rune-lab 0.1.0 → 0.1.2

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 (46) hide show
  1. package/dist/components/ApiMonitor.svelte.d.ts +14 -3
  2. package/dist/components/Icon.svelte.d.ts +13 -8
  3. package/dist/components/RuneProvider.svelte +26 -2
  4. package/dist/components/RuneProvider.svelte.d.ts +16 -7
  5. package/dist/components/Toaster.svelte.d.ts +12 -16
  6. package/dist/features/command-palette/CommandPalette.svelte.d.ts +13 -5
  7. package/dist/features/config/AppSettingSelector.svelte +177 -0
  8. package/dist/features/config/AppSettingSelector.svelte.d.ts +14 -0
  9. package/dist/features/config/{components/CurrencySelector.svelte → CurrencySelector.svelte} +15 -10
  10. package/dist/features/config/CurrencySelector.svelte.d.ts +14 -0
  11. package/dist/features/config/{components/LanguageSelector.svelte → LanguageSelector.svelte} +17 -10
  12. package/dist/features/config/LanguageSelector.svelte.d.ts +14 -0
  13. package/dist/features/config/{components/ThemeSelector.svelte → ThemeSelector.svelte} +16 -11
  14. package/dist/features/config/ThemeSelector.svelte.d.ts +14 -0
  15. package/dist/features/detail-panels/DashboardPanel.svelte.d.ts +14 -3
  16. package/dist/features/detail-panels/ShortcutsPanel.svelte.d.ts +14 -3
  17. package/dist/features/detail-panels/ShowcasePanel.svelte.d.ts +14 -3
  18. package/dist/features/layout/smart/ConnectedNavigationPanel.svelte.d.ts +13 -9
  19. package/dist/features/layout/smart/ConnectedWorkspaceStrip.svelte.d.ts +13 -8
  20. package/dist/features/shortcuts/ShortcutPalette.svelte.d.ts +19 -6
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +4 -4
  23. package/dist/layout/ContentArea.svelte.d.ts +13 -7
  24. package/dist/layout/DetailPanel.svelte.d.ts +13 -6
  25. package/dist/layout/NavigationPanel.svelte.d.ts +13 -13
  26. package/dist/layout/WorkspaceLayout.svelte.d.ts +14 -3
  27. package/dist/layout/WorkspaceStrip.svelte.d.ts +13 -10
  28. package/dist/paraglide/runtime.d.ts +2 -2
  29. package/dist/showcase/AppStateInspector.svelte.d.ts +14 -3
  30. package/dist/showcase/Showcase.svelte.d.ts +12 -16
  31. package/dist/showcase/ShowcaseCard.svelte.d.ts +13 -8
  32. package/dist/showcase/StoreDetailCard.svelte.d.ts +13 -18
  33. package/dist/showcase/tabs/Actions.svelte.d.ts +12 -16
  34. package/dist/showcase/tabs/DataInput.svelte.d.ts +14 -3
  35. package/dist/showcase/tabs/Display.svelte.d.ts +12 -16
  36. package/dist/showcase/tabs/Feedback.svelte.d.ts +14 -3
  37. package/dist/showcase/tabs/Navigation.svelte.d.ts +12 -16
  38. package/dist/showcase/tabs/Visual.svelte.d.ts +12 -16
  39. package/dist/state/language.svelte.d.ts +1 -0
  40. package/dist/state/language.svelte.js +4 -16
  41. package/package.json +7 -9
  42. package/dist/features/config/components/AppSettingSelector.svelte +0 -124
  43. package/dist/features/config/components/AppSettingSelector.svelte.d.ts +0 -13
  44. package/dist/features/config/components/CurrencySelector.svelte.d.ts +0 -8
  45. package/dist/features/config/components/LanguageSelector.svelte.d.ts +0 -8
  46. package/dist/features/config/components/ThemeSelector.svelte.d.ts +0 -8
@@ -1,3 +1,14 @@
1
- declare const ApiMonitor: import("svelte").Component<Record<string, never>, {}, "">;
2
- type ApiMonitor = ReturnType<typeof ApiMonitor>;
3
- export default ApiMonitor;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ApiMonitorProps = typeof __propDef.props;
10
+ export type ApiMonitorEvents = typeof __propDef.events;
11
+ export type ApiMonitorSlots = typeof __propDef.slots;
12
+ export default class ApiMonitor extends SvelteComponentTyped<ApiMonitorProps, ApiMonitorEvents, ApiMonitorSlots> {
13
+ }
14
+ export {};
@@ -1,9 +1,14 @@
1
- type $$ComponentProps = {
2
- name: string;
3
- size?: string;
4
- class?: string;
5
- icons?: Record<string, string>;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
6
8
  };
