@superblocks-at/devtools
v0.9.8
Published
Airtable block dev tools that include a global config editor and an api explorer
Downloads
6
Readme
@superblocks-at/devtools
Airtable blocks dev tools - an npm package that can be added to any block and includes the following tools:
A GlobalConfig editor - so you can view AND edit global config in development mode AND in release mode.
A blocks api explorer - with support for viewing the property values of the following models, exactly as you get them from the api:
- Base
- Active table
- Active view
- Selected record
- Selected field
- Cursor
- Session
- Viewport
Installation
In your custom block folder:
npm install @superblocks-at/devtools --save
Usage
import React from "react";
import { initializeBlock } from "@airtable/blocks/ui";
import { Devtools } from "@superblocks-at/devtools";
function BlockWithDevtools {
// Wrap Devtools around your block code or put it wherever you want in your main component.
// It will just work.
return <Devtools>
<MyBlock/>
</Devtools>;
// Another way of using Devtools
// return <>
// <Devtools/>
// <MyBlock/>
// </>;
}
initializeBlock(() => <BlockWithDevtools />);
To open and close devtools, press 'ddd' quick 3 times.
Devtools options / props
import { Devtools, Position} from "@superblocks-at/devtools";
<Devtools
shortcutKey="d",
timeout={500},
position ={Position.bottom},
overlap={100}
/>
| Prop name | Description | Default value | | ----------- | --------------------------------------------------------------------------------- | --------------- | | shortcutKey | The key to press 3 times to open/close devtools | "d" | | timeout | The max period between keystrokes in milliseconds before keystroke count is reset | 500 | | position | Where to display devtools: bottom, left, top or right | Position.bottom | | overlap | How much of the block width or height the devtools ui overlaps | 100 (percent) |
LICENSE
MIT
Contributions
Are more than welcome. The goal is to have the community expand the package with additional tools that can increase the productivity of Airtable custom blocks developers. Some ideas that come to mind:
- Add Links to the relevant blocks api documentation section wherever appropriate.
- Add the ability to execute api functions which also shows correct usage through pre-populated code snippets.
Development environment setup instructions for contributors
See the devtools-dev-env repo for instructions.