@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 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/core/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,YAAY,EAC1E,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EACjE,0BAA0B,EAAE,wBAAwB,EACrD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MA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
+
const i = uri.indexOf(':');
|
|
5
|
+
return i === -1 ? 'file' : uri.slice(0, i);
|
|
6
|
+
}
|
|
7
|
+
function matchesGlob(name, pattern) {
|
|
8
|
+
if (pattern.startsWith('*.'))
|
|
9
|
+
return name.toLowerCase().endsWith(pattern.slice(1).toLowerCase());
|
|
10
|
+
return name.toLowerCase() === pattern.toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The resource model.
|
|
14
|
+
*
|
|
15
|
+
* A resource is anything addressable that something can be registered to
|
|
16
|
+
* display, edit or act on - a file, a record, a log stream, a service. The
|
|
17
|
+
* filesystem is one provider among several rather than the model itself, which
|
|
18
|
+
* is what lets an explorer browse services and files with the same component.
|
|
19
|
+
*
|
|
20
|
+
* Kinds form a hierarchy by dotted name: `file.markdown` specialises
|
|
21
|
+
* `file.text`, so a viewer registered for `file.text` still opens a markdown
|
|
22
|
+
* file when no more specific one exists.
|
|
23
|
+
*/
|
|
24
|
+
export class Resources {
|
|
25
|
+
deps;
|
|
26
|
+
kindDefs = new Map();
|
|
27
|
+
providers = new Map();
|
|
28
|
+
viewers = [];
|
|
29
|
+
editors = [];
|
|
30
|
+
actions = [];
|
|
31
|
+
constructor(deps) {
|
|
32
|
+
this.deps = deps;
|
|
33
|
+
}
|
|
34
|
+
registerKind(kind) {
|
|
35
|
+
this.kindDefs.set(kind.id, kind);
|
|
36
|
+
return toDisposable(() => this.kindDefs.delete(kind.id));
|
|
37
|
+
}
|
|
38
|
+
registerProvider(provider) {
|
|
39
|
+
this.providers.set(provider.scheme, provider);
|
|
40
|
+
return toDisposable(() => this.providers.delete(provider.scheme));
|
|
41
|
+
}
|
|
42
|
+
registerViewer(def) {
|
|
43
|
+
this.viewers.push(def);
|
|
44
|
+
return toDisposable(() => {
|
|
45
|
+
const i = this.viewers.indexOf(def);
|
|
46
|
+
if (i >= 0)
|
|
47
|
+
this.viewers.splice(i, 1);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
registerEditor(def) {
|
|
51
|
+
this.editors.push(def);
|
|
52
|
+
return toDisposable(() => {
|
|
53
|
+
const i = this.editors.indexOf(def);
|
|
54
|
+
if (i >= 0)
|
|
55
|
+
this.editors.splice(i, 1);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
registerAction(def) {
|
|
59
|
+
this.actions.push(def);
|
|
60
|
+
return toDisposable(() => {
|
|
61
|
+
const i = this.actions.indexOf(def);
|
|
62
|
+
if (i >= 0)
|
|
63
|
+
this.actions.splice(i, 1);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
kinds() {
|
|
67
|
+
return [...this.kindDefs.values()];
|
|
68
|
+
}
|
|
69
|
+
/** Extension, then mime type, then an explicit `detect`. Best match wins. */
|
|
70
|
+
detectKind(uri, meta = { name: uri }) {
|
|
71
|
+
const name = meta.name || nameOf(uri) || uri;
|
|
72
|
+
const candidates = [];
|
|
73
|
+
for (const kind of this.kindDefs.values()) {
|
|
74
|
+
let score = kind.priority ?? 0;
|
|
75
|
+
let matched = false;
|
|
76
|
+
if (kind.extensions?.some((p) => matchesGlob(name, p))) {
|
|
77
|
+
score += 100;
|
|
78
|
+
matched = true;
|
|
79
|
+
}
|
|
80
|
+
if (meta.mimeType && kind.mimeTypes?.includes(meta.mimeType)) {
|
|
81
|
+
score += 80;
|
|
82
|
+
matched = true;
|
|
83
|
+
}
|
|
84
|
+
if (kind.detect?.(uri, meta)) {
|
|
85
|
+
score += 200;
|
|
86
|
+
matched = true;
|
|
87
|
+
}
|
|
88
|
+
// A more specific kind beats its parent on equal evidence.
|
|
89
|
+
if (matched) {
|
|
90
|
+
score += kind.id.split('.').length;
|
|
91
|
+
candidates.push({ id: kind.id, score });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (candidates.length === 0)
|
|
95
|
+
return meta.mimeType ? 'file' : 'unknown';
|
|
96
|
+
candidates.sort((a, b) => b.score - a.score);
|
|
97
|
+
return candidates[0].id;
|
|
98
|
+
}
|
|
99
|
+
kindMatches(kind, ancestor) {
|
|
100
|
+
if (kind === ancestor)
|
|
101
|
+
return true;
|
|
102
|
+
if (kind.startsWith(ancestor + '.'))
|
|
103
|
+
return true;
|
|
104
|
+
let cursor = this.kindDefs.get(kind);
|
|
105
|
+
const seen = new Set();
|
|
106
|
+
while (cursor?.extends && !seen.has(cursor.id)) {
|
|
107
|
+
seen.add(cursor.id);
|
|
108
|
+
if (cursor.extends === ancestor)
|
|
109
|
+
return true;
|
|
110
|
+
cursor = this.kindDefs.get(cursor.extends);
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
provider(uri) {
|
|
115
|
+
const scheme = schemeOf(uri);
|
|
116
|
+
const provider = this.providers.get(scheme);
|
|
117
|
+
if (!provider) {
|
|
118
|
+
throw new Error(`[textui] no resource provider registered for "${scheme}:"`);
|
|
119
|
+
}
|
|
120
|
+
return provider;
|
|
121
|
+
}
|
|
122
|
+
async stat(uri) {
|
|
123
|
+
const resource = await this.provider(uri).stat(uri);
|
|
124
|
+
if (!resource)
|
|
125
|
+
return null;
|
|
126
|
+
// A provider may leave classification to the registry.
|
|
127
|
+
if (!resource.kind || resource.kind === 'unknown') {
|
|
128
|
+
return { ...resource, kind: this.detectKind(uri, resource.metadata) };
|
|
129
|
+
}
|
|
130
|
+
return resource;
|
|
131
|
+
}
|
|
132
|
+
async list(uri) {
|
|
133
|
+
const provider = this.provider(uri);
|
|
134
|
+
if (!provider.list)
|
|
135
|
+
return [];
|
|
136
|
+
const items = await provider.list(uri);
|
|
137
|
+
return items.map((r) => r.kind && r.kind !== 'unknown' ? r : { ...r, kind: this.detectKind(r.uri, r.metadata) });
|
|
138
|
+
}
|
|
139
|
+
async read(uri) {
|
|
140
|
+
const provider = this.provider(uri);
|
|
141
|
+
if (!provider.read)
|
|
142
|
+
throw new Error(`[textui] "${schemeOf(uri)}:" cannot be read`);
|
|
143
|
+
return provider.read(uri);
|
|
144
|
+
}
|
|
145
|
+
async write(uri, content) {
|
|
146
|
+
const provider = this.provider(uri);
|
|
147
|
+
if (!provider.write)
|
|
148
|
+
throw new Error(`[textui] "${schemeOf(uri)}:" is read-only`);
|
|
149
|
+
return provider.write(uri, content);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Destructive calls throw when the provider cannot serve them, the same way
|
|
153
|
+
* `write` does. A silent no-op is the failure mode worth designing against:
|
|
154
|
+
* a Delete that appears in the menu and removes nothing is worse than one
|
|
155
|
+
* that says it cannot.
|
|
156
|
+
*
|
|
157
|
+
* Whether to *offer* the action is a different question, answered before
|
|
158
|
+
* the call by `Resource.capabilities` - which is per resource rather than
|
|
159
|
+
* per provider, so a read-only mount, a file without permission and an
|
|
160
|
+
* inherently immutable resource are all the same shape. The throw is for
|
|
161
|
+
* the race that asking first cannot close: the remote goes away, the
|
|
162
|
+
* permission changes, between the offer and the call.
|
|
163
|
+
*/
|
|
164
|
+
async delete(uri) {
|
|
165
|
+
const provider = this.provider(uri);
|
|
166
|
+
if (!provider.delete)
|
|
167
|
+
throw new Error(`[textui] "${schemeOf(uri)}:" cannot delete`);
|
|
168
|
+
return provider.delete(uri);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A rename is within one provider. Two schemes is a move between providers,
|
|
172
|
+
* which is a copy and a delete and belongs above a registry that dispatches
|
|
173
|
+
* on a single scheme by construction.
|
|
174
|
+
*/
|
|
175
|
+
async rename(from, to) {
|
|
176
|
+
const scheme = schemeOf(from);
|
|
177
|
+
if (schemeOf(to) !== scheme) {
|
|
178
|
+
throw new Error(`[textui] cannot rename across schemes: "${scheme}:" to "${schemeOf(to)}:"`);
|
|
179
|
+
}
|
|
180
|
+
const provider = this.provider(from);
|
|
181
|
+
if (!provider.rename)
|
|
182
|
+
throw new Error(`[textui] "${scheme}:" cannot rename`);
|
|
183
|
+
return provider.rename(from, to);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Watching follows `list` rather than `write`: a provider that cannot watch
|
|
187
|
+
* gets a disposable that does nothing, because "I will never tell you about
|
|
188
|
+
* a change" is a truthful answer to an optional question. Making every
|
|
189
|
+
* caller guard a subscription would buy nothing.
|
|
190
|
+
*/
|
|
191
|
+
watch(uri, fn) {
|
|
192
|
+
const provider = this.provider(uri);
|
|
193
|
+
return provider.watch?.(uri, fn) ?? toDisposable(() => { });
|
|
194
|
+
}
|
|
195
|
+
viewersFor(kind) {
|
|
196
|
+
const specific = this.viewers
|
|
197
|
+
.filter((v) => !v.fallback && v.kinds.some((k) => this.kindMatches(kind, k)))
|
|
198
|
+
.filter((v) => this.deps.when.evaluate(v.when))
|
|
199
|
+
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
200
|
+
const fallbacks = this.viewers
|
|
201
|
+
.filter((v) => v.fallback)
|
|
202
|
+
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
203
|
+
return [...specific, ...fallbacks];
|
|
204
|
+
}
|
|
205
|
+
editorsFor(kind) {
|
|
206
|
+
return this.editors
|
|
207
|
+
.filter((e) => e.kinds.some((k) => this.kindMatches(kind, k)))
|
|
208
|
+
.filter((e) => this.deps.when.evaluate(e.when))
|
|
209
|
+
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Every way of showing this kind, best first.
|
|
213
|
+
*
|
|
214
|
+
* Three registries answer the same question - an editor, a viewer and a
|
|
215
|
+
* component that declared `opens` are all "a component that can put this on
|
|
216
|
+
* screen" - and a panel offering "open with" wants one list. Saving is a
|
|
217
|
+
* property of the renderer here rather than the registry it came from, which
|
|
218
|
+
* is what lets `file.markdown` list an editor, a rendered view and plain
|
|
219
|
+
* text together and lets the panel pick between them.
|
|
220
|
+
*/
|
|
221
|
+
/**
|
|
222
|
+
* What a resource looks like in a list.
|
|
223
|
+
*
|
|
224
|
+
* Asked of the *renderer* first, because the thing that knows what a
|
|
225
|
+
* markdown file is is the thing that opens markdown files - so a viewer an
|
|
226
|
+
* extension brought names and colours its own kind without anything here
|
|
227
|
+
* learning what it is. Then the kind, walking up `extends`, since
|
|
228
|
+
* `file.markdown` inheriting Text's icon is better than inheriting nothing.
|
|
229
|
+
*
|
|
230
|
+
* Answers nothing rather than a default: what a nameless file looks like is
|
|
231
|
+
* the caller's vocabulary, because which glyphs a terminal can draw is known
|
|
232
|
+
* where the terminal is and not here.
|
|
233
|
+
*/
|
|
234
|
+
appearanceOf(resource) {
|
|
235
|
+
for (const renderer of this.renderersFor(resource.kind)) {
|
|
236
|
+
if (renderer.icon !== undefined || renderer.tone !== undefined) {
|
|
237
|
+
return {
|
|
238
|
+
...(renderer.icon !== undefined ? { icon: renderer.icon } : {}),
|
|
239
|
+
...(renderer.tone !== undefined ? { tone: renderer.tone } : {}),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const byId = new Map(this.kinds().map((k) => [k.id, k]));
|
|
244
|
+
// Bounded by the number of kinds: a cycle in `extends` is a bad
|
|
245
|
+
// registration and must not be an infinite loop in a list row.
|
|
246
|
+
const seen = new Set();
|
|
247
|
+
let kind = byId.get(resource.kind);
|
|
248
|
+
while (kind && !seen.has(kind.id)) {
|
|
249
|
+
seen.add(kind.id);
|
|
250
|
+
if (kind.icon !== undefined || kind.tone !== undefined) {
|
|
251
|
+
return {
|
|
252
|
+
...(kind.icon !== undefined ? { icon: kind.icon } : {}),
|
|
253
|
+
...(kind.tone !== undefined ? { tone: kind.tone } : {}),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
kind = kind.extends === undefined ? undefined : byId.get(kind.extends);
|
|
257
|
+
}
|
|
258
|
+
return {};
|
|
259
|
+
}
|
|
260
|
+
renderersFor(kind) {
|
|
261
|
+
const seen = new Set();
|
|
262
|
+
const out = [];
|
|
263
|
+
const add = (def) => {
|
|
264
|
+
if (seen.has(def.id))
|
|
265
|
+
return;
|
|
266
|
+
seen.add(def.id);
|
|
267
|
+
out.push(def);
|
|
268
|
+
};
|
|
269
|
+
for (const e of this.editorsFor(kind))
|
|
270
|
+
add({ ...e, saves: true });
|
|
271
|
+
for (const v of this.viewersFor(kind))
|
|
272
|
+
add({ ...v, saves: false });
|
|
273
|
+
for (const c of this.deps.components.findOpeners(kind)) {
|
|
274
|
+
add({
|
|
275
|
+
id: c.component,
|
|
276
|
+
title: c.opens?.title ?? c.component,
|
|
277
|
+
kinds: c.opens?.resourceKinds ?? [],
|
|
278
|
+
component: c.component,
|
|
279
|
+
...(c.opens?.icon !== undefined ? { icon: c.opens.icon } : {}),
|
|
280
|
+
...(c.opens?.priority !== undefined ? { priority: c.opens.priority } : {}),
|
|
281
|
+
saves: c.opens?.mode === 'edit',
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return out.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
285
|
+
}
|
|
286
|
+
actionsFor(kind, slot) {
|
|
287
|
+
return this.actions
|
|
288
|
+
.filter((a) => a.kinds.some((k) => this.kindMatches(kind, k) || k === '*'))
|
|
289
|
+
.filter((a) => !slot || (a.slots ?? ['context']).includes(slot))
|
|
290
|
+
.filter((a) => this.deps.when.evaluate(a.when))
|
|
291
|
+
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The node that displays this resource. An explicit `viewerId` wins; then a
|
|
295
|
+
* registered editor when edit was asked for; then the best viewer; then a
|
|
296
|
+
* component that declared `opens` for this kind; then nothing.
|
|
297
|
+
*/
|
|
298
|
+
nodeFor(resource, options = {}) {
|
|
299
|
+
const props = { resource, uri: resource.uri };
|
|
300
|
+
if (options.viewerId) {
|
|
301
|
+
const chosen = this.viewers.find((v) => v.id === options.viewerId) ??
|
|
302
|
+
this.editors.find((e) => e.id === options.viewerId);
|
|
303
|
+
return chosen ? { component: chosen.component, ...props } : null;
|
|
304
|
+
}
|
|
305
|
+
if (options.mode === 'edit') {
|
|
306
|
+
const editor = this.editorsFor(resource.kind)[0];
|
|
307
|
+
if (editor)
|
|
308
|
+
return { component: editor.component, ...props };
|
|
309
|
+
}
|
|
310
|
+
const viewer = this.viewersFor(resource.kind)[0];
|
|
311
|
+
if (viewer)
|
|
312
|
+
return { component: viewer.component, ...props };
|
|
313
|
+
const opener = this.deps.components.findOpeners(resource.kind)[0];
|
|
314
|
+
if (opener)
|
|
315
|
+
return { component: opener.component, ...props };
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
export function createResources(deps) {
|
|
320
|
+
return new Resources(deps);
|
|
321
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ServiceContainer, ServiceKey } from '../types/services.js';
|
|
2
|
+
import type { Disposable } from '../types/disposable.js';
|
|
3
|
+
/**
|
|
4
|
+
* A typed lookup table, not a dependency-injection container. No lifecycles,
|
|
5
|
+
* no scoping rules, no auto-wiring - a child falls back to its parent and that
|
|
6
|
+
* is the whole of it.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Services implements ServiceContainer {
|
|
9
|
+
private parent;
|
|
10
|
+
private values;
|
|
11
|
+
private factories;
|
|
12
|
+
constructor(parent?: ServiceContainer | null);
|
|
13
|
+
provide<T>(key: ServiceKey<T>, value: T): Disposable;
|
|
14
|
+
provideLazy<T>(key: ServiceKey<T>, factory: () => T): Disposable;
|
|
15
|
+
get<T>(key: ServiceKey<T>): T | undefined;
|
|
16
|
+
require<T>(key: ServiceKey<T>): T;
|
|
17
|
+
has<T>(key: ServiceKey<T>): boolean;
|
|
18
|
+
child(): ServiceContainer;
|
|
19
|
+
}
|
|
20
|
+
export declare function createServices(parent?: ServiceContainer): Services;
|
|
21
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/core/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;;;GAIG;AACH,qBAAa,QAAS,YAAW,gBAAgB;IAInC,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,SAAS,CAAoC;gBAEjC,MAAM,GAAE,gBAAgB,GAAG,IAAW;IAE1D,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU;IAepD,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,UAAU;IAQhE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAWzC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;IAQjC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO;IAInC,KAAK,IAAI,gBAAgB;CAG1B;AAED,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,QAAQ,CAElE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { toDisposable } from '../util/disposable.js';
|
|
2
|
+
/**
|
|
3
|
+
* A typed lookup table, not a dependency-injection container. No lifecycles,
|
|
4
|
+
* no scoping rules, no auto-wiring - a child falls back to its parent and that
|
|
5
|
+
* is the whole of it.
|
|
6
|
+
*/
|
|
7
|
+
export class Services {
|
|
8
|
+
parent;
|
|
9
|
+
values = new Map();
|
|
10
|
+
factories = new Map();
|
|
11
|
+
constructor(parent = null) {
|
|
12
|
+
this.parent = parent;
|
|
13
|
+
}
|
|
14
|
+
provide(key, value) {
|
|
15
|
+
this.values.set(key.id, value);
|
|
16
|
+
return toDisposable(() => {
|
|
17
|
+
// Only if nothing has replaced it since.
|
|
18
|
+
//
|
|
19
|
+
// Two providers for one key overlap whenever one mounts before the other
|
|
20
|
+
// unmounts - which is the ordinary case for anything provided by the
|
|
21
|
+
// *focused* control, since focus arrives at the new one before it leaves
|
|
22
|
+
// the old. Deleting unconditionally took the live provider out along
|
|
23
|
+
// with the stale one, and left the key answering `undefined` while
|
|
24
|
+
// something was still very much providing it.
|
|
25
|
+
if (this.values.get(key.id) === value)
|
|
26
|
+
this.values.delete(key.id);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
provideLazy(key, factory) {
|
|
30
|
+
this.factories.set(key.id, factory);
|
|
31
|
+
return toDisposable(() => {
|
|
32
|
+
this.factories.delete(key.id);
|
|
33
|
+
this.values.delete(key.id);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
get(key) {
|
|
37
|
+
if (this.values.has(key.id))
|
|
38
|
+
return this.values.get(key.id);
|
|
39
|
+
const factory = this.factories.get(key.id);
|
|
40
|
+
if (factory) {
|
|
41
|
+
const value = factory();
|
|
42
|
+
this.values.set(key.id, value);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
return this.parent?.get(key);
|
|
46
|
+
}
|
|
47
|
+
require(key) {
|
|
48
|
+
const value = this.get(key);
|
|
49
|
+
if (value === undefined) {
|
|
50
|
+
throw new Error(`[textui] no service provided for "${key.id}"`);
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
has(key) {
|
|
55
|
+
return this.values.has(key.id) || this.factories.has(key.id) || (this.parent?.has(key) ?? false);
|
|
56
|
+
}
|
|
57
|
+
child() {
|
|
58
|
+
return new Services(this);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function createServices(parent) {
|
|
62
|
+
return new Services(parent ?? null);
|
|
63
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ChangeRecord, CollectionOps, ComputedDefinition, DataProviderDefinition, PathSchema, PersistenceAdapter, ReactiveStore, ScopeName, SubscribeOptions } from '../types/store.js';
|
|
2
|
+
import type { BindingPath } from '../types/graph.js';
|
|
3
|
+
import type { Disposable } from '../types/disposable.js';
|
|
4
|
+
/**
|
|
5
|
+
* The store is one tree, and it is the only place state lives. A component
|
|
6
|
+
* that keeps a copy in its own state has created a second answer to a question
|
|
7
|
+
* the store already answers.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Store implements ReactiveStore {
|
|
10
|
+
private root;
|
|
11
|
+
private subs;
|
|
12
|
+
private computedByKey;
|
|
13
|
+
private computedDeps;
|
|
14
|
+
private providers;
|
|
15
|
+
private schemas;
|
|
16
|
+
private persistence;
|
|
17
|
+
private persistTimers;
|
|
18
|
+
private batchDepth;
|
|
19
|
+
private pending;
|
|
20
|
+
private disposed;
|
|
21
|
+
/** Thrown-away errors from listeners would hide bugs; collect and report. */
|
|
22
|
+
onError: (err: unknown, context: string) => void;
|
|
23
|
+
get<T = unknown>(path: BindingPath): T | undefined;
|
|
24
|
+
read<T>(path: BindingPath, fallback: T): T;
|
|
25
|
+
has(path: BindingPath): boolean;
|
|
26
|
+
private readKey;
|
|
27
|
+
set(path: BindingPath, value: unknown): void;
|
|
28
|
+
update<T = unknown>(path: BindingPath, fn: (current: T | undefined) => T): void;
|
|
29
|
+
patch(path: BindingPath, partial: Record<string, unknown>): void;
|
|
30
|
+
patchMany(entries: Record<string, unknown>): void;
|
|
31
|
+
delete(path: BindingPath): void;
|
|
32
|
+
private writeKey;
|
|
33
|
+
batch<T>(fn: () => T): T;
|
|
34
|
+
private enqueue;
|
|
35
|
+
private flushIfIdle;
|
|
36
|
+
private notify;
|
|
37
|
+
private subMatches;
|
|
38
|
+
subscribe(path: BindingPath, fn: (value: unknown, change: ChangeRecord) => void, options?: SubscribeOptions): Disposable;
|
|
39
|
+
subscriberCount(scope: ScopeName | string): number;
|
|
40
|
+
clearScope(scope: ScopeName | string): void;
|
|
41
|
+
computed<T = unknown>(path: BindingPath, def: ComputedDefinition<T>): Disposable;
|
|
42
|
+
private recompute;
|
|
43
|
+
private recomputeDependents;
|
|
44
|
+
collection<T = unknown>(path: BindingPath): CollectionOps<T>;
|
|
45
|
+
registerDataProvider(def: DataProviderDefinition): Disposable;
|
|
46
|
+
listDataProviders(): DataProviderDefinition[];
|
|
47
|
+
/** A read or subscribe below a provider's namespace is what loads it. */
|
|
48
|
+
private touchProvider;
|
|
49
|
+
private loadProvider;
|
|
50
|
+
private maybeUnloadProvider;
|
|
51
|
+
registerSchema(schema: PathSchema): Disposable;
|
|
52
|
+
registerPersistence(adapter: PersistenceAdapter): Disposable;
|
|
53
|
+
hydrate(): Promise<void>;
|
|
54
|
+
private schedulePersist;
|
|
55
|
+
snapshot(scope?: ScopeName | string): Record<string, unknown>;
|
|
56
|
+
restore(snapshot: Record<string, unknown>): void;
|
|
57
|
+
dispose(): void;
|
|
58
|
+
}
|
|
59
|
+
export declare function createStore(): Store;
|
|
60
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,sBAAsB,EACvE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAC3E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA0BzD;;;;GAIG;AACH,qBAAa,KAAM,YAAW,aAAa;IACzC,OAAO,CAAC,IAAI,CAA+B;IAC3C,OAAO,CAAC,IAAI,CAA2B;IACvC,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,O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