@svadmin/ui 0.28.0 → 0.29.1

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": "@svadmin/ui",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -20,7 +20,7 @@
20
20
  "./components/*": "./src/components/*"
21
21
  },
22
22
  "peerDependencies": {
23
- "@svadmin/core": "^0.19.5",
23
+ "@svadmin/core": "^0.20.1",
24
24
  "@tanstack/svelte-query": "^6.0.0",
25
25
  "highlight.js": "^11.11.1",
26
26
  "isomorphic-dompurify": "^3.7.1",
package/src/app.css CHANGED
@@ -99,6 +99,160 @@
99
99
  --sidebar-ring: oklch(0.55 0.18 264);
100
100
  }
101
101
 
102
+ /* ── Color Theme Overrides ──────────────────────────────
103
+ * Each [data-theme] selector overrides the primary-related
104
+ * CSS variables for both light and dark mode.
105
+ * Values match builtinPresets in @svadmin/core/theme.
106
+ * This CSS-level fallback prevents FOUC before JS inits.
107
+ */
108
+
109
+ /* Neutral */
110
+ [data-theme="neutral"] {
111
+ --primary: oklch(0.205 0.006 286);
112
+ --primary-foreground: oklch(0.985 0 0);
113
+ --ring: oklch(0.205 0.006 286);
114
+ --sidebar-primary: oklch(0.205 0.006 286);
115
+ --sidebar-primary-foreground: oklch(0.985 0 0);
116
+ --sidebar-ring: oklch(0.205 0.006 286);
117
+ --chart-1: oklch(0.488 0.243 264.376);
118
+ }
119
+ .dark[data-theme="neutral"],
120
+ .dark [data-theme="neutral"] {
121
+ --primary: oklch(0.922 0.004 286);
122
+ --primary-foreground: oklch(0.205 0.006 286);
123
+ --ring: oklch(0.556 0.004 286);
124
+ --sidebar-primary: oklch(0.922 0.004 286);
125
+ --sidebar-primary-foreground: oklch(0.205 0.006 286);
126
+ --sidebar-ring: oklch(0.556 0.004 286);
127
+ --chart-1: oklch(0.585 0.233 264);
128
+ }
129
+
130
+ /* Indigo (default) */
131
+ [data-theme="indigo"] {
132
+ --primary: oklch(0.488 0.243 264.376);
133
+ --primary-foreground: oklch(0.985 0 0);
134
+ --ring: oklch(0.488 0.243 264.376);
135
+ --sidebar-primary: oklch(0.488 0.243 264.376);
136
+ --sidebar-primary-foreground: oklch(0.985 0 0);
137
+ --sidebar-ring: oklch(0.488 0.243 264.376);
138
+ --chart-1: oklch(0.488 0.243 264.376);
139
+ }
140
+ .dark[data-theme="indigo"],
141
+ .dark [data-theme="indigo"] {
142
+ --primary: oklch(0.585 0.233 264);
143
+ --primary-foreground: oklch(0.15 0.04 265);
144
+ --ring: oklch(0.55 0.18 264);
145
+ --sidebar-primary: oklch(0.585 0.233 264);
146
+ --sidebar-primary-foreground: oklch(0.985 0 0);
147
+ --sidebar-ring: oklch(0.55 0.18 264);
148
+ --chart-1: oklch(0.585 0.233 264);
149
+ }
150
+
151
+ /* Blue */
152
+ [data-theme="blue"] {
153
+ --primary: oklch(0.546 0.245 262.881);
154
+ --primary-foreground: oklch(0.985 0 0);
155
+ --ring: oklch(0.546 0.245 262.881);
156
+ --sidebar-primary: oklch(0.546 0.245 262.881);
157
+ --sidebar-primary-foreground: oklch(0.985 0 0);
158
+ --sidebar-ring: oklch(0.546 0.245 262.881);
159
+ --chart-1: oklch(0.546 0.245 262.881);
160
+ }
161
+ .dark[data-theme="blue"],
162
+ .dark [data-theme="blue"] {
163
+ --primary: oklch(0.623 0.214 259.815);
164
+ --primary-foreground: oklch(0.15 0.04 265);
165
+ --ring: oklch(0.546 0.245 262.881);
166
+ --sidebar-primary: oklch(0.623 0.214 259.815);
167
+ --sidebar-primary-foreground: oklch(0.985 0 0);
168
+ --sidebar-ring: oklch(0.546 0.245 262.881);
169
+ --chart-1: oklch(0.623 0.214 259.815);
170
+ }
171
+
172
+ /* Green */
173
+ [data-theme="green"] {
174
+ --primary: oklch(0.527 0.185 150.069);
175
+ --primary-foreground: oklch(0.985 0 0);
176
+ --ring: oklch(0.527 0.185 150.069);
177
+ --sidebar-primary: oklch(0.527 0.185 150.069);
178
+ --sidebar-primary-foreground: oklch(0.985 0 0);
179
+ --sidebar-ring: oklch(0.527 0.185 150.069);
180
+ --chart-1: oklch(0.527 0.185 150.069);
181
+ }
182
+ .dark[data-theme="green"],
183
+ .dark [data-theme="green"] {
184
+ --primary: oklch(0.627 0.194 149.214);
185
+ --primary-foreground: oklch(0.15 0.05 150);
186
+ --ring: oklch(0.527 0.185 150.069);
187
+ --sidebar-primary: oklch(0.627 0.194 149.214);
188
+ --sidebar-primary-foreground: oklch(0.985 0 0);
189
+ --sidebar-ring: oklch(0.527 0.185 150.069);
190
+ --chart-1: oklch(0.627 0.194 149.214);
191
+ }
192
+
193
+ /* Rose */
194
+ [data-theme="rose"] {
195
+ --primary: oklch(0.577 0.245 27.325);
196
+ --primary-foreground: oklch(0.985 0 0);
197
+ --ring: oklch(0.577 0.245 27.325);
198
+ --sidebar-primary: oklch(0.577 0.245 27.325);
199
+ --sidebar-primary-foreground: oklch(0.985 0 0);
200
+ --sidebar-ring: oklch(0.577 0.245 27.325);
201
+ --chart-1: oklch(0.577 0.245 27.325);
202
+ }
203
+ .dark[data-theme="rose"],
204
+ .dark [data-theme="rose"] {
205
+ --primary: oklch(0.577 0.245 27.325);
206
+ --primary-foreground: oklch(0.985 0 0);
207
+ --ring: oklch(0.577 0.245 27.325);
208
+ --sidebar-primary: oklch(0.577 0.245 27.325);
209
+ --sidebar-primary-foreground: oklch(0.985 0 0);
210
+ --sidebar-ring: oklch(0.577 0.245 27.325);
211
+ --chart-1: oklch(0.577 0.245 27.325);
212
+ }
213
+
214
+ /* Orange */
215
+ [data-theme="orange"] {
216
+ --primary: oklch(0.646 0.222 41.116);
217
+ --primary-foreground: oklch(0.985 0 0);
218
+ --ring: oklch(0.646 0.222 41.116);
219
+ --sidebar-primary: oklch(0.646 0.222 41.116);
220
+ --sidebar-primary-foreground: oklch(0.985 0 0);
221
+ --sidebar-ring: oklch(0.646 0.222 41.116);
222
+ --chart-1: oklch(0.646 0.222 41.116);
223
+ }
224
+ .dark[data-theme="orange"],
225
+ .dark [data-theme="orange"] {
226
+ --primary: oklch(0.646 0.222 41.116);
227
+ --primary-foreground: oklch(0.985 0 0);
228
+ --ring: oklch(0.646 0.222 41.116);
229
+ --sidebar-primary: oklch(0.646 0.222 41.116);
230
+ --sidebar-primary-foreground: oklch(0.985 0 0);
231
+ --sidebar-ring: oklch(0.646 0.222 41.116);
232
+ --chart-1: oklch(0.646 0.222 41.116);
233
+ }
234
+
235
+ /* Violet */
236
+ [data-theme="violet"] {
237
+ --primary: oklch(0.541 0.281 293.009);
238
+ --primary-foreground: oklch(0.985 0 0);
239
+ --ring: oklch(0.541 0.281 293.009);
240
+ --sidebar-primary: oklch(0.541 0.281 293.009);
241
+ --sidebar-primary-foreground: oklch(0.985 0 0);
242
+ --sidebar-ring: oklch(0.541 0.281 293.009);
243
+ --chart-1: oklch(0.541 0.281 293.009);
244
+ }
245
+ .dark[data-theme="violet"],
246
+ .dark [data-theme="violet"] {
247
+ --primary: oklch(0.541 0.281 293.009);
248
+ --primary-foreground: oklch(0.985 0 0);
249
+ --ring: oklch(0.541 0.281 293.009);
250
+ --sidebar-primary: oklch(0.541 0.281 293.009);
251
+ --sidebar-primary-foreground: oklch(0.985 0 0);
252
+ --sidebar-ring: oklch(0.541 0.281 293.009);
253
+ --chart-1: oklch(0.541 0.281 293.009);
254
+ }
255
+
102
256
  /* Stripe-inspired Soft Shadows — premium, multi-layered depth */
