@neovici/cosmoz-bottom-bar 4.1.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,8 @@
1
1
  import { component } from 'haunted';
2
2
  import { html } from 'lit-html';
3
3
  import { ifDefined } from 'lit-html/directives/if-defined';
4
- import { ref } from '@neovici/cosmoz-utils/lib/directives/ref';
5
- import { useBottomBarView } from './lib/use-bottom-bar-view';
6
4
  import { bottomBarSlots } from './cosmoz-bottom-bar';
7
5
 
8
-
9
-
10
6
  /**
11
7
  * `cosmoz-bottom-bar-view` contains a content section and a bottom bar with actions.
12
8
  *
@@ -18,49 +14,41 @@ import { bottomBarSlots } from './cosmoz-bottom-bar';
18
14
  */
19
15
 
20
16
  const CosmozBottomBarView = ({
21
- barHeight,
22
- ...pass
23
- }) => { /*eslint-disable no-return-assign */
24
- const {
25
- active,
26
- info
27
- } = useBottomBarView(pass);
28
-
29
- return html`
30
- <style>
31
- :host {
32
- position: relative;
33
- display: flex;
34
- flex-direction: column;
35
- flex: var(--cosmoz-bottom-bar-view-flex, auto);
36
- overflow: hidden;
37
- }
38
-
39
- #content {
40
- display: flex;
41
- flex-direction: column;
42
- flex: auto;
43
- -webkit-overflow-scrolling: touch;
44
- overflow-y: auto;
45
- }
46
-
47
- #bar {
48
- background-color: var(--cosmoz-bottom-bar-view-bar-color, rgba(230, 230, 230, 0.8));
49
- box-shadow: var(--cosmoz-bottom-bar-view-bar-shadow, none);
50
- position: static;
51
- flex: none;
52
- }
53
- </style>
54
- <div id="content" part="content">
55
- ${ ref(info) }
56
- <slot name="content"></slot>
57
- <slot name="scroller-content"></slot>
58
- </div>
59
- <cosmoz-bottom-bar id="bar" ?active=${ active } bar-height=${ ifDefined(barHeight) } part="bar">
60
- <slot></slot>
61
- ${ bottomBarSlots }
62
- </cosmoz-bottom-bar>
63
- `;
64
- };
17
+ active = true,
18
+ barHeight
19
+ }) => html`
20
+ <style>
21
+ :host {
22
+ position: relative;
23
+ display: flex;
24
+ flex-direction: column;
25
+ flex: var(--cosmoz-bottom-bar-view-flex, auto);
26
+ overflow: hidden;
27
+ }
28
+
29
+ #content {
30
+ display: flex;
31
+ flex-direction: column;
32
+ flex: auto;
33
+ -webkit-overflow-scrolling: touch;
34
+ overflow-y: auto;
35
+ }
36
+
37
+ #bar {
38
+ background-color: var(--cosmoz-bottom-bar-view-bar-color, rgba(230, 230, 230, 0.8));
39
+ box-shadow: var(--cosmoz-bottom-bar-view-bar-shadow, none);
40
+ position: static;
41
+ flex: none;
42
+ }
43
+ </style>
44
+ <div id="content" part="content">
45
+ <slot name="content"></slot>
46
+ <slot name="scroller-content"></slot>
47
+ </div>
48
+ <cosmoz-bottom-bar id="bar" ?active=${ active } bar-height=${ ifDefined(barHeight) } part="bar">
49
+ <slot></slot>
50
+ ${ bottomBarSlots }
51
+ </cosmoz-bottom-bar>
52
+ `;
65
53
  customElements.define('cosmoz-bottom-bar-view', component(CosmozBottomBarView));
66
54
 
