/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@riotjs/observable/dist/observable.js": /*!************************************************************!*\ !*** ./node_modules/@riotjs/observable/dist/observable.js ***! \************************************************************/ /***/ ((module) => { ;(function(window, undefined) {const ALL_CALLBACKS = '*' const define = Object.defineProperties const entries = Object.entries const on = (callbacks, el) => (event, fn) => { if (callbacks.has(event)) { callbacks.get(event).add(fn) } else { callbacks.set(event, new Set().add(fn)) } return el } const deleteCallback = (callbacks, el, event, fn) => { if (fn) { const fns = callbacks.get(event) if (fns) { fns.delete(fn) if (fns.size === 0) callbacks.delete(event) } } else callbacks.delete(event) } const off = (callbacks, el) => (event, fn) => { if (event === ALL_CALLBACKS && !fn) { callbacks.clear() } else { deleteCallback(callbacks, el, event, fn) } return el } const one = (callbacks, el) => (event, fn) => { function on(...args) { el.off(event, on) fn.apply(el, args) } return el.on(event, on) } const trigger = (callbacks, el) => (event, ...args) => { const fns = callbacks.get(event) if (fns) fns.forEach(fn => fn.apply(el, args)) if (callbacks.get(ALL_CALLBACKS) && event !== ALL_CALLBACKS) { el.trigger(ALL_CALLBACKS, event, ...args) } return el } const observable = function(el) { // eslint-disable-line const callbacks = new Map() const methods = {on, off, one, trigger} el = el || {} define(el, entries(methods).reduce((acc, [key, method]) => { acc[key] = { value: method(callbacks, el), enumerable: false, writable: false, configurable: false } return acc }, {}) ) return el } /* istanbul ignore next */ // support CommonJS, AMD & browser if (true) module.exports = observable else {} })(typeof window != 'undefined' ? window : undefined); /***/ }), /***/ "./js/components/hub/create.riot": /*!***************************************!*\ !*** ./js/components/hub/create.riot ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _stores_hub_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../stores/hub.js */ "./js/stores/hub.js"); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: { state: { text: 'new' }, /** * * */ onMounted() { // if props for text is set if (this.props.text) { this.state.text = this.props.text } }, /** * trigger open in storage * * * @param {object} event * */ handleOpen(event, data = undefined) { _stores_hub_js__WEBPACK_IMPORTED_MODULE_0__["default"].trigger('open', data) } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '', [ { redundantAttribute: 'expr18', selector: '[expr18]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 1, evaluate: _scope => [ _scope.state.text ].join( '' ) }, { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => (event) => { _scope.handleOpen(event) } } ] } ] ), name: 'app-hub-create' }); /***/ }), /***/ "./js/components/hub/form.riot": /*!*************************************!*\ !*** ./js/components/hub/form.riot ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var riot__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! riot */ "./node_modules/riot/riot.esm.js"); /* harmony import */ var _tiny_components_validator_src_formValidator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiny-components/validator/src/formValidator.js */ "./node_modules/@tiny-components/validator/src/formValidator.js"); /* harmony import */ var _stores_hub_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../stores/hub.js */ "./js/stores/hub.js"); /* harmony import */ var _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiny-components/notification/src/notificationStore.js */ "./node_modules/@tiny-components/notification/src/notificationStore.js"); /* harmony import */ var _tiny_components_sidebar_form_src_sidebarFormMixin_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tiny-components/sidebar-form/src/sidebarFormMixin.js */ "./node_modules/@tiny-components/sidebar-form/src/sidebarFormMixin.js"); /* harmony import */ var _tiny_components_validator_src_fieldError_riot__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tiny-components/validator/src/fieldError.riot */ "./node_modules/@tiny-components/validator/src/fieldError.riot"); // stores // mixins riot__WEBPACK_IMPORTED_MODULE_5__.register('field-error', _tiny_components_validator_src_fieldError_riot__WEBPACK_IMPORTED_MODULE_4__["default"]) /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: () => { return { ..._tiny_components_sidebar_form_src_sidebarFormMixin_js__WEBPACK_IMPORTED_MODULE_3__["default"], // adding basic funtion for sidebar state: { requestHandlers: [], validator: undefined }, /** * * */ onMounted() { // creating formValidator this.state.validator = new _tiny_components_validator_src_formValidator_js__WEBPACK_IMPORTED_MODULE_0__["default"](this.$('.form'), { 'name': { 'presence': true }, 'directory': { 'presence': true }, 'description': { 'presence': false } }) // adding on success this.state.validator.onSuccess((event, data) => { this.handleSuccess(event, data) }) // adding on success this.state.validator.onError((event, data) => { this.state.isLoading = false // add notification _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_2__["default"].danger('Error! Check your input!') this.update() }) // if open event _stores_hub_js__WEBPACK_IMPORTED_MODULE_1__["default"].on('open', (data) => { this.state.isOpen = true if (data && data._id) { this.state.current = data } this.update() }) }, /** * * * */ reset() { this.state.current = { name: '', directory: '', description: '' } }, /** * send data to server * * @param {object} event * @param {object} data * */ handleSuccess(event, data) { event.preventDefault() let method = 'POST' // if data has id, change to method for update task if (this.state.current._id) { method = 'PUT' } fetch('/api/hubs/v1', { 'method': method, 'body': JSON.stringify(data), 'headers': { 'Content-Type': 'application/json' } }) .then((response) => response.json()) .then((response) => { // stop loading this.state.isLoading = false // add id to current this.state.current._id = response.data.id this.state.current._rev = response.data.rev this.state.current = Object.assign(this.state.current, data) if (method === 'POST') { _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_2__["default"].success('Success! Task created!') } else { _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_2__["default"].success('Success! Task ' + response.data.name + ' created!') } // fetch for new tasks of component:tasks _stores_hub_js__WEBPACK_IMPORTED_MODULE_1__["default"].get() this.update() // if button has attribute close if (event.submitter.attributes.close) { this.handleClose() } }).catch((error) => { // stop loading this.state.isLoading = false // show error message _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_2__["default"].danger('Error! Server has a Error, Request can not proceed!') this.update() }) } } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '', [ { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'tiny-sidebar-form', slots: [ { id: 'title', html: '', bindings: [ { type: bindingTypes.IF, evaluate: _scope => _scope.state.current._id, redundantAttribute: 'expr7', selector: '[expr7]', template: template( null, [ { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'virtual', slots: [ { id: 'default', html: ' ', bindings: [ { expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ 'Edit Task ', _scope.state.current.name ].join( '' ) } ] } ] } ], attributes: [] } ] ) }, { type: bindingTypes.IF, evaluate: _scope => !_scope.state.current._id, redundantAttribute: 'expr8', selector: '[expr8]', template: template( null, [ { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'virtual', slots: [ { id: 'default', html: '\n New Task\n ', bindings: [] } ], attributes: [] } ] ) } ] }, { id: 'form', html: '
', bindings: [ { redundantAttribute: 'expr9', selector: '[expr9]', expressions: [ { type: expressionTypes.EVENT, name: 'onsubmit', evaluate: _scope => (event) => { _scope.state.isLoading = true; _scope.update(); _scope.state.validator.submit(event) } } ] }, { type: bindingTypes.IF, evaluate: _scope => _scope.state.current._id, redundantAttribute: 'expr10', selector: '[expr10]', template: template( null, [ { expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'value', evaluate: _scope => _scope.state.current._id } ] } ] ) }, { type: bindingTypes.IF, evaluate: _scope => _scope.state.current._rev, redundantAttribute: 'expr11', selector: '[expr11]', template: template( null, [ { expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'value', evaluate: _scope => _scope.state.current._rev } ] } ] ) }, { redundantAttribute: 'expr12', selector: '[expr12]', expressions: [ { type: expressionTypes.VALUE, evaluate: _scope => _scope.state.current.name } ] }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr13', selector: '[expr13]' }, { redundantAttribute: 'expr14', selector: '[expr14]', expressions: [ { type: expressionTypes.VALUE, evaluate: _scope => _scope.state.current.directory } ] }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr15', selector: '[expr15]' }, { redundantAttribute: 'expr16', selector: '[expr16]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => _scope.state.current.description } ] }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr17', selector: '[expr17]' } ] } ], attributes: [ { type: expressionTypes.ATTRIBUTE, name: 'open', evaluate: _scope => _scope.state.isOpen }, { type: expressionTypes.ATTRIBUTE, name: 'close', evaluate: _scope => () => { _scope.handleClose() } }, { type: expressionTypes.ATTRIBUTE, name: 'loading', evaluate: _scope => _scope.state.isLoading } ], redundantAttribute: 'expr6', selector: '[expr6]' } ] ), name: 'app-hub-form' }); /***/ }), /***/ "./js/components/hub/index.riot": /*!**************************************!*\ !*** ./js/components/hub/index.riot ***! \**************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _stores_hub_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../stores/hub.js */ "./js/stores/hub.js"); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: { state: { hubs: [] }, onMounted() { _stores_hub_js__WEBPACK_IMPORTED_MODULE_0__["default"].on('update', (data) => { this.state.hubs = data this.update() }) _stores_hub_js__WEBPACK_IMPORTED_MODULE_0__["default"].get() } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
', [ { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'app-hub-create', slots: [], attributes: [], redundantAttribute: 'expr0', selector: '[expr0]' }, { type: bindingTypes.EACH, getKey: null, condition: null, template: template( '

