Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

Commit a799c37

Browse files
authored
Release/v5 (#43)
1 parent 39adea9 commit a799c37

17 files changed

+304
-357
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
22
.idea
33
npm-debug.log*
4-
**/mix-manifest.json
4+
**/mix-manifest.json
5+
test/js/dist/

.npmignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
docs/
2-
src/
31
test/
42
build/
53
.idea

CHANGELOG.md

+44-26
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,60 @@
22

33
All notable changes to this project will be documented here.
44

5+
<a name="5.0.0"></a>
6+
## [5.0.0](https://github.com/rawilk/vue-context/releases/tag/5.0.0)
7+
8+
Released 2019-11-14
9+
10+
### Added
11+
- Add default export in entry point ([#41](https://github.com/rawilk/vue-context/issues/41)).
12+
- Add support for nested context menus ([#37](https://github.com/rawilk/vue-context/pull/37)).
13+
14+
### Changes
15+
- Update entry point to source ([#33](https://github.com/rawilk/vue-context/issues/33)).
16+
- No longer build component with webpack ([#33](https://github.com/rawilk/vue-context/issues/33)).
17+
- Component source is available through npm now, including the sass files.
18+
19+
### Release notes
20+
- Even though there shouldn't be any breaking changes in this release, it's a major release because
21+
breaking changes were introduced in version 4.1.0, which should have been a major release instead.
22+
523
<a name="4.1.1"></a>
624
## [4.1.1](https://github.com/rawilk/vue-context/releases/tag/4.1.1)
725

826
Released 2019-10-20
927

10-
### Bug Fixes 4.1.1
28+
### Bug Fixes
1129
- Fix bug of "Unknown custom element" ([#40](https://github.com/rawilk/vue-context/issues/40)).
1230

1331
<a name="4.1.0"></a>
1432
## [4.1.0](https://github.com/rawilk/vue-context/releases/tag/4.0.3)
1533

1634
Released 2019-10-11
1735

18-
### Breaking Changes 4.1.0
36+
### Breaking Changes
1937
- Move menu styles from js to its own stylesheet ([#36](https://github.com/rawilk/vue-context/issues/36))
2038

21-
### Changes 4.1.0
39+
### Changes
2240
- Remove core-js as a dependency in favor of local polyfills for a smaller build size ([#33](https://github.com/rawilk/vue-context/issues/33))
2341

2442
<a name="4.0.3"></a>
2543
## [4.0.3](https://github.com/rawilk/vue-context/releases/tag/4.0.3)
2644

2745
Released 2019-07-28
2846

29-
### Bug Fixes 4.0.3
47+
### Bug Fixes
3048
- Make `localItemSelector` reactive to changes from `itemSelector` prop ([#30](https://github.com/rawilk/vue-context/issues/30)).
3149

32-
### Updates 4.0.3
50+
### Updates
3351
- Update dev dependencies
3452

3553
<a name="4.0.2"></a>
3654
## [4.0.2](https://github.com/rawilk/vue-context/releases/tag/4.0.2)
3755

3856
Released 2019-06-22
3957

40-
### Bug Fixes 4.0.2
58+
### Bug Fixes
4159
- Fix menu item width issues ([#26](https://github.com/rawilk/vue-context/issues/26)).
4260
- Remove outline from menu and menu items when given focus ([#26](https://github.com/rawilk/vue-context/issues/26)).
4361

@@ -46,25 +64,25 @@ Released 2019-06-22
4664

4765
Released 2019-06-03
4866

49-
### Bug Fixes 4.0.1
67+
### Bug Fixes
5068
- Always emit the close event on click. See issue [#23](https://github.com/rawilk/vue-context/issues/23)
5169

5270
<a name="4.0.0"></a>
5371
## [4.0.0](https://github.com/rawilk/vue-context/releases/tag/4.0.0)
5472

5573
Released 2019-05-18
5674

57-
### Added 4.0.0
75+
### Added
5876
- Added support for keyboard navigation (up and down arrows).
5977
- Added ability to close menu on esc.
6078
- Added `lazy` prop as an alternative to `v-show`.
6179
- Added `tag` prop to specify menu tag (defaults to `<ul>`).
6280

63-
### Changes 4.0.0
81+
### Changes
6482
- Default menu tag is now `<ul>` and menu is now the top-level element.
6583
- Changed how the menu is styled.
6684

67-
### Updates 4.0.0
85+
### Updates
6886
- Updated build process and project structure.
6987
- Ran `npm audit fix` to fix vulnerabilities found from dependencies.
7088

@@ -73,15 +91,15 @@ Released 2019-05-18
7391

7492
Released 2019-04-05
7593

76-
### Bug Fixes 3.4.2
94+
### Bug Fixes
7795
- Only add scroll event listener on `closeOnScroll` prop value change if the menu is open.
7896

7997
<a name="3.4.1"></a>
8098
## [3.4.1](https://github.com/rawilk/vue-context/releases/tag/3.4.1)
8199

82100
Released 2019-04-03
83101

84-
### Updates 3.4.1
102+
### Updates
85103
- **Scroll Listener:** Only attach the close scroll event listener when opened and immediately remove it when menu is closed
86104
to prevent it being called unnecessarily.
87105
- **Dependencies:** Removed Vue as a dependency as it never really was one since v3.0.0.
@@ -92,42 +110,42 @@ to prevent it being called unnecessarily.
92110

93111
Released 2018-11-19
94112

95-
### Bug fixes 3.4.0
113+
### Bug fixes
96114
- **Close event:** only emit the event if menu is actually open (fixes [#13](https://github.com/rawilk/vue-context/issues/13))
97115

98116
<a name="3.3.1"></a>
99117
## [3.3.1](https://github.com/rawilk/vue-context/releases/tag/3.3.1)
100118

101119
Released 2018-10-23
102120

103-
### Changes 3.3.1
121+
### Changes
104122
- Context menu now closes via [clickaway](https://github.com/simplesmiler/vue-clickaway) instead of a blur event. Credit: [robjbrain](https://github.com/robjbrain)
105123

106-
### Updates 3.3.1
124+
### Updates
107125
- Updated vue and other dev dependencies.
108126

109127
<a name="3.3.0"></a>
110128
## [3.3.0](https://github.com/rawilk/vue-context/releases/tag/3.3.0)
111129

112130
Released 2018-10-15
113131

114-
### Features 3.3.0
132+
### Features
115133
- **Events:** both open and close events are now emitted by the component. ([#10](https://github.com/rawilk/vue-context/issues/10))
116134

117135
<a name="3.2.0"></a>
118136
## [3.2.0](https://github.com/rawilk/vue-context/releases/tag/3.2.0)
119137

120138
Released 2018-09-12
121139

122-
### Features 3.2.0
140+
### Features
123141
- **Close on click prop:** added a prop to prevent closing the context menu on click. ([#8](https://github.com/rawilk/vue-context/issues/8))
124142

125143
<a name="3.1.1"></a>
126144
## [3.1.1](https://github.com/rawilk/vue-context/releases/tag/3.1.1)
127145

128146
Released 2018-06-23
129147

130-
### Updates 3.1.1
148+
### Updates
131149
- Updated README.md
132150
- Added code comments
133151

@@ -136,46 +154,46 @@ Released 2018-06-23
136154

137155
Released 2018-05-29
138156

139-
### Features 3.1.0
157+
### Features
140158
- **Scroll prop:** added a prop to close the context menu automatically on window scroll. ([#2](https://github.com/rawilk/vue-context/issues/2))
141159

142160
<a name="3.0.2"></a>
143161
## [3.0.2](https://github.com/rawilk/vue-context/releases/tag/3.0.2)
144162

145163
Released 2018-05-29
146164

147-
### Updates 3.0.2
165+
### Updates
148166
- Updated documentation
149167

150-
### Added 3.0.2
168+
### Added
151169
- Added [demos](https://vue-context.randallwilk.com) for the component.
152170

153171
<a name="3.0.0"></a>
154172
## [3.0.0](https://github.com/rawilk/vue-context/releases/tag/3.0.0)
155173

156174
Released 2018-05-26
157175

158-
### Breaking changes 3.0.0
176+
### Breaking changes
159177
- Changed slot scope definition from `userData` to just `data`.
160178
- Component gets imported as `{ VueContext }` instead of `VContext` now.
161179

162-
### Updates 3.0.0
180+
### Updates
163181
- Updated dependencies
164182
- Updated documentation
165183

166-
### Changes 3.0.0
184+
### Changes
167185
- Changed code structure and build process.
168186

169187
<a name="2.0.1"></a>
170188
## [2.0.1](https://github.com/rawilk/vue-context/releases/tag/2.0.1)
171189

172190
Released 2017-08-18
173191

174-
### Added 2.0.1
192+
### Added
175193
- License file
176194
- Changelog file
177195

178-
### Removed 2.0.1
196+
### Removed
179197
- Removed bottom border from context menu line items.
180198

181199
<a name="2.0.0"></a>

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,22 @@ Next add an element to the page that will trigger the context menu to appear, an
7575
7676
```bash
7777
@import '~vue-context/dist/css/vue-context.css';
78+
79+
// Or
80+
@import '~vue-context/src/sass/vue-context';
7881
```
7982

8083
## Documentation/Demo
8184

8285
For full documentation and demos, go here: https://vue-context.com/docs
8386

87+
## Contributors
88+
89+
This project exists thanks to all the people who contribute. [[Contribute]](CONTRIBUTING.md).
90+
91+
- [rawilk](https://github.com/rawilk)
92+
- [wol-soft](https://github.com/wol-soft)
93+
8494
## License
8595

8696
`vue-context` uses the MIT License (MIT). Please see the [license file](https://github.com/rawilk/vue-context/blob/master/LICENSE) for more information.

build/webpack-styles.mix.js

-5
This file was deleted.

build/webpack.mix.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
const mix = require('laravel-mix');
22

3-
const inProduction = mix.inProduction();
4-
53
mix
6-
.setPublicPath('dist/js')
7-
.js('src/js/index.js', 'vue-context.js')
8-
.sourceMaps(! inProduction)
9-
.webpackConfig({
10-
output: {
11-
libraryTarget: 'umd',
12-
umdNamedDefine: true
13-
}
14-
});
4+
.setPublicPath('dist/css')
5+
.sass('src/sass/vue-context.scss', 'vue-context.css');

dist/css/vue-context.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/vue-context.js

-1
This file was deleted.

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
"name": "vue-context",
33
"version": "4.1.1",
44
"description": "A simple vue context menu component.",
5-
"main": "dist/js/vue-context.js",
5+
"main": "src/js/index.js",
66
"scripts": {
77
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --env.mixfile=build/webpack.mix.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
88
"dev-test": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --env.mixfile=build/webpack-test.mix.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
99
"watch-test": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --env.mixfile=build/webpack-test.mix.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
10-
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --env.mixfile=build/webpack.mix.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
11-
"styles": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --env.mixfile=build/webpack-styles.mix.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
10+
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --env.mixfile=build/webpack.mix.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
1211
},
1312
"keywords": [
1413
"Vue",

src/js/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export { default } from './vue-context';
12
export { default as VueContext } from './vue-context';

src/js/utils.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export const isArray = Array.isArray;
1717

1818
export const keyCodes = {
1919
ESC: 27,
20+
LEFT: 37,
2021
UP: 38,
22+
RIGHT: 39,
2123
DOWN: 40
2224
};
2325

@@ -51,7 +53,7 @@ export const filterVisible = elements => (elements || []).filter(isVisible);
5153

5254
// Return the Bounding Client Rect of an element
5355
// Returns `null` if not an element
54-
const getBCR = el => (isElement(el) ? el.getBoundingClientRect() : null);
56+
export const getBCR = el => (isElement(el) ? el.getBoundingClientRect() : null);
5557

5658
// Determine if an element is an HTML element
5759
const isElement = el => Boolean(el && el.nodeType === Node.ELEMENT_NODE);
@@ -81,3 +83,13 @@ export const setAttr = (el, attr, value) => {
8183
el.setAttribute(attr, value);
8284
}
8385
};
86+
87+
export const parentElementByClassName = (element, className) => {
88+
let parentElement = element.parentElement;
89+
90+
while (parentElement !== null && !parentElement.classList.contains(className)) {
91+
parentElement = parentElement.parentElement;
92+
}
93+
94+
return parentElement;
95+
};

0 commit comments

Comments
 (0)