@dsh-stack/profile-ui 0.0.0-stage → 0.1.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/lib/index.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export declare const name = "stack-profiles";
2
+ export declare const version = "0.1.0";
3
+ /**
4
+ * Host loader entry for the browser-only profile UI plugin: mounting it puts
5
+ * the package on the loader's entry list so the client-modules scanner picks
6
+ * up its `dsh.client` bundle.
7
+ */
8
+ export declare function apply(): void;
9
+ export declare const profileOptions: readonly [{
10
+ readonly id: "default";
11
+ readonly label: "Default";
12
+ }, {
13
+ readonly id: "coding";
14
+ readonly label: "Coding";
15
+ }, {
16
+ readonly id: "trading";
17
+ readonly label: "Trading";
18
+ }, {
19
+ readonly id: "skyblock";
20
+ readonly label: "SkyBlock";
21
+ }];
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ export const name = "stack-profiles";
2
+ export const version = "0.1.0";
3
+ /**
4
+ * Host loader entry for the browser-only profile UI plugin: mounting it puts
5
+ * the package on the loader's entry list so the client-modules scanner picks
6
+ * up its `dsh.client` bundle.
7
+ */
8
+ export function apply() { }
9
+ export const profileOptions = [
10
+ { id: "default", label: "Default" },
11
+ { id: "coding", label: "Coding" },
12
+ { id: "trading", label: "Trading" },
13
+ { id: "skyblock", label: "SkyBlock" },
14
+ ];
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@dsh-stack/profile-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./lib/index.d.ts",
10
+ "default": "./lib/index.js"
11
+ },
12
+ "./client": {
13
+ "types": "./lib/client/index.d.ts",
14
+ "default": "./lib/client.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "dsh": {
19
+ "client": {
20
+ "inject": [
21
+ "@deepseek-ai/dsh-client-ui-slots",
22
+ "@deepseek-ai/dsh-client-ui-renderer",
23
+ "@deepseek-ai/dsh-client-ui-sidebar",
24
+ "@deepseek-ai/dsh-client-ui-settings",
25
+ "@deepseek-ai/dsh-client-locale",
26
+ "@deepseek-ai/dsh-client-ui-primitives"
27
+ ],
28
+ "platform": "web"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "build": "tsc -p tsconfig.json && tsdown",
33
+ "typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
34
+ },
35
+ "dependencies": {
36
+ "@dsh-stack/lucide-animated": "0.1.1",
37
+ "@dsh-stack/profile-runtime": "0.1.1",
38
+ "@dsh-stack/settings-panel": "0.1.1"
39
+ },
40
+ "peerDependencies": {
41
+ "@deepseek-ai/cordis": "^4.0.1",
42
+ "@deepseek-ai/dsh-client-locale": "0.2.0-rc.2",
43
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
44
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
45
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
46
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.0-rc.2",
47
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
48
+ "react": "^18.2.0"
49
+ },
50
+ "devDependencies": {
51
+ "@deepseek-ai/cordis": "^4.0.1",
52
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
53
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
54
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
55
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.0-rc.2",
56
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
57
+ "@types/react": "~18.3.1",
58
+ "react": "^18.3.1",
59
+ "typescript": "^6.0.3"
60
+ },
61
+ "stack": {
62
+ "kind": "plugin",
63
+ "id": "stack.ui.profile"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "repository": {
69
+ "type": "git",
70
+ "url": "https://github.com/marius-patrik/dsh-stack.git",
71
+ "directory": "plugins/profile-ui"
72
+ }
73
+ }
@@ -0,0 +1,130 @@
1
+ import { useState } from "react";
2
+ import { Menu } from "@deepseek-ai/dsh-client-ui-primitives";
3
+ import type { Context as ClientContext } from "@deepseek-ai/cordis";
4
+ import type { SettingsSectionOwnerProps } from "@deepseek-ai/dsh-client-ui-settings/client";
5
+ import type { SidebarFooterActionOwnerProps } from "@deepseek-ai/dsh-client-ui-sidebar/client";
6
+ import type {} from "@deepseek-ai/dsh-client-ui-settings/client";
7
+ // Type-only: pulls the SlotRegistry service merge (ctx.slots).
8
+ import type {} from "@deepseek-ai/dsh-client-ui-renderer/client";
9
+ import type {} from "@deepseek-ai/dsh-client-ui-sidebar/client";
10
+ import {
11
+ SETTINGS_SECTION_ICON_SLOT,
12
+ SettingsSection,
13
+ SettingsOptionRow,
14
+ } from "@dsh-stack/settings-panel";
15
+ import { CheckIcon, LayersIcon, SettingsIcon } from "@dsh-stack/lucide-animated/client";
16
+ import { createProfileRuntime } from "@dsh-stack/profile-runtime";
17
+ import { profileOptions } from "../index.js";
18
+
19
+ const runtime = createProfileRuntime(profileOptions, { reload: () => window.location.reload() });
20
+ export const inject = ["slots"];
21
+
22
+ /** Render the compact or expanded profile selector in the sidebar footer. */
23
+ function ProfileSelector({ wide }: SidebarFooterActionOwnerProps) {
24
+ const [open, setOpen] = useState(false);
25
+ const active = runtime.getActive();
26
+ const activeOption = profileOptions.find((option) => option.id === active) ?? profileOptions[0]!;
27
+ return (
28
+ <Menu
29
+ open={open}
30
+ onClose={() => setOpen(false)}
31
+ items={profileOptions.map((option) => ({ id: option.id, label: option.label }))}
32
+ selectedIds={[activeOption.id]}
33
+ onSelect={(id) => {
34
+ setOpen(false);
35
+ runtime.setActive(id);
36
+ }}
37
+ align="start"
38
+ dense
39
+ portal
40
+ anchor={
41
+ <button
42
+ type="button"
43
+ aria-label="Switch profile"
44
+ aria-haspopup="menu"
45
+ aria-expanded={open}
46
+ onClick={() => setOpen((value) => !value)}
47
+ title={activeOption.label}
48
+ style={{
49
+ width: "100%",
50
+ minHeight: 34,
51
+ display: "flex",
52
+ alignItems: "center",
53
+ gap: 8,
54
+ padding: wide ? "0 10px" : 0,
55
+ justifyContent: wide ? "flex-start" : "center",
56
+ border: 0,
57
+ borderRadius: 8,
58
+ background: "transparent",
59
+ color: "inherit",
60
+ cursor: "pointer",
61
+ font: "inherit",
62
+ }}
63
+ >
64
+ <SettingsIcon aria-hidden="true" size={18} />
65
+ {wide ? (
66
+ <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
67
+ {activeOption.label}
68
+ </span>
69
+ ) : null}
70
+ </button>
71
+ }
72
+ />
73
+ );
74
+ }
75
+
76
+ /** Render the profile selection section inside the settings surface. */
77
+ function ProfileSettings({ close }: SettingsSectionOwnerProps) {
78
+ const [active, setActive] = useState(runtime.getActive());
79
+ return (
80
+ <SettingsSection
81
+ label="Profiles"
82
+ title="Profiles"
83
+ description="Switch the active Stack composition. The new profile is applied after the interface reloads."
84
+ onClose={close}
85
+ >
86
+ {profileOptions.map((option) => (
87
+ <SettingsOptionRow
88
+ key={option.id}
89
+ label={option.label}
90
+ selected={option.id === active}
91
+ onSelect={() => {
92
+ setActive(option.id);
93
+ runtime.setActive(option.id);
94
+ }}
95
+ selectedMark={<CheckIcon aria-hidden="true" size={18} />}
96
+ />
97
+ ))}
98
+ </SettingsSection>
99
+ );
100
+ }
101
+
102
+ /** Renders the Profiles section's nav glyph from the canonical animated icon set. */
103
+ function ProfileSettingsIcon() {
104
+ return <LayersIcon aria-hidden="true" size={16} />;
105
+ }
106
+
107
+ /** Mount the profile selector and settings section into the client slot registry. */
108
+ export function apply(ctx: ClientContext): void {
109
+ ctx.slots.inject("sidebar.footer.action", () =>
110
+ ctx.slots.register({ name: "sidebar.footer.action", id: "profiles" }, ProfileSelector),
111
+ );
112
+ ctx.slots.inject("settings.section", () =>
113
+ ctx.slots.register(
114
+ {
115
+ name: "settings.section",
116
+ id: "profiles",
117
+ order: 40,
118
+ label: "Profiles",
119
+ inject: () => ({}),
120
+ },
121
+ ProfileSettings,
122
+ ),
123
+ );
124
+ ctx.slots.inject(SETTINGS_SECTION_ICON_SLOT, () =>
125
+ ctx.slots.register(
126
+ { name: SETTINGS_SECTION_ICON_SLOT, id: "profiles", order: 0 },
127
+ ProfileSettingsIcon,
128
+ ),
129
+ );
130
+ }
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ export const name = "stack-profiles";
2
+ export const version = "0.1.0";
3
+
4
+ /**
5
+ * Host loader entry for the browser-only profile UI plugin: mounting it puts
6
+ * the package on the loader's entry list so the client-modules scanner picks
7
+ * up its `dsh.client` bundle.
8
+ */
9
+ export function apply(): void {}
10
+
11
+ export const profileOptions = [
12
+ { id: "default", label: "Default" },
13
+ { id: "coding", label: "Coding" },
14
+ { id: "trading", label: "Trading" },
15
+ { id: "skyblock", label: "SkyBlock" },
16
+ ] as const;
package/src/types.d.ts ADDED
@@ -0,0 +1 @@
1
+ declare module "katex/dist/katex.min.css";
package/stack.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "stack.ui.profile",
3
+ "name": "@dsh-stack/profile-ui",
4
+ "version": "0.1.1",
5
+ "kind": "plugin",
6
+ "description": "@dsh-stack/profile-ui",
7
+ "files": ["lib", "README.md", "package.json", "stack.json"],
8
+ "dependencies": [],
9
+ "optionalDependencies": []
10
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "lib": ["ES2023", "DOM"],
5
+ "jsx": "react-jsx",
6
+ "outDir": "lib",
7
+ "rootDir": "src"
8
+ },
9
+ "include": ["src"]
10
+ }