@threenine/nuxstr-comments 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -24
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/CommentAuthor.d.vue.ts +2 -1
- package/dist/runtime/components/CommentAuthor.vue +5 -4
- package/dist/runtime/components/CommentAuthor.vue.d.ts +2 -1
- package/dist/runtime/components/CommentView.d.vue.ts +3 -2
- package/dist/runtime/components/CommentView.vue +11 -7
- package/dist/runtime/components/CommentView.vue.d.ts +3 -2
- package/dist/runtime/components/NuxstrComments.d.vue.ts +2 -1
- package/dist/runtime/components/NuxstrComments.vue.d.ts +2 -1
- package/dist/runtime/components/PostComment.d.vue.ts +2 -1
- package/dist/runtime/components/PostComment.vue.d.ts +2 -1
- package/dist/runtime/components/PostReply.d.vue.ts +2 -1
- package/dist/runtime/components/PostReply.vue +1 -2
- package/dist/runtime/components/PostReply.vue.d.ts +2 -1
- package/dist/runtime/components/ReplyButton.d.vue.ts +2 -1
- package/dist/runtime/components/ReplyButton.vue.d.ts +2 -1
- package/dist/runtime/components/ReplyView.d.vue.ts +2 -1
- package/dist/runtime/components/ReplyView.vue +3 -1
- package/dist/runtime/components/ReplyView.vue.d.ts +2 -1
- package/dist/runtime/components/ScaffoldComment.d.vue.ts +2 -1
- package/dist/runtime/components/ScaffoldComment.vue.d.ts +2 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -38,27 +38,13 @@ npx nuxi module add @threenine/nuxstr-comments
|
|
|
38
38
|
That's it! You can now use Nuxstr Comments in your Nuxt app ✨
|
|
39
39
|
|
|
40
40
|
### Usage
|
|
41
|
-
|
|
42
|
-
1. Ensure @nuxt/content is enabled and your blog post pages use ContentDoc or render content files.
|
|
43
|
-
2. Add the comments component where you want comments to appear (usually below a ContentDoc):
|
|
44
|
-
|
|
45
|
-
```vue
|
|
46
|
-
<template>
|
|
47
|
-
<div>
|
|
48
|
-
<ContentDoc />
|
|
49
|
-
<NuxstrComments />
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
41
|
By default, the component tags comments by the current route path (e.g., content:/blog/my-post) and fetches them from configured relays.
|
|
55
42
|
|
|
56
|
-
|
|
43
|
+
1. Configuration (nuxt.config.ts):
|
|
57
44
|
|
|
58
45
|
```ts
|
|
59
46
|
export default defineNuxtConfig({
|
|
60
47
|
modules: [
|
|
61
|
-
'@nuxt/content',
|
|
62
48
|
'@threenine/nuxstr-comments',
|
|
63
49
|
],
|
|
64
50
|
nuxstrComments: {
|
|
@@ -68,6 +54,18 @@ export default defineNuxtConfig({
|
|
|
68
54
|
},
|
|
69
55
|
})
|
|
70
56
|
```
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
2. Add the comments component where you want comments to appear (usually below a ContentDoc):
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<template>
|
|
63
|
+
<div>
|
|
64
|
+
<NuxstrComments />
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
```
|
|
68
|
+
|
|
71
69
|
Select your preferred relays from the list of [relays](https://nostrwat.ch/) and configure the tag strategy and tag prefix.
|
|
72
70
|
|
|
73
71
|
When a user attempts to post, they will be prompted to log in with their Nostr browser extension [NIP-07](https://github.com/nostr-protocol/nips/blob/master/07.md).
|
|
@@ -75,7 +73,7 @@ When a user attempts to post, they will be prompted to log in with their Nostr b
|
|
|
75
73
|
Comments are published as kind: 1111 as defined in [NIP-22](https://github.com/nostr-protocol/nips/blob/master/22.md)
|
|
76
74
|
notes tagged with a `t` tag containing the content tag (e.g., `comment:/blog/my-post`).
|
|
77
75
|
|
|
78
|
-
Replys to comments are
|
|
76
|
+
Replys to comments are enabled, and are also published as kind: 1111, as defined in [NIP-22](https://github.com/nostr-protocol/nips/blob/master/22.md)
|
|
79
77
|
|
|
80
78
|
|
|
81
79
|
|
|
@@ -86,26 +84,26 @@ Replys to comments are enable, and are also published as kind: 1111, as defined
|
|
|
86
84
|
|
|
87
85
|
```bash
|
|
88
86
|
# Install dependencies
|
|
89
|
-
|
|
87
|
+
pnpm install
|
|
90
88
|
|
|
91
89
|
# Generate type stubs
|
|
92
|
-
|
|
90
|
+
pnpm run dev:prepare
|
|
93
91
|
|
|
94
92
|
# Develop with the playground
|
|
95
|
-
|
|
93
|
+
pnpm run dev
|
|
96
94
|
|
|
97
95
|
# Build the playground
|
|
98
|
-
|
|
96
|
+
pnpm run dev:build
|
|
99
97
|
|
|
100
98
|
# Run ESLint
|
|
101
|
-
|
|
99
|
+
pnpm run lint
|
|
102
100
|
|
|
103
101
|
# Run Vitest
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
pnpm run test
|
|
103
|
+
pnpm run test:watch
|
|
106
104
|
|
|
107
105
|
# Release new version
|
|
108
|
-
|
|
106
|
+
pnpm run release
|
|
109
107
|
```
|
|
110
108
|
|
|
111
109
|
</details>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addPlugin, addImports, addComponent } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
|
|
4
|
-
const module = defineNuxtModule({
|
|
4
|
+
const module$1 = defineNuxtModule({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "@threenine/nuxstr-comments",
|
|
7
7
|
configKey: "nuxstrComments"
|
|
@@ -77,4 +77,4 @@ const module = defineNuxtModule({
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
export { module as default };
|
|
80
|
+
export { module$1 as default };
|
|
@@ -2,5 +2,6 @@ type __VLS_Props = {
|
|
|
2
2
|
profile: Profile;
|
|
3
3
|
createdAt: number;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
6
7
|
export default _default;
|
|
@@ -17,10 +17,11 @@ const props = defineProps({
|
|
|
17
17
|
class="w-6 h-6 rounded-full object-cover"
|
|
18
18
|
>
|
|
19
19
|
</div>
|
|
20
|
-
<div class="flex-1 min-w-0 mb-3">
|
|
21
|
-
<div class="
|
|
22
|
-
{{ props.profile.display_name || props.profile.name || `${props.profile.pubkey.slice(0, 8)}\u2026` }}
|
|
23
|
-
<span class="text-xs
|
|
20
|
+
<div class="flex-1 min-w-0 mb-3 ">
|
|
21
|
+
<div class="flex gap-6 items-center">
|
|
22
|
+
<span class="text-sm mr-6">{{ props.profile.display_name || props.profile.name || `${props.profile.pubkey.slice(0, 8)}\u2026` }}</span>
|
|
23
|
+
<span class="text-xs text-muted-foreground ml-3"> </span>
|
|
24
|
+
<span class="text-xs text-primary ml-3">{{ new Date(props.createdAt * 1e3).toLocaleString() }}</span>
|
|
24
25
|
</div>
|
|
25
26
|
</div>
|
|
26
27
|
</div>
|
|
@@ -2,5 +2,6 @@ type __VLS_Props = {
|
|
|
2
2
|
profile: Profile;
|
|
3
3
|
createdAt: number;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
6
7
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
content: string;
|
|
3
|
-
id
|
|
3
|
+
id: string;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
6
7
|
export default _default;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { onMounted } from "vue";
|
|
2
3
|
import { marked } from "marked";
|
|
3
4
|
const props = defineProps({
|
|
4
5
|
content: { type: String, required: true },
|
|
5
|
-
id: { type: String, required:
|
|
6
|
+
id: { type: String, required: true }
|
|
7
|
+
});
|
|
8
|
+
async function renderMarkdown(md) {
|
|
9
|
+
return marked.parse(md);
|
|
10
|
+
}
|
|
11
|
+
onMounted(async () => {
|
|
12
|
+
const targetEl = document.getElementById("comment-content");
|
|
13
|
+
if (!targetEl) return;
|
|
14
|
+
targetEl.innerHTML = await renderMarkdown(props.content);
|
|
6
15
|
});
|
|
7
16
|
</script>
|
|
8
17
|
|
|
9
18
|
<template>
|
|
10
19
|
<div class="mt-2 mb-2">
|
|
11
|
-
|
|
12
|
-
<div
|
|
13
|
-
class="mb-1"
|
|
14
|
-
v-html="marked.parse(props.content)"
|
|
15
|
-
/>
|
|
16
|
-
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
20
|
+
<div id="comment-content" />
|
|
17
21
|
<ReplyButton :content-id="props.id" />
|
|
18
22
|
</div>
|
|
19
23
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
content: string;
|
|
3
|
-
id
|
|
3
|
+
id: string;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
6
7
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
contentId?: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
contentId?: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
contentId?: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
contentId?: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
rootId: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -33,13 +33,12 @@ async function postReply(comment) {
|
|
|
33
33
|
:rows="4"
|
|
34
34
|
/>
|
|
35
35
|
</div>
|
|
36
|
-
<div class="flex flex-col justify-center items-
|
|
36
|
+
<div class="flex flex-col justify-center items-center p-2">
|
|
37
37
|
<UButton
|
|
38
38
|
icon="mingcute:send-line"
|
|
39
39
|
size="xl"
|
|
40
40
|
color="primary"
|
|
41
41
|
variant="solid"
|
|
42
|
-
|
|
43
42
|
@click="postReply(content)"
|
|
44
43
|
/>
|
|
45
44
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
rootId: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
contentId: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
contentId: string;
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
replies: Comment[];
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
replies: Comment[];
|
|
3
3
|
};
|
|
4
|
-
declare const
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threenine/nuxstr-comments",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Nuxt module to enable Nostr Comments on Nuxt 4 based websites",
|
|
5
5
|
"repository": "threenine/nuxstr-comments",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nostr-dev-kit/ndk": "^2.
|
|
27
|
-
"@nuxt/kit": "^4.0.3",
|
|
26
|
+
"@nostr-dev-kit/ndk": "^2.18.1",
|
|
28
27
|
"defu": "^6.1.4",
|
|
29
28
|
"marked": "^16.2.1"
|
|
30
29
|
},
|
|
@@ -32,22 +31,23 @@
|
|
|
32
31
|
"@nuxt/devtools": "^2.6.2",
|
|
33
32
|
"@nuxt/eslint": "1.9.0",
|
|
34
33
|
"@nuxt/eslint-config": "^1.9.0",
|
|
34
|
+
"@nuxt/kit": "^4.2.1",
|
|
35
35
|
"@nuxt/module-builder": "^1.0.2",
|
|
36
|
-
"@nuxt/schema": "^4.
|
|
36
|
+
"@nuxt/schema": "^4.2.1",
|
|
37
37
|
"@nuxt/scripts": "0.11.10",
|
|
38
38
|
"@nuxt/test-utils": "^3.19.2",
|
|
39
|
-
"@nuxt/ui": "^
|
|
39
|
+
"@nuxt/ui": "^4.2.1",
|
|
40
40
|
"@testing-library/jest-dom": "^6.8.0",
|
|
41
41
|
"@testing-library/vue": "^8.1.0",
|
|
42
|
+
"@types/node": "latest",
|
|
42
43
|
"@unhead/vue": "^2.0.14",
|
|
43
44
|
"changelogen": "^0.6.2",
|
|
44
45
|
"eslint": "^9.35.0",
|
|
45
46
|
"jsdom": "^26.1.0",
|
|
46
|
-
"nuxt": "^4.1
|
|
47
|
+
"nuxt": "^4.2.1",
|
|
47
48
|
"typescript": "~5.9.2",
|
|
48
49
|
"vitest": "^3.2.4",
|
|
49
|
-
"vue-tsc": "^3.0.6"
|
|
50
|
-
"@types/node": "latest"
|
|
50
|
+
"vue-tsc": "^3.0.6"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"dev": "pnpm run dev:prepare && nuxi dev playground",
|