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