@loomcycle/explorer 0.19.0 → 0.20.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.
@@ -27,9 +27,14 @@ export declare function chunkInheritsDocColor(scheme: ColorScheme): boolean;
27
27
  export declare function hexToTint(hex: string, alpha?: number): string | undefined;
28
28
  export declare function tintStyle(color: string | undefined): CSSProperties | undefined;
29
29
  export declare function washStyle(color: string | undefined): CSSProperties | undefined;
30
- export declare function chunkRowStyle(opts: {
30
+ export declare function chunkRowStyle(opts: ChunkRowColorOpts): CSSProperties | undefined;
31
+ interface ChunkRowColorOpts {
31
32
  status: string | undefined;
32
33
  isRoot: boolean;
33
34
  documentColor: string | undefined;
34
35
  scheme: ColorScheme | null;
35
- }): CSSProperties | undefined;
36
+ }
37
+ export declare function rowTint(color: string | undefined, wash?: boolean): CSSProperties | undefined;
38
+ export declare function chunkRowTint(opts: ChunkRowColorOpts): CSSProperties | undefined;
39
+ export declare function statusDotColor(status: string | undefined, scheme?: ColorScheme): string | undefined;
40
+ export {};
@@ -33,6 +33,13 @@ export interface DocRevertAnswer {
33
33
  export interface PathLsPage {
34
34
  limit?: number;
35
35
  cursor?: string;
36
+ withCounts?: boolean;
37
+ filters?: PathLsFilters;
38
+ }
39
+ export interface PathLsFilters {
40
+ name_contains?: string;
41
+ type?: string;
42
+ status?: string;
36
43
  }
37
44
  export interface DocEdgesPage {
38
45
  edges: DocEdge[];
@@ -44,6 +51,8 @@ export interface PathLsResult {
44
51
  entries: PathEntry[];
45
52
  truncated?: boolean;
46
53
  next_cursor?: string;
54
+ filters?: PathLsFilters;
55
+ type_expanded_to?: string[];
47
56
  }
48
57
  export interface ExplorerDataLayer {
49
58
  pathLs(path: string, scope: PathScope, recursive: boolean, browse?: BrowseScope, page?: PathLsPage): Promise<PathLsResult>;
@@ -1,27 +1,17 @@
1
1
  import type { BrowseScope, DocScope } from "../types";
2
- import { type ExplorerDataLayer } from "../lib/dataLayer";
3
- /** One entry of the document's download menu. */
2
+ import type { ExplorerDataLayer } from "./dataLayer";
3
+ /** One download of the document. */
4
4
  export type DownloadKind = "pdf" | "docx" | "odt" | "epub" | "html" | "md" | "canvas";
5
- interface DownloadEntry {
5
+ export interface DownloadEntry {
6
6
  kind: DownloadKind;
7
7
  label: string;
8
8
  title: string;
9
9
  rendered: boolean;
10
10
  }
11
- /** The entries the menu offers for a data layer: the rendered formats only when
12
- * it can fetch a rendered file. */
11
+ /** The downloads offered for a data layer: the rendered formats only when it
12
+ * can fetch a rendered file. */
13
13
  export declare function downloadEntries(data: Pick<ExplorerDataLayer, "documentExportFile">): DownloadEntry[];
14
14
  /** Fetch one download through the data layer and hand it to the browser.
15
15
  * .md and .canvas keep their own exports (the round-trippable Markdown with
16
16
  * metadata comments, the canvas graph); the rest are rendered by the runtime. */
17
17
  export declare function runDownload(data: ExplorerDataLayer, kind: DownloadKind, documentId: string, scope: DocScope, browse: BrowseScope | undefined, title: string | undefined, save?: (blob: Blob, filename: string) => void): Promise<void>;
18
- export interface DownloadMenuProps {
19
- documentId: string;
20
- scope: DocScope;
21
- browse?: BrowseScope;
22
- /** The document's title, for a file name the server does not supply. */
23
- title?: string;
24
- onError: (message: string) => void;
25
- }
26
- export default function DownloadMenu({ documentId, scope, browse, title, onError }: DownloadMenuProps): import("react").JSX.Element;
27
- export {};
@@ -1,5 +1,5 @@
1
1
  import type { BrowseScope, PathEntry, PathScope } from "../types";
2
- import type { ExplorerDataLayer } from "./dataLayer";
2
+ import type { ExplorerDataLayer, PathLsFilters } from "./dataLayer";
3
3
  export declare const LS_PAGE_LIMIT = 500;
4
4
  export declare const LS_MAX_LIMIT = 5000;
5
5
  export interface DirListing {
@@ -8,6 +8,12 @@ export interface DirListing {
8
8
  loaded: boolean;
9
9
  loading: boolean;
10
10
  error?: string;
11
+ appliedFilters?: PathLsFilters;
12
+ typeExpandedTo?: string[];
13
+ }
14
+ export interface ListingOptions {
15
+ withCounts?: boolean;
16
+ filters?: PathLsFilters;
11
17
  }
12
18
  export type DirMap = ReadonlyMap<string, DirListing>;
13
19
  export declare function lsTarget(dir: string): string;
@@ -18,12 +24,13 @@ export declare class LazyPathTree {
18
24
  private readonly scope;
19
25
  private readonly browse?;
20
26
  private readonly pageLimit;
27
+ private readonly listing;
21
28
  private dirs;
22
29
  private snapshot;
23
30
  private readonly listeners;
24
31
  private readonly inflight;
25
32
  private readonly epoch;
26
- constructor(data: ExplorerDataLayer, scope: PathScope, browse?: BrowseScope | undefined, pageLimit?: number);
33
+ constructor(data: ExplorerDataLayer, scope: PathScope, browse?: BrowseScope | undefined, pageLimit?: number, listing?: ListingOptions);
27
34
  getSnapshot: () => DirMap;
28
35
  subscribe: (fn: () => void) => (() => void);
29
36
  private publish;
@@ -0,0 +1,6 @@
1
+ export declare function readStored(key: string): string | null;
2
+ export declare function writeStored(key: string, value: string | null): void;
3
+ export declare function usePersistedFlag(key: string, fallback?: boolean): [boolean, (v: boolean | ((cur: boolean) => boolean)) => void];
4
+ export declare function usePersistedChoice<T extends string>(key: string, choices: readonly T[]): [T | null, (v: T | null | ((cur: T | null) => T | null)) => void];
5
+ export declare function isTypingTarget(t: EventTarget | null): boolean;
6
+ export declare function shortcutApplies(e: KeyboardEvent, root: HTMLElement | null): boolean;
@@ -0,0 +1,26 @@
1
+ import type { DocSummary } from "./colorScheme";
2
+ import type { PathLsFilters } from "./dataLayer";
3
+ import { type PathNode } from "../components/PathTree";
4
+ export interface TreeFilter {
5
+ name: string;
6
+ type: string;
7
+ status: string;
8
+ }
9
+ export declare const NO_FILTER: TreeFilter;
10
+ export declare function filterActive(f: TreeFilter): boolean;
11
+ export declare const STATUS_SUGGESTIONS: string[];
12
+ export type FindCoverage = "opened" | "subtree";
13
+ export declare function findCoverage(rootListing: unknown): FindCoverage;
14
+ export declare function coverageLabel(mode: "search" | "filter", c: FindCoverage): string;
15
+ export declare function lsFilters(f: TreeFilter): PathLsFilters | undefined;
16
+ export declare const AUTO_OPEN_FOLDERS = 8;
17
+ export declare function autoOpen(tree: PathNode[], open: ReadonlySet<string>, tried: ReadonlySet<string>, budget?: number): string[];
18
+ export declare function searchListed(tree: PathNode[], base: string, query: string): PathNode[];
19
+ export declare function filterTree(tree: PathNode[], f: TreeFilter, summaries?: Map<string, DocSummary>): {
20
+ tree: PathNode[];
21
+ open: Set<string>;
22
+ };
23
+ export declare function filterChoices(trees: PathNode[][], summaries?: Map<string, DocSummary>): {
24
+ types: string[];
25
+ statuses: string[];
26
+ };
@@ -0,0 +1,2 @@
1
+ import { type RefObject } from "react";
2
+ export declare function useNarrow(ref: RefObject<HTMLElement | null>, below: number): boolean;