Compare commits

..

12 Commits

Author SHA1 Message Date
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
bb46890b58 1.0.20 2020-05-23 13:13:59 +00:00
4c3c7f18fc fix(core): update 2020-05-23 13:13:58 +00:00
942670a733 1.0.19 2020-05-11 00:36:58 +00:00
c0900e265b fix(core): update 2020-05-11 00:36:58 +00:00
10 changed files with 1316 additions and 106 deletions

View File

@ -21,6 +21,6 @@
<script src="../ts_web/index.ts"></script>
</head>
<body>
<></>
<wcc-dashboard></wcc-dashboard>
</body>
</html>

834
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,31 @@
{
"name": "@losslessone_private/dees-wcctools",
"version": "1.0.18",
"name": "@designestate/dees-wcctools",
"version": "1.0.24",
"private": false,
"description": "website for lossless.com",
"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": {
"@designestate/dees-domtools": "^1.0.21",
"@gitzone/tsrun": "^1.1.17",
"@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/parcel-plugin-wrapper": "^1.0.5",
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tsbundle": "^1.0.69",
"@gitzone/tswatch": "^1.0.46",
"@pushrocks/projectinfo": "^4.0.2",
"tslint": "^5.11.0",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.17.0"
},
"files": [
@ -38,5 +39,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

@ -0,0 +1,105 @@
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
import * as deesDomtools from '@designestate/dees-domtools';
import { WccDefaultElement } from './wcc-defaultelement';
// wcc tools
import './wcc-frame';
import './wcc-sidebar';
import './wcc-properties';
@customElement('wcc-dashboard')
export class WccDashboard extends LitElement {
@property()
public selectedItem: TemplateResult | LitElement = WccDefaultElement as any;
@property()
public selectedInstance;
@property()
public selectedViewport: deesDomtools.breakpoints.TViewport = 'desktop';
@property()
public pages: { [key: string]: TemplateResult } = {};
@property()
public elements: { [key: string]: LitElement } = {};
@property()
public warning: string = null;
constructor(elementsArg?: { [key: string]: LitElement }, pagesArg?: { [key: string]: TemplateResult }) {
super();
if (elementsArg) {
this.elements = elementsArg;
}
if (pagesArg) {
this.pages = pagesArg;
}
}
public render(): TemplateResult {
return html`
<style>
@import url('https://fonts.googleapis.com/css?family=Roboto');
:host {
font-family: 'Roboto', sans-serif;
background: #fcfcfc;
display: block;
box-sizing: border-box;
}
:host([hidden]) {
display: none;
}
</style>
<wcc-sidebar .pages=${this.pages} .elements=${this.elements} @selectedItem=${eventArg => {
this.selectedItem = eventArg.detail;
}}></wcc-sidebar>
<wcc-properties .warning="${this.warning}" .selectedItem=${this.selectedItem} .selectedInstance=${this.selectedInstance} @selectedViewport=${eventArg => {this.selectedViewport = eventArg.detail; this.updateSlot();}}></wcc-properties>
<wcc-frame id="wccFrame" viewport=${this.selectedViewport}>
${(() => {
if (this.selectedItem instanceof TemplateResult) {
return this.selectedItem;
} else if (this.selectedItem) {
console.log(this.selectedItem);
const anonItem: any = this.selectedItem;
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.selectedItem = WccDefaultElement as any;
}
})()}
</wcc-frame>
${this.selectedViewport}
`;
}
public async updateSlot() {
console.log('updateSlot');
const oldSelectedItem = this.selectedItem;
this.selectedItem = null;
const domtools = await deesDomtools.DomTools.setupDomTools();
domtools.setVirtualViewport(this.selectedViewport);
this.selectedItem = oldSelectedItem;
}
public setWarning(warningTextArg: string) {
if (this.warning !== warningTextArg) {
console.log(warningTextArg);
this.warning = warningTextArg;
setTimeout(() => {
super.performUpdate();
}, 0);
}
}
}

View File

@ -1,8 +1,10 @@
import { LitElement, property, html, customElement } from 'lit-element';
import { TemplateResult } from 'lit-html';
@customElement('lele-element')
export class LeleElement extends LitElement {
@customElement('wcc-defaultelement')
export class WccDefaultElement extends LitElement {
public static demo = () => html`<wcc-defaultelement></wcc-defaultelement>`;
@property()
public footerText = `Lossless GmbH - 2018`;
@ -20,16 +22,20 @@ export class LeleElement extends LitElement {
@import url('https://fonts.googleapis.com/css?family=Roboto');
:host {
font-family: 'Roboto', sans-serif;
background: #FCFCFC;
background: #333;
text-align: center;
padding:30px;
box-shadow: 0px 0px 5px rgba(0,0,0,0.6);
display: block;
box-sizing: border-box;
color: #fff;
font-size: 30px;
}
:host([hidden]) {
display: none;
}
</style>
<slot></slot>
No Element specified!
`;
}
}

View File

@ -0,0 +1,71 @@
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
const breakpoints = {
desktop: 1240,
tablet: 700,
phablet: 500,
phone: 340,
};
@customElement('wcc-frame')
export class WccFrame extends LitElement {
@property()
public viewport: string;
public render(): TemplateResult {
return html`
<style>
:host {
border: 10px solid #ffaeaf;
background: #222;
position: absolute;
left: 200px;
right: 0px;
top: 0px;
bottom: 100px;
overflow-y: auto;
overflow-x: auto;
${(() => {
switch (this.viewport) {
case 'desktop':
return `
padding: 0px 0px;
`;
case 'tablet':
return `
padding: 0px ${(document.body.clientWidth - 200 - breakpoints.tablet) / 2}px;
`;
case 'phablet':
return `
padding: 0px ${(document.body.clientWidth - 200 - breakpoints.phablet) / 2}px;
`;
case 'phone':
return `
padding: 0px ${(document.body.clientWidth - 200 - breakpoints.phone) / 2}px;
`;
}
})()}
}
.viewport {
position: relative;
${this.viewport !== 'desktop'
? html` border-right: 1px dotted #444; border-left: 1px dotted #444; `
: html``}
min-height: 100%;
background:
radial-gradient(#444444 3px, transparent 4px),
radial-gradient(#444444 3px, transparent 4px),
linear-gradient(#222222 4px, transparent 0),
linear-gradient(45deg, transparent 74px, transparent 75px, #444444 75px, #444444 76px, transparent 77px, transparent 109px),
linear-gradient(-45deg, transparent 75px, transparent 76px, #444444 76px, #444444 77px, transparent 78px, transparent 109px),
#222222;
background-size: 109px 109px, 109px 109px,100% 6px, 109px 109px, 109px 109px;
background-position: 54px 55px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
}
</style>
<div class="viewport">
<slot></slot>
</div>
`;
}
}

View File

@ -0,0 +1,200 @@
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
export type TEnvironment = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
let environment: TEnvironment = 'native';
export const setEnvironment = envArg => {
environment = envArg;
};
@customElement('wcc-properties')
export class WccProperties extends LitElement {
@property()
public selectedItem: TemplateResult | LitElement;
@property()
public selectedInstance;
@property()
public selectedViewport = 'native';
@property()
public warning: string = null;
public render(): TemplateResult {
return html`
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<style>
:host {
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
position: absolute;
left: 200px;
height: 100px;
bottom: 0px;
right: 0px;
overflow: hidden;
background: #111;
color: #fff;
}
.grid {
display: grid;
grid-template-columns: auto 300px 70px;
}
.properties {
border-right: 1px solid #999;
height: 100px;
overflow-y: auto;
display: grid;
grid-template-columns: 33% 33% 33%;
}
.properties .property {
padding: 5px;
background: #444;
border: 1px solid #000;
}
.viewports {
border-right: 1px solid #999;
}
.viewport-selectors {
display: grid;
grid-template-columns: 25% 25% 25% 25%;
}
.viewport {
padding: 10px;
text-align: center;
border: 1px solid #000;
transition: all 0.2s;
}
.viewport:hover {
cursor: pointer;
color: #333;
background: #fff;
}
.viewport.selected {
background: #455A64;
}
.viewport.selected:hover {
cursor: pointer;
color: #ffffff;
background: #455a64;
}
.panelheading {
padding: 5px;
font-weight: bold;
background: #444;
border: 1px solid #000;
}
.docs {
text-align: center;
line-height: 100px;
text-transform: uppercase;
}
.docs:hover {
cursor: pointer;
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">
<div class="panelheading">Properties</div>
${(() => {
if (this.selectedItem && !(this.selectedItem instanceof TemplateResult)) {
const anonItem: any = this.selectedItem;
const classProperties: Map<string, any> = anonItem._classProperties;
const returnArray: TemplateResult[] = [];
for (const key of classProperties.keys()) {
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
>
</div>
`
);
}
return returnArray;
}
})()}
</div>
<div class="viewports">
<div class="panelheading">Viewports</div>
<div class="viewport-selectors">
<div
class="viewport ${this.selectedViewport === 'phone' ? 'selected' : null}"
@click=${() => {
this.selectViewport('phone');
}}
>
Phone<br /><i class="material-icons">smartphone</i>
</div>
<div
class="viewport ${this.selectedViewport === 'phablet' ? 'selected' : null}"
@click=${() => {
this.selectViewport('phablet');
}}
>
Phablet<br /><i class="material-icons">smartphone</i>
</div>
<div
class="viewport ${this.selectedViewport === 'tablet' ? 'selected' : null}"
@click=${() => {
this.selectViewport('tablet');
}}
>
Tablet<br /><i class="material-icons">tablet</i>
</div>
<div
class="viewport ${this.selectedViewport === 'desktop' || this.selectedViewport === 'native' ? 'selected' : null}"
@click=${() => {
this.selectViewport('native');
}}
>
Desktop<br /><i class="material-icons">desktop_windows</i>
</div>
</div>
</div>
<div class="docs">Docs</div>
</div>
${this.warning ? html`<div class="warning">
${this.warning}
</div>` : null}
`;
}
public selectViewport(viewport: TEnvironment) {
this.selectedViewport = viewport;
setEnvironment(viewport);
this.dispatchEvent(
new CustomEvent('selectedViewport', {
detail: viewport
})
);
}
}

View File

@ -0,0 +1,150 @@
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
@customElement('wcc-sidebar')
export class WccSidebar extends LitElement {
@property({type: Array})
public websites: string[] = [];
@property()
public pages: { [key: string]: TemplateResult } = {};
@property()
public elements: { [key: string]: LitElement } = {};
@property({ attribute: false })
public selectedItem: LitElement | TemplateResult;
public render(): TemplateResult {
return html`
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<style>
:host {
display: block;
border-right: 1px solid #999;
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
position: absolute;
left: 0px;
width: 200px;
top: 0px;
bottom: 0px;
overflow-y: scroll;
overflow-x: hidden;
background: #222;
color: #fff;
padding: 5px;
}
.heading {
font-size: 24px;
text-align: center;
margin: 20px 5px 5px 5px;
}
.subheading {
text-align: center;
}
.selectOption {
position: relative;
line-height: 24px;
padding: 5px;
transition: all 0.2s;
display: grid;
grid-template-columns: 28px auto;
}
.selectOption:hover {
cursor: pointer;
padding: 5px;
color: #333;
background: #fff;
}
.selectOption.selected {
background: #455A64;;
}
.selectOption.selected:hover {
cursor: pointer;
color: #ffffff;
background: #455A64;
}
.selectOption .material-icons {
color: #666;
display: block;
transition: all 0.2s;
}
.selectOption.selected .material-icons {
color: #000;
}
.selectOption .text {
display: block;
word-wrap: break-word;
word-break: break-all;
max-width: 100%;
}
</style>
<div class="heading">
lele-catalog
</div>
<div class="subheading">
Lossless GmbH
</div>
<div class="menu">
<h3>Live Websites</h3>
${this.websites.map(website => {
return html`<div class="selectOption"><i class="material-icons">ondemand_video</i><div class="text">${website}</div></div>`;
})}
<h3>Pages</h3>
${(() => {
const pages = Object.keys(this.pages);
return pages.map(pageName => {
const item = this.pages[pageName];
return html`
<div
class="selectOption ${this.selectedItem === item ? 'selected' : console.log('hi')}"
@click=${() => {
this.selectItem(item);
}}
>
<i class="material-icons">insert_drive_file</i>
<div class="text">${pageName}</div>
</div>
`;
});
})()}
<h3>Elements</h3>
${(() => {
const elements = Object.keys(this.elements);
return elements.map(elementName => {
const item = this.elements[elementName];
return html`
<div
class="selectOption ${this.selectedItem === item ? 'selected' : console.log('hi')}"
@click=${() => {
this.selectItem(item);
}}
>
<i class="material-icons">featured_video</i>
<div class="text">${elementName}</div>
</div>
`;
});
})()}
</menu>
`;
}
public selectItem(item: TemplateResult | LitElement) {
console.log('selected item');
this.selectedItem = item;
this.dispatchEvent(
new CustomEvent('selectedItem', {
detail: item
})
);
}
}

View File

@ -1,5 +1,19 @@
import { LeleElement } from './elements/lele-element';
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 {
LeleElement
setupWccTools
};