Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

druxt-blocks

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

druxt-blocks - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

72

dist/druxt-blocks.esm.js
import { resolve } from 'path';
import { DruxtEntityComponentSuggestionMixin, DruxtEntityContextMixin } from 'druxt-entity';
import { DruxtRouterEntityMixin } from 'druxt-router';
import { mapActions } from 'vuex';
import { stringify } from 'qs';
import { mapState, mapActions } from 'vuex';
import { DrupalJsonApiParams } from 'drupal-jsonapi-params';

@@ -206,7 +208,7 @@ //

data: function () { return ({
blocks: []
blocks: [],
loading: false
}); },
computed: {
suggestionDefaults: function suggestionDefaults() {
computed: Object.assign({}, {suggestionDefaults: function suggestionDefaults() {
if (!this.tokens) { return [] }

@@ -229,18 +231,58 @@

tokenType: function () { return 'block-region'; }
tokenType: function () { return 'block-region'; }},
mapState('druxtRouter', {
route: function (state) { return state.route; }
})),
watch: {
route: function route() {
this.fetchBlocks();
}
},
created: function created() {
var this$1 = this;
this.fetchBlocks();
},
var query = {
'filter[region]': this.name,
'filter[theme]': this.theme,
'filter[status]': 1
};
methods: Object.assign({}, {fetchBlocks: function fetchBlocks() {
var this$1 = this;
this.getResources({ resource: 'block--block', query: query }).then(function (blocks) { return this$1.blocks = blocks; });
},
if (this.loading) { return }
methods: Object.assign({}, mapActions({
this.loading = true;
var query = new DrupalJsonApiParams();
query
.addFilter('region', this.name)
.addFilter('status', '1')
.addFilter('theme', this.theme)
.addGroup('visibility', 'OR')
.addFilter('visibility.request_path', null, 'IS NULL', 'visibility');
query.addGroup('pages', 'AND', 'visibility')
.addFilter('visibility.request_path.pages', this.route.resolvedPath, 'CONTAINS', 'pages')
.addFilter('visibility.request_path.negate', 0, '=', 'pages');
query.addGroup('front', 'AND', 'visibility')
.addFilter('visibility.request_path.pages', '<front>', 'CONTAINS', 'front')
.addFilter('visibility.request_path.negate', this.route.isHomePath ? 0 : 1, '=', 'front');
// 'drupal-jsonapi-params' incorrectly assigns NULL operator conditions a value.
// We have to modify and stringify the query manually.
// @SEE - https://github.com/d34dman/drupal-jsonapi-params/issues/7
var queryObject = query.getQueryObject();
delete queryObject.filter['visibility.request_path'].condition.value;
var querystring = stringify(queryObject);
var options = {
headers: { 'Druxt-Request-Path': this.$store.state.druxtRouter.route.resolvedPath }
};
this.getResources({ resource: 'block--block', query: querystring }).then(function (blocks) {
this$1.blocks = blocks;
this$1.loading = false;
});
}},
mapActions({
getResources: 'druxtRouter/getResources'

@@ -254,3 +296,3 @@ }))

/* template */
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.component,{tag:"component"},_vm._l((_vm.blocks),function(block){return _c('druxt-block',{key:block.id,attrs:{"uuid":block.id,"type":"block--block"}})}),1)};
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.blocks)?_c(_vm.component,{tag:"component"},_vm._l((_vm.blocks),function(block){return _c('druxt-block',{key:block.id,attrs:{"uuid":block.id,"type":"block--block"}})}),1):_vm._e()};
var __vue_staticRenderFns__$1 = [];

@@ -257,0 +299,0 @@

@@ -1,1 +0,1 @@

var DruxtBlocks=function(t,e,i,n,s){"use strict";function o(t,e,i,n,s,o,r,u,c,h){"boolean"!=typeof r&&(c=u,u=r,r=!1);var l,p="function"==typeof i?i.options:i;if(t&&t.render&&(p.render=t.render,p.staticRenderFns=t.staticRenderFns,p._compiled=!0,s&&(p.functional=!0)),n&&(p._scopeId=n),o?(l=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,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},p._ssrRegister=l):e&&(l=r?function(t){e.call(this,h(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,u(t))}),l)if(p.functional){var d=p.render;p.render=function(t,e){return l.call(e),d(t,e)}}else{var k=p.beforeCreate;p.beforeCreate=k?[].concat(k,l):[l]}return i}var r=o({render:function(){var t=this.$createElement,e=this._self._c||t;return this.entity?e(this.component,this._b({tag:"component"},"component",this.props,!1)):this._e()},staticRenderFns:[]},void 0,{name:"DruxtBlock",mixins:[i.DruxtEntityComponentSuggestionMixin,n.DruxtRouterEntityMixin],props:{type:{type:String,default:"block--block"}},computed:{props:function(){return{block:this.entity}},suggestionDefaults:function(){var t=[];return this.tokens?(t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId+this.tokens.region+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.region+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId+this.tokens.region),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.region),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId),t.push(this.tokens.prefix+this.tokens.plugin),t.filter((function(t,e,i){return i.indexOf(t)===e})).map((function(t){return{value:t}}))):t},tokens:function(){if(!this.entity)return!1;var t={prefix:"DruxtBlock",plugin:this.suggest(this.entity.attributes.plugin),pluginId:"",region:this.suggest(this.entity.attributes.region),theme:this.suggest(this.entity.attributes.theme)};if(this.entity.attributes.plugin.includes(":")){var e=this.entity.attributes.plugin.split(":");t.plugin=this.suggest(e[0]),t.pluginId=this.suggest(e[1])}return t},tokenType:function(){return"block"}}},void 0,!1,void 0,!1,void 0,void 0,void 0),u=o({render:function(){var t=this.$createElement,e=this._self._c||t;return e(this.component,{tag:"component"},this._l(this.blocks,(function(t){return e("druxt-block",{key:t.id,attrs:{uuid:t.id,type:"block--block"}})})),1)},staticRenderFns:[]},void 0,{name:"DruxtBlockRegion",mixins:[i.DruxtEntityComponentSuggestionMixin],props:{name:{type:String,default:"content"},theme:{type:String,required:!0}},data:function(){return{blocks:[]}},computed:{suggestionDefaults:function(){return this.tokens?[{value:this.tokens.prefix+this.tokens.region+this.tokens.theme},{value:this.tokens.prefix+this.tokens.region}]:[]},tokens:function(){return{prefix:"DruxtBlockRegion",region:this.suggest(this.name),theme:this.suggest(this.theme)}},tokenType:function(){return"block-region"}},created:function(){var t=this,e={"filter[region]":this.name,"filter[theme]":this.theme,"filter[status]":1};this.getResources({resource:"block--block",query:e}).then((function(e){return t.blocks=e}))},methods:Object.assign({},s.mapActions({getResources:"druxtRouter/getResources"}))},void 0,!1,void 0,!1,void 0,void 0,void 0),c={mixins:[i.DruxtEntityContextMixin],props:{block:{type:Object,require:!0}},computed:{settings:function(){return this.block.attributes.settings}}},h=o({render:function(){var t=this.$createElement;return(this._self._c||t)("druxt-entity",this._b({},"druxt-entity",this.props,!1))},staticRenderFns:[]},void 0,{name:"DruxtBlockBlockContent",mixins:[c],computed:{props:function(){var t=this.block.attributes.dependencies.content[0].split(":");return{type:t[0]+"--"+t[1],uuid:t[2]}}}},void 0,!1,void 0,!1,void 0,void 0,void 0),l=o({render:function(){var t=this.$createElement;return(this._self._c||t)("nuxt")},staticRenderFns:[]},void 0,{name:"DruxtBlockSystemMainBlock",mixins:[c]},void 0,!1,void 0,!1,void 0,void 0,void 0),p=Object.freeze({__proto__:null,DruxtBlock:r,DruxtBlockRegion:u,DruxtBlockBlockContent:h,DruxtBlockSystemMainBlock:l});return t.DruxtBlock=r,t.DruxtBlockBlockContent=h,t.DruxtBlockRegion=u,t.DruxtBlockSystemMainBlock=l,t.DruxtBlocksBlockMixin=c,t.DruxtBlocksComponents=p,t.default=function(t){if(void 0===this.options||!this.options.druxt)throw new TypeError("Druxt settings missing.");var i=this.options.druxt;this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-blocks.js",options:i})},t}({},path,druxtEntity,druxtRouter,vuex);
var DruxtBlocks=function(t,e,i,n,s,o,r){"use strict";function u(t,e,i,n,s,o,r,u,h,l){"boolean"!=typeof r&&(h=u,u=r,r=!1);var c,a="function"==typeof i?i.options:i;if(t&&t.render&&(a.render=t.render,a.staticRenderFns=t.staticRenderFns,a._compiled=!0,s&&(a.functional=!0)),n&&(a._scopeId=n),o?(c=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,h(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},a._ssrRegister=c):e&&(c=r?function(t){e.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,u(t))}),c)if(a.functional){var d=a.render;a.render=function(t,e){return c.call(e),d(t,e)}}else{var p=a.beforeCreate;a.beforeCreate=p?[].concat(p,c):[c]}return i}var h=u({render:function(){var t=this.$createElement,e=this._self._c||t;return this.entity?e(this.component,this._b({tag:"component"},"component",this.props,!1)):this._e()},staticRenderFns:[]},void 0,{name:"DruxtBlock",mixins:[i.DruxtEntityComponentSuggestionMixin,n.DruxtRouterEntityMixin],props:{type:{type:String,default:"block--block"}},computed:{props:function(){return{block:this.entity}},suggestionDefaults:function(){var t=[];return this.tokens?(t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId+this.tokens.region+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.region+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId+this.tokens.region),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.region),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.theme),t.push(this.tokens.prefix+this.tokens.plugin+this.tokens.pluginId),t.push(this.tokens.prefix+this.tokens.plugin),t.filter((function(t,e,i){return i.indexOf(t)===e})).map((function(t){return{value:t}}))):t},tokens:function(){if(!this.entity)return!1;var t={prefix:"DruxtBlock",plugin:this.suggest(this.entity.attributes.plugin),pluginId:"",region:this.suggest(this.entity.attributes.region),theme:this.suggest(this.entity.attributes.theme)};if(this.entity.attributes.plugin.includes(":")){var e=this.entity.attributes.plugin.split(":");t.plugin=this.suggest(e[0]),t.pluginId=this.suggest(e[1])}return t},tokenType:function(){return"block"}}},void 0,!1,void 0,!1,void 0,void 0,void 0),l=u({render:function(){var t=this.$createElement,e=this._self._c||t;return this.blocks?e(this.component,{tag:"component"},this._l(this.blocks,(function(t){return e("druxt-block",{key:t.id,attrs:{uuid:t.id,type:"block--block"}})})),1):this._e()},staticRenderFns:[]},void 0,{name:"DruxtBlockRegion",mixins:[i.DruxtEntityComponentSuggestionMixin],props:{name:{type:String,default:"content"},theme:{type:String,required:!0}},data:function(){return{blocks:[],loading:!1}},computed:Object.assign({},{suggestionDefaults:function(){return this.tokens?[{value:this.tokens.prefix+this.tokens.region+this.tokens.theme},{value:this.tokens.prefix+this.tokens.region}]:[]},tokens:function(){return{prefix:"DruxtBlockRegion",region:this.suggest(this.name),theme:this.suggest(this.theme)}},tokenType:function(){return"block-region"}},o.mapState("druxtRouter",{route:function(t){return t.route}})),watch:{route:function(){this.fetchBlocks()}},created:function(){this.fetchBlocks()},methods:Object.assign({},{fetchBlocks:function(){var t=this;if(!this.loading){this.loading=!0;var e=new r.DrupalJsonApiParams;e.addFilter("region",this.name).addFilter("status","1").addFilter("theme",this.theme).addGroup("visibility","OR").addFilter("visibility.request_path",null,"IS NULL","visibility"),e.addGroup("pages","AND","visibility").addFilter("visibility.request_path.pages",this.route.resolvedPath,"CONTAINS","pages").addFilter("visibility.request_path.negate",0,"=","pages"),e.addGroup("front","AND","visibility").addFilter("visibility.request_path.pages","<front>","CONTAINS","front").addFilter("visibility.request_path.negate",this.route.isHomePath?0:1,"=","front");var i=e.getQueryObject();delete i.filter["visibility.request_path"].condition.value;var n=s.stringify(i);this.$store.state.druxtRouter.route.resolvedPath;this.getResources({resource:"block--block",query:n}).then((function(e){t.blocks=e,t.loading=!1}))}}},o.mapActions({getResources:"druxtRouter/getResources"}))},void 0,!1,void 0,!1,void 0,void 0,void 0),c={mixins:[i.DruxtEntityContextMixin],props:{block:{type:Object,require:!0}},computed:{settings:function(){return this.block.attributes.settings}}},a=u({render:function(){var t=this.$createElement;return(this._self._c||t)("druxt-entity",this._b({},"druxt-entity",this.props,!1))},staticRenderFns:[]},void 0,{name:"DruxtBlockBlockContent",mixins:[c],computed:{props:function(){var t=this.block.attributes.dependencies.content[0].split(":");return{type:t[0]+"--"+t[1],uuid:t[2]}}}},void 0,!1,void 0,!1,void 0,void 0,void 0),d=u({render:function(){var t=this.$createElement;return(this._self._c||t)("nuxt")},staticRenderFns:[]},void 0,{name:"DruxtBlockSystemMainBlock",mixins:[c]},void 0,!1,void 0,!1,void 0,void 0,void 0),p=Object.freeze({__proto__:null,DruxtBlock:h,DruxtBlockRegion:l,DruxtBlockBlockContent:a,DruxtBlockSystemMainBlock:d});return t.DruxtBlock=h,t.DruxtBlockBlockContent=a,t.DruxtBlockRegion=l,t.DruxtBlockSystemMainBlock=d,t.DruxtBlocksBlockMixin=c,t.DruxtBlocksComponents=p,t.default=function(t){if(void 0===this.options||!this.options.druxt)throw new TypeError("Druxt settings missing.");var i=this.options.druxt;this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-blocks.js",options:i})},t}({},path,druxtEntity,druxtRouter,qs,vuex,drupalJsonapiParams);

@@ -1,2 +0,2 @@

'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path'),druxtEntity=require('druxt-entity'),druxtRouter=require('druxt-router'),vuex=require('vuex');//
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path'),druxtEntity=require('druxt-entity'),druxtRouter=require('druxt-router'),qs=require('qs'),vuex=require('vuex'),drupalJsonapiParams=require('drupal-jsonapi-params');//

