@ui5/webcomponents-tools 2.3.1-rc.0 → 2.4.0-rc.1

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 CHANGED
@@ -3,6 +3,34 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.4.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v2.4.0-rc.0...v2.4.0-rc.1) (2024-10-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * scoping issues and document how scoping is used correctly ([#10023](https://github.com/SAP/ui5-webcomponents/issues/10023)) ([ee808c3](https://github.com/SAP/ui5-webcomponents/commit/ee808c309f316fe145b05d292c92328396c655ab))
12
+ * **tools:** revert tsconfig moduleResolution to node ([#10014](https://github.com/SAP/ui5-webcomponents/issues/10014)) ([0724b92](https://github.com/SAP/ui5-webcomponents/commit/0724b9289ad04f88972d4978ed37e76f13abca13))
13
+
14
+
15
+
16
+
17
+
18
+ # [2.4.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.3.1-rc.0...v2.4.0-rc.0) (2024-10-10)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * require handlebar file names processed by hbs2ui5 tool to end with the '.hbs' extension ([#9992](https://github.com/SAP/ui5-webcomponents/issues/9992)) ([1b23f3d](https://github.com/SAP/ui5-webcomponents/commit/1b23f3d2b02829844cb8c0cd4a4adefd628b7f4f))
24
+
25
+
26
+ ### Features
27
+
28
+ * enhance `[@event](https://github.com/event)` decorator ([#9944](https://github.com/SAP/ui5-webcomponents/issues/9944)) ([fe1d816](https://github.com/SAP/ui5-webcomponents/commit/fe1d816f512400b839fd4ce1b9af1506d0cb4c9a))
29
+
30
+
31
+
32
+
33
+
6
34
  ## [2.3.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.3.0...v2.3.1-rc.0) (2024-10-03)
7
35
 
8
36
  **Note:** Version bump only for package @ui5/webcomponents-tools
package/lib/cem/event.mjs CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  } from "./utils.mjs";
17
17
 
18
18
  const jsDocRegExp = /\/\*\*(.|\n)+?\s+\*\//;
19
+ const ASTFalseKeywordCode = 94;
19
20
 
20
21
  const getParams = (ts, eventDetails, commentParams, classNode, moduleDoc) => {
21
22
  return commentParams?.map(commentParam => {
@@ -77,17 +78,33 @@ function processEvent(ts, event, classNode, moduleDoc) {
77
78
  const privacy = findTag(eventParsedComment, ["public", "private", "protected"])?.tag || "private";
78
79
  const sinceTag = findTag(eventParsedComment, "since");
79
80
  const commentParams = findAllTags(eventParsedComment, "param");
80
- const allowPreventDefault = hasTag(eventParsedComment, "allowPreventDefault") || undefined;
81
81
  const description = normalizeDescription(eventParsedComment?.description);
82
82
  const native = hasTag(eventParsedComment, "native");
83
- const eventDetails = event?.expression?.arguments?.[1]?.properties?.find(prop => prop?.name?.text === "detail")?.initializer?.properties;
83
+ const eventArgs = event?.expression?.arguments;
84
+ let eventBubbles;
85
+ let eventCancelable;
86
+ let eventDetails;
87
+
88
+ eventArgs && eventArgs.forEach(arg => {
89
+ arg.properties?.forEach(prop => {
90
+ if (prop.name?.text === "bubbles") {
91
+ eventBubbles = prop.initializer.kind === ASTFalseKeywordCode ? false : true;
92
+ } else if (prop.name?.text === "cancelable") {
93
+ eventCancelable = prop.initializer.kind === ASTFalseKeywordCode ? false : true;
94
+ } else if (prop.name?.text === "detail") {
95
+ eventDetails = prop.initializer?.properties;
96
+ }
97
+ });
98
+ });
84
99
 
85
- if (event?.expression?.arguments?.[1] && !event?.expression?.typeArguments) {
100
+ if (eventDetails && !event?.expression?.typeArguments) {
86
101
  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
102
  }
88
103
 
89
104
  result.description = description;
90
- result._ui5allowPreventDefault = allowPreventDefault;
105
+ result._ui5Cancelable = eventCancelable !== undefined ? eventCancelable : false;
106
+ result._ui5allowPreventDefault = result._ui5Cancelable;
107
+ result._ui5Bubbles = eventBubbles !== undefined ? eventBubbles : true;
91
108
 
92
109
  if (native) {
93
110
  result.type = { text: "Event" };
@@ -818,6 +818,14 @@
818
818
  "description": "Whether the parameter is optional. Undefined implies non-optional.",
819
819
  "type": "boolean"
820
820
  },
821
+ "_ui5Cancelable": {
822
+ "description": "Whether the event is cancelable or not.",
823
+ "type": "boolean"
824
+ },
825
+ "_ui5Bubbles": {
826
+ "description": "Whether the event bubbles or not.",
827
+ "type": "boolean"
828
+ },
821
829
  "_ui5since": {
822
830
  "description": "Marks when the field was introduced",
823
831
  "type": "string"
@@ -319,9 +319,20 @@ export interface Event {
319
319
  _ui5parameters?: Parameter[]
320
320
  _ui5privacy?: Privacy
321
321
  /**
322
- * Whether the parameter is optional. Undefined implies non-optional.
322
+ * Whether the event is preventable.
323
+ */
324
+ _ui5allowPreventDefault?: boolean;
325
+
326
+ /**
327
+ * Whether the event is cancelable.
323
328
  */
324
- _ui5allowPreventDefault?: boolean
329
+ _ui5Cancelable?: boolean;
330
+
331
+ /**
332
+ * Whether the event is bubbles.
333
+ */
334
+ _ui5Bubbles?: boolean;
335
+
325
336
  /**
326
337
  * Marks when the field was introduced
327
338
  */
package/lib/cem/utils.mjs CHANGED
@@ -222,7 +222,7 @@ const commonTags = ["public", "protected", "private", "since", "deprecated"];
222
222
  const allowedTags = {
223
223
  field: [...commonTags, "formEvents", "formProperty", "default"],
224
224
  slot: [...commonTags, "default"],
225
- event: [...commonTags, "param", "allowPreventDefault", "native"],
225
+ event: [...commonTags, "param", "native", "allowPreventDefault"],
226
226
  eventParam: [...commonTags],
227
227
  method: [...commonTags, "param", "returns", "override"],
228
228
  class: [...commonTags, "constructor", "class", "abstract", "experimental", "implements", "extends", "slot", "csspart"],
@@ -283,7 +283,7 @@ const findAllTags = (jsDoc, tagName) => {
283
283
  };
284
284
 
285
285
  const validateJSDocTag = (tag) => {
286
- const booleanTags = ["private", "protected", "public", "abstract", "allowPreventDefault", "native", "formProperty", "constructor", "override"];
286
+ const booleanTags = ["private", "protected", "public", "abstract", "native", "allowPreventDefault", "formProperty", "constructor", "override"];
287
287
  let tagName = tag.tag;
288
288
 
289
289
  if (booleanTags.includes(tag.tag)) {
@@ -24,7 +24,7 @@ const onError = (place) => {
24
24
  console.log(`A problem occoured when reading ${place}. Please recheck passed parameters.`);
25
25
  };
26
26
 
27
- const isHandlebars = (fileName) => fileName.indexOf('.hbs') !== -1;
27
+ const isHandlebars = (fileName) => fileName.endsWith('.hbs');
28
28
 
29
29
  const hasTypes = (file, componentName) => {
30
30
  const tsFile = path.join(path.dirname(file), componentName + ".ts")
@@ -4,8 +4,15 @@ const glob = require("glob");
4
4
 
5
5
  const getTag = file => {
6
6
  const fileContent = String(fs.readFileSync(file)).replace(/\n/g, "");
7
- const matches = fileContent.match(/\btag\b:\s*\"(.*?)\"/);
8
- return matches ? matches[1] : undefined;
7
+ let matches = fileContent.match(/\btag\b:\s*\"(.*?)\"/);
8
+ if (matches) {
9
+ return matches[1];
10
+ }
11
+ matches = fileContent.match(/@customElement\("(.*?)"\)/);
12
+ if (matches) {
13
+ return matches[1];
14
+ }
15
+ return undefined;
9
16
  };
10
17
 
11
18
  const getPackageTags = (packageDir) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "2.3.1-rc.0",
3
+ "version": "2.4.0-rc.1",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -86,5 +86,5 @@
86
86
  "esbuild": "^0.19.9",
87
87
  "yargs": "^17.5.1"
88
88
  },
89
- "gitHead": "2857fcf8b4da8ccd7bbfa9dd0b0c2eb4c925cf4f"
89
+ "gitHead": "478542af62e30ca4df65b0778bcbeab837d583d6"
90
90
  }
package/tsconfig.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "NodeNext",
4
3
  "target": "ES2021",
5
4
  "lib": [
6
5
  "DOM",
@@ -12,5 +11,6 @@
12
11
  "sourceMap": true,
13
12
  "inlineSources": true,
14
13
  "strict": true,
14
+ "moduleResolution": "node",
15
15
  }
16
16
  }