@sofidevo/astro-dynamic-header 5.0.5 → 5.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Header.astro +21 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sofidevo/astro-dynamic-header",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "A dynamic Astro header component that switches between floating and fullscreen styles",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/Header.astro CHANGED
@@ -34,7 +34,7 @@ export interface Props {
34
34
  * <Header preset="dark" />
35
35
  * ```
36
36
  */
37
- preset?: "light" | "dark" | "auto" | "none" ;
37
+ preset?: "light" | "dark" | "auto" | "none";
38
38
 
39
39
  /**
40
40
  * Navigation links, home link, and fine-grained classes for the desktop
@@ -79,7 +79,6 @@ export interface Props {
79
79
  */
80
80
  classNames?: HeaderClassNames;
81
81
  headerBg?: string;
82
-
83
82
  }
84
83
 
85
84
  const {
@@ -114,15 +113,13 @@ const {
114
113
  menu__link__class,
115
114
  } = navigation;
116
115
 
117
-
118
-
119
116
  let forcedClass = "";
120
117
  if (preset !== "none") {
121
118
  forcedClass = `header--force-${preset}`;
122
119
  }
123
120
  ---
124
121
 
125
- <style >
122
+ <style>
126
123
  @layer theme, base, components, utilities;
127
124
  </style>
128
125
 
@@ -202,8 +199,12 @@ if (preset !== "none") {
202
199
  @layer theme, base, components, utilities;
203
200
 
204
201
  @layer components {
202
+ :root {
203
+ --header-bg: rgba(255, 255, 255, 0.748);
204
+ }
205
+
205
206
  .header {
206
- --bg-color: var(--l-bg);
207
+ --bg-color: var(--l-bg, rgba(255, 255, 255, 0.748));
207
208
  --bg-color-opaque: var(--l-bg-opaque, rgba(255, 255, 255, 0.748));
208
209
  --text-color: var(--l-text, #1a1a1a);
209
210
  --accent-color: var(--l-accent, #3e1c71);
@@ -220,7 +221,7 @@ if (preset !== "none") {
220
221
  transition:
221
222
  background-color 0.3s ease,
222
223
  color 0.3s ease;
223
- z-index: 200;
224
+ z-index: 200;
224
225
 
225
226
  @media (width < 768px) {
226
227
  align-self: flex-end;
@@ -231,21 +232,12 @@ if (preset !== "none") {
231
232
 
232
233
  /* Automatic dark mode detection via root class */
233
234
  :root.dark .header:not(.header--force-light):not(.header--force-dark) {
234
- --bg-color: var(--d-bg, rgba(0, 0, 0, 0.823));
235
+ --header-bg: rgba(0, 0, 0, 0.823);
236
+ --bg-color: var(--bg, rgba(0, 0, 0, 0.823));
235
237
  --bg-color-opaque: var(--d-bg-opaque, #0d0d0d);
236
238
  --text-color: var(--d-text, #ffffff);
237
239
  --accent-color: var(--d-accent, #00ffff);
238
240
  --backdrop-blur: var(--d-blur, blur(20px));
239
-
240
- }
241
-
242
- .header.header--force-auto {
243
- --bg-color: var(--l-bg);
244
- --bg-color-opaque: var(--l-bg-opaque, rgba(255, 255, 255, 0.748));
245
- --text-color: var(--l-text, #1a1a1a);
246
- --accent-color: var(--l-accent, #3e1c71);
247
- --backdrop-blur: var(--l-blur, blur(20px));
248
- background-color: var(--bg-color);
249
241
  }
250
242
 
251
243
  /* Forced themes: higher specificity than .header, no !important needed */
@@ -259,13 +251,22 @@ if (preset !== "none") {
259
251
  }
260
252
 
261
253
  .header.header--force-light {
262
- --bg-color: var(--l-bg, rgba(255, 255, 255, 0.748));
254
+ --bg-color: var(--l-bg, rgba(255, 255, 255, 0.748));
263
255
  --bg-color-opaque: var(--l-bg-opaque, rgb(255, 255, 255));
264
256
  --text-color: var(--l-text, #1a1a1a);
265
257
  --accent-color: var(--l-accent, #3e1c71);
266
258
  --backdrop-blur: var(--l-blur, blur(30px));
267
259
  background-color: var(--bg-color);
268
260
  }
261
+ .dark {
262
+ }
263
+ .header.header--force-auto {
264
+ --bg-color-opaque: var(--l-bg-opaque, rgba(255, 255, 255, 0.748));
265
+ --text-color: var(--l-text, #1a1a1a);
266
+ --accent-color: var(--l-accent, #3e1c71);
267
+ --backdrop-blur: var(--l-blur, blur(20px));
268
+ background-color: var(--header-bg);
269
+ }
269
270
 
270
271
  .header__container {
271
272
  width: 100%;
@@ -302,7 +303,7 @@ if (preset !== "none") {
302
303
 
303
304
  .header--fullscreen {
304
305
  border-radius: 0;
305
- padding:0.6rem 1em ;
306
+ padding: 0.6rem 1em;
306
307
 
307
308
  @media (width < 768px) {
308
309
  max-width: 100%;