@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
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
* @returns digest - a rather insecure hash, very quickly
|
|
5
5
|
*/
|
|
6
6
|
export function cyrb64(str) {
|
|
7
|
-
/* eslint-disable no-bitwise */
|
|
8
7
|
let h1 = 0xdeadbeef;
|
|
9
8
|
let h2 = 0x41c6ce57;
|
|
10
|
-
/* eslint-disable-next-line no-plusplus */
|
|
11
9
|
for (let i = 0, ch; i < str.length; i++) {
|
|
12
10
|
ch = str.charCodeAt(i);
|
|
13
11
|
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
@@ -21,6 +19,5 @@ export function cyrb64(str) {
|
|
|
21
19
|
Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
22
20
|
return ((h2 >>> 0).toString(16).padStart(8, '0') +
|
|
23
21
|
(h1 >>> 0).toString(16).padStart(8, '0'));
|
|
24
|
-
/* eslint-enable no-bitwise */
|
|
25
22
|
}
|
|
26
23
|
//# sourceMappingURL=cyrb64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cyrb64.js","sourceRoot":"","sources":["../../foundation/cyrb64.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC
|
|
1
|
+
{"version":3,"file":"cyrb64.js","sourceRoot":"","sources":["../../src/foundation/cyrb64.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,IAAI,EAAE,GAAG,UAAU,CAAC;IACpB,IAAI,EAAE,GAAG,UAAU,CAAC;IAEpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,EAAE,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACvB,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QACpC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC;IACD,EAAE;QACA,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1C,EAAE;QACA,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1C,OAAO,CACL,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;QACxC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACzC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Hashes `str` using the cyrb64 variant of\n * https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js\n * @returns digest - a rather insecure hash, very quickly\n */\nexport function cyrb64(str: string): string {\n let h1 = 0xdeadbeef;\n let h2 = 0x41c6ce57;\n\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 =\n Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^\n Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 =\n Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^\n Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n return (\n (h2 >>> 0).toString(16).padStart(8, '0') +\n (h1 >>> 0).toString(16).padStart(8, '0')\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CloseDetail = {
|
|
2
|
+
docName: string;
|
|
3
|
+
};
|
|
4
|
+
/** Represents the intent to close the document with filename `docName`. */
|
|
5
|
+
export type CloseEvent = CustomEvent<CloseDetail>;
|
|
6
|
+
export type RenameDetail = {
|
|
7
|
+
oldName: string;
|
|
8
|
+
newName: string;
|
|
9
|
+
};
|
|
10
|
+
/** Represents the intent to rename the document with filename `docName`. */
|
|
11
|
+
export type RenameEvent = CustomEvent<RenameDetail>;
|
|
12
|
+
declare global {
|
|
13
|
+
interface ElementEventMap {
|
|
14
|
+
['oscd-close']: CloseEvent;
|
|
15
|
+
['oscd-rename']: RenameEvent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/foundation/events.ts"],"names":[],"mappings":"","sourcesContent":["export type CloseDetail = {\n docName: string;\n};\n/** Represents the intent to close the document with filename `docName`. */\nexport type CloseEvent = CustomEvent<CloseDetail>;\n\nexport type RenameDetail = {\n oldName: string;\n newName: string;\n};\n/** Represents the intent to rename the document with filename `docName`. */\nexport type RenameEvent = CustomEvent<RenameDetail>;\n\ndeclare global {\n interface ElementEventMap {\n ['oscd-close']: CloseEvent;\n ['oscd-rename']: RenameEvent;\n }\n}\n"]}
|
package/dist/foundation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foundation.js","sourceRoot":"","sources":["../foundation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { cyrb64 } from './foundation/cyrb64.js';\n"]}
|
|
1
|
+
{"version":3,"file":"foundation.js","sourceRoot":"","sources":["../src/foundation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { cyrb64 } from './foundation/cyrb64.js';\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
|
|
3
|
+
import { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';
|
|
4
|
+
import { PluginEntry } from '../oscd-shell.js';
|
|
5
|
+
import { LocaleTag } from '../localization.js';
|
|
6
|
+
import { OscdElevation } from '@omicronenergy/oscd-ui/elevation/OscdElevation.js';
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'landing-page': LandingPage;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare const LandingPage_base: typeof LitElement & import("@open-wc/scoped-elements/lit-element.js").ScopedElementsHostConstructor;
|
|
13
|
+
export declare class LandingPage extends LandingPage_base {
|
|
14
|
+
static scopedElements: {
|
|
15
|
+
'oscd-icon': typeof OscdIcon;
|
|
16
|
+
'oscd-text-button': typeof OscdTextButton;
|
|
17
|
+
'oscd-elevation': typeof OscdElevation;
|
|
18
|
+
};
|
|
19
|
+
heading: string;
|
|
20
|
+
subHeading: string;
|
|
21
|
+
menuPlugins: PluginEntry[];
|
|
22
|
+
locale: LocaleTag;
|
|
23
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
24
|
+
static styles: import("lit").CSSResult;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
|
|
5
|
+
import { localized } from '@lit/localize';
|
|
6
|
+
import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
|
|
7
|
+
import { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';
|
|
8
|
+
import { OscdElevation } from '@omicronenergy/oscd-ui/elevation/OscdElevation.js';
|
|
9
|
+
let LandingPage = class LandingPage extends ScopedElementsMixin(LitElement) {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
/* Properties */
|
|
13
|
+
this.heading = '';
|
|
14
|
+
this.subHeading = '';
|
|
15
|
+
this.menuPlugins = [];
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return html `
|
|
19
|
+
<h1 class="heading">${this.heading}</h1>
|
|
20
|
+
<h2 class="sub-heading">${this.subHeading}</h2>
|
|
21
|
+
<div class="menu-plugins-grid">
|
|
22
|
+
${this.menuPlugins.map(plugin => html `<oscd-text-button
|
|
23
|
+
class="menu-plugin-item"
|
|
24
|
+
@click=${() => {
|
|
25
|
+
this.dispatchEvent(new CustomEvent('menu-plugin-select', {
|
|
26
|
+
detail: { plugin },
|
|
27
|
+
bubbles: true,
|
|
28
|
+
composed: true,
|
|
29
|
+
}));
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<oscd-elevation></oscd-elevation>
|
|
33
|
+
<div class="menu-plugin-item-content">
|
|
34
|
+
<oscd-icon>${plugin.icon}</oscd-icon>
|
|
35
|
+
<span>${plugin.name}</span>
|
|
36
|
+
<div class="menu-plugin-item-corner-wedge"></div>
|
|
37
|
+
</div>
|
|
38
|
+
</oscd-text-button> `)}
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
LandingPage.scopedElements = {
|
|
44
|
+
'oscd-icon': OscdIcon,
|
|
45
|
+
'oscd-text-button': OscdTextButton,
|
|
46
|
+
'oscd-elevation': OscdElevation,
|
|
47
|
+
};
|
|
48
|
+
LandingPage.styles = css `
|
|
49
|
+
.host {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
gap: 8px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.heading {
|
|
58
|
+
color: var(--oscd-base3);
|
|
59
|
+
text-align: center;
|
|
60
|
+
font-family: 'Roboto';
|
|
61
|
+
font-size: 50px;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
line-height: normal;
|
|
65
|
+
|
|
66
|
+
margin-block-start: 64px;
|
|
67
|
+
margin-block-end: 8px;
|
|
68
|
+
|
|
69
|
+
--md-icon-size: 50px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.sub-heading {
|
|
73
|
+
color: var(--oscd-base3);
|
|
74
|
+
text-align: center;
|
|
75
|
+
font-family: Roboto;
|
|
76
|
+
font-size: 16.909px;
|
|
77
|
+
font-style: normal;
|
|
78
|
+
font-weight: 400;
|
|
79
|
+
line-height: 65.194px; /* 385.56% */
|
|
80
|
+
|
|
81
|
+
margin-block-end: 168px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.menu-plugins-grid {
|
|
85
|
+
width: 60%;
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-wrap: wrap;
|
|
88
|
+
gap: 95px;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
margin: 0 auto;
|
|
91
|
+
padding: 16px 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.menu-plugin-item {
|
|
95
|
+
--md-text-button-container-shape: 2px;
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: row;
|
|
98
|
+
align-items: center;
|
|
99
|
+
text-align: center;
|
|
100
|
+
padding: 8px;
|
|
101
|
+
color: var(--oscd-base3);
|
|
102
|
+
background: var(--oscd-primary);
|
|
103
|
+
transition: background-color 0.3s;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.menu-plugin-item:hover {
|
|
108
|
+
--md-elevation-level: 2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.menu-plugin-item-content {
|
|
112
|
+
color: var(--oscd-base3);
|
|
113
|
+
width: 240px;
|
|
114
|
+
height: 180px;
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
gap: 24px;
|
|
120
|
+
font-family: 'Roboto';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.menu-plugin-item-content oscd-icon {
|
|
124
|
+
--md-icon-size: 54px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.menu-plugin-item-content span {
|
|
128
|
+
font-size: 16px;
|
|
129
|
+
font-style: normal;
|
|
130
|
+
font-weight: 500;
|
|
131
|
+
line-height: 22px; /* 135% */
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.menu-plugin-item-corner-wedge {
|
|
135
|
+
position: absolute;
|
|
136
|
+
bottom: 0;
|
|
137
|
+
right: 0;
|
|
138
|
+
width: 50px;
|
|
139
|
+
height: 50px;
|
|
140
|
+
background: linear-gradient(
|
|
141
|
+
to top left,
|
|
142
|
+
var(--omicron-yellow) 50%,
|
|
143
|
+
transparent 50%
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
__decorate([
|
|
148
|
+
property({ type: String })
|
|
149
|
+
], LandingPage.prototype, "heading", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
property({ type: String })
|
|
152
|
+
], LandingPage.prototype, "subHeading", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
property({ type: Array })
|
|
155
|
+
], LandingPage.prototype, "menuPlugins", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: String, reflect: true })
|
|
158
|
+
], LandingPage.prototype, "locale", void 0);
|
|
159
|
+
LandingPage = __decorate([
|
|
160
|
+
localized()
|
|
161
|
+
], LandingPage);
|
|
162
|
+
export { LandingPage };
|
|
163
|
+
//# sourceMappingURL=landing-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"landing-page.js","sourceRoot":"","sources":["../../src/landing-page/landing-page.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAIjF,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAQ3E,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,mBAAmB,CAAC,UAAU,CAAC;IAAzD;;QAOL,gBAAgB;QAGhB,YAAO,GAAW,EAAE,CAAC;QAGrB,eAAU,GAAW,EAAE,CAAC;QAExB,gBAAW,GAAkB,EAAE,CAAC;IAuIlC,CAAC;IAlIC,MAAM;QACJ,OAAO,IAAI,CAAA;4BACa,IAAI,CAAC,OAAO;gCACR,IAAI,CAAC,UAAU;;UAErC,IAAI,CAAC,WAAW,CAAC,GAAG,CACpB,MAAM,CAAC,EAAE,CACP,IAAI,CAAA;;uBAEO,GAAG,EAAE;YACZ,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,oBAAoB,EAAE;gBACpC,MAAM,EAAE,EAAE,MAAM,EAAE;gBAClB,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf,CAAC,CACH,CAAC;QACJ,CAAC;;;;6BAIc,MAAM,CAAC,IAAI;wBAChB,MAAM,CAAC,IAAI;;;iCAGF,CACxB;;KAEJ,CAAC;IACJ,CAAC;;AAhDM,0BAAc,GAAG;IACtB,WAAW,EAAE,QAAQ;IACrB,kBAAkB,EAAE,cAAc;IAClC,gBAAgB,EAAE,aAAa;CAChC,AAJoB,CAInB;AA8CK,kBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGlB,AAlGY,CAkGX;AA3IF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACN;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACH;AAExB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDACM;AAGhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACvB;AAlBR,WAAW;IADvB,SAAS,EAAE;GACC,WAAW,CAsJvB","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';\nimport { localized } from '@lit/localize';\n\nimport { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';\nimport { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';\n\nimport { PluginEntry } from '../oscd-shell.js';\nimport { LocaleTag } from '../localization.js';\nimport { OscdElevation } from '@omicronenergy/oscd-ui/elevation/OscdElevation.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'landing-page': LandingPage;\n }\n}\n@localized()\nexport class LandingPage extends ScopedElementsMixin(LitElement) {\n static scopedElements = {\n 'oscd-icon': OscdIcon,\n 'oscd-text-button': OscdTextButton,\n 'oscd-elevation': OscdElevation,\n };\n\n /* Properties */\n\n @property({ type: String })\n heading: string = '';\n\n @property({ type: String })\n subHeading: string = '';\n @property({ type: Array })\n menuPlugins: PluginEntry[] = [];\n\n @property({ type: String, reflect: true })\n locale!: LocaleTag;\n\n render() {\n return html`\n <h1 class=\"heading\">${this.heading}</h1>\n <h2 class=\"sub-heading\">${this.subHeading}</h2>\n <div class=\"menu-plugins-grid\">\n ${this.menuPlugins.map(\n plugin =>\n html`<oscd-text-button\n class=\"menu-plugin-item\"\n @click=${() => {\n this.dispatchEvent(\n new CustomEvent('menu-plugin-select', {\n detail: { plugin },\n bubbles: true,\n composed: true,\n }),\n );\n }}\n >\n <oscd-elevation></oscd-elevation>\n <div class=\"menu-plugin-item-content\">\n <oscd-icon>${plugin.icon}</oscd-icon>\n <span>${plugin.name}</span>\n <div class=\"menu-plugin-item-corner-wedge\"></div>\n </div>\n </oscd-text-button> `,\n )}\n </div>\n `;\n }\n\n static styles = css`\n .host {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n gap: 8px;\n }\n\n .heading {\n color: var(--oscd-base3);\n text-align: center;\n font-family: 'Roboto';\n font-size: 50px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n\n margin-block-start: 64px;\n margin-block-end: 8px;\n\n --md-icon-size: 50px;\n }\n\n .sub-heading {\n color: var(--oscd-base3);\n text-align: center;\n font-family: Roboto;\n font-size: 16.909px;\n font-style: normal;\n font-weight: 400;\n line-height: 65.194px; /* 385.56% */\n\n margin-block-end: 168px;\n }\n\n .menu-plugins-grid {\n width: 60%;\n display: flex;\n flex-wrap: wrap;\n gap: 95px;\n justify-content: center;\n margin: 0 auto;\n padding: 16px 0;\n }\n\n .menu-plugin-item {\n --md-text-button-container-shape: 2px;\n display: flex;\n flex-direction: row;\n align-items: center;\n text-align: center;\n padding: 8px;\n color: var(--oscd-base3);\n background: var(--oscd-primary);\n transition: background-color 0.3s;\n cursor: pointer;\n }\n\n .menu-plugin-item:hover {\n --md-elevation-level: 2;\n }\n\n .menu-plugin-item-content {\n color: var(--oscd-base3);\n width: 240px;\n height: 180px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 24px;\n font-family: 'Roboto';\n }\n\n .menu-plugin-item-content oscd-icon {\n --md-icon-size: 54px;\n }\n\n .menu-plugin-item-content span {\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 22px; /* 135% */\n }\n\n .menu-plugin-item-corner-wedge {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 50px;\n height: 50px;\n background: linear-gradient(\n to top left,\n var(--omicron-yellow) 50%,\n transparent 50%\n );\n }\n `;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../oscd-shell.js';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
2
|
+
import '../oscd-shell.js';
|
|
3
|
+
import { TestMenuPlugin1 } from '../utils/testing/test-plugins.js';
|
|
4
|
+
import { newOpenEvent } from '@openscd/oscd-api/utils.js';
|
|
5
|
+
import { createSclDocument } from '../utils/testing/test-doc-helpers.js';
|
|
6
|
+
import { sampleMenuPlugins, waitForAllPluginsToInstantiate, } from '../utils/testing/plugin-helpers.js';
|
|
7
|
+
import sinon from 'sinon';
|
|
8
|
+
const testHeading = 'Test Heading';
|
|
9
|
+
const testSubHeading = 'Test Subheading';
|
|
10
|
+
describe('default landing-page', () => {
|
|
11
|
+
let oscdShell;
|
|
12
|
+
let landingPage;
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
oscdShell = await fixture(html `<oscd-shell
|
|
15
|
+
landingPageHeading=${testHeading}
|
|
16
|
+
landingPageSubHeading=${testSubHeading}
|
|
17
|
+
></oscd-shell>`);
|
|
18
|
+
const testMenuPlugin1TagName = sampleMenuPlugins[0].tagName;
|
|
19
|
+
expect(testMenuPlugin1TagName).to.not.be.undefined;
|
|
20
|
+
if (oscdShell?.registry?.get(testMenuPlugin1TagName) === undefined) {
|
|
21
|
+
oscdShell?.registry?.define(testMenuPlugin1TagName, TestMenuPlugin1);
|
|
22
|
+
}
|
|
23
|
+
oscdShell.plugins = {
|
|
24
|
+
menu: sampleMenuPlugins,
|
|
25
|
+
};
|
|
26
|
+
await waitForAllPluginsToInstantiate(oscdShell);
|
|
27
|
+
landingPage = oscdShell.shadowRoot.querySelector('landing-page');
|
|
28
|
+
});
|
|
29
|
+
it('loads the default landing-page if no landing-page slot is used and not document loaded', async () => {
|
|
30
|
+
expect(landingPage).to.exist;
|
|
31
|
+
});
|
|
32
|
+
it('renders the landingPageHeading', async () => {
|
|
33
|
+
const headingElement = landingPage.shadowRoot.querySelector('.heading');
|
|
34
|
+
expect(headingElement?.textContent?.trim()).to.equal(testHeading);
|
|
35
|
+
});
|
|
36
|
+
it('renders the landingPageSubHeading', async () => {
|
|
37
|
+
const subHeadingElement = landingPage.shadowRoot.querySelector('.sub-heading');
|
|
38
|
+
expect(subHeadingElement?.textContent?.trim()).to.equal(testSubHeading);
|
|
39
|
+
});
|
|
40
|
+
it('does not load the default landing page as soon as a document is loaded', async () => {
|
|
41
|
+
oscdShell.dispatchEvent(newOpenEvent(createSclDocument(), 'test.scd'));
|
|
42
|
+
await oscdShell.updateComplete;
|
|
43
|
+
const landingPageAfterOpen = oscdShell.shadowRoot.querySelector('landing-page');
|
|
44
|
+
expect(landingPageAfterOpen).to.be.null;
|
|
45
|
+
});
|
|
46
|
+
it('renders all menu plugins, not requiring a document, as large tiles (buttons)', async () => {
|
|
47
|
+
const menuPluginsNotRequiringDoc = oscdShell.plugins.menu.filter(plugin => !plugin.requireDoc);
|
|
48
|
+
const menuPluginElements = landingPage.shadowRoot.querySelectorAll('.menu-plugin-item');
|
|
49
|
+
expect(menuPluginElements.length).to.equal(menuPluginsNotRequiringDoc.length);
|
|
50
|
+
});
|
|
51
|
+
it('triggers the run method of the plugin when a menu tile is clicked', async () => {
|
|
52
|
+
const testMenuPlugin1Def = sampleMenuPlugins.find(plugin => plugin.tagName === 'test-menu-plugin1');
|
|
53
|
+
const menuPluginElements = landingPage.shadowRoot.querySelectorAll('.menu-plugin-item');
|
|
54
|
+
const testMenuPlugin1Instance = oscdShell.shadowRoot?.querySelector('test-menu-plugin1');
|
|
55
|
+
const menuPluginSpy = sinon.spy(testMenuPlugin1Instance, 'run');
|
|
56
|
+
const testMenuPlugin1Button = Array.from(menuPluginElements).find(element => element
|
|
57
|
+
.querySelector('.menu-plugin-item-content span')
|
|
58
|
+
?.textContent?.trim() === testMenuPlugin1Def?.name);
|
|
59
|
+
testMenuPlugin1Button.click();
|
|
60
|
+
await oscdShell.updateComplete;
|
|
61
|
+
expect(menuPluginSpy.calledOnce).to.be.true;
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('custom landing-page', () => {
|
|
65
|
+
let oscdShell;
|
|
66
|
+
// let landingPage: LandingPage;
|
|
67
|
+
beforeEach(async () => {
|
|
68
|
+
oscdShell = await fixture(html `<oscd-shell>
|
|
69
|
+
<div slot="landing-page" class="my-custom-landing-page">
|
|
70
|
+
<h1>Custom Landing Page</h1>
|
|
71
|
+
</div>
|
|
72
|
+
</oscd-shell>`);
|
|
73
|
+
await waitForAllPluginsToInstantiate(oscdShell);
|
|
74
|
+
});
|
|
75
|
+
it('loads a custom landing page if no document is loaded', async () => {
|
|
76
|
+
const landingPageSlot = oscdShell.shadowRoot.querySelector('slot[name="landing-page"]');
|
|
77
|
+
expect(landingPageSlot).to.exist;
|
|
78
|
+
expect(landingPageSlot?.assignedElements().length).to.equal(1);
|
|
79
|
+
const customLandingPage = landingPageSlot?.assignedElements()[0];
|
|
80
|
+
expect(customLandingPage).to.exist;
|
|
81
|
+
});
|
|
82
|
+
it('it no longer loads the landing page when a document is loaded', async () => {
|
|
83
|
+
const defaultLandingPage = oscdShell.shadowRoot.querySelector('landing-page');
|
|
84
|
+
expect(defaultLandingPage).to.be.null;
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=landing-page.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"landing-page.spec.js","sourceRoot":"","sources":["../../src/landing-page/landing-page.spec.ts"],"names":[],"mappings":"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","sourcesContent":["import { expect, fixture, html } from '@open-wc/testing';\nimport type { OscdShell } from '../oscd-shell.js';\n\nimport '../oscd-shell.js';\nimport { TestMenuPlugin1 } from '../utils/testing/test-plugins.js';\nimport { LandingPage } from './landing-page.js';\nimport { newOpenEvent } from '@openscd/oscd-api/utils.js';\nimport { createSclDocument } from '../utils/testing/test-doc-helpers.js';\nimport {\n sampleMenuPlugins,\n waitForAllPluginsToInstantiate,\n} from '../utils/testing/plugin-helpers.js';\nimport sinon from 'sinon';\nimport { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';\n\nconst testHeading = 'Test Heading';\nconst testSubHeading = 'Test Subheading';\n\ndescribe('default landing-page', () => {\n let oscdShell: OscdShell;\n let landingPage: LandingPage;\n\n beforeEach(async () => {\n oscdShell = await fixture(\n html`<oscd-shell\n landingPageHeading=${testHeading}\n landingPageSubHeading=${testSubHeading}\n ></oscd-shell>`,\n );\n const testMenuPlugin1TagName = sampleMenuPlugins[0].tagName!;\n expect(testMenuPlugin1TagName).to.not.be.undefined;\n if (oscdShell?.registry?.get(testMenuPlugin1TagName) === undefined) {\n oscdShell?.registry?.define(testMenuPlugin1TagName!, TestMenuPlugin1);\n }\n oscdShell.plugins = {\n menu: sampleMenuPlugins,\n };\n await waitForAllPluginsToInstantiate(oscdShell);\n landingPage = oscdShell.shadowRoot!.querySelector('landing-page')!;\n });\n\n it('loads the default landing-page if no landing-page slot is used and not document loaded', async () => {\n expect(landingPage).to.exist;\n });\n\n it('renders the landingPageHeading', async () => {\n const headingElement = landingPage.shadowRoot!.querySelector('.heading');\n expect(headingElement?.textContent?.trim()).to.equal(testHeading);\n });\n\n it('renders the landingPageSubHeading', async () => {\n const subHeadingElement =\n landingPage.shadowRoot!.querySelector('.sub-heading');\n expect(subHeadingElement?.textContent?.trim()).to.equal(testSubHeading);\n });\n\n it('does not load the default landing page as soon as a document is loaded', async () => {\n oscdShell.dispatchEvent(newOpenEvent(createSclDocument(), 'test.scd'));\n await oscdShell.updateComplete;\n const landingPageAfterOpen =\n oscdShell.shadowRoot!.querySelector('landing-page');\n expect(landingPageAfterOpen).to.be.null;\n });\n\n it('renders all menu plugins, not requiring a document, as large tiles (buttons)', async () => {\n const menuPluginsNotRequiringDoc = oscdShell.plugins.menu.filter(\n plugin => !plugin.requireDoc,\n );\n const menuPluginElements =\n landingPage.shadowRoot!.querySelectorAll('.menu-plugin-item');\n\n expect(menuPluginElements.length).to.equal(\n menuPluginsNotRequiringDoc.length,\n );\n });\n\n it('triggers the run method of the plugin when a menu tile is clicked', async () => {\n const testMenuPlugin1Def = sampleMenuPlugins.find(\n plugin => plugin.tagName === 'test-menu-plugin1',\n );\n const menuPluginElements =\n landingPage.shadowRoot!.querySelectorAll('.menu-plugin-item');\n\n const testMenuPlugin1Instance = oscdShell.shadowRoot?.querySelector(\n 'test-menu-plugin1',\n ) as TestMenuPlugin1;\n const menuPluginSpy = sinon.spy(testMenuPlugin1Instance, 'run');\n\n const testMenuPlugin1Button = Array.from(menuPluginElements).find(\n element =>\n element\n .querySelector('.menu-plugin-item-content span')\n ?.textContent?.trim() === testMenuPlugin1Def?.name,\n ) as OscdTextButton;\n testMenuPlugin1Button.click();\n await oscdShell.updateComplete;\n\n expect(menuPluginSpy.calledOnce).to.be.true;\n });\n});\n\ndescribe('custom landing-page', () => {\n let oscdShell: OscdShell;\n // let landingPage: LandingPage;\n\n beforeEach(async () => {\n oscdShell = <OscdShell>await fixture(\n html`<oscd-shell>\n <div slot=\"landing-page\" class=\"my-custom-landing-page\">\n <h1>Custom Landing Page</h1>\n </div>\n </oscd-shell>`,\n );\n await waitForAllPluginsToInstantiate(oscdShell);\n });\n\n it('loads a custom landing page if no document is loaded', async () => {\n const landingPageSlot = oscdShell.shadowRoot!.querySelector(\n 'slot[name=\"landing-page\"]',\n ) as HTMLSlotElement;\n expect(landingPageSlot).to.exist;\n expect(landingPageSlot?.assignedElements().length).to.equal(1);\n const customLandingPage = landingPageSlot?.assignedElements()[0];\n expect(customLandingPage).to.exist;\n });\n\n it('it no longer loads the landing page when a document is loaded', async () => {\n const defaultLandingPage =\n oscdShell.shadowRoot!.querySelector('landing-page');\n expect(defaultLandingPage).to.be.null;\n });\n});\n"]}
|
package/dist/locales/de.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export declare const templates: {
|
|
2
|
-
s1b528387ae29637a: string;
|
|
3
|
-
s2ceb11be2290bb1b: string;
|
|
4
|
-
s60320a18282b2b33: string;
|
|
5
|
-
s690714fde574c188: string;
|
|
6
2
|
s6d8c02aee480af7a: string;
|
|
7
|
-
s737e3dbdf9c08cdf: string;
|
|
8
3
|
s7417792bbe720149: string;
|
|
9
4
|
s8f4be9f086eb530f: string;
|
|
10
5
|
};
|
package/dist/locales/de.js
CHANGED
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
/* eslint-disable no-irregular-whitespace */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
export const templates = {
|
|
6
|
-
's1b528387ae29637a': `Dateiendung`,
|
|
7
|
-
's2ceb11be2290bb1b': `Abbrechen`,
|
|
8
|
-
's60320a18282b2b33': `Umbenennen`,
|
|
9
|
-
's690714fde574c188': `Dateiname`,
|
|
10
6
|
's6d8c02aee480af7a': `Menü`,
|
|
11
|
-
's737e3dbdf9c08cdf': `Datei schließen`,
|
|
12
7
|
's7417792bbe720149': `Wiederholen`,
|
|
13
8
|
's8f4be9f086eb530f': `Rückgängig`,
|
|
14
9
|
};
|
package/dist/locales/de.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.js","sourceRoot":"","sources":["../../locales/de.ts"],"names":[],"mappings":"AACI,mCAAmC;AACnC,gDAAgD;AAKhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"de.js","sourceRoot":"","sources":["../../src/locales/de.ts"],"names":[],"mappings":"AACI,mCAAmC;AACnC,gDAAgD;AAKhD,4CAA4C;AAC5C,uDAAuD;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,mBAAmB,EAAE,MAAM;IACjC,mBAAmB,EAAE,aAAa;IAClC,mBAAmB,EAAE,YAAY;CAC5B,CAAC","sourcesContent":["\n // Do not modify this file by hand!\n // Re-generate this file by running lit-localize\n\n \n \n\n /* eslint-disable no-irregular-whitespace */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n\n export const templates = {\n 's6d8c02aee480af7a': `Menü`,\n's7417792bbe720149': `Wiederholen`,\n's8f4be9f086eb530f': `Rückgängig`,\n };\n "]}
|
package/dist/locales.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../locales.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,iDAAiD;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI;CACI,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI;IACJ,IAAI;CACI,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize.\n\n/**\n * The locale code that templates in this source code are written in.\n */\nexport const sourceLocale = `en`;\n\n/**\n * The other locale codes that this application is localized into. Sorted\n * lexicographically.\n */\nexport const targetLocales = [\n `de`,\n] as const;\n\n/**\n * All valid project locale codes. Sorted lexicographically.\n */\nexport const allLocales = [\n `de`,\n `en`,\n] as const;\n"]}
|
|
1
|
+
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../src/locales.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,iDAAiD;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI;CACI,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI;IACJ,IAAI;CACI,CAAC","sourcesContent":["// Do not modify this file by hand!\n// Re-generate this file by running lit-localize.\n\n/**\n * The locale code that templates in this source code are written in.\n */\nexport const sourceLocale = `en`;\n\n/**\n * The other locale codes that this application is localized into. Sorted\n * lexicographically.\n */\nexport const targetLocales = [\n `de`,\n] as const;\n\n/**\n * All valid project locale codes. Sorted lexicographically.\n */\nexport const allLocales = [\n `de`,\n `en`,\n] as const;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { allLocales, sourceLocale, targetLocales } from './locales.js';
|
|
2
|
+
export type LocaleTag = (typeof allLocales)[number];
|
|
3
|
+
export type Translation = (typeof targetLocales)[number];
|
|
4
|
+
export type Translations = Record<Translation, string>;
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
localization?: {
|
|
8
|
+
getLocale: () => string;
|
|
9
|
+
setLocale: (locale: string) => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const getLocale: () => string, setLocale: (locale: string) => void;
|
|
14
|
+
export { getLocale, setLocale };
|
|
15
|
+
export { allLocales, sourceLocale, targetLocales };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { configureLocalization } from '@lit/localize';
|
|
2
|
+
import { allLocales, sourceLocale, targetLocales } from './locales.js';
|
|
3
|
+
const { getLocale, setLocale } = window.localization ??
|
|
4
|
+
configureLocalization({
|
|
5
|
+
sourceLocale,
|
|
6
|
+
targetLocales,
|
|
7
|
+
loadLocale: _locale => {
|
|
8
|
+
return import(new URL(`./locales/de.js`, import.meta.url).href);
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
/*
|
|
12
|
+
* To prevent multiple calls to configureLocalization,
|
|
13
|
+
* we store the getLocale and setLocale functions on the window object.
|
|
14
|
+
* This happens now and again in development mode with HMR, perhaps
|
|
15
|
+
* we should wrap this in a check for dev mode only?
|
|
16
|
+
*/
|
|
17
|
+
if (!window.localization) {
|
|
18
|
+
window.localization = { getLocale, setLocale };
|
|
19
|
+
}
|
|
20
|
+
export { getLocale, setLocale };
|
|
21
|
+
export { allLocales, sourceLocale, targetLocales };
|
|
22
|
+
//# sourceMappingURL=localization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.js","sourceRoot":"","sources":["../src/localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAcvE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAC5B,MAAM,CAAC,YAAY;IACnB,qBAAqB,CAAC;QACpB,YAAY;QACZ,aAAa;QACb,UAAU,EAAE,OAAO,CAAC,EAAE;YACpB,OAAO,MAAM,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC;KACF,CAAC,CAAC;AAEL;;;;;GAKG;AACH,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACzB,MAAM,CAAC,YAAY,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { configureLocalization } from '@lit/localize';\nimport { allLocales, sourceLocale, targetLocales } from './locales.js';\nexport type LocaleTag = (typeof allLocales)[number];\nexport type Translation = (typeof targetLocales)[number];\nexport type Translations = Record<Translation, string>;\n\ndeclare global {\n interface Window {\n localization?: {\n getLocale: () => string;\n setLocale: (locale: string) => void;\n };\n }\n}\n\nconst { getLocale, setLocale } =\n window.localization ??\n configureLocalization({\n sourceLocale,\n targetLocales,\n loadLocale: _locale => {\n return import(new URL(`./locales/de.js`, import.meta.url).href);\n },\n });\n\n/*\n * To prevent multiple calls to configureLocalization,\n * we store the getLocale and setLocale functions on the window object.\n * This happens now and again in development mode with HMR, perhaps\n * we should wrap this in a check for dev mode only?\n */\nif (!window.localization) {\n window.localization = { getLocale, setLocale };\n}\n\nexport { getLocale, setLocale };\nexport { allLocales, sourceLocale, targetLocales };\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
|
|
3
|
+
import { OscdMenu } from '@omicronenergy/oscd-ui/menu/OscdMenu.js';
|
|
4
|
+
import { OscdMenuItem } from '@omicronenergy/oscd-ui/menu/OscdMenuItem.js';
|
|
5
|
+
import { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';
|
|
6
|
+
import { LocaleTag } from '../localization.js';
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'files-menu': FilesMenu;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare const FilesMenu_base: typeof LitElement & import("@open-wc/scoped-elements/lit-element.js").ScopedElementsHostConstructor;
|
|
13
|
+
export declare class FilesMenu extends FilesMenu_base {
|
|
14
|
+
static scopedElements: {
|
|
15
|
+
'oscd-text-button': typeof OscdTextButton;
|
|
16
|
+
'oscd-icon': typeof OscdIcon;
|
|
17
|
+
'oscd-menu': typeof OscdMenu;
|
|
18
|
+
'oscd-menu-item': typeof OscdMenuItem;
|
|
19
|
+
};
|
|
20
|
+
editableDocs: string[];
|
|
21
|
+
selectedDocName: string | undefined;
|
|
22
|
+
locale: LocaleTag;
|
|
23
|
+
menu: OscdMenu;
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
static styles: import("lit").CSSResult;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { property, query } from 'lit/decorators.js';
|
|
4
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
|
|
5
|
+
import { localized } from '@lit/localize';
|
|
6
|
+
import { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';
|
|
7
|
+
import { OscdMenu } from '@omicronenergy/oscd-ui/menu/OscdMenu.js';
|
|
8
|
+
import { OscdMenuItem } from '@omicronenergy/oscd-ui/menu/OscdMenuItem.js';
|
|
9
|
+
import { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';
|
|
10
|
+
let FilesMenu = class FilesMenu extends ScopedElementsMixin(LitElement) {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
/* Properties */
|
|
14
|
+
this.editableDocs = [];
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return html `
|
|
18
|
+
<oscd-text-button
|
|
19
|
+
id="fileMenuButton"
|
|
20
|
+
@click=${() => this.menu.show()}
|
|
21
|
+
trailing-icon
|
|
22
|
+
>
|
|
23
|
+
${this.selectedDocName}
|
|
24
|
+
<oscd-icon slot="icon">code</oscd-icon></oscd-filled-icon-button
|
|
25
|
+
>
|
|
26
|
+
</oscd-text-button>
|
|
27
|
+
|
|
28
|
+
<oscd-menu
|
|
29
|
+
fixed
|
|
30
|
+
id="fileMenu"
|
|
31
|
+
anchor="fileMenuButton"
|
|
32
|
+
corner="BOTTOM_END"
|
|
33
|
+
>
|
|
34
|
+
${this.editableDocs.map(name => html `<oscd-menu-item
|
|
35
|
+
@click=${() => {
|
|
36
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
37
|
+
bubbles: true,
|
|
38
|
+
composed: true,
|
|
39
|
+
detail: { name },
|
|
40
|
+
}));
|
|
41
|
+
}}
|
|
42
|
+
?selected=${this.selectedDocName === name}
|
|
43
|
+
>${name}</oscd-menu-item
|
|
44
|
+
>`)}
|
|
45
|
+
</oscd-menu>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
FilesMenu.scopedElements = {
|
|
50
|
+
'oscd-text-button': OscdTextButton,
|
|
51
|
+
'oscd-icon': OscdIcon,
|
|
52
|
+
'oscd-menu': OscdMenu,
|
|
53
|
+
'oscd-menu-item': OscdMenuItem,
|
|
54
|
+
};
|
|
55
|
+
FilesMenu.styles = css `
|
|
56
|
+
:host {
|
|
57
|
+
position: relative;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 4px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host oscd-text-button {
|
|
64
|
+
--md-text-button-label-text-line-height: normal;
|
|
65
|
+
--md-text-button-label-text-family: 'Roboto';
|
|
66
|
+
--md-text-button-label-text-weight: 500;
|
|
67
|
+
--md-text-button-label-text-size: 18px;
|
|
68
|
+
--md-text-button-label-text-style: normal;
|
|
69
|
+
--md-sys-color-primary: var(--oscd-base3);
|
|
70
|
+
display: inline;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host oscd-text-button oscd-icon {
|
|
74
|
+
transform: rotate(90deg);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
oscd-menu {
|
|
78
|
+
min-width: 350px;
|
|
79
|
+
padding: 12px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
oscd-menu-item {
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
__decorate([
|
|
87
|
+
property({ type: Array })
|
|
88
|
+
], FilesMenu.prototype, "editableDocs", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: String })
|
|
91
|
+
], FilesMenu.prototype, "selectedDocName", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: String, reflect: true })
|
|
94
|
+
], FilesMenu.prototype, "locale", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
query('#fileMenu')
|
|
97
|
+
], FilesMenu.prototype, "menu", void 0);
|
|
98
|
+
FilesMenu = __decorate([
|
|
99
|
+
localized()
|
|
100
|
+
], FilesMenu);
|
|
101
|
+
export { FilesMenu };
|
|
102
|
+
//# sourceMappingURL=files-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-menu.js","sourceRoot":"","sources":["../../src/menus/files-menu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAU1E,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,mBAAmB,CAAC,UAAU,CAAC;IAAvD;;QAQL,gBAAgB;QAGhB,iBAAY,GAAa,EAAE,CAAC;IAkF9B,CAAC;IArEC,MAAM;QACJ,OAAO,IAAI,CAAA;;;mBAGI,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;;;YAG7B,IAAI,CAAC,eAAe;;;;;;;;;;;UAWtB,IAAI,CAAC,YAAY,CAAC,GAAG,CACrB,IAAI,CAAC,EAAE,CACL,IAAI,CAAA;uBACO,GAAG,EAAE;YACZ,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,EAAE,IAAI,EAAE;aACjB,CAAC,CACH,CAAC;QACJ,CAAC;0BACW,IAAI,CAAC,eAAe,KAAK,IAAI;iBACtC,IAAI;cACP,CACL;;KAEJ,CAAC;IACJ,CAAC;;AA3DM,wBAAc,GAAG;IACtB,kBAAkB,EAAE,cAAc;IAClC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,YAAY;CAC/B,AALoB,CAKnB;AAwDK,gBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BlB,AA9BY,CA8BX;AAjFF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CACE;AAG5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAGpC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACvB;AAKnB;IADC,KAAK,CAAC,WAAW,CAAC;uCACH;AAtBL,SAAS;IADrB,SAAS,EAAE;GACC,SAAS,CA6FrB","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';\nimport { localized } from '@lit/localize';\n\nimport { OscdIcon } from '@omicronenergy/oscd-ui/icon/OscdIcon.js';\nimport { OscdMenu } from '@omicronenergy/oscd-ui/menu/OscdMenu.js';\nimport { OscdMenuItem } from '@omicronenergy/oscd-ui/menu/OscdMenuItem.js';\nimport { OscdTextButton } from '@omicronenergy/oscd-ui/button/OscdTextButton.js';\n\nimport { LocaleTag } from '../localization.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'files-menu': FilesMenu;\n }\n}\n@localized()\nexport class FilesMenu extends ScopedElementsMixin(LitElement) {\n static scopedElements = {\n 'oscd-text-button': OscdTextButton,\n 'oscd-icon': OscdIcon,\n 'oscd-menu': OscdMenu,\n 'oscd-menu-item': OscdMenuItem,\n };\n\n /* Properties */\n\n @property({ type: Array })\n editableDocs: string[] = [];\n\n @property({ type: String })\n selectedDocName: string | undefined;\n\n @property({ type: String, reflect: true })\n locale!: LocaleTag;\n\n /* Queries */\n\n @query('#fileMenu')\n menu!: OscdMenu;\n\n render() {\n return html`\n <oscd-text-button\n id=\"fileMenuButton\"\n @click=${() => this.menu.show()}\n trailing-icon\n >\n ${this.selectedDocName}\n <oscd-icon slot=\"icon\">code</oscd-icon></oscd-filled-icon-button\n >\n </oscd-text-button>\n\n <oscd-menu\n fixed\n id=\"fileMenu\"\n anchor=\"fileMenuButton\"\n corner=\"BOTTOM_END\"\n >\n ${this.editableDocs.map(\n name =>\n html`<oscd-menu-item\n @click=${() => {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: { name },\n }),\n );\n }}\n ?selected=${this.selectedDocName === name}\n >${name}</oscd-menu-item\n >`,\n )}\n </oscd-menu>\n `;\n }\n\n static styles = css`\n :host {\n position: relative;\n display: flex;\n align-items: center;\n gap: 4px;\n }\n\n :host oscd-text-button {\n --md-text-button-label-text-line-height: normal;\n --md-text-button-label-text-family: 'Roboto';\n --md-text-button-label-text-weight: 500;\n --md-text-button-label-text-size: 18px;\n --md-text-button-label-text-style: normal;\n --md-sys-color-primary: var(--oscd-base3);\n display: inline;\n }\n\n :host oscd-text-button oscd-icon {\n transform: rotate(90deg);\n }\n\n oscd-menu {\n min-width: 350px;\n padding: 12px;\n }\n\n oscd-menu-item {\n width: 100%;\n }\n `;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../oscd-shell.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
2
|
+
import '../oscd-shell.js';
|
|
3
|
+
import { createTestDocs } from '../utils/testing/test-doc-helpers.js';
|
|
4
|
+
describe('files-menu', () => {
|
|
5
|
+
let oscdShell;
|
|
6
|
+
let filesMenu;
|
|
7
|
+
let docs;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
docs = createTestDocs(3);
|
|
10
|
+
oscdShell = (await fixture(html `<oscd-shell
|
|
11
|
+
.docs=${docs}
|
|
12
|
+
docName=${Object.keys(docs)[0]}
|
|
13
|
+
></oscd-shell>`));
|
|
14
|
+
filesMenu = oscdShell.shadowRoot.querySelector('files-menu');
|
|
15
|
+
await oscdShell.updateComplete;
|
|
16
|
+
await filesMenu.updateComplete;
|
|
17
|
+
});
|
|
18
|
+
it('allows the user to switch documents', async () => {
|
|
19
|
+
const fileDropdownButton = filesMenu.shadowRoot?.querySelector('oscd-text-button');
|
|
20
|
+
expect(fileDropdownButton).to.exist;
|
|
21
|
+
fileDropdownButton?.click();
|
|
22
|
+
await filesMenu.updateComplete;
|
|
23
|
+
filesMenu.menu.firstElementChild.click();
|
|
24
|
+
await oscdShell.updateComplete;
|
|
25
|
+
const oldDocName = oscdShell.docName;
|
|
26
|
+
fileDropdownButton?.click();
|
|
27
|
+
await filesMenu.updateComplete;
|
|
28
|
+
filesMenu.menu.lastElementChild.click();
|
|
29
|
+
await oscdShell.updateComplete;
|
|
30
|
+
expect(oscdShell).to.not.have.property('docName', oldDocName);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=files-menu.spec.js.map
|