@hubpav/hwio-ui 0.4.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubpav/hwio-ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "HARDWARIO web design system for Astro: DaisyUI 5 themes generated from the brand tokens, the Tailwind entry stylesheet and the HWio* components.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,9 +31,9 @@
31
31
  "build": "node scripts/build-themes.mjs"
32
32
  },
33
33
  "dependencies": {
34
- "@hubpav/hwio-brand": "0.4.0",
35
- "@hubpav/hwio-web-runtime": "0.4.0",
36
- "@hubpav/hwio-web-worker": "0.4.0",
34
+ "@hubpav/hwio-brand": "0.5.0",
35
+ "@hubpav/hwio-web-runtime": "0.5.0",
36
+ "@hubpav/hwio-web-worker": "0.5.0",
37
37
  "daisyui": "5.7.28"
38
38
  },
39
39
  "peerDependencies": {
@@ -19,12 +19,10 @@ interface Props {
19
19
  labels: { nav: string; menu: string; close: string; theme?: string; languages?: string };
20
20
  /** Viewport from which the inline nav and CTAs replace the drawer (default lg; xl for long navs). */
21
21
  desktopFrom?: 'lg' | 'xl';
22
- /** Desktop language control: dropdown (default) or inline pills (two-language sites). */
23
- languageVariant?: 'dropdown' | 'pills';
24
22
  id?: string;
25
23
  class?: string;
26
24
  }
27
- const { nav, ctas = [], languages = [], showThemeToggle = true, scrollspy = false, labels, desktopFrom = 'lg', languageVariant = 'dropdown', id = 'hwio-nav-drawer', class: className = '' } = Astro.props;
25
+ const { nav, ctas = [], languages = [], showThemeToggle = true, scrollspy = false, labels, desktopFrom = 'lg', id = 'hwio-nav-drawer', class: className = '' } = Astro.props;
28
26
  const BREAK = {
29
27
  lg: { nav: 'hidden flex-1 justify-center lg:flex', ctas: 'hidden items-center gap-2 lg:flex', drawer: 'drawer drawer-end w-auto lg:hidden' },
30
28
  xl: { nav: 'hidden flex-1 justify-center xl:flex', ctas: 'hidden items-center gap-2 xl:flex', drawer: 'drawer drawer-end w-auto xl:hidden' },
@@ -59,7 +57,7 @@ const CTA_VARIANT = { primary: 'primary', secondary: 'secondary', ghost: 'ghost'
59
57
 
60
58
  <div class="ml-auto flex items-center gap-2">
61
59
  {showThemeToggle && <HWioThemeToggle label={labels.theme ?? 'Theme'} />}
62
- {languages.length > 1 && <HWioLanguageSwitcher items={languages} label={labels.languages ?? 'Language'} variant={languageVariant} />}
60
+ {languages.length > 1 && <HWioLanguageSwitcher items={languages} label={labels.languages ?? 'Language'} />}
63
61
  <div class={bp.ctas}>
64
62
  {ctas.map((cta) => (
65
63
  <HWioButton href={cta.href} external={cta.external} variant={CTA_VARIANT[cta.variant ?? 'primary']} size="sm" track={cta.track ?? { id: 'header-cta', location: 'header' }} class={cta.icon ? '2xl:px-4 px-2.5' : ''} aria-label={cta.icon ? cta.label : undefined} title={cta.icon ? cta.label : undefined}>
@@ -11,10 +11,6 @@ const { label, class: className = '' } = Astro.props;
11
11
  .hwio-theme-toggle :global(.hwio-theme-toggle__sun) { display: none; }
12
12
  :global([data-theme$='-dark']) .hwio-theme-toggle :global(.hwio-theme-toggle__sun) { display: block; }
13
13
  :global([data-theme$='-dark']) .hwio-theme-toggle :global(.hwio-theme-toggle__moon) { display: none; }
14
- @media (prefers-color-scheme: dark) {
15
- :global(html:not([data-theme])) .hwio-theme-toggle :global(.hwio-theme-toggle__sun) { display: block; }
16
- :global(html:not([data-theme])) .hwio-theme-toggle :global(.hwio-theme-toggle__moon) { display: none; }
17
- }
18
14
  </style>
19
15
  <script>
20
16
  import { hwioThemeRuntime } from '@hubpav/hwio-web-runtime/theme';
package/src/html.ts CHANGED
@@ -10,6 +10,8 @@ export interface HWioHtmlOptions {
10
10
  /** Pin data-theme on <html> (single-theme sites such as enerooo, or a fixed catalog page). */
11
11
  pinTheme?: boolean;
12
12
  font?: { family: string; sample?: string; sampleExt?: string } | null;
13
+ /** Share the light/dark choice across a domain's sites through a first-party cookie (e.g. '.hardwario.com'). */
14
+ themeCookieDomain?: string;
13
15
  class?: string;
14
16
  }
15
17
 
@@ -21,6 +23,7 @@ export function hwioHtmlAttrs(o: HWioHtmlOptions): Record<string, string> {
21
23
  'data-hwio-theme-light': o.themes.light,
22
24
  };
23
25
  if (o.themes.dark) attrs['data-hwio-theme-dark'] = o.themes.dark;
26
+ if (o.themeCookieDomain) attrs['data-hwio-theme-cookie-domain'] = o.themeCookieDomain;
24
27
  if (o.pinTheme || !o.themes.dark) attrs['data-theme'] = o.themes.light;
25
28
  if (o.font) {
26
29
  attrs['data-hwio-font-family'] = o.font.family;
@@ -195,10 +195,6 @@
195
195
  .hwio-logo-grey:hover { filter: none; opacity: 1; }
196
196
  [data-theme$='-dark'] .hwio-logo-grey { filter: grayscale(100%) invert(1); }
197
197
  [data-theme$='-dark'] .hwio-logo-grey:hover { filter: grayscale(100%) invert(1); opacity: 1; }
198
- @media (prefers-color-scheme: dark) {
199
- :root:not([data-theme]) .hwio-logo-grey { filter: grayscale(100%) invert(1); }
200
- :root:not([data-theme]) .hwio-logo-grey:hover { filter: grayscale(100%) invert(1); opacity: 1; }
201
- }
202
198
 
203
199
  .hwio-theme-transition,
204
200
  .hwio-theme-transition *,
@@ -2,7 +2,7 @@
2
2
  @plugin "daisyui/theme" {
3
3
  name: "hwio-dark";
4
4
  default: false;
5
- prefersdark: true;
5
+ prefersdark: false;
6
6
  color-scheme: dark;
7
7
  --color-base-100: #0f0f14;
8
8
  --color-base-200: #1a1a22;
@@ -40,10 +40,3 @@
40
40
  --hwio-container-pad: 27px;
41
41
  --hwio-kicker-on-neutral: #f43f5e;
42
42
  }
43
-
44
- @media (prefers-color-scheme: dark) {
45
- :root:not([data-theme]) {
46
- --hwio-font-sans: 'Inter', 'Inter Fallback', ui-sans-serif, system-ui, sans-serif;
47
- --hwio-kicker-on-neutral: #f43f5e;
48
- }
49
- }