nuxt-strapi-blocks-renderer 1.0.15 → 1.0.17

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.
Files changed (34) hide show
  1. package/README.md +50 -40
  2. package/dist/module.d.mts +2 -1
  3. package/dist/module.json +3 -3
  4. package/dist/runtime/components/StrapiBlocksText.vue +7 -13
  5. package/dist/runtime/components/StrapiBlocksText.vue.d.ts +6 -0
  6. package/dist/runtime/components/blocks/CodeNode.vue.d.ts +14 -0
  7. package/dist/runtime/components/blocks/ImageNode.vue +4 -4
  8. package/dist/runtime/components/blocks/ImageNode.vue.d.ts +5 -0
  9. package/dist/runtime/components/blocks/ParagraphNode.vue.d.ts +14 -0
  10. package/dist/runtime/components/blocks/QuoteNode.vue.d.ts +14 -0
  11. package/dist/runtime/components/blocks/heading/Heading1Node.vue.d.ts +14 -0
  12. package/dist/runtime/components/blocks/heading/Heading2Node.vue.d.ts +14 -0
  13. package/dist/runtime/components/blocks/heading/Heading3Node.vue.d.ts +14 -0
  14. package/dist/runtime/components/blocks/heading/Heading4Node.vue.d.ts +14 -0
  15. package/dist/runtime/components/blocks/heading/Heading5Node.vue.d.ts +14 -0
  16. package/dist/runtime/components/blocks/heading/Heading6Node.vue.d.ts +14 -0
  17. package/dist/runtime/components/blocks/inline/BoldInlineNode.vue.d.ts +14 -0
  18. package/dist/runtime/components/blocks/inline/CodeInlineNode.vue.d.ts +14 -0
  19. package/dist/runtime/components/blocks/inline/ItalicInlineNode.vue.d.ts +14 -0
  20. package/dist/runtime/components/blocks/inline/LinkInlineNode.vue +4 -4
  21. package/dist/runtime/components/blocks/inline/LinkInlineNode.vue.d.ts +17 -0
  22. package/dist/runtime/components/blocks/inline/ListItemInlineNode.vue.d.ts +14 -0
  23. package/dist/runtime/components/blocks/inline/StrikethroughInlineNode.vue.d.ts +14 -0
  24. package/dist/runtime/components/blocks/inline/UnderlineInlineNode.vue.d.ts +14 -0
  25. package/dist/runtime/components/blocks/list/OrderedListNode.vue.d.ts +14 -0
  26. package/dist/runtime/components/blocks/list/UnorderedListNode.vue.d.ts +14 -0
  27. package/dist/runtime/composables/useBlocksText.js +3 -1
  28. package/dist/runtime/utils/index.d.ts +11 -11
  29. package/dist/runtime/utils/index.js +41 -45
  30. package/dist/types.d.mts +3 -1
  31. package/package.json +24 -18
  32. package/dist/module.cjs +0 -5
  33. package/dist/module.d.ts +0 -9
  34. package/dist/types.d.ts +0 -1
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img width="320" src="https://raw.githubusercontent.com/freb97/nuxt-strapi-blocks-renderer/refs/heads/main/.github/public/nuxt-strapi-blocks-renderer.png">
3
+ </p>
4
+
1
5
  # Nuxt Strapi Blocks Renderer
2
6
 
3
7
  [![Github Actions][github-actions-src]][github-actions-href]
@@ -10,7 +14,7 @@ A fully customizable Nuxt 3 module for rendering text with the new Blocks rich t
10
14
  The implementation is based on Strapi's [Blocks React Renderer](https://github.com/strapi/blocks-react-renderer/).
11
15
 
12
16
  - ✨ [Release notes](/CHANGELOG.md)
13
- - 🏀 [Online stackblitz playground](https://stackblitz.com/github/freb97/nuxt-strapi-blocks-renderer?file=playground%2Fbasic%2Fpages%2Findex.vue)
17
+ - 🏀 [Online stackblitz playground](https://stackblitz.com/github/freb97/nuxt-strapi-blocks-renderer?file=playground%2Fcustom%2Fpages%2Findex.vue)
14
18
 
15
19
  ## Installation
16
20
 
@@ -23,7 +27,9 @@ The implementation is based on Strapi's [Blocks React Renderer](https://github.c
23
27
  2. Add the module to `nuxt.config.{ts|js}`:
24
28
 
25
29
  ```typescript
26
- modules: ['nuxt-strapi-blocks-renderer']
30
+ export default defineNuxtConfig({
31
+ modules: [ 'nuxt-strapi-blocks-renderer' ]
32
+ })
27
33
  ```
28
34
 
29
35
  ## Usage
@@ -73,15 +79,18 @@ This step is crucial for your custom components to be recognized and used by the
73
79
 
74
80
  In your Nuxt configuration (`nuxt.config.{js|ts}`), add:
75
81
 
76
- ```typescript
77
- components: {
78
- dirs: [
79
- {
80
- path: '~/components',
81
- },
82
- ],
83
- global: true,
84
- },
82
+ ```ts
83
+ export default defineNuxtConfig({
84
+ components: {
85
+ dirs: [
86
+ {
87
+ path: '~/components/blocks',
88
+ pathPrefix: false,
89
+ global: true,
90
+ },
91
+ ],
92
+ },
93
+ })
85
94
  ```
86
95
 
87
96
  #### Customizing the Paragraph Tag
@@ -90,8 +99,8 @@ To customize the rendering of the paragraph (`<p>`) tag, you need to create a co
90
99
  The name of the component follows a predefined pattern: `'StrapiBlocksText' + [NodeName] + 'Node.vue'`.
91
100
  To override the default paragraph tag, we create a file called `StrapiBlocksTextParagraphNode.vue`.
92
101
 
93
- ```vue
94
- <!-- components/StrapiBlocksTextParagraphNode.vue -->
102
+ ```html
103
+ <!-- components/blocks/StrapiBlocksTextParagraphNode.vue -->
95
104
  <template>
96
105
  <p class="my-custom-class-for-p">
97
106
  <slot />
@@ -103,12 +112,13 @@ This component assigns a custom class `my-custom-class-for-p` to the paragraph t
103
112
 
104
113
  The prefix for the custom components can be adjusted in your `nuxt.config.{js|ts}`:
105
114
 
106
- ```typescript
107
- modules: ['nuxt-strapi-blocks-renderer'],
108
- strapiBlocksRenderer: {
109
- prefix: 'MyCustomPrefix'
110
- blocksPrefix: 'MyCustomBlocksPrefix',
111
- },
115
+ ```ts
116
+ export default defineNuxtConfig({
117
+ strapiBlocksRenderer: {
118
+ prefix: 'MyCustomPrefix',
119
+ blocksPrefix: 'MyCustomBlocksPrefix',
120
+ },
121
+ })
112
122
  ```
113
123
 
114
124
  With this configuration, the `StrapiBlocksText` component becomes `MyCustomPrefixStrapiBlocksText` and the custom
@@ -118,20 +128,20 @@ paragraph node component would be named `MyCustomBlocksPrefixParagraphNode`.
118
128
 
119
129
  You can apply similar customizations to all other HTML tags used by the renderer:
120
130
 
121
- <details>
131
+ <details open>
122
132
  <summary>Headings</summary>
123
133
 
124
134
  Custom heading tags (`<h1>`, `<h2>`, `<h3>`, etc.):
125
135
 
126
- ```vue
127
- <!-- components/StrapiBlocksTextHeading1Node.vue -->
136
+ ```html
137
+ <!-- components/blocks/StrapiBlocksTextHeading1Node.vue -->
128
138
  <template>
129
139
  <h1 class="my-custom-class-for-h1">
130
140
  <slot />
131
141
  </h1>
132
142
  </template>
133
143
 
134
- <!-- components/StrapiBlocksTextHeading2Node.vue -->
144
+ <!-- components/blocks/StrapiBlocksTextHeading2Node.vue -->
135
145
  <template>
136
146
  <h2 class="my-custom-class-for-h2">
137
147
  <slot />
@@ -147,22 +157,22 @@ This pattern also extends to the `h3`, `h4`, `h5` and `h6` tags.
147
157
 
148
158
  Custom list tags (`<ol>`, `<ul>` and `<li>`):
149
159
 
150
- ```vue
151
- <!-- components/StrapiBlocksTextOrderedListNode.vue -->
160
+ ```html
161
+ <!-- components/blocks/StrapiBlocksTextOrderedListNode.vue -->
152
162
  <template>
153
163
  <ol class="my-custom-class-for-ol">
154
164
  <slot />
155
165
  </ol>
156
166
  </template>
157
167
 
158
- <!-- components/StrapiBlocksTextUnorderedListNode.vue -->
168
+ <!-- components/blocks/StrapiBlocksTextUnorderedListNode.vue -->
159
169
  <template>
160
170
  <ul class="my-custom-class-for-ul">
161
171
  <slot />
162
172
  </ul>
163
173
  </template>
164
174
 
165
- <!-- components/StrapiBlocksTextListItemInlineNode.vue -->
175
+ <!-- components/blocks/StrapiBlocksTextListItemInlineNode.vue -->
166
176
  <template>
167
177
  <li class="my-custom-class-for-li">
168
178
  <slot />
@@ -176,15 +186,15 @@ Custom list tags (`<ol>`, `<ul>` and `<li>`):
176
186
 
177
187
  Custom blockquote and code tags (`<blockquote>`, `<pre>`):
178
188
 
179
- ```vue
180
- <!-- components/StrapiBlocksTextQuoteNode.vue -->
189
+ ```html
190
+ <!-- components/blocks/StrapiBlocksTextQuoteNode.vue -->
181
191
  <template>
182
192
  <blockquote class="my-custom-class-for-blockquote">
183
193
  <slot />
184
194
  </blockquote>
185
195
  </template>
186
196
 
187
- <!-- components/StrapiBlocksTextCodeNode.vue -->
197
+ <!-- components/blocks/StrapiBlocksTextCodeNode.vue -->
188
198
  <template>
189
199
  <pre class="my-custom-class-for-pre"><slot /></pre>
190
200
  </template>
@@ -196,36 +206,36 @@ Custom blockquote and code tags (`<blockquote>`, `<pre>`):
196
206
 
197
207
  Custom inline text nodes (`<strong>`, `<em>`, `<u>`, `<del>`, `<code>`):
198
208
 
199
- ```vue
200
- <!-- components/StrapiBlocksTextBoldInlineNode.vue -->
209
+ ```html
210
+ <!-- components/blocks/StrapiBlocksTextBoldInlineNode.vue -->
201
211
  <template>
202
212
  <strong class="my-custom-class-for-strong">
203
213
  <slot />
204
214
  </strong>
205
215
  </template>
206
216
 
207
- <!-- components/StrapiBlocksTextItalicInlineNode.vue -->
217
+ <!-- components/blocks/StrapiBlocksTextItalicInlineNode -->
208
218
  <template>
209
219
  <em class="my-custom-class-for-em">
210
220
  <slot />
211
221
  </em>
212
222
  </template>
213
223
 
214
- <!-- components/StrapiBlocksTextUnderlineInlineNode.vue -->
224
+ <!-- components/blocks/StrapiBlocksTextUnderlineInlineNode -->
215
225
  <template>
216
226
  <u class="my-custom-class-for-u">
217
227
  <slot />
218
228
  </u>
219
229
  </template>
220
230
 
221
- <!-- components/StrapiBlocksTextStrikethroughInlineNode.vue -->
231
+ <!-- components/blocks/StrapiBlocksTextStrikethroughInlineNode -->
222
232
  <template>
223
233
  <del class="my-custom-class-for-del">
224
234
  <slot />
225
235
  </del>
226
236
  </template>
227
237
 
228
- <!-- components/StrapiBlocksTextCodeInlineNode.vue -->
238
+ <!-- components/blocks/StrapiBlocksTextCodeInlineNode.vue -->
229
239
  <template>
230
240
  <code class="my-custom-class-for-code">
231
241
  <slot />
@@ -239,8 +249,8 @@ Custom inline text nodes (`<strong>`, `<em>`, `<u>`, `<del>`, `<code>`):
239
249
 
240
250
  Custom link tag (`<a>`):
241
251
 
242
- ```vue
243
- <!-- components/StrapiBlocksTextLinkInlineNode.vue -->
252
+ ```html
253
+ <!-- components/blocks/StrapiBlocksTextLinkInlineNode.vue -->
244
254
  <script setup lang="ts">
245
255
  const props = defineProps<{
246
256
  url: string;
@@ -262,8 +272,8 @@ When rendering a link tag, the url gets passed as the `url` component property.
262
272
 
263
273
  Custom image tag (`<img>`):
264
274
 
265
- ```vue
266
- <!-- components/StrapiBlocksTextImageNode.vue -->
275
+ ```html
276
+ <!-- components/blocks/StrapiBlocksTextImageNode.vue -->
267
277
  <script setup lang="ts">
268
278
  const props = defineProps<{
269
279
  image: any;
package/dist/module.d.mts CHANGED
@@ -6,4 +6,5 @@ interface ModuleOptions {
6
6
  }
7
7
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
8
8
 
9
- export { type ModuleOptions, _default as default };
9
+ export { _default as default };
10
+ export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-strapi-blocks-renderer",
3
3
  "configKey": "strapiBlocksRenderer",
4
- "version": "1.0.15",
4
+ "version": "1.0.17",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.4",
7
- "unbuild": "2.0.0"
6
+ "@nuxt/module-builder": "1.0.1",
7
+ "unbuild": "3.5.0"
8
8
  }
9
9
  }
@@ -1,17 +1,11 @@
1
- <script setup lang="ts">
2
- import type { BlockNode } from '#strapi-blocks-renderer/types';
3
- import type { VNode } from 'vue';
4
-
5
- import { useBlocksText } from '#strapi-blocks-renderer/composables/useBlocksText';
6
-
7
- const props = defineProps<{
8
- nodes: BlockNode[];
9
- }>();
10
-
1
+ <script setup>
2
+ import { useBlocksText } from "#strapi-blocks-renderer/composables/useBlocksText";
3
+ const props = defineProps({
4
+ nodes: { type: Array, required: true }
5
+ });
11
6
  const { text } = useBlocksText(props.nodes);
12
-
13
- const RenderText = (): VNode[] => {
14
- return text;
7
+ const RenderText = () => {
8
+ return text;
15
9
  };
16
10
  </script>
17
11
 
@@ -0,0 +1,6 @@
1
+ import type { BlockNode } from '#strapi-blocks-renderer/types';
2
+ type __VLS_Props = {
3
+ nodes: BlockNode[];
4
+ };
5
+ declare const _default: 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
+ export default _default;
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -1,7 +1,7 @@
1
- <script setup lang="ts">
2
- const props = defineProps<{
3
- image: Record<string, string>;
4
- }>();
1
+ <script setup>
2
+ const props = defineProps({
3
+ image: { type: Object, required: true }
4
+ });
5
5
  </script>
6
6
 
7
7
  <template>
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ image: Record<string, string>;
3
+ };
4
+ declare const _default: 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
+ export default _default;
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -1,7 +1,7 @@
1
- <script setup lang="ts">
2
- const props = defineProps<{
3
- url: string;
4
- }>();
1
+ <script setup>
2
+ const props = defineProps({
3
+ url: { type: String, required: true }
4
+ });
5
5
  </script>
6
6
 
7
7
  <template>
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ url: string;
3
+ };
4
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ }>;
9
+ declare const __VLS_self: 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>;
10
+ declare const __VLS_component: 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>;
11
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -0,0 +1,14 @@
1
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2
+ declare var __VLS_1: {};
3
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
4
+ default?: (props: typeof __VLS_1) => any;
5
+ }>;
6
+ declare const __VLS_self: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
9
+ export default _default;
10
+ type __VLS_WithSlots<T, S> = T & {
11
+ new (): {
12
+ $slots: S;
13
+ };
14
+ };
@@ -1,6 +1,8 @@
1
+ import { useRuntimeConfig } from "#imports";
1
2
  import { renderBlocks } from "#strapi-blocks-renderer/utils";
