druxt-site 0.14.2 → 0.14.4-dev.20260920043715
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 +74 -32
- package/banner.svg +1 -0
- package/dist/components/DruxtSite.vue +24 -6
- package/dist/druxt-site.esm.js +2 -1
- package/dist/druxt-site.ssr.js +2 -1
- package/icon.svg +5 -0
- package/package.json +15 -13
package/README.md
CHANGED
|
@@ -1,54 +1,96 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="./banner.svg" alt="DruxtSite: a decoupled Drupal site out of the box">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://github.com/druxt/druxt.js/actions/workflows/ci.yml)
|
|
6
|
+
[](https://snyk.io/test/github/druxt/druxt.js?targetFile=package.json)
|
|
7
|
+
[](https://codecov.io/gh/druxt/druxt.js)
|
|
6
8
|
[](https://www.npmjs.com/package/druxt-site)
|
|
7
9
|
|
|
10
|
+
> Out-of-the-box decoupled Drupal sites with DruxtSite, wiring layout, blocks, menus and content together from one Nuxt module.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
DruxtSite is the whole framework in one module. Install it and you get
|
|
13
|
+
routing, entities, blocks, menus, views and breadcrumbs preconfigured: the
|
|
14
|
+
`DruxtSite` component renders your Drupal theme's regions and content using
|
|
15
|
+
Drupal's own display configuration. Start here if you want a decoupled Drupal
|
|
16
|
+
site rather than individual building blocks.
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+

|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
- Documentation: https://druxtjs.org/modules/site
|
|
15
|
-
- Community Discord server: https://discord.druxtjs.org
|
|
20
|
+
## Features
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
- **Router** with path alias and redirect support for Entity and Views pages.
|
|
23
|
+
- **Vuex** based, on-demand JSON:API resource loading.
|
|
24
|
+
- **Entity / Field** render system powered by Drupal display modes.
|
|
25
|
+
- **Block** region and **Content block** component rendering.
|
|
26
|
+
- **Views** and **Views blocks** via the [Drupal JSON:API Views module](https://www.drupal.org/project/jsonapi_views).
|
|
27
|
+
- **Breadcrumb**, **Menus** and more.
|
|
28
|
+
- **File Proxy** enabled by default, and support for API proxying.
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
---
|
|
20
31
|
|
|
21
|
-
##
|
|
32
|
+
## Installation
|
|
22
33
|
|
|
23
|
-
1.
|
|
34
|
+
1. Install the package:
|
|
24
35
|
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
```sh
|
|
37
|
+
npm i druxt-site
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. Add the module to `nuxt.config.js`:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
export default {
|
|
44
|
+
modules: ['druxt-site'],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Options
|
|
49
|
+
|
|
50
|
+
- `druxt.site.layout`
|
|
51
|
+
|
|
52
|
+
Type: `boolean`
|
|
53
|
+
Default: `true`
|
|
54
|
+
|
|
55
|
+
Adds a default layout if no default layout has been provided.
|
|
56
|
+
|
|
57
|
+
- `druxt.site.theme`
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
Type: `string`
|
|
60
|
+
|
|
61
|
+
Sets the default theme to be used by the DruxtSite component. Theme can be overridden by the `theme` property on the component.
|
|
62
|
+
If no value is provided, a fallback value will be determined from the JSON:API.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Vue.js components
|
|
67
|
+
|
|
68
|
+
### DruxtSite
|
|
69
|
+
|
|
70
|
+
Renders all available block regions based on the specified theme.
|
|
37
71
|
|
|
38
72
|
```vue
|
|
39
|
-
<
|
|
40
|
-
<DruxtSite :theme="theme" />
|
|
41
|
-
</template>
|
|
73
|
+
<DruxtSite :theme="theme" />
|
|
42
74
|
```
|
|
43
75
|
|
|
76
|
+
- For more details, refer to the [DruxtSite API documentation](https://druxtjs.org/api/packages/site/components/DruxtSite).
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
44
80
|
## Options
|
|
45
81
|
|
|
46
82
|
### Base Druxt options
|
|
47
83
|
|
|
48
84
|
These options are available to all Druxt modules.
|
|
49
85
|
|
|
50
|
-
| Option
|
|
51
|
-
|
|
|
52
|
-
| `axios`
|
|
53
|
-
| `baseUrl`
|
|
54
|
-
| `endpoint` | `string` | No
|
|
86
|
+
| Option | Type | Required | Default | Description |
|
|
87
|
+
| ---------- | -------- | -------- | ---------- | ---------------------------------------------------------------------------- |
|
|
88
|
+
| `axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). |
|
|
89
|
+
| `baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. |
|
|
90
|
+
| `endpoint` | `string` | No | `/jsonapi` | JSON:API Endpoint of the Drupal installation. |
|
|
91
|
+
|
|
92
|
+
## Links
|
|
93
|
+
|
|
94
|
+
- DruxtJS: https://druxtjs.org
|
|
95
|
+
- Documentation: https://druxtjs.org/modules/site
|
|
96
|
+
- Community Discord server: https://discord.druxtjs.org
|
package/banner.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 320" width="1280" height="320" role="img" aria-label="druxt-site: A decoupled Drupal site out of the box."><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#1f2937"/><stop offset="0.7" stop-color="#2f495e"/><stop offset="1" stop-color="#36566e"/></linearGradient></defs><rect width="1280" height="320" rx="16" fill="url(#g)"/><rect x="250" y="85" width="150" height="150" rx="32" fill="rgba(229,236,241,0.07)"/><g transform="translate(277,112) scale(4)" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5.5 4.5h13a2 2 0 0 1 2 2v11a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2z" stroke="#7cc5f1"/><path d="M3.5 9h17M6.25 6.75h.01M8.75 6.75h.01" stroke="#7cc5f1"/><path d="M12 11.75l-2.6 4.75h5.2L12 11.75z" stroke="#68cb9f"/></g><text x="440" y="150" style="font-family:ui-sans-serif,system-ui,sans-serif" font-size="64" font-weight="700" letter-spacing="-1" fill="#eef2f6">Site</text><text x="614" y="150" style="font-family:ui-monospace,Menlo,Consolas,monospace" font-size="26" fill="#7cc5f1">druxt-site</text><text x="440" y="196" style="font-family:ui-sans-serif,system-ui,sans-serif" font-size="25" fill="rgba(229,236,241,0.75)">A decoupled Drupal site out of the box.</text><g transform="translate(440,236) scale(0.0994)"><path d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z" fill="#3498DB"/><path d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z" fill="#108775"/><path d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z" fill="#E5ECF1"/></g><text x="492" y="260" style="font-family:ui-sans-serif,system-ui,sans-serif" font-size="17" font-weight="600" fill="rgba(229,236,241,0.85)">druxtjs.org</text></svg>
|
|
@@ -11,7 +11,7 @@ import { mapActions } from 'vuex'
|
|
|
11
11
|
* While Drupal provides placement configuration for blocks, it does not provide
|
|
12
12
|
* any information on where each region should be placed.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* Each region is provided as a scoped slot for the Druxt Wrapper component.
|
|
15
15
|
*
|
|
16
16
|
* @example @lang vue
|
|
17
17
|
* <template>
|
|
@@ -33,7 +33,7 @@ import { mapActions } from 'vuex'
|
|
|
33
33
|
* mixins: [DruxtSiteMixin]
|
|
34
34
|
* }
|
|
35
35
|
*
|
|
36
|
-
* @example <caption>DruxtSite
|
|
36
|
+
* @example <caption>DruxtSite default slot (template injection)</caption> @lang vue
|
|
37
37
|
* <DruxtSite>
|
|
38
38
|
* <template #default="{ props, regions, theme }">
|
|
39
39
|
* <!-- Do whatever you want here -->
|
|
@@ -60,6 +60,9 @@ export default {
|
|
|
60
60
|
* Used to filter the available regions from the Drupal Blocks JSON:API
|
|
61
61
|
* resources.
|
|
62
62
|
*
|
|
63
|
+
* If not set, the theme from the `druxt.site.theme` module option is
|
|
64
|
+
* used, falling back to the first available theme.
|
|
65
|
+
*
|
|
63
66
|
* @type {string}
|
|
64
67
|
*/
|
|
65
68
|
theme: {
|
|
@@ -77,6 +80,10 @@ export default {
|
|
|
77
80
|
/**
|
|
78
81
|
* DruxtBlockRegion propsData for regions.
|
|
79
82
|
*
|
|
83
|
+
* @param {object} vm - The component ViewModel.
|
|
84
|
+
* @param {string|undefined} vm.defaultTheme - The default Drupal theme machine name.
|
|
85
|
+
* @param {string[]} vm.regions - An array of unique region names.
|
|
86
|
+
* @param {string|undefined} vm.theme - Drupal theme ID.
|
|
80
87
|
* @return {object}
|
|
81
88
|
*/
|
|
82
89
|
props: ({ defaultTheme, regions, theme }) =>
|
|
@@ -88,6 +95,10 @@ export default {
|
|
|
88
95
|
|
|
89
96
|
/**
|
|
90
97
|
* An array of unique region names.
|
|
98
|
+
*
|
|
99
|
+
* @param {object} vm - The component ViewModel.
|
|
100
|
+
* @param {string[]} vm.model - The region names model value.
|
|
101
|
+
* @param {string[]} vm.value - The module component model value.
|
|
91
102
|
* @return {string[]}
|
|
92
103
|
*/
|
|
93
104
|
regions: ({ model, value }) => model || value || [],
|
|
@@ -111,6 +122,8 @@ export default {
|
|
|
111
122
|
* Provides the available component naming options for the Druxt Wrapper.
|
|
112
123
|
*
|
|
113
124
|
* @param {object} context - The module component ViewModel.
|
|
125
|
+
* @param {string|undefined} context.defaultTheme - The default Drupal theme machine name.
|
|
126
|
+
* @param {string|undefined} context.theme - Drupal theme ID.
|
|
114
127
|
* @returns {ComponentOptions}
|
|
115
128
|
*/
|
|
116
129
|
componentOptions: ({ defaultTheme, theme }) => [[theme || defaultTheme], ['default']],
|
|
@@ -148,6 +161,10 @@ export default {
|
|
|
148
161
|
* Provides propsData for the DruxtWrapper.
|
|
149
162
|
*
|
|
150
163
|
* @param {object} context - The module component ViewModel.
|
|
164
|
+
* @param {string|undefined} context.defaultTheme - The default Drupal theme machine name.
|
|
165
|
+
* @param {object} context.props - DruxtBlockRegion propsData for regions.
|
|
166
|
+
* @param {string[]} context.regions - An array of unique region names.
|
|
167
|
+
* @param {string|undefined} context.theme - Drupal theme ID.
|
|
151
168
|
* @returns {PropsData}
|
|
152
169
|
*/
|
|
153
170
|
propsData: ({ defaultTheme, props, regions, theme }) => ({ props, regions, theme: theme || defaultTheme }),
|
|
@@ -158,7 +175,7 @@ export default {
|
|
|
158
175
|
* A scoped slot is provided for each block region available, as per the
|
|
159
176
|
* specified theme.
|
|
160
177
|
*
|
|
161
|
-
*
|
|
178
|
+
* The `default` slot will also render all regions, or the Nuxt
|
|
162
179
|
* component when no block region data is available.
|
|
163
180
|
*
|
|
164
181
|
* @example <caption>DruxtSite**Theme**.vue</caption> @lang vue
|
|
@@ -170,6 +187,7 @@ export default {
|
|
|
170
187
|
* </template>
|
|
171
188
|
*
|
|
172
189
|
* @return {ScopedSlots} The Scoped slots object.
|
|
190
|
+
* @param {Function} h - The Vue createElement function.
|
|
173
191
|
*/
|
|
174
192
|
slots(h) {
|
|
175
193
|
// If no regions, return Nuxt component.
|
|
@@ -203,7 +221,7 @@ export default {
|
|
|
203
221
|
}
|
|
204
222
|
|
|
205
223
|
/**
|
|
206
|
-
* Provides the available naming options for the
|
|
224
|
+
* Provides the available naming options for the wrapper component.
|
|
207
225
|
*
|
|
208
226
|
* @typedef {array[]} ComponentOptions
|
|
209
227
|
*
|
|
@@ -225,7 +243,7 @@ export default {
|
|
|
225
243
|
*/
|
|
226
244
|
|
|
227
245
|
/**
|
|
228
|
-
* Provides propsData for use in the
|
|
246
|
+
* Provides propsData for use in the wrapper component.
|
|
229
247
|
*
|
|
230
248
|
* @typedef {object} PropsData
|
|
231
249
|
* @param {object} props - DruxtBlockRegion propsData for regions.
|
|
@@ -247,7 +265,7 @@ export default {
|
|
|
247
265
|
*/
|
|
248
266
|
|
|
249
267
|
/**
|
|
250
|
-
* Provides scoped slots for use in the
|
|
268
|
+
* Provides scoped slots for use in the wrapper component.
|
|
251
269
|
*
|
|
252
270
|
* @typedef {object} ScopedSlots
|
|
253
271
|
* @param {function} * - Slot per region.
|
package/dist/druxt-site.esm.js
CHANGED
|
@@ -30,6 +30,7 @@ async function DruxtSiteStorybook({ options, stories }) {
|
|
|
30
30
|
stories.push(resolve(this.options.buildDir, "./stories/druxt-site.*.stories.js"));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
const extendComponent = (component) => ({ ...component, isAsync: false });
|
|
33
34
|
const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
34
35
|
const options = {
|
|
35
36
|
baseUrl: moduleOptions.baseUrl,
|
|
@@ -47,7 +48,7 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
|
47
48
|
};
|
|
48
49
|
this.options.druxt = options;
|
|
49
50
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
50
|
-
dirs.push({ path: join(__dirname, "components") });
|
|
51
|
+
dirs.push({ path: join(__dirname, "components"), extendComponent });
|
|
51
52
|
});
|
|
52
53
|
const druxtModules = [
|
|
53
54
|
"druxt",
|
package/dist/druxt-site.ssr.js
CHANGED
|
@@ -34,6 +34,7 @@ async function DruxtSiteStorybook({ options, stories }) {
|
|
|
34
34
|
stories.push(path.resolve(this.options.buildDir, "./stories/druxt-site.*.stories.js"));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const extendComponent = (component) => ({ ...component, isAsync: false });
|
|
37
38
|
const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
38
39
|
const options = {
|
|
39
40
|
baseUrl: moduleOptions.baseUrl,
|
|
@@ -51,7 +52,7 @@ const DruxtSiteNuxtModule = async function(moduleOptions = {}) {
|
|
|
51
52
|
};
|
|
52
53
|
this.options.druxt = options;
|
|
53
54
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
54
|
-
dirs.push({ path: path.join(__dirname, "components") });
|
|
55
|
+
dirs.push({ path: path.join(__dirname, "components"), extendComponent });
|
|
55
56
|
});
|
|
56
57
|
const druxtModules = [
|
|
57
58
|
"druxt",
|
package/icon.svg
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<rect stroke="#036397" x="3.5" y="4.5" width="17" height="15" rx="2" />
|
|
3
|
+
<path stroke="#036397" d="M3.5 9h17M6.25 6.75h.01M8.75 6.75h.01" />
|
|
4
|
+
<path stroke="#3b8070" d="M12 11.75l-2.6 4.75h5.2L12 11.75z" />
|
|
5
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-site",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4-dev.20260920043715",
|
|
4
4
|
"description": "Out of the box Decoupled Drupal sites with Druxt.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"url": "git+https://github.com/druxt/druxt.js"
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
|
+
"author": "Stuart Clark <stuart@druxtjs.org>",
|
|
30
31
|
"exports": {
|
|
31
32
|
".": {
|
|
32
33
|
"require": "./dist/druxt-site.ssr.js",
|
|
@@ -39,22 +40,23 @@
|
|
|
39
40
|
"module": "dist/druxt-site.esm.js",
|
|
40
41
|
"files": [
|
|
41
42
|
"dist",
|
|
42
|
-
"templates"
|
|
43
|
+
"templates",
|
|
44
|
+
"icon.svg",
|
|
45
|
+
"banner.svg"
|
|
43
46
|
],
|
|
44
47
|
"dependencies": {
|
|
45
|
-
"drupal-jsonapi-params": "^2.2
|
|
46
|
-
"druxt": "
|
|
47
|
-
"druxt-blocks": "
|
|
48
|
-
"druxt-breadcrumb": "
|
|
49
|
-
"druxt-entity": "
|
|
50
|
-
"druxt-menu": "
|
|
51
|
-
"druxt-router": "
|
|
52
|
-
"druxt-schema": "
|
|
53
|
-
"druxt-views": "
|
|
54
|
-
"md5": "^2.3.0"
|
|
48
|
+
"drupal-jsonapi-params": "^2.3.2",
|
|
49
|
+
"druxt": "0.24.1-dev.20260920043715",
|
|
50
|
+
"druxt-blocks": "0.17.4-dev.20260920043715",
|
|
51
|
+
"druxt-breadcrumb": "0.17.3-dev.20260920043715",
|
|
52
|
+
"druxt-entity": "0.29.0-dev.20260920043715",
|
|
53
|
+
"druxt-menu": "0.21.1-dev.20260920043715",
|
|
54
|
+
"druxt-router": "0.31.1-dev.20260920043715",
|
|
55
|
+
"druxt-schema": "0.11.4-dev.20260920043715",
|
|
56
|
+
"druxt-views": "0.22.3-dev.20260920043715"
|
|
55
57
|
},
|
|
56
58
|
"optionalDependencies": {
|
|
57
|
-
"vue": "^2.7.
|
|
59
|
+
"vue": "^2.7.16",
|
|
58
60
|
"vuex": "^3.6.2"
|
|
59
61
|
},
|
|
60
62
|
"publishConfig": {
|