astro-consent 1.0.17 → 2.0.0
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/CHANGELOG.md +38 -0
- package/LICENSE.md +1 -1
- package/README.md +221 -120
- package/dist/cli.cjs +228 -264
- package/dist/index.d.ts +10 -0
- package/dist/index.js +222 -80
- package/dist/templates/cssTemplate.cjs +447 -0
- package/dist/templates/cssTemplate.d.ts +1 -1
- package/package.json +8 -6
- package/dist/templates/cssTemplate.js +0 -117
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_CSS = void 0;
|
|
4
|
+
exports.DEFAULT_CSS = `
|
|
5
|
+
/*
|
|
6
|
+
astro-consent stylesheet
|
|
7
|
+
|
|
8
|
+
Generated file location:
|
|
9
|
+
src/cookiebanner/styles.css
|
|
10
|
+
|
|
11
|
+
Tweak these custom properties first. They are the public theme API.
|
|
12
|
+
|
|
13
|
+
Core surface
|
|
14
|
+
--cb-font-family
|
|
15
|
+
--cb-z-index
|
|
16
|
+
--cb-max-width
|
|
17
|
+
--cb-padding
|
|
18
|
+
--cb-gap
|
|
19
|
+
--cb-radius
|
|
20
|
+
--cb-bg
|
|
21
|
+
--cb-surface
|
|
22
|
+
--cb-surface-strong
|
|
23
|
+
--cb-text
|
|
24
|
+
--cb-muted
|
|
25
|
+
--cb-border
|
|
26
|
+
--cb-shadow
|
|
27
|
+
--cb-backdrop
|
|
28
|
+
|
|
29
|
+
Brand
|
|
30
|
+
--cb-accent
|
|
31
|
+
--cb-accent-strong
|
|
32
|
+
--cb-accent-soft
|
|
33
|
+
--cb-success
|
|
34
|
+
--cb-danger
|
|
35
|
+
|
|
36
|
+
Buttons
|
|
37
|
+
--cb-button-bg
|
|
38
|
+
--cb-button-text
|
|
39
|
+
--cb-button-border
|
|
40
|
+
--cb-button-secondary-bg
|
|
41
|
+
--cb-button-secondary-text
|
|
42
|
+
--cb-button-secondary-border
|
|
43
|
+
|
|
44
|
+
Layout
|
|
45
|
+
--cb-banner-radius
|
|
46
|
+
--cb-modal-width
|
|
47
|
+
--cb-panel-radius
|
|
48
|
+
--cb-toggle-width
|
|
49
|
+
--cb-toggle-height
|
|
50
|
+
--cb-toggle-knob
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
:root {
|
|
54
|
+
--cb-font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
55
|
+
--cb-z-index: 9999;
|
|
56
|
+
--cb-max-width: 76rem;
|
|
57
|
+
--cb-padding: 1rem;
|
|
58
|
+
--cb-gap: 0.85rem;
|
|
59
|
+
--cb-radius: 1.15rem;
|
|
60
|
+
--cb-banner-radius: 1.4rem;
|
|
61
|
+
--cb-panel-radius: 1rem;
|
|
62
|
+
--cb-modal-width: 44rem;
|
|
63
|
+
--cb-toggle-width: 3.4rem;
|
|
64
|
+
--cb-toggle-height: 2rem;
|
|
65
|
+
--cb-toggle-knob: 1.55rem;
|
|
66
|
+
|
|
67
|
+
--cb-bg: rgba(7, 11, 20, 0.9);
|
|
68
|
+
--cb-surface: rgba(255, 255, 255, 0.04);
|
|
69
|
+
--cb-surface-strong: rgba(255, 255, 255, 0.07);
|
|
70
|
+
--cb-text: #f8fafc;
|
|
71
|
+
--cb-muted: rgba(248, 250, 252, 0.72);
|
|
72
|
+
--cb-border: rgba(255, 255, 255, 0.11);
|
|
73
|
+
--cb-shadow: 0 24px 80px rgba(2, 6, 23, 0.34);
|
|
74
|
+
--cb-backdrop: rgba(2, 6, 23, 0.72);
|
|
75
|
+
|
|
76
|
+
--cb-accent: #7dd3fc;
|
|
77
|
+
--cb-accent-strong: #38bdf8;
|
|
78
|
+
--cb-accent-soft: rgba(125, 211, 252, 0.16);
|
|
79
|
+
--cb-success: #34d399;
|
|
80
|
+
--cb-danger: #fb7185;
|
|
81
|
+
|
|
82
|
+
--cb-button-bg: linear-gradient(135deg, var(--cb-accent-strong), var(--cb-success));
|
|
83
|
+
--cb-button-text: #00111a;
|
|
84
|
+
--cb-button-border: transparent;
|
|
85
|
+
--cb-button-secondary-bg: rgba(255, 255, 255, 0.03);
|
|
86
|
+
--cb-button-secondary-text: var(--cb-text);
|
|
87
|
+
--cb-button-secondary-border: var(--cb-border);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#astro-consent-banner {
|
|
91
|
+
position: fixed;
|
|
92
|
+
left: 0;
|
|
93
|
+
right: 0;
|
|
94
|
+
bottom: 0;
|
|
95
|
+
z-index: var(--cb-z-index);
|
|
96
|
+
padding: 0 var(--cb-padding) var(--cb-padding);
|
|
97
|
+
font-family: var(--cb-font-family);
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
#astro-consent-banner,
|
|
102
|
+
#astro-consent-modal {
|
|
103
|
+
opacity: 0;
|
|
104
|
+
transform: translateY(18px) scale(0.98);
|
|
105
|
+
transition:
|
|
106
|
+
opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
107
|
+
transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#astro-consent-banner.cb-visible,
|
|
111
|
+
#astro-consent-modal.cb-visible {
|
|
112
|
+
opacity: 1;
|
|
113
|
+
transform: translateY(0);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
#astro-consent-modal {
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#astro-consent-modal.cb-visible {
|
|
121
|
+
pointer-events: auto;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.cb-container,
|
|
125
|
+
.cb-modal {
|
|
126
|
+
box-sizing: border-box;
|
|
127
|
+
color: var(--cb-text);
|
|
128
|
+
border: 1px solid var(--cb-border);
|
|
129
|
+
box-shadow: var(--cb-shadow);
|
|
130
|
+
backdrop-filter: blur(24px) saturate(1.08);
|
|
131
|
+
-webkit-backdrop-filter: blur(24px) saturate(1.08);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.cb-container {
|
|
135
|
+
max-width: var(--cb-max-width);
|
|
136
|
+
margin: 0 auto;
|
|
137
|
+
padding: 1.15rem 1.2rem;
|
|
138
|
+
display: flex;
|
|
139
|
+
gap: 1.15rem;
|
|
140
|
+
justify-content: space-between;
|
|
141
|
+
align-items: center;
|
|
142
|
+
background:
|
|
143
|
+
radial-gradient(circle at top left, var(--cb-accent-soft), transparent 34%),
|
|
144
|
+
linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
|
|
145
|
+
var(--cb-bg);
|
|
146
|
+
border-radius: var(--cb-banner-radius);
|
|
147
|
+
pointer-events: auto;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.cb-container > div:first-child {
|
|
151
|
+
min-width: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.cb-title {
|
|
155
|
+
margin: 0;
|
|
156
|
+
font-size: 1rem;
|
|
157
|
+
font-weight: 700;
|
|
158
|
+
letter-spacing: -0.015em;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.cb-desc {
|
|
162
|
+
margin-top: 0.35rem;
|
|
163
|
+
color: var(--cb-muted);
|
|
164
|
+
line-height: 1.5;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.cb-desc a {
|
|
168
|
+
color: var(--cb-accent);
|
|
169
|
+
font-weight: 650;
|
|
170
|
+
text-decoration-thickness: 0.08em;
|
|
171
|
+
text-underline-offset: 0.18em;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.cb-modal-header a {
|
|
175
|
+
color: var(--cb-accent);
|
|
176
|
+
font-weight: 650;
|
|
177
|
+
text-decoration-thickness: 0.08em;
|
|
178
|
+
text-underline-offset: 0.18em;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.cb-actions {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-wrap: wrap;
|
|
184
|
+
gap: 0.65rem;
|
|
185
|
+
justify-content: flex-end;
|
|
186
|
+
flex-shrink: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.cb-actions button,
|
|
190
|
+
.cb-toggle {
|
|
191
|
+
appearance: none;
|
|
192
|
+
border: 1px solid transparent;
|
|
193
|
+
border-radius: 999px;
|
|
194
|
+
font: inherit;
|
|
195
|
+
font-weight: 650;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
transition:
|
|
198
|
+
transform 160ms ease,
|
|
199
|
+
background-color 160ms ease,
|
|
200
|
+
border-color 160ms ease,
|
|
201
|
+
color 160ms ease,
|
|
202
|
+
box-shadow 160ms ease;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.cb-actions button {
|
|
206
|
+
padding: 0.82rem 1.05rem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.cb-actions button:hover,
|
|
210
|
+
.cb-toggle:hover {
|
|
211
|
+
transform: translateY(-1px);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.cb-actions button:focus-visible,
|
|
215
|
+
.cb-toggle:focus-visible {
|
|
216
|
+
outline: 2px solid var(--cb-accent);
|
|
217
|
+
outline-offset: 2px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.cb-accept {
|
|
221
|
+
background: var(--cb-button-bg);
|
|
222
|
+
color: var(--cb-button-text);
|
|
223
|
+
border-color: var(--cb-button-border);
|
|
224
|
+
box-shadow: 0 10px 24px rgba(56, 189, 248, 0.16);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.cb-reject {
|
|
228
|
+
background: var(--cb-button-secondary-bg);
|
|
229
|
+
color: var(--cb-button-secondary-text);
|
|
230
|
+
border-color: var(--cb-button-secondary-border);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.cb-manage {
|
|
234
|
+
background: rgba(255, 255, 255, 0.02);
|
|
235
|
+
color: var(--cb-text);
|
|
236
|
+
border-color: var(--cb-border);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#astro-consent-modal {
|
|
240
|
+
position: fixed;
|
|
241
|
+
inset: 0;
|
|
242
|
+
z-index: calc(var(--cb-z-index) + 1);
|
|
243
|
+
display: grid;
|
|
244
|
+
place-items: center;
|
|
245
|
+
padding: 1rem;
|
|
246
|
+
background: var(--cb-backdrop);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#astro-consent-banner.cb-mode-overlay {
|
|
250
|
+
pointer-events: auto;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
#astro-consent-banner.cb-mode-overlay .cb-container {
|
|
254
|
+
display: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
#astro-consent-banner.cb-mode-overlay #astro-consent-modal {
|
|
258
|
+
position: fixed;
|
|
259
|
+
inset: 0;
|
|
260
|
+
min-height: 100vh;
|
|
261
|
+
padding: 1rem;
|
|
262
|
+
background:
|
|
263
|
+
radial-gradient(circle at top center, rgba(125, 211, 252, 0.12), transparent 28%),
|
|
264
|
+
var(--cb-backdrop);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
#astro-consent-banner.cb-mode-overlay .cb-modal {
|
|
268
|
+
width: min(100%, 40rem);
|
|
269
|
+
transform: translateY(0);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
#astro-consent-banner.cb-mode-overlay.cb-visible .cb-modal {
|
|
273
|
+
transform: translateY(0) scale(1);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
#astro-consent-banner.cb-mode-overlay .cb-modal-header p {
|
|
277
|
+
max-width: 38rem;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.cb-modal-header a {
|
|
281
|
+
color: var(--cb-accent);
|
|
282
|
+
text-decoration-thickness: 0.08em;
|
|
283
|
+
text-underline-offset: 0.18em;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.cb-modal {
|
|
287
|
+
width: min(100%, var(--cb-modal-width));
|
|
288
|
+
border-radius: calc(var(--cb-radius) + 0.45rem);
|
|
289
|
+
padding: 1.45rem;
|
|
290
|
+
background:
|
|
291
|
+
radial-gradient(circle at top right, var(--cb-accent-soft), transparent 32%),
|
|
292
|
+
linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025)),
|
|
293
|
+
var(--cb-bg);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.cb-modal-header h3 {
|
|
297
|
+
margin: 0;
|
|
298
|
+
font-size: 1.18rem;
|
|
299
|
+
letter-spacing: -0.022em;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.cb-modal-header p {
|
|
303
|
+
margin: 0.55rem 0 0;
|
|
304
|
+
color: var(--cb-muted);
|
|
305
|
+
line-height: 1.55;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.cb-panel {
|
|
309
|
+
margin-top: 1.05rem;
|
|
310
|
+
border-radius: var(--cb-panel-radius);
|
|
311
|
+
overflow: hidden;
|
|
312
|
+
border: 1px solid var(--cb-border);
|
|
313
|
+
background: rgba(255, 255, 255, 0.03);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.cb-row {
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: center;
|
|
319
|
+
justify-content: space-between;
|
|
320
|
+
gap: 1rem;
|
|
321
|
+
padding: 1rem 1rem;
|
|
322
|
+
border-top: 1px solid var(--cb-border);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.cb-row:first-child {
|
|
326
|
+
border-top: 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.cb-row span {
|
|
330
|
+
font-weight: 600;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.cb-row strong {
|
|
334
|
+
color: var(--cb-muted);
|
|
335
|
+
font-weight: 600;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.cb-toggle {
|
|
339
|
+
width: var(--cb-toggle-width);
|
|
340
|
+
height: var(--cb-toggle-height);
|
|
341
|
+
padding: 0;
|
|
342
|
+
position: relative;
|
|
343
|
+
background: rgba(255, 255, 255, 0.12);
|
|
344
|
+
border-color: transparent;
|
|
345
|
+
flex-shrink: 0;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.cb-toggle::before {
|
|
349
|
+
content: "";
|
|
350
|
+
position: absolute;
|
|
351
|
+
top: calc((var(--cb-toggle-height) - var(--cb-toggle-knob)) / 2);
|
|
352
|
+
left: 0.24rem;
|
|
353
|
+
width: var(--cb-toggle-knob);
|
|
354
|
+
height: var(--cb-toggle-knob);
|
|
355
|
+
border-radius: 999px;
|
|
356
|
+
background: #fff;
|
|
357
|
+
transition: transform 180ms ease, box-shadow 180ms ease;
|
|
358
|
+
box-shadow: 0 4px 12px rgba(2, 6, 23, 0.24);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.cb-toggle.active {
|
|
362
|
+
background: linear-gradient(135deg, var(--cb-accent-strong), var(--cb-success));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.cb-toggle.active::before {
|
|
366
|
+
transform: translateX(calc(var(--cb-toggle-width) - var(--cb-toggle-knob) - 0.48rem));
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.cb-actions-modal {
|
|
370
|
+
margin-top: 1.05rem;
|
|
371
|
+
justify-content: space-between;
|
|
372
|
+
padding-top: 1.05rem;
|
|
373
|
+
border-top: 1px solid var(--cb-border);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
#astro-consent-banner.cb-visible .cb-container,
|
|
377
|
+
#astro-consent-modal.cb-visible .cb-modal {
|
|
378
|
+
animation: cb-pop-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
#astro-consent-modal.cb-visible .cb-modal-header {
|
|
382
|
+
animation: cb-rise-in 320ms 40ms cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
#astro-consent-modal.cb-visible .cb-panel {
|
|
386
|
+
animation: cb-rise-in 320ms 90ms cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#astro-consent-modal.cb-visible .cb-actions-modal {
|
|
390
|
+
animation: cb-rise-in 320ms 140ms cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
@keyframes cb-pop-in {
|
|
394
|
+
from {
|
|
395
|
+
transform: translateY(8px) scale(0.985);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
to {
|
|
399
|
+
transform: translateY(0) scale(1);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@keyframes cb-rise-in {
|
|
404
|
+
from {
|
|
405
|
+
opacity: 0;
|
|
406
|
+
transform: translateY(8px);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
to {
|
|
410
|
+
opacity: 1;
|
|
411
|
+
transform: translateY(0);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
@media (max-width: 640px) {
|
|
416
|
+
#astro-consent-banner {
|
|
417
|
+
padding-inline: 0.5rem;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.cb-container {
|
|
421
|
+
flex-direction: column;
|
|
422
|
+
align-items: stretch;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.cb-actions {
|
|
426
|
+
justify-content: stretch;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.cb-actions button {
|
|
430
|
+
flex: 1 1 0;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.cb-actions-modal {
|
|
434
|
+
flex-direction: column-reverse;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.cb-actions-modal button {
|
|
438
|
+
width: 100%;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.cb-row {
|
|
442
|
+
align-items: flex-start;
|
|
443
|
+
padding-block: 0.95rem;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DEFAULT_CSS = "\n:root {\n
|
|
1
|
+
export declare const DEFAULT_CSS = "\n/*\n astro-consent stylesheet\n\n Generated file location:\n src/cookiebanner/styles.css\n\n Tweak these custom properties first. They are the public theme API.\n\n Core surface\n --cb-font-family\n --cb-z-index\n --cb-max-width\n --cb-padding\n --cb-gap\n --cb-radius\n --cb-bg\n --cb-surface\n --cb-surface-strong\n --cb-text\n --cb-muted\n --cb-border\n --cb-shadow\n --cb-backdrop\n\n Brand\n --cb-accent\n --cb-accent-strong\n --cb-accent-soft\n --cb-success\n --cb-danger\n\n Buttons\n --cb-button-bg\n --cb-button-text\n --cb-button-border\n --cb-button-secondary-bg\n --cb-button-secondary-text\n --cb-button-secondary-border\n\n Layout\n --cb-banner-radius\n --cb-modal-width\n --cb-panel-radius\n --cb-toggle-width\n --cb-toggle-height\n --cb-toggle-knob\n*/\n\n:root {\n --cb-font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n --cb-z-index: 9999;\n --cb-max-width: 76rem;\n --cb-padding: 1rem;\n --cb-gap: 0.85rem;\n --cb-radius: 1.15rem;\n --cb-banner-radius: 1.4rem;\n --cb-panel-radius: 1rem;\n --cb-modal-width: 44rem;\n --cb-toggle-width: 3.4rem;\n --cb-toggle-height: 2rem;\n --cb-toggle-knob: 1.55rem;\n\n --cb-bg: rgba(7, 11, 20, 0.9);\n --cb-surface: rgba(255, 255, 255, 0.04);\n --cb-surface-strong: rgba(255, 255, 255, 0.07);\n --cb-text: #f8fafc;\n --cb-muted: rgba(248, 250, 252, 0.72);\n --cb-border: rgba(255, 255, 255, 0.11);\n --cb-shadow: 0 24px 80px rgba(2, 6, 23, 0.34);\n --cb-backdrop: rgba(2, 6, 23, 0.72);\n\n --cb-accent: #7dd3fc;\n --cb-accent-strong: #38bdf8;\n --cb-accent-soft: rgba(125, 211, 252, 0.16);\n --cb-success: #34d399;\n --cb-danger: #fb7185;\n\n --cb-button-bg: linear-gradient(135deg, var(--cb-accent-strong), var(--cb-success));\n --cb-button-text: #00111a;\n --cb-button-border: transparent;\n --cb-button-secondary-bg: rgba(255, 255, 255, 0.03);\n --cb-button-secondary-text: var(--cb-text);\n --cb-button-secondary-border: var(--cb-border);\n}\n\n#astro-consent-banner {\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: var(--cb-z-index);\n padding: 0 var(--cb-padding) var(--cb-padding);\n font-family: var(--cb-font-family);\n pointer-events: none;\n}\n\n#astro-consent-banner,\n#astro-consent-modal {\n opacity: 0;\n transform: translateY(18px) scale(0.98);\n transition:\n opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 300ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n#astro-consent-banner.cb-visible,\n#astro-consent-modal.cb-visible {\n opacity: 1;\n transform: translateY(0);\n}\n\n#astro-consent-modal {\n pointer-events: none;\n}\n\n#astro-consent-modal.cb-visible {\n pointer-events: auto;\n}\n\n.cb-container,\n.cb-modal {\n box-sizing: border-box;\n color: var(--cb-text);\n border: 1px solid var(--cb-border);\n box-shadow: var(--cb-shadow);\n backdrop-filter: blur(24px) saturate(1.08);\n -webkit-backdrop-filter: blur(24px) saturate(1.08);\n}\n\n.cb-container {\n max-width: var(--cb-max-width);\n margin: 0 auto;\n padding: 1.15rem 1.2rem;\n display: flex;\n gap: 1.15rem;\n justify-content: space-between;\n align-items: center;\n background:\n radial-gradient(circle at top left, var(--cb-accent-soft), transparent 34%),\n linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),\n var(--cb-bg);\n border-radius: var(--cb-banner-radius);\n pointer-events: auto;\n}\n\n.cb-container > div:first-child {\n min-width: 0;\n}\n\n.cb-title {\n margin: 0;\n font-size: 1rem;\n font-weight: 700;\n letter-spacing: -0.015em;\n}\n\n.cb-desc {\n margin-top: 0.35rem;\n color: var(--cb-muted);\n line-height: 1.5;\n}\n\n.cb-desc a {\n color: var(--cb-accent);\n font-weight: 650;\n text-decoration-thickness: 0.08em;\n text-underline-offset: 0.18em;\n}\n\n.cb-modal-header a {\n color: var(--cb-accent);\n font-weight: 650;\n text-decoration-thickness: 0.08em;\n text-underline-offset: 0.18em;\n}\n\n.cb-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 0.65rem;\n justify-content: flex-end;\n flex-shrink: 0;\n}\n\n.cb-actions button,\n.cb-toggle {\n appearance: none;\n border: 1px solid transparent;\n border-radius: 999px;\n font: inherit;\n font-weight: 650;\n cursor: pointer;\n transition:\n transform 160ms ease,\n background-color 160ms ease,\n border-color 160ms ease,\n color 160ms ease,\n box-shadow 160ms ease;\n}\n\n.cb-actions button {\n padding: 0.82rem 1.05rem;\n}\n\n.cb-actions button:hover,\n.cb-toggle:hover {\n transform: translateY(-1px);\n}\n\n.cb-actions button:focus-visible,\n.cb-toggle:focus-visible {\n outline: 2px solid var(--cb-accent);\n outline-offset: 2px;\n}\n\n.cb-accept {\n background: var(--cb-button-bg);\n color: var(--cb-button-text);\n border-color: var(--cb-button-border);\n box-shadow: 0 10px 24px rgba(56, 189, 248, 0.16);\n}\n\n.cb-reject {\n background: var(--cb-button-secondary-bg);\n color: var(--cb-button-secondary-text);\n border-color: var(--cb-button-secondary-border);\n}\n\n.cb-manage {\n background: rgba(255, 255, 255, 0.02);\n color: var(--cb-text);\n border-color: var(--cb-border);\n}\n\n#astro-consent-modal {\n position: fixed;\n inset: 0;\n z-index: calc(var(--cb-z-index) + 1);\n display: grid;\n place-items: center;\n padding: 1rem;\n background: var(--cb-backdrop);\n}\n\n#astro-consent-banner.cb-mode-overlay {\n pointer-events: auto;\n}\n\n#astro-consent-banner.cb-mode-overlay .cb-container {\n display: none;\n}\n\n#astro-consent-banner.cb-mode-overlay #astro-consent-modal {\n position: fixed;\n inset: 0;\n min-height: 100vh;\n padding: 1rem;\n background:\n radial-gradient(circle at top center, rgba(125, 211, 252, 0.12), transparent 28%),\n var(--cb-backdrop);\n}\n\n#astro-consent-banner.cb-mode-overlay .cb-modal {\n width: min(100%, 40rem);\n transform: translateY(0);\n}\n\n#astro-consent-banner.cb-mode-overlay.cb-visible .cb-modal {\n transform: translateY(0) scale(1);\n}\n\n#astro-consent-banner.cb-mode-overlay .cb-modal-header p {\n max-width: 38rem;\n}\n\n.cb-modal-header a {\n color: var(--cb-accent);\n text-decoration-thickness: 0.08em;\n text-underline-offset: 0.18em;\n}\n\n.cb-modal {\n width: min(100%, var(--cb-modal-width));\n border-radius: calc(var(--cb-radius) + 0.45rem);\n padding: 1.45rem;\n background:\n radial-gradient(circle at top right, var(--cb-accent-soft), transparent 32%),\n linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025)),\n var(--cb-bg);\n}\n\n.cb-modal-header h3 {\n margin: 0;\n font-size: 1.18rem;\n letter-spacing: -0.022em;\n}\n\n.cb-modal-header p {\n margin: 0.55rem 0 0;\n color: var(--cb-muted);\n line-height: 1.55;\n}\n\n.cb-panel {\n margin-top: 1.05rem;\n border-radius: var(--cb-panel-radius);\n overflow: hidden;\n border: 1px solid var(--cb-border);\n background: rgba(255, 255, 255, 0.03);\n}\n\n.cb-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n padding: 1rem 1rem;\n border-top: 1px solid var(--cb-border);\n}\n\n.cb-row:first-child {\n border-top: 0;\n}\n\n.cb-row span {\n font-weight: 600;\n}\n\n.cb-row strong {\n color: var(--cb-muted);\n font-weight: 600;\n}\n\n.cb-toggle {\n width: var(--cb-toggle-width);\n height: var(--cb-toggle-height);\n padding: 0;\n position: relative;\n background: rgba(255, 255, 255, 0.12);\n border-color: transparent;\n flex-shrink: 0;\n}\n\n.cb-toggle::before {\n content: \"\";\n position: absolute;\n top: calc((var(--cb-toggle-height) - var(--cb-toggle-knob)) / 2);\n left: 0.24rem;\n width: var(--cb-toggle-knob);\n height: var(--cb-toggle-knob);\n border-radius: 999px;\n background: #fff;\n transition: transform 180ms ease, box-shadow 180ms ease;\n box-shadow: 0 4px 12px rgba(2, 6, 23, 0.24);\n}\n\n.cb-toggle.active {\n background: linear-gradient(135deg, var(--cb-accent-strong), var(--cb-success));\n}\n\n.cb-toggle.active::before {\n transform: translateX(calc(var(--cb-toggle-width) - var(--cb-toggle-knob) - 0.48rem));\n}\n\n.cb-actions-modal {\n margin-top: 1.05rem;\n justify-content: space-between;\n padding-top: 1.05rem;\n border-top: 1px solid var(--cb-border);\n}\n\n#astro-consent-banner.cb-visible .cb-container,\n#astro-consent-modal.cb-visible .cb-modal {\n animation: cb-pop-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;\n}\n\n#astro-consent-modal.cb-visible .cb-modal-header {\n animation: cb-rise-in 320ms 40ms cubic-bezier(0.16, 1, 0.3, 1) both;\n}\n\n#astro-consent-modal.cb-visible .cb-panel {\n animation: cb-rise-in 320ms 90ms cubic-bezier(0.16, 1, 0.3, 1) both;\n}\n\n#astro-consent-modal.cb-visible .cb-actions-modal {\n animation: cb-rise-in 320ms 140ms cubic-bezier(0.16, 1, 0.3, 1) both;\n}\n\n@keyframes cb-pop-in {\n from {\n transform: translateY(8px) scale(0.985);\n }\n\n to {\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes cb-rise-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@media (max-width: 640px) {\n #astro-consent-banner {\n padding-inline: 0.5rem;\n }\n\n .cb-container {\n flex-direction: column;\n align-items: stretch;\n }\n\n .cb-actions {\n justify-content: stretch;\n }\n\n .cb-actions button {\n flex: 1 1 0;\n }\n\n .cb-actions-modal {\n flex-direction: column-reverse;\n }\n\n .cb-actions-modal button {\n width: 100%;\n }\n\n .cb-row {\n align-items: flex-start;\n padding-block: 0.95rem;\n }\n}\n\n";
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-consent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A privacy-first, GDPR-compliant cookie consent banner for Astro with a built-in preferences modal, zero dependencies, and full theme control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
|
-
"name": "Velohost",
|
|
7
|
+
"name": "Velohost UK Limited",
|
|
8
8
|
"url": "https://velohost.co.uk"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
|
32
32
|
"README.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
33
34
|
"LICENSE.md"
|
|
34
35
|
],
|
|
35
36
|
"scripts": {
|
|
36
|
-
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cli.json &&
|
|
37
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cli.json && node -e \"const fs=require('fs');const path=require('path');fs.renameSync('dist/cli.js','dist/cli.cjs');fs.renameSync('dist/templates/cssTemplate.js','dist/templates/cssTemplate.cjs');let s=fs.readFileSync('dist/cli.cjs','utf8');s=s.replace('./templates/cssTemplate.js','./templates/cssTemplate.cjs');fs.writeFileSync('dist/cli.cjs',s);fs.chmodSync('dist/cli.cjs',0o755);\""
|
|
37
38
|
},
|
|
38
39
|
"keywords": [
|
|
39
40
|
"astro",
|
|
@@ -45,14 +46,15 @@
|
|
|
45
46
|
"analytics-consent",
|
|
46
47
|
"marketing-consent",
|
|
47
48
|
"withastro",
|
|
48
|
-
"velohost"
|
|
49
|
+
"velohost-uk-limited"
|
|
49
50
|
],
|
|
50
51
|
"peerDependencies": {
|
|
51
|
-
"astro": "^4.0.0 || ^5.0.0"
|
|
52
|
+
"astro": "^4.0.0 || ^5.0.0 || ^6.0.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/node": "^25.2.1",
|
|
55
|
-
"astro": "^
|
|
56
|
+
"astro": "^6.0.0",
|
|
57
|
+
"typescript": "^5.9.2"
|
|
56
58
|
},
|
|
57
59
|
"engines": {
|
|
58
60
|
"node": ">=18.0.0"
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_CSS = `
|
|
2
|
-
:root {
|
|
3
|
-
/* Layout */
|
|
4
|
-
--cb-z-index: 9999;
|
|
5
|
-
--cb-max-width: 960px;
|
|
6
|
-
--cb-padding: 16px;
|
|
7
|
-
--cb-gap: 12px;
|
|
8
|
-
--cb-radius: 10px;
|
|
9
|
-
|
|
10
|
-
/* Colours */
|
|
11
|
-
--cb-bg: #111827;
|
|
12
|
-
--cb-surface: #1f2933;
|
|
13
|
-
--cb-text: #ffffff;
|
|
14
|
-
--cb-muted: #9ca3af;
|
|
15
|
-
--cb-border: #374151;
|
|
16
|
-
--cb-accent: #6366f1;
|
|
17
|
-
|
|
18
|
-
/* Buttons */
|
|
19
|
-
--cb-btn-bg: var(--cb-accent);
|
|
20
|
-
--cb-btn-text: #ffffff;
|
|
21
|
-
--cb-btn-secondary-bg: transparent;
|
|
22
|
-
--cb-btn-secondary-text: var(--cb-text);
|
|
23
|
-
--cb-btn-border: var(--cb-border);
|
|
24
|
-
|
|
25
|
-
/* Typography */
|
|
26
|
-
--cb-font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
27
|
-
--cb-title-size: 1rem;
|
|
28
|
-
--cb-text-size: 0.875rem;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
#astro-consent-banner {
|
|
32
|
-
position: fixed;
|
|
33
|
-
bottom: 0;
|
|
34
|
-
left: 0;
|
|
35
|
-
right: 0;
|
|
36
|
-
z-index: var(--cb-z-index);
|
|
37
|
-
background: var(--cb-bg);
|
|
38
|
-
color: var(--cb-text);
|
|
39
|
-
font-family: var(--cb-font-family);
|
|
40
|
-
border-top: 1px solid var(--cb-border);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#astro-consent-banner > * {
|
|
44
|
-
max-width: var(--cb-max-width);
|
|
45
|
-
margin: 0 auto;
|
|
46
|
-
padding: var(--cb-padding);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#astro-consent-banner h2 {
|
|
50
|
-
margin: 0 0 4px;
|
|
51
|
-
font-size: var(--cb-title-size);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
#astro-consent-banner p {
|
|
55
|
-
margin: 0;
|
|
56
|
-
font-size: var(--cb-text-size);
|
|
57
|
-
color: var(--cb-muted);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
#astro-consent-banner a {
|
|
61
|
-
color: var(--cb-accent);
|
|
62
|
-
text-decoration: underline;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.astro-consent-categories {
|
|
66
|
-
display: grid;
|
|
67
|
-
gap: var(--cb-gap);
|
|
68
|
-
margin-top: var(--cb-gap);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.astro-consent-category {
|
|
72
|
-
background: var(--cb-surface);
|
|
73
|
-
padding: 12px;
|
|
74
|
-
border-radius: var(--cb-radius);
|
|
75
|
-
border: 1px solid var(--cb-border);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.astro-consent-label {
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: center;
|
|
81
|
-
gap: 8px;
|
|
82
|
-
font-weight: 600;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.astro-consent-description {
|
|
86
|
-
margin: 4px 0 0 26px;
|
|
87
|
-
font-size: 0.8rem;
|
|
88
|
-
color: var(--cb-muted);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.astro-consent-actions {
|
|
92
|
-
display: flex;
|
|
93
|
-
gap: 8px;
|
|
94
|
-
justify-content: flex-end;
|
|
95
|
-
margin-top: var(--cb-gap);
|
|
96
|
-
flex-wrap: wrap;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.astro-consent-actions button {
|
|
100
|
-
padding: 8px 14px;
|
|
101
|
-
border-radius: var(--cb-radius);
|
|
102
|
-
font-size: 0.875rem;
|
|
103
|
-
cursor: pointer;
|
|
104
|
-
border: 1px solid var(--cb-btn-border);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.astro-consent-actions button:first-child {
|
|
108
|
-
background: var(--cb-btn-secondary-bg);
|
|
109
|
-
color: var(--cb-btn-secondary-text);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.astro-consent-actions button:last-child {
|
|
113
|
-
background: var(--cb-btn-bg);
|
|
114
|
-
color: var(--cb-btn-text);
|
|
115
|
-
border-color: var(--cb-btn-bg);
|
|
116
|
-
}
|
|
117
|
-
`;
|