rune-lab 0.0.21 → 0.1.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 +107 -0
- package/dist/components/ApiMonitor.svelte.d.ts +3 -0
- package/dist/components/Icon.svelte +52 -12
- package/dist/components/Icon.svelte.d.ts +2 -1
- package/dist/components/RuneProvider.svelte +49 -10
- package/dist/components/RuneProvider.svelte.d.ts +11 -1
- package/dist/{devtools → components}/Toaster.svelte +2 -2
- package/dist/features/config/components/AppSettingSelector.svelte +9 -3
- package/dist/features/config/components/CurrencySelector.svelte +5 -3
- package/dist/features/config/components/LanguageSelector.svelte +6 -6
- package/dist/features/config/components/ThemeSelector.svelte +5 -3
- package/dist/features/detail-panels/ShowcasePanel.svelte +4 -6
- package/dist/index.d.ts +8 -9
- package/dist/index.js +6 -9
- package/dist/layout/WorkspaceLayout.svelte +81 -40
- package/dist/layout/WorkspaceLayout.svelte.d.ts +18 -4
- package/dist/persistence/drivers.js +10 -12
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +20 -0
- package/dist/showcase/AppStateInspector.svelte +27 -9
- package/dist/showcase/Showcase.svelte +5 -4
- package/dist/showcase/state.svelte.d.ts +3 -0
- package/dist/showcase/state.svelte.js +3 -0
- package/dist/state/api.svelte.d.ts +2 -1
- package/dist/state/api.svelte.js +16 -4
- package/dist/state/app.svelte.d.ts +5 -0
- package/dist/state/app.svelte.js +7 -0
- package/dist/state/commands.svelte.d.ts +1 -1
- package/dist/state/currency.svelte.d.ts +1 -1
- package/dist/state/currency.svelte.js +1 -1
- package/dist/state/index.d.ts +3 -1
- package/dist/state/index.js +3 -1
- package/dist/state/language.svelte.d.ts +6 -2
- package/dist/state/language.svelte.js +12 -4
- package/dist/state/layout.svelte.d.ts +0 -2
- package/dist/state/layout.svelte.js +0 -4
- package/dist/state/shortcuts.svelte.d.ts +14 -14
- package/dist/state/shortcuts.svelte.js +0 -10
- package/dist/state/theme.svelte.d.ts +1 -1
- package/dist/state/theme.svelte.js +1 -1
- package/dist/state/toast-bridge.d.ts +29 -0
- package/dist/state/toast-bridge.js +43 -0
- package/package.json +9 -5
- package/dist/devtools/API_Monitor.svelte.d.ts +0 -3
- /package/dist/{devtools/API_Monitor.svelte → components/ApiMonitor.svelte} +0 -0
- /package/dist/{devtools → components}/Toaster.svelte.d.ts +0 -0
- /package/dist/{devtools → internal}/message-resolver.d.ts +0 -0
- /package/dist/{devtools → internal}/message-resolver.js +0 -0
- /package/dist/{devtools → state}/createConfigStore.svelte.d.ts +0 -0
- /package/dist/{devtools → state}/createConfigStore.svelte.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// client/sdk/state/src/config/language.svelte.ts
|
|
2
|
-
import { createConfigStore, } from "
|
|
2
|
+
import { createConfigStore, } from "./createConfigStore.svelte";
|
|
3
3
|
import { setLocale } from "../paraglide/runtime.js";
|
|
4
4
|
import { getContext } from "svelte";
|
|
5
5
|
import { RUNE_LAB_CONTEXT } from "../context";
|
|
@@ -23,21 +23,29 @@ export const LANGUAGES = [
|
|
|
23
23
|
{ code: "ko", flag: "🇰🇷" },
|
|
24
24
|
{ code: "vi", flag: "🇻🇳" },
|
|
25
25
|
];
|
|
26
|
-
export function createLanguageStore(
|
|
26
|
+
export function createLanguageStore(options) {
|
|
27
|
+
const driver = typeof options?.driver === "function"
|
|
28
|
+
? options.driver()
|
|
29
|
+
: options?.driver;
|
|
27
30
|
const store = createConfigStore({
|
|
28
31
|
items: LANGUAGES,
|
|
29
32
|
storageKey: "language",
|
|
30
33
|
displayName: "Language",
|
|
31
34
|
idKey: "code",
|
|
32
35
|
icon: "🌍",
|
|
33
|
-
driver
|
|
36
|
+
driver,
|
|
34
37
|
});
|
|
35
38
|
// Sync Paraglide locale with languageStore
|
|
36
39
|
if (typeof window !== "undefined") {
|
|
37
40
|
$effect.root(() => {
|
|
38
41
|
$effect(() => {
|
|
39
42
|
const currentCode = store.current;
|
|
40
|
-
|
|
43
|
+
if (options?.onLocaleChange) {
|
|
44
|
+
options.onLocaleChange(currentCode);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
setLocale(currentCode);
|
|
48
|
+
}
|
|
41
49
|
});
|
|
42
50
|
});
|
|
43
51
|
}
|
|
@@ -27,7 +27,6 @@ export declare class LayoutStore {
|
|
|
27
27
|
workspaces: WorkspaceItem[];
|
|
28
28
|
activeWorkspaceId: string | null;
|
|
29
29
|
activeNavItemId: string | null;
|
|
30
|
-
activeShowcaseTab: number;
|
|
31
30
|
navOpen: boolean;
|
|
32
31
|
detailOpen: boolean;
|
|
33
32
|
collapsedSections: Set<string>;
|
|
@@ -40,7 +39,6 @@ export declare class LayoutStore {
|
|
|
40
39
|
activateWorkspace(id: string): void;
|
|
41
40
|
activateWorkspaceByIndex(index: number): void;
|
|
42
41
|
navigate(id: string): void;
|
|
43
|
-
setShowcaseTab(index: number): void;
|
|
44
42
|
toggleNav(): void;
|
|
45
43
|
toggleDetail(): void;
|
|
46
44
|
toggleSection(id: string): void;
|
|
@@ -5,7 +5,6 @@ export class LayoutStore {
|
|
|
5
5
|
workspaces = $state([]);
|
|
6
6
|
activeWorkspaceId = $state(null);
|
|
7
7
|
activeNavItemId = $state(null);
|
|
8
|
-
activeShowcaseTab = $state(0);
|
|
9
8
|
navOpen = $state(true);
|
|
10
9
|
detailOpen = $state(false);
|
|
11
10
|
collapsedSections = $state(new Set());
|
|
@@ -80,9 +79,6 @@ export class LayoutStore {
|
|
|
80
79
|
navigate(id) {
|
|
81
80
|
this.activeNavItemId = id;
|
|
82
81
|
}
|
|
83
|
-
setShowcaseTab(index) {
|
|
84
|
-
this.activeShowcaseTab = index;
|
|
85
|
-
}
|
|
86
82
|
toggleNav() {
|
|
87
83
|
this.navOpen = !this.navOpen;
|
|
88
84
|
}
|
|
@@ -28,6 +28,20 @@ export interface ShortcutEntry extends ShortcutMeta {
|
|
|
28
28
|
* Built-in layout shortcuts
|
|
29
29
|
*/
|
|
30
30
|
export declare const LAYOUT_SHORTCUTS: {
|
|
31
|
+
readonly TOGGLE_NAV: {
|
|
32
|
+
readonly id: "rl:layout:toggle-nav";
|
|
33
|
+
readonly keys: "ctrl+\\";
|
|
34
|
+
readonly label: "Toggle Navigation Panel";
|
|
35
|
+
readonly category: "Layout";
|
|
36
|
+
readonly scope: "global";
|
|
37
|
+
};
|
|
38
|
+
readonly TOGGLE_DETAIL: {
|
|
39
|
+
readonly id: "rl:layout:toggle-detail";
|
|
40
|
+
readonly keys: "ctrl+shift+\\";
|
|
41
|
+
readonly label: "Toggle Detail Panel";
|
|
42
|
+
readonly category: "Layout";
|
|
43
|
+
readonly scope: "global";
|
|
44
|
+
};
|
|
31
45
|
readonly OPEN_SHORTCUTS: {
|
|
32
46
|
readonly id: "rl:shortcuts:open";
|
|
33
47
|
readonly keys: "ctrl+/";
|
|
@@ -63,20 +77,6 @@ export declare const LAYOUT_SHORTCUTS: {
|
|
|
63
77
|
readonly category: "Navigation";
|
|
64
78
|
readonly scope: "panel:navigation";
|
|
65
79
|
};
|
|
66
|
-
readonly TOGGLE_NAV: {
|
|
67
|
-
readonly id: "rl:layout:toggle-nav";
|
|
68
|
-
readonly keys: "ctrl+\\";
|
|
69
|
-
readonly label: "Toggle Navigation Panel";
|
|
70
|
-
readonly category: "Layout";
|
|
71
|
-
readonly scope: "global";
|
|
72
|
-
};
|
|
73
|
-
readonly TOGGLE_DETAIL: {
|
|
74
|
-
readonly id: "rl:layout:toggle-detail";
|
|
75
|
-
readonly keys: "ctrl+shift+\\";
|
|
76
|
-
readonly label: "Toggle Detail Panel";
|
|
77
|
-
readonly category: "Layout";
|
|
78
|
-
readonly scope: "global";
|
|
79
|
-
};
|
|
80
80
|
};
|
|
81
81
|
export declare class ShortcutStore {
|
|
82
82
|
/** All registered shortcuts */
|
|
@@ -19,16 +19,6 @@ export const LAYOUT_SHORTCUTS = {
|
|
|
19
19
|
category: "Layout",
|
|
20
20
|
scope: "global",
|
|
21
21
|
},
|
|
22
|
-
...Object.fromEntries(Array.from({ length: 9 }, (_, i) => [
|
|
23
|
-
`WORKSPACE_${i + 1}`,
|
|
24
|
-
{
|
|
25
|
-
id: `rl:layout:workspace-${i + 1}`,
|
|
26
|
-
keys: `ctrl+${i + 1}`,
|
|
27
|
-
label: `Jump to Workspace ${i + 1}`,
|
|
28
|
-
category: "Navigation",
|
|
29
|
-
scope: "global",
|
|
30
|
-
},
|
|
31
|
-
])),
|
|
32
22
|
OPEN_SHORTCUTS: {
|
|
33
23
|
id: "rl:shortcuts:open",
|
|
34
24
|
keys: "ctrl+/",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// client/packages/ui/src/state/theme-config.svelte.ts
|
|
2
|
-
import { createConfigStore, } from "
|
|
2
|
+
import { createConfigStore, } from "./createConfigStore.svelte";
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
import { RUNE_LAB_CONTEXT } from "../context";
|
|
5
5
|
import themeOrder from "daisyui/functions/themeOrder.js"; // has its own .d.ts
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ToastStore, ToastType } from "./toast.svelte";
|
|
2
|
+
/**
|
|
3
|
+
* Notifies the global toast system.
|
|
4
|
+
* If called before the ToastStore is initialized (e.g., in a module-level store),
|
|
5
|
+
* it queues the toast and flushes it once wired.
|
|
6
|
+
*
|
|
7
|
+
* @clientOnly — Not safe for use in SSR contexts. Module-level state persists across requests.
|
|
8
|
+
*/
|
|
9
|
+
export declare function notify(message: string, type?: ToastType, duration?: number): void;
|
|
10
|
+
/**
|
|
11
|
+
* Wires the global `notify` function to an active ToastStore instance.
|
|
12
|
+
* Automatically flushes any queued toasts.
|
|
13
|
+
*/
|
|
14
|
+
export declare function wire(store: ToastStore): void;
|
|
15
|
+
/**
|
|
16
|
+
* Escape hatch for module-level stores to send toasts without Svelte context.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { createToastBridge } from "rune-lab";
|
|
21
|
+
* const { notify } = createToastBridge();
|
|
22
|
+
*
|
|
23
|
+
* notify("Logged in successfully", "success");
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const createToastBridge: () => {
|
|
27
|
+
notify: typeof notify;
|
|
28
|
+
wire: typeof wire;
|
|
29
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const queue = [];
|
|
2
|
+
let activeStore = null;
|
|
3
|
+
/**
|
|
4
|
+
* Notifies the global toast system.
|
|
5
|
+
* If called before the ToastStore is initialized (e.g., in a module-level store),
|
|
6
|
+
* it queues the toast and flushes it once wired.
|
|
7
|
+
*
|
|
8
|
+
* @clientOnly — Not safe for use in SSR contexts. Module-level state persists across requests.
|
|
9
|
+
*/
|
|
10
|
+
export function notify(message, type = "info", duration) {
|
|
11
|
+
if (typeof window === "undefined")
|
|
12
|
+
return; // No-op on server
|
|
13
|
+
if (activeStore) {
|
|
14
|
+
activeStore.send(message, type, duration ?? 3000);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
queue.push({ message, type, duration });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wires the global `notify` function to an active ToastStore instance.
|
|
22
|
+
* Automatically flushes any queued toasts.
|
|
23
|
+
*/
|
|
24
|
+
export function wire(store) {
|
|
25
|
+
activeStore = store;
|
|
26
|
+
while (queue.length > 0) {
|
|
27
|
+
const next = queue.shift();
|
|
28
|
+
if (next)
|
|
29
|
+
store.send(next.message, next.type, next.duration ?? 3000);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Escape hatch for module-level stores to send toasts without Svelte context.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { createToastBridge } from "rune-lab";
|
|
38
|
+
* const { notify } = createToastBridge();
|
|
39
|
+
*
|
|
40
|
+
* notify("Logged in successfully", "success");
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const createToastBridge = () => ({ notify, wire });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rune-lab",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Rune Lab: Modern toolkit for Svelte 5 Runes applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
"types": "./dist/layout/index.d.ts",
|
|
31
31
|
"default": "./dist/layout/index.js"
|
|
32
32
|
},
|
|
33
|
+
"./server": {
|
|
34
|
+
"types": "./dist/server/index.d.ts",
|
|
35
|
+
"default": "./dist/server/index.js"
|
|
36
|
+
},
|
|
33
37
|
"./paraglide/*": {
|
|
34
38
|
"types": "./dist/paraglide/*.d.ts",
|
|
35
39
|
"default": "./dist/paraglide/*.js"
|
|
@@ -45,8 +49,8 @@
|
|
|
45
49
|
"prepack": "bun run compile && bunx svelte-kit sync && bunx svelte-package && rm -f dist/paraglide/.gitignore dist/paraglide/.prettierignore && bunx publint"
|
|
46
50
|
},
|
|
47
51
|
"peerDependencies": {
|
|
48
|
-
"@sveltejs/kit": "^2.
|
|
49
|
-
"svelte": "^5.53.
|
|
52
|
+
"@sveltejs/kit": "^2.53.0",
|
|
53
|
+
"svelte": "^5.53.2"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
52
56
|
"@inlang/paraglide-js": "^2.12.0",
|
|
@@ -57,11 +61,11 @@
|
|
|
57
61
|
"@tailwindcss/typography": "^0.5.19",
|
|
58
62
|
"@tailwindcss/vite": "^4.2.0",
|
|
59
63
|
"@types/node": "^25.3.0",
|
|
60
|
-
"daisyui": "^5.5.
|
|
64
|
+
"daisyui": "^5.5.19",
|
|
61
65
|
"esm-env": "^1.2.2",
|
|
62
66
|
"hotkeys-js": "^4.0.0",
|
|
63
67
|
"publint": "^0.3.17",
|
|
64
|
-
"svelte-check": "^4.4.
|
|
68
|
+
"svelte-check": "^4.4.3",
|
|
65
69
|
"tailwindcss": "^4.2.0",
|
|
66
70
|
"typescript": "^5.9.3",
|
|
67
71
|
"vite": "^7.3.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|