@loomcycle/explorer 0.7.0 → 0.9.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.
@@ -0,0 +1 @@
1
+ export declare function copyToClipboard(text: string): Promise<boolean>;
@@ -11,11 +11,20 @@ export interface ChunkPatch {
11
11
  type?: string;
12
12
  tags?: string[];
13
13
  }
14
+ export interface PathLsPage {
15
+ limit?: number;
16
+ cursor?: string;
17
+ }
18
+ export interface PathLsResult {
19
+ path: string;
20
+ entries: PathEntry[];
21
+ truncated?: boolean;
22
+ next_cursor?: string;
23
+ }
14
24
  export interface ExplorerDataLayer {
15
- pathLs(path: string, scope: PathScope, recursive: boolean, browse?: BrowseScope): Promise<{
16
- path: string;
17
- entries: PathEntry[];
18
- }>;
25
+ pathLs(path: string, scope: PathScope, recursive: boolean, browse?: BrowseScope, page?: PathLsPage): Promise<PathLsResult>;
26
+ pathIsStored?(path: string, scope: PathScope, browse?: BrowseScope): Promise<boolean>;
27
+ documentPath?(documentId: string, scope: PathScope, browse?: BrowseScope): Promise<string | undefined>;
19
28
  pathMkdir(path: string, scope: PathScope, browse?: BrowseScope): Promise<unknown>;
20
29
  pathMv(from: string, to: string, scope: PathScope, browse?: BrowseScope): Promise<unknown>;
21
30
  pathRm(path: string, scope: PathScope, recursive: boolean, browse?: BrowseScope): Promise<unknown>;
@@ -0,0 +1,26 @@
1
+ import type { ChunkRow, PathEntry } from "../types";
2
+ import type { DirMap } from "./lazyPathTree";
3
+ export interface DocLocation {
4
+ documentId: string;
5
+ chunkId?: string;
6
+ title?: string;
7
+ path?: string;
8
+ }
9
+ export type Trail = readonly DocLocation[];
10
+ export declare function followReference(trail: Trail, origin: DocLocation, target: DocLocation): Trail;
11
+ export declare function jumpTo(trail: Trail, index: number): Trail;
12
+ export declare function back(trail: Trail): Trail;
13
+ export declare function amendCurrent(trail: Trail, documentId: string, patch: Pick<DocLocation, "title" | "path">): Trail;
14
+ export declare function labelOf(loc: DocLocation): string;
15
+ export type TrailItem = {
16
+ kind: "crumb";
17
+ index: number;
18
+ } | {
19
+ kind: "gap";
20
+ hidden: number[];
21
+ };
22
+ export declare const TRAIL_VISIBLE = 4;
23
+ export declare function collapseTrail(length: number, max?: number): TrailItem[];
24
+ export declare function findDocumentPath(dirs: DirMap, documentId: string): string | undefined;
25
+ export declare function documentIdOf(entry: PathEntry): string | undefined;
26
+ export declare function landingChunk(rows: ChunkRow[], wanted?: string): string | undefined;
@@ -0,0 +1,43 @@
1
+ import type { BrowseScope, PathEntry, PathScope } from "../types";
2
+ import type { ExplorerDataLayer } from "./dataLayer";
3
+ export declare const LS_PAGE_LIMIT = 500;
4
+ export declare const LS_MAX_LIMIT = 5000;
5
+ export interface DirListing {
6
+ entries: PathEntry[];
7
+ nextCursor?: string;
8
+ loaded: boolean;
9
+ loading: boolean;
10
+ error?: string;
11
+ }
12
+ export type DirMap = ReadonlyMap<string, DirListing>;
13
+ export declare function lsTarget(dir: string): string;
14
+ export declare function parentPathOf(fullPath: string): string;
15
+ export declare function ancestorsOf(path: string): string[];
16
+ export declare class LazyPathTree {
17
+ private readonly data;
18
+ private readonly scope;
19
+ private readonly browse?;
20
+ private readonly pageLimit;
21
+ private dirs;
22
+ private snapshot;
23
+ private readonly listeners;
24
+ private readonly inflight;
25
+ private readonly epoch;
26
+ constructor(data: ExplorerDataLayer, scope: PathScope, browse?: BrowseScope | undefined, pageLimit?: number);
27
+ getSnapshot: () => DirMap;
28
+ subscribe: (fn: () => void) => (() => void);
29
+ private publish;
30
+ private set;
31
+ private track;
32
+ loadDir(dir: string): Promise<void>;
33
+ reload(dir: string): Promise<void>;
34
+ private fetchFirst;
35
+ loadMore(dir: string): Promise<void>;
36
+ reveal(path: string): Promise<boolean>;
37
+ invalidate(path: string, opts?: {
38
+ dropSubtree?: boolean;
39
+ }): Promise<void>;
40
+ refresh(keep: Iterable<string>): Promise<void>;
41
+ }
42
+ export declare function listSubtree(data: ExplorerDataLayer, dir: string, scope: PathScope, browse?: BrowseScope): Promise<PathEntry[]>;
43
+ export declare function documentIdsOf(entries: Iterable<PathEntry>): string[];
package/dist/styles.css CHANGED
@@ -427,6 +427,27 @@
427
427
  opacity: 0.7;
428
428
  font-style: italic;
429
429
  }
