Compare commits

..

No commits in common. "master" and "v1.0.73" have entirely different histories.

22 changed files with 17692 additions and 4747 deletions

View File

@ -1,66 +0,0 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -1,124 +0,0 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

View File

@ -13,24 +13,31 @@ stages:
- metadata - metadata
before_script: before_script:
- pnpm install -g pnpm - npm install -g @shipzone/npmci
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
# ==================== mirror:
# security stage stage: security
# ==================== script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- lossless
- docker - docker
allow_failure: true allow_failure: true
@ -38,10 +45,11 @@ auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --dev - npmci command npm audit --audit-level=high --only=dev
tags: tags:
- lossless
- docker - docker
allow_failure: true allow_failure: true
@ -52,6 +60,7 @@ auditDevDependencies:
testStable: testStable:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
@ -62,9 +71,10 @@ testStable:
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@ -112,9 +122,11 @@ trigger:
pages: pages:
stage: metadata stage: metadata
script: script:
- npmci node install stable - npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command npm run buildDocs - npmci command tsdoc
tags: tags:
- lossless - lossless
- docker - docker

View File

@ -1,5 +1,5 @@
<!--gitzone element--> <!--gitzone element-->
<!-- made by Task Venture Capital GmbH --> <!-- made by Lossless GmbH -->
<!-- checkout https://maintainedby.lossless.com for awesome OpenSource projects --> <!-- checkout https://maintainedby.lossless.com for awesome OpenSource projects -->
<html lang="en"> <html lang="en">
<head> <head>
@ -10,10 +10,6 @@
/> />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--Lets load standard fonts-->
<link rel="preconnect" href="https://assetbroker.lossless.one/" crossorigin>
<link rel="stylesheet" href="https://assetbroker.lossless.one/fonts/fonts.css">
<style> <style>
body { body {
margin: 0px; margin: 0px;

View File

@ -1,6 +1,6 @@
// dees tools // dees tools
import * as deesWccTools from '../ts_web/index.js'; import * as deesWccTools from '../ts_web/index.js';
import * as deesDomTools from '@design.estate/dees-domtools'; import * as deesDomTools from '@designestate/dees-domtools';
// elements and pages // elements and pages
import * as elements from '../test/elements/index.js'; import * as elements from '../test/elements/index.js';

View File

@ -2,32 +2,17 @@
"gitzone": { "gitzone": {
"projectType": "wcc", "projectType": "wcc",
"module": { "module": {
"githost": "code.foss.global", "githost": "gitlab.com",
"gitscope": "designestate", "gitscope": "designestate",
"gitrepo": "dees-wcctools", "gitrepo": "dees-wcctools",
"description": "A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.", "description": "wcc tools for creating element catalogues",
"npmPackagename": "@designestate/dees-wcctools", "npmPackagename": "@designestate/dees-wcctools",
"license": "MIT", "license": "MIT",
"projectDomain": "design.estate", "projectDomain": "design.estate"
"keywords": [
"web components",
"element catalogues",
"custom elements",
"documentation",
"typescript",
"lit",
"component development",
"design system",
"element testing",
"page development"
]
} }
}, },
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
} }
} }

