Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tomasmoosee/widget-editor

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tomasmoosee/widget-editor

This is the second iteration of the widget editor. The widget editor is a tool to generate charts based on vega configurations. You can plug in any api using Adapters. Currently, we support out of the box the resource watch API.

  • 2.0.31-alpha.0
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Widget editor V2

This is the second iteration of the widget editor. The widget editor is a tool to generate charts based on vega configurations. You can plug in any api using Adapters. Currently, we support out of the box the resource watch API.

Getting started

Installing through NPM npm install widget-editor

Instaling with Yarn(v1) yarn install widget-editor

There are two parts to the editor. Eather, you can use the entire editor by merely importing the WidgetEditor component. Or if you want to display the configured charts, you should import the Renderer.

Using the editor

import WidgetEditor from "widget-editor";

const App = () => {
  return <WidgetEditor />;
};

The editor has a few properties, some required. Below you have all properties listed.

adapter (required)

First of all, we need to plug in an adapter to the editor. This adapter is responsible for proxying and resolving any necessary information into the editor itself. Currently, we only have an adapter written for the resource watch API.

datasetId (required)

This tells the editor what dataset to utilize. (note* this might change in the future)

widgetId

widgetId is used together with a datasetId. This will make another request fetching the necessary widget.

schemes

Schemes allow you to add custom themes to the editor. This takes an array of objects of this format:

{
  "name": "theme name",
  "mainColor": "#hex",
  "category": ["#hex"]
}

compact (boolean, default false)

This property renders the editor in a compact mode. By default, the editor is a two-column layout. Enabling this setting will render one column & overlay the options.

disable

This property allows you to disable specific features in the editor, read more here.

All properties listed

import WidgetEditor, { RwAdapter } from "widget-editor";

<WidgetEditor
  disable={[string]}
  schemes={[theme_objects]}
  datasetId="string"
  widgetId="string"
  adapter={RwAdapter}
/>;

Using the renderer

The renderer allows you to render a chart based on a widget configuration. It takes one parameter, which is a widget configuration.

import { Renderer } from "widget-editor";

const App = () => {
  return <Renderer widgetConfig={...} />;
};

FAQs

Package last updated on 16 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc