@textui/core 0.1.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.
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +11 -0
- package/dist/app/app.d.ts +200 -0
- package/dist/app/app.d.ts.map +1 -0
- package/dist/app/app.js +980 -0
- package/dist/core/animation.d.ts +34 -0
- package/dist/core/animation.d.ts.map +1 -0
- package/dist/core/animation.js +125 -0
- package/dist/core/clipboard.d.ts +29 -0
- package/dist/core/clipboard.d.ts.map +1 -0
- package/dist/core/clipboard.js +30 -0
- package/dist/core/commands.d.ts +42 -0
- package/dist/core/commands.d.ts.map +1 -0
- package/dist/core/commands.js +146 -0
- package/dist/core/components.d.ts +27 -0
- package/dist/core/components.d.ts.map +1 -0
- package/dist/core/components.js +78 -0
- package/dist/core/events.d.ts +23 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +77 -0
- package/dist/core/focus.d.ts +69 -0
- package/dist/core/focus.d.ts.map +1 -0
- package/dist/core/focus.js +336 -0
- package/dist/core/i18n.d.ts +27 -0
- package/dist/core/i18n.d.ts.map +1 -0
- package/dist/core/i18n.js +88 -0
- package/dist/core/keybindings.d.ts +53 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +163 -0
- package/dist/core/layers.d.ts +28 -0
- package/dist/core/layers.d.ts.map +1 -0
- package/dist/core/layers.js +84 -0
- package/dist/core/manifest.d.ts +22 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +85 -0
- package/dist/core/navigation.d.ts +47 -0
- package/dist/core/navigation.d.ts.map +1 -0
- package/dist/core/navigation.js +110 -0
- package/dist/core/resources.d.ts +115 -0
- package/dist/core/resources.d.ts.map +1 -0
- package/dist/core/resources.js +321 -0
- package/dist/core/services.d.ts +21 -0
- package/dist/core/services.d.ts.map +1 -0
- package/dist/core/services.js +63 -0
- package/dist/core/store.d.ts +60 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/store.js +593 -0
- package/dist/core/surfaces.d.ts +81 -0
- package/dist/core/surfaces.d.ts.map +1 -0
- package/dist/core/surfaces.js +237 -0
- package/dist/core/syntax.d.ts +49 -0
- package/dist/core/syntax.d.ts.map +1 -0
- package/dist/core/syntax.js +172 -0
- package/dist/core/when.d.ts +15 -0
- package/dist/core/when.d.ts.map +1 -0
- package/dist/core/when.js +224 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/jsx/factory.d.ts +27 -0
- package/dist/jsx/factory.d.ts.map +1 -0
- package/dist/jsx/factory.js +102 -0
- package/dist/jsx/intrinsics.d.ts +96 -0
- package/dist/jsx/intrinsics.d.ts.map +1 -0
- package/dist/jsx/intrinsics.js +1 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +13 -0
- package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx/jsx-dev-runtime.js +12 -0
- package/dist/jsx/jsx-runtime.d.ts +42 -0
- package/dist/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx/jsx-runtime.js +16 -0
- package/dist/render/buffer.d.ts +77 -0
- package/dist/render/buffer.d.ts.map +1 -0
- package/dist/render/buffer.js +275 -0
- package/dist/render/color.d.ts +35 -0
- package/dist/render/color.d.ts.map +1 -0
- package/dist/render/color.js +160 -0
- package/dist/render/diff.d.ts +37 -0
- package/dist/render/diff.d.ts.map +1 -0
- package/dist/render/diff.js +66 -0
- package/dist/render/layout.d.ts +72 -0
- package/dist/render/layout.d.ts.map +1 -0
- package/dist/render/layout.js +633 -0
- package/dist/render/static.d.ts +63 -0
- package/dist/render/static.d.ts.map +1 -0
- package/dist/render/static.js +209 -0
- package/dist/runtime/bindings.d.ts +46 -0
- package/dist/runtime/bindings.d.ts.map +1 -0
- package/dist/runtime/bindings.js +116 -0
- package/dist/runtime/hooks.d.ts +284 -0
- package/dist/runtime/hooks.d.ts.map +1 -0
- package/dist/runtime/hooks.js +846 -0
- package/dist/runtime/instance.d.ts +106 -0
- package/dist/runtime/instance.d.ts.map +1 -0
- package/dist/runtime/instance.js +181 -0
- package/dist/runtime/paint.d.ts +27 -0
- package/dist/runtime/paint.d.ts.map +1 -0
- package/dist/runtime/paint.js +567 -0
- package/dist/runtime/reconcile.d.ts +23 -0
- package/dist/runtime/reconcile.d.ts.map +1 -0
- package/dist/runtime/reconcile.js +260 -0
- package/dist/runtime/runtime.d.ts +42 -0
- package/dist/runtime/runtime.d.ts.map +1 -0
- package/dist/runtime/runtime.js +1 -0
- package/dist/runtime/style.d.ts +55 -0
- package/dist/runtime/style.d.ts.map +1 -0
- package/dist/runtime/style.js +143 -0
- package/dist/themes/borders.d.ts +10 -0
- package/dist/themes/borders.d.ts.map +1 -0
- package/dist/themes/borders.js +88 -0
- package/dist/themes/builtin.d.ts +31 -0
- package/dist/themes/builtin.d.ts.map +1 -0
- package/dist/themes/builtin.js +291 -0
- package/dist/themes/glyphs.d.ts +15 -0
- package/dist/themes/glyphs.d.ts.map +1 -0
- package/dist/themes/glyphs.js +97 -0
- package/dist/themes/index.d.ts +5 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +4 -0
- package/dist/themes/registry.d.ts +20 -0
- package/dist/themes/registry.d.ts.map +1 -0
- package/dist/themes/registry.js +204 -0
- package/dist/types/adapter.d.ts +38 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/adapter.js +1 -0
- package/dist/types/animation.d.ts +31 -0
- package/dist/types/animation.d.ts.map +1 -0
- package/dist/types/animation.js +1 -0
- package/dist/types/app.d.ts +148 -0
- package/dist/types/app.d.ts.map +1 -0
- package/dist/types/app.js +1 -0
- package/dist/types/async.d.ts +30 -0
- package/dist/types/async.d.ts.map +1 -0
- package/dist/types/async.js +1 -0
- package/dist/types/capabilities.d.ts +44 -0
- package/dist/types/capabilities.d.ts.map +1 -0
- package/dist/types/capabilities.js +33 -0
- package/dist/types/cells.d.ts +72 -0
- package/dist/types/cells.d.ts.map +1 -0
- package/dist/types/cells.js +10 -0
- package/dist/types/command.d.ts +127 -0
- package/dist/types/command.d.ts.map +1 -0
- package/dist/types/command.js +1 -0
- package/dist/types/component-registry.d.ts +77 -0
- package/dist/types/component-registry.d.ts.map +1 -0
- package/dist/types/component-registry.js +1 -0
- package/dist/types/disposable.d.ts +8 -0
- package/dist/types/disposable.d.ts.map +1 -0
- package/dist/types/disposable.js +1 -0
- package/dist/types/focus.d.ts +72 -0
- package/dist/types/focus.d.ts.map +1 -0
- package/dist/types/focus.js +1 -0
- package/dist/types/geometry.d.ts +28 -0
- package/dist/types/geometry.d.ts.map +1 -0
- package/dist/types/geometry.js +14 -0
- package/dist/types/graph.d.ts +129 -0
- package/dist/types/graph.d.ts.map +1 -0
- package/dist/types/graph.js +31 -0
- package/dist/types/i18n.d.ts +23 -0
- package/dist/types/i18n.d.ts.map +1 -0
- package/dist/types/i18n.js +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +31 -0
- package/dist/types/input.d.ts +65 -0
- package/dist/types/input.d.ts.map +1 -0
- package/dist/types/input.js +1 -0
- package/dist/types/keybinding.d.ts +49 -0
- package/dist/types/keybinding.d.ts.map +1 -0
- package/dist/types/keybinding.js +1 -0
- package/dist/types/layer.d.ts +54 -0
- package/dist/types/layer.d.ts.map +1 -0
- package/dist/types/layer.js +1 -0
- package/dist/types/manifest.d.ts +114 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/dist/types/manifest.js +1 -0
- package/dist/types/markdown.d.ts +58 -0
- package/dist/types/markdown.d.ts.map +1 -0
- package/dist/types/markdown.js +1 -0
- package/dist/types/navigation.d.ts +40 -0
- package/dist/types/navigation.d.ts.map +1 -0
- package/dist/types/navigation.js +1 -0
- package/dist/types/render.d.ts +72 -0
- package/dist/types/render.d.ts.map +1 -0
- package/dist/types/render.js +1 -0
- package/dist/types/resource.d.ts +170 -0
- package/dist/types/resource.d.ts.map +1 -0
- package/dist/types/resource.js +1 -0
- package/dist/types/services.d.ts +24 -0
- package/dist/types/services.d.ts.map +1 -0
- package/dist/types/services.js +3 -0
- package/dist/types/shell.d.ts +32 -0
- package/dist/types/shell.d.ts.map +1 -0
- package/dist/types/shell.js +1 -0
- package/dist/types/store.d.ts +124 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/store.js +1 -0
- package/dist/types/stream.d.ts +18 -0
- package/dist/types/stream.d.ts.map +1 -0
- package/dist/types/stream.js +1 -0
- package/dist/types/style.d.ts +166 -0
- package/dist/types/style.d.ts.map +1 -0
- package/dist/types/style.js +1 -0
- package/dist/types/surface.d.ts +97 -0
- package/dist/types/surface.d.ts.map +1 -0
- package/dist/types/surface.js +1 -0
- package/dist/types/syntax.d.ts +68 -0
- package/dist/types/syntax.d.ts.map +1 -0
- package/dist/types/syntax.js +5 -0
- package/dist/types/terminal.d.ts +52 -0
- package/dist/types/terminal.d.ts.map +1 -0
- package/dist/types/terminal.js +1 -0
- package/dist/types/theme.d.ts +117 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/theme.js +1 -0
- package/dist/types/when.d.ts +19 -0
- package/dist/types/when.d.ts.map +1 -0
- package/dist/types/when.js +1 -0
- package/dist/ui/primitives.d.ts +56 -0
- package/dist/ui/primitives.d.ts.map +1 -0
- package/dist/ui/primitives.js +108 -0
- package/dist/ui/screen.d.ts +23 -0
- package/dist/ui/screen.d.ts.map +1 -0
- package/dist/ui/screen.js +18 -0
- package/dist/util/disposable.d.ts +6 -0
- package/dist/util/disposable.d.ts.map +1 -0
- package/dist/util/disposable.js +49 -0
- package/dist/util/markdown.d.ts +24 -0
- package/dist/util/markdown.d.ts.map +1 -0
- package/dist/util/markdown.js +220 -0
- package/dist/util/paths.d.ts +47 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +134 -0
- package/dist/util/stream.d.ts +32 -0
- package/dist/util/stream.d.ts.map +1 -0
- package/dist/util/stream.js +206 -0
- package/dist/util/text.d.ts +65 -0
- package/dist/util/text.d.ts.map +1 -0
- package/dist/util/text.js +419 -0
- package/package.json +70 -0
- package/src/adapters/index.ts +11 -0
- package/src/app/app.ts +1096 -0
- package/src/core/animation.ts +144 -0
- package/src/core/clipboard.ts +40 -0
- package/src/core/commands.ts +169 -0
- package/src/core/components.ts +91 -0
- package/src/core/events.ts +95 -0
- package/src/core/focus.ts +358 -0
- package/src/core/i18n.ts +107 -0
- package/src/core/keybindings.ts +184 -0
- package/src/core/layers.ts +94 -0
- package/src/core/manifest.ts +84 -0
- package/src/core/navigation.ts +135 -0
- package/src/core/resources.ts +362 -0
- package/src/core/services.ts +69 -0
- package/src/core/store.ts +640 -0
- package/src/core/surfaces.ts +292 -0
- package/src/core/syntax.ts +200 -0
- package/src/core/when.ts +238 -0
- package/src/index.ts +76 -0
- package/src/jsx/factory.ts +124 -0
- package/src/jsx/intrinsics.ts +99 -0
- package/src/jsx/jsx-dev-runtime.ts +23 -0
- package/src/jsx/jsx-runtime.ts +76 -0
- package/src/render/buffer.ts +318 -0
- package/src/render/color.ts +180 -0
- package/src/render/diff.ts +99 -0
- package/src/render/layout.ts +764 -0
- package/src/render/static.ts +290 -0
- package/src/runtime/bindings.ts +150 -0
- package/src/runtime/hooks.ts +1057 -0
- package/src/runtime/instance.ts +284 -0
- package/src/runtime/paint.ts +737 -0
- package/src/runtime/reconcile.ts +335 -0
- package/src/runtime/runtime.ts +47 -0
- package/src/runtime/style.ts +205 -0
- package/src/themes/borders.ts +95 -0
- package/src/themes/builtin.ts +301 -0
- package/src/themes/glyphs.ts +101 -0
- package/src/themes/index.ts +4 -0
- package/src/themes/registry.ts +224 -0
- package/src/types/adapter.ts +41 -0
- package/src/types/animation.ts +34 -0
- package/src/types/app.ts +149 -0
- package/src/types/async.ts +35 -0
- package/src/types/capabilities.ts +79 -0
- package/src/types/cells.ts +79 -0
- package/src/types/command.ts +139 -0
- package/src/types/component-registry.ts +82 -0
- package/src/types/disposable.ts +8 -0
- package/src/types/focus.ts +77 -0
- package/src/types/geometry.ts +50 -0
- package/src/types/graph.ts +174 -0
- package/src/types/i18n.ts +25 -0
- package/src/types/index.ts +31 -0
- package/src/types/input.ts +81 -0
- package/src/types/keybinding.ts +51 -0
- package/src/types/layer.ts +46 -0
- package/src/types/manifest.ts +101 -0
- package/src/types/markdown.ts +47 -0
- package/src/types/navigation.ts +42 -0
- package/src/types/render.ts +86 -0
- package/src/types/resource.ts +185 -0
- package/src/types/services.ts +28 -0
- package/src/types/shell.ts +30 -0
- package/src/types/store.ts +148 -0
- package/src/types/stream.ts +24 -0
- package/src/types/style.ts +205 -0
- package/src/types/surface.ts +119 -0
- package/src/types/syntax.ts +93 -0
- package/src/types/terminal.ts +58 -0
- package/src/types/theme.ts +121 -0
- package/src/types/when.ts +21 -0
- package/src/ui/primitives.ts +118 -0
- package/src/ui/screen.ts +41 -0
- package/src/util/disposable.ts +49 -0
- package/src/util/markdown.ts +225 -0
- package/src/util/paths.ts +138 -0
- package/src/util/stream.ts +213 -0
- package/src/util/text.ts +428 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
import type { BindingPath, EventPath } from './graph.js';
|
|
3
|
+
/**
|
|
4
|
+
* Scopes are lifetimes, not folders. The first segment of an absolute path
|
|
5
|
+
* names one, and `clearScope` is what makes sign-out or screen-teardown a
|
|
6
|
+
* single call rather than a cascade of resets.
|
|
7
|
+
*/
|
|
8
|
+
export type ScopeName = 'local' | 'screen' | 'session' | 'app' | 'global' | 'summary' | 'active' | 'ui' | 'layout' | 'modus' | `plugins.${string}` | (string & {});
|
|
9
|
+
export type SubscribeOptions = {
|
|
10
|
+
/** Fire for changes at or below the path, not only exact hits. */
|
|
11
|
+
subtree?: boolean;
|
|
12
|
+
/** Deliver the current value immediately on subscribe. */
|
|
13
|
+
immediate?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export interface ChangeRecord {
|
|
16
|
+
path: BindingPath;
|
|
17
|
+
value: unknown;
|
|
18
|
+
previous: unknown;
|
|
19
|
+
}
|
|
20
|
+
export type ComputedDefinition<T = unknown> = {
|
|
21
|
+
from: BindingPath[];
|
|
22
|
+
select: (values: Record<string, unknown>) => T;
|
|
23
|
+
}
|
|
24
|
+
/** A tiny expression over the `from` paths, for computed defined as data. */
|
|
25
|
+
| {
|
|
26
|
+
from: BindingPath[];
|
|
27
|
+
select: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A namespace and the code that fills it. Lazy by default: nothing loads until
|
|
31
|
+
* something reads or subscribes below `namespace`.
|
|
32
|
+
*/
|
|
33
|
+
export interface DataProviderDefinition {
|
|
34
|
+
namespace: string;
|
|
35
|
+
load?: 'lazy' | 'eager';
|
|
36
|
+
/** Unload this many ms after the last subscriber leaves. */
|
|
37
|
+
unloadAfter?: number;
|
|
38
|
+
provider: {
|
|
39
|
+
load(store: ReactiveStore): Promise<void> | void;
|
|
40
|
+
unload?(store: ReactiveStore): Promise<void> | void;
|
|
41
|
+
loadOne?(id: string): Promise<unknown>;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Optional shape checking. Dynamic paths stay legal either way. */
|
|
45
|
+
export interface PathSchema {
|
|
46
|
+
path: BindingPath;
|
|
47
|
+
/** Return null when valid, a message when not. */
|
|
48
|
+
validate(value: unknown): string | null;
|
|
49
|
+
/** Seeded when the path is first read and still empty. */
|
|
50
|
+
initial?: unknown;
|
|
51
|
+
}
|
|
52
|
+
/** Persist selected paths or subtrees across runs. */
|
|
53
|
+
export interface PersistenceAdapter {
|
|
54
|
+
id: string;
|
|
55
|
+
/** Paths and subtrees this adapter owns. Subtree if it ends in `/`. */
|
|
56
|
+
paths: string[];
|
|
57
|
+
read(): Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
58
|
+
write(entries: Record<string, unknown>): Promise<void> | void;
|
|
59
|
+
/** Coalesce writes by this many ms. */
|
|
60
|
+
debounceMs?: number;
|
|
61
|
+
}
|
|
62
|
+
/** Collection helpers operate on a path holding an array. */
|
|
63
|
+
export interface CollectionOps<T = unknown> {
|
|
64
|
+
all(): T[];
|
|
65
|
+
at(index: number): T | undefined;
|
|
66
|
+
find(pred: (item: T, i: number) => boolean): T | undefined;
|
|
67
|
+
append(...items: T[]): void;
|
|
68
|
+
prepend(...items: T[]): void;
|
|
69
|
+
insertAt(index: number, ...items: T[]): void;
|
|
70
|
+
removeAt(index: number): void;
|
|
71
|
+
remove(pred: (item: T, i: number) => boolean): number;
|
|
72
|
+
update(pred: (item: T, i: number) => boolean, patch: Partial<T> | ((item: T) => T)): number;
|
|
73
|
+
replace(items: T[]): void;
|
|
74
|
+
filter(pred: (item: T, i: number) => boolean): T[];
|
|
75
|
+
clear(): void;
|
|
76
|
+
/** Keep at most `n` items, dropping from the front. For log tails. */
|
|
77
|
+
cap(n: number): void;
|
|
78
|
+
readonly length: number;
|
|
79
|
+
}
|
|
80
|
+
export interface ReactiveStore extends Disposable {
|
|
81
|
+
get<T = unknown>(path: BindingPath): T | undefined;
|
|
82
|
+
/** `get` with a fallback, so callers stop writing `?? default` everywhere. */
|
|
83
|
+
read<T>(path: BindingPath, fallback: T): T;
|
|
84
|
+
set(path: BindingPath, value: unknown): void;
|
|
85
|
+
/** Functional update - receives the current value. */
|
|
86
|
+
update<T = unknown>(path: BindingPath, fn: (current: T | undefined) => T): void;
|
|
87
|
+
/** Shallow-merge into an object at `path`. */
|
|
88
|
+
patch(path: BindingPath, partial: Record<string, unknown>): void;
|
|
89
|
+
/** Many writes, one notification pass. */
|
|
90
|
+
patchMany(entries: Record<BindingPath, unknown>): void;
|
|
91
|
+
delete(path: BindingPath): void;
|
|
92
|
+
has(path: BindingPath): boolean;
|
|
93
|
+
/** Coalesce every write inside `fn` into a single notification pass. */
|
|
94
|
+
batch<T>(fn: () => T): T;
|
|
95
|
+
subscribe(path: BindingPath, fn: (value: unknown, change: ChangeRecord) => void, options?: SubscribeOptions): Disposable;
|
|
96
|
+
clearScope(scope: ScopeName | string): void;
|
|
97
|
+
subscriberCount(scope: ScopeName | string): number;
|
|
98
|
+
computed<T = unknown>(path: BindingPath, def: ComputedDefinition<T>): Disposable;
|
|
99
|
+
collection<T = unknown>(path: BindingPath): CollectionOps<T>;
|
|
100
|
+
registerDataProvider(def: DataProviderDefinition): Disposable;
|
|
101
|
+
listDataProviders(): DataProviderDefinition[];
|
|
102
|
+
registerSchema(schema: PathSchema): Disposable;
|
|
103
|
+
registerPersistence(adapter: PersistenceAdapter): Disposable;
|
|
104
|
+
/** Load every registered persistence adapter. Call once at boot. */
|
|
105
|
+
hydrate(): Promise<void>;
|
|
106
|
+
/** Everything below `scope`, as a plain object. For snapshots and tests. */
|
|
107
|
+
snapshot(scope?: ScopeName | string): Record<string, unknown>;
|
|
108
|
+
restore(snapshot: Record<string, unknown>): void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Transient events. Same path convention as the store, deliberately not the
|
|
112
|
+
* same mechanism - an event has no value to read back, which is the whole
|
|
113
|
+
* difference between `$/dialog/open` and `@/dialog/confirm`.
|
|
114
|
+
*/
|
|
115
|
+
export interface EventBus extends Disposable {
|
|
116
|
+
emit(path: EventPath, payload?: unknown): void;
|
|
117
|
+
on(path: EventPath, fn: (payload: unknown, path: EventPath) => void, options?: {
|
|
118
|
+
subtree?: boolean;
|
|
119
|
+
once?: boolean;
|
|
120
|
+
}): Disposable;
|
|
121
|
+
/** Resolve on the next emit at this path. */
|
|
122
|
+
next(path: EventPath, timeoutMs?: number): Promise<unknown>;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/types/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CA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AAO,CAAC,CAAC;IAC9D,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAClD;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,UAAU,CAAC;IAClI,6CAA6C;IAC7C,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
/**
|
|
3
|
+
* The smallest useful stream. A LogViewer should not care whether its lines
|
|
4
|
+
* come from a Node stream, an async iterable, a child process or a store path,
|
|
5
|
+
* so every source is adapted to this.
|
|
6
|
+
*/
|
|
7
|
+
export interface Stream<T> {
|
|
8
|
+
subscribe(observer: StreamObserver<T>): Disposable;
|
|
9
|
+
/** Best-effort stop at the source. */
|
|
10
|
+
cancel?(): void;
|
|
11
|
+
}
|
|
12
|
+
export interface StreamObserver<T> {
|
|
13
|
+
next(value: T): void;
|
|
14
|
+
error?(err: unknown): void;
|
|
15
|
+
complete?(): void;
|
|
16
|
+
}
|
|
17
|
+
export type StreamSource<T> = Stream<T> | AsyncIterable<T> | Iterable<T> | (() => AsyncIterable<T>);
|
|
18
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/types/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IACnD,sCAAsC;IACtC,MAAM,CAAC,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IACtB,MAAM,CAAC,CAAC,CAAC,GACT,aAAa,CAAC,CAAC,CAAC,GAChB,QAAQ,CAAC,CAAC,CAAC,GACX,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { Color } from './cells.js';
|
|
2
|
+
import type { EdgeSpec } from './geometry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Semantic theme tokens. A component names a role, never a colour - which is
|
|
5
|
+
* what lets one catalog render the same under a light theme, a dark theme and
|
|
6
|
+
* a 16-colour ssh session.
|
|
7
|
+
*/
|
|
8
|
+
export type ColorToken = 'canvas' | 'surface' | 'surfaceAlt' | 'overlay' | 'border' | 'borderStrong' | 'borderSubtle' | 'text' | 'muted' | 'subtle' | 'inverted' | 'accent' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'onDefault' | 'onMuted' | 'onAccent' | 'onPrimary' | 'onSecondary' | 'onSuccess' | 'onWarning' | 'onDanger' | 'onInfo' | 'hover' | 'active' | 'selected' | 'focus' | 'disabled' | 'scrim' | 'cursor' | 'shadow';
|
|
9
|
+
/** Anywhere a colour is accepted, a semantic token is accepted too. */
|
|
10
|
+
export type StyleColor = ColorToken | Color;
|
|
11
|
+
export type Dimension = number | `${number}%` | 'auto';
|
|
12
|
+
export type BorderStyle = 'none' | 'single' | 'double' | 'round' | 'bold' | 'dashed' | 'ascii' | 'thick' | 'half';
|
|
13
|
+
/** The twelve glyphs a box needs. Themes may ship their own set. */
|
|
14
|
+
export interface BorderChars {
|
|
15
|
+
topLeft: string;
|
|
16
|
+
top: string;
|
|
17
|
+
topRight: string;
|
|
18
|
+
right: string;
|
|
19
|
+
bottomRight: string;
|
|
20
|
+
bottom: string;
|
|
21
|
+
bottomLeft: string;
|
|
22
|
+
left: string;
|
|
23
|
+
/** junctions, for tables and split panels */
|
|
24
|
+
cross: string;
|
|
25
|
+
teeTop: string;
|
|
26
|
+
teeBottom: string;
|
|
27
|
+
teeLeft: string;
|
|
28
|
+
teeRight: string;
|
|
29
|
+
}
|
|
30
|
+
export type BorderSides = {
|
|
31
|
+
top?: boolean;
|
|
32
|
+
right?: boolean;
|
|
33
|
+
bottom?: boolean;
|
|
34
|
+
left?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** A colour per edge. Unnamed edges fall back to the border's `color`. */
|
|
37
|
+
export type BorderColors = {
|
|
38
|
+
top?: StyleColor;
|
|
39
|
+
right?: StyleColor;
|
|
40
|
+
bottom?: StyleColor;
|
|
41
|
+
left?: StyleColor;
|
|
42
|
+
};
|
|
43
|
+
export type BorderSpec = BorderStyle | {
|
|
44
|
+
style?: BorderStyle;
|
|
45
|
+
color?: StyleColor;
|
|
46
|
+
/**
|
|
47
|
+
* Per-edge colour, over `color`. A corner belongs to the edge that runs
|
|
48
|
+
* through it - the top rule owns both top corners - because a cell holds
|
|
49
|
+
* one colour and a terminal has no mitre to split it along.
|
|
50
|
+
*/
|
|
51
|
+
colors?: BorderColors;
|
|
52
|
+
sides?: BorderSides;
|
|
53
|
+
chars?: Partial<BorderChars>;
|
|
54
|
+
/**
|
|
55
|
+
* Draw the frame dim. The frame only: a dim attribute on the box itself
|
|
56
|
+
* would take the content with it, and a quiet border around ordinary
|
|
57
|
+
* text is the whole reason to ask.
|
|
58
|
+
*/
|
|
59
|
+
dim?: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type Align = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
62
|
+
export type Justify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
63
|
+
export type Overflow = 'visible' | 'hidden' | 'scroll' | 'ellipsis';
|
|
64
|
+
export type Position = 'relative' | 'absolute';
|
|
65
|
+
export type FlexWrap = 'nowrap' | 'wrap';
|
|
66
|
+
/**
|
|
67
|
+
* How a run of text meets the edge of its box.
|
|
68
|
+
*
|
|
69
|
+
* `none`, `word` and `char` describe *wrapping*: the text keeps every
|
|
70
|
+
* character and takes as many rows as it needs. The `truncate-*` forms are the
|
|
71
|
+
* opposite bargain - one row, and whatever does not fit is replaced by an
|
|
72
|
+
* ellipsis at the named end. `truncate` is `truncate-end`, which is the one
|
|
73
|
+
* everybody means.
|
|
74
|
+
*
|
|
75
|
+
* A truncating text is one row tall by definition, so an embedded newline
|
|
76
|
+
* would have nowhere to go; those become spaces rather than being dropped,
|
|
77
|
+
* because a joined sentence still reads and a silently halved one does not.
|
|
78
|
+
*/
|
|
79
|
+
export type TextWrap = 'none' | 'word' | 'char' | 'truncate' | 'truncate-start' | 'truncate-middle' | 'truncate-end';
|
|
80
|
+
export interface Style {
|
|
81
|
+
/**
|
|
82
|
+
* Wash whatever is already painted here toward this colour, instead of
|
|
83
|
+
* drawing over it. A modal scrim in a terminal: the screen behind recedes
|
|
84
|
+
* but stays legible, rather than being replaced by a rectangle of nothing.
|
|
85
|
+
* `true` uses the theme's `scrim` token; a number sets the strength.
|
|
86
|
+
*/
|
|
87
|
+
scrim?: boolean | StyleColor;
|
|
88
|
+
scrimStrength?: number;
|
|
89
|
+
display?: 'flex' | 'none';
|
|
90
|
+
direction?: 'row' | 'column';
|
|
91
|
+
/** Space between children on both axes. `columnGap`/`rowGap` override it. */
|
|
92
|
+
gap?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Space between columns - horizontal, whichever way the container runs. It
|
|
95
|
+
* is the gap *between* children on a row, and the gap between wrapped lines
|
|
96
|
+
* on a column.
|
|
97
|
+
*/
|
|
98
|
+
columnGap?: number;
|
|
99
|
+
/** Space between rows - vertical. The mirror of `columnGap`. */
|
|
100
|
+
rowGap?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Whether children that do not fit start a new line. `nowrap` is the
|
|
103
|
+
* default and the cheaper path: one line, children shrink or get clipped.
|
|
104
|
+
*/
|
|
105
|
+
flexWrap?: FlexWrap;
|
|
106
|
+
padding?: EdgeSpec;
|
|
107
|
+
margin?: EdgeSpec;
|
|
108
|
+
width?: Dimension;
|
|
109
|
+
height?: Dimension;
|
|
110
|
+
minWidth?: number;
|
|
111
|
+
maxWidth?: number;
|
|
112
|
+
minHeight?: number;
|
|
113
|
+
maxHeight?: number;
|
|
114
|
+
/** Grow factor along the parent's main axis. 0 = size to content. */
|
|
115
|
+
flex?: number;
|
|
116
|
+
/** Shrink factor. Defaults to 1 when flex is unset. */
|
|
117
|
+
shrink?: number;
|
|
118
|
+
/** Base size along the main axis before grow/shrink. */
|
|
119
|
+
basis?: Dimension;
|
|
120
|
+
align?: Align;
|
|
121
|
+
alignSelf?: Align;
|
|
122
|
+
justify?: Justify;
|
|
123
|
+
position?: Position;
|
|
124
|
+
top?: number;
|
|
125
|
+
right?: number;
|
|
126
|
+
bottom?: number;
|
|
127
|
+
left?: number;
|
|
128
|
+
/** Painting and hit-testing order within a layer. */
|
|
129
|
+
zIndex?: number;
|
|
130
|
+
/** What happens to content past the edge, on both axes. */
|
|
131
|
+
overflow?: Overflow;
|
|
132
|
+
/** Overrides `overflow` sideways. A row that scrolls but does not grow. */
|
|
133
|
+
overflowX?: Overflow;
|
|
134
|
+
/** Overrides `overflow` downwards. The usual scroll container. */
|
|
135
|
+
overflowY?: Overflow;
|
|
136
|
+
fg?: StyleColor;
|
|
137
|
+
bg?: StyleColor;
|
|
138
|
+
bold?: boolean;
|
|
139
|
+
dim?: boolean;
|
|
140
|
+
italic?: boolean;
|
|
141
|
+
underline?: boolean;
|
|
142
|
+
inverse?: boolean;
|
|
143
|
+
strike?: boolean;
|
|
144
|
+
blink?: boolean;
|
|
145
|
+
border?: BorderSpec;
|
|
146
|
+
wrap?: TextWrap;
|
|
147
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
148
|
+
/** Character painted into empty cells of this box. */
|
|
149
|
+
fill?: string;
|
|
150
|
+
}
|
|
151
|
+
/** Styles selected by interaction state. Merged over the base in this order. */
|
|
152
|
+
export interface StatefulStyle {
|
|
153
|
+
base?: Style;
|
|
154
|
+
focus?: Style;
|
|
155
|
+
hover?: Style;
|
|
156
|
+
active?: Style;
|
|
157
|
+
selected?: Style;
|
|
158
|
+
disabled?: Style;
|
|
159
|
+
}
|
|
160
|
+
export type StyleInput = Style | StatefulStyle | (Style | StatefulStyle | undefined | false)[];
|
|
161
|
+
/** Global semantic variants, available to every component that opts in. */
|
|
162
|
+
export type SemanticVariant = 'default' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'muted';
|
|
163
|
+
/** Presentational variants a component may support. */
|
|
164
|
+
export type SurfaceVariant = 'solid' | 'outline' | 'ghost' | 'link';
|
|
165
|
+
export type Density = 'compact' | 'normal' | 'airy';
|
|
166
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/types/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM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G,MAAM,CAAC;AAEpE,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
import type { BindingPath, ComponentNode } from './graph.js';
|
|
3
|
+
import type { WhenClause } from './when.js';
|
|
4
|
+
import type { StyleColor } from './style.js';
|
|
5
|
+
/**
|
|
6
|
+
* Where something is mounted.
|
|
7
|
+
*
|
|
8
|
+
* A surface is the application's word, not the library's. The names below are
|
|
9
|
+
* the ones the shipped shells happen to use, and they are listed so an editor
|
|
10
|
+
* can complete them - `(string & {})` keeps the type open, so `lateral1`,
|
|
11
|
+
* `inspector` or `panel:bottom` are all equally valid and need no change here.
|
|
12
|
+
*
|
|
13
|
+
* The runtime never checks a surface name against a list. A name it has not
|
|
14
|
+
* seen gets default state the first time it is used, and a shell renders
|
|
15
|
+
* whichever surfaces it decides to render.
|
|
16
|
+
*/
|
|
17
|
+
export type SurfaceName = 'header' | 'rail' | 'sidebar' | 'aside' | 'main' | 'panel' | 'status' | 'overlay' | 'notify' | (string & {});
|
|
18
|
+
export interface MountDisplay {
|
|
19
|
+
title?: string;
|
|
20
|
+
subtitle?: string;
|
|
21
|
+
icon?: string;
|
|
22
|
+
color?: StyleColor;
|
|
23
|
+
badge?: string | number;
|
|
24
|
+
/** Commands offered in this mount's header. */
|
|
25
|
+
actions?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface MountPolicy {
|
|
28
|
+
/** Survives a session snapshot. */
|
|
29
|
+
persistent?: boolean;
|
|
30
|
+
/** Removed on the next navigation. Previews want this. */
|
|
31
|
+
transient?: boolean;
|
|
32
|
+
closable?: boolean;
|
|
33
|
+
/** The user may move it to another surface. */
|
|
34
|
+
movable?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** An inline node, or a binding whose value is a node. */
|
|
37
|
+
export type MountTarget = ComponentNode | {
|
|
38
|
+
path: BindingPath;
|
|
39
|
+
};
|
|
40
|
+
export interface Mount {
|
|
41
|
+
key: string;
|
|
42
|
+
surface: SurfaceName;
|
|
43
|
+
target: MountTarget;
|
|
44
|
+
display?: MountDisplay;
|
|
45
|
+
policy?: MountPolicy;
|
|
46
|
+
when?: WhenClause;
|
|
47
|
+
/** Relative paths inside this mount resolve against here. */
|
|
48
|
+
dataContext?: BindingPath;
|
|
49
|
+
order?: number;
|
|
50
|
+
}
|
|
51
|
+
/** How a surface arranges the several mounts it holds. */
|
|
52
|
+
export type LayoutName = 'single' | 'tabs' | 'stack' | 'split' | 'rail' | 'bar' | 'inline' | 'floating' | 'toast';
|
|
53
|
+
export interface SurfaceState {
|
|
54
|
+
/**
|
|
55
|
+
* Open, like `SurfaceName` and like `LayoutDefinition.name`. An application
|
|
56
|
+
* that registers a layout has to be able to put a surface into it, and the
|
|
57
|
+
* runtime never assumed a closed set anyway - `SurfaceArea` looks the name
|
|
58
|
+
* up in the registry and renders a diagnostic when nothing answers to it.
|
|
59
|
+
*/
|
|
60
|
+
layout: LayoutName | (string & {});
|
|
61
|
+
activeKey: string | null;
|
|
62
|
+
visible: boolean;
|
|
63
|
+
/** Cells along the surface's cross axis. Unset lets the shell decide. */
|
|
64
|
+
size?: number;
|
|
65
|
+
collapsed?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface SurfaceRegistry {
|
|
68
|
+
open(mount: Mount): Disposable;
|
|
69
|
+
close(surface: SurfaceName, key: string): void;
|
|
70
|
+
closeAll(surface: SurfaceName): void;
|
|
71
|
+
get(surface: SurfaceName, key: string): Mount | undefined;
|
|
72
|
+
mounts(surface: SurfaceName): Mount[];
|
|
73
|
+
activate(surface: SurfaceName, key: string): void;
|
|
74
|
+
state(surface: SurfaceName): SurfaceState;
|
|
75
|
+
setState(surface: SurfaceName, patch: Partial<SurfaceState>): void;
|
|
76
|
+
/** Resolve a resource's viewer and mount it. */
|
|
77
|
+
openResource(uri: string, options?: {
|
|
78
|
+
surface?: SurfaceName;
|
|
79
|
+
viewerId?: string;
|
|
80
|
+
mode?: 'view' | 'edit';
|
|
81
|
+
}): Promise<Disposable | null>;
|
|
82
|
+
}
|
|
83
|
+
/** A layout is a component that receives a surface's mounts and renders them. */
|
|
84
|
+
export interface LayoutDefinition {
|
|
85
|
+
name: LayoutName | (string & {});
|
|
86
|
+
/** Component name receiving `{ surface, mounts, state }`. */
|
|
87
|
+
component: string;
|
|
88
|
+
title?: string;
|
|
89
|
+
/** Surfaces this layout is offered for. Unset = all. */
|
|
90
|
+
surfaces?: SurfaceName[];
|
|
91
|
+
}
|
|
92
|
+
export interface LayoutRegistry {
|
|
93
|
+
register(def: LayoutDefinition): Disposable;
|
|
94
|
+
get(name: string): LayoutDefinition | undefined;
|
|
95
|
+
list(surface?: SurfaceName): LayoutDefinition[];
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/types/surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,MAAM,GACN,SAAS,GACT,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MA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,CAAC;IAChD,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
/**
|
|
3
|
+
* Syntax highlighting.
|
|
4
|
+
*
|
|
5
|
+
* A highlighter names *scopes*, never colours. The theme owns the palette, so
|
|
6
|
+
* one JSON highlighter looks right on a dark console, a paper report and a
|
|
7
|
+
* sixteen-colour terminal without knowing that any of them exist - and a
|
|
8
|
+
* colourless terminal simply resolves every scope to the default foreground.
|
|
9
|
+
*
|
|
10
|
+
* The scope list is closed on purpose. An open vocabulary means a theme can
|
|
11
|
+
* only guess what a highlighter will emit, and the guess is what produces the
|
|
12
|
+
* uncoloured token nobody can explain.
|
|
13
|
+
*/
|
|
14
|
+
export type SyntaxScope = 'plain' | 'keyword' | 'string' | 'number' | 'boolean' | 'null' | 'comment' | 'punctuation'
|
|
15
|
+
/** An object key, a column name, a field label - the left of a pair. */
|
|
16
|
+
| 'key' | 'operator' | 'type' | 'function' | 'tag' | 'attribute' | 'regexp' | 'escape'
|
|
17
|
+
/** Syntactically wrong. Worth seeing rather than hiding. */
|
|
18
|
+
| 'invalid';
|
|
19
|
+
export declare const SYNTAX_SCOPES: readonly SyntaxScope[];
|
|
20
|
+
/** A run of text with one scope. Never spans a newline. */
|
|
21
|
+
export interface SyntaxToken {
|
|
22
|
+
text: string;
|
|
23
|
+
scope: SyntaxScope;
|
|
24
|
+
}
|
|
25
|
+
/** A scored region of the source, before it is split into lines. */
|
|
26
|
+
export interface SyntaxSpan {
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
scope: SyntaxScope;
|
|
30
|
+
}
|
|
31
|
+
export interface HighlighterDefinition {
|
|
32
|
+
id: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
/** Resource kinds this claims: `file.data.json`, `log.stream`. */
|
|
35
|
+
kinds?: string[];
|
|
36
|
+
/** Filename globs, for when nothing has classified the resource yet. */
|
|
37
|
+
extensions?: string[];
|
|
38
|
+
/** Higher wins when several match. */
|
|
39
|
+
priority?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Tokenise a whole document into one array per line.
|
|
42
|
+
*
|
|
43
|
+
* The result must have exactly as many entries as `text.split('\n')`, and
|
|
44
|
+
* the tokens on each line must join back to that line. The registry checks
|
|
45
|
+
* both and falls back to plain text rather than paint a file that no longer
|
|
46
|
+
* lines up with its own gutter.
|
|
47
|
+
*/
|
|
48
|
+
tokenize(text: string): SyntaxToken[][];
|
|
49
|
+
}
|
|
50
|
+
export interface SyntaxQuery {
|
|
51
|
+
/** Resource kind, when the resource has been classified. */
|
|
52
|
+
kind?: string;
|
|
53
|
+
/** URI or filename, matched against `extensions`. */
|
|
54
|
+
uri?: string;
|
|
55
|
+
/** An explicit highlighter id, which wins over everything. */
|
|
56
|
+
language?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SyntaxRegistry {
|
|
59
|
+
register(def: HighlighterDefinition): Disposable;
|
|
60
|
+
unregister(id: string): void;
|
|
61
|
+
get(id: string): HighlighterDefinition | undefined;
|
|
62
|
+
list(): HighlighterDefinition[];
|
|
63
|
+
/** The best highlighter for this resource, or undefined. */
|
|
64
|
+
find(query: SyntaxQuery): HighlighterDefinition | undefined;
|
|
65
|
+
/** Tokenise, falling back to one plain token per line. */
|
|
66
|
+
tokenize(text: string, query?: SyntaxQuery): SyntaxToken[][];
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=syntax.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../../src/types/syntax.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,SAAS,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ACnD,IAAI,IAAI,qBAAqB,EAAE,CAAC;IAChC,4DAA4D;IAC5D,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAC5D,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,EAAE,CAAC;CAC9D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
import type { Size } from './geometry.js';
|
|
3
|
+
import type { TerminalCapabilities, CapabilityOverrides } from './capabilities.js';
|
|
4
|
+
import type { InputEvent } from './input.js';
|
|
5
|
+
/**
|
|
6
|
+
* Which capabilities the session wants turned on. The adapter records what it
|
|
7
|
+
* actually acquired, and `release` undoes exactly that and nothing else -
|
|
8
|
+
* which is the whole difference between a managed session and an embedded one.
|
|
9
|
+
*/
|
|
10
|
+
export interface TerminalSessionOptions {
|
|
11
|
+
/** TextUI owns setup and teardown of the terminal. */
|
|
12
|
+
managed?: boolean;
|
|
13
|
+
altScreen?: boolean;
|
|
14
|
+
mouse?: boolean;
|
|
15
|
+
wheel?: boolean;
|
|
16
|
+
focusEvents?: boolean;
|
|
17
|
+
paste?: boolean;
|
|
18
|
+
hideCursor?: boolean;
|
|
19
|
+
/** Kitty keyboard disambiguation, when available. */
|
|
20
|
+
enhancedKeys?: boolean;
|
|
21
|
+
title?: string;
|
|
22
|
+
}
|
|
23
|
+
/** What the adapter actually turned on, so release is exact. */
|
|
24
|
+
export interface AcquiredState {
|
|
25
|
+
altScreen: boolean;
|
|
26
|
+
mouse: boolean;
|
|
27
|
+
wheel: boolean;
|
|
28
|
+
focusEvents: boolean;
|
|
29
|
+
paste: boolean;
|
|
30
|
+
cursorHidden: boolean;
|
|
31
|
+
enhancedKeys: boolean;
|
|
32
|
+
rawMode: boolean;
|
|
33
|
+
titleSet: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface TerminalAdapter extends Disposable {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
size(): Size;
|
|
38
|
+
capabilities(): TerminalCapabilities;
|
|
39
|
+
/** Explicit overrides win over detection. */
|
|
40
|
+
setCapabilityOverrides(overrides: CapabilityOverrides): void;
|
|
41
|
+
acquire(options: TerminalSessionOptions): Promise<AcquiredState> | AcquiredState;
|
|
42
|
+
release(): Promise<void> | void;
|
|
43
|
+
readonly acquired: AcquiredState | null;
|
|
44
|
+
write(data: string): void;
|
|
45
|
+
flush(): Promise<void> | void;
|
|
46
|
+
onInput(fn: (event: InputEvent) => void): Disposable;
|
|
47
|
+
onResize(fn: (size: Size) => void): Disposable;
|
|
48
|
+
/** OSC 52, when the terminal allows it. */
|
|
49
|
+
writeClipboard?(text: string): void;
|
|
50
|
+
setTitle?(title: string): void;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/types/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qDAAqD;IACrD,YAAY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