@ui5/webcomponents-tools 0.0.0-aadaf0b2a → 0.0.0-acc6fea96
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/CHANGELOG.md +1784 -1
- package/README.md +6 -9
- package/assets-meta.js +158 -0
- package/bin/dev.js +12 -1
- package/components-package/cypress/support/commands.js +39 -0
- package/components-package/cypress/support/component-index.html +17 -0
- package/components-package/cypress/support/component.d.ts +23 -0
- package/components-package/cypress/support/component.js +34 -0
- package/components-package/cypress.config.js +19 -0
- package/components-package/eslint.js +99 -2
- package/components-package/nps.js +121 -45
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -23
- package/components-package/vite.config.js +13 -0
- package/components-package/wdio.js +153 -72
- package/icons-collection/nps.js +55 -12
- package/lib/amd-to-es6/index.js +102 -0
- package/lib/amd-to-es6/no-remaining-require.js +33 -0
- package/lib/cem/custom-elements-manifest.config.mjs +527 -0
- package/lib/cem/event.mjs +168 -0
- package/lib/cem/schema-internal.json +1413 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +808 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +413 -0
- package/lib/cem/validate.js +70 -0
- package/lib/copy-and-watch/index.js +145 -0
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +126 -54
- package/lib/create-illustrations/index.js +182 -0
- package/lib/create-new-component/index.js +63 -93
- package/lib/create-new-component/tsFileContentTemplate.js +71 -0
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +74 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/css-processors/shared.mjs +56 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/dev-server.mjs +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +52 -0
- package/lib/generate-js-imports/illustrations.js +86 -0
- package/lib/generate-json-imports/i18n.js +82 -47
- package/lib/generate-json-imports/themes.js +55 -19
- package/lib/hbs2lit/index.js +2 -4
- package/lib/hbs2lit/src/compiler.js +30 -9
- package/lib/hbs2lit/src/includesReplacer.js +23 -17
- package/lib/hbs2lit/src/litVisitor2.js +125 -26
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +40 -7
- package/lib/hbs2ui5/index.js +69 -30
- package/lib/i18n/defaults.js +78 -50
- package/lib/i18n/toJSON.js +25 -13
- package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
- package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
- package/lib/scoping/get-all-tags.js +44 -0
- package/lib/scoping/lint-src.js +32 -0
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/scoping/scope-test-pages.js +41 -0
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +62 -55
- package/tsconfig.json +18 -0
- package/types/index.d.ts +1 -0
- package/bin/init-ui5-package.js +0 -3
- package/components-package/rollup.js +0 -134
- package/components-package/serve.json +0 -3
- package/lib/documentation/index.js +0 -143
- package/lib/documentation/templates/api-component-since.js +0 -3
- package/lib/documentation/templates/api-css-variables-section.js +0 -24
- package/lib/documentation/templates/api-events-section.js +0 -35
- package/lib/documentation/templates/api-methods-section.js +0 -26
- package/lib/documentation/templates/api-properties-section.js +0 -40
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -38
- package/lib/init-package/index.js +0 -119
- package/lib/init-package/resources/.eslintignore +0 -3
- package/lib/init-package/resources/bundle.es5.js +0 -25
- package/lib/init-package/resources/bundle.esm.js +0 -34
- package/lib/init-package/resources/config/.eslintrc.js +0 -1
- package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
- package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
- package/lib/init-package/resources/config/rollup.config.js +0 -1
- package/lib/init-package/resources/config/wdio.conf.js +0 -1
- package/lib/init-package/resources/package-scripts.js +0 -11
- package/lib/init-package/resources/src/Assets.js +0 -6
- package/lib/init-package/resources/src/Demo.hbs +0 -1
- package/lib/init-package/resources/src/Demo.js +0 -56
- package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
- package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
- package/lib/init-package/resources/src/themes/Demo.css +0 -11
- package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
- package/lib/init-package/resources/test/pages/index.html +0 -51
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2407
- package/lib/jsdoc/template/publish.js +0 -4092
- package/lib/postcss-css-to-esm/index.js +0 -33
- package/lib/postcss-css-to-json/index.js +0 -20
@@ -0,0 +1,168 @@
|
|
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
|
+
const ASTFalseKeywordCode = 94;
|
20
|
+
|
21
|
+
const getParams = (ts, eventDetails, commentParams, classNode, moduleDoc) => {
|
22
|
+
return commentParams?.map(commentParam => {
|
23
|
+
const { typeName, name } = getType(normalizeTagType(commentParam?.type));
|
24
|
+
let type;
|
25
|
+
|
26
|
+
if (typeName) {
|
27
|
+
type = { text: typeName };
|
28
|
+
|
29
|
+
let typeRefs = name?.split("|")
|
30
|
+
?.map(e => getReference(ts, e.trim(), classNode, moduleDoc.path))
|
31
|
+
.filter(Boolean);
|
32
|
+
|
33
|
+
if (typeRefs?.length) {
|
34
|
+
type.references = typeRefs;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
return {
|
39
|
+
type,
|
40
|
+
name: commentParam?.name,
|
41
|
+
_ui5privacy: "public",
|
42
|
+
description: normalizeDescription(commentParam?.description),
|
43
|
+
};
|
44
|
+
});
|
45
|
+
};
|
46
|
+
|
47
|
+
function processEvent(ts, event, classNode, moduleDoc) {
|
48
|
+
const name = event?.expression?.arguments?.[0]?.text;
|
49
|
+
const result = {
|
50
|
+
name,
|
51
|
+
_ui5privacy: "private",
|
52
|
+
type: { text: "CustomEvent" }
|
53
|
+
};
|
54
|
+
|
55
|
+
const comment = event.getFullText?.().match(jsDocRegExp)?.[0];
|
56
|
+
|
57
|
+
if (!comment) {
|
58
|
+
return result;
|
59
|
+
}
|
60
|
+
|
61
|
+
const eventParsedComment = parse(comment, { spacing: 'preserve' })[0];
|
62
|
+
|
63
|
+
validateJSDocComment("event", eventParsedComment, name, moduleDoc);
|
64
|
+
|
65
|
+
const deprecatedTag = findTag(eventParsedComment, "deprecated");
|
66
|
+
const privacy = findTag(eventParsedComment, ["public", "private", "protected"])?.tag || "private";
|
67
|
+
const sinceTag = findTag(eventParsedComment, "since");
|
68
|
+
const commentParams = findAllTags(eventParsedComment, "param");
|
69
|
+
const description = normalizeDescription(eventParsedComment?.description);
|
70
|
+
const native = hasTag(eventParsedComment, "native");
|
71
|
+
const eventArgs = event?.expression?.arguments;
|
72
|
+
let eventBubbles;
|
73
|
+
let eventCancelable;
|
74
|
+
let eventDetails;
|
75
|
+
|
76
|
+
eventArgs && eventArgs.forEach(arg => {
|
77
|
+
arg.properties?.forEach(prop => {
|
78
|
+
if (prop.name?.text === "bubbles") {
|
79
|
+
eventBubbles = prop.initializer.kind === ASTFalseKeywordCode ? false : true;
|
80
|
+
} else if (prop.name?.text === "cancelable") {
|
81
|
+
eventCancelable = prop.initializer.kind === ASTFalseKeywordCode ? false : true;
|
82
|
+
} else if (prop.name?.text === "detail") {
|
83
|
+
eventDetails = prop.initializer?.properties;
|
84
|
+
}
|
85
|
+
});
|
86
|
+
});
|
87
|
+
|
88
|
+
result.description = description;
|
89
|
+
result._ui5Cancelable = eventCancelable !== undefined ? eventCancelable : false;
|
90
|
+
result._ui5allowPreventDefault = result._ui5Cancelable;
|
91
|
+
result._ui5Bubbles = eventBubbles !== undefined ? eventBubbles : false;
|
92
|
+
|
93
|
+
if (native) {
|
94
|
+
result.type = { text: "Event" };
|
95
|
+
}
|
96
|
+
|
97
|
+
if (privacy) {
|
98
|
+
result._ui5privacy = privacy;
|
99
|
+
}
|
100
|
+
|
101
|
+
if (deprecatedTag?.name) {
|
102
|
+
result.deprecated = deprecatedTag.description
|
103
|
+
? `${deprecatedTag.name} ${deprecatedTag.description}`
|
104
|
+
: deprecatedTag.name;
|
105
|
+
} else if (deprecatedTag) {
|
106
|
+
result.deprecated = true;
|
107
|
+
}
|
108
|
+
|
109
|
+
if (sinceTag?.name) {
|
110
|
+
result._ui5since = sinceTag?.description
|
111
|
+
? `${sinceTag.name} ${sinceTag.description}`
|
112
|
+
: sinceTag.name;
|
113
|
+
}
|
114
|
+
|
115
|
+
const eventDetailType = classNode.members?.find(member => {
|
116
|
+
return ts.isPropertyDeclaration(member) && member.name.text === "eventDetails"
|
117
|
+
})?.type;
|
118
|
+
const eventDetailRef = eventDetailType?.members?.find(member => member.name.text === name) || eventDetailType?.types?.[eventDetailType?.types?.length - 1]?.members?.find(member => member.name.text === name);
|
119
|
+
const hasGeneric = !!event?.expression?.typeArguments
|
120
|
+
|
121
|
+
if (commentParams.length) {
|
122
|
+
if (eventDetailRef && hasGeneric) {
|
123
|
+
logDocumentationError(moduleDoc.path, `Event details for event '${name}' has to be defined either with generic or with eventDetails.`)
|
124
|
+
} else if (eventDetails) {
|
125
|
+
if (hasGeneric) {
|
126
|
+
const typesText = event?.expression?.typeArguments.map(type => type.typeName?.text).filter(Boolean).join(" | ");
|
127
|
+
const typeRefs = (getTypeRefs(ts, event.expression)
|
128
|
+
?.map(e => getReference(ts, e, event, moduleDoc.path)).filter(Boolean)) || [];
|
129
|
+
|
130
|
+
result.type = { text: `CustomEvent<${typesText}>` };
|
131
|
+
|
132
|
+
if (typeRefs.length) {
|
133
|
+
result.type.references = typeRefs;
|
134
|
+
}
|
135
|
+
} else if (eventDetailRef) {
|
136
|
+
const typesText = eventDetailRef?.type?.typeName?.text;
|
137
|
+
const typeRefs = (getTypeRefs(ts, eventDetailRef)
|
138
|
+
?.map(e => getReference(ts, e, event, moduleDoc.path)).filter(Boolean)) || [];
|
139
|
+
|
140
|
+
result.type = { text: `CustomEvent<${typesText}>` };
|
141
|
+
|
142
|
+
if (typeRefs.length) {
|
143
|
+
result.type.references = typeRefs;
|
144
|
+
}
|
145
|
+
} else {
|
146
|
+
logDocumentationError(moduleDoc.path, `Event details for event '${name}' must be described using generics. Add type via generics to the decorator: @event<TypeForDetails>("${name}", {details}).`)
|
147
|
+
}
|
148
|
+
} else if (eventDetailRef) {
|
149
|
+
const typesText = eventDetailRef?.type?.typeName?.text;
|
150
|
+
const typeRefs = (getTypeRefs(ts, eventDetailRef)
|
151
|
+
?.map(e => getReference(ts, e, event, moduleDoc.path)).filter(Boolean)) || [];
|
152
|
+
|
153
|
+
result.type = { text: `CustomEvent<${typesText}>` };
|
154
|
+
|
155
|
+
if (typeRefs.length) {
|
156
|
+
result.type.references = typeRefs;
|
157
|
+
}
|
158
|
+
} else {
|
159
|
+
logDocumentationError(moduleDoc.path, `Event details for event '${name}' must be described.`)
|
160
|
+
}
|
161
|
+
|
162
|
+
result._ui5parameters = getParams(ts, eventDetails, commentParams, classNode, moduleDoc);
|
163
|
+
}
|
164
|
+
|
165
|
+
return result;
|
166
|
+
}
|
167
|
+
|
168
|
+
export default processEvent;
|