druxt-blocks 0.11.1 → 0.12.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # druxt-blocks
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 715e5ef: Updated component registration method to use the Nuxt `components:dirs` hook
8
+ - 2b8c3f3: Updated to use DruxtDebug component
9
+
10
+ ### Patch Changes
11
+
12
+ - 49454cb: Fixed path to components in Storybook
13
+ - Updated dependencies [1ab762c]
14
+ - druxt-router@0.20.0
15
+ - druxt@0.10.0
16
+ - druxt-entity@0.18.0
17
+
3
18
  ## 0.11.1
4
19
 
5
20
  ### Patch Changes
@@ -49,6 +49,13 @@ export default {
49
49
  },
50
50
  },
51
51
 
52
+ /**
53
+ * @property {object} resource - The JSON:API resource object.
54
+ */
55
+ data: () => ({
56
+ resource: {},
57
+ }),
58
+
52
59
  /**
53
60
  * The Nuxt Fetch hook.
54
61
  *
@@ -89,13 +96,6 @@ export default {
89
96
  return [...parts, getCounter(parts.join(':'))].join(':')
90
97
  },
91
98
 
92
- /**
93
- * @property {object} resource - The JSON:API resource object.
94
- */
95
- data: () => ({
96
- resource: {},
97
- }),
98
-
99
99
  /** */