17458
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +1,32 @@
{ {
"name": "@design.estate/dees-wcctools", "name": "@designestate/dees-wcctools",
"version": "1.0.90", "version": "1.0.73",
"private": false, "private": false,
"description": "A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.", "description": "wcc tools for creating element catalogues",
"main": "dist_ts_web/index.js", "main": "dist_ts_web/index.js",
"typings": "dist_ts_web/index.d.ts", "typings": "dist_ts_web/index.d.ts",
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "(npm run build)", "test": "(npm run build)",
"build": "(tsbuild element --web --allowimplicitany && tsbundle element)", "build": "(tsbuild element --web --allowimplicitany --skiplibcheck && tsbundle element)",
"watch": "tswatch element", "watch": "tswatch element"
"buildDocs": "tsdoc"
}, },
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"@design.estate/dees-domtools": "^2.0.57", "@designestate/dees-domtools": "^2.0.1",
"@design.estate/dees-element": "^2.0.34", "@designestate/dees-element": "^2.0.4",
"@push.rocks/smartdelay": "^3.0.5", "@gitzone/tsrun": "^1.2.31",
"lit": "^3.1.3" "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartexpress": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@api.global/typedserver": "^3.0.29", "@gitzone/tsbuild": "^2.1.61",
"@git.zone/tsbuild": "^2.1.72", "@gitzone/tsbundle": "^1.0.101",
"@git.zone/tsbundle": "^2.0.15", "@gitzone/tswatch": "^1.0.73",
"@git.zone/tsrun": "^1.2.44", "@pushrocks/projectinfo": "^4.0.5",
"@git.zone/tswatch": "^2.0.23", "tslint": "^6.1.3",
"@push.rocks/projectinfo": "^5.0.2" "tslint-config-prettier": "^1.17.0"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@ -42,17 +42,5 @@
], ],
"browserslist": [ "browserslist": [
"last 1 Chrome versions" "last 1 Chrome versions"
],
"keywords": [
"web components",
"element catalogues",
"custom elements",
"documentation",
"typescript",
"lit",
"component development",
"design system",
"element testing",
"page development"
] ]
} }

4230
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@

134
readme.md
View File

