Socket
Socket
Sign inDemoInstall

druxt-breadcrumb

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

druxt-breadcrumb - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

86

dist/druxt-breadcrumb.esm.js

@@ -18,36 +18,3 @@ import { resolve } from 'path';

created: function created() {
var this$1 = this;
// Home crumb.
// @TODO - Make this configurable.
this.items['/'] = {
to: '/',
text: 'Home'
};
if (this.$route.path === '/') { return }
// Current route crumb.
this.items[this.$route.path] = {
text: this.route.label
};
// Add crumbs for route parents.
var paths = this.$route.path.split('/').filter(String);
paths.pop();
var loop = function () {
this$1.loading++;
var to = '/' + paths.join('/');
this$1.items[to] = {};
this$1.getRoute(to).then(function (res) {
this$1.loading--;
this$1.items[to] = { to: to, text: res.label };
this$1.$forceUpdate();
});
paths.pop();
};
while (paths.length > 0) loop();
this.getItems();
},

@@ -63,3 +30,4 @@

if (!!this.loading) { return false }
if (!!this.loading) { return [] }
return Object.keys(this.items).sort(function (a, b) { return a.length - b.length; }).map(function (key) {

@@ -75,7 +43,53 @@ return this$1.items[key]

methods: Object.assign({}, mapActions({
methods: Object.assign({}, {getItems: function getItems() {
var this$1 = this;
// Reset items.
this.items = {};
// Home crumb.
// @TODO - Make this configurable.
this.items['/'] = {
to: '/',
text: 'Home'
};
if (this.$route.path === '/') { return }
// Current route crumb.
this.items[this.$route.path] = {
text: this.route.label
};
// Add crumbs for route parents.
var paths = this.$route.path.split('/').filter(String);
paths.pop();
var loop = function () {
this$1.loading++;
var to = '/' + paths.join('/');
this$1.items[to] = {};
this$1.getRoute(to).then(function (res) {
this$1.loading--;
this$1.items[to] = { to: to, text: res.label };
this$1.$forceUpdate();
});
paths.pop();
};
while (paths.length > 0) loop();
}},
mapActions({
getRoute: 'druxtRouter/getRoute'
})),
watch: {
'$route': 'getItems'
},
render: function (createElement) {
if (this.crumbs.length === 0) { return }
// @TODO - Make component configurable.

@@ -82,0 +96,0 @@ return createElement(this.component, {

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

var VueDrupalEntity=function(t,e,r){"use strict";var n={name:"DruxtBreadcrumb",props:{component:{type:String,default:function(){return"div"}}},created:function(){var t=this;if(this.items["/"]={to:"/",text:"Home"},"/"!==this.$route.path){this.items[this.$route.path]={text:this.route.label};var e=this.$route.path.split("/").filter(String);e.pop();for(var r=function(){t.loading++;var r="/"+e.join("/");t.items[r]={},t.getRoute(r).then((function(e){t.loading--,t.items[r]={to:r,text:e.label},t.$forceUpdate()})),e.pop()};e.length>0;)r()}},data:function(){return{loading:0,items:{}}},computed:Object.assign({},{crumbs:function(){var t=this;return!this.loading&&Object.keys(this.items).sort((function(t,e){return t.length-e.length})).map((function(e){return t.items[e]}))}},r.mapState({route:function(t){return t.druxtRouter.route},routes:function(t){return t.druxtRouter.routes}})),methods:Object.assign({},r.mapActions({getRoute:"druxtRouter/getRoute"})),render:function(t){return t(this.component,{props:{items:this.crumbs}})}};return t.DruxtBreadcrumb=n,t.default=function(t){void 0===t&&(t={}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-breadcrumb.js",moduleOptions:t})},t}({},path,vuex);
var VueDrupalEntity=function(t,e,r){"use strict";var n={name:"DruxtBreadcrumb",props:{component:{type:String,default:function(){return"div"}}},created:function(){this.getItems()},data:function(){return{loading:0,items:{}}},computed:Object.assign({},{crumbs:function(){var t=this;return this.loading?[]:Object.keys(this.items).sort((function(t,e){return t.length-e.length})).map((function(e){return t.items[e]}))}},r.mapState({route:function(t){return t.druxtRouter.route},routes:function(t){return t.druxtRouter.routes}})),methods:Object.assign({},{getItems:function(){var t=this;if(this.items={},this.items["/"]={to:"/",text:"Home"},"/"!==this.$route.path){this.items[this.$route.path]={text:this.route.label};var e=this.$route.path.split("/").filter(String);e.pop();for(var r=function(){t.loading++;var r="/"+e.join("/");t.items[r]={},t.getRoute(r).then((function(e){t.loading--,t.items[r]={to:r,text:e.label},t.$forceUpdate()})),e.pop()};e.length>0;)r()}}},r.mapActions({getRoute:"druxtRouter/getRoute"})),watch:{$route:"getItems"},render:function(t){if(0!==this.crumbs.length)return t(this.component,{props:{items:this.crumbs}})}};return t.DruxtBreadcrumb=n,t.default=function(t){void 0===t&&(t={}),this.addPlugin({src:e.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt-breadcrumb.js",moduleOptions:t})},t}({},path,vuex);

@@ -15,36 +15,3 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path'),vuex=require('vuex');var component = {

created: function created() {
var this$1 = this;
// Home crumb.
// @TODO - Make this configurable.
this.items['/'] = {
to: '/',
text: 'Home'
};
if (this.$route.path === '/') { return }
// Current route crumb.
this.items[this.$route.path] = {
text: this.route.label
};
// Add crumbs for route parents.
var paths = this.$route.path.split('/').filter(String);
paths.pop();
var loop = function () {
this$1.loading++;
var to = '/' + paths.join('/');
this$1.items[to] = {};
this$1.getRoute(to).then(function (res) {
this$1.loading--;
this$1.items[to] = { to: to, text: res.label };
this$1.$forceUpdate();
});
paths.pop();
};
while (paths.length > 0) loop();
this.getItems();
},

@@ -60,3 +27,4 @@

if (!!this.loading) { return false }
if (!!this.loading) { return [] }
return Object.keys(this.items).sort(function (a, b) { return a.length - b.length; }).map(function (key) {

@@ -72,7 +40,53 @@ return this$1.items[key]

methods: Object.assign({}, vuex.mapActions({
methods: Object.assign({}, {getItems: function getItems() {
var this$1 = this;
// Reset items.
this.items = {};
// Home crumb.
// @TODO - Make this configurable.
this.items['/'] = {
to: '/',
text: 'Home'
};
if (this.$route.path === '/') { return }
// Current route crumb.
this.items[this.$route.path] = {
text: this.route.label
};
// Add crumbs for route parents.
var paths = this.$route.path.split('/').filter(String);
paths.pop();
var loop = function () {
this$1.loading++;
var to = '/' + paths.join('/');
this$1.items[to] = {};
this$1.getRoute(to).then(function (res) {
this$1.loading--;
this$1.items[to] = { to: to, text: res.label };
this$1.$forceUpdate();
});
paths.pop();
};
while (paths.length > 0) loop();
}},
vuex.mapActions({
getRoute: 'druxtRouter/getRoute'
})),
watch: {
'$route': 'getItems'
},
render: function (createElement) {
if (this.crumbs.length === 0) { return }
// @TODO - Make component configurable.

@@ -79,0 +93,0 @@ return createElement(this.component, {

{
"name": "druxt-breadcrumb",
"version": "0.1.1",
"version": "0.2.0",
"description": "Provides a Breadcrumb Vue component to be used within a Druxt (DRUpal nuXT) project.",

@@ -5,0 +5,0 @@ "repository": {

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