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