@ibgib/space-gib 0.0.34 → 0.0.35

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.
Files changed (45) hide show
  1. package/dist/client/bootstrap.mjs +1 -1
  2. package/dist/client/{chunk-25PXC4HP.mjs → chunk-FIAGRVBY.mjs} +1487 -468
  3. package/dist/client/chunk-XLQ3UCQY.mjs +53 -0
  4. package/dist/client/css/activity-bar.css +21 -3
  5. package/dist/client/css/layout.css +126 -5
  6. package/dist/client/index.html +6 -0
  7. package/dist/client/index.mjs +22 -45
  8. package/dist/client/privacy.html +22 -22
  9. package/dist/client/script.mjs +1 -1
  10. package/dist/server/server.mjs +3 -3
  11. package/package.json +6 -6
  12. package/src/client/AUTO-GENERATED-version.mts +1 -1
  13. package/src/client/cosmos/seed-cosmos-workspace.mts +20 -6
  14. package/src/client/css/activity-bar.css +21 -3
  15. package/src/client/css/layout.css +126 -5
  16. package/src/client/dev-tools/vcs-workspace.mts +4 -4
  17. package/src/client/index.html +6 -0
  18. package/src/client/privacy.html +22 -22
  19. package/src/client/ui/component/changes/changes.css +413 -0
  20. package/src/client/ui/component/changes/changes.html +37 -0
  21. package/src/client/ui/component/changes/changes.mts +766 -0
  22. package/src/client/ui/component/changes/index.mts +9 -0
  23. package/src/client/ui/component/chat-view/chat-view.html +6 -58
  24. package/src/client/ui/component/chat-view/chat-view.mts +13 -26
  25. package/src/client/ui/component/clone/clone.mts +67 -39
  26. package/src/client/ui/component/code-editor/code-editor.css +91 -9
  27. package/src/client/ui/component/code-editor/code-editor.html +58 -45
  28. package/src/client/ui/component/code-editor/code-editor.mts +265 -49
  29. package/src/client/ui/component/cosmos-navigator/cosmos-navigator.css +1 -1
  30. package/src/client/ui/component/cosmos-navigator/cosmos-navigator.html +5 -10
  31. package/src/client/ui/component/cosmos-navigator/cosmos-navigator.mts +297 -64
  32. package/src/client/ui/component/file-explorer/file-explorer.css +475 -11
  33. package/src/client/ui/component/file-explorer/file-explorer.html +45 -65
  34. package/src/client/ui/component/file-explorer/file-explorer.mts +1164 -98
  35. package/src/client/ui/component/nested-chat/chat/chat.mts +5 -90
  36. package/src/client/ui/component/nested-chat/nested-chat.mts +10 -8
  37. package/src/client/ui/component/timeline/timeline.css +16 -1
  38. package/src/client/ui/component/timeline/timeline.mts +37 -93
  39. package/src/client/ui/router/space-gib-router-helpers.mts +33 -233
  40. package/src/client/ui/router/space-gib-router-helpers.respec.mts +298 -122
  41. package/src/client/ui/router/space-gib-router-service.mts +28 -151
  42. package/src/client/ui/router/space-gib-router-types.mts +32 -76
  43. package/src/client/ui/shell/cosmic-big-bang.mts +12 -3
  44. package/src/client/ui/shell/space-gib-shell-service.mts +687 -119
  45. package/dist/client/chunk-RXWLL2AI.mjs +0 -30
@@ -1,175 +1,52 @@
1
1
  /**
2
2
  * @module client/ui/router/space-gib-router-service
3
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.
4
+ * Singleton HTML5 History API Cosmos router service for space-gib.
5
+ * Extends the Tier 2 IbGibCosmosRouterServiceBase from @ibgib/web-gib.
7
6
  */
8
7
 
9
- import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
8
+ import { IbGibCosmosRouterServiceBase, safeDecode } from '@ibgib/web-gib/dist/ui/router/index.mjs';
10
9
 
11
10
  import {
12
11
  SpaceGibRouteInfo,
13
12
  RouterNavigateOptions,
14
13
  SpaceGibRouteListener,
14
+ AdminReviewRouteInfo,
15
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
16
 
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
- });
17
+ export class SpaceGibRouterService extends IbGibCosmosRouterServiceBase<SpaceGibRouteInfo> {
18
+ protected override lc: string = `[SpaceGibRouterService]`;
50
19
 
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
- }
20
+ protected override parseCustomRoute(pathname: string): SpaceGibRouteInfo | undefined {
21
+ let cleanPath = (pathname || '').trim();
22
+ const qIdx = cleanPath.indexOf('?');
23
+ if (qIdx !== -1) { cleanPath = cleanPath.substring(0, qIdx); }
24
+ const hIdx = cleanPath.indexOf('#');
25
+ if (hIdx !== -1) { cleanPath = cleanPath.substring(0, hIdx); }
80
26
 
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;
27
+ if (cleanPath === '/admin/review') {
28
+ return { kind: 'admin-review' };
133
29
  }
30
+ if (cleanPath.startsWith('/admin/review/')) {
31
+ const tjpGib = safeDecode(cleanPath.slice('/admin/review/'.length)).trim();
32
+ return { kind: 'admin-review', ...(tjpGib ? { tjpGib } : {}) };
33
+ }
34
+ return undefined;
134
35
  }
