Compare commits

..

24 Commits

Author SHA1 Message Date
00a2de6560 1.0.32 2020-06-03 14:09:21 +00:00
b357bc67fa fix(core): update 2020-06-03 14:09:21 +00:00
0665f85d49 1.0.31 2020-06-01 15:56:33 +00:00
c222a66ead fix(core): update 2020-06-01 15:56:32 +00:00
8d628d3285 1.0.30 2020-06-01 15:07:13 +00:00
681de01143 fix(core): update 2020-06-01 15:07:13 +00:00
070d894ea6 1.0.29 2020-06-01 13:22:55 +00:00
6a6d782288 fix(core): update 2020-06-01 13:22:54 +00:00
ec1660cab5 1.0.28 2020-06-01 13:18:52 +00:00
5f182ba435 fix(core): update 2020-06-01 13:18:51 +00:00
f73df83768 1.0.27 2020-05-28 00:06:26 +00:00
0b09f3f61c fix(core): update 2020-05-28 00:06:25 +00:00
d2e0a55a13 1.0.26 2020-05-27 22:49:51 +00:00
fb1fc7fa6b fix(core): update 2020-05-27 22:49:50 +00:00
374a3c58c4 1.0.25 2020-05-27 22:34:06 +00:00
b36846737b fix(core): update 2020-05-27 22:34:06 +00:00
b16c6948b2 1.0.24 2020-05-27 22:13:50 +00:00
2a51d7a7cd fix(core): update 2020-05-27 22:13:50 +00:00
b12f35484d 1.0.23 2020-05-24 20:09:38 +00:00
7fe861f577 fix(core): update 2020-05-24 20:09:37 +00:00
ac999adfcb 1.0.22 2020-05-24 19:37:43 +00:00
fdd6e38e0c fix(core): update 2020-05-24 19:37:43 +00:00
88ed2f294f 1.0.21 2020-05-23 14:00:49 +00:00
dcca98c535 fix(core): update 2020-05-23 14:00:49 +00:00
9 changed files with 895 additions and 393 deletions

1109
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,32 @@
{
"name": "@designestate/dees-wcctools",
"version": "1.0.20",
"version": "1.0.32",
"private": false,
"description": "wcc tools for creating element catalogues",
"main": "dist_ts_web/index.js",
"typings": "dist_ts_web/index.d.ts",
"scripts": {
"test": "npm run build",
"build": "tsbuild custom ts_web --web",
"test": "(npm run build)",
"build": "(tsbuild custom ts_web --web && tsbundle element)",
"watch": "tswatch element"
},
"author": "Lossless GmbH",
"license": "UNLICENSED",
"dependencies": {
"@gitzone/tsrun": "^1.1.17",
"@designestate/dees-domtools": "^1.0.28",
"@gitzone/tsrun": "^1.2.12",
"@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartexpress": "^3.0.10",
"lit-element": "^2.0.0-rc.5",
"lit-html": "^1.0.0-rc.2",
"typescript": "^3.2.2"
"typescript": "^3.9.3"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.8",
"@gitzone/tswatch": "^1.0.30",
"@pushrocks/projectinfo": "^4.0.2",
"tslint": "^5.11.0",
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsbundle": "^1.0.69",
"@gitzone/tswatch": "^1.0.46",
"@pushrocks/projectinfo": "^4.0.5",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.17.0"
},
"files": [
@ -37,5 +40,8 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 2 Chrome versions"
]
}

View File

@ -18,6 +18,10 @@ wcc tools for creating element catalogues
## Usage
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
## Contribution

View File

