@omicronenergy/oscd-shell 0.0.5 → 0.0.8
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/dist/foundation/cyrb64.d.ts +6 -0
- package/dist/foundation/cyrb64.js +26 -0
- package/dist/foundation/cyrb64.js.map +1 -0
- package/dist/foundation.d.ts +1 -0
- package/dist/foundation.js +2 -0
- package/dist/foundation.js.map +1 -0
- package/dist/locales/de.d.ts +10 -0
- package/dist/locales/de.js +15 -0
- package/dist/locales/de.js.map +1 -0
- package/dist/locales.d.ts +13 -0
- package/dist/locales.js +21 -0
- package/dist/locales.js.map +1 -0
- package/dist/oscd-shell.d.ts +119 -0
- package/dist/oscd-shell.js +685 -0
- package/dist/oscd-shell.js.map +1 -0
- package/dist/utils/plugin-utils.d.ts +29 -0
- package/dist/utils/plugin-utils.js +138 -0
- package/dist/utils/plugin-utils.js.map +1 -0
- package/dist/utils/plugin-utils.spec.d.ts +1 -0
- package/dist/utils/plugin-utils.spec.js +115 -0
- package/dist/utils/plugin-utils.spec.js.map +1 -0
- package/package.json +40 -35
- package/.editorconfig +0 -22
- package/.github/actions/setup-node-env/action.yml +0 -49
- package/.github/workflows/release-please.yml +0 -84
- package/.github/workflows/test.yml +0 -18
- package/.github/workflows/update-screenshots.yml +0 -29
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.release-please-manifest.json +0 -1
- package/CHANGELOG.md +0 -73
- package/CONTRIBUTING.md +0 -393
- package/commitlint.config.js +0 -1
- package/demo/AddPlugins.js +0 -42
- package/demo/DemoPluginSrc.js +0 -9
- package/demo/embedded.html +0 -17
- package/demo/index.html +0 -95
- package/foundation/cyrb64.ts +0 -27
- package/foundation/edit-event.ts +0 -273
- package/foundation/open-event.ts +0 -21
- package/foundation.ts +0 -28
- package/lit-localize.json +0 -15
- package/localization/de.xlf +0 -75
- package/oscd-shell.editing.spec.ts +0 -813
- package/oscd-shell.plugging.spec.ts +0 -78
- package/oscd-shell.spec.ts +0 -431
- package/oscd-shell.test.ts +0 -382
- package/oscd-shell.ts +0 -906
- package/release-please-config.json +0 -21
- package/rollup.config.js +0 -51
- package/screenshots/Chromium/baseline/app-bar-de.png +0 -0
- package/screenshots/Chromium/baseline/app-bar-en.png +0 -0
- package/screenshots/Chromium/baseline/document-name-de.png +0 -0
- package/screenshots/Chromium/baseline/document-name-en.png +0 -0
- package/screenshots/Chromium/baseline/editor-plugins-de.png +0 -0
- package/screenshots/Chromium/baseline/editor-plugins-en.png +0 -0
- package/screenshots/Chromium/baseline/editor-plugins-selected-de.png +0 -0
- package/screenshots/Chromium/baseline/editor-plugins-selected-en.png +0 -0
- package/screenshots/Chromium/baseline/editor-plugins-with-doc-de.png +0 -0
- package/screenshots/Chromium/baseline/editor-plugins-with-doc-en.png +0 -0
- package/screenshots/Chromium/baseline/log-entries-de.png +0 -0
- package/screenshots/Chromium/baseline/log-entries-en.png +0 -0
- package/screenshots/Chromium/baseline/log-entries-redone-de.png +0 -0
- package/screenshots/Chromium/baseline/log-entries-redone-en.png +0 -0
- package/screenshots/Chromium/baseline/log-entries-undone-de.png +0 -0
- package/screenshots/Chromium/baseline/log-entries-undone-en.png +0 -0
- package/screenshots/Chromium/baseline/log-screen-de.png +0 -0
- package/screenshots/Chromium/baseline/log-screen-en.png +0 -0
- package/screenshots/Chromium/baseline/menu-drawer-de.png +0 -0
- package/screenshots/Chromium/baseline/menu-drawer-en.png +0 -0
- package/screenshots/Chromium/baseline/menu-plugins-de.png +0 -0
- package/screenshots/Chromium/baseline/menu-plugins-en.png +0 -0
- package/screenshots/Chromium/baseline/menu-plugins-triggered-de.png +0 -0
- package/screenshots/Chromium/baseline/menu-plugins-triggered-en.png +0 -0
- package/screenshots/Firefox/baseline/app-bar-de.png +0 -0
- package/screenshots/Firefox/baseline/app-bar-en.png +0 -0
- package/screenshots/Firefox/baseline/document-name-de.png +0 -0
- package/screenshots/Firefox/baseline/document-name-en.png +0 -0
- package/screenshots/Firefox/baseline/editor-plugins-de.png +0 -0
- package/screenshots/Firefox/baseline/editor-plugins-en.png +0 -0
- package/screenshots/Firefox/baseline/editor-plugins-selected-de.png +0 -0
- package/screenshots/Firefox/baseline/editor-plugins-selected-en.png +0 -0
- package/screenshots/Firefox/baseline/editor-plugins-with-doc-de.png +0 -0
- package/screenshots/Firefox/baseline/editor-plugins-with-doc-en.png +0 -0
- package/screenshots/Firefox/baseline/log-entries-de.png +0 -0
- package/screenshots/Firefox/baseline/log-entries-en.png +0 -0
- package/screenshots/Firefox/baseline/log-entries-redone-de.png +0 -0
- package/screenshots/Firefox/baseline/log-entries-redone-en.png +0 -0
- package/screenshots/Firefox/baseline/log-entries-undone-de.png +0 -0
- package/screenshots/Firefox/baseline/log-entries-undone-en.png +0 -0
- package/screenshots/Firefox/baseline/log-screen-de.png +0 -0
- package/screenshots/Firefox/baseline/log-screen-en.png +0 -0
- package/screenshots/Firefox/baseline/menu-drawer-de.png +0 -0
- package/screenshots/Firefox/baseline/menu-drawer-en.png +0 -0
- package/screenshots/Firefox/baseline/menu-plugins-de.png +0 -0
- package/screenshots/Firefox/baseline/menu-plugins-en.png +0 -0
- package/screenshots/Firefox/baseline/menu-plugins-triggered-de.png +0 -0
- package/screenshots/Firefox/baseline/menu-plugins-triggered-en.png +0 -0
- package/screenshots/Webkit/baseline/app-bar-de.png +0 -0
- package/screenshots/Webkit/baseline/app-bar-en.png +0 -0
- package/screenshots/Webkit/baseline/document-name-de.png +0 -0
- package/screenshots/Webkit/baseline/document-name-en.png +0 -0
- package/screenshots/Webkit/baseline/editor-plugins-de.png +0 -0
- package/screenshots/Webkit/baseline/editor-plugins-en.png +0 -0
- package/screenshots/Webkit/baseline/editor-plugins-selected-de.png +0 -0
- package/screenshots/Webkit/baseline/editor-plugins-selected-en.png +0 -0
- package/screenshots/Webkit/baseline/editor-plugins-with-doc-de.png +0 -0
- package/screenshots/Webkit/baseline/editor-plugins-with-doc-en.png +0 -0
- package/screenshots/Webkit/baseline/log-entries-de.png +0 -0
- package/screenshots/Webkit/baseline/log-entries-en.png +0 -0
- package/screenshots/Webkit/baseline/log-entries-redone-de.png +0 -0
- package/screenshots/Webkit/baseline/log-entries-redone-en.png +0 -0
- package/screenshots/Webkit/baseline/log-entries-undone-de.png +0 -0
- package/screenshots/Webkit/baseline/log-entries-undone-en.png +0 -0
- package/screenshots/Webkit/baseline/log-screen-de.png +0 -0
- package/screenshots/Webkit/baseline/log-screen-en.png +0 -0
- package/screenshots/Webkit/baseline/menu-drawer-de.png +0 -0
- package/screenshots/Webkit/baseline/menu-drawer-en.png +0 -0
- package/screenshots/Webkit/baseline/menu-plugins-de.png +0 -0
- package/screenshots/Webkit/baseline/menu-plugins-en.png +0 -0
- package/screenshots/Webkit/baseline/menu-plugins-triggered-de.png +0 -0
- package/screenshots/Webkit/baseline/menu-plugins-triggered-en.png +0 -0
- package/tsconfig.json +0 -23
- package/utils/testing.spec.ts +0 -210
- package/utils/testing.ts +0 -65
- package/web-dev-server.config.js +0 -24
- package/web-test-runner.config.js +0 -180
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { visualRegressionPlugin } from '@web/test-runner-visual-regression/plugin';
|
|
2
|
-
import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
3
|
-
|
|
4
|
-
import pixelmatch from 'pixelmatch';
|
|
5
|
-
import { PNG } from 'pngjs';
|
|
6
|
-
|
|
7
|
-
const fuzzy = ['win32', 'darwin'].includes(process.platform); // allow for 1% difference on non-linux OSs
|
|
8
|
-
const local = !process.env.CI;
|
|
9
|
-
|
|
10
|
-
console.assert(local, 'Running in CI!');
|
|
11
|
-
console.assert(!fuzzy, 'Running on OS with 1% test pixel diff threshold!');
|
|
12
|
-
|
|
13
|
-
const thresholdPercentage = fuzzy && local ? 1 : 0;
|
|
14
|
-
|
|
15
|
-
const filteredLogs = [
|
|
16
|
-
'Running in dev mode',
|
|
17
|
-
'Lit is in dev mode',
|
|
18
|
-
'scheduled an update',
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
const browsers = [
|
|
22
|
-
playwrightLauncher({ product: 'chromium' }),
|
|
23
|
-
playwrightLauncher({ product: 'firefox' }),
|
|
24
|
-
playwrightLauncher({ product: 'webkit' }),
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
function defaultGetImageDiff({ baselineImage, image, options }) {
|
|
28
|
-
let error = '';
|
|
29
|
-
let basePng = PNG.sync.read(baselineImage);
|
|
30
|
-
let png = PNG.sync.read(image);
|
|
31
|
-
let { width, height } = png;
|
|
32
|
-
|
|
33
|
-
if (basePng.width !== png.width || basePng.height !== png.height) {
|
|
34
|
-
error =
|
|
35
|
-
`Screenshot is not the same width and height as the baseline. ` +
|
|
36
|
-
`Baseline: { width: ${basePng.width}, height: ${basePng.height} }` +
|
|
37
|
-
`Screenshot: { width: ${png.width}, height: ${png.height} }`;
|
|
38
|
-
width = Math.max(basePng.width, png.width);
|
|
39
|
-
height = Math.max(basePng.height, png.height);
|
|
40
|
-
let oldPng = basePng;
|
|
41
|
-
basePng = new PNG({ width, height });
|
|
42
|
-
oldPng.data.copy(basePng.data, 0, 0, oldPng.data.length);
|
|
43
|
-
oldPng = png;
|
|
44
|
-
png = new PNG({ width, height });
|
|
45
|
-
oldPng.data.copy(png.data, 0, 0, oldPng.data.length);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const diff = new PNG({ width, height });
|
|
49
|
-
|
|
50
|
-
const numDiffPixels = pixelmatch(
|
|
51
|
-
basePng.data,
|
|
52
|
-
png.data,
|
|
53
|
-
diff.data,
|
|
54
|
-
width,
|
|
55
|
-
height,
|
|
56
|
-
options,
|
|
57
|
-
);
|
|
58
|
-
const diffPercentage = (numDiffPixels / (width * height)) * 100;
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
error,
|
|
62
|
-
diffImage: PNG.sync.write(diff),
|
|
63
|
-
diffPercentage,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
68
|
-
plugins: [
|
|
69
|
-
visualRegressionPlugin({
|
|
70
|
-
update: process.argv.includes('--update-visual-baseline'),
|
|
71
|
-
getImageDiff: options => {
|
|
72
|
-
const result = defaultGetImageDiff(options);
|
|
73
|
-
if (result.diffPercentage < thresholdPercentage) {
|
|
74
|
-
result.diffPercentage = 0;
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
},
|
|
78
|
-
}),
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
files: 'dist/**/*.spec.js',
|
|
82
|
-
|
|
83
|
-
coverageConfig: {
|
|
84
|
-
exclude: [
|
|
85
|
-
'**/node_modules/**',
|
|
86
|
-
'**/__wds-outside-root__/**', // Exclude external modules like oscd-ui
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
groups: [
|
|
91
|
-
{
|
|
92
|
-
name: 'visual',
|
|
93
|
-
files: 'dist/**/*.test.js',
|
|
94
|
-
testRunnerHtml: testFramework => `
|
|
95
|
-
<!DOCTYPE html>
|
|
96
|
-
<html>
|
|
97
|
-
<head>
|
|
98
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap" >
|
|
99
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" >
|
|
100
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" >
|
|
101
|
-
</head>
|
|
102
|
-
<body>
|
|
103
|
-
<style class="deanimator">
|
|
104
|
-
*, *::before, *::after {
|
|
105
|
-
-moz-transition: none !important;
|
|
106
|
-
transition: none !important;
|
|
107
|
-
-moz-animation: none !important;
|
|
108
|
-
animation: none !important;
|
|
109
|
-
}
|
|
110
|
-
</style>
|
|
111
|
-
<script>window.process = { env: ${JSON.stringify(process.env)} }</script>
|
|
112
|
-
<script type="module" src="${testFramework}"></script>
|
|
113
|
-
<script>
|
|
114
|
-
function descendants(parent) {
|
|
115
|
-
return (Array.from(parent.childNodes)).concat(
|
|
116
|
-
...Array.from(parent.children).map(child => descendants(child))
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
const deanimator = document.querySelector('.deanimator');
|
|
120
|
-
function deanimate(element) {
|
|
121
|
-
if (!element.shadowRoot) return;
|
|
122
|
-
if (element.shadowRoot.querySelector('.deanimator')) return;
|
|
123
|
-
const style = deanimator.cloneNode(true);
|
|
124
|
-
element.shadowRoot.appendChild(style);
|
|
125
|
-
descendants(element.shadowRoot).forEach(deanimate);
|
|
126
|
-
}
|
|
127
|
-
const observer = new MutationObserver((mutationList, observer) => {
|
|
128
|
-
for (const mutation of mutationList) {
|
|
129
|
-
if (mutation.type === 'childList') {
|
|
130
|
-
descendants(document.body).forEach(deanimate);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
observer.observe(document.body, {childList: true, subtree:true});
|
|
135
|
-
</script>
|
|
136
|
-
<style>
|
|
137
|
-
* {
|
|
138
|
-
margin: 0px;
|
|
139
|
-
padding: 0px;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
oscd-shell {
|
|
143
|
-
display: block;
|
|
144
|
-
height: 600px;
|
|
145
|
-
}
|
|
146
|
-
</style>
|
|
147
|
-
</body>
|
|
148
|
-
</html>`,
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
|
|
152
|
-
/** Resolve bare module imports */
|
|
153
|
-
nodeResolve: {
|
|
154
|
-
exportConditions: ['browser', 'development'],
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
/** Filter out lit dev mode logs */
|
|
158
|
-
filterBrowserLogs(log) {
|
|
159
|
-
for (const arg of log.args) {
|
|
160
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return true;
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
168
|
-
// esbuildTarget: 'auto',
|
|
169
|
-
|
|
170
|
-
/** Amount of browsers to run concurrently */
|
|
171
|
-
concurrentBrowsers: 3,
|
|
172
|
-
|
|
173
|
-
/** Amount of test files per browser to test concurrently */
|
|
174
|
-
concurrency: 1,
|
|
175
|
-
|
|
176
|
-
/** Browsers to run tests on */
|
|
177
|
-
browsers,
|
|
178
|
-
|
|
179
|
-
// See documentation for all available options
|
|
180
|
-
});
|