@ui5/webcomponents-tools 0.0.0-d1315d658 → 0.0.0-d473b9686

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 (53) hide show
  1. package/CHANGELOG.md +767 -0
  2. package/README.md +2 -1
  3. package/assets-meta.js +15 -10
  4. package/components-package/eslint.js +2 -0
  5. package/components-package/nps.js +51 -43
  6. package/components-package/postcss.components.js +1 -21
  7. package/components-package/postcss.themes.js +1 -50
  8. package/components-package/wdio.js +414 -400
  9. package/icons-collection/nps.js +7 -5
  10. package/lib/amd-to-es6/index.js +102 -0
  11. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  12. package/lib/cem/custom-elements-manifest.config.mjs +501 -0
  13. package/lib/cem/event.mjs +131 -0
  14. package/lib/cem/schema-internal.json +1357 -0
  15. package/lib/cem/schema.json +1098 -0
  16. package/lib/cem/types-internal.d.ts +796 -0
  17. package/lib/cem/types.d.ts +736 -0
  18. package/lib/cem/utils.mjs +384 -0
  19. package/lib/cem/validate.js +70 -0
  20. package/lib/create-icons/index.js +8 -6
  21. package/lib/create-illustrations/index.js +51 -30
  22. package/lib/create-new-component/index.js +4 -11
  23. package/lib/create-new-component/tsFileContentTemplate.js +3 -12
  24. package/lib/css-processors/css-processor-component-styles.mjs +48 -0
  25. package/lib/css-processors/css-processor-components.mjs +77 -0
  26. package/lib/css-processors/css-processor-themes.mjs +79 -0
  27. package/lib/css-processors/scope-variables.mjs +49 -0
  28. package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
  29. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  30. package/lib/dev-server/ssr-dom-shim-loader.js +26 -0
  31. package/lib/generate-js-imports/illustrations.js +78 -64
  32. package/lib/generate-json-imports/i18n.js +10 -37
  33. package/lib/generate-json-imports/themes.js +9 -31
  34. package/lib/i18n/defaults.js +1 -1
  35. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  36. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  37. package/lib/scoping/get-all-tags.js +1 -1
  38. package/lib/scoping/lint-src.js +8 -7
  39. package/lib/scoping/scope-test-pages.js +2 -1
  40. package/package.json +11 -10
  41. package/components-package/wdio.sync.js +0 -368
  42. package/lib/create-new-component/jsFileContentTemplate.js +0 -73
  43. package/lib/esm-abs-to-rel/index.js +0 -58
  44. package/lib/generate-custom-elements-manifest/index.js +0 -327
  45. package/lib/jsdoc/config.json +0 -29
  46. package/lib/jsdoc/configTypescript.json +0 -29
  47. package/lib/jsdoc/plugin.js +0 -2468
  48. package/lib/jsdoc/preprocess.js +0 -146
  49. package/lib/jsdoc/template/publish.js +0 -4120
  50. package/lib/postcss-css-to-json/index.js +0 -47
  51. package/lib/postcss-new-files/index.js +0 -36
  52. package/lib/postcss-p/postcss-p.mjs +0 -14
  53. package/lib/replace-global-core/index.js +0 -25
