blob: 66a678633d07addc5055c89f6a485771b94316c2 [file] [log] [blame]
Andres Olivares6490c002020-12-02 16:03:351// Copyright 2020 The Chromium Authors. All rights reserved.
Andres Olivares0e3a9e82020-12-01 14:03:202// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Tim van der Lippeaa61faf2021-04-07 15:32:075import * as Common from '../../core/common/common.js';
Douglas Chiang5f52fb62023-04-05 08:43:106import * as i18n from '../../core/i18n/i18n.js';
Jack Franklina75ae7c2021-05-11 13:22:547import type * as Platform from '../../core/platform/platform.js';
Tim van der Lippeaa61faf2021-04-07 15:32:078import * as Root from '../../core/root/root.js';
Andres Olivares0e3a9e82020-12-01 14:03:209
10import {Context} from './Context.js';
11
Douglas Chiang5f52fb62023-04-05 08:43:1012const UIStrings = {
13 /**
14 *@description Title of the keybind category 'Elements' in Settings' Shortcuts pannel.
15 */
16 elements: 'Elements',
17 /**
18 *@description Title of the keybind category 'Screenshot' in Settings' Shortcuts pannel.
19 */
20 screenshot: 'Screenshot',
21 /**
22 *@description Title of the keybind category 'Network' in Settings' Shortcuts pannel.
23 */
24 network: 'Network',
25 /**
26 *@description Title of the keybind category 'Memory' in Settings' Shortcuts pannel.
27 */
28 memory: 'Memory',
29 /**
30 *@description Title of the keybind category 'JavaScript Profiler' in Settings' Shortcuts pannel.
31 */
32 javascript_profiler: 'JavaScript Profiler',
33 /**
34 *@description Title of the keybind category 'Console' in Settings' Shortcuts pannel.
35 */
36 console: 'Console',
37 /**
38 *@description Title of the keybind category 'Performance' in Settings' Shortcuts pannel.
39 */
40 performance: 'Performance',
41 /**
42 *@description Title of the keybind category 'Mobile' in Settings' Shortcuts pannel.
43 */
44 mobile: 'Mobile',
45 /**
46 *@description Title of the keybind category 'Help' in Settings' Shortcuts pannel.
47 */
48 help: 'Help',
49 /**
50 *@description Title of the keybind category 'Layers' in Settings' Shortcuts pannel.
51 */
52 layers: 'Layers',
53 /**
54 *@description Title of the keybind category 'Navigation' in Settings' Shortcuts pannel.
55 */
56 navigation: 'Navigation',
57 /**
58 *@description Title of the keybind category 'Drawer' in Settings' Shortcuts pannel.
59 */
60 drawer: 'Drawer',
61 /**
62 *@description Title of the keybind category 'Global' in Settings' Shortcuts pannel.
63 */
64 global: 'Global',
65 /**
66 *@description Title of the keybind category 'Resources' in Settings' Shortcuts pannel.
67 */
68 resources: 'Resources',
69 /**
70 *@description Title of the keybind category 'Background Services' in Settings' Shortcuts pannel.
71 */
72 background_services: 'Background Services',
73 /**
74 *@description Title of the keybind category 'Settings' in Settings' Shortcuts pannel.
75 */
76 settings: 'Settings',
77 /**
78 *@description Title of the keybind category 'Debugger' in Settings' Shortcuts pannel.
79 */
80 debugger: 'Debugger',
81 /**
82 *@description Title of the keybind category 'Sources' in Settings' Shortcuts pannel.
83 */
84 sources: 'Sources',
85 /**
86 *@description Title of the keybind category 'Rendering' in Settings' Shortcuts pannel.
87 */
88 rendering: 'Rendering',
89};
90const str_ = i18n.i18n.registerUIStrings('ui/legacy/ActionRegistration.ts', UIStrings);
91const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
92
Andres Olivares0e3a9e82020-12-01 14:03:2093export interface ActionDelegate {
94 handleAction(_context: Context, _actionId: string): boolean;
95}
96
Kateryna Prokopenkoa72448b2021-08-31 14:16:1697export class Action extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
Jan Scheffler01eab3c2021-08-16 17:18:0798 private enabledInternal = true;
99 private toggledInternal = false;
Jack Franklin01d09b02020-12-02 15:15:20100 private actionRegistration: ActionRegistration;
Andres Olivares0e3a9e82020-12-01 14:03:20101 constructor(actionRegistration: ActionRegistration) {
102 super();
Jack Franklin01d09b02020-12-02 15:15:20103 this.actionRegistration = actionRegistration;
Andres Olivares0e3a9e82020-12-01 14:03:20104 }
105
106 id(): string {
Jack Franklin01d09b02020-12-02 15:15:20107 return this.actionRegistration.actionId;
Andres Olivares0e3a9e82020-12-01 14:03:20108 }
109
110 async execute(): Promise<boolean> {
Jack Franklin01d09b02020-12-02 15:15:20111 if (!this.actionRegistration.loadActionDelegate) {
Andres Olivares0e3a9e82020-12-01 14:03:20112 return false;
113 }
Jack Franklin01d09b02020-12-02 15:15:20114 const delegate = await this.actionRegistration.loadActionDelegate();
Andres Olivares0e3a9e82020-12-01 14:03:20115 const actionId = this.id();
116 return delegate.handleAction(Context.instance(), actionId);
117 }
118
119 icon(): string|undefined {
Jack Franklin01d09b02020-12-02 15:15:20120 return this.actionRegistration.iconClass;
Andres Olivares0e3a9e82020-12-01 14:03:20121 }
122
123 toggledIcon(): string|undefined {
Jack Franklin01d09b02020-12-02 15:15:20124 return this.actionRegistration.toggledIconClass;
Andres Olivares0e3a9e82020-12-01 14:03:20125 }
126
127 toggleWithRedColor(): boolean {
Tim van der Lippeba0e6452021-01-07 13:46:34128 return Boolean(this.actionRegistration.toggleWithRedColor);
Andres Olivares0e3a9e82020-12-01 14:03:20129 }
130
Tim van der Lipped946df02020-12-14 14:35:49131 setEnabled(enabled: boolean): void {
Jan Scheffler01eab3c2021-08-16 17:18:07132 if (this.enabledInternal === enabled) {
Andres Olivares0e3a9e82020-12-01 14:03:20133 return;
134 }
135
Jan Scheffler01eab3c2021-08-16 17:18:07136 this.enabledInternal = enabled;
Andres Olivares0e3a9e82020-12-01 14:03:20137 this.dispatchEventToListeners(Events.Enabled, enabled);
138 }
139
140 enabled(): boolean {
Jan Scheffler01eab3c2021-08-16 17:18:07141 return this.enabledInternal;
Andres Olivares0e3a9e82020-12-01 14:03:20142 }
143
Douglas Chiang5f52fb62023-04-05 08:43:10144 category(): ActionCategory {
Jack Franklin01d09b02020-12-02 15:15:20145 return this.actionRegistration.category;
Andres Olivares0e3a9e82020-12-01 14:03:20146 }
147
Andres Olivares344120f2020-12-07 17:43:28148 tags(): string|void {
149 if (this.actionRegistration.tags) {
150 // Get localized keys and separate by null character to prevent fuzzy matching from matching across them.
Andres Olivares4ce36a52021-01-18 18:35:05151 return this.actionRegistration.tags.map(tag => tag()).join('\0');
Andres Olivares344120f2020-12-07 17:43:28152 }
Andres Olivares0e3a9e82020-12-01 14:03:20153 }
154
155 toggleable(): boolean {
Tim van der Lippeba0e6452021-01-07 13:46:34156 return Boolean(this.actionRegistration.toggleable);
Andres Olivares0e3a9e82020-12-01 14:03:20157 }
158
Simon Zünd6eb94e32023-04-11 05:28:22159 title(): Common.UIString.LocalizedString {
160 let title = this.actionRegistration.title ? this.actionRegistration.title() : i18n.i18n.lockedString('');
Jack Franklin01d09b02020-12-02 15:15:20161 const options = this.actionRegistration.options;
Andres Olivares0e3a9e82020-12-01 14:03:20162 if (options) {
163 // Actions with an 'options' property don't have a title field. Instead, the displayed
164 // title is taken from the 'title' property of the option that is not active. Only one of the
165 // two options can be active at a given moment and the 'toggled' property of the action along
166 // with the 'value' of the options are used to determine which one it is.
167
168 for (const pair of options) {
Jan Scheffler01eab3c2021-08-16 17:18:07169 if (pair.value !== this.toggledInternal) {
Andres Olivares4ce36a52021-01-18 18:35:05170 title = pair.title();
Andres Olivares0e3a9e82020-12-01 14:03:20171 }
172 }
173 }
174 return title;
175 }
176
177 toggled(): boolean {
Jan Scheffler01eab3c2021-08-16 17:18:07178 return this.toggledInternal;
Andres Olivares0e3a9e82020-12-01 14:03:20179 }
180
Tim van der Lipped946df02020-12-14 14:35:49181 setToggled(toggled: boolean): void {
Andres Olivares0e3a9e82020-12-01 14:03:20182 console.assert(this.toggleable(), 'Shouldn\'t be toggling an untoggleable action', this.id());
Jan Scheffler01eab3c2021-08-16 17:18:07183 if (this.toggledInternal === toggled) {
Andres Olivares0e3a9e82020-12-01 14:03:20184 return;
185 }
186
Jan Scheffler01eab3c2021-08-16 17:18:07187 this.toggledInternal = toggled;
Andres Olivares0e3a9e82020-12-01 14:03:20188 this.dispatchEventToListeners(Events.Toggled, toggled);
189 }
190
191 options(): undefined|Array<ExtensionOption> {
Jack Franklin01d09b02020-12-02 15:15:20192 return this.actionRegistration.options;
Andres Olivares0e3a9e82020-12-01 14:03:20193 }
194
Sigurd Schneider61fc9bd2021-07-14 09:01:53195 contextTypes(): undefined|Array<Function> {
Jack Franklin01d09b02020-12-02 15:15:20196 if (this.actionRegistration.contextTypes) {
197 return this.actionRegistration.contextTypes();
Andres Olivares0e3a9e82020-12-01 14:03:20198 }
199 return undefined;
200 }
201
202 canInstantiate(): boolean {
Tim van der Lippeba0e6452021-01-07 13:46:34203 return Boolean(this.actionRegistration.loadActionDelegate);
Andres Olivares0e3a9e82020-12-01 14:03:20204 }
205
206 bindings(): Array<Binding>|undefined {
Jack Franklin01d09b02020-12-02 15:15:20207 return this.actionRegistration.bindings;
Andres Olivares0e3a9e82020-12-01 14:03:20208 }
209
210 experiment(): string|undefined {
Jack Franklin01d09b02020-12-02 15:15:20211 return this.actionRegistration.experiment;
Andres Olivares0e3a9e82020-12-01 14:03:20212 }
213
214 condition(): string|undefined {
Jack Franklin01d09b02020-12-02 15:15:20215 return this.actionRegistration.condition;
Andres Olivares0e3a9e82020-12-01 14:03:20216 }
Andres Olivares4dba1302021-01-28 23:17:32217
218 order(): number|undefined {
219 return this.actionRegistration.order;
220 }
Andres Olivares0e3a9e82020-12-01 14:03:20221}
222
Andres Olivaresf2a2ddd2021-02-03 17:27:51223const registeredActionExtensions: Array<Action> = [];
Andres Olivares0e3a9e82020-12-01 14:03:20224
225const actionIdSet = new Set<string>();
226
Tim van der Lipped946df02020-12-14 14:35:49227export function registerActionExtension(registration: ActionRegistration): void {
Andres Olivares0e3a9e82020-12-01 14:03:20228 const actionId = registration.actionId;
229 if (actionIdSet.has(actionId)) {
230 throw new Error(`Duplicate Action id '${actionId}': ${new Error().stack}`);
231 }
232 actionIdSet.add(actionId);
Andres Olivaresf2a2ddd2021-02-03 17:27:51233 registeredActionExtensions.push(new Action(registration));
Andres Olivares0e3a9e82020-12-01 14:03:20234}
235
Andrés Olivaresb0fcd182023-02-21 10:13:28236export function reset(): void {
237 actionIdSet.clear();
238 registeredActionExtensions.length = 0;
239}
240
Andres Olivaresf2a2ddd2021-02-03 17:27:51241export function getRegisteredActionExtensions(): Array<Action> {
Andres Olivares4dba1302021-01-28 23:17:32242 return registeredActionExtensions
243 .filter(
244 action => Root.Runtime.Runtime.isDescriptorEnabled(
245 {experiment: action.experiment(), condition: action.condition()}))
246 .sort((firstAction, secondAction) => {
247 const order1 = firstAction.order() || 0;
248 const order2 = secondAction.order() || 0;
249 return order1 - order2;
250 });
Andres Olivares0e3a9e82020-12-01 14:03:20251}
252
Andres Olivares975c3022021-03-29 13:45:24253export function maybeRemoveActionExtension(actionId: string): boolean {
254 const actionIndex = registeredActionExtensions.findIndex(action => action.id() === actionId);
255 if (actionIndex < 0 || !actionIdSet.delete(actionId)) {
256 return false;
257 }
258 registeredActionExtensions.splice(actionIndex, 1);
259 return true;
260}
261
Andres Olivares4ce36a52021-01-18 18:35:05262export const enum Platforms {
Andres Olivares0e3a9e82020-12-01 14:03:20263 All = 'All platforms',
264 Mac = 'mac',
265 WindowsLinux = 'windows,linux',
266 Android = 'Android',
Andres Olivares70556d62021-02-02 19:09:01267 Windows = 'windows',
Andres Olivares0e3a9e82020-12-01 14:03:20268}
269
Kateryna Prokopenkoa72448b2021-08-31 14:16:16270export const enum Events {
271 Enabled = 'Enabled',
272 Toggled = 'Toggled',
273}
274
275export type EventTypes = {
276 [Events.Enabled]: boolean,
277 [Events.Toggled]: boolean,
Andres Olivares0e3a9e82020-12-01 14:03:20278};
279
Douglas Chiang5f52fb62023-04-05 08:43:10280// eslint-disable-next-line rulesdir/const_enum
281export enum ActionCategory {
282 NONE = '', // `NONE` must be a falsy value. Legacy code uses if-checks for the category.
283 ELEMENTS = 'ELEMENTS',
284 SCREENSHOT = 'SCREENSHOT',
285 NETWORK = 'NETWORK',
286 MEMORY = 'MEMORY',
287 JAVASCRIPT_PROFILER = 'JAVASCRIPT_PROFILER',
288 CONSOLE = 'CONSOLE',
289 PERFORMANCE = 'PERFORMANCE',
290 MOBILE = 'MOBILE',
291 HELP = 'HELP',
292 LAYERS = 'LAYERS',
293 NAVIGATION = 'NAVIGATION',
294 DRAWER = 'DRAWER',
295 GLOBAL = 'GLOBAL',
296 RESOURCES = 'RESOURCES',
297 BACKGROUND_SERVICES = 'BACKGROUND_SERVICES',
298 SETTINGS = 'SETTINGS',
299 DEBUGGER = 'DEBUGGER',
300 SOURCES = 'SOURCES',
301 RENDERING = 'RENDERING',
302}
Andres Olivares0e3a9e82020-12-01 14:03:20303
Douglas Chiang5f52fb62023-04-05 08:43:10304export function getLocalizedActionCategory(category: ActionCategory): Platform.UIString.LocalizedString {
305 switch (category) {
306 case ActionCategory.ELEMENTS:
307 return i18nString(UIStrings.elements);
308 case ActionCategory.SCREENSHOT:
309 return i18nString(UIStrings.screenshot);
310 case ActionCategory.NETWORK:
311 return i18nString(UIStrings.network);
312 case ActionCategory.MEMORY:
313 return i18nString(UIStrings.memory);
314 case ActionCategory.JAVASCRIPT_PROFILER:
315 return i18nString(UIStrings.javascript_profiler);
316 case ActionCategory.CONSOLE:
317 return i18nString(UIStrings.console);
318 case ActionCategory.PERFORMANCE:
319 return i18nString(UIStrings.performance);
320 case ActionCategory.MOBILE:
321 return i18nString(UIStrings.mobile);
322 case ActionCategory.HELP:
323 return i18nString(UIStrings.help);
324 case ActionCategory.LAYERS:
325 return i18nString(UIStrings.layers);
326 case ActionCategory.NAVIGATION:
327 return i18nString(UIStrings.navigation);
328 case ActionCategory.DRAWER:
329 return i18nString(UIStrings.drawer);
330 case ActionCategory.GLOBAL:
331 return i18nString(UIStrings.global);
332 case ActionCategory.RESOURCES:
333 return i18nString(UIStrings.resources);
334 case ActionCategory.BACKGROUND_SERVICES:
335 return i18nString(UIStrings.background_services);
336 case ActionCategory.SETTINGS:
337 return i18nString(UIStrings.settings);
338 case ActionCategory.DEBUGGER:
339 return i18nString(UIStrings.debugger);
340 case ActionCategory.SOURCES:
341 return i18nString(UIStrings.sources);
342 case ActionCategory.RENDERING:
343 return i18nString(UIStrings.rendering);
344 case ActionCategory.NONE:
345 return i18n.i18n.lockedString('');
346 }
Simon Zündd2132fb2023-04-05 11:39:15347 // Not all categories are cleanly typed yet. Return the category as-is in this case.
348 return i18n.i18n.lockedString(category);
Douglas Chiang5f52fb62023-04-05 08:43:10349}
Andres Olivares0e3a9e82020-12-01 14:03:20350
351export const enum IconClass {
Kateryna Prokopenko910cb532023-03-28 09:36:46352 LARGEICON_NODE_SEARCH = 'select-element',
Kateryna Prokopenko75da9712023-03-31 11:56:38353 START_RECORDING = 'record-start',
354 STOP_RECORDING = 'record-stop',
Kateryna Prokopenko551f9c82023-04-04 14:34:21355 REFRESH = 'refresh',
Kateryna Prokopenko05ade9a2023-03-31 10:57:05356 CLEAR = 'clear',
357 EYE = 'eye',
Kateryna Prokopenko910cb532023-03-28 09:36:46358 LARGEICON_PHONE = 'devices',
Andres Olivaresa7b7b492021-01-28 16:12:37359 LARGEICON_PLAY = 'largeicon-play',
Benedikt Meurerc4ad9d92023-04-11 07:25:02360 DOWNLOAD = 'download',
Benedikt Meurer4878f6a2023-03-29 12:01:44361 LARGEICON_PAUSE = 'pause',
362 LARGEICON_RESUME = 'resume',
Benedikt Meurer178c0c32023-03-31 04:50:06363 BIN = 'bin',
Kateryna Prokopenko910cb532023-03-28 09:36:46364 LARGEICON_SETTINGS_GEAR = 'gear',
Benedikt Meurer4878f6a2023-03-29 12:01:44365 LARGEICON_STEP_OVER = 'step-over',
366 LARGE_ICON_STEP_INTO = 'step-into',
367 LARGE_ICON_STEP = 'step',
368 LARGE_ICON_STEP_OUT = 'step-out',
Benedikt Meurer32c2a1b2023-03-30 07:09:59369 BREAKPOINT_CROSSED_FILLED = 'breakpoint-crossed-filled',
370 BREAKPOINT_CROSSED = 'breakpoint-crossed',
Benedikt Meurer7d5cc372023-04-12 12:20:41371 PLUS = 'plus',
Andres Olivares0e3a9e82020-12-01 14:03:20372}
373
374export const enum KeybindSet {
375 DEVTOOLS_DEFAULT = 'devToolsDefault',
376 VS_CODE = 'vsCode',
377}
378
379export interface ExtensionOption {
380 value: boolean;
Andres Olivares4ce36a52021-01-18 18:35:05381 title: () => Platform.UIString.LocalizedString;
Andres Olivares0e3a9e82020-12-01 14:03:20382 text?: string;
383}
384
385export interface Binding {
Andres Olivares4ce36a52021-01-18 18:35:05386 platform?: Platforms;
Andres Olivares0e3a9e82020-12-01 14:03:20387 shortcut: string;
388 keybindSets?: Array<KeybindSet>;
389}
390
Andres Olivares3f49f132020-12-03 13:10:27391/**
392 * The representation of an action extension to be registered.
393 */
Andres Olivares0e3a9e82020-12-01 14:03:20394export interface ActionRegistration {
Andres Olivares3f49f132020-12-03 13:10:27395 /**
396 * The unique id of an Action extension.
397 */
Andres Olivares0e3a9e82020-12-01 14:03:20398 actionId: string;
Andres Olivares3f49f132020-12-03 13:10:27399 /**
400 * The category with which the action is displayed in the UI.
401 */
Andres Olivares0e3a9e82020-12-01 14:03:20402 category: ActionCategory;
Andres Olivares3f49f132020-12-03 13:10:27403 /**
404 * The title with which the action is displayed in the UI.
405 */
Andres Olivares4ce36a52021-01-18 18:35:05406 title?: () => Platform.UIString.LocalizedString;
Andres Olivares3f49f132020-12-03 13:10:27407 /**
408 * The type of the icon used to trigger the action.
409 */
Andres Olivares844c58d2021-01-26 13:09:07410 iconClass?: IconClass;
Andres Olivares3f49f132020-12-03 13:10:27411 /**
412 * Whether the style of the icon toggles on interaction.
413 */
Andres Olivares844c58d2021-01-26 13:09:07414 toggledIconClass?: IconClass;
Andres Olivares3f49f132020-12-03 13:10:27415 /**
416 * Whether the class 'toolbar-toggle-with-red-color' is toggled on the icon on interaction.
417 */
Andres Olivares0e3a9e82020-12-01 14:03:20418 toggleWithRedColor?: boolean;
Andres Olivares3f49f132020-12-03 13:10:27419 /**
420 * Words used to find an action in the Command Menu.
421 */
Andres Olivares4ce36a52021-01-18 18:35:05422 tags?: Array<() => Platform.UIString.LocalizedString>;
Andres Olivares3f49f132020-12-03 13:10:27423 /**
424 * Whether the action is toggleable.
425 */
Andres Olivares0e3a9e82020-12-01 14:03:20426 toggleable?: boolean;
Andres Olivares3f49f132020-12-03 13:10:27427 /**
Andres Olivaresa0cdb382021-01-21 15:44:33428 * Loads the class that handles the action when it is triggered. The common pattern for implementing
429 * this function relies on having the module that contains the action’s handler lazily loaded. For example:
430 * ```js
431 * let loadedElementsModule;
432 *
433 * async function loadElementsModule() {
434 *
435 * if (!loadedElementsModule) {
436 * loadedElementsModule = await import('./elements.js');
437 * }
438 * return loadedElementsModule;
439 * }
440 * UI.ActionRegistration.registerActionExtension({
441 * <...>
442 * async loadActionDelegate() {
443 * const Elements = await loadElementsModule();
444 * return Elements.ElementsPanel.ElementsActionDelegate.instance();
445 * },
446 * <...>
447 * });
448 * ```
Andres Olivares3f49f132020-12-03 13:10:27449 */
Andres Olivares0e3a9e82020-12-01 14:03:20450 loadActionDelegate?: () => Promise<ActionDelegate>;
Andres Olivares3f49f132020-12-03 13:10:27451 /**
452 * Returns the classes that represent the 'context flavors' under which the action is available for triggering.
453 * The context of the application is described in 'flavors' that are usually views added and removed to the context
454 * as the user interacts with the application (e.g when the user moves across views). (See UI.Context)
455 * When the action is supposed to be available globally, that is, it does not depend on the application to have
456 * a specific context, the value of this property should be undefined.
457 *
458 * Because the method is synchronous, context types should be already loaded when the method is invoked.
459 * In the case that an action has context types it depends on, and they haven't been loaded yet, the function should
460 * return an empty array. Once the context types have been loaded, the function should return an array with all types
461 * that it depends on.
462 *
463 * The common pattern for implementing this function is relying on having the module with the corresponding context
464 * types loaded and stored when the related 'view' extension is loaded asynchronously. As an example:
465 *
466 * ```js
467 * let loadedElementsModule;
468 *
469 * async function loadElementsModule() {
470 *
471 * if (!loadedElementsModule) {
472 * loadedElementsModule = await import('./elements.js');
473 * }
474 * return loadedElementsModule;
475 * }
476 * function maybeRetrieveContextTypes(getClassCallBack: (elementsModule: typeof Elements) => unknown[]): unknown[] {
477 *
478 * if (loadedElementsModule === undefined) {
479 * return [];
480 * }
481 * return getClassCallBack(loadedElementsModule);
482 * }
483 * UI.ActionRegistration.registerActionExtension({
484 *
485 * contextTypes() {
486 * return maybeRetrieveContextTypes(Elements => [Elements.ElementsPanel.ElementsPanel]);
487 * }
488 * <...>
489 * });
490 * ```
491 */
Sigurd Schneider61fc9bd2021-07-14 09:01:53492 contextTypes?: () => Array<Function>;
Andres Olivares3f49f132020-12-03 13:10:27493 /**
Andres Olivaresa0cdb382021-01-21 15:44:33494 * The descriptions for each of the two states in which a toggleable action can be.
Andres Olivares3f49f132020-12-03 13:10:27495 */
Andres Olivares0e3a9e82020-12-01 14:03:20496 options?: Array<ExtensionOption>;
Andres Olivares3f49f132020-12-03 13:10:27497 /**
498 * The description of the variables (e.g. platform, keys and keybind sets) under which a keyboard shortcut triggers the action.
499 * If a keybind must be available on all platforms, its 'platform' property must be undefined. The same applies to keybind sets
500 * and the keybindSet property.
501 *
502 * Keybinds also depend on the context types of their corresponding action, and so they will only be available when such context types
503 * are flavors of the current appliaction context.
504 */
Andres Olivares0e3a9e82020-12-01 14:03:20505 bindings?: Array<Binding>;
Andres Olivares3f49f132020-12-03 13:10:27506 /**
Andres Olivaresa0cdb382021-01-21 15:44:33507 * The name of the experiment an action is associated with. Enabling and disabling the declared
508 * experiment will enable and disable the action respectively.
Andres Olivares3f49f132020-12-03 13:10:27509 */
Andres Olivares0e3a9e82020-12-01 14:03:20510 experiment?: Root.Runtime.ExperimentName;
Andres Olivares3f49f132020-12-03 13:10:27511 /**
Andres Olivaresa0cdb382021-01-21 15:44:33512 * A condition represented as a string the action's availability depends on. Conditions come
513 * from the queryParamsObject defined in Runtime and just as the experiment field, they determine the availability
514 * of the setting. A condition can be negated by prepending a ‘!’ to the value of the condition
515 * property and in that case the behaviour of the action's availability will be inverted.
Andres Olivares3f49f132020-12-03 13:10:27516 */
Andres Olivares0e3a9e82020-12-01 14:03:20517 condition?: Root.Runtime.ConditionName;
Andres Olivares4dba1302021-01-28 23:17:32518 /**
519 * Used to sort actions when all registered actions are queried.
520 */
521 order?: number;
Andres Olivares0e3a9e82020-12-01 14:03:20522}