@placeholderco/placeholder-ui 2.2.3 → 2.2.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/dist/app.css CHANGED
@@ -46,7 +46,6 @@
46
46
  --ui-link-color: var(--ui-tertiary-dark);
47
47
  --ui-link-hover-color: var(--ui-accent-dark);
48
48
 
49
-
50
49
  /* ---- Surfaces and text (light mode) ---- */
51
50
  --off-white: rgb(221, 221, 221);
52
51
  --input-bg: #fff;
@@ -82,6 +81,13 @@
82
81
  font-family: var(--ui-font-family);
83
82
  }
84
83
 
84
+ /* The `site` Navbar variant is a taller marketing header. Raising the token here (rather than
85
+ on the header itself) keeps --page-content-height, Sidenav and Drawer in step with it.
86
+ :where() keeps specificity at :root level so a consumer's own --header-height still wins. */
87
+ :root:where(:has(.pui-navbar.site)) {
88
+ --header-height: 68px;
89
+ }
90
+
85
91
  .dark {
86
92
  --input-bg: rgb(33, 37, 41);
87
93
  --page-bg: rgb(36, 37, 40);
@@ -11,6 +11,7 @@
11
11
  import Link from '../ui/Link.svelte';
12
12
  import Logo from '../ui/Logo.svelte';
13
13
  import type { Snippet } from 'svelte';
14
+ import { themeState } from '../theme.svelte.js';
14
15
 
15
16
  export type NavbarVariant = 'default' | 'primary' | 'site';
16
17
 
@@ -20,7 +21,9 @@
20
21
  * - `primary` uses the primary brand colour as the background across all themes.
21
22
  * - `site` is a marketing-site header: logo on the left, links pushed to the right with an
22
23
  * accent underline on the `active` item. Below 768px the links collapse and the drawer
23
- * button (enable with `showDrawerButton`) is shown instead.
24
+ * button (enable with `showDrawerButton`) is shown instead. While a site header is on the
25
+ * page, `--header-height` is raised to 68px (see app.css), so `--page-content-height`
26
+ * follows automatically.
24
27
  */
25
28
  variant?: NavbarVariant;
26
29
  /** App navigation link displayed as a header */
@@ -74,9 +77,13 @@
74
77
 
75
78
  const isPrimary = $derived(variant === 'primary');
76
79
  const isSite = $derived(variant === 'site');
80
+ // Site variant: the drawer button is the only nav control on mobile, so keep it legible on dark
81
+ const drawerButtonVariant = $derived(
82
+ isPrimary || (isSite && themeState.isDarkMode) ? 'accent-subtle' : 'secondary-subtle'
83
+ );
77
84
  </script>
78
85
 
79
- <header class={isPrimary ? 'primary' : isSite ? 'site' : ''}>
86
+ <header class="pui-navbar {isPrimary ? 'primary' : isSite ? 'site' : ''}">
80
87
  <div class="inner-navbar {className} {inContainer ? 'container' : ''}">
81
88
  {#if isSite && !noLogo}
82
89
  <span class="site-logo">
@@ -87,7 +94,7 @@
87
94
  {#if showDrawerButton && drawerButtonPosition === 'left'}
88
95
  <ActionIcon
89
96
  svg={drawerButtonIcon}
90
- variant={isPrimary ? 'accent-subtle' : 'secondary-subtle'}
97
+ variant={drawerButtonVariant}
91
98
  size="1.25rem"
92
99
  onclick={onDrawerButtonClick}
93
100
  class="drawer-btn drawer-btn-left"
@@ -144,7 +151,7 @@
144
151
  {#if showDrawerButton && drawerButtonPosition === 'right'}
145
152
  <ActionIcon
146
153
  svg={drawerButtonIcon}
147
- variant={isPrimary ? 'accent-subtle' : 'secondary-subtle'}
154
+ variant={drawerButtonVariant}
148
155
  size="1.25rem"
149
156
  onclick={onDrawerButtonClick}
150
157
  class="drawer-btn drawer-btn-right"
@@ -8,7 +8,9 @@ export interface NavbarProps {
8
8
  * - `primary` uses the primary brand colour as the background across all themes.
9
9
  * - `site` is a marketing-site header: logo on the left, links pushed to the right with an
10
10
  * accent underline on the `active` item. Below 768px the links collapse and the drawer
11
- * button (enable with `showDrawerButton`) is shown instead.
11
+ * button (enable with `showDrawerButton`) is shown instead. While a site header is on the
12
+ * page, `--header-height` is raised to 68px (see app.css), so `--page-content-height`
13
+ * follows automatically.
12
14
  */
13
15
  variant?: NavbarVariant;
14
16
  /** App navigation link displayed as a header */
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { onMount } from 'svelte';
2
3
  import { setTheme, themeState } from '../theme.svelte.js';
3
4
 
4
5
  import sunSvg from '../icon/sun.svg?raw';
@@ -31,6 +32,17 @@
31
32
  system: 'System theme'
32
33
  };
33
34
 
35
+ // The server always renders the 'system' theme (no localStorage), but the client loads the
36
+ // saved theme at module load. Rendering the server values until mounted keeps the hydrated
37
+ // markup identical and avoids a hydration_html_changed warning from the {@html} icon.
38
+ let mounted = $state(false);
39
+ onMount(() => {
40
+ mounted = true;
41
+ });
42
+
43
+ const theme = $derived(mounted ? themeState.theme : 'system');
44
+ const isDarkMode = $derived(mounted ? themeState.isDarkMode : false);
45
+
34
46
  function cycleTheme() {
35
47
  const index = themeCycle.indexOf(themeState.theme);
36
48
  setTheme(themeCycle[(index + 1) % themeCycle.length]);
@@ -38,14 +50,14 @@
38
50
  </script>
39
51
 
40
52
  <div class="theme-switcher">
41
- {#key themeState.theme}
53
+ {#key theme}
42
54
  <ActionIcon
43
- variant={themeState.isDarkMode ? darkVariant : lightVariant}
44
- svg={icons[themeState.theme]}
55
+ variant={isDarkMode ? darkVariant : lightVariant}
56
+ svg={icons[theme]}
45
57
  class="action-icon"
46
58
  size="1.6em"
47
59
  onclick={cycleTheme}
48
- tooltip={tooltips[themeState.theme]}
60
+ tooltip={tooltips[theme]}
49
61
  />
50
62
  {/key}
51
63
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@placeholderco/placeholder-ui",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "A modern, customizable Svelte 5 UI component library with comprehensive theming support. Re-brand it with a single config object.",
5
5
  "license": "MIT",
6
6
  "author": "Placeholderco",