@consent.software/catalog 2.0.0 → 2.0.2

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.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Lossless GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consent.software/catalog",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "private": false,
5
5
  "description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
6
6
  "exports": {
@@ -17,10 +17,11 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@design.estate/dees-wcctools": "^1.2.1",
20
- "@git.zone/tsbuild": "^3.1.2",
21
- "@git.zone/tsbundle": "^2.6.2",
22
- "@git.zone/tswatch": "^2.2.1",
23
- "@push.rocks/projectinfo": "^5.0.2"
20
+ "@git.zone/tsbuild": "^4.4.2",
21
+ "@git.zone/tsbundle": "^2.13.0",
22
+ "@git.zone/tswatch": "^3.3.5",
23
+ "@push.rocks/projectinfo": "^5.0.2",
24
+ "@types/node": "^26.4.1"
24
25
  },
25
26
  "files": [
26
27
  "ts/**/*",
@@ -31,7 +32,8 @@
31
32
  "dist_ts_web/**/*",
32
33
  "assets/**/*",
33
34
  "cli.js",
34
- "npmextra.json",
35
+ ".smartconfig.json",
36
+ "license.md",
35
37
  "readme.md"
36
38
  ],
37
39
  "browserslist": [
@@ -51,7 +53,7 @@
51
53
  ],
52
54
  "scripts": {
53
55
  "test": "pnpm run build",
54
- "build": "tsbuild tsfolders --allowimplicitany && tsbundle element --production",
56
+ "build": "tsbuild tsfolders && tsbundle element --production",
55
57
  "watch": "tswatch element"
56
58
  }
57
59
  }
package/readme.md CHANGED
@@ -187,7 +187,7 @@ pnpm run watch
187
187
 
188
188
  ## License and Legal Information
189
189
 
190
- This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
190
+ This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license.md](./license.md) file.
191
191
 
192
192
  **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.
193
193
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@consent.software/catalog',
6
- version: '2.0.0',
6
+ version: '2.0.2',
7
7
  description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
8
8
  }
@@ -6,7 +6,6 @@ import {
6
6
  html,
7
7
  css,
8
8
  type TemplateResult,
9
- property,
10
9
  } from '@design.estate/dees-element';
11
10
 
12
11
  import * as csInterfaces from '@consent.software/interfaces';
@@ -25,6 +24,7 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
25
24
 
26
25
  public csWebclientInstance = new csWebclient.CsWebclient();
27
26
  public csWebclientRan = false;
27
+ private isMobile = false;
28
28
 
29
29
  public static styles = [
30
30
  cssManager.defaultStyles,
@@ -43,7 +43,7 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
43
43
  z-index: 1000;
44
44
  background: rgba(0, 0, 0, 0);
45
45
  backdrop-filter: blur(0px);
46
- transition: all 0.2s ease-out;
46
+ transition: background 0.3s ease, backdrop-filter 0.3s ease;
47
47
  }
48
48
 
49
49
  .pageOverlay.shake {
@@ -63,18 +63,42 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
63
63
  min-width: 320px;
64
64
  box-sizing: border-box;
65
65
  overflow: hidden;
66
- will-change: transform;
67
- transition: all 0.2s ease-out;
68
- transform: scale(0.96);
66
+ will-change: transform, opacity;
67
+ transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
68
+ transform: scale(0.92) translateY(20px);
69
69
  opacity: 0;
70
70
  }
71
71
 
72
+ .modalBox.visible {
73
+ transform: scale(1) translateY(0);
74
+ opacity: 1;
75
+ }
76
+
77
+ .modalBox.hiding {
78
+ transform: scale(0.95) translateY(10px);
79
+ opacity: 0;
80
+ }
81
+
82
+ /* Mobile: slide up from bottom */
72
83
  @media (max-width: 560px) {
84
+ .pageOverlay {
85
+ align-items: flex-end;
86
+ }
87
+
73
88
  .modalBox {
74
89
  max-width: 100%;
75
90
  min-width: 100%;
76
- height: 100vh;
77
- border-radius: 0;
91
+ border-radius: 16px 16px 0 0;
92
+ transform: translateY(100%);
93
+ opacity: 1;
94
+ }
95
+
96
+ .modalBox.visible {
97
+ transform: translateY(0);
98
+ }
99
+
100
+ .modalBox.hiding {
101
+ transform: translateY(100%);
78
102
  }
79
103
  }