7
- declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
8
- type Icon = ReturnType<typeof Icon>;
9
- export default Icon;
9
+ export type IconProps = typeof __propDef.props;
10
+ export type IconEvents = typeof __propDef.events;
11
+ export type IconSlots = typeof __propDef.slots;
12
+ export default class Icon extends SvelteComponentTyped<IconProps, IconEvents, IconSlots> {
13
+ }
14
+ export {};
@@ -15,6 +15,7 @@
15
15
  import { Toaster, CommandPalette, ShortcutPalette } from "../index";
16
16
 
17
17
  import type { PersistenceDriver } from "../persistence/types";
18
+ import { localStorageDriver } from "../persistence/drivers";
18
19
  import { RUNE_LAB_CONTEXT } from "../context";
19
20
  import type { AppData } from "../state/app.svelte";
20
21
 
@@ -26,6 +27,9 @@
26
27
  favicon?: string;
27
28
  manageHead?: boolean;
28
29
  dictionary?: Record<string, any>;
30
+ locales?: readonly string[];
31
+ onLanguageChange?: (code: string) => void;
32
+ onThemeChange?: (name: string) => void;
29
33
  }
30
34
 
31
35
  let { children, config = {} } = $props<{
@@ -42,11 +46,16 @@
42
46
  wire(toastStore);
43
47
 
44
48
  // Capture the initial persistence prop to avoid Svelte 5 reactive capture warnings
45
- const initialPersistence = untrack(() => config.persistence);
49
+ // Default to localStorageDriver to ensure UI selectors persist across browser page reloads
50
+ const initialPersistence = untrack(
51
+ () => config.persistence ?? localStorageDriver,
52
+ );
53
+ const initialLocales = untrack(() => config.locales);
46
54
 
47
55
  const themeStore = createThemeStore(initialPersistence);
48
56
  const languageStore = createLanguageStore({
49
57
  driver: initialPersistence,
58
+ locales: initialLocales,
50
59
  });
51
60
  const currencyStore = createCurrencyStore(initialPersistence);
52
61
  const shortcutStore = createShortcutStore();
@@ -85,7 +94,22 @@
85
94
  });
86
95
 
87
96
  $effect(() => {
88
- if (config.apiUrl) apiStore.init(config.apiUrl, "v1", config.apiHealthCheck);
97
+ if (config.apiUrl)
98
+ apiStore.init(config.apiUrl, "v1", config.apiHealthCheck);
99
+ });
100
+
101
+ $effect(() => {
102
+ const code = languageStore.current as string;
103
+ if (config.onLanguageChange) {
104
+ config.onLanguageChange(code);
105
+ }
106
+ });
107
+
108
+ $effect(() => {
109
+ const name = themeStore.current as string;
110
+ if (config.onThemeChange) {
111
+ config.onThemeChange(name);
112
+ }
89
113
  });
90
114
 