@@ -103,7 +103,7 @@ export default html`
103
103
  }
104
104
  </style>
105
105
 
106
- <div id="bar" style$="[[ _getHeightStyle(computedBarHeight) ]]">
106
+ <div id="bar" style$="[[ _getHeightStyle(computedBarHeight) ]]" part="bar">
107
107
  <div id="info">
108
108
  <slot name="info"></slot>
109
109
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-bottom-bar",
3
- "version": "4.1.1",
3
+ "version": "4.2.0",
4
4
  "description": "A responsive bottom-bar that can house buttons/actions and a menu for the buttons that won't fit the available width.",
5
5
  "keywords": [
6
6
  "polymer",
@@ -51,8 +51,7 @@
51
51
  ]
52
52
  },
53
53
  "dependencies": {
54
- "@neovici/cosmoz-utils": "^3.12.0",
55
- "@neovici/cosmoz-viewinfo": "^3.1.3",
54
+ "@neovici/cosmoz-utils": "^3.21.0",
56
55
  "@polymer/iron-icons": "^3.0.1",
57
56
  "@polymer/iron-selector": "^3.0.0",
58
57
  "@polymer/paper-icon-button": "^3.0.0",
@@ -64,22 +63,21 @@
64
63
  "lit-html": "^1.4.0"
65
64
  },
66
65
  "devDependencies": {
67
- "@commitlint/cli": "^12.0.0",
68
- "@commitlint/config-conventional": "^12.0.0",
66
+ "@commitlint/cli": "^15.0.0",
67
+ "@commitlint/config-conventional": "^15.0.0",
69
68
  "@neovici/eslint-config": "^1.3.0",
70
69
  "@open-wc/testing": "^2.5.0",
71
70
  "@polymer/iron-icon": "^3.0.1",
72
71
  "@polymer/paper-button": "^3.0.0",
73
72
  "@polymer/paper-toggle-button": "^3.0.0",
74
- "@semantic-release/changelog": "^5.0.0",
75
- "@semantic-release/git": "^9.0.0",
76
- "@web/dev-server": "^0.1.17",
73
+ "@semantic-release/changelog": "^6.0.0",
74
+ "@semantic-release/git": "^10.0.0",
75
+ "@web/dev-server": "^0.1.0",
77
76
  "@web/test-runner": "^0.13.0",
78
77
  "@web/test-runner-selenium": "^0.5.0",
79
78
  "@webcomponents/webcomponentsjs": "^2.5.0",
80
- "eslint": "^7.0.0",
81
- "husky": "^6.0.0",
82
- "semantic-release": "^17.4.0",
83
- "sinon": "^11.0.0"
79
+ "husky": "^7.0.0",
80
+ "semantic-release": "^18.0.0",
81
+ "sinon": "^12.0.0"
84
82
  }
85
83
  }
@@ -1,62 +0,0 @@
1
- import {
2
- useEffect,
3
- useState,
4
- useMemo
5
- } from 'haunted';
6
- import { useViewInfo } from '@neovici/cosmoz-viewinfo';
7
-
8
- const useBottomBarView = ({
9
- active: initialActive = true,
10
- fixed
11
- }) => { /* eslint-disable no-return-assign */
12
- const { desktop } = useViewInfo(),
13
- isFixed = fixed ?? desktop,
14
- [active, setActive] = useState(initialActive),
15
- info = useMemo(() => ({}), []);
16
-
17
- useEffect(() => {
18
- if (isFixed) {
19
- return;
20
- }
21
- const
22
- { current: el } = info,
23
- opts = { passive: true },
24
- onScroll = () => {
25
- if (info.raf) {
26
- cancelAnimationFrame(info.raf);
27
- }
28
- info.raf = requestAnimationFrame(() => info.raf = requestAnimationFrame(() => {
29
- const { scrollTop } = el;
30
- setActive(
31
- scrollTop < 2 // at top
32
- || info.scrollTop > scrollTop // scrolling up
33
- || el.scrollHeight - scrollTop - el.offsetHeight < 3 // at bottom
34
- );
35
- Object.assign(info, {
36
- scrollTop,
37
- raf: undefined
38
- });
39
- }));
40
- };
41
- el.addEventListener('scroll', onScroll, opts);
42
- onScroll();
43
- return () => {
44
- el.removeEventListener('scroll', onScroll, opts);
45
- if (info.raf) {
46
- cancelAnimationFrame(info.raf);
47
- info.raf = undefined;
48
- }
49
- };
50
- }, [isFixed, info]);
51
-
52
- useEffect(() => {
53
- setActive(initialActive);
54
- }, [initialActive, setActive]);
55
-
56
- return {
57
- active,
58
- info
59
- };
60
- };
61
-
62
- export { useBottomBarView };