@ -1,117 +1,41 @@
# @design.estate/dees-wcctools # @designestate/dees-wcctools
wcc tools for creating element catalogues wcc tools for creating element catalogues
## Install ## Availabililty and Links
To install `@design.estate/dees-wcctools`, you can use npm: * [npmjs.org (npm package)](https://www.npmjs.com/package/@designestate/dees-wcctools)
* [gitlab.com (source)](https://gitlab.com/designestate/dees-wcctools)
* [github.com (source mirror)](https://github.com/designestate/dees-wcctools)
* [docs (typedoc)](https://designestate.gitlab.io/dees-wcctools/)
```bash ## Status for master
npm install @design.estate/dees-wcctools --save
``` Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/designestate/dees-wcctools/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/designestate/dees-wcctools/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@designestate/dees-wcctools)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/designestate/dees-wcctools)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@designestate/dees-wcctools)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@designestate/dees-wcctools)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@designestate/dees-wcctools)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
The `@design.estate/dees-wcctools` package provides a set of tools for creating element catalogues using Web Components. It leverages LitElement for creating custom elements and provides a structured way to showcase and test these elements in various environments and themes.
### Setting Up ## Contribution
First, ensure that your project is set up to use TypeScript and ESM syntax. This guide assumes you have a basic understanding of TypeScript and modern JavaScript development practices.
Start by importing the necessary tools from `@design.estate/dees-wcctools` in your main TypeScript file. 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). :)
```typescript ## Contribution
import { setupWccTools } from '@design.estate/dees-wcctools';
```
### Defining Custom Elements 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). :)
Define your custom elements using LitElement. Here's a simple example of an element:
```typescript For further information read the linked docs at the top of this readme.
import { LitElement, html, customElement } from 'lit';
@customElement('my-element') > MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
class MyElement extends LitElement { | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
render() {
return html`<p>Hello, world!</p>`;
}
}
```
### Bootstrapping the WCCTools Dashboard [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
To showcase your elements, `@design.estate/dees-wcctools` provides a handy way to bootstrap a dashboard where your elements can be registered and displayed.
Create a bootstrap function in your main file or a separate module:
```typescript
async function bootstrapWCCTools() {
// Define your elements here
const elements = {
'my-element': MyElement, // Assuming MyElement is imported
};
// Optionally, define pages as functions returning Lit HTML Templates
const pages = {
home: () => html`<h1>Welcome to My Element Catalogue</h1>`,
};
// Setup the WCCTools dashboard
setupWccTools(elements, pages);
}
```
Call this function to initialize your catalogue:
```typescript
bootstrapWCCTools();
```
### Configurations and Customizations
The `setupWccTools` function accepts two arguments: `elements` and `pages`.
- `elements`: An object where keys are element tags (e.g., 'my-element') and values are the corresponding class definitions.
- `pages`: An optional object where keys are page identifiers and values are functions returning Lit HTML templates.
### Testing Elements
Once the dashboard is set up, navigate to your project in a web browser. You'll see a sidebar listing all registered elements and pages. Clicking on an element name will display it in the main view, allowing you to interact with it and see it in action.
### Theme and Environment Testing
The dashboard also provides options for testing your elements in different environments (e.g., desktop, tablet) and themes (light or dark). This helps ensure that your elements are versatile and adaptable to varying conditions.
### Expanding Your Catalogue
To add more elements to your catalogue, simply extend the `elements` object and rerun `bootstrapWCCTools()`. This modular approach makes it easy to maintain and expand your element catalogue.
### Leveraging TypeScript
Using TypeScript allows you to enforce typing and build more reliable web components. Define properties with decorators, and use TypeScript's features to enhance your component development process.
```typescript
import { LitElement, property, html, customElement } from 'lit';
@customElement('typed-element')
class TypedElement extends LitElement {
@property({type: String})
name: string = 'World';
render() {
return html`<p>Hello, ${this.name}!</p>`;
}
}
```
### Conclusion
`@design.estate/dees-wcctools` provides a powerful, flexible platform for developing, showcasing, and testing web components. By leveraging modern development practices like TypeScript and LitElement, you can build a robust catalogue of reusable web components ready for any project.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -1,14 +1,14 @@
import { import {
DeesElement, DeesElement,
customElement, customElement,
type TemplateResult, TemplateResult,
html, html,
property, property,
css, css,
cssManager, cssManager,
} from '@design.estate/dees-element'; } from '@designestate/dees-element';
import * as domtools from '@design.estate/dees-domtools'; import * as domtools from '@designestate/dees-domtools';
enum ETestEnum { enum ETestEnum {
'first' = 'first', 'first' = 'first',

View File

@ -1,8 +0,0 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@design.estate/dees-wcctools',
version: '1.0.90',
description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
}

View File

@ -1,4 +1,4 @@
import { DeesElement, property, html, customElement, type TemplateResult, queryAsync, render, domtools } from '@design.estate/dees-element'; import { DeesElement, property, html, customElement, TemplateResult, queryAsync } from '@designestate/dees-element';
import * as plugins from '../wcctools.plugins.js'; import * as plugins from '../wcctools.plugins.js';
@ -6,9 +6,9 @@ import * as plugins from '../wcctools.plugins.js';
import './wcc-frame.js'; import './wcc-frame.js';
import './wcc-sidebar.js'; import './wcc-sidebar.js';
import './wcc-properties.js'; import './wcc-properties.js';
import { type TTheme } from './wcc-properties.js'; import { TTheme } from './wcc-properties.js';
import { type TElementType } from './wcc-sidebar.js'; import { TElementType } from './wcc-sidebar.js';
import { breakpoints } from '@design.estate/dees-domtools'; import { breakpoints } from '@designestate/dees-domtools';
import { WccFrame } from './wcc-frame.js'; import { WccFrame } from './wcc-frame.js';
@customElement('wcc-dashboard') @customElement('wcc-dashboard')
@ -61,6 +61,7 @@ export class WccDashboard extends DeesElement {
return html` return html`
<style> <style>
:host { :host {
font-family: 'Roboto', sans-serif;
background: #fcfcfc; background: #fcfcfc;
display: block; display: block;
box-sizing: border-box; box-sizing: border-box;
@ -97,6 +98,32 @@ export class WccDashboard extends DeesElement {
}} }}
></wcc-properties> ></wcc-properties>
<wcc-frame id="wccFrame" viewport=${this.selectedViewport}> <wcc-frame id="wccFrame" viewport=${this.selectedViewport}>
${(() => {
if (this.selectedType === 'page' && this.selectedItem) {
if (typeof this.selectedItem === 'function') {
console.log('slotting page.');
return this.selectedItem();
} else {
console.error('The selected item looks strange:');
console.log(this.selectedItem);
}
} else if (this.selectedType === 'element' && this.selectedItem) {
console.log('slotting element.');
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()}`;
}
})()}
</wcc-frame> </wcc-frame>
`; `;
} }
@ -133,43 +160,24 @@ export class WccDashboard extends DeesElement {
); );
} }
public async updated(changedPropertiesArg: Map<string, any>) { private updating = false;
public async updated() {
if (this.updating) {
return;
}
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools(); this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
await this.domtools.router._handleRouteState(); await this.domtools.router._handleRouteState();
this.updating = true;
const storeElement = this.selectedItem; const storeElement = this.selectedItem;
const wccFrame: WccFrame = this.shadowRoot.querySelector('wcc-frame'); setTimeout(async () => {
this.selectedItem = null;
if (changedPropertiesArg.has('selectedItemName')) { setTimeout(async () => {
document.title = this.selectedItemName; this.selectedItem = storeElement;
}; setTimeout(() => {
this.updating = false;
if (this.selectedType === 'page' && this.selectedItem) { }, 0);
if (typeof this.selectedItem === 'function') { });
console.log('slotting page.'); }, 0);
const viewport = await wccFrame.getViewportElement();
render(this.selectedItem(), viewport);
console.log('rendered page.');
} else {
console.error('The selected item looks strange:');
console.log(this.selectedItem);
}
} else if (this.selectedType === 'element' && this.selectedItem) {
console.log('slotting element.');
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);
const viewport = await wccFrame.getViewportElement();
render(anonItem.demo(), viewport);;
}
} }
public buildUrl() { public buildUrl() {

View File

@ -1,46 +1,25 @@
import { DeesElement, property, html, customElement, type TemplateResult, css, cssManager } from '@design.estate/dees-element'; import { DeesElement, property, html, customElement, TemplateResult } from '@designestate/dees-element';
import * as domtools from '@design.estate/dees-domtools'; import * as domtools from '@designestate/dees-domtools';
declare global {
interface HTMLElementTagNameMap {
'wcc-frame': WccFrame;
}
}
@customElement('wcc-frame') @customElement('wcc-frame')
export class WccFrame extends DeesElement { export class WccFrame extends DeesElement {
@property() @property()
public viewport: string; public viewport: string;
public static styles = [ public render(): TemplateResult {
css` return html`
<style>
:host { :host {
border: 10px solid #ffaeaf; border: 10px solid #ffaeaf;
position: absolute; position: absolute;
background: ${cssManager.bdTheme('#333', '#000')}; background: ${this.goBright ? '#333': '#000'};
left: 200px; left: 200px;
right: 0px; right: 0px;
top: 0px; top: 0px;
bottom: 100px; bottom: 100px;
overflow-y: auto; overflow-y: auto;
overflow-x: auto; overflow-x: auto;
overscroll-behavior: contain;
}
.viewport {
container-type: inline-size;
container-name: wccToolsViewport;
position: relative;
min-height: 100%;
}
`,
]
public render(): TemplateResult {
return html`
<style>
:host {
${(() => { ${(() => {
switch (this.viewport) { switch (this.viewport) {
case 'desktop': case 'desktop':
@ -70,13 +49,15 @@ export class WccFrame extends DeesElement {
} }
.viewport { .viewport {
container-type: inline-size;
container-name: wccToolsViewport;
position: relative;
${this.viewport !== 'desktop' ${this.viewport !== 'desktop'
? html` border-right: 1px dotted #444; border-left: 1px dotted #444; ` ? html` border-right: 1px dotted #444; border-left: 1px dotted #444; `
: html`` : html``}
} min-height: 100%;
background: background:
${ ${this.goBright ? `
this.goBright ? `
radial-gradient(#CCCCCC 3px, transparent 4px), radial-gradient(#CCCCCC 3px, transparent 4px),
radial-gradient(#CCCCCC 3px, transparent 4px), radial-gradient(#CCCCCC 3px, transparent 4px),
linear-gradient(#eeeeee 4px, transparent 0), linear-gradient(#eeeeee 4px, transparent 0),
@ -94,12 +75,11 @@ export class WccFrame extends DeesElement {
#222222; #222222;
background-size: 109px 109px, 109px 109px,100% 6px, 109px 109px, 109px 109px; background-size: 109px 109px, 109px 109px,100% 6px, 109px 109px, 109px 109px;
background-position: 54px 55px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; background-position: 54px 55px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
` `}
}
} }
</style> </style>
<div class="viewport"> <div class="viewport">
<slot></slot>
</div> </div>
`; `;
} }
@ -109,8 +89,4 @@ export class WccFrame extends DeesElement {
const slottedContent = this.children; const slottedContent = this.children;
console.log(slottedContent); console.log(slottedContent);
} }
public async getViewportElement(): Promise<HTMLElement> {
return this.shadowRoot.querySelector('.viewport') as HTMLElement;
}
} }

View File

@ -1,4 +1,4 @@
import { DeesElement, property, html, customElement, type TemplateResult, state } from '@design.estate/dees-element'; import { DeesElement, property, html, customElement, TemplateResult, state } from '@designestate/dees-element';
import { WccDashboard } from './wcc-dashboard.js'; import { WccDashboard } from './wcc-dashboard.js';
export type TPropertyType = 'String' | 'Number' | 'Boolean' | 'Object' | 'Enum' | 'Array'; export type TPropertyType = 'String' | 'Number' | 'Boolean' | 'Object' | 'Enum' | 'Array';
@ -36,6 +36,7 @@ export class WccProperties extends DeesElement {
public render(): TemplateResult { public render(): TemplateResult {
return html` return html`
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<style> <style>
:host { :host {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
@ -61,21 +62,6 @@ export class WccProperties extends DeesElement {
grid-template-columns: 33% 33% 33%; grid-template-columns: 33% 33% 33%;
} }
.material-symbols-outlined {
font-family: 'Material Symbols Outlined';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}
.properties .property { .properties .property {
padding: 5px; padding: 5px;
background: #444; background: #444;
@ -111,6 +97,7 @@ export class WccProperties extends DeesElement {
transition: all 0.2s; transition: all 0.2s;
} }
.button:hover { .button:hover {
cursor: pointer;
color: #333; color: #333;
background: #fff; background: #fff;
} }
@ -120,6 +107,7 @@ export class WccProperties extends DeesElement {
} }
.button.selected:hover { .button.selected:hover {
cursor: pointer;
color: #ffffff; color: #ffffff;
background: #455a64; background: #455a64;
} }
@ -137,6 +125,7 @@ export class WccProperties extends DeesElement {
} }
.docs:hover { .docs:hover {
cursor: pointer;
color: #333; color: #333;
background: #fff; background: #fff;
} }
@ -168,7 +157,7 @@ export class WccProperties extends DeesElement {
this.selectTheme('dark'); this.selectTheme('dark');
}} }}
> >
Dark<br /><i class="material-symbols-outlined">brightness_3</i> Dark<br /><i class="material-icons">brightness_3</i>
</div> </div>
<div <div
class="button ${this.selectedTheme === 'bright' ? 'selected' : null}" class="button ${this.selectedTheme === 'bright' ? 'selected' : null}"
@ -176,7 +165,7 @@ export class WccProperties extends DeesElement {
this.selectTheme('bright'); this.selectTheme('bright');
}} }}
> >
Bright<br /><i class="material-symbols-outlined">flare</i> Bright<br /><i class="material-icons">flare</i>
</div> </div>
</div> </div>
</div> </div>
@ -189,7 +178,7 @@ export class WccProperties extends DeesElement {
this.selectViewport('phone'); this.selectViewport('phone');
}} }}
> >
Phone<br /><i class="material-symbols-outlined">smartphone</i> Phone<br /><i class="material-icons">smartphone</i>
</div> </div>
<div <div
class="button ${this.selectedViewport === 'phablet' ? 'selected' : null}" class="button ${this.selectedViewport === 'phablet' ? 'selected' : null}"
@ -197,7 +186,7 @@ export class WccProperties extends DeesElement {
this.selectViewport('phablet'); this.selectViewport('phablet');
}} }}
> >
Phablet<br /><i class="material-symbols-outlined">smartphone</i> Phablet<br /><i class="material-icons">smartphone</i>
</div> </div>
<div <div
class="button ${this.selectedViewport === 'tablet' ? 'selected' : null}" class="button ${this.selectedViewport === 'tablet' ? 'selected' : null}"
@ -205,7 +194,7 @@ export class WccProperties extends DeesElement {
this.selectViewport('tablet'); this.selectViewport('tablet');
}} }}
> >
Tablet<br /><i class="material-symbols-outlined">tablet</i> Tablet<br /><i class="material-icons">tablet</i>
</div> </div>
<div <div
class="button ${this.selectedViewport === 'desktop' || class="button ${this.selectedViewport === 'desktop' ||
@ -216,7 +205,7 @@ export class WccProperties extends DeesElement {
this.selectViewport('native'); this.selectViewport('native');
}} }}
> >
Desktop<br /><i class="material-symbols-outlined">desktop_windows</i> Desktop<br /><i class="material-icons">desktop_windows</i>
</div> </div>
</div> </div>
</div> </div>
@ -254,7 +243,7 @@ export class WccProperties extends DeesElement {
}); });
return enumValues; return enumValues;
}; };
const determinePropertyType = async (propertyArg: any): Promise<TPropertyType> => { const determinePropertyType = (propertyArg: any): TPropertyType => {
const typeName: any | undefined = propertyArg.type.name; const typeName: any | undefined = propertyArg.type.name;
if (typeName) { if (typeName) {
return typeName; return typeName;
@ -276,7 +265,7 @@ export class WccProperties extends DeesElement {
console.log(anonItem.elementProperties); console.log(anonItem.elementProperties);
const wccFrame = await this.dashboardRef.wccFrame; const wccFrame = await this.dashboardRef.wccFrame;
let firstFoundInstantiatedElement: HTMLElement; let firstFoundInstantiatedElement: HTMLElement;
for (const element of Array.from((await wccFrame.getViewportElement()).children)) { for (const element of Array.from(wccFrame.children)) {
if (element instanceof (this.selectedItem as any)) { if (element instanceof (this.selectedItem as any)) {
firstFoundInstantiatedElement = element as HTMLElement; firstFoundInstantiatedElement = element as HTMLElement;
break; break;
@ -298,7 +287,7 @@ export class WccProperties extends DeesElement {
continue; continue;
} }
const property = classProperties.get(key); const property = classProperties.get(key);
const propertyTypeString = await determinePropertyType(property); const propertyTypeString = determinePropertyType(property);
propertyArray.push( propertyArray.push(
html` html`
<div class="property"> <div class="property">

View File

@ -1,11 +1,14 @@
import * as plugins from '../wcctools.plugins.js'; import * as plugins from '../wcctools.plugins.js';
import { DeesElement, property, html, customElement, type TemplateResult } from '@design.estate/dees-element'; import { DeesElement, property, html, customElement, TemplateResult } from '@designestate/dees-element';
import { WccDashboard } from './wcc-dashboard.js'; import { WccDashboard } from './wcc-dashboard.js';
export type TElementType = 'element' | 'page'; export type TElementType = 'element' | 'page';
@customElement('wcc-sidebar') @customElement('wcc-sidebar')
export class WccSidebar extends DeesElement { export class WccSidebar extends DeesElement {
@property({type: Array})
public websites: string[] = [];
@property({ attribute: false }) @property({ attribute: false })
public selectedItem: DeesElement | (() => TemplateResult); public selectedItem: DeesElement | (() => TemplateResult);
@ -22,8 +25,7 @@ export class WccSidebar extends DeesElement {
:host { :host {
display: block; display: block;
border-right: 1px solid #999; border-right: 1px solid #999;
font-family: 'Roboto', 'Inter', sans-serif; font-family: 'Roboto', sans-serif;
font-size: 12px;
box-sizing: border-box; box-sizing: border-box;
position: absolute; position: absolute;
left: 0px; left: 0px;
@ -37,23 +39,21 @@ export class WccSidebar extends DeesElement {
padding: 5px; padding: 5px;
} }
.material-symbols-outlined { .heading {
font-family: 'Material Symbols Outlined'; font-size: 24px;
font-weight: normal; text-align: center;
font-style: normal; margin: 20px 5px 5px 5px;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 48;
} }
.heading a {
text-decoration: none;
color: #fff;
}
.subheading {
text-align: center;
}
.selectOption { .selectOption {
user-select: none;
position: relative; position: relative;
line-height: 24px; line-height: 24px;
padding: 5px; padding: 5px;
@ -62,6 +62,7 @@ export class WccSidebar extends DeesElement {
grid-template-columns: 28px auto; grid-template-columns: 28px auto;
} }
.selectOption:hover { .selectOption:hover {
cursor: pointer;
padding: 5px; padding: 5px;
color: #333; color: #333;
background: #fff; background: #fff;
@ -72,17 +73,18 @@ export class WccSidebar extends DeesElement {
} }
.selectOption.selected:hover { .selectOption.selected:hover {
cursor: pointer;
color: #ffffff; color: #ffffff;
background: #455A64; background: #455A64;
} }
.selectOption .material-symbols-outlined { .selectOption .material-icons {
color: #666; color: #666;
display: block; display: block;
transition: all 0.2s; transition: all 0.2s;
} }
.selectOption.selected .material-symbols-outlined { .selectOption.selected .material-icons {
color: #000; color: #000;
} }
@ -95,7 +97,17 @@ export class WccSidebar extends DeesElement {
</style> </style>
<div class="heading">
<a href="https://gitlab.com/designestate/dees-wcctools" target="_blank">wcctools</a>
</div>
<div class="subheading">
by Lossless GmbH
</div>
<div class="menu"> <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> <h3>Pages</h3>
${(() => { ${(() => {
const pages = Object.keys(this.dashboardRef.pages); const pages = Object.keys(this.dashboardRef.pages);
@ -109,7 +121,7 @@ export class WccSidebar extends DeesElement {
this.selectItem('page', pageName, item); this.selectItem('page', pageName, item);
}} }}
> >
<i class="material-symbols-outlined">insert_drive_file</i> <i class="material-icons">insert_drive_file</i>
<div class="text">${pageName}</div> <div class="text">${pageName}</div>
</div> </div>
`; `;
@ -128,13 +140,13 @@ export class WccSidebar extends DeesElement {
this.selectItem('element', elementName, item); this.selectItem('element', elementName, item);
}} }}
> >
<i class="material-symbols-outlined">featured_video</i> <i class="material-icons">featured_video</i>
<div class="text">${elementName}</div> <div class="text">${elementName}</div>
</div> </div>
`; `;
}); });
})()} })()}
</div> </menu>
`; `;
} }

View File

@ -1,5 +1,5 @@
import { WccDashboard } from './elements/wcc-dashboard.js'; import { WccDashboard } from './elements/wcc-dashboard.js';
import { LitElement, type TemplateResult } from 'lit'; import { LitElement, TemplateResult } from 'lit-element';
const setupWccTools = (elementsArg?: { [key: string]: LitElement }, pagesArg?: { [key: string]: () => TemplateResult }) => { const setupWccTools = (elementsArg?: { [key: string]: LitElement }, pagesArg?: { [key: string]: () => TemplateResult }) => {
let hasRun = false; let hasRun = false;

16
ts_web/tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"lib": ["es2017", "dom"],
"declaration": true,
"inlineSources": true,
"inlineSourceMap": true,
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"outDir": "dist/",
"skipLibCheck": true,
"experimentalDecorators": true
}
}

View File

@ -1,10 +1,10 @@
import * as smartdelay from '@push.rocks/smartdelay'; import * as smartdelay from '@pushrocks/smartdelay';
export { export {
smartdelay smartdelay
}; };
import * as deesDomtools from '@design.estate/dees-domtools'; import * as deesDomtools from '@designestate/dees-domtools';
export { export {
deesDomtools deesDomtools

View File

@ -1,14 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "target": "ES2017",
"target": "ES2022", "moduleResolution": "Node"
"module": "NodeNext", }
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
} }

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}