@croffledev/croffle-types 1.0.1 → 1.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/index.d.ts +96 -74
- package/package.json +7 -2
package/index.d.ts
CHANGED
|
@@ -29,24 +29,63 @@ export interface SearchQuery {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface FeatureView {
|
|
32
|
-
id: string;
|
|
33
|
-
title: string;
|
|
34
|
-
subtitle: string;
|
|
35
|
-
icon: unknown;
|
|
36
|
-
url: string;
|
|
37
|
-
active?: boolean;
|
|
38
|
-
pluginName?: string;
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
subtitle: string;
|
|
35
|
+
icon: unknown;
|
|
36
|
+
url: string;
|
|
37
|
+
active?: boolean;
|
|
38
|
+
pluginName?: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface FeatureContextMenu {
|
|
42
|
-
id: string;
|
|
43
|
-
label: string;
|
|
44
|
-
action: (targetElement: HTMLElement | null) => void;
|
|
42
|
+
id: string;
|
|
43
|
+
label: string;
|
|
44
|
+
action: (targetElement: HTMLElement | null) => void;
|
|
45
45
|
condition?: (targetElement: HTMLElement | null) => boolean;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
targetView?: string[];
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
targetView?: string[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 설정 항목 스키마 (extension SDK / manifest 공용) */
|
|
51
|
+
export type ConfigItemType = "string" | "number" | "boolean" | "select" | "path";
|
|
52
|
+
|
|
53
|
+
export interface ConfigItemSchema<T = unknown> {
|
|
54
|
+
type: ConfigItemType;
|
|
55
|
+
label: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
defaultValue: T;
|
|
58
|
+
options?: Array<{ label: string; value: T extends string | number ? T : never }>;
|
|
48
59
|
}
|
|
49
60
|
|
|
61
|
+
/** extension이 기여하는 설정 섹션 (선언형) */
|
|
62
|
+
export interface SettingsSectionContribution {
|
|
63
|
+
id: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
items: Record<string, ConfigItemSchema>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** extension이 기여하는 설정 탭 */
|
|
70
|
+
export interface SettingsTabContribution {
|
|
71
|
+
id: string;
|
|
72
|
+
label: string;
|
|
73
|
+
icon?: unknown;
|
|
74
|
+
pluginId: string;
|
|
75
|
+
pluginName?: string;
|
|
76
|
+
order?: number;
|
|
77
|
+
/** 커스텀 패널 렌더러 (Vue 외부 DOM 마운트) */
|
|
78
|
+
render?: (container: HTMLElement) => void;
|
|
79
|
+
/** 선언형 스키마 섹션 (render와 동시 사용 불가) */
|
|
80
|
+
sections?: SettingsSectionContribution[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** manifest(plugin.json)에 선언 가능한 설정 탭 메타 (render 제외) */
|
|
84
|
+
export type SettingsTabManifest = Omit<
|
|
85
|
+
SettingsTabContribution,
|
|
86
|
+
"pluginId" | "pluginName" | "render"
|
|
87
|
+
>;
|
|
88
|
+
|
|
50
89
|
export interface PluginInfo {
|
|
51
90
|
enabled: boolean;
|
|
52
91
|
id: string;
|
|
@@ -58,6 +97,7 @@ export interface PluginInfo {
|
|
|
58
97
|
features: {
|
|
59
98
|
views?: FeatureView[];
|
|
60
99
|
contextMenus?: FeatureContextMenu[];
|
|
100
|
+
settingsTabs?: SettingsTabManifest[];
|
|
61
101
|
};
|
|
62
102
|
}
|
|
63
103
|
|
|
@@ -144,9 +184,7 @@ export interface HttpResponse<T = unknown> {
|
|
|
144
184
|
data: T | null;
|
|
145
185
|
}
|
|
146
186
|
|
|
147
|
-
// IPC Event Types in main process
|
|
148
187
|
export enum AppEventType {
|
|
149
|
-
// Schedule
|
|
150
188
|
SCHEDULE_GET = "schedule:get",
|
|
151
189
|
SCHEDULE_CREATE = "schedule:create",
|
|
152
190
|
SCHEDULE_UPDATE = "schedule:update",
|
|
@@ -154,14 +192,12 @@ export enum AppEventType {
|
|
|
154
192
|
SCHEDULE_EXPORT_TO_FILE = "schedule:exportToFile",
|
|
155
193
|
SCHEDULE_IMPORT_FROM_FILE = "schedule:importFromFile",
|
|
156
194
|
|
|
157
|
-
// Tag
|
|
158
195
|
TAG_GET = "tag:getAll",
|
|
159
196
|
TAG_GET_BY_NAME = "tag:getByName",
|
|
160
197
|
TAG_CREATE = "tag:create",
|
|
161
198
|
TAG_UPDATE = "tag:update",
|
|
162
199
|
TAG_DELETE = "tag:delete",
|
|
163
200
|
|
|
164
|
-
// Plugin Info
|
|
165
201
|
PLUGIN_INFO_GET_INSTALLED = "pluginInfo:getInstalled",
|
|
166
202
|
PLUGIN_INFO_GET_ENABLED = "pluginInfo:getEnabled",
|
|
167
203
|
PLUGIN_INFO_GET_BY_NAME = "pluginInfo:getByName",
|
|
@@ -169,17 +205,14 @@ export enum AppEventType {
|
|
|
169
205
|
PLUGIN_INFO_UPDATE = "pluginInfo:update",
|
|
170
206
|
PLUGIN_INFO_DELETE = "pluginInfo:delete",
|
|
171
207
|
|
|
172
|
-
// Plugin Storage
|
|
173
208
|
PLUGIN_STORAGE_GET = "pluginStorage:get",
|
|
174
209
|
PLUGIN_STORAGE_SET = "pluginStorage:set",
|
|
175
210
|
PLUGIN_STORAGE_DELETE = "pluginStorage:delete",
|
|
176
211
|
|
|
177
|
-
// Settings
|
|
178
212
|
SETTINGS_GET = "settings:get",
|
|
179
213
|
SETTINGS_GET_OF = "settings:getOf",
|
|
180
214
|
SETTINGS_UPDATE = "settings:update",
|
|
181
215
|
|
|
182
|
-
// Window
|
|
183
216
|
WINDOW_MINIMIZE = "window:minimize",
|
|
184
217
|
WINDOW_RESTORE = "window:restore",
|
|
185
218
|
WINDOW_MAXIMIZE = "window:maximize",
|
|
@@ -189,36 +222,39 @@ export enum AppEventType {
|
|
|
189
222
|
WINDOW_SHOW = "window:show",
|
|
190
223
|
WINDOW_HIDE = "window:hide",
|
|
191
224
|
|
|
192
|
-
// OS Service
|
|
193
225
|
NATIVE_OS_NOTIFICATION = "nativeOs:notification",
|
|
194
226
|
NATIVE_OS_CLIPBOARD_GET = "nativeOs:clipboard:get",
|
|
195
227
|
NATIVE_OS_CLIPBOARD_SET = "nativeOs:clipboard:set",
|
|
196
228
|
|
|
197
|
-
// HTTP Service
|
|
198
229
|
HTTP_SERVICE_GET = "httpService:get",
|
|
199
230
|
HTTP_SERVICE_POST = "httpService:post",
|
|
200
231
|
|
|
201
|
-
// Plugin
|
|
202
232
|
PLUGIN_INSTALL = "plugin:install",
|
|
203
233
|
PLUGIN_TOGGLE = "plugin:toggle",
|
|
204
234
|
PLUGIN_UNINSTALL = "plugin:uninstall",
|
|
205
235
|
|
|
206
|
-
// Plugin Session Storage
|
|
207
236
|
PLUGIN_SESSION_STORAGE_GET = "sessionStorage:get",
|
|
208
237
|
PLUGIN_SESSION_STORAGE_SET = "sessionStorage:set",
|
|
209
238
|
PLUGIN_SESSION_STORAGE_CLEAR = "sessionStorage:clear",
|
|
210
239
|
PLUGIN_SESSION_STORAGE_DELETE = "sessionStorage:delete",
|
|
211
240
|
PLUGIN_SESSION_STORAGE_CLEAR_ALL = "sessionStorage:clearAll",
|
|
212
241
|
|
|
213
|
-
// Background works
|
|
214
242
|
SCHEDULER_REGISTER = "scheduler:register",
|
|
215
243
|
SCHEDULER_UNREGISTER = "scheduler:unregister",
|
|
216
244
|
|
|
217
|
-
// UI Extensions
|
|
218
245
|
UI_ADD_MENU_ITEM = "ui:addMenuItem",
|
|
219
246
|
UI_CONTEXT_MENU_ADD_ITEM = "ui:contextMenu:addItem",
|
|
220
247
|
}
|
|
221
248
|
|
|
249
|
+
/** ui.registerSettingsTab 옵션 */
|
|
250
|
+
export interface RegisterSettingsTabOptions {
|
|
251
|
+
label: string;
|
|
252
|
+
icon?: unknown;
|
|
253
|
+
order?: number;
|
|
254
|
+
render?: (container: HTMLElement) => void;
|
|
255
|
+
sections?: SettingsSectionContribution[];
|
|
256
|
+
}
|
|
257
|
+
|
|
222
258
|
export interface PluginContext {
|
|
223
259
|
base: typeof base;
|
|
224
260
|
app: typeof app;
|
|
@@ -244,15 +280,9 @@ export namespace tags {
|
|
|
244
280
|
}
|
|
245
281
|
|
|
246
282
|
export namespace schedules {
|
|
247
|
-
export function getAll(period: {
|
|
248
|
-
start: string;
|
|
249
|
-
end: string;
|
|
250
|
-
}): Promise<Schedule[]>;
|
|
283
|
+
export function getAll(period: { start: string; end: string }): Promise<Schedule[]>;
|
|
251
284
|
export function create(data: Partial<Schedule>): Promise<Schedule>;
|
|
252
|
-
export function update(
|
|
253
|
-
id: string,
|
|
254
|
-
data: Partial<Schedule>,
|
|
255
|
-
): Promise<Schedule>;
|
|
285
|
+
export function update(id: string, data: Partial<Schedule>): Promise<Schedule>;
|
|
256
286
|
export function remove(id: string): Promise<boolean>;
|
|
257
287
|
export function exportSchedulesToFile(period?: {
|
|
258
288
|
start: string;
|
|
@@ -268,10 +298,7 @@ export namespace pluginInfo {
|
|
|
268
298
|
export function getEnabled(): Promise<PluginInfo[]>;
|
|
269
299
|
export function getByName(name: string): Promise<PluginInfo | null>;
|
|
270
300
|
export function install(data: Partial<PluginInfo>): Promise<PluginInfo>;
|
|
271
|
-
export function toggle(
|
|
272
|
-
name: string,
|
|
273
|
-
enable: boolean,
|
|
274
|
-
): Promise<PluginInfo | null>;
|
|
301
|
+
export function toggle(name: string, enable: boolean): Promise<PluginInfo | null>;
|
|
275
302
|
export function uninstall(name: string): Promise<boolean>;
|
|
276
303
|
}
|
|
277
304
|
|
|
@@ -279,29 +306,35 @@ export namespace search {
|
|
|
279
306
|
export function search(query: SearchQuery): Promise<Schedule[]>;
|
|
280
307
|
}
|
|
281
308
|
|
|
309
|
+
/** 앱 전역 설정 (settings.json) */
|
|
282
310
|
export namespace settings {
|
|
283
311
|
export function getAll(): Promise<AppSettings>;
|
|
284
312
|
export function getOf(key: string): Promise<AppSettings[keyof AppSettings]>;
|
|
285
|
-
export function update(
|
|
286
|
-
newSettings: Partial<AppSettings>,
|
|
287
|
-
): Promise<AppSettings>;
|
|
313
|
+
export function update(newSettings: Partial<AppSettings>): Promise<AppSettings>;
|
|
288
314
|
}
|
|
289
315
|
|
|
290
|
-
|
|
291
|
-
|
|
316
|
+
/** 플러그인별 설정 저장소 (pluginStorage 기반) */
|
|
317
|
+
export namespace pluginSettings {
|
|
318
|
+
export function get<T = Record<string, unknown>>(
|
|
319
|
+
pluginId: string,
|
|
320
|
+
storageKey?: string,
|
|
321
|
+
): Promise<T>;
|
|
292
322
|
export function set(
|
|
293
323
|
pluginId: string,
|
|
294
|
-
|
|
295
|
-
|
|
324
|
+
values: Record<string, unknown>,
|
|
325
|
+
storageKey?: string,
|
|
296
326
|
): Promise<void>;
|
|
297
327
|
}
|
|
298
328
|
|
|
329
|
+
export namespace pluginStorage {
|
|
330
|
+
export function get(pluginId: string, key: string): Promise<string | null>;
|
|
331
|
+
export function set(pluginId: string, key: string, value: string): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
299
334
|
export namespace os {
|
|
300
335
|
export function showNotification(title: string, body: string): Promise<void>;
|
|
301
336
|
export function getClipboard(): Promise<ClipboardResult>;
|
|
302
|
-
export function setClipboard(
|
|
303
|
-
data: ClipboardTextData | ClipboardImageData,
|
|
304
|
-
): Promise<void>;
|
|
337
|
+
export function setClipboard(data: ClipboardTextData | ClipboardImageData): Promise<void>;
|
|
305
338
|
}
|
|
306
339
|
|
|
307
340
|
export namespace http {
|
|
@@ -318,22 +351,8 @@ export namespace http {
|
|
|
318
351
|
}
|
|
319
352
|
|
|
320
353
|
export namespace event {
|
|
321
|
-
/**
|
|
322
|
-
* Send event to all windows
|
|
323
|
-
* @param type event type
|
|
324
|
-
* @param payload event payload
|
|
325
|
-
*/
|
|
326
354
|
export function emit(type: string, payload: unknown): void;
|
|
327
|
-
|
|
328
|
-
* Listen to event from all windows
|
|
329
|
-
* @param type event type
|
|
330
|
-
* @param callback callback function
|
|
331
|
-
* @returns unsubscribe function
|
|
332
|
-
*/
|
|
333
|
-
export function on(
|
|
334
|
-
type: string,
|
|
335
|
-
callback: (payload: unknown) => void,
|
|
336
|
-
): () => void;
|
|
355
|
+
export function on(type: string, callback: (payload: unknown) => void): () => void;
|
|
337
356
|
}
|
|
338
357
|
|
|
339
358
|
export const base: {
|
|
@@ -343,14 +362,7 @@ export const base: {
|
|
|
343
362
|
pluginInfo: typeof pluginInfo;
|
|
344
363
|
search: typeof search;
|
|
345
364
|
settings: typeof settings;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
export const app: {
|
|
349
|
-
os: typeof os;
|
|
350
|
-
http: typeof http;
|
|
351
|
-
storage: typeof pluginStorage;
|
|
352
|
-
event: typeof event;
|
|
353
|
-
session: PluginSessionAPI;
|
|
365
|
+
pluginSettings: typeof pluginSettings;
|
|
354
366
|
};
|
|
355
367
|
|
|
356
368
|
export interface PluginSessionAPI {
|
|
@@ -361,6 +373,14 @@ export interface PluginSessionAPI {
|
|
|
361
373
|
clearAll: () => Promise<void>;
|
|
362
374
|
}
|
|
363
375
|
|
|
376
|
+
export const app: {
|
|
377
|
+
os: typeof os;
|
|
378
|
+
http: typeof http;
|
|
379
|
+
storage: typeof pluginStorage;
|
|
380
|
+
event: typeof event;
|
|
381
|
+
session: PluginSessionAPI;
|
|
382
|
+
};
|
|
383
|
+
|
|
364
384
|
export const enums: {
|
|
365
385
|
AppSettingLanguage: typeof AppSettingLanguage;
|
|
366
386
|
AppSettingTheme: typeof AppSettingTheme;
|
|
@@ -373,14 +393,16 @@ export const enums: {
|
|
|
373
393
|
};
|
|
374
394
|
|
|
375
395
|
export const ui: {
|
|
376
|
-
registerView: (
|
|
377
|
-
viewId: string,
|
|
378
|
-
renderFn: (container: HTMLElement) => void,
|
|
379
|
-
) => void;
|
|
396
|
+
registerView: (viewId: string, renderFn: (container: HTMLElement) => void) => void;
|
|
380
397
|
registerContextMenu: (
|
|
381
398
|
target: string,
|
|
382
399
|
command: string,
|
|
383
400
|
label: string,
|
|
384
401
|
callback: (target: string) => void,
|
|
385
402
|
) => void;
|
|
403
|
+
/**
|
|
404
|
+
* 설정 모달에 탭을 추가합니다.
|
|
405
|
+
* @param tabId 고유 탭 ID (플러그인 ID와 조합해 `${pluginId}:${tabId}` 형태로 저장됨)
|
|
406
|
+
*/
|
|
407
|
+
registerSettingsTab: (tabId: string, options: RegisterSettingsTabOptions) => void;
|
|
386
408
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@croffledev/croffle-types",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Croffle project type definitions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "",
|
|
8
|
-
"types": "index.d.ts",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
9
14
|
"files": [
|
|
10
15
|
"index.d.ts"
|
|
11
16
|
],
|