@lukstei/dsh-client-kanban 0.0.0-stage → 0.2.2-rc.5.3
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/LICENSE +21 -0
- package/README.md +181 -2
- package/cordis.patch.yml +3 -0
- package/dist/client.js +4088 -0
- package/dist/index.js +461 -0
- package/package.json +135 -3
- package/src/client/InFlightSidebar.tsx +606 -0
- package/src/client/KanbanCard.tsx +195 -0
- package/src/client/KanbanIcon.tsx +25 -0
- package/src/client/KanbanPane.tsx +576 -0
- package/src/client/KanbanPaneStatus.tsx +46 -0
- package/src/client/KanbanSection.tsx +177 -0
- package/src/client/KanbanStatusDot.tsx +14 -0
- package/src/client/KanbanTransitionDropdown.tsx +281 -0
- package/src/client/SessionLinks.tsx +72 -0
- package/src/client/dsh.d.ts +30 -0
- package/src/client/index.tsx +602 -0
- package/src/client/navigation.ts +93 -0
- package/src/client/sidebar-mode.ts +71 -0
- package/src/client/store.ts +809 -0
- package/src/client/styles.ts +1539 -0
- package/src/client/use-kanban.ts +52 -0
- package/src/fold.ts +213 -0
- package/src/index.ts +193 -0
- package/src/search-host.ts +77 -0
- package/src/search.ts +72 -0
- package/src/types.ts +80 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Reactive store managing sidebar view mode between native Workspaces and In-Flight Kanban. */
|
|
2
|
+
|
|
3
|
+
export type SidebarViewMode = "workspaces" | "kanban";
|
|
4
|
+
|
|
5
|
+
const STORAGE_KEY = "dsh-sidebar-view-mode";
|
|
6
|
+
|
|
7
|
+
export class SidebarModeStore {
|
|
8
|
+
private mode: SidebarViewMode;
|
|
9
|
+
private readonly listeners = new Set<() => void>();
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
try {
|
|
13
|
+
const stored =
|
|
14
|
+
typeof localStorage !== "undefined"
|
|
15
|
+
? localStorage.getItem(STORAGE_KEY)
|
|
16
|
+
: null;
|
|
17
|
+
this.mode = stored === "kanban" ? "kanban" : "workspaces";
|
|
18
|
+
} catch {
|
|
19
|
+
this.mode = "workspaces";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Purpose: Read current sidebar view mode snapshot.
|
|
25
|
+
* Contract:
|
|
26
|
+
* - Inputs: None.
|
|
27
|
+
* - Outputs: Current SidebarViewMode ('workspaces' or 'kanban').
|
|
28
|
+
* - Throws / Errors: Never throws.
|
|
29
|
+
*/
|
|
30
|
+
getSnapshot = (): SidebarViewMode => {
|
|
31
|
+
return this.mode;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Purpose: Switch sidebar view mode and notify subscribers.
|
|
36
|
+
* Contract:
|
|
37
|
+
* - Inputs: New SidebarViewMode.
|
|
38
|
+
* - Outputs: void.
|
|
39
|
+
* - Throws / Errors: Never throws.
|
|
40
|
+
*/
|
|
41
|
+
setMode = (nextMode: SidebarViewMode): void => {
|
|
42
|
+
if (this.mode === nextMode) return;
|
|
43
|
+
this.mode = nextMode;
|
|
44
|
+
try {
|
|
45
|
+
if (typeof localStorage !== "undefined") {
|
|
46
|
+
localStorage.setItem(STORAGE_KEY, nextMode);
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
// ignore storage errors
|
|
50
|
+
}
|
|
51
|
+
for (const listener of this.listeners) {
|
|
52
|
+
listener();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Purpose: Subscribe to sidebar view mode changes.
|
|
58
|
+
* Contract:
|
|
59
|
+
* - Inputs: Callback listener function.
|
|
60
|
+
* - Outputs: Unsubscribe function.
|
|
61
|
+
* - Throws / Errors: Never throws.
|
|
62
|
+
*/
|
|
63
|
+
subscribe = (listener: () => void): (() => void) => {
|
|
64
|
+
this.listeners.add(listener);
|
|
65
|
+
return () => {
|
|
66
|
+
this.listeners.delete(listener);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const sidebarModeStore = new SidebarModeStore();
|