bulmajs-rails 0.3.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8cf8f832a508485147ff0eaf6a221d3203a433915c92ee9bcb4d8d59acbdc968
4
+ data.tar.gz: 934a656391f56b0a1867cf2f3c4de012428023d53b5ff6a454972e3e0c5f318b
5
+ SHA512:
6
+ metadata.gz: 6e2effa1fd1a895eea4a65b5a0ff9e94f090046d3469c69bafadef3d62fe658a12817468dd46908cb3ca5c1391ce6dfd5a50ec08478a2a00a17e412f968f4c4d
7
+ data.tar.gz: aab29f95f67e430e76a5a9ff69c1cf439d8892b1e5c69cdbc528e7bb4d4f2a2c3a76e5d6b3fbeada1671263f240666ccdc6047af3960bf9bf899c491b4372c0e
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /BulmaJS/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at theeomm@outlook.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bulmajs-rails.gemspec
6
+ gemspec
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bulmajs-rails (0.3.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.7.0)
12
+ rspec-core (~> 3.7.0)
13
+ rspec-expectations (~> 3.7.0)
14
+ rspec-mocks (~> 3.7.0)
15
+ rspec-core (3.7.1)
16
+ rspec-support (~> 3.7.0)
17
+ rspec-expectations (3.7.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.7.0)
20
+ rspec-mocks (3.7.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.7.0)
23
+ rspec-support (3.7.1)
24
+
25
+ PLATFORMS
26
+ x64-mingw32
27
+
28
+ DEPENDENCIES
29
+ bulmajs-rails!
30
+ bundler (~> 1.16)
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 1.16.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Douglas Harrington Muhone
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,126 @@
1
+ # Bulmajs::Rails
2
+
3
+ Bulmajs-rails is the implementation of [BulmaJS](https://github.com/VizuaaLOG/BulmaJS)
4
+
5
+ BulmaJS is an unofficial javascript extension to the awesome [Bulma CSS framework](https://bulma.io)
6
+
7
+ Source: [https://github.com/VizuaaLOG/BulmaJS](https://github.com/VizuaaLOG/BulmaJS)
8
+
9
+ Ruby Gem: [https://rubygems.org/gems/bulmajs-rails](https://rubygems.org/gems/jquery-rails)
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'bulmajs-rails'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install bulmajs-rails
26
+
27
+ Now you need to edit your `app/assets/javascripts/application.js` file and add the following line:
28
+
29
+ ```javascript
30
+ //= require bulma
31
+ ```
32
+
33
+ ## Usage Examples
34
+
35
+ ### Basic Tabs
36
+
37
+ ```html
38
+ <div id="tabs-example" data-bulma="tabs">
39
+ <div class="tabs" data-links>
40
+ <ul>
41
+ <li class="is-active">
42
+ <a>Pictures</a>
43
+ </li>
44
+ <li>
45
+ <a>Music</a>
46
+ </li>
47
+ <li>
48
+ <a>Videos</a>
49
+ </li>
50
+ <li>
51
+ <a>Documents</a>
52
+ </li>
53
+ </ul>
54
+ </div>
55
+
56
+ <div class="tabs-content" data-content>
57
+ <ul>
58
+ <li class="is-active">
59
+ <h1>Pictures</h1>
60
+ </li>
61
+ <li>
62
+ <h1>Music</h1>
63
+ </li>
64
+ <li>
65
+ <h1>Videos</h1>
66
+ </li>
67
+ <li>
68
+ <h1>Documents</h1>
69
+ </li>
70
+ </ul>
71
+ </div>
72
+ </div>
73
+ ```
74
+
75
+ ### Navbar Mobile Toggle
76
+
77
+ All you need to do is add `data-bulma="navbar"` to the main navbar div, and then add `data-trigger` and `data-target="navID"` to the navbar burger
78
+
79
+ ```html
80
+ <nav class="navbar" data-bulma="navbar">
81
+ <div class="navbar-brand">
82
+ <!-- Your other HTML here -->
83
+ <div class="navbar-burger burger" data-trigger data-target="navMenuExample">
84
+ <span></span>
85
+ <span></span>
86
+ <span></span>
87
+ </div>
88
+ </div>
89
+ <div id="navMenuExample" class="navbar-menu">
90
+ <!-- Your navbar HTML here -->
91
+ </div>
92
+ </nav>
93
+ ```
94
+
95
+ ### Filename Updating
96
+
97
+ ```html
98
+ <div class="file has-name is-boxed" data-bulma="file">
99
+ <label class="file-label">
100
+ <input class="file-input" type="file" name="resume" multiple>
101
+ <span class="file-cta">
102
+ <span class="file-icon">
103
+ <i class="fa fa-upload"></i>
104
+ </span>
105
+ <span class="file-label">
106
+ Choose a file…
107
+ </span>
108
+ </span>
109
+ <span class="file-name"></span>
110
+ </label>
111
+ </div>
112
+ ```
113
+
114
+ More examples and explanation are on available [https://vizuaalog.github.io/BulmaJS](https://vizuaalog.github.io/BulmaJS)
115
+
116
+ ## Contributing
117
+
118
+ Bug reports and pull requests are welcome on GitHub at https://github.com/theeomm/bulmajs-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
119
+
120
+ ## Special Thanks
121
+
122
+ [Thomas](https://github.com/VizuaaLOG) - Creator of BulmaJS
123
+
124
+ ## License
125
+
126
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
File without changes
@@ -0,0 +1,304 @@
1
+ /******/
2
+ (function (modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/
5
+ var installedModules = {};
6
+ /******/
7
+ /******/ // The require function
8
+ /******/
9
+ function __webpack_require__(moduleId) {
10
+ /******/
11
+ /******/ // Check if module is in cache
12
+ /******/
13
+ if (installedModules[moduleId]) {
14
+ /******/
15
+ return installedModules[moduleId].exports;
16
+ /******/
17
+ }
18
+ /******/ // Create a new module (and put it into the cache)
19
+ /******/
20
+ var module = installedModules[moduleId] = {
21
+ /******/
22
+ i: moduleId,
23
+ /******/
24
+ l: false,
25
+ /******/
26
+ exports: {}
27
+ /******/
28
+ };
29
+ /******/
30
+ /******/ // Execute the module function
31
+ /******/
32
+ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
33
+ /******/
34
+ /******/ // Flag the module as loaded
35
+ /******/
36
+ module.l = true;
37
+ /******/
38
+ /******/ // Return the exports of the module
39
+ /******/
40
+ return module.exports;
41
+ /******/
42
+ }
43
+ /******/
44
+ /******/
45
+ /******/ // expose the modules object (__webpack_modules__)
46
+ /******/
47
+ __webpack_require__.m = modules;
48
+ /******/
49
+ /******/ // expose the module cache
50
+ /******/
51
+ __webpack_require__.c = installedModules;
52
+ /******/
53
+ /******/ // define getter function for harmony exports
54
+ /******/
55
+ __webpack_require__.d = function (exports, name, getter) {
56
+ /******/
57
+ if (!__webpack_require__.o(exports, name)) {
58
+ /******/
59
+ Object.defineProperty(exports, name, {
60
+ /******/
61
+ configurable: false,
62
+ /******/
63
+ enumerable: true,
64
+ /******/
65
+ get: getter
66
+ /******/
67
+ });
68
+ /******/
69
+ }
70
+ /******/
71
+ };
72
+ /******/
73
+ /******/ // define __esModule on exports
74
+ /******/
75
+ __webpack_require__.r = function (exports) {
76
+ /******/
77
+ Object.defineProperty(exports, '__esModule', {
78
+ value: true
79
+ });
80
+ /******/
81
+ };
82
+ /******/
83
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
84
+ /******/
85
+ __webpack_require__.n = function (module) {
86
+ /******/
87
+ var getter = module && module.__esModule ?
88
+ /******/
89
+ function getDefault() {
90
+ return module['default'];
91
+ } :
92
+ /******/
93
+ function getModuleExports() {
94
+ return module;
95
+ };
96
+ /******/
97
+ __webpack_require__.d(getter, 'a', getter);
98
+ /******/
99
+ return getter;
100
+ /******/
101
+ };
102
+ /******/
103
+ /******/ // Object.prototype.hasOwnProperty.call
104
+ /******/
105
+ __webpack_require__.o = function (object, property) {
106
+ return Object.prototype.hasOwnProperty.call(object, property);
107
+ };
108
+ /******/
109
+ /******/ // __webpack_public_path__
110
+ /******/
111
+ __webpack_require__.p = "";
112
+ /******/
113
+ /******/
114
+ /******/ // Load entry module and return exports
115
+ /******/
116
+ return __webpack_require__(__webpack_require__.s = "./src/bulma.js");
117
+ /******/
118
+ })
119
+ /************************************************************************/
120
+ /******/
121
+ ({
122
+
123
+ /***/
124
+ "./src/bulma.js":
125
+ /*!**********************!*\
126
+ !*** ./src/bulma.js ***!
127
+ \**********************/
128
+ /*! no exports provided */
129
+ /***/
130
+ (function (module, __webpack_exports__, __webpack_require__) {
131
+
132
+ "use strict";
133
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core */ \"./src/core.js\");\n/* harmony import */ var _plugins_notification__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./plugins/notification */ \"./src/plugins/notification.js\");\n/* harmony import */ var _plugins_navbar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./plugins/navbar */ \"./src/plugins/navbar.js\");\n/* harmony import */ var _plugins_message__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./plugins/message */ \"./src/plugins/message.js\");\n/* harmony import */ var _plugins_dropdown__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./plugins/dropdown */ \"./src/plugins/dropdown.js\");\n/* harmony import */ var _plugins_modal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./plugins/modal */ \"./src/plugins/modal.js\");\n/* harmony import */ var _plugins_file__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./plugins/file */ \"./src/plugins/file.js\");\n/* harmony import */ var _plugins_tabs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./plugins/tabs */ \"./src/plugins/tabs.js\");\n/* harmony import */ var _plugins_accordion__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./plugins/accordion */ \"./src/plugins/accordion.js\");\n/* harmony import */ var _plugins_calendar__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./plugins/calendar */ \"./src/plugins/calendar.js\");\n/* eslint no-unused-vars: 0 */\n\n\n\n\n\n\n\n\n\n\n\n\n\nwindow.Bulma = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"];\n\n//# sourceURL=webpack:///./src/bulma.js?");
134
+
135
+ /***/
136
+ }),
137
+
138
+ /***/
139
+ "./src/core.js":
140
+ /*!*********************!*\
141
+ !*** ./src/core.js ***!
142
+ \*********************/
143
+ /*! exports provided: default */
144
+ /***/
145
+ (function (module, __webpack_exports__, __webpack_require__) {
146
+
147
+ "use strict";
148
+ eval("__webpack_require__.r(__webpack_exports__);\nconst Bulma = {\n /**\n * Current BulmaJS version.\n * @type {String}\n */\n VERSION: '0.4.0',\n\n /**\n * Helper method to create a new plugin.\n * @param {String} key The plugin's key\n * @param {Object} options The options to be passed to the plugin\n * @return {Object} The newly created plugin instance\n */\n create(key, options) {\n if (!key || !Bulma.hasOwnProperty(key)) {\n throw new Error('[BulmaJS] A plugin with the key \\'' + key + '\\' has not been registered.');\n }\n\n return Bulma[key].create(options);\n },\n\n /**\n * Register a new plugin\n * @param {String} key The key to register the plugin under\n * @param {Object} plugin The plugin's main constructor\n * @return {undefined}\n */\n registerPlugin(key, plugin) {\n if (!key) {\n throw new Error('[BulmaJS] Key attribute is required.');\n }\n\n this[key] = plugin;\n },\n\n /**\n * Parse the HTML DOM searching for data-bulma attributes. We will then pass\n * each element to the appropriate plugin to handle the required processing.\n * \n * @return {undefined}\n */\n traverseDOM() {\n let elements = document.querySelectorAll('[data-bulma]');\n\n elements.forEach(function (element) {\n let plugin = element.getAttribute('data-bulma');\n\n if (!Bulma.hasOwnProperty(plugin)) {\n throw new Error('[BulmaJS] Plugin with the key \\'' + plugin + '\\' has not been registered.');\n }\n\n if (Bulma[plugin].hasOwnProperty('handleDomParsing')) {\n Bulma[element.getAttribute('data-bulma')].handleDomParsing(element);\n }\n });\n },\n\n /**\n * Create an element and assign classes\n * @param {string} name The name of the element to create\n * @param {array} classes An array of classes to add to the element\n * @return {HTMLElement} The newly created element\n */\n createElement(name, classes) {\n if (!classes) {\n classes = [];\n }\n\n if (typeof classes === 'string') {\n classes = [classes];\n }\n\n let elem = document.createElement(name);\n\n classes.forEach(className => {\n elem.classList.add(className);\n });\n\n return elem;\n }\n};\n\ndocument.addEventListener('DOMContentLoaded', () => {\n Bulma.traverseDOM();\n});\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Bulma);\n\n//# sourceURL=webpack:///./src/core.js?");
149
+
150
+ /***/
151
+ }),
152
+
153
+ /***/
154
+ "./src/dismissableComponent.js":
155
+ /*!*************************************!*\
156
+ !*** ./src/dismissableComponent.js ***!
157
+ \*************************************/
158
+ /*! exports provided: default */
159
+ /***/
160
+ (function (module, __webpack_exports__, __webpack_require__) {
161
+
162
+ "use strict";
163
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return DismissableComponent; });\n/**\n * @module DismissableComponent\n * @since 0.2.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass DismissableComponent {\n /**\n * Plugin constructor\n * @param {string} name Plugin's name\n * @param {Object} options Plugin's options\n * @return {this} The new plugin instance\n */\n constructor(name, options) {\n /**\n * The name of this component, this will be used as the root class\n * @type {string}\n */\n this.name = name;\n\n /**\n * Body text.\n * @type {string}\n */\n this.body = options.hasOwnProperty('body') ? options.body : '';\n\n /**\n * The parent element to inject HTML\n */\n this.parent = options.hasOwnProperty('parent') ? options.parent : document.body;\n\n /**\n * Color modifier.\n * @type {string} Possible values are null, primary, info, success, warning, danger\n */\n this.color = options.hasOwnProperty('color') ? options.color : '';\n\n /**\n * How long to wait before auto dismissing the component.\n * @type {int|null} If null component must be dismissed manually.\n */\n this.dismissInterval = options.hasOwnProperty('dismissInterval') ? this.createDismissInterval(options.dismissInterval) : null;\n\n /**\n * Does this component have a dismiss button?\n * @type {Boolean}\n */\n this.isDismissable = options.hasOwnProperty('isDismissable') ? options.isDismissable : false;\n\n /**\n * Should this component be destroyed when it is dismissed.\n * @type {Boolean}\n */\n this.destroyOnDismiss = options.hasOwnProperty('destroyOnDismiss') ? options.destroyOnDismiss : true;\n\n /**\n * The root element.\n * @type {HTMLElement|null} If this is not provided a new element will be created.\n */\n this.root = options.hasOwnProperty('element') ? options.element : null;\n\n /**\n * The element used to close the component.\n * @type {HTMLElement}\n */\n this.closeButton = options.hasOwnProperty('closeButton') ? options.closeButton : this.createCloseButton();\n\n if (!this.root) {\n this.createRootElement();\n this.parent.appendChild(this.root);\n }\n\n if (this.body) {\n this.insertBody();\n }\n\n if (this.color) {\n this.setColor();\n }\n }\n\n /**\n * Create the main element.\n * @return {undefined}\n */\n createRootElement() {\n this.root = document.createElement('div');\n\n this.root.classList.add(this.name);\n this.hide();\n }\n\n /**\n * Show the component.\n * @return {undefined}\n */\n show() {\n this.root.classList.remove('is-hidden');\n }\n\n /**\n * Hide the component.\n * @return {undefined}\n */\n hide() {\n this.root.classList.add('is-hidden');\n }\n\n /**\n * Insert the body text into the component.\n * @return {undefined}\n */\n insertBody() {\n this.root.innerHTML = this.body;\n }\n\n /**\n * Create the element that will be used to close the component.\n * @return {HTMLElement} The newly created close button\n */\n createCloseButton() {\n var closeButton = document.createElement('button');\n closeButton.setAttribute('type', 'button');\n closeButton.classList.add('delete');\n\n return closeButton;\n }\n\n /**\n * Create an interval to dismiss the component after the set number of ms.\n * @param {int} interval The time to wait before dismissing the component\n * @return {undefined}\n */\n createDismissInterval(interval) {\n return setInterval(() => {\n this.handleCloseEvent();\n }, interval);\n }\n\n /**\n * Insert the close button before our content.\n * @return {undefined}\n */\n prependCloseButton() {\n this.root.insertBefore(this.closeButton, this.root.firstChild);\n }\n\n /**\n * Setup the event listener for the close button.\n * @return {undefined}\n */\n setupCloseEvent() {\n this.closeButton.addEventListener('click', this.handleCloseEvent.bind(this));\n }\n\n /**\n * Handle the event when our close button is clicked.\n * @return {undefined}\n */\n handleCloseEvent() {\n if (this.destroyOnDismiss) {\n this.destroy();\n } else {\n this.hide();\n }\n }\n\n /**\n * Set the colour of the component.\n * @return {undefined}\n */\n setColor() {\n this.root.classList.add('is-' + this.color);\n }\n\n /**\n * Destroy the component, removing the event listener, interval and element.\n * @return {undefined}\n */\n destroy() {\n if (this.closeButton) {\n this.closeButton.removeEventListener('click', this.handleCloseEvent.bind(this));\n }\n\n clearInterval(this.dismissInterval);\n\n this.parent.removeChild(this.root);\n this.parent = null;\n this.root = null;\n }\n}\n\n//# sourceURL=webpack:///./src/dismissableComponent.js?");
164
+
165
+ /***/
166
+ }),
167
+
168
+ /***/
169
+ "./src/plugins/accordion.js":
170
+ /*!**********************************!*\
171
+ !*** ./src/plugins/accordion.js ***!
172
+ \**********************************/
173
+ /*! exports provided: default */
174
+ /***/
175
+ (function (module, __webpack_exports__, __webpack_require__) {
176
+
177
+ "use strict";
178
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Accordion\n * @since 0.3.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Accordion {\n /**\n * Plugin constructor\n * @param {Object} options The plugin's options\n * @return {this} The new plugin instance\n */\n constructor(options) {\n if (!options) {\n options = {};\n }\n\n /**\n * Message body text.\n * @type {string}\n */\n this.root = options.hasOwnProperty('element') ? options.element : '';\n\n /**\n * Accordion items\n * @type {Array}\n */\n this.accordions = this.findAccordions();\n\n /**\n * Toggle buttons for each accordion item\n * @type {Array}\n */\n this.toggleButtons = this.findToggleButtons();\n\n this.addToggleButtonEvents();\n }\n\n /**\n * Find the accordion items within this accordions element\n * @returns {Array} The accordion elements found\n */\n findAccordions() {\n return this.root.querySelectorAll('.accordion');\n }\n\n /**\n * Find the toggle buttons within this accordions element\n * @returns {Array} The toggle buttons found\n */\n findToggleButtons() {\n let buttons = [];\n\n this.accordions.forEach(accordion => {\n buttons.push(accordion.querySelector('button.toggle'));\n });\n\n return buttons;\n }\n\n /**\n * Add click events to toggle buttons\n * @return {undefined}\n */\n addToggleButtonEvents() {\n this.toggleButtons.forEach((toggleButton, index) => {\n // If the button is null, the accordion item has no toggle button\n if (toggleButton !== null) {\n toggleButton.addEventListener('click', event => {\n this.handleToggleClick(event, index);\n });\n }\n });\n }\n\n /**\n * Handle the click\n * @param {Object} event The event object\n * @param {number} index Index of the accordion to toggle\n * @return {undefined}\n */\n handleToggleClick(event, index) {\n this.toggleAccordionVisibility(this.accordions[index]);\n }\n\n /**\n * Show or hide the accordion\n * @param {HTMLElement} accordion The accordion element\n * @return {undefined}\n */\n toggleAccordionVisibility(accordion) {\n this.accordions.forEach(function (a) {\n a.classList.remove('is-active');\n });\n\n if (accordion.classList.contains('is-active')) {\n accordion.classList.remove('is-active');\n } else {\n accordion.classList.add('is-active');\n }\n }\n\n /**\n * Helper method used by the Bulma core to create a new instance.\n * @param {Object} options The plugin's options\n * @return {Accordion} The newly created instance\n */\n static create(options) {\n return new Accordion(options);\n }\n\n /**\n * Destroy the message, removing the event listener, interval and element.\n * @return {undefined}\n */\n destroy() {\n this.root = null;\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this accordion\n * @return {undefined}\n */\n static handleDomParsing(element) {\n new Accordion({\n element\n });\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('accordion', Accordion);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Accordion);\n\n//# sourceURL=webpack:///./src/plugins/accordion.js?");
179
+
180
+ /***/
181
+ }),
182
+
183
+ /***/
184
+ "./src/plugins/calendar.js":
185
+ /*!*********************************!*\
186
+ !*** ./src/plugins/calendar.js ***!
187
+ \*********************************/
188
+ /*! exports provided: default */
189
+ /***/
190
+ (function (module, __webpack_exports__, __webpack_require__) {
191
+
192
+ "use strict";
193
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Calendar\n * @since 0.3.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Calendar {\n /**\n * Plugin constructor\n * @param {Object} options Plugin instance's options\n * @return {this} The newly created instance\n */\n constructor(options) {\n if (!options.element) {\n throw new Error('[BulmaJS] The Calendar component requires an element.');\n }\n\n /**\n * The root Calendar element.\n * @type {HTMLElement}\n */\n this.root = options.element;\n\n /**\n * The input element this calendar belongs to.\n * @type {HTMLElement|null}\n */\n this.inputElement = null;\n\n if (this.root.nodeName === 'INPUT') {\n this.inputElement = this.root;\n this.root = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div');\n }\n\n /**\n * The wrapper for the calendar\n * @type {HTMLElement}\n */\n this.wrapper = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', ['calendar']);\n\n /**\n * The current date for today tests\n * @type {Date}\n */\n this.now = new Date();\n\n /**\n * The date this calendar starts at\n * @type {Date}\n */\n this.date = options.hasOwnProperty('date') ? options.date : this.now;\n\n /**\n * The current year for the calendar\n * @type {int}\n */\n this.year = this.date.getFullYear();\n\n /**\n * The current month for the calendar\n * @type {int}\n */\n this.month = this.date.getMonth();\n\n /**\n * Month names\n * @type {Array}\n */\n this.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n\n /**\n * Short day names\n * @type {Array}\n */\n this.shortDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n /**\n * Number of days in each month\n * @type {Array}\n */\n this.monthDays = [31, this.isLeapYear(this.year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\n /**\n * Show the navigating buttons\n * @type {boolean}\n */\n this.navButtons = options.hasOwnProperty('navButtons') ? options.navButtons : true;\n\n /**\n * The format string for the date output. Used when attached to an input element.\n * @type {string}\n */\n this.format = options.hasOwnProperty('format') ? options.format : 'yyyy-mm-dd';\n\n /**\n * Should the calendar be shown as a modal. Used when attached to an input element\n * @type {boolean}\n */\n this.overlay = options.hasOwnProperty('overlay') ? options.overlay : false;\n\n if (this.overlay) {\n this.buildModal();\n }\n\n if (this.inputElement !== null) {\n this.inputElement.addEventListener('focus', event => {\n this.handleInputFocus(event);\n });\n }\n\n this.render();\n }\n\n ////////////////////////////////////////\n ///// HELPER METHODS TO BUILD HTML /////\n ////////////////////////////////////////\n\n /**\n * If we are to show as an overlay, build the modal's HTML\n * @return {undefined}\n */\n buildModal() {\n this.modal = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', ['modal']);\n this.modalBackground = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', ['modal-background']);\n\n let modalClose = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('button', ['modal-close']);\n\n modalClose.addEventListener('click', () => {\n this.modal.classList.remove('is-active');\n });\n\n this.modal.appendChild(this.modalBackground);\n this.modal.appendChild(modalClose);\n\n this.root.appendChild(this.modal);\n\n this.wrapper.style.zIndex = 40;\n }\n\n /**\n * Build the calendars nav HTML\n * @return {undefined}\n */\n buildNav() {\n let prevIcon, nextIcon;\n let nav = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-nav');\n let navLeft = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-nav-left');\n let navRight = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-nav-right');\n\n // Left side of nav (prev year/month buttons)\n if (this.navButtons) {\n this.prevYearButton = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('button', ['button', 'is-text']);\n prevIcon = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('i', ['fa', 'fa-backward']);\n this.prevYearButton.appendChild(prevIcon);\n\n this.prevYearButton.addEventListener('click', event => {\n this.handlePrevYearClick(event);\n });\n\n navLeft.appendChild(this.prevYearButton);\n\n this.prevMonthButton = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('button', ['button', 'is-text']);\n prevIcon = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('i', ['fa', 'fa-chevron-left']);\n this.prevMonthButton.appendChild(prevIcon);\n\n this.prevMonthButton.addEventListener('click', event => {\n this.handlePrevMonthClick(event);\n });\n\n navLeft.appendChild(this.prevMonthButton);\n\n // Right side of nav (next year/month buttons)\n this.nextMonthButton = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('button', ['button', 'is-text']);\n nextIcon = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('i', ['fa', 'fa-chevron-right']);\n this.nextMonthButton.appendChild(nextIcon);\n\n this.nextMonthButton.addEventListener('click', event => {\n this.handleNextMonthClick(event);\n });\n\n navRight.appendChild(this.nextMonthButton);\n\n this.nextYearButton = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('button', ['button', 'is-text']);\n prevIcon = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('i', ['fa', 'fa-forward']);\n this.nextYearButton.appendChild(prevIcon);\n\n this.nextYearButton.addEventListener('click', event => {\n this.handleNextYearClick(event);\n });\n\n navRight.appendChild(this.nextYearButton);\n }\n\n // Month/year label\n this.monthYearLabel = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div');\n this.monthYearLabel.innerHTML = this.months[this.month] + ' ' + this.year;\n\n nav.appendChild(navLeft);\n nav.appendChild(this.monthYearLabel);\n nav.appendChild(navRight);\n\n return nav;\n }\n\n /**\n * Build the calendar's container HTML\n * @return {HTMLElement} The calendar's container\n */\n buildContainer() {\n return _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-container');\n }\n\n /**\n * Build the calendar's header HTML\n * @return {HTMLElement} The calendar's header element\n */\n buildHeader() {\n let calendarHeader = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-header');\n\n this.shortDays.forEach(dayName => {\n let day = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-date');\n day.innerHTML = dayName;\n calendarHeader.appendChild(day);\n });\n\n return calendarHeader;\n }\n\n /**\n * Build the calendar's body. This includes all days.\n * @return {HTMLElement} The calendar's body element\n */\n buildBody() {\n let calendarBody = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-body');\n\n let daysInMonth = this.monthDays[this.now.getMonth()];\n\n // Number of days to show from the previous month.\n let daysBefore = new Date(this.year, this.month, 1).getDay();\n\n // Number of days to show from the next month\n let daysAfter;\n\n let numDays = daysInMonth + daysBefore;\n\n daysAfter = numDays;\n while (daysAfter > 7) {\n daysAfter -= 7;\n }\n\n numDays += 7 - daysAfter;\n\n let cells = [];\n\n for (let i = 0; i < numDays; i++) {\n let d = new Date(this.year, this.month, 1 + (i - daysBefore));\n\n let today = false;\n let thisMonth = false;\n\n if (d.getFullYear() === this.now.getFullYear() && d.getMonth() === this.now.getMonth() && d.getDate() === this.now.getDate()) {\n today = true;\n }\n\n if (d.getMonth() === this.month) {\n thisMonth = true;\n }\n\n cells.push({\n day: d.getDate(),\n isToday: today,\n isThisMonth: thisMonth\n });\n }\n\n cells.forEach(day => {\n let d = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('div', 'calendar-date');\n\n if (!day.isThisMonth) {\n d.classList.add('is-disabled');\n }\n\n let button = _core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createElement('button', 'date-item');\n\n if (this.inputElement !== null && day.isThisMonth) {\n button.addEventListener('click', event => {\n this.handleDayClick(event, day);\n });\n }\n\n if (day.isToday) {\n button.classList.add('is-today');\n }\n\n button.innerHTML = day.day;\n\n d.appendChild(button);\n\n calendarBody.appendChild(d);\n });\n\n return calendarBody;\n }\n\n //////////////////////////\n ///// EVENT HANDLERS /////\n //////////////////////////\n\n /**\n * Called when the input box is in focus.\n * @return {undefined}\n */\n handleInputFocus() {\n if (this.overlay) {\n this.modal.classList.add('is-active');\n }\n\n this.inputElement.parentNode.insertBefore(this.root, this.inputElement.nextSibling);\n }\n\n /**\n * Event hander for when a day is clicked.\n * @param {Object} event The event object\n * @param {Object} day The day that was clicked\n * @return {undefined}\n */\n handleDayClick(event, day) {\n day = new Date(this.year, this.month, day.day);\n\n let dateString = this.formatDateString(day);\n\n this.inputElement.value = dateString;\n\n if (this.overlay) {\n this.modal.classList.remove('is-active');\n } else {\n this.inputElement.parentNode.removeChild(this.root);\n }\n }\n\n /**\n * Event handler for the previous month button.\n * @return {undefined}\n */\n handlePrevMonthClick() {\n this.month--;\n\n if (this.month < 0) {\n this.year--;\n this.month = 11;\n }\n\n this.render();\n }\n\n /**\n * Event handler for the next month button.\n * @return {undefined}\n */\n handleNextMonthClick() {\n this.month++;\n\n if (this.month > 11) {\n this.year++;\n this.month = 0;\n }\n\n this.render();\n }\n\n /**\n * Event handler for the previous year button.\n * @return {undefined}\n */\n handlePrevYearClick() {\n this.year--;\n\n this.render();\n }\n\n /**\n * Event handler for the next year button.\n * @return {undefined}\n */\n handleNextYearClick() {\n this.year++;\n\n this.render();\n }\n\n /**\n * Format the date based on the supplied format string.\n * @param {Object} day Date object representing the day to format\n * @returns {string} The formatted date string\n */\n formatDateString(day) {\n let dateString = this.format;\n\n // May be a better/faster way of doing this?\n if (dateString.indexOf('yyyy') !== -1) {\n dateString = this.format.replace('yyyy', day.getFullYear());\n } else {\n dateString = this.format.replace('yy', day.getFullYear().toString().substr(-2));\n }\n\n if (dateString.indexOf('mm') !== -1) {\n let month = day.getMonth() + 1;\n if (month < 10) {\n month = '0' + month.toString();\n }\n dateString = dateString.replace('mm', month);\n } else {\n dateString = dateString.replace('m', day.getMonth() + 1);\n }\n\n if (dateString.indexOf('dd') !== -1) {\n let date = day.getDate();\n if (date < 10) {\n date = '0' + date.toString();\n }\n dateString = dateString.replace('dd', date);\n } else {\n dateString = dateString.replace('d', day.getDate());\n }\n\n return dateString;\n }\n\n /**\n * Clear the calendar HTML, ready for a re-render.\n * @return {undefined}\n */\n clearCalendar() {\n while (this.wrapper.firstChild) {\n this.wrapper.removeChild(this.wrapper.firstChild);\n }\n }\n\n /**\n * Check if the passed year is a leap year.\n * @param {int} year The year to check against\n * @return {boolean} Is the year a leap year or not\n */\n isLeapYear(year) {\n // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951\n return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n }\n\n /**\n * Render/build the calendar's HTML.\n * @return {undefined}\n */\n render() {\n this.clearCalendar();\n\n this.wrapper.appendChild(this.buildNav());\n\n let container = this.buildContainer();\n container.appendChild(this.buildHeader());\n container.appendChild(this.buildBody());\n\n this.wrapper.appendChild(container);\n\n if (this.overlay) {\n this.modal.insertBefore(this.wrapper, this.modalBackground.nextSibling);\n this.root.appendChild(this.modal);\n } else {\n this.root.appendChild(this.wrapper);\n }\n }\n\n /**\n * Helper method used by the Bulma core to create a new instance.\n * @param {Object} options The new calendar's options\n * @return {Calendar} The newly created calendar instance\n */\n static create(options) {\n return new Calendar(options);\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @return {undefined}\n */\n static handleDomParsing() {\n return;\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('calendar', Calendar);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Calendar);\n\n//# sourceURL=webpack:///./src/plugins/calendar.js?");
194
+
195
+ /***/
196
+ }),
197
+
198
+ /***/
199
+ "./src/plugins/dropdown.js":
200
+ /*!*********************************!*\
201
+ !*** ./src/plugins/dropdown.js ***!
202
+ \*********************************/
203
+ /*! exports provided: default */
204
+ /***/
205
+ (function (module, __webpack_exports__, __webpack_require__) {
206
+
207
+ "use strict";
208
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Dropdown\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Dropdown {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created instance\n */\n constructor(options) {\n if (!options.element || !options.trigger) {\n throw new Error('[BulmaJS] The dropdown component requires an element and trigger to function.');\n }\n\n /**\n * The root dropdown element.\n * @type {HTMLElement}\n */\n this.root = options.element;\n\n /**\n * The element to trigger when clicked.\n * @type {HTMLElement}\n */\n this.trigger = options.trigger;\n\n this.registerEvents();\n }\n\n /**\n * Register all the events this module needs.\n * @return {undefined}\n */\n registerEvents() {\n this.trigger.addEventListener('click', this.handleTriggerClick.bind(this));\n }\n\n /**\n * Handle the click event on the trigger.\n * @return {undefined}\n */\n handleTriggerClick() {\n if (this.root.classList.contains('is-active')) {\n this.root.classList.remove('is-active');\n } else {\n this.root.classList.add('is-active');\n }\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HtmlElement} element The root element for this instance\n * @return {undefined}\n */\n static handleDomParsing(element) {\n let trigger = element.querySelector('[data-trigger]');\n\n new Dropdown({\n element: element,\n trigger: trigger\n });\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('dropdown', Dropdown);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Dropdown);\n\n//# sourceURL=webpack:///./src/plugins/dropdown.js?");
209
+
210
+ /***/
211
+ }),
212
+
213
+ /***/
214
+ "./src/plugins/file.js":
215
+ /*!*****************************!*\
216
+ !*** ./src/plugins/file.js ***!
217
+ \*****************************/
218
+ /*! exports provided: default */
219
+ /***/
220
+ (function (module, __webpack_exports__, __webpack_require__) {
221
+
222
+ "use strict";
223
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module File\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass File {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created plugin instance\n */\n constructor(options) {\n if (!options.element) {\n throw new Error('[BulmaJS] The file component requires an element to function.');\n }\n\n /**\n * The root file element.\n * @type {HTMLElement}\n */\n this.root = options.element;\n\n /**\n * The element to use as the trigger.\n * @type {HTMLELement}\n */\n this.trigger = this.root.querySelector('input');\n\n /**\n * The element to show the file name.\n * @type {HTMLElement}\n */\n this.target = this.root.querySelector('.file-name');\n\n this.registerEvents();\n }\n\n /**\n * Register all the events this module needs.\n * @return {undefined}\n */\n registerEvents() {\n this.trigger.addEventListener('change', this.handleTriggerChange.bind(this));\n }\n\n /**\n * Handle the click event on the trigger.\n * @param {Object} event The event object\n * @return {undefined}\n */\n handleTriggerChange(event) {\n if (event.target.files.length === 0) {\n this.clearFileName();\n }\n\n if (event.target.files.length === 1) {\n this.setFileName(event.target.files[0].name);\n }\n\n if (event.target.files.length > 1) {\n this.setFileName(event.target.files.length + ' files');\n }\n }\n\n /**\n * Clear the file name element.\n * @return {undefined}\n */\n clearFileName() {\n this.target.innerHTML = '';\n }\n\n /**\n * Set the text for the file name element.\n * @param {string} value The name of the file to update the label with\n * @return {undefined}\n */\n setFileName(value) {\n this.target.innerHTML = value;\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this plugin\n * @return {undefined}\n */\n static handleDomParsing(element) {\n new File({\n element: element\n });\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('file', File);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (File);\n\n//# sourceURL=webpack:///./src/plugins/file.js?");
224
+
225
+ /***/
226
+ }),
227
+
228
+ /***/
229
+ "./src/plugins/message.js":
230
+ /*!********************************!*\
231
+ !*** ./src/plugins/message.js ***!
232
+ \********************************/
233
+ /*! exports provided: default */
234
+ /***/
235
+ (function (module, __webpack_exports__, __webpack_require__) {
236
+
237
+ "use strict";
238
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n/* harmony import */ var _dismissableComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dismissableComponent */ \"./src/dismissableComponent.js\");\n\n\n\n/**\n * @module Message\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n * @extends DismissableComponent\n */\nclass Message extends _dismissableComponent__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created instance\n */\n constructor(options) {\n if (!options) {\n options = {};\n }\n\n super('message', options);\n\n /**\n * The size of the message\n * @type {String} Possible values are small, normal, medium or large\n */\n this.size = options.hasOwnProperty('size') ? options.size : '';\n\n /**\n * The title of the message\n * @type {String}\n */\n this.title = options.hasOwnProperty('title') ? options.title : '';\n\n if (this.title) {\n this.createMessageHeader();\n }\n\n // TODO: Move this into the DismissableComponent class. Due to the required\n // changes between different components, we may need a way to trigger this\n // when the component is ready.\n if (this.isDismissable) {\n if (!options.hasOwnProperty('closeButton')) {\n this.prependCloseButton();\n }\n\n this.setupCloseEvent();\n }\n\n if (this.size) {\n this.setSize();\n }\n }\n\n /**\n * Helper method used by the Bulma core to create a new instance.\n * @param {Object} options THe options object for this instance\n * @return {Message} The newly created message instance\n */\n static create(options) {\n return new Message(options);\n }\n\n /**\n * Create the message header\n * @return {undefined}\n */\n createMessageHeader() {\n let header = document.createElement('div');\n header.classList.add('message-header');\n\n header.innerHTML = '<p>' + this.title + '</p>';\n\n this.title = header;\n\n this.root.insertBefore(this.title, this.root.firstChild);\n }\n\n /**\n * Set the size of the message.\n * @return {undefined}\n */\n setSize() {\n this.root.classList.add('is-' + this.size);\n }\n\n /**\n * Insert the body text into the component.\n * @return {undefined}\n */\n insertBody() {\n let body = document.createElement('div');\n body.classList.add('message-body');\n body.innerHTML = this.body;\n\n this.root.appendChild(body);\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this plugin\n * @return {undefined}\n */\n static handleDomParsing(element) {\n let closeBtn = element.querySelector('.delete');\n let dismissInterval = element.getAttribute('data-dismiss-interval');\n\n let options = {\n body: null,\n parent: element.parentNode,\n element: element,\n closeButton: closeBtn,\n isDismissable: !!closeBtn,\n destroyOnDismiss: true\n };\n\n if (dismissInterval) {\n options['dismissInterval'] = parseInt(dismissInterval);\n }\n\n new Message(options);\n }\n\n /**\n * Insert the close button before our content.\n * @return {undefined}\n */\n prependCloseButton() {\n this.title.appendChild(this.closeButton);\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('message', Message);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Message);\n\n//# sourceURL=webpack:///./src/plugins/message.js?");
239
+
240
+ /***/
241
+ }),
242
+
243
+ /***/
244
+ "./src/plugins/modal.js":
245
+ /*!******************************!*\
246
+ !*** ./src/plugins/modal.js ***!
247
+ \******************************/
248
+ /*! exports provided: default */
249
+ /***/
250
+ (function (module, __webpack_exports__, __webpack_require__) {
251
+
252
+ "use strict";
253
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Modal\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Modal {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created plugin instance\n */\n constructor(options) {\n if (!options) {\n options = {};\n }\n\n /**\n * Message body text.\n * @type {string}\n */\n this.root = options.hasOwnProperty('element') ? options.element : '';\n\n /**\n * Closable toggle switch.\n * @type {bool}\n */\n this.closable = options.hasOwnProperty('closable') ? options.closable : true;\n\n /**\n * The element used to close the message.\n * @type {HTMLElement}\n */\n this.closeButton = this.findCloseButton();\n\n if (this.closeButton && this.closable) {\n this.setupCloseEvent();\n }\n }\n\n /**\n * Helper method used by the Bulma core to create a new instance.\n * @param {Object} options THe options object for the new instance\n * @return {Modal} The newly created instance\n */\n static create(options) {\n return new Modal(options);\n }\n\n /**\n * Show the message.\n * @return {undefined}\n */\n open() {\n this.root.classList.add('is-active');\n }\n\n /**\n * Hide the message.\n * @return {undefined}\n */\n close() {\n this.root.classList.remove('is-active');\n }\n\n /**\n * Find the close button.\n * @return {HTMLElement} The newly created element\n */\n findCloseButton() {\n let element = this.root.querySelector('.modal-close');\n\n if (!element) {\n return this.root.querySelector('.delete');\n }\n\n return element;\n }\n\n /**\n * Setup the event listener for the close button.\n * @return {undefined}\n */\n setupCloseEvent() {\n this.closeButton.addEventListener('click', this.handleCloseEvent.bind(this));\n }\n\n /**\n * Handle the event when our close button is clicked.\n * @return {undefined}\n */\n handleCloseEvent() {\n this.close();\n }\n\n /**\n * Destroy the message, removing the event listener, interval and element.\n * @return {undefined}\n */\n destroy() {\n if (this.closable && this.closeButton) {\n this.closeButton.removeEventListener('click', this.handleCloseEvent.bind(this));\n }\n\n this.root = null;\n this.closeButton = null;\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @return {undefined}\n */\n static handleDomParsing() {\n return;\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('modal', Modal);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Modal);\n\n//# sourceURL=webpack:///./src/plugins/modal.js?");
254
+
255
+ /***/
256
+ }),
257
+
258
+ /***/
259
+ "./src/plugins/navbar.js":
260
+ /*!*******************************!*\
261
+ !*** ./src/plugins/navbar.js ***!
262
+ \*******************************/
263
+ /*! exports provided: default */
264
+ /***/
265
+ (function (module, __webpack_exports__, __webpack_require__) {
266
+
267
+ "use strict";
268
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Navbar\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Navbar {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created plugin instance\n */\n constructor(options) {\n if (!options.element || !options.trigger || !options.target) {\n throw new Error('[BulmaJS] The navbar component requires an element, trigger and target to function.');\n }\n\n /**\n * The root navbar element.\n * @type {HTMLElement}\n */\n this.root = options.element;\n\n /**\n * The element used for the trigger.\n * @type {HTMLElement}\n */\n this.trigger = options.trigger;\n\n /**\n * The target element.\n * @type {HTMLELement}\n */\n this.target = options.target;\n\n this.registerEvents();\n }\n\n /**\n * Register all the events this module needs.\n * @return {undefined}\n */\n registerEvents() {\n this.trigger.addEventListener('click', this.handleTriggerClick.bind(this));\n }\n\n /**\n * Handle the click event on the trigger.\n * @return {undefined}\n */\n handleTriggerClick() {\n if (this.target.classList.contains('is-active')) {\n this.target.classList.remove('is-active');\n } else {\n this.target.classList.add('is-active');\n }\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this instance\n * @return {undefined}\n */\n static handleDomParsing(element) {\n let trigger = element.querySelector('[data-trigger]'),\n target = trigger.getAttribute('data-target');\n\n new Navbar({\n element: element,\n trigger: trigger,\n target: element.querySelector('#' + target)\n });\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('navbar', Navbar);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Navbar);\n\n//# sourceURL=webpack:///./src/plugins/navbar.js?");
269
+
270
+ /***/
271
+ }),
272
+
273
+ /***/
274
+ "./src/plugins/notification.js":
275
+ /*!*************************************!*\
276
+ !*** ./src/plugins/notification.js ***!
277
+ \*************************************/
278
+ /*! exports provided: default */
279
+ /***/
280
+ (function (module, __webpack_exports__, __webpack_require__) {
281
+
282
+ "use strict";
283
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n/* harmony import */ var _dismissableComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dismissableComponent */ \"./src/dismissableComponent.js\");\n\n\n\n/**\n * @module Notification\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n * @extends DismissableComponent\n */\nclass Notification extends _dismissableComponent__WEBPACK_IMPORTED_MODULE_1__[\"default\"] {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created instance\n */\n constructor(options) {\n if (!options) {\n options = {};\n }\n\n super('notification', options);\n\n // TODO: Move this into the DismissableComponent class. Due to the required\n // changes between different components, we may need a way to trigger this\n // when the component is ready.\n if (this.isDismissable) {\n if (!options.hasOwnProperty('closeButton')) {\n this.prependCloseButton();\n }\n\n this.setupCloseEvent();\n }\n }\n\n /**\n * Helper method used by the Bulma core to create a new instance.\n * @param {Object} options The options object for this instance\n * @return {Notification} The newly created instance\n */\n static create(options) {\n return new Notification(options);\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this instance\n * @return {undefined}\n */\n static handleDomParsing(element) {\n let closeBtn = element.querySelector('.delete');\n let dismissInterval = element.getAttribute('data-dismiss-interval');\n\n let options = {\n body: null,\n parent: element.parentNode,\n element: element,\n closeButton: closeBtn,\n isDismissable: !!closeBtn,\n destroyOnDismiss: true\n };\n\n if (dismissInterval) {\n options['dismissInterval'] = parseInt(dismissInterval);\n }\n\n new Notification(options);\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('notification', Notification);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Notification);\n\n//# sourceURL=webpack:///./src/plugins/notification.js?");
284
+
285
+ /***/
286
+ }),
287
+
288
+ /***/
289
+ "./src/plugins/tabs.js":
290
+ /*!*****************************!*\
291
+ !*** ./src/plugins/tabs.js ***!
292
+ \*****************************/
293
+ /*! exports provided: default */
294
+ /***/
295
+ (function (module, __webpack_exports__, __webpack_require__) {
296
+
297
+ "use strict";
298
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Tabs\n * @since 0.4.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Tabs {\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created instance\n */\n constructor(options) {\n if (!options) {\n options = {};\n }\n\n this.root = options.hasOwnProperty('root') ? options.root : null;\n\n this.nav = this.findNav();\n this.navItems = this.findNavItems();\n\n this.content = this.findContent();\n this.contentItems = this.findContentItems();\n\n this.setupNavEvents();\n }\n\n findNav() {\n return this.root.querySelector('[data-links]');\n }\n\n findNavItems() {\n return this.nav.querySelectorAll('li');\n }\n\n findContent() {\n return this.root.querySelector('[data-content]');\n }\n\n findContentItems() {\n return this.content.querySelectorAll('li');\n }\n\n setupNavEvents() {\n this.navItems.forEach((navItem, index) => {\n navItem.addEventListener('click', () => {\n this.handleNavClick(navItem, index);\n });\n });\n }\n\n handleNavClick(navItem, index) {\n this.navItems.forEach(navItem => {\n navItem.classList.remove('is-active');\n });\n\n this.contentItems.forEach(contentItem => {\n contentItem.classList.remove('is-active');\n });\n\n navItem.classList.add('is-active');\n this.contentItems[index].classList.add('is-active');\n }\n\n /**\n * Helper method used by the Bulma core to create a new instance.\n * @param {Object} options The options object for this instance\n * @return {Tabs} The newly created instance\n */\n static create(options) {\n return new Tabs(options);\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this instance\n * @return {undefined}\n */\n static handleDomParsing(element) {\n let options = {\n root: element\n };\n\n new Tabs(options);\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('tabs', Tabs);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Tabs);\n\n//# sourceURL=webpack:///./src/plugins/tabs.js?");
299
+
300
+ /***/
301
+ })
302
+
303
+ /******/
304
+ });
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bulmajs/rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,25 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bulmajs-rails"
7
+ spec.version = "0.3.2"
8
+ spec.authors = ["Douglas Harrington Muhone"]
9
+ spec.email = ["theeomm@outlook.com"]
10
+
11
+ spec.summary = %q{Ruby on rails wrapper for the unofficial javascript extension to the awesome Bulma CSS framework.}
12
+ spec.homepage = "https://github.com/theeomm/bulmajs-rails"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.16"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ end
@@ -0,0 +1,4 @@
1
+ module Bulmajs
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bulmajs-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
+ platform: ruby
6
+ authors:
7
+ - Douglas Harrington Muhone
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - theeomm@outlook.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - app/assets/javascripts/.keep
72
+ - app/assets/javascripts/bulma.js
73
+ - bin/console
74
+ - bin/setup
75
+ - bulmajs-rails.gemspec
76
+ - lib/bulmajs-rails.rb
77
+ homepage: https://github.com/theeomm/bulmajs-rails
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.7.6
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Ruby on rails wrapper for the unofficial javascript extension to the awesome
101
+ Bulma CSS framework.
102
+ test_files: []