extension/README.md
Chrome devtools extension to help debugging Floating UI
<!-- Available on [Chrome web store](). -->pnpm run build from root /extension folder/extension/dist folderThe Chrome devtools extension supports custom data-types for the following libraries:
@floating-ui/react@fluentui/react-componentsTo add support for a new library custom data-types, you need to:
./src/views with the name of the libraryData union type./src/views/<library-name>
folderview object, and import the
component created in the previous step to render the data-typeMyLibrary custom data-typesCustom data-type and a component that will consume that data-type for
MyLibrary are defined in the ./src/views/my-library as follow:
// ./src/views/my-library/data-types.ts
export type MyLibraryMiddlewareData = {
type: 'MyLibraryMiddlewareData';
};
export type Datatype = MyLibraryMiddlewareData;
// ./src/views/my-library/MyLibraryMiddleware.tsx
export const MyLibraryMiddleware = React.memo((props: Serialized<MyLibraryMiddlewareData>) => {
return <div>MyLibraryMiddleware</div>;
});
export default MyLibraryMiddleware;
// ./src/views/my-library/index.ts
export * from './data-types';
export const views = {
MyLibraryMiddleware: React.lazy(() => import('./MyLibraryMiddleware')),
}
Then the Data union type is updated to include the new data-type, and the
views object is updated to include the new component:
# ./src/views/index.tsx
import type React from 'react';
import * as common from './common';
import * as floatingUI from './floating-ui';
import * as fluentUI from './fluentui';
+import * as myLibrary from './my-library'
export type Data =
| common.Datatype
| floatingUI.Datatype
| fluentUI.Datatype
+ | myLibrary.Datatype
export const views: Record<Data['type'], React.FC> = {
...common.views,
...floatingUI.views,
...fluentUI.views,
+ ...myLibrary.views
};