@design.estate/dees-catalog 1.0.173 → 1.0.174

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.
@@ -0,0 +1,28 @@
1
+ <!--gitzone element-->
2
+ <!-- made by Task Venture Capital GmbH -->
3
+ <!-- checkout https://maintainedby.lossless.com for awesome OpenSource projects -->
4
+ <html lang="en">
5
+ <head>
6
+ <!--Lets set some basic meta tags-->
7
+ <meta
8
+ name="viewport"
9
+ content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height"
10
+ />
11
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
12
+
13
+ <!--Lets load standard fonts-->
14
+ <link rel="preconnect" href="https://assetbroker.lossless.one/" crossorigin>
15
+ <link rel="stylesheet" href="https://assetbroker.lossless.one/fonts/fonts.css">
16
+
17
+ <style>
18
+ body {
19
+ margin: 0px;
20
+ background: #222222;
21
+ }
22
+ </style>
23
+
24
+ <script type="module" src="/bundle.js"></script>
25
+ </head>
26
+ <body>
27
+ </body>
28
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "1.0.173",
3
+ "version": "1.0.174",
4
4
  "private": false,
5
5
  "description": "website for lossless.com",
6
6
  "main": "dist_ts_web/index.js",
@@ -22,20 +22,20 @@
22
22
  "@fortawesome/free-brands-svg-icons": "^6.4.2",
23
23
  "@fortawesome/free-regular-svg-icons": "^6.4.2",
24
24
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
25
- "@push.rocks/smartpromise": "^4.0.0",
26
- "@push.rocks/smartstring": "^4.0.5",
25
+ "@push.rocks/smartpromise": "^4.0.3",
26
+ "@push.rocks/smartstring": "^4.0.8",
27
27
  "@tsclass/tsclass": "^4.0.42",
28
28
  "highlight.js": "11.8.0",
29
- "pdfjs-dist": "^2.15.349"
29
+ "pdfjs-dist": "^2.16.105"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@gitzone/tsbuild": "^2.1.66",
33
33
  "@gitzone/tsbundle": "^2.0.8",
34
34
  "@gitzone/tstest": "^1.0.77",
35
35
  "@gitzone/tswatch": "^2.0.7",
36
- "@push.rocks/projectinfo": "^5.0.1",
37
- "@push.rocks/tapbundle": "^5.0.12",
38
- "@types/node": "^20.4.8"
36
+ "@push.rocks/projectinfo": "^5.0.2",
37
+ "@push.rocks/tapbundle": "^5.0.15",
38
+ "@types/node": "^20.5.1"
39
39
  },
40
40
  "files": [
41
41
  "ts/**/*",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '1.0.173',
6
+ version: '1.0.174',
7
7
  description: 'website for lossless.com'
8
8
  }
@@ -7,9 +7,15 @@ import { DeesInputQuantitySelector } from './dees-input-quantityselector.js';
7
7
  import { DeesInputRadio } from './dees-input-radio.js';
8
8
  import { DeesFormSubmit } from './dees-form-submit.js';
9
9
 
10
- export type TFormElement = Array<
11
- DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio
12
- >;
10
+ // Unified set for form input types
11
+ const FORM_INPUT_TYPES = [
12
+ DeesInputCheckbox,
13
+ DeesInputText,
14
+ DeesInputQuantitySelector,
15
+ DeesInputRadio
16
+ ];
17
+
18
+ export type TFormInputElement = DeesInputCheckbox | DeesInputText | DeesInputQuantitySelector | DeesInputRadio;
13
19
 
14
20
  declare global {
15
21
  interface HTMLElementTagNameMap {
@@ -19,6 +25,7 @@ declare global {
19
25
 
20
26
  @customElement('dees-form')
21
27
  export class DeesForm extends DeesElement {
28
+
22
29
  public static demo = () => html`
23
30
  <dees-form
24
31
  style="display: block; margin:auto; max-width: 500px; padding: 20px"
@@ -31,11 +38,7 @@ export class DeesForm extends DeesElement {
31
38
  >
32
39
  <dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
33
40
  <dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
34
- <dees-input-checkbox
35
- .required="${true}"
36
- key="hello3"
37
- label="another text"
38
- ></dees-input-checkbox>
41
+ <dees-input-checkbox .required="${true}" key="hello3" label="another text"></dees-input-checkbox>
39
42
  <dees-form-submit>Submit</dees-form-submit>
40
43
  </dees-form>
41
44
  `;
@@ -55,51 +58,37 @@ export class DeesForm extends DeesElement {
55
58
  }
56
59
 
57
60
  public async firstUpdated() {
58
- const formChildren = this.getFormChildren();
59
- this.checkRequiredStatus();
61
+ const formChildren = this.getFormElements();
62
+ this.updateRequiredStatus();
63
+
60
64
  for (const child of formChildren) {
61
- child.changeSubject.subscribe(async (elementArg: TFormElement) => {
62
- const valueObject = await this.gatherData();
65
+ child.changeSubject.subscribe(async () => {
66
+ const valueObject = await this.collectFormData();
63
67
  this.changeSubject.next(valueObject);
64
68
  console.log(valueObject);
65
- this.checkRequiredStatus();
69
+ this.updateRequiredStatus();
66
70
  });
67
71
  }
68
- await this.instrumentBehaviours();
72
+ await this.addBehaviours();
69
73
  }
70
74
 
71
- public getFormChildren() {
72
- const children: Array<DeesElement> = this.children as any;
73
- const formChildren: TFormElement = [];
74
-
75
- for (const child of children) {
76
- if (
77
- child instanceof DeesInputCheckbox ||
78
- child instanceof DeesInputText ||
79
- child instanceof DeesInputQuantitySelector
80
- ) {
81
- formChildren.push(child);
82
- }
83
- }
84
- return formChildren;
75
+ public getFormElements(): Array<TFormInputElement> {
76
+ return (Array.from(this.children)).filter(child =>
77
+ FORM_INPUT_TYPES.includes(child.constructor as any)
78
+ ) as unknown as TFormInputElement[];
85
79
  }
86
80
 
87
- public getSubmitButton() {
88
- const children: Array<DeesElement> = this.children as any;
89
- let submitButton: DeesFormSubmit;
90
- for (const childArg of children) {
91
- if (childArg instanceof DeesFormSubmit) {
92
- submitButton = childArg;
93
- }
94
- }
95
- return submitButton;
81
+ public getSubmitButton(): DeesFormSubmit | undefined {
82
+ return Array.from(this.children).find(child =>
83
+ child instanceof DeesFormSubmit
84
+ ) as DeesFormSubmit;
96
85
  }
97
86
 
98
- public async checkRequiredStatus() {
87
+ public async updateRequiredStatus() {
99
88
  console.log('checking the required status.');
100
89
 
101
90
  let requiredOK = true;
102
- for (const childArg of this.getFormChildren()) {
91
+ for (const childArg of this.getFormElements()) {
103
92
  if (childArg.required && !childArg.value) {
104
93
  requiredOK = false;
105
94
  }
@@ -109,8 +98,8 @@ export class DeesForm extends DeesElement {
109
98
  }
110
99
  }
111
100
 
112
- public async gatherData() {
113
- const children = this.getFormChildren();
101
+ public async collectFormData() {
102
+ const children = this.getFormElements();
114
103
  const valueObject: { [key: string]: string | number | boolean } = {};
115
104
  for (const child of children) {
116
105
  valueObject[child.key] = child.value;
@@ -119,7 +108,7 @@ export class DeesForm extends DeesElement {
119
108
  }
120
109
 
121
110
  public async gatherAndDispatch() {
122
- const valueObject = await this.gatherData();
111
+ const valueObject = await this.collectFormData();
123
112
  const formDataEvent = new CustomEvent('formData', {
124
113
  detail: {
125
114
  data: valueObject,
@@ -135,7 +124,7 @@ export class DeesForm extends DeesElement {
135
124
  visualStateArg: 'normal' | 'pending' | 'error' | 'success',
136
125
  textStateArg: string
137
126
  ) {
138
- const inputChildren = this.getFormChildren();
127
+ const inputChildren = this.getFormElements();
139
128
  const submitButton = this.getSubmitButton();
140
129
 
141
130
  switch (visualStateArg) {
@@ -172,20 +161,22 @@ export class DeesForm extends DeesElement {
172
161
  submitButton.text = textStateArg;
173
162
  }
174
163
 
175
- public async instrumentBehaviours() {
176
- const children = this.getFormChildren();
177
- for (const child of children) {
178
- child.addEventListener('keydown', (eventArg) => {
179
- if (eventArg.key === 'Enter') {
180
- const currentIndex = children.indexOf(child);
181
- if (currentIndex < children.length - 1) {
182
- children[currentIndex + 1].focus();
183
- } else {
184
- children[currentIndex].blur();
185
- this.getSubmitButton().focus();
186
- }
164
+ public async addBehaviours() {
165
+ // Use event delegation
166
+ this.addEventListener('keydown', (event: KeyboardEvent) => {
167
+ const target = event.target as DeesElement;
168
+ if (!FORM_INPUT_TYPES.includes(target.constructor as any)) return;
169
+
170
+ if (event.key === 'Enter') {
171
+ const children = this.getFormElements();
172
+ const currentIndex = children.indexOf(target as any);
173
+ if (currentIndex < children.length - 1) {
174
+ children[currentIndex + 1].focus();
175
+ } else {
176
+ target.blur();
177
+ this.getSubmitButton()?.focus();
187
178
  }
188
- });
189
- }
179
+ }
180
+ });
190
181
  }
191
182
  }
@@ -144,7 +144,7 @@ export class DeesInputCheckbox extends DeesElement {
144
144
  }
145
145
  </style>
146
146
  <div class="maincontainer" @click="${this.toggleSelected}">
147
- <div class="checkbox ${this.value ? 'selected' : ''} ${this.disabled ? 'disabled' : ''}">
147
+ <div class="checkbox ${this.value ? 'selected' : ''} ${this.disabled ? 'disabled' : ''}" tabindex="0">
148
148
  ${this.value
149
149
  ? html`
150
150
  <span class="checkmark">
@@ -172,4 +172,11 @@ export class DeesInputCheckbox extends DeesElement {
172
172
  );
173
173
  this.changeSubject.next(this);
174
174
  }
175
+
176
+ public focus(): void {
177
+ const checkboxDiv = this.shadowRoot.querySelector('.checkbox');
178
+ if (checkboxDiv) {
179
+ (checkboxDiv as any).focus();
180
+ }
181
+ }
175
182
  }
@@ -155,7 +155,10 @@ export class DeesInputFileupload extends DeesElement {
155
155
  public async openFileSelector() {
156
156
  const inputFile: HTMLInputElement = this.shadowRoot.querySelector('input[type="file"]');
157
157
  inputFile.click();
158
+ this.state = 'idle';
159
+ this.buttonText = 'Upload more files...';
158
160
  }
161
+
159
162
 
160
163
  public async updateValue(eventArg: Event) {
161
164
  const target: any = eventArg.target;
@@ -164,6 +167,20 @@ export class DeesInputFileupload extends DeesElement {
164
167
  }
165
168
 
166
169
  public firstUpdated() {
170
+ const inputFile: HTMLInputElement = this.shadowRoot.querySelector('input[type="file"]');
171
+ inputFile.addEventListener('change', (event: Event) => {
172
+ const target = event.target as HTMLInputElement;
173
+ for (const file of Array.from(target.files)) {
174
+ this.value.push(file);
175
+ }
176
+ this.requestUpdate();
177
+ console.log(`Got ${this.value.length} files!`);
178
+ // Reset the input value to allow selecting the same file again if needed
179
+ target.value = '';
180
+ });
181
+
182
+
183
+ // lets handle drag and drop
167
184
  const dropArea = this.shadowRoot.querySelector('.uploadButton');
168
185
  const handlerFunction = (eventArg: DragEvent) => {
169
186
  eventArg.preventDefault();
@@ -0,0 +1,74 @@
1
+ import {
2
+ customElement,
3
+ html,
4
+ DeesElement,
5
+ property,
6
+ type TemplateResult,
7
+ cssManager,
8
+ css,
9
+ unsafeCSS,
10
+ type CSSResult,
11
+ state,
12
+ } from '@design.estate/dees-element';
13
+
14
+ import * as domtools from '@design.estate/dees-domtools';
15
+
16
+ declare global {
17
+ interface HTMLElementTagNameMap {
18
+ 'dees-simple-login': DeesSimpleLogin;
19
+ }
20
+ }
21
+
22
+ @customElement('dees-simple-login')
23
+ export class DeesSimpleLogin extends DeesElement {
24
+ // STATIC
25
+ public static demo = () => html` <dees-simple-login></dees-simple-login> `;
26
+
27
+ // INSTANCE
28
+
29
+ @property()
30
+ public title = 'Dees Simple Login';
31
+
32
+ public static styles = [
33
+ cssManager.defaultStyles,
34
+ css`
35
+ :host {
36
+ color: ${cssManager.bdTheme('#333', '#fff')};
37
+ }
38
+ .loginContainer {
39
+ display: flex;
40
+ justify-content: center; /* aligns horizontally */
41
+ align-items: center; /* aligns vertically */
42
+ height: 100%;
43
+ }
44
+ .login {
45
+ min-width: 320px;
46
+ min-height: 100px;
47
+ background: ${cssManager.bdTheme('#eeeeeb', '#111')};
48
+ box-shadow: ${cssManager.bdTheme('0px 1px 4px rgba(0,0,0,0.3)', 'none')};
49
+ border-radius: 3px;
50
+ padding: 24px;
51
+ }
52
+
53
+ .header {
54
+ text-align: center;
55
+ }
56
+ `,
57
+ ];
58
+
59
+ public render(): TemplateResult {
60
+ return html`
61
+ <div class="loginContainer">
62
+ <div class="login">
63
+ <dees-form>
64
+ <div class="header">Login to ${this.title}</div>
65
+ <dees-input-text label="username"></dees-input-text>
66
+ <dees-input-text label="password" isPasswordBool></dees-input-text>
67
+ <dees-form-submit>login</dees-form-submit>
68
+ </dees-form>
69
+ </div>
70
+ </div>
71
+ <slot></slot>
72
+ `;
73
+ }
74
+ }
@@ -0,0 +1,3 @@
1
+ export class FormController {
2
+
3
+ }
@@ -4,8 +4,8 @@ export * from './dees-chips.js';
4
4
  export * from './dees-contextmenu.js';
5
5
  export * from './dees-dataview-codebox.js';
6
6
  export * from './dees-dataview-statusobject.js';
7
- export * from './dees-form.js';
8
7
  export * from './dees-form-submit.js';
8
+ export * from './dees-form.js';
9
9
  export * from './dees-icon.js';
10
10
  export * from './dees-input-checkbox.js';
11
11
  export * from './dees-input-dropdown.js';
@@ -15,6 +15,7 @@ export * from './dees-input-radio.js';
15
15
  export * from './dees-input-text.js';
16
16
  export * from './dees-mobilenavigation.js';
17
17
  export * from './dees-pdf.js';
18
+ export * from './dees-simple-login.js';
18
19
  export * from './dees-speechbubble.js';
19
20
  export * from './dees-spinner.js';
20
21
  export * from './dees-stepper.js';
@@ -0,0 +1 @@
1
+ export * from './mainpage.js';
@@ -0,0 +1,6 @@
1
+ import { html } from '@design.estate/dees-element';
2
+
3
+ export const mainPage = () => html`
4
+ <dees-input-text label="my-test-label"></dees-input-text>
5
+ <dees-input-text label="my-test-label"></dees-input-text>
6
+ `;