@omicronenergy/oscd-shell 0.0.9 → 0.0.11
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.js +0 -3
- package/dist/foundation/cyrb64.js.map +1 -1
- package/dist/foundation/events.d.ts +17 -0
- package/dist/foundation/events.js +2 -0
- package/dist/foundation/events.js.map +1 -0
- package/dist/foundation.js.map +1 -1
- package/dist/landing-page/landing-page.d.ts +26 -0
- package/dist/landing-page/landing-page.js +163 -0
- package/dist/landing-page/landing-page.js.map +1 -0
- package/dist/landing-page/landing-page.spec.d.ts +1 -0
- package/dist/landing-page/landing-page.spec.js +87 -0
- package/dist/landing-page/landing-page.spec.js.map +1 -0
- package/dist/locales/de.d.ts +0 -5
- package/dist/locales/de.js +0 -5
- package/dist/locales/de.js.map +1 -1
- package/dist/locales.js.map +1 -1
- package/dist/localization.d.ts +15 -0
- package/dist/localization.js +22 -0
- package/dist/localization.js.map +1 -0
- package/dist/menus/files-menu.d.ts +27 -0
- package/dist/menus/files-menu.js +102 -0
- package/dist/menus/files-menu.js.map +1 -0
- package/dist/menus/files-menu.spec.d.ts +1 -0
- package/dist/menus/files-menu.spec.js +33 -0
- package/dist/menus/files-menu.spec.js.map +1 -0
- package/dist/menus/plugins-menu.d.ts +32 -0
- package/dist/menus/plugins-menu.js +128 -0
- package/dist/menus/plugins-menu.js.map +1 -0
- package/dist/menus/plugins-menu.spec.d.ts +1 -0
- package/dist/menus/plugins-menu.spec.js +65 -0
- package/dist/menus/plugins-menu.spec.js.map +1 -0
- package/dist/oscd-shell.d.ts +70 -84
- package/dist/oscd-shell.js +422 -511
- package/dist/oscd-shell.js.map +1 -1
- package/dist/side-panel/editor-plugins-panel.d.ts +29 -0
- package/dist/side-panel/editor-plugins-panel.js +151 -0
- package/dist/side-panel/editor-plugins-panel.js.map +1 -0
- package/dist/side-panel/editor-plugins-panel.spec.d.ts +1 -0
- package/dist/side-panel/editor-plugins-panel.spec.js +87 -0
- package/dist/side-panel/editor-plugins-panel.spec.js.map +1 -0
- package/dist/utils/plugin-utils.d.ts +1 -1
- package/dist/utils/plugin-utils.js +8 -11
- package/dist/utils/plugin-utils.js.map +1 -1
- package/dist/utils/plugin-utils.spec.js.map +1 -1
- package/dist/utils/testing/plugin-helpers.d.ts +24 -0
- package/dist/utils/testing/plugin-helpers.js +74 -0
- package/dist/utils/testing/plugin-helpers.js.map +1 -0
- package/dist/utils/testing/test-doc-helpers.d.ts +7 -0
- package/dist/utils/testing/test-doc-helpers.js +28 -0
- package/dist/utils/testing/test-doc-helpers.js.map +1 -0
- package/dist/utils/testing/test-plugins.d.ts +44 -0
- package/dist/utils/testing/test-plugins.js +56 -0
- package/dist/utils/testing/test-plugins.js.map +1 -0
- package/package.json +62 -125
- package/dist/AddPlugins.js +0 -39
- package/dist/DemoPluginSrc.js +0 -7
- package/dist/embedded.html +0 -17
- package/dist/index.html +0 -112
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils.spec.js","sourceRoot":"","sources":["../../utils/plugin-utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9E,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,MAAM,GAAG;gBACb,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,WAAW;gBACjB,UAAU,EAAE,KAAK;aAClB,CAAC;YACF,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC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EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,sCAAsC;YAC5C,OAAO,EAAE,qBAAqB;YAC9B,UAAU,EAAE,eAAe;SAC5B,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;QAC1F,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,sCAAsC;YAC5C,OAAO,EAAE,qBAAqB;YAC9B,YAAY,EAAE,KAAK;SACpB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,KAAK,IAAI,EAAE;QACpF,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,sCAAsC;YAC5C,OAAO,EAAE,qBAAqB;YAC9B,YAAY,EAAE;gBACZ,EAAE,EAAE,sCAAsC;gBAC1C,EAAE,EAAE,GAAG,EAAE,qCAAqC;aAC/C;SACF,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { isPlugin, isSourcedPlugin, validatePlugin } from './plugin-utils.js';\n\ndescribe('Plugin Utils', () => {\n describe('isPlugin', () => {\n it('should return true for a valid Plugin object', () => {\n const plugin = {\n tagName: 'test-plugin',\n name: 'Test Plugin',\n icon: 'test-icon',\n requireDoc: false,\n };\n expect(plugin).satisfies(isPlugin);\n });\n\n it('should return false for an object without tagName', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n requireDoc: false,\n };\n expect(plugin).to.not.satisfy(isPlugin);\n });\n\n it('should return false for a SourcePlugin', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n src: 'data:text/javascript;charset=utf-8,import%20%7B%20default%20as%20TestPlugin%20%7D%20from%20\"./test-plugin.js\";',\n };\n expect(plugin).to.not.satisfy(isPlugin);\n });\n });\n\n describe('isSourcePlugin', () => {\n it('should return true for a valid SourcePlugin object', () => {\n const plugin = {\n name: 'Test Plugin',\n src: 'data:text/javascript;charset=utf-8,import%20%7B%20default%20as%20TestPlugin%20%7D%20from%20\"./test-plugin.js\";',\n icon: 'test-icon',\n };\n expect(plugin).satisfies(isSourcedPlugin);\n });\n\n it('should return false for an object without a src field', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n };\n expect(plugin).not.to.satisfy(isSourcedPlugin);\n });\n\n it('should return false for an Plugin object (has tagName, but no src)', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n tagName: 'test-plugin',\n };\n expect(plugin).not.to.satisfy(isSourcedPlugin);\n });\n });\n});\n\ndescribe('validatePlugin', () => {\n it('returns a Plugin object, for a valid plugin', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n icon: 'coronavirus',\n tagName: 'test-tagless-plugin',\n };\n\n expect(plugin).satisfies(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition missing its \"tagName\" field', async () => {\n const plugin = {\n icon: 'coronavirus',\n name: 'Tagless, Sourceless, Hopeless Plugin',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition missing its \"name\" field', async () => {\n const plugin = {\n icon: 'coronavirus',\n tagName: 'test-tagless-plugin',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition missing its \"icon\" field', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition with invalid requireDoc field', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n requireDoc: 'not-a-boolean',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition with invalid translations field', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n translations: 'ops',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition with invalid translations', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n translations: {\n en: 'Tagless, Sourceless, Hopeless Plugin',\n fr: 123, // Invalid translation (not a string)\n },\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"plugin-utils.spec.js","sourceRoot":"","sources":["../../src/utils/plugin-utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9E,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,MAAM,GAAG;gBACb,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,WAAW;gBACjB,UAAU,EAAE,KAAK;aAClB,CAAC;YACF,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE,aAAa;gBACnB,IAAI,EAA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E,sCAAsC;YAC5C,OAAO,EAAE,qBAAqB;YAC9B,UAAU,EAAE,eAAe;SAC5B,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;QAC1F,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,sCAAsC;YAC5C,OAAO,EAAE,qBAAqB;YAC9B,YAAY,EAAE,KAAK;SACpB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,KAAK,IAAI,EAAE;QACpF,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,sCAAsC;YAC5C,OAAO,EAAE,qBAAqB;YAC9B,YAAY,EAAE;gBACZ,EAAE,EAAE,sCAAsC;gBAC1C,EAAE,EAAE,GAAG,EAAE,qCAAqC;aAC/C;SACF,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { isPlugin, isSourcedPlugin, validatePlugin } from './plugin-utils.js';\n\ndescribe('Plugin Utils', () => {\n describe('isPlugin', () => {\n it('should return true for a valid Plugin object', () => {\n const plugin = {\n tagName: 'test-plugin',\n name: 'Test Plugin',\n icon: 'test-icon',\n requireDoc: false,\n };\n expect(plugin).satisfies(isPlugin);\n });\n\n it('should return false for an object without tagName', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n requireDoc: false,\n };\n expect(plugin).to.not.satisfy(isPlugin);\n });\n\n it('should return false for a SourcePlugin', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n src: 'data:text/javascript;charset=utf-8,import%20%7B%20default%20as%20TestPlugin%20%7D%20from%20\"./test-plugin.js\";',\n };\n expect(plugin).to.not.satisfy(isPlugin);\n });\n });\n\n describe('isSourcePlugin', () => {\n it('should return true for a valid SourcePlugin object', () => {\n const plugin = {\n name: 'Test Plugin',\n src: 'data:text/javascript;charset=utf-8,import%20%7B%20default%20as%20TestPlugin%20%7D%20from%20\"./test-plugin.js\";',\n icon: 'test-icon',\n };\n expect(plugin).satisfies(isSourcedPlugin);\n });\n\n it('should return false for an object without a src field', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n };\n expect(plugin).not.to.satisfy(isSourcedPlugin);\n });\n\n it('should return false for an Plugin object (has tagName, but no src)', () => {\n const plugin = {\n name: 'Test Plugin',\n icon: 'test-icon',\n tagName: 'test-plugin',\n };\n expect(plugin).not.to.satisfy(isSourcedPlugin);\n });\n });\n});\n\ndescribe('validatePlugin', () => {\n it('returns a Plugin object, for a valid plugin', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n icon: 'coronavirus',\n tagName: 'test-tagless-plugin',\n };\n\n expect(plugin).satisfies(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition missing its \"tagName\" field', async () => {\n const plugin = {\n icon: 'coronavirus',\n name: 'Tagless, Sourceless, Hopeless Plugin',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition missing its \"name\" field', async () => {\n const plugin = {\n icon: 'coronavirus',\n tagName: 'test-tagless-plugin',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition missing its \"icon\" field', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition with invalid requireDoc field', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n requireDoc: 'not-a-boolean',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition with invalid translations field', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n translations: 'ops',\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n\n it('returns undefined, for a plugin definition with invalid translations', async () => {\n const plugin = {\n name: 'Tagless, Sourceless, Hopeless Plugin',\n tagName: 'test-tagless-plugin',\n translations: {\n en: 'Tagless, Sourceless, Hopeless Plugin',\n fr: 123, // Invalid translation (not a string)\n },\n };\n\n expect(plugin).not.to.satisfy(validatePlugin);\n });\n});\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OscdShell, PluginEntry } from '../../oscd-shell.js';
|
|
2
|
+
export declare const sampleMenuPlugins: (Omit<PluginEntry, 'tagName'> & {
|
|
3
|
+
tagName?: string;
|
|
4
|
+
src?: string;
|
|
5
|
+
})[];
|
|
6
|
+
export declare const sampleEditorPlugins: (Omit<PluginEntry, 'tagName'> & {
|
|
7
|
+
tagName?: string;
|
|
8
|
+
src?: string;
|
|
9
|
+
})[];
|
|
10
|
+
export declare const isPluginInstanciated: (pluginTagName: string, shell: OscdShell) => boolean;
|
|
11
|
+
export declare const waitForPluginInstanciation: (plugin: PluginEntry, shell: OscdShell) => Promise<void>;
|
|
12
|
+
export declare const waitForPluginsToInstantiate: (plugins: PluginEntry[], shell: OscdShell) => Promise<void[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Convienience function to wait for all applicable plugins to instantiate.
|
|
15
|
+
* If a document is loaded, all plugins are waited for. If no document is loaded,
|
|
16
|
+
* only plugins that do not require a document are waited for.
|
|
17
|
+
* If no document is loaded, only menu and background plugins are considered, as
|
|
18
|
+
* the landing page does not have an editor.
|
|
19
|
+
*
|
|
20
|
+
* @param shell - The instance of the OscdShell to check for plugin instantiation.
|
|
21
|
+
* @returns Empty Promise that resolves when all applicable plugins have been instantiated.
|
|
22
|
+
*/
|
|
23
|
+
export declare const waitForAllPluginsToInstantiate: (shell: OscdShell) => Promise<void | void[]>;
|
|
24
|
+
export declare const registerPlugin: (shell: OscdShell, tagName: string, pluginClass: CustomElementConstructor) => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* eslint-disable import-x/no-extraneous-dependencies */
|
|
2
|
+
import { waitUntil } from '@open-wc/testing';
|
|
3
|
+
export const sampleMenuPlugins = [
|
|
4
|
+
{
|
|
5
|
+
name: 'Test Menu Plugin',
|
|
6
|
+
translations: { de: 'Test Menu Erweiterung' },
|
|
7
|
+
tagName: 'test-menu-plugin1',
|
|
8
|
+
icon: 'margin',
|
|
9
|
+
requireDoc: false,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'Test Menu Plugin 2',
|
|
13
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestStrMenuPlugin2%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run%28%29%20%7B%0D%0A%20%20%20%20return%20true%3B%0D%0A%20%20%7D%0D%0A%7D',
|
|
14
|
+
icon: 'margin',
|
|
15
|
+
requireDoc: false,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'Test Menu Plugin 3',
|
|
19
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestStrMenuPlugin3%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run%28%29%20%7B%0D%0A%20%20%20%20return%20true%3B%0D%0A%20%20%7D%0D%0A%7D',
|
|
20
|
+
icon: 'margin',
|
|
21
|
+
requireDoc: false,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
export const sampleEditorPlugins = [
|
|
25
|
+
{
|
|
26
|
+
name: 'Test Editor Plugin',
|
|
27
|
+
translations: { de: 'Test Editor Erweiterung' },
|
|
28
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',
|
|
29
|
+
icon: 'coronavirus',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Test Editor Plugin 2',
|
|
33
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',
|
|
34
|
+
icon: 'coronavirus',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
export const isPluginInstanciated = (pluginTagName, shell) => !!shell.registry?.get(pluginTagName) &&
|
|
38
|
+
!!shell.shadowRoot?.querySelector(pluginTagName);
|
|
39
|
+
export const waitForPluginInstanciation = async (plugin, shell) => waitUntil(() => isPluginInstanciated(plugin.tagName, shell), `Plugin: "${plugin.name}" <${plugin.tagName}> failed to load.
|
|
40
|
+
CustomElements Registered: ${shell.registry?.get(plugin.tagName) ? 'Yes' : 'No (at least not in the OscdShell registry)'},
|
|
41
|
+
Found in DOM: ${shell.shadowRoot?.querySelector(plugin.tagName) ? 'Yes' : 'No'},
|
|
42
|
+
requiresDoc?: ${plugin.requireDoc}
|
|
43
|
+
loadedDocName?: ${shell.docName}`);
|
|
44
|
+
export const waitForPluginsToInstantiate = async (plugins, shell) => await Promise.all(plugins.map(plugin => waitForPluginInstanciation(plugin, shell)));
|
|
45
|
+
/**
|
|
46
|
+
* Convienience function to wait for all applicable plugins to instantiate.
|
|
47
|
+
* If a document is loaded, all plugins are waited for. If no document is loaded,
|
|
48
|
+
* only plugins that do not require a document are waited for.
|
|
49
|
+
* If no document is loaded, only menu and background plugins are considered, as
|
|
50
|
+
* the landing page does not have an editor.
|
|
51
|
+
*
|
|
52
|
+
* @param shell - The instance of the OscdShell to check for plugin instantiation.
|
|
53
|
+
* @returns Empty Promise that resolves when all applicable plugins have been instantiated.
|
|
54
|
+
*/
|
|
55
|
+
export const waitForAllPluginsToInstantiate = async (shell) => {
|
|
56
|
+
const docLoaded = !!shell.docName;
|
|
57
|
+
const editorPlugin = shell.plugins.editor.find(editor => editor.tagName === shell.editor);
|
|
58
|
+
const menuPlugins = shell.plugins.menu.filter(plugin => !plugin.requireDoc || docLoaded);
|
|
59
|
+
const backgroundPlugins = shell.plugins.background.filter(plugin => !plugin.requireDoc || docLoaded);
|
|
60
|
+
const allPlugins = [
|
|
61
|
+
...menuPlugins,
|
|
62
|
+
...backgroundPlugins,
|
|
63
|
+
...(docLoaded && editorPlugin ? [editorPlugin] : []),
|
|
64
|
+
];
|
|
65
|
+
return allPlugins.length > 0
|
|
66
|
+
? waitForPluginsToInstantiate(allPlugins, shell)
|
|
67
|
+
: Promise.resolve();
|
|
68
|
+
};
|
|
69
|
+
export const registerPlugin = (shell, tagName, pluginClass) => {
|
|
70
|
+
if (!shell.registry?.get(tagName)) {
|
|
71
|
+
shell.registry?.define(tagName, pluginClass);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=plugin-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-helpers.js","sourceRoot":"","sources":["../../../src/utils/testing/plugin-helpers.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,CAAC,MAAM,iBAAiB,GAGvB;IACL;QACE,IAAI,EAAE,kBAAkB;QACxB,YAAY,EAAE,EAAE,EAAE,EAAE,uBAAuB,EAAE;QAC7C,OAAO,EAAE,mBAAmB;QAC5B,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,KAAK;KAClB;IACD;QACE,IAAI,EAAE,oBAAoB;Q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ACrC,EAAE;IACF,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC","sourcesContent":["/* eslint-disable import-x/no-extraneous-dependencies */\nimport { waitUntil } from '@open-wc/testing';\nimport { OscdShell, PluginEntry } from '../../oscd-shell.js';\n\nexport const sampleMenuPlugins: (Omit<PluginEntry, 'tagName'> & {\n tagName?: string;\n src?: string;\n})[] = [\n {\n name: 'Test Menu Plugin',\n translations: { de: 'Test Menu Erweiterung' },\n tagName: 'test-menu-plugin1',\n icon: 'margin',\n requireDoc: false,\n },\n {\n name: 'Test Menu Plugin 2',\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestStrMenuPlugin2%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run%28%29%20%7B%0D%0A%20%20%20%20return%20true%3B%0D%0A%20%20%7D%0D%0A%7D',\n icon: 'margin',\n requireDoc: false,\n },\n {\n name: 'Test Menu Plugin 3',\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestStrMenuPlugin3%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run%28%29%20%7B%0D%0A%20%20%20%20return%20true%3B%0D%0A%20%20%7D%0D%0A%7D',\n icon: 'margin',\n requireDoc: false,\n },\n];\n\nexport const sampleEditorPlugins: (Omit<PluginEntry, 'tagName'> & {\n tagName?: string;\n src?: string;\n})[] = [\n {\n name: 'Test Editor Plugin',\n translations: { de: 'Test Editor Erweiterung' },\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',\n icon: 'coronavirus',\n },\n {\n name: 'Test Editor Plugin 2',\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',\n icon: 'coronavirus',\n },\n];\n\nexport const isPluginInstanciated = (\n pluginTagName: string,\n shell: OscdShell,\n): boolean =>\n !!shell.registry?.get(pluginTagName) &&\n !!shell.shadowRoot?.querySelector(pluginTagName);\n\nexport const waitForPluginInstanciation = async (\n plugin: PluginEntry,\n shell: OscdShell,\n): Promise<void> =>\n waitUntil(\n () => isPluginInstanciated(plugin.tagName, shell),\n `Plugin: \"${plugin.name}\" <${plugin.tagName}> failed to load. \n CustomElements Registered: ${shell.registry?.get(plugin.tagName) ? 'Yes' : 'No (at least not in the OscdShell registry)'}, \n Found in DOM: ${shell.shadowRoot?.querySelector(plugin.tagName) ? 'Yes' : 'No'}, \n requiresDoc?: ${plugin.requireDoc}\n loadedDocName?: ${shell.docName}`,\n );\n\nexport const waitForPluginsToInstantiate = async (\n plugins: PluginEntry[],\n shell: OscdShell,\n) =>\n await Promise.all(\n plugins.map(plugin => waitForPluginInstanciation(plugin, shell)),\n );\n\n/**\n * Convienience function to wait for all applicable plugins to instantiate.\n * If a document is loaded, all plugins are waited for. If no document is loaded,\n * only plugins that do not require a document are waited for.\n * If no document is loaded, only menu and background plugins are considered, as\n * the landing page does not have an editor.\n *\n * @param shell - The instance of the OscdShell to check for plugin instantiation.\n * @returns Empty Promise that resolves when all applicable plugins have been instantiated.\n */\nexport const waitForAllPluginsToInstantiate = async (shell: OscdShell) => {\n const docLoaded = !!shell.docName;\n\n const editorPlugin = shell.plugins.editor.find(\n editor => editor.tagName === shell.editor,\n );\n\n const menuPlugins = shell.plugins.menu.filter(\n plugin => !plugin.requireDoc || docLoaded,\n );\n const backgroundPlugins = shell.plugins.background.filter(\n plugin => !plugin.requireDoc || docLoaded,\n );\n\n const allPlugins: PluginEntry[] = [\n ...menuPlugins,\n ...backgroundPlugins,\n ...(docLoaded && editorPlugin ? [editorPlugin] : []),\n ];\n\n return allPlugins.length > 0\n ? waitForPluginsToInstantiate(allPlugins, shell)\n : Promise.resolve();\n};\n\nexport const registerPlugin = (\n shell: OscdShell,\n tagName: string,\n pluginClass: CustomElementConstructor,\n) => {\n if (!shell.registry?.get(tagName)) {\n shell.registry?.define(tagName, pluginClass);\n }\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OscdShell } from '../../oscd-shell.js';
|
|
2
|
+
export declare const nonSclDocString = "<testdoc></testdoc>";
|
|
3
|
+
export declare const sclDocString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <SCL version=\"2007\" revision=\"B\" xmlns=\"http://www.iec.ch/61850/2003/SCL\" xmlns:ens1=\"http://example.org/somePreexistingExtensionNamespace\">\n <Substation ens1:foo=\"a\" name=\"A1\" desc=\"test substation\"></Substation>\n</SCL>";
|
|
4
|
+
export declare const createNonSclDocument: () => Document;
|
|
5
|
+
export declare const createSclDocument: () => Document;
|
|
6
|
+
export declare const openDocOnShell: (shell: OscdShell, docName: string, doc: XMLDocument) => Promise<void>;
|
|
7
|
+
export declare function createTestDocs(amount: number): any;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const nonSclDocString = `<testdoc></testdoc>`;
|
|
2
|
+
export const sclDocString = `<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
+
<SCL version="2007" revision="B" xmlns="http://www.iec.ch/61850/2003/SCL" xmlns:ens1="http://example.org/somePreexistingExtensionNamespace">
|
|
4
|
+
<Substation ens1:foo="a" name="A1" desc="test substation"></Substation>
|
|
5
|
+
</SCL>`;
|
|
6
|
+
export const createNonSclDocument = () => {
|
|
7
|
+
const parser = new DOMParser();
|
|
8
|
+
return parser.parseFromString(nonSclDocString, 'application/xml');
|
|
9
|
+
};
|
|
10
|
+
export const createSclDocument = () => {
|
|
11
|
+
const parser = new DOMParser();
|
|
12
|
+
return parser.parseFromString(sclDocString, 'application/xml');
|
|
13
|
+
};
|
|
14
|
+
export const openDocOnShell = async (shell, docName, doc) => {
|
|
15
|
+
shell.docs = { ...shell.docs, [docName]: doc };
|
|
16
|
+
shell.docName = docName;
|
|
17
|
+
await shell.updateComplete;
|
|
18
|
+
};
|
|
19
|
+
export function createTestDocs(amount) {
|
|
20
|
+
return Array(amount)
|
|
21
|
+
.fill(0)
|
|
22
|
+
.reduce((acc, _, index) => {
|
|
23
|
+
const docName = `test${index}.cid`;
|
|
24
|
+
acc[docName] = createSclDocument();
|
|
25
|
+
return acc;
|
|
26
|
+
}, {});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=test-doc-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-doc-helpers.js","sourceRoot":"","sources":["../../../src/utils/testing/test-doc-helpers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG;;;OAGrB,CAAC;AAER,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAC/B,OAAO,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAC/B,OAAO,MAAM,CAAC,eAAe,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,KAAgB,EAChB,OAAe,EACf,GAAgB,EACD,EAAE;IACjB,KAAK,CAAC,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAC/C,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,MAAM,KAAK,CAAC,cAAc,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,KAAK,CAAC,MAAM,CAAC;SACjB,IAAI,CAAC,CAAC,CAAC;SACP,MAAM,CACL,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;QAChB,MAAM,OAAO,GAAG,OAAO,KAAK,MAAM,CAAC;QACnC,GAAG,CAAC,OAAO,CAAC,GAAG,iBAAiB,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAiC,CAClC,CAAC;AACN,CAAC","sourcesContent":["import { OscdShell } from '../../oscd-shell.js';\n\nexport const nonSclDocString = `<testdoc></testdoc>`;\n\nexport const sclDocString = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <SCL version=\"2007\" revision=\"B\" xmlns=\"http://www.iec.ch/61850/2003/SCL\" xmlns:ens1=\"http://example.org/somePreexistingExtensionNamespace\">\n <Substation ens1:foo=\"a\" name=\"A1\" desc=\"test substation\"></Substation>\n</SCL>`;\n\nexport const createNonSclDocument = () => {\n const parser = new DOMParser();\n return parser.parseFromString(nonSclDocString, 'application/xml');\n};\n\nexport const createSclDocument = () => {\n const parser = new DOMParser();\n return parser.parseFromString(sclDocString, 'application/xml');\n};\n\nexport const openDocOnShell = async (\n shell: OscdShell,\n docName: string,\n doc: XMLDocument,\n): Promise<void> => {\n shell.docs = { ...shell.docs, [docName]: doc };\n shell.docName = docName;\n await shell.updateComplete;\n};\n\nexport function createTestDocs(amount: number) {\n return Array(amount)\n .fill(0)\n .reduce(\n (acc, _, index) => {\n const docName = `test${index}.cid`;\n acc[docName] = createSclDocument();\n return acc;\n },\n {} as Record<string, XMLDocument>,\n );\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class TestMenuPlugin1 extends LitElement {
|
|
3
|
+
docVersion: number;
|
|
4
|
+
run(): Promise<boolean>;
|
|
5
|
+
}
|
|
6
|
+
export declare class TestBackgroundPlugin extends HTMLElement {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare const testMenuPlugin1: {
|
|
10
|
+
name: string;
|
|
11
|
+
translations: {
|
|
12
|
+
de: string;
|
|
13
|
+
};
|
|
14
|
+
tagName: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
requireDoc: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const testMenuPlugin2: {
|
|
19
|
+
name: string;
|
|
20
|
+
translations: {
|
|
21
|
+
de: string;
|
|
22
|
+
};
|
|
23
|
+
src: string;
|
|
24
|
+
icon: string;
|
|
25
|
+
requireDoc: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare const testEditorPlugin: {
|
|
28
|
+
name: string;
|
|
29
|
+
translations: {
|
|
30
|
+
de: string;
|
|
31
|
+
};
|
|
32
|
+
src: string;
|
|
33
|
+
icon: string;
|
|
34
|
+
requireDoc: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare const testEditorPlugin2: {
|
|
37
|
+
name: string;
|
|
38
|
+
translations: {
|
|
39
|
+
de: string;
|
|
40
|
+
};
|
|
41
|
+
src: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
requireDoc: boolean;
|
|
44
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
export class TestMenuPlugin1 extends LitElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.docVersion = 0;
|
|
8
|
+
}
|
|
9
|
+
async run() {
|
|
10
|
+
const editor = this.getRootNode().host;
|
|
11
|
+
editor.undo();
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
__decorate([
|
|
16
|
+
property({})
|
|
17
|
+
], TestMenuPlugin1.prototype, "docVersion", void 0);
|
|
18
|
+
export class TestBackgroundPlugin extends HTMLElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
document.addEventListener('test-tx', event => {
|
|
22
|
+
document.dispatchEvent(new CustomEvent('test-rx', {
|
|
23
|
+
detail: event.detail,
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const testMenuPlugin1 = {
|
|
29
|
+
name: 'Test Undo Menu Plugin 1',
|
|
30
|
+
translations: { de: 'Test Rückgängig-Menü-Plugin' },
|
|
31
|
+
tagName: 'test-menu-plugin1',
|
|
32
|
+
icon: 'undo',
|
|
33
|
+
requireDoc: false,
|
|
34
|
+
};
|
|
35
|
+
export const testMenuPlugin2 = {
|
|
36
|
+
name: 'Test Undo Menu Plugin 2',
|
|
37
|
+
translations: { de: 'Test Rückgängig-Menü-Plugin 2' },
|
|
38
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run()%20%7B%0D%0A%20%20const%20editor2%20=%20(this.getRootNode()).host;%20%0D%0A%20editor2.undo();%0D%0A%20return%20true;%0D%0A%20%20%7D%0D%0A%7D',
|
|
39
|
+
icon: 'undo',
|
|
40
|
+
requireDoc: true,
|
|
41
|
+
};
|
|
42
|
+
export const testEditorPlugin = {
|
|
43
|
+
name: 'Test Editor Plugin',
|
|
44
|
+
translations: { de: 'Test Editor Erweiterung' },
|
|
45
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',
|
|
46
|
+
icon: 'edit',
|
|
47
|
+
requireDoc: false,
|
|
48
|
+
};
|
|
49
|
+
export const testEditorPlugin2 = {
|
|
50
|
+
name: 'Test Editor Plugin 2',
|
|
51
|
+
translations: { de: 'Test Editor Erweiterung 2' },
|
|
52
|
+
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin2%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin2%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',
|
|
53
|
+
icon: 'edit',
|
|
54
|
+
requireDoc: true,
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=test-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-plugins.js","sourceRoot":"","sources":["../../../src/utils/testing/test-plugins.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QAEE,eAAU,GAAG,CAAC,CAAC;IAOjB,CAAC;IALC,KAAK,CAAC,GAAG;QACP,MAAM,MAAM,GAAI,IAAI,CAAC,WAAW,EAAiB,CAAC,IAAiB,CAAC;QACpE,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAPC;IADC,QAAQ,CAAC,EAAE,CAAC;mDACE;AASjB,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD;QACE,KAAK,EAAE,CAAC;QACR,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YAC3C,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,SAAS,EAAE;gBACzB,MAAM,EAAG,KAAqB,CAAC,MAAM;aACtC,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,yBAAyB;IAC/B,YAAY,EAAE,EAAE,EAAE,EAAE,6BAA6B,EAAE;IACnD,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,yBAAyB;IAC/B,YAAY,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE;IACrD,GAAG,EAAE,6QAA6Q;IAClR,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,oBAAoB;IAC1B,YAAY,EAAE,EAAE,EAAE,EAAE,yBAAyB,EAAE;IAC/C,GAAG,EAAE,8PAA8P;IACnQ,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,KAAK;CAClB,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,sBAAsB;IAC5B,YAAY,EAAE,EAAE,EAAE,EAAE,2BAA2B,EAAE;IACjD,GAAG,EAAE,gQAAgQ;IACrQ,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,IAAI;CACjB,CAAC","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { OscdShell } from '../../oscd-shell.js';\n\nexport class TestMenuPlugin1 extends LitElement {\n @property({})\n docVersion = 0;\n\n async run() {\n const editor = (this.getRootNode() as ShadowRoot).host as OscdShell;\n editor.undo();\n return true;\n }\n}\n\nexport class TestBackgroundPlugin extends HTMLElement {\n constructor() {\n super();\n document.addEventListener('test-tx', event => {\n document.dispatchEvent(\n new CustomEvent('test-rx', {\n detail: (event as CustomEvent).detail,\n }),\n );\n });\n }\n}\n\nexport const testMenuPlugin1 = {\n name: 'Test Undo Menu Plugin 1',\n translations: { de: 'Test Rückgängig-Menü-Plugin' },\n tagName: 'test-menu-plugin1',\n icon: 'undo',\n requireDoc: false,\n};\n\nexport const testMenuPlugin2 = {\n name: 'Test Undo Menu Plugin 2',\n translations: { de: 'Test Rückgängig-Menü-Plugin 2' },\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run()%20%7B%0D%0A%20%20const%20editor2%20=%20(this.getRootNode()).host;%20%0D%0A%20editor2.undo();%0D%0A%20return%20true;%0D%0A%20%20%7D%0D%0A%7D',\n icon: 'undo',\n requireDoc: true,\n};\n\nexport const testEditorPlugin = {\n name: 'Test Editor Plugin',\n translations: { de: 'Test Editor Erweiterung' },\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',\n icon: 'edit',\n requireDoc: false,\n};\nexport const testEditorPlugin2 = {\n name: 'Test Editor Plugin 2',\n translations: { de: 'Test Editor Erweiterung 2' },\n src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin2%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin2%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',\n icon: 'edit',\n requireDoc: true,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omicronenergy/oscd-shell",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "The shell component of OpenSCD, where plugins are loaded and the application is initialized.",
|
|
5
|
-
"displayName": "OpenSCD Shell",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "git+https://github.com/OMICRONEnergyOSS/oscd-shell.git"
|
|
@@ -33,158 +32,93 @@
|
|
|
33
32
|
"!/dist/*.test.*"
|
|
34
33
|
],
|
|
35
34
|
"scripts": {
|
|
36
|
-
"lint": "eslint
|
|
37
|
-
"format": "eslint
|
|
38
|
-
"build": "rimraf dist/* && cp -r ./demo ./dist/ && npm run extract && npm run localize && tsc -b",
|
|
39
|
-
"bundle": "rimraf dist && npm run localize && rollup -c rollup.config.js",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"format": "eslint . --fix",
|
|
40
37
|
"extract": "lit-localize extract",
|
|
41
38
|
"localize": "lit-localize build",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"test
|
|
47
|
-
"test:
|
|
48
|
-
"
|
|
39
|
+
"build": "rimraf dist && mkdir dist && npm run extract && npm run localize && npm run analyze -- --exclude dist && tsc ",
|
|
40
|
+
"bundle": "rimraf dist && npm run extract && npm run localize && rollup -c rollup.config.js",
|
|
41
|
+
"start": "npm run build && concurrently -k \"tsc --watch --preserveWatchOutput\" \"wds --open '/demo/' --node-resolve\"",
|
|
42
|
+
"start:bundle": "npm run bundle && concurrently -k -r \"rollup -c rollup.config.js --watch\" \"wds --root-dir dist --app-index demo/index.html --open '/demo/' --watch\"",
|
|
43
|
+
"test": "npm run build && wtr --coverage --group unit",
|
|
44
|
+
"test:watch": "npm run build && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --coverage --watch --group unit\"",
|
|
45
|
+
"analyze": "cem analyze --litelement --exclude demo/* --exclude dist/* --exclude *.spec.ts --exclude *.test.ts --exclude coverage/*",
|
|
46
|
+
"doc": "npm run analyze -- --exclude dist && typedoc --out dist/doc src/oscd-shell.ts src/foundation.ts",
|
|
47
|
+
"test:visual": "npm run build && wtr --group visual",
|
|
49
48
|
"test:update": "npm run build && wtr --group visual --update-visual-baseline",
|
|
50
|
-
"
|
|
51
|
-
"doc": "npm run analyze -- --exclude dist && typedoc --out dist/doc oscd-shell.ts foundation.ts",
|
|
52
|
-
"deploy": "npm run bundle && npm run doc && gh-pages --dist 'dist'",
|
|
49
|
+
"deploy": "npm run bundle && npm run doc && gh-pages --dist 'dist' --nojekyll",
|
|
53
50
|
"prepare": "husky"
|
|
54
51
|
},
|
|
55
52
|
"dependencies": {
|
|
56
53
|
"@lit/localize": "^0.12.2",
|
|
57
|
-
"@omicronenergy/oscd-api": "^0.1.3",
|
|
58
54
|
"@omicronenergy/oscd-background-editv1": "^0.0.6",
|
|
59
|
-
"@omicronenergy/oscd-editor": "^1.
|
|
55
|
+
"@omicronenergy/oscd-editor": "^1.7.1",
|
|
56
|
+
"@omicronenergy/oscd-editor-source": "^0.0.1",
|
|
57
|
+
"@omicronenergy/oscd-menu-commons": "^0.0.1",
|
|
60
58
|
"@omicronenergy/oscd-menu-open": "^0.0.6",
|
|
61
|
-
"@omicronenergy/oscd-menu-save": "^0.0.
|
|
59
|
+
"@omicronenergy/oscd-menu-save": "^0.0.2",
|
|
62
60
|
"@omicronenergy/oscd-test-utils": "^0.0.8",
|
|
63
|
-
"@omicronenergy/oscd-ui": "^0.0.
|
|
64
|
-
"@open-wc/scoped-elements": "^3.0.
|
|
61
|
+
"@omicronenergy/oscd-ui": "^0.0.9",
|
|
62
|
+
"@open-wc/scoped-elements": "^3.0.6",
|
|
63
|
+
"@openscd/oscd-api": "^0.1.6",
|
|
65
64
|
"@webcomponents/scoped-custom-element-registry": "^0.0.10",
|
|
66
|
-
"lit": "^3.3.
|
|
67
|
-
"tslib": "^2.
|
|
65
|
+
"lit": "^3.3.1",
|
|
66
|
+
"tslib": "^2.8.1"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
70
69
|
"@commitlint/cli": "^19.8.1",
|
|
71
70
|
"@commitlint/config-conventional": "^19.8.1",
|
|
72
|
-
"@custom-elements-manifest/analyzer": "^0.10.
|
|
71
|
+
"@custom-elements-manifest/analyzer": "^0.10.5",
|
|
72
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
73
|
+
"@eslint/js": "^9.34.0",
|
|
73
74
|
"@lit/localize-tools": "^0.8.0",
|
|
74
|
-
"@open-wc/
|
|
75
|
-
"@open-wc/eslint-config": "^
|
|
75
|
+
"@open-wc/dev-server-hmr": "^0.2.0",
|
|
76
|
+
"@open-wc/eslint-config": "^13.0.0",
|
|
76
77
|
"@open-wc/testing": "^4.0.0",
|
|
77
|
-
"@rollup/plugin-
|
|
78
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
79
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
78
80
|
"@types/mocha": "^10.0.10",
|
|
79
|
-
"@
|
|
80
|
-
"@typescript-eslint/
|
|
81
|
-
"@
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
82
|
+
"@typescript-eslint/parser": "^8.41.0",
|
|
83
|
+
"@ungap/structured-clone": "^1.3.0",
|
|
82
84
|
"@web/dev-server": "^0.4.6",
|
|
83
|
-
"@web/
|
|
84
|
-
"@web/
|
|
85
|
-
"@web/
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
85
|
+
"@web/dev-server-polyfill": "^1.0.6",
|
|
86
|
+
"@web/rollup-plugin-html": "^2.3.0",
|
|
87
|
+
"@web/rollup-plugin-import-meta-assets": "^2.3.0",
|
|
88
|
+
"@web/test-runner": "0.20.2",
|
|
89
|
+
"@web/test-runner-commands": "^0.9.0",
|
|
90
|
+
"@web/test-runner-playwright": "0.11.1",
|
|
91
|
+
"@web/test-runner-visual-regression": "0.9.0",
|
|
92
|
+
"concurrently": "^9.2.1",
|
|
93
|
+
"eslint": "^9.34.0",
|
|
94
|
+
"eslint-config-prettier": "^10.1.8",
|
|
95
|
+
"eslint-plugin-html": "^8.1.3",
|
|
96
|
+
"eslint-plugin-lit": "^2.1.1",
|
|
97
|
+
"eslint-plugin-lit-a11y": "^5.1.1",
|
|
98
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
99
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
91
100
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
92
|
-
"
|
|
101
|
+
"eslint-plugin-wc": "^3.0.1",
|
|
93
102
|
"gh-pages": "^6.3.0",
|
|
94
103
|
"husky": "^9.1.7",
|
|
95
|
-
"lint-staged": "^16.1.
|
|
96
|
-
"
|
|
97
|
-
"
|
|
104
|
+
"lint-staged": "^16.1.5",
|
|
105
|
+
"pixelmatch": "^7.1.0",
|
|
106
|
+
"pngjs": "^7.0.0",
|
|
107
|
+
"prettier": "^3.6.2",
|
|
108
|
+
"rimraf": "^6.0.1",
|
|
109
|
+
"rollup": "^4.49.0",
|
|
98
110
|
"rollup-plugin-copy": "^3.5.0",
|
|
99
111
|
"sinon": "^21.0.0",
|
|
100
112
|
"tsdoc": "^0.0.4",
|
|
101
|
-
"typedoc": "^0.28.
|
|
102
|
-
"typescript": "5.
|
|
113
|
+
"typedoc": "^0.28.11",
|
|
114
|
+
"typescript": "^5.9.2"
|
|
103
115
|
},
|
|
104
116
|
"overrides": {
|
|
105
|
-
"playwright": {
|
|
106
|
-
"
|
|
107
|
-
"@web/test-runner-playwright": "0.11.0"
|
|
117
|
+
"@web/test-runner-playwright": {
|
|
118
|
+
"playwright": "1.54.1"
|
|
108
119
|
}
|
|
109
120
|
},
|
|
110
121
|
"customElements": "custom-elements.json",
|
|
111
|
-
"eslintConfig": {
|
|
112
|
-
"parser": "@typescript-eslint/parser",
|
|
113
|
-
"parserOptions": {
|
|
114
|
-
"lib": [
|
|
115
|
-
"es2018",
|
|
116
|
-
"dom"
|
|
117
|
-
]
|
|
118
|
-
},
|
|
119
|
-
"extends": [
|
|
120
|
-
"@open-wc",
|
|
121
|
-
"prettier"
|
|
122
|
-
],
|
|
123
|
-
"plugins": [
|
|
124
|
-
"@typescript-eslint",
|
|
125
|
-
"eslint-plugin-tsdoc",
|
|
126
|
-
"prettier"
|
|
127
|
-
],
|
|
128
|
-
"rules": {
|
|
129
|
-
"no-unused-vars": "off",
|
|
130
|
-
"class-methods-use-this": [
|
|
131
|
-
"error",
|
|
132
|
-
{
|
|
133
|
-
"exceptMethods": [
|
|
134
|
-
"locale"
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
"@typescript-eslint/no-explicit-any": [
|
|
139
|
-
"error",
|
|
140
|
-
{
|
|
141
|
-
"ignoreRestArgs": true
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
"import/no-extraneous-dependencies": [
|
|
145
|
-
"error",
|
|
146
|
-
{
|
|
147
|
-
"devDependencies": [
|
|
148
|
-
"**/*.test.ts",
|
|
149
|
-
"**/*.spec.ts",
|
|
150
|
-
"./dist"
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
],
|
|
154
|
-
"curly": [
|
|
155
|
-
"error",
|
|
156
|
-
"all"
|
|
157
|
-
],
|
|
158
|
-
"@typescript-eslint/no-unused-vars": [
|
|
159
|
-
"error",
|
|
160
|
-
{
|
|
161
|
-
"argsIgnorePattern": "^_",
|
|
162
|
-
"varsIgnorePattern": "^_",
|
|
163
|
-
"destructuredArrayIgnorePattern": "^_"
|
|
164
|
-
}
|
|
165
|
-
],
|
|
166
|
-
"import/no-unresolved": "off",
|
|
167
|
-
"import/extensions": [
|
|
168
|
-
"error",
|
|
169
|
-
"always",
|
|
170
|
-
{
|
|
171
|
-
"ignorePackages": true
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"prettier/prettier": "error"
|
|
175
|
-
},
|
|
176
|
-
"overrides": [
|
|
177
|
-
{
|
|
178
|
-
"files": [
|
|
179
|
-
"**/*.spec.ts",
|
|
180
|
-
"**/*.test.ts"
|
|
181
|
-
],
|
|
182
|
-
"rules": {
|
|
183
|
-
"no-unused-expressions": "off"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
},
|
|
188
122
|
"prettier": {
|
|
189
123
|
"singleQuote": true,
|
|
190
124
|
"arrowParens": "avoid"
|
|
@@ -195,6 +129,9 @@
|
|
|
195
129
|
}
|
|
196
130
|
},
|
|
197
131
|
"lint-staged": {
|
|
198
|
-
"*.ts":
|
|
132
|
+
"*.ts": [
|
|
133
|
+
"eslint --fix",
|
|
134
|
+
"eslint"
|
|
135
|
+
]
|
|
199
136
|
}
|
|
200
137
|
}
|
package/dist/AddPlugins.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-alert */
|
|
2
|
-
export default class AddPlugins extends HTMLElement {
|
|
3
|
-
/* eslint-disable-next-line class-methods-use-this */
|
|
4
|
-
run() {
|
|
5
|
-
const editor = this.getRootNode().host;
|
|
6
|
-
const kind = window.confirm(
|
|
7
|
-
`Add a menu type plugin?
|
|
8
|
-
If you choose 'Cancel', an editor type plugin will be added instead.`,
|
|
9
|
-
)
|
|
10
|
-
? 'menu'
|
|
11
|
-
: 'editor';
|
|
12
|
-
const requireDoc = window.confirm(
|
|
13
|
-
'Does the plugin require a loaded document? (OK=yes, Cancel=no)',
|
|
14
|
-
);
|
|
15
|
-
const name =
|
|
16
|
-
window.prompt('Plugin name', 'My plugin') || 'Default plugin name';
|
|
17
|
-
const icon =
|
|
18
|
-
window.prompt('Plugin icon (material icon name)', 'extension') ||
|
|
19
|
-
'extension';
|
|
20
|
-
const src =
|
|
21
|
-
window.prompt(
|
|
22
|
-
'Plugin source URI',
|
|
23
|
-
`/demo/DemoPluginSrc.js?${Date.now()}`,
|
|
24
|
-
) || 'data:text/javascript,';
|
|
25
|
-
const plugin = { name, src, icon, requireDoc };
|
|
26
|
-
if (
|
|
27
|
-
!window.confirm(
|
|
28
|
-
`Add ${kind} plugin ${JSON.stringify(plugin, null, ' ')}?`,
|
|
29
|
-
)
|
|
30
|
-
) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
editor.plugins = {
|
|
34
|
-
...editor.plugins,
|
|
35
|
-
[kind]: [...(editor.plugins[kind] || []), plugin],
|
|
36
|
-
};
|
|
37
|
-
editor.requestUpdate('plugins');
|
|
38
|
-
}
|
|
39
|
-
}
|
package/dist/DemoPluginSrc.js
DELETED
package/dist/embedded.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<title>OpenSCD Core Embedding Demo</title>
|
|
3
|
-
<iframe src="./index.html?locale=de&dark"></iframe>
|
|
4
|
-
<style>
|
|
5
|
-
iframe {
|
|
6
|
-
width:50vw;
|
|
7
|
-
height: 50vh;
|
|
8
|
-
position: relative;
|
|
9
|
-
top: 25vh;
|
|
10
|
-
left: 25vw;
|
|
11
|
-
border: none;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
body {
|
|
15
|
-
background-color: darkseagreen;
|
|
16
|
-
}
|
|
17
|
-
</style>
|