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

@dreayoung/vue-code-view

v0.4.1

Published

A Vue 2 component like Vue SFC REPL `@vue/repl` : u can edit, run and preview the code effect display in real time on the web page.

Downloads

2

Readme

Build Status GitHub license npm npm bundle size npm

English | 简体中文

A lightweight code interaction component based on vue 2.x, which can edit, run and preview the code effect display in real time on the web page.

When reading docs that contain a lot of code, many project docs implement a render representation of the sample code via the markdown loader, but it is static. When we want to debug code, we generally need to open the local IDE or open online editor websites such as codepen, codesandbox, and it is also subject to whether the computer has a development environment installed or whether the network connection is smooth.

So can there be such a component that can support editing code in the page, edit, run and preview the code effect display in real time in the web page?

Special thanks to the component react-code-view, based on which the vue version of the component was written! Using this component, you can edit the running code and preview the effect in real time by using the multi-sample code in the vue page or the markdown document.

Online Demo

示例

demo address: https://andurils.github.io/vue-code-view/#/demo

codesandbox example: vue-code-view-example

✨ Features

  • 💻 Code can be edited online and preview the effect in real time.
  • 🎨 Support sample code highlighting, configure themes.
  • 🌈 Support <style> parsing and rendering.
  • 📑 Support Markdown file example rendering

📦 Install

npm i vue-code-view
# or
yarn add vue-code-view

🔨 Configure

Using vue cli requires configuration in the vue.config.js file, which supports the use of Vue builds that include the runtime compiler.

module.exports = {
  runtimeCompiler: true,
  // or
  chainWebpack: (config) => { 
    config.resolve.alias
      .set("vue$", "vue/dist/vue.esm.js");
  },
}; 

💻 Usage

Components are introduced in the entry file main.js, and there is no need to manually introduce styles.

import Vue from "vue";
import App from "./App.vue";
import CodeView from "vue-code-view";

Vue.use(CodeView);

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");

API

Attributes

| 参数 | 说明 | 类型 | 默认值 | 版本 | | ------------- | ---------------------------- | ----------------- | ------ | ---- | | themeMode | code editor theme mode,default light | \| `dark` | | | | showCode | show the code editor , only layout value is top takes effect | boolean | false | | | source | source code | string | - | | | layout | render view layout | top | right | left | top | 0.4.0 |

Changelog

Detailed changes for each release are documented in the release notes.

💡 Inspired

links.

License

VCV is licensed under the terms of the MIT License

Copyright (c) 2021-present Anduril