91
115
  onMount(() => {
@@ -1,4 +1,4 @@
1
- import { type Snippet } from "svelte";
1
+ import { SvelteComponentTyped } from "svelte";
2
2
  import type { PersistenceDriver } from "../persistence/types";
3
3
  import type { AppData } from "../state/app.svelte";
4
4
  export interface RuneLabConfig {
@@ -9,11 +9,20 @@ export interface RuneLabConfig {
9
9
  favicon?: string;
10
10
  manageHead?: boolean;
11
11
  dictionary?: Record<string, any>;
12
+ locales?: readonly string[];
13
+ onLanguageChange?: (code: string) => void;
14
+ onThemeChange?: (name: string) => void;
12
15
  }
13
- type $$ComponentProps = {
14
- children: Snippet;
15
- config?: RuneLabConfig;
16
+ declare const __propDef: {
17
+ props: Record<string, never>;
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
16
22
  };
17
- declare const RuneProvider: import("svelte").Component<$$ComponentProps, {}, "">;
18
- type RuneProvider = ReturnType<typeof RuneProvider>;
19
- export default RuneProvider;
23
+ export type RuneProviderProps = typeof __propDef.props;
24
+ export type RuneProviderEvents = typeof __propDef.events;
25
+ export type RuneProviderSlots = typeof __propDef.slots;
26
+ export default class RuneProvider extends SvelteComponentTyped<RuneProviderProps, RuneProviderEvents, RuneProviderSlots> {
27
+ }
28
+ export {};
@@ -1,18 +1,14 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
11
6
  };
12
- z_$$bindings?: Bindings;
7
+ slots: {};
8
+ };
9
+ export type ToasterProps = typeof __propDef.props;
10
+ export type ToasterEvents = typeof __propDef.events;
11
+ export type ToasterSlots = typeof __propDef.slots;
12
+ export default class Toaster extends SvelteComponentTyped<ToasterProps, ToasterEvents, ToasterSlots> {
13
13
  }
14
- declare const Toaster: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type Toaster = InstanceType<typeof Toaster>;
18
- export default Toaster;
14
+ export {};
@@ -1,6 +1,14 @@
1
- type $$ComponentProps = {
2
- shortcutKey?: string;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
3
8
  };
4
- declare const CommandPalette: import("svelte").Component<$$ComponentProps, {}, "">;
5
- type CommandPalette = ReturnType<typeof CommandPalette>;
6
- export default CommandPalette;
9
+ export type CommandPaletteProps = typeof __propDef.props;
10
+ export type CommandPaletteEvents = typeof __propDef.events;
11
+ export type CommandPaletteSlots = typeof __propDef.slots;
12
+ export default class CommandPalette extends SvelteComponentTyped<CommandPaletteProps, CommandPaletteEvents, CommandPaletteSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,177 @@
1
+ <script lang="ts">
2
+ import { portal } from "../../actions/portal";
3
+ import { type Snippet } from "svelte";
4
+
5
+ let {
6
+ options,
7
+ value,
8
+ item,
9
+ triggerLabel,
10
+ tooltip,
11
+ direction = "bottom",
12
+ responsive = true,
13
+ } = $props<{
14
+ options: any[];
15
+ value: any;
16
+ item: Snippet<[any]>;
17
+ triggerLabel: Snippet<[any]>;
18
+ tooltip?: string;
19
+ direction?: "top" | "bottom" | "left" | "right" | "end" | "auto";
20
+ responsive?: boolean;
21
+ }>();
22
+
23
+ let modal = $state<HTMLDialogElement>();
24
+
25
+ let isOpen = $state(false);
26
+ let triggerEl = $state<HTMLElement>();
27
+ let panelStyle = $state("position:fixed;visibility:hidden");
28
+
29
+ function computePosition() {
30
+ if (!triggerEl) return;
31
+ const rect = triggerEl.getBoundingClientRect();
32
+ const spaceBelow = window.innerHeight - rect.bottom;
33
+ const spaceAbove = rect.top;
34
+ const openUpward =
35
+ direction === "top" ||
36
+ (direction === "auto" &&
37
+ spaceBelow < 200 &&
38
+ spaceAbove > spaceBelow);
39
+
40
+ if (openUpward) {
41
+ panelStyle = `position:fixed; bottom:${window.innerHeight - rect.top + 4}px; left:${rect.left}px; min-width:${rect.width}px; z-index:9999`;
42
+ } else {
43
+ panelStyle = `position:fixed; top:${rect.bottom + 4}px; left:${rect.left}px; min-width:${rect.width}px; z-index:9999`;
44
+ }
45
+ }
46
+
47
+ function open() {
48
+ computePosition();
49
+ isOpen = true;
50
+ }
51
+
52
+ function close() {
53
+ isOpen = false;
54
+ }
55
+
56
+ function handleOutsideClick(e: MouseEvent) {
57
+ if (!triggerEl?.contains(e.target as Node)) close();
58
+ }
59
+
60
+ $effect(() => {
61
+ if (isOpen) {
62
+ document.addEventListener("click", handleOutsideClick, {
63
+ capture: true,
64
+ });
65
+ document.addEventListener(
66
+ "keydown",
67
+ (e) => e.key === "Escape" && close(),
68
+ );
69
+ }
70
+ return () => {
71
+ document.removeEventListener("click", handleOutsideClick, {
72
+ capture: true,
73
+ });
74
+ };
75
+ });
76
+ </script>
77
+
78
+ <!-- Mobile Modal Implementation -->
79
+ {#if responsive}
80
+ <div class="md:hidden inline-block">
81
+ <button
82
+ type="button"
83
+ class="btn btn-ghost btn-sm m-1 h-auto min-h-[2rem] px-2"
84
+ aria-haspopup="dialog"
85
+ onclick={() => modal?.showModal()}
86
+ >
87
+ <span class="flex items-center gap-2">
88
+ {@render triggerLabel(value)}
89
+ </span>
90
+ </button>
91
+
92
+ <dialog bind:this={modal} class="modal modal-bottom sm:modal-middle">
93
+ <div class="modal-box p-0 overflow-hidden">
94
+ <div
95
+ class="p-4 bg-base-200 border-b border-base-300 flex justify-between items-center"
96
+ >
97
+ <h3 class="font-bold text-lg">Select Option</h3>
98
+ <form method="dialog">
99
+ <button class="btn btn-sm btn-circle btn-ghost"
100
+ >✕</button
101
+ >
102
+ </form>
103
+ </div>
104
+ <div class="max-h-[60vh] overflow-y-auto p-2">
105
+ <ul class="menu bg-base-100 w-full p-0" role="menu">
106
+ {#each options as option}
107
+ <li
108
+ class="border-b border-base-100 last:border-0"
109
+ role="menuitem"
110
+ >
111
+ <button
112
+ class="w-full text-left py-3"
113
+ onclick={() => modal?.close()}
114
+ >
115
+ {@render item(option)}
116
+ </button>
117
+ </li>
118
+ {/each}
119
+ </ul>
120
+ </div>
121
+ </div>
122
+ <form method="dialog" class="modal-backdrop">
123
+ <button>close</button>
124
+ </form>
125
+ </dialog>
126
+ </div>
127
+ {/if}
128
+
129
+ <!-- Desktop Dropdown Implementation -->
130
+ <div
131
+ bind:this={triggerEl}
132
+ class="relative {responsive ? 'hidden md:inline-block' : 'inline-block'}"
133
+ >
134
+ <button
135
+ type="button"
136
+ aria-haspopup="listbox"
137
+ aria-expanded={isOpen}
138
+ onclick={open}
139
+ class="btn btn-ghost btn-sm m-1 {tooltip
140
+ ? 'tooltip tooltip-bottom'
141
+ : ''}"
142
+ data-tip={tooltip}
143
+ >
144
+ <span class="flex items-center gap-2">
145
+ {@render triggerLabel(value)}
146
+ </span>
147
+ </button>
148
+ </div>
149
+
150
+ {#if isOpen}
151
+ <div
152
+ use:portal
153
+ style={panelStyle}
154
+ class={responsive ? "hidden md:block" : "block"}
155
+ >
156
+ <ul
157
+ role="listbox"
158
+ class="menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow-xl border border-base-200 max-h-96 overflow-y-auto"
159
+ >
160
+ {#each options as option}
161
+ <li role="option" aria-selected={value === option}>
162
+ <!-- Event delegation: we close on click unless they clicked the scrollbar -->
163
+ <!-- In a real world component you'd wrap the button down here or add a capture handler -->
164
+ <div
165
+ role="presentation"
166
+ onclick={close}
167
+ onkeydown={(e) => e.key === "Enter" && close()}
168
+ tabindex="-1"
169
+ class="w-full"
170
+ >
171
+ {@render item(option)}
172
+ </div>
173
+ </li>
174
+ {/each}
175
+ </ul>
176
+ </div>
177
+ {/if}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type AppSettingSelectorProps = typeof __propDef.props;
10
+ export type AppSettingSelectorEvents = typeof __propDef.events;
11
+ export type AppSettingSelectorSlots = typeof __propDef.slots;
12
+ export default class AppSettingSelector extends SvelteComponentTyped<AppSettingSelectorProps, AppSettingSelectorEvents, AppSettingSelectorSlots> {
13
+ }
14
+ export {};
@@ -3,13 +3,12 @@
3
3
  import {
4
4
  getCurrencyStore,
5
5
  type Currency,
6
- } from "../../../state/currency.svelte";
6
+ } from "../../state/currency.svelte";
7
+ import * as rlMessages from "../../paraglide/messages.js";
8
+ import { getContext } from "svelte";
7
9
 
8
10
  const currencyStore = getCurrencyStore();
9
11
 
10
- import { getContext } from "svelte";
11
- import { createMessageResolver } from "../../../internal/message-resolver";
12
-
13
12
  let {
14
13
  codes = [],
15
14
  current = $bindable(String(currencyStore.current)),
@@ -20,11 +19,17 @@
20
19
  onchange?: (value: string) => void;
21
20
  } = $props();
22
21
 
23
- const dictionary = getContext<Record<string, any>>("rl:dictionary") || {};
22
+ const userDictionary =
23
+ getContext<Record<string, any>>("rl:dictionary") ?? {};
24
24
 
25
- const getLabel = createMessageResolver<Currency>(dictionary as any, {
26
- keyExtractor: (c) => String(c.code),
27
- });
25
+ function getLabel(currency: Currency): string {
26
+ const key = String(currency.code);
27
+ if (typeof userDictionary[key] === "function")
28
+ return userDictionary[key]();
29
+ if (typeof (rlMessages as any)[key] === "function")
30
+ return (rlMessages as any)[key]();
31
+ return String(currency.code);
32
+ }
28
33
 
29
34
  let active = $derived(
30
35
  currencyStore.get(currencyStore.current) ?? currencyStore.available[0],
@@ -42,8 +47,8 @@
42
47
  options={available}
43
48
  tooltip={getLabel(active)}
44
49
  >
45
- {#snippet triggerLabel(c)}
46
- <span class="font-bold">{c.symbol}</span>
50
+ {#snippet triggerLabel()}
51
+ <span class="font-bold">{active.symbol}</span>
47
52
  {/snippet}
48
53
 
49
54
  {#snippet item(c)}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type CurrencySelectorProps = typeof __propDef.props;
10
+ export type CurrencySelectorEvents = typeof __propDef.events;
11
+ export type CurrencySelectorSlots = typeof __propDef.slots;
12
+ export default class CurrencySelector extends SvelteComponentTyped<CurrencySelectorProps, CurrencySelectorEvents, CurrencySelectorSlots> {
13
+ }
14
+ export {};
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  getLanguageStore,
5
5
  type Language,
6
- } from "../../../state/language.svelte";
6
+ } from "../../state/language.svelte";
7
+ import * as rlMessages from "../../paraglide/messages.js";
8
+ import { getContext } from "svelte";
9
+ import { setLocale } from "../../paraglide/runtime";
7
10
 
8
11
  const languageStore = getLanguageStore();
9
12
 
10
- import { getContext } from "svelte";
11
- import { createMessageResolver } from "../../../internal/message-resolver";
12
-
13
13
  let {
14
14
  languages: allowedLocales = languageStore.available.map((l) => l.code),
15
15
  current = $bindable(languageStore.current),
@@ -20,11 +20,17 @@
20
20
  onchange?: (value: string) => void;
21
21
  } = $props();
22
22
 
23
- const dictionary = getContext<Record<string, any>>("rl:dictionary") || {};
23
+ const userDictionary =
24
+ getContext<Record<string, any>>("rl:dictionary") ?? {};
24
25
 
25
- const getLabel = createMessageResolver<Language>(dictionary as any, {
26
- keyExtractor: (l) => l.code,
27
- });
26
+ function getLabel(lang: Language): string {
27
+ const key = lang.code;
28
+ if (typeof userDictionary[key] === "function")
29
+ return userDictionary[key]();
30
+ if (typeof (rlMessages as any)[key] === "function")
31
+ return (rlMessages as any)[key]();
32
+ return lang.code.toUpperCase();
33
+ }
28
34
 
29
35
  let active = $derived(
30
36
  languageStore.get(languageStore.current) ?? languageStore.available[0],
@@ -42,8 +48,8 @@
42
48
  options={available}
43
49
  tooltip={getLabel(active)}
44
50
  >
45
- {#snippet triggerLabel(l)}
46
- <span class="text-lg">{l?.flag ?? active.flag}</span>
51
+ {#snippet triggerLabel()}
52
+ <span class="text-lg">{active.flag}</span>
47
53
  {/snippet}
48
54
 
49
55
  {#snippet item(l)}
@@ -51,6 +57,7 @@
51
57
  class="flex items-center gap-3 w-full"
52
58
  onclick={() => {
53
59
  languageStore.set(l.code);
60
+ setLocale(l.code as any);
54
61
  current = l.code;
55
62
  onchange?.(l.code);
56
63
  }}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type LanguageSelectorProps = typeof __propDef.props;
10
+ export type LanguageSelectorEvents = typeof __propDef.events;
11
+ export type LanguageSelectorSlots = typeof __propDef.slots;
12
+ export default class LanguageSelector extends SvelteComponentTyped<LanguageSelectorProps, LanguageSelectorEvents, LanguageSelectorSlots> {
13
+ }
14
+ export {};
@@ -1,12 +1,11 @@
1
1
  <script lang="ts">
2
2
  import AppSettingSelector from "./AppSettingSelector.svelte";
3
- import { getThemeStore, type Theme } from "../../../state/theme.svelte";
3
+ import { getThemeStore, type Theme } from "../../state/theme.svelte";
4
+ import * as rlMessages from "../../paraglide/messages.js";
5
+ import { getContext } from "svelte";
4
6
 
5
7
  const themeStore = getThemeStore();
6
8
 
7
- import { getContext } from "svelte";
8
- import { createMessageResolver } from "../../../internal/message-resolver";
9
-
10
9
  let {
11
10
  themes = [],
12
11
  current = $bindable(themeStore.current),
@@ -17,11 +16,17 @@
17
16
  onchange?: (value: string) => void;
18
17
  } = $props();
19
18
 
20
- const dictionary = getContext<Record<string, any>>("rl:dictionary") || {};
19
+ const userDictionary =
20
+ getContext<Record<string, any>>("rl:dictionary") ?? {};
21
21
 
22
- const getThemeLabel = createMessageResolver<Theme>(dictionary as any, {
23
- keyExtractor: (t) => t.name,
24
- });
22
+ function getThemeLabel(theme: Theme): string {
23
+ const key = theme.name;
24
+ if (typeof userDictionary[key] === "function")
25
+ return userDictionary[key]();
26
+ if (typeof (rlMessages as any)[key] === "function")
27
+ return (rlMessages as any)[key]();
28
+ return theme.name;
29
+ }
25
30
 
26
31
  let activeTheme = $derived(
27
32
  themeStore.get(themeStore.current) ?? themeStore.available[0],
@@ -39,8 +44,8 @@
39
44
  options={available}
40
45
  tooltip={getThemeLabel(activeTheme)}
41
46
  >
42
- {#snippet triggerLabel(t)}
43
- <span class="text-lg">{t?.icon ?? activeTheme.icon}</span>
47
+ {#snippet triggerLabel()}
48
+ <span class="text-lg">{activeTheme.icon}</span>
44
49
  {/snippet}
45
50
 
46
51
  {#snippet item(t)}
@@ -54,7 +59,7 @@
54
59
  >
55
60
  <input
56
61
  type="radio"
57
- name="theme-dropdown"
62
+ name="theme-{t.name}"
58
63
  class="theme-controller radio radio-xs"
59
64
  value={t.name}
60
65
  bind:group={themeStore.current}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ThemeSelectorProps = typeof __propDef.props;
10
+ export type ThemeSelectorEvents = typeof __propDef.events;
11
+ export type ThemeSelectorSlots = typeof __propDef.slots;
12
+ export default class ThemeSelector extends SvelteComponentTyped<ThemeSelectorProps, ThemeSelectorEvents, ThemeSelectorSlots> {
13
+ }
14
+ export {};
@@ -1,3 +1,14 @@
1
- declare const DashboardPanel: import("svelte").Component<Record<string, never>, {}, "">;
2
- type DashboardPanel = ReturnType<typeof DashboardPanel>;
3
- export default DashboardPanel;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type DashboardPanelProps = typeof __propDef.props;
10
+ export type DashboardPanelEvents = typeof __propDef.events;
11
+ export type DashboardPanelSlots = typeof __propDef.slots;
12
+ export default class DashboardPanel extends SvelteComponentTyped<DashboardPanelProps, DashboardPanelEvents, DashboardPanelSlots> {
13
+ }
14
+ export {};
@@ -1,3 +1,14 @@
1
- declare const ShortcutsPanel: import("svelte").Component<Record<string, never>, {}, "">;
2
- type ShortcutsPanel = ReturnType<typeof ShortcutsPanel>;
3
- export default ShortcutsPanel;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ShortcutsPanelProps = typeof __propDef.props;
10
+ export type ShortcutsPanelEvents = typeof __propDef.events;
11
+ export type ShortcutsPanelSlots = typeof __propDef.slots;
12
+ export default class ShortcutsPanel extends SvelteComponentTyped<ShortcutsPanelProps, ShortcutsPanelEvents, ShortcutsPanelSlots> {
13
+ }
14
+ export {};
@@ -1,3 +1,14 @@
1
- declare const ShowcasePanel: import("svelte").Component<Record<string, never>, {}, "">;
2
- type ShowcasePanel = ReturnType<typeof ShowcasePanel>;
3
- export default ShowcasePanel;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ShowcasePanelProps = typeof __propDef.props;
10
+ export type ShowcasePanelEvents = typeof __propDef.events;
11
+ export type ShowcasePanelSlots = typeof __propDef.slots;
12
+ export default class ShowcasePanel extends SvelteComponentTyped<ShowcasePanelProps, ShowcasePanelEvents, ShowcasePanelSlots> {
13
+ }
14
+ export {};