@advanced-rest-client/monaco-support

中文文档
1.0.1发布于 2020/11/25ESM + CJS近 30 天下载 3361

Helper library to add support for the Monaco editor across the components

原始使用文档
文档目录4 节
  1. Usage
  2. Installation
  3. Loading monaco
  4. ARC common theme

Monaco support

A set of helper functions with common logic when working with Monaco editor in ARC components.

This module offers the following exports:

  • MonacoStyles - a lit-element based styles for Monaco editor
  • MonacoLoader - functions that allows to manage loading Monaco into the global scope and tun the logic after it is loaded
  • MonacoTheme - very basic theme configuration for ARC
  • MonacoHelper - additional helper library with common functions.

Usage

Installation

npm install --save @advanced-rest-client/monaco-support

Loading monaco

Monaco uses CSS files import in their ES modules which makes it unusable in pure web environment. The alternative is to load Monaco globally (bad idea but it's a path to move forward) and use the global monaco object in the components.

These functions helps to load monaco and recognize when the library is finally loaded:

import { MonacoLoader } from '@advanced-rest-client/monaco-support';

const monacoBase = '../node_modules/monaco-editor/';
MonacoLoader.createEnvironment(monacoBase);
await MonacoLoader.loadMonaco(monacoBase);
await MonacoLoader.monacoReady();

// it is safe to load a component

ARC common theme

The MonacoTheme.assignTheme() function is to be called when monaco is loaded and preparing configuration for the editor instance. This check for the current user preference for the dark theme and sets the corresponding theme on the configuration option.

let config = /** IStandaloneEditorConstructionOptions */ ({
  minimap: {
    enabled: false,
  },
  tabSize: 2,
  detectIndentation: true,
});
config = MonacoTheme.assignTheme(monaco, config);

The monaco refers to the global variable loaded to the global scope. The function returns a copy of the configuration object so the original one has to be updated.

版本与发布记录

@advanced-rest-client/monaco-support 共发布 2 个版本,首次发布于 2020/11/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2020/11/255 年前
1.0.02020/11/255 年前

关于 @advanced-rest-client/monaco-support 的常见问题

@advanced-rest-client/monaco-support 是什么?

Helper library to add support for the Monaco editor across the components

如何安装 @advanced-rest-client/monaco-support?

在项目目录运行 npm install @advanced-rest-client/monaco-support,或使用 pnpm add / yarn add / bun add。

@advanced-rest-client/monaco-support 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/advanced-rest-client__monaco-support 是否存在。

@advanced-rest-client/monaco-support 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@advanced-rest-client/monaco-support 可以商用吗?

@advanced-rest-client/monaco-support 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@advanced-rest-client/monaco-support 的下载量有多少?

根据 npm 官方下载统计,@advanced-rest-client/monaco-support 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,361 次,日均约 112 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@advanced-rest-client/monaco-support 还在维护吗?

最新版本 1.0.1 发布于 2020/11/25(5 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/11/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。