@@ -195,7 +195,7 @@ var script = {

data: function () { return ({
blocks: []
blocks: [],
loading: false
}); },
computed: {
suggestionDefaults: function suggestionDefaults() {
computed: Object.assign({}, {suggestionDefaults: function suggestionDefaults() {
if (!this.tokens) { return [] }

@@ -218,18 +218,58 @@

tokenType: function () { return 'block-region'; }
tokenType: function () { return 'block-region'; }},
vuex.mapState('druxtRouter', {
route: function (state) { return state.route; }
})),
watch: {
route: function route() {
this.fetchBlocks();
}
},
created: function created() {
var this$1 = this;
this.fetchBlocks();
},
var query = {
'filter[region]': this.name,
'filter[theme]': this.theme,
'filter[status]': 1
};
methods: Object.assign({}, {fetchBlocks: function fetchBlocks() {
var this$1 = this;
this.getResources({ resource: 'block--block', query: query }).then(function (blocks) { return this$1.blocks = blocks; });
},
if (this.loading) { return }
methods: Object.assign({}, vuex.mapActions({
this.loading = true;
var query = new drupalJsonapiParams.DrupalJsonApiParams();
query
.addFilter('region', this.name)
.addFilter('status', '1')
.addFilter('theme', this.theme)
.addGroup('visibility', 'OR')
.addFilter('visibility.request_path', null, 'IS NULL', 'visibility');
query.addGroup('pages', 'AND', 'visibility')
.addFilter('visibility.request_path.pages', this.route.resolvedPath, 'CONTAINS', 'pages')
.addFilter('visibility.request_path.negate', 0, '=', 'pages');
query.addGroup('front', 'AND', 'visibility')
.addFilter('visibility.request_path.pages', '<front>', 'CONTAINS', 'front')
.addFilter('visibility.request_path.negate', this.route.isHomePath ? 0 : 1, '=', 'front');
// 'drupal-jsonapi-params' incorrectly assigns NULL operator conditions a value.
// We have to modify and stringify the query manually.
// @SEE - https://github.com/d34dman/drupal-jsonapi-params/issues/7
var queryObject = query.getQueryObject();
delete queryObject.filter['visibility.request_path'].condition.value;
var querystring = qs.stringify(queryObject);
var options = {
headers: { 'Druxt-Request-Path': this.$store.state.druxtRouter.route.resolvedPath }
};
this.getResources({ resource: 'block--block', query: querystring }).then(function (blocks) {
this$1.blocks = blocks;
this$1.loading = false;
});
}},
vuex.mapActions({
getResources: 'druxtRouter/getResources'

@@ -241,3 +281,3 @@ }))

/* template */
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.component,{tag:"component"},_vm._l((_vm.blocks),function(block){return _c('druxt-block',{key:block.id,attrs:{"uuid":block.id,"type":"block--block"}})}),1)};
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.blocks)?_c(_vm.component,{tag:"component"},_vm._l((_vm.blocks),function(block){return _c('druxt-block',{key:block.id,attrs:{"uuid":block.id,"type":"block--block"}})}),1):_vm._e()};
var __vue_staticRenderFns__$1 = [];

@@ -250,3 +290,3 @@

/* module identifier */
var __vue_module_identifier__$1 = "data-v-538a3ac0";
var __vue_module_identifier__$1 = "data-v-3d059032";
/* functional template */

@@ -253,0 +293,0 @@ var __vue_is_functional_template__$1 = false;

{
"name": "druxt-blocks",
"version": "0.2.0",
"version": "0.3.0",
"description": "Provides Drupal blocks and region components to be used within a Druxt (DRUpal nuXT) project.",

@@ -47,4 +47,6 @@ "repository": {

"codecov": "^3.7.0",
"drupal-jsonapi-params": "^1.1.8",
"druxt-entity": "^0.5.1",
"druxt-router": "^0.13.0",
"druxt-router": "^0.14.0",
"qs": "^6.9.4",
"vuex": "^3.5.1"

@@ -51,0 +53,0 @@ },

@@ -1,2 +0,2 @@

# \Druxt blocks
# Druxt blocks

@@ -3,0 +3,0 @@ [![CircleCI](https://circleci.com/gh/Realityloop/druxt-blocks.svg?style=svg)](https://circleci.com/gh/Realityloop/druxt-blocks)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc