Skip to content

Commit

Permalink
With oscd open (#1394)
Browse files Browse the repository at this point in the history
* Added openscd/core

* Removed dist folder from core

* Delete packages/core/.tsbuildinfo

* Delete packages/open-scd/public/js/dist/plugins.dev.js

* Removed dist folder

* Reverted german xlf

* chore: Added deprecated `doc` property

* Added build step for core

* Chore: Added oscd-open to Editing mixin

* Added deprecation notes to OpenDocEvent

* Remove oscd-open plugin

* Remove dist folder

* Reverted open-scd snapshot

* Removed open-scd.controller
  • Loading branch information
pascalwilbrink authored Jan 10, 2024
1 parent 758a3b8 commit 4c15c01
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 22 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ jobs:
with:
node-version: '18.x'

- name: Install and Build
- name: Install and build Core
run: |
cd packages/core
npm clean-install
npm run-script build
- name: Install and Build OpenSCD
run: |
cd packages/open-scd
npm clean-install
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"packages/*"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cd packages/open-scd && npm run start"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions packages/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tsbuildinfo

dist/
node_modules/
3 changes: 3 additions & 0 deletions packages/core/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ export type {
} from './foundation/edit-event.js';

export { cyrb64 } from './foundation/cyrb64.js';

export { Editing } from './mixins/Editing.js';
export { Plugging } from './mixins/Plugging.js';
23 changes: 23 additions & 0 deletions packages/core/locales.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Do not modify this file by hand!
// Re-generate this file by running lit-localize.

/**
* The locale code that templates in this source code are written in.
*/
export const sourceLocale = `en`;

/**
* The other locale codes that this application is localized into. Sorted
* lexicographically.
*/
export const targetLocales = [
`de`,
] as const;

/**
* All valid project locale codes. Sorted lexicographically.
*/
export const allLocales = [
`de`,
`en`,
] as const;
14 changes: 14 additions & 0 deletions packages/core/locales/de.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

// Do not modify this file by hand!
// Re-generate this file by running lit-localize




/* eslint-disable no-irregular-whitespace */
/* eslint-disable @typescript-eslint/no-explicit-any */

export const templates = {

};

2 changes: 1 addition & 1 deletion packages/core/localization/de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
</trans-unit>
</body>
</file>
</xliff>
</xliff>
10 changes: 1 addition & 9 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@openscd/open-scd-core",
"name": "@openscd/core",
"version": "1.0.1",
"description": "The core editor component of open-scd, without any extensions pre-installed.",
"author": "Open-SCD",
Expand Down Expand Up @@ -35,14 +35,6 @@
},
"dependencies": {
"@lit/localize": "^0.11.4",
"@material/mwc-button": "^0.27.0",
"@material/mwc-dialog": "^0.27.0",
"@material/mwc-drawer": "^0.27.0",
"@material/mwc-icon": "^0.27.0",
"@material/mwc-icon-button": "^0.27.0",
"@material/mwc-list": "^0.27.0",
"@material/mwc-tab-bar": "^0.27.0",
"@material/mwc-top-app-bar-fixed": "^0.27.0",
"@open-wc/lit-helpers": "^0.5.1",
"lit": "^2.2.7"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/open-scd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"lit": "^2.2.7",
"lit-translate": "^1.2.1",
"marked": "^4.0.10",
"panzoom": "^9.4.2"
"panzoom": "^9.4.2",
"@openscd/core": "*"
},
"scripts": {
"lint:eslint": "eslint --ext .ts,.html . --ignore-path .gitignore",
Expand Down
4 changes: 2 additions & 2 deletions packages/open-scd/public/js/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,6 @@ export const officialPlugins = [
default: false,
kind: 'menu',
requireDoc: true,
position: 'middle'
}
position: 'middle',
},
];
11 changes: 11 additions & 0 deletions packages/open-scd/src/Editing.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { OpenEvent } from '@openscd/core';
import { property } from 'lit-element';
import { get } from 'lit-translate';

Expand Down Expand Up @@ -428,6 +429,10 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
this.dispatchEvent(newValidateEvent());
}

/**
*
* @deprecated [Move to handleOpenDoc instead]
*/
private async onOpenDoc(event: OpenDocEvent) {
this.doc = event.detail.doc;
this.docName = event.detail.docName;
Expand All @@ -445,11 +450,17 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {
);
}

handleOpenDoc({ detail: { docName, doc } }: OpenEvent) {
this.doc = doc;
this.docName = docName;
}

constructor(...args: any[]) {
super(...args);

this.addEventListener('editor-action', this.onAction);
this.addEventListener('open-doc', this.onOpenDoc);
this.addEventListener('oscd-open', this.handleOpenDoc);
}
}

Expand Down
11 changes: 9 additions & 2 deletions packages/open-scd/src/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ export type WizardInputElement =
| TextField
| (AceEditor & {
checkValidity: () => boolean;
validityTransform: (newValue: string, nativeValidity: ValidityState) => ValidityState;
validityTransform: (
newValue: string,
nativeValidity: ValidityState
) => ValidityState;
validationMessage: string;
validity: ValidityState;
label: string;
Expand Down Expand Up @@ -437,6 +440,10 @@ export interface PendingStateDetail {
promise: Promise<void>;
}
export type PendingStateEvent = CustomEvent<PendingStateDetail>;

/**
* @deprecated
*/
export function newPendingStateEvent(
promise: Promise<void>,
eventInitDict?: CustomEventInit<Partial<PendingStateDetail>>
Expand Down Expand Up @@ -1559,7 +1566,7 @@ const sCLTags = [
'SecPerSamples',
] as const;

export type SCLTag = typeof sCLTags[number];
export type SCLTag = (typeof sCLTags)[number];

const tagSet = new Set<string>(sCLTags);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* @web/test-runner snapshot v1 */
export const snapshots = {};

snapshots["open-scd looks like its snapshot"] =
`<mwc-drawer
snapshots['open-scd looks like its snapshot'] = `<mwc-drawer
class="mdc-theme--surface"
hasheader=""
id="menu"
Expand Down Expand Up @@ -1411,4 +1410,3 @@ snapshots["open-scd looks like its snapshot"] =
</mwc-linear-progress>
`;
/* end snapshot open-scd looks like its snapshot */

0 comments on commit 4c15c01

Please sign in to comment.