@micromag/transforms 0.2.286

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,2157 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
+ import { validate as validate$1, stripTags } from '@micromag/transforms/utils';
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import isString from 'lodash/isString';
5
+ import isInteger from 'lodash/isInteger';
6
+ import isNumber from 'lodash/isNumber';
7
+ import isEmpty from 'lodash/isEmpty';
8
+ import hash from 'object-hash';
9
+
10
+ var getArticleComponents = function getArticleComponents(story) {
11
+ var _ref = story || {},
12
+ _ref$title = _ref.title,
13
+ title = _ref$title === void 0 ? null : _ref$title,
14
+ _ref$metadata = _ref.metadata,
15
+ metadata = _ref$metadata === void 0 ? {} : _ref$metadata,
16
+ _ref$components = _ref.components,
17
+ components = _ref$components === void 0 ? [] : _ref$components;
18
+
19
+ var _ref2 = metadata || {},
20
+ _ref2$description = _ref2.description,
21
+ description = _ref2$description === void 0 ? 'Ma description' : _ref2$description;
22
+
23
+ var heading1 = title ? {
24
+ role: 'heading1',
25
+ text: title,
26
+ format: 'html'
27
+ } : null;
28
+ var heading2 = description ? {
29
+ role: 'heading2',
30
+ text: description,
31
+ format: 'html'
32
+ } : null;
33
+ var titleScreen = components.reduce(function (comp, next, i) {
34
+ if (comp === null && i < 3) {
35
+ if (next.type.indexOf('title') !== false) {
36
+ return next;
37
+ }
38
+ }
39
+
40
+ return comp;
41
+ }, null);
42
+ var imageComponent = null;
43
+
44
+ if (titleScreen !== null) {
45
+ var _ref3 = titleScreen || {},
46
+ _ref3$image = _ref3.image,
47
+ image = _ref3$image === void 0 ? null : _ref3$image,
48
+ _ref3$background = _ref3.background,
49
+ background = _ref3$background === void 0 ? null : _ref3$background;
50
+
51
+ if (image !== null) {
52
+ imageComponent = {
53
+ role: 'image',
54
+ URL: image.url
55
+ };
56
+ } else if (background !== null && background.image !== null) {
57
+ imageComponent = {
58
+ role: 'image',
59
+ URL: background.image.url
60
+ };
61
+ }
62
+ }
63
+
64
+ var headerComponents = [imageComponent, heading1, heading2].filter(function (it) {
65
+ return it !== null;
66
+ });
67
+ return {
68
+ components: headerComponents.length > 0 ? [{
69
+ role: 'header',
70
+ components: headerComponents,
71
+ layout: 'header'
72
+ }] : []
73
+ };
74
+ };
75
+
76
+ var name$f = "Format\\TextStyle";
77
+ var description$f = "The object for defining the text style (font family, size, color, and so on) that you can apply to ranges of text.";
78
+ var version$f = "1.7+";
79
+ var from_class$f = null;
80
+ var typed$f = null;
81
+ var url$f = "https://developer.apple.com/documentation/apple_news/textstyle";
82
+ var properties$f = [{
83
+ name: "backgroundColor",
84
+ type: "Color",
85
+ required: false,
86
+ description: "The background color for text lines. The value defaults to transparent.",
87
+ typed: false
88
+ }, {
89
+ name: "conditional",
90
+ type: "array:Format\\ConditionalTextStyle",
91
+ required: false,
92
+ description: "An array of text style properties that can be applied conditionally, and the conditions that cause them to be applied.",
93
+ typed: false
94
+ }, {
95
+ name: "fontFamily",
96
+ type: "string",
97
+ required: false,
98
+ description: "The font family to use for text rendering, for example Gill Sans. Using a combination of fontFamily, fontWeight, fontWidth and fontStyle you can define the appearance of the text. News automatically selects the appropriate font variant from the available variants in that family.",
99
+ typed: false
100
+ }, {
101
+ name: "fontName",
102
+ type: "string",
103
+ required: false,
104
+ description: "The fontName to refer to an explicit font variant’s PostScript name, such as GillSans-Bold. Alternatively, you can use a combination of fontFamily, fontWeight, fontWidth and/or fontStyle to have News automatically select the appropriate variant depending on the text formatting used.",
105
+ typed: false
106
+ }, {
107
+ name: "fontSize",
108
+ type: "integer",
109
+ required: false,
110
+ description: "The size of the font, in points. By default, the font size will be inherited from a parent component or a default style. As a best practice, try not to go below 16 points for body text. The fontSize may be automatically resized for different device sizes or for iOS devices with Larger Accessibility Sizes enabled.",
111
+ typed: false
112
+ }, {
113
+ name: "fontStyle",
114
+ type: "enum:string",
115
+ required: false,
116
+ description: "The font style to apply for the selected font.",
117
+ enum_values: ["normal", "italic", "oblique"],
118
+ typed: false
119
+ }, {
120
+ name: "fontWeight",
121
+ type: "enum:integer|string",
122
+ required: false,
123
+ description: "The font weight to apply for font selection. In addition to explicit weights (named or numerical), lighter and bolder are available, to set text in a lighter or bolder font as compared to its surrounding text.",
124
+ enum_values: [100, 200, 300, 400, 500, 600, 700, 800, 900, "thin", "extra-light", "extralight", "ultra-light", "light", "regular", "normal", "book", "roman", "medium", "semi-bold", "semibold", "demi-bold", "demibold", "bold", "extra-bold", "extrabold", "ultra-bold", "ultrabold", "black", "heavy", "lighter", "bolder"],
125
+ typed: false
126
+ }, {
127
+ name: "fontWidth",
128
+ type: "enum:string",
129
+ required: false,
130
+ description: "The font width for font selection (known in CSS as font-stretch). Defines the width characteristics of a font variant between normal, condensed and expanded. Some font families have separate families assigned for different widths (for example, Avenir Next and Avenir Next Condensed), so make sure that the fontFamily you select supports the specified fontWidth.",
131
+ enum_values: ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"],
132
+ typed: false
133
+ }, {
134
+ name: "orderedListItems",
135
+ type: "Format\\ListItemStyle",
136
+ required: false,
137
+ description: "An object for use with text components with HTML markup. You can create text styles containing an orderedListItems definition to configure how list items inside <ol> tags should be displayed.",
138
+ typed: false
139
+ }, {
140
+ name: "strikethrough",
141
+ type: ["Format\\TextDecoration", "boolean"],
142
+ required: false,
143
+ description: "The text strikethrough. Set strikethrough to true to use the text color inherited from the textColor property as the strikethrough color, or provide a text decoration definition with a different color. By default strikethrough is omitted (false).",
144
+ typed: false
145
+ }, {
146
+ name: "stroke",
147
+ type: "Format\\TextStrokeStyle",
148
+ required: false,
149
+ description: "The stroke style for the text outline. By default, stroke will be omitted.",
150
+ typed: false
151
+ }, {
152
+ name: "textColor",
153
+ type: "Color",
154
+ required: false,
155
+ description: "The text color.",
156
+ typed: false
157
+ }, {
158
+ name: "textShadow",
159
+ type: "Format\\Shadow",
160
+ required: false,
161
+ description: "The text shadow for this style.",
162
+ typed: false
163
+ }, {
164
+ name: "textTransform",
165
+ type: "enum:string",
166
+ required: false,
167
+ description: "The transform to apply to the text.",
168
+ enum_values: ["uppercase", "lowercase", "capitalize", "none"],
169
+ typed: false
170
+ }, {
171
+ name: "tracking",
172
+ type: "number",
173
+ required: false,
174
+ description: "The amount of tracking (spacing between characters) in text, as a percentage of the fontSize. The actual spacing between letters is determined by combining information from the font and font size.",
175
+ "default": 0,
176
+ typed: false
177
+ }, {
178
+ name: "underline",
179
+ type: ["Format\\TextDecoration", "boolean"],
180
+ required: false,
181
+ description: "The text underlining. This style can be used for links. Set underline to true to use the text color as the underline color, or provide a text decoration with a different color. By default underline is omitted (false).",
182
+ typed: false
183
+ }, {
184
+ name: "unorderedListItems",
185
+ type: "Format\\ListItemStyle",
186
+ required: false,
187
+ description: "An object for use with text components with HTML markup. You can create text styles containing an unorderedListItems definition to configure how list items inside <ul> tags should be displayed.",
188
+ typed: false
189
+ }, {
190
+ name: "verticalAlignment",
191
+ type: "enum:string",
192
+ required: false,
193
+ description: "The vertical alignment of the text. You can use this property for superscripts and subscripts.",
194
+ enum_values: ["superscript", "subscript", "baseline"],
195
+ typed: false
196
+ }];
197
+ var TextStyleDefinition = {
198
+ name: name$f,
199
+ description: description$f,
200
+ version: version$f,
201
+ from_class: from_class$f,
202
+ "extends": null,
203
+ typed: typed$f,
204
+ url: url$f,
205
+ properties: properties$f
206
+ };
207
+
208
+ var TextStyle = function TextStyle() {
209
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
210
+ _ref$fontFamily = _ref.fontFamily,
211
+ fontFamily = _ref$fontFamily === void 0 ? null : _ref$fontFamily,
212
+ _ref$fontSize = _ref.fontSize,
213
+ fontSize = _ref$fontSize === void 0 ? null : _ref$fontSize,
214
+ _ref$lineHeight = _ref.lineHeight,
215
+ lineHeight = _ref$lineHeight === void 0 ? null : _ref$lineHeight,
216
+ _ref$color = _ref.color,
217
+ color = _ref$color === void 0 ? null : _ref$color;
218
+
219
+ var content = {
220
+ fontFamily: fontFamily,
221
+ fontSize: fontSize,
222
+ lineHeight: lineHeight ? Math.floor(fontSize * lineHeight) : null,
223
+ textColor: color && color.color ? color.color : null
224
+ };
225
+ return validate$1(content, TextStyleDefinition);
226
+ };
227
+
228
+ var getArticleTextStyles = function getArticleTextStyles() {
229
+ // const { theme = {} } = story || {};
230
+ // const { textStyle = {} } = theme || {};
231
+ // const { heading1 = {}, text = {} } = textStyle || {};
232
+ // const titleStyles = TextStyle(heading1);
233
+ // const textStyles = TextStyle(text);
234
+ var fontSize = 18;
235
+ var lineHeight = 1.35;
236
+ var titleStyles = TextStyle({
237
+ fontFamily: 'Futura',
238
+ // stylelint-disable-line
239
+ fontSize: fontSize * 2,
240
+ fontWeight: 'bold',
241
+ lineHeight: lineHeight
242
+ });
243
+ var textStyles = TextStyle({
244
+ fontFamily: 'Palatino',
245
+ // stylelint-disable-line
246
+ fontSize: fontSize,
247
+ lineHeight: lineHeight
248
+ });
249
+ return {
250
+ componentTextStyles: {
251
+ "default": _objectSpread({
252
+ textColor: '#000',
253
+ linkStyle: {
254
+ textColor: '#F0F',
255
+ underline: true
256
+ }
257
+ }, textStyles !== null ? textStyles : {}),
258
+ 'default-heading1': _objectSpread(_objectSpread({}, titleStyles !== null ? titleStyles : {}), {}, {
259
+ fontSize: fontSize * 2,
260
+ lineHeight: 36,
261
+ fontWeight: 'regular',
262
+ fontWidth: 'expanded',
263
+ textTransform: 'uppercase'
264
+ }),
265
+ 'default-heading2': _objectSpread(_objectSpread({}, titleStyles !== null ? titleStyles : {}), {}, {
266
+ fontSize: 26,
267
+ fontWeight: 'regular',
268
+ fontWidth: 'expanded',
269
+ textTransform: 'uppercase'
270
+ }),
271
+ 'default-title': _objectSpread(_objectSpread({}, titleStyles !== null ? titleStyles : {}), {}, {
272
+ fontSize: 26,
273
+ fontWeight: 'regular',
274
+ fontWidth: 'expanded',
275
+ textTransform: 'uppercase'
276
+ }),
277
+ 'default-body': _objectSpread({}, textStyles !== null ? textStyles : {}),
278
+ 'default-text': _objectSpread({}, textStyles !== null ? textStyles : {}),
279
+ 'default-quote': _objectSpread(_objectSpread({}, textStyles !== null ? textStyles : {}), {}, {
280
+ fontSize: 26
281
+ }),
282
+ 'style-author': _objectSpread(_objectSpread({}, textStyles !== null ? textStyles : {}), {}, {
283
+ fontStyle: 'italic'
284
+ })
285
+ }
286
+ };
287
+ };
288
+
289
+ var name$e = "Format\\Layout";
290
+ var description$e = "The object for defining columns, gutters, and margins for your article’s designed width.";
291
+ var version$e = "1.7+";
292
+ var from_class$e = null;
293
+ var typed$e = null;
294
+ var url$e = "https://developer.apple.com/documentation/apple_news/layout";
295
+ var properties$e = [{
296
+ name: "columns",
297
+ type: "integer",
298
+ required: true,
299
+ description: "The number of columns this article was designed for. You must have at least one column.",
300
+ minimum: 1,
301
+ typed: false
302
+ }, {
303
+ name: "width",
304
+ type: "integer",
305
+ required: true,
306
+ description: "The width (in points) this article was designed for. This property is used to calculate down-scaling scenarios for smaller devices.",
307
+ minimum: 1,
308
+ typed: false
309
+ }, {
310
+ name: "gutter",
311
+ type: "integer",
312
+ required: false,
313
+ description: "The gutter size for the article (in points). The gutter provides spacing between columns. This property should always be an even number; odd numbers are rounded up to the next even number. If this property is omitted, a default gutter size of 20 is applied. If the gutter is negative, the number will be set to 0.",
314
+ "default": 20,
315
+ minimum: 0,
316
+ typed: false
317
+ }, {
318
+ name: "margin",
319
+ type: "integer",
320
+ required: false,
321
+ description: "The outer (left and right) margins of the article, in points. If this property is omitted, a default article margin of 60 is applied. If the margin is negative, the number is set to 0. If the margin is greater than or equal to the width/2, the article delivery fails.",
322
+ "default": 60,
323
+ minimum: 0,
324
+ typed: false
325
+ }];
326
+ var LayoutDefinition = {
327
+ name: name$e,
328
+ description: description$e,
329
+ version: version$e,
330
+ from_class: from_class$e,
331
+ "extends": null,
332
+ typed: typed$e,
333
+ url: url$e,
334
+ properties: properties$e
335
+ };
336
+
337
+ var Layout = function Layout() {
338
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
339
+ _ref$columns = _ref.columns,
340
+ columns = _ref$columns === void 0 ? 8 : _ref$columns,
341
+ _ref$width = _ref.width,
342
+ width = _ref$width === void 0 ? 768 : _ref$width,
343
+ _ref$margin = _ref.margin,
344
+ margin = _ref$margin === void 0 ? 60 : _ref$margin,
345
+ _ref$gutter = _ref.gutter,
346
+ gutter = _ref$gutter === void 0 ? 20 : _ref$gutter;
347
+
348
+ var content = {
349
+ columns: columns,
350
+ width: width,
351
+ margin: margin,
352
+ gutter: gutter
353
+ };
354
+ return validate$1(content, LayoutDefinition);
355
+ };
356
+
357
+ var name$d = "Format\\ComponentLayout";
358
+ var description$d = "The object for defining the positioning for a specific component within the article’s column system.";
359
+ var version$d = "1.7+";
360
+ var from_class$d = null;
361
+ var typed$d = null;
362
+ var url$d = "https://developer.apple.com/documentation/apple_news/componentlayout";
363
+ var properties$d = [{
364
+ name: "columnSpan",
365
+ type: "integer",
366
+ required: false,
367
+ description: "A number that indicates how many columns the component spans, based on the number of columns in the document.",
368
+ minimum: 1,
369
+ typed: false
370
+ }, {
371
+ name: "columnStart",
372
+ type: "integer",
373
+ required: false,
374
+ description: "A number that indicates which column the component‘s start position is in, based on the number of columns in the document or parent container.",
375
+ minimum: 0,
376
+ typed: false
377
+ }, {
378
+ name: "conditional",
379
+ type: "array:Format\\ConditionalComponentLayout",
380
+ required: false,
381
+ description: "An array of component layout properties that can be applied conditionally, and the conditions that cause them to be applied.",
382
+ typed: false
383
+ }, {
384
+ name: "contentInset",
385
+ type: ["Format\\ContentInset", "boolean"],
386
+ required: false,
387
+ description: "A value that defines a content inset for the component. If applied, the inset is equivalent to half the document gutter. For example, if the article's layout sets the document gutter to 40pt, the content inset is 20 points.",
388
+ typed: false
389
+ }, {
390
+ name: "horizontalContentAlignment",
391
+ type: "enum:string",
392
+ required: false,
393
+ description: "A string value that sets the alignment of the content within the component. This property applies only when the width of the content is less than the width of the component.",
394
+ "default": "center",
395
+ enum_values: ["left", "center", "right"],
396
+ typed: false
397
+ }, {
398
+ name: "ignoreDocumentGutter",
399
+ type: "enum:boolean|string",
400
+ required: false,
401
+ description: "A value that indicates whether the gutters (if any) to the left and right of the component should be ignored. The gutter size is defined in the Layout object at the root level of the document.",
402
+ enum_values: ["none", "left", "right", "both", true, false],
403
+ typed: false
404
+ }, {
405
+ name: "ignoreDocumentMargin",
406
+ type: "enum:boolean|string",
407
+ required: false,
408
+ description: "A value that indicates whether a document’s margins should be respected or ignored by the parent container. Ignoring document margins will position the component at the edge of the display. This property affects the layout only if the component is in the first or last column.",
409
+ enum_values: ["none", "left", "right", "both", true, false],
410
+ typed: false
411
+ }, {
412
+ name: "margin",
413
+ type: ["Format\\Margin", "integer"],
414
+ required: false,
415
+ description: "A value that sets the margins for the top and bottom of the component, as a single integer that gets applied to the top and bottom margins, or as an object containing separate properties for top and bottom.",
416
+ typed: false
417
+ }, {
418
+ name: "maximumContentWidth",
419
+ type: ["SupportedUnits", "integer"],
420
+ required: false,
421
+ description: "A value that sets the maximum width of the content within the component. Specify this value as an integer in points or using one of the available units of measure for components. See Specifying Measurements for Components.",
422
+ typed: false
423
+ }, {
424
+ name: "minimumHeight",
425
+ type: ["SupportedUnits", "integer"],
426
+ required: false,
427
+ description: "A value that sets the minimum height of the component. A component is taller than its defined minimumHeight when the contents require the component to be taller. The minimum height can be defined as an integer in points or using one of the available units of measure for components. See Specifying Measurements for Components.",
428
+ typed: false
429
+ }, {
430
+ name: "minimumWidth",
431
+ type: ["SupportedUnits", "integer"],
432
+ required: false,
433
+ description: "A value that defines the minimum width of the layout when used within a Container with HorizontalStackDisplay as the specified contentDisplay type. The minimum width can be defined as an integer in points or using one of the available units of measure for components. See Specifying Measurements for Components.",
434
+ typed: false
435
+ }, {
436
+ name: "maximumWidth",
437
+ type: ["SupportedUnits", "integer"],
438
+ required: false,
439
+ description: "A value that defines the maximum width of the layout when used within a Container with HorizontalStackDisplay as the specified contentDisplay type. The maximum width can be defined as an integer in points or using one of the available units of measure for components. See Specifying Measurements for Components.",
440
+ typed: false
441
+ }, {
442
+ name: "padding",
443
+ type: ["Format\\Padding", "SupportedUnits", "integer"],
444
+ required: false,
445
+ description: "A value that defines the padding between the content of the component and the edges of the component. Padding can be defined as an integer in points or using one of the available units of measure for components. See Specifying Measurements for Components.",
446
+ typed: false
447
+ }];
448
+ var ComponentLayoutDefinition = {
449
+ name: name$d,
450
+ description: description$d,
451
+ version: version$d,
452
+ from_class: from_class$d,
453
+ "extends": null,
454
+ typed: typed$d,
455
+ url: url$d,
456
+ properties: properties$d
457
+ };
458
+
459
+ var ComponentLayout = function ComponentLayout() {
460
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
461
+ _ref$columnStart = _ref.columnStart,
462
+ columnStart = _ref$columnStart === void 0 ? 0 : _ref$columnStart,
463
+ _ref$columnSpan = _ref.columnSpan,
464
+ columnSpan = _ref$columnSpan === void 0 ? 12 : _ref$columnSpan,
465
+ _ref$marginTop = _ref.marginTop,
466
+ marginTop = _ref$marginTop === void 0 ? 0 : _ref$marginTop,
467
+ _ref$marginBottom = _ref.marginBottom,
468
+ marginBottom = _ref$marginBottom === void 0 ? 20 : _ref$marginBottom;
469
+
470
+ var content = {
471
+ columnStart: columnStart,
472
+ columnSpan: columnSpan,
473
+ margin: {
474
+ top: marginTop,
475
+ bottom: marginBottom
476
+ }
477
+ };
478
+ return validate$1(content, ComponentLayoutDefinition);
479
+ };
480
+
481
+ var getArticleLayouts = function getArticleLayouts() {
482
+ // const { theme = {} } = newStory || {};
483
+ // const { textStyle = {} } = theme || {};
484
+ // const { heading1 = {}, text = {} } = textStyle || {};
485
+ // const titleStyles = TextStyle(heading1);
486
+ var layoutStyles = Layout();
487
+ var componentLayoutStyles = ComponentLayout();
488
+ var defaultMargin = 20;
489
+ return {
490
+ layout: _objectSpread({}, layoutStyles !== null ? layoutStyles : {}),
491
+ componentLayouts: {
492
+ "default": _objectSpread({}, componentLayoutStyles !== null ? componentLayoutStyles : {}),
493
+ container: {
494
+ margin: {
495
+ bottom: 40
496
+ }
497
+ },
498
+ header: {
499
+ ignoreDocumentMargin: true,
500
+ ignoreDocumentGutter: true,
501
+ margin: {
502
+ bottom: 40
503
+ }
504
+ },
505
+ title: {
506
+ margin: {
507
+ bottom: 10
508
+ }
509
+ },
510
+ heading1: {
511
+ margin: {
512
+ bottom: 10
513
+ }
514
+ },
515
+ heading2: {
516
+ margin: {
517
+ bottom: 10
518
+ }
519
+ },
520
+ text: {
521
+ margin: {
522
+ bottom: defaultMargin
523
+ }
524
+ },
525
+ photo: {
526
+ margin: {
527
+ bottom: defaultMargin
528
+ }
529
+ },
530
+ image: {
531
+ margin: {
532
+ bottom: defaultMargin
533
+ }
534
+ },
535
+ gallery: {
536
+ margin: {
537
+ bottom: defaultMargin
538
+ }
539
+ },
540
+ mosaic: {
541
+ margin: {
542
+ bottom: defaultMargin
543
+ }
544
+ },
545
+ audio: {
546
+ margin: {
547
+ bottom: defaultMargin
548
+ }
549
+ },
550
+ video: {
551
+ margin: {
552
+ bottom: defaultMargin
553
+ }
554
+ },
555
+ map: {
556
+ margin: {
557
+ bottom: defaultMargin
558
+ }
559
+ },
560
+ quote: {
561
+ columnStart: 1,
562
+ columnSpan: 5,
563
+ contentInset: {
564
+ left: false
565
+ },
566
+ margin: {
567
+ right: 20,
568
+ bottom: defaultMargin
569
+ }
570
+ }
571
+ }
572
+ };
573
+ };
574
+
575
+ var name$c = "Format\\DocumentStyle";
576
+ var description$c = "The object for setting the background color for your article.";
577
+ var version$c = "1.7+";
578
+ var from_class$c = null;
579
+ var typed$c = null;
580
+ var url$c = "https://developer.apple.com/documentation/apple_news/documentstyle";
581
+ var properties$c = [{
582
+ name: "backgroundColor",
583
+ type: "Color",
584
+ required: false,
585
+ description: "The article’s background color. The value defaults to white.",
586
+ typed: false
587
+ }];
588
+ var DocumentStyleDefinition = {
589
+ name: name$c,
590
+ description: description$c,
591
+ version: version$c,
592
+ from_class: from_class$c,
593
+ "extends": null,
594
+ typed: typed$c,
595
+ url: url$c,
596
+ properties: properties$c
597
+ };
598
+
599
+ var DocumentStyle = function DocumentStyle() {
600
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
601
+ _ref$backgroundColor = _ref.backgroundColor,
602
+ backgroundColor = _ref$backgroundColor === void 0 ? null : _ref$backgroundColor;
603
+
604
+ var content = {
605
+ backgroundColor: backgroundColor
606
+ };
607
+ return validate$1(content, DocumentStyleDefinition);
608
+ };
609
+
610
+ var getArticleDocumentStyle = function getArticleDocumentStyle() {
611
+ var documentStyle = DocumentStyle({
612
+ backgroundColor: '#FFF'
613
+ });
614
+ return {
615
+ documentStyle: documentStyle
616
+ };
617
+ };
618
+
619
+ var name$b = "Format\\ArticleDocument";
620
+ var description$b = "The root object of an Apple News article, containing required properties, metadata, content, layout, and styles.";
621
+ var version$b = "1.7+";
622
+ var from_class$b = null;
623
+ var typed$b = null;
624
+ var url$b = "https://developer.apple.com/documentation/apple_news/articledocument";
625
+ var properties$b = [{
626
+ name: "components",
627
+ type: "array:Format\\Component",
628
+ required: true,
629
+ description: "An array of components that form the content of this article. Components have different roles and types, such as Photo and Music.",
630
+ typed: true
631
+ }, {
632
+ name: "componentTextStyles",
633
+ type: "Format\\ComponentTextStyles",
634
+ required: true,
635
+ description: "The component text styles that can be referred to by components in this document. Each article.json file must have, at minimum, a default component text style named default. Defaults by component role can also be set. See Defining and Using Text Styles.",
636
+ typed: false
637
+ }, {
638
+ name: "identifier",
639
+ type: "string",
640
+ required: true,
641
+ description: "An unique, publisher-provided identifier for this article. This identifier must remain constant; it cannot change when the article is updated.",
642
+ typed: false
643
+ }, {
644
+ name: "language",
645
+ type: "string",
646
+ required: true,
647
+ description: "A code that indicates the language of the article. Use the IANA.org language subtag registry to find the appropriate code; e.g., en for English, or the more specific en_UK for English (U.K.) or en_US for English (U.S.).",
648
+ typed: false
649
+ }, {
650
+ name: "layout",
651
+ type: "Format\\Layout",
652
+ required: true,
653
+ description: "The article’s column system. Apple News Format layouts make it possible to recreate print design on iPhone, iPad, iPod touch and Mac. Layout information is also used to calculate relative positioning and size for these devices. See Planning the Layout for Your Article.",
654
+ typed: false
655
+ }, {
656
+ name: "title",
657
+ type: "string",
658
+ required: true,
659
+ description: "The article title or headline. Should be plain text; formatted text (HTML or Markdown) is not supported.",
660
+ typed: false
661
+ }, {
662
+ name: "version",
663
+ type: "string",
664
+ required: true,
665
+ description: "The version of Apple News Format used in the JSON document.",
666
+ typed: false
667
+ }, {
668
+ name: "advertisingSettings",
669
+ type: "Format\\AdvertisingSettings",
670
+ required: false,
671
+ description: "An advertisement to be inserted at a position that is both possible and optimal. You can specify what bannerType you want to have automatically inserted.",
672
+ typed: false
673
+ }, {
674
+ name: "autoplacement",
675
+ type: "Format\\AutoPlacement",
676
+ required: false,
677
+ description: "The metadata, appearance, and placement of advertising and related content components within Apple News Format articles.",
678
+ typed: false
679
+ }, {
680
+ name: "componentLayouts",
681
+ type: "Format\\ComponentLayouts",
682
+ required: false,
683
+ description: "The article-level ComponentLayout objects that can be referred to by their key within the ComponentLayouts object. See Positioning the Content in Your Article.",
684
+ typed: false
685
+ }, {
686
+ name: "componentStyles",
687
+ type: "Format\\ComponentStyles",
688
+ required: false,
689
+ description: "The component styles that can be referred to by components within this document. See Enhancing Your Articles with Styles.",
690
+ typed: false
691
+ }, {
692
+ name: "documentStyle",
693
+ type: "Format\\DocumentStyle",
694
+ required: false,
695
+ description: "An object containing the background color of the article.",
696
+ typed: false
697
+ }, {
698
+ name: "metadata",
699
+ type: "Format\\Metadata",
700
+ required: false,
701
+ description: "The article's metadata, such as publication date, ad campaign data, and other information that is not part of the core article content.",
702
+ typed: false
703
+ }, {
704
+ name: "subtitle",
705
+ type: "string",
706
+ required: false,
707
+ description: "The article subtitle. Should be plain text; formatted text (HTML or Markdown) is not supported.",
708
+ typed: false
709
+ }, {
710
+ name: "textStyles",
711
+ type: "Format\\TextStyles",
712
+ required: false,
713
+ description: "The TextStyle objects available to use inline for text in Text components. See Using HTML with Apple News Format, Using Markdown with Apple News Format, and InlineTextStyle.",
714
+ typed: false
715
+ }];
716
+ var ArticleDefinition = {
717
+ name: name$b,
718
+ description: description$b,
719
+ version: version$b,
720
+ from_class: from_class$b,
721
+ "extends": null,
722
+ typed: typed$b,
723
+ url: url$b,
724
+ properties: properties$b
725
+ };
726
+
727
+ var validate = function validate() {
728
+ var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
729
+ var definition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
730
+ var validated = content ? Object.keys(content).reduce(function (values, name) {
731
+ var value = content[name] || null; // Find the reference
732
+
733
+ if (definition && definition.properties) {
734
+ var property = definition.properties.find(function (prop) {
735
+ return prop.name === name;
736
+ }) || null;
737
+
738
+ if (property !== null) {
739
+ var isValid = true;
740
+
741
+ switch (property.type) {
742
+ case 'string':
743
+ isValid = isString(value);
744
+ break;
745
+
746
+ case 'integer':
747
+ isValid = isInteger(value);
748
+ break;
749
+
750
+ case 'float':
751
+ isValid = isNumber(value);
752
+ break;
753
+
754
+ default:
755
+ isValid = value !== null;
756
+ break;
757
+ } // Skip the whole thing it cause it aint gonna work
758
+
759
+
760
+ if (!isValid && property.required) {
761
+ console.log('VALIDATION ERROR: SKIPPED BECAUSE REQUIRED', content, name); // eslint-disable-line
762
+
763
+ return null;
764
+ }
765
+
766
+ if (values !== null && isValid) {
767
+ return _objectSpread(_objectSpread({}, values), {}, _defineProperty({}, name, value));
768
+ }
769
+
770
+ console.log('VALIDATION ERROR: VALID TYPE', name, content); // eslint-disable-line
771
+ }
772
+ }
773
+
774
+ return values;
775
+ }, {}) : {};
776
+ return !isEmpty(validated) ? validated : null;
777
+ };
778
+
779
+ var Article = function Article(story, settings) {
780
+ // console.log('ARTICLE', story); // eslint-disable-line
781
+ var _story$title = story.title,
782
+ title = _story$title === void 0 ? 'Article' : _story$title;
783
+
784
+ var _ref = settings || {},
785
+ _ref$identifier = _ref.identifier,
786
+ identifier = _ref$identifier === void 0 ? 'testArticle' : _ref$identifier;
787
+
788
+ var content = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
789
+ title: title,
790
+ version: "".concat(1, ".0").toString(),
791
+ // Note: for some reason only 1.0 works
792
+ identifier: identifier,
793
+ language: 'fr',
794
+ layout: {},
795
+ documentStyle: {},
796
+ components: [],
797
+ componentStyles: {},
798
+ componentTextStyles: {},
799
+ componentLayouts: {}
800
+ }, getArticleDocumentStyle()), getArticleTextStyles()), getArticleLayouts()), getArticleComponents(story)); // console.log('KONTENT', content);
801
+
802
+
803
+ return validate(content, ArticleDefinition);
804
+ };
805
+
806
+ var name$a = "Format\\Audio";
807
+ var description$a = "The component for adding a playable audio clip.";
808
+ var version$a = "1.7+";
809
+ var from_class$a = null;
810
+ var typed$a = null;
811
+ var url$a = "https://developer.apple.com/documentation/apple_news/audio";
812
+ var properties$a = [{
813
+ name: "role",
814
+ type: "string",
815
+ required: true,
816
+ description: "Always audio for this component.",
817
+ value: "audio",
818
+ read_only: true,
819
+ typed: false
820
+ }, {
821
+ name: "URL",
822
+ type: "uri",
823
+ required: true,
824
+ description: "The URL of an audio file (http or https only). This component supports all AVPlayer audio formats, including the following:",
825
+ typed: false
826
+ }, {
827
+ name: "accessibilityCaption",
828
+ type: "string",
829
+ required: false,
830
+ description: "A caption that describes the content of the audio file. The text is used for VoiceOver for iOS and VoiceOver for macOS. If accessibilityCaption is not provided, the caption value is used for VoiceOver for iOS and VoiceOver for macOS.",
831
+ typed: false
832
+ }, {
833
+ name: "anchor",
834
+ type: "Format\\Anchor",
835
+ required: false,
836
+ description: "An object that defines vertical alignment with another component.",
837
+ typed: false
838
+ }, {
839
+ name: "animation",
840
+ type: "Format\\ComponentAnimation",
841
+ required: false,
842
+ description: "An object that defines an animation to be applied to the component.",
843
+ typed: true
844
+ }, {
845
+ name: "behavior",
846
+ type: "Format\\Behavior",
847
+ required: false,
848
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
849
+ typed: true
850
+ }, {
851
+ name: "caption",
852
+ type: "string",
853
+ required: false,
854
+ description: "A caption that describes the content of the audio file. This text is also used by VoiceOver for iOS and VoiceOver for macOS if accessibilityCaption is not provided, or it can be shown when the audio cannot be played.",
855
+ typed: false
856
+ }, {
857
+ name: "conditional",
858
+ type: "array:Format\\ConditionalComponent",
859
+ required: false,
860
+ description: "An array of component properties that can be applied conditionally, and the conditions that cause them to be applied.",
861
+ typed: false
862
+ }, {
863
+ name: "explicitContent",
864
+ type: "boolean",
865
+ required: false,
866
+ description: "A Boolean value that indicates the audio may contain explicit content.",
867
+ typed: false
868
+ }, {
869
+ name: "hidden",
870
+ type: "boolean",
871
+ required: false,
872
+ description: "A Boolean value that determines whether the component is hidden.",
873
+ "default": "false",
874
+ typed: false
875
+ }, {
876
+ name: "identifier",
877
+ type: "string",
878
+ required: false,
879
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
880
+ typed: false
881
+ }, {
882
+ name: "imageURL",
883
+ type: "string",
884
+ required: false,
885
+ description: "The URL of an image file that represents the audio file, such as a cover image.",
886
+ typed: false
887
+ }, {
888
+ name: "layout",
889
+ type: ["Format\\ComponentLayout", "string"],
890
+ required: false,
891
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
892
+ typed: false
893
+ }, {
894
+ name: "style",
895
+ type: ["Format\\ComponentStyle", "string"],
896
+ required: false,
897
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
898
+ typed: false
899
+ }];
900
+ var AudioDefinition = {
901
+ name: name$a,
902
+ description: description$a,
903
+ version: version$a,
904
+ from_class: from_class$a,
905
+ "extends": "Format\\Component",
906
+ typed: typed$a,
907
+ url: url$a,
908
+ properties: properties$a
909
+ };
910
+
911
+ var MediaElement = function MediaElement(story, media) {
912
+ var role = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'audio';
913
+ var definition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
914
+ var _story$componentLayou = story.componentLayouts,
915
+ componentLayouts = _story$componentLayou === void 0 ? {} : _story$componentLayou;
916
+
917
+ var _ref = media || {},
918
+ url = _ref.url;
919
+
920
+ var content = _objectSpread(_objectSpread({
921
+ role: role
922
+ }, componentLayouts[role] ? {
923
+ layout: role
924
+ } : {}), {}, {
925
+ URL: url
926
+ });
927
+
928
+ var component = validate$1(content, definition);
929
+ return {
930
+ story: story,
931
+ component: role === 'audio' ? component : component // Figure out HLS for videos
932
+
933
+ };
934
+ };
935
+
936
+ var Audio = function Audio(story, audio) {
937
+ return MediaElement(story, audio, 'audio', AudioDefinition);
938
+ };
939
+
940
+ var name$9 = "Format\\Text";
941
+ var description$9 = "Properties shared by all text component types.";
942
+ var version$9 = "1.7+";
943
+ var from_class$9 = null;
944
+ var typed$9 = null;
945
+ var url$9 = "https://developer.apple.com/documentation/apple_news/text";
946
+ var properties$9 = [{
947
+ name: "role",
948
+ type: "string",
949
+ required: true,
950
+ description: "The role of a text component depends on the type of content it contains. For example, a PullQuote should have a role of pullquote, and for text in the article body, the role should be body. See Component.",
951
+ typed: false
952
+ }, {
953
+ name: "text",
954
+ type: "string",
955
+ required: true,
956
+ description: "The text to display in the article, including any formatting tags depending on the format property.",
957
+ typed: false
958
+ }, {
959
+ name: "additions",
960
+ type: "array:Format\\Addition",
961
+ required: false,
962
+ description: "An array of all the additions that should be applied to ranges of the component's text.",
963
+ typed: false
964
+ }, {
965
+ name: "anchor",
966
+ type: "Format\\Anchor",
967
+ required: false,
968
+ description: "An object that defines vertical alignment with another component.",
969
+ typed: false
970
+ }, {
971
+ name: "animation",
972
+ type: "Format\\ComponentAnimation",
973
+ required: false,
974
+ description: "An object that defines an animation to be applied to the component.",
975
+ typed: true
976
+ }, {
977
+ name: "behavior",
978
+ type: "Format\\Behavior",
979
+ required: false,
980
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
981
+ typed: true
982
+ }, {
983
+ name: "conditional",
984
+ type: "array:Format\\ConditionalText",
985
+ required: false,
986
+ description: "An array of text component properties that can be applied conditionally, and the conditions that cause them to be applied.",
987
+ typed: false
988
+ }, {
989
+ name: "format",
990
+ type: "enum:string",
991
+ required: false,
992
+ description: "The formatting or markup method applied to the text.",
993
+ "default": "none",
994
+ enum_values: ["markdown", "html", "none"],
995
+ typed: false
996
+ }, {
997
+ name: "hidden",
998
+ type: "boolean",
999
+ required: false,
1000
+ description: "A Boolean value that determines whether the component is hidden.",
1001
+ "default": "false",
1002
+ typed: false
1003
+ }, {
1004
+ name: "identifier",
1005
+ type: "string",
1006
+ required: false,
1007
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1008
+ typed: false
1009
+ }, {
1010
+ name: "inlineTextStyles",
1011
+ type: "array:Format\\InlineTextStyle",
1012
+ required: false,
1013
+ description: "An array of InlineTextStyle objects you can use to apply different text styles to ranges of text. For each InlineTextStyle, you should supply a rangeStart, rangeLength, and either a text style or the identifier of a text style that is defined at the top level of the document.",
1014
+ typed: false
1015
+ }, {
1016
+ name: "layout",
1017
+ type: ["Format\\ComponentLayout", "string"],
1018
+ required: false,
1019
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout that is defined at the top level of the document.",
1020
+ typed: false
1021
+ }, {
1022
+ name: "style",
1023
+ type: ["Format\\ComponentStyle", "string"],
1024
+ required: false,
1025
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1026
+ typed: false
1027
+ }, {
1028
+ name: "textStyle",
1029
+ type: ["Format\\ComponentTextStyle", "string"],
1030
+ required: false,
1031
+ description: "An inline ComponentTextStyle object that contains styling information, or a string reference to a ComponentTextStyle object that is defined at the top level of the document.",
1032
+ typed: false
1033
+ }];
1034
+ var TextDefinition = {
1035
+ name: name$9,
1036
+ description: description$9,
1037
+ version: version$9,
1038
+ from_class: from_class$9,
1039
+ "extends": "Format\\Component",
1040
+ typed: typed$9,
1041
+ url: url$9,
1042
+ properties: properties$9
1043
+ };
1044
+
1045
+ var TextElement = function TextElement(story, text) {
1046
+ var role = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'text';
1047
+ var definition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1048
+ var props = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1049
+ var _story$componentLayou = story.componentLayouts,
1050
+ componentLayouts = _story$componentLayou === void 0 ? {} : _story$componentLayou;
1051
+
1052
+ var _ref = text || {},
1053
+ _ref$body = _ref.body,
1054
+ body = _ref$body === void 0 ? null : _ref$body,
1055
+ _ref$textStyle = _ref.textStyle,
1056
+ textStyle = _ref$textStyle === void 0 ? null : _ref$textStyle;
1057
+
1058
+ var style = textStyle ? TextStyle(textStyle) : null;
1059
+ var styleName = style !== null ? hash(style) : null;
1060
+ var hasStyle = style !== null && styleName !== null;
1061
+
1062
+ var content = _objectSpread(_objectSpread({
1063
+ role: role
1064
+ }, componentLayouts[role] ? {
1065
+ layout: role
1066
+ } : {}), {}, {
1067
+ text: body,
1068
+ format: 'html'
1069
+ }, props);
1070
+
1071
+ var component = definition ? validate$1(content, definition) : null;
1072
+ return {
1073
+ story: _objectSpread(_objectSpread({}, story), {}, {
1074
+ componentStyles: _objectSpread(_objectSpread({}, story.componentStyles || {}), component !== null && hasStyle ? _defineProperty({}, styleName, style) : {})
1075
+ }),
1076
+ component: component
1077
+ };
1078
+ };
1079
+
1080
+ var Author = function Author(story, text) {
1081
+ return TextElement(story, text, 'text', TextDefinition, {
1082
+ textStyle: 'style-author'
1083
+ });
1084
+ };
1085
+
1086
+ var name$8 = "Format\\Container";
1087
+ var description$8 = "Properties shared by all container types.";
1088
+ var version$8 = "1.7+";
1089
+ var from_class$8 = null;
1090
+ var typed$8 = null;
1091
+ var url$8 = "https://developer.apple.com/documentation/apple_news/container";
1092
+ var properties$8 = [{
1093
+ name: "role",
1094
+ type: "string",
1095
+ required: true,
1096
+ description: "Always container for this component.",
1097
+ value: "container",
1098
+ read_only: true,
1099
+ typed: false
1100
+ }, {
1101
+ name: "additions",
1102
+ type: "array:Format\\ComponentLink",
1103
+ required: false,
1104
+ description: "An array of ComponentLink objects. This can be used to create a ComponentLink, allowing a link to anywhere in News. Adding a link to a container component makes the entire component interactable. Any links used in its child components are not interactable.",
1105
+ typed: false
1106
+ }, {
1107
+ name: "anchor",
1108
+ type: "Format\\Anchor",
1109
+ required: false,
1110
+ description: "An object that defines vertical alignment with another component.",
1111
+ typed: false
1112
+ }, {
1113
+ name: "animation",
1114
+ type: "Format\\ComponentAnimation",
1115
+ required: false,
1116
+ description: "An object that defines an animation to be applied to the component.",
1117
+ typed: true
1118
+ }, {
1119
+ name: "behavior",
1120
+ type: "Format\\Behavior",
1121
+ required: false,
1122
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1123
+ typed: true
1124
+ }, {
1125
+ name: "components",
1126
+ type: "array:Format\\Component",
1127
+ required: false,
1128
+ description: "An array of components to display as child components. Child components are positioned and rendered relative to their parent component.",
1129
+ typed: true
1130
+ }, {
1131
+ name: "conditional",
1132
+ type: "array:Format\\ConditionalContainer",
1133
+ required: false,
1134
+ description: "An array of container properties that can be applied conditionally, and the conditions that cause them to be applied.",
1135
+ typed: false
1136
+ }, {
1137
+ name: "contentDisplay",
1138
+ type: ["Format\\CollectionDisplay", "Format\\HorizontalStackDisplay"],
1139
+ required: false,
1140
+ description: "The object that defines the way child components should be positioned within this container component. A HorizontalStackDisplay for example, allows for displaying child components side-by-side.",
1141
+ typed: false
1142
+ }, {
1143
+ name: "hidden",
1144
+ type: "boolean",
1145
+ required: false,
1146
+ description: "A Boolean value that determines whether the component is hidden.",
1147
+ "default": "false",
1148
+ typed: false
1149
+ }, {
1150
+ name: "identifier",
1151
+ type: "string",
1152
+ required: false,
1153
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1154
+ typed: false
1155
+ }, {
1156
+ name: "layout",
1157
+ type: ["Format\\ComponentLayout", "string"],
1158
+ required: false,
1159
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
1160
+ typed: false
1161
+ }, {
1162
+ name: "style",
1163
+ type: ["Format\\ComponentStyle", "string"],
1164
+ required: false,
1165
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1166
+ typed: false
1167
+ }];
1168
+ var ContainerDefinition = {
1169
+ name: name$8,
1170
+ description: description$8,
1171
+ version: version$8,
1172
+ from_class: from_class$8,
1173
+ "extends": "Format\\Component",
1174
+ typed: typed$8,
1175
+ url: url$8,
1176
+ properties: properties$8
1177
+ };
1178
+
1179
+ var Container = function Container(story, components) {
1180
+ var content = {
1181
+ role: 'container',
1182
+ components: components
1183
+ };
1184
+ var component = validate$1(content, ContainerDefinition);
1185
+ return {
1186
+ story: story,
1187
+ component: components && components.length > 0 ? component : null
1188
+ };
1189
+ };
1190
+
1191
+ var name$7 = "Format\\Gallery";
1192
+ var description$7 = "The component for displaying a sequence of images in a specific order as a horizontal strip.";
1193
+ var version$7 = "1.7+";
1194
+ var from_class$7 = null;
1195
+ var typed$7 = null;
1196
+ var url$7 = "https://developer.apple.com/documentation/apple_news/gallery";
1197
+ var properties$7 = [{
1198
+ name: "items",
1199
+ type: "array:Format\\GalleryItem",
1200
+ required: true,
1201
+ description: "An array of the images that appear in the gallery. The order used in the array is the order of the images in the gallery. Gallery items can be JPEG (with .jpg or .jpeg extension), PNG, or GIF images.",
1202
+ typed: false
1203
+ }, {
1204
+ name: "role",
1205
+ type: "string",
1206
+ required: true,
1207
+ description: "Always gallery for this component.",
1208
+ value: "gallery",
1209
+ read_only: true,
1210
+ typed: false
1211
+ }, {
1212
+ name: "anchor",
1213
+ type: "Format\\Anchor",
1214
+ required: false,
1215
+ description: "An object that defines vertical alignment with another component.",
1216
+ typed: false
1217
+ }, {
1218
+ name: "animation",
1219
+ type: "Format\\ComponentAnimation",
1220
+ required: false,
1221
+ description: "An object that defines an animation to be applied to the component.",
1222
+ typed: true
1223
+ }, {
1224
+ name: "behavior",
1225
+ type: "Format\\Behavior",
1226
+ required: false,
1227
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1228
+ typed: true
1229
+ }, {
1230
+ name: "conditional",
1231
+ type: "array:Format\\ConditionalComponent",
1232
+ required: false,
1233
+ description: "An array of component properties that can be applied conditionally, and the conditions that cause them to be applied.",
1234
+ typed: false
1235
+ }, {
1236
+ name: "hidden",
1237
+ type: "boolean",
1238
+ required: false,
1239
+ description: "A Boolean value that determines whether the component is hidden.",
1240
+ "default": "false",
1241
+ typed: false
1242
+ }, {
1243
+ name: "identifier",
1244
+ type: "string",
1245
+ required: false,
1246
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1247
+ typed: false
1248
+ }, {
1249
+ name: "layout",
1250
+ type: ["Format\\ComponentLayout", "string"],
1251
+ required: false,
1252
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
1253
+ typed: false
1254
+ }, {
1255
+ name: "style",
1256
+ type: ["Format\\ComponentStyle", "string"],
1257
+ required: false,
1258
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1259
+ typed: false
1260
+ }];
1261
+ var GalleryDefinition = {
1262
+ name: name$7,
1263
+ description: description$7,
1264
+ version: version$7,
1265
+ from_class: from_class$7,
1266
+ "extends": "Format\\Component",
1267
+ typed: typed$7,
1268
+ url: url$7,
1269
+ properties: properties$7
1270
+ };
1271
+
1272
+ var GalleryElement = function GalleryElement(story, gallery) {
1273
+ var role = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'gallery';
1274
+ var definition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1275
+ var _story$componentLayou = story.componentLayouts,
1276
+ componentLayouts = _story$componentLayou === void 0 ? {} : _story$componentLayou;
1277
+
1278
+ var _ref = gallery || {},
1279
+ _ref$images = _ref.images,
1280
+ images = _ref$images === void 0 ? [] : _ref$images;
1281
+
1282
+ var galleryImages = images !== null ? images.map(function (image) {
1283
+ if (image == null) {
1284
+ return null;
1285
+ }
1286
+
1287
+ var _ref2 = image || {},
1288
+ _ref2$media = _ref2.media,
1289
+ media = _ref2$media === void 0 ? null : _ref2$media,
1290
+ _ref2$url = _ref2.url,
1291
+ url = _ref2$url === void 0 ? null : _ref2$url,
1292
+ _ref2$caption = _ref2.caption,
1293
+ caption = _ref2$caption === void 0 ? null : _ref2$caption;
1294
+
1295
+ var mediaUrl = media !== null && media.url ? media.url : null;
1296
+ var imageUrl = url !== null ? url : null;
1297
+ var hasUrl = imageUrl || mediaUrl;
1298
+ var imageCaption = caption !== null && caption.body ? stripTags(caption.body) : null;
1299
+ return hasUrl ? _objectSpread({
1300
+ URL: imageUrl || mediaUrl
1301
+ }, imageCaption !== null ? {
1302
+ caption: imageCaption
1303
+ } : {}) : null;
1304
+ }).filter(function (i) {
1305
+ return i !== null;
1306
+ }) : [];
1307
+
1308
+ var content = _objectSpread(_objectSpread({
1309
+ role: role
1310
+ }, componentLayouts[role] ? {
1311
+ layout: role
1312
+ } : {}), {}, {
1313
+ items: galleryImages
1314
+ });
1315
+
1316
+ var component = validate$1(content, definition);
1317
+ return {
1318
+ story: story,
1319
+ component: component
1320
+ };
1321
+ };
1322
+
1323
+ var Gallery = function Gallery(story, gallery) {
1324
+ return GalleryElement(story, gallery, 'gallery', GalleryDefinition);
1325
+ };
1326
+
1327
+ var name$6 = "Format\\Heading";
1328
+ var description$6 = "The text component for adding a heading.";
1329
+ var version$6 = "1.7+";
1330
+ var from_class$6 = null;
1331
+ var typed$6 = null;
1332
+ var url$6 = "https://developer.apple.com/documentation/apple_news/heading";
1333
+ var properties$6 = [{
1334
+ name: "role",
1335
+ type: "enum:string",
1336
+ required: true,
1337
+ description: "Always one of these roles for this component: heading, heading1, heading2, heading3, heading4, heading5, or heading6.",
1338
+ enum_values: ["heading", "heading1", "heading2", "heading3", "heading4", "heading5", "heading6"],
1339
+ value: "heading",
1340
+ typed: false
1341
+ }, {
1342
+ name: "text",
1343
+ type: "string",
1344
+ required: true,
1345
+ description: "The text to display in the article, including any formatting tags depending on the format property.",
1346
+ typed: false
1347
+ }, {
1348
+ name: "additions",
1349
+ type: "array:Format\\Addition",
1350
+ required: false,
1351
+ description: "An array of all the additions that should be applied to ranges of the component's text.",
1352
+ typed: false
1353
+ }, {
1354
+ name: "anchor",
1355
+ type: "Format\\Anchor",
1356
+ required: false,
1357
+ description: "An object that defines vertical alignment with another component.",
1358
+ typed: false
1359
+ }, {
1360
+ name: "animation",
1361
+ type: "Format\\ComponentAnimation",
1362
+ required: false,
1363
+ description: "An object that defines an animation to be applied to the component.",
1364
+ typed: true
1365
+ }, {
1366
+ name: "behavior",
1367
+ type: "Format\\Behavior",
1368
+ required: false,
1369
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1370
+ typed: true
1371
+ }, {
1372
+ name: "conditional",
1373
+ type: "array:Format\\ConditionalText",
1374
+ required: false,
1375
+ description: "An array of text components that can be applied conditionally, and the conditions that cause them to be applied.",
1376
+ typed: false
1377
+ }, {
1378
+ name: "format",
1379
+ type: "enum:string",
1380
+ required: false,
1381
+ description: "The formatting or markup method applied to the text.",
1382
+ "default": "none",
1383
+ enum_values: ["markdown", "html", "none"],
1384
+ typed: false
1385
+ }, {
1386
+ name: "hidden",
1387
+ type: "boolean",
1388
+ required: false,
1389
+ description: "A Boolean value that determines whether the component is hidden.",
1390
+ "default": "false",
1391
+ typed: false
1392
+ }, {
1393
+ name: "identifier",
1394
+ type: "string",
1395
+ required: false,
1396
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1397
+ typed: false
1398
+ }, {
1399
+ name: "inlineTextStyles",
1400
+ type: "array:Format\\InlineTextStyle",
1401
+ required: false,
1402
+ description: "An array of InlineTextStyle objects that you can use to apply different text styles to ranges of text. For each InlineTextStyle, you should supply a rangeStart, a rangeLength, and either a TextStyle object or the identifier of a TextStyle that is defined at the top level of the document.",
1403
+ typed: false
1404
+ }, {
1405
+ name: "layout",
1406
+ type: ["Format\\ComponentLayout", "string"],
1407
+ required: false,
1408
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout that is defined at the top level of the document.",
1409
+ typed: false
1410
+ }, {
1411
+ name: "style",
1412
+ type: ["Format\\ComponentStyle", "string"],
1413
+ required: false,
1414
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle that is defined at the top level of the document.",
1415
+ typed: false
1416
+ }, {
1417
+ name: "textStyle",
1418
+ type: ["Format\\ComponentTextStyle", "string"],
1419
+ required: false,
1420
+ description: "An inline ComponentTextStyle object that contains styling information, or a string reference to a ComponentTextStyle object that is defined at the top level of the document.",
1421
+ typed: false
1422
+ }];
1423
+ var HeadingDefinition = {
1424
+ name: name$6,
1425
+ description: description$6,
1426
+ version: version$6,
1427
+ from_class: from_class$6,
1428
+ "extends": "Format\\Text",
1429
+ typed: typed$6,
1430
+ url: url$6,
1431
+ properties: properties$6
1432
+ };
1433
+
1434
+ var Heading1 = function Heading1(story, heading) {
1435
+ return TextElement(story, heading, 'heading1', HeadingDefinition);
1436
+ };
1437
+
1438
+ var Heading2 = function Heading2(story, heading) {
1439
+ return TextElement(story, heading, 'heading2', HeadingDefinition);
1440
+ };
1441
+
1442
+ var name$5 = "Format\\Image";
1443
+ var description$5 = "The component for displaying JPEG, PNG, or GIF images.";
1444
+ var version$5 = "1.7+";
1445
+ var from_class$5 = null;
1446
+ var typed$5 = null;
1447
+ var url$5 = "https://developer.apple.com/documentation/apple_news/image";
1448
+ var properties$5 = [{
1449
+ name: "role",
1450
+ type: "string",
1451
+ required: true,
1452
+ description: "Always image for this component.",
1453
+ value: "image",
1454
+ read_only: true,
1455
+ typed: false
1456
+ }, {
1457
+ name: "URL",
1458
+ type: "uri",
1459
+ required: true,
1460
+ description: "The URL of an image file.",
1461
+ typed: false
1462
+ }, {
1463
+ name: "accessibilityCaption",
1464
+ type: "string",
1465
+ required: false,
1466
+ description: "A caption that describes the image. The text is used for VoiceOver for iOS and VoiceOver for macOS. If accessibilityCaption is not provided, the caption value is used for VoiceOver for iOS and VoiceOver for macOS.",
1467
+ typed: false
1468
+ }, {
1469
+ name: "additions",
1470
+ type: "array:Format\\ComponentLink",
1471
+ required: false,
1472
+ description: "An array of ComponentLink objects. This can be used to create a ComponentLink, allowing a link to anywhere in News.",
1473
+ typed: false
1474
+ }, {
1475
+ name: "anchor",
1476
+ type: "Format\\Anchor",
1477
+ required: false,
1478
+ description: "An object that defines vertical alignment with another component.",
1479
+ typed: false
1480
+ }, {
1481
+ name: "animation",
1482
+ type: "Format\\ComponentAnimation",
1483
+ required: false,
1484
+ description: "An object that defines an animation to be applied to the component.",
1485
+ typed: true
1486
+ }, {
1487
+ name: "behavior",
1488
+ type: "Format\\Behavior",
1489
+ required: false,
1490
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1491
+ typed: true
1492
+ }, {
1493
+ name: "caption",
1494
+ type: ["Format\\CaptionDescriptor", "string"],
1495
+ required: false,
1496
+ description: "A caption that describes the image. The text is seen when the image is in full screen. This text is also used by VoiceOver for iOS and VoiceOver for macOS, if accessibilityCaption text is not provided. The caption text does not appear in the main article view. To display a caption in the main article view, use the Caption component.",
1497
+ typed: false
1498
+ }, {
1499
+ name: "conditional",
1500
+ type: "array:Format\\ConditionalComponent",
1501
+ required: false,
1502
+ description: "An array of component properties that can be applied conditionally, and the conditions that cause them to be applied.",
1503
+ typed: false
1504
+ }, {
1505
+ name: "explicitContent",
1506
+ type: "boolean",
1507
+ required: false,
1508
+ description: "A Boolean value that indicates the image may contain explicit content.",
1509
+ typed: false
1510
+ }, {
1511
+ name: "hidden",
1512
+ type: "boolean",
1513
+ required: false,
1514
+ description: "A Boolean value that determines whether the component is hidden.",
1515
+ "default": "false",
1516
+ typed: false
1517
+ }, {
1518
+ name: "identifier",
1519
+ type: "string",
1520
+ required: false,
1521
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1522
+ typed: false
1523
+ }, {
1524
+ name: "layout",
1525
+ type: ["Format\\ComponentLayout", "string"],
1526
+ required: false,
1527
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
1528
+ typed: false
1529
+ }, {
1530
+ name: "style",
1531
+ type: ["Format\\ComponentStyle", "string"],
1532
+ required: false,
1533
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1534
+ typed: false
1535
+ }];
1536
+ var ImageDefinition = {
1537
+ name: name$5,
1538
+ description: description$5,
1539
+ version: version$5,
1540
+ from_class: from_class$5,
1541
+ "extends": "Format\\Component",
1542
+ typed: typed$5,
1543
+ url: url$5,
1544
+ properties: properties$5
1545
+ };
1546
+
1547
+ var ImageElement = function ImageElement(story, image) {
1548
+ var role = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'image';
1549
+ var definition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1550
+ var _story$componentLayou = story.componentLayouts,
1551
+ componentLayouts = _story$componentLayou === void 0 ? {} : _story$componentLayou;
1552
+
1553
+ var _ref = image || {},
1554
+ url = _ref.url;
1555
+
1556
+ var content = _objectSpread(_objectSpread({
1557
+ role: role
1558
+ }, componentLayouts[role] ? {
1559
+ layout: role
1560
+ } : {}), {}, {
1561
+ URL: url
1562
+ });
1563
+
1564
+ var component = validate$1(content, definition);
1565
+ return {
1566
+ story: story,
1567
+ component: component
1568
+ };
1569
+ };
1570
+
1571
+ var Image = function Image(story, image) {
1572
+ return ImageElement(story, image, 'image', ImageDefinition);
1573
+ };
1574
+
1575
+ var name$4 = "Format\\Map";
1576
+ var description$4 = "The component for adding a map.";
1577
+ var version$4 = "1.7+";
1578
+ var from_class$4 = null;
1579
+ var typed$4 = null;
1580
+ var url$4 = "https://developer.apple.com/documentation/apple_news/map";
1581
+ var properties$4 = [{
1582
+ name: "latitude",
1583
+ type: "number",
1584
+ required: true,
1585
+ description: "The latitude of the map’s center. Provide both a latitude and longitude, or an array of items.",
1586
+ typed: false
1587
+ }, {
1588
+ name: "longitude",
1589
+ type: "number",
1590
+ required: true,
1591
+ description: "The longitude of the map’s center. Provide both a latitude and longitude, or an array of items.",
1592
+ typed: false
1593
+ }, {
1594
+ name: "role",
1595
+ type: "string",
1596
+ required: true,
1597
+ description: "Always map for this component.",
1598
+ value: "map",
1599
+ read_only: true,
1600
+ typed: false
1601
+ }, {
1602
+ name: "accessibilityCaption",
1603
+ type: "string",
1604
+ required: false,
1605
+ description: "The caption that describes what is visible on the map. The text is used for VoiceOver for iOS and VoiceOver for macOS. The value in this property should describe the contents of the map for non-sighted users. If accessibilityCaption is not provided the caption value is used for VoiceOver for iOS and VoiceOver for macOS.",
1606
+ typed: false
1607
+ }, {
1608
+ name: "anchor",
1609
+ type: "Format\\Anchor",
1610
+ required: false,
1611
+ description: "An object that defines vertical alignment with another component.",
1612
+ typed: false
1613
+ }, {
1614
+ name: "animation",
1615
+ type: "Format\\ComponentAnimation",
1616
+ required: false,
1617
+ description: "An object that defines an animation to be applied to the component.",
1618
+ typed: true
1619
+ }, {
1620
+ name: "behavior",
1621
+ type: "Format\\Behavior",
1622
+ required: false,
1623
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1624
+ typed: true
1625
+ }, {
1626
+ name: "caption",
1627
+ type: "string",
1628
+ required: false,
1629
+ description: "A string that describes what is displayed on the map. The caption is displayed in the full screen version of the map. This text is also used by VoiceOver for iOS and VoiceOver for macOS, if accessibilityCaption text is not provided.",
1630
+ typed: false
1631
+ }, {
1632
+ name: "conditional",
1633
+ type: "array:Format\\ConditionalComponent",
1634
+ required: false,
1635
+ description: "An array of component properties that can be applied conditionally, and the conditions that cause them to be applied.",
1636
+ typed: false
1637
+ }, {
1638
+ name: "hidden",
1639
+ type: "boolean",
1640
+ required: false,
1641
+ description: "A Boolean value that determines whether the component is hidden.",
1642
+ "default": "false",
1643
+ typed: false
1644
+ }, {
1645
+ name: "identifier",
1646
+ type: "string",
1647
+ required: false,
1648
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1649
+ typed: false
1650
+ }, {
1651
+ name: "items",
1652
+ type: "array:Format\\MapItem",
1653
+ required: false,
1654
+ description: "An array of MapItems. If latitude and longitude are not set, at least one item containing latitude and longitude should be added to the items array.",
1655
+ typed: false
1656
+ }, {
1657
+ name: "layout",
1658
+ type: ["Format\\ComponentLayout", "string"],
1659
+ required: false,
1660
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
1661
+ typed: false
1662
+ }, {
1663
+ name: "mapType",
1664
+ type: "enum:string",
1665
+ required: false,
1666
+ description: "A string that defines the type of map to display by default.",
1667
+ "default": "standard",
1668
+ enum_values: ["standard", "hybrid", "satellite"],
1669
+ typed: false
1670
+ }, {
1671
+ name: "span",
1672
+ type: "Format\\MapSpan",
1673
+ required: false,
1674
+ description: "An object for defining the visible area of a map, relative to its center. A span is defined in deltas for latitude and longitude.",
1675
+ typed: false
1676
+ }, {
1677
+ name: "style",
1678
+ type: ["Format\\ComponentStyle", "string"],
1679
+ required: false,
1680
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1681
+ typed: false
1682
+ }];
1683
+ var MapDefinition = {
1684
+ name: name$4,
1685
+ description: description$4,
1686
+ version: version$4,
1687
+ from_class: from_class$4,
1688
+ "extends": "Format\\Component",
1689
+ typed: typed$4,
1690
+ url: url$4,
1691
+ properties: properties$4
1692
+ };
1693
+
1694
+ var MapElement = function MapElement(story, map) {
1695
+ var role = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'map';
1696
+ var definition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1697
+ var _story$componentLayou = story.componentLayouts,
1698
+ componentLayouts = _story$componentLayou === void 0 ? {} : _story$componentLayou;
1699
+
1700
+ var _ref = map || {},
1701
+ _ref$latitude = _ref.latitude,
1702
+ latitude = _ref$latitude === void 0 ? null : _ref$latitude,
1703
+ _ref$longitude = _ref.longitude,
1704
+ longitude = _ref$longitude === void 0 ? null : _ref$longitude;
1705
+
1706
+ var content = _objectSpread(_objectSpread({
1707
+ role: role
1708
+ }, componentLayouts[role] ? {
1709
+ layout: role
1710
+ } : {}), {}, {
1711
+ latitude: latitude,
1712
+ longitude: longitude
1713
+ });
1714
+
1715
+ var component = validate$1(content, definition);
1716
+ return {
1717
+ story: story,
1718
+ component: component
1719
+ };
1720
+ };
1721
+
1722
+ var Map = function Map(story, map) {
1723
+ return MapElement(story, map, 'map', MapDefinition);
1724
+ };
1725
+
1726
+ var name$3 = "Format\\Mosaic";
1727
+ var description$3 = "The component for displaying a set of images as tiles in no particular order.";
1728
+ var version$3 = "1.7+";
1729
+ var from_class$3 = null;
1730
+ var typed$3 = null;
1731
+ var url$3 = "https://developer.apple.com/documentation/apple_news/mosaic";
1732
+ var properties$3 = [{
1733
+ name: "items",
1734
+ type: "array:Format\\GalleryItem",
1735
+ required: true,
1736
+ description: "An array of the images that will appear in the mosaic. The order used in the array may affect layout and positioning in the mosaic, depending on the device or width. Gallery items can be JPEG (with .jpg or .jpeg extension), PNG, or GIF images. If the GIF is animated, the animation plays only in full screen.",
1737
+ typed: false
1738
+ }, {
1739
+ name: "role",
1740
+ type: "string",
1741
+ required: true,
1742
+ description: "Always mosaic for this component.",
1743
+ value: "mosaic",
1744
+ read_only: true,
1745
+ typed: false
1746
+ }, {
1747
+ name: "anchor",
1748
+ type: "Format\\Anchor",
1749
+ required: false,
1750
+ description: "An object that defines vertical alignment with another component.",
1751
+ typed: false
1752
+ }, {
1753
+ name: "animation",
1754
+ type: "Format\\ComponentAnimation",
1755
+ required: false,
1756
+ description: "An object that defines an animation to be applied to the component.",
1757
+ typed: true
1758
+ }, {
1759
+ name: "behavior",
1760
+ type: "Format\\Behavior",
1761
+ required: false,
1762
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1763
+ typed: true
1764
+ }, {
1765
+ name: "conditional",
1766
+ type: "array:Format\\ConditionalComponent",
1767
+ required: false,
1768
+ description: "An array of component properties that can be applied conditionally, and the conditions that cause them to be applied.",
1769
+ typed: false
1770
+ }, {
1771
+ name: "hidden",
1772
+ type: "boolean",
1773
+ required: false,
1774
+ description: "A Boolean value that determines whether the component is hidden.",
1775
+ "default": "false",
1776
+ typed: false
1777
+ }, {
1778
+ name: "identifier",
1779
+ type: "string",
1780
+ required: false,
1781
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1782
+ typed: false
1783
+ }, {
1784
+ name: "layout",
1785
+ type: ["Format\\ComponentLayout", "string"],
1786
+ required: false,
1787
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
1788
+ typed: false
1789
+ }, {
1790
+ name: "style",
1791
+ type: ["Format\\ComponentStyle", "string"],
1792
+ required: false,
1793
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1794
+ typed: false
1795
+ }];
1796
+ var MosaicDefinition = {
1797
+ name: name$3,
1798
+ description: description$3,
1799
+ version: version$3,
1800
+ from_class: from_class$3,
1801
+ "extends": "Format\\Component",
1802
+ typed: typed$3,
1803
+ url: url$3,
1804
+ properties: properties$3
1805
+ };
1806
+
1807
+ var Mosaic = function Mosaic(story, mosaic) {
1808
+ return GalleryElement(story, mosaic, 'mosaic', MosaicDefinition);
1809
+ };
1810
+
1811
+ var name$2 = "Format\\Quote";
1812
+ var description$2 = "The component for including a quote.";
1813
+ var version$2 = "1.7+";
1814
+ var from_class$2 = null;
1815
+ var typed$2 = null;
1816
+ var url$2 = "https://developer.apple.com/documentation/apple_news/quote";
1817
+ var properties$2 = [{
1818
+ name: "role",
1819
+ type: "string",
1820
+ required: true,
1821
+ description: "Always quote for this component.",
1822
+ value: "quote",
1823
+ read_only: true,
1824
+ typed: false
1825
+ }, {
1826
+ name: "text",
1827
+ type: "string",
1828
+ required: true,
1829
+ description: "The text to display in the article, including any formatting tags depending on the format property.",
1830
+ typed: false
1831
+ }, {
1832
+ name: "additions",
1833
+ type: "array:Format\\Addition",
1834
+ required: false,
1835
+ description: "An array of all the additions that should be applied to ranges of the component's text.",
1836
+ typed: false
1837
+ }, {
1838
+ name: "anchor",
1839
+ type: "Format\\Anchor",
1840
+ required: false,
1841
+ description: "An object that defines vertical alignment with another component.",
1842
+ typed: false
1843
+ }, {
1844
+ name: "animation",
1845
+ type: "Format\\ComponentAnimation",
1846
+ required: false,
1847
+ description: "An object that defines an animation to be applied to the component.",
1848
+ typed: true
1849
+ }, {
1850
+ name: "behavior",
1851
+ type: "Format\\Behavior",
1852
+ required: false,
1853
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1854
+ typed: true
1855
+ }, {
1856
+ name: "conditional",
1857
+ type: "array:Format\\ConditionalText",
1858
+ required: false,
1859
+ description: "An array of text components that can be applied conditionally and the conditions that cause them to be applied.",
1860
+ typed: false
1861
+ }, {
1862
+ name: "format",
1863
+ type: "enum:string",
1864
+ required: false,
1865
+ description: "The formatting or markup method applied to the text.",
1866
+ "default": "none",
1867
+ enum_values: ["markdown", "html", "none"],
1868
+ typed: false
1869
+ }, {
1870
+ name: "hidden",
1871
+ type: "boolean",
1872
+ required: false,
1873
+ description: "A Boolean value that determines whether the component is hidden.",
1874
+ "default": "false",
1875
+ typed: false
1876
+ }, {
1877
+ name: "identifier",
1878
+ type: "string",
1879
+ required: false,
1880
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1881
+ typed: false
1882
+ }, {
1883
+ name: "inlineTextStyles",
1884
+ type: "array:Format\\InlineTextStyle",
1885
+ required: false,
1886
+ description: "An array of InlineTextStyle objects that you can use to apply different text styles to ranges of text. For each InlineTextStyle, you should supply a rangeStart, rangeLength, and either a TextStyle object or the identifier of a TextStyle that is defined at the top level of the document.",
1887
+ typed: false
1888
+ }, {
1889
+ name: "layout",
1890
+ type: ["Format\\ComponentLayout", "string"],
1891
+ required: false,
1892
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
1893
+ typed: false
1894
+ }, {
1895
+ name: "style",
1896
+ type: ["Format\\ComponentStyle", "string"],
1897
+ required: false,
1898
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
1899
+ typed: false
1900
+ }, {
1901
+ name: "textStyle",
1902
+ type: ["Format\\ComponentTextStyle", "string"],
1903
+ required: false,
1904
+ description: "An inline ComponentTextStyle object that contains styling information, or a string reference to a ComponentTextStyle object that is defined at the top level of the document.",
1905
+ typed: false
1906
+ }];
1907
+ var QuoteDefinition = {
1908
+ name: name$2,
1909
+ description: description$2,
1910
+ version: version$2,
1911
+ from_class: from_class$2,
1912
+ "extends": "Format\\Text",
1913
+ typed: typed$2,
1914
+ url: url$2,
1915
+ properties: properties$2
1916
+ };
1917
+
1918
+ var Quote = function Quote(story, quote) {
1919
+ return TextElement(story, quote, 'quote', QuoteDefinition);
1920
+ };
1921
+
1922
+ var name$1 = "Format\\Title";
1923
+ var description$1 = "The component for adding an article title.";
1924
+ var version$1 = "1.7+";
1925
+ var from_class$1 = null;
1926
+ var typed$1 = null;
1927
+ var url$1 = "https://developer.apple.com/documentation/apple_news/title";
1928
+ var properties$1 = [{
1929
+ name: "role",
1930
+ type: "string",
1931
+ required: true,
1932
+ description: "Always title for this component.",
1933
+ value: "title",
1934
+ read_only: true,
1935
+ typed: false
1936
+ }, {
1937
+ name: "text",
1938
+ type: "string",
1939
+ required: true,
1940
+ description: "The text to display in the article, including any formatting tags depending on the format property.",
1941
+ typed: false
1942
+ }, {
1943
+ name: "additions",
1944
+ type: "array:Format\\Addition",
1945
+ required: false,
1946
+ description: "An array of all the additions that should be applied to ranges of the component's text.",
1947
+ typed: false
1948
+ }, {
1949
+ name: "anchor",
1950
+ type: "Format\\Anchor",
1951
+ required: false,
1952
+ description: "An object that defines vertical alignment with another component.",
1953
+ typed: false
1954
+ }, {
1955
+ name: "animation",
1956
+ type: "Format\\ComponentAnimation",
1957
+ required: false,
1958
+ description: "An object that defines an animation to be applied to the component.",
1959
+ typed: true
1960
+ }, {
1961
+ name: "behavior",
1962
+ type: "Format\\Behavior",
1963
+ required: false,
1964
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
1965
+ typed: true
1966
+ }, {
1967
+ name: "conditional",
1968
+ type: "array:Format\\ConditionalText",
1969
+ required: false,
1970
+ description: "An array of text components that can be applied conditionally, and the conditions that cause them to be applied.",
1971
+ typed: false
1972
+ }, {
1973
+ name: "format",
1974
+ type: "enum:string",
1975
+ required: false,
1976
+ description: "The formatting or markup method applied to the text.",
1977
+ "default": "none",
1978
+ enum_values: ["markdown", "html", "none"],
1979
+ typed: false
1980
+ }, {
1981
+ name: "hidden",
1982
+ type: "boolean",
1983
+ required: false,
1984
+ description: "A Boolean value that determines whether the component is hidden.",
1985
+ "default": "false",
1986
+ typed: false
1987
+ }, {
1988
+ name: "identifier",
1989
+ type: "string",
1990
+ required: false,
1991
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
1992
+ typed: false
1993
+ }, {
1994
+ name: "inlineTextStyles",
1995
+ type: "array:Format\\InlineTextStyle",
1996
+ required: false,
1997
+ description: "An array of InlineTextStyle objects that you can use to apply different text styles to ranges of text. For each InlineTextStyle, you should supply a rangeStart, a rangeLength, and either a TextStyle object or the identifier of a TextStyle that is defined at the top level of the document.",
1998
+ typed: false
1999
+ }, {
2000
+ name: "layout",
2001
+ type: ["Format\\ComponentLayout", "string"],
2002
+ required: false,
2003
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout that is defined at the top level of the document.",
2004
+ typed: false
2005
+ }, {
2006
+ name: "style",
2007
+ type: ["Format\\ComponentStyle", "string"],
2008
+ required: false,
2009
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle that is defined at the top level of the document.",
2010
+ typed: false
2011
+ }, {
2012
+ name: "textStyle",
2013
+ type: ["Format\\ComponentTextStyle", "string"],
2014
+ required: false,
2015
+ description: "An inline ComponentTextStyle object that contains styling information, or a string reference to a ComponentTextStyle object that is defined at the top level of the document.",
2016
+ typed: false
2017
+ }];
2018
+ var TitleDefinition = {
2019
+ name: name$1,
2020
+ description: description$1,
2021
+ version: version$1,
2022
+ from_class: from_class$1,
2023
+ "extends": "Format\\Text",
2024
+ typed: typed$1,
2025
+ url: url$1,
2026
+ properties: properties$1
2027
+ };
2028
+
2029
+ var Subtitle = function Subtitle(story, subtitle) {
2030
+ return TextElement(story, subtitle, 'title', TitleDefinition);
2031
+ };
2032
+
2033
+ var Text = function Text(story, text) {
2034
+ return TextElement(story, text, 'text', TextDefinition);
2035
+ };
2036
+
2037
+ var Title = function Title(story, title) {
2038
+ return TextElement(story, title, 'title', TitleDefinition);
2039
+ };
2040
+
2041
+ var name = "Format\\Video";
2042
+ var description = "The component for adding a video.";
2043
+ var version = "1.7+";
2044
+ var from_class = null;
2045
+ var typed = null;
2046
+ var url = "https://developer.apple.com/documentation/apple_news/video";
2047
+ var properties = [{
2048
+ name: "role",
2049
+ type: "string",
2050
+ required: true,
2051
+ description: "Always video for this component.",
2052
+ value: "video",
2053
+ read_only: true,
2054
+ typed: false
2055
+ }, {
2056
+ name: "URL",
2057
+ type: "uri",
2058
+ required: true,
2059
+ description: "The URL of a video file that can be played using AVPlayer. HTTP Live Streaming (HLS) is highly recommended (.M3U8). For more information on HLS, refer to the iOS developer documentation on HTTP Live Streaming, especially the following sections of the HTTP Live Streaming Overview:",
2060
+ typed: false
2061
+ }, {
2062
+ name: "accessibilityCaption",
2063
+ type: "string",
2064
+ required: false,
2065
+ description: "A caption that describes the content of the video. The text is used for VoiceOver for iOS and VoiceOver for macOS. If accessibilityCaption is not provided, the caption value is used for VoiceOver for iOS and VoiceOver for macOS.",
2066
+ typed: false
2067
+ }, {
2068
+ name: "anchor",
2069
+ type: "Format\\Anchor",
2070
+ required: false,
2071
+ description: "An object that defines vertical alignment with another component.",
2072
+ typed: false
2073
+ }, {
2074
+ name: "animation",
2075
+ type: "Format\\ComponentAnimation",
2076
+ required: false,
2077
+ description: "An object that defines an animation to be applied to the component.",
2078
+ typed: true
2079
+ }, {
2080
+ name: "aspectRatio",
2081
+ type: "number",
2082
+ required: false,
2083
+ description: "The aspect ratio of the video: width divided by height. The aspect ratio determines the height of the video player.",
2084
+ "default": 1.777,
2085
+ typed: false
2086
+ }, {
2087
+ name: "behavior",
2088
+ type: "Format\\Behavior",
2089
+ required: false,
2090
+ description: "An object that defines behavior for a component, like Parallax or Springy.",
2091
+ typed: true
2092
+ }, {
2093
+ name: "caption",
2094
+ type: "string",
2095
+ required: false,
2096
+ description: "A caption that describes the content of the video file. This text is also used by VoiceOver for iOS and VoiceOver for macOS if accessibilityCaption is not provided, or it can be shown when the video cannot be played.",
2097
+ typed: false
2098
+ }, {
2099
+ name: "conditional",
2100
+ type: "array:Format\\ConditionalComponent",
2101
+ required: false,
2102
+ description: "An array of component properties that can be applied conditionally, and the conditions that cause them to be applied.",
2103
+ typed: false
2104
+ }, {
2105
+ name: "explicitContent",
2106
+ type: "boolean",
2107
+ required: false,
2108
+ description: "A Boolean value that indicates that the video or its still image may contain explicit content.",
2109
+ typed: false
2110
+ }, {
2111
+ name: "hidden",
2112
+ type: "boolean",
2113
+ required: false,
2114
+ description: "A Boolean value that determines whether the component is hidden.",
2115
+ "default": "false",
2116
+ typed: false
2117
+ }, {
2118
+ name: "identifier",
2119
+ type: "string",
2120
+ required: false,
2121
+ description: "An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it.",
2122
+ typed: false
2123
+ }, {
2124
+ name: "layout",
2125
+ type: ["Format\\ComponentLayout", "string"],
2126
+ required: false,
2127
+ description: "An inline ComponentLayout object that contains layout information, or a string reference to a ComponentLayout object that is defined at the top level of the document.",
2128
+ typed: false
2129
+ }, {
2130
+ name: "stillURL",
2131
+ type: "uri",
2132
+ required: false,
2133
+ description: "The URL of an image file that should be shown when the video has not yet been played.",
2134
+ typed: false
2135
+ }, {
2136
+ name: "style",
2137
+ type: ["Format\\ComponentStyle", "string"],
2138
+ required: false,
2139
+ description: "An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle object that is defined at the top level of the document.",
2140
+ typed: false
2141
+ }];
2142
+ var VideoDefinition = {
2143
+ name: name,
2144
+ description: description,
2145
+ version: version,
2146
+ from_class: from_class,
2147
+ "extends": "Format\\Component",
2148
+ typed: typed,
2149
+ url: url,
2150
+ properties: properties
2151
+ };
2152
+
2153
+ var Video = function Video(story, video) {
2154
+ return MediaElement(story, video, 'video', VideoDefinition);
2155
+ };
2156
+
2157
+ export { Article, Audio, Author, Container, Gallery, Heading1, Heading2, Image, Map, Mosaic, Quote, Subtitle, Text, TextStyle, Title, Video };