@ -1,5 +1,7 @@
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
import * as plugins from '../wcctools.plugins';
import { WccDefaultElement } from './wcc-defaultelement';
// wcc tools
@ -10,22 +12,29 @@ import './wcc-properties';
@customElement('wcc-dashboard')
export class WccDashboard extends LitElement {
@property()
public selectedItem: TemplateResult | LitElement = WccDefaultElement as any;
public selectedItem: TemplateResult | LitElement;
@property()
public selectedInstance;
public selectedViewport: plugins.deesDomtools.breakpoints.TViewport = 'desktop';
@property()
public selectedViewport: string = 'desktop';
public pages: { [key: string]: TemplateResult } = {};
@property()
public pages: TemplateResult[] = [];
public elements: { [key: string]: LitElement } = {};
@property()
public elements: LitElement[] = [];
public warning: string = null;
constructor() {
constructor(elementsArg?: { [key: string]: LitElement }, pagesArg?: { [key: string]: TemplateResult }) {
super();
if (elementsArg) {
this.elements = elementsArg;
}
if (pagesArg) {
this.pages = pagesArg;
}
}
public render(): TemplateResult {
@ -45,7 +54,7 @@ export class WccDashboard extends LitElement {
<wcc-sidebar .pages=${this.pages} .elements=${this.elements} @selectedItem=${eventArg => {
this.selectedItem = eventArg.detail;
}}></wcc-sidebar>
<wcc-properties .selectedItem=${this.selectedItem} .selectedInstance=${this.selectedInstance} @selectedViewport=${eventArg => {this.selectedViewport = eventArg.detail; this.updateSlot();}}></wcc-properties>
<wcc-properties .warning="${this.warning}" .selectedItem=${this.selectedItem} @selectedViewport=${eventArg => {this.selectedViewport = eventArg.detail; this.updateSlot();}}></wcc-properties>
<wcc-frame id="wccFrame" viewport=${this.selectedViewport}>
${(() => {
if (this.selectedItem instanceof TemplateResult) {
@ -53,28 +62,49 @@ export class WccDashboard extends LitElement {
} else if (this.selectedItem) {
console.log(this.selectedItem);
const anonItem: any = this.selectedItem;
if (anonItem.demo) {
return html`${anonItem.demo}`;
} else {
alert(`component does not expose a demo property.`);
if (!anonItem.demo) {
this.setWarning(`component ${anonItem.name} does not expose a demo property.`);
return;
}
if (!(typeof anonItem.demo === 'function')) {
this.setWarning(`component ${anonItem.name} has demo property, but it is not of type function`);
return;
}
this.setWarning(null);
return html`${anonItem.demo()}`;
} else {
this.updateSlot();
}
})()}
</wcc-frame>
${this.selectedViewport}
`;
}
public updateSlot() {
console.log('updateSlot');
const oldSelectedItem = this.selectedItem;
private currentlyUpdating: boolean = false;
public async updateSlot() {
if (this.currentlyUpdating) {
return;
}
this.currentlyUpdating = true;
!this.selectedItem ? this.selectedItem = WccDefaultElement as any : null;
const localSelectedItem = this.selectedItem;
this.selectedItem = null;
console.log('updateSlot');
const domtools = await plugins.deesDomtools.DomTools.setupDomTools();
domtools.setVirtualViewport(this.selectedViewport);
await super.performUpdate();
this.selectedItem = localSelectedItem;
await super.performUpdate();
this.currentlyUpdating = false;
}
public setWarning(warningTextArg: string) {
if (this.warning !== warningTextArg) {
console.log(warningTextArg);
this.warning = warningTextArg;
setTimeout(() => {
this.selectedItem = oldSelectedItem;
super.performUpdate();
}, 0);
}
}
}

View File

@ -3,10 +3,7 @@ import { TemplateResult } from 'lit-html';
@customElement('wcc-defaultelement')
export class WccDefaultElement extends LitElement {
public static demo = html`<wcc-defaultelement></wcc-defaultelement>`;
@property()
public footerText = `Lossless GmbH - 2018`;
public static demo = () => html`<wcc-defaultelement></wcc-defaultelement>`;
constructor() {
super();

View File

@ -1,11 +1,6 @@
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
const breakpoints = {
desktop: 1240,
tablet: 700,
phablet: 500,
phone: 340,
};
import * as domtools from '@designestate/dees-domtools';
@customElement('wcc-frame')
export class WccFrame extends LitElement {
@ -33,19 +28,26 @@ export class WccFrame extends LitElement {
`;
case 'tablet':
return `
padding: 0px ${(document.body.clientWidth - 200 - breakpoints.tablet) / 2}px;
padding: 0px ${
(document.body.clientWidth - 200 - domtools.breakpoints.tablet) / 2
}px;
`;
case 'phablet':
return `
padding: 0px ${(document.body.clientWidth - 200 - breakpoints.phablet) / 2}px;
padding: 0px ${
(document.body.clientWidth - 200 - domtools.breakpoints.phablet) / 2
}px;
`;
case 'phone':
return `
padding: 0px ${(document.body.clientWidth - 200 - breakpoints.phone) / 2}px;
padding: 0px ${
(document.body.clientWidth - 200 - domtools.breakpoints.phone) / 2
}px;
`;
}
})()}
}
.viewport {
position: relative;
${this.viewport !== 'desktop'

View File

@ -14,10 +14,10 @@ export class WccProperties extends LitElement {
public selectedItem: TemplateResult | LitElement;
@property()
public selectedInstance;
public selectedViewport = 'native';
@property()
public selectedViewport = 'native';
public warning: string = null;
public render(): TemplateResult {
return html`
@ -98,6 +98,18 @@ export class WccProperties extends LitElement {
color: #333;
background: #fff;
}
.warning {
position: absolute;
background: #800000;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
text-align: center;
padding: 20px;
font-size: 25px;
}
</style>
<div class="grid">
<div class="properties">
@ -111,15 +123,7 @@ export class WccProperties extends LitElement {
returnArray.push(
html`
<div class="property">
${key} / ${classProperties.get(key).type.name} /
<pre>
${(() => {
const result = this.selectedInstance
? JSON.stringify(this.selectedInstance[key], null, 2)
: null;
return result;
})()}</pre
>
${key} / ${classProperties.get(key).type.name}
</div>
`
);
@ -167,6 +171,9 @@ ${(() => {
</div>
<div class="docs">Docs</div>
</div>
${this.warning ? html`<div class="warning">
${this.warning}
</div>` : null}
`;
}

View File

@ -1,5 +1,19 @@
import { WccDashboard } from './elements/wcc-dashboard';
import { LitElement, TemplateResult } from 'lit-element';
const setupWccTools = (elementsArg?: { [key: string]: LitElement }, pagesArg?: { [key: string]: TemplateResult }) => {
let hasRun = false;
const runWccToolsSetup = async () => {
if (document.readyState === 'complete' && !hasRun) {
hasRun = true;
const wccTools = new WccDashboard(elementsArg as any, pagesArg);
document.querySelector('body').append(wccTools);
}
};
document.addEventListener('readystatechange', runWccToolsSetup);
runWccToolsSetup();
};
export {
WccDashboard
setupWccTools
};

View File

@ -0,0 +1,11 @@
import * as smartdelay from '@pushrocks/smartdelay';
export {
smartdelay
};
import * as deesDomtools from '@designestate/dees-domtools';
export {
deesDomtools
};