@afeefa/vue-app 0.0.152 → 0.0.154

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 +1 @@
1
- 0.0.152
1
+ 0.0.154
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.152",
3
+ "version": "0.0.154",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@ import { randomCssClass } from '@a-vue/utils/random'
13
13
  import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
14
14
 
15
15
  @Component({
16
- props: [{show: false}, 'beforeClose']
16
+ props: [{show: false}, 'beforeClose', 'width']
17
17
  })
18
18
  export default class FlyingContext extends Mixins(CancelOnEscMixin) {
19
19
  isVisible = false
@@ -43,7 +43,14 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
43
43
  }
44
44
 
45
45
  if (this.isVisible) {
46
- const container = this.getSidebarContainer()
46
+ const containerContainer = this.getFlyingContextContainer()
47
+ if (this.width) {
48
+ containerContainer.style.width = this.width
49
+ } else {
50
+ containerContainer.style.width = '50vw'
51
+ }
52
+
53
+ const container = this.getChildrenContainer()
47
54
  container.appendChild(el)
48
55
  this.coe_watchCancel() // show context -> watch esc
49
56
  } else {
@@ -53,7 +60,7 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
53
60
  }
54
61
 
55
62
  destroyed () {
56
- const container = this.getSidebarContainer()
63
+ const container = this.getChildrenContainer()
57
64
  const el = this.getContent()
58
65
  if (container.contains(el)) {
59
66
  container.removeChild(el)
@@ -87,7 +94,11 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
87
94
  return document.querySelector('.' + this.contextId)
88
95
  }
89
96
 
90
- getSidebarContainer () {
97
+ getFlyingContextContainer () {
98
+ return document.getElementById('flyingContextContainer')
99
+ }
100
+
101
+ getChildrenContainer () {
91
102
  return document.getElementById('flyingContextContainer__children')
92
103
  }
93
104
  }
@@ -32,6 +32,7 @@ import { getZIndex } from 'vuetify/lib/util/helpers'
32
32
  })
33
33
  export default class FlyingContextContainer extends Vue {
34
34
  visible = false
35
+ oldOverflowY = null
35
36
 
36
37
  mounted () {
37
38
  this.mutationWatcher = new MutationObserver(this.domChanged)
@@ -40,14 +41,42 @@ export default class FlyingContextContainer extends Vue {
40
41
  window.addEventListener('mousedown', this.onClickOutside)
41
42
  }
42
43
 
44
+ getScrollbarWidth () {
45
+ const el = document.documentElement
46
+ const overflowY = getComputedStyle(el)['overflow-y']
47
+ if (overflowY === 'scroll' || (overflowY === 'auto' && el.scrollHeight > el.clientHeight)) {
48
+ // measure scrollbar width https://stackoverflow.com/a/55278118
49
+ const scrollbox = document.createElement('div')
50
+ scrollbox.style.overflow = 'scroll'
51
+ document.body.appendChild(scrollbox)
52
+ const scrollBarWidth = scrollbox.offsetWidth - scrollbox.clientWidth
53
+ document.body.removeChild(scrollbox)
54
+ return scrollBarWidth
55
+ }
56
+ return 0
57
+ }
58
+
43
59
  domChanged () {
44
60
  const container = this.getChildrenContainer()
45
61
  this.visible = !!container.children.length
46
62
 
63
+ const el = document.documentElement
64
+
47
65
  if (this.visible) {
48
- document.documentElement.style.overflow = 'hidden'
66
+ const style = getComputedStyle(el)
67
+ this.oldOverflowY = style.overflowY
68
+ const scrollbarWidth = this.getScrollbarWidth()
69
+ setTimeout(() => {
70
+ el.style.overflowY = 'hidden'
71
+ el.style.marginRight = scrollbarWidth + 'px'
72
+ }, 100)
73
+
74
+ this.$el.style.left = (el.offsetWidth - this.$el.offsetWidth + scrollbarWidth) + 'px'
49
75
  } else {
50
- document.documentElement.style.overflow = 'auto'
76
+ el.style.overflowY = this.oldOverflowY
77
+ el.style.marginRight = 0
78
+
79
+ this.$el.style.left = '101vw'
51
80
  }
52
81
  }
53
82
 
@@ -94,19 +123,20 @@ export default class FlyingContextContainer extends Vue {
94
123
  #flyingContextContainer {
95
124
  position: fixed;
96
125
  z-index: 200;
97
- right: 0;
126
+ left: 50vw;
98
127
  height: 100%;
128
+ width: 50vw;
99
129
  min-width: 400px;
100
130
  max-width: calc(100vw - 100px);
101
131
  top: 0;
102
132
  background: white;
103
- transition: right .2s;
133
+ transition: left .2s;
104
134
  padding: 2rem;
105
135
  overflow-y: auto;
106
136
  border-left: 1px solid rgba(0, 0, 0, .12);
107
137
 
108
138
  &:not(.visible) {
109
- right: -80vw;
139
+ left: 101vw;
110
140
  }
111
141
 
112
142
  .closeButton {
@@ -1,3 +1,7 @@
1
+ html {
2
+ overflow-y: auto; // ress.css • v2.0.4 sets overflow-y: scroll
3
+ }
4
+
1
5
  .container {
2
6
  padding: 0;
3
7
  }