@omicronenergy/oscd-shell 0.0.5 → 0.0.7

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.
Files changed (121) hide show
  1. package/dist/foundation/cyrb64.d.ts +6 -0
  2. package/dist/foundation/cyrb64.js +26 -0
  3. package/dist/foundation/cyrb64.js.map +1 -0
  4. package/dist/foundation.d.ts +1 -0
  5. package/dist/foundation.js +2 -0
  6. package/dist/foundation.js.map +1 -0
  7. package/dist/locales/de.d.ts +10 -0
  8. package/dist/locales/de.js +15 -0
  9. package/dist/locales/de.js.map +1 -0
  10. package/dist/locales.d.ts +13 -0
  11. package/dist/locales.js +21 -0
  12. package/dist/locales.js.map +1 -0
  13. package/dist/oscd-shell.d.ts +115 -0
  14. package/dist/oscd-shell.js +732 -0
  15. package/dist/oscd-shell.js.map +1 -0
  16. package/package.json +32 -29
  17. package/.editorconfig +0 -22
  18. package/.github/actions/setup-node-env/action.yml +0 -49
  19. package/.github/workflows/release-please.yml +0 -84
  20. package/.github/workflows/test.yml +0 -18
  21. package/.github/workflows/update-screenshots.yml +0 -29
  22. package/.husky/commit-msg +0 -1
  23. package/.husky/pre-commit +0 -1
  24. package/.release-please-manifest.json +0 -1
  25. package/CHANGELOG.md +0 -73
  26. package/CONTRIBUTING.md +0 -393
  27. package/commitlint.config.js +0 -1
  28. package/demo/AddPlugins.js +0 -42
  29. package/demo/DemoPluginSrc.js +0 -9
  30. package/demo/embedded.html +0 -17
  31. package/demo/index.html +0 -95
  32. package/foundation/cyrb64.ts +0 -27
  33. package/foundation/edit-event.ts +0 -273
  34. package/foundation/open-event.ts +0 -21
  35. package/foundation.ts +0 -28
  36. package/lit-localize.json +0 -15
  37. package/localization/de.xlf +0 -75
  38. package/oscd-shell.editing.spec.ts +0 -813
  39. package/oscd-shell.plugging.spec.ts +0 -78
  40. package/oscd-shell.spec.ts +0 -431
  41. package/oscd-shell.test.ts +0 -382
  42. package/oscd-shell.ts +0 -906
  43. package/release-please-config.json +0 -21
  44. package/rollup.config.js +0 -51
  45. package/screenshots/Chromium/baseline/app-bar-de.png +0 -0
  46. package/screenshots/Chromium/baseline/app-bar-en.png +0 -0
  47. package/screenshots/Chromium/baseline/document-name-de.png +0 -0
  48. package/screenshots/Chromium/baseline/document-name-en.png +0 -0
  49. package/screenshots/Chromium/baseline/editor-plugins-de.png +0 -0
  50. package/screenshots/Chromium/baseline/editor-plugins-en.png +0 -0
  51. package/screenshots/Chromium/baseline/editor-plugins-selected-de.png +0 -0
  52. package/screenshots/Chromium/baseline/editor-plugins-selected-en.png +0 -0
  53. package/screenshots/Chromium/baseline/editor-plugins-with-doc-de.png +0 -0
  54. package/screenshots/Chromium/baseline/editor-plugins-with-doc-en.png +0 -0
  55. package/screenshots/Chromium/baseline/log-entries-de.png +0 -0
  56. package/screenshots/Chromium/baseline/log-entries-en.png +0 -0
  57. package/screenshots/Chromium/baseline/log-entries-redone-de.png +0 -0
  58. package/screenshots/Chromium/baseline/log-entries-redone-en.png +0 -0
  59. package/screenshots/Chromium/baseline/log-entries-undone-de.png +0 -0
  60. package/screenshots/Chromium/baseline/log-entries-undone-en.png +0 -0
  61. package/screenshots/Chromium/baseline/log-screen-de.png +0 -0
  62. package/screenshots/Chromium/baseline/log-screen-en.png +0 -0
  63. package/screenshots/Chromium/baseline/menu-drawer-de.png +0 -0
  64. package/screenshots/Chromium/baseline/menu-drawer-en.png +0 -0
  65. package/screenshots/Chromium/baseline/menu-plugins-de.png +0 -0
  66. package/screenshots/Chromium/baseline/menu-plugins-en.png +0 -0
  67. package/screenshots/Chromium/baseline/menu-plugins-triggered-de.png +0 -0
  68. package/screenshots/Chromium/baseline/menu-plugins-triggered-en.png +0 -0
  69. package/screenshots/Firefox/baseline/app-bar-de.png +0 -0
  70. package/screenshots/Firefox/baseline/app-bar-en.png +0 -0
  71. package/screenshots/Firefox/baseline/document-name-de.png +0 -0
  72. package/screenshots/Firefox/baseline/document-name-en.png +0 -0
  73. package/screenshots/Firefox/baseline/editor-plugins-de.png +0 -0
  74. package/screenshots/Firefox/baseline/editor-plugins-en.png +0 -0
  75. package/screenshots/Firefox/baseline/editor-plugins-selected-de.png +0 -0
  76. package/screenshots/Firefox/baseline/editor-plugins-selected-en.png +0 -0
  77. package/screenshots/Firefox/baseline/editor-plugins-with-doc-de.png +0 -0
  78. package/screenshots/Firefox/baseline/editor-plugins-with-doc-en.png +0 -0
  79. package/screenshots/Firefox/baseline/log-entries-de.png +0 -0
  80. package/screenshots/Firefox/baseline/log-entries-en.png +0 -0
  81. package/screenshots/Firefox/baseline/log-entries-redone-de.png +0 -0
  82. package/screenshots/Firefox/baseline/log-entries-redone-en.png +0 -0
  83. package/screenshots/Firefox/baseline/log-entries-undone-de.png +0 -0
  84. package/screenshots/Firefox/baseline/log-entries-undone-en.png +0 -0
  85. package/screenshots/Firefox/baseline/log-screen-de.png +0 -0
  86. package/screenshots/Firefox/baseline/log-screen-en.png +0 -0
  87. package/screenshots/Firefox/baseline/menu-drawer-de.png +0 -0
  88. package/screenshots/Firefox/baseline/menu-drawer-en.png +0 -0
  89. package/screenshots/Firefox/baseline/menu-plugins-de.png +0 -0
  90. package/screenshots/Firefox/baseline/menu-plugins-en.png +0 -0
  91. package/screenshots/Firefox/baseline/menu-plugins-triggered-de.png +0 -0
  92. package/screenshots/Firefox/baseline/menu-plugins-triggered-en.png +0 -0
  93. package/screenshots/Webkit/baseline/app-bar-de.png +0 -0
  94. package/screenshots/Webkit/baseline/app-bar-en.png +0 -0
  95. package/screenshots/Webkit/baseline/document-name-de.png +0 -0
  96. package/screenshots/Webkit/baseline/document-name-en.png +0 -0
  97. package/screenshots/Webkit/baseline/editor-plugins-de.png +0 -0
  98. package/screenshots/Webkit/baseline/editor-plugins-en.png +0 -0
  99. package/screenshots/Webkit/baseline/editor-plugins-selected-de.png +0 -0
  100. package/screenshots/Webkit/baseline/editor-plugins-selected-en.png +0 -0
  101. package/screenshots/Webkit/baseline/editor-plugins-with-doc-de.png +0 -0
  102. package/screenshots/Webkit/baseline/editor-plugins-with-doc-en.png +0 -0
  103. package/screenshots/Webkit/baseline/log-entries-de.png +0 -0
  104. package/screenshots/Webkit/baseline/log-entries-en.png +0 -0
  105. package/screenshots/Webkit/baseline/log-entries-redone-de.png +0 -0
  106. package/screenshots/Webkit/baseline/log-entries-redone-en.png +0 -0
  107. package/screenshots/Webkit/baseline/log-entries-undone-de.png +0 -0
  108. package/screenshots/Webkit/baseline/log-entries-undone-en.png +0 -0
  109. package/screenshots/Webkit/baseline/log-screen-de.png +0 -0
  110. package/screenshots/Webkit/baseline/log-screen-en.png +0 -0
  111. package/screenshots/Webkit/baseline/menu-drawer-de.png +0 -0
  112. package/screenshots/Webkit/baseline/menu-drawer-en.png +0 -0
  113. package/screenshots/Webkit/baseline/menu-plugins-de.png +0 -0
  114. package/screenshots/Webkit/baseline/menu-plugins-en.png +0 -0
  115. package/screenshots/Webkit/baseline/menu-plugins-triggered-de.png +0 -0
  116. package/screenshots/Webkit/baseline/menu-plugins-triggered-en.png +0 -0
  117. package/tsconfig.json +0 -23
  118. package/utils/testing.spec.ts +0 -210
  119. package/utils/testing.ts +0 -65
  120. package/web-dev-server.config.js +0 -24
  121. package/web-test-runner.config.js +0 -180