430
+ /* A directory's trailing status / "load more" row (the tree lists lazily). */
431
+ .loomcycle-explorer .path-status {
432
+ padding: 2px 8px;
433
+ font-size: var(--lc-text-xs);
434
+ }
435
+ .loomcycle-explorer .path-err {
436
+ color: var(--failed);
437
+ }
438
+ .loomcycle-explorer .path-more {
439
+ background: transparent;
440
+ border: 1px dashed var(--border);
441
+ border-radius: 4px;
442
+ color: var(--fg-soft);
443
+ cursor: pointer;
444
+ padding: 2px 8px;
445
+ font: inherit;
446
+ }
447
+ .loomcycle-explorer .path-more:hover:not(:disabled) {
448
+ color: var(--accent);
449
+ border-color: var(--accent);
450
+ }
430
451
 
431
452
  /* Detail (right) pane. */
432
453
  .loomcycle-explorer .paths-detail {
@@ -587,6 +608,67 @@
587
608
  color: white;
588
609
  border-color: var(--accent);
589
610
  }
611
+
612
+ /* Id + copy affordance (IdCopy): the document id in the toolbar, the selected
613
+ chunk id in the content head, and a compact copy on every chunk-tree row.
614
+ Lets an operator grab the exact id for an external workflow (n8n over the
615
+ MCP/HTTP API). */
616
+ .loomcycle-explorer .id-copy {
617
+ display: inline-flex;
618
+ align-items: center;
619
+ gap: 4px;
620
+ min-width: 0;
621
+ }
622
+ .loomcycle-explorer .id-copy-label {
623
+ font-size: var(--lc-text-xs);
624
+ color: var(--fg-muted);
625
+ text-transform: uppercase;
626
+ letter-spacing: 0.03em;
627
+ }
628
+ .loomcycle-explorer .id-copy-value {
629
+ font-family: var(--mono);
630
+ font-size: var(--lc-text-xs);
631
+ color: var(--fg-soft);
632
+ background: var(--bg);
633
+ border: 1px solid var(--border);
634
+ border-radius: 4px;
635
+ padding: 1px 6px;
636
+ max-width: 22ch;
637
+ overflow: hidden;
638
+ text-overflow: ellipsis;
639
+ white-space: nowrap;
640
+ }
641
+ .loomcycle-explorer .id-copy-btn {
642
+ background: transparent;
643
+ border: none;
644
+ color: var(--fg-soft);
645
+ cursor: pointer;
646
+ font-size: 12px;
647
+ line-height: 1;
648
+ padding: 2px 3px;
649
+ border-radius: 4px;
650
+ user-select: none;
651
+ }
652
+ .loomcycle-explorer .id-copy-btn:hover {
653
+ color: var(--accent);
654
+ }
655
+ .loomcycle-explorer .id-copy-btn.id-copy-copied {
656
+ color: var(--accent);
657
+ }
658
+ .loomcycle-explorer .id-copy-btn.id-copy-error {
659
+ color: var(--failed);
660
+ }
661
+ /* On a chunk-tree row the copy sits at the far right and stays faint until the
662
+ row is hovered/selected, so the tree keeps its clean scan-line. */
663
+ .loomcycle-explorer .node .row .id-copy-btn {
664
+ margin-left: auto;
665
+ opacity: 0.4;
666
+ }
667
+ .loomcycle-explorer .node .row:hover .id-copy-btn,
668
+ .loomcycle-explorer .node.selected .row .id-copy-btn,
669
+ .loomcycle-explorer .node .row .id-copy-btn:focus-visible {
670
+ opacity: 1;
671
+ }
590
672
  .loomcycle-explorer .doc-mode-toggle {
591
673
  display: inline-flex;
592
674
  border: 1px solid var(--border);
@@ -1010,6 +1092,116 @@
1010
1092
  color: var(--fg-soft);
1011
1093
  cursor: default;
1012
1094
  }
1095
+ /* A cross-document target is a button once the host can open that document
1096
+ (it keeps the ↗); the muted, inert look is only for a host that cannot. */
1097
+ .loomcycle-explorer button.doc-ref-target.external {
1098
+ color: var(--accent);
1099
+ cursor: pointer;
1100
+ }
1101
+ .loomcycle-explorer .doc-ref-target:focus-visible,
1102
+ .loomcycle-explorer .doc-trail button:focus-visible {
1103
+ outline: 2px solid var(--accent);
1104
+ outline-offset: 2px;
1105
+ border-radius: 2px;
1106
+ }
1107
+ /* The relationship graph's nodes follow the same links as the list. */
1108
+ .loomcycle-explorer .md-mermaid-nav g.node {
1109
+ cursor: pointer;
1110
+ }
1111
+
1112
+ /* ---- document trail: the breadcrumb back through followed references ---- */
1113
+ .loomcycle-explorer .doc-trail {
1114
+ display: flex;
1115
+ align-items: center;
1116
+ gap: 10px;
1117
+ padding: 6px 12px;
1118
+ border-bottom: 1px solid var(--border);
1119
+ font-size: var(--lc-text-sm);
1120
+ min-width: 0;
1121
+ }
1122
+ .loomcycle-explorer .doc-trail-back {
1123
+ flex: none;
1124
+ background: var(--bg);
1125
+ color: var(--fg);
1126
+ border: 1px solid var(--border);
1127
+ border-radius: 4px;
1128
+ padding: 2px 8px;
1129
+ cursor: pointer;
1130
+ }
1131
+ .loomcycle-explorer .doc-trail-back:hover {
1132
+ border-color: var(--accent);
1133
+ }
1134
+ .loomcycle-explorer .doc-trail-list {
1135
+ list-style: none;
1136
+ margin: 0;
1137
+ padding: 0;
1138
+ display: flex;
1139
+ align-items: center;
1140
+ flex: 1;
1141
+ min-width: 0;
1142
+ overflow: hidden;
1143
+ }
1144
+ .loomcycle-explorer .doc-trail-item {
1145
+ display: flex;
1146
+ align-items: center;
1147
+ min-width: 0;
1148
+ }
1149
+ .loomcycle-explorer .doc-trail-item + .doc-trail-item::before {
1150
+ content: "›";
1151
+ flex: none;
1152
+ margin: 0 6px;
1153
+ color: var(--fg-muted);
1154
+ }
1155
+ /* Long titles are cut here; the full title is the element's tooltip. */
1156
+ .loomcycle-explorer .doc-trail-crumb,
1157
+ .loomcycle-explorer .doc-trail-current {
1158
+ max-width: 28ch;
1159
+ overflow: hidden;
1160
+ text-overflow: ellipsis;
1161
+ white-space: nowrap;
1162
+ }
1163
+ .loomcycle-explorer .doc-trail-crumb,
1164
+ .loomcycle-explorer .doc-trail-gap {
1165
+ background: none;
1166
+ border: none;
1167
+ padding: 0;
1168
+ font: inherit;
1169
+ color: var(--accent);
1170
+ cursor: pointer;
1171
+ }
1172
+ .loomcycle-explorer .doc-trail-crumb:hover,
1173
+ .loomcycle-explorer .doc-trail-gap:hover {
1174
+ text-decoration: underline;
1175
+ }
1176
+ .loomcycle-explorer .doc-trail-current {
1177
+ color: var(--fg);
1178
+ font-weight: 600;
1179
+ }
1180
+ /* A document open by id, with no Path-tree entry to show in the header. */
1181
+ .loomcycle-explorer .paths-doc-unfiled {
1182
+ font-family: inherit;
1183
+ word-break: normal;
1184
+ }
1185
+ .loomcycle-explorer .paths-doc-unfiled em {
1186
+ font-style: normal;
1187
+ color: var(--fg-soft);
1188
+ }
1189
+ /* A document that could not be read (deleted / other scope / no access). */
1190
+ .loomcycle-explorer .doc-unavailable {
1191
+ padding: 24px 16px;
1192
+ color: var(--fg-soft);
1193
+ font-size: var(--lc-text-sm);
1194
+ }
1195
+ .loomcycle-explorer .doc-unavailable p {
1196
+ margin: 0 0 8px 0;
1197
+ }
1198
+ .loomcycle-explorer .doc-unavailable-lead {
1199
+ color: var(--fg);
1200
+ font-weight: 600;
1201
+ }
1202
+ .loomcycle-explorer .doc-unavailable-detail {
1203
+ word-break: break-all;
1204
+ }
1013
1205
  .loomcycle-explorer .doc-graph {
1014
1206
  margin-top: 12px;
1015
1207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcycle/explorer",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "Embeddable React Path VFS + chunked-graph Document browser for the loomcycle agentic runtime (RFC AL / AK) \u2014 a themeable, standalone package: a dirent tree with folder/document CRUD and a chunk-tree Document viewer/editor.",
6
6
  "license": "Apache-2.0",