@consent.software/catalog 1.6.1 → 2.0.1
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/dist_bundle/bundle.js +655 -329
- package/dist_bundle/bundle.js.map +4 -4
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/consentsoftware-cookieconsent.d.ts +7 -20
- package/dist_ts_web/elements/consentsoftware-cookieconsent.js +200 -252
- package/dist_ts_web/elements/consentsoftware-header.d.ts +3 -4
- package/dist_ts_web/elements/consentsoftware-header.js +35 -23
- package/dist_ts_web/elements/consentsoftware-mainselection.d.ts +4 -5
- package/dist_ts_web/elements/consentsoftware-mainselection.js +54 -28
- package/dist_ts_web/elements/consentsoftware-tabs.d.ts +4 -5
- package/dist_ts_web/elements/consentsoftware-tabs.js +44 -36
- package/dist_ts_web/elements/consentsoftware-toggle.d.ts +11 -9
- package/dist_ts_web/elements/consentsoftware-toggle.js +103 -94
- package/dist_ts_web/elements/shared.d.ts +35 -1
- package/dist_ts_web/elements/shared.js +36 -2
- package/dist_ts_web/pages/page1.d.ts +1 -1
- package/dist_ts_web/pages/page1.js +2 -2
- package/dist_watch/bundle.js +503 -437
- package/dist_watch/bundle.js.map +3 -3
- package/package.json +3 -3
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/consentsoftware-cookieconsent.ts +218 -250
- package/ts_web/elements/consentsoftware-header.ts +40 -23
- package/ts_web/elements/consentsoftware-mainselection.ts +60 -30
- package/ts_web/elements/consentsoftware-tabs.ts +51 -37
- package/ts_web/elements/consentsoftware-toggle.ts +123 -107
- package/ts_web/elements/shared.ts +38 -2
- package/ts_web/pages/page1.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consent.software/catalog",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@consent.software/interfaces": "^1.0.14",
|
|
14
14
|
"@consent.software/webclient": "^1.1.0",
|
|
15
|
-
"@
|
|
16
|
-
"
|
|
15
|
+
"@design.estate/dees-element": "^2.1.3",
|
|
16
|
+
"@push.rocks/smartdelay": "^3.0.5"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@design.estate/dees-wcctools": "^1.2.1",
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@consent.software/catalog',
|
|
6
|
-
version: '
|
|
6
|
+
version: '2.0.1',
|
|
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
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cssManager, colors } from './shared.js';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
DeesElement,
|
|
5
|
+
customElement,
|
|
6
|
+
html,
|
|
7
|
+
css,
|
|
8
|
+
type TemplateResult,
|
|
9
|
+
} from '@design.estate/dees-element';
|
|
6
10
|
|
|
7
11
|
import * as csInterfaces from '@consent.software/interfaces';
|
|
8
12
|
import * as csWebclient from '@consent.software/webclient';
|
|
@@ -15,215 +19,191 @@ declare global {
|
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
@customElement('consentsoftware-cookieconsent')
|
|
18
|
-
export class ConsentsoftwareCookieconsent extends
|
|
22
|
+
export class ConsentsoftwareCookieconsent extends DeesElement {
|
|
19
23
|
public static demo = () => html`<consentsoftware-cookieconsent></consentsoftware-cookieconsent>`;
|
|
20
24
|
|
|
21
25
|
public csWebclientInstance = new csWebclient.CsWebclient();
|
|
22
26
|
public csWebclientRan = false;
|
|
27
|
+
private isMobile = false;
|
|
28
|
+
|
|
29
|
+
public static styles = [
|
|
30
|
+
cssManager.defaultStyles,
|
|
31
|
+
css`
|
|
32
|
+
:host {
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
user-select: none;
|
|
35
|
+
}
|
|
23
36
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
.pageOverlay {
|
|
38
|
+
position: fixed;
|
|
39
|
+
inset: 0;
|
|
40
|
+
display: grid;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
z-index: 1000;
|
|
44
|
+
background: rgba(0, 0, 0, 0);
|
|
45
|
+
backdrop-filter: blur(0px);
|
|
46
|
+
transition: background 0.3s ease, backdrop-filter 0.3s ease;
|
|
47
|
+
}
|
|
27
48
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* Theme-specific overrides modify these for dark mode.
|
|
32
|
-
*/
|
|
33
|
-
public static styles = css`
|
|
34
|
-
:host {
|
|
35
|
-
font-family: ${shared.fontStack};
|
|
36
|
-
user-select: none;
|
|
37
|
-
/* Default variables for Light Theme */
|
|
38
|
-
--text-color: #333;
|
|
39
|
-
--background-color: #eeeeee;
|
|
40
|
-
--accent-color: #333333;
|
|
41
|
-
--button-bg: #ffffff;
|
|
42
|
-
--button-hover-bg: #f2f2f2;
|
|
43
|
-
--icon-color: #4496f5;
|
|
44
|
-
--link-color: #333;
|
|
45
|
-
--padding-sides: 16px;
|
|
46
|
-
/* Additional variables for modal and info container styling */
|
|
47
|
-
--info-bg: rgba(0, 0, 0, 0.1);
|
|
48
|
-
--info-text: rgba(255, 255, 255, 0.5);
|
|
49
|
-
--modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
|
|
50
|
-
}
|
|
49
|
+
.pageOverlay.shake {
|
|
50
|
+
background: rgba(0, 0, 0, 0.6) !important;
|
|
51
|
+
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
.modalBox {
|
|
54
|
+
display: block;
|
|
55
|
+
color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
|
|
56
|
+
background: ${cssManager.bdTheme(colors.light.background, colors.dark.background)};
|
|
57
|
+
box-shadow:
|
|
58
|
+
0 0 0 1px ${cssManager.bdTheme(colors.light.border, colors.dark.border)},
|
|
59
|
+
0 16px 70px ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(0, 0, 0, 0.35)')};
|
|
60
|
+
position: relative;
|
|
61
|
+
border-radius: 8px;
|
|
62
|
+
max-width: 520px;
|
|
63
|
+
min-width: 320px;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
overflow: hidden;
|
|
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
|
+
opacity: 0;
|
|
70
|
+
}
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
--text-color: #333;
|
|
72
|
-
--background-color: #eeeeee;
|
|
73
|
-
--accent-color: #333333;
|
|
74
|
-
--button-bg: #ffffff;
|
|
75
|
-
--button-hover-bg: #f2f2f2;
|
|
76
|
-
--icon-color: #4496f5;
|
|
77
|
-
--link-color: #333;
|
|
78
|
-
--info-bg: rgba(0, 0, 0, 0.1);
|
|
79
|
-
--info-text: rgba(0, 0, 0, 0.5);
|
|
80
|
-
--modal-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
|
|
81
|
-
}
|
|
72
|
+
.modalBox.visible {
|
|
73
|
+
transform: scale(1) translateY(0);
|
|
74
|
+
opacity: 1;
|
|
75
|
+
}
|
|
82
76
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
bottom: 0;
|
|
88
|
-
right: 0;
|
|
89
|
-
left: 0;
|
|
90
|
-
display: grid;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
z-index: 1000; /* Ensures the overlay is on top of other elements */
|
|
94
|
-
background: rgba(255, 255, 255, 0);
|
|
95
|
-
backdrop-filter: blur(0px);
|
|
96
|
-
transition: all 0.2s;
|
|
97
|
-
}
|
|
77
|
+
.modalBox.hiding {
|
|
78
|
+
transform: scale(0.95) translateY(10px);
|
|
79
|
+
opacity: 0;
|
|
80
|
+
}
|
|
98
81
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
/* Mobile: slide up from bottom */
|
|
83
|
+
@media (max-width: 560px) {
|
|
84
|
+
.pageOverlay {
|
|
85
|
+
align-items: flex-end;
|
|
86
|
+
}
|
|
103
87
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
border: 1px dotted rgba(255, 255, 255, 0.1);
|
|
112
|
-
border-top: 1px solid var(--accent-color);
|
|
113
|
-
border-radius: 16px;
|
|
114
|
-
max-width: 1100px;
|
|
115
|
-
min-width: calc(100vw / 3);
|
|
116
|
-
box-sizing: border-box;
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
will-change: transform;
|
|
119
|
-
transition: all 0.3s;
|
|
120
|
-
transform: scale(0.95);
|
|
121
|
-
opacity: 0;
|
|
122
|
-
}
|
|
88
|
+
.modalBox {
|
|
89
|
+
max-width: 100%;
|
|
90
|
+
min-width: 100%;
|
|
91
|
+
border-radius: 16px 16px 0 0;
|
|
92
|
+
transform: translateY(100%);
|
|
93
|
+
opacity: 1;
|
|
94
|
+
}
|
|
123
95
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
96
|
+
.modalBox.visible {
|
|
97
|
+
transform: translateY(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.modalBox.hiding {
|
|
101
|
+
transform: translateY(100%);
|
|
102
|
+
}
|
|
130
103
|
}
|
|
131
|
-
}
|
|
132
104
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
105
|
+
.modalBox.shake {
|
|
106
|
+
animation: shake 120ms 2 linear;
|
|
107
|
+
}
|
|
137
108
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
transform:
|
|
109
|
+
@keyframes shake {
|
|
110
|
+
0% { transform: translateX(3px); }
|
|
111
|
+
50% { transform: translateX(-3px); }
|
|
112
|
+
100% { transform: translateX(0); }
|
|
141
113
|
}
|
|
142
|
-
|
|
143
|
-
|
|
114
|
+
|
|
115
|
+
:host([show='false']) { display: none; }
|
|
116
|
+
:host([show='true']) { display: block; }
|
|
117
|
+
|
|
118
|
+
.content {
|
|
119
|
+
margin: auto;
|
|
144
120
|
}
|
|
145
|
-
|
|
146
|
-
|
|
121
|
+
|
|
122
|
+
.text-container {
|
|
123
|
+
padding: 12px 16px;
|
|
124
|
+
font-size: 0.9em;
|
|
125
|
+
line-height: 1.5;
|
|
126
|
+
color: ${cssManager.bdTheme(colors.light.mutedForeground, colors.dark.mutedForeground)};
|
|
147
127
|
}
|
|
148
|
-
}
|
|
149
128
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
display: block;
|
|
156
|
-
}
|
|
129
|
+
.text-container a {
|
|
130
|
+
color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
|
|
131
|
+
text-decoration: underline;
|
|
132
|
+
text-underline-offset: 2px;
|
|
133
|
+
}
|
|
157
134
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
135
|
+
.text-container a:hover {
|
|
136
|
+
opacity: 0.8;
|
|
137
|
+
}
|
|
161
138
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
139
|
+
.button-container {
|
|
140
|
+
padding: 12px 16px 16px;
|
|
141
|
+
display: grid;
|
|
142
|
+
grid-template-columns: repeat(3, 1fr);
|
|
143
|
+
gap: 8px;
|
|
144
|
+
}
|
|
168
145
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
146
|
+
@media (max-width: 560px) {
|
|
147
|
+
.button-container {
|
|
148
|
+
grid-template-columns: 1fr;
|
|
149
|
+
padding-bottom: max(16px, env(safe-area-inset-bottom));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
173
152
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
153
|
+
.consent-button {
|
|
154
|
+
border-radius: 6px;
|
|
155
|
+
background: ${cssManager.bdTheme(colors.light.secondary, colors.dark.secondary)};
|
|
156
|
+
border: 1px solid ${cssManager.bdTheme(colors.light.border, colors.dark.border)};
|
|
157
|
+
padding: 8px 16px;
|
|
158
|
+
font-size: 0.85em;
|
|
159
|
+
font-weight: 500;
|
|
160
|
+
text-align: center;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
transition: all 0.15s ease;
|
|
163
|
+
color: ${cssManager.bdTheme(colors.light.secondaryForeground, colors.dark.secondaryForeground)};
|
|
164
|
+
}
|
|
180
165
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
grid-template-columns: 1fr;
|
|
166
|
+
.consent-button:hover {
|
|
167
|
+
background: ${cssManager.bdTheme(colors.light.accent, colors.dark.accent)};
|
|
168
|
+
border-color: ${cssManager.bdTheme(colors.light.ring, colors.dark.ring)};
|
|
185
169
|
}
|
|
186
|
-
}
|
|
187
170
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
background: var(--button-bg);
|
|
192
|
-
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
|
|
193
|
-
padding: 10px;
|
|
194
|
-
line-height: 30px;
|
|
195
|
-
text-align: center;
|
|
196
|
-
cursor: pointer;
|
|
197
|
-
transition: all 0.2s;
|
|
198
|
-
}
|
|
171
|
+
.consent-button:active {
|
|
172
|
+
transform: scale(0.98);
|
|
173
|
+
}
|
|
199
174
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
175
|
+
.consent-button:last-child {
|
|
176
|
+
background: ${cssManager.bdTheme(colors.light.primary, colors.dark.primary)};
|
|
177
|
+
color: ${cssManager.bdTheme(colors.light.primaryForeground, colors.dark.primaryForeground)};
|
|
178
|
+
border-color: ${cssManager.bdTheme(colors.light.primary, colors.dark.primary)};
|
|
179
|
+
}
|
|
203
180
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
line-height: 3em;
|
|
208
|
-
background: var(--info-bg);
|
|
209
|
-
border-top: 1px dotted rgba(255, 255, 255, 0.1);
|
|
210
|
-
font-size: 0.8em;
|
|
211
|
-
color: var(--info-text);
|
|
212
|
-
}
|
|
181
|
+
.consent-button:last-child:hover {
|
|
182
|
+
opacity: 0.9;
|
|
183
|
+
}
|
|
213
184
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
185
|
+
.info-container {
|
|
186
|
+
text-align: center;
|
|
187
|
+
padding: 10px 16px;
|
|
188
|
+
background: ${cssManager.bdTheme(colors.light.muted, colors.dark.muted)};
|
|
189
|
+
border-top: 1px solid ${cssManager.bdTheme(colors.light.border, colors.dark.border)};
|
|
190
|
+
font-size: 0.75em;
|
|
191
|
+
color: ${cssManager.bdTheme(colors.light.mutedForeground, colors.dark.mutedForeground)};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.info-container a {
|
|
195
|
+
color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
|
|
196
|
+
text-decoration: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.info-container a:hover {
|
|
200
|
+
text-decoration: underline;
|
|
201
|
+
}
|
|
202
|
+
`,
|
|
203
|
+
];
|
|
223
204
|
|
|
224
205
|
constructor() {
|
|
225
206
|
super();
|
|
226
|
-
// Initially hide the consent banner until needed
|
|
227
207
|
this.setAttribute('show', 'false');
|
|
228
208
|
}
|
|
229
209
|
|
|
@@ -234,11 +214,11 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
234
214
|
<div class="content">
|
|
235
215
|
<consentsoftware-header></consentsoftware-header>
|
|
236
216
|
<consentsoftware-tabs></consentsoftware-tabs>
|
|
237
|
-
<div class="text-container"
|
|
217
|
+
<div class="text-container">
|
|
238
218
|
<div class="toptext">
|
|
239
|
-
|
|
219
|
+
We use cookies to enhance your experience. Review our
|
|
240
220
|
<a href="https://lossless.gmbh/cookie" target="_blank">cookie policy</a>
|
|
241
|
-
and
|
|
221
|
+
and select your preferences.
|
|
242
222
|
</div>
|
|
243
223
|
</div>
|
|
244
224
|
<consentsoftware-mainselection></consentsoftware-mainselection>
|
|
@@ -277,46 +257,26 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
277
257
|
|
|
278
258
|
/**
|
|
279
259
|
* Lifecycle method called when the element is connected to the DOM.
|
|
280
|
-
*
|
|
260
|
+
* Displays the consent banner if no cookie levels are set.
|
|
281
261
|
*/
|
|
282
262
|
public async connectedCallback() {
|
|
283
|
-
super.connectedCallback();
|
|
284
|
-
|
|
263
|
+
await super.connectedCallback();
|
|
264
|
+
|
|
265
|
+
// Check if mobile
|
|
266
|
+
this.isMobile = window.matchMedia('(max-width: 560px)').matches;
|
|
285
267
|
|
|
286
268
|
const cookieLevel = await this.csWebclientInstance.getCookieLevels();
|
|
287
269
|
if (!cookieLevel) {
|
|
288
|
-
// Show consent banner if cookie levels haven't been set yet
|
|
289
270
|
this.setAttribute('show', 'true');
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (pageOverlay) {
|
|
294
|
-
// Apply dark overlay styling when modal appears
|
|
295
|
-
pageOverlay.style.background = 'rgba(0,0,0, 0.5)';
|
|
296
|
-
pageOverlay.style.backdropFilter = 'blur(20px)';
|
|
297
|
-
}
|
|
298
|
-
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
|
299
|
-
if (modalBox) {
|
|
300
|
-
// Animate modal box appearance
|
|
301
|
-
modalBox.style.transform = `scale(1)`;
|
|
302
|
-
modalBox.style.opacity = '1';
|
|
303
|
-
}
|
|
304
|
-
});
|
|
271
|
+
// Small delay to ensure DOM is ready, then animate in
|
|
272
|
+
await delayFor(50);
|
|
273
|
+
this.animateIn();
|
|
305
274
|
} else {
|
|
306
|
-
// Hide banner if cookie levels are already set
|
|
307
275
|
this.setAttribute('show', 'false');
|
|
308
276
|
}
|
|
309
277
|
}
|
|
310
278
|
|
|
311
279
|
public async firstUpdated() {
|
|
312
|
-
// Placeholder for any logic needed after first render
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Called after updates. Logs banner height and runs consent scripts if necessary.
|
|
317
|
-
*/
|
|
318
|
-
public async updated() {
|
|
319
|
-
console.log(`The height of the cookie banner is ${this.shadowRoot?.host?.clientHeight}px`);
|
|
320
280
|
const acceptedCookieLevels = await this.csWebclientInstance.getCookieLevels();
|
|
321
281
|
if (!this.csWebclientRan && acceptedCookieLevels) {
|
|
322
282
|
this.csWebclientRan = true;
|
|
@@ -324,32 +284,58 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
324
284
|
}
|
|
325
285
|
}
|
|
326
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
|
+
|
|
327
319
|
/**
|
|
328
320
|
* Handles consent button clicks, sets cookie levels, and hides the banner.
|
|
329
|
-
* Uses theme variables for styling transitions.
|
|
330
321
|
*/
|
|
331
322
|
private async handleConsentButtonClick(
|
|
332
|
-
|
|
323
|
+
_event: MouseEvent,
|
|
333
324
|
levelsArg: csInterfaces.TCookieLevel[]
|
|
334
325
|
) {
|
|
335
326
|
console.log(`Set level to ${levelsArg}`);
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
pageOverlay.style.background = 'rgba(255,255,255, 0)';
|
|
340
|
-
pageOverlay.style.backdropFilter = 'blur(0px)';
|
|
341
|
-
}
|
|
342
|
-
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
|
343
|
-
if (modalBox) {
|
|
344
|
-
// Scale down and fade out modal box before hiding
|
|
345
|
-
modalBox.style.transform = `scale(0.95)`;
|
|
346
|
-
modalBox.style.opacity = '0';
|
|
347
|
-
}
|
|
327
|
+
|
|
328
|
+
await this.animateOut();
|
|
329
|
+
|
|
348
330
|
// Save user consent preferences
|
|
349
331
|
await this.csWebclientInstance.setCookieLevels(levelsArg);
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
332
|
+
this.setAttribute('show', 'false');
|
|
333
|
+
|
|
334
|
+
// Run consent scripts
|
|
335
|
+
if (!this.csWebclientRan) {
|
|
336
|
+
this.csWebclientRan = true;
|
|
337
|
+
await this.csWebclientInstance.getAndRunConsentTuples();
|
|
338
|
+
}
|
|
353
339
|
}
|
|
354
340
|
|
|
355
341
|
/**
|
|
@@ -358,30 +344,12 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
358
344
|
*/
|
|
359
345
|
private async pageOverlayClick(e: MouseEvent) {
|
|
360
346
|
if (e.target === e.currentTarget) {
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
if (pageOverlay && modalBox) {
|
|
364
|
-
pageOverlay.classList.add('shake');
|
|
347
|
+
const modalBox = this.shadowRoot?.querySelector('.modalBox') as HTMLDivElement;
|
|
348
|
+
if (modalBox) {
|
|
365
349
|
modalBox.classList.add('shake');
|
|
366
|
-
await delayFor(
|
|
367
|
-
pageOverlay.classList.remove('shake');
|
|
350
|
+
await delayFor(300);
|
|
368
351
|
modalBox.classList.remove('shake');
|
|
369
352
|
}
|
|
370
353
|
}
|
|
371
354
|
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Dynamically switches the theme between light and dark.
|
|
375
|
-
* Listens for system theme changes to update the component's theme.
|
|
376
|
-
*/
|
|
377
|
-
private updateTheme() {
|
|
378
|
-
// Check the initial system preference for dark mode
|
|
379
|
-
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
380
|
-
this.theme = prefersDark ? 'dark' : 'light';
|
|
381
|
-
|
|
382
|
-
// Listen for changes in the system color scheme preference
|
|
383
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
|
384
|
-
this.theme = e.matches ? 'dark' : 'light';
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
355
|
}
|
|
@@ -1,36 +1,53 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cssManager, colors } from './shared.js';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
DeesElement,
|
|
5
|
+
customElement,
|
|
6
|
+
html,
|
|
7
|
+
css,
|
|
8
|
+
type TemplateResult,
|
|
9
|
+
} from '@design.estate/dees-element';
|
|
6
10
|
|
|
7
11
|
@customElement('consentsoftware-header')
|
|
8
|
-
export class ConsentsoftwareHeader extends
|
|
9
|
-
public static demo = () => html`<consentsoftware-
|
|
12
|
+
export class ConsentsoftwareHeader extends DeesElement {
|
|
13
|
+
public static demo = () => html`<consentsoftware-header></consentsoftware-header>`;
|
|
10
14
|
|
|
11
|
-
public static styles =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
public static styles = [
|
|
16
|
+
cssManager.defaultStyles,
|
|
17
|
+
css`
|
|
18
|
+
:host {
|
|
19
|
+
display: block;
|
|
20
|
+
padding: 14px 16px;
|
|
21
|
+
border-bottom: 1px solid ${cssManager.bdTheme(colors.light.border, colors.dark.border)};
|
|
22
|
+
}
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
.heading {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
font-size: 0.95em;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
color: ${cssManager.bdTheme(colors.light.foreground, colors.dark.foreground)};
|
|
31
|
+
}
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
.icon {
|
|
34
|
+
width: 18px;
|
|
35
|
+
height: 18px;
|
|
36
|
+
opacity: 0.7;
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
];
|
|
28
40
|
|
|
29
41
|
public render(): TemplateResult {
|
|
30
42
|
return html`
|
|
31
43
|
<div class="heading">
|
|
32
|
-
|
|
44
|
+
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
45
|
+
<circle cx="12" cy="12" r="10"/>
|
|
46
|
+
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
|
|
47
|
+
<path d="M12 17h.01"/>
|
|
48
|
+
</svg>
|
|
49
|
+
Cookie Preferences
|
|
33
50
|
</div>
|
|
34
51
|
`;
|
|
35
52
|
}
|
|
36
|
-
}
|
|
53
|
+
}
|