@ui5/webcomponents-tools 0.0.0-f2abb18c2 → 0.0.0-f651a470c
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 +408 -4
- package/README.md +5 -6
- package/assets-meta.js +16 -1
- package/bin/dev.js +1 -5
- package/components-package/eslint.js +34 -0
- package/components-package/nps.js +103 -50
- package/components-package/postcss.components.js +13 -13
- package/components-package/postcss.themes.js +19 -16
- package/components-package/vite.config.js +13 -0
- package/components-package/wdio.js +393 -344
- package/components-package/wdio.sync.js +360 -0
- package/icons-collection/nps.js +51 -10
- package/lib/copy-and-watch/index.js +30 -5
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +124 -52
- package/lib/create-illustrations/index.js +161 -0
- package/lib/create-new-component/index.js +108 -103
- package/lib/create-new-component/jsFileContentTemplate.js +77 -0
- package/lib/create-new-component/tsFileContentTemplate.js +84 -0
- package/lib/dev-server/dev-server.js +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +52 -0
- package/lib/esm-abs-to-rel/index.js +58 -0
- package/lib/generate-custom-elements-manifest/index.js +327 -0
- package/lib/generate-js-imports/illustrations.js +72 -0
- package/lib/generate-json-imports/i18n.js +75 -30
- package/lib/generate-json-imports/themes.js +62 -24
- package/lib/hbs2lit/src/compiler.js +20 -3
- package/lib/hbs2lit/src/includesReplacer.js +5 -5
- package/lib/hbs2lit/src/litVisitor2.js +77 -14
- package/lib/hbs2lit/src/svgProcessor.js +3 -3
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +4 -11
- package/lib/hbs2ui5/index.js +37 -21
- package/lib/i18n/defaults.js +65 -57
- package/lib/i18n/toJSON.js +13 -12
- package/lib/jsdoc/configTypescript.json +29 -0
- package/lib/jsdoc/plugin.js +62 -1
- package/lib/jsdoc/preprocess.js +146 -0
- package/lib/jsdoc/template/publish.js +30 -2
- package/lib/postcss-combine-duplicated-selectors/index.js +178 -0
- package/lib/postcss-css-to-esm/index.js +64 -16
- package/lib/postcss-css-to-json/index.js +31 -11
- package/lib/postcss-new-files/index.js +36 -0
- package/lib/postcss-p/postcss-p.mjs +14 -0
- package/lib/replace-global-core/index.js +25 -0
- package/lib/scoping/get-all-tags.js +1 -8
- package/lib/scoping/lint-src.js +1 -1
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/scoping/scope-test-pages.js +1 -1
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +51 -53
- package/bin/init-ui5-package.js +0 -3
- package/components-package/rollup.js +0 -147
- 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 -123
- 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 -5
- package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
- package/lib/init-package/resources/src/MyFirstComponent.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/MyFirstComponent.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/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
- package/lib/init-package/resources/test/pages/index.html +0 -56
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
- package/package-lock.json +0 -48
@@ -1,147 +0,0 @@
|
|
1
|
-
const process = require("process");
|
2
|
-
const fs = require("fs");
|
3
|
-
const os = require("os");
|
4
|
-
const { babel } = require("@rollup/plugin-babel");
|
5
|
-
const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
6
|
-
const url = require("@rollup/plugin-url");
|
7
|
-
const { terser } = require("rollup-plugin-terser");
|
8
|
-
const notify = require('rollup-plugin-notify');
|
9
|
-
const filesize = require('rollup-plugin-filesize');
|
10
|
-
const livereload = require('rollup-plugin-livereload');
|
11
|
-
|
12
|
-
const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
|
13
|
-
const DEPLOY_PUBLIC_PATH = process.env.DEPLOY_PUBLIC_PATH || "";
|
14
|
-
|
15
|
-
function ui5DevImportCheckerPlugin() {
|
16
|
-
return {
|
17
|
-
name: "ui5-dev-import-checker-plugin",
|
18
|
-
transform(code, file) {
|
19
|
-
const re = new RegExp(`^import.*"${packageName}/`);
|
20
|
-
if (re.test(code)) {
|
21
|
-
throw new Error(`illegal import in ${file}`);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
};
|
25
|
-
}
|
26
|
-
|
27
|
-
const getPlugins = ({ transpile }) => {
|
28
|
-
const plugins = [];
|
29
|
-
let publicPath = DEPLOY_PUBLIC_PATH;
|
30
|
-
|
31
|
-
if (!process.env.DEV) {
|
32
|
-
plugins.push(filesize({
|
33
|
-
render : function (options, bundle, { minSize, gzipSize, brotliSize, bundleSize }){
|
34
|
-
return gzipSize;
|
35
|
-
}
|
36
|
-
}));
|
37
|
-
}
|
38
|
-
|
39
|
-
plugins.push(ui5DevImportCheckerPlugin());
|
40
|
-
|
41
|
-
plugins.push(url({
|
42
|
-
limit: 0,
|
43
|
-
include: [
|
44
|
-
/.*assets\/.*\.json/
|
45
|
-
],
|
46
|
-
emitFiles: true,
|
47
|
-
fileName: "[name].[hash][extname]",
|
48
|
-
publicPath,
|
49
|
-
}));
|
50
|
-
|
51
|
-
|
52
|
-
if (transpile) {
|
53
|
-
plugins.push(babel({
|
54
|
-
presets: ["@babel/preset-env"],
|
55
|
-
exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, //exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
|
56
|
-
sourcemap: true,
|
57
|
-
}));
|
58
|
-
}
|
59
|
-
|
60
|
-
plugins.push(nodeResolve());
|
61
|
-
|
62
|
-
if (!process.env.DEV) {
|
63
|
-
plugins.push(terser({
|
64
|
-
numWorkers: 1, // temp workaround for `Error: kill EPERM` error on MacOS 11
|
65
|
-
}));
|
66
|
-
}
|
67
|
-
|
68
|
-
if (process.env.DEV) {
|
69
|
-
plugins.push(notify());
|
70
|
-
}
|
71
|
-
|
72
|
-
const es6DevMain = process.env.DEV && !transpile && packageName === "@ui5/webcomponents";
|
73
|
-
if (es6DevMain && os.platform() !== "win32") {
|
74
|
-
plugins.push(livereload({
|
75
|
-
watch: [
|
76
|
-
"dist/resources/bundle.esm.js",
|
77
|
-
"dist/**/*.html",
|
78
|
-
"dist/**/*.json",
|
79
|
-
]
|
80
|
-
}));
|
81
|
-
}
|
82
|
-
|
83
|
-
return plugins;
|
84
|
-
};
|
85
|
-
|
86
|
-
const getES6Config = (input = "bundle.esm.js") => {
|
87
|
-
return [{
|
88
|
-
input,
|
89
|
-
output: {
|
90
|
-
dir: "dist/resources",
|
91
|
-
format: "esm",
|
92
|
-
sourcemap: true
|
93
|
-
},
|
94
|
-
moduleContext: (id) => {
|
95
|
-
if (id.includes("url-search-params-polyfill")) {
|
96
|
-
// suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
|
97
|
-
return "window";
|
98
|
-
}
|
99
|
-
},
|
100
|
-
watch: {
|
101
|
-
clearScreen: false
|
102
|
-
},
|
103
|
-
plugins: getPlugins({transpile: false}),
|
104
|
-
}];
|
105
|
-
};
|
106
|
-
|
107
|
-
const getES5Config = (input = "bundle.es5.js") => {
|
108
|
-
return [ {
|
109
|
-
input,
|
110
|
-
output: {
|
111
|
-
dir: "dist/resources",
|
112
|
-
format: "iife",
|
113
|
-
inlineDynamicImports: true,
|
114
|
-
name: "sap-ui-webcomponents-bundle",
|
115
|
-
extend: "true", // Whether or not to extend the global variable defined by the name option in umd or iife formats.
|
116
|
-
sourcemap: true
|
117
|
-
},
|
118
|
-
moduleContext: (id) => {
|
119
|
-
if (id.includes("url-search-params-polyfill")) {
|
120
|
-
// suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
|
121
|
-
return "window";
|
122
|
-
}
|
123
|
-
},
|
124
|
-
watch: {
|
125
|
-
clearScreen: false
|
126
|
-
},
|
127
|
-
plugins: getPlugins({transpile: true}),
|
128
|
-
}];
|
129
|
-
};
|
130
|
-
|
131
|
-
let config = getES6Config();
|
132
|
-
|
133
|
-
if (process.env.ES5_BUILD) {
|
134
|
-
config = config.concat(getES5Config());
|
135
|
-
}
|
136
|
-
|
137
|
-
if (process.env.SCOPE) {
|
138
|
-
if (fs.existsSync("bundle.scoped.esm.js")) {
|
139
|
-
config = config.concat(getES6Config("bundle.scoped.esm.js"));
|
140
|
-
|
141
|
-
if (fs.existsSync("bundle.scoped.es5.js") && process.env.ES5_BUILD) {
|
142
|
-
config = config.concat(getES5Config("bundle.scoped.es5.js"));
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
|
147
|
-
module.exports = config;
|
@@ -1,143 +0,0 @@
|
|
1
|
-
const cssVariables = {};
|
2
|
-
const template = require('./templates/template').template;
|
3
|
-
const sinceTemplate = require('./templates/api-component-since').template;
|
4
|
-
const propertiesTemplate = require('./templates/api-properties-section').template;
|
5
|
-
const slotsTemplate = require('./templates/api-slots-section').template;
|
6
|
-
const eventsTemplate = require('./templates/api-events-section').template;
|
7
|
-
const methodsTemplate = require('./templates/api-methods-section').template;
|
8
|
-
const cssVariablesTemplate = require('./templates/api-css-variables-section').template;
|
9
|
-
const Handlebars = require('handlebars/dist/handlebars.min.js');
|
10
|
-
const fs = require('fs');
|
11
|
-
const path = require('path');
|
12
|
-
const mkdirp = require('mkdirp');
|
13
|
-
|
14
|
-
const api = JSON.parse(fs.readFileSync(path.normalize(process.argv[2])));
|
15
|
-
|
16
|
-
const entries = api['symbols'];
|
17
|
-
const compiledHandlebars = Handlebars.compile(template);
|
18
|
-
const compiledSinceTemplate = Handlebars.compile(sinceTemplate);
|
19
|
-
const linkMatcher = /{@link(\s)(\w+)\s*}/gi;
|
20
|
-
const sinceMarker = "<!--since_tag_marker-->";
|
21
|
-
|
22
|
-
const getComponentByName = name => {
|
23
|
-
return entries.find(element => {
|
24
|
-
return element.basename === name;
|
25
|
-
})
|
26
|
-
};
|
27
|
-
|
28
|
-
const getCSSVarsByName = name => {
|
29
|
-
return cssVariables[name] || [];
|
30
|
-
};
|
31
|
-
|
32
|
-
const capitalize = str => {
|
33
|
-
return str.replace(/^./, str => str.toUpperCase());
|
34
|
-
};
|
35
|
-
|
36
|
-
Handlebars.registerHelper('toLowerCase', function (str) {
|
37
|
-
return str ? str.toLowerCase() : "";
|
38
|
-
});
|
39
|
-
|
40
|
-
Handlebars.registerHelper('toKebabCase', function (str) {
|
41
|
-
const kebab = str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
42
|
-
return kebab !== str ? kebab : undefined;
|
43
|
-
});
|
44
|
-
|
45
|
-
Handlebars.registerHelper('checkEven', function (iIndex) {
|
46
|
-
return (iIndex % 2 === 0) ? "api-table-roll-even" : "api-table-roll-odd";
|
47
|
-
});
|
48
|
-
|
49
|
-
Handlebars.registerPartial('properties', propertiesTemplate);
|
50
|
-
Handlebars.registerPartial('slots', slotsTemplate);
|
51
|
-
Handlebars.registerPartial('events', eventsTemplate);
|
52
|
-
Handlebars.registerPartial('methods', methodsTemplate);
|
53
|
-
Handlebars.registerPartial('cssVariables', cssVariablesTemplate);
|
54
|
-
|
55
|
-
mkdirp.sync(`dist/test-resources/api`);
|
56
|
-
|
57
|
-
let entriesAPI = [];
|
58
|
-
|
59
|
-
const appendCSSVarsAPI = entry => {
|
60
|
-
entry.cssVariables = getCSSVarsByName(entry.basename);
|
61
|
-
return entry;
|
62
|
-
}
|
63
|
-
|
64
|
-
const calculateAPI = entry => {
|
65
|
-
if (entriesAPI.indexOf(entry.basename) !== -1) {
|
66
|
-
return entry;
|
67
|
-
}
|
68
|
-
|
69
|
-
let parent = getComponentByName(entry.extends) || {};
|
70
|
-
|
71
|
-
entry = appendCSSVarsAPI(entry);
|
72
|
-
parent = appendCSSVarsAPI(parent);
|
73
|
-
|
74
|
-
parent = { ...{ properties: [], events: [], slots: [], cssVariables: [] }, ...parent };
|
75
|
-
|
76
|
-
// extend component documentation
|
77
|
-
entry.properties = [...(entry.properties || []), ...(parent.properties || [])];
|
78
|
-
entry.events = [...(entry.events || []), ...(parent.events || [])];
|
79
|
-
entry.slots = [...(entry.slots || []), ...(parent.slots || [])];
|
80
|
-
entry.cssVariables = [...(entry.cssVariables || []), ...(parent.cssVariables || [])];
|
81
|
-
|
82
|
-
entriesAPI.push(entry.basename);
|
83
|
-
|
84
|
-
return entry;
|
85
|
-
}
|
86
|
-
|
87
|
-
const appendAdditionalEntriesAPI = entry => {
|
88
|
-
if (entry.appenddocs) {
|
89
|
-
const additionalEntries = entry.appenddocs.split(" ");
|
90
|
-
entry.additionalDocs = [];
|
91
|
-
|
92
|
-
additionalEntries.forEach(entryName => {
|
93
|
-
let additionalEntry = getComponentByName(entryName);
|
94
|
-
additionalEntry = calculateAPI(additionalEntry);
|
95
|
-
entry.additionalDocs.push(additionalEntry);
|
96
|
-
});
|
97
|
-
}
|
98
|
-
|
99
|
-
return entry;
|
100
|
-
}
|
101
|
-
|
102
|
-
const generateSamplePage = entry => {
|
103
|
-
let content = "";
|
104
|
-
|
105
|
-
try {
|
106
|
-
content = fs.readFileSync(`dist/test-resources/samples/${capitalize(entry.basename)}.sample.html`, 'utf8');
|
107
|
-
} catch (err) { }
|
108
|
-
|
109
|
-
if (content) {
|
110
|
-
const APIReference = compiledHandlebars(entry).replace(/\[\]/g, " [0..n]");
|
111
|
-
const EntitySince = compiledSinceTemplate(entry).replace(/\[\]/g, " [0..n]");
|
112
|
-
|
113
|
-
content = content.replace('<!-- JSDoc marker -->', APIReference);
|
114
|
-
content = content.replace(sinceMarker, EntitySince);
|
115
|
-
|
116
|
-
content = content.replace(linkMatcher, match => {
|
117
|
-
const component = linkMatcher.exec(match)[2];
|
118
|
-
|
119
|
-
// reset the regex
|
120
|
-
linkMatcher.lastIndex = 0;
|
121
|
-
|
122
|
-
return `<a href="#" onclick="redirect(event, '${component}')">${component}</a>`;
|
123
|
-
});
|
124
|
-
|
125
|
-
fs.writeFile(`dist/test-resources/api/${entry.basename}.sample.html`, content, (err) => {
|
126
|
-
// console.log(err);
|
127
|
-
});
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
const generateComponentAPI = entry => {
|
132
|
-
// (1) calculate the API
|
133
|
-
entry = calculateAPI(entry);
|
134
|
-
|
135
|
-
// (2) append additional API for composition components - List -> ListIems, TabContainer -> Tabs, Table -> TableRow/Column/Cell
|
136
|
-
entry = appendAdditionalEntriesAPI(entry);
|
137
|
-
|
138
|
-
// (3) generate sample page
|
139
|
-
generateSamplePage(entry);
|
140
|
-
}
|
141
|
-
|
142
|
-
entries.forEach(generateComponentAPI);
|
143
|
-
entriesAPI = [];
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
{{#if cssVariables}}
|
4
|
-
<h3 class="comment-api-title" >CSS variables</h3>
|
5
|
-
<p class="small-space-top">You can use the following CSS varialbes to change the component styling.</p>
|
6
|
-
|
7
|
-
<div class="small-space-top api-table">
|
8
|
-
<div class="head api-table-header-roll">
|
9
|
-
<div class="cell api-table-header-cell">Name</div>
|
10
|
-
<div class="cell api-table-header-cell">Description</div>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
{{#each cssVariables}}
|
14
|
-
<div class="row {{checkEven @index}}">
|
15
|
-
<div class="cell api-table-content-cell api-table-content-cell-bold">{{this.name}}</div>
|
16
|
-
<div class="cell api-table-content-cell api-table-content-cell-description">
|
17
|
-
{{{this.description}}}
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
{{/each}}
|
21
|
-
|
22
|
-
</div>
|
23
|
-
{{/if}}`
|
24
|
-
};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
{{#if events}}
|
4
|
-
<h3 class="comment-api-title space-top">Events</h3>
|
5
|
-
<p class="small-space-top" >This Web Component fires semantic events upon user interaction. You can bind to these events with the standard DOM APIs, such as <code>addEventListener</code>. </p>
|
6
|
-
|
7
|
-
<div class="small-space-top api-table">
|
8
|
-
<div class="head api-table-header-roll">
|
9
|
-
<div class="cell api-table-header-cell">Name</div>
|
10
|
-
<div class="cell api-table-header-cell">Description</div>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
{{#each events}}
|
14
|
-
<div class="row {{checkEven @index}}">
|
15
|
-
<div class="cell api-table-content-cell api-table-content-cell-bold">{{this.name}}</div>
|
16
|
-
<div class="cell api-table-content-cell api-table-content-cell-description">
|
17
|
-
{{{this.description}}}
|
18
|
-
{{#if this.since}}
|
19
|
-
<div class="api-table-content-cell-bold api-table-content-cell-since">since v{{{this.since}}}</div>
|
20
|
-
{{/if}}
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
|
24
|
-
{{#each this.parameters}}
|
25
|
-
<tr class="api-table-event-param">
|
26
|
-
<div class="api-table-content-event-params-wrapper">
|
27
|
-
<div class="cell api-table-param-name api-table-content-cell api-table-content-cell-bold">{{this.name}}</div>
|
28
|
-
<div class="cell api-table-event-param-cell api-table-content-cell api-table-content-cell-description"><strong class="bold" >type:</strong> {{this.type}} <br/> <strong class="api-table-event-description bold">description:</strong> {{{this.description}}}</div>
|
29
|
-
</div>
|
30
|
-
</tr>
|
31
|
-
{{/each}}
|
32
|
-
{{/each}}
|
33
|
-
</div>
|
34
|
-
{{/if}}`
|
35
|
-
};
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
{{#if methods}}
|
4
|
-
<h3 class="comment-api-title space-top">Methods</h3>
|
5
|
-
<p class="small-space-top" >This Web Component exposes public methods. You can invoke them directly on the Web Component instance.</p>
|
6
|
-
|
7
|
-
<div class="small-space-top api-table">
|
8
|
-
<div class="head api-table-header-roll">
|
9
|
-
<div class="cell api-table-header-cell">Name</div>
|
10
|
-
<div class="cell api-table-header-cell">Description</div>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
{{#each methods}}
|
14
|
-
<div class="row {{checkEven @index}}">
|
15
|
-
<div class="cell api-table-content-cell api-table-content-cell-bold">{{this.name}}</div>
|
16
|
-
<div class="cell api-table-content-cell api-table-content-cell-description">{{{this.description}}}</div>
|
17
|
-
</div>
|
18
|
-
|
19
|
-
{{#each this.parameters}}
|
20
|
-
<div class="cell api-table-content-cell api-table-content-cell-bold api-table-param-name">{{this.name}}</div>
|
21
|
-
<div class="cell api-table-event-param-cell api-table-content-cell api-table-content-cell-description"><strong class="bold" >type:</strong> {{this.type}} <br/> <strong class="api-table-event-description bold">description:</strong> {{{this.description}}}</div>
|
22
|
-
{{/each}}
|
23
|
-
{{/each}}
|
24
|
-
</div>
|
25
|
-
{{/if}}`
|
26
|
-
};
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
{{#if properties}}
|
4
|
-
<h3 class="comment-api-title" >Properties/Attributes</h3>
|
5
|
-
<p class="small-space-top" >You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.</p>
|
6
|
-
|
7
|
-
<div class="small-space-top api-table">
|
8
|
-
<div class="head api-table-header-roll">
|
9
|
-
<div class="cell api-table-header-cell">Name</div>
|
10
|
-
<div class="cell api-table-header-cell">Type</div>
|
11
|
-
<div class="cell api-table-header-cell">Default Value</div>
|
12
|
-
<div class="cell api-table-header-cell">Description</div>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
{{#each properties}}
|
16
|
-
<div class="row {{checkEven @index}}">
|
17
|
-
<div class="cell api-table-content-cell api-table-content-cell-bold">
|
18
|
-
{{this.name}}
|
19
|
-
{{#if this.readonly}}
|
20
|
-
(readonly)
|
21
|
-
{{/if}}
|
22
|
-
<br>
|
23
|
-
{{#if (toKebabCase this.name)}}
|
24
|
-
<code>{{toKebabCase this.name}}</code>
|
25
|
-
{{/if}}
|
26
|
-
</div>
|
27
|
-
<div class="cell api-table-content-cell">{{this.type}}</div>
|
28
|
-
<div class="cell api-table-content-cell">{{this.defaultValue}}</div>
|
29
|
-
<div class="cell api-table-content-cell api-table-content-cell-description">
|
30
|
-
{{{this.description}}}
|
31
|
-
{{#if this.since}}
|
32
|
-
<div class="api-table-content-cell-bold api-table-content-cell-since">since v{{{this.since}}}</div>
|
33
|
-
{{/if}}
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
{{/each}}
|
37
|
-
|
38
|
-
</div>
|
39
|
-
{{/if}}`
|
40
|
-
};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
{{#if slots}}
|
4
|
-
<h3 class="comment-api-title space-top" >Slots</h3>
|
5
|
-
<p class="small-space-top" >
|
6
|
-
This Element provides slot(s). This means it can display its child nodes.<br>
|
7
|
-
Unless targeting the default slot, use the <code>slot</code> attribute to define the destination slot for each child.<br>
|
8
|
-
Text, along with HTML Elements with no <code>slot</code> attribute, goes the the <code>default</code> slot.
|
9
|
-
</p>
|
10
|
-
|
11
|
-
<div class="small-space-top api-table">
|
12
|
-
<div class="head api-table-header-roll">
|
13
|
-
<div class="cell api-table-header-cell">Slot</div>
|
14
|
-
<div class="cell api-table-header-cell">Type</div>
|
15
|
-
<div class="cell api-table-header-cell">Description</div>
|
16
|
-
</div>
|
17
|
-
|
18
|
-
{{#each slots}}
|
19
|
-
<div class="row {{checkEven @index}}">
|
20
|
-
<div class="cell api-table-content-cell api-table-content-cell-bold">{{this.name}}</div>
|
21
|
-
<div class="cell api-table-content-cell">{{this.type}}</div>
|
22
|
-
<div class="cell api-table-content-cell api-table-content-cell-description">{{{this.description}}}</div>
|
23
|
-
</div>
|
24
|
-
{{/each}}
|
25
|
-
|
26
|
-
</div>
|
27
|
-
{{/if}}`
|
28
|
-
};
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
<div class="page-container">
|
4
|
-
<div class="api-container">
|
5
|
-
<section class="component-description">
|
6
|
-
{{{description}}}
|
7
|
-
<section class="component-api space-top">
|
8
|
-
{{> properties this}}
|
9
|
-
{{> slots this}}
|
10
|
-
{{> events this}}
|
11
|
-
{{> methods this}}
|
12
|
-
{{> cssVariables this}}
|
13
|
-
</section>
|
14
|
-
</section>
|
15
|
-
</div>
|
16
|
-
</div>
|
17
|
-
{{#each additionalDocs}}
|
18
|
-
<div class="api-container appended-doc">
|
19
|
-
<h1>{{this.basename}}</h1>
|
20
|
-
<section class="component-description">
|
21
|
-
{{{this.description}}}
|
22
|
-
<section class="component-api space-top">
|
23
|
-
{{> properties this}}
|
24
|
-
{{> slots this}}
|
25
|
-
{{> events this}}
|
26
|
-
{{> cssVariables this}}
|
27
|
-
</section>
|
28
|
-
</section>
|
29
|
-
</div>
|
30
|
-
{{/each}}
|
31
|
-
<footer class="footer-wrapper">
|
32
|
-
<div class="footer-links">
|
33
|
-
<a class="separator" href="https://www.sap.com/about/legal/privacy.html" target="_blank">Privacy Policy</a>
|
34
|
-
<a href="https://www.sap.com/about/legal/impressum.html" target="_blank">Legal</a>
|
35
|
-
</div>
|
36
|
-
<img src="../../../../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
|
37
|
-
</footer>`
|
38
|
-
};
|
@@ -1,123 +0,0 @@
|
|
1
|
-
const fs = require("fs");
|
2
|
-
const path = require("path");
|
3
|
-
const mkdirp = require("mkdirp");
|
4
|
-
const commandLineArgs = require('command-line-args');
|
5
|
-
const beautify = require("json-beautify");
|
6
|
-
|
7
|
-
// String utils
|
8
|
-
const kebabToCamelCase = string => toCamelCase(string.split("-"));
|
9
|
-
const toCamelCase = parts => {
|
10
|
-
return parts.map((string, index) => {
|
11
|
-
return index === 0 ? string.toLowerCase() : string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
12
|
-
}).join("");
|
13
|
-
};
|
14
|
-
const capitalizeFirst = str => str.substr(0,1).toUpperCase() + str.substr(1);
|
15
|
-
|
16
|
-
// content of package.json
|
17
|
-
let packageContent;
|
18
|
-
|
19
|
-
const DEFAULT_PORT = 8080;
|
20
|
-
const DEFAULT_TAG = 'my-first-component';
|
21
|
-
|
22
|
-
// from where all the files will be copied
|
23
|
-
const RESOURCES_DIR = path.join(`${__dirname}`, `resources/`);
|
24
|
-
|
25
|
-
// Command line options
|
26
|
-
const options = commandLineArgs([
|
27
|
-
{name: 'port', alias: 'p', type: Number},
|
28
|
-
{name: 'tag', type: String},
|
29
|
-
]);
|
30
|
-
|
31
|
-
// Ensure there is package.json
|
32
|
-
try {
|
33
|
-
packageContent = JSON.parse(fs.readFileSync("package.json"));
|
34
|
-
} catch (err) {
|
35
|
-
console.log("No package.json found, please run: 'npm init' first");
|
36
|
-
process.exit(1);
|
37
|
-
}
|
38
|
-
|
39
|
-
// Ensure correct tag
|
40
|
-
const tag = options.tag || DEFAULT_TAG;
|
41
|
-
if (!tag.includes("-")) {
|
42
|
-
console.log("tag name should contain at least one dash");
|
43
|
-
process.exit(1);
|
44
|
-
}
|
45
|
-
if (tag.startsWith("ui5-")) {
|
46
|
-
console.log("The ui5- prefix is reserved for the standard UI5 Web Components due to future possible name clashes.");
|
47
|
-
process.exit(1);
|
48
|
-
}
|
49
|
-
|
50
|
-
const className = capitalizeFirst(kebabToCamelCase(tag));
|
51
|
-
|
52
|
-
// All variables that will be replaced in the content of the resources/
|
53
|
-
const vars = {
|
54
|
-
INIT_PACKAGE_VAR_NAME: packageContent.name,
|
55
|
-
INIT_PACKAGE_VAR_PORT: options.port || DEFAULT_PORT,
|
56
|
-
INIT_PACKAGE_VAR_TAG: tag,
|
57
|
-
INIT_PACKAGE_VAR_CLASS_NAME: className,
|
58
|
-
};
|
59
|
-
console.log(vars);
|
60
|
-
|
61
|
-
const replaceVarsInFileContent = content => {
|
62
|
-
for (let key in vars) {
|
63
|
-
const re = new RegExp(key, "g");
|
64
|
-
content = content.replace(re, vars[key]);
|
65
|
-
}
|
66
|
-
return content;
|
67
|
-
};
|
68
|
-
|
69
|
-
const replaceVarsInFileName = fileName => {
|
70
|
-
return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME) ;
|
71
|
-
};
|
72
|
-
|
73
|
-
const copyFile = (sourcePath, destPath) => {
|
74
|
-
let content = fs.readFileSync(sourcePath, {encoding: "UTF-8"});
|
75
|
-
content = replaceVarsInFileContent(content);
|
76
|
-
destPath = replaceVarsInFileName(destPath);
|
77
|
-
fs.writeFileSync(destPath, content);
|
78
|
-
console.log(destPath);
|
79
|
-
};
|
80
|
-
|
81
|
-
const copyResources = sourcePath => {
|
82
|
-
const destPath = sourcePath.substr(RESOURCES_DIR.length);
|
83
|
-
const isDir = fs.lstatSync(sourcePath).isDirectory();
|
84
|
-
if (isDir) {
|
85
|
-
if (destPath) {
|
86
|
-
mkdirp.sync(destPath);
|
87
|
-
console.log(destPath);
|
88
|
-
}
|
89
|
-
fs.readdirSync(sourcePath).forEach(file => {
|
90
|
-
copyResources(path.join(sourcePath, file));
|
91
|
-
});
|
92
|
-
} else {
|
93
|
-
copyFile(sourcePath, destPath);
|
94
|
-
}
|
95
|
-
};
|
96
|
-
|
97
|
-
const updatePackageFile = () => {
|
98
|
-
packageContent.scripts = {
|
99
|
-
"clean": "wc-dev clean",
|
100
|
-
"lint": "wc-dev lint",
|
101
|
-
"start": "wc-dev start",
|
102
|
-
"watch": "wc-dev watch",
|
103
|
-
"serve": "wc-dev serve",
|
104
|
-
"build": "wc-dev build",
|
105
|
-
"test": "wc-dev test",
|
106
|
-
"create-ui5-element": "wc-create-ui5-element",
|
107
|
-
"prepublishOnly": "npm run build"
|
108
|
-
};
|
109
|
-
|
110
|
-
packageContent.ui5 = {
|
111
|
-
webComponentsPackage: true
|
112
|
-
};
|
113
|
-
|
114
|
-
fs.writeFileSync("package.json", beautify(packageContent, null, 2, 100));
|
115
|
-
};
|
116
|
-
|
117
|
-
// Copy files
|
118
|
-
copyResources(RESOURCES_DIR);
|
119
|
-
|
120
|
-
// Update package.json
|
121
|
-
updatePackageFile();
|
122
|
-
|
123
|
-
console.log("Package successfully initialized.");
|
@@ -1,25 +0,0 @@
|
|
1
|
-
// ES5 bundle targets IE11 only
|
2
|
-
import "@ui5/webcomponents-base/dist/features/browsersupport/IE11.js";
|
3
|
-
|
4
|
-
import "./bundle.esm.js";
|
5
|
-
|
6
|
-
import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js";
|
7
|
-
import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
|
8
|
-
import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
|
9
|
-
import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
|
10
|
-
import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
|
11
|
-
import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
|
12
|
-
import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
|
13
|
-
|
14
|
-
const configuration = {
|
15
|
-
getAnimationMode,
|
16
|
-
getLanguage,
|
17
|
-
getTheme,
|
18
|
-
setTheme,
|
19
|
-
getNoConflict,
|
20
|
-
setNoConflict,
|
21
|
-
getCalendarType,
|
22
|
-
getRTL,
|
23
|
-
getFirstDayOfWeek,
|
24
|
-
};
|
25
|
-
export default configuration;
|