@wpnuxt/blocks 0.0.7 → 0.0.9
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/dist/module.json +1 -1
- package/dist/module.mjs +5 -7
- package/dist/runtime/components/BlockRenderer.vue +3 -3
- package/dist/runtime/components/blocks/CoreButton.vue +2 -2
- package/dist/runtime/components/blocks/CoreParagraph.vue +1 -2
- package/dist/runtime/queries/fragments/{EditorBlocks.fragment.gql → NodeWithEditorBlocks.fragment.gql} +1 -1
- package/dist/runtime/queries/fragments/Page.fragment.gql +2 -2
- package/dist/runtime/queries/fragments/Post.fragment.gql +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { promises } from 'node:fs';
|
|
2
|
-
import { defineNuxtModule, createResolver, installModule, addComponentsDir,
|
|
2
|
+
import { defineNuxtModule, createResolver, installModule, addComponentsDir, addTemplate } from '@nuxt/kit';
|
|
3
3
|
import { genDynamicImport } from 'knitwork';
|
|
4
4
|
|
|
5
5
|
const name = "@wpnuxt/blocks";
|
|
6
|
-
const version = "0.0.
|
|
6
|
+
const version = "0.0.9";
|
|
7
7
|
|
|
8
8
|
const module = defineNuxtModule({
|
|
9
9
|
meta: {
|
|
@@ -22,10 +22,11 @@ const module = defineNuxtModule({
|
|
|
22
22
|
nuxt.options.alias["#wpnuxt/blocks"] = resolve(nuxt.options.buildDir, "wpnuxt/blocks");
|
|
23
23
|
await installModule("@nuxt/ui");
|
|
24
24
|
await installModule("@nuxt/image", {
|
|
25
|
+
// TODO: get wordpressUrl from @wpnuxt/core options
|
|
25
26
|
domains: ["wordpress.wpnuxt.com"]
|
|
26
27
|
});
|
|
27
28
|
addComponentsDir({
|
|
28
|
-
path: resolveRuntimeModule("./components
|
|
29
|
+
path: resolveRuntimeModule("./components"),
|
|
29
30
|
pathPrefix: false,
|
|
30
31
|
prefix: "",
|
|
31
32
|
global: true
|
|
@@ -46,12 +47,9 @@ const module = defineNuxtModule({
|
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
addComponent({ name: "BlockComponent", filePath: resolveRuntimeModule("./components/BlockComponent") });
|
|
50
|
-
addComponent({ name: "BlockInfo", filePath: resolveRuntimeModule("./components/BlockInfo") });
|
|
51
|
-
addComponent({ name: "BlockRenderer", filePath: resolveRuntimeModule("./components/BlockRenderer") });
|
|
52
50
|
const componentsContext = { components: [] };
|
|
53
51
|
nuxt.hook("components:extend", (newComponents) => {
|
|
54
|
-
const moduleBlocksDir = resolveRuntimeModule("./components
|
|
52
|
+
const moduleBlocksDir = resolveRuntimeModule("./components");
|
|
55
53
|
const userBlocksDir = (nuxt.options.srcDir || nuxt.options.rootDir) + "/components/blocks";
|
|
56
54
|
componentsContext.components = newComponents.filter((c) => {
|
|
57
55
|
if (c.filePath.startsWith(moduleBlocksDir) || c.filePath.startsWith(userBlocksDir)) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import BlockComponent from './BlockComponent.vue'
|
|
3
|
-
import type {
|
|
3
|
+
import type { NodeWithEditorBlocksFragment } from '#build/graphql-operations'
|
|
4
4
|
|
|
5
5
|
defineProps<{
|
|
6
|
-
|
|
6
|
+
node: NodeWithEditorBlocksFragment
|
|
7
7
|
}>()
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<template>
|
|
11
11
|
<div>
|
|
12
12
|
<BlockComponent
|
|
13
|
-
v-for="block, index in
|
|
13
|
+
v-for="block, index in node.editorBlocks"
|
|
14
14
|
:key="index"
|
|
15
15
|
:block="block"
|
|
16
16
|
/>
|
|
@@ -22,8 +22,8 @@ if (props.block.attributes?.metadata) {
|
|
|
22
22
|
:rel="block.attributes.rel"
|
|
23
23
|
:style="block.attributes.style"
|
|
24
24
|
:variant
|
|
25
|
-
:class="getCssClasses(
|
|
26
|
-
:size="convertFontSize(
|
|
25
|
+
:class="getCssClasses(block)"
|
|
26
|
+
:size="convertFontSize(block.attributes?.fontSize, '', 'md')"
|
|
27
27
|
>
|
|
28
28
|
<span v-sanitize="block.attributes.text" />
|
|
29
29
|
</UButton>
|
|
@@ -5,14 +5,13 @@ import type { CoreParagraph } from '#wpnuxt/blocks'
|
|
|
5
5
|
const props = defineProps<{
|
|
6
6
|
block: CoreParagraph
|
|
7
7
|
}>()
|
|
8
|
-
const cssClass = getCssClasses(props.block)
|
|
9
8
|
</script>
|
|
10
9
|
|
|
11
10
|
<template>
|
|
12
11
|
<p
|
|
13
12
|
:id="block?.attributes?.anchor"
|
|
14
13
|
v-sanitize="block?.attributes?.content"
|
|
15
|
-
:class="
|
|
14
|
+
:class="getCssClasses(props.block)"
|
|
16
15
|
:style="block?.attributes?.style"
|
|
17
16
|
/>
|
|
18
17
|
</template>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#import '~/.queries/fragments/ContentNode.fragment.gql';
|
|
2
2
|
#import '~/.queries/fragments/NodeWithFeaturedImage.fragment.gql';
|
|
3
|
-
#import '~/.queries/fragments/
|
|
3
|
+
#import '~/.queries/fragments/NodeWithEditorBlocks.fragment.gql';
|
|
4
4
|
|
|
5
5
|
fragment Page on Page {
|
|
6
6
|
...ContentNode
|
|
7
7
|
...NodeWithFeaturedImage
|
|
8
|
+
...NodeWithEditorBlocks
|
|
8
9
|
content
|
|
9
10
|
isFrontPage
|
|
10
11
|
isPostsPage
|
|
@@ -13,5 +14,4 @@ fragment Page on Page {
|
|
|
13
14
|
isRestricted
|
|
14
15
|
isRevision
|
|
15
16
|
title
|
|
16
|
-
...EditorBlocks
|
|
17
17
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#import "~/.queries/fragments/NodeWithExcerpt.fragment.gql";
|
|
2
2
|
#import '~/.queries/fragments/ContentNode.fragment.gql';
|
|
3
3
|
#import '~/.queries/fragments/NodeWithFeaturedImage.fragment.gql';
|
|
4
|
-
#import '~/.queries/fragments/
|
|
4
|
+
#import '~/.queries/fragments/NodeWithEditorBlocks.fragment.gql';
|
|
5
5
|
|
|
6
6
|
fragment Post on Post {
|
|
7
7
|
...NodeWithExcerpt
|
|
8
8
|
...ContentNode
|
|
9
9
|
...NodeWithFeaturedImage
|
|
10
|
+
...NodeWithEditorBlocks
|
|
10
11
|
content
|
|
11
12
|
title
|
|
12
|
-
...EditorBlocks
|
|
13
13
|
}
|