@ui5/webcomponents-tools 1.23.1-rc.0 → 1.24.0-rc.0

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,22 @@
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
+ # [1.24.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.23.1...v1.24.0-rc.0) (2024-03-14)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.23.1](https://github.com/SAP/ui5-webcomponents/compare/v1.23.1-rc.0...v1.23.1) (2024-03-08)
15
+
16
+ **Note:** Version bump only for package @ui5/webcomponents-tools
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.23.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0...v1.23.1-rc.0) (2024-03-07)
7
23
 
8
24
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -72,9 +72,10 @@ const getScripts = (options) => {
72
72
  default: "nps prepare lint build.bundle", // build.bundle2
73
73
  templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
74
74
  styles: {
75
- default: `concurrently "nps build.styles.themes" "nps build.styles.components"`,
75
+ default: `concurrently "nps build.styles.themes" "nps build.styles.components" "nps build.styles.componentStyles"`,
76
76
  themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
77
77
  components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
78
+ componentStyles: `node "${LIB}/css-processors/css-processor-component-styles.mjs"`,
78
79
  },
79
80
  i18n: {
80
81
  default: "nps build.i18n.defaultsjs build.i18n.json",
@@ -108,9 +109,10 @@ const getScripts = (options) => {
108
109
  props: 'nps "copy.props --watch --safe --skip-initial-copy"',
109
110
  bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
110
111
  styles: {
111
- default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
112
+ default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components" "nps watch.styles.componentStyles" ',
112
113
  themes: 'nps "build.styles.themes -w"',
113
114
  components: `nps "build.styles.components -w"`,
115
+ componentStyles: `nps "build.styles.componentStyles -w"`,
114
116
  },
115
117
  templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
116
118
  api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
@@ -19,8 +19,11 @@ import {
19
19
  isClass,
20
20
  normalizeTagType,
21
21
  logDocumentationError,
22
- displayDocumentationErrors
22
+ displayDocumentationErrors,
23
+ toKebabCase
23
24
  } from "./utils.mjs";
25
+ import { generateCustomData } from "cem-plugin-vs-code-custom-data-generator";
26
+ import { customElementJetBrainsPlugin } from "custom-element-jet-brains-integration";
24
27
 
25
28
  const packageJSON = JSON.parse(fs.readFileSync("./package.json"));
26
29
 
@@ -169,6 +172,23 @@ function processClass(ts, classNode, moduleDoc) {
169
172
  member._ui5noAttribute = propertyDecorator?.expression?.arguments[0]?.properties?.find(property => property.name.text === "noAttribute")?.initializer?.kind === ts.SyntaxKind.TrueKeyword || undefined;
170
173
  }
171
174
 
175
+ if (currClass.customElement && member.privacy === "public" && !propertyDecorator?.expression?.arguments[0]?.properties?.find(property => property.name.text === "multiple") && !["object"].includes(member._ui5validator?.toLowerCase())) {
176
+ const filename = classNode.getSourceFile().fileName;
177
+ const sourceFile = typeProgram.getSourceFile(filename);
178
+ const tsProgramClassNode = sourceFile.statements.find(statement => ts.isClassDeclaration(statement) && statement.name?.text === classNode.name?.text);
179
+ const tsProgramMember = tsProgramClassNode.members.find(m => ts.isPropertyDeclaration(m) && m.name?.text === member.name);
180
+ const attributeValue = typeChecker.typeToString(typeChecker.getTypeAtLocation(tsProgramMember), tsProgramMember);
181
+
182
+ currClass.attributes.push({
183
+ description: member.description,
184
+ name: toKebabCase(member.name),
185
+ default: member.default,
186
+ fieldName: member.name,
187
+ type: { text: attributeValue },
188
+ deprecated: member.deprecated
189
+ })
190
+ }
191
+
172
192
  if (hasTag(memberParsedJsDoc, "formProperty")) {
173
193
  member._ui5formProperty = true;
174
194
  }
@@ -334,7 +354,7 @@ const processPublicAPI = object => {
334
354
  if ((key === "privacy" && object[key] !== "public") || (key === "_ui5privacy" && object[key] !== "public")) {
335
355
  return true;
336
356
  } else if (typeof object[key] === "object") {
337
- if (key === "cssParts" || key === "_ui5implements") {
357
+ if (key === "cssParts" || key === "attributes" || key === "_ui5implements") {
338
358
  continue;
339
359
  }
340
360
 
@@ -475,5 +495,7 @@ export default {
475
495
  }
476
496
  }
477
497
  },
498
+ generateCustomData({ outdir: "dist", cssFileName: null, cssPropertiesDocs: false }),
499
+ customElementJetBrainsPlugin({ outdir: "dist", cssFileName: null, cssPropertiesDocs: false })
478
500
  ],
479
501
  };
package/lib/cem/utils.mjs CHANGED
@@ -14,6 +14,10 @@ const getDeprecatedStatus = (jsdocComment) => {
14
14
  : undefined;
15
15
  };
16
16
 
17
+ const toKebabCase = str => {
18
+ return str.replaceAll(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase())
19
+ }
20
+
17
21
  const normalizeDescription = (description) => {
18
22
  return typeof description === 'string' ? description.replaceAll(/^-\s+|^(\n)+|(\n)+$/g, ""): description;
19
23
  }
@@ -376,4 +380,5 @@ export {
376
380
  normalizeTagType,
377
381
  displayDocumentationErrors,
378
382
  logDocumentationError,
383
+ toKebabCase
379
384
  };
@@ -0,0 +1,47 @@
1
+ import { globby } from "globby";
2
+ import * as esbuild from 'esbuild'
3
+ import * as fs from "fs";
4
+ import * as path from "path";
5
+ import { writeFile, mkdir } from "fs/promises";
6
+ import scopeVariables from "./scope-variables.mjs";
7
+
8
+ const packageJSON = JSON.parse(fs.readFileSync("./package.json"))
9
+ const inputFiles = await globby("src/styles/*.module.css");
10
+ const restArgs = process.argv.slice(2);
11
+
12
+ let componentStylesPlugin = {
13
+ name: 'component-styles',
14
+ setup(build) {
15
+ build.initialOptions.write = false;
16
+
17
+ build.onEnd(result => {
18
+ result.outputFiles.forEach(async f => {
19
+ // scoping
20
+ const newText = scopeVariables(f.text, packageJSON);
21
+ await mkdir(path.dirname(f.path), {recursive: true});
22
+ writeFile(f.path, newText);
23
+ writeFile(f.path.replace(".module.css", ".css"), newText);
24
+ });
25
+ })
26
+ },
27
+ }
28
+
29
+ const config = {
30
+ entryPoints: inputFiles,
31
+ outdir: 'dist',
32
+ outbase: 'src',
33
+ loader: {
34
+ ".module.css": "global-css"
35
+ },
36
+ plugins: [
37
+ componentStylesPlugin,
38
+ ]
39
+ };
40
+
41
+ if (restArgs.includes("-w")) {
42
+ let ctx = await esbuild.context(config);
43
+ await ctx.watch()
44
+ console.log('watching...')
45
+ } else {
46
+ await esbuild.build(config);
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "1.23.1-rc.0",
3
+ "version": "1.24.0-rc.0",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -31,6 +31,7 @@
31
31
  "@wdio/spec-reporter": "^7.19.7",
32
32
  "@wdio/static-server-service": "^7.19.5",
33
33
  "ajv": "^8.12.0",
34
+ "cem-plugin-vs-code-custom-data-generator": "^1.4.2",
34
35
  "chai": "^4.3.4",
35
36
  "child_process": "^1.0.2",
36
37
  "chokidar": "^3.5.1",
@@ -39,6 +40,7 @@
39
40
  "comment-parser": "^1.4.0",
40
41
  "concurrently": "^6.0.0",
41
42
  "cross-env": "^7.0.3",
43
+ "custom-element-jet-brains-integration": "^1.4.4",
42
44
  "escodegen": "^2.0.0",
43
45
  "eslint": "^7.22.0",
44
46
  "eslint-config-airbnb-base": "^14.2.1",
@@ -79,5 +81,5 @@
79
81
  "esbuild": "^0.19.9",
80
82
  "yargs": "^17.5.1"
81
83
  },
82
- "gitHead": "33cfce9ec9ae9b4e086b976b98e0a77bc75a2e06"
84
+ "gitHead": "41fccb5ed1980879eac12c7b9c096208b986e79d"
83
85
  }