diff --git a/package-lock.json b/package-lock.json index 9f5f2e7bf3..5c5795a0f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2320,6 +2320,40 @@ "lit": "^2.2.7" } }, + "node_modules/@compas-oscd/open-scd": { + "version": "0.34.43", + "resolved": "file:packages/compas-open-scd/compas-oscd-open-scd-0.34.43.tgz", + "integrity": "sha512-fe6COfqbvAUPbnH/PUEuzAEhrS+LqPIDHOeAXtQNTuYMIGm/l9LEaZOoLyWKtV/kBOxAFbhzdBFFNC5j7Aq6Vg==", + "license": "Apache-2.0", + "dependencies": { + "@compas-oscd/core": "^0.1.23", + "@compas-oscd/xml": "^0.0.1", + "@material/mwc-dialog": "0.22.1", + "@material/mwc-drawer": "0.22.1", + "@material/mwc-fab": "0.22.1", + "@material/mwc-formfield": "0.22.1", + "@material/mwc-icon": "0.22.1", + "@material/mwc-icon-button": "0.22.1", + "@material/mwc-icon-button-toggle": "0.22.1", + "@material/mwc-linear-progress": "0.22.1", + "@material/mwc-list": "0.22.1", + "@material/mwc-menu": "0.22.1", + "@material/mwc-select": "0.22.1", + "@material/mwc-snackbar": "0.22.1", + "@material/mwc-switch": "0.22.1", + "@material/mwc-tab": "0.22.1", + "@material/mwc-tab-bar": "0.22.1", + "@material/mwc-textarea": "0.22.1", + "@material/mwc-textfield": "0.22.1", + "@material/mwc-top-app-bar-fixed": "0.22.1", + "@openscd/oscd-api": "^0.1.5", + "ace-custom-element": "^1.6.5", + "lit": "^2.2.7", + "lit-translate": "^1.2.1", + "marked": "^4.0.10", + "panzoom": "^9.4.2" + } + }, "node_modules/@compas-oscd/xml": { "version": "0.0.1", "license": "Apache-2.0" @@ -30806,6 +30840,7 @@ "license": "Apache-2.0", "dependencies": { "@compas-oscd/core": "^0.1.23", + "@compas-oscd/open-scd": "file:compas-oscd-open-scd-0.34.43.tgz", "@compas-oscd/xml": "^0.0.1", "@material/mwc-dialog": "0.22.1", "@material/mwc-drawer": "0.22.1", diff --git a/packages/compas-open-scd/package.json b/packages/compas-open-scd/package.json index c352e3c01a..8633226c5d 100644 --- a/packages/compas-open-scd/package.json +++ b/packages/compas-open-scd/package.json @@ -19,6 +19,7 @@ "type": "module", "dependencies": { "@compas-oscd/core": "^0.1.23", + "@compas-oscd/open-scd": "file:compas-oscd-open-scd-0.34.43.tgz", "@compas-oscd/xml": "^0.0.1", "@material/mwc-dialog": "0.22.1", "@material/mwc-drawer": "0.22.1", diff --git a/packages/compas-open-scd/src/addons/CompasHistory.ts b/packages/compas-open-scd/src/addons/CompasHistory.ts index 66edb74293..446e357652 100644 --- a/packages/compas-open-scd/src/addons/CompasHistory.ts +++ b/packages/compas-open-scd/src/addons/CompasHistory.ts @@ -9,16 +9,16 @@ import '@material/mwc-list'; import '@material/mwc-list/mwc-list-item'; import '@material/mwc-snackbar'; -import '@openscd/open-scd/src/filtered-list.js'; +import '@compas-oscd/open-scd/filtered-list.js'; import { IssueDetail } from '@compas-oscd/core'; import { HistoryUIDetail, OscdHistory, -} from '@openscd/open-scd/src/addons/History.js'; +} from '@compas-oscd/open-scd/dist/addons/History.js'; import { wizards } from '@openscd/plugins/src/wizards/wizard-library'; -import { newWizardEvent, SCLTag } from '@openscd/open-scd/src/foundation'; +import { newWizardEvent, SCLTag } from '@compas-oscd/open-scd/dist/foundation.js'; import { nothing } from 'lit-html'; export enum HistoryUIKind { diff --git a/packages/compas-open-scd/src/addons/CompasLayout.ts b/packages/compas-open-scd/src/addons/CompasLayout.ts index d1d515a0b9..52eb4986bd 100644 --- a/packages/compas-open-scd/src/addons/CompasLayout.ts +++ b/packages/compas-open-scd/src/addons/CompasLayout.ts @@ -8,12 +8,12 @@ import { get } from 'lit-translate'; import type { UserInfoEvent } from '../compas/foundation'; -import { OscdLayout } from '@openscd/open-scd/src/addons/Layout.js'; +import { OscdLayout } from '@compas-oscd/open-scd/dist/addons/Layout.js'; @customElement('compas-layout') export class CompasLayout extends OscdLayout { - @property({ type: String }) username: string | undefined; + @property({ type: String }) username: string | undefined = 'God Emperor Testus'; connectedCallback(): void { super.connectedCallback(); @@ -27,9 +27,9 @@ export class CompasLayout extends OscdLayout { } protected renderActionItems(): TemplateResult { - return html` + return this.componentHtml` ${this.username != undefined - ? html` { - return staticTagHtml`<${tag} - .doc=${this.doc} - .docName=${this.docName} - .editCount=${this.editCount} - .plugins=${this.storedPlugins} - .docId=${this.docId} - .pluginId=${plugin.src} - .nsdoc=${this.nsdoc} - .docs=${this.docs} - .locale=${this.locale} - .oscdApi=${new OscdApi(tag)} - .editor=${this.editor} - .compasApi=${this.compasApi} - class="${classMap({ - plugin: true, - menu: plugin.kind === 'menu', - validator: plugin.kind === 'validator', - editor: plugin.kind === 'editor', - })}" - >`; + content: { + tag }, }; } @@ -549,7 +532,7 @@ export interface MenuItem { actionItem?: boolean; action?: (event: CustomEvent) => void; disabled?: () => boolean; - content: () => TemplateResult; + content: ContentContext; kind: string; } @@ -602,46 +585,6 @@ export interface CompasApi { }; } -/** - * This is a template literal tag function. See: - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates - * - * Passes its arguments to LitElement's `html` tag after combining the first and - * last expressions with the first two and last two static strings. - * Throws unless the first and last expressions are identical strings. - * - * We need this to get around the expression location limitations documented in - * https://lit.dev/docs/templates/expressions/#expression-locations - * - * After upgrading to Lit 2 we can use their static HTML functions instead: - * https://lit.dev/docs/api/static-html/ - */ -function staticTagHtml( - oldStrings: ReadonlyArray, - ...oldArgs: unknown[] -): TemplateResult { - const args = [...oldArgs]; - const firstArg = args.shift(); - const lastArg = args.pop(); - - if (firstArg !== lastArg) - throw new Error( - `Opening tag <${firstArg}> does not match closing tag .` - ); - - const strings = [...oldStrings] as string[] & { raw: string[] }; - const firstString = strings.shift(); - const secondString = strings.shift(); - - const lastString = strings.pop(); - const penultimateString = strings.pop(); - - strings.unshift(`${firstString}${firstArg}${secondString}`); - strings.push(`${penultimateString}${lastArg}${lastString}`); - - return html(strings, ...args); -} - function withoutContent

( plugin: P ): P {