@@ -0,0 +1,131 @@
1
+ import { parse } from "comment-parser";
2
+ import {
3
+ getPrivacyStatus,
4
+ getDeprecatedStatus,
5
+ getSinceStatus,
6
+ getType,
7
+ getTypeRefs,
8
+ validateJSDocComment,
9
+ hasTag,
10
+ findTag,
11
+ findAllTags,
12
+ getReference,
13
+ normalizeDescription,
14
+ normalizeTagType,
15
+ logDocumentationError
16
+ } from "./utils.mjs";
17
+
18
+ const jsDocRegExp = /\/\*\*(.|\n)+?\s+\*\//;
19
+
20
+ const getParams = (ts, eventDetails, commentParams, classNode, moduleDoc) => {
21
+ return commentParams?.map(commentParam => {
22
+ const decoratorParam = eventDetails?.find(prop => prop?.name?.text === commentParam?.name);
23
+
24
+ if (!decoratorParam || !decoratorParam?.jsDoc?.[0]) {
25
+ return;
26
+ }
27
+
28
+ const decoratorParamParsedComment = parse(decoratorParam?.jsDoc?.[0]?.getText?.(), { spacing: 'preserve' })[0];
29
+
30
+ validateJSDocComment("eventParam", decoratorParamParsedComment, decoratorParam.name?.text, moduleDoc);
31
+
32
+ const { typeName, name } = getType(normalizeTagType(commentParam?.type));
33
+ let type;
34
+
35
+ if (typeName) {
36
+ type = { text: typeName };
37
+
38
+ let typeRefs = name?.split("|")
39
+ ?.map(e => getReference(ts, e.trim(), classNode, moduleDoc.path))
40
+ .filter(Boolean);
41
+
42
+ if (typeRefs?.length) {
43
+ type.references = typeRefs;
44
+ }
45
+ }
46
+
47
+ return {
48
+ type,
49
+ name: commentParam?.name,
50
+ _ui5privacy: getPrivacyStatus(decoratorParamParsedComment),
51
+ description: normalizeDescription(commentParam?.description),
52
+ _ui5since: getSinceStatus(decoratorParamParsedComment),
53
+ deprecated: getDeprecatedStatus(decoratorParamParsedComment),
54
+ };
55
+ }).filter(pair => !!pair);
56
+ };
57
+
58
+ function processEvent(ts, event, classNode, moduleDoc) {
59
+ const name = event?.expression?.arguments?.[0]?.text;
60
+ const result = {
61
+ name,
62
+ _ui5privacy: "private",
63
+ type: { text: "CustomEvent" }
64
+ };
65
+
66
+ const comment = event.getFullText?.().match(jsDocRegExp)?.[0];
67
+
68
+ if (!comment) {
69
+ return result;
70
+ }
71
+
72
+ const eventParsedComment = parse(comment, { spacing: 'preserve' })[0];
73
+
74
+ validateJSDocComment("event", eventParsedComment, name, moduleDoc);
75
+
76
+ const deprecatedTag = findTag(eventParsedComment, "deprecated");
77
+ const privacy = findTag(eventParsedComment, ["public", "private", "protected"])?.tag || "private";
78
+ const sinceTag = findTag(eventParsedComment, "since");
79
+ const commentParams = findAllTags(eventParsedComment, "param");
80
+ const allowPreventDefault = hasTag(eventParsedComment, "allowPreventDefault") || undefined;
81
+ const description = normalizeDescription(eventParsedComment?.description);
82
+ const native = hasTag(eventParsedComment, "native");
83
+ const eventDetails = event?.expression?.arguments?.[1]?.properties?.find(prop => prop?.name?.text === "detail")?.initializer?.properties;
84
+
85
+ if (event?.expression?.arguments?.[1] && !event?.expression?.typeArguments) {
86
+ logDocumentationError(moduleDoc.path, `Event details for event '${name}' must be described using generics. Add type via generics to the decorator: @event<TypeForDetails>("${name}", {details}).`)
87
+ }
88
+
89
+ result.description = description;
90
+ result._ui5allowPreventDefault = allowPreventDefault;
91
+
92
+ if (native) {
93
+ result.type = { text: "Event" };
94
+ } else if (event?.expression?.typeArguments) {
95
+ const typesText = event?.expression?.typeArguments.map(type => type.typeName?.text).filter(Boolean).join(" | ");
96
+ const typeRefs = (getTypeRefs(ts, event.expression)
97
+ ?.map(e => getReference(ts, e, event, moduleDoc.path)).filter(Boolean)) || [];
98
+
99
+ result.type = { text: `CustomEvent<${typesText}>` };
100
+
101
+ if (typeRefs.length) {
102
+ result.type.references = typeRefs;
103
+ }
104
+ }
105
+
106
+ if (privacy) {
107
+ result._ui5privacy = privacy;
108
+ }
109
+
110
+ if (deprecatedTag?.name) {
111
+ result.deprecated = deprecatedTag.description
112
+ ? `${deprecatedTag.name} ${deprecatedTag.description}`
113
+ : deprecatedTag.name;
114
+ } else if (deprecatedTag) {
115
+ result.deprecated = true;
116
+ }
117
+
118
+ if (sinceTag?.name) {
119
+ result._ui5since = sinceTag?.description
120
+ ? `${sinceTag.name} ${sinceTag.description}`
121
+ : sinceTag.name;
122
+ }
123
+
124
+ if (commentParams && eventDetails) {
125
+ result._ui5parameters = getParams(ts, eventDetails, commentParams, classNode, moduleDoc);
126
+ }
127
+
128
+ return result;
129
+ }
130
+
131
+ export default processEvent;