103
257
  [data-slot="button"],
104
258
  [data-slot="input"],
@@ -45,6 +45,8 @@
45
45
  components?: Partial<ComponentRegistry>;
46
46
  /** Custom multi-level menu configuration */
47
47
  menu?: MenuItem[];
48
+ /** External URL to the main application or workspace (renders a shortcut in the header) */
49
+ siteUrl?: string;
48
50
  }
49
51
 
50
52
  let {
@@ -60,6 +62,7 @@
60
62
  loginPage,
61
63
  components: userComponents,
62
64
  menu,
65
+ siteUrl,
63
66
  }: Props = $props();
64
67
 
65
68
  // Default component registry
@@ -148,7 +151,7 @@
148
151
  {:else if route === '/login' || route === '/register' || route === '/forgot-password' || route === '/update-password'}
149
152
  <ConfigErrorScreen title="{title} — {t('common.configRequired')}" />
150
153
  {:else if isAuthenticated || !authProvider}
151
- <Layout {title} {menu}>
154
+ <Layout {title} {menu} {siteUrl}>
152
155
  {#key route + (params.resource ?? '') + (params.id ?? '')}
153
156
  <div class="svadmin-page-enter">
154
157
  {#if currentPath().startsWith('/settings')}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { Moon, Sun, Search } from '@lucide/svelte';
2
+ import { Moon, Sun, Search, MonitorUp } from '@lucide/svelte';
3
3
  import { Button } from './ui/button';
4
4
  import TooltipButton from './TooltipButton.svelte';
5
5
  import { getResolvedTheme, toggleTheme } from '@svadmin/core';
@@ -15,6 +15,7 @@
15
15
  children,
16
16
  /** Slot for additional actions on the right side of the header */
17
17
  rightActions,
18
+ siteUrl,
18
19
  } = $props<{
19
20
  showThemeToggle?: boolean;
20
21
  showBreadcrumbs?: boolean;
@@ -22,6 +23,7 @@
22
23
  onSearchClick?: () => void;
23
24
  children?: import('svelte').Snippet;
24
25
  rightActions?: import('svelte').Snippet;
26
+ siteUrl?: string;
25
27
  }>();
26
28
 
27
29
  // Retrieve optional component overrides from registry
@@ -50,6 +52,12 @@
50
52
  {@render rightActions()}
51
53
  {/if}
52
54
 
55
+ {#if siteUrl}
56
+ <TooltipButton tooltip={t('common.goToSite') || 'Site'} href={siteUrl} target="_blank" rel="noopener noreferrer" class="rounded-full flex items-center justify-center">
57
+ <MonitorUp class="h-4 w-4 text-muted-foreground transition-colors hover:text-foreground" />
58
+ </TooltipButton>
59
+ {/if}
60
+
53
61
  {#if CustomNotificationPanel}
54
62
  <CustomNotificationPanel />
55
63
  {/if}
@@ -22,7 +22,7 @@
22
22
  let shortcutsOpen = $state(false);
23
23
  let mobileMenuOpen = $state(false);
24
24
 
25
- let { children, title = 'Admin', menu }: { children: Snippet; title?: string; menu?: MenuItem[] } = $props();
25
+ let { children, title = 'Admin', menu, siteUrl }: { children: Snippet; title?: string; menu?: MenuItem[]; siteUrl?: string } = $props();
26
26
 
27
27
  let hasAuth = true;
28
28
  let auth: ReturnType<typeof getAuthProvider> | null = null;
@@ -138,6 +138,7 @@
138
138
  >
139
139
  <!-- Header with mobile hamburger -->
140
140
  <Header
141
+ {siteUrl}
141
142
  showSearch={true}
142
143
  onSearchClick={() => { commandOpen = true; }}
143
144
  >