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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dgiot/dgiot-monaco

v1.2.3

Published

@dgiot/dgiot-monaco 是基于 Monaco editor 开发的简易版 web 端代码编辑器 Vue 组件。

Downloads

36

Readme

dgiot-monaco

dgiot-monaco 是基于 Monaco editor 开发的简易版 web 端代码编辑器 Vue 组件。如在使用中若遇到问题可以提交 issues 。

预览图

预览图

安装

pnpm add @dgiot/dgiot-monaco

快速使用

<style lang="scss" scoped>
  .dgiot-monaco{
    height:100%;
    width: 100%;
  }
</style>
<template>
  <div class="dgiot-monaco">
    <dgiot-monaco ref="dgiotMonaco" :content="content" :language="language" :theme="theme" width="100%" height="100%" />
  </div>
</template>

<script>
  import dgiotMonaco from "@dgiot/dgiot-monaco"; 
  export default {
    components: {
        dgiotMonaco
    },
    data() {
      return {
        content: "",
        theme: "vs-dark",
        language: "javascript"
      };
    }
  }
</script>

编辑器配置

vue.config.js 中添加如下代码,若没有则新建。(vue-cli3.0)

const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
module.exports = {
  chainWebpack: config => {
    config.plugin('monaco-editor').use(MonacoWebpackPlugin, [
      {
        
        languages: ['json', 'go', 'css', 'html', 'java', 'javascript', 'less', 'markdown', 'mysql', 'php', 'python', 'scss', 'shell', 'redis', 'sql', 'typescript', 'xml'],
        // 以下为全部支持的代码语言,可根据需求添加
        //   ['abap', 'apex', 'azcli', 'bat', 'cameligo', 'clojure', 'coffee', 'cpp', 'csharp', 'csp', 'css', 'dart', 'dockerfile', 'ecl', 'fsharp', 'go', 'graphql', 'handlebars', 'hcl', 'html', 'ini', 'java', 'javascript', 'json', 'julia', 'kotlin', 'less', 'lexon', 'lua', 'm3', 'markdown', 'mips', 'msdax', 'mysql', 'objective-c', 'pascal', 'pascaligo', 'perl', 'pgsql', 'php', 'postiats', 'powerquery', 'powershell', 'pug', 'python', 'r', 'razor', 'redis', 'redshift', 'restructuredtext', 'ruby', 'rust', 'sb', 'scala', 'scheme', 'scss', 'shell', 'solidity', 'sophia', 'sql', 'st', 'swift', 'systemverilog', 'tcl', 'twig', 'typescript', 'vb', 'xml', 'yaml'],

        features: ['format', 'find', 'contextmenu', 'gotoError', 'gotoLine', 'gotoSymbol', 'hover' , 'documentSymbols']
        // 以下为全部功能模块,可根据需求添加
        // ['accessibilityHelp', 'anchorSelect', 'bracketMatching', 'caretOperations', 'clipboard', 'codeAction', 'codelens', 'colorPicker', 'comment', 'contextmenu', 'coreCommands', 'cursorUndo', 'dnd', 'documentSymbols', 'find', 'folding', 'fontZoom', 'format', 'gotoError', 'gotoLine', 'gotoSymbol', 'hover', 'iPadShowKeyboard', 'inPlaceReplace', 'indentation', 'inlineHints', 'inspectTokens', 'linesOperations', 'linkedEditing', 'links', 'multicursor', 'parameterHints', 'quickCommand', 'quickHelp', 'quickOutline', 'referenceSearch', 'rename', 'smartSelect', 'snippets', 'suggest', 'toggleHighContrast', 'toggleTabFocusMode', 'transpose', 'unusualLineTerminators', 'viewportSemanticTokens', 'wordHighlighter', 'wordOperations', 'wordPartOperations']
      }
    ])
  }
}

Props属性

| 属性值 | 类型 | 默认值 | 描述 | |:--------------|:--------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------| | languageModal | Array | ['json', 'go', 'css', 'html', 'java', 'javascript', 'less', 'markdown', 'mysql', 'php', 'python', 'scss', 'shell', 'redis', 'sql', 'typescript', 'xml'] | 代码语言模块 | | language | String | javascript | 代码语言 | | height | Number/String | 100% | 编辑器高度 | | width | Number/String | 100% | 编辑器宽度 | | diffEditor | Boolean | false | 是否开启 diff 模式 | | original | String | null | diff 内容(只有在diff模式下有效) | | content | String | null | 内容 | | theme | String | vs-dark | 主题(hc-black、vs-dark、vs-light) | | options | Object | {} | 可查看:Monaco Editor Options |

方法属性

| 属性值 | 返回值 | 描述 | |:----------------|:---------------|:-------------------| | on-before-mount | monaco | 编辑器挂载之前 | | on-mounted | editor, monaco | 编辑器挂载之后 | | on-change | value, event | 内容改变后触发 | | on-input | value | 内容改变后触发 | | on-save | value | 保存点击按钮时触发( ctrl + s ) |