Skip to content

Commit 102e84f

Browse files
committed
refactor: module structure, Nuxt 4 compatibility
1 parent 5b4bb8c commit 102e84f

File tree

44 files changed

+8628
-6396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+8628
-6396
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Changelog
22

3-
43
## v2.5.5
54

65
[compare changes](https://github.com/liip/vuepal/compare/v2.5.4...v2.5.5)
76

87
### 🩹 Fixes
98

10-
- Typescript issue resolved. ([7ad769b](https://github.com/liip/vuepal/commit/7ad769b))
9+
- Typescript issue resolved.
10+
([7ad769b](https://github.com/liip/vuepal/commit/7ad769b))
1111

1212
### ❤️ Contributors
1313

@@ -19,7 +19,8 @@
1919

2020
### 🩹 Fixes
2121

22-
- Remove unwanted styles ([cf99c13](https://github.com/liip/vuepal/commit/cf99c13))
22+
- Remove unwanted styles
23+
([cf99c13](https://github.com/liip/vuepal/commit/cf99c13))
2324

2425
### ❤️ Contributors
2526

@@ -42,4 +43,3 @@
4243
- Ayalon <info@ayalon.ch>
4344

4445
## v2.5.1
45-

README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# VuePal
22

3-
VuePal provides a bridge between Drupal and Vue. It comes with a set of components and
4-
composables to make your life easier when working with Drupal.
3+
VuePal provides a bridge between Drupal and Vue. It comes with a set of
4+
components and composables to make your life easier when working with Drupal.
55

66
## Frontend Routing
77

@@ -17,10 +17,13 @@ export default defineNuxtConfig({
1717
})
1818
```
1919

20-
With this feature enabled, you can create a static frontend page in Nuxt and still use all the routing features of
21-
Drupal in your frontend application. You can define your aliases in the frontend page using `definePageMeta`. The module
22-
will automatically create a Drupal configuration file that can be imported and processed by the
23-
[Drupal frontend_routing](https://www.drupal.org/project/frontend_routing) module.
20+
With this feature enabled, you can create a static frontend page in Nuxt and
21+
still use all the routing features of Drupal in your frontend application. You
22+
can define your aliases in the frontend page using `definePageMeta`. The module
23+
will automatically create a Drupal configuration file that can be imported and
24+
processed by the
25+
[Drupal frontend_routing](https://www.drupal.org/project/frontend_routing)
26+
module.
2427

2528
```ts [pages/static-page/example.vue]
2629
definePageMeta({
@@ -46,8 +49,9 @@ export default defineNuxtConfig({
4649
})
4750
```
4851

49-
This option enables the `useDrupalRoute()` composable.
50-
This composable provides the necessary GraphQL fragment and query to fetch the route data and metatags of a Drupal page.
52+
This option enables the `useDrupalRoute()` composable. This composable provides
53+
the necessary GraphQL fragment and query to fetch the route data and metatags of
54+
a Drupal page.
5155

5256
## Admin Toolbar
5357

@@ -61,13 +65,13 @@ export default defineNuxtConfig({
6165
})
6266
```
6367

64-
The admin toolbar component fetches the Drupal administration menu and displays it in your frontend application.
68+
The admin toolbar component fetches the Drupal administration menu and displays
69+
it in your frontend application.
6570
![toolbar.png](https://github.com/liip/vuepal/blob/main/screenshots/toolbar.png)
6671

6772
### Usage
6873

6974
```vue
70-
7175
<template>
7276
<ClientOnly>
7377
<div v-if="drupalUser.accessToolbar && !isEditing">
@@ -76,16 +80,15 @@ The admin toolbar component fetches the Drupal administration menu and displays
7680
</ClientOnly>
7781
</template>
7882
79-
8083
<script setup lang="ts">
81-
const route = useRoute()
82-
const drupalUser = useDrupalUser()
83-
const language = useCurrentLanguage()
84-
const isEditing = computed(
85-
() =>
86-
!!(route.query.blokkliEditing || route.query.blokkliPreview) &&
87-
drupalUser.value.accessToolbar,
88-
)
84+
const route = useRoute()
85+
const drupalUser = useDrupalUser()
86+
const language = useCurrentLanguage()
87+
const isEditing = computed(
88+
() =>
89+
!!(route.query.blokkliEditing || route.query.blokkliPreview) &&
90+
drupalUser.value.accessToolbar,
91+
)
8992
</script>
9093
```
9194

@@ -101,11 +104,11 @@ export default defineNuxtConfig({
101104
})
102105
```
103106

104-
The local tasks component fetches the local tasks of a Drupal page and displays them in your frontend application.
107+
The local tasks component fetches the local tasks of a Drupal page and displays
108+
them in your frontend application.
105109
![localtasks.png](https://github.com/liip/vuepal/blob/main/screenshots/localtasks.png)
106110

107111
```vue
108-
109112
<template>
110113
<ClientOnly>
111114
<div class="flex">

app/vuepal.adapter.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
import { defineVuepalAdapter } from '#vuepal/types'
2-
import { computed } from '#imports'
1+
import adapter from './../playground/app/vuepal.adapter'
32

4-
export default defineVuepalAdapter(() => {
5-
return {
6-
getAdminMenu() {
7-
return Promise.resolve(undefined)
8-
},
9-
getCurrentLanguage() {
10-
return computed(() => 'de')
11-
},
12-
}
13-
})
3+
export default adapter

build.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineBuildConfig } from 'unbuild'
22

33
export default defineBuildConfig({
4+
entries: ['./src/adapter.ts'],
45
externals: [
56
'#imports',
67
'defu',

css/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import './../src/runtime/components/AdminToolbar/Palette/index.css';
1+
@import './../src/runtime/components/VuepalAdminToolbar/Palette/index.css';
22

33
@tailwind base;
44
@tailwind components;

eslint.config.mjs

Lines changed: 14 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,26 @@
1-
// @ts-check
2-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
1+
import withNuxt from './playground/.nuxt/eslint.config.mjs'
2+
import prettier from 'eslint-plugin-prettier'
3+
import eslintConfigPrettier from 'eslint-config-prettier'
4+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
35

4-
// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
5-
export default createConfigForNuxt({
6-
features: {
7-
// Rules for module authors
8-
tooling: true,
9-
// Rules for formatting
10-
stylistic: false,
6+
export default withNuxt({
7+
plugins: {
8+
prettier,
119
},
12-
dirs: {
13-
src: ['./playground'],
10+
rules: {
11+
...eslintConfigPrettier.rules,
12+
...eslintPluginPrettierRecommended.rules,
1413
},
1514
})
16-
.override('nuxt/vue/rules', {
17-
rules: {
18-
'vue/no-v-html': 0,
19-
'vue/no-v-text-v-html-on-component': 0,
20-
'vue/multi-word-component-names': 0,
21-
'vue/no-empty-component-block': 'error',
22-
'vue/padding-line-between-blocks': 'error',
23-
'vue/no-v-for-template-key': 'error',
24-
'vue/prefer-true-attribute-shorthand': 'error',
25-
'vue/component-api-style': 'error',
26-
'vue/block-lang': [
27-
'error',
28-
{
29-
script: {
30-
lang: 'ts',
31-
},
32-
},
33-
],
34-
'vue/block-order': [
35-
'error',
36-
{
37-
order: [['script', 'template'], 'style'],
38-
},
39-
],
40-
'vue/html-self-closing': [
41-
'error',
42-
{
43-
html: {
44-
void: 'always',
45-
},
46-
},
47-
],
48-
'vue/no-deprecated-slot-attribute': [
49-
'error',
50-
{
51-
ignore: [],
52-
},
53-
],
54-
},
55-
})
5615
.override('nuxt/typescript/rules', {
5716
rules: {
58-
'@typescript-eslint/no-explicit-any': 'warn',
5917
'@typescript-eslint/ban-ts-comment': 'off',
60-
'@typescript-eslint/no-empty-object-type': 'off',
6118
},
6219
})
63-
.override('nuxt/tooling/regexp', {
20+
.override('nuxt/vue/rules', {
6421
rules: {
65-
'regexp/no-super-linear-backtracking': 'off',
66-
'regexp/optimal-quantifier-concatenation': 'off',
67-
'regexp/no-unused-capturing-group': 'off',
22+
'vue/multi-word-component-names': 'off',
23+
'vue/no-v-text-v-html-on-component': 'off',
24+
'vue/no-v-html': 'off',
6825
},
6926
})

0 commit comments

Comments
 (0)