Skip to content

Commit 6ec6393

Browse files
committed
feat: nuxt module
1 parent 962f11f commit 6ec6393

File tree

16 files changed

+729
-18
lines changed

16 files changed

+729
-18
lines changed

packages/docs/components/content/VModelPreview.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
const show = ref(false)
33
44
function confirm() {
5-
alert('confirm')
65
show.value = false
76
}
87
</script>

packages/docs/markdown-parser/handler/blockquote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import type { H } from 'mdast-util-to-hast'
22
import { all } from 'mdast-util-to-hast'
33
import { wrap } from './utils'
44

5-
export default function blockquote (h: H, node: any) {
5+
export default function blockquote(h: H, node: any) {
66
return h(node, 'blockquote', wrap(all(h, node), true))
77
}

packages/docs/markdown-parser/handler/inlineCode.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { u } from 'unist-builder'
33

44
export default function inlineCode(h: H, node: any) {
55
return h(node, 'code-inline', node.attributes, [
6-
// @ts-expect-error
76
u('text', node.value.replace(/\r?\n|\r/g, ' ')),
87
])
98
}

packages/nuxt/.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Logs
5+
*.log*
6+
7+
# Temp directories
8+
.temp
9+
.tmp
10+
.cache
11+
12+
# Yarn
13+
**/.yarn/cache
14+
**/.yarn/*state*
15+
16+
# Generated dirs
17+
dist
18+
19+
# Nuxt
20+
.nuxt
21+
.output
22+
.vercel_build_output
23+
.build-*
24+
.env
25+
.netlify
26+
27+
# Env
28+
.env
29+
30+
# Testing
31+
reports
32+
coverage
33+
*.lcov
34+
.nyc_output
35+
36+
# VSCode
37+
.vscode
38+
39+
# Intellij idea
40+
*.iml
41+
.idea
42+
43+
# OSX
44+
.DS_Store
45+
.AppleDouble
46+
.LSOverride
47+
.AppleDB
48+
.AppleDesktop
49+
Network Trash Folder
50+
Temporary Items
51+
.apdisk

packages/nuxt/.nuxtrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
imports.autoImport=false

packages/nuxt/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Nuxt Module
2+
3+
## Development
4+
5+
- Run `npm run dev:prepare` to generate type stubs.
6+
- Use `npm run dev` to start [playground](./playground) in development mode.

packages/nuxt/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "@vue-final-modal/nuxt",
3+
"version": "1.0.0",
4+
"license": "MIT",
5+
"type": "module",
6+
"exports": {
7+
".": {
8+
"import": "./dist/module.mjs",
9+
"require": "./dist/module.cjs"
10+
}
11+
},
12+
"main": "./dist/module.cjs",
13+
"types": "./dist/types.d.ts",
14+
"files": [
15+
"dist"
16+
],
17+
"scripts": {
18+
"prepack": "nuxt-module-build",
19+
"dev": "nuxi dev playground",
20+
"dev:build": "nuxi build playground",
21+
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
22+
"release": "release-it"
23+
},
24+
"dependencies": {
25+
"@nuxt/kit": "^3.0.0-rc.12",
26+
"vue-final-modal": "workspace:4.0.0-rc.0"
27+
},
28+
"devDependencies": {
29+
"@nuxt/module-builder": "^0.2.0",
30+
"@nuxt/schema": "^3.0.0-rc.12",
31+
"@nuxtjs/eslint-config-typescript": "^11.0.0",
32+
"eslint": "^8.26.0",
33+
"nuxt": "^3.0.0-rc.12",
34+
"release-it": "^15.5.0"
35+
}
36+
}

packages/nuxt/playground/app.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script setup lang="ts">
2+
import { ModalsContainer } from 'vue-final-modal'
3+
</script>
4+
5+
<template>
6+
<PlainCssConfirmModalPreview />
7+
<ModalsContainer />
8+
</template>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<script setup lang="ts">
2+
import { VueFinalModal } from 'vue-final-modal'
3+
4+
defineProps<{
5+
title?: string
6+
}>()
7+
8+
const emit = defineEmits<{
9+
(e: 'update:modelValue', modelValue: boolean): void
10+
(e: 'confirm'): void
11+
}>()
12+
</script>
13+
14+
<template>
15+
<VueFinalModal
16+
class="confirm-modal"
17+
content-class="confirm-modal-content"
18+
@update:model-value="val => emit('update:modelValue', val)"
19+
>
20+
<h1>{{ title }}</h1>
21+
<slot />
22+
<button @click="emit('confirm')">
23+
Confirm
24+
</button>
25+
</VueFinalModal>
26+
</template>
27+
28+
<style>
29+
.confirm-modal {
30+
display: flex;
31+
justify-content: center;
32+
align-items: center;
33+
}
34+
.confirm-modal-content {
35+
display: flex;
36+
flex-direction: column;
37+
padding: 1rem;
38+
background: #fff;
39+
border-radius: 0.5rem;
40+
}
41+
.confirm-modal-content > * + *{
42+
margin: 0.5rem 0;
43+
}
44+
.confirm-modal-content h1 {
45+
font-size: 1.375rem;
46+
}
47+
.confirm-modal-content button {
48+
margin: 0.25rem 0 0 auto;
49+
padding: 0 8px;
50+
border: 1px solid;
51+
border-radius: 0.5rem;
52+
}
53+
.dark .confirm-modal-content {
54+
background: #000;
55+
}
56+
</style>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<script setup lang="ts">
2+
import { ModalsContainer, useModal } from 'vue-final-modal'
3+
import PlainCssConfirmModal from './PlainCssConfirmModal.vue'
4+
5+
const { open, close } = useModal({
6+
component: markRaw(PlainCssConfirmModal),
7+
attrs: {
8+
title: 'Hello World!',
9+
onConfirm() {
10+
close()
11+
},
12+
},
13+
slots: {
14+
default: '<p>The content of the modal</p>',
15+
},
16+
})
17+
</script>
18+
19+
<template>
20+
<button @click="() => open()">
21+
Open Modal
22+
</button>
23+
24+
<ModalsContainer />
25+
</template>

0 commit comments

Comments
 (0)