@kubohiroya/turbowarp-plus-editor-project-folder 0.7.0 → 0.8.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.
@@ -0,0 +1,13 @@
1
+ /** The project folder mounted for a VM, as a view of the folder follows it. */
2
+ export interface FollowedFolder {
3
+ readonly directory: FileSystemDirectoryHandle | null;
4
+ subscribe(listener: () => void): () => void;
5
+ /** Asks for a folder and opens it, as the File menu's Open Project Folder… does. */
6
+ open(locale: string): void;
7
+ }
8
+ export declare function registerFolder(vm: object, folder: FollowedFolder): () => void;
9
+ /**
10
+ * Calls `listener` with the project folder mounted for `vm` and the directory open in it, now and whenever a folder is
11
+ * mounted, opened, closed or saved. Returns the function that stops it.
12
+ */
13
+ export declare function followProjectFolder(vm: object, listener: (folder: FollowedFolder | undefined, directory: FileSystemDirectoryHandle | null) => void): () => void;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type { FolderHost, FolderVM } from './session.js';
2
2
  export type { Comparison, ComparisonRequest, ComparisonSection, FolderHost, FolderVM, OpenResult } from './session.js';
3
3
  export type { ReloadTarget } from './block-reload.js';
4
+ export { followProjectFolder } from './folder-registry.js';
5
+ export type { FollowedFolder } from './folder-registry.js';
4
6
  export type { DeserializeBlocks } from './script-reload.js';
5
7
  type MenuElement = (component: any, props: any, ...children: any[]) => any;
6
8
  interface MenuProps {
@@ -22,6 +24,11 @@ export declare function mountProjectFolder({ vm, document, host, locale, autoRel
22
24
  autoReload?: boolean;
23
25
  }): {
24
26
  openDirectory: (directory: FileSystemDirectoryHandle, confirmReplace: () => boolean) => Promise<import("./session.js").OpenResult>;
27
+ /**
28
+ * The folder the loaded project came from, or `null` once another project loaded or the folder was
29
+ * detached. A host can tell projects apart by it, for example to keep the layout of each one.
30
+ */
31
+ readonly directory: FileSystemDirectoryHandle | null;
25
32
  dispose(): void;
26
33
  } | null;
27
34
  export declare function projectFolderActions(vm: FolderVM, locale?: string): {