From 77d058f403a577fd23de3ad34f7b542efcd5004a Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 27 Sep 2021 14:45:05 +0200 Subject: [PATCH] fix(core): update --- package-lock.json | 28 +++++++-------- ts_web/elements/wcc-properties.ts | 57 +++++++++++++++---------------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/package-lock.json b/package-lock.json index a28af2e..25f4cda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1819,14 +1819,14 @@ } }, "node_modules/@designestate/dees-comms": { - "version": "1.0.10", - "resolved": "https://verdaccio.lossless.one/@designestate%2fdees-comms/-/dees-comms-1.0.10.tgz", - "integrity": "sha512-IqzZWYS8Pk/nHzD4zCpOr4dTKCb887DXVRQeApmAiwoGJaFhTMhEPmUs1XJPG5c4EXFxZ1v0vsSrmysc3uEPtg==", + "version": "1.0.11", + "resolved": "https://verdaccio.lossless.one/@designestate%2fdees-comms/-/dees-comms-1.0.11.tgz", + "integrity": "sha512-dli893c4j7SLkby9fF8vcXMS5KRdQOREQrPARoNISKnLJFAHyQHm8w2uOPmSIJXPvYF3Sx3a9iOmijUVU9IxjQ==", "license": "MIT", "dependencies": { "@apiglobal/typedrequest": "^1.0.58", "@apiglobal/typedrequest-interfaces": "^1.0.15", - "broadcast-channel": "^4.2.0" + "broadcast-channel": "^3.7.0" } }, "node_modules/@designestate/dees-domtools": { @@ -4600,9 +4600,9 @@ } }, "node_modules/broadcast-channel": { - "version": "4.2.0", - "resolved": "https://verdaccio.lossless.one/broadcast-channel/-/broadcast-channel-4.2.0.tgz", - "integrity": "sha512-XX9yNnIy/v2T+HR5EKIH7ziM2mYTefsrzZ2lkCmFZxwCDG7Ns7HLIooUXA114sCeFRJ4MEXEgdMapxfPDh9Xkg==", + "version": "3.7.0", + "resolved": "https://verdaccio.lossless.one/broadcast-channel/-/broadcast-channel-3.7.0.tgz", + "integrity": "sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.7.2", @@ -16792,13 +16792,13 @@ } }, "@designestate/dees-comms": { - "version": "1.0.10", - "resolved": "https://verdaccio.lossless.one/@designestate%2fdees-comms/-/dees-comms-1.0.10.tgz", - "integrity": "sha512-IqzZWYS8Pk/nHzD4zCpOr4dTKCb887DXVRQeApmAiwoGJaFhTMhEPmUs1XJPG5c4EXFxZ1v0vsSrmysc3uEPtg==", + "version": "1.0.11", + "resolved": "https://verdaccio.lossless.one/@designestate%2fdees-comms/-/dees-comms-1.0.11.tgz", + "integrity": "sha512-dli893c4j7SLkby9fF8vcXMS5KRdQOREQrPARoNISKnLJFAHyQHm8w2uOPmSIJXPvYF3Sx3a9iOmijUVU9IxjQ==", "requires": { "@apiglobal/typedrequest": "^1.0.58", "@apiglobal/typedrequest-interfaces": "^1.0.15", - "broadcast-channel": "^4.2.0" + "broadcast-channel": "^3.7.0" } }, "@designestate/dees-domtools": { @@ -19080,9 +19080,9 @@ } }, "broadcast-channel": { - "version": "4.2.0", - "resolved": "https://verdaccio.lossless.one/broadcast-channel/-/broadcast-channel-4.2.0.tgz", - "integrity": "sha512-XX9yNnIy/v2T+HR5EKIH7ziM2mYTefsrzZ2lkCmFZxwCDG7Ns7HLIooUXA114sCeFRJ4MEXEgdMapxfPDh9Xkg==", + "version": "3.7.0", + "resolved": "https://verdaccio.lossless.one/broadcast-channel/-/broadcast-channel-3.7.0.tgz", + "integrity": "sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==", "requires": { "@babel/runtime": "^7.7.2", "detect-node": "^2.1.0", diff --git a/ts_web/elements/wcc-properties.ts b/ts_web/elements/wcc-properties.ts index 0df8e35..cc4321f 100644 --- a/ts_web/elements/wcc-properties.ts +++ b/ts_web/elements/wcc-properties.ts @@ -1,11 +1,4 @@ -import { - LitElement, - property, - html, - customElement, - TemplateResult, - state, -} from 'lit-element'; +import { LitElement, property, html, customElement, TemplateResult, state } from 'lit-element'; import { WccDashboard } from './wcc-dashboard'; export type TPropertyType = 'String' | 'Number' | 'Boolean' | 'Object' | 'Enum' | 'Array'; @@ -25,7 +18,7 @@ export class WccProperties extends LitElement { dashboardRef: WccDashboard; @property() - public selectedItem: TemplateResult | LitElement; + public selectedItem: (() => TemplateResult) | LitElement; @property() public selectedViewport: TEnvironment = 'native'; @@ -73,7 +66,8 @@ export class WccProperties extends LitElement { border: 1px solid #000; } - .properties input, .properties select { + .properties input, + .properties select { display: block; width: 100%; background: #333; @@ -81,7 +75,6 @@ export class WccProperties extends LitElement { color: #fff; } - .viewportSelector, .themeSelector { user-select: none; @@ -220,7 +213,8 @@ export class WccProperties extends LitElement { } public async createProperties() { - console.log('creating properties'); + console.log('creating properties for:'); + console.log(this.selectedItem); const isEnumeration = (propertyArg): boolean => { const keys = Object.keys(propertyArg.type); const values = []; @@ -240,7 +234,7 @@ export class WccProperties extends LitElement { }; const getEnumValues = (propertyArg): any[] => { console.log(JSON.stringify(propertyArg)); - const enumValues : any[] = []; + const enumValues: any[] = []; Object.keys(propertyArg.type).forEach((valueArg: string) => { enumValues.push(valueArg); }); @@ -258,11 +252,10 @@ export class WccProperties extends LitElement { : 'Object'; } }; - if (this.selectedItem && !((this.selectedItem as any)._classProperties)) { + if (this.selectedItem && (this.selectedItem as any).demo) { + console.log(`Got Dees-Element for property evaluation.`); const anonItem: any = this.selectedItem; - if (!anonItem._classProperties) { - return html`You have selected a page!`; - } + console.log(anonItem.elementProperties); const wccFrame = await this.dashboardRef.wccFrame; let selectedElement: HTMLElement; for (const element of Array.from(wccFrame.children)) { @@ -271,11 +264,10 @@ export class WccProperties extends LitElement { break; } } - console.log(selectedElement); - const classProperties: Map = anonItem._classProperties; + const classProperties: Map = anonItem.elementProperties; const propertyArray: TemplateResult[] = []; for (const key of classProperties.keys()) { - if (key === 'goBright' || key === 'domtools') { + if (key === 'goBright' || key === 'domtools') { continue; } const property = classProperties.get(key); @@ -283,7 +275,7 @@ export class WccProperties extends LitElement { propertyArray.push( html`
- ${key} / ${propertyTypeString}
+ ${key} / ${propertyTypeString}
${(() => { switch (propertyTypeString) { case 'Boolean': @@ -313,14 +305,20 @@ export class WccProperties extends LitElement { case 'Enum': const enumValues: any[] = getEnumValues(property); return html``; } })()} @@ -330,6 +328,7 @@ export class WccProperties extends LitElement { } this.propertyContent = propertyArray; } else { + console.log(`Cannot extract properties of ${(this.selectedItem as any)?.name}`) return null; } }