@opensumi/ide-keymaps 2.12.1-next-079c1930

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.
Files changed (38) hide show
  1. package/lib/browser/index.d.ts +6 -0
  2. package/lib/browser/index.d.ts.map +1 -0
  3. package/lib/browser/index.js +26 -0
  4. package/lib/browser/index.js.map +1 -0
  5. package/lib/browser/keymaps-parser.d.ts +46 -0
  6. package/lib/browser/keymaps-parser.d.ts.map +1 -0
  7. package/lib/browser/keymaps-parser.js +100 -0
  8. package/lib/browser/keymaps-parser.js.map +1 -0
  9. package/lib/browser/keymaps.contribution.d.ts +36 -0
  10. package/lib/browser/keymaps.contribution.d.ts.map +1 -0
  11. package/lib/browser/keymaps.contribution.js +169 -0
  12. package/lib/browser/keymaps.contribution.js.map +1 -0
  13. package/lib/browser/keymaps.module.less +310 -0
  14. package/lib/browser/keymaps.service.d.ts +136 -0
  15. package/lib/browser/keymaps.service.d.ts.map +1 -0
  16. package/lib/browser/keymaps.service.js +671 -0
  17. package/lib/browser/keymaps.service.js.map +1 -0
  18. package/lib/browser/keymaps.view.d.ts +3 -0
  19. package/lib/browser/keymaps.view.d.ts.map +1 -0
  20. package/lib/browser/keymaps.view.js +250 -0
  21. package/lib/browser/keymaps.view.js.map +1 -0
  22. package/lib/common/const.d.ts +3 -0
  23. package/lib/common/const.d.ts.map +1 -0
  24. package/lib/common/const.js +6 -0
  25. package/lib/common/const.js.map +1 -0
  26. package/lib/common/index.d.ts +3 -0
  27. package/lib/common/index.d.ts.map +1 -0
  28. package/lib/common/index.js +6 -0
  29. package/lib/common/index.js.map +1 -0
  30. package/lib/common/keymaps.d.ts +98 -0
  31. package/lib/common/keymaps.d.ts.map +1 -0
  32. package/lib/common/keymaps.js +5 -0
  33. package/lib/common/keymaps.js.map +1 -0
  34. package/lib/index.d.ts +2 -0
  35. package/lib/index.d.ts.map +1 -0
  36. package/lib/index.js +5 -0
  37. package/lib/index.js.map +1 -0
  38. package/package.json +30 -0
