GithubHelp home page GithubHelp logo

rexskz / json-diff-kit-vue Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 26 KB

The Vue version of Viewer used by json-diff-kit. (Beta)

Home Page: https://json-diff-kit.js.org/

License: MIT License

HTML 1.26% Vue 55.63% TypeScript 43.11%
diff json vue

json-diff-kit-vue's Introduction

JSON Diff Kit Viewer (Vue)

NPM version Downloads

The Vue version of Viewer used by json-diff-kit. For more documents and usages, please refer to the json-diff-kit's main repository as well as the playground (React version).

Installation

# using npm
npm i @json-diff-kit/viewer-vue --save

# using yarn
yarn add @json-diff-kit/viewer-vue

# using pnpm
pnpm add @json-diff-kit/viewer-vue

Usage

<script setup lang="ts">
import { Differ, Viewer } from '@json-diff-kit/viewer-vue';
import type { DifferOptions, ViewerProps } from '@json-diff-kit/viewer-vue';

const differProps: DifferOptions = {
  detectCircular: false,
  maxDepth: Infinity,
  showModifications: true,
  arrayDiffMethod: 'lcs',
  ignoreCase: false,
  recursiveEqual: true,
  preserveKeyOrder: true,
};
const differ = new Differ(differProps);

const before = { a: 1, b: 2, c: 3 };
const after = { a: 1, b: 3, d: 4 };
const diff = differ.diff(before, after);

const viewerProps: Partial<ViewerProps> = {
  diff,
  indent: 2,
  lineNumbers: true,
  highlightInlineDiff: true,
  inlineDiffOptions: {
    mode: 'word',
    wordSeparator: ' ',
  },
  hideUnchangedLines: true,
  syntaxHighlight: { theme: 'monokai' },
};
</script>

<template>
  <Viewer v-bind="viewerProps" />
</template>

<style>
/* If syntax highlight is enabled, you should import a theme file, or write it by yourself. */
@import 'json-diff-kit/dist/viewer-monokai.css';
</style>

License

MIT

json-diff-kit-vue's People

Contributors

rexskz avatar

Watchers

 avatar

json-diff-kit-vue's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.