rune-lab 0.3.0 → 0.4.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/README.md +1 -1
- package/dist/core/design-tokens/props.d.ts +52 -0
- package/dist/core/design-tokens/props.d.ts.map +1 -0
- package/dist/core/design-tokens/props.js +34 -0
- package/dist/core/exchange-rate/strategies.d.ts +52 -0
- package/dist/core/exchange-rate/strategies.d.ts.map +1 -0
- package/dist/core/exchange-rate/strategies.js +72 -0
- package/dist/core/index.d.ts +8 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -3
- package/dist/core/internal/message-resolver.d.ts +1 -1
- package/dist/core/internal/message-resolver.d.ts.map +1 -1
- package/dist/core/layout/types.d.ts +60 -0
- package/dist/core/layout/types.d.ts.map +1 -0
- package/dist/core/layout/types.js +4 -0
- package/dist/core/money/index.d.ts +1 -1
- package/dist/core/money/index.d.ts.map +1 -1
- package/dist/core/money/index.js +1 -1
- package/dist/core/money/money-primitive.d.ts +101 -0
- package/dist/core/money/money-primitive.d.ts.map +1 -0
- package/dist/core/money/money-primitive.js +161 -0
- package/dist/core/money/money.d.ts +74 -2
- package/dist/core/money/money.d.ts.map +1 -1
- package/dist/core/money/money.js +120 -2
- package/dist/core/shortcuts/types.d.ts +60 -0
- package/dist/core/shortcuts/types.d.ts.map +1 -0
- package/dist/core/shortcuts/types.js +4 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +6 -4
- package/dist/state/api.svelte.js +2 -2
- package/dist/state/app.svelte.js +1 -1
- package/dist/state/auth/index.d.ts +2 -2
- package/dist/state/auth/index.js +1 -1
- package/dist/state/auth/session.svelte.d.ts +1 -1
- package/dist/state/auth/session.svelte.js +7 -5
- package/dist/state/auth/types.d.ts +1 -1
- package/dist/state/cart.svelte.d.ts +1 -1
- package/dist/state/cart.svelte.js +1 -1
- package/dist/state/commands.svelte.d.ts +7 -7
- package/dist/state/commands.svelte.js +1 -1
- package/dist/state/composables/useMoney.d.ts +19 -3
- package/dist/state/composables/useMoney.js +70 -6
- package/dist/state/composables/useMoneyFilter.d.ts +20 -0
- package/dist/state/composables/useMoneyFilter.js +81 -0
- package/dist/state/composables/usePersistence.d.ts +1 -1
- package/dist/state/composables/usePersistence.js +1 -1
- package/dist/state/composables/useRuneLab.d.ts +1 -1
- package/dist/state/composables/useRuneLab.js +2 -2
- package/dist/state/composables/useShortcuts.d.ts +33 -0
- package/dist/state/composables/useShortcuts.js +75 -0
- package/dist/state/context.d.ts +1 -0
- package/dist/state/context.js +1 -0
- package/dist/state/createConfigStore.svelte.d.ts +4 -31
- package/dist/state/createConfigStore.svelte.js +62 -51
- package/dist/state/currency.svelte.d.ts +13 -9
- package/dist/state/currency.svelte.js +26 -10
- package/dist/state/currency.test.d.ts +1 -0
- package/dist/state/currency.test.js +35 -0
- package/dist/state/exchange-rate.svelte.d.ts +43 -0
- package/dist/state/exchange-rate.svelte.js +145 -0
- package/dist/state/exchange-rate.test.d.ts +1 -0
- package/dist/state/exchange-rate.test.js +75 -0
- package/dist/state/index.d.ts +26 -19
- package/dist/state/index.js +25 -18
- package/dist/state/language.svelte.d.ts +3 -10
- package/dist/state/language.svelte.js +4 -5
- package/dist/state/layout.svelte.d.ts +1 -1
- package/dist/state/layout.svelte.js +4 -4
- package/dist/state/persistence/drivers.d.ts +1 -1
- package/dist/state/persistence/drivers.js +9 -7
- package/dist/state/persistence/drivers.test.d.ts +1 -0
- package/dist/state/persistence/drivers.test.js +79 -0
- package/dist/state/persistence/provider.d.ts +23 -0
- package/dist/state/persistence/provider.js +43 -0
- package/dist/state/persistence/provider.test.d.ts +1 -0
- package/dist/state/persistence/provider.test.js +51 -0
- package/dist/state/registry/index.d.ts +44 -0
- package/dist/state/registry/index.js +58 -0
- package/dist/state/registry/registry.test.d.ts +1 -0
- package/dist/state/registry/registry.test.js +112 -0
- package/dist/state/registry/types.d.ts +20 -0
- package/dist/state/registry/types.js +3 -0
- package/dist/state/shortcuts.svelte.js +4 -4
- package/dist/state/theme.svelte.d.ts +3 -10
- package/dist/state/theme.svelte.js +8 -8
- package/dist/state/toast-bridge.d.ts +1 -1
- package/dist/state/toast.svelte.js +1 -1
- package/dist/ui/components/ApiMonitor.svelte +2 -2
- package/dist/ui/components/Icon.svelte +1 -1
- package/dist/ui/components/RuneProvider.svelte +28 -8
- package/dist/ui/components/RuneProvider.svelte.d.ts +12 -5
- package/dist/ui/components/Toaster.svelte +1 -1
- package/dist/ui/components/money/MoneyDisplay.svelte +91 -18
- package/dist/ui/components/money/MoneyDisplay.svelte.d.ts +15 -3
- package/dist/ui/components/money/MoneyDisplay.svelte.test.d.ts +1 -1
- package/dist/ui/components/money/MoneyDisplay.svelte.test.js +45 -2
- package/dist/ui/components/money/MoneyInput.svelte +123 -42
- package/dist/ui/components/money/MoneyInput.svelte.d.ts +14 -5
- package/dist/ui/features/command-palette/CommandPalette.svelte +3 -3
- package/dist/ui/features/config/APP_CONFIGURATIONS.d.ts +29 -0
- package/dist/ui/features/config/APP_CONFIGURATIONS.js +38 -0
- package/dist/ui/features/config/CurrencySelector.svelte +10 -36
- package/dist/ui/features/config/LanguageSelector.svelte +10 -33
- package/dist/ui/features/config/ResourceSelector.svelte +92 -0
- package/dist/ui/features/config/ResourceSelector.svelte.d.ts +25 -0
- package/dist/ui/features/config/ThemeSelector.svelte +11 -34
- package/dist/ui/features/shortcuts/ShortcutBinder.svelte +17 -0
- package/dist/ui/features/shortcuts/ShortcutBinder.svelte.d.ts +7 -0
- package/dist/ui/features/shortcuts/ShortcutPalette.svelte +3 -3
- package/dist/ui/index.d.ts +5 -1
- package/dist/ui/index.js +8 -3
- package/dist/ui/layout/ConnectedNavigationPanel.svelte +7 -8
- package/dist/ui/layout/ConnectedNavigationPanel.svelte.d.ts +1 -1
- package/dist/ui/layout/ConnectedWorkspaceStrip.svelte +5 -3
- package/dist/ui/layout/ConnectedWorkspaceStrip.svelte.d.ts +1 -1
- package/dist/ui/layout/NavigationPanel.svelte +1 -1
- package/dist/ui/layout/NavigationPanel.svelte.d.ts +1 -1
- package/dist/ui/layout/WorkspaceLayout.svelte +9 -1
- package/dist/ui/layout/WorkspaceLayout.svelte.d.ts +7 -0
- package/dist/ui/layout/WorkspaceStrip.svelte +1 -1
- package/dist/ui/layout/WorkspaceStrip.svelte.d.ts +1 -1
- package/dist/ui/layout/connection-factory.d.ts +50 -0
- package/dist/ui/layout/connection-factory.js +58 -0
- package/dist/ui/layout/index.d.ts +2 -2
- package/dist/ui/layout/index.js +1 -1
- package/dist/ui/paraglide/README.md +53 -0
- package/dist/ui/paraglide/runtime.d.ts +105 -124
- package/dist/ui/paraglide/runtime.js +162 -127
- package/dist/ui/paraglide/server.d.ts +6 -17
- package/dist/ui/paraglide/server.js +11 -20
- package/dist/ui/primitives/DatePicker.svelte +1 -1
- package/package.json +8 -8
- package/dist/state/daisyui.d.ts +0 -4
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
getCurrencyStore,
|
|
5
|
-
type Currency,
|
|
6
|
-
} from "rune-lab/state";
|
|
7
|
-
import * as rlMessages from "../../paraglide/messages.js";
|
|
8
|
-
import { getContext } from "svelte";
|
|
2
|
+
import ResourceSelector from "./ResourceSelector.svelte";
|
|
3
|
+
import { getCurrencyStore } from "@internal/state";
|
|
9
4
|
|
|
10
5
|
const currencyStore = getCurrencyStore();
|
|
11
6
|
|
|
@@ -18,36 +13,15 @@
|
|
|
18
13
|
current?: string;
|
|
19
14
|
onchange?: (value: string) => void;
|
|
20
15
|
} = $props();
|
|
21
|
-
|
|
22
|
-
const userDictionary =
|
|
23
|
-
getContext<Record<string, any>>("rl:dictionary") ?? {};
|
|
24
|
-
|
|
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
|
-
}
|
|
33
|
-
|
|
34
|
-
let active = $derived(
|
|
35
|
-
currencyStore.get(currencyStore.current) ?? currencyStore.available[0],
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
let available = $derived(
|
|
39
|
-
codes.length > 0
|
|
40
|
-
? currencyStore.available.filter((c) => codes.includes(c.code))
|
|
41
|
-
: currencyStore.available,
|
|
42
|
-
);
|
|
43
16
|
</script>
|
|
44
17
|
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
18
|
+
<ResourceSelector
|
|
19
|
+
store={currencyStore}
|
|
20
|
+
idKey="code"
|
|
21
|
+
filterKeys={codes}
|
|
22
|
+
{onchange}
|
|
49
23
|
>
|
|
50
|
-
{#snippet triggerLabel()}
|
|
24
|
+
{#snippet triggerLabel(active)}
|
|
51
25
|
<span class="font-bold">{active.symbol}</span>
|
|
52
26
|
{/snippet}
|
|
53
27
|
|
|
@@ -61,7 +35,7 @@
|
|
|
61
35
|
}}
|
|
62
36
|
>
|
|
63
37
|
<span class="badge badge-sm badge-ghost w-8">{c.symbol}</span>
|
|
64
|
-
<span>{
|
|
38
|
+
<span>{c.code}</span>
|
|
65
39
|
</button>
|
|
66
40
|
{/snippet}
|
|
67
|
-
</
|
|
41
|
+
</ResourceSelector>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import { getLanguageStore
|
|
4
|
-
import * as rlMessages from "../../paraglide/messages.js";
|
|
5
|
-
import { getContext } from "svelte";
|
|
2
|
+
import ResourceSelector from "./ResourceSelector.svelte";
|
|
3
|
+
import { getLanguageStore } from "@internal/state";
|
|
6
4
|
import { setLocale } from "../../paraglide/runtime";
|
|
7
5
|
|
|
8
6
|
const languageStore = getLanguageStore();
|
|
@@ -16,36 +14,15 @@
|
|
|
16
14
|
current?: string;
|
|
17
15
|
onchange?: (value: string) => void;
|
|
18
16
|
} = $props();
|
|
19
|
-
|
|
20
|
-
const userDictionary =
|
|
21
|
-
getContext<Record<string, any>>("rl:dictionary") ?? {};
|
|
22
|
-
|
|
23
|
-
function getLabel(lang: Language): string {
|
|
24
|
-
const key = lang.code;
|
|
25
|
-
if (typeof userDictionary[key] === "function")
|
|
26
|
-
return userDictionary[key]();
|
|
27
|
-
if (typeof (rlMessages as any)[key] === "function")
|
|
28
|
-
return (rlMessages as any)[key]();
|
|
29
|
-
return lang.code.toUpperCase();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let active = $derived(
|
|
33
|
-
languageStore.get(languageStore.current) ?? languageStore.available[0],
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
let available = $derived(
|
|
37
|
-
languageStore.available.filter((l) =>
|
|
38
|
-
allowedLocales.includes(l.code as any),
|
|
39
|
-
),
|
|
40
|
-
);
|
|
41
17
|
</script>
|
|
42
18
|
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
19
|
+
<ResourceSelector
|
|
20
|
+
store={languageStore}
|
|
21
|
+
idKey="code"
|
|
22
|
+
filterKeys={[...allowedLocales]}
|
|
23
|
+
{onchange}
|
|
47
24
|
>
|
|
48
|
-
{#snippet triggerLabel()}
|
|
25
|
+
{#snippet triggerLabel(active)}
|
|
49
26
|
<span class="text-lg">{active.flag}</span>
|
|
50
27
|
{/snippet}
|
|
51
28
|
|
|
@@ -60,7 +37,7 @@
|
|
|
60
37
|
}}
|
|
61
38
|
>
|
|
62
39
|
<span class="text-lg">{l.flag}</span>
|
|
63
|
-
<span>{
|
|
40
|
+
<span>{l.code.toUpperCase()}</span>
|
|
64
41
|
</button>
|
|
65
42
|
{/snippet}
|
|
66
|
-
</
|
|
43
|
+
</ResourceSelector>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import AppSettingSelector from "./AppSettingSelector.svelte";
|
|
3
|
+
import type { ConfigStore } from "@internal/state";
|
|
4
|
+
import * as rlMessages from "../../paraglide/messages.js";
|
|
5
|
+
import { getContext, type Snippet } from "svelte";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ResourceSelector — Generic configuration picker.
|
|
9
|
+
* Wraps AppSettingSelector with automatic label resolution and store binding.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```svelte
|
|
13
|
+
* <ResourceSelector store={themeStore} idKey="name">
|
|
14
|
+
* {#snippet triggerLabel(item)}<span>{item.icon}</span>{/snippet}
|
|
15
|
+
* {#snippet item(t)}<button onclick={() => store.set(t.name)}>{t.name}</button>{/snippet}
|
|
16
|
+
* </ResourceSelector>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
let {
|
|
20
|
+
store,
|
|
21
|
+
idKey,
|
|
22
|
+
filterKeys = [],
|
|
23
|
+
triggerLabel,
|
|
24
|
+
item,
|
|
25
|
+
onchange,
|
|
26
|
+
direction = "bottom",
|
|
27
|
+
responsive = true,
|
|
28
|
+
}: {
|
|
29
|
+
/** ConfigStore instance to bind to */
|
|
30
|
+
store: ConfigStore<any>;
|
|
31
|
+
/** Key to use as identifier (e.g., "name", "code") */
|
|
32
|
+
idKey: string;
|
|
33
|
+
/** Optional subset of IDs to show */
|
|
34
|
+
filterKeys?: string[];
|
|
35
|
+
/** Snippet to render the trigger button content */
|
|
36
|
+
triggerLabel: Snippet<[any]>;
|
|
37
|
+
/** Snippet to render each option in the dropdown */
|
|
38
|
+
item: Snippet<[any]>;
|
|
39
|
+
/** Callback when selection changes */
|
|
40
|
+
onchange?: (value: string) => void;
|
|
41
|
+
/** Dropdown direction */
|
|
42
|
+
direction?: "top" | "bottom" | "left" | "right" | "end" | "auto";
|
|
43
|
+
/** Whether to show responsive mobile modal */
|
|
44
|
+
responsive?: boolean;
|
|
45
|
+
} = $props();
|
|
46
|
+
|
|
47
|
+
const userDictionary =
|
|
48
|
+
getContext<Record<string, any>>("rl:dictionary") ?? {};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a label for an item through the message chain:
|
|
52
|
+
* 1. User-provided dictionary
|
|
53
|
+
* 2. Paraglide messages
|
|
54
|
+
* 3. Raw key fallback
|
|
55
|
+
*/
|
|
56
|
+
export function resolveLabel(item: any): string {
|
|
57
|
+
const key = String(item[idKey]);
|
|
58
|
+
if (typeof userDictionary[key] === "function")
|
|
59
|
+
return userDictionary[key]();
|
|
60
|
+
if (typeof (rlMessages as any)[key] === "function")
|
|
61
|
+
return (rlMessages as any)[key]();
|
|
62
|
+
return key;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let active = $derived(
|
|
66
|
+
store.get(store.current) ?? store.available[0],
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
let available = $derived(
|
|
70
|
+
filterKeys.length > 0
|
|
71
|
+
? store.available.filter((item: any) =>
|
|
72
|
+
filterKeys.includes(String(item[idKey])),
|
|
73
|
+
)
|
|
74
|
+
: store.available,
|
|
75
|
+
);
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<AppSettingSelector
|
|
79
|
+
value={active}
|
|
80
|
+
options={available}
|
|
81
|
+
tooltip={resolveLabel(active)}
|
|
82
|
+
{direction}
|
|
83
|
+
{responsive}
|
|
84
|
+
>
|
|
85
|
+
{#snippet triggerLabel(value)}
|
|
86
|
+
{@render triggerLabel(value)}
|
|
87
|
+
{/snippet}
|
|
88
|
+
|
|
89
|
+
{#snippet item(option)}
|
|
90
|
+
{@render item(option)}
|
|
91
|
+
{/snippet}
|
|
92
|
+
</AppSettingSelector>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ConfigStore } from "@internal/state";
|
|
2
|
+
import { type Snippet } from "svelte";
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
/** ConfigStore instance to bind to */
|
|
5
|
+
store: ConfigStore<any>;
|
|
6
|
+
/** Key to use as identifier (e.g., "name", "code") */
|
|
7
|
+
idKey: string;
|
|
8
|
+
/** Optional subset of IDs to show */
|
|
9
|
+
filterKeys?: string[];
|
|
10
|
+
/** Snippet to render the trigger button content */
|
|
11
|
+
triggerLabel: Snippet<[any]>;
|
|
12
|
+
/** Snippet to render each option in the dropdown */
|
|
13
|
+
item: Snippet<[any]>;
|
|
14
|
+
/** Callback when selection changes */
|
|
15
|
+
onchange?: (value: string) => void;
|
|
16
|
+
/** Dropdown direction */
|
|
17
|
+
direction?: "top" | "bottom" | "left" | "right" | "end" | "auto";
|
|
18
|
+
/** Whether to show responsive mobile modal */
|
|
19
|
+
responsive?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare const ResourceSelector: import("svelte").Component<$$ComponentProps, {
|
|
22
|
+
resolveLabel: (item: any) => string;
|
|
23
|
+
}, "">;
|
|
24
|
+
type ResourceSelector = ReturnType<typeof ResourceSelector>;
|
|
25
|
+
export default ResourceSelector;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import { getThemeStore, type Theme } from "
|
|
4
|
-
import * as rlMessages from "../../paraglide/messages.js";
|
|
5
|
-
import { getContext } from "svelte";
|
|
2
|
+
import ResourceSelector from "./ResourceSelector.svelte";
|
|
3
|
+
import { getThemeStore, type Theme } from "@internal/state";
|
|
6
4
|
|
|
7
5
|
const themeStore = getThemeStore();
|
|
8
6
|
|
|
@@ -15,37 +13,16 @@
|
|
|
15
13
|
current?: string;
|
|
16
14
|
onchange?: (value: string) => void;
|
|
17
15
|
} = $props();
|
|
18
|
-
|
|
19
|
-
const userDictionary =
|
|
20
|
-
getContext<Record<string, any>>("rl:dictionary") ?? {};
|
|
21
|
-
|
|
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
|
-
}
|
|
30
|
-
|
|
31
|
-
let activeTheme = $derived(
|
|
32
|
-
themeStore.get(themeStore.current) ?? themeStore.available[0],
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
let available = $derived(
|
|
36
|
-
themes.length > 0
|
|
37
|
-
? themeStore.available.filter((t) => themes.includes(t.name))
|
|
38
|
-
: themeStore.available,
|
|
39
|
-
);
|
|
40
16
|
</script>
|
|
41
17
|
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
18
|
+
<ResourceSelector
|
|
19
|
+
store={themeStore}
|
|
20
|
+
idKey="name"
|
|
21
|
+
filterKeys={themes}
|
|
22
|
+
{onchange}
|
|
46
23
|
>
|
|
47
|
-
{#snippet triggerLabel()}
|
|
48
|
-
<span class="text-lg">{
|
|
24
|
+
{#snippet triggerLabel(active)}
|
|
25
|
+
<span class="text-lg">{active.icon}</span>
|
|
49
26
|
{/snippet}
|
|
50
27
|
|
|
51
28
|
{#snippet item(t)}
|
|
@@ -66,8 +43,8 @@
|
|
|
66
43
|
/>
|
|
67
44
|
<span class="text-lg">{t.icon}</span>
|
|
68
45
|
<span class="capitalize">
|
|
69
|
-
{
|
|
46
|
+
{t.name}
|
|
70
47
|
</span>
|
|
71
48
|
</button>
|
|
72
49
|
{/snippet}
|
|
73
|
-
</
|
|
50
|
+
</ResourceSelector>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
ShortcutBinder — Declarative shortcut registration component.
|
|
3
|
+
No visual output — purely a lifecycle binder.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
<ShortcutBinder shortcuts={[
|
|
7
|
+
{ id: "save:doc", keys: "ctrl+s", handler: save, label: "Save" },
|
|
8
|
+
]} />
|
|
9
|
+
-->
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import type { ShortcutConfig } from "@internal/core";
|
|
12
|
+
import { useShortcuts } from "@internal/state";
|
|
13
|
+
|
|
14
|
+
let { shortcuts }: { shortcuts: ShortcutConfig[] } = $props();
|
|
15
|
+
|
|
16
|
+
useShortcuts(shortcuts);
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ShortcutConfig } from "@internal/core";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
shortcuts: ShortcutConfig[];
|
|
4
|
+
};
|
|
5
|
+
declare const ShortcutBinder: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type ShortcutBinder = ReturnType<typeof ShortcutBinder>;
|
|
7
|
+
export default ShortcutBinder;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!-- src/lib/features/shortcuts/ShortcutPalette.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { tick } from "svelte";
|
|
4
|
-
import type { ShortcutEntry } from "
|
|
4
|
+
import type { ShortcutEntry } from "@internal/state";
|
|
5
5
|
import {
|
|
6
6
|
getAppStore,
|
|
7
7
|
getShortcutStore,
|
|
8
8
|
LAYOUT_SHORTCUTS,
|
|
9
|
-
} from "
|
|
10
|
-
import { Icon } from "
|
|
9
|
+
} from "@internal/state";
|
|
10
|
+
import { Icon } from "@internal/ui";
|
|
11
11
|
|
|
12
12
|
const appStore = getAppStore();
|
|
13
13
|
const shortcutStore = getShortcutStore();
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { portal } from "./actions/portal.
|
|
1
|
+
export { portal } from "./actions/portal.ts";
|
|
2
2
|
export { default as RuneProvider } from "./components/RuneProvider.svelte";
|
|
3
3
|
export { default as Icon } from "./components/Icon.svelte";
|
|
4
4
|
export { default as Toaster } from "./components/Toaster.svelte";
|
|
@@ -6,7 +6,10 @@ export { default as ApiMonitor } from "./components/ApiMonitor.svelte";
|
|
|
6
6
|
export { default as Kyntharil } from "./components/Kyntharil.svelte";
|
|
7
7
|
export { default as CommandPalette } from "./features/command-palette/CommandPalette.svelte";
|
|
8
8
|
export { default as ShortcutPalette } from "./features/shortcuts/ShortcutPalette.svelte";
|
|
9
|
+
export { default as ShortcutBinder } from "./features/shortcuts/ShortcutBinder.svelte";
|
|
9
10
|
export { default as AppSettingSelector } from "./features/config/AppSettingSelector.svelte";
|
|
11
|
+
export { default as ResourceSelector } from "./features/config/ResourceSelector.svelte";
|
|
12
|
+
export { APP_CONFIGURATIONS, type ConfigDimension, } from "./features/config/APP_CONFIGURATIONS.ts";
|
|
10
13
|
export { default as ThemeSelector } from "./features/config/ThemeSelector.svelte";
|
|
11
14
|
export { default as LanguageSelector } from "./features/config/LanguageSelector.svelte";
|
|
12
15
|
export { default as CurrencySelector } from "./features/config/CurrencySelector.svelte";
|
|
@@ -17,6 +20,7 @@ export { default as ContentArea } from "./layout/ContentArea.svelte";
|
|
|
17
20
|
export { default as DetailPanel } from "./layout/DetailPanel.svelte";
|
|
18
21
|
export { default as ConnectedNavigationPanel } from "./layout/ConnectedNavigationPanel.svelte";
|
|
19
22
|
export { default as ConnectedWorkspaceStrip } from "./layout/ConnectedWorkspaceStrip.svelte";
|
|
23
|
+
export { createNavigationConnection, createWorkspaceConnection, type NavigationConnection, type WorkspaceConnection, } from "./layout/connection-factory.ts";
|
|
20
24
|
export { default as DatePicker } from "./primitives/DatePicker.svelte";
|
|
21
25
|
export { default as UserAvatar } from "./components/user/UserAvatar.svelte";
|
|
22
26
|
export { default as UserProfile } from "./components/user/UserProfile.svelte";
|
package/dist/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// All components, actions, and layout primitives
|
|
2
2
|
// ── Actions ───────────────────────────────────────────────────────────────────
|
|
3
|
-
export { portal } from "./actions/portal.
|
|
3
|
+
export { portal } from "./actions/portal.ts";
|
|
4
4
|
// ── Core Components ───────────────────────────────────────────────────────────
|
|
5
5
|
export { default as RuneProvider } from "./components/RuneProvider.svelte";
|
|
6
6
|
export { default as Icon } from "./components/Icon.svelte";
|
|
@@ -10,8 +10,11 @@ export { default as Kyntharil } from "./components/Kyntharil.svelte";
|
|
|
10
10
|
// ── Features ──────────────────────────────────────────────────────────────────
|
|
11
11
|
export { default as CommandPalette } from "./features/command-palette/CommandPalette.svelte";
|
|
12
12
|
export { default as ShortcutPalette } from "./features/shortcuts/ShortcutPalette.svelte";
|
|
13
|
+
export { default as ShortcutBinder } from "./features/shortcuts/ShortcutBinder.svelte";
|
|
13
14
|
// Setting Selectors
|
|
14
15
|
export { default as AppSettingSelector } from "./features/config/AppSettingSelector.svelte";
|
|
16
|
+
export { default as ResourceSelector } from "./features/config/ResourceSelector.svelte";
|
|
17
|
+
export { APP_CONFIGURATIONS, } from "./features/config/APP_CONFIGURATIONS.ts";
|
|
15
18
|
export { default as ThemeSelector } from "./features/config/ThemeSelector.svelte";
|
|
16
19
|
export { default as LanguageSelector } from "./features/config/LanguageSelector.svelte";
|
|
17
20
|
export { default as CurrencySelector } from "./features/config/CurrencySelector.svelte";
|
|
@@ -24,6 +27,8 @@ export { default as DetailPanel } from "./layout/DetailPanel.svelte";
|
|
|
24
27
|
// ── Connected (Smart) Components ──────────────────────────────────────────────
|
|
25
28
|
export { default as ConnectedNavigationPanel } from "./layout/ConnectedNavigationPanel.svelte";
|
|
26
29
|
export { default as ConnectedWorkspaceStrip } from "./layout/ConnectedWorkspaceStrip.svelte";
|
|
30
|
+
// ── Connection Factory (Phase 3) ──────────────────────────────────────────────
|
|
31
|
+
export { createNavigationConnection, createWorkspaceConnection, } from "./layout/connection-factory.ts";
|
|
27
32
|
// ── Primitives ────────────────────────────────────────────────────────────────
|
|
28
33
|
export { default as DatePicker } from "./primitives/DatePicker.svelte";
|
|
29
34
|
// ── User Components ───────────────────────────────────────────────────────────
|
|
@@ -37,5 +42,5 @@ export { default as MoneyInput } from "./components/money/MoneyInput.svelte";
|
|
|
37
42
|
// ── Paraglide messages ────────────────────────────────────────────────────────
|
|
38
43
|
export * as sdkMessages from "./paraglide/messages.js";
|
|
39
44
|
// // Consumers shouldn't need rune-lab/state just to get cookieDriver, stores, etc.
|
|
40
|
-
// export * from "
|
|
41
|
-
// export * from "
|
|
45
|
+
// export * from "@internal/state";
|
|
46
|
+
// export * from "@internal/core";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<!-- src/lib/features/layout/smart/ConnectedNavigationPanel.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import { getLayoutStore, type NavigationSection } from "
|
|
3
|
+
import { getLayoutStore, type NavigationSection } from "@internal/state";
|
|
4
4
|
import NavigationPanel from "./NavigationPanel.svelte";
|
|
5
|
+
import { createNavigationConnection } from "./connection-factory.ts";
|
|
5
6
|
import type { Snippet } from "svelte";
|
|
6
7
|
|
|
7
8
|
let { sections, header, footer } = $props<{
|
|
@@ -11,17 +12,15 @@
|
|
|
11
12
|
}>();
|
|
12
13
|
|
|
13
14
|
const layoutStore = getLayoutStore();
|
|
15
|
+
const connection = createNavigationConnection(layoutStore);
|
|
14
16
|
</script>
|
|
15
17
|
|
|
16
18
|
<NavigationPanel
|
|
17
19
|
{sections}
|
|
18
20
|
{header}
|
|
19
21
|
{footer}
|
|
20
|
-
activeId={
|
|
21
|
-
collapsedIds={
|
|
22
|
-
onSelect={
|
|
23
|
-
onToggle={
|
|
24
|
-
isOpen
|
|
25
|
-
? layoutStore.expandSection(id)
|
|
26
|
-
: layoutStore.collapseSection(id)}
|
|
22
|
+
activeId={connection.activeId}
|
|
23
|
+
collapsedIds={connection.collapsedIds}
|
|
24
|
+
onSelect={connection.onSelect}
|
|
25
|
+
onToggle={connection.onToggle}
|
|
27
26
|
/>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<!-- src/lib/features/layout/smart/ConnectedWorkspaceStrip.svelte -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import { getLayoutStore, type WorkspaceItem } from "
|
|
3
|
+
import { getLayoutStore, type WorkspaceItem } from "@internal/state";
|
|
4
4
|
import WorkspaceStrip from "./WorkspaceStrip.svelte";
|
|
5
|
+
import { createWorkspaceConnection } from "./connection-factory.ts";
|
|
5
6
|
import type { Snippet } from "svelte";
|
|
6
7
|
|
|
7
8
|
let { items, globalActions } = $props<{
|
|
@@ -10,11 +11,12 @@
|
|
|
10
11
|
}>();
|
|
11
12
|
|
|
12
13
|
const layoutStore = getLayoutStore();
|
|
14
|
+
const connection = createWorkspaceConnection(layoutStore);
|
|
13
15
|
</script>
|
|
14
16
|
|
|
15
17
|
<WorkspaceStrip
|
|
16
18
|
{items}
|
|
17
19
|
{globalActions}
|
|
18
|
-
activeId={
|
|
19
|
-
onSelect={
|
|
20
|
+
activeId={connection.activeId}
|
|
21
|
+
onSelect={connection.onSelect}
|
|
20
22
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { NavigationItem, NavigationSection } from "
|
|
2
|
+
import type { NavigationItem, NavigationSection } from "@internal/state";
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
header?: Snippet;
|
|
5
5
|
sections: NavigationSection[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!-- src/lib/layout/WorkspaceLayout.svelte -->
|
|
2
2
|
<script module lang="ts">
|
|
3
3
|
import type { Snippet } from "svelte";
|
|
4
|
+
import type { LayoutConfig } from "@internal/core";
|
|
4
5
|
|
|
5
6
|
export interface WorkspaceLayoutProps {
|
|
6
7
|
/** Content for the far-left vertical strip */
|
|
@@ -13,6 +14,13 @@
|
|
|
13
14
|
detailPanel?: Snippet;
|
|
14
15
|
namespace?: string;
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Declarative layout configuration.
|
|
19
|
+
* When provided, zones can be rendered from config entries.
|
|
20
|
+
* Snippet props take priority when both are provided.
|
|
21
|
+
*/
|
|
22
|
+
config?: LayoutConfig;
|
|
23
|
+
|
|
16
24
|
/** Width of the left workspace strip */
|
|
17
25
|
stripWidth?: string;
|
|
18
26
|
/** Width of the navigation tree panel */
|
|
@@ -34,7 +42,7 @@
|
|
|
34
42
|
getLanguageStore,
|
|
35
43
|
shortcutListener,
|
|
36
44
|
LAYOUT_SHORTCUTS,
|
|
37
|
-
} from "
|
|
45
|
+
} from "@internal/state";
|
|
38
46
|
import { onMount } from "svelte";
|
|
39
47
|
|
|
40
48
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
+
import type { LayoutConfig } from "@internal/core";
|
|
2
3
|
export interface WorkspaceLayoutProps {
|
|
3
4
|
/** Content for the far-left vertical strip */
|
|
4
5
|
workspaceStrip?: Snippet;
|
|
@@ -9,6 +10,12 @@ export interface WorkspaceLayoutProps {
|
|
|
9
10
|
/** Right-side contextual detail panel */
|
|
10
11
|
detailPanel?: Snippet;
|
|
11
12
|
namespace?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Declarative layout configuration.
|
|
15
|
+
* When provided, zones can be rendered from config entries.
|
|
16
|
+
* Snippet props take priority when both are provided.
|
|
17
|
+
*/
|
|
18
|
+
config?: LayoutConfig;
|
|
12
19
|
/** Width of the left workspace strip */
|
|
13
20
|
stripWidth?: string;
|
|
14
21
|
/** Width of the navigation tree panel */
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { LayoutStore } from "@internal/state";
|
|
2
|
+
/**
|
|
3
|
+
* Reactive prop binding for the NavigationPanel component.
|
|
4
|
+
*/
|
|
5
|
+
export interface NavigationConnection {
|
|
6
|
+
/** Currently active navigation item ID */
|
|
7
|
+
readonly activeId: string | null;
|
|
8
|
+
/** Set of collapsed section IDs */
|
|
9
|
+
readonly collapsedIds: Set<string>;
|
|
10
|
+
/** Handler for when a navigation item is selected */
|
|
11
|
+
onSelect: (item: {
|
|
12
|
+
id?: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
/** Handler for when a section is toggled */
|
|
15
|
+
onToggle: (id: string, isOpen: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reactive prop binding for the WorkspaceStrip component.
|
|
19
|
+
*/
|
|
20
|
+
export interface WorkspaceConnection {
|
|
21
|
+
/** Currently active workspace ID */
|
|
22
|
+
readonly activeId: string | null;
|
|
23
|
+
/** Handler for when a workspace is selected */
|
|
24
|
+
onSelect: (id: string) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates reactive prop bindings for connecting NavigationPanel to LayoutStore.
|
|
28
|
+
* Returns an object with getter properties that track LayoutStore state.
|
|
29
|
+
*
|
|
30
|
+
* @param layoutStore - The LayoutStore instance from context
|
|
31
|
+
* @returns Prop bindings compatible with NavigationPanel
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```svelte
|
|
35
|
+
* <script>
|
|
36
|
+
* const layoutStore = getLayoutStore();
|
|
37
|
+
* const nav = createNavigationConnection(layoutStore);
|
|
38
|
+
* </script>
|
|
39
|
+
* <NavigationPanel {sections} activeId={nav.activeId} collapsedIds={nav.collapsedIds}
|
|
40
|
+
* onSelect={nav.onSelect} onToggle={nav.onToggle} />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function createNavigationConnection(layoutStore: LayoutStore): NavigationConnection;
|
|
44
|
+
/**
|
|
45
|
+
* Creates reactive prop bindings for connecting WorkspaceStrip to LayoutStore.
|
|
46
|
+
*
|
|
47
|
+
* @param layoutStore - The LayoutStore instance from context
|
|
48
|
+
* @returns Prop bindings compatible with WorkspaceStrip
|
|
49
|
+
*/
|
|
50
|
+
export declare function createWorkspaceConnection(layoutStore: LayoutStore): WorkspaceConnection;
|