@croffledev/croffle-types 1.7.0 → 1.8.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/ui.d.ts +23 -1
- package/models/extension.d.ts +7 -1
- package/package.json +1 -1
package/api/ui.d.ts
CHANGED
|
@@ -8,14 +8,36 @@ export type RegisterConfigurationTabOptions = {
|
|
|
8
8
|
sections?: ConfigurationSectionContribution[];
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
export type ContextMenuHandlerOptions = {
|
|
12
|
+
condition?: (target: HTMLElement | null) => boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
11
15
|
export interface UiApi {
|
|
12
16
|
registerView(viewId: string, renderFn: (container: HTMLElement) => void): void;
|
|
17
|
+
/**
|
|
18
|
+
* 코드만으로 컨텍스트 메뉴 항목을 추가합니다. manifest에 선언한 항목은 `onContextMenu`를 쓰세요.
|
|
19
|
+
* @param target 메뉴가 뜨는 화면 (`calendar` 또는 확장 viewId)
|
|
20
|
+
* @param callback 우클릭한 요소(날짜 칸, 일정 등)를 받습니다. 없으면 `null`.
|
|
21
|
+
*/
|
|
13
22
|
registerContextMenu(
|
|
14
23
|
target: string,
|
|
15
24
|
command: string,
|
|
16
25
|
label: string,
|
|
17
|
-
callback: (target:
|
|
26
|
+
callback: (target: HTMLElement | null) => void,
|
|
18
27
|
): void;
|
|
28
|
+
/**
|
|
29
|
+
* manifest `contributes.contextMenus`에 선언한 항목에 동작을 붙입니다.
|
|
30
|
+
* 동작이 붙기 전까지 항목은 메뉴에 나타나지 않습니다.
|
|
31
|
+
* @param id manifest 항목의 `id`
|
|
32
|
+
* @param handler 우클릭한 요소를 받습니다. 없으면 `null`.
|
|
33
|
+
* @param options.condition `false`를 돌려주면 그 우클릭에서는 항목을 숨깁니다.
|
|
34
|
+
* @returns 동작을 떼어 내는 함수 (`deactivated`에서 호출)
|
|
35
|
+
*/
|
|
36
|
+
onContextMenu(
|
|
37
|
+
id: string,
|
|
38
|
+
handler: (target: HTMLElement | null) => void,
|
|
39
|
+
options?: ContextMenuHandlerOptions,
|
|
40
|
+
): () => void;
|
|
19
41
|
/**
|
|
20
42
|
* 앱 설정 모달에 extension configuration 탭을 추가합니다.
|
|
21
43
|
* @param tabId 고유 탭 ID (`${extensionId}:${tabId}` 형태로 저장됨)
|
package/models/extension.d.ts
CHANGED
|
@@ -37,11 +37,17 @@ export type ViewManifest = {
|
|
|
37
37
|
url: string;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Manifest `contributes.contextMenus` 항목. 동작은 코드에서 `context.ui.onContextMenu(id, …)`로 붙입니다.
|
|
42
|
+
*/
|
|
41
43
|
export type ContextMenuManifest = {
|
|
44
|
+
/** 확장 안에서 고유. `onContextMenu`의 id */
|
|
42
45
|
id: string;
|
|
46
|
+
/** 메뉴에 그대로 표시되는 문구 */
|
|
43
47
|
label: string;
|
|
48
|
+
/** 메뉴가 뜨는 화면 (`calendar` 또는 확장 viewId). 생략하면 모든 화면 */
|
|
44
49
|
targetView?: string[];
|
|
50
|
+
/** `true`면 항목을 비활성으로 표시 */
|
|
45
51
|
disabled?: boolean;
|
|
46
52
|
};
|
|
47
53
|
|