@vicinae/api 0.3.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/README.md +37 -0
- package/bin/run.js +9 -0
- package/dist/api/ai.d.ts +110 -0
- package/dist/api/ai.js +120 -0
- package/dist/api/alert.d.ts +22 -0
- package/dist/api/alert.js +61 -0
- package/dist/api/bus.d.ts +95 -0
- package/dist/api/bus.js +211 -0
- package/dist/api/cache.d.ts +117 -0
- package/dist/api/cache.js +52 -0
- package/dist/api/clipboard.d.ts +34 -0
- package/dist/api/clipboard.js +52 -0
- package/dist/api/color.d.ts +24 -0
- package/dist/api/color.js +24 -0
- package/dist/api/components/action-pannel.d.ts +23 -0
- package/dist/api/components/action-pannel.js +30 -0
- package/dist/api/components/actions.d.ts +52 -0
- package/dist/api/components/actions.js +81 -0
- package/dist/api/components/detail.d.ts +21 -0
- package/dist/api/components/detail.js +12 -0
- package/dist/api/components/dropdown.d.ts +36 -0
- package/dist/api/components/dropdown.js +21 -0
- package/dist/api/components/empty-view.d.ts +9 -0
- package/dist/api/components/empty-view.js +12 -0
- package/dist/api/components/form.d.ts +81 -0
- package/dist/api/components/form.js +53 -0
- package/dist/api/components/grid.d.ts +117 -0
- package/dist/api/components/grid.js +80 -0
- package/dist/api/components/index.d.ts +7 -0
- package/dist/api/components/index.js +23 -0
- package/dist/api/components/list.d.ts +109 -0
- package/dist/api/components/list.js +53 -0
- package/dist/api/components/menu-bar.d.ts +26 -0
- package/dist/api/components/menu-bar.js +25 -0
- package/dist/api/components/metadata.d.ts +23 -0
- package/dist/api/components/metadata.js +27 -0
- package/dist/api/components/tag.d.ts +16 -0
- package/dist/api/components/tag.js +28 -0
- package/dist/api/context/index.d.ts +1 -0
- package/dist/api/context/index.js +17 -0
- package/dist/api/context/navigation-context.d.ts +7 -0
- package/dist/api/context/navigation-context.js +8 -0
- package/dist/api/context/navigation-provider.d.ts +4 -0
- package/dist/api/context/navigation-provider.js +40 -0
- package/dist/api/controls.d.ts +3 -0
- package/dist/api/controls.js +20 -0
- package/dist/api/environment.d.ts +118 -0
- package/dist/api/environment.js +17 -0
- package/dist/api/hooks/index.d.ts +2 -0
- package/dist/api/hooks/index.js +18 -0
- package/dist/api/hooks/use-applications.d.ts +2 -0
- package/dist/api/hooks/use-applications.js +19 -0
- package/dist/api/hooks/use-imperative-form-handle.d.ts +3 -0
- package/dist/api/hooks/use-imperative-form-handle.js +25 -0
- package/dist/api/hooks/use-navigation.d.ts +4 -0
- package/dist/api/hooks/use-navigation.js +13 -0
- package/dist/api/hooks.d.ts +1 -0
- package/dist/api/hooks.js +24 -0
- package/dist/api/icon.d.ts +444 -0
- package/dist/api/icon.js +448 -0
- package/dist/api/image.d.ts +35 -0
- package/dist/api/image.js +84 -0
- package/dist/api/index.d.ts +19 -0
- package/dist/api/index.js +35 -0
- package/dist/api/keyboard.d.ts +16 -0
- package/dist/api/keyboard.js +12 -0
- package/dist/api/lib/result.d.ts +9 -0
- package/dist/api/lib/result.js +11 -0
- package/dist/api/local-storage.d.ts +13 -0
- package/dist/api/local-storage.js +31 -0
- package/dist/api/oauth.d.ts +319 -0
- package/dist/api/oauth.js +166 -0
- package/dist/api/preference.d.ts +5 -0
- package/dist/api/preference.js +18 -0
- package/dist/api/proto/application.d.ts +48 -0
- package/dist/api/proto/application.js +378 -0
- package/dist/api/proto/clipboard.d.ts +65 -0
- package/dist/api/proto/clipboard.js +614 -0
- package/dist/api/proto/common.d.ts +28 -0
- package/dist/api/proto/common.js +102 -0
- package/dist/api/proto/extension.d.ts +68 -0
- package/dist/api/proto/extension.js +604 -0
- package/dist/api/proto/google/protobuf/struct.d.ts +107 -0
- package/dist/api/proto/google/protobuf/struct.js +456 -0
- package/dist/api/proto/ipc.d.ts +64 -0
- package/dist/api/proto/ipc.js +604 -0
- package/dist/api/proto/manager.d.ts +82 -0
- package/dist/api/proto/manager.js +689 -0
- package/dist/api/proto/oauth.d.ts +55 -0
- package/dist/api/proto/oauth.js +379 -0
- package/dist/api/proto/storage.d.ts +80 -0
- package/dist/api/proto/storage.js +804 -0
- package/dist/api/proto/ui.d.ts +186 -0
- package/dist/api/proto/ui.js +1993 -0
- package/dist/api/toast.d.ts +168 -0
- package/dist/api/toast.js +152 -0
- package/dist/api/utils.d.ts +15 -0
- package/dist/api/utils.js +64 -0
- package/dist/commands/build/index.d.ts +11 -0
- package/dist/commands/build/index.js +123 -0
- package/dist/commands/develop/index.d.ts +10 -0
- package/dist/commands/develop/index.js +193 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/schemas/manifest.d.ts +75 -0
- package/dist/schemas/manifest.js +4 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.js +38 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.js +19 -0
- package/dist/utils/vicinae.d.ts +12 -0
- package/dist/utils/vicinae.js +33 -0
- package/package.json +73 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
interface AbstractCache {
|
|
2
|
+
/**
|
|
3
|
+
* @returns the full path to the directory where the data is stored on disk.
|
|
4
|
+
*/
|
|
5
|
+
get storageDirectory(): string;
|
|
6
|
+
/**
|
|
7
|
+
* @returns the data for the given key. If there is no data for the key, `undefined` is returned.
|
|
8
|
+
* @remarks If you want to just check for the existence of a key, use {@link has}.
|
|
9
|
+
*/
|
|
10
|
+
get(key: string): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* @returns `true` if data for the key exists, `false` otherwise.
|
|
13
|
+
* @remarks You can use this method to check for entries without affecting the LRU access.
|
|
14
|
+
*/
|
|
15
|
+
has(key: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @returns `true` if the cache is empty, `false` otherwise.
|
|
18
|
+
*/
|
|
19
|
+
get isEmpty(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the data for the given key.
|
|
22
|
+
* If the data exceeds the configured `capacity`, the least recently used entries are removed.
|
|
23
|
+
* This also notifies registered subscribers (see {@link subscribe}).
|
|
24
|
+
*/
|
|
25
|
+
set(key: string, data: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Removes the data for the given key.
|
|
28
|
+
* This also notifies registered subscribers (see {@link subscribe}).
|
|
29
|
+
* @returns `true` if data for the key was removed, `false` otherwise.
|
|
30
|
+
*/
|
|
31
|
+
remove(key: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Clears all stored data.
|
|
34
|
+
* This also notifies registered subscribers (see {@link subscribe}) unless the `notifySubscribers` option is set to `false`.
|
|
35
|
+
*/
|
|
36
|
+
clear(options?: {
|
|
37
|
+
notifySubscribers: boolean;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Registers a new subscriber that gets notified when cache data is set or removed.
|
|
41
|
+
* @returns a function that can be called to remove the subscriber.
|
|
42
|
+
*/
|
|
43
|
+
subscribe(subscriber: Cache.Subscriber): Cache.Subscription;
|
|
44
|
+
}
|
|
45
|
+
export declare class Cache implements AbstractCache {
|
|
46
|
+
constructor(options?: Cache.Options);
|
|
47
|
+
/**
|
|
48
|
+
* @returns the full path to the directory where the data is stored on disk.
|
|
49
|
+
*/
|
|
50
|
+
get storageDirectory(): string;
|
|
51
|
+
/**
|
|
52
|
+
* @returns the data for the given key. If there is no data for the key, `undefined` is returned.
|
|
53
|
+
* @remarks If you want to just check for the existence of a key, use {@link has}.
|
|
54
|
+
*/
|
|
55
|
+
get(key: string): string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* @returns `true` if data for the key exists, `false` otherwise.
|
|
58
|
+
* @remarks You can use this method to check for entries without affecting the LRU access.
|
|
59
|
+
*/
|
|
60
|
+
has(key: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* @returns `true` if the cache is empty, `false` otherwise.
|
|
63
|
+
*/
|
|
64
|
+
get isEmpty(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the data for the given key.
|
|
67
|
+
* If the data exceeds the configured `capacity`, the least recently used entries are removed.
|
|
68
|
+
* This also notifies registered subscribers (see {@link subscribe}).
|
|
69
|
+
*/
|
|
70
|
+
set(key: string, data: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Removes the data for the given key.
|
|
73
|
+
* This also notifies registered subscribers (see {@link subscribe}).
|
|
74
|
+
* @returns `true` if data for the key was removed, `false` otherwise.
|
|
75
|
+
*/
|
|
76
|
+
remove(key: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Clears all stored data.
|
|
79
|
+
* This also notifies registered subscribers (see {@link subscribe}) unless the `notifySubscribers` option is set to `false`.
|
|
80
|
+
*/
|
|
81
|
+
clear(options?: {
|
|
82
|
+
notifySubscribers: boolean;
|
|
83
|
+
}): void;
|
|
84
|
+
/**
|
|
85
|
+
* Registers a new subscriber that gets notified when cache data is set or removed.
|
|
86
|
+
* @returns a function that can be called to remove the subscriber.
|
|
87
|
+
*/
|
|
88
|
+
subscribe(subscriber: Cache.Subscriber): Cache.Subscription;
|
|
89
|
+
private maintainCapacity;
|
|
90
|
+
private notifySubscribers;
|
|
91
|
+
}
|
|
92
|
+
export declare namespace Cache {
|
|
93
|
+
/**
|
|
94
|
+
* The options for creating a new {@link Cache}.
|
|
95
|
+
*/
|
|
96
|
+
interface Options {
|
|
97
|
+
/**
|
|
98
|
+
* If set, the Cache will be namespaced via a subdirectory.
|
|
99
|
+
* This can be useful to separate the caches for individual commands of an extension.
|
|
100
|
+
* By default, the cache is shared between the commands of an extension.
|
|
101
|
+
*/
|
|
102
|
+
namespace?: string;
|
|
103
|
+
/**
|
|
104
|
+
* The parent directory for the cache data.
|
|
105
|
+
* @deprecated this parameter will be removed in the future – use the default directory.
|
|
106
|
+
*/
|
|
107
|
+
directory?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The capacity in bytes. If the stored data exceeds the capacity, the least recently used data is removed.
|
|
110
|
+
* The default capacity is 10 MB.
|
|
111
|
+
*/
|
|
112
|
+
capacity?: number;
|
|
113
|
+
}
|
|
114
|
+
type Subscriber = (key: string | undefined, data: string | undefined) => void;
|
|
115
|
+
type Subscription = () => void;
|
|
116
|
+
}
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Cache = void 0;
|
|
4
|
+
class Cache {
|
|
5
|
+
constructor(options) { }
|
|
6
|
+
/**
|
|
7
|
+
* @returns the full path to the directory where the data is stored on disk.
|
|
8
|
+
*/
|
|
9
|
+
get storageDirectory() { return ''; }
|
|
10
|
+
/**
|
|
11
|
+
* @returns the data for the given key. If there is no data for the key, `undefined` is returned.
|
|
12
|
+
* @remarks If you want to just check for the existence of a key, use {@link has}.
|
|
13
|
+
*/
|
|
14
|
+
get(key) { return undefined; }
|
|
15
|
+
/**
|
|
16
|
+
* @returns `true` if data for the key exists, `false` otherwise.
|
|
17
|
+
* @remarks You can use this method to check for entries without affecting the LRU access.
|
|
18
|
+
*/
|
|
19
|
+
has(key) { return false; }
|
|
20
|
+
/**
|
|
21
|
+
* @returns `true` if the cache is empty, `false` otherwise.
|
|
22
|
+
*/
|
|
23
|
+
get isEmpty() { return true; }
|
|
24
|
+
/**
|
|
25
|
+
* Sets the data for the given key.
|
|
26
|
+
* If the data exceeds the configured `capacity`, the least recently used entries are removed.
|
|
27
|
+
* This also notifies registered subscribers (see {@link subscribe}).
|
|
28
|
+
*/
|
|
29
|
+
set(key, data) { }
|
|
30
|
+
/**
|
|
31
|
+
* Removes the data for the given key.
|
|
32
|
+
* This also notifies registered subscribers (see {@link subscribe}).
|
|
33
|
+
* @returns `true` if data for the key was removed, `false` otherwise.
|
|
34
|
+
*/
|
|
35
|
+
remove(key) { return false; }
|
|
36
|
+
/**
|
|
37
|
+
* Clears all stored data.
|
|
38
|
+
* This also notifies registered subscribers (see {@link subscribe}) unless the `notifySubscribers` option is set to `false`.
|
|
39
|
+
*/
|
|
40
|
+
clear(options) { }
|
|
41
|
+
/**
|
|
42
|
+
* Registers a new subscriber that gets notified when cache data is set or removed.
|
|
43
|
+
* @returns a function that can be called to remove the subscriber.
|
|
44
|
+
*/
|
|
45
|
+
subscribe(subscriber) {
|
|
46
|
+
return () => { };
|
|
47
|
+
}
|
|
48
|
+
maintainCapacity;
|
|
49
|
+
notifySubscribers;
|
|
50
|
+
}
|
|
51
|
+
exports.Cache = Cache;
|
|
52
|
+
;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PathLike } from 'fs';
|
|
2
|
+
import { ClipboardContent } from './proto/clipboard';
|
|
3
|
+
export declare namespace Clipboard {
|
|
4
|
+
type Content = {
|
|
5
|
+
text: string;
|
|
6
|
+
} | {
|
|
7
|
+
file: PathLike;
|
|
8
|
+
} | {
|
|
9
|
+
html: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
};
|
|
12
|
+
type ReadContent = {
|
|
13
|
+
text: string;
|
|
14
|
+
} | {
|
|
15
|
+
file?: string;
|
|
16
|
+
} | {
|
|
17
|
+
html?: string;
|
|
18
|
+
};
|
|
19
|
+
type CopyOptions = {
|
|
20
|
+
concealed?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const Clipboard: {
|
|
24
|
+
mapContent(content: string | number | Clipboard.Content): ClipboardContent;
|
|
25
|
+
copy(text: string | number | Clipboard.Content, options?: Clipboard.CopyOptions): Promise<void>;
|
|
26
|
+
paste(text: string | Clipboard.Content): Promise<void>;
|
|
27
|
+
read(options?: {
|
|
28
|
+
offset?: number;
|
|
29
|
+
}): Promise<Clipboard.ReadContent>;
|
|
30
|
+
readText(options?: {
|
|
31
|
+
offset?: number;
|
|
32
|
+
}): Promise<string | undefined>;
|
|
33
|
+
clear(text: string): Promise<void>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Clipboard = void 0;
|
|
4
|
+
const bus_1 = require("./bus");
|
|
5
|
+
const clipboard_1 = require("./proto/clipboard");
|
|
6
|
+
;
|
|
7
|
+
exports.Clipboard = {
|
|
8
|
+
mapContent(content) {
|
|
9
|
+
let ct = clipboard_1.ClipboardContent.create();
|
|
10
|
+
if (typeof content != 'object') {
|
|
11
|
+
ct.text = `${content}`;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
if (content['file']) {
|
|
15
|
+
ct.path = { path: content['file'] };
|
|
16
|
+
}
|
|
17
|
+
else if (content['html']) {
|
|
18
|
+
ct.html = { html: content['html'], text: content['text'] };
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
ct.text = content['text'];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return ct;
|
|
25
|
+
},
|
|
26
|
+
async copy(text, options = {}) {
|
|
27
|
+
await bus_1.bus.turboRequest('clipboard.copy', {
|
|
28
|
+
content: this.mapContent(text),
|
|
29
|
+
options: { concealed: options.concealed ?? false }
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async paste(text) {
|
|
33
|
+
await bus_1.bus.turboRequest('clipboard.paste', {
|
|
34
|
+
content: this.mapContent(text),
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
async read(options) {
|
|
38
|
+
const res = await bus_1.bus.request('clipboard.read', {
|
|
39
|
+
options
|
|
40
|
+
});
|
|
41
|
+
return res.data.content;
|
|
42
|
+
},
|
|
43
|
+
async readText(options) {
|
|
44
|
+
const res = await bus_1.bus.request('clipboard.read-text', {
|
|
45
|
+
options
|
|
46
|
+
});
|
|
47
|
+
return res.data.content;
|
|
48
|
+
},
|
|
49
|
+
async clear(text) {
|
|
50
|
+
// TODO: implement
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type DynamicColor = {
|
|
2
|
+
dark: string;
|
|
3
|
+
light: string;
|
|
4
|
+
adjustContrast?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare namespace Color {
|
|
7
|
+
type Dynamic = DynamicColor;
|
|
8
|
+
type Raw = string;
|
|
9
|
+
}
|
|
10
|
+
export declare enum Color {
|
|
11
|
+
Blue = "blue",
|
|
12
|
+
Green = "green",
|
|
13
|
+
Magenta = "magenta",
|
|
14
|
+
Orange = "orange",
|
|
15
|
+
Purple = "purple",
|
|
16
|
+
Red = "red",
|
|
17
|
+
Yellow = "yellow",
|
|
18
|
+
PrimaryText = "primary-text",
|
|
19
|
+
SecondaryText = "secondary-text"
|
|
20
|
+
}
|
|
21
|
+
export type ColorLike = Color.Dynamic | Color.Raw | Color;
|
|
22
|
+
export type SerializedColorLike = Color.Dynamic | string;
|
|
23
|
+
export declare const serializeColorLike: (color: ColorLike) => SerializedColorLike;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeColorLike = exports.Color = void 0;
|
|
4
|
+
;
|
|
5
|
+
var Color;
|
|
6
|
+
(function (Color) {
|
|
7
|
+
Color["Blue"] = "blue";
|
|
8
|
+
Color["Green"] = "green";
|
|
9
|
+
Color["Magenta"] = "magenta";
|
|
10
|
+
Color["Orange"] = "orange";
|
|
11
|
+
Color["Purple"] = "purple";
|
|
12
|
+
Color["Red"] = "red";
|
|
13
|
+
Color["Yellow"] = "yellow";
|
|
14
|
+
Color["PrimaryText"] = "primary-text";
|
|
15
|
+
Color["SecondaryText"] = "secondary-text";
|
|
16
|
+
})(Color || (exports.Color = Color = {}));
|
|
17
|
+
;
|
|
18
|
+
const serializeColorLike = (color) => {
|
|
19
|
+
if (typeof color == 'string') {
|
|
20
|
+
return color;
|
|
21
|
+
}
|
|
22
|
+
return color;
|
|
23
|
+
};
|
|
24
|
+
exports.serializeColorLike = serializeColorLike;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Image } from "../image";
|
|
3
|
+
import { Keyboard } from "../keyboard";
|
|
4
|
+
export type ActionPanelProps = {
|
|
5
|
+
title?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type ActionPanelSectionProps = {
|
|
9
|
+
title?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type ActionPanelSubmenuProps = {
|
|
13
|
+
title: string;
|
|
14
|
+
icon?: Image.ImageLike;
|
|
15
|
+
shortcut?: Keyboard.Shortcut;
|
|
16
|
+
onOpen?: () => void;
|
|
17
|
+
onSearchTextChange?: (text: string) => void;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
export declare const ActionPanel: import("react").FC<ActionPanelProps> & {
|
|
21
|
+
Section: import("react").FC<import("react").PropsWithChildren<ActionPanelSectionProps>>;
|
|
22
|
+
Submenu: import("react").FC<ActionPanelSubmenuProps>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionPanel = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const image_1 = require("../image");
|
|
6
|
+
const hooks_1 = require("../hooks");
|
|
7
|
+
const ActionPanelRoot = (props) => {
|
|
8
|
+
const nativeProps = props;
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("action-panel", { ...nativeProps }));
|
|
10
|
+
};
|
|
11
|
+
const ActionPanelSection = (props) => {
|
|
12
|
+
const nativeProps = {
|
|
13
|
+
title: props.title,
|
|
14
|
+
};
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("action-panel-section", { ...nativeProps, children: props.children }));
|
|
16
|
+
};
|
|
17
|
+
const ActionPannelSubmenu = ({ icon, children, onOpen, onSearchTextChange, ...props }) => {
|
|
18
|
+
const onSearchTextChangeHandler = (0, hooks_1.useEventListener)(onSearchTextChange);
|
|
19
|
+
const onOpenHandler = (0, hooks_1.useEventListener)(onOpen);
|
|
20
|
+
const nativeProps = props;
|
|
21
|
+
nativeProps.onSearchTextChange = onSearchTextChangeHandler;
|
|
22
|
+
nativeProps.onOpen = onOpenHandler;
|
|
23
|
+
if (icon)
|
|
24
|
+
nativeProps.icon = (0, image_1.serializeImageLike)(icon);
|
|
25
|
+
return (0, jsx_runtime_1.jsx)("action-panel-submenu", { ...nativeProps, children: children });
|
|
26
|
+
};
|
|
27
|
+
exports.ActionPanel = Object.assign(ActionPanelRoot, {
|
|
28
|
+
Section: ActionPanelSection,
|
|
29
|
+
Submenu: ActionPannelSubmenu,
|
|
30
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { Clipboard } from "../clipboard";
|
|
3
|
+
import { ImageLike } from "../image";
|
|
4
|
+
import { Keyboard } from "../keyboard";
|
|
5
|
+
import { Application } from "../utils";
|
|
6
|
+
import { Form } from "./form";
|
|
7
|
+
export type BaseActionProps = {
|
|
8
|
+
title: string;
|
|
9
|
+
icon?: ImageLike;
|
|
10
|
+
shortcut?: Keyboard.Shortcut;
|
|
11
|
+
autoFocus?: boolean;
|
|
12
|
+
style?: 'regular' | 'destructive';
|
|
13
|
+
};
|
|
14
|
+
export type ActionProps = BaseActionProps & {
|
|
15
|
+
onAction: () => void;
|
|
16
|
+
};
|
|
17
|
+
export type CopyToClipboardProps = Omit<BaseActionProps, 'title'> & {
|
|
18
|
+
content: string;
|
|
19
|
+
concealed?: boolean;
|
|
20
|
+
onCopy?: (content: string | number | Clipboard.Content) => void;
|
|
21
|
+
title?: string;
|
|
22
|
+
};
|
|
23
|
+
export type ActionPushProps = BaseActionProps & {
|
|
24
|
+
target: ReactNode;
|
|
25
|
+
};
|
|
26
|
+
export type ActionOpenProps = BaseActionProps & {
|
|
27
|
+
target: string;
|
|
28
|
+
app?: Application;
|
|
29
|
+
};
|
|
30
|
+
export type ActionPasteProps = BaseActionProps & {
|
|
31
|
+
content: string;
|
|
32
|
+
onPaste?: (content: string | number | Clipboard.Content) => void;
|
|
33
|
+
};
|
|
34
|
+
export type ActionOpenInBrowserProps = BaseActionProps & {
|
|
35
|
+
url: string;
|
|
36
|
+
};
|
|
37
|
+
export type ActionSubmitFormProps = Omit<BaseActionProps, 'title'> & {
|
|
38
|
+
onSubmit: (input: Form.Values) => boolean | void | Promise<boolean | void>;
|
|
39
|
+
title?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const Action: React.FC<ActionProps> & {
|
|
42
|
+
CopyToClipboard: React.FC<CopyToClipboardProps>;
|
|
43
|
+
Push: React.FC<ActionPushProps>;
|
|
44
|
+
Open: React.FC<ActionOpenProps>;
|
|
45
|
+
Paste: React.FC<ActionPasteProps>;
|
|
46
|
+
SubmitForm: React.FC<ActionSubmitFormProps>;
|
|
47
|
+
OpenInBrowser: React.FC<ActionOpenInBrowserProps>;
|
|
48
|
+
Style: {
|
|
49
|
+
Regular: "regular";
|
|
50
|
+
Destructive: "destructive";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Action = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const index_1 = require("../hooks/index");
|
|
6
|
+
const clipboard_1 = require("../clipboard");
|
|
7
|
+
const image_1 = require("../image");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const hooks_1 = require("../hooks");
|
|
10
|
+
const icon_1 = require("../icon");
|
|
11
|
+
const controls_1 = require("../controls");
|
|
12
|
+
const ActionRoot = ({ icon, ...props }) => {
|
|
13
|
+
const handler = (0, hooks_1.useEventListener)(props.onAction);
|
|
14
|
+
const nativeProps = {
|
|
15
|
+
...props,
|
|
16
|
+
icon,
|
|
17
|
+
onAction: handler
|
|
18
|
+
};
|
|
19
|
+
if (icon) {
|
|
20
|
+
nativeProps.icon = (0, image_1.serializeImageLike)(icon);
|
|
21
|
+
}
|
|
22
|
+
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
23
|
+
};
|
|
24
|
+
const CopyToClipboard = ({ title = "Copy to clipboard", icon = icon_1.Icon.CopyClipboard, content, concealed = false, onCopy, ...props }) => {
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(ActionRoot, { title: title, ...props, icon: icon_1.Icon.CopyClipboard, onAction: async () => {
|
|
26
|
+
clipboard_1.Clipboard.copy(content, { concealed });
|
|
27
|
+
(0, controls_1.closeMainWindow)();
|
|
28
|
+
onCopy?.(content);
|
|
29
|
+
} });
|
|
30
|
+
};
|
|
31
|
+
const Paste = ({ title = "Paste to active window", icon = icon_1.Icon.CopyClipboard, content, onPaste, ...props }) => {
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(ActionRoot, { title: title, ...props, icon: icon_1.Icon.CopyClipboard, onAction: async () => {
|
|
33
|
+
(0, controls_1.closeMainWindow)(); // we close before pasting to make sure focus has been properly restored
|
|
34
|
+
clipboard_1.Clipboard.paste(content);
|
|
35
|
+
onPaste?.(content);
|
|
36
|
+
} });
|
|
37
|
+
};
|
|
38
|
+
const Open = ({ target, app, ...props }) => {
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(ActionRoot, { ...props, onAction: () => {
|
|
40
|
+
(0, utils_1.open)(target, app);
|
|
41
|
+
} });
|
|
42
|
+
};
|
|
43
|
+
const OpenInBrowser = ({ url, ...props }) => {
|
|
44
|
+
return (0, jsx_runtime_1.jsx)(ActionRoot, { ...props, onAction: () => {
|
|
45
|
+
(0, utils_1.open)(url);
|
|
46
|
+
} });
|
|
47
|
+
};
|
|
48
|
+
const Push = ({ target, ...props }) => {
|
|
49
|
+
const { push } = (0, index_1.useNavigation)();
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(ActionRoot, { ...props, onAction: () => {
|
|
51
|
+
console.log('activate push action');
|
|
52
|
+
push(target);
|
|
53
|
+
} });
|
|
54
|
+
};
|
|
55
|
+
const SubmitForm = ({ onSubmit, icon, title = "Submit", ...props }) => {
|
|
56
|
+
const submitHandler = (0, hooks_1.useEventListener)(onSubmit);
|
|
57
|
+
const handler = (0, hooks_1.useEventListener)(() => { });
|
|
58
|
+
const nativeProps = {
|
|
59
|
+
...props,
|
|
60
|
+
title,
|
|
61
|
+
icon,
|
|
62
|
+
onSubmit: submitHandler,
|
|
63
|
+
onAction: handler
|
|
64
|
+
};
|
|
65
|
+
if (icon) {
|
|
66
|
+
nativeProps.icon = (0, image_1.serializeImageLike)(icon);
|
|
67
|
+
}
|
|
68
|
+
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
69
|
+
};
|
|
70
|
+
exports.Action = Object.assign(ActionRoot, {
|
|
71
|
+
CopyToClipboard,
|
|
72
|
+
Push,
|
|
73
|
+
Open,
|
|
74
|
+
Paste,
|
|
75
|
+
SubmitForm,
|
|
76
|
+
OpenInBrowser,
|
|
77
|
+
Style: {
|
|
78
|
+
Regular: 'regular',
|
|
79
|
+
Destructive: 'destructive'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type DetailProps = {
|
|
3
|
+
navigationTitle?: string;
|
|
4
|
+
metadata?: ReactNode;
|
|
5
|
+
markdown: string;
|
|
6
|
+
actions?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const Detail: import("react").FC<DetailProps> & {
|
|
9
|
+
Metadata: import("react").FC<import("./metadata").MetadataProps> & {
|
|
10
|
+
Label: import("react").FC<import("./metadata").ListItemDetailMetadataLabelProps>;
|
|
11
|
+
Separator: import("react").FC<{}>;
|
|
12
|
+
TagList: import("react").FC<import("./tag").TagListProps> & {
|
|
13
|
+
Item: import("react").FC<import("./tag").TagItemProps>;
|
|
14
|
+
};
|
|
15
|
+
Link: import("react").FC<{
|
|
16
|
+
title: string;
|
|
17
|
+
target: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Detail = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const metadata_1 = require("./metadata");
|
|
6
|
+
const DetailRoot = ({ metadata, actions, ...props }) => {
|
|
7
|
+
const nativeProps = props;
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("detail", { ...nativeProps, children: [actions, metadata] }));
|
|
9
|
+
};
|
|
10
|
+
exports.Detail = Object.assign(DetailRoot, {
|
|
11
|
+
Metadata: metadata_1.Metadata
|
|
12
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Image } from "../image";
|
|
3
|
+
export declare namespace Dropdown {
|
|
4
|
+
type Props = DropdownProps;
|
|
5
|
+
type Item = DropdownItemProps;
|
|
6
|
+
type Section = DropdownSectionProps;
|
|
7
|
+
}
|
|
8
|
+
type DropdownProps = {
|
|
9
|
+
tooltip?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
filtering?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
storeValue?: boolean;
|
|
17
|
+
throttle?: boolean;
|
|
18
|
+
value?: string;
|
|
19
|
+
onChange?: (newValue: string) => void;
|
|
20
|
+
onSearchTextChange?: (text: string) => void;
|
|
21
|
+
};
|
|
22
|
+
type DropdownItemProps = {
|
|
23
|
+
title: string;
|
|
24
|
+
value: string;
|
|
25
|
+
icon?: Image.ImageLike;
|
|
26
|
+
keywords?: string[];
|
|
27
|
+
};
|
|
28
|
+
type DropdownSectionProps = {
|
|
29
|
+
title?: string;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
};
|
|
32
|
+
export declare const Dropdown: import("react").FC<DropdownProps> & {
|
|
33
|
+
Item: import("react").FC<DropdownItemProps>;
|
|
34
|
+
Section: import("react").FC<DropdownSectionProps>;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Dropdown = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const image_1 = require("../image");
|
|
6
|
+
const hooks_1 = require("../hooks");
|
|
7
|
+
const DropdownRoot = ({ children, ...props }) => {
|
|
8
|
+
const onSearchTextChange = (0, hooks_1.useEventListener)(props.onSearchTextChange);
|
|
9
|
+
const onChange = (0, hooks_1.useEventListener)(props.onChange);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("dropdown", { onSearchTextChange: onSearchTextChange, onChange: onChange, children: children }));
|
|
11
|
+
};
|
|
12
|
+
const Item = ({ title, value, icon }) => {
|
|
13
|
+
return (0, jsx_runtime_1.jsx)("dropdown-item", { title: title, value: value, icon: icon && (0, image_1.serializeImageLike)(icon) });
|
|
14
|
+
};
|
|
15
|
+
const Section = ({ title, children }) => {
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)("dropdown-section", { title: title, children: children }));
|
|
17
|
+
};
|
|
18
|
+
exports.Dropdown = Object.assign(DropdownRoot, {
|
|
19
|
+
Item,
|
|
20
|
+
Section
|
|
21
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ImageLike } from '../image';
|
|
3
|
+
export type EmptyViewProps = {
|
|
4
|
+
title?: string;
|
|
5
|
+
icon?: ImageLike;
|
|
6
|
+
description?: string;
|
|
7
|
+
actions?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const EmptyView: React.FC<EmptyViewProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmptyView = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const image_1 = require("../image");
|
|
6
|
+
const EmptyView = ({ icon, actions, ...props }) => {
|
|
7
|
+
const nativeProps = props;
|
|
8
|
+
if (icon)
|
|
9
|
+
nativeProps.icon = (0, image_1.serializeImageLike)(icon);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("empty-view", { ...nativeProps, children: actions }));
|
|
11
|
+
};
|
|
12
|
+
exports.EmptyView = EmptyView;
|