Skip to content

Commit e25eb19

Browse files
committed
ci: updated demo + pkg.json scripts
1 parent a35051e commit e25eb19

File tree

6 files changed

+186
-103
lines changed

6 files changed

+186
-103
lines changed

custom-elements.json

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22
"schemaVersion": "1.0.0",
33
"readme": "",
44
"modules": [
5-
{
6-
"kind": "javascript-module",
7-
"path": "oscd-menu-save.spec.ts",
8-
"declarations": [],
9-
"exports": [
10-
{
11-
"kind": "custom-element-definition",
12-
"name": "oscd-menu-save",
13-
"declaration": {
14-
"name": "OscdMenuSave",
15-
"module": "/oscd-menu-save.js"
16-
}
17-
}
18-
]
19-
},
205
{
216
"kind": "javascript-module",
227
"path": "oscd-menu-save.ts",
@@ -73,24 +58,6 @@
7358
}
7459
}
7560
]
76-
},
77-
{
78-
"kind": "javascript-module",
79-
"path": "coverage/lcov-report/block-navigation.js",
80-
"declarations": [],
81-
"exports": []
82-
},
83-
{
84-
"kind": "javascript-module",
85-
"path": "coverage/lcov-report/prettify.js",
86-
"declarations": [],
87-
"exports": []
88-
},
89-
{
90-
"kind": "javascript-module",
91-
"path": "coverage/lcov-report/sorter.js",
92-
"declarations": [],
93-
"exports": []
9461
}
9562
]
9663
}

demo/index.html

Lines changed: 46 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,50 @@
1-
<html>
2-
<head>
3-
<title>oscd-menu-save Demo</title>
4-
<link
5-
rel="stylesheet"
6-
href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap"
7-
/>
8-
<link
9-
rel="stylesheet"
10-
href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
11-
/>
12-
<link
13-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined"
14-
rel="stylesheet"
15-
/>
16-
</head>
17-
<body>
18-
<oscd-shell></oscd-shell>
1+
<title>oscd-designer demo</title>
2+
<link
3+
rel="stylesheet"
4+
href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap"
5+
/>
6+
<link
7+
rel="stylesheet"
8+
href="https://fonts.googleapis.com/css?family=Material+Symbols+Outlined&display=block"
9+
/>
10+
<oscd-shell></oscd-shell>
1911

20-
<script type="module">
21-
import '@omicronenergy/oscd-shell/oscd-shell.js';
12+
<script type="module">
13+
import '@omicronenergy/oscd-shell/oscd-shell.js';
14+
import { plugins } from './plugins.js';
2215

23-
const plugins = {
24-
menu: [
25-
{
26-
name: 'Open File',
27-
translations: { de: 'Datei öffnen' },
28-
icon: 'folder_open',
29-
src: 'https://openenergytools.github.io/oscd-open/oscd-open.js',
30-
},
31-
{
32-
name: 'Save',
33-
translations: { de: 'Datei speichern' },
34-
icon: 'save',
35-
requireDoc: true,
36-
src: '../oscd-menu-save.js',
37-
},
38-
],
39-
};
16+
const editor = document.querySelector('oscd-shell');
17+
editor.plugins = plugins;
4018

41-
const editor = document.querySelector('oscd-shell');
42-
const params = new URL(document.location.href).searchParams;
43-
if (!editor) {
44-
throw new Error('oscd-shell element not found');
45-
}
46-
for (const [name, value] of params) {
47-
editor.setAttribute(name, value);
48-
}
49-
editor.plugins = plugins;
50-
</script>
51-
<style>
52-
html,
53-
body {
54-
width: 100%;
55-
height: 100%;
56-
}
19+
const params = new URL(document.location).searchParams;
20+
for (const [name, value] of params) {
21+
editor.setAttribute(name, value);
22+
}
5723

