@vaadin-component-factory/vcf-pdf-viewer 0.9.0 → 0.9.4

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.
Files changed (174) hide show
  1. package/README.md +1 -1
  2. package/package.json +33 -18
  3. package/{src/display → pdfjs/dist}/display_utils.js +344 -139
  4. package/{src/display → pdfjs/dist}/fetch_stream.js +115 -97
  5. package/pdfjs/dist/get.js +1857 -0
  6. package/pdfjs/dist/index.js +767 -0
  7. package/pdfjs/dist/l10n_utils.js +140 -0
  8. package/{src/shared → pdfjs/dist}/message_handler.js +243 -259
  9. package/{src/display → pdfjs/dist}/network.js +149 -87
  10. package/{src/display/content_disposition.js → pdfjs/dist/network_utils.js} +167 -55
  11. package/{src/display → pdfjs/dist}/node_stream.js +133 -98
  12. package/pdfjs/dist/pdf.js +12778 -0
  13. package/pdfjs/dist/pdf_link_service.js +638 -0
  14. package/pdfjs/dist/pdf_rendering_queue.js +199 -0
  15. package/pdfjs/dist/pdf_thumbnail_viewer.js +819 -0
  16. package/pdfjs/dist/pdf_viewer.js +3598 -0
  17. package/pdfjs/dist/typeof.js +100 -0
  18. package/pdfjs/dist/ui_utils.js +1033 -0
  19. package/{src/shared → pdfjs/dist}/util.js +301 -287
  20. package/pdfjs/dist/worker.js +62813 -0
  21. package/src/vcf-pdf-viewer.js +77 -27
  22. package/theme/lumo/vcf-pdf-viewer-styles.js +1 -1
  23. package/theme/material/vcf-pdf-viewer.js +2 -2
  24. package/src/core/.eslintrc +0 -13
  25. package/src/core/annotation.js +0 -2948
  26. package/src/core/arithmetic_decoder.js +0 -182
  27. package/src/core/ascii_85_stream.js +0 -98
  28. package/src/core/ascii_hex_stream.js +0 -79
  29. package/src/core/base_stream.js +0 -110
  30. package/src/core/bidi.js +0 -438
  31. package/src/core/calibri_factors.js +0 -308
  32. package/src/core/catalog.js +0 -1459
  33. package/src/core/ccitt.js +0 -1062
  34. package/src/core/ccitt_stream.js +0 -60
  35. package/src/core/cff_font.js +0 -116
  36. package/src/core/cff_parser.js +0 -1949
  37. package/src/core/charsets.js +0 -119
  38. package/src/core/chunked_stream.js +0 -557
  39. package/src/core/cmap.js +0 -1039
  40. package/src/core/colorspace.js +0 -1533
  41. package/src/core/core_utils.js +0 -464
  42. package/src/core/crypto.js +0 -1900
  43. package/src/core/decode_stream.js +0 -170
  44. package/src/core/decrypt_stream.js +0 -59
  45. package/src/core/default_appearance.js +0 -99
  46. package/src/core/document.js +0 -1456
  47. package/src/core/encodings.js +0 -301
  48. package/src/core/evaluator.js +0 -4601
  49. package/src/core/file_spec.js +0 -108
  50. package/src/core/flate_stream.js +0 -402
  51. package/src/core/font_renderer.js +0 -882
  52. package/src/core/fonts.js +0 -3260
  53. package/src/core/fonts_utils.js +0 -221
  54. package/src/core/function.js +0 -1257
  55. package/src/core/glyf.js +0 -706
  56. package/src/core/glyphlist.js +0 -4558
  57. package/src/core/helvetica_factors.js +0 -353
  58. package/src/core/image.js +0 -802
  59. package/src/core/image_utils.js +0 -291
  60. package/src/core/jbig2.js +0 -2572
  61. package/src/core/jbig2_stream.js +0 -73
  62. package/src/core/jpeg_stream.js +0 -105
  63. package/src/core/jpg.js +0 -1416
  64. package/src/core/jpx.js +0 -2343
  65. package/src/core/jpx_stream.js +0 -87
  66. package/src/core/liberationsans_widths.js +0 -221
  67. package/src/core/lzw_stream.js +0 -150
  68. package/src/core/metadata_parser.js +0 -146
  69. package/src/core/metrics.js +0 -2970
  70. package/src/core/murmurhash3.js +0 -139
  71. package/src/core/myriadpro_factors.js +0 -290
  72. package/src/core/name_number_tree.js +0 -153
  73. package/src/core/object_loader.js +0 -149
  74. package/src/core/opentype_file_builder.js +0 -154
  75. package/src/core/operator_list.js +0 -734
  76. package/src/core/parser.js +0 -1416
  77. package/src/core/pattern.js +0 -985
  78. package/src/core/pdf_manager.js +0 -217
  79. package/src/core/predictor_stream.js +0 -238
  80. package/src/core/primitives.js +0 -402
  81. package/src/core/ps_parser.js +0 -272
  82. package/src/core/run_length_stream.js +0 -61
  83. package/src/core/segoeui_factors.js +0 -308
  84. package/src/core/standard_fonts.js +0 -817
  85. package/src/core/stream.js +0 -103
  86. package/src/core/struct_tree.js +0 -335
  87. package/src/core/to_unicode_map.js +0 -103
  88. package/src/core/type1_font.js +0 -421
  89. package/src/core/type1_parser.js +0 -776
  90. package/src/core/unicode.js +0 -1649
  91. package/src/core/worker.js +0 -848
  92. package/src/core/worker_stream.js +0 -135
  93. package/src/core/writer.js +0 -278
  94. package/src/core/xfa/bind.js +0 -652
  95. package/src/core/xfa/builder.js +0 -207
  96. package/src/core/xfa/config.js +0 -1926
  97. package/src/core/xfa/connection_set.js +0 -202
  98. package/src/core/xfa/data.js +0 -82
  99. package/src/core/xfa/datasets.js +0 -76
  100. package/src/core/xfa/factory.js +0 -111
  101. package/src/core/xfa/fonts.js +0 -181
  102. package/src/core/xfa/formcalc_lexer.js +0 -385
  103. package/src/core/xfa/formcalc_parser.js +0 -1340
  104. package/src/core/xfa/html_utils.js +0 -639
  105. package/src/core/xfa/layout.js +0 -383
  106. package/src/core/xfa/locale_set.js +0 -345
  107. package/src/core/xfa/namespaces.js +0 -81
  108. package/src/core/xfa/parser.js +0 -184
  109. package/src/core/xfa/setup.js +0 -38
  110. package/src/core/xfa/signature.js +0 -40
  111. package/src/core/xfa/som.js +0 -338
  112. package/src/core/xfa/stylesheet.js +0 -40
  113. package/src/core/xfa/template.js +0 -6260
  114. package/src/core/xfa/text.js +0 -290
  115. package/src/core/xfa/unknown.js +0 -29
  116. package/src/core/xfa/utils.js +0 -217
  117. package/src/core/xfa/xdp.js +0 -59
  118. package/src/core/xfa/xfa_object.js +0 -1130
  119. package/src/core/xfa/xhtml.js +0 -543
  120. package/src/core/xfa_fonts.js +0 -208
  121. package/src/core/xml_parser.js +0 -507
  122. package/src/core/xref.js +0 -899
  123. package/src/display/annotation_layer.js +0 -2107
  124. package/src/display/annotation_storage.js +0 -113
  125. package/src/display/api.js +0 -3292
  126. package/src/display/base_factory.js +0 -180
  127. package/src/display/canvas.js +0 -2828
  128. package/src/display/font_loader.js +0 -484
  129. package/src/display/metadata.js +0 -41
  130. package/src/display/network_utils.js +0 -100
  131. package/src/display/node_utils.js +0 -83
  132. package/src/display/optional_content_config.js +0 -189
  133. package/src/display/pattern_helper.js +0 -659
  134. package/src/display/svg.js +0 -1709
  135. package/src/display/text_layer.js +0 -847
  136. package/src/display/transport_stream.js +0 -303
  137. package/src/display/worker_options.js +0 -40
  138. package/src/display/xfa_layer.js +0 -204
  139. package/src/doc_helper.js +0 -25
  140. package/src/images/logo.svg +0 -41
  141. package/src/interfaces.js +0 -169
  142. package/src/license_header.js +0 -14
  143. package/src/license_header_libre.js +0 -21
  144. package/src/pdf.image_decoders.js +0 -46
  145. package/src/pdf.js +0 -146
  146. package/src/pdf.sandbox.external.js +0 -181
  147. package/src/pdf.sandbox.js +0 -151
  148. package/src/pdf.scripting.js +0 -25
  149. package/src/pdf.worker.entry.js +0 -19
  150. package/src/pdf.worker.js +0 -23
  151. package/src/scripting_api/aform.js +0 -608
  152. package/src/scripting_api/app.js +0 -621
  153. package/src/scripting_api/color.js +0 -129
  154. package/src/scripting_api/common.js +0 -58
  155. package/src/scripting_api/console.js +0 -38
  156. package/src/scripting_api/constants.js +0 -208
  157. package/src/scripting_api/doc.js +0 -1195
  158. package/src/scripting_api/error.js +0 -23
  159. package/src/scripting_api/event.js +0 -232
  160. package/src/scripting_api/field.js +0 -620
  161. package/src/scripting_api/fullscreen.js +0 -145
  162. package/src/scripting_api/initialization.js +0 -223
  163. package/src/scripting_api/pdf_object.js +0 -24
  164. package/src/scripting_api/print_params.js +0 -146
  165. package/src/scripting_api/proxy.js +0 -139
  166. package/src/scripting_api/thermometer.js +0 -69
  167. package/src/scripting_api/util.js +0 -581
  168. package/src/shared/.eslintrc +0 -13
  169. package/src/shared/cffStandardStrings.js +0 -311
  170. package/src/shared/compatibility.js +0 -114
  171. package/src/shared/fonts_utils.js +0 -429
  172. package/src/shared/is_node.js +0 -27
  173. package/src/shared/scripting_utils.js +0 -85
  174. package/src/worker_loader.js +0 -32
@@ -1,383 +0,0 @@
1
- /* Copyright 2021 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- import {
17
- $extra,
18
- $flushHTML,
19
- $getSubformParent,
20
- $getTemplateRoot,
21
- $isSplittable,
22
- $isThereMoreWidth,
23
- } from "./xfa_object.js";
24
- import { measureToString } from "./html_utils.js";
25
-
26
- // Subform and ExclGroup have a layout so they share these functions.
27
-
28
- /**
29
- * How layout works ?
30
- *
31
- * A container has an initial space (with a width and a height) to fit in,
32
- * which means that once all the children have been added then
33
- * the total width/height must be lower than the given ones in
34
- * the initial space.
35
- * So if the container has known dimensions and these ones are ok with the
36
- * space then continue else we return HTMLResult.FAILURE: it's up to the
37
- * parent to deal with this failure (e.g. if parent layout is lr-tb and
38
- * we fail to add a child at end of line (lr) then we try to add it on the
39
- * next line).
40
- * And then we run through the children, each child gets its initial space
41
- * in calling its parent $getAvailableSpace method
42
- * (see _filteredChildrenGenerator and $childrenToHTML in xfa_object.js)
43
- * then we try to layout child in its space. If everything is ok then we add
44
- * the result to its parent through $addHTML which will recompute the available
45
- * space in parent according to its layout property else we return
46
- * HTMLResult.Failure.
47
- * Before a failure some children may have been layed out: they've been saved in
48
- * [$extra].children and [$extra] has properties generator and failingNode
49
- * in order to save the state where we were before a failure.
50
- * This [$extra].children property is useful when a container has to be splited.
51
- * So if a container is unbreakable, we must delete its [$extra] property before
52
- * returning.
53
- */
54
-
55
- function createLine(node, children) {
56
- return {
57
- name: "div",
58
- attributes: {
59
- class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"],
60
- },
61
- children,
62
- };
63
- }
64
-
65
- function flushHTML(node) {
66
- if (!node[$extra]) {
67
- return null;
68
- }
69
-
70
- const attributes = node[$extra].attributes;
71
- const html = {
72
- name: "div",
73
- attributes,
74
- children: node[$extra].children,
75
- };
76
-
77
- if (node[$extra].failingNode) {
78
- const htmlFromFailing = node[$extra].failingNode[$flushHTML]();
79
- if (htmlFromFailing) {
80
- if (node.layout.endsWith("-tb")) {
81
- html.children.push(createLine(node, [htmlFromFailing]));
82
- } else {
83
- html.children.push(htmlFromFailing);
84
- }
85
- }
86
- }
87
-
88
- if (html.children.length === 0) {
89
- return null;
90
- }
91
-
92
- return html;
93
- }
94
-
95
- function addHTML(node, html, bbox) {
96
- const extra = node[$extra];
97
- const availableSpace = extra.availableSpace;
98
-
99
- const [x, y, w, h] = bbox;
100
- switch (node.layout) {
101
- case "position": {
102
- extra.width = Math.max(extra.width, x + w);
103
- extra.height = Math.max(extra.height, y + h);
104
- extra.children.push(html);
105
- break;
106
- }
107
- case "lr-tb":
108
- case "rl-tb":
109
- if (!extra.line || extra.attempt === 1) {
110
- extra.line = createLine(node, []);
111
- extra.children.push(extra.line);
112
- extra.numberInLine = 0;
113
- }
114
-
115
- extra.numberInLine += 1;
116
- extra.line.children.push(html);
117
-
118
- if (extra.attempt === 0) {
119
- // Add the element on the line
120
- extra.currentWidth += w;
121
- extra.height = Math.max(extra.height, extra.prevHeight + h);
122
- } else {
123
- extra.currentWidth = w;
124
- extra.prevHeight = extra.height;
125
- extra.height += h;
126
-
127
- // The element has been added on a new line so switch to line mode now.
128
- extra.attempt = 0;
129
- }
130
- extra.width = Math.max(extra.width, extra.currentWidth);
131
- break;
132
- case "rl-row":
133
- case "row": {
134
- extra.children.push(html);
135
- extra.width += w;
136
- extra.height = Math.max(extra.height, h);
137
- const height = measureToString(extra.height);
138
- for (const child of extra.children) {
139
- child.attributes.style.height = height;
140
- }
141
- break;
142
- }
143
- case "table": {
144
- extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
145
- extra.height += h;
146
- extra.children.push(html);
147
- break;
148
- }
149
- case "tb": {
150
- extra.width = availableSpace.width;
151
- extra.height += h;
152
- extra.children.push(html);
153
- break;
154
- }
155
- }
156
- }
157
-
158
- function getAvailableSpace(node) {
159
- const availableSpace = node[$extra].availableSpace;
160
- const marginV = node.margin
161
- ? node.margin.topInset + node.margin.bottomInset
162
- : 0;
163
- const marginH = node.margin
164
- ? node.margin.leftInset + node.margin.rightInset
165
- : 0;
166
-
167
- switch (node.layout) {
168
- case "lr-tb":
169
- case "rl-tb":
170
- if (node[$extra].attempt === 0) {
171
- return {
172
- width: availableSpace.width - marginH - node[$extra].currentWidth,
173
- height: availableSpace.height - marginV - node[$extra].prevHeight,
174
- };
175
- }
176
- return {
177
- width: availableSpace.width - marginH,
178
- height: availableSpace.height - marginV - node[$extra].height,
179
- };
180
- case "rl-row":
181
- case "row":
182
- const width = node[$extra].columnWidths
183
- .slice(node[$extra].currentColumn)
184
- .reduce((a, x) => a + x);
185
- return { width, height: availableSpace.height - marginH };
186
- case "table":
187
- case "tb":
188
- return {
189
- width: availableSpace.width - marginH,
190
- height: availableSpace.height - marginV - node[$extra].height,
191
- };
192
- case "position":
193
- default:
194
- return availableSpace;
195
- }
196
- }
197
-
198
- function getTransformedBBox(node) {
199
- // Take into account rotation and anchor to get the real bounding box.
200
- let w = node.w === "" ? NaN : node.w;
201
- let h = node.h === "" ? NaN : node.h;
202
- let [centerX, centerY] = [0, 0];
203
- switch (node.anchorType || "") {
204
- case "bottomCenter":
205
- [centerX, centerY] = [w / 2, h];
206
- break;
207
- case "bottomLeft":
208
- [centerX, centerY] = [0, h];
209
- break;
210
- case "bottomRight":
211
- [centerX, centerY] = [w, h];
212
- break;
213
- case "middleCenter":
214
- [centerX, centerY] = [w / 2, h / 2];
215
- break;
216
- case "middleLeft":
217
- [centerX, centerY] = [0, h / 2];
218
- break;
219
- case "middleRight":
220
- [centerX, centerY] = [w, h / 2];
221
- break;
222
- case "topCenter":
223
- [centerX, centerY] = [w / 2, 0];
224
- break;
225
- case "topRight":
226
- [centerX, centerY] = [w, 0];
227
- break;
228
- }
229
-
230
- let x, y;
231
- switch (node.rotate || 0) {
232
- case 0:
233
- [x, y] = [-centerX, -centerY];
234
- break;
235
- case 90:
236
- [x, y] = [-centerY, centerX];
237
- [w, h] = [h, -w];
238
- break;
239
- case 180:
240
- [x, y] = [centerX, centerY];
241
- [w, h] = [-w, -h];
242
- break;
243
- case 270:
244
- [x, y] = [centerY, -centerX];
245
- [w, h] = [-h, w];
246
- break;
247
- }
248
-
249
- return [
250
- node.x + x + Math.min(0, w),
251
- node.y + y + Math.min(0, h),
252
- Math.abs(w),
253
- Math.abs(h),
254
- ];
255
- }
256
-
257
- /**
258
- * Returning true means that the node will be layed out
259
- * else the layout will go to its next step (changing of line
260
- * in case of lr-tb or changing content area...).
261
- */
262
- function checkDimensions(node, space) {
263
- if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) {
264
- return true;
265
- }
266
-
267
- if (node.w === 0 || node.h === 0) {
268
- return true;
269
- }
270
-
271
- const ERROR = 2;
272
- const parent = node[$getSubformParent]();
273
- const attempt = (parent[$extra] && parent[$extra].attempt) || 0;
274
-
275
- const [, y, w, h] = getTransformedBBox(node);
276
- switch (parent.layout) {
277
- case "lr-tb":
278
- case "rl-tb":
279
- if (attempt === 0) {
280
- // Try to put an element in the line.
281
-
282
- if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) {
283
- if (node.h !== "" && Math.round(h - space.height) > ERROR) {
284
- // Not enough height.
285
- return false;
286
- }
287
-
288
- if (node.w !== "") {
289
- if (Math.round(w - space.width) <= ERROR) {
290
- return true;
291
- }
292
- if (parent[$extra].numberInLine === 0) {
293
- return space.height > 0;
294
- }
295
-
296
- return false;
297
- }
298
-
299
- return space.width > 0;
300
- }
301
-
302
- // No layout failure.
303
-
304
- // Put the element on the line but we can fail
305
- // and then in the second step (next line) we'll accept.
306
- if (node.w !== "") {
307
- return Math.round(w - space.width) <= ERROR;
308
- }
309
-
310
- return space.width > 0;
311
- }
312
-
313
- // Second attempt: try to put the element on the next line.
314
-
315
- if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
316
- // We cannot fail.
317
- return true;
318
- }
319
-
320
- if (node.h !== "" && Math.round(h - space.height) > ERROR) {
321
- return false;
322
- }
323
-
324
- if (node.w === "" || Math.round(w - space.width) <= ERROR) {
325
- return space.height > 0;
326
- }
327
-
328
- if (parent[$isThereMoreWidth]()) {
329
- return false;
330
- }
331
-
332
- return space.height > 0;
333
- case "table":
334
- case "tb":
335
- if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
336
- return true;
337
- }
338
-
339
- // If the node has a height then check if it's fine with available height.
340
- // If the node is breakable then we can return true.
341
- if (node.h !== "" && !node[$isSplittable]()) {
342
- return Math.round(h - space.height) <= ERROR;
343
- }
344
- // Else wait and see: this node will be layed out itself
345
- // in the provided space and maybe a children won't fit.
346
-
347
- if (node.w === "" || Math.round(w - space.width) <= ERROR) {
348
- return space.height > 0;
349
- }
350
-
351
- if (parent[$isThereMoreWidth]()) {
352
- return false;
353
- }
354
-
355
- return space.height > 0;
356
- case "position":
357
- if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
358
- return true;
359
- }
360
-
361
- if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
362
- return true;
363
- }
364
-
365
- const area = node[$getTemplateRoot]()[$extra].currentContentArea;
366
- return h + y > area.h;
367
- case "rl-row":
368
- case "row":
369
- if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
370
- return true;
371
- }
372
-
373
- if (node.h !== "") {
374
- return Math.round(h - space.height) <= ERROR;
375
- }
376
- return true;
377
- default:
378
- // No layout, so accept everything.
379
- return true;
380
- }
381
- }
382
-
383
- export { addHTML, checkDimensions, flushHTML, getAvailableSpace };
@@ -1,345 +0,0 @@
1
- /* Copyright 2021 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- import { $buildXFAObject, NamespaceIds } from "./namespaces.js";
17
- import {
18
- ContentObject,
19
- StringObject,
20
- XFAObject,
21
- XFAObjectArray,
22
- } from "./xfa_object.js";
23
- import { getInteger, getStringOption } from "./utils.js";
24
-
25
- const LOCALE_SET_NS_ID = NamespaceIds.localeSet.id;
26
-
27
- class CalendarSymbols extends XFAObject {
28
- constructor(attributes) {
29
- super(LOCALE_SET_NS_ID, "calendarSymbols", /* hasChildren = */ true);
30
- this.name = "gregorian";
31
- this.dayNames = new XFAObjectArray(2);
32
- this.eraNames = null;
33
- this.meridiemNames = null;
34
- this.monthNames = new XFAObjectArray(2);
35
- }
36
- }
37
-
38
- class CurrencySymbol extends StringObject {
39
- constructor(attributes) {
40
- super(LOCALE_SET_NS_ID, "currencySymbol");
41
- this.name = getStringOption(attributes.name, [
42
- "symbol",
43
- "isoname",
44
- "decimal",
45
- ]);
46
- }
47
- }
48
-
49
- class CurrencySymbols extends XFAObject {
50
- constructor(attributes) {
51
- super(LOCALE_SET_NS_ID, "currencySymbols", /* hasChildren = */ true);
52
- this.currencySymbol = new XFAObjectArray(3);
53
- }
54
- }
55
-
56
- class DatePattern extends StringObject {
57
- constructor(attributes) {
58
- super(LOCALE_SET_NS_ID, "datePattern");
59
- this.name = getStringOption(attributes.name, [
60
- "full",
61
- "long",
62
- "med",
63
- "short",
64
- ]);
65
- }
66
- }
67
-
68
- class DatePatterns extends XFAObject {
69
- constructor(attributes) {
70
- super(LOCALE_SET_NS_ID, "datePatterns", /* hasChildren = */ true);
71
- this.datePattern = new XFAObjectArray(4);
72
- }
73
- }
74
-
75
- class DateTimeSymbols extends ContentObject {
76
- // TODO: spec unclear about the format of the array.
77
-
78
- constructor(attributes) {
79
- super(LOCALE_SET_NS_ID, "dateTimeSymbols");
80
- }
81
- }
82
-
83
- class Day extends StringObject {
84
- constructor(attributes) {
85
- super(LOCALE_SET_NS_ID, "day");
86
- }
87
- }
88
-
89
- class DayNames extends XFAObject {
90
- constructor(attributes) {
91
- super(LOCALE_SET_NS_ID, "dayNames", /* hasChildren = */ true);
92
- this.abbr = getInteger({
93
- data: attributes.abbr,
94
- defaultValue: 0,
95
- validate: x => x === 1,
96
- });
97
- this.day = new XFAObjectArray(7);
98
- }
99
- }
100
-
101
- class Era extends StringObject {
102
- constructor(attributes) {
103
- super(LOCALE_SET_NS_ID, "era");
104
- }
105
- }
106
-
107
- class EraNames extends XFAObject {
108
- constructor(attributes) {
109
- super(LOCALE_SET_NS_ID, "eraNames", /* hasChildren = */ true);
110
- this.era = new XFAObjectArray(2);
111
- }
112
- }
113
-
114
- class Locale extends XFAObject {
115
- constructor(attributes) {
116
- super(LOCALE_SET_NS_ID, "locale", /* hasChildren = */ true);
117
- this.desc = attributes.desc || "";
118
- this.name = "isoname";
119
- this.calendarSymbols = null;
120
- this.currencySymbols = null;
121
- this.datePatterns = null;
122
- this.dateTimeSymbols = null;
123
- this.numberPatterns = null;
124
- this.numberSymbols = null;
125
- this.timePatterns = null;
126
- this.typeFaces = null;
127
- }
128
- }
129
-
130
- class LocaleSet extends XFAObject {
131
- constructor(attributes) {
132
- super(LOCALE_SET_NS_ID, "localeSet", /* hasChildren = */ true);
133
- this.locale = new XFAObjectArray();
134
- }
135
- }
136
-
137
- class Meridiem extends StringObject {
138
- constructor(attributes) {
139
- super(LOCALE_SET_NS_ID, "meridiem");
140
- }
141
- }
142
-
143
- class MeridiemNames extends XFAObject {
144
- constructor(attributes) {
145
- super(LOCALE_SET_NS_ID, "meridiemNames", /* hasChildren = */ true);
146
- this.meridiem = new XFAObjectArray(2);
147
- }
148
- }
149
-
150
- class Month extends StringObject {
151
- constructor(attributes) {
152
- super(LOCALE_SET_NS_ID, "month");
153
- }
154
- }
155
-
156
- class MonthNames extends XFAObject {
157
- constructor(attributes) {
158
- super(LOCALE_SET_NS_ID, "monthNames", /* hasChildren = */ true);
159
- this.abbr = getInteger({
160
- data: attributes.abbr,
161
- defaultValue: 0,
162
- validate: x => x === 1,
163
- });
164
- this.month = new XFAObjectArray(12);
165
- }
166
- }
167
-
168
- class NumberPattern extends StringObject {
169
- constructor(attributes) {
170
- super(LOCALE_SET_NS_ID, "numberPattern");
171
- this.name = getStringOption(attributes.name, [
172
- "full",
173
- "long",
174
- "med",
175
- "short",
176
- ]);
177
- }
178
- }
179
-
180
- class NumberPatterns extends XFAObject {
181
- constructor(attributes) {
182
- super(LOCALE_SET_NS_ID, "numberPatterns", /* hasChildren = */ true);
183
- this.numberPattern = new XFAObjectArray(4);
184
- }
185
- }
186
-
187
- class NumberSymbol extends StringObject {
188
- constructor(attributes) {
189
- super(LOCALE_SET_NS_ID, "numberSymbol");
190
- this.name = getStringOption(attributes.name, [
191
- "decimal",
192
- "grouping",
193
- "percent",
194
- "minus",
195
- "zero",
196
- ]);
197
- }
198
- }
199
-
200
- class NumberSymbols extends XFAObject {
201
- constructor(attributes) {
202
- super(LOCALE_SET_NS_ID, "numberSymbols", /* hasChildren = */ true);
203
- this.numberSymbol = new XFAObjectArray(5);
204
- }
205
- }
206
-
207
- class TimePattern extends StringObject {
208
- constructor(attributes) {
209
- super(LOCALE_SET_NS_ID, "timePattern");
210
- this.name = getStringOption(attributes.name, [
211
- "full",
212
- "long",
213
- "med",
214
- "short",
215
- ]);
216
- }
217
- }
218
-
219
- class TimePatterns extends XFAObject {
220
- constructor(attributes) {
221
- super(LOCALE_SET_NS_ID, "timePatterns", /* hasChildren = */ true);
222
- this.timePattern = new XFAObjectArray(4);
223
- }
224
- }
225
-
226
- class TypeFace extends XFAObject {
227
- constructor(attributes) {
228
- super(LOCALE_SET_NS_ID, "typeFace", /* hasChildren = */ true);
229
- this.name = attributes.name | "";
230
- }
231
- }
232
-
233
- class TypeFaces extends XFAObject {
234
- constructor(attributes) {
235
- super(LOCALE_SET_NS_ID, "typeFaces", /* hasChildren = */ true);
236
- this.typeFace = new XFAObjectArray();
237
- }
238
- }
239
-
240
- class LocaleSetNamespace {
241
- static [$buildXFAObject](name, attributes) {
242
- if (LocaleSetNamespace.hasOwnProperty(name)) {
243
- return LocaleSetNamespace[name](attributes);
244
- }
245
- return undefined;
246
- }
247
-
248
- static calendarSymbols(attrs) {
249
- return new CalendarSymbols(attrs);
250
- }
251
-
252
- static currencySymbol(attrs) {
253
- return new CurrencySymbol(attrs);
254
- }
255
-
256
- static currencySymbols(attrs) {
257
- return new CurrencySymbols(attrs);
258
- }
259
-
260
- static datePattern(attrs) {
261
- return new DatePattern(attrs);
262
- }
263
-
264
- static datePatterns(attrs) {
265
- return new DatePatterns(attrs);
266
- }
267
-
268
- static dateTimeSymbols(attrs) {
269
- return new DateTimeSymbols(attrs);
270
- }
271
-
272
- static day(attrs) {
273
- return new Day(attrs);
274
- }
275
-
276
- static dayNames(attrs) {
277
- return new DayNames(attrs);
278
- }
279
-
280
- static era(attrs) {
281
- return new Era(attrs);
282
- }
283
-
284
- static eraNames(attrs) {
285
- return new EraNames(attrs);
286
- }
287
-
288
- static locale(attrs) {
289
- return new Locale(attrs);
290
- }
291
-
292
- static localeSet(attrs) {
293
- return new LocaleSet(attrs);
294
- }
295
-
296
- static meridiem(attrs) {
297
- return new Meridiem(attrs);
298
- }
299
-
300
- static meridiemNames(attrs) {
301
- return new MeridiemNames(attrs);
302
- }
303
-
304
- static month(attrs) {
305
- return new Month(attrs);
306
- }
307
-
308
- static monthNames(attrs) {
309
- return new MonthNames(attrs);
310
- }
311
-
312
- static numberPattern(attrs) {
313
- return new NumberPattern(attrs);
314
- }
315
-
316
- static numberPatterns(attrs) {
317
- return new NumberPatterns(attrs);
318
- }
319
-
320
- static numberSymbol(attrs) {
321
- return new NumberSymbol(attrs);
322
- }
323
-
324
- static numberSymbols(attrs) {
325
- return new NumberSymbols(attrs);
326
- }
327
-
328
- static timePattern(attrs) {
329
- return new TimePattern(attrs);
330
- }
331
-
332
- static timePatterns(attrs) {
333
- return new TimePatterns(attrs);
334
- }
335
-
336
- static typeFace(attrs) {
337
- return new TypeFace(attrs);
338
- }
339
-
340
- static typeFaces(attrs) {
341
- return new TypeFaces(attrs);
342
- }
343
- }
344
-
345
- export { LocaleSetNamespace };