@acrylblends/blends-frame 0.1.0 → 0.1.2
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/lib/app-plugins.d.ts +32 -5
- package/lib/app-reload.d.ts +5 -4
- package/lib/applied-live.d.ts +43 -0
- package/lib/client.js +31886 -367
- package/lib/client.js.map +1 -1
- package/lib/contract.d.ts +116 -0
- package/lib/github-connect.d.ts +44 -0
- package/lib/graph-contract.d.ts +85 -0
- package/lib/graph-inspect.d.ts +16 -0
- package/lib/index.d.ts +20 -3
- package/lib/index.js +1188 -51
- package/lib/index.js.map +1 -1
- package/lib/plain.d.ts +26 -0
- package/lib/plugin-graph.d.ts +38 -0
- package/lib/registry.d.ts +71 -0
- package/lib/types/client/AppSection.d.ts +10 -0
- package/lib/types/client/BlendsFrame.d.ts +7 -1
- package/lib/types/client/GraphView.d.ts +22 -0
- package/lib/types/client/NameYourApp.d.ts +10 -0
- package/lib/types/client/PluginsSection.d.ts +11 -1
- package/lib/types/client/RegistryView.d.ts +11 -0
- package/lib/types/client/SettingsExpand.d.ts +6 -0
- package/lib/types/client/ShareChooser.d.ts +21 -0
- package/lib/types/client/desktop-app.d.ts +65 -0
- package/lib/types/client/graph-api.d.ts +11 -0
- package/lib/types/client/graph-canvas.d.ts +63 -0
- package/lib/types/client/graph-link.d.ts +21 -0
- package/lib/types/client/graph-model.d.ts +23 -0
- package/lib/types/client/graph-styles.d.ts +3 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/plain-failure.d.ts +10 -0
- package/lib/types/client/plugins-navigator.d.ts +37 -7
- package/lib/types/client/registry-api.d.ts +21 -0
- package/lib/types/client/registry-list.d.ts +14 -0
- package/lib/types/client/settings-fullscreen.d.ts +13 -0
- package/lib/types/client/theme-switch.d.ts +27 -0
- package/lib/types/contract.d.ts +116 -0
- package/lib/types/graph-contract.d.ts +85 -0
- package/lib/types/graph-inspect.d.ts +16 -0
- package/package.json +13 -9
package/lib/app-plugins.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* switch when its Loader row (`app-plugins`) loads again, which the client asks for.
|
|
6
6
|
*/
|
|
7
7
|
import { type PublishGitPort, type RepositoryHostPort } from '@webboxes/plugin-hub';
|
|
8
|
-
import { type AppPluginView, type FramePluginState, type FramePluginView, type SharedPluginView, type SharePlan } from './contract.ts';
|
|
8
|
+
import { type AppPluginView, type FramePluginState, type FramePluginView, type SavedPluginResult, type SavedPluginView, type ShareVisibility, type SharedPluginView, type SharePlan } from './contract.ts';
|
|
9
9
|
/** One row of `blend.yaml`'s `spec.rows`: where its block starts and ends (line indexes, end exclusive). */
|
|
10
10
|
export interface BlendRow {
|
|
11
11
|
readonly id: string;
|
|
@@ -49,7 +49,18 @@ export type RepositoryCheck = (url: string) => Promise<boolean | undefined>;
|
|
|
49
49
|
export declare const ghRepositoryCheck: RepositoryCheck;
|
|
50
50
|
/** The share records, each checked once: a repository GitHub says is gone is marked so, and the row offers a new share. */
|
|
51
51
|
export declare function checkedShares(records: Readonly<Record<string, SharedPluginView>>, check: RepositoryCheck): Promise<Record<string, SharedPluginView>>;
|
|
52
|
-
|
|
52
|
+
/** Where a plugin's code is: its folder (absolute) and its main file relative to the app's folder (absent when the file is outside the app). */
|
|
53
|
+
export interface PluginLocation {
|
|
54
|
+
readonly folder: string;
|
|
55
|
+
readonly main?: string;
|
|
56
|
+
}
|
|
57
|
+
/** A path inside `root` as a relative path with forward slashes, or undefined when it is outside. */
|
|
58
|
+
export declare function insideApp(root: string, file: string): string | undefined;
|
|
59
|
+
/** Where a plugin of `blend.yaml` or the frame has its code: a folder of the app's `plugins/`, else the package the app installed (read-only). */
|
|
60
|
+
export declare function pluginLocation(root: string, name: string): Promise<PluginLocation | undefined>;
|
|
61
|
+
/** The newest packed copy of each plugin kept in the app's plugin store, by name. An unreadable store lists nothing. */
|
|
62
|
+
export declare function savedCopies(storeRoot: string | undefined): ReadonlyMap<string, SavedPluginView>;
|
|
63
|
+
export declare function readAppPlugins(root: string, git: GitPort, sharedFile?: string, check?: RepositoryCheck, storeRoot?: string): Promise<AppPluginView[]>;
|
|
53
64
|
/**
|
|
54
65
|
* Switch one plugin in `blend.yaml`: a row (a library row, or one of the app's own plugins that has a row) gets or loses `disabled: true`; an own
|
|
55
66
|
* plugin without a row is put in or taken out of the `extensions` row's `off` list. @throws when there is no such plugin.
|
|
@@ -70,7 +81,7 @@ export declare function frameRowState(row: FrameRow): FramePluginState;
|
|
|
70
81
|
export declare function readFramePlugins(root: string, rows: readonly FrameRow[]): Promise<FramePluginView[]>;
|
|
71
82
|
/** The package.json a local plugin is shared with: the fields the builder's package_plugin writes (plugins/builder/index.ts), plus the Loader
|
|
72
83
|
* patch the plugin-hub's share requires so the package can also be installed as a row. */
|
|
73
|
-
export declare function pluginPackageManifest(name: string, description: string, version?: string): Record<string, unknown>;
|
|
84
|
+
export declare function pluginPackageManifest(name: string, description: string, version?: string, license?: string): Record<string, unknown>;
|
|
74
85
|
/**
|
|
75
86
|
* The shares this app completed, from its own home (`shared-plugins.json`). The record is written only after the hub's whole share succeeded: a
|
|
76
87
|
* package.json can name a repository before the release exists, because the hub prepares it before its guards, and a refused share must not look
|
|
@@ -82,15 +93,26 @@ export declare function recordShare(file: string, name: string, shared: SharedPl
|
|
|
82
93
|
/** Where the frame packages the plugins it shares: under the app's home, never in the app's folder, so a share leaves no file to save. */
|
|
83
94
|
export declare const pluginPackagesOf: (home: string) => string;
|
|
84
95
|
/** Copy one local plugin into its package folder under `packages`, the way the builder's package_plugin does; answers the folder. */
|
|
85
|
-
export declare function packageAppPlugin(root: string, name: string, packages: string): Promise<string>;
|
|
96
|
+
export declare function packageAppPlugin(root: string, name: string, packages: string, license?: string): Promise<string>;
|
|
86
97
|
/** Bump one package folder's patch version (what the hub asks for after a release), and answer the new version. */
|
|
87
98
|
export declare function bumpPackageVersion(dir: string): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Keep a packed copy of one local plugin on this machine: the plugin is packaged under the app's home as a share does, then put in the app's plugin
|
|
101
|
+
* store with its checksum. A version is stored once: when this version is already saved with other content, the version is raised (patch) and saved
|
|
102
|
+
* again, so a changed plugin never overwrites an earlier copy. Nothing leaves the machine.
|
|
103
|
+
*/
|
|
104
|
+
export declare function saveAppPlugin(root: string, home: string, name: string): Promise<SavedPluginResult>;
|
|
88
105
|
/** Where a share goes through: the user's own `gh` (the repository host) and `git`; a test passes stand-ins, so no test publishes. */
|
|
89
106
|
export interface SharePorts {
|
|
90
107
|
readonly host: RepositoryHostPort;
|
|
91
108
|
readonly git: PublishGitPort;
|
|
92
109
|
}
|
|
93
110
|
export declare const githubSharePorts: () => SharePorts;
|
|
111
|
+
/**
|
|
112
|
+
* The hub labels every release with the topics catalogs find a plugin by, and `cordis-plugin` is the one the registry's sync lists a public repository
|
|
113
|
+
* by. A share that was not asked to go to the registry must not put the repository there, so its host takes no topics; a registry share passes them on.
|
|
114
|
+
*/
|
|
115
|
+
export declare function listedOnlyWhenAsked(host: RepositoryHostPort, listed: boolean): RepositoryHostPort;
|
|
94
116
|
/** A completed share: where it went. */
|
|
95
117
|
export type ShareAppPluginResult = SharedPluginView & {
|
|
96
118
|
readonly owner: string;
|
|
@@ -100,10 +122,15 @@ export type ShareAppPluginResult = SharedPluginView & {
|
|
|
100
122
|
/**
|
|
101
123
|
* What sharing one local plugin would do, read without sending anything: it packages the plugin under the app's home and asks the host who is
|
|
102
124
|
* signed in, whether the repository exists and whether this version is released there (then the plan releases the next patch).
|
|
103
|
-
* @param options - the repository owner (the signed-in account when absent)
|
|
125
|
+
* @param options - the repository owner (the signed-in account when absent), the visibility the person asked for (private when absent: a share is
|
|
126
|
+
* public only when the person chose it, because anyone can then read and pull it), the license of a public share (MIT when absent; the plan names it)
|
|
127
|
+
* and whether the public registry lists it (`registry`: the share sets the `cordis-plugin` topic, which the registry's hourly sync finds).
|
|
104
128
|
*/
|
|
105
129
|
export declare function planAppPluginShare(root: string, home: string, name: string, options: {
|
|
106
130
|
readonly owner?: string;
|
|
131
|
+
readonly visibility?: ShareVisibility;
|
|
132
|
+
readonly license?: string;
|
|
133
|
+
readonly registry?: boolean;
|
|
107
134
|
}, ports: SharePorts): Promise<SharePlan>;
|
|
108
135
|
/**
|
|
109
136
|
* Share one local plugin through the plugin-hub path, exactly as the person confirmed it: the plan is read again, and when it no longer matches
|
package/lib/app-reload.d.ts
CHANGED
|
@@ -58,16 +58,17 @@ export declare class AppReloader {
|
|
|
58
58
|
/** A file whose change is no change of the app: an editor's swap or backup file, a hidden file or folder. */
|
|
59
59
|
export declare function isNoise(filename: string): boolean;
|
|
60
60
|
/**
|
|
61
|
-
* Calls `onChange` once, `debounceMs` after the last change of a file under `dir` (recursively, or only the `only` files at its top), whoever made it
|
|
62
|
-
*
|
|
61
|
+
* Calls `onChange` once, `debounceMs` after the last change of a file under `dir` (recursively, or only the `only` files at its top), whoever made it,
|
|
62
|
+
* with the paths that changed in the burst (`dir` itself when the system did not say which file). Returns the function that stops watching; a folder
|
|
63
|
+
* that does not exist is not watched (an app without `src/` has no code to load again).
|
|
63
64
|
*/
|
|
64
|
-
export declare function watchFolder(dir: string, onChange: () => void, options?: {
|
|
65
|
+
export declare function watchFolder(dir: string, onChange: (changed: readonly string[]) => void, options?: {
|
|
65
66
|
readonly debounceMs?: number;
|
|
66
67
|
readonly report?: (cause: unknown) => void;
|
|
67
68
|
readonly only?: readonly string[];
|
|
68
69
|
}): () => void;
|
|
69
70
|
/** {@link watchFolder} over several folders, one debounce per folder: a burst across two folders reloads once, as a reload already running takes the next one in. */
|
|
70
|
-
export declare function watchFolders(dirs: readonly string[], onChange: () => void, options?: {
|
|
71
|
+
export declare function watchFolders(dirs: readonly string[], onChange: (changed: readonly string[]) => void, options?: {
|
|
71
72
|
readonly debounceMs?: number;
|
|
72
73
|
readonly report?: (cause: unknown) => void;
|
|
73
74
|
}): () => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** `blend.yaml` read for this decision: the app without its pulled records, and the digest remembered for each pulled plugin. */
|
|
2
|
+
export interface AppDefinition {
|
|
3
|
+
/** The definition with the pulled records taken out, as canonical JSON: equal when no row, order or config other than those changed. */
|
|
4
|
+
readonly app: string;
|
|
5
|
+
/** The content digest (sha256 hex) remembered for each pulled plugin, by name. */
|
|
6
|
+
readonly pulled: Readonly<Record<string, string>>;
|
|
7
|
+
}
|
|
8
|
+
/** `blend.yaml`'s text as an {@link AppDefinition}. A text that does not parse is its own definition, so any change to it loads the app again. */
|
|
9
|
+
export declare function readDefinition(text: string): AppDefinition;
|
|
10
|
+
/** The digest a running app's pull installed, by plugin name; undefined when it pulled no plugin of that name (or is not running). */
|
|
11
|
+
export type PulledDigest = (name: string) => string | undefined;
|
|
12
|
+
/** The app's files as its code was last loaded, and the decision for each burst of changes after it. */
|
|
13
|
+
export declare class AppliedLive {
|
|
14
|
+
private readonly root;
|
|
15
|
+
private readonly pulledDigest;
|
|
16
|
+
private definition;
|
|
17
|
+
private folders;
|
|
18
|
+
/** `root` is the app's folder; the state is read now, as the app's code was loaded at start. `pulledDigest` answers for a pull `blend.yaml` does not remember. */
|
|
19
|
+
constructor(root: string, pulledDigest?: PulledDigest);
|
|
20
|
+
/** The app's code is being loaded again from the files as they are now: they are the new reference. */
|
|
21
|
+
loaded(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the app's code must be loaded again for these changed paths (absolute, as the watcher reports them). `false` when the running app has
|
|
24
|
+
* applied every one of them itself; the pulled-records-only `blend.yaml` then becomes the reference.
|
|
25
|
+
*/
|
|
26
|
+
needsReload(changed: readonly string[]): boolean;
|
|
27
|
+
private read;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Watches the app's files - `src/`, `plugins/` and the `blend.yaml` at its root - and calls `reload` for a burst of changes the running app has not
|
|
31
|
+
* applied itself. A decision that cannot read a file (it went away meanwhile) is reported and loads the app again, as without the decision.
|
|
32
|
+
* @returns the function that stops watching.
|
|
33
|
+
*/
|
|
34
|
+
export declare function watchAppFiles(root: string, reload: () => void, options?: {
|
|
35
|
+
readonly debounceMs?: number;
|
|
36
|
+
readonly report?: (cause: unknown) => void;
|
|
37
|
+
readonly pulledDigest?: PulledDigest;
|
|
38
|
+
}): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* The running app's `pluginShare` as the frame reads it: its `pulledDigest`, when the service is there and has one. Read at each call, as the app's rows
|
|
41
|
+
* come and go with a reload; anything else answers undefined, so the decision falls back to `blend.yaml` alone.
|
|
42
|
+
*/
|
|
43
|
+
export declare function pulledDigestOf(service: () => unknown): PulledDigest;
|