@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,77 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
import type { ComponentNode, ErrorFallback } from './graph.js';
|
|
3
|
+
import type { WhenClause } from './when.js';
|
|
4
|
+
import type { CapabilityName } from './capabilities.js';
|
|
5
|
+
import type { FunctionComponent, HostComponent } from './render.js';
|
|
6
|
+
import type { Style } from './style.js';
|
|
7
|
+
export type ComponentCategory = 'layout' | 'display' | 'control' | 'form' | 'data' | 'navigation' | 'overlay' | 'feedback' | 'chart' | 'chrome' | 'resource' | 'template';
|
|
8
|
+
/** Late binding: a name, a category, and something that renders. */
|
|
9
|
+
export type ComponentRenderer = {
|
|
10
|
+
kind: 'function';
|
|
11
|
+
render: FunctionComponent;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'host';
|
|
14
|
+
host: HostComponent;
|
|
15
|
+
}
|
|
16
|
+
/** A component defined as data - the graph all the way down. */
|
|
17
|
+
| {
|
|
18
|
+
kind: 'template';
|
|
19
|
+
template: ComponentNode;
|
|
20
|
+
}
|
|
21
|
+
/** Loaded on first mount. The catalog costs a name until something uses it. */
|
|
22
|
+
| {
|
|
23
|
+
kind: 'lazy';
|
|
24
|
+
load: () => Promise<{
|
|
25
|
+
default: FunctionComponent;
|
|
26
|
+
} | FunctionComponent>;
|
|
27
|
+
};
|
|
28
|
+
export type PropsSchema = Record<string, string | readonly string[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Declares that this component can render a resource kind. `findOpeners`
|
|
31
|
+
* drives "Open with...", double-click in an explorer, and the resource picker.
|
|
32
|
+
*/
|
|
33
|
+
export interface ComponentOpensSpec {
|
|
34
|
+
resourceKinds?: string[];
|
|
35
|
+
selector?: WhenClause;
|
|
36
|
+
title?: string;
|
|
37
|
+
icon?: string;
|
|
38
|
+
priority?: number;
|
|
39
|
+
/** 'view' is read-only, 'edit' can write back. */
|
|
40
|
+
mode?: 'view' | 'edit';
|
|
41
|
+
}
|
|
42
|
+
export interface ComponentDefinition {
|
|
43
|
+
component: string;
|
|
44
|
+
renderer: ComponentRenderer;
|
|
45
|
+
category?: ComponentCategory;
|
|
46
|
+
description?: string;
|
|
47
|
+
propsSchema?: PropsSchema;
|
|
48
|
+
/** Variants this component understands, for the theme and the CLI. */
|
|
49
|
+
variants?: string[];
|
|
50
|
+
/** Rendered instead when this subtree throws. */
|
|
51
|
+
fallback?: ErrorFallback;
|
|
52
|
+
/** Degrades or refuses to mount without these. */
|
|
53
|
+
requires?: CapabilityName[];
|
|
54
|
+
/** Uses these when present, works without them. */
|
|
55
|
+
enhancedBy?: CapabilityName[];
|
|
56
|
+
opens?: ComponentOpensSpec;
|
|
57
|
+
/** Default style, merged under the theme's entry for this component. */
|
|
58
|
+
defaultStyle?: Style;
|
|
59
|
+
/** Semantic role, for the testing harness and future a11y integrations. */
|
|
60
|
+
role?: SemanticRole;
|
|
61
|
+
}
|
|
62
|
+
export type SemanticRole = 'button' | 'textbox' | 'checkbox' | 'radio' | 'slider' | 'switch' | 'dialog' | 'alertdialog' | 'menu' | 'menuitem' | 'list' | 'listitem' | 'tree' | 'treeitem' | 'table' | 'row' | 'cell' | 'columnheader' | 'tab' | 'tablist' | 'tabpanel' | 'link' | 'heading' | 'label' | 'progressbar' | 'status' | 'alert' | 'region' | 'group' | 'separator' | 'toolbar' | 'searchbox' | 'combobox' | 'option' | 'presentation' | 'log' | 'timer' | 'marquee' | 'tooltip' | 'banner' | 'main' | 'navigation' | 'document' | 'complementary' | 'contentinfo' | 'form' | 'grid' | 'gridcell' | 'meter';
|
|
63
|
+
export interface ComponentRegistry {
|
|
64
|
+
register(def: ComponentDefinition): Disposable;
|
|
65
|
+
registerMany(defs: ComponentDefinition[]): Disposable;
|
|
66
|
+
unregister(component: string): void;
|
|
67
|
+
get(component: string): ComponentDefinition | undefined;
|
|
68
|
+
has(component: string): boolean;
|
|
69
|
+
list(category?: ComponentCategory): ComponentDefinition[];
|
|
70
|
+
/** Resolve a lazy renderer. Idempotent, cached. */
|
|
71
|
+
resolve(component: string): Promise<ComponentDefinition>;
|
|
72
|
+
/** Names registered but not yet resolved. */
|
|
73
|
+
pending(): string[];
|
|
74
|
+
/** Components whose `opens` accepts this kind, best first. */
|
|
75
|
+
findOpeners(resourceKind: string): ComponentDefinition[];
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=component-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/types/component-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,C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EAAE,mBAAmB,GAAG,UAAU,CAAC;IAC/C,YAAY,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,UAAU,CAAC;IACtD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAAC;IACxD,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,IAAI,CAAC,QAAQ,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAAC;IAC1D,mDAAmD;IACnD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACzD,6CAA6C;IAC7C,OAAO,IAAI,MAAM,EAAE,CAAC;IACpB,8DAA8D;IAC9D,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface Disposable {
|
|
2
|
+
dispose(): void;
|
|
3
|
+
}
|
|
4
|
+
/** A disposable that owns other disposables. Dispose once, dispose all. */
|
|
5
|
+
export interface DisposableBag extends Disposable {
|
|
6
|
+
add<T extends Disposable>(d: T): T;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=disposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../../src/types/disposable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
import type { Rect } from './geometry.js';
|
|
3
|
+
import type { KeyEvent } from './input.js';
|
|
4
|
+
export type FocusDirection = 'next' | 'previous' | 'up' | 'down' | 'left' | 'right';
|
|
5
|
+
/**
|
|
6
|
+
* A focus scope is a container that focus can be trapped inside or restored
|
|
7
|
+
* to. Modals trap; a sidebar does not. Scopes nest, and the innermost active
|
|
8
|
+
* scope answers navigation first.
|
|
9
|
+
*/
|
|
10
|
+
export interface FocusScopeOptions {
|
|
11
|
+
id: string;
|
|
12
|
+
/** Tab cannot leave this scope while it is active. Modals want this. */
|
|
13
|
+
trap?: boolean;
|
|
14
|
+
/** Restore focus to whatever was focused before, on deactivate. */
|
|
15
|
+
restore?: boolean;
|
|
16
|
+
/** Focus this scope's first focusable as soon as it activates. */
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
/** Higher wins when two scopes are active. */
|
|
19
|
+
priority?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface FocusableOptions {
|
|
22
|
+
id: string;
|
|
23
|
+
/** Explicit order within the scope. Unset = document order. */
|
|
24
|
+
order?: number;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Skipped by tab, still reachable by directional navigation and click. */
|
|
27
|
+
skipTab?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Reads keys whether or not it is focused.
|
|
30
|
+
*
|
|
31
|
+
* For handlers that are not about one control - a screen's shortcuts, a
|
|
32
|
+
* layer that must see escape. A focusable without this only reads keys while
|
|
33
|
+
* it holds focus, which is what focus means.
|
|
34
|
+
*/
|
|
35
|
+
global?: boolean;
|
|
36
|
+
/** Current bounds, for directional navigation and mouse hit-testing. */
|
|
37
|
+
rect?: Rect;
|
|
38
|
+
scopeId?: string;
|
|
39
|
+
onFocus?(): void;
|
|
40
|
+
onBlur?(): void;
|
|
41
|
+
/** Return true to consume. Runs before the scope's and the app's handlers. */
|
|
42
|
+
onKey?(event: KeyEvent): boolean | void;
|
|
43
|
+
}
|
|
44
|
+
export interface FocusManager {
|
|
45
|
+
registerScope(options: FocusScopeOptions): Disposable;
|
|
46
|
+
activateScope(id: string): void;
|
|
47
|
+
deactivateScope(id: string): void;
|
|
48
|
+
activeScope(): string | null;
|
|
49
|
+
register(options: FocusableOptions): Disposable;
|
|
50
|
+
update(id: string, patch: Partial<FocusableOptions>): void;
|
|
51
|
+
/** True when a focusable with this id is registered. */
|
|
52
|
+
has(id: string): boolean;
|
|
53
|
+
/** Which scope a focusable belongs to. */
|
|
54
|
+
scopeOf(id: string): string;
|
|
55
|
+
focus(id: string): boolean;
|
|
56
|
+
blur(): void;
|
|
57
|
+
focused(): string | null;
|
|
58
|
+
/** Move focus; returns the id that took it. */
|
|
59
|
+
move(direction: FocusDirection): string | null;
|
|
60
|
+
/** The focused id and every ancestor scope, innermost first. */
|
|
61
|
+
chain(): string[];
|
|
62
|
+
/** Ids in tab order within a scope (or the active scope). */
|
|
63
|
+
order(scopeId?: string): string[];
|
|
64
|
+
/** Hit-test a cell; used for click-to-focus. */
|
|
65
|
+
at(x: number, y: number): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Feed a key to the focused node, then outward through its scopes, then to
|
|
68
|
+
* global handlers. Returns true when something consumed it.
|
|
69
|
+
*/
|
|
70
|
+
dispatch(event: KeyEvent): boolean;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/types/focus.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,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,MA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EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC;IACzB,+CAA+C;IAC/C,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/C,gEAAgE;IAChE,KAAK,IAAI,MAAM,EAAE,CAAC;IAClB,6DAA6D;IAC7D,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,gDAAgD;IAChD,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Terminal geometry is integral cells. Never fractional. */
|
|
2
|
+
export interface Point {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface Size {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Rect {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
/** padding / margin / border widths, in cells. */
|
|
17
|
+
export interface Edges {
|
|
18
|
+
top: number;
|
|
19
|
+
right: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
left: number;
|
|
22
|
+
}
|
|
23
|
+
export type EdgeSpec = number | [vertical: number, horizontal: number] | [top: number, horizontal: number, bottom: number] | [top: number, right: number, bottom: number, left: number] | Partial<Edges>;
|
|
24
|
+
export declare const ZERO_EDGES: Edges;
|
|
25
|
+
export declare function rectContains(r: Rect, x: number, y: number): boolean;
|
|
26
|
+
export declare function rectIntersect(a: Rect, b: Rect): Rect;
|
|
27
|
+
export declare function rectEquals(a: Rect, b: Rect): boolean;
|
|
28
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/types/geometry.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,kDAAkD;AAClD,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,GACtC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACjD,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAC1D,OAAO,CAAC,KAAK,CAAC,CAAC;AAEnB,eAAO,MAAM,UAAU,EAAE,KAAgD,CAAC;AAE1E,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAMpD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAEpD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const ZERO_EDGES = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
2
|
+
export function rectContains(r, x, y) {
|
|
3
|
+
return x >= r.x && x < r.x + r.width && y >= r.y && y < r.y + r.height;
|
|
4
|
+
}
|
|
5
|
+
export function rectIntersect(a, b) {
|
|
6
|
+
const x = Math.max(a.x, b.x);
|
|
7
|
+
const y = Math.max(a.y, b.y);
|
|
8
|
+
const right = Math.min(a.x + a.width, b.x + b.width);
|
|
9
|
+
const bottom = Math.min(a.y + a.height, b.y + b.height);
|
|
10
|
+
return { x, y, width: Math.max(0, right - x), height: Math.max(0, bottom - y) };
|
|
11
|
+
}
|
|
12
|
+
export function rectEquals(a, b) {
|
|
13
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
14
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component graph.
|
|
3
|
+
*
|
|
4
|
+
* A screen IS its root ComponentNode. JSX compiles to exactly this shape -
|
|
5
|
+
* `<Row gap={1}/>` and `{ component: 'Row', gap: 1 }` are the same value - so
|
|
6
|
+
* a screen can be written in TypeScript, loaded from JSON, generated, edited
|
|
7
|
+
* or sent over a wire without changing the runtime that mounts it.
|
|
8
|
+
*
|
|
9
|
+
* Three keys are reserved on every node: `id`, `component`, `$meta`.
|
|
10
|
+
* Everything else is props, and props are the component's business.
|
|
11
|
+
*/
|
|
12
|
+
export type NodeId = string;
|
|
13
|
+
/**
|
|
14
|
+
* JSON-Pointer-shaped store path.
|
|
15
|
+
*
|
|
16
|
+
* `$/seg/seg` - absolute; the first segment is a scope.
|
|
17
|
+
* `/seg/seg` - relative to the surrounding data context.
|
|
18
|
+
* `..` - forbidden. Escape to the root with `$/` instead, so a node's
|
|
19
|
+
* meaning never depends on where it was pasted.
|
|
20
|
+
* `*` - wildcard segment, subscriptions only (writes throw).
|
|
21
|
+
* `#/seg` - the value AT this path is itself a path; one extra hop.
|
|
22
|
+
* `{{ /seg }}` inside a path substitutes another path's value first.
|
|
23
|
+
*/
|
|
24
|
+
export type BindingPath = `$/${string}` | `/${string}`;
|
|
25
|
+
/**
|
|
26
|
+
* Transient event path. Same shape, different lifetime: events are delivered
|
|
27
|
+
* and forgotten, never stored. `@/dialog/confirm`, `@/agent/restart`.
|
|
28
|
+
*/
|
|
29
|
+
export type EventPath = `@/${string}`;
|
|
30
|
+
export type DataBinding = {
|
|
31
|
+
path: BindingPath;
|
|
32
|
+
};
|
|
33
|
+
export type FunctionCall = {
|
|
34
|
+
call: string;
|
|
35
|
+
args?: Record<string, PropValue>;
|
|
36
|
+
/** Refuse to route this to a remote dispatcher. */
|
|
37
|
+
callableFrom?: 'clientOnly';
|
|
38
|
+
};
|
|
39
|
+
export type DynamicValue = string | number | boolean | string[] | DataBinding | FunctionCall;
|
|
40
|
+
export type DynamicString = string | DataBinding | FunctionCall;
|
|
41
|
+
export type DynamicNumber = number | DataBinding | FunctionCall;
|
|
42
|
+
export type DynamicBoolean = boolean | DataBinding | FunctionCall;
|
|
43
|
+
export type DynamicStringList = string[] | DataBinding | FunctionCall;
|
|
44
|
+
/** Inline children, or one instance of `template` per item at `path`. */
|
|
45
|
+
export type ChildList = ComponentNode[] | {
|
|
46
|
+
template: ComponentNode;
|
|
47
|
+
path: BindingPath;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Discriminated by key presence:
|
|
51
|
+
* 'emit' in action -> publish on an event path
|
|
52
|
+
* 'functionCall' in action -> run a registered command
|
|
53
|
+
* 'handler' in action -> a closure. Never serializable; only legal for
|
|
54
|
+
* nodes built in-process (JSX), and stripped
|
|
55
|
+
* when a graph is exported.
|
|
56
|
+
*/
|
|
57
|
+
export type Action = {
|
|
58
|
+
emit: {
|
|
59
|
+
path: EventPath;
|
|
60
|
+
payload?: PropValue;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
functionCall: FunctionCall;
|
|
64
|
+
} | {
|
|
65
|
+
handler: (...args: any[]) => void;
|
|
66
|
+
};
|
|
67
|
+
export type PropValue = string | number | boolean | null | undefined | DataBinding | FunctionCall | Action | ComponentNode | ComponentNode[] | {
|
|
68
|
+
template: ComponentNode;
|
|
69
|
+
path: BindingPath;
|
|
70
|
+
} | {
|
|
71
|
+
[k: string]: PropValue;
|
|
72
|
+
} | PropValue[] | ((...args: any[]) => unknown);
|
|
73
|
+
/** What a component threw, and which component threw it. */
|
|
74
|
+
export interface RenderError {
|
|
75
|
+
/** The thrown value, whatever it was. */
|
|
76
|
+
error: unknown;
|
|
77
|
+
/** `error.message`, or the value stringified. */
|
|
78
|
+
message: string;
|
|
79
|
+
/** The component that threw. */
|
|
80
|
+
component: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* What to render when a component throws.
|
|
84
|
+
*
|
|
85
|
+
* A node keeps the graph data, and is handed the failure as the `error` and
|
|
86
|
+
* `errorMessage` props - so a registered `ErrorPanel` can show what happened
|
|
87
|
+
* without the registry holding a function. A function is for the local case,
|
|
88
|
+
* where the fallback wants the failure itself rather than two props.
|
|
89
|
+
*/
|
|
90
|
+
export type ErrorFallback = ComponentNode | ((failure: RenderError) => ComponentNode);
|
|
91
|
+
/** Internal only - stripped before a node is serialized back to a sender. */
|
|
92
|
+
export type NodeMeta = {
|
|
93
|
+
origin?: {
|
|
94
|
+
format: string;
|
|
95
|
+
version?: string;
|
|
96
|
+
sourceNodeId?: NodeId;
|
|
97
|
+
};
|
|
98
|
+
/** Rendered instead when this node's subtree throws. */
|
|
99
|
+
fallback?: ErrorFallback;
|
|
100
|
+
/** Set by the JSX factory for a function component, so the registry can
|
|
101
|
+
* resolve the same function without a name collision. */
|
|
102
|
+
fn?: unknown;
|
|
103
|
+
/** Source location, when the JSX transform provides one. */
|
|
104
|
+
source?: {
|
|
105
|
+
file: string;
|
|
106
|
+
line: number;
|
|
107
|
+
column: number;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export type ComponentNode = {
|
|
111
|
+
id?: NodeId;
|
|
112
|
+
component: string;
|
|
113
|
+
$meta?: NodeMeta;
|
|
114
|
+
/** Reconciliation identity among siblings. */
|
|
115
|
+
key?: string | number;
|
|
116
|
+
children?: PropValue | unknown;
|
|
117
|
+
[prop: string]: unknown;
|
|
118
|
+
};
|
|
119
|
+
/** A screen IS its root node. No separate {root, nodes} map. */
|
|
120
|
+
export type ScreenState = ComponentNode;
|
|
121
|
+
export declare function isComponentNode(v: unknown): v is ComponentNode;
|
|
122
|
+
export declare function isDataBinding(v: unknown): v is DataBinding;
|
|
123
|
+
export declare function isFunctionCall(v: unknown): v is FunctionCall;
|
|
124
|
+
export declare function isAction(v: unknown): v is Action;
|
|
125
|
+
export declare function isTemplatedChildren(v: unknown): v is {
|
|
126
|
+
template: ComponentNode;
|
|
127
|
+
path: BindingPath;
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/types/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,MAAM,EAAE,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE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ExC,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAK9D;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,WAAW,CAa1D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,CAM5D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAMhD;AAED,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,OAAO,GACT,CAAC,IAAI;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAMrD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function isComponentNode(v) {
|
|
2
|
+
return (typeof v === 'object' && v !== null &&
|
|
3
|
+
'component' in v && typeof v.component === 'string');
|
|
4
|
+
}
|
|
5
|
+
export function isDataBinding(v) {
|
|
6
|
+
// Exactly one key, because that is what the type says: `{ path }`. Testing
|
|
7
|
+
// only that `path` is present made a binding out of anything that happens to
|
|
8
|
+
// carry one - `{ kind: 'unix', path: '/tmp/room' }` is a socket address, and
|
|
9
|
+
// it was resolved against the store and thrown as a PathError instead. The
|
|
10
|
+
// shape is far too common to claim loosely: a route, a file entry, a config
|
|
11
|
+
// section. The old guard listed `component` and `template` as exceptions,
|
|
12
|
+
// which was this same problem met twice and patched twice.
|
|
13
|
+
return (typeof v === 'object' && v !== null &&
|
|
14
|
+
typeof v.path === 'string' &&
|
|
15
|
+
Object.keys(v).length === 1);
|
|
16
|
+
}
|
|
17
|
+
export function isFunctionCall(v) {
|
|
18
|
+
return (typeof v === 'object' && v !== null &&
|
|
19
|
+
'call' in v && typeof v.call === 'string' &&
|
|
20
|
+
!('component' in v));
|
|
21
|
+
}
|
|
22
|
+
export function isAction(v) {
|
|
23
|
+
return (typeof v === 'object' && v !== null &&
|
|
24
|
+
('emit' in v || 'functionCall' in v || 'handler' in v) &&
|
|
25
|
+
!('component' in v));
|
|
26
|
+
}
|
|
27
|
+
export function isTemplatedChildren(v) {
|
|
28
|
+
return (typeof v === 'object' && v !== null &&
|
|
29
|
+
'template' in v && 'path' in v &&
|
|
30
|
+
isComponentNode(v.template));
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
export type LocaleId = string;
|
|
3
|
+
export interface TranslationBundle {
|
|
4
|
+
locale: LocaleId;
|
|
5
|
+
/** Flat or nested; nested keys are addressed with dots. */
|
|
6
|
+
messages: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface I18n {
|
|
9
|
+
locale: LocaleId;
|
|
10
|
+
setLocale(locale: LocaleId): void;
|
|
11
|
+
register(bundle: TranslationBundle): Disposable;
|
|
12
|
+
locales(): LocaleId[];
|
|
13
|
+
/** Missing keys fall back to the fallback locale, then to the key itself. */
|
|
14
|
+
t(key: string, values?: Record<string, unknown>): string;
|
|
15
|
+
/** Intl-backed; TextUI does not reimplement formatting. */
|
|
16
|
+
number(value: number, options?: Intl.NumberFormatOptions): string;
|
|
17
|
+
date(value: Date | number, options?: Intl.DateTimeFormatOptions): string;
|
|
18
|
+
relative(value: number, unit: Intl.RelativeTimeFormatUnit): string;
|
|
19
|
+
list(items: string[], options?: Intl.ListFormatOptions): string;
|
|
20
|
+
plural(count: number, forms: Record<string, string>): string;
|
|
21
|
+
onChange(fn: (locale: LocaleId) => void): Disposable;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/types/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,MAAM,EA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
|
5
|
+
export * from './style.js';
|
|
6
|
+
export * from './theme.js';
|
|
7
|
+
export * from './graph.js';
|
|
8
|
+
export * from './store.js';
|
|
9
|
+
export * from './input.js';
|
|
10
|
+
export * from './focus.js';
|
|
11
|
+
export * from './when.js';
|
|
12
|
+
export * from './command.js';
|
|
13
|
+
export * from './keybinding.js';
|
|
14
|
+
export * from './render.js';
|
|
15
|
+
export * from './component-registry.js';
|
|
16
|
+
export * from './resource.js';
|
|
17
|
+
export * from './surface.js';
|
|
18
|
+
export * from './shell.js';
|
|
19
|
+
export * from './navigation.js';
|
|
20
|
+
export * from './layer.js';
|
|
21
|
+
export * from './async.js';
|
|
22
|
+
export * from './stream.js';
|
|
23
|
+
export * from './animation.js';
|
|
24
|
+
export * from './i18n.js';
|
|
25
|
+
export * from './terminal.js';
|
|
26
|
+
export * from './services.js';
|
|
27
|
+
export * from './manifest.js';
|
|
28
|
+
export * from './app.js';
|
|
29
|
+
export * from './syntax.js';
|
|
30
|
+
export * from './adapter.js';
|
|
31
|
+
export * from './markdown.js';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export * from './disposable.js';
|
|
2
|
+
export * from './geometry.js';
|
|
3
|
+
export * from './capabilities.js';
|
|
4
|
+
export * from './cells.js';
|
|
5
|
+
export * from './style.js';
|
|
6
|
+
export * from './theme.js';
|
|
7
|
+
export * from './graph.js';
|
|
8
|
+
export * from './store.js';
|
|
9
|
+
export * from './input.js';
|
|
10
|
+
export * from './focus.js';
|
|
11
|
+
export * from './when.js';
|
|
12
|
+
export * from './command.js';
|
|
13
|
+
export * from './keybinding.js';
|
|
14
|
+
export * from './render.js';
|
|
15
|
+
export * from './component-registry.js';
|
|
16
|
+
export * from './resource.js';
|
|
17
|
+
export * from './surface.js';
|
|
18
|
+
export * from './shell.js';
|
|
19
|
+
export * from './navigation.js';
|
|
20
|
+
export * from './layer.js';
|
|
21
|
+
export * from './async.js';
|
|
22
|
+
export * from './stream.js';
|
|
23
|
+
export * from './animation.js';
|
|
24
|
+
export * from './i18n.js';
|
|
25
|
+
export * from './terminal.js';
|
|
26
|
+
export * from './services.js';
|
|
27
|
+
export * from './manifest.js';
|
|
28
|
+
export * from './app.js';
|
|
29
|
+
export * from './syntax.js';
|
|
30
|
+
export * from './adapter.js';
|
|
31
|
+
export * from './markdown.js';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
export interface KeyModifiers {
|
|
3
|
+
ctrl: boolean;
|
|
4
|
+
alt: boolean;
|
|
5
|
+
shift: boolean;
|
|
6
|
+
meta: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Canonical key name. Printable keys carry the character itself; everything
|
|
10
|
+
* else uses these names, so a keybinding string is stable across terminals.
|
|
11
|
+
*/
|
|
12
|
+
export type KeyName = 'up' | 'down' | 'left' | 'right' | 'enter' | 'escape' | 'tab' | 'backspace' | 'delete' | 'space' | 'home' | 'end' | 'pageup' | 'pagedown' | 'insert' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | (string & {});
|
|
13
|
+
export interface KeyEvent {
|
|
14
|
+
type: 'key';
|
|
15
|
+
/** Canonical name, or the printable character. */
|
|
16
|
+
name: KeyName;
|
|
17
|
+
/** The character produced, when printable. */
|
|
18
|
+
char?: string;
|
|
19
|
+
ctrl: boolean;
|
|
20
|
+
alt: boolean;
|
|
21
|
+
shift: boolean;
|
|
22
|
+
meta: boolean;
|
|
23
|
+
/** Raw bytes, for adapters and diagnostics. */
|
|
24
|
+
raw: string;
|
|
25
|
+
/** Set by a handler to stop propagation up the focus chain. */
|
|
26
|
+
handled: boolean;
|
|
27
|
+
/** Kitty protocol only - press/repeat/release. */
|
|
28
|
+
kind?: 'press' | 'repeat' | 'release';
|
|
29
|
+
}
|
|
30
|
+
export type MouseButton = 'left' | 'middle' | 'right' | 'none';
|
|
31
|
+
export type MouseAction = 'down' | 'up' | 'move' | 'drag' | 'wheel';
|
|
32
|
+
export interface MouseEvent {
|
|
33
|
+
type: 'mouse';
|
|
34
|
+
action: MouseAction;
|
|
35
|
+
button: MouseButton;
|
|
36
|
+
/** Terminal cell coordinates, 0-based. */
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
/** Negative up, positive down. */
|
|
40
|
+
wheel?: number;
|
|
41
|
+
ctrl: boolean;
|
|
42
|
+
alt: boolean;
|
|
43
|
+
shift: boolean;
|
|
44
|
+
handled: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface PasteEvent {
|
|
47
|
+
type: 'paste';
|
|
48
|
+
text: string;
|
|
49
|
+
handled: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Terminal-level focus (the window), not component focus. */
|
|
52
|
+
export interface TerminalFocusEvent {
|
|
53
|
+
type: 'terminal-focus';
|
|
54
|
+
focused: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ResizeEvent {
|
|
57
|
+
type: 'resize';
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
}
|
|
61
|
+
export type InputEvent = KeyEvent | MouseEvent | PasteEvent | TerminalFocusEvent | ResizeEvent;
|
|
62
|
+
export interface InputSource extends Disposable {
|
|
63
|
+
on(fn: (event: InputEvent) => void): Disposable;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/types/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,OAAO,GACf,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAChC,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAC7D,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GACjD,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GACvC,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAA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;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAClB,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,kBAAkB,GAAG,WAAW,CAAC;AAE1E,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,UAAU,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Disposable } from './disposable.js';
|
|
2
|
+
import type { WhenClause } from './when.js';
|
|
3
|
+
import type { KeyEvent } from './input.js';
|
|
4
|
+
/**
|
|
5
|
+
* A chord string: `ctrl+p`, `ctrl+k ctrl+s` (a sequence), `shift+tab`, `g g`.
|
|
6
|
+
* Names match `KeyName`; modifiers are ctrl/alt/shift/meta in that order.
|
|
7
|
+
*/
|
|
8
|
+
export type Chord = string;
|
|
9
|
+
export interface KeybindingDefinition {
|
|
10
|
+
keys: Chord;
|
|
11
|
+
commandId: string;
|
|
12
|
+
args?: Record<string, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* What *this key* does, when the command's own title does not say it.
|
|
15
|
+
*
|
|
16
|
+
* A binding that carries arguments runs one invocation of a command, not the
|
|
17
|
+
* command: `ctrl+b` is "Toggle Sidebar" and the command is "Toggle Surface".
|
|
18
|
+
* Without this the shortcut sheet files the key under the general title and
|
|
19
|
+
* says something that is not true of the key.
|
|
20
|
+
*/
|
|
21
|
+
title?: string;
|
|
22
|
+
when?: WhenClause;
|
|
23
|
+
/** Only fires while this focus scope (or one inside it) is active. */
|
|
24
|
+
scopeId?: string;
|
|
25
|
+
/** Higher wins on conflict. Defaults to registration order. */
|
|
26
|
+
priority?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface KeybindingRegistry {
|
|
29
|
+
register(def: KeybindingDefinition): Disposable;
|
|
30
|
+
unregister(keys: Chord, commandId?: string): void;
|
|
31
|
+
list(): KeybindingDefinition[];
|
|
32
|
+
/**
|
|
33
|
+
* Chords bound to a command, for rendering hints next to menu rows.
|
|
34
|
+
*
|
|
35
|
+
* Argument-bearing bindings are left out: they run one invocation and not
|
|
36
|
+
* the command, so offering one as *the* key for the command's menu row
|
|
37
|
+
* names a key that does something else. Match on `args` through `list()`
|
|
38
|
+
* when the specific invocation is what is wanted.
|
|
39
|
+
*/
|
|
40
|
+
forCommand(commandId: string): Chord[];
|
|
41
|
+
/**
|
|
42
|
+
* Feed a key in. Returns 'handled', 'pending' (a prefix of a longer chord),
|
|
43
|
+
* or 'unhandled'.
|
|
44
|
+
*/
|
|
45
|
+
handle(event: KeyEvent): 'handled' | 'pending' | 'unhandled';
|
|
46
|
+
/** Abandon a partially typed chord. */
|
|
47
|
+
reset(): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=keybinding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keybinding.d.ts","sourceRoot":"","sources":["../../src/types/keybinding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,UAAU,CAAC;IAChD,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,IAAI,IAAI,oBAAoB,EAAE,CAAC;IAC/B;;;;;;;OAOG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAAC;IACvC;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC7D,uCAAuC;IACvC,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|