80
104
 
@@ -122,6 +146,7 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
122
146
  @media (max-width: 560px) {
123
147
  .button-container {
124
148
  grid-template-columns: 1fr;
149
+ padding-bottom: max(16px, env(safe-area-inset-bottom));
125
150
  }
126
151
  }
127
152
 
@@ -143,6 +168,10 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
143
168
  border-color: ${cssManager.bdTheme(colors.light.ring, colors.dark.ring)};
144
169
  }
145
170
 
171
+ .consent-button:active {
172
+ transform: scale(0.98);
173
+ }
174
+
146
175
  .consent-button:last-child {
147
176
  background: ${cssManager.bdTheme(colors.light.primary, colors.dark.primary)};
148
177
  color: ${cssManager.bdTheme(colors.light.primaryForeground, colors.dark.primaryForeground)};
@@ -175,7 +204,6 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
175
204
 
176
205
  constructor() {
177
206
  super();
178
- // Initially hide the consent banner until needed
179
207
  this.setAttribute('show', 'false');
180
208
  }
181
209
 
@@ -234,33 +262,21 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
234
262
  public async connectedCallback() {
235
263
  await super.connectedCallback();
236
264
 
265
+ // Check if mobile
266
+ this.isMobile = window.matchMedia('(max-width: 560px)').matches;
267
+
237
268
  const cookieLevel = await this.csWebclientInstance.getCookieLevels();
238
269
  if (!cookieLevel) {
239
- // Show consent banner if cookie levels haven't been set yet
240
270
  this.setAttribute('show', 'true');
241
- requestAnimationFrame(async () => {
242
- await this.updateComplete;
243
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
244
- if (pageOverlay) {
245
- // Apply subtle backdrop blur when modal appears
246
- pageOverlay.style.background = 'rgba(0,0,0, 0.6)';
247
- pageOverlay.style.backdropFilter = 'blur(4px)';
248
- }
249
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
250
- if (modalBox) {
251
- // Animate modal box appearance
252
- modalBox.style.transform = `scale(1)`;
253
- modalBox.style.opacity = '1';
254
- }
255
- });
271
+ // Small delay to ensure DOM is ready, then animate in
272
+ await delayFor(50);
273
+ this.animateIn();
256
274
  } else {
257
- // Hide banner if cookie levels are already set
258
275
  this.setAttribute('show', 'false');
259
276
  }
260
277
  }
261
278
 
262
279
  public async firstUpdated() {
263
- // Run consent scripts if levels are already set
264
280
  const acceptedCookieLevels = await this.csWebclientInstance.getCookieLevels();
265
281
  if (!this.csWebclientRan && acceptedCookieLevels) {
266
282
  this.csWebclientRan = true;
@@ -268,29 +284,52 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
268
284
  }
269
285
  }
270
286
 
287
+ private animateIn() {
288
+ const pageOverlay = this.shadowRoot?.querySelector('.pageOverlay') as HTMLDivElement;
289
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
290
+
291
+ if (pageOverlay) {
292
+ pageOverlay.style.background = 'rgba(0, 0, 0, 0.5)';
293
+ pageOverlay.style.backdropFilter = 'blur(4px)';
294
+ }
295
+
296
+ if (modalBox) {
297
+ modalBox.classList.remove('hiding');
298
+ modalBox.classList.add('visible');
299
+ }
300
+ }
301
+
302
+ private async animateOut() {
303
+ const pageOverlay = this.shadowRoot?.querySelector('.pageOverlay') as HTMLDivElement;
304
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
305
+
306
+ if (pageOverlay) {
307
+ pageOverlay.style.background = 'rgba(0, 0, 0, 0)';
308
+ pageOverlay.style.backdropFilter = 'blur(0px)';
309
+ }
310
+
311
+ if (modalBox) {
312
+ modalBox.classList.remove('visible');
313
+ modalBox.classList.add('hiding');
314
+ }
315
+
316
+ await delayFor(350);
317
+ }
318
+
271
319
  /**
272
320
  * Handles consent button clicks, sets cookie levels, and hides the banner.
273
321
  */
274
322
  private async handleConsentButtonClick(
275
- event: MouseEvent,
323
+ _event: MouseEvent,
276
324
  levelsArg: csInterfaces.TCookieLevel[]
277
325
  ) {
278
326
  console.log(`Set level to ${levelsArg}`);
279
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
280
- if (pageOverlay) {
281
- pageOverlay.style.background = 'rgba(0,0,0, 0)';
282
- pageOverlay.style.backdropFilter = 'blur(0px)';
283
- }
284
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
285
- if (modalBox) {
286
- // Scale down and fade out modal box before hiding
287
- modalBox.style.transform = `scale(0.95)`;
288
- modalBox.style.opacity = '0';
289
- }
327
+
328
+ await this.animateOut();
329
+
290
330
  // Save user consent preferences
291
331
  await this.csWebclientInstance.setCookieLevels(levelsArg);
292
- await delayFor(300);
293
- this.setAttribute('show', 'false'); // Hide the consent banner
332
+ this.setAttribute('show', 'false');
294
333
 
295
334
  // Run consent scripts
296
335
  if (!this.csWebclientRan) {
@@ -305,13 +344,10 @@ export class ConsentsoftwareCookieconsent extends DeesElement {
305
344
  */
306
345
  private async pageOverlayClick(e: MouseEvent) {
307
346
  if (e.target === e.currentTarget) {
308
- const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
309
- const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
310
- if (pageOverlay && modalBox) {
311
- pageOverlay.classList.add('shake');
347
+ const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
348
+ if (modalBox) {
312
349
  modalBox.classList.add('shake');
313
- await delayFor(2000);
314
- pageOverlay.classList.remove('shake');
350
+ await delayFor(300);
315
351
  modalBox.classList.remove('shake');
316
352
  }
317
353
  }
@@ -73,9 +73,9 @@ export class ConsentsoftwareTabs extends DeesElement {
73
73
 
74
74
  public async handleClick(mouseEvent: MouseEvent) {
75
75
  const target = mouseEvent.target as HTMLElement;
76
- const tab: HTMLDivElement = target.closest('.tab');
76
+ const tab = target.closest<HTMLDivElement>('.tab');
77
77
  if (tab) {
78
- const selector: HTMLDivElement = this.shadowRoot?.querySelector('.selector');
78
+ const selector = this.shadowRoot?.querySelector<HTMLDivElement>('.selector');
79
79
  if (selector) {
80
80
  selector.style.left = `${tab.offsetLeft}px`;
81
81
  selector.style.width = `${tab.offsetWidth}px`;
@@ -216,7 +216,7 @@ export class ConsentsoftwareToggle extends DeesElement {
216
216
  if (!this.isDragging) return;
217
217
  const newX = event.clientX - this.startX;
218
218
  this.hasDragged = true;
219
- const toggleKnobInner: HTMLDivElement = this.shadowRoot.querySelector('.toggleKnobInner');
219
+ const toggleKnobInner = event.currentTarget as HTMLDivElement;
220
220
  toggleKnobInner.classList.add('dragging');
221
221
 
222
222
  // Clamp to valid travel range (0 to maxTravel)
@@ -233,7 +233,7 @@ export class ConsentsoftwareToggle extends DeesElement {
233
233
  if (!this.hasDragged) {
234
234
  return;
235
235
  }
236
- const toggleKnobInner: HTMLDivElement = this.shadowRoot.querySelector('.toggleKnobInner');
236
+ const toggleKnobInner = event.currentTarget as HTMLDivElement;
237
237
  toggleKnobInner.classList.remove('dragging');
238
238
 
239
239
  // Real drag => decide final side based on midpoint
package/npmextra.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "gitzone": {
3
- "projectType": "wcc",
4
- "module": {
5
- "githost": "gitlab.com",
6
- "gitscope": "consentsoftware",
7
- "gitrepo": "private/catalog",
8
- "description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
9
- "npmPackagename": "@consentsoftware_private/catalog",
10
- "license": "UNLICENSED",
11
- "projectDomain": "consent.software",
12
- "keywords": [
13
- "consent management",
14
- "web components",
15
- "cookie consent",
16
- "privacy compliance",
17
- "GDPR",
18
- "ES modules",
19
- "frontend",
20
- "typescript",
21
- "user privacy",
22
- "modern web"
23
- ]
24
- }
25
- },
26
- "npmci": {
27
- "npmGlobalTools": [],
28
- "npmAccessLevel": "private",
29
- "npmRegistryUrl": "verdaccio.lossless.one"
30
- }
31
- }
package/readme.hints.md DELETED
File without changes