/******/ (() => { // 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); /***/ }), /***/ "../../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 } /** * 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 } // 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); /***/ }), /***/ "../../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", error: ""}, ...] runValidations: function(attributes, constraints, options) { var results = [] , attr , validatorName , value , validators , validator , validatorOptions , error; if (v.isDomElement(attributes) || v.isJqueryElement(attributes)) { attributes = v.collectFormValues(attributes); } // Loops through each constraints, finds the correct validator and run it. for (attr in constraints) { value = v.getDeepObjectValue(attributes, attr); // This allows the constraints for an attribute to be a function. // The function will be called with the value, attribute name, the complete dict of // attributes as well as the options and constraints passed in. // This is useful when you want to have different // validations depending on the attribute value. validators = v.result(constraints[attr], value, attributes, attr, options, constraints); for (validatorName in validators) { validator = v.validators[validatorName]; if (!validator) { error = v.format("Unknown validator %{name}", {name: validatorName}); throw new Error(error); } validatorOptions = validators[validatorName]; // This allows the options to be a function. The function will be // called with the value, attribute name, the complete dict of // attributes as well as the options and constraints passed in. // This is useful when you want to have different // validations depending on the attribute value. validatorOptions = v.result(validatorOptions, value, attributes, attr, options, constraints); if (!validatorOptions) { continue; } results.push({ attribute: attr, value: value, validator: validatorName, globalOptions: options, attributes: attributes, options: validatorOptions, error: validator.call(validator, value, validatorOptions, attr, attributes, options) }); } } return results; }, // Takes the output from runValidations and converts it to the correct // output format. processValidationResults: function(errors, options) { errors = v.pruneEmptyErrors(errors, options); errors = v.expandMultipleErrors(errors, options); errors = v.convertErrorMessages(errors, options); var format = options.format || "grouped"; if (typeof v.formatters[format] === 'function') { errors = v.formatters[format](errors); } else { throw new Error(v.format("Unknown format %{format}", options)); } return v.isEmpty(errors) ? undefined : errors; }, // Runs the validations with support for promises. // This function will return a promise that is settled when all the // validation promises have been completed. // It can be called even if no validations returned a promise. async: function(attributes, constraints, options) { options = v.extend({}, v.async.options, options); var WrapErrors = options.wrapErrors || function(errors) { return errors; }; // Removes unknown attributes if (options.cleanAttributes !== false) { attributes = v.cleanAttributes(attributes, constraints); } var results = v.runValidations(attributes, constraints, options); return new v.Promise(function(resolve, reject) { v.waitForResults(results).then(function() { var errors = v.processValidationResults(results, options); if (errors) { reject(new WrapErrors(errors, options, attributes, constraints)); } else { resolve(attributes); } }, function(err) { reject(err); }); }); }, single: function(value, constraints, options) { options = v.extend({}, v.single.options, options, { format: "flat", fullMessages: false }); return v({single: value}, {single: constraints}, options); }, // Returns a promise that is resolved when all promises in the results array // are settled. The promise returned from this function is always resolved, // never rejected. // This function modifies the input argument, it replaces the promises // with the value returned from the promise. waitForResults: function(results) { // Create a sequence of all the results starting with a resolved promise. return results.reduce(function(memo, result) { // If this result isn't a promise skip it in the sequence. if (!v.isPromise(result.error)) { return memo; } return memo.then(function() { return result.error.then(function(error) { result.error = error || null; }); }); }, new v.Promise(function(r) { r(); })); // A resolved promise }, // If the given argument is a call: function the and: function return the value // otherwise just return the value. Additional arguments will be passed as // arguments to the function. // Example: // ``` // result('foo') // 'foo' // result(Math.max, 1, 2) // 2 // ``` result: function(value) { var args = [].slice.call(arguments, 1); if (typeof value === 'function') { value = value.apply(null, args); } return value; }, // Checks if the value is a number. This function does not consider NaN a // number like many other `isNumber` functions do. isNumber: function(value) { return typeof value === 'number' && !isNaN(value); }, // Returns false if the object is not a function isFunction: function(value) { return typeof value === 'function'; }, // A simple check to verify that the value is an integer. Uses `isNumber` // and a simple modulo check. isInteger: function(value) { return v.isNumber(value) && value % 1 === 0; }, // Checks if the value is a boolean isBoolean: function(value) { return typeof value === 'boolean'; }, // Uses the `Object` function to check if the given argument is an object. isObject: function(obj) { return obj === Object(obj); }, // Simply checks if the object is an instance of a date isDate: function(obj) { return obj instanceof Date; }, // Returns false if the object is `null` of `undefined` isDefined: function(obj) { return obj !== null && obj !== undefined; }, // Checks if the given argument is a promise. Anything with a `then` // function is considered a promise. isPromise: function(p) { return !!p && v.isFunction(p.then); }, isJqueryElement: function(o) { return o && v.isString(o.jquery); }, isDomElement: function(o) { if (!o) { return false; } if (!o.querySelectorAll || !o.querySelector) { return false; } if (v.isObject(document) && o === document) { return true; } // http://stackoverflow.com/a/384380/699304 /* istanbul ignore else */ if (typeof HTMLElement === "object") { return o instanceof HTMLElement; } else { return o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"; } }, isEmpty: function(value) { var attr; // Null and undefined are empty if (!v.isDefined(value)) { return true; } // functions are non empty if (v.isFunction(value)) { return false; } // Whitespace only strings are empty if (v.isString(value)) { return v.EMPTY_STRING_REGEXP.test(value); } // For arrays we use the length property if (v.isArray(value)) { return value.length === 0; } // Dates have no attributes but aren't empty if (v.isDate(value)) { return false; } // If we find at least one property we consider it non empty if (v.isObject(value)) { for (attr in value) { return false; } return true; } return false; }, // Formats the specified strings with the given values like so: // ``` // format("Foo: %{foo}", {foo: "bar"}) // "Foo bar" // ``` // If you want to write %{...} without having it replaced simply // prefix it with % like this `Foo: %%{foo}` and it will be returned // as `"Foo: %{foo}"` format: v.extend(function(str, vals) { if (!v.isString(str)) { return str; } return str.replace(v.format.FORMAT_REGEXP, function(m0, m1, m2) { if (m1 === '%') { return "%{" + m2 + "}"; } else { return String(vals[m2]); } }); }, { // Finds %{key} style patterns in the given string FORMAT_REGEXP: /(%?)%\{([^\}]+)\}/g }), // "Prettifies" the given string. // Prettifying means replacing [.\_-] with spaces as well as splitting // camel case words. prettify: function(str) { if (v.isNumber(str)) { // If there are more than 2 decimals round it to two if ((str * 100) % 1 === 0) { return "" + str; } else { return parseFloat(Math.round(str * 100) / 100).toFixed(2); } } if (v.isArray(str)) { return str.map(function(s) { return v.prettify(s); }).join(", "); } if (v.isObject(str)) { if (!v.isDefined(str.toString)) { return JSON.stringify(str); } return str.toString(); } // Ensure the string is actually a string str = "" + str; return str // Splits keys separated by periods .replace(/([^\s])\.([^\s])/g, '$1 $2') // Removes backslashes .replace(/\\+/g, '') // Replaces - and - with space .replace(/[_-]/g, ' ') // Splits camel cased words .replace(/([a-z])([A-Z])/g, function(m0, m1, m2) { return "" + m1 + " " + m2.toLowerCase(); }) .toLowerCase(); }, stringifyValue: function(value, options) { var prettify = options && options.prettify || v.prettify; return prettify(value); }, isString: function(value) { return typeof value === 'string'; }, isArray: function(value) { return {}.toString.call(value) === '[object Array]'; }, // Checks if the object is a hash, which is equivalent to an object that // is neither an array nor a function. isHash: function(value) { return v.isObject(value) && !v.isArray(value) && !v.isFunction(value); }, contains: function(obj, value) { if (!v.isDefined(obj)) { return false; } if (v.isArray(obj)) { return obj.indexOf(value) !== -1; } return value in obj; }, unique: function(array) { if (!v.isArray(array)) { return array; } return array.filter(function(el, index, array) { return array.indexOf(el) == index; }); }, forEachKeyInKeypath: function(object, keypath, callback) { if (!v.isString(keypath)) { return undefined; } var key = "" , i , escape = false; for (i = 0; i < keypath.length; ++i) { switch (keypath[i]) { case '.': if (escape) { escape = false; key += '.'; } else { object = callback(object, key, false); key = ""; } break; case '\\': if (escape) { escape = false; key += '\\'; } else { escape = true; } break; default: escape = false; key += keypath[i]; break; } } return callback(object, key, true); }, getDeepObjectValue: function(obj, keypath) { if (!v.isObject(obj)) { return undefined; } return v.forEachKeyInKeypath(obj, keypath, function(obj, key) { if (v.isObject(obj)) { return obj[key]; } }); }, // This returns an object with all the values of the form. // It uses the input name as key and the value as value // So for example this: // // would return: // {email: "foo@bar.com"} collectFormValues: function(form, options) { var values = {} , i , j , input , inputs , option , value; if (v.isJqueryElement(form)) { form = form[0]; } if (!form) { return values; } options = options || {}; inputs = form.querySelectorAll("input[name], textarea[name]"); for (i = 0; i < inputs.length; ++i) { input = inputs.item(i); if (v.isDefined(input.getAttribute("data-ignored"))) { continue; } var name = input.name.replace(/\./g, "\\\\."); value = v.sanitizeFormValue(input.value, options); if (input.type === "number") { value = value ? +value : null; } else if (input.type === "checkbox") { if (input.attributes.value) { if (!input.checked) { value = values[name] || null; } } else { value = input.checked; } } else if (input.type === "radio") { if (!input.checked) { value = values[name] || null; } } values[name] = value; } inputs = form.querySelectorAll("select[name]"); for (i = 0; i < inputs.length; ++i) { input = inputs.item(i); if (v.isDefined(input.getAttribute("data-ignored"))) { continue; } if (input.multiple) { value = []; for (j in input.options) { option = input.options[j]; if (option && option.selected) { value.push(v.sanitizeFormValue(option.value, options)); } } } else { var _val = typeof input.options[input.selectedIndex] !== 'undefined' ? input.options[input.selectedIndex].value : /* istanbul ignore next */ ''; value = v.sanitizeFormValue(_val, options); } values[input.name] = value; } return values; }, sanitizeFormValue: function(value, options) { if (options.trim && v.isString(value)) { value = value.trim(); } if (options.nullify !== false && value === "") { return null; } return value; }, capitalize: function(str) { if (!v.isString(str)) { return str; } return str[0].toUpperCase() + str.slice(1); }, // Remove all errors who's error attribute is empty (null or undefined) pruneEmptyErrors: function(errors) { return errors.filter(function(error) { return !v.isEmpty(error.error); }); }, // In // [{error: ["err1", "err2"], ...}] // Out // [{error: "err1", ...}, {error: "err2", ...}] // // All attributes in an error with multiple messages are duplicated // when expanding the errors. expandMultipleErrors: function(errors) { var ret = []; errors.forEach(function(error) { // Removes errors without a message if (v.isArray(error.error)) { error.error.forEach(function(msg) { ret.push(v.extend({}, error, {error: msg})); }); } else { ret.push(error); } }); return ret; }, // Converts the error mesages by prepending the attribute name unless the // message is prefixed by ^ convertErrorMessages: function(errors, options) { options = options || {}; var ret = [] , prettify = options.prettify || v.prettify; errors.forEach(function(errorInfo) { var error = v.result(errorInfo.error, errorInfo.value, errorInfo.attribute, errorInfo.options, errorInfo.attributes, errorInfo.globalOptions); if (!v.isString(error)) { ret.push(errorInfo); return; } if (error[0] === '^') { error = error.slice(1); } else if (options.fullMessages !== false) { error = v.capitalize(prettify(errorInfo.attribute)) + " " + error; } error = error.replace(/\\\^/g, "^"); error = v.format(error, { value: v.stringifyValue(errorInfo.value, options) }); ret.push(v.extend({}, errorInfo, {error: error})); }); return ret; }, // In: // [{attribute: "", ...}] // Out: // {"": [{attribute: "", ...}]} groupErrorsByAttribute: function(errors) { var ret = {}; errors.forEach(function(error) { var list = ret[error.attribute]; if (list) { list.push(error); } else { ret[error.attribute] = [error]; } }); return ret; }, // In: // [{error: "", ...}, {error: "", ...}] // Out: // ["", ""] flattenErrorsToArray: function(errors) { return errors .map(function(error) { return error.error; }) .filter(function(value, index, self) { return self.indexOf(value) === index; }); }, cleanAttributes: function(attributes, whitelist) { function whitelistCreator(obj, key, last) { if (v.isObject(obj[key])) { return obj[key]; } return (obj[key] = last ? true : {}); } function buildObjectWhitelist(whitelist) { var ow = {} , lastObject , attr; for (attr in whitelist) { if (!whitelist[attr]) { continue; } v.forEachKeyInKeypath(ow, attr, whitelistCreator); } return ow; } function cleanRecursive(attributes, whitelist) { if (!v.isObject(attributes)) { return attributes; } var ret = v.extend({}, attributes) , w , attribute; for (attribute in attributes) { w = whitelist[attribute]; if (v.isObject(w)) { ret[attribute] = cleanRecursive(ret[attribute], w); } else if (!w) { delete ret[attribute]; } } return ret; } if (!v.isObject(whitelist) || !v.isObject(attributes)) { return {}; } whitelist = buildObjectWhitelist(whitelist); return cleanRecursive(attributes, whitelist); }, exposeModule: function(validate, root, exports, module, define) { if (exports) { if (module && module.exports) { exports = module.exports = validate; } exports.validate = validate; } else { root.validate = validate; if (validate.isFunction(define) && define.amd) { define([], function () { return validate; }); } } }, warn: function(msg) { if (typeof console !== "undefined" && console.warn) { console.warn("[validate.js] " + msg); } }, error: function(msg) { if (typeof console !== "undefined" && console.error) { console.error("[validate.js] " + msg); } } }); validate.validators = { // Presence validates that the value isn't empty presence: function(value, options) { options = v.extend({}, this.options, options); if (options.allowEmpty !== false ? !v.isDefined(value) : v.isEmpty(value)) { return options.message || this.message || "can't be blank"; } }, length: function(value, options, attribute) { // Empty values are allowed if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var is = options.is , maximum = options.maximum , minimum = options.minimum , tokenizer = options.tokenizer || function(val) { return val; } , err , errors = []; value = tokenizer(value); var length = value.length; if(!v.isNumber(length)) { return options.message || this.notValid || "has an incorrect length"; } // Is checks if (v.isNumber(is) && length !== is) { err = options.wrongLength || this.wrongLength || "is the wrong length (should be %{count} characters)"; errors.push(v.format(err, {count: is})); } if (v.isNumber(minimum) && length < minimum) { err = options.tooShort || this.tooShort || "is too short (minimum is %{count} characters)"; errors.push(v.format(err, {count: minimum})); } if (v.isNumber(maximum) && length > maximum) { err = options.tooLong || this.tooLong || "is too long (maximum is %{count} characters)"; errors.push(v.format(err, {count: maximum})); } if (errors.length > 0) { return options.message || errors; } }, numericality: function(value, options, attribute, attributes, globalOptions) { // Empty values are fine if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var errors = [] , name , count , checks = { greaterThan: function(v, c) { return v > c; }, greaterThanOrEqualTo: function(v, c) { return v >= c; }, equalTo: function(v, c) { return v === c; }, lessThan: function(v, c) { return v < c; }, lessThanOrEqualTo: function(v, c) { return v <= c; }, divisibleBy: function(v, c) { return v % c === 0; } } , prettify = options.prettify || (globalOptions && globalOptions.prettify) || v.prettify; // Strict will check that it is a valid looking number if (v.isString(value) && options.strict) { var pattern = "^-?(0|[1-9]\\d*)"; if (!options.onlyInteger) { pattern += "(\\.\\d+)?"; } pattern += "$"; if (!(new RegExp(pattern).test(value))) { return options.message || options.notValid || this.notValid || this.message || "must be a valid number"; } } // Coerce the value to a number unless we're being strict. if (options.noStrings !== true && v.isString(value) && !v.isEmpty(value)) { value = +value; } // If it's not a number we shouldn't continue since it will compare it. if (!v.isNumber(value)) { return options.message || options.notValid || this.notValid || this.message || "is not a number"; } // Same logic as above, sort of. Don't bother with comparisons if this // doesn't pass. if (options.onlyInteger && !v.isInteger(value)) { return options.message || options.notInteger || this.notInteger || this.message || "must be an integer"; } for (name in checks) { count = options[name]; if (v.isNumber(count) && !checks[name](value, count)) { // This picks the default message if specified // For example the greaterThan check uses the message from // this.notGreaterThan so we capitalize the name and prepend "not" var key = "not" + v.capitalize(name); var msg = options[key] || this[key] || this.message || "must be %{type} %{count}"; errors.push(v.format(msg, { count: count, type: prettify(name) })); } } if (options.odd && value % 2 !== 1) { errors.push(options.notOdd || this.notOdd || this.message || "must be odd"); } if (options.even && value % 2 !== 0) { errors.push(options.notEven || this.notEven || this.message || "must be even"); } if (errors.length) { return options.message || errors; } }, datetime: v.extend(function(value, options) { if (!v.isFunction(this.parse) || !v.isFunction(this.format)) { throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator"); } // Empty values are fine if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var err , errors = [] , earliest = options.earliest ? this.parse(options.earliest, options) : NaN , latest = options.latest ? this.parse(options.latest, options) : NaN; value = this.parse(value, options); // 86400000 is the number of milliseconds in a day, this is used to remove // the time from the date if (isNaN(value) || options.dateOnly && value % 86400000 !== 0) { err = options.notValid || options.message || this.notValid || "must be a valid date"; return v.format(err, {value: arguments[0]}); } if (!isNaN(earliest) && value < earliest) { err = options.tooEarly || options.message || this.tooEarly || "must be no earlier than %{date}"; err = v.format(err, { value: this.format(value, options), date: this.format(earliest, options) }); errors.push(err); } if (!isNaN(latest) && value > latest) { err = options.tooLate || options.message || this.tooLate || "must be no later than %{date}"; err = v.format(err, { date: this.format(latest, options), value: this.format(value, options) }); errors.push(err); } if (errors.length) { return v.unique(errors); } }, { parse: null, format: null }), date: function(value, options) { options = v.extend({}, options, {dateOnly: true}); return v.validators.datetime.call(v.validators.datetime, value, options); }, format: function(value, options) { if (v.isString(options) || (options instanceof RegExp)) { options = {pattern: options}; } options = v.extend({}, this.options, options); var message = options.message || this.message || "is invalid" , pattern = options.pattern , match; // Empty values are allowed if (!v.isDefined(value)) { return; } if (!v.isString(value)) { return message; } if (v.isString(pattern)) { pattern = new RegExp(options.pattern, options.flags); } match = pattern.exec(value); if (!match || match[0].length != value.length) { return message; } }, inclusion: function(value, options) { // Empty values are fine if (!v.isDefined(value)) { return; } if (v.isArray(options)) { options = {within: options}; } options = v.extend({}, this.options, options); if (v.contains(options.within, value)) { return; } var message = options.message || this.message || "^%{value} is not included in the list"; return v.format(message, {value: value}); }, exclusion: function(value, options) { // Empty values are fine if (!v.isDefined(value)) { return; } if (v.isArray(options)) { options = {within: options}; } options = v.extend({}, this.options, options); if (!v.contains(options.within, value)) { return; } var message = options.message || this.message || "^%{value} is restricted"; if (v.isString(options.within[value])) { value = options.within[value]; } return v.format(message, {value: value}); }, email: v.extend(function(value, options) { options = v.extend({}, this.options, options); var message = options.message || this.message || "is not a valid email"; // Empty values are fine if (!v.isDefined(value)) { return; } if (!v.isString(value)) { return message; } if (!this.PATTERN.exec(value)) { return message; } }, { PATTERN: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i }), equality: function(value, options, attribute, attributes, globalOptions) { if (!v.isDefined(value)) { return; } if (v.isString(options)) { options = {attribute: options}; } options = v.extend({}, this.options, options); var message = options.message || this.message || "is not equal to %{attribute}"; if (v.isEmpty(options.attribute) || !v.isString(options.attribute)) { throw new Error("The attribute must be a non empty string"); } var otherValue = v.getDeepObjectValue(attributes, options.attribute) , comparator = options.comparator || function(v1, v2) { return v1 === v2; } , prettify = options.prettify || (globalOptions && globalOptions.prettify) || v.prettify; if (!comparator(value, otherValue, options, attribute, attributes)) { return v.format(message, {attribute: prettify(options.attribute)}); } }, // A URL validator that is used to validate URLs with the ability to // restrict schemes and some domains. url: function(value, options) { if (!v.isDefined(value)) { return; } options = v.extend({}, this.options, options); var message = options.message || this.message || "is not a valid url" , schemes = options.schemes || this.schemes || ['http', 'https'] , allowLocal = options.allowLocal || this.allowLocal || false , allowDataUrl = options.allowDataUrl || this.allowDataUrl || false; if (!v.isString(value)) { return message; } // https://gist.github.com/dperini/729294 var regex = "^" + // protocol identifier "(?:(?:" + schemes.join("|") + ")://)" + // user:pass authentication "(?:\\S+(?::\\S*)?@)?" + "(?:"; var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; if (allowLocal) { tld += "?"; } else { regex += // IP address exclusion // private & local networks "(?!(?:10|127)(?:\\.\\d{1,3}){3})" + "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})"; } regex += // IP address dotted notation octets // excludes loopback network 0.0.0.0 // excludes reserved space >= 224.0.0.0 // excludes network & broacast addresses // (first & last IP address of each class) "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + "|" + // host name "(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" + // domain name "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" + tld + ")" + // port number "(?::\\d{2,5})?" + // resource path "(?:[/?#]\\S*)?" + "$"; if (allowDataUrl) { // RFC 2397 var mediaType = "\\w+\\/[-+.\\w]+(?:;[\\w=]+)*"; var urlchar = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*"; var dataurl = "data:(?:"+mediaType+")?(?:;base64)?,"+urlchar; regex = "(?:"+regex+")|(?:^"+dataurl+"$)"; } var PATTERN = new RegExp(regex, 'i'); if (!PATTERN.exec(value)) { return message; } }, type: v.extend(function(value, originalOptions, attribute, attributes, globalOptions) { if (v.isString(originalOptions)) { originalOptions = {type: originalOptions}; } if (!v.isDefined(value)) { return; } var options = v.extend({}, this.options, originalOptions); var type = options.type; if (!v.isDefined(type)) { throw new Error("No type was specified"); } var check; if (v.isFunction(type)) { check = type; } else { check = this.types[type]; } if (!v.isFunction(check)) { throw new Error("validate.validators.type.types." + type + " must be a function."); } if (!check(value, options, attribute, attributes, globalOptions)) { var message = originalOptions.message || this.messages[type] || this.message || options.message || (v.isFunction(type) ? "must be of the correct type" : "must be of type %{type}"); if (v.isFunction(message)) { message = message(value, originalOptions, attribute, attributes, globalOptions); } return v.format(message, {attribute: v.prettify(attribute), type: type}); } }, { types: { object: function(value) { return v.isObject(value) && !v.isArray(value); }, array: v.isArray, integer: v.isInteger, number: v.isNumber, string: v.isString, date: v.isDate, boolean: v.isBoolean }, messages: {} }) }; validate.formatters = { detailed: function(errors) {return errors;}, flat: v.flattenErrorsToArray, grouped: function(errors) { var attr; errors = v.groupErrorsByAttribute(errors); for (attr in errors) { errors[attr] = v.flattenErrorsToArray(errors[attr]); } return errors; }, constraint: function(errors) { var attr; errors = v.groupErrorsByAttribute(errors); for (attr in errors) { errors[attr] = errors[attr].map(function(result) { return result.validator; }).sort(); } return errors; } }; validate.exposeModule(validate, this, exports, module, __webpack_require__.amdD); }).call(this, true ? /* istanbul ignore next */ exports : 0, true ? /* istanbul ignore next */ module : 0, __webpack_require__.amdD); /***/ }), /***/ "../../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: 'expr28', selector: '[expr28]', template: template( '
', [ { type: bindingTypes.EACH, getKey: null, condition: null, template: template( ' ', [ { expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.error ].join( '' ) } ] } ] ), redundantAttribute: 'expr29', selector: '[expr29]', itemName: 'error', indexName: null, evaluate: _scope => _scope.state.errors } ] ) } ] ), name: 'field-error' }); /***/ }), /***/ "./js/components/sidebar.riot": /*!************************************!*\ !*** ./js/components/sidebar.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: { /** * * */ handleClose() { this.props.close() }, /** * * */ getCssClasses() { const classes = [ 'sidebar' ] if (this.props.open === true) { classes.push('sidebar--open') } return classes.join(' ') } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
', [ { redundantAttribute: 'expr0', selector: '[expr0]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'class', evaluate: _scope => _scope.getCssClasses() } ] }, { type: bindingTypes.SLOT, attributes: [], name: 'title', redundantAttribute: 'expr1', selector: '[expr1]' }, { redundantAttribute: 'expr2', selector: '[expr2]', expressions: [ { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => (event) => { _scope.handleClose(event) } } ] }, { type: bindingTypes.SLOT, attributes: [], name: 'form', redundantAttribute: 'expr3', selector: '[expr3]' }, { redundantAttribute: 'expr4', selector: '[expr4]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'form', evaluate: _scope => _scope.props.formId } ] }, { redundantAttribute: 'expr5', selector: '[expr5]', expressions: [ { type: expressionTypes.ATTRIBUTE, name: 'form', evaluate: _scope => _scope.props.formId } ] } ] ), name: 'app-sidebar' }); /***/ }), /***/ "./js/components/task-form.riot": /*!**************************************!*\ !*** ./js/components/task-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_4__ = __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_taskForm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../stores/taskForm.js */ "./js/stores/taskForm.js"); /* harmony import */ var _mixins_sidebar_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../mixins/sidebar.js */ "./js/mixins/sidebar.js"); /* harmony import */ var _tiny_components_validator_src_fieldError_riot__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tiny-components/validator/src/fieldError.riot */ "../../node_modules/@tiny-components/validator/src/fieldError.riot"); riot__WEBPACK_IMPORTED_MODULE_4__.register('field-error', _tiny_components_validator_src_fieldError_riot__WEBPACK_IMPORTED_MODULE_3__["default"]) /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ css: null, exports: () => { return { ..._mixins_sidebar_js__WEBPACK_IMPORTED_MODULE_2__["default"], state: { requestHandlers: [], validator: undefined, current: { } }, /** * * */ onMounted() { // creating formValidator this.state.validator = new _tiny_components_validator_src_formValidator_js__WEBPACK_IMPORTED_MODULE_0__["default"](this.$('.form'), { 'name': { 'presence': true }, 'url': { 'presence': true }, 'requestHandler': { 'presence': true } }) // adding on success this.state.validator.onSuccess((event, data) => { this.handleSuccess(event, data) }) _stores_taskForm_js__WEBPACK_IMPORTED_MODULE_1__["default"].on('open', (data) => { this.state.isOpen = true this.update() }) }, /** * * * */ handleSuccess(event, data) { } } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '', [ { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'app-sidebar', slots: [ { id: 'title', html: '', bindings: [ { type: bindingTypes.IF, evaluate: _scope => _scope.state.current.name, redundantAttribute: 'expr19', selector: '[expr19]', 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.name, redundantAttribute: 'expr20', selector: '[expr20]', 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: 'expr21', selector: '[expr21]', expressions: [ { type: expressionTypes.EVENT, name: 'onsubmit', evaluate: _scope => (event) => { _scope.state.validator.submit(event) } } ] }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr22', selector: '[expr22]' }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr23', selector: '[expr23]' }, { type: bindingTypes.EACH, getKey: null, condition: null, template: template( null, [] ), redundantAttribute: 'expr24', selector: '[expr24]', itemName: 'handler', indexName: null, evaluate: _scope => _scope.state.requestHandlers }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr25', selector: '[expr25]' }, { type: bindingTypes.EACH, getKey: null, condition: null, template: template( null, [] ), redundantAttribute: 'expr26', selector: '[expr26]', itemName: 'handler', indexName: null, evaluate: _scope => _scope.state.actions }, { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'field-error', slots: [], attributes: [], redundantAttribute: 'expr27', selector: '[expr27]' } ] } ], attributes: [ { type: expressionTypes.ATTRIBUTE, name: 'open', evaluate: _scope => _scope.state.isOpen }, { type: expressionTypes.ATTRIBUTE, name: 'close', evaluate: _scope => () => { _scope.handleClose() } } ], redundantAttribute: 'expr18', selector: '[expr18]' } ] ), name: 'app-task-form' }); /***/ }), /***/ "./js/components/task-new.riot": /*!*************************************!*\ !*** ./js/components/task-new.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_taskForm_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../stores/taskForm.js */ "./js/stores/taskForm.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 } }, /** * * @param {[type]} event * @return {[type]} */ handleOpen(event, data = undefined) { _stores_taskForm_js__WEBPACK_IMPORTED_MODULE_0__["default"].open(data) } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '', [ { redundantAttribute: 'expr6', selector: '[expr6]', 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-task-button' }); /***/ }), /***/ "./js/components/tasks.riot": /*!**********************************!*\ !*** ./js/components/tasks.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: { tasks: [] }, /** * * */ onMounted() { this.getTasks() }, /** * * */ getTasks() { fetch('/api/task', (response) => { this.state.tasks = response.data }) }, /** * * */ handleDelete(event, action) { }, /** * * */ handleEdit(event, action) { } }, template: ( template, expressionTypes, bindingTypes, getComponent ) => template( '
\n name\n \n url\n \n requestHandler\n \n actions\n \n cron\n
', [ { type: bindingTypes.EACH, getKey: null, condition: _scope => _scope.state.tasks.length > 0, template: template( ' ', [ { redundantAttribute: 'expr8', selector: '[expr8]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.task.name ].join( '' ) } ] }, { redundantAttribute: 'expr9', selector: '[expr9]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.task.url ].join( '' ) } ] }, { redundantAttribute: 'expr10', selector: '[expr10]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.task.requestHandler ].join( '' ) } ] }, { type: bindingTypes.EACH, getKey: null, condition: null, template: template( null, [ { type: bindingTypes.TAG, getComponent: getComponent, evaluate: _scope => 'virtual', slots: [ { id: 'default', html: ' ', bindings: [ { redundantAttribute: 'expr12', selector: '[expr12]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.action.className ].join( '' ) } ] }, { type: bindingTypes.IF, evaluate: _scope => _scope.actions.options, redundantAttribute: 'expr13', selector: '[expr13]', template: template( ' ', [ { expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ JSON.stringify(_scope.action.options) ].join( '' ) } ] } ] ) } ] } ], attributes: [] } ] ), redundantAttribute: 'expr11', selector: '[expr11]', itemName: 'action', indexName: null, evaluate: _scope => _scope.task.actions }, { redundantAttribute: 'expr14', selector: '[expr14]', expressions: [ { type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => [ _scope.task.cron ].join( '' ) } ] }, { redundantAttribute: 'expr15', selector: '[expr15]', expressions: [ { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => (event) => { _scope.handleEdit(event, _scope.task) } } ] }, { redundantAttribute: 'expr16', selector: '[expr16]', expressions: [ { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => (event) => { _scope.handleDelete(event, _scope.task) } } ] } ] ), redundantAttribute: 'expr7', selector: '[expr7]', itemName: 'task', indexName: null, evaluate: _scope => _scope.state.tasks }, { type: bindingTypes.IF, evaluate: _scope => _scope.state.tasks.length === 0, redundantAttribute: 'expr17', selector: '[expr17]', template: template( '\n Nothing found\n ', [] ) } ] ), name: 'app-tasks' }); /***/ }), /***/ "./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_4__ = __webpack_require__(/*! riot */ "./node_modules/riot/riot.esm.js"); /* harmony import */ var _components_sidebar_riot__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/sidebar.riot */ "./js/components/sidebar.riot"); /* harmony import */ var _components_tasks_riot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/tasks.riot */ "./js/components/tasks.riot"); /* harmony import */ var _components_task_new_riot__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/task-new.riot */ "./js/components/task-new.riot"); /* harmony import */ var _components_task_form_riot__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/task-form.riot */ "./js/components/task-form.riot"); // register components riot__WEBPACK_IMPORTED_MODULE_4__.register('app-sidebar', _components_sidebar_riot__WEBPACK_IMPORTED_MODULE_0__["default"]); riot__WEBPACK_IMPORTED_MODULE_4__.register('app-tasks', _components_tasks_riot__WEBPACK_IMPORTED_MODULE_1__["default"]); riot__WEBPACK_IMPORTED_MODULE_4__.register('app-task-button', _components_task_new_riot__WEBPACK_IMPORTED_MODULE_2__["default"]); riot__WEBPACK_IMPORTED_MODULE_4__.register('app-task-form', _components_task_form_riot__WEBPACK_IMPORTED_MODULE_3__["default"]); // mount components riot__WEBPACK_IMPORTED_MODULE_4__.mount('app-sidebar'); riot__WEBPACK_IMPORTED_MODULE_4__.mount('app-tasks'); riot__WEBPACK_IMPORTED_MODULE_4__.mount('app-task-button'); riot__WEBPACK_IMPORTED_MODULE_4__.mount('app-task-form'); /***/ }), /***/ "./js/mixins/sidebar.js": /*!******************************!*\ !*** ./js/mixins/sidebar.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 default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ state: { isOpen: false }, /** * * */ handleClose: function handleClose() { this.state.isOpen = false; this.update(); } }); /***/ }), /***/ "./js/stores/taskForm.js": /*!*******************************!*\ !*** ./js/stores/taskForm.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__); /** * * * * @author Björn Hase * * */ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_riotjs_observable__WEBPACK_IMPORTED_MODULE_0___default()({ /** * * @param {object} data * */ open: function open(data) { this.trigger('open', data); } })); /***/ }), /***/ "./scss/styles.scss": /*!**************************!*\ !*** ./scss/styles.scss ***! \**************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }), /***/ "./node_modules/riot/riot.esm.js": /*!***************************************!*\ !*** ./node_modules/riot/riot.esm.js ***! \***************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "__": () => (/* binding */ __), /* harmony export */ "component": () => (/* binding */ component), /* harmony export */ "install": () => (/* binding */ install), /* harmony export */ "mount": () => (/* binding */ mount), /* harmony export */ "pure": () => (/* binding */ pure), /* harmony export */ "register": () => (/* binding */ register), /* harmony export */ "uninstall": () => (/* binding */ uninstall), /* harmony export */ "unmount": () => (/* binding */ unmount), /* harmony export */ "unregister": () => (/* binding */ unregister), /* harmony export */ "version": () => (/* binding */ version), /* harmony export */ "withTypes": () => (/* binding */ withTypes) /* harmony export */ }); /* Riot v6.1.2, @license MIT */ /** * Convert a string from camel case to dash-case * @param {string} string - probably a component tag name * @returns {string} component name normalized */ function camelToDashCase(string) { return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); } /** * Convert a string containing dashes to camel case * @param {string} string - input string * @returns {string} my-string -> 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