58-
* {
59-
margin: 0px;
60-
padding: 0px;
61-
}
62-
</style>
63-
</body>
64-
</html>
24+
const sample = await fetch('sample.scd').then(r => r.text());
25+
const sample2 = await fetch('sample2.scd').then(r => r.text());
26+
editor.docs = {
27+
['sample.scd']: new DOMParser().parseFromString(sample, 'application/xml'),
28+
29+
['sample2.scd']: new DOMParser().parseFromString(
30+
sample2,
31+
'application/xml',
32+
),
33+
};
34+
editor.docName = 'sample.scd';
35+
</script>
36+
37+
<style>
38+
* {
39+
--oscd-theme-text-font: 'Roboto';
40+
--oscd-theme-icon-font: 'Material Symbols Outlined';
41+
42+
margin: 0px;
43+
padding: 0px;
44+
}
45+
46+
abbr {
47+
text-decoration: none;
48+
border-bottom: none;
49+
}
50+
</style>

demo/plugins.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import OscdMenuOpen from '@omicronenergy/oscd-menu-open';
2+
import OscdBackgroundEditV1 from '@omicronenergy/oscd-background-editv1';
3+
4+
import OscdMenuSave from '../oscd-menu-save.js';
5+
6+
customElements.define('oscd-menu-open', OscdMenuOpen);
7+
customElements.define('oscd-background-editv1', OscdBackgroundEditV1);
8+
9+
customElements.define('oscd-menu-save', OscdMenuSave);
10+
11+
export const plugins = {
12+
menu: [
13+
{
14+
name: 'Open File',
15+
translations: { de: 'Datei öffnen' },
16+
icon: 'folder_open',
17+
tagName: 'oscd-menu-open',
18+
},
19+
{
20+
name: 'Save File',
21+
translations: { de: 'Datei speichern' },
22+
icon: 'save',
23+
requireDoc: true,
24+
tagName: 'oscd-menu-save',
25+
},
26+
],
27+
editor: [],
28+
background: [
29+
{
30+
name: 'EditV1 Events Listener',
31+
icon: 'none',
32+
requireDoc: true,
33+
tagName: 'oscd-background-editv1',
34+
},
35+
],
36+
};

package-lock.json

Lines changed: 94 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"scripts": {
1616
"lint": "eslint .",
1717
"format": "eslint . --fix",
18-
"analyze": "cem analyze --litelement",
18+
"analyze": "cem analyze --litelement --exclude demo/* --exclude dist/* --exclude *.spec.ts --exclude *.test.ts --exclude coverage/*",
1919
"copy-demo": "cp -r ./demo ./dist/",
20-
"start": "npm run build && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
21-
"start:bundle": "npm run bundle && concurrently -k -r \"rollup -c rollup.config.js --watch\" \"wds --open dist/demo/index.html --watch --config ./web-dev-server.bundle.config.js\"",
22-
"build": "rimraf dist && npm run copy-demo && npm run analyze -- --exclude dist && tsc ",
20+
"start": "npm run build && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds --node-resolve \"",
21+
"start:bundle": "npm run bundle && concurrently -k -r \"rollup -c rollup.config.js --watch\" \"wds --watch \"",
22+
"build": "rimraf dist && mkdir dist && npm run copy-demo && npm run analyze -- --exclude dist && tsc ",
2323
"bundle": "rimraf dist && rollup -c rollup.config.js",
2424
"test": "npm run build && wtr --coverage",
2525
"test:watch": "npm run build && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
@@ -41,7 +41,9 @@
4141
"license": "Apache-2.0",
4242
"dependencies": {
4343
"@omicronenergy/oscd-api": "^0.1.1",
44-
"@omicronenergy/oscd-shell": "^0.0.7",
44+
"@omicronenergy/oscd-menu-open": "^0.0.6",
45+
"@omicronenergy/oscd-background-editv1": "^0.0.6",
46+
"@omicronenergy/oscd-shell": "^0.0.8",
4547
"tslib": "^2.8.1"
4648
},
4749
"devDependencies": {

web-dev-server.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
1010
/** Use regular watch mode if HMR is not enabled. */
1111
watch: !hmr,
1212
/** Resolve bare module imports */
13-
nodeResolve: {
14-
exportConditions: ['browser', 'development'],
15-
},
13+
// nodeResolve: {
14+
// exportConditions: ['browser', 'development'],
15+
// },
1616

1717
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
1818
// esbuildTarget: 'auto'

0 commit comments

Comments
 (0)