@openremote/or-vaadin-components 1.13.1 → 1.14.0-snapshot
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/README.md +17 -2
- package/custom-elements-jsx.d.ts +6398 -192
- package/custom-elements-manifest.config.mjs +116 -0
- package/custom-elements.json +108678 -512
- package/lib/or-vaadin-button.d.ts +8 -0
- package/lib/or-vaadin-button.d.ts.map +1 -0
- package/lib/or-vaadin-button.js +1 -0
- package/lib/or-vaadin-button.js.map +1 -0
- package/lib/or-vaadin-checkbox-group.d.ts +7 -0
- package/lib/or-vaadin-checkbox-group.d.ts.map +1 -0
- package/lib/or-vaadin-checkbox-group.js +1 -0
- package/lib/or-vaadin-checkbox-group.js.map +1 -0
- package/lib/or-vaadin-checkbox.d.ts +4 -1
- package/lib/or-vaadin-checkbox.d.ts.map +1 -1
- package/lib/or-vaadin-checkbox.js +1 -34
- package/lib/or-vaadin-checkbox.js.map +1 -1
- package/lib/or-vaadin-date-picker.d.ts +5 -0
- package/lib/or-vaadin-date-picker.d.ts.map +1 -0
- package/lib/or-vaadin-date-picker.js +1 -0
- package/lib/or-vaadin-date-picker.js.map +1 -0
- package/lib/or-vaadin-date-time-picker.d.ts +5 -0
- package/lib/or-vaadin-date-time-picker.d.ts.map +1 -0
- package/lib/or-vaadin-date-time-picker.js +1 -0
- package/lib/or-vaadin-date-time-picker.js.map +1 -0
- package/lib/or-vaadin-dialog.d.ts +12 -2
- package/lib/or-vaadin-dialog.d.ts.map +1 -1
- package/lib/or-vaadin-dialog.js +13 -35
- package/lib/or-vaadin-dialog.js.map +1 -1
- package/lib/or-vaadin-icon.d.ts +7 -0
- package/lib/or-vaadin-icon.d.ts.map +1 -0
- package/lib/or-vaadin-icon.js +1 -0
- package/lib/or-vaadin-icon.js.map +1 -0
- package/lib/or-vaadin-input.d.ts +7 -8
- package/lib/or-vaadin-input.d.ts.map +1 -1
- package/lib/or-vaadin-input.js +2 -258
- package/lib/or-vaadin-input.js.map +1 -1
- package/lib/or-vaadin-multi-select-combo-box.d.ts +5 -0
- package/lib/or-vaadin-multi-select-combo-box.d.ts.map +1 -0
- package/lib/or-vaadin-multi-select-combo-box.js +1 -0
- package/lib/or-vaadin-multi-select-combo-box.js.map +1 -0
- package/lib/or-vaadin-number-field.d.ts +9 -0
- package/lib/or-vaadin-number-field.d.ts.map +1 -0
- package/lib/or-vaadin-number-field.js +1 -0
- package/lib/or-vaadin-number-field.js.map +1 -0
- package/lib/{or-vaadin-passwordfield.d.ts → or-vaadin-password-field.d.ts} +2 -2
- package/lib/or-vaadin-password-field.d.ts.map +1 -0
- package/lib/or-vaadin-password-field.js +1 -0
- package/lib/or-vaadin-password-field.js.map +1 -0
- package/lib/or-vaadin-radio-group.d.ts +5 -0
- package/lib/or-vaadin-radio-group.d.ts.map +1 -0
- package/lib/or-vaadin-radio-group.js +1 -0
- package/lib/or-vaadin-radio-group.js.map +1 -0
- package/lib/or-vaadin-select.d.ts +4 -1
- package/lib/or-vaadin-select.d.ts.map +1 -1
- package/lib/or-vaadin-select.js +1 -34
- package/lib/or-vaadin-select.js.map +1 -1
- package/lib/or-vaadin-text-area.d.ts +9 -0
- package/lib/or-vaadin-text-area.d.ts.map +1 -0
- package/lib/or-vaadin-text-area.js +1 -0
- package/lib/or-vaadin-text-area.js.map +1 -0
- package/lib/or-vaadin-text-field.d.ts +9 -0
- package/lib/or-vaadin-text-field.d.ts.map +1 -0
- package/lib/or-vaadin-text-field.js +1 -0
- package/lib/or-vaadin-text-field.js.map +1 -0
- package/lib/or-vaadin-time-picker.d.ts +5 -0
- package/lib/or-vaadin-time-picker.d.ts.map +1 -0
- package/lib/or-vaadin-time-picker.js +1 -0
- package/lib/or-vaadin-time-picker.js.map +1 -0
- package/lib/util.d.ts +6 -30
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +1 -372
- package/lib/util.js.map +1 -1
- package/lib/value-input-provider.d.ts +34 -0
- package/lib/value-input-provider.d.ts.map +1 -0
- package/lib/value-input-provider.js +20 -0
- package/lib/value-input-provider.js.map +1 -0
- package/package.json +20 -13
- package/stories/or-vaadin-button.stories.ts +79 -0
- package/stories/or-vaadin-checkbox.stories.ts +59 -0
- package/stories/or-vaadin-dialog.stories.ts +124 -0
- package/stories/or-vaadin-number-field.stories.ts +60 -0
- package/stories/{or-vaadin-textfield.stories.ts → or-vaadin-text-field.stories.ts} +6 -6
- package/lib/or-vaadin-numberfield.d.ts +0 -9
- package/lib/or-vaadin-numberfield.d.ts.map +0 -1
- package/lib/or-vaadin-numberfield.js +0 -38
- package/lib/or-vaadin-numberfield.js.map +0 -1
- package/lib/or-vaadin-passwordfield.d.ts.map +0 -1
- package/lib/or-vaadin-passwordfield.js +0 -38
- package/lib/or-vaadin-passwordfield.js.map +0 -1
- package/lib/or-vaadin-textarea.d.ts +0 -9
- package/lib/or-vaadin-textarea.d.ts.map +0 -1
- package/lib/or-vaadin-textarea.js +0 -38
- package/lib/or-vaadin-textarea.js.map +0 -1
- package/lib/or-vaadin-textfield.d.ts +0 -9
- package/lib/or-vaadin-textfield.d.ts.map +0 -1
- package/lib/or-vaadin-textfield.js +0 -38
- package/lib/or-vaadin-textfield.js.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, OpenRemote Inc.
|
|
3
|
+
*
|
|
4
|
+
* See the CONTRIBUTORS.txt file in the distribution for a
|
|
5
|
+
* full listing of individual contributors.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Affero General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
10
|
+
* License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Affero General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import baseConfig from "../custom-elements-manifest.config.mjs";
|
|
21
|
+
import {cemInheritancePlugin} from "@wc-toolkit/cem-inheritance";
|
|
22
|
+
import {fileURLToPath} from "node:url";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Custom plugin that we wrote ourselves, that parses the JSDoc format that Vaadin uses,
|
|
26
|
+
* and generates the Custom Elements Manifest JSON fields for it.
|
|
27
|
+
*/
|
|
28
|
+
const VaadinJSDocParserPlugin = {
|
|
29
|
+
name: 'vaadin-jsdoc-parser',
|
|
30
|
+
analyzePhase({ ts, node, moduleDoc }) {
|
|
31
|
+
if (node.kind !== ts.SyntaxKind.ClassDeclaration) return;
|
|
32
|
+
const declaration = moduleDoc.declarations.find(d => d.name === node.name.getText());
|
|
33
|
+
const description = declaration?.description; // The JSDoc text above the class
|
|
34
|
+
if (!description) return;
|
|
35
|
+
|
|
36
|
+
const sections = [
|
|
37
|
+
/*{ key: 'shadow DOM parts', category: 'cssParts', inputType: undefined },*/ // TODO: Fix CSS parts to not override HTML attributes
|
|
38
|
+
{ key: 'state attributes', category: 'attributes', inputType: 'boolean' },
|
|
39
|
+
{ key: 'custom CSS properties', category: 'cssProperties', inputType: 'string' }
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* To parse the JSDoc text into categories, we need a complex regex pattern to parse the values out.
|
|
44
|
+
* It extracts backticked names and grabs its description by checking for the `|` symbol.
|
|
45
|
+
* The generated list would be inserted into the custom-elements.json file.
|
|
46
|
+
* Example JSDoc:
|
|
47
|
+
* ---
|
|
48
|
+
* state attributes
|
|
49
|
+
* `is-active` | Whether the component is toggled on.
|
|
50
|
+
* `disabled` | Prevents user interaction.
|
|
51
|
+
* custom CSS properties
|
|
52
|
+
* `--bg-color` | The background color of the button.
|
|
53
|
+
*/
|
|
54
|
+
sections.forEach(({ key, category, inputType }, i) => {
|
|
55
|
+
const content = description.split(key)[1]?.split(sections[i + 1]?.key || '$')[0] || '';
|
|
56
|
+
const matches = [...content.matchAll(/`([^`]+)`(?:\s*\|\s*([^\n|]+))?/g)];
|
|
57
|
+
declaration[category] ??= [];
|
|
58
|
+
|
|
59
|
+
const entries = matches.flatMap(([_, name, desc]) => {
|
|
60
|
+
return [{
|
|
61
|
+
name: name,
|
|
62
|
+
description: desc?.trim(),
|
|
63
|
+
...(inputType && { type: { text: inputType } })
|
|
64
|
+
}]
|
|
65
|
+
});
|
|
66
|
+
declaration[category].push(...entries);
|
|
67
|
+
});
|
|
68
|
+
if(declaration) {
|
|
69
|
+
console.debug(`Injected additional JSDoc documentation for class ${declaration.name}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Custom plugin that we wrote ourselves, that corrects the 'extends' keyword for our Vaadin classes.
|
|
76
|
+
* The analyzer does not understand `extends (TextField as new () => TextField & LitElement)`,
|
|
77
|
+
* so we manually parse the Vaadin class, and link it to the correct Vaadin NPM package.
|
|
78
|
+
*/
|
|
79
|
+
const VaadinSuperclassParserPlugin = {
|
|
80
|
+
name: 'vaadin-superclass-parser',
|
|
81
|
+
analyzePhase({ ts, node, moduleDoc }) {
|
|
82
|
+
if (node.kind !== ts.SyntaxKind.ClassDeclaration || !node.heritageClauses) return;
|
|
83
|
+
if (!node.name) return;
|
|
84
|
+
|
|
85
|
+
const className = node.name.getText();
|
|
86
|
+
const declaration = moduleDoc.declarations?.find(d => d.name === className);
|
|
87
|
+
const extendsClause = node.heritageClauses.find(h => h.token === ts.SyntaxKind.ExtendsKeyword);
|
|
88
|
+
const baseName = extendsClause?.types[0]?.getText().match(/\(([^ ]+) as/)?.[1];
|
|
89
|
+
|
|
90
|
+
if (declaration && baseName) {
|
|
91
|
+
const pkg = baseName.replaceAll(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); // For example, parses TextField to 'text-field'
|
|
92
|
+
declaration.superclass = {
|
|
93
|
+
name: baseName,
|
|
94
|
+
package: `@vaadin/${pkg}`
|
|
95
|
+
};
|
|
96
|
+
console.debug(`Resolved conflict for super class documentation for: @vaadin/${pkg}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* -------------------------------- */
|
|
102
|
+
|
|
103
|
+
// Retrieve path to the Vaadin NPM package
|
|
104
|
+
const vaadinFilesURL = new URL("../*/src/*.js", import.meta.resolve("@vaadin/button/package.json"));
|
|
105
|
+
const vaadinPath = fileURLToPath(vaadinFilesURL).replaceAll('\\', '/');
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
...baseConfig,
|
|
109
|
+
globs: [...baseConfig.globs, vaadinPath], // Also analyze the code inside the Vaadin folder
|
|
110
|
+
plugins: [
|
|
111
|
+
...baseConfig.plugins,
|
|
112
|
+
VaadinSuperclassParserPlugin, // Resolve conflict in package names
|
|
113
|
+
cemInheritancePlugin(), // Inject the analysis of the inherited Vaadin code
|
|
114
|
+
VaadinJSDocParserPlugin // Inject JSDoc of the inherited Vaadin code
|
|
115
|
+
]
|
|
116
|
+
}
|