@wpnuxt/blocks 0.0.2 → 0.0.4
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.d.mts +1 -0
- package/dist/module.d.ts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -5
- package/dist/runtime/components/blocks/CoreButton.vue +7 -2
- package/dist/runtime/components/blocks/CoreHeading.vue +28 -0
- package/dist/runtime/components/blocks/CoreImage.vue +3 -2
- package/dist/runtime/components/blocks/EditorBlock.vue +1 -1
- package/dist/runtime/queries/fragments/CoreHeading.fragment.gql +20 -0
- package/dist/runtime/queries/fragments/EditorBlock.fragment.gql +2 -0
- package/package.json +9 -7
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addComponent, addTemplate } from '@nuxt/kit';
|
|
1
|
+
import { promises } from 'node:fs';
|
|
2
|
+
import { defineNuxtModule, createResolver, installModule, addComponentsDir, addComponent, 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.4";
|
|
7
7
|
|
|
8
8
|
const module = defineNuxtModule({
|
|
9
9
|
meta: {
|
|
@@ -12,12 +12,18 @@ const module = defineNuxtModule({
|
|
|
12
12
|
configKey: "wpNuxtBlocks"
|
|
13
13
|
},
|
|
14
14
|
// Default configuration options of the Nuxt module
|
|
15
|
-
defaults: {
|
|
15
|
+
defaults: {
|
|
16
|
+
enabled: true
|
|
17
|
+
},
|
|
16
18
|
async setup(_options, nuxt) {
|
|
17
19
|
const { resolve } = createResolver(import.meta.url);
|
|
18
20
|
const resolveRuntimeModule = (path) => resolve("./runtime", path);
|
|
19
21
|
console.log("!!! Setup @wpnuxt/blocks module");
|
|
20
22
|
nuxt.options.alias["#wpnuxt/blocks"] = resolve(nuxt.options.buildDir, "wpnuxt/blocks");
|
|
23
|
+
await installModule("@nuxt/ui");
|
|
24
|
+
await installModule("@nuxt/image", {
|
|
25
|
+
domains: ["wordpress.wpnuxt.com"]
|
|
26
|
+
});
|
|
21
27
|
addComponentsDir({
|
|
22
28
|
path: resolveRuntimeModule("./components/blocks"),
|
|
23
29
|
pathPrefix: false,
|
|
@@ -28,7 +34,7 @@ const module = defineNuxtModule({
|
|
|
28
34
|
for (const layer of _layers) {
|
|
29
35
|
const srcDir = layer.config.srcDir;
|
|
30
36
|
const blockComponents = resolve(srcDir, "components/blocks");
|
|
31
|
-
const dirStat = await
|
|
37
|
+
const dirStat = await promises.stat(blockComponents).catch(() => null);
|
|
32
38
|
if (dirStat && dirStat.isDirectory()) {
|
|
33
39
|
nuxt.hook("components:dirs", (dirs) => {
|
|
34
40
|
dirs.unshift({
|
|
@@ -8,7 +8,12 @@ defineProps<{
|
|
|
8
8
|
|
|
9
9
|
<template>
|
|
10
10
|
<UButton
|
|
11
|
-
:label="block.attributes.text"
|
|
12
11
|
:to="block.attributes.url"
|
|
13
|
-
|
|
12
|
+
:target="block.attributes.linkTarget"
|
|
13
|
+
:class="block.attributes.cssClassName"
|
|
14
|
+
:rel="block.attributes.rel"
|
|
15
|
+
:style="block.attributes.style"
|
|
16
|
+
>
|
|
17
|
+
<span v-sanitize="block.attributes.text" />
|
|
18
|
+
</UButton>
|
|
14
19
|
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CoreHeading } from '#wpnuxt/blocks'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
block: CoreHeading
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<template v-if="block.attributes.level === 1">
|
|
11
|
+
<h1 v-sanitize="block.attributes.content" />
|
|
12
|
+
</template>
|
|
13
|
+
<template v-if="block.attributes.level === 2">
|
|
14
|
+
<h2 v-sanitize="block.attributes.content" />
|
|
15
|
+
</template>
|
|
16
|
+
<template v-if="block.attributes.level === 3">
|
|
17
|
+
<h3 v-sanitize="block.attributes.content" />
|
|
18
|
+
</template>
|
|
19
|
+
<template v-if="block.attributes.level === 4">
|
|
20
|
+
<h4 v-sanitize="block.attributes.content" />
|
|
21
|
+
</template>
|
|
22
|
+
<template v-if="block.attributes.level === 5">
|
|
23
|
+
<h5 v-sanitize="block.attributes.content" />
|
|
24
|
+
</template>
|
|
25
|
+
<template v-if="block.attributes.level === 6">
|
|
26
|
+
<h6 v-sanitize="block.attributes.content" />
|
|
27
|
+
</template>
|
|
28
|
+
</template>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { getRelativeImagePath } from '../../util/images'
|
|
2
|
+
// import { getRelativeImagePath } from '../../util/images'
|
|
3
3
|
import type { CoreImage } from '#graphql-operations'
|
|
4
4
|
|
|
5
5
|
const props = defineProps<{
|
|
6
6
|
block: CoreImage
|
|
7
7
|
}>()
|
|
8
|
-
const imgUrl = getRelativeImagePath(props.block?.attributes?.url)
|
|
8
|
+
// const imgUrl = getRelativeImagePath(props.block?.attributes?.url)
|
|
9
|
+
const imgUrl = props.block?.attributes?.url
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
fragment CoreHeading on CoreHeading {
|
|
2
|
+
attributes {
|
|
3
|
+
align
|
|
4
|
+
anchor
|
|
5
|
+
backgroundColor
|
|
6
|
+
className
|
|
7
|
+
content
|
|
8
|
+
cssClassName
|
|
9
|
+
fontFamily
|
|
10
|
+
fontSize
|
|
11
|
+
gradient
|
|
12
|
+
level
|
|
13
|
+
lock
|
|
14
|
+
metadata
|
|
15
|
+
placeholder
|
|
16
|
+
style
|
|
17
|
+
textAlign
|
|
18
|
+
textColor
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import '~/.queries/fragments/CoreButton.fragment.gql';
|
|
2
2
|
#import '~/.queries/fragments/CoreGallery.fragment.gql';
|
|
3
|
+
#import '~/.queries/fragments/CoreHeading.fragment.gql';
|
|
3
4
|
#import '~/.queries/fragments/CoreImage.fragment.gql';
|
|
4
5
|
#import '~/.queries/fragments/CoreParagraph.fragment.gql';
|
|
5
6
|
#import '~/.queries/fragments/CoreQuote.fragment.gql';
|
|
@@ -15,6 +16,7 @@ fragment EditorBlock on EditorBlock {
|
|
|
15
16
|
renderedHtml
|
|
16
17
|
...CoreButton
|
|
17
18
|
...CoreGallery
|
|
19
|
+
...CoreHeading
|
|
18
20
|
...CoreImage
|
|
19
21
|
...CoreParagraph
|
|
20
22
|
...CoreQuote
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wpnuxt/blocks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "WPNuxt Blocks",
|
|
5
5
|
"repository": "wpnuxt/wpnuxt-blocks",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"dev": "nuxi dev playground",
|
|
26
26
|
"dev:build": "nuxi build playground",
|
|
27
27
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
28
|
-
"release": "
|
|
29
|
-
"release-edge": "
|
|
28
|
+
"release": "pnpm run lint && pnpm run test && pnpm run prepack; release-it --git.tagExclude='*[-edge]*'",
|
|
29
|
+
"release-edge": "pnpm run lint && pnpm run test && pnpm run prepack; release-it --preRelease=edge --config .release-it-edge.json",
|
|
30
30
|
"lint": "eslint .",
|
|
31
31
|
"lint:fix": "eslint . --fix",
|
|
32
32
|
"test": "vitest run",
|
|
@@ -34,18 +34,20 @@
|
|
|
34
34
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@nuxt/image": "^1.7.0",
|
|
37
38
|
"@nuxt/kit": "^3.12.4",
|
|
38
|
-
"@
|
|
39
|
+
"@nuxt/ui": "^2.18.4",
|
|
40
|
+
"@wpnuxt/core": "^1.0.0-edge.4"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
43
|
"@nuxt/devtools": "^1.3.9",
|
|
42
|
-
"@nuxt/eslint-config": "^0.
|
|
44
|
+
"@nuxt/eslint-config": "^0.5.0",
|
|
43
45
|
"@nuxt/module-builder": "^0.8.1",
|
|
44
46
|
"@nuxt/schema": "^3.12.4",
|
|
45
47
|
"@nuxt/test-utils": "^3.13.1",
|
|
46
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^22.2.0",
|
|
47
49
|
"changelogen": "^0.5.5",
|
|
48
|
-
"eslint": "^9.
|
|
50
|
+
"eslint": "^9.9.0",
|
|
49
51
|
"nuxt": "^3.12.4",
|
|
50
52
|
"release-it": "^17.6.0",
|
|
51
53
|
"typescript": "latest",
|