Socket
Socket
Sign inDemoInstall

@bva/vue-sticky-directive

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bva/vue-sticky-directive - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

4

package.json
{
"name": "@bva/vue-sticky-directive",
"version": "0.1.3",
"version": "0.1.4",
"description": "Vue directive to enable sticky scrolling on navigation elements such as headers and sidebars.",

@@ -24,3 +24,3 @@ "main": "vue-sticky-directive.js",

"dependencies": {
"@bva/stickie": "^0.1.1"
"@bva/stickie": "^0.1.2"
},

@@ -27,0 +27,0 @@ "devDependencies": {

import Stickie from "@bva/stickie";
/**
* Type verify the `newOpts` argument before merging it with `oldOpts`.
*/
export const mergeOptions = (oldOpts, newOpts) => {
if (typeof newOpts === "undefined" || typeof newOpts === "object") {
return { ...oldOpts, ...newOpts };
} else {
console.warn(
"v-sticky binding must be an object, fallback to previous option set."
);
return oldOpts;
}
const DEFAULTS = {
contained: false,
classScope: "sticky",
eventScope: "sticky",
};
const Sticky = (options = {}) => {
const DEFAULTS = options.DEFAULTS || {
container: false,
classScope: "sticky",
eventScope: "sticky",
};
return {
inserted(el, binding, vnode) {
const mergedOptions = mergeOptions(DEFAULTS, binding.value);
vnode.context.$nextTick(() => {
new Stickie(el, mergedOptions);
new Stickie(el, { ...DEFAULTS, ...binding.value });
});

@@ -32,0 +15,0 @@ },

@@ -37,12 +37,2 @@ (function (global, factory) {

function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
function _defineProperty(obj, key, value) {

@@ -63,27 +53,13 @@ if (key in obj) {

/**
* Type verify the `newOpts` argument before merging it with `oldOpts`.
*/
var mergeOptions = function mergeOptions(oldOpts, newOpts) {
if (typeof newOpts === "undefined" || _typeof(newOpts) === "object") {
return _objectSpread2(_objectSpread2({}, oldOpts), newOpts);
} else {
console.warn("v-sticky binding must be an object, fallback to previous option set.");
return oldOpts;
}
var DEFAULTS = {
contained: false,
classScope: "sticky",
eventScope: "sticky"
};
var Sticky = function Sticky() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var DEFAULTS = options.DEFAULTS || {
container: false,
classScope: "sticky",
eventScope: "sticky"
};
return {
inserted: function inserted(el, binding, vnode) {
var mergedOptions = mergeOptions(DEFAULTS, binding.value);
vnode.context.$nextTick(function () {
new Stickie__default["default"](el, mergedOptions);
new Stickie__default["default"](el, _objectSpread2(_objectSpread2({}, DEFAULTS), binding.value));
});

@@ -90,0 +66,0 @@ },

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