', [ { redundantAttribute: 'expr2', selector: '[expr2]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'href', evaluate: _scope => [ '/hub/', _scope.hub._id ].join( '' ) } ] }, { redundantAttribute: 'expr3', selector: '[expr3]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => _scope.hub.name } ] }, { type: bindingTypes.IF, evaluate: _scope => _scope.hub.description, redundantAttribute: 'expr4', selector: '[expr4]', template: template( ' ', [ { expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.hub.description ].join( '' ) } ] } ] ) } ] ), redundantAttribute: 'expr1', selector: '[expr1]', itemName: 'hub', indexName: null, evaluate: _scope => _scope.state.hubs }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'app-hub-form', slots: [], attributes: [], redundantAttribute: 'expr5', selector: '[expr5]' } ] ), name: 'app-hub-index' }); /***/ }), /***/ "./node_modules/@tiny-components/loading/src/loading.riot": /*!****************************************************************!*\ !*** ./node_modules/@tiny-components/loading/src/loading.riot ***! \****************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: null, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
', [ { type: bindingTypes.IF, evaluate: _scope => _scope.props.active, redundantAttribute: 'expr33', selector: '[expr33]', template: template( '
', [] ) } ] ), name: 'tiny-loading' }); /***/ }), /***/ "./node_modules/@tiny-components/notification/src/notification.riot": /*!**************************************************************************!*\ !*** ./node_modules/@tiny-components/notification/src/notification.riot ***! \**************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/v4.js"); /* harmony import */ var _notificationStore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./notificationStore.js */ "./node_modules/@tiny-components/notification/src/notificationStore.js"); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: { state: { items: [], timeout: 5000, prefixId: 'tiny-notification-', wrapperClass: '' }, /** * on mounted * * @param {Object} props * @param {Object} state * */ onMounted(props, state) { // change timeout by props if (props.timeout) { state.timeout = props.timeout } // change timeout by props if (props.wrapperClass) { state.wrapperClass = props.wrapperClass } // adding service for notifications and listen to "update" _notificationStore_js__WEBPACK_IMPORTED_MODULE_0__["default"].on('append', (item) => { // adding attributes item.id = this.state.prefixId + 'toast-' + (0,uuid__WEBPACK_IMPORTED_MODULE_1__["default"])() // create timeout to remove notification item.timeout = setTimeout(() => { this.removeItem(item) }, this.state.timeout) item.classes = [ 'toast', 'toast--' + item.type ] this.state.items.push(item) this.update() setTimeout(() => { for (let i = 0; i < this.state.items.length; i++) { if (this.state.items[i].id === item.id) { this.state.items[i].classes.push('toast--animation') this.update() } } }, 10) }) }, /** * remove single item * * * @param {Object} item * */ removeItem(item) { // set event transitionend only to item that has to removed // after animation is complete search for cleartimeout and remove it // form items this.$('#' + item.id).addEventListener('transitionend', () => { const items = [] for (let i = 0; i < this.state.items.length; i++) { if (this.state.items[i].id === item.id) { clearTimeout(this.state.items[i].timeout) } else { items.push(this.state.items[i]) } } this.state.items = items this.update() }) // remove class animation and update requestAnimationFrame(() => { for (let i = 0; i < this.state.items.length; i++) { if (this.state.items[i].id === item.id) { this.state.items[i].classes.pop('toast--animation') this.update() } } }) }, /** * remove item by clicked on it * * @param {Object} event * @param {Object} item * */ handleClick(event, item) { this.removeItem(item) } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
', [ { type: bindingTypes.IF, evaluate: _scope => _scope.state.items.length > 0, redundantAttribute: 'expr28', selector: '[expr28]', template: template( '
', [ { expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'class', evaluate: _scope => [ 'toast-wrapper ', _scope.state.wrapperClass ].join( '' ) } ] }, { type: bindingTypes.EACH, getKey: null, condition: null, template: template( '
', [ { expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'id', evaluate: _scope => _scope.item.id }, { type: expressionTypes.ATTRIBUTE, name: 'class', evaluate: _scope => _scope.item.classes.join(' ') }, { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => (event) => { _scope.handleClick(event, _scope.item) } } ] }, { redundantAttribute: 'expr30', selector: '[expr30]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.item.message ].join( '' ) } ] } ] ), redundantAttribute: 'expr29', selector: '[expr29]', itemName: 'item', indexName: null, evaluate: _scope => _scope.state.items } ] ) } ] ), name: 'tiny-notification' }); /***/ }), /***/ "./node_modules/@tiny-components/sidebar-form/src/sidebarForm.riot": /*!*************************************************************************!*\ !*** ./node_modules/@tiny-components/sidebar-form/src/sidebarForm.riot ***! \*************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var riot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! riot */ "./node_modules/riot/riot.esm.js"); /* harmony import */ var _tiny_components_loading_src_loading_riot__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiny-components/loading/src/loading.riot */ "./node_modules/@tiny-components/loading/src/loading.riot"); // adding TinyLoading riot__WEBPACK_IMPORTED_MODULE_1__.register('tiny-loading', _tiny_components_loading_src_loading_riot__WEBPACK_IMPORTED_MODULE_0__["default"]) /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: { /** * * */ handleClose() { this.props.close() }, /** * getting css classes for sidebar * * * @return {String} */ getCssClasses() { const classes = [ 'sidebar' ] if (this.props.open === true) { classes.push('sidebar--open') } return classes.join(' ') } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
', [ { redundantAttribute: 'expr19', selector: '[expr19]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'class', evaluate: _scope => _scope.getCssClasses() } ] }, { type: bindingTypes.SLOT, attributes: [], name: 'title', redundantAttribute: 'expr20', selector: '[expr20]' }, { redundantAttribute: 'expr21', selector: '[expr21]', expressions: [ { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => (event) => { _scope.handleClose(event) } } ] }, { type: bindingTypes.SLOT, attributes: [], name: 'form', redundantAttribute: 'expr22', selector: '[expr22]' }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'tiny-loading', slots: [], attributes: [ { type: expressionTypes.ATTRIBUTE, name: 'active', evaluate: _scope => _scope.props.loading } ], redundantAttribute: 'expr23', selector: '[expr23]' }, { redundantAttribute: 'expr24', selector: '[expr24]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'form', evaluate: _scope => _scope.props.formId }, { type: expressionTypes.ATTRIBUTE, name: 'disabled', evaluate: _scope => _scope.props.loading } ] }, { redundantAttribute: 'expr25', selector: '[expr25]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'form', evaluate: _scope => _scope.props.formId }, { type: expressionTypes.ATTRIBUTE, name: 'disabled', evaluate: _scope => _scope.props.loading } ] } ] ), name: 'tiny-sidebar-form' }); /***/ }), /***/ "./node_modules/@tiny-components/validator/src/fieldError.riot": /*!*********************************************************************!*\ !*** ./node_modules/@tiny-components/validator/src/fieldError.riot ***! \*********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: { state: { errors: [ ], // css class for closest: '.field-group', }, /** * * * @param {Object} props * @param {Object} state * */ onBeforeMounted(props, state) { if (props.closest) { state.closest = props.closest } }, /** * * * @param {Object} props * @param {Object} state * */ onMounted(props, state) { // getting parent element for entire field const parent = this.root.closest(state.closest) // getting current element by name const element = parent.querySelector('[name="' + props.name + '"]') // getting form const form = element.closest('form') // element, form are exists and nofieldupdate is not set // each change of the element dispatch a event to form validation if (element && form && !props.nofieldupdate) { element.addEventListener('input', (event) => { this.dispatchCustomEvent(event, form, props.name) }) } // add custom event to listen to form-validation this.root.addEventListener('form-validation', (event) => { this.onFormValidation(event, parent) }) }, /** * process form validation triggered by form * * @param {Event} event * @param {Element} parent * */ onFormValidation(event, parent) { // if detail is a value, set to errors if (event.detail) { this.state.errors = event.detail parent.classList.add('field--error') parent.classList.remove('field--valid') } else { this.state.errors = [] parent.classList.remove('field--error') parent.classList.add('field--valid') } this.update() }, /** * create event to send to form validation * * @param {Event} event * @param {Element} form * @param {string} name * */ dispatchCustomEvent(event, form, name) { const fieldUpdateEvent = new CustomEvent('field-update', { 'detail': { 'name': name, 'value': event.target.value } }) form.dispatchEvent(fieldUpdateEvent) } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
', [ { type: bindingTypes.IF, evaluate: _scope => _scope.state.errors.length > 0, redundantAttribute: 'expr31', selector: '[expr31]', template: template( '', [ { type: bindingTypes.EACH, getKey: null, condition: null, template: template( ' ', [ { expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.error ].join( '' ) } ] } ] ), redundantAttribute: 'expr32', selector: '[expr32]', itemName: 'error', indexName: null, evaluate: _scope => _scope.state.errors } ] ) } ] ), name: 'field-error' }); /***/ }), /***/ "./node_modules/@tiny-components/notification/src/notificationStore.js": /*!*****************************************************************************!*\ !*** ./node_modules/@tiny-components/notification/src/notificationStore.js ***! \*****************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _riotjs_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @riotjs/observable */ "./node_modules/@riotjs/observable/dist/observable.js"); /* harmony import */ var _riotjs_observable__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_riotjs_observable__WEBPACK_IMPORTED_MODULE_0__); /** * NotificationService * * @author Björn Hase * @license http://opensource.org/licenses/MIT The MIT License * @link https://gitea.node001.net/tiny-components/notification * */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_riotjs_observable__WEBPACK_IMPORTED_MODULE_0___default()({ SUCCESS: 'success', DANGER: 'danger', INFO: 'info', /** * adding success notification * */ success(message) { this._add(message, this.SUCCESS) }, /** * * */ danger(message) { this._add(message, this.DANGER) }, /** * * */ info(message) { this._add(message, this.INFO) }, /** * * @param {[type]} message [description] * @param {[type]} type [description] */ _add(message, type) { this.trigger('append', { message: message, type: type }) } })); /***/ }), /***/ "./node_modules/@tiny-components/sidebar-form/src/sidebarFormMixin.js": /*!****************************************************************************!*\ !*** ./node_modules/@tiny-components/sidebar-form/src/sidebarFormMixin.js ***! \****************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /** * Mixin to Extend a Sidebar * * @author Björn Hase * @license http://opensource.org/licenses/MIT The MIT License * @link https://gitea.node001.net/tiny-components/sidebar-form * */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ state: { isOpen: false, // if sidebar is open isLoading: false // if loading is shown }, /** * close current sidebar * */ handleClose() { this.state.isOpen = false this.reset() this.update() }, /** * * */ onBeforeMount() { this.reset() }, /** * function to reset current form data * will call before Mount and after close * */ reset() { } }); /***/ }), /***/ "./node_modules/@tiny-components/validator/src/formValidator.js": /*!**********************************************************************!*\ !*** ./node_modules/@tiny-components/validator/src/formValidator.js ***! \**********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! validate.js */ "./node_modules/validate.js/validate.js"); /* harmony import */ var validate_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(validate_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var form_serialize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! form-serialize */ "./node_modules/form-serialize/index.js"); /* harmony import */ var form_serialize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(form_serialize__WEBPACK_IMPORTED_MODULE_1__); /** * Form Validator with RiotJS Components * * * @author HerrHase * */ class FormValidator { /** * * @param {[type]} formSelector [description] * @param {[type]} constraits [description] */ constructor(formElement, constraits, addSubmitEvent = false) { // constraits for validate.js this.constraits = constraits // get form and elements this.formElement = formElement // if form not found if (!this.formElement) { console.error('FormValidator: form not found!') } this.elements = this.formElement.querySelectorAll('field-error') // adding event if a element is updated this.formElement.addEventListener('field-update', (event) => { this._onFieldUpdate(event) }) // adding submit event if (addSubmitEvent) { this.formElement.addEventListener('submit', (event) => { this._onSubmit(event) }) } } /** * trigger submit * * @param {object} event * */ submit(event) { this._onSubmit(event) } /** * * @param {function} onError * */ onError(onError) { this._onError = onError } /** * settin onSuccess callback and add submit-event on form * * @param {function} onSuccess * */ onSuccess(onSuccess) { // adding onSuccess this._onSuccess = onSuccess } /** * * @param {function} onError * */ onBeforeSubmit(onBeforeSubmit) { this._onBeforeSubmit = onBeforeSubmit } /** * handle submit * * * @param {Event} event * */ _onSubmit(event) { // getting data from target of submit event const data = form_serialize__WEBPACK_IMPORTED_MODULE_1___default()(event.target, { hash: true }) // options for validate.js const options = { fullMessages: false } if (this._onBeforeSubmit) { this._onBeforeSubmit() } // check form and getting errors validate_js__WEBPACK_IMPORTED_MODULE_0___default().async(data, this.constraits, options).then( () => { this._onSuccess(event, data) }, (errors) => { event.preventDefault() // if onError is set, tha if (this._onError) { this._onError(event, errors, data) } // send each element a event this.elements.forEach((element) => { let elementErrors = false // check for errors by name if (errors[element.attributes.name.nodeValue]) { elementErrors = errors[element.attributes.name.nodeValue] } this._dispatchCustomEvent(elementErrors, element) }) } ) } /** * send update to fields * * * @param {Event} event * */ _onFieldUpdate(event) { // workaround, make sure that value for single is undefined if it is empty if (event.detail.value == '') { event.detail.value = undefined } let errors = validate_js__WEBPACK_IMPORTED_MODULE_0___default().single(event.detail.value, this.constraits[event.detail.name]) // search for element by name and dispatch event this.elements.forEach((element) => { if (element.attributes.name.nodeValue == event.detail.name) { this._dispatchCustomEvent(errors, element) } }) } /** * dispatch event to single element * * @param {Array} errors * @param {Element} element * */ _dispatchCustomEvent(errors, element) { let detail = false if (errors) { detail = errors } const formValidationEvent = new CustomEvent('form-validation', { 'detail': detail }) element.dispatchEvent(formValidationEvent) } } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FormValidator); /***/ }), /***/ "./js/app.js": /*!*******************!*\ !*** ./js/app.js ***! \*******************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var riot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! riot */ "./node_modules/riot/riot.esm.js"); /* harmony import */ var _tiny_components_notification_src_notification_riot__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiny-components/notification/src/notification.riot */ "./node_modules/@tiny-components/notification/src/notification.riot"); /* harmony import */ var _tiny_components_sidebar_form_src_sidebarForm_riot__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiny-components/sidebar-form/src/sidebarForm.riot */ "./node_modules/@tiny-components/sidebar-form/src/sidebarForm.riot"); /* harmony import */ var _components_hub_index_riot__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/hub/index.riot */ "./js/components/hub/index.riot"); /* harmony import */ var _components_hub_create_riot__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/hub/create.riot */ "./js/components/hub/create.riot"); /* harmony import */ var _components_hub_form_riot__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/hub/form.riot */ "./js/components/hub/form.riot"); riot__WEBPACK_IMPORTED_MODULE_1__.register('tiny-notification', _tiny_components_notification_src_notification_riot__WEBPACK_IMPORTED_MODULE_0__["default"]); riot__WEBPACK_IMPORTED_MODULE_1__.register('tiny-sidebar-form', _tiny_components_sidebar_form_src_sidebarForm_riot__WEBPACK_IMPORTED_MODULE_2__["default"]); // register components riot__WEBPACK_IMPORTED_MODULE_1__.register('app-hub-index', _components_hub_index_riot__WEBPACK_IMPORTED_MODULE_3__["default"]); riot__WEBPACK_IMPORTED_MODULE_1__.register('app-hub-create', _components_hub_create_riot__WEBPACK_IMPORTED_MODULE_4__["default"]); riot__WEBPACK_IMPORTED_MODULE_1__.register('app-hub-form', _components_hub_form_riot__WEBPACK_IMPORTED_MODULE_5__["default"]); // mount components riot__WEBPACK_IMPORTED_MODULE_1__.mount('app-hub-index'); /***/ }), /***/ "./js/stores/hub.js": /*!**************************!*\ !*** ./js/stores/hub.js ***! \**************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _riotjs_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @riotjs/observable */ "./node_modules/@riotjs/observable/dist/observable.js"); /* harmony import */ var _riotjs_observable__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_riotjs_observable__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tiny-components/notification/src/notificationStore.js */ "./node_modules/@tiny-components/notification/src/notificationStore.js"); /** * * Store for hub * * * @author Björn Hase * */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_riotjs_observable__WEBPACK_IMPORTED_MODULE_0___default()({ /** * getting all hubs, * trigger update after response * * * @param {object} data * */ get: function get() { var _this = this; fetch('/api/hubs/v1').then(function (response) { return response.json(); }).then(function (response) { _this.trigger('update', response.data); })["catch"](function () { _tiny_components_notification_src_notificationStore_js__WEBPACK_IMPORTED_MODULE_1__["default"].danger('Error! Connection Problem!'); }); } })); /***/ }), /***/ "./node_modules/form-serialize/index.js": /*!**********************************************!*\ !*** ./node_modules/form-serialize/index.js ***! \**********************************************/ /***/ ((module) => { // get successful control from form and assemble into object // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2 // types which indicate a submit action and are not successful controls // these will be ignored var k_r_submitter = /^(?:submit|button|image|reset|file)$/i; // node names which could be successful controls var k_r_success_contrls = /^(?:input|select|textarea|keygen)/i; // Matches bracket notation. var brackets = /(\[[^\[\]]*\])/g; // serializes form fields // @param form MUST be an HTMLForm element // @param options is an optional argument to configure the serialization. Default output // with no options specified is a url encoded string // - hash: [true | false] Configure the output type. If true, the output will // be a js object. // - serializer: [function] Optional serializer function to override the default one. // The function takes 3 arguments (result, key, value) and should return new result // hash and url encoded str serializers are provided with this module // - disabled: [true | false]. If true serialize disabled fields. // - empty: [true | false]. If true serialize empty fields function serialize(form, options) { if (typeof options != 'object') { options = { hash: !!options }; } else if (options.hash === undefined) { options.hash = true; } var result = (options.hash) ? {} : ''; var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize); var elements = form && form.elements ? form.elements : []; //Object store each radio and set if it's empty or not var radio_store = Object.create(null); for (var i=0 ; i myString */ function dashToCamelCase(string) { return string.replace(/-(\w)/g, (_, c) => c.toUpperCase()); } /** * Get all the element attributes as object * @param {HTMLElement} element - DOM node we want to parse * @returns {Object} all the attributes found as a key value pairs */ function DOMattributesToObject(element) { return Array.from(element.attributes).reduce((acc, attribute) => { acc[dashToCamelCase(attribute.name)] = attribute.value; return acc; }, {}); } /** * Move all the child nodes from a source tag to another * @param {HTMLElement} source - source node * @param {HTMLElement} target - target node * @returns {undefined} it's a void method ¯\_(ツ)_/¯ */ // Ignore this helper because it's needed only for svg tags function moveChildren(source, target) { if (source.firstChild) { target.appendChild(source.firstChild); moveChildren(source, target); } } /** * Remove the child nodes from any DOM node * @param {HTMLElement} node - target node * @returns {undefined} */ function cleanNode(node) { clearChildren(node.childNodes); } /** * Clear multiple children in a node * @param {HTMLElement[]} children - direct children nodes * @returns {undefined} */ function clearChildren(children) { Array.from(children).forEach(removeChild); } /** * Remove a node * @param {HTMLElement}node - node to remove * @returns {undefined} */ const removeChild = node => node && node.parentNode && node.parentNode.removeChild(node); /** * Insert before a node * @param {HTMLElement} newNode - node to insert * @param {HTMLElement} refNode - ref child * @returns {undefined} */ const insertBefore = (newNode, refNode) => refNode && refNode.parentNode && refNode.parentNode.insertBefore(newNode, refNode); /** * Replace a node * @param {HTMLElement} newNode - new node to add to the DOM * @param {HTMLElement} replaced - node to replace * @returns {undefined} */ const replaceChild = (newNode, replaced) => replaced && replaced.parentNode && replaced.parentNode.replaceChild(newNode, replaced); // Riot.js constants that can be used accross more modules const COMPONENTS_IMPLEMENTATION_MAP$1 = new Map(), DOM_COMPONENT_INSTANCE_PROPERTY$1 = Symbol('riot-component'), PLUGINS_SET$1 = new Set(), IS_DIRECTIVE = 'is', VALUE_ATTRIBUTE = 'value', MOUNT_METHOD_KEY = 'mount', UPDATE_METHOD_KEY = 'update', UNMOUNT_METHOD_KEY = 'unmount', SHOULD_UPDATE_KEY = 'shouldUpdate', ON_BEFORE_MOUNT_KEY = 'onBeforeMount', ON_MOUNTED_KEY = 'onMounted', ON_BEFORE_UPDATE_KEY = 'onBeforeUpdate', ON_UPDATED_KEY = 'onUpdated', ON_BEFORE_UNMOUNT_KEY = 'onBeforeUnmount', ON_UNMOUNTED_KEY = 'onUnmounted', PROPS_KEY = 'props', STATE_KEY = 'state', SLOTS_KEY = 'slots', ROOT_KEY = 'root', IS_PURE_SYMBOL = Symbol('pure'), IS_COMPONENT_UPDATING = Symbol('is_updating'), PARENT_KEY_SYMBOL = Symbol('parent'), ATTRIBUTES_KEY_SYMBOL = Symbol('attributes'), TEMPLATE_KEY_SYMBOL = Symbol('template'); var globals = /*#__PURE__*/Object.freeze({ __proto__: null, COMPONENTS_IMPLEMENTATION_MAP: COMPONENTS_IMPLEMENTATION_MAP$1, DOM_COMPONENT_INSTANCE_PROPERTY: DOM_COMPONENT_INSTANCE_PROPERTY$1, PLUGINS_SET: PLUGINS_SET$1, IS_DIRECTIVE: IS_DIRECTIVE, VALUE_ATTRIBUTE: VALUE_ATTRIBUTE, MOUNT_METHOD_KEY: MOUNT_METHOD_KEY, UPDATE_METHOD_KEY: UPDATE_METHOD_KEY, UNMOUNT_METHOD_KEY: UNMOUNT_METHOD_KEY, SHOULD_UPDATE_KEY: SHOULD_UPDATE_KEY, ON_BEFORE_MOUNT_KEY: ON_BEFORE_MOUNT_KEY, ON_MOUNTED_KEY: ON_MOUNTED_KEY, ON_BEFORE_UPDATE_KEY: ON_BEFORE_UPDATE_KEY, ON_UPDATED_KEY: ON_UPDATED_KEY, ON_BEFORE_UNMOUNT_KEY: ON_BEFORE_UNMOUNT_KEY, ON_UNMOUNTED_KEY: ON_UNMOUNTED_KEY, PROPS_KEY: PROPS_KEY, STATE_KEY: STATE_KEY, SLOTS_KEY: SLOTS_KEY, ROOT_KEY: ROOT_KEY, IS_PURE_SYMBOL: IS_PURE_SYMBOL, IS_COMPONENT_UPDATING: IS_COMPONENT_UPDATING, PARENT_KEY_SYMBOL: PARENT_KEY_SYMBOL, ATTRIBUTES_KEY_SYMBOL: ATTRIBUTES_KEY_SYMBOL, TEMPLATE_KEY_SYMBOL: TEMPLATE_KEY_SYMBOL }); const EACH = 0; const IF = 1; const SIMPLE = 2; const TAG = 3; const SLOT = 4; var bindingTypes = { EACH, IF, SIMPLE, TAG, SLOT }; const ATTRIBUTE = 0; const EVENT = 1; const TEXT = 2; const VALUE = 3; var expressionTypes = { ATTRIBUTE, EVENT, TEXT, VALUE }; const HEAD_SYMBOL = Symbol('head'); const TAIL_SYMBOL = Symbol('tail'); /** * Create the