Summary:
[interesting] since it shows how Flipper APIs are exposed through sandy. However, the next diff is a much simpler example of that
This diff adds support for adding menu entries for sandy plugin (renamed keyboard actions to menus, as it always creates a menu entry, but not necessarily a keyboard shortcut)
```
client.addMenuEntry(
// custom entry
{
label: 'Reset Selection',
topLevelMenu: 'Edit',
handler: () => {
selectedID.set(null);
},
},
// based on built-in action (sets standard label, shortcut)
{
action: 'createPaste',
handler: () => {
console.log('creating paste');
},
},
);
```
Most of this diff is introducing the concept of FlipperUtils, a set of static Flipper methods (not related to a device or client) that can be used from Sandy. This will for example be used to implement things as `createPaste` as well
Reviewed By: nikoant
Differential Revision: D22766990
fbshipit-source-id: ce90af3b700e6c3d9a779a3bab4673ba356f3933
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import './plugin/PluginBase';
|
|
import * as TestUtilites from './test-utils/test-utils';
|
|
|
|
export {
|
|
SandyPluginInstance,
|
|
PluginClient as FlipperClient,
|
|
} from './plugin/Plugin';
|
|
export {
|
|
Device,
|
|
DeviceLogEntry,
|
|
DeviceLogListener,
|
|
DevicePluginClient,
|
|
LogLevel,
|
|
SandyDevicePluginInstance,
|
|
DeviceType,
|
|
} from './plugin/DevicePlugin';
|
|
export {SandyPluginDefinition} from './plugin/SandyPluginDefinition';
|
|
export {SandyPluginRenderer} from './plugin/PluginRenderer';
|
|
export {SandyPluginContext, usePlugin} from './plugin/PluginContext';
|
|
export {createState, useValue, Atom} from './state/atom';
|
|
export {FlipperLib} from './plugin/FlipperLib';
|
|
export {
|
|
MenuEntry,
|
|
NormalizedMenuEntry,
|
|
buildInMenuEntries,
|
|
} from './plugin/MenuEntry';
|
|
|
|
// It's not ideal that this exists in flipper-plugin sources directly,
|
|
// but is the least pain for plugin authors.
|
|
// Probably we should make sure that testing-library doesn't end up in our final Flipper bundle (which packages flipper-plugin)
|
|
// T69106962
|
|
export const TestUtils = TestUtilites;
|