druxt-blocks 0.17.3 → 0.17.4-dev.20260920063819
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 +81 -53
- package/banner.svg +1 -0
- package/dist/components/DruxtBlock.vue +28 -12
- package/dist/components/DruxtBlockRegion.vue +31 -16
- package/dist/components/blocks/DruxtBlockBlockContent.vue +2 -2
- package/dist/components/blocks/DruxtBlockPageTitleBlock.vue +2 -2
- package/dist/components/blocks/DruxtBlockSystemMainBlock.vue +1 -1
- package/dist/druxt-blocks.esm.js +3 -2
- package/dist/druxt-blocks.ssr.js +3 -2
- package/icon.svg +5 -0
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,47 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="./banner.svg" alt="DruxtBlocks renders Drupal blocks and block regions in Nuxt">
|
|
2
|
+
|
|
3
|
+
# DruxtBlocks
|
|
2
4
|
|
|
3
5
|
[](https://www.npmjs.com/package/druxt-blocks)
|
|
4
|
-
[](https://github.com/druxt/druxt.js/actions/workflows/ci.yml)
|
|
7
|
+
[](https://snyk.io/test/github/druxt/druxt.js?targetFile=package.json)
|
|
8
|
+
[](https://codecov.io/gh/druxt/druxt.js)
|
|
7
9
|
|
|
8
|
-
> Drupal
|
|
10
|
+
> Render Drupal blocks and block regions in Nuxt with the druxt-blocks components, themed through the Druxt component suggestion system.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
DruxtBlocks brings Drupal's block layout to Nuxt. `DruxtBlockRegion` renders
|
|
13
|
+
every visible block Drupal places in a theme region, and `DruxtBlock` renders
|
|
14
|
+
one block anywhere in your layout. Both resolve through the Druxt
|
|
15
|
+
component suggestion system, so overriding one block's markup takes one Vue
|
|
16
|
+
component.
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
- Documentation: https://druxtjs.org/modules/blocks
|
|
14
|
-
- Community Discord server: https://discord.druxtjs.org
|
|
18
|
+

|
|
15
19
|
|
|
20
|
+
## Features
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
- Vue.js components:
|
|
23
|
+
- **DruxtBlock** renders Drupal blocks by UUID or internal ID
|
|
24
|
+
- **DruxtBlockRegion** renders all blocks within a region
|
|
25
|
+
- **Druxt settings** filter JSON:API fields
|
|
26
|
+
- **@nuxtjs/Storybook** integration
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
---
|
|
20
29
|
|
|
30
|
+
## Installation
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
> Included with [`druxt-site`](https://druxtjs.org/modules/site). Install it separately only when composing modules yourself.
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
1. Install the package:
|
|
25
35
|
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
```
|
|
36
|
+
```sh
|
|
37
|
+
npm i druxt-blocks
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. Add the module to `nuxt.config.js`:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
export default {
|
|
44
|
+
modules: ['druxt-blocks'],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
---
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
## Vue.js components
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
### DruxtBlock
|
|
53
|
+
|
|
54
|
+
Renders a Drupal Block by UUID or Drupal's internal ID.
|
|
45
55
|
|
|
46
56
|
```vue
|
|
47
57
|
<DruxtBlock :id="drupal_internal__id" />
|
|
@@ -51,38 +61,51 @@ The DruxtBlock component renders a Drupal JSON:API Block resource by ID or UUID.
|
|
|
51
61
|
<DruxtBlock :uuid="uuid" />
|
|
52
62
|
```
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
- For more details, refer to the [DruxtBlock API documentation](https://druxtjs.org/api/packages/blocks/components/DruxtBlock).
|
|
56
65
|
|
|
57
66
|
### DruxtBlockRegion
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
Renders all visible blocks by theme and region name.
|
|
60
69
|
|
|
61
70
|
```vue
|
|
62
71
|
<DruxtBlockRegion :name="name" :theme="theme" />
|
|
63
72
|
```
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
- For more details, refer to the [DruxtBlockRegion API documentation](https://druxtjs.org/api/packages/blocks/components/DruxtBlockRegion).
|
|
66
75
|
|
|
67
|
-
|
|
76
|
+
---
|
|
68
77
|
|
|
78
|
+
## Settings
|
|
69
79
|
|
|
70
|
-
###
|
|
80
|
+
### Reducing Block data
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
The default behaviour of the Block module is to retrieve all available fields from the JSON:API.
|
|
73
83
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
This behaviour is configurable using the modules `query` option, allowing for manually filtered `fields`.
|
|
85
|
+
|
|
86
|
+
The default behaviour can be set via `nuxt.config.js`:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
druxt: {
|
|
90
|
+
blocks: {
|
|
91
|
+
query: {
|
|
92
|
+
fields: ['dependencies'],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}
|
|
80
96
|
```
|
|
81
97
|
|
|
82
|
-
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Storybook
|
|
101
|
+
|
|
102
|
+
DruxtBlocks provides zero-config, auto-generated Storybook integration with a live data connection to your Druxt backend.
|
|
83
103
|
|
|
84
|
-
|
|
104
|
+

|
|
85
105
|
|
|
106
|
+
- For more details, see the [Storybook guide](https://druxtjs.org/how-to/storybook).
|
|
107
|
+
|
|
108
|
+
---
|
|
86
109
|
|
|
87
110
|
## Options
|
|
88
111
|
|
|
@@ -90,17 +113,22 @@ See the [Druxt Theming guide](https://druxtjs.org/guide/theming) for more inform
|
|
|
90
113
|
|
|
91
114
|
These options are specific to this module.
|
|
92
115
|
|
|
93
|
-
| Option
|
|
94
|
-
|
|
|
95
|
-
| `
|
|
96
|
-
|
|
116
|
+
| Option | Type | Required | Default | Description |
|
|
117
|
+
| --------------------- | ---------- | -------- | ------- | -------------------------------------------------------- |
|
|
118
|
+
| `blocks.query.fields` | `string[]` | No | `[]` | An array of fields to filter all Block JSON:API queries. |
|
|
97
119
|
|
|
98
120
|
### Base Druxt options
|
|
99
121
|
|
|
100
122
|
These options are available to all Druxt modules.
|
|
101
123
|
|
|
102
|
-
| Option
|
|
103
|
-
|
|
|
104
|
-
| `axios`
|
|
105
|
-
| `baseUrl`
|
|
106
|
-
| `endpoint` | `string` | No
|
|
124
|
+
| Option | Type | Required | Default | Description |
|
|
125
|
+
| ---------- | -------- | -------- | ---------- | ---------------------------------------------------------------------------- |
|
|
126
|
+
| `axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). |
|
|
127
|
+
| `baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. |
|
|
128
|
+
| `endpoint` | `string` | No | `/jsonapi` | JSON:API Endpoint of the Drupal installation. |
|
|
129
|
+
|
|
130
|
+
## Links
|
|
131
|
+
|
|
132
|
+
- DruxtJS: https://druxtjs.org
|
|
133
|
+
- Documentation: https://druxtjs.org/modules/blocks
|
|
134
|
+
- 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-blocks: Drupal blocks and block regions in Nuxt."><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 9.5h17" stroke="#7cc5f1"/><path d="M10.5 9.5v10" 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">Blocks</text><text x="688" y="150" style="font-family:ui-monospace,Menlo,Consolas,monospace" font-size="26" fill="#7cc5f1">druxt-blocks</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)">Drupal blocks and block regions in Nuxt.</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>
|
|
@@ -5,13 +5,15 @@ import DruxtModule from 'druxt/dist/components/DruxtModule.vue'
|
|
|
5
5
|
import { mapActions } from 'vuex'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The DruxtBlock component
|
|
9
|
-
*
|
|
8
|
+
* The DruxtBlock component renders a Drupal Block by UUID or by its block
|
|
9
|
+
* placement machine name.
|
|
10
10
|
*
|
|
11
11
|
* While the DruxtBlock component can't automatically render every Drupal block,
|
|
12
|
-
* it does provide the Block settings to a
|
|
12
|
+
* it does provide the Block settings to a targeted Druxt wrapper component for
|
|
13
13
|
* manual theming.
|
|
14
14
|
*
|
|
15
|
+
* @see https://druxtjs.org/modules/blocks
|
|
16
|
+
*
|
|
15
17
|
* @example <caption>Render a block using **id**</caption> @lang vue
|
|
16
18
|
* <DruxtBlock id="umami_branding" />
|
|
17
19
|
*
|
|
@@ -29,7 +31,9 @@ import { mapActions } from 'vuex'
|
|
|
29
31
|
* mixins: [DruxtBlocksBlockMixin]
|
|
30
32
|
* }
|
|
31
33
|
*
|
|
32
|
-
* @
|
|
34
|
+
* @see {@link https://druxtjs.org/explanation/component-resolution|Component resolution}
|
|
35
|
+
*
|
|
36
|
+
* @example <caption>DruxtBlock default slot (template injection)</caption> @lang vue
|
|
33
37
|
* <DruxtBlock id="umami_branding">
|
|
34
38
|
* <template #default="{ block }">
|
|
35
39
|
* <!-- Do whatever you want here -->
|
|
@@ -43,13 +47,15 @@ export default {
|
|
|
43
47
|
extends: DruxtModule,
|
|
44
48
|
|
|
45
49
|
/**
|
|
46
|
-
* The DruxtBlock component requires either the
|
|
50
|
+
* The DruxtBlock component requires either the `uuid` or `id` property.
|
|
47
51
|
*/
|
|
48
52
|
props: {
|
|
49
53
|
/**
|
|
50
|
-
* The
|
|
54
|
+
* The block placement machine name, as configured on Drupal's Block layout
|
|
55
|
+
* page (/admin/structure/block).
|
|
51
56
|
*
|
|
52
|
-
* @type string
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @default null
|
|
53
59
|
*
|
|
54
60
|
* @example @lang vue
|
|
55
61
|
* <DruxtBlock id="umami_branding" />
|
|
@@ -65,6 +71,7 @@ export default {
|
|
|
65
71
|
* If used, the **id** prop will be ignored.
|
|
66
72
|
*
|
|
67
73
|
* @type {string}
|
|
74
|
+
* @default null
|
|
68
75
|
*
|
|
69
76
|
* @example @lang vue
|
|
70
77
|
* <DruxtBlock uuid="59104acd-88e1-43c3-bd5f-35800f206394" />
|
|
@@ -76,6 +83,8 @@ export default {
|
|
|
76
83
|
},
|
|
77
84
|
|
|
78
85
|
/**
|
|
86
|
+
* Provides the fetched Block resource state.
|
|
87
|
+
*
|
|
79
88
|
* @property {object} resource - The JSON:API resource object.
|
|
80
89
|
*/
|
|
81
90
|
data: () => ({
|
|
@@ -92,7 +101,9 @@ export default {
|
|
|
92
101
|
/**
|
|
93
102
|
* The Block entity data.
|
|
94
103
|
*
|
|
95
|
-
* @
|
|
104
|
+
* @param {object} vm - The component ViewModel.
|
|
105
|
+
* @param {object} vm.resource - The Block JSON:API resource.
|
|
106
|
+
* @return {object} The Block entity JSON:API resource data.
|
|
96
107
|
*/
|
|
97
108
|
block: ({ resource }) => (resource || {}).data,
|
|
98
109
|
},
|
|
@@ -125,6 +136,7 @@ export default {
|
|
|
125
136
|
* Provides the available component naming options for the DruxtWrapper.
|
|
126
137
|
*
|
|
127
138
|
* @param {object} context - The module component ViewModel.
|
|
139
|
+
* @param {object} context.block - The Block entity data.
|
|
128
140
|
* @returns {ComponentOptions}
|
|
129
141
|
*/
|
|
130
142
|
componentOptions: ({ block }) => {
|
|
@@ -179,7 +191,7 @@ export default {
|
|
|
179
191
|
})
|
|
180
192
|
}
|
|
181
193
|
|
|
182
|
-
// Fetch Block by
|
|
194
|
+
// Fetch Block by placement machine name (drupal_internal__id).
|
|
183
195
|
else if (this.id) {
|
|
184
196
|
query.addFilter('drupal_internal__id', this.id)
|
|
185
197
|
const collection = await this.getCollection({
|
|
@@ -195,6 +207,7 @@ export default {
|
|
|
195
207
|
* Provides propsData for the DruxtWrapper.
|
|
196
208
|
*
|
|
197
209
|
* @param {object} context - The module component ViewModel.
|
|
210
|
+
* @param {object} context.block - The Block entity data.
|
|
198
211
|
* @returns {PropsData}
|
|
199
212
|
*/
|
|
200
213
|
propsData: ({ block }) => ({ block }),
|
|
@@ -205,6 +218,7 @@ export default {
|
|
|
205
218
|
* A default slot is provided with debug information if Nuxt is in
|
|
206
219
|
* development mode.
|
|
207
220
|
*
|
|
221
|
+
* @param {Function} h - The Vue createElement function.
|
|
208
222
|
* @return {ScopedSlots} The Scoped slots object.
|
|
209
223
|
*/
|
|
210
224
|
slots(h) {
|
|
@@ -253,10 +267,12 @@ export default {
|
|
|
253
267
|
}
|
|
254
268
|
|
|
255
269
|
/**
|
|
256
|
-
* Provides the available naming options for the
|
|
270
|
+
* Provides the available naming options for the wrapper component.
|
|
257
271
|
*
|
|
258
272
|
* @typedef {array[]} ComponentOptions
|
|
259
273
|
*
|
|
274
|
+
* @see {@link https://druxtjs.org/explanation/component-resolution|Component resolution}
|
|
275
|
+
*
|
|
260
276
|
* @example @lang js
|
|
261
277
|
* [
|
|
262
278
|
* 'DruxtBlock[Plugin][PluginId][Region][Theme][Langcode]',
|
|
@@ -311,7 +327,7 @@ export default {
|
|
|
311
327
|
*/
|
|
312
328
|
|
|
313
329
|
/**
|
|
314
|
-
* Provides propsData for use in the
|
|
330
|
+
* Provides propsData for use in the wrapper component.
|
|
315
331
|
*
|
|
316
332
|
* @typedef {object} PropsData
|
|
317
333
|
* @param {object} block - The Block Entity data.
|
|
@@ -329,7 +345,7 @@ export default {
|
|
|
329
345
|
*/
|
|
330
346
|
|
|
331
347
|
/**
|
|
332
|
-
* Provides scoped slots for use in the
|
|
348
|
+
* Provides scoped slots for use in the wrapper component.
|
|
333
349
|
*
|
|
334
350
|
* @typedef {object} ScopedSlots
|
|
335
351
|
* @param {function} default - Debug information if Nuxt is in development mode.
|
|
@@ -11,6 +11,8 @@ import { mapActions, mapState } from 'vuex'
|
|
|
11
11
|
* All blocks, including those not visible, are provided as slots for the Druxt
|
|
12
12
|
* Wrapper component.
|
|
13
13
|
*
|
|
14
|
+
* @see https://druxtjs.org/modules/blocks
|
|
15
|
+
*
|
|
14
16
|
* @example @lang vue
|
|
15
17
|
* <DruxtBlockRegion name="header" theme="umami" />
|
|
16
18
|
*
|
|
@@ -25,13 +27,15 @@ import { mapActions, mapState } from 'vuex'
|
|
|
25
27
|
* mixins: [DruxtBlocksRegionMixin]
|
|
26
28
|
* }
|
|
27
29
|
*
|
|
28
|
-
* @
|
|
29
|
-
*
|
|
30
|
-
*
|
|
30
|
+
* @see {@link https://druxtjs.org/explanation/component-resolution|Component resolution}
|
|
31
|
+
*
|
|
32
|
+
* @example <caption>DruxtBlockRegion default slot (template injection)</caption> @lang vue
|
|
33
|
+
* <DruxtBlockRegion name="header" theme="umami">
|
|
34
|
+
* <template #default="{ blocks }">
|
|
31
35
|
* <!-- Do whatever you want here -->
|
|
32
|
-
* <DruxtDebug :json="
|
|
36
|
+
* <DruxtDebug :json="blocks" />
|
|
33
37
|
* </template>
|
|
34
|
-
* </
|
|
38
|
+
* </DruxtBlockRegion>
|
|
35
39
|
*/
|
|
36
40
|
export default {
|
|
37
41
|
name: 'DruxtBlockRegion',
|
|
@@ -41,7 +45,8 @@ export default {
|
|
|
41
45
|
/** */
|
|
42
46
|
props: {
|
|
43
47
|
/**
|
|
44
|
-
*
|
|
48
|
+
* A region machine name from the Drupal theme's block layout
|
|
49
|
+
* (/admin/structure/block).
|
|
45
50
|
*
|
|
46
51
|
* @type {string}
|
|
47
52
|
* @default content
|
|
@@ -55,7 +60,7 @@ export default {
|
|
|
55
60
|
},
|
|
56
61
|
|
|
57
62
|
/**
|
|
58
|
-
*
|
|
63
|
+
* The machine name of the Drupal theme that provides the block layout.
|
|
59
64
|
*
|
|
60
65
|
* @type {string}
|
|
61
66
|
* @required
|
|
@@ -70,7 +75,9 @@ export default {
|
|
|
70
75
|
},
|
|
71
76
|
|
|
72
77
|
/**
|
|
73
|
-
*
|
|
78
|
+
* Provides the fetched Block resources for the region.
|
|
79
|
+
*
|
|
80
|
+
* @property {object[]} blocks - The Block JSON:API resources.
|
|
74
81
|
*/
|
|
75
82
|
data: () => ({
|
|
76
83
|
blocks: []
|
|
@@ -82,7 +89,7 @@ export default {
|
|
|
82
89
|
},
|
|
83
90
|
|
|
84
91
|
/**
|
|
85
|
-
* @vue-computed {object} route The current Route from the [DruxtRouter vuex store](https://
|
|
92
|
+
* @vue-computed {object} route The current Route from the [DruxtRouter vuex store](https://druxtjs.org/api/packages/router/stores/router).
|
|
86
93
|
*/
|
|
87
94
|
computed: {
|
|
88
95
|
...mapState('druxtRouter', {
|
|
@@ -102,13 +109,13 @@ export default {
|
|
|
102
109
|
|
|
103
110
|
methods: {
|
|
104
111
|
/**
|
|
105
|
-
* Checks if a given block
|
|
112
|
+
* Checks if a given block should be visible.
|
|
106
113
|
*
|
|
107
114
|
* Uses Request Path visibility details if available with the DruxtRouter.
|
|
108
115
|
*
|
|
109
116
|
* @param {object} block - The Block entity object.
|
|
110
117
|
*
|
|
111
|
-
* @return {boolean}
|
|
118
|
+
* @return {boolean} `true` if the block should be rendered on the current route.
|
|
112
119
|
*/
|
|
113
120
|
isVisible(block) {
|
|
114
121
|
// Request path visibility conditions.
|
|
@@ -151,6 +158,8 @@ export default {
|
|
|
151
158
|
* Provides the available component naming options for the DruxtWrapper.
|
|
152
159
|
*
|
|
153
160
|
* @param {object} context - The module component ViewModel.
|
|
161
|
+
* @param {string} context.name - The region machine name.
|
|
162
|
+
* @param {string} context.theme - The Drupal theme machine name.
|
|
154
163
|
* @returns {ComponentOptions}
|
|
155
164
|
*/
|
|
156
165
|
componentOptions: ({ name, theme }) => [[name, theme], ['default']],
|
|
@@ -180,6 +189,9 @@ export default {
|
|
|
180
189
|
* Provides propsData for the DruxtWrapper.
|
|
181
190
|
*
|
|
182
191
|
* @param {object} context - The module component ViewModel.
|
|
192
|
+
* @param {object[]} context.blocks - The Block JSON:API resources for the region.
|
|
193
|
+
* @param {string} context.name - The region machine name.
|
|
194
|
+
* @param {string} context.theme - The Drupal theme machine name.
|
|
183
195
|
* @returns {PropsData}
|
|
184
196
|
*/
|
|
185
197
|
propsData: ({ blocks, name, theme }) => ({ blocks, name, theme }),
|
|
@@ -204,6 +216,7 @@ export default {
|
|
|
204
216
|
* <slot name="umami_branding" />
|
|
205
217
|
* </div>
|
|
206
218
|
* </template>
|
|
219
|
+
* @param {Function} h - The Vue createElement function.
|
|
207
220
|
*/
|
|
208
221
|
slots(h) {
|
|
209
222
|
// Build scoped slots for each block.
|
|
@@ -246,10 +259,12 @@ export default {
|
|
|
246
259
|
}
|
|
247
260
|
|
|
248
261
|
/**
|
|
249
|
-
* Provides the available naming options for the
|
|
262
|
+
* Provides the available naming options for the wrapper component.
|
|
250
263
|
*
|
|
251
264
|
* @typedef {array[]} ComponentOptions
|
|
252
265
|
*
|
|
266
|
+
* @see {@link https://druxtjs.org/explanation/component-resolution|Component resolution}
|
|
267
|
+
*
|
|
253
268
|
* @example @lang js
|
|
254
269
|
* [
|
|
255
270
|
* 'DruxtBlockRegion[Name][Theme][Langcode]',
|
|
@@ -272,12 +287,12 @@ export default {
|
|
|
272
287
|
*/
|
|
273
288
|
|
|
274
289
|
/**
|
|
275
|
-
* Provides propsData for use in the
|
|
290
|
+
* Provides propsData for use in the wrapper component.
|
|
276
291
|
*
|
|
277
292
|
* @typedef {object} PropsData
|
|
278
293
|
* @param {object[]} blocks - The Block JSON:API resources.
|
|
279
|
-
* @param {string} name - The
|
|
280
|
-
* @param {string} theme -
|
|
294
|
+
* @param {string} name - The region machine name.
|
|
295
|
+
* @param {string} theme - The Drupal theme machine name.
|
|
281
296
|
*
|
|
282
297
|
* @example @lang js
|
|
283
298
|
* {
|
|
@@ -294,7 +309,7 @@ export default {
|
|
|
294
309
|
*/
|
|
295
310
|
|
|
296
311
|
/**
|
|
297
|
-
* Provides scoped slots for use in the
|
|
312
|
+
* Provides scoped slots for use in the wrapper component.
|
|
298
313
|
*
|
|
299
314
|
* @typedef {object} ScopedSlots
|
|
300
315
|
* @param {function} [drupal_internal__id] - Slot per block.
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
/**
|
|
33
33
|
* Vue.js Mixins.
|
|
34
34
|
*
|
|
35
|
-
* @see {@link
|
|
35
|
+
* @see {@link /api/packages/blocks/mixins/block|DruxtBlocksBlockMixin}
|
|
36
36
|
*/
|
|
37
37
|
mixins: [DruxtBlocksBlockMixin],
|
|
38
38
|
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
*
|
|
55
55
|
* @type {object}
|
|
56
56
|
*
|
|
57
|
-
* @see {@link
|
|
57
|
+
* @see {@link /api/packages/entity/components/DruxtEntity|DruxtEntity}
|
|
58
58
|
*/
|
|
59
59
|
propsData: ({ $fetchState, $store, block, langcode }) => {
|
|
60
60
|
if ($fetchState.pending) return false
|
|
@@ -21,7 +21,7 @@ import { DruxtBlocksBlockMixin } from 'druxt-blocks'
|
|
|
21
21
|
* />
|
|
22
22
|
*
|
|
23
23
|
* @see {@link ../DruxtBlock|DruxtBlock}
|
|
24
|
-
* @see {@link https://
|
|
24
|
+
* @see {@link https://druxtjs.org/modules/router|DruxtJS Router}
|
|
25
25
|
*/
|
|
26
26
|
export default {
|
|
27
27
|
name: 'DruxtBlockPageTitleBlock',
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
/**
|
|
30
30
|
* Vue.js Mixins.
|
|
31
31
|
*
|
|
32
|
-
* @see {@link
|
|
32
|
+
* @see {@link /api/packages/blocks/mixins/block|DruxtBlocksBlockMixin}
|
|
33
33
|
*/
|
|
34
34
|
mixins: [DruxtBlocksBlockMixin],
|
|
35
35
|
|
package/dist/druxt-blocks.esm.js
CHANGED
|
@@ -52,6 +52,7 @@ async function DruxtBlocksStorybook({ stories }) {
|
|
|
52
52
|
stories.push(resolve(options.buildDir, `./stories/druxt-block-region.*.stories.js`));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
const extendComponent = (component) => ({ ...component, isAsync: false });
|
|
55
56
|
const DruxtBlocksNuxtModule = async function(moduleOptions = {}) {
|
|
56
57
|
const options = {
|
|
57
58
|
baseUrl: moduleOptions.baseUrl,
|
|
@@ -64,8 +65,8 @@ const DruxtBlocksNuxtModule = async function(moduleOptions = {}) {
|
|
|
64
65
|
};
|
|
65
66
|
await this.addModule(["druxt", options]);
|
|
66
67
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
67
|
-
dirs.push({ path: join(__dirname, "components") });
|
|
68
|
-
dirs.push({ path: join(__dirname, "components/blocks") });
|
|
68
|
+
dirs.push({ path: join(__dirname, "components"), extendComponent });
|
|
69
|
+
dirs.push({ path: join(__dirname, "components/blocks"), extendComponent });
|
|
69
70
|
});
|
|
70
71
|
this.nuxt.hook("storybook:config", async ({ stories }) => {
|
|
71
72
|
await DruxtBlocksStorybook.call(this, { stories });
|
package/dist/druxt-blocks.ssr.js
CHANGED
|
@@ -56,6 +56,7 @@ async function DruxtBlocksStorybook({ stories }) {
|
|
|
56
56
|
stories.push(path.resolve(options.buildDir, `./stories/druxt-block-region.*.stories.js`));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const extendComponent = (component) => ({ ...component, isAsync: false });
|
|
59
60
|
const DruxtBlocksNuxtModule = async function(moduleOptions = {}) {
|
|
60
61
|
const options = {
|
|
61
62
|
baseUrl: moduleOptions.baseUrl,
|
|
@@ -68,8 +69,8 @@ const DruxtBlocksNuxtModule = async function(moduleOptions = {}) {
|
|
|
68
69
|
};
|
|
69
70
|
await this.addModule(["druxt", options]);
|
|
70
71
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
71
|
-
dirs.push({ path: path.join(__dirname, "components") });
|
|
72
|
-
dirs.push({ path: path.join(__dirname, "components/blocks") });
|
|
72
|
+
dirs.push({ path: path.join(__dirname, "components"), extendComponent });
|
|
73
|
+
dirs.push({ path: path.join(__dirname, "components/blocks"), extendComponent });
|
|
73
74
|
});
|
|
74
75
|
this.nuxt.hook("storybook:config", async ({ stories }) => {
|
|
75
76
|
await DruxtBlocksStorybook.call(this, { stories });
|
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 9.5h17" />
|
|
4
|
+
<path stroke="#3b8070" d="M10.5 9.5v10" />
|
|
5
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-blocks",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4-dev.20260920063819",
|
|
4
4
|
"description": "Drupal Block and Block Region Druxt components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"block",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"url": "git+https://github.com/druxt/druxt.js"
|
|
29
29
|
},
|
|
30
30
|
"license": "MIT",
|
|
31
|
+
"author": "Stuart Clark <stuart@druxtjs.org>",
|
|
31
32
|
"exports": {
|
|
32
33
|
".": {
|
|
33
34
|
"require": "./dist/druxt-blocks.ssr.js",
|
|
@@ -39,17 +40,17 @@
|
|
|
39
40
|
"module": "dist/druxt-blocks.esm.js",
|
|
40
41
|
"files": [
|
|
41
42
|
"dist",
|
|
42
|
-
"templates"
|
|
43
|
+
"templates",
|
|
44
|
+
"icon.svg",
|
|
45
|
+
"banner.svg"
|
|
43
46
|
],
|
|
44
47
|
"dependencies": {
|
|
45
|
-
"axios": "0.
|
|
46
|
-
"drupal-jsonapi-params": "^2.2
|
|
47
|
-
"druxt": "
|
|
48
|
-
"druxt-entity": "^0.28.1",
|
|
49
|
-
"druxt-router": "^0.30.0"
|
|
48
|
+
"axios": "0.33.0",
|
|
49
|
+
"drupal-jsonapi-params": "^2.3.2",
|
|
50
|
+
"druxt": "0.24.1-dev.20260920063819"
|
|
50
51
|
},
|
|
51
52
|
"optionalDependencies": {
|
|
52
|
-
"vue": "^2.7.
|
|
53
|
+
"vue": "^2.7.16",
|
|
53
54
|
"vuex": "^3.6.2"
|
|
54
55
|
},
|
|
55
56
|
"publishConfig": {
|