Skip to content

Commit

Permalink
docs: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ttpss930141011 committed Nov 20, 2023
1 parent d497143 commit 1cf2649
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 69 deletions.
61 changes: 28 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,65 +62,56 @@ To use this wafermap component, follow these steps:
npm install vue-wafer-painter
```

2. Import the component into your Vue application:
2. Import CSS in main.js / main.ts:

```javascript
import VWafermap from 'vue-wafer-painter'
import { createApp } from 'vue'
import './style.css'

import 'vue-wafer-painter/dist/style.css' // add this row

import App from './App.vue'

createApp(App).mount('#app')
```

3. Add the VWafermap component to your template:
3. Import and add the component to your template:

```html
<template>
<v-wafermap :width="800" :height="800" :coords="[{...your coords}]" />
</template>
<script setup lang="ts">
import { ref } from "vue";
import { VWafermap } from "vue-wafer-painter";
...
</script>
```

### Usage

<details closed><summary>VWafermap</summary>

Here's a example of Coords data:

```javascript
//src\packages\VWafermap\src\types.ts

export interface Coords {
info: Array<string>
x: number
y: number
dut: number
color: string
}

const coords = [
{ x: -2, y: -2, info: ['1'], dut: 1, color: '#ff8080' },
{ x: 0, y: 1, info: ['2'], dut: 2, color: 'green' },
{ x: 1, y: 0, info: ['4'], dut: 1, color: 'rgb(0, 102, 204)' }
{ x: 2, y: 0, info: ['7', '789'], dut: 1, color: 'red' },
{ x: 2, y: 2, info: ['9'], dut: 3, color: '#b800e6' }
]

```

Here's the simplest example of using the VWafermap component:

```html
<template>
<v-wafermap :coords="coords" @onDie="handleDieHover" />
</template>

<script setup>
<script setup lang="ts">
import { ref } from 'vue'
import VWafermap from 'vue-wafer-painter'
import { VWafermap } from 'vue-wafer-painter'
const coords = ref([
// many coords
{ x: -2, y: -2, info: ['1'], dut: 1, color: '#ff8080' },
{ x: 0, y: 1, info: ['2'], dut: 2, color: 'green' },
{ x: 1, y: 0, info: ['4'], dut: 1, color: 'rgb(0, 102, 204)' },
{ x: 2, y: 0, info: ['7', '789'], dut: 1, color: 'red' },
{ x: 2, y: 2, info: ['9'], dut: 3, color: '#b800e6' }
])
const handleDieHover = (event, dieInfo) => {
// Handle the click on a die
console.log('Hovered on die:', dieInfo)
const handleDieHover = (event: MouseEvent, dieInfo: any) => {
console.log('Hovered on die:', event, dieInfo)
}
</script>
```
Expand Down Expand Up @@ -182,6 +173,10 @@ Here's the simplest example of using the VWafermap component:

---

## 📝 Todo

- [x] Better TypeScript support

## 📄 License

This project is licensed under the MIT License. See the [LICENSE](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository) file for additional info.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-wafer-painter",
"description": "The Wafermap component library based on Vue 3 provides a versatile and customizable solution for visualizing wafermaps, commonly used in semiconductor manufacturing.",
"version": "1.0.7",
"version": "1.0.8",
"private": false,
"author": "ttpss930141011 <https://github.com/ttpss930141011> (https://github.com/ttpss930141011)",
"license": "MIT",
Expand Down
22 changes: 17 additions & 5 deletions src/stories/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,30 @@ To use this wafermap component, follow these steps:
npm install vue-wafer-painter
```

2. Import the component into your Vue application:
2. Import CSS in main.js / main.ts:

```javascript
import VWafermap from 'vue-wafer-painter'
```
```javascript
import { createApp } from 'vue'
import './style.css'

import 'vue-wafer-painter/dist/style.css' // add this row

import App from './App.vue'

createApp(App).mount('#app')
```

3. Add the VWafermap component to your template:
3. Import and add the component to your template:

```html
<template>
<v-wafermap :width="800" :height="800" :coords="[{...your coords}]" />
</template>
<script setup lang="ts">
import { ref } from "vue";
import { VWafermap } from "vue-wafer-painter";
...
</script>
```

## 📄 License
Expand Down
40 changes: 10 additions & 30 deletions src/stories/VWafermap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,47 +38,26 @@ VWafermap is used to draw a 2D wafermap with a given set of coordinates.

## 🧑‍💻 Usage

Here's a example of Coords data:

```javascript
//src\packages\VWafermap\src\types.ts

export interface Coords {
info: Array<string>
x: number
y: number
dut: number
color: string
}

const coords = [
{ x: -2, y: -2, info: ['1'], dut: 1, color: '#ff8080' },
{ x: 0, y: 1, info: ['2'], dut: 2, color: 'green' },
{ x: 1, y: 0, info: ['4'], dut: 1, color: 'rgb(0, 102, 204)' }
{ x: 2, y: 0, info: ['7', '789'], dut: 1, color: 'red' },
{ x: 2, y: 2, info: ['9'], dut: 3, color: '#b800e6' }
]

```

Here's the simplest example of using the VWafermap component:

```html
<template>
<v-wafermap :coords="coords" @onDie="handleDieHover" />
</template>

<script setup>
<script setup lang="ts">
import { ref } from 'vue'
import VWafermap from 'vue-wafer-painter'
import { VWafermap } from 'vue-wafer-painter'
const coords = ref([
// many coords
{ x: -2, y: -2, info: ['1'], dut: 1, color: '#ff8080' },
{ x: 0, y: 1, info: ['2'], dut: 2, color: 'green' },
{ x: 1, y: 0, info: ['4'], dut: 1, color: 'rgb(0, 102, 204)' },
{ x: 2, y: 0, info: ['7', '789'], dut: 1, color: 'red' },
{ x: 2, y: 2, info: ['9'], dut: 3, color: '#b800e6' }
])
const handleDieHover = (event, dieInfo) => {
// Handle the click on a die
console.log('Hovered on die:', dieInfo)
const handleDieHover = (event: MouseEvent, dieInfo: any) => {
console.log('Hovered on die:', event, dieInfo)
}
</script>
```
Expand Down Expand Up @@ -315,4 +294,5 @@ flex-direction: column;
}
`}

</style>

1 comment on commit 1cf2649

@ttpss930141011
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for vue-wafer-painter ready!

✅ Preview
https://vue-wafer-painter-gtrw32t2c-ttpss930141011.vercel.app

Built with commit 1cf2649.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.