astro-consent 1.0.3 → 1.0.5

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # astro-cookiebanner
1
+ # astro-consent
2
2
 
3
- A **privacyfirst, zerodependency cookie consent banner** for Astro projects — built for speed, compliance, and full visual control.
3
+ A **privacy-first, zero-dependency cookie consent banner** for Astro projects — built for speed, compliance, and full visual control.
4
4
 
5
5
  Designed and maintained by **Velohost**.
6
6
 
@@ -20,34 +20,46 @@ Designed and maintained by **Velohost**.
20
20
 
21
21
  ---
22
22
 
23
- ## 📦 Installation
23
+ ## 📦 Installation (Required)
24
+
25
+ This package uses **both an Astro integration and a CLI installer**.
26
+
27
+ ### 1️⃣ Install the package
24
28
 
25
29
  ```bash
26
- npm install astro-cookiebanner
30
+ npm install astro-consent
27
31
  ```
28
32
 
29
- Then run the installer inside your Astro project:
33
+ This step is **required** so Astro can import the integration at build time.
34
+
35
+ ### 2️⃣ Run the installer
30
36
 
31
37
  ```bash
32
- npx astro-cookiebanner
38
+ npx astro-consent
33
39
  ```
34
40
 
35
- To remove everything:
41
+ This will:
42
+
43
+ - Inject the Astro integration into `astro.config.*`
44
+ - Create `src/cookiebanner.css` (theme variables)
45
+ - Enable the consent banner automatically
46
+
47
+ ### ❌ Uninstall
36
48
 
37
49
  ```bash
38
- npx astro-cookiebanner remove
50
+ npx astro-consent remove
39
51
  ```
40
52
 
41
53
  ---
42
54
 
43
- ## 🔧 Usage
55
+ ## 🔧 Astro Integration Usage
44
56
 
45
57
  ```ts
46
- import astroCookieBanner from "astro-cookiebanner";
58
+ import astroConsent from "astro-consent";
47
59
 
48
60
  export default {
49
61
  integrations: [
50
- astroCookieBanner({
62
+ astroConsent({
51
63
  siteName: "My Website",
52
64
  policyUrl: "/privacy",
53
65
  consent: {
@@ -73,16 +85,6 @@ window.cookieConsent.set({ essential: true, analytics: true });
73
85
  window.cookieConsent.reset();
74
86
  ```
75
87
 
76
- Example conditional loading:
77
-
78
- ```js
79
- const consent = window.cookieConsent.get();
80
-
81
- if (consent?.categories?.analytics) {
82
- // Load analytics script
83
- }
84
- ```
85
-
86
88
  ---
87
89
 
88
90
  ## 🎨 Theming
@@ -112,17 +114,8 @@ Open‑source with **mandatory attribution**.
112
114
 
113
115
  Any public use, fork, or redistribution **must credit Velohost**.
114
116
 
115
- See `LICENSE.md` for full terms.
116
-
117
117
  ---
118
118
 
119
119
  ## 🏢 Velohost
120
120
 
121
- Built by **Velohost**
122
- https://velohost.co.uk
123
-
124
- ---
125
-
126
- ## 🤝 Contributions
127
-
128
- PRs welcome — attribution must be preserved.
121
+ https://velohost.co.uk/
@@ -28,7 +28,7 @@ export const DEFAULT_CSS = `
28
28
  --cb-text-size: 0.875rem;
29
29
  }
30
30
 
31
- #astro-cookie-banner {
31
+ #astro-consent-banner {
32
32
  position: fixed;
33
33
  bottom: 0;
34
34
  left: 0;
@@ -40,55 +40,55 @@ export const DEFAULT_CSS = `
40
40
  border-top: 1px solid var(--cb-border);
41
41
  }
42
42
 
43
- #astro-cookie-banner > * {
43
+ #astro-consent-banner > * {
44
44
  max-width: var(--cb-max-width);
45
45
  margin: 0 auto;
46
46
  padding: var(--cb-padding);
47
47
  }
48
48
 
49
- #astro-cookie-banner h2 {
49
+ #astro-consent-banner h2 {
50
50
  margin: 0 0 4px;
51
51
  font-size: var(--cb-title-size);
52
52
  }
53
53
 
54
- #astro-cookie-banner p {
54
+ #astro-consent-banner p {
55
55
  margin: 0;
56
56
  font-size: var(--cb-text-size);
57
57
  color: var(--cb-muted);
58
58
  }
59
59
 
60
- #astro-cookie-banner a {
60
+ #astro-consent-banner a {
61
61
  color: var(--cb-accent);
62
62
  text-decoration: underline;
63
63
  }
64
64
 
65
- .astro-cookie-categories {
65
+ .astro-consent-categories {
66
66
  display: grid;
67
67
  gap: var(--cb-gap);
68
68
  margin-top: var(--cb-gap);
69
69
  }
70
70
 
71
- .astro-cookie-category {
71
+ .astro-consent-category {
72
72
  background: var(--cb-surface);
73
73
  padding: 12px;
74
74
  border-radius: var(--cb-radius);
75
75
  border: 1px solid var(--cb-border);
76
76
  }
77
77
 
78
- .astro-cookie-label {
78
+ .astro-consent-label {
79
79
  display: flex;
80
80
  align-items: center;
81
81
  gap: 8px;
82
82
  font-weight: 600;
83
83
  }
84
84
 
85
- .astro-cookie-description {
85
+ .astro-consent-description {
86
86
  margin: 4px 0 0 26px;
87
87
  font-size: 0.8rem;
88
88
  color: var(--cb-muted);
89
89
  }
90
90
 
91
- .astro-cookie-actions {
91
+ .astro-consent-actions {
92
92
  display: flex;
93
93
  gap: 8px;
94
94
  justify-content: flex-end;
@@ -96,7 +96,7 @@ export const DEFAULT_CSS = `
96
96
  flex-wrap: wrap;
97
97
  }
98
98
 
99
- .astro-cookie-actions button {
99
+ .astro-consent-actions button {
100
100
  padding: 8px 14px;
101
101
  border-radius: var(--cb-radius);
102
102
  font-size: 0.875rem;
@@ -104,14 +104,14 @@ export const DEFAULT_CSS = `
104
104
  border: 1px solid var(--cb-btn-border);
105
105
  }
106
106
 
107
- .astro-cookie-actions button:first-child {
107
+ .astro-consent-actions button:first-child {
108
108
  background: var(--cb-btn-secondary-bg);
109
109
  color: var(--cb-btn-secondary-text);
110
110
  }
111
111
 
112
- .astro-cookie-actions button:last-child {
112
+ .astro-consent-actions button:last-child {
113
113
  background: var(--cb-btn-bg);
114
114
  color: var(--cb-btn-text);
115
115
  border-color: var(--cb-btn-bg);
116
116
  }
117
- `;
117
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-consent",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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": {