@@ -0,0 +1,310 @@
1
+ .keybinding_container {
2
+ padding: 11px 0 0 27px;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ }
7
+
8
+ .keybinding_header {
9
+ padding: 0 10px 11px 0;
10
+ height: 30px;
11
+ display: flex;
12
+ flex-direction: row;
13
+ box-sizing: content-box;
14
+ }
15
+
16
+
17
+ .keybinding_body {
18
+ height: calc(100% - 52px);
19
+ position: relative;
20
+ overflow: hidden;
21
+ .keybinding_loading {
22
+ position: absolute;
23
+ width: 100%;
24
+ height: 100%;
25
+ background: var(--background);
26
+ opacity: .3;
27
+ top: 0;
28
+ left: 0;
29
+ }
30
+ }
31
+
32
+
33
+ .keybinding_list_header {
34
+ background-color: hsla(0, 0%, 51%, .04);
35
+ height: 30px;
36
+ line-height: 30px;
37
+ }
38
+
39
+ .keybinding_key_input_container {
40
+ position: relative;
41
+ height: 100%;
42
+ width: 100%;
43
+ &:hover {
44
+ .keybinding_optional_actions {
45
+ z-index: 999;
46
+ display: flex;
47
+ }
48
+ .keybinding_key_input_placeholder {
49
+ display: none;
50
+ }
51
+ }
52
+ }
53
+
54
+ .keybinding_detective_messages {
55
+ z-index: 100;
56
+ position: absolute;
57
+ left: 0;
58
+ top: 24px;
59
+ max-height: 175px;
60
+ min-width: 100%;
61
+ padding: 10px;
62
+ max-width: 600px;
63
+ background: var(--kt-selectDropdown-background);
64
+ box-shadow: 0 9px 28px 8px rgba(0,0,0,0.15), 0 6px 16px 0 rgba(0,0,0,0.24), 0 3px 6px -4px rgba(0,0,0,0.36);
65
+ border-radius: 2px;
66
+ overflow-y: scroll;
67
+ overflow-x: hidden;
68
+ .keybinding_detective_messages_label {
69
+ color: var(--descriptionForeground);
70
+ text-align: left;
71
+ line-height: 20px;
72
+ font-size: 12px;
73
+ text-align: left;
74
+ line-height: 20px;
75
+ width: 172px;
76
+ height: 20px;
77
+ overflow: hidden;
78
+ text-overflow: ellipsis;
79
+ white-space: nowrap;
80
+ margin-bottom: 5px;
81
+ }
82
+ ul, li {
83
+ margin: 0;
84
+ padding: 0;
85
+ }
86
+ .keybinding_detective_messages_container {
87
+ display: flex;
88
+ flex-direction: column;
89
+
90
+ .keybinding_detective_messages_item {
91
+ display: flex;
92
+ flex-direction: column;
93
+ .title {
94
+ text-align: left;
95
+ line-height: 20px;
96
+ font-size: 12px;
97
+ color: var(--foreground);
98
+ text-align: left;
99
+ line-height: 20px;
100
+ height: 20px;
101
+ width: 100%;
102
+ overflow: hidden;
103
+ text-overflow: ellipsis;
104
+ white-space: nowrap;
105
+ }
106
+ .description {
107
+ text-align: left;
108
+ line-height: 20px;
109
+ font-size: 12px;
110
+ color: var(--descriptionForeground);
111
+ text-align: left;
112
+ line-height: 20px;
113
+ height: 20px;
114
+ width: 100%;
115
+ overflow: hidden;
116
+ text-overflow: ellipsis;
117
+ white-space: nowrap;
118
+
119
+ display: flex;
120
+ align-items: center;
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ .keybinding_key_input_placeholder {
127
+ z-index: 100;
128
+ position: absolute;
129
+ right: 5px;
130
+ top: 0;
131
+ align-items: center;
132
+ justify-content: center;
133
+ color: var(--inputicon-foreground);
134
+ width: 16px;
135
+ height: 24px;
136
+ line-height: 24px;
137
+ text-align: center;
138
+ }
139
+
140
+ .keybinding_key_input, .keybinding_key {
141
+ width: 100%;
142
+ height: 100%;
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: flex-start;
146
+ position: relative;
147
+ overflow: hidden;
148
+ }
149
+
150
+ .keybinding_key_block {
151
+ display: flex;
152
+ margin-right: 5px;
153
+ }
154
+
155
+ .keybinding_key_item {
156
+ display: block;
157
+ border-radius:2px;
158
+ background-color:rgba(134,140,145,0.10);
159
+ font-size:12px;
160
+ padding: 0 2px;
161
+ height: 16px;
162
+ line-height: 16px;
163
+ margin-right: 3px;
164
+ text-align: center;
165
+ }
166
+
167
+
168
+
169
+ .keybinding_list_container {
170
+ width: 100%;
171
+ border-spacing: 0;
172
+ border-collapse: separate;
173
+ height: calc(100% - 30px);
174
+
175
+ span {
176
+ display: inline-block;
177
+ }
178
+ }
179
+
180
+ .keybinding_list_item {
181
+ cursor: default;
182
+ display: flex;
183
+ height: 24px;
184
+ flex-direction: row;
185
+ line-height: 24px;
186
+ position: relative;
187
+
188
+ match {
189
+ color: #FF7673;
190
+ }
191
+
192
+ .keybinding_list_item_box {
193
+ align-items: center;
194
+ width: 25%;
195
+ font-size: 12px;
196
+ box-sizing: border-box;
197
+ padding-left: 30px;
198
+ }
199
+
200
+ .limit_warp {
201
+ overflow: hidden;
202
+ text-overflow: ellipsis;
203
+ white-space: nowrap;
204
+ }
205
+
206
+ &.odd {
207
+ background-color: hsla(0, 0%, 51%, .04);
208
+ }
209
+
210
+ .keybinding_inline_action {
211
+ display: none;
212
+ height: 24px;
213
+ line-height: 24px;
214
+ width: 20px;
215
+ text-align: left;
216
+ text-align: center;
217
+ cursor: pointer;
218
+ background-color: var(--list-hoverBackground);
219
+ &:hover {
220
+ transform: scale(1.2);
221
+ }
222
+ }
223
+
224
+ .keybinding_action {
225
+ display: none;
226
+ position: absolute;
227
+ right: 0;
228
+ height: 24px;
229
+ line-height: 24px;
230
+ text-align: center;
231
+ z-index: 10;
232
+ cursor: pointer;
233
+ }
234
+
235
+ &:hover {
236
+ color: var(--list-hoverForeground);
237
+ background-color: var(--list-hoverBackground);
238
+
239
+ .keybinding_action,
240
+ .keybinding_inline_action {
241
+ display: inline-block;
242
+ }
243
+ }
244
+ }
245
+
246
+ .keybinding_header_item {
247
+ width: 25%;
248
+ box-sizing: content-box;
249
+ padding-left: 30px;
250
+ overflow: hidden;
251
+ text-overflow: ellipsis;
252
+ white-space: nowrap;
253
+ }
254
+
255
+ .search_container {
256
+ position: relative;
257
+ height: 100%;
258
+ width: 100%;
259
+ &:hover {
260
+ .keybinding_optional_actions {
261
+ display: flex;
262
+ }
263
+ }
264
+ }
265
+
266
+ .search_input {
267
+ height: 30px;
268
+ width: 100%;
269
+ }
270
+
271
+ .keybinding_optional_actions {
272
+ position: absolute;
273
+ right: 5px;
274
+ top: 0;
275
+ display: none;
276
+ align-items: center;
277
+ justify-content: center;
278
+ height: 100%;
279
+ .keybinding_optional_action {
280
+ cursor: pointer;
281
+ color: var(--inputicon-foreground);
282
+ display: block;
283
+ font-size: 14px;
284
+ width: 16px;
285
+ height: 16px;
286
+ line-height: 16px;
287
+ text-align: center;
288
+ }
289
+ }
290
+
291
+ .search_inline_action {
292
+ height: 100%;
293
+ padding: 0 5px;
294
+ line-height: 20px;
295
+ display: flex;
296
+ align-items: center;
297
+ justify-content: flex-start;
298
+ &_icon {
299
+ display: block;
300
+ height: 18px;
301
+ width: 18px;
302
+ text-align: center;
303
+ box-sizing: content-box;
304
+ border: 1px solid transparent;
305
+ cursor: pointer;
306
+ &.active {
307
+ border: 1px solid var(--focusBorder);
308
+ }
309
+ }
310
+ }
@@ -0,0 +1,136 @@
1
+ import { IDisposable, KeybindingRegistry, URI, Emitter, Keybinding, KeybindingScope, CommandService, CommandRegistry, KeySequence, KeybindingService, Event, FileStat } from '@opensumi/ide-core-browser';
2
+ import { KeymapsParser } from './keymaps-parser';
3
+ import { IKeymapService, KeybindingItem, KeymapItem } from '../common';
4
+ import { IFileServiceClient } from '@opensumi/ide-file-service';
5
+ export declare class KeymapService implements IKeymapService {
6
+ static DEFAULT_SEARCH_DELAY: number;
7
+ static KEYMAP_FILE_URI: URI;
8
+ protected readonly keyBindingRegistry: KeybindingRegistry;
9
+ protected readonly parser: KeymapsParser;
10
+ protected readonly commandService: CommandService;
11
+ protected readonly commandRegistry: CommandRegistry;
12
+ protected readonly keybindingRegistry: KeybindingRegistry;
13
+ protected readonly keybindingService: KeybindingService;
14
+ protected readonly filesystem: IFileServiceClient;
15
+ private readonly logger;
16
+ private readonly progressService;
17
+ private currentSearchValue;
18
+ protected resource: FileStat | undefined;
19
+ protected readonly keymapChangeEmitter: Emitter<void>;
20
+ get onDidKeymapChanges(): Event<void>;
21
+ protected convertKeySequence: KeySequence;
22
+ protected readonly toUnregisterUserKeybindingMap: Map<string, IDisposable>;
23
+ protected readonly toRestoreDefaultKeybindingMap: Map<string, IDisposable>;
24
+ private searchDelayer;
25
+ private disposableCollection;
26
+ /**
27
+ * fuzzy搜索参数,pre及post用于包裹搜索结果
28
+ * @protected
29
+ * @memberof KeymapService
30
+ */
31
+ protected readonly fuzzyOptions: {
32
+ pre: string;
33
+ post: string;
34
+ };
35
+ private _storeKeybindings;
36
+ get storeKeybindings(): KeymapItem[];
37
+ set storeKeybindings(value: KeymapItem[]);
38
+ keybindings: KeybindingItem[];
39
+ init(): Promise<void>;
40
+ openResource(): Promise<void>;
41
+ private disposeRegistedKeybinding;
42
+ dispose(): void;
43
+ /**
44
+ * 因为 monaco.edtior.* 替换为 editor.* 为了兼容在 storage 里存量的数据,需要兼容一下
45
+ * @param command
46
+ */
47
+ private getValidateCommand;
48
+ /**
49
+ * 重新加载并设置Keymap定义的快捷键
50
+ * @param keybindings
51
+ */
52
+ reconcile(keybindings?: KeymapItem[]): Promise<void>;
53
+ private unregisterUserKeybinding;
54
+ private registerUserKeybinding;
55
+ private unregisterDefaultKeybinding;
56
+ private restoreDefaultKeybinding;
57
+ private toUniqueKey;
58
+ /**
59
+ * 更新keybindings列表
60
+ */
61
+ private updateKeybindings;
62
+ /**
63
+ * 解析快捷键数据
64
+ * @protected
65
+ * @returns {Promise<Keybinding[]>}
66
+ * @memberof KeymapsService
67
+ */
68
+ protected parseKeybindings(): Promise<KeymapItem[]>;
69
+ /**
70
+ * 设置快捷键
71
+ * @param {Keybinding} keybindings
72
+ * @returns {Promise<void>}
73
+ * @memberof KeymapsService
74
+ */
75
+ setKeybinding: (keybinding: Keybinding) => void;
76
+ private saveKeybinding;
77
+ covert: (event: KeyboardEvent) => string;
78
+ clearCovert: () => void;
79
+ /**
80
+ * 移除给定ID的快捷键绑定
81
+ * @param {string} commandId
82
+ * @returns {Promise<void>}
83
+ * @memberof KeymapsService
84
+ */
85
+ resetKeybinding: (item: Keybinding) => Promise<void>;
86
+ /**
87
+ * 从keymaps.json获取快捷键列表
88
+ * @returns {Promise<Keybinding[]>}
89
+ * @memberof KeymapsService
90
+ */
91
+ getKeybindings(): Promise<Keybinding[]>;
92
+ /**
93
+ * 打开快捷键面板
94
+ * @protected
95
+ * @returns {Promise<void>}
96
+ * @memberof KeymapService
97
+ */
98
+ open(): Promise<void>;
99
+ fixed: () => Promise<void>;
100
+ getWhen(keybinding?: Keybinding | KeymapItem): string;
101
+ /**
102
+ * 获取可读的作用域
103
+ * @param {KeybindingScope} scope
104
+ * @returns
105
+ * @memberof KeymapService
106
+ */
107
+ getScope(scope: KeybindingScope): string;
108
+ /**
109
+ * 获取所有快捷键项
110
+ * @returns {KeybindingItem[]}
111
+ * @memberof KeymapService
112
+ */
113
+ getKeybindingItems(): KeybindingItem[];
114
+ protected compareItem(a: KeybindingItem, b: KeybindingItem): number;
115
+ /**
116
+ * 搜索快捷键
117
+ */
118
+ searchKeybindings: (search: string) => void;
119
+ /**
120
+ * 模糊搜索匹配的快捷键
121
+ * @protected
122
+ */
123
+ protected readonly doSearchKeybindings: (search: any) => void;
124
+ /**
125
+ * 验证快捷键是否可用
126
+ * @memberof KeymapService
127
+ */
128
+ validateKeybinding: (keybindingItem: KeybindingItem, keybinding: string) => string;
129
+ detectKeybindings: (keybindingItem: KeybindingItem, keybinding: string) => KeybindingItem[];
130
+ /**
131
+ * 获取被fuzzy替换的原始值
132
+ * @param {string} keybinding
133
+ */
134
+ getRaw(keybinding?: string): string;
135
+ }
136
+ //# sourceMappingURL=keymaps.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keymaps.service.d.ts","sourceRoot":"","sources":["../../src/browser/keymaps.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,WAAW,EAAoB,kBAAkB,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAmB,eAAe,EAAY,WAAW,EAAE,iBAAiB,EA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