12 Commits

10 changed files with 110 additions and 1279 deletions

3
.gitignore vendored
View File

@ -3,7 +3,6 @@
# artifacts # artifacts
coverage/ coverage/
public/ public/
pages/
# installs # installs
node_modules/ node_modules/
@ -17,4 +16,4 @@ node_modules/
dist/ dist/
dist_*/ dist_*/
# custom #------# custom

View File

@ -1,5 +1,37 @@
# Changelog # Changelog
## 2025-01-14 - 1.3.4 - fix(dependencies)
Corrected build script and updated @consent.software/webclient dependency version
- Corrected the build script entry in package.json.
- Updated @consent.software/webclient dependency to version ^1.1.0.
## 2025-01-14 - 1.3.3 - fix(package.json)
Fixed incorrect main and typings fields, replacing with exports field
- Updated package.json to use the 'exports' field instead of 'main' and 'typings' for module entry points
## 2025-01-14 - 1.3.2 - fix(core)
No code changes detected, maintain current state.
## 2025-01-14 - 1.3.1 - fix(package setup)
Fix package metadata and dependency consistency
## 2025-01-14 - 1.3.0 - feat(elements)
Enhance consent management components with advanced styling and interaction
- Added delayed animation effect to 'consentsoftware-toggle' when required.
- Improved styling for better visual feedback on selections and requirements.
- Enhanced modal transition and visibility settings for the 'consentsoftware-cookieconsent'.
## 2025-01-13 - 1.2.0 - feat(pages)
Add initial structure for pages with page1 component
- Added page1 export module in ts_web/pages/index.ts
- Implemented page1 component returning an empty template using lit-html
## 2025-01-13 - 1.1.0 - feat(core) ## 2025-01-13 - 1.1.0 - feat(core)
Refactor and enhance consent management components Refactor and enhance consent management components

View File

@ -1,21 +1,22 @@
{ {
"name": "@consent.software/catalog", "name": "@consent.software/catalog",
"version": "1.1.0", "version": "1.3.4",
"private": false, "private": false,
"description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.", "description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
"main": "dist_ts_web/index.js", "exports": {
"typings": "dist_ts_web/index.d.ts", ".": "./dist_ts_web/index.js"
},
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "npm run build", "test": "npm run build",
"build": "tsbuild element --allowimplicitany && tsbundle element --production", "build": "tsbuild tsfolders --allowimplicitany && tsbundle element --production",
"watch": "tswatch element" "watch": "tswatch element"
}, },
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@consent.software/interfaces": "^1.0.11", "@consent.software/interfaces": "^1.0.11",
"@consent.software/webclient": "^1.0.14", "@consent.software/webclient": "^1.1.0",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"lit": "^3.2.1" "lit": "^3.2.1"
}, },

1265
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@consent.software/catalog', name: '@consent.software/catalog',
version: '1.1.0', version: '1.3.4',
description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.' description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
} }

View File

