druxt-site
Advanced tools
Comparing version 0.4.0 to 0.5.0
import { DrupalJsonApiParams } from 'drupal-jsonapi-params'; | ||
import { DruxtComponentMixin } from 'druxt'; | ||
import { DruxtModule } from 'druxt'; | ||
import { mapActions } from 'vuex'; | ||
@@ -7,7 +7,7 @@ import { resolve } from 'path'; | ||
/** | ||
* The `<DruxtSite />` Vue.js component. | ||
* The `<DruxtSite />` Vue.js component renders all available Block regions | ||
* based on the specified theme. | ||
* | ||
* - Loads available Block regions for the specified theme. | ||
* - Renders Block regions via the `<DruxtBlockRegion />` component. | ||
* - Supports the Druxt slot based themeing system. | ||
* Features: | ||
* - Scoped slots | ||
* | ||
@@ -19,4 +19,17 @@ * @example @lang vue | ||
* | ||
* @example <caption>DruxtSite**Umami**.vue</caption> @lang vue | ||
* @example <caption>Default slot override</caption> @lang vue | ||
* <template> | ||
* <DruxtSite theme="umami"> | ||
* <template #default="{ props, regions, theme }"> | ||
* <DruxtBlockRegion | ||
* v-for="region of regions" | ||
* :key="region" | ||
* v-bind="props[region]" | ||
* /> | ||
* </template> | ||
* </DruxtSite> | ||
* </template> | ||
* | ||
* @example <caption>Wrapper component</caption> @lang vue | ||
* <template> | ||
* <div> | ||
@@ -34,8 +47,3 @@ * <slot name="header" /> | ||
/** | ||
* Vue.js Mixins. | ||
* | ||
* @see {@link https://druxtjs.org/api/mixins/component|DruxtComponentMixin} | ||
*/ | ||
mixins: [DruxtComponentMixin], | ||
extends: DruxtModule, | ||
@@ -61,2 +69,9 @@ /** | ||
/** | ||
* @property {string[]} regions - An array of unique region names. | ||
*/ | ||
data: function () { return ({ | ||
regions: [], | ||
}); }, | ||
/** | ||
* Nuxt.js fetch method. | ||
@@ -70,3 +85,3 @@ * | ||
var type = 'block--block'; | ||
var regions = await this.getCollection({ | ||
this.regions = await this.getCollection({ | ||
type: type, | ||
@@ -77,77 +92,137 @@ query: new DrupalJsonApiParams() | ||
}).then(function (resources) { return resources.data.map(function (resource) { return resource.attributes.region; }).filter(function (v, i, s) { return s.indexOf(v) === i; }); }); | ||
this.regions = regions; | ||
// Invoke DruxtComponent mixin. | ||
await DruxtComponentMixin.fetch.call(this); | ||
// Call DruxtModule fetch hook. | ||
await DruxtModule.fetch.call(this); | ||
}, | ||
/** | ||
* @property {string[]} regions - An array of unique region names. | ||
* Vue.js Computed properties. | ||
*/ | ||
data: function () { return ({ | ||
regions: [] | ||
}); }, | ||
computed: { | ||
/** | ||
* DruxtBlockRegion propsData for regions. | ||
* | ||
* @return {object} | ||
*/ | ||
props: function (ref) { | ||
var regions = ref.regions; | ||
var theme = ref.theme; | ||
methods: Object.assign({}, mapActions({ getCollection: 'druxt/getCollection' })), | ||
return Object.fromEntries(regions.map(function (region) { return [region, { | ||
name: region, | ||
theme: theme, | ||
}]; })); | ||
}, | ||
}, | ||
render: function render(h) { | ||
var this$1 = this; | ||
methods: Object.assign({}, {getScopedSlots: function getScopedSlots() { | ||
var this$1 = this; | ||
var wrapperData = { | ||
class: this.wrapper.class || undefined, | ||
style: this.wrapper.style || undefined, | ||
props: this.wrapper.propsData, | ||
}; | ||
// Build scoped slots for each field. | ||
var scopedSlots = Object.assign({}, Object.fromEntries(this.regions.map(function (region) { return [region, function (attrs) { return this$1.$createElement('DruxtBlockRegion', { | ||
attrs: attrs, | ||
key: region, | ||
props: this$1.props[region], | ||
}); }]; }))); | ||
// Return only wrapper if fetch state is still pending. | ||
if (this.$fetchState.pending) { | ||
return h(this.wrapper.component, wrapperData) | ||
} | ||
// Build default slot. | ||
scopedSlots.default = function (attrs) { return Object.entries(this$1.regions) | ||
.map(function (region) { return (scopedSlots[region] || (function () {}))(attrs); }); }; | ||
if (this.$scopedSlots.default) { | ||
scopedSlots.default = function (attrs) { return this$1.$scopedSlots.default(Object.assign({}, this$1.$options.druxt.propsData(this$1), | ||
attrs)); }; | ||
} | ||
// Build scoped slots for each region. | ||
var scopedSlots = {}; | ||
Object.entries(this.regions).map(function (ref) { | ||
var index = ref[0]; | ||
var region = ref[1]; | ||
return scopedSlots | ||
}}, | ||
scopedSlots[region] = function (attrs) { return h('DruxtBlockRegion', { | ||
attrs: attrs, | ||
props: { | ||
name: region, | ||
theme: this$1.theme | ||
} | ||
}); }; | ||
}); | ||
mapActions({ getCollection: 'druxt/getCollection' })), | ||
// Build default slot. | ||
scopedSlots.default = function (attrs) { return Object.entries(this$1.regions).map(function (ref) { | ||
var index = ref[0]; | ||
var region = ref[1]; | ||
/** | ||
* Druxt module configuration. | ||
*/ | ||
druxt: { | ||
/** | ||
* Provides the available component naming options for the Druxt Wrapper. | ||
* | ||
* @param {object} context - The module component ViewModel. | ||
* @returns {ComponentOptions} | ||
*/ | ||
componentOptions: function (ref) { | ||
var theme = ref.theme; | ||
return scopedSlots[region](attrs); | ||
}); }; | ||
return [[theme], ['default']]; | ||
}, | ||
// Return wrapped component. | ||
return h(this.wrapper.component, wrapperData, [ | ||
h(this.component.is, { | ||
props: this.component.propsData, | ||
scopedSlots: scopedSlots, | ||
}) | ||
]) | ||
}, | ||
/** | ||
* Provides propsData for the DruxtWrapper. | ||
* | ||
* @param {object} context - The module component ViewModel. | ||
* @returns {PropsData} | ||
*/ | ||
propsData: function (ref) { | ||
var props = ref.props; | ||
var regions = ref.regions; | ||
var theme = ref.theme; | ||
druxt: function (ref) { | ||
var vm = ref.vm; | ||
return ({ props: props, regions: regions, theme: theme }); | ||
}, | ||
} | ||
}; | ||
return ({ | ||
componentOptions: [[vm.theme], ['default']], | ||
/** | ||
* Provides the available naming options for the Wrapper component. | ||
* | ||
* @typedef {array[]} ComponentOptions | ||
* | ||
* @example @lang js | ||
* [ | ||
* 'DruxtSite[Theme]', | ||
* 'DruxtSiteDefault', | ||
* ] | ||
* | ||
* @example <caption>Umami</caption> @lang js | ||
* [ | ||
* 'DruxtSiteUmami', | ||
* ] | ||
*/ | ||
propsData: { | ||
theme: vm.theme, | ||
regions: vm.regions | ||
} | ||
}); | ||
} | ||
}; | ||
/** | ||
* Provides propsData for use in the Wrapper component. | ||
* | ||
* @typedef {object} PropsData | ||
* @param {object} props - DruxtBlockRegion propsData for regions. | ||
* @param {string[]} regions - An array of unique region names. | ||
* @param {string} theme - Drupal theme ID. | ||
* | ||
* @example @lang js | ||
* { | ||
* props: { | ||
* content: { | ||
* name: 'content', | ||
* theme: 'umami', | ||
* }, | ||
* ... | ||
* }, | ||
* regions: ['breadcrumbs', 'header', 'content', ...], | ||
* theme: 'umami', | ||
* } | ||
*/ | ||
/** | ||
* Provides scoped slots for use in the Wrapper component. | ||
* | ||
* @typedef {object} ScopedSlots | ||
* @param {function} * - Slot per region. | ||
* @param {function} default - All regions. | ||
* | ||
* @example <caption>DruxtSite**Theme**.vue</caption> @lang vue | ||
* <template> | ||
* <div> | ||
* <slot name="content" /> | ||
* <slot :name="region_name" /> | ||
* </div> | ||
* </template> | ||
*/ | ||
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
@@ -286,3 +361,3 @@ if (typeof shadowMode !== 'boolean') { | ||
// Add NuxtJS modules. | ||
// Add Nuxt.js modules. | ||
var modules = [ | ||
@@ -319,2 +394,4 @@ '@nuxtjs/proxy', | ||
DruxtSiteNuxtModule.meta = require('../package.json'); | ||
/** | ||
@@ -328,3 +405,3 @@ * Module options object. | ||
/** | ||
* Provides Vue.js properties to render Drupal Site components. | ||
* Provides Vue.js properties for DrupalSite Wrapper components. | ||
* | ||
@@ -339,4 +416,3 @@ * @mixin | ||
* :key="region" | ||
* :name="region" | ||
* :theme="theme" | ||
* v-bind="props[region]" | ||
* /> | ||
@@ -360,9 +436,9 @@ * </div> | ||
/** | ||
* The Drupal theme ID. | ||
* | ||
* @type {string} | ||
* DruxtBlockRegion propsData for regions. | ||
* | ||
* @return {object} | ||
*/ | ||
theme: { | ||
type: String, | ||
required: true, | ||
props: { | ||
type: Object, | ||
default: function () { return ({}); }, | ||
}, | ||
@@ -375,6 +451,16 @@ | ||
*/ | ||
regions: { | ||
regions: { | ||
type: Array, | ||
default: function () { return ([]); } | ||
} | ||
}, | ||
/** | ||
* The Drupal theme ID. | ||
* | ||
* @type {string} | ||
*/ | ||
theme: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
@@ -381,0 +467,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
var DruxtSite=function(t,e,n,r,i){"use strict";function o(t,e,n,r,i,o,s,u,a,d){"boolean"!=typeof s&&(a=u,u=s,s=!1);var p,c="function"==typeof n?n.options:n;if(t&&t.render&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,i&&(c.functional=!0)),r&&(c._scopeId=r),o?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,a(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=p):e&&(p=s?function(t){e.call(this,d(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,u(t))}),p)if(c.functional){var h=c.render;c.render=function(t,e){return p.call(e),h(t,e)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,p):[p]}return n}var s=o({},undefined,{name:"DruxtSite",mixins:[n.DruxtComponentMixin],props:{theme:{type:String,required:!0}},fetch:async function(){var t="block--block",r=await this.getCollection({type:t,query:(new e.DrupalJsonApiParams).addFilter("theme",this.theme).addFields(t,["region"])}).then((function(t){return t.data.map((function(t){return t.attributes.region})).filter((function(t,e,n){return n.indexOf(t)===e}))}));this.regions=r,await n.DruxtComponentMixin.fetch.call(this)},data:function(){return{regions:[]}},methods:Object.assign({},r.mapActions({getCollection:"druxt/getCollection"})),render:function(t){var e=this,n={class:this.wrapper.class||void 0,style:this.wrapper.style||void 0,props:this.wrapper.propsData};if(this.$fetchState.pending)return t(this.wrapper.component,n);var r={};return Object.entries(this.regions).map((function(n){n[0];var i=n[1];r[i]=function(n){return t("DruxtBlockRegion",{attrs:n,props:{name:i,theme:e.theme}})}})),r.default=function(t){return Object.entries(e.regions).map((function(e){e[0];var n=e[1];return r[n](t)}))},t(this.wrapper.component,n,[t(this.component.is,{props:this.component.propsData,scopedSlots:r})])},druxt:function(t){var e=t.vm;return{componentOptions:[[e.theme],["default"]],propsData:{theme:e.theme,regions:e.regions}}}},undefined,undefined,undefined,!1,void 0,void 0,void 0),u={props:{theme:{type:String,required:!0},regions:{type:Array,default:function(){return[]}}}};return t.DruxtSite=s,t.DruxtSiteMixin=u,t.default=function(t){if(void 0===this.options||!this.options.druxt)throw new TypeError("Druxt settings missing.");this.addPlugin({src:i.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-site.js",options:this.options.druxt});var e=["@nuxtjs/proxy","druxt","druxt-blocks","druxt-breadcrumb","druxt-entity","druxt-menu","druxt-router","druxt-schema","druxt-views"];for(var n in e)this.addModule(e[n]);void 0===this.options.proxy&&(this.options.proxy=[this.options.druxt.baseUrl+"/sites/default/files"]),void 0===((this.options.druxt||{}).menu||{}).jsonApiMenuItems&&(this.options.druxt.menu=Object.assign({},this.options.druxt.menu,{jsonApiMenuItems:!0})),this.options.store=!0},t}({},drupalJsonapiParams,druxt,vuex,path); | ||
var DruxtSite=function(t,e,n,r,i){"use strict";function o(t,e,n,r,i,o,s,u,d,a){"boolean"!=typeof s&&(d=u,u=s,s=!1);var p,c="function"==typeof n?n.options:n;if(t&&t.render&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,i&&(c.functional=!0)),r&&(c._scopeId=r),o?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,d(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=p):e&&(p=s?function(t){e.call(this,a(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,u(t))}),p)if(c.functional){var f=c.render;c.render=function(t,e){return p.call(e),f(t,e)}}else{var l=c.beforeCreate;c.beforeCreate=l?[].concat(l,p):[p]}return n}var s=o({},undefined,{name:"DruxtSite",extends:n.DruxtModule,props:{theme:{type:String,required:!0}},data:function(){return{regions:[]}},fetch:async function(){var t="block--block";this.regions=await this.getCollection({type:t,query:(new e.DrupalJsonApiParams).addFilter("theme",this.theme).addFields(t,["region"])}).then((function(t){return t.data.map((function(t){return t.attributes.region})).filter((function(t,e,n){return n.indexOf(t)===e}))})),await n.DruxtModule.fetch.call(this)},computed:{props:function(t){var e=t.regions,n=t.theme;return Object.fromEntries(e.map((function(t){return[t,{name:t,theme:n}]})))}},methods:Object.assign({},{getScopedSlots:function(){var t=this,e=Object.assign({},Object.fromEntries(this.regions.map((function(e){return[e,function(n){return t.$createElement("DruxtBlockRegion",{attrs:n,key:e,props:t.props[e]})}]}))));return e.default=function(n){return Object.entries(t.regions).map((function(t){return(e[t]||function(){})(n)}))},this.$scopedSlots.default&&(e.default=function(e){return t.$scopedSlots.default(Object.assign({},t.$options.druxt.propsData(t),e))}),e}},r.mapActions({getCollection:"druxt/getCollection"})),druxt:{componentOptions:function(t){return[[t.theme],["default"]]},propsData:function(t){return{props:t.props,regions:t.regions,theme:t.theme}}}},undefined,undefined,undefined,!1,void 0,void 0,void 0),u=function(t){if(void 0===this.options||!this.options.druxt)throw new TypeError("Druxt settings missing.");this.addPlugin({src:i.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-site.js",options:this.options.druxt});var e=["@nuxtjs/proxy","druxt","druxt-blocks","druxt-breadcrumb","druxt-entity","druxt-menu","druxt-router","druxt-schema","druxt-views"];for(var n in e)this.addModule(e[n]);void 0===this.options.proxy&&(this.options.proxy=[this.options.druxt.baseUrl+"/sites/default/files"]),void 0===((this.options.druxt||{}).menu||{}).jsonApiMenuItems&&(this.options.druxt.menu=Object.assign({},this.options.druxt.menu,{jsonApiMenuItems:!0})),this.options.store=!0};u.meta=require("../package.json");var d={props:{props:{type:Object,default:function(){return{}}},regions:{type:Array,default:function(){return[]}},theme:{type:String,required:!0}}};return t.DruxtSite=s,t.DruxtSiteMixin=d,t.default=u,t}({},drupalJsonapiParams,druxt,vuex,path); |
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var drupalJsonapiParams=require('drupal-jsonapi-params'),druxt=require('druxt'),vuex=require('vuex'),path=require('path');/** | ||
* The `<DruxtSite />` Vue.js component. | ||
* The `<DruxtSite />` Vue.js component renders all available Block regions | ||
* based on the specified theme. | ||
* | ||
* - Loads available Block regions for the specified theme. | ||
* - Renders Block regions via the `<DruxtBlockRegion />` component. | ||
* - Supports the Druxt slot based themeing system. | ||
* Features: | ||
* - Scoped slots | ||
* | ||
@@ -13,4 +13,17 @@ * @example @lang vue | ||
* | ||
* @example <caption>DruxtSite**Umami**.vue</caption> @lang vue | ||
* @example <caption>Default slot override</caption> @lang vue | ||
* <template> | ||
* <DruxtSite theme="umami"> | ||
* <template #default="{ props, regions, theme }"> | ||
* <DruxtBlockRegion | ||
* v-for="region of regions" | ||
* :key="region" | ||
* v-bind="props[region]" | ||
* /> | ||
* </template> | ||
* </DruxtSite> | ||
* </template> | ||
* | ||
* @example <caption>Wrapper component</caption> @lang vue | ||
* <template> | ||
* <div> | ||
@@ -28,8 +41,3 @@ * <slot name="header" /> | ||
/** | ||
* Vue.js Mixins. | ||
* | ||
* @see {@link https://druxtjs.org/api/mixins/component|DruxtComponentMixin} | ||
*/ | ||
mixins: [druxt.DruxtComponentMixin], | ||
extends: druxt.DruxtModule, | ||
@@ -55,2 +63,9 @@ /** | ||
/** | ||
* @property {string[]} regions - An array of unique region names. | ||
*/ | ||
data: function () { return ({ | ||
regions: [], | ||
}); }, | ||
/** | ||
* Nuxt.js fetch method. | ||
@@ -64,3 +79,3 @@ * | ||
var type = 'block--block'; | ||
var regions = await this.getCollection({ | ||
this.regions = await this.getCollection({ | ||
type: type, | ||
@@ -71,76 +86,136 @@ query: new drupalJsonapiParams.DrupalJsonApiParams() | ||
}).then(function (resources) { return resources.data.map(function (resource) { return resource.attributes.region; }).filter(function (v, i, s) { return s.indexOf(v) === i; }); }); | ||
this.regions = regions; | ||
// Invoke DruxtComponent mixin. | ||
await druxt.DruxtComponentMixin.fetch.call(this); | ||
// Call DruxtModule fetch hook. | ||
await druxt.DruxtModule.fetch.call(this); | ||
}, | ||
/** | ||
* @property {string[]} regions - An array of unique region names. | ||
* Vue.js Computed properties. | ||
*/ | ||
data: function () { return ({ | ||
regions: [] | ||
}); }, | ||
computed: { | ||
/** | ||
* DruxtBlockRegion propsData for regions. | ||
* | ||
* @return {object} | ||
*/ | ||
props: function (ref) { | ||
var regions = ref.regions; | ||
var theme = ref.theme; | ||
methods: Object.assign({}, vuex.mapActions({ getCollection: 'druxt/getCollection' })), | ||
return Object.fromEntries(regions.map(function (region) { return [region, { | ||
name: region, | ||
theme: theme, | ||
}]; })); | ||
}, | ||
}, | ||
render: function render(h) { | ||
var this$1 = this; | ||
methods: Object.assign({}, {getScopedSlots: function getScopedSlots() { | ||
var this$1 = this; | ||
var wrapperData = { | ||
class: this.wrapper.class || undefined, | ||
style: this.wrapper.style || undefined, | ||
props: this.wrapper.propsData, | ||
}; | ||
// Build scoped slots for each field. | ||
var scopedSlots = Object.assign({}, Object.fromEntries(this.regions.map(function (region) { return [region, function (attrs) { return this$1.$createElement('DruxtBlockRegion', { | ||
attrs: attrs, | ||
key: region, | ||
props: this$1.props[region], | ||
}); }]; }))); | ||
// Return only wrapper if fetch state is still pending. | ||
if (this.$fetchState.pending) { | ||
return h(this.wrapper.component, wrapperData) | ||
} | ||
// Build default slot. | ||
scopedSlots.default = function (attrs) { return Object.entries(this$1.regions) | ||
.map(function (region) { return (scopedSlots[region] || (function () {}))(attrs); }); }; | ||
if (this.$scopedSlots.default) { | ||
scopedSlots.default = function (attrs) { return this$1.$scopedSlots.default(Object.assign({}, this$1.$options.druxt.propsData(this$1), | ||
attrs)); }; | ||
} | ||
// Build scoped slots for each region. | ||
var scopedSlots = {}; | ||
Object.entries(this.regions).map(function (ref) { | ||
var index = ref[0]; | ||
var region = ref[1]; | ||
return scopedSlots | ||
}}, | ||
scopedSlots[region] = function (attrs) { return h('DruxtBlockRegion', { | ||
attrs: attrs, | ||
props: { | ||
name: region, | ||
theme: this$1.theme | ||
} | ||
}); }; | ||
}); | ||
vuex.mapActions({ getCollection: 'druxt/getCollection' })), | ||
// Build default slot. | ||
scopedSlots.default = function (attrs) { return Object.entries(this$1.regions).map(function (ref) { | ||
var index = ref[0]; | ||
var region = ref[1]; | ||
/** | ||
* Druxt module configuration. | ||
*/ | ||
druxt: { | ||
/** | ||
* Provides the available component naming options for the Druxt Wrapper. | ||
* | ||
* @param {object} context - The module component ViewModel. | ||
* @returns {ComponentOptions} | ||
*/ | ||
componentOptions: function (ref) { | ||
var theme = ref.theme; | ||
return scopedSlots[region](attrs); | ||
}); }; | ||
return [[theme], ['default']]; | ||
}, | ||
// Return wrapped component. | ||
return h(this.wrapper.component, wrapperData, [ | ||
h(this.component.is, { | ||
props: this.component.propsData, | ||
scopedSlots: scopedSlots, | ||
}) | ||
]) | ||
}, | ||
/** | ||
* Provides propsData for the DruxtWrapper. | ||
* | ||
* @param {object} context - The module component ViewModel. | ||
* @returns {PropsData} | ||
*/ | ||
propsData: function (ref) { | ||
var props = ref.props; | ||
var regions = ref.regions; | ||
var theme = ref.theme; | ||
druxt: function (ref) { | ||
var vm = ref.vm; | ||
return ({ props: props, regions: regions, theme: theme }); | ||
}, | ||
} | ||
}; | ||
return ({ | ||
componentOptions: [[vm.theme], ['default']], | ||
/** | ||
* Provides the available naming options for the Wrapper component. | ||
* | ||
* @typedef {array[]} ComponentOptions | ||
* | ||
* @example @lang js | ||
* [ | ||
* 'DruxtSite[Theme]', | ||
* 'DruxtSiteDefault', | ||
* ] | ||
* | ||
* @example <caption>Umami</caption> @lang js | ||
* [ | ||
* 'DruxtSiteUmami', | ||
* ] | ||
*/ | ||
propsData: { | ||
theme: vm.theme, | ||
regions: vm.regions | ||
} | ||
}); | ||
} | ||
};function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
/** | ||
* Provides propsData for use in the Wrapper component. | ||
* | ||
* @typedef {object} PropsData | ||
* @param {object} props - DruxtBlockRegion propsData for regions. | ||
* @param {string[]} regions - An array of unique region names. | ||
* @param {string} theme - Drupal theme ID. | ||
* | ||
* @example @lang js | ||
* { | ||
* props: { | ||
* content: { | ||
* name: 'content', | ||
* theme: 'umami', | ||
* }, | ||
* ... | ||
* }, | ||
* regions: ['breadcrumbs', 'header', 'content', ...], | ||
* theme: 'umami', | ||
* } | ||
*/ | ||
/** | ||
* Provides scoped slots for use in the Wrapper component. | ||
* | ||
* @typedef {object} ScopedSlots | ||
* @param {function} * - Slot per region. | ||
* @param {function} default - All regions. | ||
* | ||
* @example <caption>DruxtSite**Theme**.vue</caption> @lang vue | ||
* <template> | ||
* <div> | ||
* <slot name="content" /> | ||
* <slot :name="region_name" /> | ||
* </div> | ||
* </template> | ||
*/function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof shadowMode !== 'boolean') { | ||
@@ -228,3 +303,3 @@ createInjectorSSR = createInjector; | ||
/* module identifier */ | ||
var __vue_module_identifier__ = "data-v-6eba2974"; | ||
var __vue_module_identifier__ = "data-v-32e435ba"; | ||
/* functional template */ | ||
@@ -275,3 +350,3 @@ var __vue_is_functional_template__ = undefined; | ||
// Add NuxtJS modules. | ||
// Add Nuxt.js modules. | ||
var modules = [ | ||
@@ -308,2 +383,4 @@ '@nuxtjs/proxy', | ||
DruxtSiteNuxtModule.meta = require('../package.json'); | ||
/** | ||
@@ -315,3 +392,3 @@ * Module options object. | ||
*//** | ||
* Provides Vue.js properties to render Drupal Site components. | ||
* Provides Vue.js properties for DrupalSite Wrapper components. | ||
* | ||
@@ -326,4 +403,3 @@ * @mixin | ||
* :key="region" | ||
* :name="region" | ||
* :theme="theme" | ||
* v-bind="props[region]" | ||
* /> | ||
@@ -347,9 +423,9 @@ * </div> | ||
/** | ||
* The Drupal theme ID. | ||
* | ||
* @type {string} | ||
* DruxtBlockRegion propsData for regions. | ||
* | ||
* @return {object} | ||
*/ | ||
theme: { | ||
type: String, | ||
required: true, | ||
props: { | ||
type: Object, | ||
default: function () { return ({}); }, | ||
}, | ||
@@ -362,7 +438,17 @@ | ||
*/ | ||
regions: { | ||
regions: { | ||
type: Array, | ||
default: function () { return ([]); } | ||
} | ||
}, | ||
/** | ||
* The Drupal theme ID. | ||
* | ||
* @type {string} | ||
*/ | ||
theme: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
};exports.DruxtSite=__vue_component__;exports.DruxtSiteMixin=DruxtSiteMixin;exports.default=DruxtSiteNuxtModule; |
{ | ||
"name": "druxt-site", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Out of the box decoupled Drupal Site module for DruxtJS.", | ||
@@ -15,3 +15,7 @@ "repository": { | ||
], | ||
"author": "Stuart Clark <stuart@realityloop.com> (realityloop.com)", | ||
"author": { | ||
"name": "Stuart Clark", | ||
"email": "stuart@realityloop.com", | ||
"url": "https://realityloop.com" | ||
}, | ||
"license": "MIT", | ||
@@ -48,7 +52,7 @@ "bugs": { | ||
"@nuxtjs/proxy": "^2.1.0", | ||
"druxt": "^0.4.1", | ||
"druxt": "^0.6.0", | ||
"druxt-blocks": "^0.8.0", | ||
"druxt-breadcrumb": "^0.7.1", | ||
"druxt-entity": "^0.10.0", | ||
"druxt-menu": "^0.8.0", | ||
"druxt-entity": "^0.14.0", | ||
"druxt-menu": "^0.10.1", | ||
"druxt-router": "^0.18.0", | ||
@@ -55,0 +59,0 @@ "druxt-schema": "^0.7.0", |
@@ -6,2 +6,3 @@ # DruxtJS Site module | ||
[![codecov](https://codecov.io/gh/druxt/druxt-site/branch/develop/graph/badge.svg)](https://codecov.io/gh/druxt/druxt-site) | ||
[![npm](https://badgen.net/npm/v/druxt-site)](https://www.npmjs.com/package/druxt-site) | ||
@@ -40,3 +41,3 @@ | ||
<template> | ||
<DruxtSite :theme="theme" > | ||
<DruxtSite :theme="theme" /> | ||
</template> | ||
@@ -43,0 +44,0 @@ ``` |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
31701
832
55
3
+ Addeddruxt@0.5.10.6.1(transitive)
+ Addeddruxt-entity@0.14.2(transitive)
+ Addeddruxt-menu@0.10.3(transitive)
+ Addedscule@0.1.1(transitive)
- Removeddruxt-menu@0.8.0(transitive)
Updateddruxt@^0.6.0
Updateddruxt-entity@^0.14.0
Updateddruxt-menu@^0.10.1