xmlui 0.9.31 → 0.9.32

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.
@@ -12,7 +12,7 @@
12
12
  */
13
13
  @scope (#_ui-engine-theme-root) {
14
14
  :scope {
15
- line-height: 1.5;
15
+ line-height: 1.7;
16
16
  font-feature-settings: var(--xmlui-font-feature-settings);
17
17
  font-variation-settings: normal;
18
18
  -webkit-font-smoothing: antialiased;
@@ -190,7 +190,7 @@
190
190
  html {
191
191
  -webkit-text-size-adjust: 100%;
192
192
  tab-size: 4;
193
- line-height: 1.5;
193
+ line-height: 1.7;
194
194
  }
195
195
  body {
196
196
  line-height: inherit;
@@ -1,4 +1,4 @@
1
- import { m as main, s as start } from "./server-common-Cucl1Ik4.mjs";
1
+ import { m as main, s as start } from "./server-common-1aXZ-B7H.mjs";
2
2
  var browser = main;
3
3
  const messageReader = new browser.BrowserMessageReader(self);
4
4
  messageReader.listen((message) => {
@@ -1,4 +1,4 @@
1
- import { m as main, s as start$1 } from "./server-common-Cucl1Ik4.mjs";
1
+ import { m as main, s as start$1 } from "./server-common-1aXZ-B7H.mjs";
2
2
  var node = main;
3
3
  function start() {
4
4
  const connection = node.createConnection(node.ProposedFeatures.all);
@@ -0,0 +1,659 @@
1
+ import { w as COMPOUND_COMP_ID, y as CORE_NAMESPACE_VALUE } from "./transform-B-MhfH46.mjs";
2
+ const attrBreakRegex = /[\r\n<>'"&]/;
3
+ class XmlUiHelper {
4
+ /**
5
+ * Serialize the specified XML fragment into a string
6
+ * @param xml XML fragment to serialize
7
+ * @param options Formatting options to use
8
+ */
9
+ serialize(xml, options) {
10
+ const fragment = Array.isArray(xml) ? xml : [xml];
11
+ return serializeFragment(fragment, 0);
12
+ function serializeFragment(nodes, depth) {
13
+ return nodes.map((n) => serializeNode(n, depth)).join((options == null ? void 0 : options.prettify) ? "\n" + getIndent(depth) : "");
14
+ }
15
+ function serializeNode(node, depth) {
16
+ switch (node.type) {
17
+ case "XmlUiComment":
18
+ return serializeXmlComment(node, depth);
19
+ case "XmlUiElement":
20
+ return serializeXmlElement(node, depth);
21
+ default:
22
+ return "";
23
+ }
24
+ }
25
+ function getIndent(depth) {
26
+ return (options == null ? void 0 : options.prettify) ? "".padEnd(((options == null ? void 0 : options.indents) ?? 2) * depth, " ") : "";
27
+ }
28
+ function serializeXmlComment(node, depth) {
29
+ return `${getIndent(depth)}<!--${node.text}-->`;
30
+ }
31
+ function serializeXmlElement(node, depth) {
32
+ var _a, _b;
33
+ let elementStr = `${getIndent(depth)}<${nodeName()}`;
34
+ const hasAttrs = (((_a = node.attributes) == null ? void 0 : _a.length) ?? 0) > 0;
35
+ const hasChildren = (((_b = node.childNodes) == null ? void 0 : _b.length) ?? 0) > 0;
36
+ if (node.text || hasAttrs || hasChildren) {
37
+ if (hasAttrs) {
38
+ const attrTexts = node.attributes.map((a) => serializeXmlAttribute(a));
39
+ if (!(options == null ? void 0 : options.prettify)) {
40
+ elementStr += " " + attrTexts.join(" ");
41
+ } else {
42
+ const nodeLength = elementStr.length + 1 + // --- Space after
43
+ attrTexts.join(" ").length + // --- Attributes total length
44
+ (hasChildren ? 1 : (options == null ? void 0 : options.useSpaceBeforeClose) ?? false ? 3 : 2);
45
+ if (nodeLength > ((options == null ? void 0 : options.lineLength) ?? 80)) {
46
+ attrTexts.forEach((text) => {
47
+ elementStr += "\n" + getIndent(depth + 1) + text;
48
+ });
49
+ if ((options == null ? void 0 : options.breakClosingTag) ?? false) {
50
+ elementStr += "\n" + getIndent(depth);
51
+ }
52
+ } else {
53
+ elementStr += " " + attrTexts.join(" ");
54
+ }
55
+ }
56
+ }
57
+ if (node.text || hasChildren) {
58
+ elementStr += ">";
59
+ if (node.text) {
60
+ const textContents = node.preserveSpaces ? serializeQuotedText(node.text) : serializeText(node.text);
61
+ if ((options == null ? void 0 : options.prettify) && elementStr.length + textContents.length + node.name.length + 3 > ((options == null ? void 0 : options.lineLength) ?? 80)) {
62
+ elementStr += "\n" + getIndent(depth + 1) + textContents + "\n";
63
+ } else {
64
+ elementStr += textContents;
65
+ }
66
+ }
67
+ if (hasChildren) {
68
+ const childrenTexts = node.childNodes.map((c) => serializeNode(c, depth + 1));
69
+ if (!(options == null ? void 0 : options.prettify)) {
70
+ elementStr += childrenTexts.join("");
71
+ } else {
72
+ childrenTexts.forEach((text) => {
73
+ elementStr += "\n" + text;
74
+ });
75
+ elementStr += "\n";
76
+ }
77
+ }
78
+ elementStr += `${getIndent(depth)}</${node.name}>`;
79
+ } else {
80
+ elementStr += ((options == null ? void 0 : options.useSpaceBeforeClose) ?? false ? " " : "") + "/>";
81
+ }
82
+ } else {
83
+ elementStr += ((options == null ? void 0 : options.useSpaceBeforeClose) ?? false ? " " : "") + "/>";
84
+ if (node.text === "") {
85
+ elementStr += `""</${nodeName()}>`;
86
+ }
87
+ }
88
+ return elementStr;
89
+ function nodeName() {
90
+ return node.namespace ? `${node.namespace}:${node.name}` : node.name;
91
+ }
92
+ }
93
+ function serializeXmlAttribute(node) {
94
+ if (node.value === void 0 || node.value === null) {
95
+ return `${nodeName()}`;
96
+ }
97
+ if (node.preserveSpaces) {
98
+ return `${nodeName()}=${serializeQuotedText(node.value)}`;
99
+ }
100
+ const value = node.value ?? "";
101
+ return `${nodeName()}=${serializeQuotedText(value)}`;
102
+ function nodeName() {
103
+ return node.namespace ? `${node.namespace}:${node.name}` : node.name;
104
+ }
105
+ }
106
+ function serializeText(text) {
107
+ return (options == null ? void 0 : options.useQuotes) || attrBreakRegex.test(text) ? serializeQuotedText(text) : text;
108
+ }
109
+ function serializeQuotedText(text) {
110
+ const containsQuote = text.indexOf("'") >= 0;
111
+ const containsDQuote = text.indexOf('"') >= 0;
112
+ if (!containsQuote && !containsDQuote || containsQuote && !containsDQuote) {
113
+ return `"${text.replaceAll("`", "\\`")}"`;
114
+ }
115
+ if (containsDQuote && !containsQuote) {
116
+ return `'${text.replaceAll("`", "\\`")}'`;
117
+ }
118
+ return `\`${text.replaceAll("`", "\\`")}\``;
119
+ }
120
+ }
121
+ /**
122
+ * Transform the specified component definition into an XMLUI node
123
+ * @param def Component definitions
124
+ * @param options Transformation options
125
+ */
126
+ transformComponentDefinition(def, options) {
127
+ return def.type ? this.transformSimpleComponentDefinition(def, options) : this.transformCompoundComponentDefinition(def, options);
128
+ }
129
+ /**
130
+ * Transform the specified object into an XMLUI nodes
131
+ * @param def Object definition
132
+ * @param options Transformation options
133
+ */
134
+ transformObject(def, options) {
135
+ const transformed = this.transformValue("Object", "", def, options);
136
+ if (!transformed) {
137
+ return null;
138
+ }
139
+ return transformed.childNodes ?? [];
140
+ }
141
+ /**
142
+ * Transforms the specified simple component definition into an XMLUI node
143
+ * @param def Component definition
144
+ * @param options Transformation options
145
+ */
146
+ transformSimpleComponentDefinition(def, options) {
147
+ const componentNode = {
148
+ type: "XmlUiElement",
149
+ name: def.type
150
+ };
151
+ if (def.uid !== void 0) {
152
+ this.addProperty(componentNode, "id", def.uid, options);
153
+ }
154
+ if (def.testId !== void 0) {
155
+ this.addProperty(componentNode, "testId", def.testId, options);
156
+ }
157
+ if (def.when !== void 0) {
158
+ this.addProperty(componentNode, "when", def.when, options);
159
+ }
160
+ if (def.vars) {
161
+ Object.keys(def.vars).forEach((key) => {
162
+ const varElement = this.transformValue("var", key, def.vars[key], options);
163
+ if (varElement === null) return;
164
+ componentNode.childNodes ?? (componentNode.childNodes = []);
165
+ componentNode.childNodes.push(varElement);
166
+ });
167
+ }
168
+ if (def.props) {
169
+ Object.keys(def.props).forEach((key) => {
170
+ const propValue = def.props[key];
171
+ if (key.endsWith("Template") && propValue.type) {
172
+ componentNode.childNodes ?? (componentNode.childNodes = []);
173
+ const propWrapper = {
174
+ type: "XmlUiElement",
175
+ name: "property",
176
+ attributes: [
177
+ {
178
+ type: "XmlUiAttribute",
179
+ name: "name",
180
+ value: key
181
+ }
182
+ ]
183
+ };
184
+ this.addComponentElement(propWrapper, propValue);
185
+ componentNode.childNodes.push(propWrapper);
186
+ } else {
187
+ if (propValue === void 0) {
188
+ return;
189
+ }
190
+ if (propValue === null) {
191
+ const nullPropElement = {
192
+ type: "XmlUiElement",
193
+ name: "property",
194
+ attributes: [
195
+ {
196
+ type: "XmlUiAttribute",
197
+ name: "name",
198
+ value: key
199
+ }
200
+ ]
201
+ };
202
+ componentNode.childNodes ?? (componentNode.childNodes = []);
203
+ componentNode.childNodes.push(nullPropElement);
204
+ return;
205
+ }
206
+ if (key === "id" || key === "when" || key === "testId" || (options == null ? void 0 : options.extractProps)) {
207
+ const idPropElement = {
208
+ type: "XmlUiElement",
209
+ name: "property"
210
+ };
211
+ this.addProperty(idPropElement, key, propValue, options);
212
+ componentNode.childNodes ?? (componentNode.childNodes = []);
213
+ componentNode.childNodes.push(idPropElement);
214
+ return;
215
+ }
216
+ this.addProperty(componentNode, key, propValue, options);
217
+ }
218
+ });
219
+ }
220
+ if (def.events) {
221
+ Object.keys(def.events).forEach((key) => {
222
+ const eventElement = this.transformValue("event", key, def.events[key], options);
223
+ if (eventElement === null) return;
224
+ componentNode.childNodes ?? (componentNode.childNodes = []);
225
+ componentNode.childNodes.push(eventElement);
226
+ });
227
+ }
228
+ if (def.loaders) {
229
+ this.addComponentList(componentNode, "loaders", def.loaders);
230
+ }
231
+ if (def.api) {
232
+ Object.keys(def.api).forEach((key) => {
233
+ const apiElement = this.transformValue("api", key, def.api[key], options);
234
+ if (apiElement === null) return;
235
+ componentNode.childNodes ?? (componentNode.childNodes = []);
236
+ componentNode.childNodes.push(apiElement);
237
+ });
238
+ }
239
+ if (def.uses) {
240
+ this.addList(componentNode, "uses", "", def.uses, options);
241
+ }
242
+ if (def.children) {
243
+ if (typeof def.children === "string") {
244
+ this.addProperty(componentNode, "children", def.children, options);
245
+ } else {
246
+ def.children.forEach((ch) => {
247
+ this.addComponentElement(componentNode, ch);
248
+ });
249
+ }
250
+ }
251
+ return componentNode;
252
+ }
253
+ /**
254
+ * Transforms the specified simple component definition into an Xml node
255
+ * @param def Compound component definition
256
+ * @param options Transformation options
257
+ */
258
+ transformCompoundComponentDefinition(def, options) {
259
+ if (typeof def === "string") {
260
+ return {
261
+ type: "XmlUiElement",
262
+ name: def
263
+ };
264
+ }
265
+ const nested = this.transformSimpleComponentDefinition(
266
+ def.component,
267
+ options
268
+ );
269
+ const componentNode = {
270
+ type: "XmlUiElement",
271
+ name: COMPOUND_COMP_ID,
272
+ attributes: [
273
+ {
274
+ type: "XmlUiAttribute",
275
+ name: "name",
276
+ value: def.name
277
+ }
278
+ ],
279
+ childNodes: Array.isArray(nested) ? [...nested] : [nested]
280
+ };
281
+ if (def.api) {
282
+ Object.keys(def.api).forEach((key) => {
283
+ const apiElement = this.transformValue("api", key, def.api[key], options);
284
+ if (apiElement === null) return;
285
+ componentNode.childNodes ?? (componentNode.childNodes = []);
286
+ componentNode.childNodes.push(apiElement);
287
+ });
288
+ }
289
+ return componentNode;
290
+ }
291
+ /**
292
+ * Transforms a value into an XMLUI element
293
+ * @param nodeName Name of the value node
294
+ * @param name Optional (property) name
295
+ * @param value Value to transform
296
+ * @param options Transformation options
297
+ */
298
+ transformValue(nodeName, name, value, options) {
299
+ if (value === void 0) return null;
300
+ const valueNode = {
301
+ type: "XmlUiElement",
302
+ name: nodeName
303
+ };
304
+ if (name) {
305
+ valueNode.attributes = [
306
+ {
307
+ type: "XmlUiAttribute",
308
+ name: "name",
309
+ value: name
310
+ }
311
+ ];
312
+ }
313
+ if (value === null) {
314
+ return valueNode;
315
+ }
316
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
317
+ const strValue = typeof value === "string" ? value.toString() : `{${value.toString()}}`;
318
+ const preserveSpaces = attrBreakRegex.test(strValue) || strValue.trim().length != strValue.length;
319
+ if (options == null ? void 0 : options.preferTextToValue) {
320
+ valueNode.text = strValue;
321
+ valueNode.preserveSpaces = preserveSpaces;
322
+ } else {
323
+ valueNode.attributes ?? (valueNode.attributes = []);
324
+ valueNode.attributes.push({
325
+ type: "XmlUiAttribute",
326
+ name: "value",
327
+ value: strValue,
328
+ preserveSpaces
329
+ });
330
+ }
331
+ return valueNode;
332
+ }
333
+ if (Array.isArray(value)) {
334
+ if (value.length === 0) {
335
+ valueNode.attributes ?? (valueNode.attributes = []);
336
+ valueNode.attributes.push({
337
+ type: "XmlUiAttribute",
338
+ name: "value",
339
+ value: "{[]}"
340
+ });
341
+ } else {
342
+ value.forEach((item) => {
343
+ const itemElement = this.transformValue("item", void 0, item, options);
344
+ if (!itemElement) return;
345
+ valueNode.childNodes ?? (valueNode.childNodes = []);
346
+ valueNode.childNodes.push(itemElement);
347
+ });
348
+ }
349
+ } else if (typeof value === "object") {
350
+ const keys = Object.keys(value);
351
+ if (keys.length === 0) {
352
+ valueNode.attributes ?? (valueNode.attributes = []);
353
+ valueNode.attributes.push({
354
+ type: "XmlUiAttribute",
355
+ name: "value",
356
+ value: "{{}}"
357
+ });
358
+ } else {
359
+ keys.forEach((key) => {
360
+ const fieldElement = this.transformValue("field", key, value[key], options);
361
+ if (!fieldElement) return;
362
+ valueNode.childNodes ?? (valueNode.childNodes = []);
363
+ valueNode.childNodes.push(fieldElement);
364
+ });
365
+ }
366
+ } else {
367
+ throw new Error(`Cannot serialize '${typeof value}' value`);
368
+ }
369
+ return valueNode;
370
+ }
371
+ /**
372
+ * Transforms the specified simple component definition into an Xml node
373
+ * @param name Element name
374
+ * @param value Value to transform
375
+ * @param options Transformation options
376
+ */
377
+ transformObjectValue(name, value, options) {
378
+ const componentNode = {
379
+ type: "XmlUiElement",
380
+ name
381
+ };
382
+ if (value) {
383
+ Object.keys(value).forEach(
384
+ (key) => this.addProperty(componentNode, key, value[key], options)
385
+ );
386
+ }
387
+ return componentNode;
388
+ }
389
+ /**
390
+ * Add a property to the specified XMLUI element
391
+ * @param element XML element
392
+ * @param name Element name
393
+ * @param value Element value
394
+ * @param options Transformation options
395
+ */
396
+ addProperty(element, name, value, options) {
397
+ switch (typeof value) {
398
+ case "undefined":
399
+ break;
400
+ case "string":
401
+ element.attributes ?? (element.attributes = []);
402
+ element.attributes.push({
403
+ type: "XmlUiAttribute",
404
+ name,
405
+ value: value == null ? void 0 : value.toString(),
406
+ preserveQuotes: (options == null ? void 0 : options.removeQuotes) ?? false,
407
+ preserveSpaces: attrBreakRegex.test(value.toString())
408
+ });
409
+ break;
410
+ case "boolean":
411
+ case "number":
412
+ case "object":
413
+ const objElement = this.transformValue("property", name, value, options);
414
+ if (objElement) {
415
+ element.childNodes ?? (element.childNodes = []);
416
+ element.childNodes.push(objElement);
417
+ }
418
+ break;
419
+ default:
420
+ throw new Error(`'${typeof value}' transformation is not implemented yet`);
421
+ }
422
+ }
423
+ addComponentElement(element, component) {
424
+ element.childNodes ?? (element.childNodes = []);
425
+ const childDef = this.transformComponentDefinition(component);
426
+ if (Array.isArray(childDef)) {
427
+ element.childNodes.push(...childDef);
428
+ } else {
429
+ element.childNodes.push(childDef);
430
+ }
431
+ }
432
+ /**
433
+ * Adds a list to the specified XML element
434
+ * @param element XML element
435
+ * @param name Name of the list (child in `element`)
436
+ * @param prefix Prefix to use for the list
437
+ * @param list List with items
438
+ * @param options Transformation options
439
+ */
440
+ addList(element, name, prefix, list, options) {
441
+ const nodeName = `${prefix ? prefix + "." : ""}${name}`;
442
+ element.childNodes ?? (element.childNodes = []);
443
+ list.forEach((item) => {
444
+ if (typeof item === "string") {
445
+ element.childNodes.push({
446
+ type: "XmlUiElement",
447
+ name: nodeName,
448
+ text: item,
449
+ preserveSpaces: attrBreakRegex.test(item) || item !== item.trim() || item === ""
450
+ });
451
+ } else if (item === null) {
452
+ element.childNodes.push({
453
+ type: "XmlUiElement",
454
+ name: nodeName
455
+ });
456
+ } else {
457
+ const transformed = this.transformObjectValue(nodeName, item, options);
458
+ if (Array.isArray(transformed)) {
459
+ element.childNodes.push(...transformed);
460
+ } else {
461
+ element.childNodes.push(transformed);
462
+ }
463
+ }
464
+ });
465
+ }
466
+ /**
467
+ * Adds a component list to the specified element
468
+ * @param element XML element
469
+ * @param name Name to use for the wrapper element
470
+ * @param list List with component items
471
+ * @private
472
+ */
473
+ addComponentList(element, name, list) {
474
+ const children = [];
475
+ list.forEach((item) => {
476
+ const fragment = this.transformSimpleComponentDefinition(item);
477
+ if (Array.isArray(fragment)) {
478
+ children.push(...fragment);
479
+ } else {
480
+ children.push(fragment);
481
+ }
482
+ });
483
+ const listElement = {
484
+ type: "XmlUiElement",
485
+ name,
486
+ childNodes: children
487
+ };
488
+ element.childNodes ?? (element.childNodes = []);
489
+ element.childNodes.push(listElement);
490
+ }
491
+ }
492
+ const componentFileExtension = "xmlui";
493
+ const codeBehindFileExtension = "xmlui.xs";
494
+ const moduleFileExtension = "xs";
495
+ var LintSeverity = /* @__PURE__ */ ((LintSeverity2) => {
496
+ LintSeverity2[LintSeverity2["Skip"] = 0] = "Skip";
497
+ LintSeverity2[LintSeverity2["Warning"] = 1] = "Warning";
498
+ LintSeverity2[LintSeverity2["Error"] = 2] = "Error";
499
+ return LintSeverity2;
500
+ })(LintSeverity || {});
501
+ var LintDiagKind = /* @__PURE__ */ ((LintDiagKind2) => {
502
+ LintDiagKind2[LintDiagKind2["UnrecognisedProp"] = 0] = "UnrecognisedProp";
503
+ return LintDiagKind2;
504
+ })(LintDiagKind || {});
505
+ function getLintSeverity(lintSeverityOption) {
506
+ if (!lintSeverityOption) {
507
+ return 1;
508
+ }
509
+ switch (lintSeverityOption.toLowerCase()) {
510
+ case "warning":
511
+ return 1;
512
+ case "error":
513
+ return 2;
514
+ case "skip":
515
+ return 0;
516
+ default:
517
+ console.warn(`Invalid lint severity option '${lintSeverityOption}'. Must be one of: 'warning', 'error', 'skip'. Defaulting to 'warning'.`);
518
+ return 1;
519
+ }
520
+ }
521
+ function lintApp({
522
+ appDef,
523
+ metadataProvider
524
+ }) {
525
+ const entryPointLints = {
526
+ componentName: "Main",
527
+ lints: lint({
528
+ component: appDef.entryPoint,
529
+ metadataProvider
530
+ })
531
+ };
532
+ const compoundCompLints = (appDef.components ?? []).map((c) => {
533
+ const lints = lint({
534
+ component: c,
535
+ metadataProvider
536
+ });
537
+ return { lints, componentName: c.name };
538
+ });
539
+ return [entryPointLints, ...compoundCompLints].filter((diags) => diags.lints.length > 0);
540
+ }
541
+ function printComponentLints(lintDiags) {
542
+ console.group(`Validation on '${lintDiags.componentName}':`);
543
+ lintDiags.lints.forEach(({ message }) => {
544
+ console.warn(message);
545
+ });
546
+ console.groupEnd();
547
+ }
548
+ function lintErrorsComponent(lints) {
549
+ function makeComponent() {
550
+ const errList = lints.map((lint2, idx) => {
551
+ return {
552
+ type: "VStack",
553
+ props: { gap: "0px" },
554
+ children: [
555
+ {
556
+ type: "VStack",
557
+ props: { "backgroundColor": "lightgrey", padding: "10px" },
558
+ children: [
559
+ {
560
+ type: "H2",
561
+ props: {
562
+ value: `#${idx + 1}: In component '${lint2.componentName}':`,
563
+ color: "$color-info"
564
+ }
565
+ },
566
+ {
567
+ type: "VStack",
568
+ children: lint2.lints.map(({ message }, msgIdx) => {
569
+ return {
570
+ type: "Text",
571
+ props: { value: `${idx + 1}.${msgIdx + 1}: ${message}`, fontWeight: "bold" }
572
+ };
573
+ })
574
+ }
575
+ ]
576
+ }
577
+ ]
578
+ };
579
+ });
580
+ const comp = {
581
+ type: "VStack",
582
+ props: { padding: "$padding-normal", gap: 0 },
583
+ children: [
584
+ {
585
+ type: "H1",
586
+ props: {
587
+ value: `Errors found while checking Xmlui markup`,
588
+ padding: "$padding-normal",
589
+ backgroundColor: "$color-error",
590
+ color: "white"
591
+ }
592
+ },
593
+ {
594
+ type: "VStack",
595
+ props: {
596
+ gap: "$gap-tight",
597
+ padding: "$padding-normal"
598
+ },
599
+ children: errList
600
+ }
601
+ ]
602
+ };
603
+ return comp;
604
+ }
605
+ return makeComponent();
606
+ }
607
+ function lint({
608
+ component,
609
+ metadataProvider
610
+ }) {
611
+ if ("component" in component) {
612
+ return lintHelp(component.component, metadataProvider, []);
613
+ }
614
+ return lintHelp(component, metadataProvider, []);
615
+ }
616
+ function lintHelp(component, metadataProvider, acc) {
617
+ const componentName = component.type.startsWith(CORE_NAMESPACE_VALUE) ? component.type.slice(CORE_NAMESPACE_VALUE.length + 1) : component.type;
618
+ const componentMdProvider = metadataProvider.getComponent(componentName);
619
+ if (componentMdProvider !== null && !componentMdProvider.allowArbitraryProps) {
620
+ lintAttrs(component, componentMdProvider, acc);
621
+ }
622
+ if (!component.children) {
623
+ return acc;
624
+ }
625
+ for (const child of component.children) {
626
+ lintHelp(child, metadataProvider, acc);
627
+ }
628
+ return acc;
629
+ }
630
+ function lintAttrs(component, metadataForCurrentComponent, diags) {
631
+ const invalidAttrNames = Object.keys(component.props ?? {}).filter((name) => !metadataForCurrentComponent.getAttr(name));
632
+ const invalidEvents = Object.keys(component.events ?? {}).filter((event) => !metadataForCurrentComponent.getEvent(event));
633
+ const invalidApis = Object.keys(component.api ?? {}).filter((api) => !metadataForCurrentComponent.getApi(api));
634
+ invalidAttrNames.push(...invalidEvents);
635
+ invalidAttrNames.push(...invalidApis);
636
+ for (const invalidAttrName of invalidAttrNames) {
637
+ diags.push(toUnrecognisedAttrDiag(component, invalidAttrName));
638
+ }
639
+ }
640
+ function toUnrecognisedAttrDiag(component, attr) {
641
+ return {
642
+ message: `Unrecognised property '${attr}' on component '${component.type}'.`,
643
+ kind: 0
644
+ /* UnrecognisedProp */
645
+ };
646
+ }
647
+ export {
648
+ LintSeverity as L,
649
+ XmlUiHelper as X,
650
+ codeBehindFileExtension as a,
651
+ LintDiagKind as b,
652
+ componentFileExtension as c,
653
+ lintErrorsComponent as d,
654
+ lint as e,
655
+ getLintSeverity as g,
656
+ lintApp as l,
657
+ moduleFileExtension as m,
658
+ printComponentLints as p
659
+ };