@croffledev/croffle-types 1.1.3 → 1.2.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/api/extensions.d.ts +58 -0
- package/api/ui.d.ts +6 -6
- package/croffle-api.d.ts +13 -4
- package/enums.d.ts +11 -44
- package/index.d.ts +2 -2
- package/models/extension.d.ts +94 -0
- package/package.json +1 -1
- package/api/plugins.d.ts +0 -39
- package/models/plugin.d.ts +0 -71
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ExtensionInfo } from '../models/extension';
|
|
2
|
+
|
|
3
|
+
export interface ExtensionInfoApi {
|
|
4
|
+
getInstalled(): Promise<ExtensionInfo[]>;
|
|
5
|
+
getEnabled(): Promise<ExtensionInfo[]>;
|
|
6
|
+
getByName(name: string): Promise<ExtensionInfo | null>;
|
|
7
|
+
install(data: Partial<ExtensionInfo>): Promise<ExtensionInfo>;
|
|
8
|
+
installFromLocal(): Promise<ExtensionInfo | null>;
|
|
9
|
+
toggle(name: string, enable: boolean): Promise<ExtensionInfo | null>;
|
|
10
|
+
uninstall(name: string): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Extension-scoped configuration (persisted via storage) */
|
|
14
|
+
export interface ExtensionConfigurationApi {
|
|
15
|
+
get<T = Record<string, unknown>>(extensionId: string, storageKey?: string): Promise<T>;
|
|
16
|
+
set(extensionId: string, values: Record<string, unknown>, storageKey?: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ExtensionStorageApi {
|
|
20
|
+
get<T = unknown>(extensionId: string, key: string): Promise<T | null>;
|
|
21
|
+
set(extensionId: string, key: string, value: unknown): Promise<void>;
|
|
22
|
+
delete(extensionId: string, key: string): Promise<boolean>;
|
|
23
|
+
clear(extensionId: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ExtensionSessionApi {
|
|
27
|
+
get<T = unknown>(extensionId: string, key: string): Promise<T | null>;
|
|
28
|
+
set<T = unknown>(extensionId: string, key: string, value: T): Promise<void>;
|
|
29
|
+
delete(extensionId: string, key: string): Promise<boolean>;
|
|
30
|
+
clear(extensionId: string): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Bound to a single extension id (passed via ExtensionContext) */
|
|
34
|
+
export interface ExtensionScopedStorageApi {
|
|
35
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
36
|
+
set(key: string, value: unknown): Promise<void>;
|
|
37
|
+
delete(key: string): Promise<boolean>;
|
|
38
|
+
clear(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ExtensionScopedSessionApi {
|
|
42
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
43
|
+
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
44
|
+
delete(key: string): Promise<boolean>;
|
|
45
|
+
clear(): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ExtensionScopedConfigurationApi {
|
|
49
|
+
get<T = Record<string, unknown>>(storageKey?: string): Promise<T>;
|
|
50
|
+
set(values: Record<string, unknown>, storageKey?: string): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ExtensionsApi {
|
|
54
|
+
info: ExtensionInfoApi;
|
|
55
|
+
configuration: ExtensionConfigurationApi;
|
|
56
|
+
storage: ExtensionStorageApi;
|
|
57
|
+
session: ExtensionSessionApi;
|
|
58
|
+
}
|
package/api/ui.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConfigurationSectionContribution } from '../models/extension';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type RegisterConfigurationTabOptions = {
|
|
4
4
|
label: string;
|
|
5
5
|
icon?: unknown;
|
|
6
6
|
order?: number;
|
|
7
7
|
render?: (container: HTMLElement) => void;
|
|
8
|
-
sections?:
|
|
8
|
+
sections?: ConfigurationSectionContribution[];
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export interface UiApi {
|
|
@@ -17,8 +17,8 @@ export interface UiApi {
|
|
|
17
17
|
callback: (target: string) => void,
|
|
18
18
|
): void;
|
|
19
19
|
/**
|
|
20
|
-
* 설정 모달에 탭을 추가합니다.
|
|
21
|
-
* @param tabId 고유 탭 ID (
|
|
20
|
+
* 앱 설정 모달에 extension configuration 탭을 추가합니다.
|
|
21
|
+
* @param tabId 고유 탭 ID (`${extensionId}:${tabId}` 형태로 저장됨)
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
registerConfigurationTab(tabId: string, options: RegisterConfigurationTabOptions): void;
|
|
24
24
|
}
|
package/croffle-api.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { CalendarApi } from './api/calendar';
|
|
2
2
|
import type { EventApi } from './api/event';
|
|
3
|
+
import type {
|
|
4
|
+
ExtensionScopedConfigurationApi,
|
|
5
|
+
ExtensionScopedSessionApi,
|
|
6
|
+
ExtensionScopedStorageApi,
|
|
7
|
+
ExtensionsApi,
|
|
8
|
+
} from './api/extensions';
|
|
3
9
|
import type { HttpApi } from './api/http';
|
|
4
10
|
import type { OsApi } from './api/os';
|
|
5
|
-
import type { PluginsApi } from './api/plugins';
|
|
6
11
|
import type { SettingsApi } from './api/settings';
|
|
7
12
|
import type { UiApi } from './api/ui';
|
|
8
13
|
import type { WindowApi } from './api/window';
|
|
@@ -36,11 +41,15 @@ export interface CroffleAPI {
|
|
|
36
41
|
event: EventApi;
|
|
37
42
|
calendar: CalendarApi;
|
|
38
43
|
settings: SettingsApi;
|
|
39
|
-
|
|
44
|
+
extensions: ExtensionsApi;
|
|
40
45
|
enums: EnumsApi;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
/**
|
|
44
|
-
export type
|
|
48
|
+
/** Extension activated(context)에 전달되는 API (+ ui + id-bound storage) */
|
|
49
|
+
export type ExtensionContext = CroffleAPI & {
|
|
45
50
|
ui: UiApi;
|
|
51
|
+
/** Prefer over `extensions.storage` — id is fixed to this extension */
|
|
52
|
+
storage: ExtensionScopedStorageApi;
|
|
53
|
+
session: ExtensionScopedSessionApi;
|
|
54
|
+
configuration: ExtensionScopedConfigurationApi;
|
|
46
55
|
};
|
package/enums.d.ts
CHANGED
|
@@ -1,64 +1,31 @@
|
|
|
1
1
|
export declare enum AppEventType {
|
|
2
|
-
|
|
2
|
+
// Schedule
|
|
3
3
|
SCHEDULE_CREATE = 'schedule:create',
|
|
4
4
|
SCHEDULE_UPDATE = 'schedule:update',
|
|
5
5
|
SCHEDULE_DELETE = 'schedule:delete',
|
|
6
6
|
SCHEDULE_EXPORT_TO_FILE = 'schedule:exportToFile',
|
|
7
7
|
SCHEDULE_IMPORT_FROM_FILE = 'schedule:importFromFile',
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
TAG_GET_BY_NAME = 'tag:getByName',
|
|
9
|
+
// Tag
|
|
11
10
|
TAG_CREATE = 'tag:create',
|
|
12
11
|
TAG_UPDATE = 'tag:update',
|
|
13
12
|
TAG_DELETE = 'tag:delete',
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
PLUGIN_INFO_TOGGLE = 'pluginInfo:toggle',
|
|
20
|
-
PLUGIN_INFO_UNINSTALL = 'pluginInfo:uninstall',
|
|
14
|
+
// Extension lifecycle
|
|
15
|
+
EXTENSION_INFO_INSTALL = 'extensionInfo:install',
|
|
16
|
+
EXTENSION_INFO_TOGGLE = 'extensionInfo:toggle',
|
|
17
|
+
EXTENSION_INFO_UNINSTALL = 'extensionInfo:uninstall',
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
PLUGIN_STORAGE_SET = 'pluginStorage:set',
|
|
24
|
-
PLUGIN_STORAGE_DELETE = 'pluginStorage:delete',
|
|
25
|
-
|
|
26
|
-
SETTINGS_GET = 'settings:get',
|
|
27
|
-
SETTINGS_GET_OF = 'settings:getOf',
|
|
19
|
+
// Settings
|
|
28
20
|
SETTINGS_UPDATE = 'settings:update',
|
|
21
|
+
SETTINGS_STARTUP_NAVIGATE = 'settings:startup-navigate',
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
WINDOW_RESTORE = 'window:restore',
|
|
32
|
-
WINDOW_MAXIMIZE = 'window:maximize',
|
|
33
|
-
WINDOW_CLOSE = 'window:close',
|
|
34
|
-
WINDOW_EXIT = 'window:exit',
|
|
35
|
-
WINDOW_CHECK_FOR_UPDATES = 'window:checkForUpdates',
|
|
23
|
+
// Window lifecycle
|
|
36
24
|
WINDOW_SHOW = 'window:show',
|
|
37
25
|
WINDOW_HIDE = 'window:hide',
|
|
26
|
+
WINDOW_EXIT = 'window:exit',
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
NATIVE_OS_CLIPBOARD_GET = 'nativeOs:clipboard:get',
|
|
41
|
-
NATIVE_OS_CLIPBOARD_SET = 'nativeOs:clipboard:set',
|
|
42
|
-
|
|
43
|
-
HTTP_SERVICE_GET = 'httpService:get',
|
|
44
|
-
HTTP_SERVICE_POST = 'httpService:post',
|
|
45
|
-
|
|
46
|
-
PLUGIN_INSTALL = 'plugin:install',
|
|
47
|
-
PLUGIN_TOGGLE = 'plugin:toggle',
|
|
48
|
-
PLUGIN_UNINSTALL = 'plugin:uninstall',
|
|
49
|
-
|
|
50
|
-
PLUGIN_SESSION_STORAGE_GET = 'sessionStorage:get',
|
|
51
|
-
PLUGIN_SESSION_STORAGE_SET = 'sessionStorage:set',
|
|
52
|
-
PLUGIN_SESSION_STORAGE_DELETE = 'sessionStorage:delete',
|
|
53
|
-
PLUGIN_SESSION_STORAGE_CLEAR = 'sessionStorage:clear',
|
|
54
|
-
PLUGIN_SESSION_STORAGE_CLEAR_ALL = 'sessionStorage:clearAll',
|
|
55
|
-
|
|
56
|
-
SCHEDULER_REGISTER = 'scheduler:register',
|
|
57
|
-
SCHEDULER_UNREGISTER = 'scheduler:unregister',
|
|
58
|
-
|
|
59
|
-
UI_ADD_MENU_ITEM = 'ui:addMenuItem',
|
|
60
|
-
UI_CONTEXT_MENU_ADD_ITEM = 'ui:contextMenu:addItem',
|
|
61
|
-
|
|
28
|
+
// Electron updater (host UI)
|
|
62
29
|
UPDATE_AVAILABLE = 'update:available',
|
|
63
30
|
UPDATE_NOT_AVAILABLE = 'update:notAvailable',
|
|
64
31
|
UPDATE_DOWNLOAD_PROGRESS = 'update:downloadProgress',
|
package/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export * from './models/tag';
|
|
2
2
|
export * from './models/schedule';
|
|
3
3
|
export * from './models/search';
|
|
4
|
-
export * from './models/
|
|
4
|
+
export * from './models/extension';
|
|
5
5
|
export * from './models/app-settings';
|
|
6
6
|
export * from './models/clipboard';
|
|
7
7
|
export * from './models/http';
|
|
8
8
|
export * from './enums';
|
|
9
9
|
export * from './api/window';
|
|
10
10
|
export * from './api/calendar';
|
|
11
|
-
export * from './api/
|
|
11
|
+
export * from './api/extensions';
|
|
12
12
|
export * from './api/settings';
|
|
13
13
|
export * from './api/os';
|
|
14
14
|
export * from './api/http';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export type ConfigItemType = 'string' | 'number' | 'boolean' | 'select' | 'path';
|
|
2
|
+
|
|
3
|
+
export type ConfigItemSchema<T = unknown> = {
|
|
4
|
+
type: ConfigItemType;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
defaultValue: T;
|
|
8
|
+
options?: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: T extends string | number ? T : never;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ConfigurationSectionContribution = {
|
|
15
|
+
id: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
items: Record<string, ConfigItemSchema>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ConfigurationTabContribution = {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
icon?: unknown;
|
|
25
|
+
extensionId: string;
|
|
26
|
+
extensionName?: string;
|
|
27
|
+
order?: number;
|
|
28
|
+
render?: (container: HTMLElement) => void;
|
|
29
|
+
sections?: ConfigurationSectionContribution[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Manifest `contributes.configuration` 항목 (런타임 extensionId/render 제외) */
|
|
33
|
+
export type ConfigurationTabManifest = Omit<
|
|
34
|
+
ConfigurationTabContribution,
|
|
35
|
+
'extensionId' | 'extensionName' | 'render'
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
/** Manifest `contributes.views` 항목 */
|
|
39
|
+
export type ViewManifest = {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
subtitle: string;
|
|
43
|
+
/** JSON에서는 보통 string; 호스트 기본 메뉴는 컴포넌트도 허용 */
|
|
44
|
+
icon?: unknown;
|
|
45
|
+
url: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** 런타임 뷰 (사이드바 등) — manifest + host 메타 */
|
|
49
|
+
export type FeatureView = ViewManifest & {
|
|
50
|
+
active?: boolean;
|
|
51
|
+
extensionName?: string;
|
|
52
|
+
extensionId?: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Manifest `contributes.contextMenus` 항목 (action은 코드에서만) */
|
|
56
|
+
export type ContextMenuManifest = {
|
|
57
|
+
id: string;
|
|
58
|
+
label: string;
|
|
59
|
+
targetView?: string[];
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type FeatureContextMenu = ContextMenuManifest & {
|
|
64
|
+
action: (targetElement: HTMLElement | null) => void;
|
|
65
|
+
condition?: (targetElement: HTMLElement | null) => boolean;
|
|
66
|
+
extensionId?: string;
|
|
67
|
+
extensionName?: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type ExtensionContributes = {
|
|
71
|
+
views?: ViewManifest[];
|
|
72
|
+
contextMenus?: ContextMenuManifest[];
|
|
73
|
+
configuration?: ConfigurationTabManifest[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** `croffle-manifest.json` on disk */
|
|
77
|
+
export type CroffleManifest = {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
version: string;
|
|
81
|
+
author: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
main?: string;
|
|
84
|
+
engines?: {
|
|
85
|
+
/** e.g. ">=1.0.0" — currently only `>=x.y.z` is enforced */
|
|
86
|
+
croffle?: string;
|
|
87
|
+
};
|
|
88
|
+
contributes?: ExtensionContributes;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Host-loaded extension (manifest + enabled) */
|
|
92
|
+
export type ExtensionInfo = CroffleManifest & {
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
};
|
package/package.json
CHANGED
package/api/plugins.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { PluginInfo } from '../models/plugin';
|
|
2
|
-
|
|
3
|
-
export interface PluginInfoApi {
|
|
4
|
-
getInstalled(): Promise<PluginInfo[]>;
|
|
5
|
-
getEnabled(): Promise<PluginInfo[]>;
|
|
6
|
-
getByName(name: string): Promise<PluginInfo | null>;
|
|
7
|
-
install(data: Partial<PluginInfo>): Promise<PluginInfo>;
|
|
8
|
-
installFromLocal(): Promise<PluginInfo | null>;
|
|
9
|
-
toggle(name: string, enable: boolean): Promise<PluginInfo | null>;
|
|
10
|
-
uninstall(name: string): Promise<boolean>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface PluginSettingsApi {
|
|
14
|
-
get<T = Record<string, unknown>>(pluginId: string, storageKey?: string): Promise<T>;
|
|
15
|
-
set(pluginId: string, values: Record<string, unknown>, storageKey?: string): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface PluginStorageApi {
|
|
19
|
-
get(pluginId: string, key: string): Promise<string | null>;
|
|
20
|
-
set(pluginId: string, key: string, value: string): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface PluginSessionApi {
|
|
24
|
-
get<T = unknown>(pluginId: string, key: string): Promise<T | null>;
|
|
25
|
-
set<T = unknown>(pluginId: string, key: string, value: T): Promise<void>;
|
|
26
|
-
delete(pluginId: string, key: string): Promise<boolean>;
|
|
27
|
-
clear(pluginId: string): Promise<void>;
|
|
28
|
-
clearAll(): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** @deprecated Use PluginSessionApi */
|
|
32
|
-
export type PluginSessionAPI = PluginSessionApi;
|
|
33
|
-
|
|
34
|
-
export interface PluginsApi {
|
|
35
|
-
info: PluginInfoApi;
|
|
36
|
-
settings: PluginSettingsApi;
|
|
37
|
-
storage: PluginStorageApi;
|
|
38
|
-
session: PluginSessionApi;
|
|
39
|
-
}
|
package/models/plugin.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export type ConfigItemType = 'string' | 'number' | 'boolean' | 'select' | 'path';
|
|
2
|
-
|
|
3
|
-
export type ConfigItemSchema<T = unknown> = {
|
|
4
|
-
type: ConfigItemType;
|
|
5
|
-
label: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
defaultValue: T;
|
|
8
|
-
options?: {
|
|
9
|
-
label: string;
|
|
10
|
-
value: T extends string | number ? T : never;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type SettingsSectionContribution = {
|
|
15
|
-
id: string;
|
|
16
|
-
title?: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
items: Record<string, ConfigItemSchema>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type SettingsTabContribution = {
|
|
22
|
-
id: string;
|
|
23
|
-
label: string;
|
|
24
|
-
icon?: unknown;
|
|
25
|
-
pluginId: string;
|
|
26
|
-
pluginName?: string;
|
|
27
|
-
order?: number;
|
|
28
|
-
render?: (container: HTMLElement) => void;
|
|
29
|
-
sections?: SettingsSectionContribution[];
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type SettingsTabManifest = Omit<
|
|
33
|
-
SettingsTabContribution,
|
|
34
|
-
'pluginId' | 'pluginName' | 'render'
|
|
35
|
-
>;
|
|
36
|
-
|
|
37
|
-
export type FeatureView = {
|
|
38
|
-
id: string;
|
|
39
|
-
title: string;
|
|
40
|
-
subtitle: string;
|
|
41
|
-
icon: unknown;
|
|
42
|
-
url: string;
|
|
43
|
-
active?: boolean;
|
|
44
|
-
pluginName?: string;
|
|
45
|
-
pluginId?: string;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type FeatureContextMenu = {
|
|
49
|
-
id: string;
|
|
50
|
-
label: string;
|
|
51
|
-
action: (targetElement: HTMLElement | null) => void;
|
|
52
|
-
condition?: (targetElement: HTMLElement | null) => boolean;
|
|
53
|
-
disabled?: boolean;
|
|
54
|
-
targetView?: string[];
|
|
55
|
-
pluginId?: string;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type PluginInfo = {
|
|
59
|
-
enabled: boolean;
|
|
60
|
-
id: string;
|
|
61
|
-
name: string;
|
|
62
|
-
version: string;
|
|
63
|
-
author: string;
|
|
64
|
-
main?: string;
|
|
65
|
-
description?: string;
|
|
66
|
-
features: {
|
|
67
|
-
views?: FeatureView[];
|
|
68
|
-
contextMenus?: FeatureContextMenu[];
|
|
69
|
-
settingsTabs?: SettingsTabManifest[];
|
|
70
|
-
};
|
|
71
|
-
};
|