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

@verygoodgraphics/vgg-react

Package Overview
Dependencies
Maintainers
0
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@verygoodgraphics/vgg-react

## Environment

  • 0.1.30
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

VGG React

Environment

Create a .env file and set the VGG runtime URL if you want to use a specific version, otherwise it will use the latest version.

# Open your terminal and goto the root directory of your project
cp /packages/react/.env.example /packages/react/.env

Usage

<VGGRender />

import { VGGRender } from "@verygoodgraphics/vgg-react"

return (
  <VGGRender
    src="https://raw.githubusercontent.com/verygoodgraphics/vgg_docs/main/static/example/docs__example__vgg_homepage_v1.daruma"
    canvasStyle={{
      width: "50vw",
      height: "100vh",
    }}
    onLoad={async (_, instance) => {
      instance.$("2:94").on(EventType.Click, async () => {
        window.alert("Hello, VGG!")
      })
    }}
  />
)

useVGG()

import { useVGG } from "@verygoodgraphics/vgg-react"

const { canvasRef, vgg, isLoading } = useVGG({
  src: "https://raw.githubusercontent.com/verygoodgraphics/vgg_docs/main/static/example/docs__example__vgg_homepage_v1.daruma",
})

useEffect(() => {
  if (isLoading || !vgg.current) return
  vgg.current?.$("2:94").on(EventType.Click, async () => {
    window.alert("Hello, VGG!")
  })
}, [isLoading])

return (
  <canvas
    ref={canvasRef}
    style={{
      width: "50vw",
      height: "100vh",
    }}
  />
)

API

Options for useVGG()

OptionTypeRequiredDefault
srcstring | Int8Array-
runtimestring-https://s5.vgg.cool/runtime/latest
editModeboolean-false
verboseboolean-false
disableLoaderboolean-false
customFontsstring[]-[]
onLoad(event: VGGEvent, instance: VGG<T>) => Promise<void>--
onLoadError(event: VGGEvent) => Promise<void>--
onReadyEventCallback--
onRenderedEventCallback--
onStateChange(event: VGGEvent, instance: VGG<T>) => Promise<void>--
onSelectEventCallback--
onLoadingStateUpdate(state: LoadingState) => void--

Props for <VGGRender />

OptionTypeRequiredDefault
srcstring | Int8Array-
runtimestring-https://s5.vgg.cool/runtime/latest
canvasStyleReact.CSSProperties--
editModeboolean-false
verboseboolean-false
disableLoaderboolean-false
customFontsstring[]-[]
onLoad(event: VGGEvent, instance: VGG<T>) => Promise<void>--
onLoadError(event: VGGEvent) => Promise<void>--
onReadyEventCallback--
onRenderedEventCallback--
onStateChange(event: VGGEvent, instance: VGG<T>) => Promise<void>--
onSelectEventCallback--
onLoadingStateUpdate(state: LoadingState) => void--

FAQs

Package last updated on 10 Sep 2024

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