@design.estate/dees-wcctools 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/license ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2020 Lossless GmbH (hello@lossless.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/npmextra.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "gitzone": {
3
+ "projectType": "wcc",
4
+ "module": {
5
+ "githost": "gitlab.com",
6
+ "gitscope": "designestate",
7
+ "gitrepo": "dees-wcctools",
8
+ "description": "wcc tools for creating element catalogues",
9
+ "npmPackagename": "@designestate/dees-wcctools",
10
+ "license": "MIT",
11
+ "projectDomain": "design.estate"
12
+ }
13
+ },
14
+ "npmci": {
15
+ "npmGlobalTools": [],
16
+ "npmAccessLevel": "public"
17
+ }
18
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@design.estate/dees-wcctools",
3
+ "version": "1.0.77",
4
+ "private": false,
5
+ "description": "wcc tools for creating element catalogues",
6
+ "main": "dist_ts_web/index.js",
7
+ "typings": "dist_ts_web/index.d.ts",
8
+ "type": "module",
9
+ "scripts": {
10
+ "test": "(npm run build)",
11
+ "build": "(tsbuild element --web --allowimplicitany && tsbundle element)",
12
+ "watch": "tswatch element",
13
+ "buildDocs": "tsdoc"
14
+ },
15
+ "author": "Lossless GmbH",
16
+ "license": "UNLICENSED",
17
+ "dependencies": {
18
+ "@design.estate/dees-domtools": "^2.0.6",
19
+ "@design.estate/dees-element": "^2.0.6",
20
+ "@gitzone/tsrun": "^1.2.44",
21
+ "@push.rocks/smartdelay": "^3.0.5",
22
+ "lit": "^2.8.0"
23
+ },
24
+ "devDependencies": {
25
+ "@api.global/typedserver": "^3.0.4",
26
+ "@gitzone/tsbuild": "^2.1.66",
27
+ "@gitzone/tsbundle": "^2.0.8",
28
+ "@gitzone/tswatch": "^2.0.7",
29
+ "@push.rocks/projectinfo": "^5.0.1"
30
+ },
31
+ "files": [
32
+ "ts/**/*",
33
+ "ts_web/**/*",
34
+ "dist/**/*",
35
+ "dist_*/**/*",
36
+ "dist_ts/**/*",
37
+ "dist_ts_web/**/*",
38
+ "assets/**/*",
39
+ "cli.js",
40
+ "npmextra.json",
41
+ "readme.md"
42
+ ],
43
+ "browserslist": [
44
+ "last 1 Chrome versions"
45
+ ]
46
+ }
package/readme.md ADDED
@@ -0,0 +1,39 @@
1
+ # @designestate/dees-wcctools
2
+ wcc tools for creating element catalogues
3
+
4
+ ## Availabililty and Links
5
+ * [npmjs.org (npm package)](https://www.npmjs.com/package/@designestate/dees-wcctools)
6
+ * [gitlab.com (source)](https://gitlab.com/designestate/dees-wcctools)
7
+ * [github.com (source mirror)](https://github.com/designestate/dees-wcctools)
8
+ * [docs (typedoc)](https://designestate.gitlab.io/dees-wcctools/)
9
+
10
+ ## Status for master
11
+
12
+ Status Category | Status Badge
13
+ -- | --
14
+ GitLab Pipelines | [![pipeline status](https://gitlab.com/designestate/dees-wcctools/badges/master/pipeline.svg)](https://lossless.cloud)
15
+ GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/designestate/dees-wcctools/badges/master/coverage.svg)](https://lossless.cloud)
16
+ npm | [![npm downloads per month](https://badgen.net/npm/dy/@designestate/dees-wcctools)](https://lossless.cloud)
17
+ Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/designestate/dees-wcctools)](https://lossless.cloud)
18
+ TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
19
+ node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
20
+ Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
21
+ PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@designestate/dees-wcctools)](https://lossless.cloud)
22
+ PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@designestate/dees-wcctools)](https://lossless.cloud)
23
+ BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@designestate/dees-wcctools)](https://lossless.cloud)
24
+
25
+ ## Usage
26
+
27
+ ## Contribution
28
+
29
+ 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). :)
30
+
31
+ ## Contribution
32
+
33
+ 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). :)
34
+
35
+ For further information read the linked docs at the top of this readme.
36
+
37
+ ## Legal
38
+ > MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
39
+ | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
@@ -0,0 +1,8 @@
1
+ /**
2
+ * autocreated commitinfo by @pushrocks/commitinfo
3
+ */
4
+ export const commitinfo = {
5
+ name: '@design.estate/dees-wcctools',
6
+ version: '1.0.77',
7
+ description: 'wcc tools for creating element catalogues'
8
+ }
@@ -0,0 +1,177 @@
1
+ import { DeesElement, property, html, customElement, type TemplateResult, queryAsync, render, domtools } from '@design.estate/dees-element';
2
+
3
+ import * as plugins from '../wcctools.plugins.js';
4
+
5
+ // wcc tools
6
+ import './wcc-frame.js';
7
+ import './wcc-sidebar.js';
8
+ import './wcc-properties.js';
9
+ import { type TTheme } from './wcc-properties.js';
10
+ import { type TElementType } from './wcc-sidebar.js';
11
+ import { breakpoints } from '@design.estate/dees-domtools';
12
+ import { WccFrame } from './wcc-frame.js';
13
+
14
+ @customElement('wcc-dashboard')
15
+ export class WccDashboard extends DeesElement {
16
+
17
+ @property()
18
+ public selectedType: TElementType;
19
+
20
+ @property()
21
+ public selectedItemName: string;
22
+
23
+ @property()
24
+ public selectedItem: (() => TemplateResult) | DeesElement;
25
+
26
+ @property()
27
+ public selectedViewport: plugins.deesDomtools.breakpoints.TViewport = 'desktop';
28
+
29
+ @property()
30
+ public selectedTheme: TTheme = 'dark';
31
+
32
+ @property()
33
+ public pages: { [key: string]: () => TemplateResult } = {};
34
+
35
+ @property()
36
+ public elements: { [key: string]: DeesElement } = {};
37
+
38
+ @property()
39
+ public warning: string = null;
40
+
41
+ @queryAsync('wcc-frame')
42
+ public wccFrame: Promise<WccFrame>;
43
+
44
+ constructor(
45
+ elementsArg?: { [key: string]: DeesElement },
46
+ pagesArg?: { [key: string]: () => TemplateResult }
47
+ ) {
48
+ super();
49
+ if (elementsArg) {
50
+ this.elements = elementsArg;
51
+ console.log('got elements:');
52
+ console.log(this.elements);
53
+ }
54
+
55
+ if (pagesArg) {
56
+ this.pages = pagesArg;
57
+ }
58
+ }
59
+
60
+ public render(): TemplateResult {
61
+ return html`
62
+ <style>
63
+ :host {
64
+ font-family: 'Roboto', sans-serif;
65
+ background: #fcfcfc;
66
+ display: block;
67
+ box-sizing: border-box;
68
+ }
69
+ :host([hidden]) {
70
+ display: none;
71
+ }
72
+ </style>
73
+ <wcc-sidebar
74
+ .dashboardRef=${this}
75
+ .selectedItem=${this.selectedItem}
76
+ @selectedType=${(eventArg) => {
77
+ this.selectedType = eventArg.detail;
78
+ }}
79
+ @selectedItemName=${(eventArg) => {
80
+ this.selectedItemName = eventArg.detail;
81
+ }}
82
+ @selectedItem=${(eventArg) => {
83
+ this.selectedItem = eventArg.detail;
84
+ }}
85
+ ></wcc-sidebar>
86
+ <wcc-properties
87
+ .dashboardRef=${this}
88
+ .warning="${this.warning}"
89
+ .selectedItem=${this.selectedItem}
90
+ .selectedViewport=${this.selectedViewport}
91
+ .selectedTheme=${this.selectedTheme}
92
+ @selectedViewport=${(eventArg) => {
93
+ this.selectedViewport = eventArg.detail;
94
+ this.scheduleUpdate();
95
+ }}
96
+ @selectedTheme=${(eventArg) => {
97
+ this.selectedTheme = eventArg.detail;
98
+ }}
99
+ ></wcc-properties>
100
+ <wcc-frame id="wccFrame" viewport=${this.selectedViewport}>
101
+ </wcc-frame>
102
+ `;
103
+ }
104
+
105
+ public setWarning(warningTextArg: string) {
106
+ if (this.warning !== warningTextArg) {
107
+ console.log(warningTextArg);
108
+ this.warning = warningTextArg;
109
+ setTimeout(() => {
110
+ this.scheduleUpdate();
111
+ }, 0);
112
+ }
113
+ }
114
+
115
+ public async firstUpdated() {
116
+ this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
117
+ this.domtools.router.on(
118
+ '/wcctools-route/:itemType/:itemName/:viewport/:theme',
119
+ async (routeInfo) => {
120
+ this.selectedType = routeInfo.params.itemType as TElementType;
121
+ this.selectedItemName = routeInfo.params.itemName;
122
+ this.selectedViewport = routeInfo.params.viewport as breakpoints.TViewport;
123
+ this.selectedTheme = routeInfo.params.theme as TTheme;
124
+ if (routeInfo.params.itemType === 'element') {
125
+ this.selectedItem = this.elements[routeInfo.params.itemName];
126
+ } else if (routeInfo.params.itemType === 'page') {
127
+ this.selectedItem = this.pages[routeInfo.params.itemName];
128
+ }
129
+ const domtoolsInstance = await plugins.deesDomtools.elementBasic.setup();
130
+ this.selectedTheme === 'bright'
131
+ ? domtoolsInstance.themeManager.goBright()
132
+ : domtoolsInstance.themeManager.goDark();
133
+ }
134
+ );
135
+ }
136
+
137
+ public async updated() {
138
+ this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
139
+ await this.domtools.router._handleRouteState();
140
+ const storeElement = this.selectedItem;
141
+ const wccFrame: WccFrame = this.shadowRoot.querySelector('wcc-frame');
142
+
143
+ if (this.selectedType === 'page' && this.selectedItem) {
144
+ if (typeof this.selectedItem === 'function') {
145
+ console.log('slotting page.');
146
+ const viewport = await wccFrame.getViewportElement();
147
+ render(this.selectedItem(), viewport);
148
+ console.log('rendered page.');
149
+ } else {
150
+ console.error('The selected item looks strange:');
151
+ console.log(this.selectedItem);
152
+ }
153
+ } else if (this.selectedType === 'element' && this.selectedItem) {
154
+ console.log('slotting element.');
155
+ const anonItem: any = this.selectedItem;
156
+ if (!anonItem.demo) {
157
+ this.setWarning(`component ${anonItem.name} does not expose a demo property.`);
158
+ return;
159
+ }
160
+ if (!(typeof anonItem.demo === 'function')) {
161
+ this.setWarning(
162
+ `component ${anonItem.name} has demo property, but it is not of type function`
163
+ );
164
+ return;
165
+ }
166
+ this.setWarning(null);
167
+ const viewport = await wccFrame.getViewportElement();
168
+ render(anonItem.demo(), viewport);;
169
+ }
170
+ }
171
+
172
+ public buildUrl() {
173
+ this.domtools.router.pushUrl(
174
+ `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedViewport}/${this.selectedTheme}`
175
+ );
176
+ }
177
+ }
@@ -0,0 +1,115 @@
1
+ import { DeesElement, property, html, customElement, type TemplateResult, css, cssManager } from '@design.estate/dees-element';
2
+
3
+ import * as domtools from '@design.estate/dees-domtools';
4
+
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'wcc-frame': WccFrame;
8
+ }
9
+ }
10
+
11
+ @customElement('wcc-frame')
12
+ export class WccFrame extends DeesElement {
13
+ @property()
14
+ public viewport: string;
15
+
16
+ public static styles = [
17
+ css`
18
+ :host {
19
+ border: 10px solid #ffaeaf;
20
+ position: absolute;
21
+ background: ${cssManager.bdTheme('#333', '#000')};
22
+ left: 200px;
23
+ right: 0px;
24
+ top: 0px;
25
+ bottom: 100px;
26
+ overflow-y: auto;
27
+ overflow-x: auto;
28
+ }
29
+
30
+ .viewport {
31
+ container-type: inline-size;
32
+ container-name: wccToolsViewport;
33
+ position: relative;
34
+ min-height: 100%;
35
+ }
36
+ `,
37
+ ]
38
+
39
+ public render(): TemplateResult {
40
+ return html`
41
+ <style>
42
+ :host {
43
+ ${(() => {
44
+ switch (this.viewport) {
45
+ case 'desktop':
46
+ return `
47
+ padding: 0px 0px;
48
+ `;
49
+ case 'tablet':
50
+ return `
51
+ padding: 0px ${
52
+ (document.body.clientWidth - 200 - domtools.breakpoints.tablet) / 2
53
+ }px;
54
+ `;
55
+ case 'phablet':
56
+ return `
57
+ padding: 0px ${
58
+ (document.body.clientWidth - 200 - domtools.breakpoints.phablet) / 2
59
+ }px;
60
+ `;
61
+ case 'phone':
62
+ return `
63
+ padding: 0px ${
64
+ (document.body.clientWidth - 200 - domtools.breakpoints.phone) / 2
65
+ }px;
66
+ `;
67
+ }
68
+ })()}
69
+ }
70
+
71
+ .viewport {
72
+ ${this.viewport !== 'desktop'
73
+ ? html` border-right: 1px dotted #444; border-left: 1px dotted #444; `
74
+ : html``
75
+ }
76
+ background:
77
+ ${
78
+ this.goBright ? `
79
+ radial-gradient(#CCCCCC 3px, transparent 4px),
80
+ radial-gradient(#CCCCCC 3px, transparent 4px),
81
+ linear-gradient(#eeeeee 4px, transparent 0),
82
+ linear-gradient(45deg, transparent 74px, transparent 75px, #CCCCCC 75px, #CCCCCC 76px, transparent 77px, transparent 109px),
83
+ linear-gradient(-45deg, transparent 75px, transparent 76px, #CCCCCC 76px, #CCCCCC 77px, transparent 78px, transparent 109px),
84
+ #eeeeee;
85
+ background-size: 109px 109px, 109px 109px,100% 6px, 109px 109px, 109px 109px;
86
+ background-position: 54px 55px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
87
+ ` : `
88
+ radial-gradient(#444444 3px, transparent 4px),
89
+ radial-gradient(#444444 3px, transparent 4px),
90
+ linear-gradient(#222222 4px, transparent 0),
91
+ linear-gradient(45deg, transparent 74px, transparent 75px, #444444 75px, #444444 76px, transparent 77px, transparent 109px),
92
+ linear-gradient(-45deg, transparent 75px, transparent 76px, #444444 76px, #444444 77px, transparent 78px, transparent 109px),
93
+ #222222;
94
+ background-size: 109px 109px, 109px 109px,100% 6px, 109px 109px, 109px 109px;
95
+ background-position: 54px 55px, 0px 0px, 0px 0px, 0px 0px, 0px 0px;
96
+ `
97
+ }
98
+ }
99
+ </style>
100
+ <div class="viewport">
101
+
102
+ </div>
103
+ `;
104
+ }
105
+
106
+ public async getDisplayedInstance() {
107
+ await this.updateComplete;
108
+ const slottedContent = this.children;
109
+ console.log(slottedContent);
110
+ }
111
+
112
+ public async getViewportElement(): Promise<HTMLElement> {
113
+ return this.shadowRoot.querySelector('.viewport') as HTMLElement;
114
+ }
115
+ }