npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@open-pencil-lowcode/vue

v0.15.0

Published

Headless Vue 3 SDK for building OpenPencil-powered editors.

Readme

@open-pencil-lowcode/vue

Headless Vue 3 SDK for building OpenPencil-powered editors.

@open-pencil-lowcode/vue sits on top of @open-pencil-lowcode/core and provides:

  • Vue editor injection via provideEditor() / useEditor()
  • canvas integration via useCanvas(), useCanvasInput(), and useTextEdit()
  • selection, command, panel, variables, and i18n composables
  • headless structural primitives like CanvasRoot, LayerTreeRoot, PageListRoot, and ToolbarRoot

The SDK is headless by design: it provides logic and structure, while your app owns styling and product-specific UI.

Install

bun add @open-pencil-lowcode/vue @open-pencil-lowcode/core canvaskit-wasm

Quick start

<script setup lang="ts">
import { createEditor } from '@open-pencil-lowcode/core/editor'
import { provideEditor } from '@open-pencil-lowcode/vue'

const editor = createEditor({
  width: 1200,
  height: 800,
})

editor.createShape('RECTANGLE', 100, 100, 200, 150)
editor.zoomToFit()

provideEditor(editor)
</script>

<template>
  <div class="h-screen">
    <CanvasRoot v-slot="{ canvasRef }">
      <canvas ref="canvasRef" class="size-full" />
    </CanvasRoot>
  </div>
</template>

Core concepts

Editor context

Use provideEditor(editor) once near the top of your subtree.

import { provideEditor } from '@open-pencil-lowcode/vue'

provideEditor(editor)

Read it anywhere below with useEditor().

import { useEditor } from '@open-pencil-lowcode/vue'

const editor = useEditor()

Canvas wiring

At the composable level, the main canvas APIs are:

  • useCanvas()
  • useCanvasInput()
  • useTextEdit()

If you want SDK-provided structure, use headless primitives like CanvasRoot and CanvasSurface.

Headless primitives

Main structural primitives include:

  • CanvasRoot
  • LayerTreeRoot
  • PageListRoot
  • PropertyListRoot
  • PropertySectionRoot
  • SegmentedControlRoot
  • ToolbarRoot
  • ColorPickerRoot
  • FontPickerRoot
  • NumberFieldRoot / NumberFieldInput / NumberFieldValue
  • BindableValueRoot / BindableValueTrigger / BindableValuePicker
  • LayoutControlsRoot
  • ConstraintsControlRoot

These components coordinate structure and state, but do not impose app styling. NumberField adds pointer scrubbing, Arrow-key stepping, mixed/bound state attributes, and safe arithmetic expressions such as +10, *2, 50%, and 12*8+4. BindableValue composes fields with a generic BindingProvider and supports detach-on-edit, read-only, and edit-variable policies. Focusing a bound NumberField is non-destructive; the configured policy begins only on the first value mutation. LayoutControlsRoot exposes axis-oriented sizing actions; editing a Hug or Fill dimension can switch that axis to Fixed inside the same provider transaction. ConstraintsControlRoot exposes eligible frame-child constraints, mixed axis values, pin actions, and undo-batched multi-selection updates. AppearanceControlsRoot exposes selection-derived independent-corner presentation state so consumers do not need parallel expansion heuristics. PropertyListRoot is controlled and editor-agnostic; OpenPencil panels connect it to selection and undo through useEditorPropertyList(). useColorModel() provides precise scene-color/Reka bridges, reactive RGB/HSL/HSB/OkHCL channels, extensible format state, and shared slider presentation data. FillRoot and FillSwatch separate fill behavior and binding-aware previews from popover composition; ChannelSlider provides accessible scalar OkHCL controls until Reka supports them.

Public API tiers

Core API

These are the main APIs most SDK consumers should start with.

Context and canvas

  • provideEditor()
  • useEditor()
  • useCanvas()
  • useCanvasInput()
  • useTextEdit()

Selection and commands

  • useSelectionState()
  • useSelectionCapabilities()
  • useEditorCommands()
  • useMenuModel()

Property panels

  • usePosition()
  • useLayout()
  • useConstraints()
  • useComponentProperties()
  • useAppearance()
  • useSharedStyleBinding()
  • useColorModel()
  • useMask()
  • useTypography()
  • useExport()
  • useFillControls()
  • useStrokeControls()
  • useEffectsControls()

Variables, navigation, and localization

  • useVariablesEditor()
  • usePageList()
  • useI18n()

Headless primitives

  • CanvasRoot
  • LayerTreeRoot
  • PageListRoot
  • PropertyListRoot
  • PropertyListItem
  • PropertyListAdd / PropertyListRemove / PropertyListVisibility
  • PropertySectionRoot / PropertySectionHeader / PropertySectionTitle
  • PropertySectionActions / PropertySectionContent / PropertySectionEmptyAction
  • SegmentedControlRoot / SegmentedControlItem
  • ToolbarRoot
  • NumberFieldRoot
  • NumberFieldInput
  • NumberFieldValue
  • NumberFieldLeading
  • NumberFieldUnit
  • NumberFieldTrailing
  • NumberFieldMenu
  • BindableValueRoot
  • BindableValueTrigger
  • BindableValuePicker
  • FillRoot / FillSwatch
  • ChannelSliderRoot / ChannelSliderTrack / ChannelSliderThumb

Advanced API

These exports are intentionally public, but they are lower-level or more specialized.

  • useNodeProps()
  • useEditorPropertyList()
  • useSceneComputed()
  • useColorBindingProvider()
  • useColorVariableBinding()
  • provideBindingProvider()
  • useBindingProvider()
  • useNumberBindingProvider()
  • useFill()
  • useGradientStops()
  • useFontPicker()
  • useOkHCL()
  • useVariables()
  • useVariablesDialogState()
  • useVariablesTable()
  • usePropScrub()
  • useLayerDrag()
  • useInlineRename()
  • useToolbarState()
  • useNodeFontStatus()
  • useCanvasDrop()
  • extractImageFilesFromClipboard()
  • useViewportKind()
  • toolCursor()

Primitive context helpers and low-level stores

These are mostly useful when extending SDK primitives rather than building from top-level composables.

  • useCanvasContext()
  • useLayerTree()
  • useToolbar()
  • usePropertyList()
  • useNumberField()
  • locale
  • localeSetting
  • setLocale()
  • AVAILABLE_LOCALES
  • LOCALE_LABELS

Example patterns

Minimal provider component

<script setup lang="ts">
import { provideEditor } from '@open-pencil-lowcode/vue'

import type { Editor } from '@open-pencil-lowcode/core/editor'

const props = defineProps<{
  editor: Editor
}>()

provideEditor(props.editor)
</script>

<template>
  <slot />
</template>

Read selection state

import { useSelectionState } from '@open-pencil-lowcode/vue'

const { hasSelection, selectedCount, selectedNode } = useSelectionState()

Build a menu

import { useMenuModel } from '@open-pencil-lowcode/vue'

const { appMenu, canvasMenu } = useMenuModel()

Build a page list

<PageListRoot v-slot="{ pages, currentPageId, switchPage }">
  <ul>
    <li v-for="page in pages" :key="page.id">
      <button :data-active="page.id === currentPageId" @click="switchPage(page.id)">
        {{ page.name }}
      </button>
    </li>
  </ul>
</PageListRoot>

Documentation

For fuller guides and API docs, see the documentation site:

  • packages/docs/programmable/sdk/

Example app

Run the included example:

cd packages/vue/example
bun install
bun run dev