It lets you inspect the UI to quickly figure out what code is rendering what you see. You can just click the provided link to open the source in VS Code.
Get it from the chrome web store!
figment.0.5.demo.mov
This tool has no dependencies. It's all browser APIs and Vanilla JavaScript with TypeScript to help keep things on the rails. Every bit of functionality was written by me because I'm just tinkering, it's just for fun, and I learn best by making something I find useful. If you would like a feature that doesn't exist, just let me know and I'll take a look. Or you can submit a PR.
I'm currently tinkering with a Figma integration to help correlate React components with Figma designs.
- Open a page on localhost that is using a dev build of React or React Native. Production React will likely be minified and not include source file mappings. I am currently limiting this tool (in the manifest) to only function for localhost.
- Toggle enabled/disabled
- Use the hotkey
ALT-f
(⌥-f
on Mac) (configure here: chrome://extensions/shortcuts) - OR click the Figment toolbar icon
- OR chose "Toggle DOM Inspection" from the browser context menu
- Use the hotkey
- Mouse over the page to see elements and components highlighted with a red outline
- Click the red outline's label to get the context menu
The context menu that pops up will show you the element/component you are inspecting as well as all of it's parent element/components. A link to the source code will be provided for each element/component where React has provided that information.
Screen.Recording.2024-03-29.at.5.17.27_PM.mov
- Figma integration (wip)
- Keep Figma API key in local storage (prompt for key if missing)
- Load Figma data into local storage when visiting a Figma page
- Get Figma images
- Keep Figma data synchronized
- Drag Figma image onto localhost page
- Manage local Figma docs (list, add, delete)
- Separate sidepanel pages for managing and using Figma data
- Functionality to link Figma designs to React components
- Full text search
- Favorites/bookmarks?
- Filter by "Ready for Dev"
- Filter by designs relevant to the current page?
- CSS styles for everything
- Sidepanel Header/Tabs
- Sidepanel toggle logic
- React sidepanel
- List all react components on the page with vsCode links
- Functionality to link React components to Figma designs
- Configuration options sidepanel
- Menu toolbar
- option to stop inspecting the DOM
- option to open/close the sidebar
- Add Submenus
- Submenu open/close css animations
- Scroll behavior
- Move the menu with the page
- Move submenus with their parent menu items when scrolling inside the menu
- Programmatically adjust menu max-height to avoid scrolling for less than a minimum number of items
- Submenu positioning
- Slide submenus left to prevent overflowing the right side of the page
- Make submenus appear on the left of their parents if they would overlap the main menu enough to cover other functionality
- Submenu mouse interaction refinement
- allow "shortcutting" over other menu items if the mouse is headed toward an open submenu
- Display other react info for selected components
- Custom browser protocols for opening files (currently only suppoprts
vscode://file:line:character
)
We're keeping it simple and using just JavaScript, HTML, and CSS. I have intentionally avoided dependencies except for git and TypeScript. We really don't need a package manager or build tool for a project of this size.
- Clone the repo locally:
git clone https://github.com/dankoster/figment.git
- Navigate to the folder that was created by git:
cd figment
- Run the terminal command:
mkdir -p dist && cp -rv ./assets/* ./dist && tsc
mkdir -p dist
makes the dist foldercp -rv ./assets/* ./dist
verbosely copies the contents of the assets folder into disttsc
compiles the typescript to the dist folder
- Open
chrome://extensions/
in your chromium browser - Turn on "Developer Mode"
- Click the "Load unpacked" button
- Choose the
figment/dist
folder - Find the figment extension in your browser extensions toolbar and pin it
- Have fun hacking!
- Use
tsc -w
to watch for changes while working - Use
cp -rv ./assets/* ./dist
to copy asset files into dist (or use the included Deno script to watch and copy those asset files when they change...deno run --allow-read --allow-write watchAndCopy.ts ./assets ./dist
)
- Use