100
100
  computed: {
101
101
  /**
@@ -165,26 +165,14 @@ export default {
165
165
  slots(h) {
166
166
  const scopedSlots = {}
167
167
 
168
- // Provide debug data if Nuxt is running in dev mode.
169
- if (this.$nuxt.context.isDev) {
170
- scopedSlots.default = (attrs) => h(
171
- 'details',
172
- {
173
- style: {
174
- border: '2px dashed lightgrey',
175
- margin: '0.5em 0',
176
- padding: '1em',
177
- },
178
- },
179
- [
180
- h('summary', [`[DruxtBlock] Missing wrapper component for '${((this.block || {}).attributes || {}).drupal_internal__id}'`]),
181
- h('br'),
182
- h('label', ['Component options:', h('ul', this.component.options.map((s) => h('li', [s])))]),
183
- h('br'),
184
- h('label', ['Block settings:', h('pre', [JSON.stringify(((this.block || {}).attributes || {}).settings, null, ' ')])])
185
- ]
186
- )
187
- }
168
+ // Debug data.
169
+ scopedSlots.debug = () => h('DruxtDebug',
170
+ { props: { summary: `Missing wrapper component for '${((this.block || {}).attributes || {}).drupal_internal__id}'`} },
171
+ [
172
+ h('label', ['Component options:', h('ul', this.component.options.map((s) => h('li', [s])))]),
173
+ h('label', ['Block settings:', h('pre', [JSON.stringify(((this.block || {}).attributes || {}).settings, null, ' ')])])
174
+ ]
175
+ )
188
176
 
189
177
  return scopedSlots
190
178
  },
@@ -51,6 +51,13 @@ export default {
51
51
  },
52
52
  },
53
53
 
54
+ /**
55
+ * @property {objects[]} blocks - The Block JSON:API resources.
56
+ */
57
+ data: () => ({
58
+ blocks: []
59
+ }),
60
+
54
61
  /**
55
62
  * The Nuxt Fetch hook.
56
63
  *
@@ -77,13 +84,6 @@ export default {
77
84
  return [...parts, getCounter(parts.join(':'))].join(':')
78
85
  },
79
86
 
80
- /**
81
- * @property {objects[]} blocks - The Block JSON:API resources.
82
- */
83
- data: () => ({
84
- blocks: []
85
- }),
86
-
87
87
  /**
88
88
  * @vue-computed {object} route The current Route from the [DruxtRouter vuex store](https://router.druxtjs.org/api/stores/router.html).
89
89
  */
@@ -1,4 +1,4 @@
1
- import { resolve } from 'path';
1
+ import { resolve, join } from 'path';
2
2
  import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
3
3
  import { DruxtClient } from 'druxt';
4
4
 
@@ -39,7 +39,7 @@ async function DruxtBlocksStorybook({ stories }) {
39
39
  stories.push.apply(stories, regionStories);
40
40
  }
41
41
 
42
- const DruxtBlocksNuxtModule = function(moduleOptions = {}) {
42
+ const DruxtBlocksNuxtModule = function() {
43
43
  const { options } = this;
44
44
  if (typeof options === "undefined" || !options.druxt) {
45
45
  throw new TypeError("Druxt settings missing.");
@@ -48,6 +48,10 @@ const DruxtBlocksNuxtModule = function(moduleOptions = {}) {
48
48
  for (const module of modules) {
49
49
  this.addModule(module);
50
50
  }
51
+ this.nuxt.hook("components:dirs", (dirs) => {
52
+ dirs.push({ path: join(__dirname, "components") });
53
+ dirs.push({ path: join(__dirname, "components/blocks") });
54
+ });
51
55
  this.addPlugin({
52
56
  src: resolve(__dirname, "../nuxt/plugin.js"),
53
57
  fileName: "druxt-blocks.js",
@@ -43,7 +43,7 @@ async function DruxtBlocksStorybook({ stories }) {
43
43
  stories.push.apply(stories, regionStories);
44
44
  }
45
45
 
46
- const DruxtBlocksNuxtModule = function(moduleOptions = {}) {
46
+ const DruxtBlocksNuxtModule = function() {
47
47
  const { options } = this;
48
48
  if (typeof options === "undefined" || !options.druxt) {
49
49
  throw new TypeError("Druxt settings missing.");
@@ -52,6 +52,10 @@ const DruxtBlocksNuxtModule = function(moduleOptions = {}) {
52
52
  for (const module of modules) {
53
53
  this.addModule(module);
54
54
  }
55
+ this.nuxt.hook("components:dirs", (dirs) => {
56
+ dirs.push({ path: path.join(__dirname, "components") });
57
+ dirs.push({ path: path.join(__dirname, "components/blocks") });
58
+ });
55
59
  this.addPlugin({
56
60
  src: path.resolve(__dirname, "../nuxt/plugin.js"),
57
61
  fileName: "druxt-blocks.js",
@@ -1,4 +1,4 @@
1
- import { default as DruxtBlockRegion } from 'druxt-blocks/src/components/DruxtBlockRegion.vue'
1
+ import DruxtBlockRegion from 'druxt-blocks/dist/components/DruxtBlockRegion.vue'
2
2
 
3
3
  export default {
4
4
  title: '<%= options.title %>',
@@ -1,4 +1,4 @@
1
- import { default as DruxtBlock } from 'druxt-blocks/src/components/DruxtBlock.vue'
1
+ import DruxtBlock from 'druxt-blocks/dist/components/DruxtBlock.vue'
2
2
 
3
3
  export default {
4
4
  title: '<%= options.title %>',
package/nuxt/plugin.js CHANGED
@@ -1,19 +1,3 @@
1
- import Vue from 'vue'
2
-
3
- import * as DruxtBlocksComponents from 'druxt-blocks/dist/components/index.mjs'
4
-
5
- Vue.use({
6
- install: function (Vue) {
7
- if (Vue._druxt_blocks_installed) return
8
- Vue._druxt_blocks_installed = true
9
-
10
- // Register components.
11
- for (const component in DruxtBlocksComponents) {
12
- Vue.component(component, DruxtBlocksComponents[component])
13
- }
14
- }
15
- })
16
-
17
1
  export default (context, inject) => {
18
2
  const options = {}
19
3
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-blocks",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Drupal Block and Block Region Druxt components.",
5
5
  "keywords": [
6
6
  "block",
@@ -31,9 +31,9 @@
31
31
  "dependencies": {
32
32
  "axios": "^0.21.1",
33
33
  "drupal-jsonapi-params": "^1.1.12",
34
- "druxt": "^0.9.0",
35
- "druxt-entity": "^0.17.1",
36
- "druxt-router": "^0.19.1"
34
+ "druxt": "^0.10.0",
35
+ "druxt-entity": "^0.18.0",
36
+ "druxt-router": "^0.20.0"
37
37
  },
38
38
  "optionalDependencies": {
39
39
  "vue": "^2.6.14",
@@ -1,3 +0,0 @@
1
- export { default as DruxtBlockBlockContent } from './DruxtBlockBlockContent.vue'
2
- export { default as DruxtBlockPageTitleBlock } from './DruxtBlockPageTitleBlock.vue'
3
- export { default as DruxtBlockSystemMainBlock } from './DruxtBlockSystemMainBlock.vue'
@@ -1,3 +0,0 @@
1
- export { default as DruxtBlock } from './DruxtBlock.vue'
2
- export { default as DruxtBlockRegion } from './DruxtBlockRegion.vue'
3
- export * from './blocks/index.mjs'