2
3
  export const useBlocksText = (blockNodes) => {
3
- const textNodes = renderBlocks(blockNodes);
4
+ const prefix = useRuntimeConfig().public.strapiBlocksRenderer.blocksPrefix;
5
+ const textNodes = renderBlocks(blockNodes, prefix);
4
6
  return {
5
7
  text: textNodes
6
8
  };
@@ -1,13 +1,13 @@
1
1
  import type { BlockNode, CodeBlockNode, DefaultInlineNode, HeadingBlockNode, ImageBlockNode, LinkInlineNode, ListBlockNode, ListItemInlineNode, ParagraphBlockNode, QuoteBlockNode, TextInlineNode } from '#strapi-blocks-renderer/types';
2
2
  import type { VNode } from 'vue';
3
- export declare const textInlineNode: (node: TextInlineNode) => (VNode | string)[] | VNode;
4
- export declare const linkInlineNode: (node: LinkInlineNode) => VNode;
5
- export declare const defaultInlineNode: (node: DefaultInlineNode) => (VNode | string)[] | VNode | undefined;
6
- export declare const listItemInlineNode: (node: ListItemInlineNode) => VNode;
7
- export declare const headingBlockNode: (node: HeadingBlockNode) => VNode;
8
- export declare const paragraphBlockNode: (node: ParagraphBlockNode) => VNode;
9
- export declare const codeBlockNode: (node: CodeBlockNode) => VNode;
10
- export declare const quoteBlockNode: (node: QuoteBlockNode) => VNode;
11
- export declare const listBlockNode: (node: ListBlockNode) => VNode;
12
- export declare const imageBlockNode: (node: ImageBlockNode) => VNode;
13
- export declare const renderBlocks: (blockNodes: BlockNode[]) => VNode[];
3
+ export declare const textInlineNode: (node: TextInlineNode, prefix: string) => (VNode | string)[] | VNode;
4
+ export declare const linkInlineNode: (node: LinkInlineNode, prefix: string) => VNode;
5
+ export declare const defaultInlineNode: (node: DefaultInlineNode, prefix: string) => (VNode | string)[] | VNode | undefined;
6
+ export declare const listItemInlineNode: (node: ListItemInlineNode, prefix: string) => VNode;
7
+ export declare const headingBlockNode: (node: HeadingBlockNode, prefix: string) => VNode;
8
+ export declare const paragraphBlockNode: (node: ParagraphBlockNode, prefix: string) => VNode;
9
+ export declare const codeBlockNode: (node: CodeBlockNode, prefix: string) => VNode;
10
+ export declare const quoteBlockNode: (node: QuoteBlockNode, prefix: string) => VNode;
11
+ export declare const listBlockNode: (node: ListBlockNode, prefix: string) => VNode;
12
+ export declare const imageBlockNode: (node: ImageBlockNode, prefix: string) => VNode;
13
+ export declare const renderBlocks: (blockNodes: BlockNode[], prefix: string) => VNode[];
@@ -1,8 +1,4 @@
1
- import { h, resolveComponent, useRuntimeConfig } from "#imports";
2
- const prefix = () => {
3
- const { public: { strapiBlocksRenderer } } = useRuntimeConfig();
4
- return strapiBlocksRenderer.blocksPrefix;
5
- };
1
+ import { h, resolveComponent } from "vue";
6
2
  const getNodeText = (node) => {
7
3
  const lines = [];
8
4
  node.text.split("\n").forEach((line, index, array) => {
@@ -13,91 +9,91 @@ const getNodeText = (node) => {
13
9
  });
14
10
  return lines;
15
11
  };
16
- export const textInlineNode = (node) => {
12
+ export const textInlineNode = (node, prefix) => {
17
13
  const text = getNodeText(node);
18
- if (node.bold) return h(resolveComponent(`${prefix()}BoldInlineNode`), () => text);
19
- if (node.italic) return h(resolveComponent(`${prefix()}ItalicInlineNode`), () => text);
20
- if (node.underline) return h(resolveComponent(`${prefix()}UnderlineInlineNode`), () => text);
21
- if (node.strikethrough) return h(resolveComponent(`${prefix()}StrikethroughInlineNode`), () => text);
22
- if (node.code) return h(resolveComponent(`${prefix()}CodeInlineNode`), () => text);
14
+ if (node.bold) return h(resolveComponent(`${prefix}BoldInlineNode`), () => text);
15
+ if (node.italic) return h(resolveComponent(`${prefix}ItalicInlineNode`), () => text);
16
+ if (node.underline) return h(resolveComponent(`${prefix}UnderlineInlineNode`), () => text);
17
+ if (node.strikethrough) return h(resolveComponent(`${prefix}StrikethroughInlineNode`), () => text);
18
+ if (node.code) return h(resolveComponent(`${prefix}CodeInlineNode`), () => text);
23
19
  return text;
24
20
  };
25
- export const linkInlineNode = (node) => {
26
- const linkComponent = resolveComponent(`${prefix()}LinkInlineNode`);
21
+ export const linkInlineNode = (node, prefix) => {
22
+ const linkComponent = resolveComponent(`${prefix}LinkInlineNode`);
27
23
  return h(linkComponent, { url: node.url }, () => node.children.map((childNode) => {
28
- return textInlineNode(childNode);
24
+ return textInlineNode(childNode, prefix);
29
25
  }));
30
26
  };
31
- export const defaultInlineNode = (node) => {
27
+ export const defaultInlineNode = (node, prefix) => {
32
28
  if (node.type === "link") {
33
- return linkInlineNode(node);
29
+ return linkInlineNode(node, prefix);
34
30
  } else if (node.type === "text") {
35
- return textInlineNode(node);
31
+ return textInlineNode(node, prefix);
36
32
  }
37
33
  };
38
- export const listItemInlineNode = (node) => {
39
- const listItemComponent = resolveComponent(`${prefix()}ListItemInlineNode`);
34
+ export const listItemInlineNode = (node, prefix) => {
35
+ const listItemComponent = resolveComponent(`${prefix}ListItemInlineNode`);
40
36
  return h(listItemComponent, () => node.children.map(
41
- (childNode) => defaultInlineNode(childNode)
37
+ (childNode) => defaultInlineNode(childNode, prefix)
42
38
  ));
43
39
  };
44
- export const headingBlockNode = (node) => {
45
- const headingComponent = resolveComponent(`${prefix()}Heading${node.level}Node`);
40
+ export const headingBlockNode = (node, prefix) => {
41
+ const headingComponent = resolveComponent(`${prefix}Heading${node.level}Node`);
46
42
  return h(headingComponent, () => node.children.map(
47
- (childNode) => defaultInlineNode(childNode)
43
+ (childNode) => defaultInlineNode(childNode, prefix)
48
44
  ));
49
45
  };
50
- export const paragraphBlockNode = (node) => {
51
- const paragraphComponent = resolveComponent(`${prefix()}ParagraphNode`);
46
+ export const paragraphBlockNode = (node, prefix) => {
47
+ const paragraphComponent = resolveComponent(`${prefix}ParagraphNode`);
52
48
  return h(paragraphComponent, () => node.children.map(
53
- (childNode) => defaultInlineNode(childNode)
49
+ (childNode) => defaultInlineNode(childNode, prefix)
54
50
  ));
55
51
  };
56
- export const codeBlockNode = (node) => {
57
- const codeComponent = resolveComponent(`${prefix()}CodeNode`);
52
+ export const codeBlockNode = (node, prefix) => {
53
+ const codeComponent = resolveComponent(`${prefix}CodeNode`);
58
54
  return h(codeComponent, () => node.children.map(
59
- (childNode) => textInlineNode(childNode)
55
+ (childNode) => textInlineNode(childNode, prefix)
60
56
  ));
61
57
  };
62
- export const quoteBlockNode = (node) => {
63
- const quoteComponent = resolveComponent(`${prefix()}QuoteNode`);
58
+ export const quoteBlockNode = (node, prefix) => {
59
+ const quoteComponent = resolveComponent(`${prefix}QuoteNode`);
64
60
  return h(quoteComponent, () => node.children.map(
65
- (childNode) => defaultInlineNode(childNode)
61
+ (childNode) => defaultInlineNode(childNode, prefix)
66
62
  ));
67
63
  };
68
- export const listBlockNode = (node) => {
64
+ export const listBlockNode = (node, prefix) => {
69
65
  const listType = node.format === "ordered" ? "OrderedListNode" : "UnorderedListNode";
70
- const listComponent = resolveComponent(prefix() + listType);
66
+ const listComponent = resolveComponent(`${prefix}${listType}`);
71
67
  return h(listComponent, () => node.children.map(
72
68
  (childNode) => {
73
69
  if (childNode.type === "list-item") {
74
- return listItemInlineNode(childNode);
70
+ return listItemInlineNode(childNode, prefix);
75
71
  }
76
- return listBlockNode(childNode);
72
+ return listBlockNode(childNode, prefix);
77
73
  }
78
74
  ));
79
75
  };
80
- export const imageBlockNode = (node) => {
81
- const imageComponent = resolveComponent(`${prefix()}ImageNode`);
76
+ export const imageBlockNode = (node, prefix) => {
77
+ const imageComponent = resolveComponent(`${prefix}ImageNode`);
82
78
  return h(imageComponent, {
83
79
  image: node.image
84
80
  });
85
81
  };
86
- export const renderBlocks = (blockNodes) => {
82
+ export const renderBlocks = (blockNodes, prefix) => {
87
83
  return blockNodes.map((blockNode) => {
88
84
  switch (blockNode.type) {
89
85
  case "heading":
90
- return headingBlockNode(blockNode);
86
+ return headingBlockNode(blockNode, prefix);
91
87
  case "code":
92
- return codeBlockNode(blockNode);
88
+ return codeBlockNode(blockNode, prefix);
93
89
  case "list":
94
- return listBlockNode(blockNode);
90
+ return listBlockNode(blockNode, prefix);
95
91
  case "quote":
96
- return quoteBlockNode(blockNode);
92
+ return quoteBlockNode(blockNode, prefix);
97
93
  case "image":
98
- return imageBlockNode(blockNode);
94
+ return imageBlockNode(blockNode, prefix);
99
95
  default:
100
- return paragraphBlockNode(blockNode);
96
+ return paragraphBlockNode(blockNode, prefix);
101
97
  }
102
98
  });
103
99
  };
package/dist/types.d.mts CHANGED
@@ -1 +1,3 @@
1
- export { type ModuleOptions, default } from './module.js'
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-strapi-blocks-renderer",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Renderer for the strapi CMS blocks text content element.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,13 +14,18 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./dist/types.d.ts",
18
- "import": "./dist/module.mjs",
19
- "require": "./dist/module.cjs"
17
+ "types": "./dist/types.d.mts",
18
+ "import": "./dist/module.mjs"
19
+ }
20
+ },
21
+ "main": "./dist/module.mjs",
22
+ "typesVersions": {
23
+ "*": {
24
+ ".": [
25
+ "./dist/types.d.mts"
26
+ ]
20
27
  }
21
28
  },
22
- "main": "./dist/module.cjs",
23
- "types": "./dist/types.d.ts",
24
29
  "files": [
25
30
  "dist"
26
31
  ],
@@ -39,20 +44,21 @@
39
44
  "renovate:config:validate": "renovate-config-validator"
40
45
  },
41
46
  "dependencies": {
42
- "@nuxt/kit": "^3.15.4",
47
+ "@nuxt/kit": "^3.16.2",
43
48
  "defu": "^6.1.4"
44
49
  },
45
50
  "devDependencies": {
46
- "@nuxt/devtools": "^1.7.0",
47
- "@nuxt/eslint-config": "^1.0.0",
48
- "@nuxt/module-builder": "^0.8.4",
49
- "@nuxt/schema": "^3.15.4",
50
- "@nuxt/test-utils": "^3.15.4",
51
- "eslint": "^9.19.0",
52
- "nuxt": "^3.15.4",
53
- "renovate": "^39.145.0",
54
- "vitest": "^3.0.4",
55
- "vue-tsc": "^2.2.0"
51
+ "@nuxt/devtools": "^2.3.2",
52
+ "@nuxt/eslint-config": "^1.3.0",
53
+ "@nuxt/module-builder": "^1.0.1",
54
+ "@nuxt/schema": "^3.16.2",
55
+ "@nuxt/test-utils": "^3.17.2",
56
+ "@nuxtjs/tailwindcss": "^6.13.2",
57
+ "eslint": "^9.24.0",
58
+ "nuxt": "^3.16.2",
59
+ "renovate": "^39.240.1",
60
+ "vitest": "^3.1.1",
61
+ "vue-tsc": "^2.2.8"
56
62
  },
57
63
  "keywords": [
58
64
  "nuxt",
@@ -70,6 +76,6 @@
70
76
  "node": "^18.x || ^20.x || ^22.x"
71
77
  },
72
78
  "stackblitz": {
73
- "startCommand": "npm run dev:prepare && npm run dev"
79
+ "startCommand": "npm run dev:prepare && npm run dev:custom"
74
80
  }
75
81
  }
package/dist/module.cjs DELETED
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
package/dist/module.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- interface ModuleOptions {
4
- prefix: string;
5
- blocksPrefix: string;
6
- }
7
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
8
-
9
- export { type ModuleOptions, _default as default };
package/dist/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export { type ModuleOptions, default } from './module'