├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .vscode
└── settings.json
├── API.md
├── CHANGELOG.md
├── LICENSE
├── README.md
├── babel.config.js
├── dist
├── VueFileToolbarMenu.common.js
├── VueFileToolbarMenu.common.js.map
├── VueFileToolbarMenu.css
├── VueFileToolbarMenu.umd.js
├── VueFileToolbarMenu.umd.js.map
├── VueFileToolbarMenu.umd.min.js
├── VueFileToolbarMenu.umd.min.js.map
└── fonts
│ ├── material-icons-outlined.78a93b20.woff
│ ├── material-icons-outlined.f86cb7b0.woff2
│ ├── material-icons-round.92dc7ca2.woff
│ ├── material-icons-round.b10ec9db.woff2
│ ├── material-icons-sharp.3885863e.woff2
│ ├── material-icons-sharp.a71cb2bf.woff
│ ├── material-icons-two-tone.588d6313.woff
│ ├── material-icons-two-tone.675bd578.woff2
│ ├── material-icons.4ad034d2.woff
│ └── material-icons.59322316.woff2
├── docs
├── css
│ └── app.66978772.css
├── favicon.ico
├── fonts
│ ├── material-icons-outlined.78a93b20.woff
│ ├── material-icons-outlined.f86cb7b0.woff2
│ ├── material-icons-round.92dc7ca2.woff
│ ├── material-icons-round.b10ec9db.woff2
│ ├── material-icons-sharp.3885863e.woff2
│ ├── material-icons-sharp.a71cb2bf.woff
│ ├── material-icons-two-tone.588d6313.woff
│ ├── material-icons-two-tone.675bd578.woff2
│ ├── material-icons.4ad034d2.woff
│ └── material-icons.59322316.woff2
├── index.html
└── js
│ ├── app.ead90959.js
│ ├── app.ead90959.js.map
│ ├── chunk-vendors.62565dd6.js
│ └── chunk-vendors.62565dd6.js.map
├── img
├── basic-example.png
├── docs-theme.png
├── logo.png
├── macos-theme.png
└── preview.png
├── package.json
├── public
├── favicon.ico
└── index.html
├── src
├── Bar
│ ├── Bar.vue
│ ├── BarButtonColor.vue
│ ├── BarButtonGeneric.vue
│ ├── BarMenu.vue
│ ├── BarMenuItem.vue
│ ├── BarMenuSeparator.vue
│ ├── BarSeparator.vue
│ ├── BarSpacer.vue
│ └── imports
│ │ └── bar-hotkey-manager.js
├── Demo
│ ├── Demo.vue
│ ├── DemoCustomButton.vue
│ └── DemoCustomMenuItem.vue
└── main.js
└── vue.config.js
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 | - Vue.js version [e.g. v2.6.11]
31 |
32 | **Smartphone (please complete the following information):**
33 | - Device: [e.g. iPhone6]
34 | - OS: [e.g. iOS8.1]
35 | - Browser [e.g. stock browser, safari]
36 | - Version [e.g. 22]
37 | - Vue.js version [e.g. v2.6.11]
38 |
39 | **Additional context**
40 | Add any other context about the problem here.
41 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | dist/demo.html
4 | package-lock.json
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 | pnpm-debug.log*
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "search.exclude": {
3 | "dist": true,
4 | "docs": true
5 | }
6 | }
--------------------------------------------------------------------------------
/API.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | # API
6 |
7 | ```js
8 | my_menu = [
9 |
10 | { // === Button component properties (all fields are optional) ===
11 |
12 | is: String || Object, // Component to display ["button-generic"(default), "button-color", "separator", "spacer", or your own imported Vue component]
13 |
14 | // === button-generic properties ===
15 | text: String, // Text displayed on the button, if any
16 | html: String, // Raw HTML to display, if any
17 | title: String, // Text to display in the button tooltip, if any
18 | icon: String || Object, // Name of Material icon to display, if any (see https://material.io/resources/icons/), or an icon component (e.g. https://github.com/antfu/unplugin-icons)
19 | emoji: String, // Name of Emoji to display, if any (from this list: https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json)
20 | hotkey: String, // Hotkey combination shortcut for the button, if any (use this format: https://github.com/jaywcjlove/hotkeys#supported-keys)
21 | active: Boolean, // Set to true if the button is toggled
22 | disabled: Boolean, // Set to true if the button is disabled (it will prevent click event)
23 | click: Function, // v-on:click event handler function, if any
24 | class: String || Object, // v-bind:class to apply to the button, if any
25 | id: String, // Element id to apply to the button, if any
26 |
27 | // if the button-generic should open a menu:
28 | menu_width: Number, // Custom menu width, if any
29 | menu_height: Number, // Custom menu maximum height, if any. Setting this activates the scrollbar if content overflows.
30 | menu_class: String || Object, // v-bind:class to apply to the menu, if any. You can set ["align-left"(default), "align-center", "align-right"]
31 | menu_id: String, // Element id to apply to the menu, if any
32 | chevron: Boolean || String, // Set to true if the button should display a chevron. You can also provide the HTML for your custom chevron.
33 | menu: [ // The menu array of items, or your own imported Vue component
34 |
35 | { // === Menu item component properties (all fields are optional) ===
36 |
37 | is: String || Object, // Component to display ["item"(default), "separator", or your own imported Vue component]
38 |
39 | // === item properties ===
40 | text: String, // Text displayed on the menu item, if any
41 | html: String, // Raw HTML to display, if any
42 | icon: String || Object, // Name of Material icon to display, if any (see https://material.io/resources/icons/), or an icon component (e.g. https://github.com/antfu/unplugin-icons)
43 | emoji: String, // Name of Emoji to display, if any (from this list: https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json)
44 | hotkey: String, // Hotkey combination shortcut for the menu, if any (use this format: https://github.com/jaywcjlove/hotkeys#supported-keys)
45 | disabled: Boolean, // Set to true if the menu is disabled (it will prevent click event)
46 | click: Function, // v-on:click event handler function, if any
47 | class: String || Object, // v-bind:class to apply to the menu item, if any
48 | id: String, // Element id to apply to the menu item, if any
49 |
50 | // If the menu should open a sub-menu:
51 | menu_width: Number, // Custom sub-menu width, if any
52 | menu_height: Number, // Custom sub-menu height, if any. Setting this activates the scrollbar.
53 | menu_class: String || Object, // v-bind:class to apply to the sub-menu, if any
54 | menu_id: String, // Element id to apply to the sub-menu, if any
55 | custom_chevron: String, // HTML of your custom chevron, if any. Set to "" to hide chevron.
56 | menu: Array || Object // (see button-generic menu property)
57 | }
58 | ],
59 |
60 | // === button-color properties ===
61 | type: String, // Color picker format: ["compact"(default), "material", "swatches", "slider", "sketch", "chrome", "photoshop"] (see https://github.com/xiaokaike/vue-color#live-demo)
62 | title: String, // Text to display in the button tooltip, if any
63 | menu_class: String || Object, // Custom v-bind:class to apply to the color picker box, if any. You can set ["align-left"(default), "align-center", "align-right"]
64 | menu_id: String, // Element id to apply to the color picker box, if any
65 | stay_open: Boolean, // If set, the color picker will stay open when the user clicks on it
66 | disabled: Boolean, // Set to true if the color picker is disabled (it will prevent opening)
67 | color: String || Object, // Current color to display (see compatible formats: https://github.com/xiaokaike/vue-color#usage)
68 | update_color: function (new_color) { // Callback when user changes the color. 1st argument is an object containing the new color in several formats:
69 | new_color = {
70 | a: Number, // color alpha value
71 | hex: String, // color in hex format "#123456"
72 | hex8: String, // color in hex8 format (w/ alpha) "#12345678"
73 | hsl: {
74 | h: Number, // color hue
75 | s: Number, // color saturation
76 | l: Number, // color lightness
77 | a: Number // color alpha
78 | },
79 | hsv: {
80 | h: Number, // color hue
81 | s: Number, // color saturation
82 | v: Number, // color value
83 | a: Number // color alpha
84 | },
85 | rgba: {
86 | r: Number, // color red value
87 | g: Number, // color green value
88 | b: Number, // color blue value
89 | a: Number // color alpha value
90 | }
91 | }
92 | }
93 | }
94 | ]
95 | ```
96 |
97 | :warning: As a reminder, be careful to the syntax for the click functions:
98 |
99 | - When writing `click (e) { console.log(this) }` : `this` represents the object containing the click function.
100 | - When writing `click: (e) => { console.log(this) }` : `this` represents your component context, so you can access your component data and methods.
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Vue 3
2 |
3 | ## v2.2.0
4 |
5 | - Allow support for using components as icons (for more info see the [API](API.md) and [PR 19](https://github.com/motla/vue-file-toolbar-menu/pull/19))
6 |
7 | ## v2.1.0
8 |
9 | - SCSS has been converted to basic CSS, so you don't have to install a SCSS compiler anymore
10 | - Updating dependencies
11 | - Removing ESLint for a lighter project
12 |
13 | ## v2.0.5
14 |
15 | - Bump `@ckpack/vue-color` dependency to its last version to fix part 2 of [Issue 16](https://github.com/motla/vue-file-toolbar-menu/issues/16).
16 |
17 | ## v2.0.4
18 |
19 | - Bump `@ckpack/vue-color` dependency to its last version to fix part 2 of [Issue 16](https://github.com/motla/vue-file-toolbar-menu/issues/16).
20 |
21 | ## v2.0.3
22 |
23 | - Fix v2.0.2 has wrong paths (Bug fix [Issue 16](https://github.com/motla/vue-file-toolbar-menu/issues/16))
24 |
25 | ## v2.0.2
26 |
27 | - Bug fix [Issue 16](https://github.com/motla/vue-file-toolbar-menu/issues/16):
28 | - Bypassing the `node-emoji` library written in CommonJS. Instead directly accessing JSON file located in `lib` for compatibility with Vite.js
29 | - Bug fix [Issue 17](https://github.com/motla/vue-file-toolbar-menu/issues/17):
30 | - Replacing `::v-deep.bar` by `.bar ::v-deep()` as ::v-deep usage as a combinator has been deprecated
31 |
32 | ## v2.0.1
33 |
34 | - Prevent displaying "false" as a default title when hovering buttons (Vue3 issue only)
35 | - Dependencies upgrade
36 |
37 | ## v2.0.0
38 |
39 | - Switching `master` branch to Vue3 (we provide vue2 compatibility on the vue2 branch / @1.x version of this library)
40 | - Switched `vue-color` to the `@ckpack/vue-color` fork for Vue3 compatibility
41 | - Dependencies upgrade
42 |
43 | # Vue 2
44 |
45 | ## v1.5.0
46 |
47 | - Allow support for using components as icons (for more info see the [API](API.md) and [PR 19](https://github.com/motla/vue-file-toolbar-menu/pull/19))
48 |
49 | ## v1.4.1
50 |
51 | - Bugfix: CSS scoping issue
52 |
53 | ## v1.4.0
54 |
55 | - SCSS has been converted to basic CSS, so you don't have to install a SCSS compiler anymore
56 | - Updating dependencies
57 | - Removing ESLint for a lighter project
58 |
59 | ## v1.3.4
60 |
61 | - \[Color button\] Prevent calling `color_update()` callback when the color is changed not from the color palette
62 |
63 | ## v1.3.3
64 |
65 | - Setting the CSS `z-index` of menus to 1000 (it was 1 previously)
66 | - Dependencies upgrade
67 |
68 | ## v1.3.2
69 |
70 | - Renaming the static library "VueFileToolbarMenu"
71 | - Adding UMD example to README.md
72 |
73 | ## v1.3.1
74 |
75 | - Dependencies upgrade
76 | - Changing `material-design-icons` to `material-icons` package (only the icon font and required CSS, considerably smaller and updated regularly)
77 |
78 | ## v1.3.0
79 |
80 | - Enhancement [Issue 13](https://github.com/motla/vue-file-toolbar-menu/issues/13): user can now set menu elements `id`
81 | - API.md update
82 |
83 | ## v1.2.0
84 |
85 | - Bug fix [Issue 7](https://github.com/motla/vue-file-toolbar-menu/issues/7): `disable` option now prevents the `click` event
86 | - Dependencies upgrade
87 |
88 | ## v1.1.4
89 |
90 | - Bug fix [Issue 6](https://github.com/motla/vue-file-toolbar-menu/issues/6): Menu did not close when clicking sub-menus that had click events
91 |
92 | ## v1.1.3
93 |
94 | - Bug fix [Issue 4](https://github.com/motla/vue-file-toolbar-menu/issues/4): "Color picker turned off once clicked"
95 | - New option `stay_open` for `button-color`
96 | - API.md update
97 |
98 | ## v1.1.2
99 |
100 | - Separator and spacer styles moved to bar-default-styles.scss
101 | - Minor code refactoring
102 | - Minor updates to README
103 |
104 | ## v1.1.1
105 |
106 | - Added `sass-loader` to `peerDependencies` in package.json
107 | - Github issue templates
108 | - Minor updates to README
109 |
110 | ## v1.1.0
111 |
112 | - Added `spacer` component
113 | - Added disabled mode for color menu
114 | - Setting parameter `menu_height` now changes CSS `max-height`
115 | - Moving `vue` and `core-js` to devDependencies
116 |
117 | ## v1.0.3
118 |
119 | - Minor documentation update
120 |
121 | ## v1.0.2
122 |
123 | - Hide icon names until icon font is loaded
124 |
125 | ## v1.0.1
126 |
127 | - Fix for external node_modules import
128 |
129 | ## v1.0.0
130 |
131 | Initial release
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Romain Lamothe
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | ## Features
9 | ### :rocket: [See live demo](https://motla.github.io/vue-file-toolbar-menu)
10 | - Synced menu content (stored in Vue.js computed/data fields, not in ``)
11 | - Easy styling
12 | - Add your own custom components for menus and buttons
13 | - Uses standard [Material Icons](https://material.io/resources/icons/)
14 | - Hotkey support
15 | - Touch-device compatible
16 | - Easy multi-language implementation ([vue-i18n](https://github.com/intlify/vue-i18n-next))
17 | - Migrated to Vue.js 3.x (to use with Vue 2.x, select library version 1.x)
18 |
19 | ###### :speech_balloon: If you plan to build a document editor, also check out [vue-document-editor](https://github.com/motla/vue-document-editor)
20 |
21 | ## Installation
22 | ##### In your Vue.js 3.x project:
23 |
24 | ```
25 | npm install vue-file-toolbar-menu
26 | ```
27 |
28 | ##### In your Vue.js 2.x project:
29 |
30 | ```
31 | npm install vue-file-toolbar-menu@1
32 | ```
33 |
34 | ###### :speech_balloon: If you prefer static files, import assets from the `dist` folder
35 |
36 | ## Basic example
37 | ###### MyComponent.vue
38 | ```Vue
39 |
40 |
41 |
42 |
43 |
68 | ```
69 | Should render this:
70 |
71 |
72 |
73 |
74 | same example using static files loaded with a CDN (Vue 3)
75 |
76 | ```HTML
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
110 |
111 |
112 | ```
113 |
114 |
115 |
116 | same example using static files loaded with a CDN (Vue 2)
117 |
118 | ```HTML
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |