@ui5/webcomponents-tools 0.0.0-e7dd012d7 → 0.0.0-ebd9a4db3

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 (101) hide show
  1. package/CHANGELOG.md +1943 -0
  2. package/README.md +6 -9
  3. package/assets-meta.js +22 -6
  4. package/bin/dev.js +1 -5
  5. package/components-package/eslint.js +66 -2
  6. package/components-package/nps.js +137 -55
  7. package/components-package/postcss.components.js +1 -21
  8. package/components-package/postcss.themes.js +1 -23
  9. package/components-package/vite.config.js +9 -0
  10. package/components-package/wdio.js +110 -39
  11. package/icons-collection/nps.js +54 -11
  12. package/lib/amd-to-es6/index.js +102 -0
  13. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  14. package/lib/cem/custom-elements-manifest.config.mjs +530 -0
  15. package/lib/cem/event.mjs +168 -0
  16. package/lib/cem/schema-internal.json +1422 -0
  17. package/lib/cem/schema.json +1098 -0
  18. package/lib/cem/types-internal.d.ts +808 -0
  19. package/lib/cem/types.d.ts +736 -0
  20. package/lib/cem/utils.mjs +423 -0
  21. package/lib/cem/validate.js +67 -0
  22. package/lib/copy-and-watch/index.js +30 -5
  23. package/lib/copy-list/index.js +28 -0
  24. package/lib/create-icons/index.js +127 -52
  25. package/lib/create-illustrations/index.js +182 -0
  26. package/lib/create-new-component/Component.js +74 -0
  27. package/lib/create-new-component/ComponentTemplate.js +12 -0
  28. package/lib/create-new-component/index.js +64 -97
  29. package/lib/css-processors/css-processor-components.mjs +78 -0
  30. package/lib/css-processors/css-processor-themes.mjs +74 -0
  31. package/lib/css-processors/scope-variables.mjs +49 -0
  32. package/lib/css-processors/shared.mjs +56 -0
  33. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  34. package/lib/dev-server/dev-server.mjs +66 -0
  35. package/lib/dev-server/virtual-index-html-plugin.js +56 -0
  36. package/lib/generate-js-imports/illustrations.js +86 -0
  37. package/lib/generate-json-imports/i18n.js +66 -37
  38. package/lib/generate-json-imports/themes.js +55 -34
  39. package/lib/hbs2lit/src/compiler.js +24 -4
  40. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  41. package/lib/hbs2lit/src/litVisitor2.js +113 -25
  42. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  43. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +40 -14
  44. package/lib/hbs2ui5/index.js +57 -24
  45. package/lib/i18n/defaults.js +66 -57
  46. package/lib/i18n/toJSON.js +13 -12
  47. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  48. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  49. package/lib/scoping/get-all-tags.js +11 -11
  50. package/lib/scoping/lint-src.js +9 -8
  51. package/lib/scoping/missing-dependencies.js +65 -0
  52. package/lib/scoping/report-tags-usage.js +28 -0
  53. package/lib/scoping/scope-test-pages.js +2 -1
  54. package/lib/test-runner/test-runner.js +71 -0
  55. package/package.json +55 -53
  56. package/tsconfig.json +18 -0
  57. package/bin/init-ui5-package.js +0 -3
  58. package/components-package/rollup.js +0 -145
  59. package/components-package/serve.json +0 -3
  60. package/lib/documentation/index.js +0 -143
  61. package/lib/documentation/templates/api-component-since.js +0 -3
  62. package/lib/documentation/templates/api-css-variables-section.js +0 -24
  63. package/lib/documentation/templates/api-events-section.js +0 -35
  64. package/lib/documentation/templates/api-methods-section.js +0 -26
  65. package/lib/documentation/templates/api-properties-section.js +0 -40
  66. package/lib/documentation/templates/api-slots-section.js +0 -28
  67. package/lib/documentation/templates/template.js +0 -38
  68. package/lib/init-package/index.js +0 -123
  69. package/lib/init-package/resources/.eslintignore +0 -3
  70. package/lib/init-package/resources/bundle.es5.js +0 -25
  71. package/lib/init-package/resources/bundle.esm.js +0 -34
  72. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  73. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  74. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  75. package/lib/init-package/resources/config/rollup.config.js +0 -1
  76. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  77. package/lib/init-package/resources/package-scripts.js +0 -11
  78. package/lib/init-package/resources/src/Assets.js +0 -5
  79. package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
  80. package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
  81. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  82. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  83. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  84. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  85. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  86. package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
  87. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  88. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  89. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  90. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  91. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  92. package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  93. package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  94. package/lib/init-package/resources/test/pages/index.html +0 -56
  95. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
  96. package/lib/jsdoc/config.json +0 -29
  97. package/lib/jsdoc/plugin.js +0 -2407
  98. package/lib/jsdoc/template/publish.js +0 -4092
  99. package/lib/postcss-css-to-esm/index.js +0 -42
  100. package/lib/postcss-css-to-json/index.js +0 -27
  101. package/package-lock.json +0 -48
@@ -0,0 +1,808 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
10
+
11
+ /**
12
+ * The top-level interface of a custom elements manifest file.
13
+ *
14
+ * Because custom elements are JavaScript classes, describing a custom element
15
+ * may require describing arbitrary JavaScript concepts like modules, classes,
16
+ * functions, etc. So custom elements manifests are capable of documenting
17
+ * the elements in a package, as well as those JavaScript concepts.
18
+ *
19
+ * The modules described in a package should be the public entrypoints that
20
+ * other packages may import from. Multiple modules may export the same object
21
+ * via re-exports, but in most cases a package should document the single
22
+ * canonical export that should be used.
23
+ */
24
+ export interface Package {
25
+ /**
26
+ * The version of the schema used in this file.
27
+ */
28
+ schemaVersion: string;
29
+
30
+ /**
31
+ * The Markdown to use for the main readme of this package.
32
+ *
33
+ * This can be used to override the readme used by Github or npm if that
34
+ * file contains information irrelevant to custom element catalogs and
35
+ * documentation viewers.
36
+ */
37
+ readme?: string;
38
+
39
+ /**
40
+ * An array of the modules this package contains.
41
+ */
42
+ modules: Array<Module>;
43
+
44
+ /**
45
+ * Whether the package is deprecated.
46
+ * If the value is a string, it's the reason for the deprecation.
47
+ */
48
+ deprecated?: boolean | string;
49
+ }
50
+
51
+ // This type may expand in the future to include JSON, CSS, or HTML
52
+ // modules.
53
+ export type Module = JavaScriptModule;
54
+
55
+ export interface JavaScriptModule {
56
+ kind: 'javascript-module';
57
+
58
+ /**
59
+ * Path to the javascript file needed to be imported.
60
+ * (not the path for example to a typescript file.)
61
+ */
62
+ path: string;
63
+
64
+ /**
65
+ * A markdown summary suitable for display in a listing.
66
+ */
67
+ summary?: string;
68
+
69
+ /**
70
+ * A markdown description of the module.
71
+ */
72
+ description?: string;
73
+
74
+ /**
75
+ * The declarations of a module.
76
+ *
77
+ * For documentation purposes, all declarations that are reachable from
78
+ * exports should be described here. Ie, functions and objects that may be
79
+ * properties of exported objects, or passed as arguments to functions.
80
+ */
81
+ declarations?: Array<Declaration>;
82
+
83
+ /**
84
+ * The exports of a module. This includes JavaScript exports and
85
+ * custom element definitions.
86
+ */
87
+ exports?: Array<Export>;
88
+
89
+ /**
90
+ * Whether the module is deprecated.
91
+ * If the value is a string, it's the reason for the deprecation.
92
+ */
93
+ deprecated?: boolean | string;
94
+ }
95
+
96
+ export type Export = JavaScriptExport | CustomElementExport;
97
+
98
+ export interface JavaScriptExport {
99
+ kind: 'js';
100
+
101
+ /**
102
+ * The name of the exported symbol.
103
+ *
104
+ * JavaScript has a number of ways to export objects which determine the
105
+ * correct name to use.
106
+ *
107
+ * - Default exports must use the name "default".
108
+ * - Named exports use the name that is exported. If the export is renamed
109
+ * with the "as" clause, use the exported name.
110
+ * - Aggregating exports (`* from`) should use the name `*`
111
+ */
112
+ name: string;
113
+
114
+ /**
115
+ * A reference to the exported declaration.
116
+ *
117
+ * In the case of aggregating exports, the reference's `module` field must be
118
+ * defined and the `name` field must be `"*"`.
119
+ */
120
+ declaration: Reference;
121
+
122
+ /**
123
+ * Whether the export is deprecated. For example, the name of the export was changed.
124
+ * If the value is a string, it's the reason for the deprecation.
125
+ */
126
+ deprecated?: boolean | string;
127
+ }
128
+
129
+ /**
130
+ * A global custom element defintion, ie the result of a
131
+ * `customElements.define()` call.
132
+ *
133
+ * This is represented as an export because a definition makes the element
134
+ * available outside of the module it's defined it.
135
+ */
136
+ export interface CustomElementExport {
137
+ kind: 'custom-element-definition';
138
+
139
+ /**
140
+ * The tag name of the custom element.
141
+ */
142
+ name: string;
143
+
144
+ /**
145
+ * A reference to the class or other declaration that implements the
146
+ * custom element.
147
+ */
148
+ declaration: Reference;
149
+
150
+ /**
151
+ * Whether the custom-element export is deprecated.
152
+ * For example, a future version will not register the custom element in this file.
153
+ * If the value is a string, it's the reason for the deprecation.
154
+ */
155
+ deprecated?: boolean | string;
156
+ }
157
+
158
+ export type Declaration =
159
+ | ClassDeclaration
160
+ | FunctionDeclaration
161
+ | MixinDeclaration
162
+ | VariableDeclaration
163
+ | CustomElementDeclaration
164
+ | EnumDeclaration
165
+ | InterfaceDeclaration
166
+ | CustomElementMixinDeclaration;
167
+
168
+ /**
169
+ * A reference to an export of a module.
170
+ *
171
+ * All references are required to be publically accessible, so the canonical
172
+ * representation of a reference is the export it's available from.
173
+ *
174
+ * `package` should generally refer to an npm package name. If `package` is
175
+ * undefined then the reference is local to this package. If `module` is
176
+ * undefined the reference is local to the containing module.
177
+ *
178
+ * References to global symbols like `Array`, `HTMLElement`, or `Event` should
179
+ * use a `package` name of `"global:"`.
180
+ */
181
+ export interface Reference {
182
+ name: string;
183
+ package?: string;
184
+ module?: string;
185
+ }
186
+
187
+ /**
188
+ * A reference to the source of a declaration or member.
189
+ */
190
+ export interface SourceReference {
191
+ /**
192
+ * An absolute URL to the source (ie. a GitHub URL).
193
+ */
194
+ href: string;
195
+ }
196
+
197
+ /**
198
+ * A description of a custom element class.
199
+ *
200
+ * Custom elements are JavaScript classes, so this extends from
201
+ * `ClassDeclaration` and adds custom-element-specific features like
202
+ * attributes, events, and slots.
203
+ *
204
+ * Note that `tagName` in this interface is optional. Tag names are not
205
+ * neccessarily part of a custom element class, but belong to the definition
206
+ * (often called the "registration") or the `customElements.define()` call.
207
+ *
208
+ * Because classes and tag names can only be registered once, there's a
209
+ * one-to-one relationship between classes and tag names. For ease of use,
210
+ * we allow the tag name here.
211
+ *
212
+ * Some packages define and register custom elements in separate modules. In
213
+ * these cases one `Module` should contain the `CustomElement` without a
214
+ * tagName, and another `Module` should contain the
215
+ * `CustomElementExport`.
216
+ */
217
+ // Note: this needs to be an interface to be included in the generated JSON
218
+ // Schema output.
219
+ export interface CustomElementDeclaration
220
+ extends ClassDeclaration,
221
+ CustomElement {
222
+ _ui5abstract?: boolean
223
+ /**
224
+ * Marks when the field was introduced
225
+ */
226
+ _ui5since?: string
227
+ }
228
+
229
+ /**
230
+ * The additional fields that a custom element adds to classes and mixins.
231
+ */
232
+ export interface CustomElement extends ClassLike {
233
+ /**
234
+ * An optional tag name that should be specified if this is a
235
+ * self-registering element.
236
+ *
237
+ * Self-registering elements must also include a CustomElementExport
238
+ * in the module's exports.
239
+ */
240
+ tagName?: string;
241
+
242
+ /**
243
+ * The attributes that this element is known to understand.
244
+ */
245
+ attributes?: Attribute[];
246
+
247
+ /**
248
+ * The events that this element fires.
249
+ */
250
+ events?: Event[];
251
+
252
+ /**
253
+ * The shadow dom content slots that this element accepts.
254
+ */
255
+ slots?: Slot[];
256
+
257
+ cssParts?: CssPart[];
258
+
259
+ cssProperties?: CssCustomProperty[];
260
+
261
+ demos?: Demo[];
262
+
263
+ /**
264
+ * Distinguishes a regular JavaScript class from a
265
+ * custom element class
266
+ */
267
+ customElement: true;
268
+ }
269
+
270
+ export interface Attribute {
271
+ name: string;
272
+
273
+ /**
274
+ * A markdown summary suitable for display in a listing.
275
+ */
276
+ summary?: string;
277
+
278
+ /**
279
+ * A markdown description.
280
+ */
281
+ description?: string;
282
+
283
+ inheritedFrom?: Reference;
284
+
285
+ /**
286
+ * The type that the attribute will be serialized/deserialized as.
287
+ */
288
+ type?: Type;
289
+
290
+ /**
291
+ * The default value of the attribute, if any.
292
+ *
293
+ * As attributes are always strings, this is the actual value, not a human
294
+ * readable description.
295
+ */
296
+ default?: string;
297
+
298
+ /**
299
+ * The name of the field this attribute is associated with, if any.
300
+ */
301
+ fieldName?: string;
302
+
303
+ /**
304
+ * Whether the attribute is deprecated.
305
+ * If the value is a string, it's the reason for the deprecation.
306
+ */
307
+ deprecated?: boolean | string;
308
+ }
309
+
310
+ export interface EnumDeclaration extends ClassLike {
311
+ kind: "enum"
312
+ }
313
+
314
+ export interface InterfaceDeclaration extends ClassLike {
315
+ kind: "interface"
316
+ }
317
+
318
+ export interface Event {
319
+ _ui5parameters?: Parameter[]
320
+ _ui5privacy?: Privacy
321
+ /**
322
+ * Whether the event is preventable.
323
+ */
324
+ _ui5allowPreventDefault?: boolean;
325
+
326
+ /**
327
+ * Whether the event is cancelable.
328
+ */
329
+ _ui5Cancelable?: boolean;
330
+
331
+ /**
332
+ * Whether the event is bubbles.
333
+ */
334
+ _ui5Bubbles?: boolean;
335
+
336
+ /**
337
+ * Marks when the field was introduced
338
+ */
339
+ _ui5since?: string
340
+ name: string;
341
+
342
+ /**
343
+ * A markdown summary suitable for display in a listing.
344
+ */
345
+ summary?: string;
346
+
347
+ /**
348
+ * A markdown description.
349
+ */
350
+ description?: string;
351
+
352
+ /**
353
+ * The type of the event object that's fired.
354
+ */
355
+ type: Type;
356
+
357
+ inheritedFrom?: Reference;
358
+
359
+ /**
360
+ * Whether the event is deprecated.
361
+ * If the value is a string, it's the reason for the deprecation.
362
+ */
363
+ deprecated?: boolean | string;
364
+ }
365
+
366
+ export interface Slot {
367
+ _ui5propertyName?: string
368
+ _ui5type?: Type
369
+ _ui5privacy?: Privacy
370
+ /**
371
+ * Marks when the field was introduced
372
+ */
373
+ _ui5since?: string
374
+ /**
375
+ * The slot name, or the empty string for an unnamed slot.
376
+ */
377
+ name: string;
378
+
379
+ /**
380
+ * A markdown summary suitable for display in a listing.
381
+ */
382
+ summary?: string;
383
+
384
+ /**
385
+ * A markdown description.
386
+ */
387
+ description?: string;
388
+
389
+ /**
390
+ * Whether the slot is deprecated.
391
+ * If the value is a string, it's the reason for the deprecation.
392
+ */
393
+ deprecated?: boolean | string;
394
+ }
395
+
396
+ /**
397
+ * The description of a CSS Part
398
+ */
399
+ export interface CssPart {
400
+ name: string;
401
+
402
+ /**
403
+ * A markdown summary suitable for display in a listing.
404
+ */
405
+ summary?: string;
406
+
407
+ /**
408
+ * A markdown description.
409
+ */
410
+ description?: string;
411
+
412
+ /**
413
+ * Whether the CSS shadow part is deprecated.
414
+ * If the value is a string, it's the reason for the deprecation.
415
+ */
416
+ deprecated?: boolean | string;
417
+ }
418
+
419
+ export interface CssCustomProperty {
420
+ /**
421
+ * The name of the property, including leading `--`.
422
+ */
423
+ name: string;
424
+
425
+ /**
426
+ * The expected syntax of the defined property. Defaults to "*".
427
+ *
428
+ * The syntax must be a valid CSS [syntax string](https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax)
429
+ * as defined in the CSS Properties and Values API.
430
+ *
431
+ * Examples:
432
+ *
433
+ * "<color>": accepts a color
434
+ * "<length> | <percentage>": accepts lengths or percentages but not calc expressions with a combination of the two
435
+ * "small | medium | large": accepts one of these values set as custom idents.
436
+ * "*": any valid token
437
+ */
438
+ syntax?: string;
439
+
440
+ default?: string;
441
+
442
+ /**
443
+ * A markdown summary suitable for display in a listing.
444
+ */
445
+ summary?: string;
446
+
447
+ /**
448
+ * A markdown description.
449
+ */
450
+ description?: string;
451
+
452
+ /**
453
+ * Whether the CSS custom property is deprecated.
454
+ * If the value is a string, it's the reason for the deprecation.
455
+ */
456
+ deprecated?: boolean | string;
457
+ }
458
+
459
+ export interface Type {
460
+ /**
461
+ * The full string representation of the type, in whatever type syntax is
462
+ * used, such as JSDoc, Closure, or TypeScript.
463
+ */
464
+ text: string;
465
+
466
+ /**
467
+ * An array of references to the types in the type string.
468
+ *
469
+ * These references have optional indices into the type string so that tools
470
+ * can understand the references in the type string independently of the type
471
+ * system and syntax. For example, a documentation viewer could display the
472
+ * type `Array<FooElement | BarElement>` with cross-references to `FooElement`
473
+ * and `BarElement` without understanding arrays, generics, or union types.
474
+ */
475
+ references?: TypeReference[];
476
+
477
+ source?: SourceReference;
478
+ }
479
+
480
+ /**
481
+ * A reference that is associated with a type string and optionally a range
482
+ * within the string.
483
+ *
484
+ * Start and end must both be present or not present. If they're present, they
485
+ * are indices into the associated type string. If they are missing, the entire
486
+ * type string is the symbol referenced and the name should match the type
487
+ * string.
488
+ */
489
+ export interface TypeReference extends Reference {
490
+ start?: number;
491
+ end?: number;
492
+ }
493
+
494
+ /**
495
+ * The common interface of classes and mixins.
496
+ */
497
+ export interface ClassLike {
498
+ _ui5experimental?: boolean | string
499
+ _ui5implements?: Reference[]
500
+ _ui5privacy?: Privacy
501
+ /**
502
+ * Marks when the field was introduced
503
+ */
504
+ _ui5since?: string
505
+ name: string;
506
+
507
+ /**
508
+ * A markdown summary suitable for display in a listing.
509
+ */
510
+ summary?: string;
511
+
512
+ /**
513
+ * A markdown description of the class.
514
+ */
515
+ description?: string;
516
+
517
+ /**
518
+ * The superclass of this class.
519
+ *
520
+ * If this class is defined with mixin applications, the prototype chain
521
+ * includes the mixin applications and the true superclass is computed
522
+ * from them.
523
+ */
524
+ superclass?: Reference;
525
+
526
+ /**
527
+ * Any class mixins applied in the extends clause of this class.
528
+ *
529
+ * If mixins are applied in the class definition, then the true superclass
530
+ * of this class is the result of applying mixins in order to the superclass.
531
+ *
532
+ * Mixins must be listed in order of their application to the superclass or
533
+ * previous mixin application. This means that the innermost mixin is listed
534
+ * first. This may read backwards from the common order in JavaScript, but
535
+ * matches the order of language used to describe mixin application, like
536
+ * "S with A, B".
537
+ *
538
+ * @example
539
+ *
540
+ * ```javascript
541
+ * class T extends B(A(S)) {}
542
+ * ```
543
+ *
544
+ * is described by:
545
+ * ```json
546
+ * {
547
+ * "kind": "class",
548
+ * "superclass": {
549
+ * "name": "S"
550
+ * },
551
+ * "mixins": [
552
+ * {
553
+ * "name": "A"
554
+ * },
555
+ * {
556
+ * "name": "B"
557
+ * },
558
+ * ]
559
+ * }
560
+ * ```
561
+ */
562
+ mixins?: Array<Reference>;
563
+ members?: Array<ClassMember>;
564
+
565
+ source?: SourceReference;
566
+
567
+ /**
568
+ * Whether the class or mixin is deprecated.
569
+ * If the value is a string, it's the reason for the deprecation.
570
+ */
571
+ deprecated?: boolean | string;
572
+ }
573
+
574
+ export interface ClassDeclaration extends ClassLike {
575
+ kind: 'class';
576
+ }
577
+
578
+ export type ClassMember = ClassField | ClassMethod;
579
+
580
+ /**
581
+ * The common interface of variables, class fields, and function
582
+ * parameters.
583
+ */
584
+ export interface PropertyLike {
585
+ name: string;
586
+
587
+ /**
588
+ * A markdown summary suitable for display in a listing.
589
+ */
590
+ summary?: string;
591
+
592
+ /**
593
+ * A markdown description of the field.
594
+ */
595
+ description?: string;
596
+
597
+ type?: Type;
598
+
599
+ default?: string;
600
+
601
+ /**
602
+ * Whether the property is deprecated.
603
+ * If the value is a string, it's the reason for the deprecation.
604
+ */
605
+ deprecated?: boolean | string;
606
+
607
+ /**
608
+ * Whether the property is read-only.
609
+ */
610
+ readonly?: boolean;
611
+ }
612
+
613
+ export interface ClassField extends PropertyLike {
614
+ _ui5noAttribute?: boolean;
615
+ _ui5validator?: string
616
+ _ui5formProperty?: boolean
617
+ _ui5formEvents?: string
618
+ /**
619
+ * Marks when the field was introduced
620
+ */
621
+ _ui5since?: string
622
+ kind: 'field';
623
+ static?: boolean;
624
+ privacy?: Privacy;
625
+ inheritedFrom?: Reference;
626
+ source?: SourceReference;
627
+ }
628
+
629
+ /**
630
+ * Additional metadata for fields on custom elements.
631
+ */
632
+ export interface CustomElementField extends ClassField {
633
+ /**
634
+ * The corresponding attribute name if there is one.
635
+ *
636
+ * If this property is defined, the attribute must be listed in the classes'
637
+ * `attributes` array.
638
+ */
639
+ attribute?: string;
640
+
641
+ /**
642
+ * If the property reflects to an attribute.
643
+ *
644
+ * If this is true, the `attribute` property must be defined.
645
+ */
646
+ reflects?: boolean;
647
+ }
648
+
649
+ export interface ClassMethod extends FunctionLike {
650
+ /**
651
+ * Marks when the field was introduced
652
+ */
653
+ _ui5since?: string
654
+ kind: 'method';
655
+ static?: boolean;
656
+ privacy?: Privacy;
657
+ inheritedFrom?: Reference;
658
+ source?: SourceReference;
659
+ }
660
+
661
+ /**
662
+ * A description of a class mixin.
663
+ *
664
+ * Mixins are functions which generate a new subclass of a given superclass.
665
+ * This interfaces describes the class and custom element features that
666
+ * are added by the mixin. As such, it extends the CustomElement interface and
667
+ * ClassLike interface.
668
+ *
669
+ * Since mixins are functions, it also extends the FunctionLike interface. This
670
+ * means a mixin is callable, and has parameters and a return type.
671
+ *
672
+ * The return type is often hard or impossible to accurately describe in type
673
+ * systems like TypeScript. It requires generics and an `extends` operator
674
+ * that TypeScript lacks. Therefore it's recommended that the return type is
675
+ * left empty. The most common form of a mixin function takes a single
676
+ * argument, so consumers of this interface should assume that the return type
677
+ * is the single argument subclassed by this declaration.
678
+ *
679
+ * A mixin should not have a superclass. If a mixins composes other mixins,
680
+ * they should be listed in the `mixins` field.
681
+ *
682
+ * See [this article]{@link https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/}
683
+ * for more information on the classmixin pattern in JavaScript.
684
+ *
685
+ * @example
686
+ *
687
+ * This JavaScript mixin declaration:
688
+ * ```javascript
689
+ * const MyMixin = (base) => class extends base {
690
+ * foo() { ... }
691
+ * }
692
+ * ```
693
+ *
694
+ * Is described by this JSON:
695
+ * ```json
696
+ * {
697
+ * "kind": "mixin",
698
+ * "name": "MyMixin",
699
+ * "parameters": [
700
+ * {
701
+ * "name": "base",
702
+ * }
703
+ * ],
704
+ * "members": [
705
+ * {
706
+ * "kind": "method",
707
+ * "name": "foo",
708
+ * }
709
+ * ]
710
+ * }
711
+ * ```
712
+ */
713
+ export interface MixinDeclaration extends ClassLike, FunctionLike {
714
+ kind: 'mixin';
715
+ }
716
+
717
+ /**
718
+ * A class mixin that also adds custom element related properties.
719
+ */
720
+ // Note: this needs to be an interface to be included in the generated JSON
721
+ // Schema output.
722
+ export interface CustomElementMixinDeclaration
723
+ extends MixinDeclaration,
724
+ CustomElement { }
725
+
726
+ export interface VariableDeclaration extends PropertyLike {
727
+ kind: 'variable';
728
+ source?: SourceReference;
729
+ }
730
+
731
+ export interface FunctionDeclaration extends FunctionLike {
732
+ /**
733
+ * Marks when the field was introduced
734
+ */
735
+ _ui5since?: string
736
+ kind: 'function';
737
+ source?: SourceReference;
738
+ }
739
+
740
+ export interface Parameter extends PropertyLike {
741
+ _ui5privacy?: Privacy
742
+ /**
743
+ * Marks when the field was introduced
744
+ */
745
+ _ui5since?: string
746
+ /**
747
+ * Whether the parameter is optional. Undefined implies non-optional.
748
+ */
749
+ optional?: boolean;
750
+ /**
751
+ * Whether the parameter is a rest parameter. Only the last parameter may be a rest parameter.
752
+ * Undefined implies single parameter.
753
+ */
754
+ rest?: boolean;
755
+ }
756
+
757
+ export interface FunctionLike {
758
+ name: string;
759
+
760
+ /**
761
+ * A markdown summary suitable for display in a listing.
762
+ */
763
+ summary?: string;
764
+
765
+ /**
766
+ * A markdown description.
767
+ */
768
+ description?: string;
769
+
770
+ /**
771
+ * Whether the function is deprecated.
772
+ * If the value is a string, it's the reason for the deprecation.
773
+ */
774
+ deprecated?: boolean | string;
775
+
776
+ parameters?: Parameter[];
777
+
778
+ return?: {
779
+ type?: Type;
780
+
781
+ /**
782
+ * A markdown summary suitable for display in a listing.
783
+ */
784
+ summary?: string;
785
+
786
+ /**
787
+ * A markdown description.
788
+ */
789
+ description?: string;
790
+ };
791
+ }
792
+
793
+ export type Privacy = 'public' | 'private' | 'protected';
794
+
795
+ export interface Demo {
796
+ /**
797
+ * A markdown description of the demo.
798
+ */
799
+ description?: string;
800
+
801
+ /**
802
+ * Relative URL of the demo if it's published with the package. Absolute URL
803
+ * if it's hosted.
804
+ */
805
+ url: string;
806
+
807
+ source?: SourceReference;
808
+ }