135
36
 
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;
37
+ protected override formatCustomRoute(route: SpaceGibRouteInfo): string | undefined {
38
+ if (route.kind === 'admin-review') {
39
+ return `/admin/review${route.tjpGib ? `/${encodeURIComponent(route.tjpGib)}` : ''}`;
161
40
  }
41
+ return undefined;
162
42
  }
163
43
 
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
- }
44
+ protected override isSameCustomRoute(a?: SpaceGibRouteInfo, b?: SpaceGibRouteInfo): boolean | undefined {
45
+ if (a?.kind === 'admin-review' || b?.kind === 'admin-review') {
46
+ if (a?.kind !== b?.kind) { return false; }
47
+ return (a as AdminReviewRouteInfo).tjpGib === (b as AdminReviewRouteInfo).tjpGib;
172
48
  }
49
+ return undefined;
173
50
  }
174
51
  }
175
52
 
@@ -1,73 +1,37 @@
1
1
  /**
2
2
  * @module client/ui/router/space-gib-router-types
3
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]
4
+ * Types for the Space-Gib Client Router.
5
+ * Re-exports universal Cosmos & Galaxy route types from @ibgib/web-gib,
6
+ * and adds space-gib specific routes (e.g. AdminReviewRouteInfo).
16
7
  */
17
8
 
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
- }
9
+ import {
10
+ CosmosRouteInfo as WebGibCosmosRouteInfo,
11
+ CosmosTenant,
12
+ PolycosmosRouteInfo,
13
+ CosmosOnlyRouteInfo,
14
+ CosmosGalaxyRouteInfo,
15
+ CosmosRawAddrRouteInfo,
16
+ CosmosRawTjpRouteInfo,
17
+ RouterNavigateOptions,
18
+ RouteListener,
19
+ } from '@ibgib/web-gib/dist/ui/router/index.mjs';
20
+
21
+ export {
22
+ RouterNavigateOptions,
23
+ RouteListener,
24
+ PolycosmosRouteInfo,
25
+ CosmosGalaxyRouteInfo,
26
+ CosmosRawAddrRouteInfo,
27
+ CosmosRawTjpRouteInfo,
28
+ };
29
+
30
+ export type SpaceGibTenant = CosmosTenant;
31
+ export type CosmosRouteInfo = CosmosOnlyRouteInfo;
32
+ export type GalaxyRouteInfo = CosmosGalaxyRouteInfo;
33
+ export type RawAddrRouteInfo = CosmosRawAddrRouteInfo;
34
+ export type RawTjpRouteInfo = CosmosRawTjpRouteInfo;
71
35
 
72
36
  export interface AdminReviewRouteInfo {
73
37
  kind: 'admin-review';
@@ -75,19 +39,11 @@ export interface AdminReviewRouteInfo {
75
39
  }
76
40
 
77
41
  export type SpaceGibRouteInfo =
78
- | PolycosmosRouteInfo
79
42
  | CosmosRouteInfo
80
- | CodeGalaxyRouteInfo
81
- | NotesGalaxyRouteInfo
43
+ | GalaxyRouteInfo
44
+ | PolycosmosRouteInfo
82
45
  | RawAddrRouteInfo
83
46
  | RawTjpRouteInfo
84
47
  | AdminReviewRouteInfo;
85
48
 
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;
49
+ export type SpaceGibRouteListener = RouteListener<SpaceGibRouteInfo>;
@@ -622,12 +622,18 @@ export class CosmicBigBangController {
622
622
  if (leftCosmos) { leftCosmos.style.display = 'none'; }
623
623
 
624
624
  if (space.type === 'code') {
625
- if (leftCode) { leftCode.style.display = 'block'; }
625
+ if (leftCode) {
626
+ leftCode.style.display = 'flex';
627
+ leftCode.style.flexDirection = 'column';
628
+ }
626
629
  if (leftText) { leftText.style.display = 'none'; }
627
630
  const titleEl = document.getElementById('left-code-space-title');
628
631
  if (titleEl) { titleEl.textContent = space.name; }
629
632
  } else {
630
- if (leftText) { leftText.style.display = 'block'; }
633
+ if (leftText) {
634
+ leftText.style.display = 'flex';
635
+ leftText.style.flexDirection = 'column';
636
+ }
631
637
  if (leftCode) { leftCode.style.display = 'none'; }
632
638
  const titleEl = document.getElementById('left-text-space-title');
633
639
  if (titleEl) { titleEl.textContent = space.name; }
@@ -673,7 +679,10 @@ export class CosmicBigBangController {
673
679
  const leftCode = document.getElementById('left-panel-code-view');
674
680
  const leftText = document.getElementById('left-panel-text-view');
675
681
 
676
- if (leftCosmos) { leftCosmos.style.display = 'block'; }
682
+ if (leftCosmos) {
683
+ leftCosmos.style.display = 'flex';
684
+ leftCosmos.style.flexDirection = 'column';
685
+ }
677
686
  if (leftCode) { leftCode.style.display = 'none'; }
678
687
  if (leftText) { leftText.style.display = 'none'; }
679
688