@figspec/react
Version:
React binding for figspec
27 lines (26 loc) • 1.16 kB
JavaScript
import { FigspecFrameViewer as FigspecFrameViewerElement, FigspecFileViewer as FigspecFileViewerElement, } from "@figspec/components";
import { createComponent } from "@lit-labs/react";
import * as React from "react";
// NOTE: These exported components are casted with `as unknown as ...` in order not to break
// typings accidentally. `as unknown` is required because a component created by
// `createComponent` has `RefAttributes<unknown>`, which is incompatible with existing
// type signature (and breaks ref typings). Also the explicit props definition prevents
// every properties turns into optional.
export const FigspecFrameViewer = createComponent({
react: React,
tagName: "figspec-frame-viewer",
elementClass: FigspecFrameViewerElement,
events: {
onNodeSelect: "nodeselect",
onPreferencesUpdate: "preferencesupdate",
},
});
export const FigspecFileViewer = createComponent({
react: React,
tagName: "figspec-file-viewer",
elementClass: FigspecFileViewerElement,
events: {
onNodeSelect: "nodeselect",
onPreferencesUpdate: "preferencesupdate",
},
});