@ibgib/space-gib 0.0.32 → 0.0.34
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/dist/client/bootstrap.mjs +24 -51
- package/dist/client/chunk-25PXC4HP.mjs +9914 -0
- package/dist/client/chunk-RXWLL2AI.mjs +30 -0
- package/dist/client/css/activity-bar.css +417 -0
- package/dist/client/css/base.css +167 -0
- package/dist/client/css/components.css +218 -0
- package/dist/client/css/cosmic.css +557 -0
- package/dist/client/css/dev-tools.css +163 -0
- package/dist/client/css/landing.css +184 -0
- package/dist/client/css/layout.css +896 -0
- package/dist/client/css/onboarding.css +181 -0
- package/dist/client/css/repos.css +740 -0
- package/dist/client/css/variables.css +64 -0
- package/dist/client/index.html +202 -31
- package/dist/client/index.mjs +31 -31
- package/dist/client/script.mjs +1 -1
- package/dist/client/style.css +11 -1056
- package/dist/respec-gib.node.mjs +5 -0
- package/dist/server/server.mjs +6879 -3109
- package/package.json +6 -6
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/cosmos/seed-cosmos-workspace.mts +69 -0
- package/src/client/css/activity-bar.css +417 -0
- package/src/client/css/base.css +167 -0
- package/src/client/css/components.css +218 -0
- package/src/client/css/cosmic.css +557 -0
- package/src/client/css/dev-tools.css +163 -0
- package/src/client/css/landing.css +184 -0
- package/src/client/css/layout.css +896 -0
- package/src/client/css/onboarding.css +181 -0
- package/src/client/css/repos.css +740 -0
- package/src/client/css/variables.css +64 -0
- package/src/client/dev-tools/vcs-workspace.mts +3 -3
- package/src/client/index.html +202 -31
- package/src/client/style.css +11 -1056
- package/src/client/ui/component/chat-view/IMPLEMENTATION.md +48 -0
- package/src/client/ui/component/chat-view/chat-view.css +381 -0
- package/src/client/ui/component/chat-view/chat-view.html +104 -0
- package/src/client/ui/component/chat-view/chat-view.mts +277 -0
- package/src/client/ui/component/chat-view/index.mts +9 -0
- package/src/client/ui/component/clone/IMPLEMENTATION.md +68 -0
- package/src/client/ui/component/clone/clone-constants.mts +16 -0
- package/src/client/ui/component/clone/clone-types.mts +60 -0
- package/src/client/ui/component/clone/clone.css +383 -0
- package/src/client/ui/component/clone/clone.html +89 -0
- package/src/client/ui/component/clone/clone.mts +620 -0
- package/src/client/ui/component/clone/index.mts +11 -0
- package/src/client/ui/component/code-editor/IMPLEMENTATION.md +89 -0
- package/src/client/ui/component/code-editor/code-editor.css +275 -0
- package/src/client/ui/component/code-editor/code-editor.html +54 -0
- package/src/client/ui/component/code-editor/code-editor.mts +427 -0
- package/src/client/ui/component/code-editor/index.mts +9 -0
- package/src/client/ui/component/cosmos-navigator/IMPLEMENTATION.md +31 -0
- package/src/client/ui/component/cosmos-navigator/cosmos-navigator.css +864 -0
- package/src/client/ui/component/cosmos-navigator/cosmos-navigator.html +97 -0
- package/src/client/ui/component/cosmos-navigator/cosmos-navigator.mts +1084 -0
- package/src/client/ui/component/cosmos-navigator/index.mts +18 -0
- package/src/client/ui/component/file-explorer/IMPLEMENTATION.md +42 -0
- package/src/client/ui/component/file-explorer/file-explorer.css +256 -0
- package/src/client/ui/component/file-explorer/file-explorer.html +75 -0
- package/src/client/ui/component/file-explorer/file-explorer.mts +346 -0
- package/src/client/ui/component/file-explorer/index.mts +9 -0
- package/src/client/ui/component/nested-chat/IMPLEMENTATION.md +18 -0
- package/src/client/ui/component/nested-chat/chat/IMPLEMENTATION.md +14 -0
- package/src/client/ui/component/nested-chat/chat/chat-constants.mts +14 -0
- package/src/client/ui/component/nested-chat/chat/chat-helpers.mts +66 -0
- package/src/client/ui/component/nested-chat/chat/chat.css +654 -0
- package/src/client/ui/component/nested-chat/chat/chat.html +90 -0
- package/src/client/ui/component/nested-chat/chat/chat.mts +646 -0
- package/src/client/ui/component/nested-chat/chat/index.mts +7 -0
- package/src/client/ui/component/nested-chat/index.mts +14 -0
- package/src/client/ui/component/nested-chat/nested-chat-constants.mts +12 -0
- package/src/client/ui/component/nested-chat/nested-chat-types.mts +53 -0
- package/src/client/ui/component/nested-chat/nested-chat.css +142 -0
- package/src/client/ui/component/nested-chat/nested-chat.html +11 -0
- package/src/client/ui/component/nested-chat/nested-chat.mts +393 -0
- package/src/client/ui/component/notes-explorer/index.mts +9 -0
- package/src/client/ui/component/notes-explorer/notes-explorer.css +313 -0
- package/src/client/ui/component/notes-explorer/notes-explorer.html +136 -0
- package/src/client/ui/component/notes-explorer/notes-explorer.mts +240 -0
- package/src/client/ui/component/notes-inspector/index.mts +9 -0
- package/src/client/ui/component/notes-inspector/notes-inspector.css +244 -0
- package/src/client/ui/component/notes-inspector/notes-inspector.html +97 -0
- package/src/client/ui/component/notes-inspector/notes-inspector.mts +152 -0
- package/src/client/ui/component/pitch/IMPLEMENTATION.md +48 -0
- package/src/client/ui/component/pitch/index.mts +9 -0
- package/src/client/ui/component/pitch/pitch.css +295 -0
- package/src/client/ui/component/pitch/pitch.html +97 -0
- package/src/client/ui/component/pitch/pitch.mts +135 -0
- package/src/client/ui/component/timeline/IMPLEMENTATION.md +33 -0
- package/src/client/ui/component/timeline/index.mts +9 -0
- package/src/client/ui/component/timeline/timeline.css +264 -0
- package/src/client/ui/component/timeline/timeline.html +23 -0
- package/src/client/ui/component/timeline/timeline.mts +317 -0
- package/src/client/ui/component/timeline-item-details/IMPLEMENTATION.md +28 -0
- package/src/client/ui/component/timeline-item-details/index.mts +9 -0
- package/src/client/ui/component/timeline-item-details/timeline-item-details.css +286 -0
- package/src/client/ui/component/timeline-item-details/timeline-item-details.html +64 -0
- package/src/client/ui/component/timeline-item-details/timeline-item-details.mts +194 -0
- package/src/client/ui/router/index.mts +3 -0
- package/src/client/ui/router/space-gib-router-helpers.mts +272 -0
- package/src/client/ui/router/space-gib-router-helpers.respec.mts +353 -0
- package/src/client/ui/router/space-gib-router-service.mts +186 -0
- package/src/client/ui/router/space-gib-router-types.mts +93 -0
- package/src/client/ui/shell/cosmic-big-bang.mts +844 -0
- package/src/client/ui/shell/space-gib-shell-constants.mts +7 -0
- package/src/client/ui/shell/space-gib-shell-service.mts +1728 -31
- package/src/server/server.mts +20 -1
- package/tsconfig.test.json +5 -1
- package/dist/client/chunk-AX6BROMT.mjs +0 -1
- package/dist/client/chunk-CIQUGV7U.mjs +0 -25
- package/dist/client/chunk-YPCHYDKL.mjs +0 -3102
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module client/ui/router/space-gib-router-service
|
|
3
|
+
*
|
|
4
|
+
* Singleton HTML5 History API router service for space-gib.
|
|
5
|
+
* Manages URL updates (pushState/replaceState), browser back/forward (popstate),
|
|
6
|
+
* internal link click interception, and route change notification.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
SpaceGibRouteInfo,
|
|
13
|
+
RouterNavigateOptions,
|
|
14
|
+
SpaceGibRouteListener,
|
|
15
|
+
} from './space-gib-router-types.mjs';
|
|
16
|
+
import {
|
|
17
|
+
parseSpaceGibRoute,
|
|
18
|
+
formatSpaceGibRoute,
|
|
19
|
+
isSameRoute,
|
|
20
|
+
} from './space-gib-router-helpers.mjs';
|
|
21
|
+
|
|
22
|
+
export class SpaceGibRouterService {
|
|
23
|
+
private lc: string = `[SpaceGibRouterService]`;
|
|
24
|
+
private currentRoute?: SpaceGibRouteInfo;
|
|
25
|
+
private listeners: SpaceGibRouteListener[] = [];
|
|
26
|
+
private isNavigating: boolean = false;
|
|
27
|
+
|
|
28
|
+
constructor() {
|
|
29
|
+
if (typeof window !== 'undefined') {
|
|
30
|
+
this.initBrowserListeners();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private initBrowserListeners(): void {
|
|
35
|
+
const lc = `${this.lc}[${this.initBrowserListeners.name}]`;
|
|
36
|
+
|
|
37
|
+
// 1. Popstate listener (browser back / forward buttons)
|
|
38
|
+
window.addEventListener('popstate', async () => {
|
|
39
|
+
try {
|
|
40
|
+
const newRoute = parseSpaceGibRoute(window.location.pathname);
|
|
41
|
+
if (isSameRoute(this.currentRoute, newRoute)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.currentRoute = newRoute;
|
|
45
|
+
await this.notifyListeners(newRoute);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error(`${lc} Popstate routing error: ${extractErrorMsg(err)}`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// 2. Intercept internal anchor link clicks for seamless SPA navigation
|
|
52
|
+
document.addEventListener('click', (e: MouseEvent) => {
|
|
53
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const target = e.target as HTMLElement | null;
|
|
58
|
+
const anchor = target?.closest('a') as HTMLAnchorElement | null;
|
|
59
|
+
if (!anchor) { return; }
|
|
60
|
+
|
|
61
|
+
const href = anchor.getAttribute('href');
|
|
62
|
+
if (!href || href.startsWith('#') || href.startsWith('javascript:') || href.startsWith('mailto:')) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Exclude external links and target="_blank"
|
|
67
|
+
if (anchor.target && anchor.target !== '_self') { return; }
|
|
68
|
+
if (anchor.origin && anchor.origin !== window.location.origin) { return; }
|
|
69
|
+
|
|
70
|
+
// Exclude API and asset routes
|
|
71
|
+
if (href.startsWith('/api/') || href.startsWith('/assets/') || href.startsWith('/css/')) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Intercept internal routing
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
this.navigatePath(href);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Subscribes a listener to route change events.
|
|
83
|
+
* Returns an unsubscribe function.
|
|
84
|
+
*/
|
|
85
|
+
public subscribe(listener: SpaceGibRouteListener): () => void {
|
|
86
|
+
this.listeners.push(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
const idx = this.listeners.indexOf(listener);
|
|
89
|
+
if (idx !== -1) {
|
|
90
|
+
this.listeners.splice(idx, 1);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns the current active route info, if any.
|
|
97
|
+
*/
|
|
98
|
+
public getCurrentRoute(): SpaceGibRouteInfo | undefined {
|
|
99
|
+
return this.currentRoute;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Navigates to a given SpaceGibRouteInfo.
|
|
104
|
+
*/
|
|
105
|
+
public async navigate(route: SpaceGibRouteInfo, opts?: RouterNavigateOptions): Promise<void> {
|
|
106
|
+
const lc = `${this.lc}[${this.navigate.name}]`;
|
|
107
|
+
if (this.isNavigating) { return; }
|
|
108
|
+
this.isNavigating = true;
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const targetPath = formatSpaceGibRoute(route);
|
|
112
|
+
|
|
113
|
+
if (typeof window !== 'undefined') {
|
|
114
|
+
if (window.location.pathname !== targetPath) {
|
|
115
|
+
if (opts?.replace) {
|
|
116
|
+
window.history.replaceState(null, '', targetPath);
|
|
117
|
+
} else {
|
|
118
|
+
window.history.pushState(null, '', targetPath);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const wasSame = isSameRoute(this.currentRoute, route);
|
|
124
|
+
this.currentRoute = route;
|
|
125
|
+
|
|
126
|
+
if (!opts?.silent && !wasSame) {
|
|
127
|
+
await this.notifyListeners(route);
|
|
128
|
+
}
|
|
129
|
+
} catch (err) {
|
|
130
|
+
console.error(`${lc} Navigation error: ${extractErrorMsg(err)}`);
|
|
131
|
+
} finally {
|
|
132
|
+
this.isNavigating = false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Navigates to a raw pathname string by parsing it into a SpaceGibRouteInfo.
|
|
138
|
+
*/
|
|
139
|
+
public async navigatePath(pathname: string, opts?: RouterNavigateOptions): Promise<void> {
|
|
140
|
+
const route = parseSpaceGibRoute(pathname);
|
|
141
|
+
await this.navigate(route, opts);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Reads current window.location.pathname, parses the route, updates internal state,
|
|
146
|
+
* and notifies all listeners. Call during application bootstrap after Shell is ready.
|
|
147
|
+
*/
|
|
148
|
+
public async loadCurrentURL(): Promise<SpaceGibRouteInfo> {
|
|
149
|
+
const lc = `${this.lc}[${this.loadCurrentURL.name}]`;
|
|
150
|
+
try {
|
|
151
|
+
const pathname = typeof window !== 'undefined' ? window.location.pathname : '/';
|
|
152
|
+
const route = parseSpaceGibRoute(pathname);
|
|
153
|
+
this.currentRoute = route;
|
|
154
|
+
await this.notifyListeners(route);
|
|
155
|
+
return route;
|
|
156
|
+
} catch (err) {
|
|
157
|
+
console.error(`${lc} loadCurrentURL error: ${extractErrorMsg(err)}`);
|
|
158
|
+
const fallback: SpaceGibRouteInfo = { kind: 'polycosmos' };
|
|
159
|
+
this.currentRoute = fallback;
|
|
160
|
+
return fallback;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private async notifyListeners(route: SpaceGibRouteInfo): Promise<void> {
|
|
165
|
+
const lc = `${this.lc}[${this.notifyListeners.name}]`;
|
|
166
|
+
for (const listener of this.listeners) {
|
|
167
|
+
try {
|
|
168
|
+
await listener(route);
|
|
169
|
+
} catch (listenerErr) {
|
|
170
|
+
console.error(`${lc} Listener error: ${extractErrorMsg(listenerErr)}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
let routerSingleton: SpaceGibRouterService | undefined;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Returns the singleton SpaceGibRouterService instance.
|
|
180
|
+
*/
|
|
181
|
+
export function getSpaceGibRouterSvc(): SpaceGibRouterService {
|
|
182
|
+
if (!routerSingleton) {
|
|
183
|
+
routerSingleton = new SpaceGibRouterService();
|
|
184
|
+
}
|
|
185
|
+
return routerSingleton;
|
|
186
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module client/ui/router/space-gib-router-types
|
|
3
|
+
*
|
|
4
|
+
* Types for the Phase 1.5 Space-Gib Client Router.
|
|
5
|
+
* Supports dual routing mechanisms:
|
|
6
|
+
* 1. Space-Qualified Raw Addr (Content-Addressed & Space-Scoped):
|
|
7
|
+
* - Snapshot / Immutable point-in-time: /:cosmos/:spaceId/addr/:ibGibAddr
|
|
8
|
+
* - Living Timeline Tip: /:cosmos/:spaceId/tjp/:tjpAddr
|
|
9
|
+
* 2. Workspace / Galaxy Projections (Human-Readable & Timeline-Aware):
|
|
10
|
+
* - Polycosmos: / or /polycosmos or /@:siteUsername or /keystone/:keystoneTjp
|
|
11
|
+
* - Cosmos: /:cosmos or /@:siteUsername/:cosmos
|
|
12
|
+
* - Code Galaxy: /:cosmos/code/:galaxyId[/:branch[/*filePath]]
|
|
13
|
+
* - Notes Galaxy: /:cosmos/notes/:galaxyId[/:topicTjp]
|
|
14
|
+
* 3. Special Routes:
|
|
15
|
+
* - Admin Review: /admin/review[/:tjpGib]
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type SpaceGibTenant =
|
|
19
|
+
| { type: 'username'; siteUsername: string }
|
|
20
|
+
| { type: 'keystone'; keystoneTjp: string };
|
|
21
|
+
|
|
22
|
+
export interface SpaceGibRouteBase {
|
|
23
|
+
tenant?: SpaceGibTenant;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PolycosmosRouteInfo extends SpaceGibRouteBase {
|
|
27
|
+
kind: 'polycosmos';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CosmosRouteInfo extends SpaceGibRouteBase {
|
|
31
|
+
kind: 'cosmos';
|
|
32
|
+
cosmos: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface CodeGalaxyRouteInfo extends SpaceGibRouteBase {
|
|
36
|
+
kind: 'code-galaxy';
|
|
37
|
+
cosmos: string;
|
|
38
|
+
galaxyId: string;
|
|
39
|
+
branch?: string;
|
|
40
|
+
filePath?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface NotesGalaxyRouteInfo extends SpaceGibRouteBase {
|
|
44
|
+
kind: 'notes-galaxy';
|
|
45
|
+
cosmos: string;
|
|
46
|
+
galaxyId: string;
|
|
47
|
+
trailMode?: 'tjp' | 'addr';
|
|
48
|
+
trail?: string[];
|
|
49
|
+
topicTjp?: string;
|
|
50
|
+
query?: {
|
|
51
|
+
inspect?: string;
|
|
52
|
+
lens?: string;
|
|
53
|
+
tag?: string;
|
|
54
|
+
[key: string]: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface RawAddrRouteInfo extends SpaceGibRouteBase {
|
|
59
|
+
kind: 'raw-addr';
|
|
60
|
+
cosmos: string;
|
|
61
|
+
spaceId: string;
|
|
62
|
+
ibGibAddr: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface RawTjpRouteInfo extends SpaceGibRouteBase {
|
|
66
|
+
kind: 'raw-tjp';
|
|
67
|
+
cosmos: string;
|
|
68
|
+
spaceId: string;
|
|
69
|
+
tjpAddr: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface AdminReviewRouteInfo {
|
|
73
|
+
kind: 'admin-review';
|
|
74
|
+
tjpGib?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type SpaceGibRouteInfo =
|
|
78
|
+
| PolycosmosRouteInfo
|
|
79
|
+
| CosmosRouteInfo
|
|
80
|
+
| CodeGalaxyRouteInfo
|
|
81
|
+
| NotesGalaxyRouteInfo
|
|
82
|
+
| RawAddrRouteInfo
|
|
83
|
+
| RawTjpRouteInfo
|
|
84
|
+
| AdminReviewRouteInfo;
|
|
85
|
+
|
|
86
|
+
export interface RouterNavigateOptions {
|
|
87
|
+
/** If true, uses history.replaceState instead of pushState */
|
|
88
|
+
replace?: boolean;
|
|
89
|
+
/** If true, does not fire route change listeners */
|
|
90
|
+
silent?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type SpaceGibRouteListener = (route: SpaceGibRouteInfo) => Promise<void> | void;
|