@croffledev/croffle-types 1.1.1 → 1.1.3

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 CHANGED
@@ -39,18 +39,18 @@ pnpm add -D @croffledev/croffle-types
39
39
  Import the types to define your plugin structure. This ensures your plugin correctly implements the required lifecycle hooks and metadata.
40
40
 
41
41
  ```typescript
42
- import type { ICrofflePlugin, PluginContext } from "@croffledev/croffle-types";
42
+ import type { ICrofflePlugin, PluginContext } from '@croffledev/croffle-types';
43
43
 
44
44
  const myPlugin: ICrofflePlugin = {
45
- name: "MyAwesomePlugin",
46
- version: "1.0.0",
45
+ name: 'MyAwesomePlugin',
46
+ version: '1.0.0',
47
47
 
48
48
  onLoad(context: PluginContext) {
49
- console.log("Croffle Plugin Loaded!", context.appVersion);
49
+ console.log('Croffle Plugin Loaded!', context.appVersion);
50
50
  },
51
51
 
52
52
  onUnload() {
53
- console.log("Cleaning up...");
53
+ console.log('Cleaning up...');
54
54
  },
55
55
  };
56
56
 
@@ -0,0 +1,35 @@
1
+ import type { Schedule } from '../models/schedule';
2
+ import type { SearchQuery } from '../models/search';
3
+ import type { Tag } from '../models/tag';
4
+
5
+ export interface SchedulesApi {
6
+ getAll(period: { start: string; end: string }): Promise<Schedule[]>;
7
+ create(data: Partial<Schedule>): Promise<Schedule>;
8
+ update(id: string, data: Partial<Schedule>): Promise<Schedule>;
9
+ remove(id: string): Promise<boolean>;
10
+ exportSchedulesToFile(period?: {
11
+ start: string;
12
+ end: string;
13
+ }): Promise<{ filePath: string; count: number } | null>;
14
+ importScheduleFromFile(
15
+ mode?: 'merge' | 'duplicate',
16
+ ): Promise<{ created: number; updated: number } | null>;
17
+ }
18
+
19
+ export interface TagsApi {
20
+ getAll(): Promise<Tag[]>;
21
+ getByName(name: string): Promise<Tag | null>;
22
+ create(name: string, color: string): Promise<Tag>;
23
+ modify(id: string, name: string, color: string): Promise<Tag>;
24
+ remove(id: string): Promise<boolean>;
25
+ }
26
+
27
+ export interface SearchApi {
28
+ q(query: SearchQuery): Promise<Schedule[]>;
29
+ }
30
+
31
+ export interface CalendarApi {
32
+ schedules: SchedulesApi;
33
+ tags: TagsApi;
34
+ search: SearchApi;
35
+ }
package/api/event.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export interface EventApi {
2
+ emit(eventName: string, ...args: unknown[]): void;
3
+ on(eventName: string, callback: (...args: unknown[]) => void): () => void;
4
+ }
package/api/http.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { HttpResponse } from '../models/http';
2
+
3
+ export interface HttpApi {
4
+ get(
5
+ url: string,
6
+ params?: Record<string, string>,
7
+ headers?: Record<string, string>,
8
+ ): Promise<HttpResponse>;
9
+ post(url: string, body?: unknown, headers?: Record<string, string>): Promise<HttpResponse>;
10
+ }
package/api/os.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { ClipboardImageData, ClipboardResult, ClipboardTextData } from '../models/clipboard';
2
+
3
+ export interface OsApi {
4
+ showNotification(title: string, body: string): Promise<void>;
5
+ getClipboard(): Promise<ClipboardResult>;
6
+ setClipboard(data: ClipboardTextData | ClipboardImageData): Promise<void>;
7
+ }
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,7 @@
1
+ import type { AppSettings } from '../models/app-settings';
2
+
3
+ export interface SettingsApi {
4
+ getAll(): Promise<AppSettings>;
5
+ getOf(key: string): Promise<AppSettings[keyof AppSettings]>;
6
+ update(newSettings: Partial<AppSettings>): Promise<AppSettings>;
7
+ }
package/api/ui.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { SettingsSectionContribution } from '../models/plugin';
2
+
3
+ export type RegisterSettingsTabOptions = {
4
+ label: string;
5
+ icon?: unknown;
6
+ order?: number;
7
+ render?: (container: HTMLElement) => void;
8
+ sections?: SettingsSectionContribution[];
9
+ };
10
+
11
+ export interface UiApi {
12
+ registerView(viewId: string, renderFn: (container: HTMLElement) => void): void;
13
+ registerContextMenu(
14
+ target: string,
15
+ command: string,
16
+ label: string,
17
+ callback: (target: string) => void,
18
+ ): void;
19
+ /**
20
+ * 설정 모달에 탭을 추가합니다.
21
+ * @param tabId 고유 탭 ID (플러그인 ID와 조합해 `${pluginId}:${tabId}` 형태로 저장됨)
22
+ */
23
+ registerSettingsTab(tabId: string, options: RegisterSettingsTabOptions): void;
24
+ }
@@ -0,0 +1,8 @@
1
+ export interface WindowApi {
2
+ minimize(): Promise<void>;
3
+ maximize(): Promise<void>;
4
+ close(): Promise<void>;
5
+ exitApp(): Promise<void>;
6
+ checkForUpdates(): Promise<void>;
7
+ setCloseToTrayMode(enabled: boolean): Promise<void>;
8
+ }
@@ -0,0 +1,46 @@
1
+ import type { CalendarApi } from './api/calendar';
2
+ import type { EventApi } from './api/event';
3
+ import type { HttpApi } from './api/http';
4
+ import type { OsApi } from './api/os';
5
+ import type { PluginsApi } from './api/plugins';
6
+ import type { SettingsApi } from './api/settings';
7
+ import type { UiApi } from './api/ui';
8
+ import type { WindowApi } from './api/window';
9
+ import type { AppEventType } from './enums';
10
+ import type {
11
+ AppSettingLanguage,
12
+ AppSettingStartupBehavior,
13
+ AppSettingTheme,
14
+ CalendarTimeFormat,
15
+ CalendarView,
16
+ CalendarWeekStartDay,
17
+ } from './models/app-settings';
18
+ import type { ClipboardDataType } from './models/clipboard';
19
+
20
+ export interface EnumsApi {
21
+ AppSettingLanguage: typeof AppSettingLanguage;
22
+ AppSettingTheme: typeof AppSettingTheme;
23
+ AppSettingStartupBehavior: typeof AppSettingStartupBehavior;
24
+ CalendarView: typeof CalendarView;
25
+ CalendarWeekStartDay: typeof CalendarWeekStartDay;
26
+ CalendarTimeFormat: typeof CalendarTimeFormat;
27
+ ClipboardDataType: typeof ClipboardDataType;
28
+ AppEventType: typeof AppEventType;
29
+ }
30
+
31
+ /** Preload에 노출되는 호스트 API (ui 제외) */
32
+ export interface CroffleAPI {
33
+ window: WindowApi;
34
+ os: OsApi;
35
+ http: HttpApi;
36
+ event: EventApi;
37
+ calendar: CalendarApi;
38
+ settings: SettingsApi;
39
+ plugins: PluginsApi;
40
+ enums: EnumsApi;
41
+ }
42
+
43
+ /** 플러그인 activated(context)에 전달되는 API (+ ui) */
44
+ export type PluginContext = CroffleAPI & {
45
+ ui: UiApi;
46
+ };
package/enums.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ export declare enum AppEventType {
2
+ SCHEDULE_GET = 'schedule:get',
3
+ SCHEDULE_CREATE = 'schedule:create',
4
+ SCHEDULE_UPDATE = 'schedule:update',
5
+ SCHEDULE_DELETE = 'schedule:delete',
6
+ SCHEDULE_EXPORT_TO_FILE = 'schedule:exportToFile',
7
+ SCHEDULE_IMPORT_FROM_FILE = 'schedule:importFromFile',
8
+
9
+ TAG_GET = 'tag:getAll',
10
+ TAG_GET_BY_NAME = 'tag:getByName',
11
+ TAG_CREATE = 'tag:create',
12
+ TAG_UPDATE = 'tag:update',
13
+ TAG_DELETE = 'tag:delete',
14
+
15
+ PLUGIN_INFO_GET_INSTALLED = 'pluginInfo:getInstalled',
16
+ PLUGIN_INFO_GET_ENABLED = 'pluginInfo:getEnabled',
17
+ PLUGIN_INFO_GET_BY_NAME = 'pluginInfo:getByName',
18
+ PLUGIN_INFO_INSTALL = 'pluginInfo:install',
19
+ PLUGIN_INFO_TOGGLE = 'pluginInfo:toggle',
20
+ PLUGIN_INFO_UNINSTALL = 'pluginInfo:uninstall',
21
+
22
+ PLUGIN_STORAGE_GET = 'pluginStorage:get',
23
+ PLUGIN_STORAGE_SET = 'pluginStorage:set',
24
+ PLUGIN_STORAGE_DELETE = 'pluginStorage:delete',
25
+
26
+ SETTINGS_GET = 'settings:get',
27
+ SETTINGS_GET_OF = 'settings:getOf',
28
+ SETTINGS_UPDATE = 'settings:update',
29
+
30
+ WINDOW_MINIMIZE = 'window:minimize',
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',
36
+ WINDOW_SHOW = 'window:show',
37
+ WINDOW_HIDE = 'window:hide',
38
+
39
+ NATIVE_OS_NOTIFICATION = 'nativeOs:notification',
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
+
62
+ UPDATE_AVAILABLE = 'update:available',
63
+ UPDATE_NOT_AVAILABLE = 'update:notAvailable',
64
+ UPDATE_DOWNLOAD_PROGRESS = 'update:downloadProgress',
65
+ UPDATE_DOWNLOADED = 'update:downloaded',
66
+ UPDATE_ERROR = 'update:error',
67
+ UPDATE_DOWNLOAD_NOW = 'update:downloadNow',
68
+ UPDATE_DOWNLOAD_LATER = 'update:downloadLater',
69
+ UPDATE_SKIP_THIS_VERSION = 'update:skipThisVersion',
70
+ }
package/index.d.ts CHANGED
@@ -1,443 +1,17 @@
1
- export interface Schedule {
2
- id: string;
3
- title: string;
4
- description: string;
5
- location: string;
6
- startDate: string; // ISO 8601 format
7
- endDate: string; // ISO 8601 format
8
- isAllDay: boolean;
9
- recurrenceRule?: string;
10
- colorLabel: string;
11
- tags: Tag[];
12
- createdAt: string; // ISO 8601 format
13
- updatedAt: string; // ISO 8601 format
14
- }
15
-
16
- export interface Tag {
17
- id: string;
18
- name: string;
19
- color: string;
20
- }
21
-
22
- export interface SearchQuery {
23
- text?: string;
24
- dateRange?: {
25
- start: string; // ISO 8601 format
26
- end: string; // ISO 8601 format
27
- };
28
- tags?: Tag[];
29
- }
30
-
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;
39
- }
40
-
41
- export interface FeatureContextMenu {
42
- id: string;
43
- label: string;
44
- action: (targetElement: HTMLElement | null) => void;
45
- condition?: (targetElement: HTMLElement | null) => boolean;
46
- disabled?: boolean;
47
- targetView?: string[];
48
- }
49
-
50
- /** 설정 항목 스키마 (extension SDK / manifest 공용) */
51
- export type ConfigItemType =
52
- | "string"
53
- | "number"
54
- | "boolean"
55
- | "select"
56
- | "path";
57
-
58
- export interface ConfigItemSchema<T = unknown> {
59
- type: ConfigItemType;
60
- label: string;
61
- description?: string;
62
- defaultValue: T;
63
- options?: Array<{
64
- label: string;
65
- value: T extends string | number ? T : never;
66
- }>;
67
- }
68
-
69
- /** extension이 기여하는 설정 섹션 (선언형) */
70
- export interface SettingsSectionContribution {
71
- id: string;
72
- title?: string;
73
- description?: string;
74
- items: Record<string, ConfigItemSchema>;
75
- }
76
-
77
- /** extension이 기여하는 설정 탭 */
78
- export interface SettingsTabContribution {
79
- id: string;
80
- label: string;
81
- icon?: unknown;
82
- pluginId: string;
83
- pluginName?: string;
84
- order?: number;
85
- /** 커스텀 패널 렌더러 (Vue 외부 DOM 마운트) */
86
- render?: (container: HTMLElement) => void;
87
- /** 선언형 스키마 섹션 (render와 동시 사용 불가) */
88
- sections?: SettingsSectionContribution[];
89
- }
90
-
91
- /** manifest(plugin.json)에 선언 가능한 설정 탭 메타 (render 제외) */
92
- export type SettingsTabManifest = Omit<
93
- SettingsTabContribution,
94
- "pluginId" | "pluginName" | "render"
95
- >;
96
-
97
- export interface PluginInfo {
98
- enabled: boolean;
99
- id: string;
100
- name: string;
101
- version: string;
102
- author: string;
103
- main?: string;
104
- description?: string;
105
- features: {
106
- views?: FeatureView[];
107
- contextMenus?: FeatureContextMenu[];
108
- settingsTabs?: SettingsTabManifest[];
109
- };
110
- }
111
-
112
- export enum AppSettingLanguage {
113
- KO = "ko",
114
- EN = "en",
115
- }
116
-
117
- export enum AppSettingTheme {
118
- LIGHT = "light",
119
- DARK = "dark",
120
- SYSTEM = "system",
121
- }
122
-
123
- export enum AppSettingStartupBehavior {
124
- OPEN_LAST_SESSION = "openLastSession",
125
- OPEN_NEW_WINDOW = "openNewWindow",
126
- DO_NOTHING = "doNothing",
127
- }
128
-
129
- export enum CalendarView {
130
- DAY = "day",
131
- WEEK = "week",
132
- MONTH = "month",
133
- YEAR = "year",
134
- }
135
-
136
- export enum CalendarWeekStartDay {
137
- SUNDAY = "sunday",
138
- MONDAY = "monday",
139
- }
140
-
141
- export enum CalendarTimeFormat {
142
- H12 = "12h",
143
- H24 = "24h",
144
- }
145
-
146
- export interface AppSettings {
147
- general: {
148
- language: AppSettingLanguage;
149
- theme: AppSettingTheme;
150
- autoUpdate: boolean;
151
- startupBehavior: AppSettingStartupBehavior;
152
- startOnSystemBoot: boolean;
153
- startMinimized: boolean;
154
- };
155
- calendar: {
156
- defaultView: CalendarView;
157
- weekStartDay: CalendarWeekStartDay;
158
- showWeekNumbers: boolean;
159
- timeFormat: CalendarTimeFormat;
160
- };
161
- notifications: {
162
- enabled: boolean;
163
- defaultReminderMinutes: number;
164
- };
165
- }
166
-
167
- export enum ClipboardDataType {
168
- TEXT = "text",
169
- IMAGE = "image",
170
- EMPTY = "empty",
171
- ERROR = "error",
172
- }
173
-
174
- export interface ClipboardResult {
175
- type: ClipboardDataType;
176
- value: string | Buffer | null;
177
- }
178
-
179
- export interface ClipboardTextData {
180
- type: ClipboardDataType.TEXT;
181
- value: string;
182
- }
183
-
184
- export interface ClipboardImageData {
185
- type: ClipboardDataType.IMAGE;
186
- value: Buffer;
187
- }
188
-
189
- export interface HttpResponse<T = unknown> {
190
- ok: boolean;
191
- status: number;
192
- data: T | null;
193
- }
194
-
195
- export enum AppEventType {
196
- SCHEDULE_GET = "schedule:get",
197
- SCHEDULE_CREATE = "schedule:create",
198
- SCHEDULE_UPDATE = "schedule:update",
199
- SCHEDULE_DELETE = "schedule:delete",
200
- SCHEDULE_EXPORT_TO_FILE = "schedule:exportToFile",
201
- SCHEDULE_IMPORT_FROM_FILE = "schedule:importFromFile",
202
-
203
- TAG_GET = "tag:getAll",
204
- TAG_GET_BY_NAME = "tag:getByName",
205
- TAG_CREATE = "tag:create",
206
- TAG_UPDATE = "tag:update",
207
- TAG_DELETE = "tag:delete",
208
-
209
- PLUGIN_INFO_GET_INSTALLED = "pluginInfo:getInstalled",
210
- PLUGIN_INFO_GET_ENABLED = "pluginInfo:getEnabled",
211
- PLUGIN_INFO_GET_BY_NAME = "pluginInfo:getByName",
212
- PLUGIN_INFO_CREATE = "pluginInfo:create",
213
- PLUGIN_INFO_UPDATE = "pluginInfo:update",
214
- PLUGIN_INFO_DELETE = "pluginInfo:delete",
215
-
216
- PLUGIN_STORAGE_GET = "pluginStorage:get",
217
- PLUGIN_STORAGE_SET = "pluginStorage:set",
218
- PLUGIN_STORAGE_DELETE = "pluginStorage:delete",
219
-
220
- SETTINGS_GET = "settings:get",
221
- SETTINGS_GET_OF = "settings:getOf",
222
- SETTINGS_UPDATE = "settings:update",
223
-
224
- WINDOW_MINIMIZE = "window:minimize",
225
- WINDOW_RESTORE = "window:restore",
226
- WINDOW_MAXIMIZE = "window:maximize",
227
- WINDOW_CLOSE = "window:close",
228
- WINDOW_EXIT = "window:exit",
229
- WINDOW_CHECK_FOR_UPDATES = "window:checkForUpdates",
230
- WINDOW_SHOW = "window:show",
231
- WINDOW_HIDE = "window:hide",
232
-
233
- NATIVE_OS_NOTIFICATION = "nativeOs:notification",
234
- NATIVE_OS_CLIPBOARD_GET = "nativeOs:clipboard:get",
235
- NATIVE_OS_CLIPBOARD_SET = "nativeOs:clipboard:set",
236
-
237
- HTTP_SERVICE_GET = "httpService:get",
238
- HTTP_SERVICE_POST = "httpService:post",
239
-
240
- PLUGIN_INSTALL = "plugin:install",
241
- PLUGIN_TOGGLE = "plugin:toggle",
242
- PLUGIN_UNINSTALL = "plugin:uninstall",
243
-
244
- PLUGIN_SESSION_STORAGE_GET = "sessionStorage:get",
245
- PLUGIN_SESSION_STORAGE_SET = "sessionStorage:set",
246
- PLUGIN_SESSION_STORAGE_CLEAR = "sessionStorage:clear",
247
- PLUGIN_SESSION_STORAGE_DELETE = "sessionStorage:delete",
248
- PLUGIN_SESSION_STORAGE_CLEAR_ALL = "sessionStorage:clearAll",
249
-
250
- SCHEDULER_REGISTER = "scheduler:register",
251
- SCHEDULER_UNREGISTER = "scheduler:unregister",
252
-
253
- UI_ADD_MENU_ITEM = "ui:addMenuItem",
254
- UI_CONTEXT_MENU_ADD_ITEM = "ui:contextMenu:addItem",
255
- }
256
-
257
- /** ui.registerSettingsTab 옵션 */
258
- export interface RegisterSettingsTabOptions {
259
- label: string;
260
- icon?: unknown;
261
- order?: number;
262
- render?: (container: HTMLElement) => void;
263
- sections?: SettingsSectionContribution[];
264
- }
265
-
266
- export interface PluginContext {
267
- base: typeof base;
268
- app: typeof app;
269
- enums: typeof enums;
270
- ui: typeof ui;
271
- }
272
-
273
- export namespace windows {
274
- export function minimize(): Promise<void>;
275
- export function maximize(): Promise<void>;
276
- export function close(): Promise<void>;
277
- export function exitApp(): Promise<void>;
278
- export function checkForUpdates(): Promise<void>;
279
- export function setCloseToTrayMode(enabled: boolean): Promise<void>;
280
- }
281
-
282
- export namespace tags {
283
- export function getAll(): Promise<Tag[]>;
284
- export function getByName(name: string): Promise<Tag | null>;
285
- export function create(name: string, color: string): Promise<Tag>;
286
- export function modify(id: string, name: string, color: string): Promise<Tag>;
287
- export function remove(id: string): Promise<boolean>;
288
- }
289
-
290
- export namespace schedules {
291
- export function getAll(period: {
292
- start: string;
293
- end: string;
294
- }): Promise<Schedule[]>;
295
- export function create(data: Partial<Schedule>): Promise<Schedule>;
296
- export function update(
297
- id: string,
298
- data: Partial<Schedule>,
299
- ): Promise<Schedule>;
300
- export function remove(id: string): Promise<boolean>;
301
- export function exportSchedulesToFile(period?: {
302
- start: string;
303
- end: string;
304
- }): Promise<{ filePath: string; count: number } | null>;
305
- export function importScheduleFromFile(
306
- mode?: "merge" | "duplicate",
307
- ): Promise<{ created: number; updated: number } | null>;
308
- }
309
-
310
- export namespace pluginInfo {
311
- export function getInstalled(): Promise<PluginInfo[]>;
312
- export function getEnabled(): Promise<PluginInfo[]>;
313
- export function getByName(name: string): Promise<PluginInfo | null>;
314
- export function install(data: Partial<PluginInfo>): Promise<PluginInfo>;
315
- export function installFromLocal(zipPath: string): Promise<PluginInfo>;
316
- export function toggle(
317
- name: string,
318
- enable: boolean,
319
- ): Promise<PluginInfo | null>;
320
- export function uninstall(name: string): Promise<boolean>;
321
- }
322
-
323
- export namespace search {
324
- export function search(query: SearchQuery): Promise<Schedule[]>;
325
- }
326
-
327
- /** 앱 전역 설정 (settings.json) */
328
- export namespace settings {
329
- export function getAll(): Promise<AppSettings>;
330
- export function getOf(key: string): Promise<AppSettings[keyof AppSettings]>;
331
- export function update(
332
- newSettings: Partial<AppSettings>,
333
- ): Promise<AppSettings>;
334
- }
335
-
336
- /** 플러그인별 설정 저장소 (pluginStorage 기반) */
337
- export namespace pluginSettings {
338
- export function get<T = Record<string, unknown>>(
339
- pluginId: string,
340
- storageKey?: string,
341
- ): Promise<T>;
342
- export function set(
343
- pluginId: string,
344
- values: Record<string, unknown>,
345
- storageKey?: string,
346
- ): Promise<void>;
347
- }
348
-
349
- export namespace pluginStorage {
350
- export function get(pluginId: string, key: string): Promise<string | null>;
351
- export function set(
352
- pluginId: string,
353
- key: string,
354
- value: string,
355
- ): Promise<void>;
356
- }
357
-
358
- export namespace os {
359
- export function showNotification(title: string, body: string): Promise<void>;
360
- export function getClipboard(): Promise<ClipboardResult>;
361
- export function setClipboard(
362
- data: ClipboardTextData | ClipboardImageData,
363
- ): Promise<void>;
364
- }
365
-
366
- export namespace http {
367
- export function get(
368
- url: string,
369
- params?: Record<string, string>,
370
- headers?: Record<string, string>,
371
- ): Promise<HttpResponse>;
372
- export function post(
373
- url: string,
374
- body?: unknown,
375
- headers?: Record<string, string>,
376
- ): Promise<HttpResponse>;
377
- }
378
-
379
- export namespace event {
380
- export function emit(type: string, payload: unknown): void;
381
- export function on(
382
- type: string,
383
- callback: (payload: unknown) => void,
384
- ): () => void;
385
- }
386
-
387
- export const base: {
388
- windows: typeof windows;
389
- tags: typeof tags;
390
- schedules: typeof schedules;
391
- pluginInfo: typeof pluginInfo;
392
- search: typeof search;
393
- settings: typeof settings;
394
- pluginSettings: typeof pluginSettings;
395
- };
396
-
397
- export interface PluginSessionAPI {
398
- get: <T = unknown>(pluginId: string, key: string) => Promise<T | null>;
399
- set: <T = unknown>(pluginId: string, key: string, value: T) => Promise<void>;
400
- delete: (pluginId: string, key: string) => Promise<boolean>;
401
- clear: (pluginId: string) => Promise<void>;
402
- clearAll: () => Promise<void>;
403
- }
404
-
405
- export const app: {
406
- os: typeof os;
407
- http: typeof http;
408
- storage: typeof pluginStorage;
409
- event: typeof event;
410
- session: PluginSessionAPI;
411
- };
412
-
413
- export const enums: {
414
- AppSettingLanguage: typeof AppSettingLanguage;
415
- AppSettingTheme: typeof AppSettingTheme;
416
- AppSettingStartupBehavior: typeof AppSettingStartupBehavior;
417
- CalendarView: typeof CalendarView;
418
- CalendarWeekStartDay: typeof CalendarWeekStartDay;
419
- CalendarTimeFormat: typeof CalendarTimeFormat;
420
- ClipboardDataType: typeof ClipboardDataType;
421
- AppEventType: typeof AppEventType;
422
- };
423
-
424
- export const ui: {
425
- registerView: (
426
- viewId: string,
427
- renderFn: (container: HTMLElement) => void,
428
- ) => void;
429
- registerContextMenu: (
430
- target: string,
431
- command: string,
432
- label: string,
433
- callback: (target: string) => void,
434
- ) => void;
435
- /**
436
- * 설정 모달에 탭을 추가합니다.
437
- * @param tabId 고유 탭 ID (플러그인 ID와 조합해 `${pluginId}:${tabId}` 형태로 저장됨)
438
- */
439
- registerSettingsTab: (
440
- tabId: string,
441
- options: RegisterSettingsTabOptions,
442
- ) => void;
443
- };
1
+ export * from './models/tag';
2
+ export * from './models/schedule';
3
+ export * from './models/search';
4
+ export * from './models/plugin';
5
+ export * from './models/app-settings';
6
+ export * from './models/clipboard';
7
+ export * from './models/http';
8
+ export * from './enums';
9
+ export * from './api/window';
10
+ export * from './api/calendar';
11
+ export * from './api/plugins';
12
+ export * from './api/settings';
13
+ export * from './api/os';
14
+ export * from './api/http';
15
+ export * from './api/event';
16
+ export * from './api/ui';
17
+ export * from './croffle-api';
@@ -0,0 +1,54 @@
1
+ export declare enum AppSettingLanguage {
2
+ KO = 'ko',
3
+ EN = 'en',
4
+ }
5
+
6
+ export declare enum AppSettingTheme {
7
+ LIGHT = 'light',
8
+ DARK = 'dark',
9
+ SYSTEM = 'system',
10
+ }
11
+
12
+ export declare enum AppSettingStartupBehavior {
13
+ OPEN_LAST_SESSION = 'openLastSession',
14
+ OPEN_NEW_WINDOW = 'openNewWindow',
15
+ DO_NOTHING = 'doNothing',
16
+ }
17
+
18
+ export declare enum CalendarView {
19
+ DAY = 'day',
20
+ WEEK = 'week',
21
+ MONTH = 'month',
22
+ YEAR = 'year',
23
+ }
24
+
25
+ export declare enum CalendarWeekStartDay {
26
+ SUNDAY = 'sunday',
27
+ MONDAY = 'monday',
28
+ }
29
+
30
+ export declare enum CalendarTimeFormat {
31
+ H12 = '12h',
32
+ H24 = '24h',
33
+ }
34
+
35
+ export type AppSettings = {
36
+ general: {
37
+ language: AppSettingLanguage;
38
+ theme: AppSettingTheme;
39
+ autoUpdate: boolean;
40
+ startupBehavior: AppSettingStartupBehavior;
41
+ startOnSystemBoot: boolean;
42
+ startMinimized: boolean;
43
+ };
44
+ calendar: {
45
+ defaultView: CalendarView;
46
+ weekStartDay: CalendarWeekStartDay;
47
+ showWeekNumbers: boolean;
48
+ timeFormat: CalendarTimeFormat;
49
+ };
50
+ notifications: {
51
+ enabled: boolean;
52
+ defaultReminderMinutes: number;
53
+ };
54
+ };
@@ -0,0 +1,21 @@
1
+ export declare enum ClipboardDataType {
2
+ TEXT = 'text',
3
+ IMAGE = 'image',
4
+ EMPTY = 'empty',
5
+ ERROR = 'error',
6
+ }
7
+
8
+ export type ClipboardResult = {
9
+ type: ClipboardDataType;
10
+ value: string | Buffer | null;
11
+ };
12
+
13
+ export type ClipboardTextData = {
14
+ type: ClipboardDataType.TEXT;
15
+ value: string;
16
+ };
17
+
18
+ export type ClipboardImageData = {
19
+ type: ClipboardDataType.IMAGE;
20
+ value: Buffer;
21
+ };
@@ -0,0 +1,5 @@
1
+ export type HttpResponse<T = unknown> = {
2
+ ok: boolean;
3
+ status: number;
4
+ data: T | null;
5
+ };
@@ -0,0 +1,71 @@
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
+ };
@@ -0,0 +1,16 @@
1
+ import type { Tag } from './tag';
2
+
3
+ export type Schedule = {
4
+ id: string;
5
+ title: string;
6
+ description: string;
7
+ location: string;
8
+ startDate: string; // ISO 8601
9
+ endDate: string; // ISO 8601
10
+ isAllDay: boolean;
11
+ recurrenceRule?: string;
12
+ colorLabel: string;
13
+ tags: Tag[];
14
+ createdAt: string; // ISO 8601
15
+ updatedAt: string; // ISO 8601
16
+ };
@@ -0,0 +1,10 @@
1
+ import type { Tag } from './tag';
2
+
3
+ export type SearchQuery = {
4
+ text?: string;
5
+ dateRange?: {
6
+ start: string; // ISO 8601
7
+ end: string; // ISO 8601
8
+ };
9
+ tags?: Tag[];
10
+ };
@@ -0,0 +1,5 @@
1
+ export type Tag = {
2
+ id: string;
3
+ name: string;
4
+ color: string;
5
+ };
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@croffledev/croffle-types",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Croffle project type definitions.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "main": "",
8
7
  "types": "./index.d.ts",
9
8
  "exports": {
10
9
  ".": {
@@ -12,14 +11,19 @@
12
11
  }
13
12
  },
14
13
  "files": [
15
- "index.d.ts"
14
+ "index.d.ts",
15
+ "enums.d.ts",
16
+ "croffle-api.d.ts",
17
+ "models",
18
+ "api"
16
19
  ],
17
20
  "publishConfig": {
18
21
  "access": "public"
19
22
  },
20
23
  "repository": {
21
24
  "type": "git",
22
- "url": "git+https://github.com/team-croffle/croffle-types.git"
25
+ "url": "git+https://github.com/team-croffle/croffle.git",
26
+ "directory": "packages/types"
23
27
  },
24
28
  "author": {
25
29
  "name": "Croffle Team",
@@ -28,6 +32,5 @@
28
32
  },
29
33
  "dependencies": {
30
34
  "@types/node": "^25.5.0"
31
- },
32
- "packageManager": "yarn@4.13.0"
33
- }
35
+ }
36
+ }