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

@knime/kds-code-editor

v7.2.2

Published

Package containing the code editor component of the KNIME Design System

Readme

KNIME® Design System – Code Editor

This is part of the KNIME Design System maintained by the UI Core Team.

This package contains the KdsCodeEditor component, a code editor that follows the KNIME Design System. It is based on the Vue JavaScript framework and powered by the Monaco editor.

It's published as npm package: @knime/kds-code-editor

Why a separate package?

Monaco is a large dependency (the editor core plus language workers) that is irrelevant to most consumers of @knime/kds-components. Keeping the code editor in its own package keeps that dependency, bundle, and security-audit/SBOM surface opt-in — only apps that install this package pull it in.

monaco-editor is declared as a peer dependency and is externalized in the build (see vite.config.ts): Monaco holds global state (language registry, MonacoEnvironment, models), so the host app controls the single shared instance and can pull CVE-patched versions via its own lockfile without waiting on a republish.

Setup in consuming repositories

Peer dependency

monaco-editor is a peer dependency (see Why a separate package?). Install a version matching the peer range declared in package.json.

Monaco patch (required)

Two upstream Monaco bugs are fixed by a pnpm patch that ships with this package under patches/:

  • Monaco's hover, suggest, and action widgets mis-position and mis-detect mouse leave when the editor is rendered inside a shadow root — which is how KNIME embeds UI extensions (AP-25740).
  • Dropping text into the editor appends a literal $0 (and backslash-escapes $, \, }) because standalone Monaco's bulk edit service ignores the insertAsSnippet flag set by the drop/paste handlers (microsoft/monaco-editor#4386).

Because pnpm applies patches in the installing workspace (a package cannot patch its consumer's dependencies), every consuming repository must apply it to its own monaco-editor install:

  1. Copy node_modules/@knime/kds-code-editor/patches/monaco-editor@<version>.patch into your repository (e.g. a patches/ folder). Do not reference the file inside node_modules directly — on a cold install pnpm needs the patch before the package providing it is extracted.

  2. Register it in your pnpm-workspace.yaml:

    patchedDependencies:
      [email protected]: patches/[email protected]

When this package bumps its monaco-editor peer range, the bundled patch is updated with it — re-copy the patch file when you bump Monaco.

Monaco state is global

Standalone Monaco keeps page-global state, and KdsCodeEditor participates in it:

  • Theme: the component switches Monaco's built-in vs-light / vs-dark theme to follow the KDS dark-mode setting — once at mount and again on every dark-mode change. Monaco's theme applies to every standalone editor on the page, so the host app's own Monaco editors switch along with it, and a custom theme set by the host is overridden while a KdsCodeEditor is mounted. If your app defines its own Monaco editors, expect them to render with vs-light / vs-dark alongside this component.
  • Worker environment and languages: setupMonacoEnvironment installs a MonacoEnvironment only when the host app has not already defined one, and the custom language grammars shipped with this package (e.g. toml) are registered in Monaco's global language registry at import time — they are also available to the host app's own editors.

Using the editor in a Vue application

Install the @knime/kds-code-editor npm package as a dependency. It requires @knime/kds-components, monaco-editor, and vue as peer dependencies:

pnpm add @knime/kds-code-editor @knime/kds-components @knime/kds-styles monaco-editor
<script setup lang="ts">
import { ref } from "vue";

import { KdsCodeEditor } from "@knime/kds-code-editor";

const value = ref('key = "value"');
</script>

<template>
  <KdsCodeEditor v-model="value" language="toml" :min-rows="5" />
</template>

Public exports

All public symbols follow the KDS Kds prefix convention:

| Export | Kind | Description | | --------------------------------- | --------- | ------------------------------------------------------------- | | KdsCodeEditor | component | The code editor (with header, copy button, and sub-text) | | setupMonacoEnvironment | function | Installs the Monaco worker environment (no-op if already set) | | kdsCodeEditorState | const | Editor states (default / error / warning) | | kdsCodeEditorStates | const | Array of all editor states | | KdsCodeEditorProps | type | Props of KdsCodeEditor | | KdsCodeEditorState | type | Union of the editor states | | KdsCodeEditorAction | type | Union of the header action types below | | KdsCodeEditorButtonAction | type | Header action rendered as KdsButton | | KdsCodeEditorToggleButtonAction | type | Header action rendered as KdsToggleButton | | KdsCodeEditorMenuButtonAction | type | Header action rendered as KdsMenuButton |

Using with Vitest, Nuxt, or Vite SSR

The published JavaScript imports its CSS as a side effect (e.g. import "./index.css"), which bundlers handle automatically. When the package is instead evaluated by Node's native ESM loader — as Vitest and Vite/Nuxt SSR do by default, since they externalize node_modules — Node has no .css loader and throws Unknown file extension ".css". Configure the consuming project once so @knime/* packages are processed instead of externalized:

// Vitest — vitest.config.ts
export default defineConfig({
  test: { server: { deps: { inline: [/@knime\//] } } },
});
// Vite SSR — vite.config.ts
export default defineConfig({ ssr: { noExternal: [/@knime\//] } });
// Nuxt — nuxt.config.ts
export default defineNuxtConfig({ build: { transpile: [/@knime\//] } });