Comparing version 0.3.1 to 0.3.2
@@ -362,2 +362,3 @@ import { resolve } from 'path'; | ||
var results = []; | ||
var unique = {}; | ||
@@ -373,8 +374,6 @@ options | ||
item.map(function (string) { | ||
var last = variants.length ? variants[variants.length - 1] : {}; | ||
var parts = last.parts ? last.parts.slice(0) : []; | ||
var parts = variants.length ? [].concat( variants[0].parts ) : []; | ||
parts.push(string); | ||
var clone = [].concat( parts ); | ||
var clone = parts.slice(0); | ||
// Attach prefix as required. | ||
@@ -406,7 +405,17 @@ if (typeof prefix !== 'string' && (prefix !== false || typeof prefix === 'undefined') && ((vm || {}).$options || {}).name) { | ||
// Add variants to results. | ||
variants.map(function (variant) { return results.push(variant); }); | ||
variants.map(function (variant) { | ||
// Ensure unique results. | ||
if (unique[variant.pascal]) { | ||
return | ||
} | ||
unique[variant.pascal] = true; | ||
results.push(variant); | ||
}); | ||
}); | ||
// Return globally registered components or all. | ||
return results.filter(function (option) { return option.global || !!all; }) | ||
return results | ||
.filter(function (option) { return option.global || !!all; }) | ||
.sort(function (a, b) { return b.parts.length - a.parts.length; }) | ||
}; | ||
@@ -529,3 +538,3 @@ | ||
var options = druxt.getComponents(this, moduleData.componentOptions, true); | ||
this.component.options = [].concat( new Set(options.map(function (item) { return item.pascal; })) ); | ||
this.component.options = options.map(function (item) { return item.pascal; }); | ||
var available = options.filter(function (item) { return item.global; }); | ||
@@ -532,0 +541,0 @@ if (!available.length) { |
@@ -1,1 +0,1 @@ | ||
var Druxt=function(t,n){"use strict";function e(t,n,e,o,r,a,i,p,s,c){"boolean"!=typeof i&&(s=p,p=i,i=!1);var u,f="function"==typeof e?e.options:e;if(t&&t.render&&(f.render=t.render,f.staticRenderFns=t.staticRenderFns,f._compiled=!0,r&&(f.functional=!0)),o&&(f._scopeId=o),a?(u=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__),n&&n.call(this,s(t)),t&&t._registeredComponents&&t._registeredComponents.add(a)},f._ssrRegister=u):n&&(u=i?function(t){n.call(this,c(t,this.$root.$options.shadowRoot))}:function(t){n.call(this,p(t))}),u)if(f.functional){var d=f.render;f.render=function(t,n){return u.call(n),d(t,n)}}else{var m=f.beforeCreate;f.beforeCreate=m?[].concat(m,u):[u]}return e}var o=e({render:function(){var t=this,n=t.$createElement,e=t._self._c||n;return t.wrapper&&t.wrapper.component?e((t.wrapper||{}).component,t._b({tag:"component"},"component",(t.wrapper||{}).propsData,!1),[e(t.component.is,t._b({tag:"component"},"component",Object.assign({},t.component.propsData,t.$attrs),!1))],1):e(t.component.is,t._b({tag:"component"},"component",Object.assign({},t.component.propsData,t.$attrs),!1))},staticRenderFns:[]},undefined,{name:"Druxt",props:{module:{type:String,required:!0},propsData:{type:Object,default:function(){return{}}},wrapper:{type:[Object,Boolean],default:function(){return{component:"div",propsData:{}}}}},data:function(){return{component:{is:void 0,propsData:{}}}},created:function(){this.setModuleComponent()},methods:{setModuleComponent:function(){var t="Druxt"+this.module.split("-").map((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})).join("");this.$options.components[t]&&(this.component.is=t,this.component.propsData=this.propsData)}}},undefined,false,undefined,!1,void 0,void 0,void 0),r=e({render:function(){var t=this,n=t.$createElement;return(t._self._c||n)("div",[t._t("default")],2)},staticRenderFns:[]},undefined,{name:"DruxtWrapper"},undefined,false,undefined,!1,void 0,void 0,void 0),a=function(){};a.prototype.getComponents=function(t,n,e,o){void 0===e&&(e=!1);var r=[];return n.filter((function(t){return Array.isArray(t)})).map((function(n){var e=[];n.map((function(n){var r=e.length?e[e.length-1]:{},a=r.parts?r.parts.slice(0):[];a.push(n);var i=a.slice(0);"string"==typeof o||!1===o&&void 0!==o||!((t||{}).$options||{}).name||(o=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),o&&i.unshift(o);var p=i.map((function(t){return t.toLowerCase().replace(/--|_/g,"-")})).join("-"),s=p.replace(/((\b|[^a-zA-Z0-9]+)[a-zA-Z0-9])/gi,(function(t,n,e){return t.toUpperCase().replace(e,"")})),c=!1;for(var u of[p,s])if(void 0!==(((t||{}).$options||{}).components||{})[u]){c=!0;break}e.unshift({global:c,kebab:p,parts:a,pascal:s,prefix:o})})),e.map((function(t){return r.push(t)}))})),r.filter((function(t){return t.global||!!e}))},a.prototype.getModuleData=async function(t){if("function"!=typeof((t||{}).$options||{}).druxt)return!1;var n=await t.$options.druxt({vm:t});return(t.$options||{}).name&&(n.name=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),n};var i={components:{DruxtWrapper:r},data:function(){return{component:{is:"DruxtWrapper",options:[],propsData:{}}}},fetch:async function(){var t=new a,n=await t.getModuleData(this);if(n.componentOptions){var e=t.getComponents(this,n.componentOptions,!0);this.component.options=[].concat(new Set(e.map((function(t){return t.pascal}))));var o=e.filter((function(t){return t.global}));o.length&&(this.component.is=o[0].pascal,this.component.propsData=n.propsData||{})}}};return t.Druxt=o,t.DruxtClass=a,t.DruxtComponentMixin=i,t.DruxtWrapper=r,t.default=function(t){void 0===t&&(t={});var e=Object.assign({},t,(this.options||{}).druxt);this.addPlugin({src:n.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt.js",options:e})},t}({},path); | ||
var Druxt=function(t,n){"use strict";function e(t,n,e,o,r,a,i,p,s,c){"boolean"!=typeof i&&(s=p,p=i,i=!1);var u,f="function"==typeof e?e.options:e;if(t&&t.render&&(f.render=t.render,f.staticRenderFns=t.staticRenderFns,f._compiled=!0,r&&(f.functional=!0)),o&&(f._scopeId=o),a?(u=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__),n&&n.call(this,s(t)),t&&t._registeredComponents&&t._registeredComponents.add(a)},f._ssrRegister=u):n&&(u=i?function(t){n.call(this,c(t,this.$root.$options.shadowRoot))}:function(t){n.call(this,p(t))}),u)if(f.functional){var d=f.render;f.render=function(t,n){return u.call(n),d(t,n)}}else{var l=f.beforeCreate;f.beforeCreate=l?[].concat(l,u):[u]}return e}var o=e({render:function(){var t=this,n=t.$createElement,e=t._self._c||n;return t.wrapper&&t.wrapper.component?e((t.wrapper||{}).component,t._b({tag:"component"},"component",(t.wrapper||{}).propsData,!1),[e(t.component.is,t._b({tag:"component"},"component",Object.assign({},t.component.propsData,t.$attrs),!1))],1):e(t.component.is,t._b({tag:"component"},"component",Object.assign({},t.component.propsData,t.$attrs),!1))},staticRenderFns:[]},undefined,{name:"Druxt",props:{module:{type:String,required:!0},propsData:{type:Object,default:function(){return{}}},wrapper:{type:[Object,Boolean],default:function(){return{component:"div",propsData:{}}}}},data:function(){return{component:{is:void 0,propsData:{}}}},created:function(){this.setModuleComponent()},methods:{setModuleComponent:function(){var t="Druxt"+this.module.split("-").map((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})).join("");this.$options.components[t]&&(this.component.is=t,this.component.propsData=this.propsData)}}},undefined,false,undefined,!1,void 0,void 0,void 0),r=e({render:function(){var t=this,n=t.$createElement;return(t._self._c||n)("div",[t._t("default")],2)},staticRenderFns:[]},undefined,{name:"DruxtWrapper"},undefined,false,undefined,!1,void 0,void 0,void 0),a=function(){};a.prototype.getComponents=function(t,n,e,o){void 0===e&&(e=!1);var r=[],a={};return n.filter((function(t){return Array.isArray(t)})).map((function(n){var e=[];n.map((function(n){var r=e.length?[].concat(e[0].parts):[];r.push(n);var a=[].concat(r);"string"==typeof o||!1===o&&void 0!==o||!((t||{}).$options||{}).name||(o=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),o&&a.unshift(o);var i=a.map((function(t){return t.toLowerCase().replace(/--|_/g,"-")})).join("-"),p=i.replace(/((\b|[^a-zA-Z0-9]+)[a-zA-Z0-9])/gi,(function(t,n,e){return t.toUpperCase().replace(e,"")})),s=!1;for(var c of[i,p])if(void 0!==(((t||{}).$options||{}).components||{})[c]){s=!0;break}e.unshift({global:s,kebab:i,parts:r,pascal:p,prefix:o})})),e.map((function(t){a[t.pascal]||(a[t.pascal]=!0,r.push(t))}))})),r.filter((function(t){return t.global||!!e})).sort((function(t,n){return n.parts.length-t.parts.length}))},a.prototype.getModuleData=async function(t){if("function"!=typeof((t||{}).$options||{}).druxt)return!1;var n=await t.$options.druxt({vm:t});return(t.$options||{}).name&&(n.name=t.$options.name.match(/[A-Z][a-z]+/g).map((function(t){return t.toLowerCase()})).join("-")),n};var i={components:{DruxtWrapper:r},data:function(){return{component:{is:"DruxtWrapper",options:[],propsData:{}}}},fetch:async function(){var t=new a,n=await t.getModuleData(this);if(n.componentOptions){var e=t.getComponents(this,n.componentOptions,!0);this.component.options=e.map((function(t){return t.pascal}));var o=e.filter((function(t){return t.global}));o.length&&(this.component.is=o[0].pascal,this.component.propsData=n.propsData||{})}}};return t.Druxt=o,t.DruxtClass=a,t.DruxtComponentMixin=i,t.DruxtWrapper=r,t.default=function(t){void 0===t&&(t={});var e=Object.assign({},t,(this.options||{}).druxt);this.addPlugin({src:n.resolve(__dirname,"../nuxt/plugin.js"),fileName:"druxt.js",options:e})},t}({},path); |
@@ -348,2 +348,3 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var path=require('path');// | ||
var results = []; | ||
var unique = {}; | ||
@@ -359,8 +360,6 @@ options | ||
item.map(function (string) { | ||
var last = variants.length ? variants[variants.length - 1] : {}; | ||
var parts = last.parts ? last.parts.slice(0) : []; | ||
var parts = variants.length ? [].concat( variants[0].parts ) : []; | ||
parts.push(string); | ||
var clone = [].concat( parts ); | ||
var clone = parts.slice(0); | ||
// Attach prefix as required. | ||
@@ -392,7 +391,17 @@ if (typeof prefix !== 'string' && (prefix !== false || typeof prefix === 'undefined') && ((vm || {}).$options || {}).name) { | ||
// Add variants to results. | ||
variants.map(function (variant) { return results.push(variant); }); | ||
variants.map(function (variant) { | ||
// Ensure unique results. | ||
if (unique[variant.pascal]) { | ||
return | ||
} | ||
unique[variant.pascal] = true; | ||
results.push(variant); | ||
}); | ||
}); | ||
// Return globally registered components or all. | ||
return results.filter(function (option) { return option.global || !!all; }) | ||
return results | ||
.filter(function (option) { return option.global || !!all; }) | ||
.sort(function (a, b) { return b.parts.length - a.parts.length; }) | ||
}; | ||
@@ -513,3 +522,3 @@ | ||
var options = druxt.getComponents(this, moduleData.componentOptions, true); | ||
this.component.options = [].concat( new Set(options.map(function (item) { return item.pascal; })) ); | ||
this.component.options = options.map(function (item) { return item.pascal; }); | ||
var available = options.filter(function (item) { return item.global; }); | ||
@@ -516,0 +525,0 @@ if (!available.length) { |
{ | ||
"name": "druxt", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "A Bridge between frameworks, NuxtJS in the front, Drupal in the back.", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39136
1009