Skip to content

zidane-ui/files/headless

import { … } from 'zidane-ui/files/headless'ui/src/files/headless/index.ts

Functions#

createMemoryFilesLayoutFunction#

A layout that lasts as long as the store: for an app that keeps none.

createStorageEditorPrefsFunction#

Editor preferences kept in a Storage under one key, read on first use and validated with parseEditor. Every storage call is guarded: a storage that throws reads as empty and drops writes.

Another window's change (Settings in the main window, the session's panels in a window of their own) is adopted and announced. Otherwise the files open here keep the old mode, and the next write from here puts it back.

droppedImportItemsFunction#

A drop as import items (importEntries, zidane/chat/pure): dropped folders walked through their entries, files read when their turn comes.

droppedItemsFunction#

What a drop holds, taken now: a DataTransfer's items are gone once the drop event returns, so its files and their entries are read here.

entryRefusalTextFunction#

What a refusal says, in the files labels.

filesRootOfFunction#

The scope's folder for file views: the session's workspace URI when its files are elsewhere, else its cwd.

filesScopeKeyFunction#

The scope's identity: the session when bound, else draft:<id> or project:<root>.

hasDroppedFilesFunction#

Whether a drag carries files from outside the page (the file manager).

inFolderFunction#

name in folder dir.

isUnderFunction#

Whether path is root or inside it.

matchRangesFunction#

Every occurrence of query in text, as UTF-16 offsets.

mediaTypeOfPathFunction#

The media a path names, by its extension; null for everything else.

movedPathFunction#

Where path is once from moved to to (itself, or inside a moved folder); null when the move does not touch it.

nameOfFunction#

The last segment of path.

parentOfFunction#

The folder holding path ('': the root).

parseEditorFunction#

Stored preferences, validated: unknown or broken fields fall back to the defaults, numbers are clamped. undefined when raw is not a JSON object.

steppedIndexFunction#

The next index when stepping direction through length items from current (-1: none), wrapping; -1 when there are none.

topLevelPathsFunction#

The paths to act on when several are picked: a path inside another picked folder goes with it, so it is left out.

Constants#

DEFAULT_EDITORConstant#

The preferences before any change.

DEFAULT_FILES_LABELSConstant#

The default English strings of the Files and Diffs tabs. Override any of them through FilesProvider.

DEFAULT_FILES_LAYOUTConstant#

A fresh scope's layout.

DIAGNOSTICS_TIMEOUTConstant#

The per-tool diagnostics timeout, in seconds.

EDITOR_STORAGE_KEYConstant#

The key the preferences live under.

LSP_IDLEConstant#

The language servers' idle shutdown, in minutes.

Interfaces#

ContentMatchInterface#

One matching line of a search in files.

ContentSearchOptionsInterface#

Options of FilesHost.search.

ContentSearchResultInterface#

A search in files.

DiagnosticInterface#

One finding from a project tool or a language server, positions 1-based like editors show them.

DiagnosticsResultInterface#

A diagnostics run.

DiagnosticsRunOptionsInterface#

Options of FilesDiagnostics.run.

DroppedItemInterface#

One thing dropped from outside the page, taken while the drop lasts (a DataTransfer is emptied after it).

EditorPrefsInterface#

The stored preferences: read with get, follow with subscribe, change with set.

EditorStateInterface#

The editor preferences.

EntryClipboardInterface#

Rows cut or copied in the tree, waiting for a paste.

FilesChatTargetInterface#

The chat a view adds to: the composer receiving the view's scope.

FilesDiagnosticsInterface#

The project's own linters and typecheckers.

FilesEntriesInterface#

Entry actions on a folder's files: what the tree's new file and folder, rename, move, copy, delete and drops from outside run. Paths are relative to the folder, never .. or absolute. Nothing is overwritten: a create, move or rename onto a taken name is refused (exists); a copy or an import takes the next free name (a copy.ts). A refusal resolves; it does not throw.

FilesHostInterface#

The files host. Every member is optional.

FilesKeyScopeInterface#

What next/previous/close/find keys do inside a tab (the app routes them by focus).

FilesLayoutInterface#

What the Files tab keeps per scope.

FilesLayoutStoreInterface#

Where a scope's layout lives: read with get, follow with subscribe, change with update.

FilesLspInterface#

Language servers: live findings while typing, hovers, completion and go to definition.

FilesScopeInterface#

What a view works from: a folder, optionally bound to a session (or the new-chat draft).

FilesSystemInterface#

What the platform does with a path outside the page.

GitStatusEntryInterface#

One path's git status.

LspCompletionDetailInterface#

The rest of a completion item, fetched when it is selected or accepted.

LspCompletionItemInterface#

One completion candidate, ready to insert.

LspCompletionListInterface#

A completion answer; id names it for FilesLsp.resolveCompletion.

LspDefinitionInterface#

A definition target, and the symbol it was asked from when the server says.

LspHoverInterface#

A hover answer; busy says why text may be missing (the server is still loading the project).

LspLocationInterface#

A position in a file, 1-based.

LspRangeInterface#

0-based LSP range.

LspTextChangeInterface#

One incremental document change, LSP shape (0-based positions in the document before the change).

MediaTypeInterface#

A file the page shows as media, with its MIME type.

StorageEditorPrefsOptionsInterface#

Options of createStorageEditorPrefs.

TextMatchOptionsInterface#

How text matches.

WorkspaceEntryInterface#

One entry of a folder listing.

WorkspaceFileInterface#

A file as read.

WorkspaceListingInterface#

A folder's listing: its entries, and whether the host cut it at its cap.

Types#

AutoSurroundType#

How the editor wraps a selection when a bracket or quote is typed.

DiagnosticSeverityType#

The severity of a finding.

DiagnosticsModeType#

lsp = project tools plus language servers (live while typing, hovers).

DiagnosticsRunType#

When project tools run: on open (and after every change on disk) or only after the editor's own saves.

EditorPrefsStorageType#

The Storage calls the editor preferences make (localStorage or a double).

FilesEntryRefusalType#

Why an entry action was refused: a taken name, a source gone, an invalid name, no access, over the import limits.

FilesEntryResultType#

What an entry action did: the path it ended at, or why it was refused (message: the backend's own words).

FilesImportResultType#

What an import did: the top-level paths it made, and why it stopped when it did.

FilesLabelsType#

The shape of the files label dictionary. Some values are functions that build a string.

FilesRemovalType#

How a folder's removals end: in the system trash (recoverable), or gone for good.

FolderChangeType#

Why a folder may have changed: a tool result in it, or the repository moving.

MediaKindType#

The media kinds a browser plays on its own.

MediaSourceType#

A media file's address: as it is now, or one side of a working-tree change.

SaveOnType#

When an edited file saves: on ⌘S only, or when the editor loses focus too.

WorkspaceWriteResultType#

What a guarded write did.