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

vue-dmak

v1.1.0

Published

Vue component wrapper for Draw Me A Kanji (dmak) - Render your Japanese writings with fun and taste

Downloads

12

Readme

vue-dmak

Vue component wrapper for Draw Me A Kanji (dmak) - Render your Japanese writings with fun and taste.

Installation

npm install vue-dmak

Usage

Basic Usage

<template>
	<VueDmak text="こんにちは" :uri="kanjiUri" />
</template>

<script>
import VueDmak from 'vue-dmak';

export default {
	components: {
		VueDmak
	},
	data() {
		return {
			kanjiUri: 'http://kanjivg.tagaini.net/kanjivg/kanji/'
		};
	}
};
</script>

Global Registration

import { createApp } from 'vue';
import VueDmak from 'vue-dmak';

const app = createApp(App);
app.use(VueDmak);

With Options

<template>
	<VueDmak
		text="世界"
		:uri="kanjiUri"
		:autoplay="false"
		:height="150"
		:width="150"
		:stroke="strokeOptions"
		@loaded="onLoaded"
		@drew="onDrew"
		@erased="onErased"
		ref="dmakRef"
	/>
	<div>
		<button @click="play">Play</button>
		<button @click="pause">Pause</button>
		<button @click="reset">Reset</button>
		<button @click="next">Next</button>
		<button @click="back">Back</button>
	</div>
</template>

<script>
import VueDmak from 'vue-dmak';

export default {
	components: {
		VueDmak
	},
	data() {
		return {
			kanjiUri: 'http://kanjivg.tagaini.net/kanjivg/kanji/',
			strokeOptions: {
				attr: {
					stroke: '#FF0000',
					'stroke-width': 5
				}
			}
		};
	},
	methods: {
		play() {
			this.$refs.dmakRef.render();
		},
		pause() {
			this.$refs.dmakRef.pause();
		},
		reset() {
			this.$refs.dmakRef.erase();
		},
		next() {
			this.$refs.dmakRef.renderNextStrokes(1);
		},
		back() {
			this.$refs.dmakRef.eraseLastStrokes(1);
		},
		onLoaded(strokes) {
			console.log('Loaded', strokes);
		},
		onDrew(pointer) {
			console.log('Drew stroke', pointer);
		},
		onErased(pointer) {
			console.log('Erased stroke', pointer);
		}
	}
};
</script>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | text | String | (required) | The Japanese text to render | | uri | String | '' | Path to the SVG files folder (KanjiVG) | | skipLoad | Boolean | false | Skip SVG files loading | | autoplay | Boolean | true | Start drawing as soon as all SVG files are loaded | | height | Number | 109 | Height in pixels of a single paper surface | | width | Number | 109 | Width in pixels of a single paper surface | | viewBox | Object | {x: 0, y: 0, w: 109, h: 109} | ViewBox configuration | | step | Number | 0.03 | Positive number which defines the speed of the drawing | | view | String | 'canvas' | View mode: 'canvas' (animation) or 'series' (static frames) | | seriesStyle | Object | {} | Style object for the flex container string series mode | | seriesFrameStyle | Object | {} | Style object for individual character frames in series mode | | seriesActiveStyle | Object | See below | Configuration for active stroke and arrow in series mode | | canvasStyle | Object | {} | Style object for the container in the canvas mode | | stroke | Object | See below | Stroke configuration | | grid | Object | See below | Grid configuration |

Stroke Options

{
	animated: {
		drawing: true,
		erasing: true
	},
	order: {
		visible: false,
		attr: {
			'font-size': '8',
			fill: '#999999'
		}
	},
	attr: {
		active: '#BF0000',
		stroke: '#2C2C2C', // Can use "random" for random color
		'stroke-width': 4,
		'stroke-linecap': 'round',
		'stroke-linejoin': 'round'
	}
}

Series Active Style (Series Mode Overrides)

Overrides stroke and arrow style for the active stroke in "series" view.

{
	activeStroke: {
		attr: {
			stroke: '#BF0000'
		}
	},
	arrow: {
		show: true,
		attr: {
			stroke: '#BF0000',
			size: 10
		}
	}
}

Grid Options

{
	show: true,
	attr: {
		stroke: '#CCCCCC',
		'stroke-width': 0.5,
		'stroke-dasharray': '--'
	}
}

Events

| Event | Payload | Description | |-------|---------|-------------| | loaded | strokes | Emitted when all SVG files are fully loaded | | drew | pointer | Emitted when a stroke is drawn | | erased | pointer | Emitted when a stroke is erased |

Methods

Access methods via template ref:

<VueDmak ref="dmakRef" text="こんにちは" :uri="kanjiUri" />

| Method | Parameters | Description | |--------|------------|-------------| | render(end) | end (optional) | Render strokes. If end is provided, render up to that stroke index | | pause() | - | Pause rendering | | erase(end) | end (optional) | Erase strokes. If end is provided, erase up to that stroke index | | reset() | - | Reset the instance (clears timeouts and resets state) | | eraseLastStrokes(nbStrokes) | nbStrokes | Remove the last N strokes | | renderNextStrokes(nbStrokes) | nbStrokes | Render the next N strokes |

Compatibility

  • Vue 3.0+
  • Chrome 1.0+
  • Firefox 16.0+
  • Opera 17.0+
  • Safari 3.0+
  • IE 10.0+ (animation not supported)

Credits

License

MIT