package/CONTRIBUTING.md DELETED
@@ -1,393 +0,0 @@
1
- # Contributing to OpenSCD Core
2
-
3
- Thanks for taking the time to contribute to the OpenSCD project!
4
-
5
- ## Non-Code Contributions
6
-
7
- You don't need to be a software developer to contribute to this effort! Apart
8
- from contributions in the form of code we are also very thankful for
9
-
10
- - [bug reports](https://github.com/OMICRONEnergyOSS/oscd-shell/issues?q=is%3Aopen) alerting
11
- us of errors in the `oscd-shell` component or its `foundation` library
12
- functions,
13
- - [ideas for enhancements](https://github.com/OMICRONEnergyOSS/oscd-shell/discussions/categories/ideas)
14
- to `oscd-shell` or its `foundation` library,
15
- - [contributions to discussions](https://github.com/OMICRONEnergyOSS/oscd-shell/discussions) we're having
16
- about which direction the project should take, and
17
- - [improvements to our wiki](https://github.com/OMICRONEnergyOSS/oscd-shell/wiki)
18
- which contains knowledge about how to use both OpenSCD and SCL in general.
19
-
20
- ## Code Contributions
21
-
22
- > The following is a set of guidelines for contributing to [OpenSCD
23
- > Core](https://github.com/OMICRONEnergyOSS/oscd-shell#readme), not a list of
24
- > strict rules. Use your best judgment and feel free to propose changes to this
25
- > document in a pull request.
26
-
27
- ### Code Structure
28
-
29
- The OpenSCD Core project's [NPM package declaration file](https://github.com/OMICRONEnergyOSS/oscd-shell/blob/main/package.json) lists
30
- two entry points that can be referred to by package users:
31
-
32
- ```json
33
- "exports": {
34
- ".": "dist/foundation.js",
35
- "/oscd-shell.js": "dist/oscd-shell.js"
36
- },
37
- ```
38
-
39
- `foundation.ts` defines a host of types, utility functions, and constants which
40
- we hope will be useful for writing plugins that edit SCL files.
41
-
42
- `oscd-shell.ts` defines a custom element `<oscd-shell>`, a [web component](https://developer.mozilla.org/en-US/docs/Web/Web_Components)
43
- implemented as a [LitElement](https://lit.dev/docs) extended with our own
44
- [Mixins](https://lit.dev/docs/composition/mixins).
45
-
46
- ### Commit Messages
47
-
48
- - Use the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
49
- format for commit messages.
50
-
51
- > A commit should contain only one single change, so you should always be
52
- > able to find a fitting type.
53
-
54
- - Use the present tense ("feat: add feature" not "feat: added feature")
55
- - Use the imperative mood ("fix: move cursor to..." not "fix: moves cursor
56
- to...")
57
- - Limit the first line to 72 characters or less
58
- - Reference issues and pull requests liberally after the first line
59
-
60
- ### Contributing Workflow and Branching Strategy
61
-
62
- We like to receive code contributions through the [Forking Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow),
63
- which means every contributor maintains their own independent fork and sends
64
- pull requests directly from their own copy of the repo. This enables
65
- contributors to work as independently as possible, with the only point of
66
- coordination happening when a maintainer merges the incoming pull request.
67
-
68
- A pull request should generally only ever contain at most one `fix` or `feat`
69
- commit, and never both. If you have several different bugs to fix or features to
70
- introduce, please create a separate pull request for each one. If a single bug
71
- fix or feature took you several commits to achieve, please squash those commits
72
- into one using an interactive rebase (see the great tutorial linked under
73
- "Forking Workflow" above) before submitting your pull request.
74
-
75
- Please make sure that all CI checks are passing before marking your pull request
76
- "Ready for review".
77
-
78
- ### Filenames
79
-
80
- If a file defines a custom element, it should always be named after its tag name
81
- (e.g. `my-component.ts`). Otherwise, files should generally be named after the
82
- most important symbol they export (e.g. `MyClass.ts`).
83
-
84
- ### Code Style and Linting
85
-
86
- We use eslint and prettier for formatting and linting. Both are run as part of
87
- a `husky` pre-commit hook defined in `package.json`. Nonetheless, we recommend
88
- you use your editor's or IED's eslint and prettier plugins for continuous
89
- formatting and linting while writing the code in order to avoid any surprises.
90
-
91
- Apart from the rules the linter and formatter enforce, we adopt the following
92
- guidelines taken from the terse but broad [Deno Style Guide](https://deno.land/manual/contributing/style_guide) with some minor adjustments:
93
-
94
- #### TODO Comments
95
-
96
- In general, don't commit TODO or FIXME comments. Their significance tends to get
97
- lost in the mists of time and they cause more confusion than anything else.
98
-
99
- If you are tempted to write a FIXME comment, please consider fixing the code
100
- immediately instead. If this is absolutely not possible, create a bug issue
101
- referencing your pull request which introduces the bug.
102
-
103
- If you are tempted to write a TODO comment, please consider opening an issue
104
- describing the changes to be made instead.
105
-
106
- If you still find it helpful to introduce a TODO comment, please include an
107
- issue or at least the author's github username in parentheses. Example:
108
-
109
- ```ts
110
- // TODO(ry): Add tests.
111
- // TODO(#123): Support Windows.
112
- // FIXME(#349): Sometimes panics.
113
- ```
114
-
115
- #### Exported functions: max 2 args, put the rest into an options object.
116
-
117
- When designing function interfaces, stick to the following rules.
118
-
119
- 1. A function that is part of the public API takes 0-2 required arguments, plus
120
- (if necessary) an options object (so max 3 total).
121
-
122
- 2. Optional parameters should generally go into the options object.
123
-
124
- An optional parameter that's not in an options object might be acceptable if
125
- there is only one, and it seems inconceivable that we would add more optional
126
- parameters in the future.
127
-
128
- 3. The 'options' argument is the only argument that is a regular 'Object'.
129
-
130
- Other arguments can be objects, but they must be distinguishable from a
131
- 'plain' Object runtime, by having either:
132
-
133
- - a distinguishing prototype (e.g. `Array`, `Map`, `Date`, `class MyThing`).
134
- - a well-known symbol property (e.g. an iterable with `Symbol.iterator`).
135
-
136
- This allows the API to evolve in a backwards compatible way, even when the
137
- position of the options object changes.
138
-
139
- ```ts, ignore
140
- // BAD: optional parameters not part of options object. (#2)
141
- export function resolve(
142
- hostname: string,
143
- family?: "ipv4" | "ipv6",
144
- timeout?: number,
145
- ): IPAddress[] {}
146
- ```
147
-
148
- ```ts, ignore
149
- // GOOD.
150
- export interface ResolveOptions {
151
- family?: "ipv4" | "ipv6";
152
- timeout?: number;
153
- }
154
- export function resolve(
155
- hostname: string,
156
- options: ResolveOptions = {},
157
- ): IPAddress[] {}
158
- ```
159
-
160
- ```ts, ignore
161
- export interface Environment {
162
- [key: string]: string;
163
- }
164
-
165
- // BAD: `env` could be a regular Object and is therefore indistinguishable
166
- // from an options object. (#3)
167
- export function runShellWithEnv(cmdline: string, env: Environment): string {}
168
-
169
- // GOOD.
170
- export interface RunShellOptions {
171
- env: Environment;
172
- }
173
- export function runShellWithEnv(
174
- cmdline: string,
175
- options: RunShellOptions,
176
- ): string {}
177
- ```
178
-
179
- ```ts
180
- // BAD: more than 3 arguments (#1), multiple optional parameters (#2).
181
- export function renameSync(
182
- oldname: string,
183
- newname: string,
184
- replaceExisting?: boolean,
185
- followLinks?: boolean,
186
- ) {}
187
- ```
188
-
189
- ```ts
190
- // GOOD.
191
- interface RenameOptions {
192
- replaceExisting?: boolean;
193
- followLinks?: boolean;
194
- }
195
- export function renameSync(
196
- oldname: string,
197
- newname: string,
198
- options: RenameOptions = {},
199
- ) {}
200
- ```
201
-
202
- ```ts
203
- // BAD: too many arguments. (#1)
204
- export function pwrite(
205
- fd: number,
206
- buffer: ArrayBuffer,
207
- offset: number,
208
- length: number,
209
- position: number,
210
- ) {}
211
- ```
212
-
213
- ```ts
214
- // BETTER.
215
- export interface PWrite {
216
- fd: number;
217
- buffer: ArrayBuffer;
218
- offset: number;
219
- length: number;
220
- position: number;
221
- }
222
- export function pwrite(options: PWrite) {}
223
- ```
224
-
225
- #### Export all interfaces that are used as parameters to an exported member
226
-
227
- Whenever you are using interfaces that are included in the parameters or return
228
- type of an exported member, you should export the interface that is used. Here
229
- is an example:
230
-
231
- ```ts, ignore
232
- // my-file.ts
233
- export interface Person {
234
- name: string;
235
- age: number;
236
- }
237
-
238
- export function createPerson(name: string, age: number): Person {
239
- return { name, age };
240
- }
241
-
242
- // mod.ts
243
- export { createPerson } from "./my-file.js";
244
- export type { Person } from "./my-file.js";
245
- ```
246
-
247
- #### Minimize dependencies; do not make circular imports.
248
-
249
- Try not to introduce external dependencies if you can avoid doing so.
250
- In particular, be careful not to introduce circular imports.
251
-
252
- #### If a filename starts with an underscore: `_foo.ts`, do not link to it.
253
-
254
- There may be situations where an internal module is necessary but its API is not
255
- meant to be stable or linked to. In this case prefix it with an underscore. By
256
- convention, only files in its own directory should import it.
257
-
258
- #### Use JSDoc for exported symbols.
259
-
260
- We strive for complete documentation. Every exported symbol ideally should have
261
- a documentation line.
262
-
263
- If possible, use a single line for the JSDoc. Example:
264
-
265
- ```ts
266
- /** foo does bar. */
267
- export function foo() {
268
- // ...
269
- }
270
- ```
271
-
272
- It is important that documentation is easily human-readable, but there is also a
273
- need to provide additional styling information to ensure generated documentation
274
- is more rich text. Therefore JSDoc should generally follow markdown markup to
275
- enrich the text.
276
-
277
- While markdown supports HTML tags, it is forbidden in JSDoc blocks.
278
-
279
- Code string literals should be braced with the back-tick (\`) instead of quotes.
280
- For example:
281
-
282
- ```ts
283
- /** Import something from the `foundation` module. */
284
- ```
285
-
286
- Do not document function arguments unless they are non-obvious of their intent
287
- (though if they are non-obvious intent, the API should be considered anyways).
288
- Therefore `@param` should generally not be used. If `@param` is used, it should
289
- not include the `type` as TypeScript is already strongly-typed.
290
-
291
- ```ts
292
- /**
293
- * Function with non-obvious param.
294
- * @param foo Description of non-obvious parameter.
295
- */
296
- ```
297
-
298
- Vertical spacing should be minimized whenever possible. Therefore, single-line
299
- comments should be written as:
300
-
301
- ```ts
302
- /** This is a good single-line JSDoc. */
303
- ```
304
-
305
- And not:
306
-
307
- ```ts
308
- /**
309
- * This is a bad single-line JSDoc.
310
- */
311
- ```
312
-
313
- Code examples should utilize markdown format, like so:
314
-
315
- ````ts
316
- /** A straightforward comment and an example:
317
- * ```ts
318
- * import { foo } from "foundation.js";
319
- * foo("bar");
320
- * ```
321
- */
322
- ````
323
-
324
- Code examples should not contain additional comments and must not be indented.
325
- It is already inside a comment. If it needs further comments, it is not a good
326
- example.
327
-
328
- #### Resolve linting problems using directives
329
-
330
- Currently, the building process uses `eslint` to lint the code. If the task
331
- requires code that is non-conformant to linter use `eslint-disable-next-line
332
- <code>` directive to suppress the warning.
333
-
334
- ```typescript
335
- /** Constructor type for defining `LitElement` mixins. */
336
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
337
- export type LitElementConstructor = new (...args: any[]) => LitElement;
338
- ```
339
-
340
- This ensures the continuous integration process doesn't fail due to linting
341
- problems, but it should be used scarcely.
342
-
343
- #### Each module should come with a test module.
344
-
345
- Every module with public functionality `foo.ts` should come with a test module
346
- `foo.spec.ts`. This file should be a sibling to the tested module.
347
-
348
- #### Top-level functions should not use arrow syntax.
349
-
350
- Top-level functions should use the `function` keyword. Arrow syntax should be
351
- limited to closures.
352
-
353
- Bad:
354
-
355
- ```ts
356
- export const foo = (): string => {
357
- return 'bar';
358
- };
359
- ```
360
-
361
- Good:
362
-
363
- ```ts
364
- export function foo(): string {
365
- return 'bar';
366
- }
367
- ```
368
-
369
- #### Prefer `#` over `private`
370
-
371
- We prefer the private fields (`#`) syntax over `private` keyword of TypeScript
372
- in the standard modules codebase. The private fields make the properties and
373
- methods private even at runtime. On the other hand, `private` keyword of
374
- TypeScript guarantee it private only at compile time and the fields are publicly
375
- accessible at runtime.
376
-
377
- Good:
378
-
379
- ```ts
380
- class MyClass {
381
- #foo = 1;
382
- #bar() {}
383
- }
384
- ```
385
-
386
- Bad:
387
-
388
- ```ts
389
- class MyClass {
390
- private foo = 1;
391
- private bar() {}
392
- }
393
- ```
@@ -1 +0,0 @@
1
- export default { extends: ['@commitlint/config-conventional'] };
@@ -1,42 +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
- ? 'menu'
10
- : 'editor';
11
- const requireDoc = window.confirm(
12
- 'Does the plugin require a loaded document? (OK=yes, Cancel=no)')
13
- ;
14
- const name =
15
- window.prompt('Plugin name', 'My plugin') ||
16
- 'Default plugin name';
17
- const icon =
18
- window.prompt('Plugin icon (material icon name)', 'extension') ||
19
- 'extension';
20
- const active = true;
21
- const src =
22
- window.prompt(
23
- 'Plugin source URI',
24
- `/demo/DemoPluginSrc.js?${Date.now()}`
25
- ) || 'data:text/javascript,';
26
- const plugin = { name, src, icon, active, requireDoc };
27
- if (
28
- !window.confirm(
29
- `Add ${kind} plugin ${JSON.stringify(plugin, null, ' ')}?`)
30
-
31
- )
32
- return;
33
- editor.plugins = {
34
- ...editor.plugins,
35
- [kind]: [
36
- ...(editor.plugins[kind] || []),
37
- plugin,
38
- ],
39
- }
40
- editor.requestUpdate('plugins');
41
- }
42
- }
@@ -1,9 +0,0 @@
1
-
2
- /* eslint-disable no-alert */
3
- export default class DemoPluginSrc extends HTMLElement {
4
- /* eslint-disable-next-line class-methods-use-this */
5
- run() {
6
- console.log(`${this.tagName}.run()`);
7
- }
8
- }
9
-
@@ -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>
package/demo/index.html DELETED
@@ -1,95 +0,0 @@
1
- <!doctype html>
2
- <title>OpenSCD Shell Demo</title>
3
- <link
4
- rel="stylesheet"
5
- href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap"
6
- />
7
- <link
8
- rel="stylesheet"
9
- href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
10
- />
11
- <link
12
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined"
13
- rel="stylesheet"
14
- />
15
-
16
- <oscd-shell></oscd-shell>
17
-
18
- <script type="module">
19
- import '../dist/oscd-shell.js';
20
-
21
- const plugins = {
22
- menu: [
23
- {
24
- name: 'Add plugins...',
25
- translations: { de: 'Erweitern...' },
26
- icon: 'extension',
27
- active: true,
28
- src: '/demo/AddPlugins.js',
29
- },
30
- {
31
- name: 'Open File',
32
- translations: { de: 'Datei öffnen' },
33
- icon: 'folder_open',
34
- active: true,
35
- src: 'https://openenergytools.github.io/oscd-open/oscd-open.js',
36
- },
37
- {
38
- name: 'Save File',
39
- translations: { de: 'Datei öffnen' },
40
- icon: 'save',
41
- active: true,
42
- src: 'https://openenergytools.github.io/oscd-save/oscd-save.js',
43
- },
44
- ],
45
- editor: [
46
- {
47
- name: 'Start',
48
- translations: {
49
- de: 'Start',
50
- },
51
- icon: 'start',
52
- active: true,
53
- src: 'https://openenergytools.github.io/scl-editor-landing/scl-editor-landing.js',
54
- },
55
-
56
- {
57
- name: 'Substation',
58
- icon: 'margin',
59
- active: true,
60
- requireDoc: true,
61
- src: 'https://openenergytools.github.io/scl-substation-editor/scl-substation-editor.js',
62
- },
63
- {
64
- name: 'Design SLD',
65
- translations: {
66
- de: 'Designer',
67
- },
68
- icon: 'add_box',
69
- active: true,
70
- requireDoc: true,
71
- src: 'https://openenergytools.github.io/oscd-designer/oscd-designer.js',
72
- },
73
- ],
74
- };
75
-
76
- const editor = document.querySelector('oscd-shell');
77
- const params = new URL(document.location).searchParams;
78
- for (const [name, value] of params) {
79
- editor.setAttribute(name, value);
80
- }
81
- editor.plugins = plugins;
82
- </script>
83
-
84
- <style>
85
- html,
86
- body {
87
- width: 100%;
88
- height: 100%;
89
- }
90
-
91
- * {
92
- margin: 0px;
93
- padding: 0px;
94
- }
95
- </style>
@@ -1,27 +0,0 @@
1
- /**
2
- * Hashes `str` using the cyrb64 variant of
3
- * https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js
4
- * @returns digest - a rather insecure hash, very quickly
5
- */
6
- export function cyrb64(str: string): string {
7
- /* eslint-disable no-bitwise */
8
- let h1 = 0xdeadbeef;
9
- let h2 = 0x41c6ce57;
10
- /* eslint-disable-next-line no-plusplus */
11
- for (let i = 0, ch; i < str.length; i++) {
12
- ch = str.charCodeAt(i);
13
- h1 = Math.imul(h1 ^ ch, 2654435761);
14
- h2 = Math.imul(h2 ^ ch, 1597334677);
15
- }
16
- h1 =
17
- Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^
18
- Math.imul(h2 ^ (h2 >>> 13), 3266489909);
19
- h2 =
20
- Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^
21
- Math.imul(h1 ^ (h1 >>> 13), 3266489909);
22
- return (
23
- (h2 >>> 0).toString(16).padStart(8, '0') +
24
- (h1 >>> 0).toString(16).padStart(8, '0')
25
- );
26
- /* eslint-enable no-bitwise */
27
- }