Socket
Socket
Sign inDemoInstall

@neovici/cosmoz-bottom-bar

Package Overview
Dependencies
Maintainers
4
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neovici/cosmoz-bottom-bar - npm Package Compare versions

Comparing version 3.0.6 to 3.0.9

cc-test-reporter

7

CHANGELOG.md

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

## [3.0.9](https://github.com/neovici/cosmoz-bottom-bar/compare/v3.0.8...v3.0.9) (2020-01-10)
### Bug Fixes
* correct package version ([9132345](https://github.com/neovici/cosmoz-bottom-bar/commit/9132345))
## [3.0.5](https://github.com/neovici/cosmoz-bottom-bar/compare/v3.0.4...v3.0.5) (2019-10-10)

@@ -2,0 +9,0 @@

43

cosmoz-bottom-bar-view.js

@@ -7,8 +7,7 @@ import '@webcomponents/shadycss/entrypoints/apply-shim';

import { html } from '@polymer/polymer/lib/utils/html-tag';
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior';
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class';
import { microTask } from '@polymer/polymer/lib/utils/async';
import { viewInfoAware } from '@neovici/cosmoz-viewinfo';
import { viewInfoAware } from '@neovici/cosmoz-viewinfo';
import './cosmoz-bottom-bar';

@@ -82,12 +81,5 @@

return {
/**
* Height of the bar
*/
barHeight: {
type: Number
},
/**
* When set to true, activate the bottom bar.
*/
* When set to true, activate the bottom bar.
*/
active: {

@@ -100,4 +92,11 @@ type: Boolean,

/**
* Set to true to have a fixed bottom that does not disappear upon scrolling.
*/
* Height of the bar
*/
barHeight: {
type: Number
},
/**
* Set to true to have a fixed bottom that does not disappear upon scrolling.
*/
fixed: {

@@ -168,2 +167,11 @@ type: Boolean,

_computeFixed(fixed, desktop) {
return fixed == null ? desktop : fixed;
}
_computeScrollerContentStyle(barHeight, bottomBarVisible) {
microTask.run(() => this.notifyResize());
return `padding-bottom: ${bottomBarVisible ? barHeight : 0}px`;
}
_scrollManagement() {

@@ -180,13 +188,4 @@ const scrollTop = this._scroller.scrollTop,

}
_computeScrollerContentStyle(barHeight, bottomBarVisible) {
microTask.run(() => this.notifyResize());
return `padding-bottom: ${bottomBarVisible ? barHeight : 0}px`;
}
_computeFixed(fixed, desktop) {
return fixed == null ? desktop : fixed;
}
}
customElements.define(CosmozBottomBarView.is, CosmozBottomBarView);

@@ -12,3 +12,2 @@ /* eslint-disable max-lines */

import { html } from '@polymer/polymer/lib/utils/html-tag';
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer';

@@ -99,3 +98,2 @@ import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';

#menu {
padding-right: 3%;
@apply --layout-center;

@@ -183,4 +181,4 @@ @apply --layout-horizontal;

/**
* Whether the bar is active (shown)
*/
* Whether the bar is active (shown)
*/
active: {

@@ -194,4 +192,4 @@ type: Boolean,

/**
* Bar height (not used when `matchParent` or `matchElementHeight` is set)
*/
* Bar height (not used when `matchParent` or `matchElementHeight` is set)
*/
barHeight: {

@@ -203,4 +201,4 @@ type: Number,

/**
* Whether to match the height of parent
*/
* Whether to match the height of parent
*/
matchParent: {

@@ -212,4 +210,4 @@ type: Boolean,

/**
* Whether this bottom bar has items distributed to the menu
*/
* Whether this bottom bar has items distributed to the menu
*/
hasMenuItems: {

@@ -228,4 +226,4 @@ type: Boolean,

/**
* Class applied the the selected item
*/
* Class applied the the selected item
*/
selectedClass: {

@@ -237,4 +235,4 @@ type: String,

/**
* Class applied to items distributed to the toolbar
*/
* Class applied to items distributed to the toolbar
*/
toolbarClass: {

@@ -246,4 +244,4 @@ type: String,

/**
* Class applied to items distributed to the menu
*/
* Class applied to items distributed to the menu
*/
menuClass: {

@@ -255,4 +253,4 @@ type: String,

/**
* Maximum number of items in toolbar, regardless of space
*/
* Maximum number of items in toolbar, regardless of space
*/
maxToolbarItems: {

@@ -264,4 +262,4 @@ type: Number,

/**
* The actual bar height, depending on if we `matchParent` or set `barHeight`
*/
* The actual bar height, depending on if we `matchParent` or set `barHeight`
*/
computedBarHeight: {

@@ -274,4 +272,4 @@ type: Number,

/**
* Kicker to make `computedBarHeight` recalculate
*/
* Kicker to make `computedBarHeight` recalculate
*/
_computedBarHeightKicker: {

@@ -282,4 +280,4 @@ type: Number

/**
* Whether the bar is visible (has actions and is `active`)
*/
* Whether the bar is visible (has actions and is `active`)
*/
visible: {

@@ -293,4 +291,4 @@ type: Boolean,

/**
* Whether we have any visible actions
*/
* Whether we have any visible actions
*/
hasActions: {

@@ -304,4 +302,4 @@ type: Boolean,

/**
* Reference element from which to inherit height
*/
* Reference element from which to inherit height
*/
_matchHeightElement: {

@@ -357,55 +355,10 @@ type: Object,

_computeVisible(hasActions, active, hasExtraItems) {
return (hasActions || hasExtraItems) && active;
}
_canAddMoreButtonToBar(width, bottomBarElements, menuElements) {
const hasSpace = width > this._overflowWidth || this._overflowWidth === undefined,
hasPlace = bottomBarElements.length < this.maxToolbarItems,
hasCandidates = menuElements.length > 0;
_getHeightMatchingElement(matchParent) {
if (matchParent) {
return this.parentElement;
}
return null;
return hasSpace && hasPlace && hasCandidates;
}
// eslint-disable-next-line no-unused-vars
_computeComputedBarHeight(matchElementHeight, barHeight, kicker) {
if (matchElementHeight) {
return matchElementHeight.offsetHeight;
}
return barHeight;
}
_getHeightStyle(height) {
return 'height: ' + height + 'px;';
}
_onResize() {
this._computedBarHeightKicker += 1;
this._debounceLayoutActions();
}
_showHideBottomBar(visible, barHeight) {
this.style.display = '';
const translateY = visible ? 0 : barHeight,
onEnd = () => {
clearTimeout(this._hideTimeout);
this._hideTimeout = null;
this.style.display = this.visible ? '' : 'none';
};
clearTimeout(this._hideTimeout);
requestAnimationFrame(() => {
this.translate3d('0px', translateY + 'px', '0px');
this._hideTimeout = setTimeout(onEnd, 510);
});
}
_isActionNode(node) {
return node.nodeType === Node.ELEMENT_NODE &&
node.getAttribute('slot') !== 'info' &&
node.tagName !== 'TEMPLATE' &&
node.tagName !== 'DOM-REPEAT' &&
node.tagName !== 'DOM-IF' &&
node.getAttribute('slot') !== 'extra';
}
_childrenUpdated(info) {

@@ -439,11 +392,23 @@ const addedNodes = info.addedNodes.filter(this._isActionNode),

_toolbarMoveToStart(node) {
const toolbar = this.$.toolbar;
if (toolbar.children.length === 0) {
toolbar.appendChild(node);
return;
// eslint-disable-next-line no-unused-vars
_computeComputedBarHeight(matchElementHeight, barHeight, kicker) {
if (matchElementHeight) {
return matchElementHeight.offsetHeight;
}
toolbar.insertBefore(node, toolbar.children[0]);
return barHeight;
}
_computeVisible(hasActions, active, hasExtraItems) {
return (hasActions || hasExtraItems) && active;
}
_debounceLayoutActions() {
this._layoutDebouncer = Debouncer.debounce(
this._layoutDebouncer,
timeOut.after(30),
this._boundLayoutActions
);
enqueueDebouncer(this._layoutDebouncer);
}
_dropdownClosed() {

@@ -453,2 +418,38 @@ this.$.dropdownButton.active = false;

_fireAction(item) {
if (!item || !item.dispatchEvent) {
return;
}
item.dispatchEvent(new window.CustomEvent('action', {
bubbles: true,
cancelable: true,
detail: {
item
}
}));
}
_getHeightMatchingElement(matchParent) {
if (matchParent) {
return this.parentElement;
}
return null;
}
_getHeightStyle(height) {
return 'height: ' + height + 'px;';
}
_isActionNode(node) {
return node.nodeType === Node.ELEMENT_NODE &&
node.getAttribute('slot') !== 'info' &&
node.tagName !== 'TEMPLATE' &&
node.tagName !== 'DOM-REPEAT' &&
node.tagName !== 'DOM-IF' &&
node.getAttribute('slot') !== 'extra';
}
/**

@@ -547,37 +548,34 @@ * Layout the actions available as buttons or menu items

_debounceLayoutActions() {
this._layoutDebouncer = Debouncer.debounce(
this._layoutDebouncer,
timeOut.after(30),
this._boundLayoutActions
);
enqueueDebouncer(this._layoutDebouncer);
_onActionSelected(event, detail) {
this._fireAction(detail.item);
event.currentTarget.selected = undefined;
}
_canAddMoreButtonToBar(width, bottomBarElements, menuElements) {
const hasSpace = width > this._overflowWidth || this._overflowWidth === undefined,
hasPlace = bottomBarElements.length < this.maxToolbarItems,
hasCandidates = menuElements.length > 0;
return hasSpace && hasPlace && hasCandidates;
_onResize() {
this._computedBarHeightKicker += 1;
this._debounceLayoutActions();
}
_onActionSelected(event, detail) {
this._fireAction(detail.item);
event.currentTarget.selected = undefined;
_showHideBottomBar(visible, barHeight) {
this.style.display = '';
const translateY = visible ? 0 : barHeight,
onEnd = () => {
clearTimeout(this._hideTimeout);
this._hideTimeout = null;
this.style.display = this.visible ? '' : 'none';
};
clearTimeout(this._hideTimeout);
requestAnimationFrame(() => {
this.translate3d('0px', translateY + 'px', '0px');
this._hideTimeout = setTimeout(onEnd, 510);
});
}
_fireAction(item) {
if (!item || !item.dispatchEvent) {
_toolbarMoveToStart(node) {
const toolbar = this.$.toolbar;
if (toolbar.children.length === 0) {
toolbar.appendChild(node);
return;
}
item.dispatchEvent(new window.CustomEvent('action', {
bubbles: true,
cancelable: true,
detail: {
item
}
}));
toolbar.insertBefore(node, toolbar.children[0]);
}

@@ -584,0 +582,0 @@ }

{
"name": "@neovici/cosmoz-bottom-bar",
"version": "3.0.6",
"version": "3.0.9",
"description": "A responsive bottom-bar that can house buttons/actions and a menu for the buttons that won't fit the available width.",

@@ -5,0 +5,0 @@ "keywords": [

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