@ -18,9 +18,6 @@ export class ConsentsoftwareCookieconsent extends LitElement {
@property({ type: String, reflect: true }) @property({ type: String, reflect: true })
public theme: 'light' | 'dark' = 'light'; public theme: 'light' | 'dark' = 'light';
@property({ type: Number })
public heightPixels = 60;
/** /**
* We bind `heightPixels` to a CSS variable (--cookieconsent-height). * We bind `heightPixels` to a CSS variable (--cookieconsent-height).
* Then we can do margin-bottom animations in CSS. * Then we can do margin-bottom animations in CSS.
@ -69,6 +66,9 @@ export class ConsentsoftwareCookieconsent extends LitElement {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 1000; /* standard z-index for fixed elements */ z-index: 1000; /* standard z-index for fixed elements */
background: rgba(0, 0, 0, 0);
backdrop-filter: blur(0px);
transition: all 0.2s;
} }
.modalBox { .modalBox {
@ -88,7 +88,9 @@ export class ConsentsoftwareCookieconsent extends LitElement {
* The animation occurs when we toggle the gotIt/show attributes. * The animation occurs when we toggle the gotIt/show attributes.
*/ */
will-change: transform; /* ensure efficient rendering */ will-change: transform; /* ensure efficient rendering */
transition: all 0.2s; transition: all 0.3s;
transform: scale(0.95);
opacity: 0;
} }
/* /*
@ -261,9 +263,20 @@ export class ConsentsoftwareCookieconsent extends LitElement {
const cookieLevel = await this.csWebclientInstance.getCookieLevels(); const cookieLevel = await this.csWebclientInstance.getCookieLevels();
if (!cookieLevel) { if (!cookieLevel) {
delayFor(300).then(() => {
this.setAttribute('show', 'true'); this.setAttribute('show', 'true');
this.setAttribute('gotIt', 'false'); this.setAttribute('gotIt', 'false');
requestAnimationFrame(async () => {
await this.updated();
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
if (pageOverlay) {
pageOverlay.style.background = 'rgba(0, 0, 0, 0.5)';
pageOverlay.style.backdropFilter = 'blur(2px)';
}
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
if (modalBox) {
modalBox.style.transform = `scale(1)`;
modalBox.style.opacity = '1';
}
}); });
} else { } else {
this.setAttribute('show', 'false'); this.setAttribute('show', 'false');
@ -275,7 +288,7 @@ export class ConsentsoftwareCookieconsent extends LitElement {
* Called after the first render of the component. * Called after the first render of the component.
* We measure the actual height of the banner and update the CSS variable. * We measure the actual height of the banner and update the CSS variable.
*/ */
public firstUpdated() {} public async firstUpdated() {}
/** /**
* Called whenever the element is updated or re-rendered. * Called whenever the element is updated or re-rendered.

View File

@ -43,7 +43,7 @@ export class ConsentsoftwareMainSelection extends LitElement {
return html` return html`
<div class="maincontainer"> <div class="maincontainer">
<div class="itemBox"> <div class="itemBox">
<consentsoftware-toggle>Required</consentsoftware-toggle> <consentsoftware-toggle required>Required</consentsoftware-toggle>
</div> </div>
<div class="itemBox"> <div class="itemBox">
<consentsoftware-toggle>Preferences</consentsoftware-toggle> <consentsoftware-toggle>Preferences</consentsoftware-toggle>

View File

@ -2,6 +2,8 @@ import { LitElement, html, css, type TemplateResult } from 'lit';
import { customElement } from 'lit/decorators.js'; import { customElement } from 'lit/decorators.js';
import { property } from 'lit/decorators/property.js'; import { property } from 'lit/decorators/property.js';
import { delayFor } from '@push.rocks/smartdelay';
@customElement('consentsoftware-toggle') @customElement('consentsoftware-toggle')
export class ConsentsoftwareToggle extends LitElement { export class ConsentsoftwareToggle extends LitElement {
public static demo = () => html`<consentsoftware-toggle></consentsoftware-toggle>`; public static demo = () => html`<consentsoftware-toggle></consentsoftware-toggle>`;
@ -27,15 +29,16 @@ export class ConsentsoftwareToggle extends LitElement {
margin: auto; margin: auto;
height: 30px; height: 30px;
width: 60px; width: 60px;
border-radius: 15px; border-radius: 20px;
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
transition: all 0.2s; transition: all 0.2s;
border: 1px solid rgba(255, 255, 255, 0);
} }
:host([selected]) .toggleKnobArea { :host([selected]) .toggleKnobArea {
background: blue; background: green;
} }
.toggleKnobMover { .toggleKnobMover {
@ -51,12 +54,21 @@ export class ConsentsoftwareToggle extends LitElement {
top: 0; top: 0;
left: 0; left: 0;
transition: all 0.2s; transition: all 0.2s;
transform: scale(0.8); transform: scale(0.7);
} }
:host([selected]) .toggleKnobInner { :host([selected]) .toggleKnobInner {
background: white; background: white;
} }
:host([required]) .toggleKnobArea {
background: none;
border: 1px solid rgba(255, 255, 255, 0.1);
}
:host([required]) .toggleKnobInner {
background: rgba(255, 255, 255, 0.1);
}
`; `;
constructor() { constructor() {
@ -76,11 +88,30 @@ export class ConsentsoftwareToggle extends LitElement {
`; `;
} }
public async firstUpdated(_changedProperties: Map<string | number | symbol, unknown>) {
super.firstUpdated(_changedProperties);
if (this.required) {
this.selected = true;
this.syncSelection();
}
}
public async handleClick(mouseEvent) { public async handleClick(mouseEvent) {
if (this.required) {
const moverElement: HTMLDivElement = this.shadowRoot.querySelector('.toggleKnobMover');
moverElement.style.transform = 'translateX(20px)';
await delayFor(250);
moverElement.style.transform = 'translateX(30px)';
return;
}
this.selected = !this.selected; this.selected = !this.selected;
mouseEvent.stopPropagation(); mouseEvent.stopPropagation();
mouseEvent.preventDefault(); mouseEvent.preventDefault();
this.syncSelection();
this.dispatchEvent(new CustomEvent('toggle', { detail: { selected: this.selected } })); this.dispatchEvent(new CustomEvent('toggle', { detail: { selected: this.selected } }));
}
public async syncSelection() {
console.log(`Selected ${this.selected}`); console.log(`Selected ${this.selected}`);
const moverElement: HTMLDivElement = this.shadowRoot.querySelector('.toggleKnobMover'); const moverElement: HTMLDivElement = this.shadowRoot.querySelector('.toggleKnobMover');
if (this.selected) { if (this.selected) {

1
ts_web/pages/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './page1.js';

3
ts_web/pages/page1.ts Normal file
View File

@ -0,0 +1,3 @@
import { html } from 'lit';
export const page1 = () => html``;