diff --git a/.eslintrc.json b/.eslintrc.json index 3305a71..403fdf4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,30 +1,30 @@ { "env": { "browser": true, - "commonjs": true, - "amd": true, - "es6": true, - "node": true + "commonjs": true, + "es6": true, + "node": true, + "amd": true }, "parserOptions": { - "ecmaVersion": 6, - "ecmaFeatures": { - "jsx": true - }, + "ecmaVersion": 11, "sourceType": "module" - }, - "plugins": [ - "html" - ], + }, + "plugins": [ + "html" + ], "rules": { "no-const-assign": "error", - "no-this-before-super": "error", + "no-this-before-super": "warn", "no-undef": "error", + "semi": "warn", + "eqeqeq": [ + "warn", + "smart" + ], "no-unreachable": "error", - "no-unused-vars": "warn", - "constructor-super": "warn", - "eqeqeq": ["warn", "smart"], - "semi": "warn", + "no-unused-vars": "warn", + "constructor-super": "warn", "valid-typeof": "error" } } \ No newline at end of file diff --git a/.gitignore b/.gitignore index 504ae45..9beeb3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,8 @@ -# Dependency directories +.vscode/ node_modules/ -specs/* -!specs/components -specs/components/* -!specs/components/readme.txt build/ +tests/ +test/**/*.js +test/**/*.map tools/*.js tools/*.map -test/index.js \ No newline at end of file diff --git a/.npmignore b/.npmignore index d911ba2..912c72a 100644 --- a/.npmignore +++ b/.npmignore @@ -5,7 +5,7 @@ examples/ src/ test/ -specs/ +tests/ tools/index.ts tools/tsconfig.json package-lock.json diff --git a/.travis.yml b/.travis.yml index 9e65286..3e6c9a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,19 @@ language: node_js node_js: - - "node" + - "13" + - "12" + - "11" + - "10" + - "9" + - "8" + sudo: required +addons: + chrome: stable install: - npm i script: - - npm run build:src - - npm run build:tools + - npm run build + - npm run build:test:components - npm test cache: directories: diff --git a/.vscode/launch.json b/.vscode/launch.json index 9128a9b..bc5b1a0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,67 +1,35 @@ { - // Utilizar IntelliSense para aprender acerca de los posibles atributos. - // Mantenga el puntero para ver las descripciones de los existentes atributos - // Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Launch Tests", - "program": "${workspaceFolder}/test/index.js" - }, - { - "type": "node", - "request": "launch", - "name": "Launch Context", - "program": "${workspaceFolder}/src/utilities/context.ts", - "outFiles": [ - "${workspaceFolder}/build/**/*.js" - ] - }, - { - "type": "firefox", - "request": "launch", - "reAttach": true, - "name": "Launch index.html", - "firefoxExecutable": "D:\\INSTALLERS\\Internet\\FirefoxPortable\\App\\Firefox\\firefox.exe", - "file": "${workspaceFolder}/todomvc/dist/index.html" - }, - { - "type": "node", - "request": "launch", - "name": "Launch Generator", - "program": "${workspaceFolder}/src/index.ts", - "outFiles": [ - "${workspaceFolder}/build/**/*.js" - ] - }, - { - "type": "node", - "request": "launch", - "name": "Launch CLI", - "program": "${workspaceFolder}/bin/trebor.js", - "cwd": "D:\\OTHERS\\Downloads\\electric-count", - "args": [ - "-i", - "electric-count.html", - // "./examples/counter/src/components/counter.html", - // "-o", - // "./examples/counter/src/components/counter.umd.js" - // "-i", - // "./examples/todomvc/src/components/todo.html", - // "-o", - // "./examples/todomvc/src/components/todo.umd.js" - ] - }, - { - "type": "node", - "request": "launch", - "name": "Launch CSS", - "program": "${workspaceFolder}/src/utilities/cssToJson.ts", - "outFiles": [ - "${workspaceFolder}/build/**/*.js" - ] - } - ] + // Use IntelliSense para saber los atributos posibles. + // Mantenga el puntero para ver las descripciones de los existentes atributos. + // Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Iniciar parser", + "program": "${workspaceFolder}\\test.js" + }, + { + "type": "node", + "request": "launch", + "name": "Iniciar eslint parser", + "program": "${workspaceFolder}\\meriyahEslintParser.js" + }, + { + "type": "node", + "request": "launch", + "name": "Iniciar test", + "program": "${workspaceFolder}\\test\\index.ts", + "outFiles": ["${workspaceFolder}\\test\\**/*.js"] + }, + { + "type": "node", + "request": "launch", + "name": "Iniciar cli", + "program": "${workspaceFolder}\\bin\\trebor.js", + "cwd": "${workspaceFolder}", + "args": ["-i", "tests/testing.html"] + } + ], } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 68ecdba..d7207a4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "typescript.tsdk": "node_modules\\typescript\\lib" + "typescript.tsdk": "node_modules\\typescript\\lib" } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 099a71d..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "build:src", - "problemMatcher": [] - }, - { - "type": "npm", - "script": "build:tools", - "problemMatcher": [] - }, - { - "type": "npm", - "script": "build:example:todo", - "problemMatcher": [] - }, - { - "type": "npm", - "script": "build:example:counter", - "problemMatcher": [] - } - ] -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index da46ad7..90a6f90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +1.0.0 +- Full rewrote of core. +- Component declarations export a class now. +- Changed interpolation expression from `{{ ... }}` to `{ ... }`. +- Added the ability to bind `name` slot attribute. +- Use `puppeteer` for test and drop `PhantomJS`. +- Dirctives are now NodeJS modules and work in compile time. +- NodeJS API change and now support parsers for javascript, html and css. +- Added tools inside Trebor again for more maintainability. + 0.3.3 - Added project descriptions to Readme. - Fixed bug when template elements are condition or loop blocks. diff --git a/README.md b/README.md index 9b4c3e5..f7f7b12 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ ### Overview [TreborJS](https://npmjs.org/package/trebor) is a [NodeJS](http://nodejs.org) module to compile `component declarated files` into `stand-alone web component` javascript files to be used -in the browser. The format of a [component declaration file](https://github.com/InDIOS/trebor/wiki/Component-declaration) is specified be the module and described +in the browser. The format of a [single file component](https://github.com/InDIOS/trebor/wiki/Component-declaration) is specified be the module and described in it's [documentation](https://github.com/InDIOS/trebor/wiki). ### Why? -In this days front-end frameworks are very populars comming to be an important part of a web application. Almost all of then have a runtime library that is part of the application, [Vue](https://github.com/vuejs/vue), [React](https://github.com/facebook/react), [Angular](https://github.com/angular/angular), but what if we can do a component that no need a runtime lib? -what if can create all components without useless code and can run it self?. That is what `TreborJS` do, a module that compile an structured html file in a javascript file with just the code you need and nothing more. +In this days front-end frameworks are very populars comming to be an important part of a web application. Almost all of then have a runtime library that is part of the application, [Vue](https://github.com/vuejs/vue), [React](https://github.com/facebook/react), [Angular](https://github.com/angular/angular), but what if we can make a component that no need a runtime lib? +What if we can create all components without useless code and can run it self?. That is what `TreborJS` do, a module that compile an structured html file in a javascript file with just the code you need and nothing more. ## How to use @@ -48,4 +48,4 @@ Read the documentation [here](https://github.com/InDIOS/trebor/wiki) [github-img]: https://img.shields.io/github/release/InDIOS/trebor.svg [github-url]: https://github.com/InDIOS/trebor/releases/latest [travis-image]: https://img.shields.io/travis/InDIOS/trebor/master.svg?label=build -[travis-url]: https://travis-ci.org/InDIOS/trebor \ No newline at end of file +[travis-url]: https://travis-ci.org/InDIOS/trebor diff --git a/bin/trebor.js b/bin/trebor.js index fa2ca34..d43f39c 100644 --- a/bin/trebor.js +++ b/bin/trebor.js @@ -1,43 +1,88 @@ #!/usr/bin/env node -const yargs = require('yargs'); + +const glob = require('glob'); const { resolve } = require('path'); -const pkg = require('../package.json'); -const gnt = require('../build').default; - -const options = yargs.options({ - input: { - alias: 'i', - type: 'string', - demandOption: true, - describe: 'Path to the input file.' - }, - output: { - alias: 'o', - type: 'string', - describe: 'Path to the output file.' - }, - format: { - alias: 'f', - type: 'string', - choices: ['es', 'iif', 'umd', 'amd', 'cjs', 'system'], - describe: 'Format of the output.' - }, - minify: { - alias: 'm', - type: 'boolean', - describe: 'Minify the output.' - } -}).version(pkg.version).argv; - -const cwd = process.cwd(); +const program = require('commander'); +const { parseFile } = require('../build'); + +program + // TO-DO: Put here parsers (css,html,js) and directives + .option('-i, --input ', 'Path to input file or directory', dir => resolve(dir)) + .option('-o, --output [fileOrDirPath]', 'Path to output file or directory (default: input directory)') + .option('-f, --format ', 'Specify output format: esm, cjs o iif (default: iif)', val => { + return /^(esm|cjs|iif)$/i.test(val) ? val : ''; + }) + .option('-c, --comments', 'Include comments in parsed result file') + .option('-m, --minify', 'Optimize output with minification') + .option('-d, --directives [value]', 'A set of path to directive files', (dir, directives) => { + directives.push(require(resolve(dir))); + return directives; + }, []) + .version('1.0.0', '-v, --version') + .parse(process.argv); + +const options = program.opts(); + +if (!options.input) { + console.log(''); + console.error('[Error]: An input file must be provided in argument -i o --input'); + console.log(''); + process.exit(1); +} + +if (options.format === '') { + console.log(''); + console.warn('[Warn]: An incorrect output format was provided'); + console.warn('[Warn]: Format option will fallback to `iif` module'); +} if (options.input) { - gnt({ - input: resolve(cwd, options.input), - out: options.output ? resolve(cwd, options.output) : undefined, - format: options.format, - minify: options.minify - }); -} else { - throw new Error('A input file must be provided.'); -} \ No newline at end of file + options.input = resolve(options.input); +} + +if (options.output) { + options.output = resolve(options.output); +} + +options.format = options.format || 'iif'; +options.minify = options.minify || false; +options.comments = options.comments || false; + +const compilerOptions = { + minify: options.minify, + format: options.format, + comments: options.comments, + outDir: options.output, + optimize: true +}; + +const start = new Date(); + +glob(options.input, { nonull: false }, (err, files) => { + if (err) { + console.log(err); + process.exit(1); + } else { + Promise.all(files.map(file => { + return new Promise((resolve, reject) => { + parseFile(file, { compilerOptions, directives: options.directives }, err => { + if (err) { + err.message = `${err.message} on file '${file}'`; + reject(err); + } else { + resolve(); + } + }); + }); + })).then(wrotes => { + if (wrotes.length === files.length) { + const time = ((new Date()) - start) / 1000; + console.log(`[Info]: All work done successfully in ${time.toFixed(2)}s`); + } + }).catch(err => { + console.log(err); + console.error('\n[Error]: Something was wrong'); + process.exit(1); + }); + } +}); \ No newline at end of file diff --git a/examples/01-Hello_World/hello.html b/examples/01-Hello_World/hello.html new file mode 100644 index 0000000..e31d5de --- /dev/null +++ b/examples/01-Hello_World/hello.html @@ -0,0 +1,13 @@ + + +

Hello, {name}!

+ + diff --git a/examples/01-Hello_World/hello.js b/examples/01-Hello_World/hello.js new file mode 100644 index 0000000..5a16896 --- /dev/null +++ b/examples/01-Hello_World/hello.js @@ -0,0 +1,646 @@ +!function(root) { + function _$extends(d, b) { + _$assign(d, b); + function _() { + this.constructor = d; + } + d.prototype = null === b ? Object.create(b) : (_.prototype = b.prototype, new _); + } + function _$(selector, parent) { + return _$isString(selector) ? (parent || document.body).querySelector(selector) : selector; + } + function _$type(obj) { + return _$lowerCase(Object.prototype.toString.call(obj).slice(8, -1)); + } + function _$isType(obj, objType) { + return _$isString(objType) ? _$type(obj) === objType : obj instanceof objType; + } + function _$isString(str) { + return 'string' === _$type(str); + } + function _$isArray(array) { + return 'array' === _$type(array) || array instanceof _$List; + } + function _$isObject(obj) { + return 'object' === _$type(obj); + } + function _$isFunction(obj) { + return 'function' === _$type(obj); + } + function _$toString(obj) { + if (_$isString(obj)) { + return obj; + } + var str = _$type(obj); + return /(^(null|undefined)$)/.test(str) ? str : obj.toString(); + } + function _$toType(value, type, component, key) { + switch (type) { + case 'date': + return new Date(value); + + case 'string': + return _$toString(value); + + case 'number': + return +value; + + case 'boolean': + return _$isString(value) && !value ? !0 : !!value; + + case 'array': + return _$isType(value, _$List) ? value : new _$List(value, component, key); + + default: + return value; + } + } + function _$slice(array, from) { + var args = []; + for (var i = from = from || 0; i < array.length; i++) { + args[i - from] = array[i]; + } + return args; + } + function _$hasProp(obj, prop) { + return obj.hasOwnProperty(prop); + } + function _$define(obj, mapDesc) { + Object.defineProperties(obj, mapDesc); + } + function _$each(obj, cb) { + if (_$isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + cb(obj[i], i); + } + } else if (_$isObject(obj)) { + var keys = Object.keys(obj); + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + cb(obj[key], key, i); + } + } + } + function _$lowerCase(str) { + return str.toLowerCase(); + } + function _$apply(callee, args, globs, thisArg) { + if (globs && !_$isArray(globs)) { + thisArg = globs; + globs = []; + } else if (void 0 === globs) { + globs = []; + } else if (void 0 === thisArg) { + thisArg = null; + } + return callee.apply(thisArg, args.concat(globs)); + } + function _$treborPlugins() { + var _a; + var TREBOR_PK = '__TREBOR_PLUGINS__'; + if (!window[TREBOR_PK]) { + _$define(window, ((_a = {})[TREBOR_PK] = { + value: [], + configurable: !0, + writable: !0, + enumerable: !1 + }, _a)); + } + return window[TREBOR_PK]; + } + function _$assign(child, parent) { + for (var property in parent) { + if (parent.hasOwnProperty(property)) { + child[property] = parent[property]; + } + } + return child; + } + function _$plainObject(obj) { + var data = {}; + _$each(_$isObject(obj) ? obj : {}, (function(value, k) { + if ('$' !== k[0] && !_$isFunction(value)) { + if (_$isType(value, _$List)) { + data[k] = value.map(_$plainObject); + } else if (_$isObject(value)) { + data[k] = _$plainObject(value); + } else { + data[k] = value; + } + } + })); + return _$isObject(obj) ? data : obj; + } + function _$accesor(component, path, value) { + return path.split('.').reduce((function(obj, key, i, arr) { + if (_$isType(value, 'undefined')) { + if (null == obj) { + arr.splice(0, arr.length); + return i > 0 && null === obj ? obj : void 0; + } + } else if (i === arr.length - 1) { + if (_$isType(obj, _$List) && _$toString(+key) === key) { + obj.pull(+key, value); + } else { + var oldVal = obj[key]; + obj[key] = Array.isArray(value) ? new _$List(value, component, key) : value; + _$dispatch(component, path, oldVal, obj[key]); + } + } else if (!_$isObject(obj[key])) { + obj[key] = {}; + } + return obj ? obj[key] : null; + }), component); + } + function _$dispatch(component, key, oldVal, value) { + component.$notify(key); + if (component._watchers[key]) { + _$each(component._watchers[key], (function(watcher) { + watcher(oldVal, value); + })); + } + component.$update(); + } + function _$subscribers(dep, handler) { + if (!this._subscribers[dep]) { + this._subscribers[dep] = []; + } + return this._subscribers[dep].push(handler.bind(this)) - 1; + } + var _$Component = function() { + function _$Component(attrs, compCtor, parent) { + var self = this; + if (!attrs) { + attrs = {}; + } + var propMap = { + $refs: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $slots: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $parent: { + value: parent || null, + enumerable: !1, + configurable: !0 + }, + $children: { + value: [], + enumerable: !1, + configurable: !0 + }, + $filters: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $options: { + value: { + filters: compCtor.$filters || {}, + children: compCtor.$children || {}, + attributes: compCtor.$attributes || {} + }, + enumerable: !1, + configurable: !0 + } + }; + _$each(compCtor.$attributes || [], (function(attrOps, key) { + key = _$isType(key, 'number') ? attrOps : key; + propMap[key] = { + get: function() { + if (_$isString(attrOps)) { + return _$isFunction(value = attrs[attrOps]) ? value() : value; + } else if (!_$hasProp(attrs, key) && attrOps.required) { + return console.error('Attribute \'' + key + '\' is required.'); + } else { + var value; + if (void 0 === (value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key]) && _$hasProp(attrOps, 'default')) { + var def = attrOps.default; + value = _$isFunction(def) ? def() : def; + } + var typ = attrOps.type; + if (typ && !_$isType(value, typ) && attrOps.required) { + return console.error('Attribute \'' + key + '\' must be type \'' + typ + '\'.'); + } + if (void 0 !== (value = _$toType(value, void 0 === value ? 'undefined' : typ, self, key)) && _$hasProp(attrOps, 'validator')) { + var validator = attrOps.validator; + if (_$isFunction(validator) && !validator(value)) { + return console.error('Assigment \'' + key + '\'=\'' + JSON.stringify(value) + '\' invalid.'); + } + } + return value; + } + }, + set: function() { + console.error('\'' + key + '\' is read only.'); + }, + enumerable: !0, + configurable: !0 + }; + })); + var desc = { + enumerable: !1, + configurable: !1 + }; + propMap._events = _$assign({ + value: {} + }, desc); + propMap._watchers = _$assign({ + value: {} + }, desc); + propMap._subscribers = _$assign({ + value: {} + }, desc); + _$define(self, propMap); + _$assign(self.$filters, compCtor.$filters || {}); + } + var prototype = _$Component.prototype; + _$define(prototype, { + $data: { + get: function() { + return _$plainObject(this); + }, + enumerable: !0, + configurable: !0 + } + }); + prototype.$get = function(path) { + return _$accesor(this, path); + }; + prototype.$set = function(path, value) { + _$accesor(this, path, value); + }; + prototype.$on = function(event, handler) { + if (!this._events[event]) { + this._events[event] = []; + } + this._events[event].push(handler); + }; + prototype.$off = function(event, handler) { + var index = this._events[event].indexOf(handler); + ~index && this._events[event].splice(index, 1); + }; + prototype.$once = function(event, handler) { + var _this = this; + var _handler = function(args) { + handler(args); + _this.$off(event, _handler); + }; + this.$on(event, _handler); + }; + prototype.$fire = function(event, data) { + if (this._events[event]) { + _$each(this._events[event], (function(handler) { + handler(data); + })); + } + }; + prototype.$notify = function(key) { + if (this._subscribers[key]) { + _$each(this._subscribers[key], (function(suscriber) { + suscriber(); + })); + } + }; + prototype.$observe = function(keyOrKeys, handler) { + var _this = this; + var subs = []; + if (_$isArray(keyOrKeys)) { + _$each(keyOrKeys, (function(key) { + subs.push({ + subscrition: key, + index: _$subscribers.call(_this, key, handler) + }); + })); + } else { + subs.push({ + subscrition: keyOrKeys, + index: _$subscribers.call(this, keyOrKeys, handler) + }); + } + return { + $unobserve: function() { + _$each(subs, (function(_a) { + var subscrition = _a.subscrition, index = _a.index; + _this._subscribers[subscrition].splice(index, 1); + })); + } + }; + }; + prototype.$watch = function(key, handler) { + var _this = this; + if (!this._watchers[key]) { + this._watchers[key] = []; + } + var i = this._watchers[key].push(handler.bind(this)); + return { + $unwatch: function() { + _this._watchers[key].splice(i - 1, 1); + } + }; + }; + return _$Component; + }(); + var _$List = function(_super) { + _$extends(List, _super); + function List(value, component, key) { + _super.call(this, value.length); + var self = this; + _$define(self, { + _key: { + value: key, + enumerable: !1 + }, + _root: { + value: component, + enumerable: !1 + } + }); + _$apply(_super.prototype.push, value.map((function(val, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(val, List) && _$isArray(val) ? new List(val, component, key + '.' + i) : val; + })), [], self); + } + List.prototype.pull = function(index) { + var self = this; + var args = _$slice(arguments, 1); + var length = self.length; + if (index > length) { + length = index + 1; + var pull = new Array(index - self.length); + _$apply(pull.push, args, [], pull); + for (var i = 0; i < length; i++) { + if (i === index) { + _$apply(self.push, pull, [], self); + } + } + } else { + _$apply(self.splice, [ index, 1 ].concat(args), [], self); + } + }; + [ 'pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice' ].forEach((function(method) { + List.prototype[method] = function() { + var self = this; + var args = _$slice(arguments); + var old = self.slice(); + var result = void 0; + if ('push' === method) { + _$apply([].push, args.map((function(v, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(v, List) && _$isArray(v) ? new List(v, self._root, self._key + '.' + i) : v; + })), [], self); + result = self.length; + } else { + result = _$apply(Array.prototype[method], args, [], self); + } + _$dispatch(self._root, self._key, old, self.slice()); + return result; + }; + })); + return List; + }(Array); + function _$createComponent($ComponentClass, templateFn) { + function $ComponentCtor(attrs, parent) { + var self = this; + _$apply(_$Component, [ attrs, $ComponentCtor, parent ], [], self); + $ComponentClass.call(self); + var descriptors = {}; + _$each(self, (function(_, key) { + if (_$hasProp(self, key)) { + var descriptor = Object.getOwnPropertyDescriptor(self, key); + if (descriptor.value && _$isArray(descriptor.value)) { + descriptor.value = new _$List(descriptor.value, self, key); + } else { + if (descriptor.get) { + var getter_1_1 = descriptor.get; + descriptor.get = function() { + var value = getter_1_1.call(this); + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + return value; + }; + } + if (descriptor.set) { + var setter_1_1 = descriptor.set; + descriptor.set = function(value) { + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + setter_1_1.call(this, value); + }; + } + } + descriptors[key] = descriptor; + } + })); + _$define(self, descriptors); + var tpl = templateFn(self); + var tplDesc = {}; + _$each(tpl, (function(value, key) { + tplDesc[key] = function(key, value) { + var hook = key[1].toUpperCase() + _$slice(key, 2); + return { + enumerable: !1, + configurable: !1, + writable: !1, + value: function() { + var args = _$slice(arguments); + var ahook = this['did' + hook]; + var bhook = this['will' + hook]; + bhook && bhook.call(this); + _$apply(value, '$update' === key ? [ this, _$slice(args, 1) ] : args, this); + ahook && ahook.call(this); + } + }; + }(key, value); + })); + _$define(self, tplDesc); + _$each(_$treborPlugins(), (function(_a) { + var plugin = _a.plugin, options = _a.options; + plugin.call(self, $ComponentCtor, options); + })); + !parent && this.$create(); + } + var proto = [ $ComponentClass.prototype, _$Component.prototype ].reduceRight((function(superProto, proto) { + var inheritedProto = Object.create(superProto); + for (var key in proto) { + if (proto.hasOwnProperty(key)) { + var desc = Object.getOwnPropertyDescriptor(proto, key); + Object.defineProperty(inheritedProto, key, desc); + } + } + _$assign($ComponentCtor, proto.constructor); + inheritedProto.constructor = proto.constructor; + return inheritedProto; + }), Object.prototype); + $ComponentCtor.prototype = Object.create(proto); + $ComponentCtor.prototype.constructor = $ComponentCtor; + $ComponentCtor.$plugin = function(plugin, options) { + _$treborPlugins().push({ + options: options, + plugin: plugin + }); + }; + return $ComponentCtor; + } + function _$fragTpl() { + var htmlParts = []; + for (var _i = 0; _i < arguments.length; _i++) { + htmlParts[_i] = arguments[_i]; + } + var template = document.createElement('template'); + template.innerHTML = htmlParts.join('\x3c!----\x3e'); + var fragment = template.content; + var nodes = _$slice(fragment.childNodes); + nodes.unshift(fragment); + return nodes; + } + function _$prepareFragment(frag, els) { + if (!frag.hasChildNodes()) { + _$each(els, (function(el) { + return frag.append(el); + })); + } + } + function _$updateTxt(txt, newData) { + if (txt.data !== newData) { + txt.data = newData; + } + } + function _$child(el, index) { + if (void 0 === index) { + index = 0; + } + var node = el.childNodes[index]; + if (3 === node.nodeType) { + node.data = ''; + } + return node; + } + function _$append(parent, child, sibling) { + if (!0 === sibling) { + parent.parentElement.replaceChild(child, parent); + } else if (!sibling) { + parent.appendChild(child); + } else { + parent.insertBefore(child, sibling); + } + } + function _$attr(el, attribute, value) { + if (void 0 === attribute) { + attribute = 'value'; + } + var isValueAttr = 'value' === attribute; + var _value = isValueAttr ? '_' + attribute : null; + if (void 0 === value) { + if (isValueAttr) { + return _$hasProp(el, _value) ? el[_value] : el[attribute]; + } else { + return el.getAttribute(attribute); + } + } else { + el.setAttribute(attribute, _$toString(value)); + } + } + function _$setElements(component, parent, sibling) { + var brother = _$(sibling); + if (brother && 'boolean' !== _$type(brother)) { + component.$siblingEl = brother; + component.$parentEl = brother.parentElement; + } else { + component.$parentEl = _$(parent); + } + } + function _$destroyComponent(component) { + component.$unmount(); + component.$parent = null; + component.$parentEl = null; + component.$siblingEl = null; + component.$children.splice(0); + } + function _$context(ctx, cb) { + var args = _$slice(arguments, 2).map((function(prop) { + return prop in ctx ? ctx[prop] : window[prop]; + })); + return args.length ? cb(args) : cb(); + } + function _$insertStyle(id, css) { + var isNew = !1; + var style = _$('#' + id, document.head); + if (!style) { + isNew = !0; + (style = document.createElement('style')).id = id; + _$attr(style, 'refs', 1); + } + if (style.textContent !== css) { + style.textContent = css; + } + if (isNew) { + _$append(document.head, style); + } else { + var count = +_$attr(style, 'refs'); + _$attr(style, 'refs', ++count); + } + } + function _$removeStyle(id) { + var style = _$('#' + id, document.head); + if (style) { + var count = +_$attr(style, 'refs'); + if (0 == --count) { + document.head.removeChild(style); + } else { + _$attr(style, 'refs', count); + } + } + } + function _$tplHello(_$ctx) { + var _b; + var _$tpl, _$elements, _$h1_1, _$txt_1, _$setTxt_1; + _$setTxt_1 = function(_$ctx) { + return _$context(_$ctx, (function(_b) { + return 'Hello, ' + _b[0] + '!'; + }), 'name'); + }; + _b = _$fragTpl('

'), _$tpl = _b[0], _$elements = _b.slice(1); + return { + $create: function() { + _$h1_1 = _$child(_$tpl); + _$txt_1 = _$child(_$h1_1); + }, + $mount: function(parent, sibling) { + this.$unmount(); + _$insertStyle('scope_79b73894', 'h1.scope_79b73894 {\n color: red;\n}\n'); + _$append(_$(parent), _$tpl, _$(sibling)); + _$setElements(this, parent, sibling); + }, + $update: function(_$ctx) { + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + }, + $unmount: function() { + _$prepareFragment(_$tpl, _$elements); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + }, + $destroy: function() { + _$destroyComponent(this); + _$removeStyle('scope_79b73894'); + _$tpl = _$elements = _$h1_1 = _$txt_1 = _$setTxt_1 = void 0; + } + }; + } + root.Hello = _$createComponent(function() { + function class_1() { + this.name = 'World'; + } + return class_1; + }(), _$tplHello); +}(this); \ No newline at end of file diff --git a/examples/animation/src/index.html b/examples/01-Hello_World/index.html similarity index 57% rename from examples/animation/src/index.html rename to examples/01-Hello_World/index.html index 80c4560..79b8ce6 100644 --- a/examples/animation/src/index.html +++ b/examples/01-Hello_World/index.html @@ -5,11 +5,18 @@ - TreborJS • Animation + 01 Hello World
+ + + - + \ No newline at end of file diff --git a/examples/02-Webpack/dist/main.js b/examples/02-Webpack/dist/main.js new file mode 100644 index 0000000..8bfbc65 --- /dev/null +++ b/examples/02-Webpack/dist/main.js @@ -0,0 +1,687 @@ +!function(root, factory) { + if ('object' == typeof exports && 'object' == typeof module) { + module.exports = factory(); + } else if ('function' == typeof define && define.amd) { + define([], factory); + } else { + var a = factory(); + for (var i in a) { + ('object' == typeof exports ? exports : root)[i] = a[i]; + } + } +}(window, (function() { + return function(modules) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module = installedModules[moduleId] = { + i: moduleId, + l: !1, + exports: {} + }; + modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + module.l = !0; + return module.exports; + } + __webpack_require__.m = modules; + __webpack_require__.c = installedModules; + __webpack_require__.d = function(exports, name, getter) { + if (!__webpack_require__.o(exports, name)) { + Object.defineProperty(exports, name, { + enumerable: !0, + get: getter + }); + } + }; + __webpack_require__.r = function(exports) { + if ('undefined' != typeof Symbol && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { + value: 'Module' + }); + } + Object.defineProperty(exports, '__esModule', { + value: !0 + }); + }; + __webpack_require__.t = function(value, mode) { + if (1 & mode) { + value = __webpack_require__(value); + } + if (8 & mode) { + return value; + } + if (4 & mode && 'object' == typeof value && value && value.__esModule) { + return value; + } + var ns = Object.create(null); + __webpack_require__.r(ns); + Object.defineProperty(ns, 'default', { + enumerable: !0, + value: value + }); + if (2 & mode && 'string' != typeof value) { + for (var key in value) { + __webpack_require__.d(ns, key, function(key) { + return value[key]; + }.bind(null, key)); + } + } + return ns; + }; + __webpack_require__.n = function(module) { + var getter = module && module.__esModule ? function() { + return module.default; + } : function() { + return module; + }; + __webpack_require__.d(getter, 'a', getter); + return getter; + }; + __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; + __webpack_require__.p = ''; + return __webpack_require__(__webpack_require__.s = 0); + }([ function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + function _$extends(d, b) { + _$assign(d, b); + function _() { + this.constructor = d; + } + d.prototype = null === b ? Object.create(b) : (_.prototype = b.prototype, new _); + } + function _$(selector, parent) { + return _$isString(selector) ? (parent || document.body).querySelector(selector) : selector; + } + function _$type(obj) { + return _$lowerCase(Object.prototype.toString.call(obj).slice(8, -1)); + } + function _$isType(obj, objType) { + return _$isString(objType) ? _$type(obj) === objType : obj instanceof objType; + } + function _$isString(str) { + return 'string' === _$type(str); + } + function _$isArray(array) { + return 'array' === _$type(array) || array instanceof _$List; + } + function _$isObject(obj) { + return 'object' === _$type(obj); + } + function _$isFunction(obj) { + return 'function' === _$type(obj); + } + function _$toString(obj) { + if (_$isString(obj)) { + return obj; + } + var str = _$type(obj); + return /(^(null|undefined)$)/.test(str) ? str : obj.toString(); + } + function _$toType(value, type, component, key) { + switch (type) { + case 'date': + return new Date(value); + + case 'string': + return _$toString(value); + + case 'number': + return +value; + + case 'boolean': + return _$isString(value) && !value ? !0 : !!value; + + case 'array': + return _$isType(value, _$List) ? value : new _$List(value, component, key); + + default: + return value; + } + } + function _$slice(array, from) { + var args = []; + for (var i = from = from || 0; i < array.length; i++) { + args[i - from] = array[i]; + } + return args; + } + function _$hasProp(obj, prop) { + return obj.hasOwnProperty(prop); + } + function _$define(obj, mapDesc) { + Object.defineProperties(obj, mapDesc); + } + function _$each(obj, cb) { + if (_$isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + cb(obj[i], i); + } + } else if (_$isObject(obj)) { + var keys = Object.keys(obj); + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + cb(obj[key], key, i); + } + } + } + function _$lowerCase(str) { + return str.toLowerCase(); + } + function _$apply(callee, args, globs, thisArg) { + if (globs && !_$isArray(globs)) { + thisArg = globs; + globs = []; + } else if (void 0 === globs) { + globs = []; + } else if (void 0 === thisArg) { + thisArg = null; + } + return callee.apply(thisArg, args.concat(globs)); + } + function _$treborPlugins() { + var _a; + var TREBOR_PK = '__TREBOR_PLUGINS__'; + if (!window[TREBOR_PK]) { + _$define(window, ((_a = {})[TREBOR_PK] = { + value: [], + configurable: !0, + writable: !0, + enumerable: !1 + }, _a)); + } + return window[TREBOR_PK]; + } + function _$assign(child, parent) { + for (var property in parent) { + if (parent.hasOwnProperty(property)) { + child[property] = parent[property]; + } + } + return child; + } + function _$plainObject(obj) { + var data = {}; + _$each(_$isObject(obj) ? obj : {}, (function(value, k) { + if ('$' !== k[0] && !_$isFunction(value)) { + if (_$isType(value, _$List)) { + data[k] = value.map(_$plainObject); + } else if (_$isObject(value)) { + data[k] = _$plainObject(value); + } else { + data[k] = value; + } + } + })); + return _$isObject(obj) ? data : obj; + } + function _$accesor(component, path, value) { + return path.split('.').reduce((function(obj, key, i, arr) { + if (_$isType(value, 'undefined')) { + if (null == obj) { + arr.splice(0, arr.length); + return i > 0 && null === obj ? obj : void 0; + } + } else if (i === arr.length - 1) { + if (_$isType(obj, _$List) && _$toString(+key) === key) { + obj.pull(+key, value); + } else { + var oldVal = obj[key]; + obj[key] = Array.isArray(value) ? new _$List(value, component, key) : value; + _$dispatch(component, path, oldVal, obj[key]); + } + } else if (!_$isObject(obj[key])) { + obj[key] = {}; + } + return obj ? obj[key] : null; + }), component); + } + function _$dispatch(component, key, oldVal, value) { + component.$notify(key); + if (component._watchers[key]) { + _$each(component._watchers[key], (function(watcher) { + watcher(oldVal, value); + })); + } + component.$update(); + } + function _$subscribers(dep, handler) { + if (!this._subscribers[dep]) { + this._subscribers[dep] = []; + } + return this._subscribers[dep].push(handler.bind(this)) - 1; + } + var _$Component = function() { + function _$Component(attrs, compCtor, parent) { + var self = this; + if (!attrs) { + attrs = {}; + } + var propMap = { + $refs: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $slots: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $parent: { + value: parent || null, + enumerable: !1, + configurable: !0 + }, + $children: { + value: [], + enumerable: !1, + configurable: !0 + }, + $filters: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $options: { + value: { + filters: compCtor.$filters || {}, + children: compCtor.$children || {}, + attributes: compCtor.$attributes || {} + }, + enumerable: !1, + configurable: !0 + } + }; + _$each(compCtor.$attributes || [], (function(attrOps, key) { + key = _$isType(key, 'number') ? attrOps : key; + propMap[key] = { + get: function() { + if (_$isString(attrOps)) { + return _$isFunction(value = attrs[attrOps]) ? value() : value; + } else if (!_$hasProp(attrs, key) && attrOps.required) { + return console.error('Attribute \'' + key + '\' is required.'); + } else { + var value; + if (void 0 === (value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key]) && _$hasProp(attrOps, 'default')) { + var def = attrOps.default; + value = _$isFunction(def) ? def() : def; + } + var typ = attrOps.type; + if (typ && !_$isType(value, typ) && attrOps.required) { + return console.error('Attribute \'' + key + '\' must be type \'' + typ + '\'.'); + } + if (void 0 !== (value = _$toType(value, void 0 === value ? 'undefined' : typ, self, key)) && _$hasProp(attrOps, 'validator')) { + var validator = attrOps.validator; + if (_$isFunction(validator) && !validator(value)) { + return console.error('Assigment \'' + key + '\'=\'' + JSON.stringify(value) + '\' invalid.'); + } + } + return value; + } + }, + set: function() { + console.error('\'' + key + '\' is read only.'); + }, + enumerable: !0, + configurable: !0 + }; + })); + var desc = { + enumerable: !1, + configurable: !1 + }; + propMap._events = _$assign({ + value: {} + }, desc); + propMap._watchers = _$assign({ + value: {} + }, desc); + propMap._subscribers = _$assign({ + value: {} + }, desc); + _$define(self, propMap); + _$assign(self.$filters, compCtor.$filters || {}); + } + var prototype = _$Component.prototype; + _$define(prototype, { + $data: { + get: function() { + return _$plainObject(this); + }, + enumerable: !0, + configurable: !0 + } + }); + prototype.$get = function(path) { + return _$accesor(this, path); + }; + prototype.$set = function(path, value) { + _$accesor(this, path, value); + }; + prototype.$on = function(event, handler) { + if (!this._events[event]) { + this._events[event] = []; + } + this._events[event].push(handler); + }; + prototype.$off = function(event, handler) { + var index = this._events[event].indexOf(handler); + ~index && this._events[event].splice(index, 1); + }; + prototype.$once = function(event, handler) { + var _this = this; + var _handler = function(args) { + handler(args); + _this.$off(event, _handler); + }; + this.$on(event, _handler); + }; + prototype.$fire = function(event, data) { + if (this._events[event]) { + _$each(this._events[event], (function(handler) { + handler(data); + })); + } + }; + prototype.$notify = function(key) { + if (this._subscribers[key]) { + _$each(this._subscribers[key], (function(suscriber) { + suscriber(); + })); + } + }; + prototype.$observe = function(keyOrKeys, handler) { + var _this = this; + var subs = []; + if (_$isArray(keyOrKeys)) { + _$each(keyOrKeys, (function(key) { + subs.push({ + subscrition: key, + index: _$subscribers.call(_this, key, handler) + }); + })); + } else { + subs.push({ + subscrition: keyOrKeys, + index: _$subscribers.call(this, keyOrKeys, handler) + }); + } + return { + $unobserve: function() { + _$each(subs, (function(_a) { + var subscrition = _a.subscrition, index = _a.index; + _this._subscribers[subscrition].splice(index, 1); + })); + } + }; + }; + prototype.$watch = function(key, handler) { + var _this = this; + if (!this._watchers[key]) { + this._watchers[key] = []; + } + var i = this._watchers[key].push(handler.bind(this)); + return { + $unwatch: function() { + _this._watchers[key].splice(i - 1, 1); + } + }; + }; + return _$Component; + }(); + var _$List = function(_super) { + _$extends(List, _super); + function List(value, component, key) { + _super.call(this, value.length); + var self = this; + _$define(self, { + _key: { + value: key, + enumerable: !1 + }, + _root: { + value: component, + enumerable: !1 + } + }); + _$apply(_super.prototype.push, value.map((function(val, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(val, List) && _$isArray(val) ? new List(val, component, key + '.' + i) : val; + })), [], self); + } + List.prototype.pull = function(index) { + var self = this; + var args = _$slice(arguments, 1); + var length = self.length; + if (index > length) { + length = index + 1; + var pull = new Array(index - self.length); + _$apply(pull.push, args, [], pull); + for (var i = 0; i < length; i++) { + if (i === index) { + _$apply(self.push, pull, [], self); + } + } + } else { + _$apply(self.splice, [ index, 1 ].concat(args), [], self); + } + }; + [ 'pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice' ].forEach((function(method) { + List.prototype[method] = function() { + var self = this; + var args = _$slice(arguments); + var old = self.slice(); + var result = void 0; + if ('push' === method) { + _$apply([].push, args.map((function(v, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(v, List) && _$isArray(v) ? new List(v, self._root, self._key + '.' + i) : v; + })), [], self); + result = self.length; + } else { + result = _$apply(Array.prototype[method], args, [], self); + } + _$dispatch(self._root, self._key, old, self.slice()); + return result; + }; + })); + return List; + }(Array); + function _$createComponent($ComponentClass, templateFn) { + function $ComponentCtor(attrs, parent) { + var self = this; + _$apply(_$Component, [ attrs, $ComponentCtor, parent ], [], self); + $ComponentClass.call(self); + var descriptors = {}; + _$each(self, (function(_, key) { + if (_$hasProp(self, key)) { + var descriptor = Object.getOwnPropertyDescriptor(self, key); + if (descriptor.value && _$isArray(descriptor.value)) { + descriptor.value = new _$List(descriptor.value, self, key); + } else { + if (descriptor.get) { + var getter_1_1 = descriptor.get; + descriptor.get = function() { + var value = getter_1_1.call(this); + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + return value; + }; + } + if (descriptor.set) { + var setter_1_1 = descriptor.set; + descriptor.set = function(value) { + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + setter_1_1.call(this, value); + }; + } + } + descriptors[key] = descriptor; + } + })); + _$define(self, descriptors); + var tpl = templateFn(self); + var tplDesc = {}; + _$each(tpl, (function(value, key) { + tplDesc[key] = function(key, value) { + var hook = key[1].toUpperCase() + _$slice(key, 2); + return { + enumerable: !1, + configurable: !1, + writable: !1, + value: function() { + var args = _$slice(arguments); + var ahook = this['did' + hook]; + var bhook = this['will' + hook]; + bhook && bhook.call(this); + _$apply(value, '$update' === key ? [ this, _$slice(args, 1) ] : args, this); + ahook && ahook.call(this); + } + }; + }(key, value); + })); + _$define(self, tplDesc); + _$each(_$treborPlugins(), (function(_a) { + var plugin = _a.plugin, options = _a.options; + plugin.call(self, $ComponentCtor, options); + })); + !parent && this.$create(); + } + var proto = [ $ComponentClass.prototype, _$Component.prototype ].reduceRight((function(superProto, proto) { + var inheritedProto = Object.create(superProto); + for (var key in proto) { + if (proto.hasOwnProperty(key)) { + var desc = Object.getOwnPropertyDescriptor(proto, key); + Object.defineProperty(inheritedProto, key, desc); + } + } + _$assign($ComponentCtor, proto.constructor); + inheritedProto.constructor = proto.constructor; + return inheritedProto; + }), Object.prototype); + $ComponentCtor.prototype = Object.create(proto); + $ComponentCtor.prototype.constructor = $ComponentCtor; + $ComponentCtor.$plugin = function(plugin, options) { + _$treborPlugins().push({ + options: options, + plugin: plugin + }); + }; + return $ComponentCtor; + } + function _$fragTpl() { + var htmlParts = []; + for (var _i = 0; _i < arguments.length; _i++) { + htmlParts[_i] = arguments[_i]; + } + var template = document.createElement('template'); + template.innerHTML = htmlParts.join('\x3c!----\x3e'); + var fragment = template.content; + var nodes = _$slice(fragment.childNodes); + nodes.unshift(fragment); + return nodes; + } + function _$prepareFragment(frag, els) { + if (!frag.hasChildNodes()) { + _$each(els, (function(el) { + return frag.append(el); + })); + } + } + function _$updateTxt(txt, newData) { + if (txt.data !== newData) { + txt.data = newData; + } + } + function _$child(el, index) { + if (void 0 === index) { + index = 0; + } + var node = el.childNodes[index]; + if (3 === node.nodeType) { + node.data = ''; + } + return node; + } + function _$append(parent, child, sibling) { + if (!0 === sibling) { + parent.parentElement.replaceChild(child, parent); + } else if (!sibling) { + parent.appendChild(child); + } else { + parent.insertBefore(child, sibling); + } + } + function _$setElements(component, parent, sibling) { + var brother = _$(sibling); + if (brother && 'boolean' !== _$type(brother)) { + component.$siblingEl = brother; + component.$parentEl = brother.parentElement; + } else { + component.$parentEl = _$(parent); + } + } + function _$destroyComponent(component) { + component.$unmount(); + component.$parent = null; + component.$parentEl = null; + component.$siblingEl = null; + component.$children.splice(0); + } + function _$context(ctx, cb) { + var args = _$slice(arguments, 2).map((function(prop) { + return prop in ctx ? ctx[prop] : window[prop]; + })); + return args.length ? cb(args) : cb(); + } + function _$tplMain(_$ctx) { + var _a; + var _$tpl, _$elements, _$h1_1, _$txt_1, _$setTxt_1; + _$setTxt_1 = function(_$ctx) { + return _$context(_$ctx, (function(_a) { + return 'Hello, ' + _a[0] + '!'; + }), 'name'); + }; + _a = _$fragTpl('

'), _$tpl = _a[0], _$elements = _a.slice(1); + return { + $create: function() { + _$h1_1 = _$child(_$tpl); + _$txt_1 = _$child(_$h1_1); + }, + $mount: function(parent, sibling) { + this.$unmount(); + _$append(_$(parent), _$tpl, _$(sibling)); + _$setElements(this, parent, sibling); + }, + $update: function(_$ctx) { + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + }, + $unmount: function() { + _$prepareFragment(_$tpl, _$elements); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + }, + $destroy: function() { + _$destroyComponent(this); + _$tpl = _$elements = _$h1_1 = _$txt_1 = _$setTxt_1 = void 0; + } + }; + } + (new (_$createComponent(function() { + function class_1() { + this.name = 'World'; + } + return class_1; + }(), _$tplMain))).$mount('main'); + } ]); +})); \ No newline at end of file diff --git a/examples/calendar/src/index.html b/examples/02-Webpack/index.html similarity index 78% rename from examples/calendar/src/index.html rename to examples/02-Webpack/index.html index 7724a81..ca86c50 100644 --- a/examples/calendar/src/index.html +++ b/examples/02-Webpack/index.html @@ -1,15 +1,14 @@ - - TreborJS • Calendar + 02 Webpack -
- + + \ No newline at end of file diff --git a/examples/02-Webpack/src/main.html b/examples/02-Webpack/src/main.html new file mode 100644 index 0000000..d3681dd --- /dev/null +++ b/examples/02-Webpack/src/main.html @@ -0,0 +1,7 @@ +

Hello, {name}!

+ + \ No newline at end of file diff --git a/examples/02-Webpack/src/main.js b/examples/02-Webpack/src/main.js new file mode 100644 index 0000000..04d8454 --- /dev/null +++ b/examples/02-Webpack/src/main.js @@ -0,0 +1,5 @@ +import Main from './main.html'; + +const main = new Main(); + +main.$mount('main'); diff --git a/examples/02-Webpack/webpack.config.js b/examples/02-Webpack/webpack.config.js new file mode 100644 index 0000000..f1cac79 --- /dev/null +++ b/examples/02-Webpack/webpack.config.js @@ -0,0 +1,58 @@ +const path = require('path'); +const webpack = require('webpack'); +const TerserPlugin = require('terser-webpack-plugin'); + +const config = { + mode: 'production', + context: __dirname, + entry: './src/main', + output: { + filename: 'main.js', + libraryTarget: 'umd', + path: path.resolve(__dirname, 'dist') + }, + module: { + rules: [ + { + test: /\.html$/, + use: { + loader: path.resolve(__dirname, '../../loader.js'), + options: { + // options here... + } + } + } + ] + }, + resolve: { + alias: { + 'trebor/tools': path.resolve(__dirname, '../../tools/index.js'), + }, + }, + plugins: [ + new webpack.optimize.ModuleConcatenationPlugin() + ], + optimization: { + usedExports: true, + minimize: true, + minimizer: [ + new TerserPlugin({ + terserOptions: { + mangle: false, + module: true, + toplevel: true, + parse: { ecma: 9 }, + output: { + quote_style: 1, indent_level: 2, beautify: true, braces: true + }, + compress: { + passes: 2, keep_fargs: false, inline: false, if_return: false, sequences: false, + reduce_vars: false, reduce_funcs: false, conditionals: false, join_vars: false + } + } + }) + ] + } +}; + +module.exports = config; diff --git a/examples/03-Rollup/dist/main.js b/examples/03-Rollup/dist/main.js new file mode 100644 index 0000000..bcd54ab --- /dev/null +++ b/examples/03-Rollup/dist/main.js @@ -0,0 +1,600 @@ +!function() { + 'use strict'; + function _$extends(d, b) { + _$assign(d, b); + function _() { + this.constructor = d; + } + d.prototype = null === b ? Object.create(b) : (_.prototype = b.prototype, new _); + } + function _$(selector, parent) { + return _$isString(selector) ? (parent || document.body).querySelector(selector) : selector; + } + function _$type(obj) { + return _$lowerCase(Object.prototype.toString.call(obj).slice(8, -1)); + } + function _$isType(obj, objType) { + return _$isString(objType) ? _$type(obj) === objType : obj instanceof objType; + } + function _$isString(str) { + return 'string' === _$type(str); + } + function _$isArray(array) { + return 'array' === _$type(array) || array instanceof _$List; + } + function _$isObject(obj) { + return 'object' === _$type(obj); + } + function _$isFunction(obj) { + return 'function' === _$type(obj); + } + function _$toString(obj) { + if (_$isString(obj)) { + return obj; + } + var str = _$type(obj); + return /(^(null|undefined)$)/.test(str) ? str : obj.toString(); + } + function _$toType(value, type, component, key) { + switch (type) { + case 'date': + return new Date(value); + + case 'string': + return _$toString(value); + + case 'number': + return +value; + + case 'boolean': + return _$isString(value) && !value ? !0 : !!value; + + case 'array': + return _$isType(value, _$List) ? value : new _$List(value, component, key); + + default: + return value; + } + } + function _$slice(array, from) { + var args = []; + for (var i = from = from || 0; i < array.length; i++) { + args[i - from] = array[i]; + } + return args; + } + function _$hasProp(obj, prop) { + return obj.hasOwnProperty(prop); + } + function _$define(obj, mapDesc) { + Object.defineProperties(obj, mapDesc); + } + function _$each(obj, cb) { + if (_$isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + cb(obj[i], i); + } + } else if (_$isObject(obj)) { + var keys = Object.keys(obj); + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + cb(obj[key], key, i); + } + } + } + function _$lowerCase(str) { + return str.toLowerCase(); + } + function _$apply(callee, args, globs, thisArg) { + if (globs && !_$isArray(globs)) { + thisArg = globs; + globs = []; + } else if (void 0 === globs) { + globs = []; + } else if (void 0 === thisArg) { + thisArg = null; + } + return callee.apply(thisArg, args.concat(globs)); + } + function _$treborPlugins() { + var _a; + var TREBOR_PK = '__TREBOR_PLUGINS__'; + if (!window[TREBOR_PK]) { + _$define(window, ((_a = {})[TREBOR_PK] = { + value: [], + configurable: !0, + writable: !0, + enumerable: !1 + }, _a)); + } + return window[TREBOR_PK]; + } + function _$assign(child, parent) { + for (var property in parent) { + if (parent.hasOwnProperty(property)) { + child[property] = parent[property]; + } + } + return child; + } + function _$plainObject(obj) { + var data = {}; + _$each(_$isObject(obj) ? obj : {}, (function(value, k) { + if ('$' !== k[0] && !_$isFunction(value)) { + if (_$isType(value, _$List)) { + data[k] = value.map(_$plainObject); + } else if (_$isObject(value)) { + data[k] = _$plainObject(value); + } else { + data[k] = value; + } + } + })); + return _$isObject(obj) ? data : obj; + } + function _$accesor(component, path, value) { + return path.split('.').reduce((function(obj, key, i, arr) { + if (_$isType(value, 'undefined')) { + if (null == obj) { + arr.splice(0, arr.length); + return i > 0 && null === obj ? obj : void 0; + } + } else if (i === arr.length - 1) { + if (_$isType(obj, _$List) && _$toString(+key) === key) { + obj.pull(+key, value); + } else { + var oldVal = obj[key]; + obj[key] = Array.isArray(value) ? new _$List(value, component, key) : value; + _$dispatch(component, path, oldVal, obj[key]); + } + } else if (!_$isObject(obj[key])) { + obj[key] = {}; + } + return obj ? obj[key] : null; + }), component); + } + function _$dispatch(component, key, oldVal, value) { + component.$notify(key); + if (component._watchers[key]) { + _$each(component._watchers[key], (function(watcher) { + watcher(oldVal, value); + })); + } + component.$update(); + } + function _$subscribers(dep, handler) { + if (!this._subscribers[dep]) { + this._subscribers[dep] = []; + } + return this._subscribers[dep].push(handler.bind(this)) - 1; + } + var _$Component = function() { + function _$Component(attrs, compCtor, parent) { + var self = this; + if (!attrs) { + attrs = {}; + } + var propMap = { + $refs: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $slots: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $parent: { + value: parent || null, + enumerable: !1, + configurable: !0 + }, + $children: { + value: [], + enumerable: !1, + configurable: !0 + }, + $filters: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $options: { + value: { + filters: compCtor.$filters || {}, + children: compCtor.$children || {}, + attributes: compCtor.$attributes || {} + }, + enumerable: !1, + configurable: !0 + } + }; + _$each(compCtor.$attributes || [], (function(attrOps, key) { + key = _$isType(key, 'number') ? attrOps : key; + propMap[key] = { + get: function() { + if (_$isString(attrOps)) { + return _$isFunction(value = attrs[attrOps]) ? value() : value; + } else if (!_$hasProp(attrs, key) && attrOps.required) { + return console.error('Attribute \'' + key + '\' is required.'); + } else { + var value; + if (void 0 === (value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key]) && _$hasProp(attrOps, 'default')) { + var def = attrOps.default; + value = _$isFunction(def) ? def() : def; + } + var typ = attrOps.type; + if (typ && !_$isType(value, typ) && attrOps.required) { + return console.error('Attribute \'' + key + '\' must be type \'' + typ + '\'.'); + } + if (void 0 !== (value = _$toType(value, void 0 === value ? 'undefined' : typ, self, key)) && _$hasProp(attrOps, 'validator')) { + var validator = attrOps.validator; + if (_$isFunction(validator) && !validator(value)) { + return console.error('Assigment \'' + key + '\'=\'' + JSON.stringify(value) + '\' invalid.'); + } + } + return value; + } + }, + set: function() { + console.error('\'' + key + '\' is read only.'); + }, + enumerable: !0, + configurable: !0 + }; + })); + var desc = { + enumerable: !1, + configurable: !1 + }; + propMap._events = _$assign({ + value: {} + }, desc); + propMap._watchers = _$assign({ + value: {} + }, desc); + propMap._subscribers = _$assign({ + value: {} + }, desc); + _$define(self, propMap); + _$assign(self.$filters, compCtor.$filters || {}); + } + var prototype = _$Component.prototype; + _$define(prototype, { + $data: { + get: function() { + return _$plainObject(this); + }, + enumerable: !0, + configurable: !0 + } + }); + prototype.$get = function(path) { + return _$accesor(this, path); + }; + prototype.$set = function(path, value) { + _$accesor(this, path, value); + }; + prototype.$on = function(event, handler) { + if (!this._events[event]) { + this._events[event] = []; + } + this._events[event].push(handler); + }; + prototype.$off = function(event, handler) { + var index = this._events[event].indexOf(handler); + ~index && this._events[event].splice(index, 1); + }; + prototype.$once = function(event, handler) { + var _this = this; + var _handler = function(args) { + handler(args); + _this.$off(event, _handler); + }; + this.$on(event, _handler); + }; + prototype.$fire = function(event, data) { + if (this._events[event]) { + _$each(this._events[event], (function(handler) { + handler(data); + })); + } + }; + prototype.$notify = function(key) { + if (this._subscribers[key]) { + _$each(this._subscribers[key], (function(suscriber) { + suscriber(); + })); + } + }; + prototype.$observe = function(keyOrKeys, handler) { + var _this = this; + var subs = []; + if (_$isArray(keyOrKeys)) { + _$each(keyOrKeys, (function(key) { + subs.push({ + subscrition: key, + index: _$subscribers.call(_this, key, handler) + }); + })); + } else { + subs.push({ + subscrition: keyOrKeys, + index: _$subscribers.call(this, keyOrKeys, handler) + }); + } + return { + $unobserve: function() { + _$each(subs, (function(_a) { + var subscrition = _a.subscrition, index = _a.index; + _this._subscribers[subscrition].splice(index, 1); + })); + } + }; + }; + prototype.$watch = function(key, handler) { + var _this = this; + if (!this._watchers[key]) { + this._watchers[key] = []; + } + var i = this._watchers[key].push(handler.bind(this)); + return { + $unwatch: function() { + _this._watchers[key].splice(i - 1, 1); + } + }; + }; + return _$Component; + }(); + var _$List = function(_super) { + _$extends(List, _super); + function List(value, component, key) { + _super.call(this, value.length); + var self = this; + _$define(self, { + _key: { + value: key, + enumerable: !1 + }, + _root: { + value: component, + enumerable: !1 + } + }); + _$apply(_super.prototype.push, value.map((function(val, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(val, List) && _$isArray(val) ? new List(val, component, key + '.' + i) : val; + })), [], self); + } + List.prototype.pull = function(index) { + var self = this; + var args = _$slice(arguments, 1); + var length = self.length; + if (index > length) { + length = index + 1; + var pull = new Array(index - self.length); + _$apply(pull.push, args, [], pull); + for (var i = 0; i < length; i++) { + if (i === index) { + _$apply(self.push, pull, [], self); + } + } + } else { + _$apply(self.splice, [ index, 1 ].concat(args), [], self); + } + }; + [ 'pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice' ].forEach((function(method) { + List.prototype[method] = function() { + var self = this; + var args = _$slice(arguments); + var old = self.slice(); + var result = void 0; + if ('push' === method) { + _$apply([].push, args.map((function(v, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(v, List) && _$isArray(v) ? new List(v, self._root, self._key + '.' + i) : v; + })), [], self); + result = self.length; + } else { + result = _$apply(Array.prototype[method], args, [], self); + } + _$dispatch(self._root, self._key, old, self.slice()); + return result; + }; + })); + return List; + }(Array); + function _$createComponent($ComponentClass, templateFn) { + function $ComponentCtor(attrs, parent) { + var self = this; + _$apply(_$Component, [ attrs, $ComponentCtor, parent ], [], self); + $ComponentClass.call(self); + var descriptors = {}; + _$each(self, (function(_, key) { + if (_$hasProp(self, key)) { + var descriptor = Object.getOwnPropertyDescriptor(self, key); + if (descriptor.value && _$isArray(descriptor.value)) { + descriptor.value = new _$List(descriptor.value, self, key); + } else { + if (descriptor.get) { + var getter_1_1 = descriptor.get; + descriptor.get = function() { + var value = getter_1_1.call(this); + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + return value; + }; + } + if (descriptor.set) { + var setter_1_1 = descriptor.set; + descriptor.set = function(value) { + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + setter_1_1.call(this, value); + }; + } + } + descriptors[key] = descriptor; + } + })); + _$define(self, descriptors); + var tpl = templateFn(self); + var tplDesc = {}; + _$each(tpl, (function(value, key) { + tplDesc[key] = function(key, value) { + var hook = key[1].toUpperCase() + _$slice(key, 2); + return { + enumerable: !1, + configurable: !1, + writable: !1, + value: function() { + var args = _$slice(arguments); + var ahook = this['did' + hook]; + var bhook = this['will' + hook]; + bhook && bhook.call(this); + _$apply(value, '$update' === key ? [ this, _$slice(args, 1) ] : args, this); + ahook && ahook.call(this); + } + }; + }(key, value); + })); + _$define(self, tplDesc); + _$each(_$treborPlugins(), (function(_a) { + var plugin = _a.plugin, options = _a.options; + plugin.call(self, $ComponentCtor, options); + })); + !parent && this.$create(); + } + var proto = [ $ComponentClass.prototype, _$Component.prototype ].reduceRight((function(superProto, proto) { + var inheritedProto = Object.create(superProto); + for (var key in proto) { + if (proto.hasOwnProperty(key)) { + var desc = Object.getOwnPropertyDescriptor(proto, key); + Object.defineProperty(inheritedProto, key, desc); + } + } + _$assign($ComponentCtor, proto.constructor); + inheritedProto.constructor = proto.constructor; + return inheritedProto; + }), Object.prototype); + $ComponentCtor.prototype = Object.create(proto); + $ComponentCtor.prototype.constructor = $ComponentCtor; + $ComponentCtor.$plugin = function(plugin, options) { + _$treborPlugins().push({ + options: options, + plugin: plugin + }); + }; + return $ComponentCtor; + } + function _$fragTpl() { + var htmlParts = []; + for (var _i = 0; _i < arguments.length; _i++) { + htmlParts[_i] = arguments[_i]; + } + var template = document.createElement('template'); + template.innerHTML = htmlParts.join('\x3c!----\x3e'); + var fragment = template.content; + var nodes = _$slice(fragment.childNodes); + nodes.unshift(fragment); + return nodes; + } + function _$prepareFragment(frag, els) { + if (!frag.hasChildNodes()) { + _$each(els, (function(el) { + return frag.append(el); + })); + } + } + function _$updateTxt(txt, newData) { + if (txt.data !== newData) { + txt.data = newData; + } + } + function _$child(el, index) { + if (void 0 === index) { + index = 0; + } + var node = el.childNodes[index]; + if (3 === node.nodeType) { + node.data = ''; + } + return node; + } + function _$append(parent, child, sibling) { + if (!0 === sibling) { + parent.parentElement.replaceChild(child, parent); + } else if (!sibling) { + parent.appendChild(child); + } else { + parent.insertBefore(child, sibling); + } + } + function _$setElements(component, parent, sibling) { + var brother = _$(sibling); + if (brother && 'boolean' !== _$type(brother)) { + component.$siblingEl = brother; + component.$parentEl = brother.parentElement; + } else { + component.$parentEl = _$(parent); + } + } + function _$destroyComponent(component) { + component.$unmount(); + component.$parent = null; + component.$parentEl = null; + component.$siblingEl = null; + component.$children.splice(0); + } + function _$context(ctx, cb) { + var args = _$slice(arguments, 2).map((function(prop) { + return prop in ctx ? ctx[prop] : window[prop]; + })); + return args.length ? cb(args) : cb(); + } + function _$tplMain(_$ctx) { + var _a; + var _$tpl, _$elements, _$h1_1, _$txt_1, _$setTxt_1; + _$setTxt_1 = function(_$ctx) { + return _$context(_$ctx, (function(_a) { + return 'Hello, ' + _a[0] + '!'; + }), 'name'); + }; + _a = _$fragTpl('

'), _$tpl = _a[0], _$elements = _a.slice(1); + return { + $create: function() { + _$h1_1 = _$child(_$tpl); + _$txt_1 = _$child(_$h1_1); + }, + $mount: function(parent, sibling) { + this.$unmount(); + _$append(_$(parent), _$tpl, _$(sibling)); + _$setElements(this, parent, sibling); + }, + $update: function(_$ctx) { + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + }, + $unmount: function() { + _$prepareFragment(_$tpl, _$elements); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + }, + $destroy: function() { + _$destroyComponent(this); + _$tpl = _$elements = _$h1_1 = _$txt_1 = _$setTxt_1 = void 0; + } + }; + } + (new (_$createComponent(function() { + function class_1() { + this.name = 'World'; + } + return class_1; + }(), _$tplMain))).$mount('main'); +}(); diff --git a/examples/clock/src/index.html b/examples/03-Rollup/index.html similarity index 78% rename from examples/clock/src/index.html rename to examples/03-Rollup/index.html index 0521bfe..b56cb17 100644 --- a/examples/clock/src/index.html +++ b/examples/03-Rollup/index.html @@ -1,15 +1,14 @@ - - TreborJS • Clock + 03 Rollup -
- + + \ No newline at end of file diff --git a/examples/03-Rollup/rollup.config.js b/examples/03-Rollup/rollup.config.js new file mode 100644 index 0000000..e13bbcb --- /dev/null +++ b/examples/03-Rollup/rollup.config.js @@ -0,0 +1,29 @@ +const path = require('path'); +const trebor = require('../../plugin'); +const alias = require('@rollup/plugin-alias'); +const { terser } = require('rollup-plugin-terser'); + +module.exports = { + input: path.join(__dirname, 'src/main.js'), + output: { + file: path.join(__dirname, 'dist/main.js'), + format: 'iife' + }, + plugins: [trebor(), alias({ + entries: { + 'trebor/tools': path.resolve(__dirname, '../../tools/index.js') + } + }), terser({ + mangle: false, + module: true, + toplevel: true, + parse: { ecma: 9 }, + output: { + quote_style: 1, indent_level: 2, beautify: true, braces: true + }, + compress: { + passes: 2, keep_fargs: false, inline: false, if_return: false, sequences: false, + reduce_vars: false, reduce_funcs: false, conditionals: false, join_vars: false + } + })] +}; \ No newline at end of file diff --git a/examples/03-Rollup/src/main.html b/examples/03-Rollup/src/main.html new file mode 100644 index 0000000..d3681dd --- /dev/null +++ b/examples/03-Rollup/src/main.html @@ -0,0 +1,7 @@ +

Hello, {name}!

+ + \ No newline at end of file diff --git a/examples/03-Rollup/src/main.js b/examples/03-Rollup/src/main.js new file mode 100644 index 0000000..04d8454 --- /dev/null +++ b/examples/03-Rollup/src/main.js @@ -0,0 +1,5 @@ +import Main from './main.html'; + +const main = new Main(); + +main.$mount('main'); diff --git a/examples/todomvc/dist/css/todomvc-app.css b/examples/04-ToDoMVC/css/todomvc-app.css similarity index 72% rename from examples/todomvc/dist/css/todomvc-app.css rename to examples/04-ToDoMVC/css/todomvc-app.css index 72a8bb5..bf7410e 100644 --- a/examples/todomvc/dist/css/todomvc-app.css +++ b/examples/04-ToDoMVC/css/todomvc-app.css @@ -15,30 +15,26 @@ button { font-weight: inherit; color: inherit; -webkit-appearance: none; - -moz-appearance: none; appearance: none; -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } body { font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.4em; background: #f5f5f5; - color: #4d4d4d; + color: #111111; min-width: 230px; max-width: 550px; margin: 0 auto; -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; font-weight: 300; } -button, -input[type="checkbox"] { - outline: none; +:focus { + outline: 0; } .hidden { @@ -56,29 +52,29 @@ input[type="checkbox"] { .todoapp input::-webkit-input-placeholder { font-style: italic; font-weight: 300; - color: #e6e6e6; + color: rgba(0, 0, 0, 0.4); } .todoapp input::-moz-placeholder { font-style: italic; font-weight: 300; - color: #e6e6e6; + color: rgba(0, 0, 0, 0.4); } .todoapp input::input-placeholder { font-style: italic; font-weight: 300; - color: #e6e6e6; + color: rgba(0, 0, 0, 0.4); } .todoapp h1 { position: absolute; - top: -155px; + top: -140px; width: 100%; - font-size: 100px; - font-weight: 100; + font-size: 80px; + font-weight: 200; text-align: center; - color: rgba(175, 47, 47, 0.15); + color: #b83f45; -webkit-text-rendering: optimizeLegibility; -moz-text-rendering: optimizeLegibility; text-rendering: optimizeLegibility; @@ -93,16 +89,13 @@ input[type="checkbox"] { font-family: inherit; font-weight: inherit; line-height: 1.4em; - border: 0; - outline: none; color: inherit; padding: 6px; border: 1px solid #999; box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); box-sizing: border-box; -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } .new-todo { @@ -118,28 +111,35 @@ input[type="checkbox"] { border-top: 1px solid #e6e6e6; } -label[for='toggle-all'] { - display: none; -} - .toggle-all { + width: 1px; + height: 1px; + border: none; /* Mobile Safari */ + opacity: 0; position: absolute; - top: -55px; - left: -12px; + right: 100%; + bottom: 100%; +} + +.toggle-all + label { width: 60px; height: 34px; - text-align: center; - border: none; /* Mobile Safari */ + font-size: 0; + position: absolute; + top: -52px; + left: -13px; + -webkit-transform: rotate(90deg); + transform: rotate(90deg); } -.toggle-all:before { +.toggle-all + label:before { content: '❯'; font-size: 22px; color: #e6e6e6; padding: 10px 27px 10px 27px; } -.toggle-all:checked:before { +.toggle-all:checked + label:before { color: #737373; } @@ -166,8 +166,8 @@ label[for='toggle-all'] { .todo-list li.editing .edit { display: block; - width: 506px; - padding: 13px 17px 12px 17px; + width: calc(100% - 43px); + padding: 12px 16px; margin: 0 0 0 43px; } @@ -186,30 +186,39 @@ label[for='toggle-all'] { margin: auto 0; border: none; /* Mobile Safari */ -webkit-appearance: none; - -moz-appearance: none; appearance: none; } -.todo-list li .toggle:after { - content: url('data:image/svg+xml;utf8,'); +.todo-list li .toggle { + opacity: 0; +} + +.todo-list li .toggle + label { + /* + Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433 + IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/ + */ + background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E'); + background-repeat: no-repeat; + background-position: center left; } -.todo-list li .toggle:checked:after { - content: url('data:image/svg+xml;utf8,'); +.todo-list li .toggle:checked + label { + background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E'); } .todo-list li label { - white-space: pre-line; word-break: break-all; - padding: 15px 60px 15px 15px; - margin-left: 45px; + padding: 15px 15px 15px 60px; display: block; line-height: 1.2; transition: color 0.4s; + font-weight: 400; + color: #4d4d4d; } .todo-list li.completed label { - color: #d9d9d9; + color: #cdcdcd; text-decoration: line-through; } @@ -249,10 +258,10 @@ label[for='toggle-all'] { } .footer { - color: #777; padding: 10px 15px; height: 20px; text-align: center; + font-size: 15px; border-top: 1px solid #e6e6e6; } @@ -302,7 +311,6 @@ label[for='toggle-all'] { border-radius: 3px; } -.filters li a.selected, .filters li a:hover { border-color: rgba(175, 47, 47, 0.1); } @@ -318,7 +326,6 @@ html .clear-completed:active { line-height: 20px; text-decoration: none; cursor: pointer; - position: relative; } .clear-completed:hover { @@ -327,8 +334,8 @@ html .clear-completed:active { .info { margin: 65px auto 0; - color: #bfbfbf; - font-size: 10px; + color: #4d4d4d; + font-size: 11px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-align: center; } @@ -360,14 +367,6 @@ html .clear-completed:active { .todo-list li .toggle { height: 40px; } - - .toggle-all { - -webkit-transform: rotate(90deg); - transform: rotate(90deg); - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - } } @media (max-width: 430px) { diff --git a/examples/04-ToDoMVC/dist/bundle.js b/examples/04-ToDoMVC/dist/bundle.js new file mode 100644 index 0000000..2db1bfb --- /dev/null +++ b/examples/04-ToDoMVC/dist/bundle.js @@ -0,0 +1,1220 @@ +!function (root, factory) { + if ('object' == typeof exports && 'object' == typeof module) { + module.exports = factory(); + } else if ('function' == typeof define && define.amd) { + define([], factory); + } else { + var a = factory(); + for (var i in a) { + ('object' == typeof exports ? exports : root)[i] = a[i]; + } + } +}(window, (function () { + return function (modules) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module = installedModules[moduleId] = { + i: moduleId, + l: !1, + exports: {} + }; + modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + module.l = !0; + return module.exports; + } + __webpack_require__.m = modules; + __webpack_require__.c = installedModules; + __webpack_require__.d = function (exports, name, getter) { + if (!__webpack_require__.o(exports, name)) { + Object.defineProperty(exports, name, { + enumerable: !0, + get: getter + }); + } + }; + __webpack_require__.r = function (exports) { + if ('undefined' != typeof Symbol && Symbol.toStringTag) { + Object.defineProperty(exports, Symbol.toStringTag, { + value: 'Module' + }); + } + Object.defineProperty(exports, '__esModule', { + value: !0 + }); + }; + __webpack_require__.t = function (value, mode) { + if (1 & mode) { + value = __webpack_require__(value); + } + if (8 & mode) { + return value; + } + if (4 & mode && 'object' == typeof value && value && value.__esModule) { + return value; + } + var ns = Object.create(null); + __webpack_require__.r(ns); + Object.defineProperty(ns, 'default', { + enumerable: !0, + value: value + }); + if (2 & mode && 'string' != typeof value) { + for (var key in value) { + __webpack_require__.d(ns, key, function (key) { + return value[key]; + }.bind(null, key)); + } + } + return ns; + }; + __webpack_require__.n = function (module) { + var getter = module && module.__esModule ? function () { + return module.default; + } : function () { + return module; + }; + __webpack_require__.d(getter, 'a', getter); + return getter; + }; + __webpack_require__.o = function (object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; + __webpack_require__.p = ''; + return __webpack_require__(__webpack_require__.s = 0); + }([function (module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + function _$extends(d, b) { + _$assign(d, b); + function _() { + this.constructor = d; + } + d.prototype = null === b ? Object.create(b) : (_.prototype = b.prototype, new _); + } + function _$(selector, parent) { + return _$isString(selector) ? (parent || document.body).querySelector(selector) : selector; + } + function _$type(obj) { + return _$lowerCase(Object.prototype.toString.call(obj).slice(8, -1)); + } + function _$isType(obj, objType) { + return _$isString(objType) ? _$type(obj) === objType : obj instanceof objType; + } + function _$isString(str) { + return 'string' === _$type(str); + } + function _$isArray(array) { + return 'array' === _$type(array) || array instanceof _$List; + } + function _$isObject(obj) { + return 'object' === _$type(obj); + } + function _$isFunction(obj) { + return 'function' === _$type(obj); + } + function _$toString(obj) { + if (_$isString(obj)) { + return obj; + } + var str = _$type(obj); + return /(^(null|undefined)$)/.test(str) ? str : obj.toString(); + } + function _$toType(value, type, component, key) { + switch (type) { + case 'date': + return new Date(value); + + case 'string': + return _$toString(value); + + case 'number': + return +value; + + case 'boolean': + return _$isString(value) && !value ? !0 : !!value; + + case 'array': + return _$isType(value, _$List) ? value : new _$List(value, component, key); + + default: + return value; + } + } + function _$slice(array, from) { + var args = []; + for (var i = from = from || 0; i < array.length; i++) { + args[i - from] = array[i]; + } + return args; + } + function _$hasProp(obj, prop) { + return obj.hasOwnProperty(prop); + } + function _$define(obj, mapDesc) { + Object.defineProperties(obj, mapDesc); + } + function _$each(obj, cb) { + if (_$isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + cb(obj[i], i); + } + } else if (_$isObject(obj)) { + var keys = Object.keys(obj); + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + cb(obj[key], key, i); + } + } + } + function _$lowerCase(str) { + return str.toLowerCase(); + } + function _$apply(callee, args, globs, thisArg) { + if (globs && !_$isArray(globs)) { + thisArg = globs; + globs = []; + } else if (void 0 === globs) { + globs = []; + } else if (void 0 === thisArg) { + thisArg = null; + } + return callee.apply(thisArg, args.concat(globs)); + } + function _$treborPlugins() { + var _a; + var TREBOR_PK = '__TREBOR_PLUGINS__'; + if (!window[TREBOR_PK]) { + _$define(window, ((_a = {})[TREBOR_PK] = { + value: [], + configurable: !0, + writable: !0, + enumerable: !1 + }, _a)); + } + return window[TREBOR_PK]; + } + function _$assign(child, parent) { + for (var property in parent) { + if (parent.hasOwnProperty(property)) { + child[property] = parent[property]; + } + } + return child; + } + function _$plainObject(obj) { + var data = {}; + _$each(_$isObject(obj) ? obj : {}, (function (value, k) { + if ('$' !== k[0] && !_$isFunction(value)) { + if (_$isType(value, _$List)) { + data[k] = value.map(_$plainObject); + } else if (_$isObject(value)) { + data[k] = _$plainObject(value); + } else { + data[k] = value; + } + } + })); + return _$isObject(obj) ? data : obj; + } + function _$accesor(component, path, value) { + return path.split('.').reduce((function (obj, key, i, arr) { + if (_$isType(value, 'undefined')) { + if (null == obj) { + arr.splice(0, arr.length); + return i > 0 && null === obj ? obj : void 0; + } + } else if (i === arr.length - 1) { + if (_$isType(obj, _$List) && _$toString(+key) === key) { + obj.pull(+key, value); + } else { + var oldVal = obj[key]; + obj[key] = Array.isArray(value) ? new _$List(value, component, key) : value; + _$dispatch(component, path, oldVal, obj[key]); + } + } else if (!_$isObject(obj[key])) { + obj[key] = {}; + } + return obj ? obj[key] : null; + }), component); + } + function _$dispatch(component, key, oldVal, value) { + component.$notify(key); + if (component._watchers[key]) { + _$each(component._watchers[key], (function (watcher) { + watcher(oldVal, value); + })); + } + component.$update(); + } + function _$subscribers(dep, handler) { + if (!this._subscribers[dep]) { + this._subscribers[dep] = []; + } + return this._subscribers[dep].push(handler.bind(this)) - 1; + } + var _$Component = function () { + function _$Component(attrs, compCtor, parent) { + var self = this; + if (!attrs) { + attrs = {}; + } + var propMap = { + $refs: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $slots: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $parent: { + value: parent || null, + enumerable: !1, + configurable: !0 + }, + $children: { + value: [], + enumerable: !1, + configurable: !0 + }, + $filters: { + value: {}, + enumerable: !1, + configurable: !0 + }, + $options: { + value: { + filters: compCtor.$filters || {}, + children: compCtor.$children || {}, + attributes: compCtor.$attributes || {} + }, + enumerable: !1, + configurable: !0 + } + }; + _$each(compCtor.$attributes || [], (function (attrOps, key) { + key = _$isType(key, 'number') ? attrOps : key; + propMap[key] = { + get: function () { + if (_$isString(attrOps)) { + return _$isFunction(value = attrs[attrOps]) ? value() : value; + } else if (!_$hasProp(attrs, key) && attrOps.required) { + return console.error('Attribute \'' + key + '\' is required.'); + } else { + var value; + if (void 0 === (value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key]) && _$hasProp(attrOps, 'default')) { + var def = attrOps.default; + value = _$isFunction(def) ? def() : def; + } + var typ = attrOps.type; + if (typ && !_$isType(value, typ) && attrOps.required) { + return console.error('Attribute \'' + key + '\' must be type \'' + typ + '\'.'); + } + if (void 0 !== (value = _$toType(value, void 0 === value ? 'undefined' : typ, self, key)) && _$hasProp(attrOps, 'validator')) { + var validator = attrOps.validator; + if (_$isFunction(validator) && !validator(value)) { + return console.error('Assigment \'' + key + '\'=\'' + JSON.stringify(value) + '\' invalid.'); + } + } + return value; + } + }, + set: function () { + console.error('\'' + key + '\' is read only.'); + }, + enumerable: !0, + configurable: !0 + }; + })); + var desc = { + enumerable: !1, + configurable: !1 + }; + propMap._events = _$assign({ + value: {} + }, desc); + propMap._watchers = _$assign({ + value: {} + }, desc); + propMap._subscribers = _$assign({ + value: {} + }, desc); + _$define(self, propMap); + _$assign(self.$filters, compCtor.$filters || {}); + } + var prototype = _$Component.prototype; + _$define(prototype, { + $data: { + get: function () { + return _$plainObject(this); + }, + enumerable: !0, + configurable: !0 + } + }); + prototype.$get = function (path) { + return _$accesor(this, path); + }; + prototype.$set = function (path, value) { + _$accesor(this, path, value); + }; + prototype.$on = function (event, handler) { + if (!this._events[event]) { + this._events[event] = []; + } + this._events[event].push(handler); + }; + prototype.$off = function (event, handler) { + var index = this._events[event].indexOf(handler); + ~index && this._events[event].splice(index, 1); + }; + prototype.$once = function (event, handler) { + var _this = this; + var _handler = function (args) { + handler(args); + _this.$off(event, _handler); + }; + this.$on(event, _handler); + }; + prototype.$fire = function (event, data) { + if (this._events[event]) { + _$each(this._events[event], (function (handler) { + handler(data); + })); + } + }; + prototype.$notify = function (key) { + if (this._subscribers[key]) { + _$each(this._subscribers[key], (function (suscriber) { + suscriber(); + })); + } + }; + prototype.$observe = function (keyOrKeys, handler) { + var _this = this; + var subs = []; + if (_$isArray(keyOrKeys)) { + _$each(keyOrKeys, (function (key) { + subs.push({ + subscrition: key, + index: _$subscribers.call(_this, key, handler) + }); + })); + } else { + subs.push({ + subscrition: keyOrKeys, + index: _$subscribers.call(this, keyOrKeys, handler) + }); + } + return { + $unobserve: function () { + _$each(subs, (function (_a) { + var subscrition = _a.subscrition, index = _a.index; + _this._subscribers[subscrition].splice(index, 1); + })); + } + }; + }; + prototype.$watch = function (key, handler) { + var _this = this; + if (!this._watchers[key]) { + this._watchers[key] = []; + } + var i = this._watchers[key].push(handler.bind(this)); + return { + $unwatch: function () { + _this._watchers[key].splice(i - 1, 1); + } + }; + }; + return _$Component; + }(); + var _$List = function (_super) { + _$extends(List, _super); + function List(value, component, key) { + _super.call(this, value.length); + var self = this; + _$define(self, { + _key: { + value: key, + enumerable: !1 + }, + _root: { + value: component, + enumerable: !1 + } + }); + _$apply(_super.prototype.push, value.map((function (val, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(val, List) && _$isArray(val) ? new List(val, component, key + '.' + i) : val; + })), [], self); + } + List.prototype.pull = function (index) { + var self = this; + var args = _$slice(arguments, 1); + var length = self.length; + if (index > length) { + length = index + 1; + var pull = new Array(index - self.length); + _$apply(pull.push, args, [], pull); + for (var i = 0; i < length; i++) { + if (i === index) { + _$apply(self.push, pull, [], self); + } + } + } else { + _$apply(self.splice, [index, 1].concat(args), [], self); + } + }; + ['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach((function (method) { + List.prototype[method] = function () { + var self = this; + var args = _$slice(arguments); + var old = self.slice(); + var result = void 0; + if ('push' === method) { + _$apply([].push, args.map((function (v, i) { + if (0 !== self.length) { + i += self.length; + } + return !_$isType(v, List) && _$isArray(v) ? new List(v, self._root, self._key + '.' + i) : v; + })), [], self); + result = self.length; + } else { + result = _$apply(Array.prototype[method], args, [], self); + } + _$dispatch(self._root, self._key, old, self.slice()); + return result; + }; + })); + return List; + }(Array); + function _$createComponent($ComponentClass, templateFn) { + function $ComponentCtor(attrs, parent) { + var self = this; + _$apply(_$Component, [attrs, $ComponentCtor, parent], [], self); + $ComponentClass.call(self); + var descriptors = {}; + _$each(self, (function (_, key) { + if (_$hasProp(self, key)) { + var descriptor = Object.getOwnPropertyDescriptor(self, key); + if (descriptor.value && _$isArray(descriptor.value)) { + descriptor.value = new _$List(descriptor.value, self, key); + } else { + if (descriptor.get) { + var getter_1_1 = descriptor.get; + descriptor.get = function () { + var value = getter_1_1.call(this); + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + return value; + }; + } + if (descriptor.set) { + var setter_1_1 = descriptor.set; + descriptor.set = function (value) { + if (_$isArray(value)) { + value = new _$List(value, this, key); + } + setter_1_1.call(this, value); + }; + } + } + descriptors[key] = descriptor; + } + })); + _$define(self, descriptors); + var tpl = templateFn(self); + var tplDesc = {}; + _$each(tpl, (function (value, key) { + tplDesc[key] = function (key, value) { + var hook = key[1].toUpperCase() + _$slice(key, 2); + return { + enumerable: !1, + configurable: !1, + writable: !1, + value: function () { + var args = _$slice(arguments); + var ahook = this['did' + hook]; + var bhook = this['will' + hook]; + bhook && bhook.call(this); + _$apply(value, '$update' === key ? [this, _$slice(args, 1)] : args, this); + ahook && ahook.call(this); + } + }; + }(key, value); + })); + _$define(self, tplDesc); + _$each(_$treborPlugins(), (function (_a) { + var plugin = _a.plugin, options = _a.options; + plugin.call(self, $ComponentCtor, options); + })); + !parent && this.$create(); + } + var proto = [$ComponentClass.prototype, _$Component.prototype].reduceRight((function (superProto, proto) { + var inheritedProto = Object.create(superProto); + for (var key in proto) { + if (proto.hasOwnProperty(key)) { + var desc = Object.getOwnPropertyDescriptor(proto, key); + Object.defineProperty(inheritedProto, key, desc); + } + } + _$assign($ComponentCtor, proto.constructor); + inheritedProto.constructor = proto.constructor; + return inheritedProto; + }), Object.prototype); + $ComponentCtor.prototype = Object.create(proto); + $ComponentCtor.prototype.constructor = $ComponentCtor; + $ComponentCtor.$plugin = function (plugin, options) { + _$treborPlugins().push({ + options: options, + plugin: plugin + }); + }; + return $ComponentCtor; + } + function _$fragTpl() { + var htmlParts = []; + for (var _i = 0; _i < arguments.length; _i++) { + htmlParts[_i] = arguments[_i]; + } + var template = document.createElement('template'); + template.innerHTML = htmlParts.join('\x3c!----\x3e'); + var fragment = template.content; + var nodes = _$slice(fragment.childNodes); + nodes.unshift(fragment); + return nodes; + } + function _$prepareFragment(frag, els) { + if (!frag.hasChildNodes()) { + _$each(els, (function (el) { + return frag.append(el); + })); + } + } + function _$updateTxt(txt, newData) { + if (txt.data !== newData) { + txt.data = newData; + } + } + function _$child(el, index) { + if (void 0 === index) { + index = 0; + } + var node = el.childNodes[index]; + if (3 === node.nodeType) { + node.data = ''; + } + return node; + } + function _$append(parent, child, sibling) { + if (!0 === sibling) { + parent.parentElement.replaceChild(child, parent); + } else if (!sibling) { + parent.appendChild(child); + } else { + parent.insertBefore(child, sibling); + } + } + function _$attr(el, attribute, value) { + if (void 0 === attribute) { + attribute = 'value'; + } + var isValueAttr = 'value' === attribute; + var _value = isValueAttr ? '_' + attribute : null; + if (void 0 === value) { + if (isValueAttr) { + return _$hasProp(el, _value) ? el[_value] : el[attribute]; + } else { + return el.getAttribute(attribute); + } + } else { + el.setAttribute(attribute, _$toString(value)); + } + } + function _$eventKeys(event) { + var keys = _$slice(arguments, 1); + var i = 0; + for (; i < keys.length;) { + var key = keys[i]; + if (_$lowerCase(event.key) !== key && !event[key + 'Key']) { + return !1; + } + i++; + } + return !0; + } + function _$addEvent(node, event, listener) { + if (0 === _$type(node).indexOf('html')) { + node.addEventListener(event, listener, !1); + } else { + node.$on(event, listener); + } + } + function _$removeEvent(node, event, listener) { + if (0 === _$type(node).indexOf('html')) { + node.removeEventListener(event, listener, !1); + } else { + node.$off(event, listener); + } + } + function _$setElements(component, parent, sibling) { + var brother = _$(sibling); + if (brother && 'boolean' !== _$type(brother)) { + component.$siblingEl = brother; + component.$parentEl = brother.parentElement; + } else { + component.$parentEl = _$(parent); + } + } + function _$destroyComponent(component) { + component.$unmount(); + component.$parent = null; + component.$parentEl = null; + component.$siblingEl = null; + component.$children.splice(0); + } + function _$bindClass(classes, classValue) { + function parseClasses(classes, classValue) { + var classList = classes.split(' '); + if (_$isString(classValue)) { + classList = classList.concat(classValue.split(' ')); + } else if (_$isArray(classValue)) { + classValue.forEach((function (c) { + classList = classList.concat(parseClasses('', c)); + })); + } else if (_$isObject(classValue)) { + _$each(classValue, (function (value, prop) { + value && classList.push(prop); + })); + } + return classList.filter((function (c, i) { + return classList.indexOf(c) === i; + })); + } + return parseClasses(classes, classValue).join(' '); + } + function _$bindBooleanAttr(node, attr, value) { + if (null == value || !1 === value) { + node.removeAttribute(attr); + node[attr] = !1; + } else { + _$attr(node, attr, ''); + node[attr] = !0; + } + } + function _$bindUpdate(node, attr, value) { + if (void 0 === value) { + value = attr; + attr = 'value'; + } + var _value = _$toString(value); + if ('value' === attr) { + if (node[attr] !== _value) { + node[attr] = _value; + node['_' + attr] = value; + } + } else if (_$attr(node, attr) !== _value) { + _$attr(node, attr, _value); + } + } + function _$filters(component, value) { + _$each(_$slice(arguments, 2), (function (args) { + var filter = args.splice(0, 1, value)[0]; + value = _$apply(component.$filters[filter], args, component); + })); + return value; + } + function _$context(ctx, cb) { + var args = _$slice(arguments, 2).map((function (prop) { + var value = prop in ctx ? ctx[prop] : window[prop]; + return _$isFunction(value) ? value.bind(ctx) : value; + })); + return args.length ? cb(args) : cb(); + } + function _$insertStyle(id, css) { + var isNew = !1; + var style = _$('#' + id, document.head); + if (!style) { + isNew = !0; + (style = document.createElement('style')).id = id; + _$attr(style, 'refs', 1); + } + if (style.textContent !== css) { + style.textContent = css; + } + if (isNew) { + _$append(document.head, style); + } else { + var count = +_$attr(style, 'refs'); + _$attr(style, 'refs', ++count); + } + } + function _$removeStyle(id) { + var style = _$('#' + id, document.head); + if (style) { + var count = +_$attr(style, 'refs'); + if (0 == --count) { + document.head.removeChild(style); + } else { + _$attr(style, 'refs', count); + } + } + } + var main_a; + function _$showValue(node, value) { + var style = node.style; + if (style.display !== value) { + style.display = _$toString(value); + } + return style.display; + } + function _$forLoop(ctx, list, loop) { + var items = {}; + var globs = _$slice(arguments, 3); + var loopParent, loopSibling; + _$each(list, (function (item, key, index) { + items[key] = _$apply(loop, [ctx, item, key, index], globs); + })); + return { + $create: function () { + _$each(items, (function (item) { + item.$create(); + })); + }, + $mount: function (parent, sibling) { + loopParent = _$(parent); + loopSibling = _$(sibling); + _$each(items, (function (item) { + item.$mount(loopParent, loopSibling); + })); + }, + $update: function (ctx, obj) { + var globs = _$slice(arguments, 2); + _$each(items, (function (item, key, index) { + if (obj[key]) { + _$apply(item.$update, [ctx, obj[key], key, index], globs, item); + } else { + item.$destroy(); + delete items[key]; + } + })); + _$each(obj, (function (item, key, index) { + if (!items[key]) { + items[key] = _$apply(loop, [ctx, item, key, index], globs); + items[key].$create(); + items[key].$mount(loopParent, loopSibling); + } + })); + }, + $destroy: function () { + _$each(items, (function (item) { + item.$destroy(); + })); + } + }; + } + function _$loop_1(_$ctx, todo, i) { + var _a; + var _$tpl, _$elements, _$li_1, _$bindClassLi_1, _$div_1, _$input_1, _$bindCheckedInput_1, _$changeEvent_1, _$listenerChangeEvent_1, _$label_1, _$dblclickEvent_1, _$listenerDblclickEvent_1, _$txt_1, _$setTxt_1, _$button_1, _$clickEvent_1, _$listenerClickEvent_1, _$input_2, _$setFocusInput_2, _$inputEvent_1, _$listenerInputEvent_1, _$bindValueInput_2, _$blurEvent_1, _$listenerBlurEvent_1, _$keyupEvent_1, _$listenerKeyupEvent_1; + _$bindClassLi_1 = function (_$ctx, todo) { + return _$bindClass('scope_4827b611 todo', _$context(_$ctx, (function (_a) { + var editedTodo = _a[0]; + return { + completed: todo.completed, + editing: todo === editedTodo + }; + }), 'editedTodo')); + }; + _$bindCheckedInput_1 = function (_$ctx, todo) { + return todo.completed; + }; + _$changeEvent_1 = function (_$ctx, todo, i, $event, $el) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])(i, $el.checked); + }), 'mark'); + }; + _$dblclickEvent_1 = function (_$ctx, todo, i) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])(todo, i); + }), 'editTodo'); + }; + _$setTxt_1 = function (_$ctx, todo) { + return '' + todo.title; + }; + _$clickEvent_1 = function (_$ctx, todo) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])(todo); + }), 'removeTodo'); + }; + _$setFocusInput_2 = function (_$ctx) { + _$context(_$ctx, (function (_a) { + var editedTodo = _a[0]; + return todo === editedTodo; + }), 'editedTodo') && _$input_2.focus(); + }; + _$inputEvent_1 = function (_$ctx, todo, i, $event, $el) { + todo.title = $el.value; + }; + _$bindValueInput_2 = function (_$ctx, todo) { + return todo.title; + }; + _$blurEvent_1 = function (_$ctx) { + _$ctx.$set('editedTodo', null); + }; + _$keyupEvent_1 = function (_$ctx, todo, i, $event) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])(todo, $event); + }), 'doneEdit'); + }; + _a = _$fragTpl('
  • '), + _$tpl = _a[0], _$elements = _a.slice(1); + return { + $create: function () { + _$li_1 = _$child(_$tpl); + _$div_1 = _$child(_$li_1); + _$addEvent(_$input_1 = _$child(_$div_1), 'change', _$listenerChangeEvent_1 = function ($event) { + _$changeEvent_1(_$ctx, todo, i, $event, _$input_1); + }); + _$addEvent(_$label_1 = _$child(_$div_1, 1), 'dblclick', _$listenerDblclickEvent_1 = function ($event) { + _$dblclickEvent_1(_$ctx, todo, i, $event, _$label_1); + }); + _$txt_1 = _$child(_$label_1); + _$addEvent(_$button_1 = _$child(_$div_1, 2), 'click', _$listenerClickEvent_1 = function ($event) { + _$clickEvent_1(_$ctx, todo, i, $event, _$button_1); + }); + _$addEvent(_$input_2 = _$child(_$li_1, 1), 'input', _$listenerInputEvent_1 = function ($event) { + _$inputEvent_1(_$ctx, todo, i, $event, _$input_2); + }); + _$addEvent(_$input_2, 'blur', _$listenerBlurEvent_1 = function ($event) { + _$blurEvent_1(_$ctx, todo, i, $event, _$input_2); + }); + _$addEvent(_$input_2, 'keyup', _$listenerKeyupEvent_1 = function ($event) { + _$keyupEvent_1(_$ctx, todo, i, $event, _$input_2); + }); + }, + $mount: function (parent, sibling) { + this.$unmount(); + _$append(_$(parent), _$tpl, _$(sibling)); + }, + $update: function (_$ctx, todo, i) { + _$bindUpdate(_$li_1, 'class', _$bindClassLi_1(_$ctx, todo, i)); + _$bindBooleanAttr(_$input_1, 'checked', _$bindCheckedInput_1(_$ctx, todo, i)); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx, todo, i)); + _$setFocusInput_2(_$ctx); + _$bindUpdate(_$input_2, _$bindValueInput_2(_$ctx, todo, i)); + }, + $unmount: function () { + _$prepareFragment(_$tpl, _$elements); + _$bindUpdate(_$li_1, 'class', _$bindClassLi_1(_$ctx, todo, i)); + _$bindBooleanAttr(_$input_1, 'checked', _$bindCheckedInput_1(_$ctx, todo, i)); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx, todo, i)); + _$setFocusInput_2(_$ctx); + _$bindUpdate(_$input_2, _$bindValueInput_2(_$ctx, todo, i)); + }, + $destroy: function () { + this.$unmount(); + _$removeEvent(_$input_1, 'change', _$listenerChangeEvent_1); + _$removeEvent(_$label_1, 'dblclick', _$listenerDblclickEvent_1); + _$removeEvent(_$button_1, 'click', _$listenerClickEvent_1); + _$removeEvent(_$input_2, 'input', _$listenerInputEvent_1); + _$removeEvent(_$input_2, 'blur', _$listenerBlurEvent_1); + _$removeEvent(_$input_2, 'keyup', _$listenerKeyupEvent_1); + _$tpl = _$elements = _$li_1 = _$bindClassLi_1 = _$div_1 = _$input_1 = _$bindCheckedInput_1 = _$changeEvent_1 = _$listenerChangeEvent_1 = _$label_1 = _$dblclickEvent_1 = _$listenerDblclickEvent_1 = _$txt_1 = _$setTxt_1 = _$button_1 = _$clickEvent_1 = _$listenerClickEvent_1 = _$input_2 = _$setFocusInput_2 = _$inputEvent_1 = _$listenerInputEvent_1 = _$bindValueInput_2 = _$blurEvent_1 = _$listenerBlurEvent_1 = _$keyupEvent_1 = _$listenerKeyupEvent_1 = void 0; + } + }; + } + function _$tplMain(_$ctx) { + var _a; + var _$tpl, _$elements, _$section_1, _$header_1, _$input_1, _$inputEvent_1, _$listenerInputEvent_1, _$bindValueInput_1, _$keyupEvent_1, _$listenerKeyupEvent_1, _$section_2, _$displaySection_2, _$input_2, _$bindCheckedInput_2, _$changeEvent_1, _$listenerChangeEvent_1, _$ul_1, _$loopAnchor_1, _$loopBlock_1, _$footer_1, _$displayFooter_1, _$span_1, _$txt_1, _$setTxt_1, _$ul_2, _$li_1, _$a_1, _$bindClassA_1, _$clickEvent_1, _$listenerClickEvent_1, _$li_2, _$a_2, _$bindClassA_2, _$clickEvent_2, _$listenerClickEvent_2, _$li_3, _$a_3, _$bindClassA_3, _$clickEvent_3, _$listenerClickEvent_3, _$button_1, _$displayButton_1, _$clickEvent_4, _$listenerClickEvent_4; + _$inputEvent_1 = function (_$ctx, $event, $el) { + _$ctx.$set('newTodo', $el.value); + }; + _$bindValueInput_1 = function (_$ctx) { + return _$context(_$ctx, (function (_a) { + return _a[0]; + }), 'newTodo'); + }; + _$keyupEvent_1 = function (_$ctx) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])(); + }), 'addTodo'); + }; + var _$showSection_2 = function (_$ctx, $el, $display) { + _$showValue($el, _$context(_$ctx, (function (_a) { + return _a[0].length; + }), 'todos') ? $display : 'none'); + }; + _$bindCheckedInput_2 = function (_$ctx) { + return _$context(_$ctx, (function (_a) { + return _a[0]; + }), 'allDone'); + }; + _$changeEvent_1 = function (_$ctx, $event, $el) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])($el.checked); + }), 'markAll'); + }; + _$loopBlock_1 = _$forLoop(_$ctx, _$context(_$ctx, (function (_a) { + var todos = _a[0], view = _a[1]; + return _$filters(_$ctx, todos, ['filterByView', view]); + }), 'todos', 'view'), _$loop_1); + var _$showFooter_1 = function (_$ctx, $el, $display) { + _$showValue($el, _$context(_$ctx, (function (_a) { + return _a[0].length; + }), 'todos') ? $display : 'none'); + }; + _$setTxt_1 = function (_$ctx) { + return _$context(_$ctx, (function (_a) { + var remaining = _a[0]; + return remaining + ' ' + _$filters(_$ctx, 'item', ['pluralize', remaining]) + ' left'; + }), 'remaining'); + }; + _$bindClassA_1 = function (_$ctx) { + return _$bindClass('scope_4827b611', _$context(_$ctx, (function (_a) { + return { + selected: '' === _a[0] + }; + }), 'view')); + }; + _$clickEvent_1 = function (_$ctx) { + _$ctx.$set('view', ''); + }; + _$bindClassA_2 = function (_$ctx) { + return _$bindClass('scope_4827b611', _$context(_$ctx, (function (_a) { + return { + selected: 'active' === _a[0] + }; + }), 'view')); + }; + _$clickEvent_2 = function (_$ctx) { + _$ctx.$set('view', 'active'); + }; + _$bindClassA_3 = function (_$ctx) { + return _$bindClass('scope_4827b611', _$context(_$ctx, (function (_a) { + return { + selected: 'completed' === _a[0] + }; + }), 'view')); + }; + _$clickEvent_3 = function (_$ctx) { + _$ctx.$set('view', 'completed'); + }; + var _$showButton_1 = function (_$ctx, $el, $display) { + _$showValue($el, _$context(_$ctx, (function (_a) { + var todos = _a[0], remaining = _a[1]; + return todos.length > remaining; + }), 'todos', 'remaining') ? $display : 'none'); + }; + _$clickEvent_4 = function (_$ctx) { + _$context(_$ctx, (function (_a) { + return (0, _a[0])(); + }), 'removeCompleted'); + }; + _a = _$fragTpl('

    todos

      ', '
    '), + _$tpl = _a[0], _$elements = _a.slice(1); + return { + $create: function () { + _$section_1 = _$child(_$tpl); + _$header_1 = _$child(_$section_1); + _$addEvent(_$input_1 = _$child(_$header_1, 1), 'input', _$listenerInputEvent_1 = function ($event) { + _$inputEvent_1(_$ctx, $event, _$input_1); + }); + _$addEvent(_$input_1, 'keyup', _$listenerKeyupEvent_1 = function ($event) { + if (_$eventKeys($event, 'enter')) { + _$keyupEvent_1(_$ctx, $event, _$input_1); + } + }); + _$section_2 = _$child(_$section_1, 1); + _$addEvent(_$input_2 = _$child(_$section_2), 'change', _$listenerChangeEvent_1 = function ($event) { + _$changeEvent_1(_$ctx, $event, _$input_2); + }); + _$ul_1 = _$child(_$section_2, 2); + _$loopAnchor_1 = _$child(_$ul_1); + _$loopBlock_1.$create(); + _$footer_1 = _$child(_$section_1, 2); + _$span_1 = _$child(_$footer_1); + _$txt_1 = _$child(_$span_1); + _$ul_2 = _$child(_$footer_1, 1); + _$li_1 = _$child(_$ul_2); + _$addEvent(_$a_1 = _$child(_$li_1), 'click', _$listenerClickEvent_1 = function ($event) { + _$clickEvent_1(_$ctx, $event, _$a_1); + }); + _$li_2 = _$child(_$ul_2, 1); + _$addEvent(_$a_2 = _$child(_$li_2), 'click', _$listenerClickEvent_2 = function ($event) { + _$clickEvent_2(_$ctx, $event, _$a_2); + }); + _$li_3 = _$child(_$ul_2, 2); + _$addEvent(_$a_3 = _$child(_$li_3), 'click', _$listenerClickEvent_3 = function ($event) { + _$clickEvent_3(_$ctx, $event, _$a_3); + }); + _$addEvent(_$button_1 = _$child(_$footer_1, 2), 'click', _$listenerClickEvent_4 = function ($event) { + _$clickEvent_4(_$ctx, $event, _$button_1); + }); + }, + $mount: function (parent, sibling) { + this.$unmount(); + _$insertStyle('scope_4827b611', '.scope_4827b611.view label.scope_4827b611 {\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n}\n'); + _$append(_$(parent), _$tpl, _$(sibling)); + _$setElements(this, parent, sibling); + }, + $update: function (_$ctx) { + _$bindUpdate(_$input_1, _$bindValueInput_1(_$ctx)); + _$showSection_2(_$ctx, _$section_2, _$displaySection_2); + _$bindBooleanAttr(_$input_2, 'checked', _$bindCheckedInput_2(_$ctx)); + _$loopBlock_1.$update(_$ctx, _$context(_$ctx, (function (_a) { + var todos = _a[0], view = _a[1]; + return _$filters(_$ctx, todos, ['filterByView', view]); + }), 'todos', 'view')); + _$showFooter_1(_$ctx, _$footer_1, _$displayFooter_1); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + _$bindUpdate(_$a_1, 'class', _$bindClassA_1(_$ctx)); + _$bindUpdate(_$a_2, 'class', _$bindClassA_2(_$ctx)); + _$bindUpdate(_$a_3, 'class', _$bindClassA_3(_$ctx)); + _$showButton_1(_$ctx, _$button_1, _$displayButton_1); + }, + $unmount: function () { + _$prepareFragment(_$tpl, _$elements); + _$bindUpdate(_$input_1, _$bindValueInput_1(_$ctx)); + _$displaySection_2 = _$showValue(_$section_2); + _$showSection_2(_$ctx, _$section_2, _$displaySection_2); + _$bindBooleanAttr(_$input_2, 'checked', _$bindCheckedInput_2(_$ctx)); + _$loopBlock_1.$mount(_$ul_1, _$loopAnchor_1); + _$displayFooter_1 = _$showValue(_$footer_1); + _$showFooter_1(_$ctx, _$footer_1, _$displayFooter_1); + _$updateTxt(_$txt_1, _$setTxt_1(_$ctx)); + _$bindUpdate(_$a_1, 'class', _$bindClassA_1(_$ctx)); + _$bindUpdate(_$a_2, 'class', _$bindClassA_2(_$ctx)); + _$bindUpdate(_$a_3, 'class', _$bindClassA_3(_$ctx)); + _$displayButton_1 = _$showValue(_$button_1); + _$showButton_1(_$ctx, _$button_1, _$displayButton_1); + }, + $destroy: function () { + _$destroyComponent(this); + _$removeStyle('scope_4827b611'); + _$removeEvent(_$input_1, 'input', _$listenerInputEvent_1); + _$removeEvent(_$input_1, 'keyup', _$listenerKeyupEvent_1); + _$removeEvent(_$input_2, 'change', _$listenerChangeEvent_1); + _$loopBlock_1.$destroy(); + _$removeEvent(_$a_1, 'click', _$listenerClickEvent_1); + _$removeEvent(_$a_2, 'click', _$listenerClickEvent_2); + _$removeEvent(_$a_3, 'click', _$listenerClickEvent_3); + _$removeEvent(_$button_1, 'click', _$listenerClickEvent_4); + _$tpl = _$elements = _$section_1 = _$header_1 = _$input_1 = _$inputEvent_1 = _$listenerInputEvent_1 = _$bindValueInput_1 = _$keyupEvent_1 = _$listenerKeyupEvent_1 = _$section_2 = _$displaySection_2 = _$input_2 = _$bindCheckedInput_2 = _$changeEvent_1 = _$listenerChangeEvent_1 = _$ul_1 = _$loopAnchor_1 = _$loopBlock_1 = _$footer_1 = _$displayFooter_1 = _$span_1 = _$txt_1 = _$setTxt_1 = _$ul_2 = _$li_1 = _$a_1 = _$bindClassA_1 = _$clickEvent_1 = _$listenerClickEvent_1 = _$li_2 = _$a_2 = _$bindClassA_2 = _$clickEvent_2 = _$listenerClickEvent_2 = _$li_3 = _$a_3 = _$bindClassA_3 = _$clickEvent_3 = _$listenerClickEvent_3 = _$button_1 = _$displayButton_1 = _$clickEvent_4 = _$listenerClickEvent_4 = void 0; + } + }; + } + (new (_$createComponent(((main_a = function () { + function class_1() { + this.todos = []; + this.newTodo = ''; + this.oldTitle = ''; + this._allDone = !1; + this.editedTodo = null; + } + Object.defineProperty(class_1.prototype, 'allDone', { + get: function () { + return this._allDone || 0 === this.remaining; + }, + set: function (value) { + this._allDone = value; + }, + enumerable: !0, + configurable: !0 + }); + Object.defineProperty(class_1.prototype, 'remaining', { + get: function () { + return this.$filters.actives(this.todos).length; + }, + enumerable: !0, + configurable: !0 + }); + class_1.prototype.addTodo = function () { + var title = this.newTodo && this.newTodo.trim(); + if (!title) { + return; + } + this.newTodo = ''; + this.todos.push({ + title: title, + completed: !1 + }); + this.$set('allDone', 0 === this.remaining); + }; + class_1.prototype.editTodo = function (todo) { + this.editedTodo = todo; + this.oldTitle = todo.title; + this.$update(); + }; + class_1.prototype.doneEdit = function (todo, e) { + if ('Enter' === e.key) { + todo.title = todo.title.trim(); + if (!todo.title) { + this.removeTodo(todo); + } + this.clearTmps(); + } else if ('Escape' === e.key) { + todo.title = this.oldTitle; + this.clearTmps(); + } + }; + class_1.prototype.removeTodo = function (todo) { + var index = this.todos.indexOf(todo); + this.todos.splice(index, 1); + this.$set('allDone', 0 === this.remaining); + }; + class_1.prototype.mark = function (item, value) { + this.$filters.filterByView(this.todos, this.view)[item].completed = value; + this.allDone = 0 === this.remaining; + this.$update(); + }; + class_1.prototype.markAll = function (value) { + this.todos.forEach((function (todo) { + todo.completed = value; + })); + this.$set('allDone', value); + }; + class_1.prototype.removeCompleted = function () { + this.$set('todos', this.$filters.actives(this.todos)); + }; + class_1.prototype.clearTmps = function () { + this.editedTodo = null; + this.oldTitle = ''; + this.$update(); + }; + return class_1; + }()).$filters = { + actives: function (todos) { + return todos.filter((function (todo) { + return !todo.completed; + })); + }, + filterByView: function (todos, view) { + switch (view) { + case 'active': + return todos.filter((function (todo) { + return !todo.completed; + })); + + case 'completed': + return todos.filter((function (todo) { + return todo.completed; + })); + + default: + return todos; + } + }, + pluralize: function (word, count) { + return word + (1 !== count ? 's' : ''); + } + }, main_a), _$tplMain))).$mount('main'); + }]); +})); \ No newline at end of file diff --git a/examples/todomvc/src/index.html b/examples/04-ToDoMVC/index.html similarity index 73% rename from examples/todomvc/src/index.html rename to examples/04-ToDoMVC/index.html index ed8c0ef..fec25ec 100644 --- a/examples/todomvc/src/index.html +++ b/examples/04-ToDoMVC/index.html @@ -1,21 +1,20 @@ - - TreborJS • TodoMVC - + Trebor.js • TodoMVC + -
    + + + - - + \ No newline at end of file diff --git a/examples/04-ToDoMVC/src/focusEdit.js b/examples/04-ToDoMVC/src/focusEdit.js new file mode 100644 index 0000000..b1ef6e3 --- /dev/null +++ b/examples/04-ToDoMVC/src/focusEdit.js @@ -0,0 +1,16 @@ +module.exports = { + priority: 10, + attr: 'focus-edit', + action(node, expression, segmts) { + if (node.tagName === 'input') { + const { varName } = node; + const exp = this.ctx(expression, segmts.globals); + const setFocusVar = `_$setFocus${varName[2].toUpperCase() + varName.slice(3)}`; + const setFocusCall = `${setFocusVar}(_$ctx);`; + segmts.init.push(setFocusVar); + segmts.extras.add(`${setFocusVar} = _$ctx => {${exp} && ${varName}.focus();};`); + segmts.update.add(setFocusCall); + segmts.unmount.add(setFocusCall); + } + } +}; \ No newline at end of file diff --git a/examples/04-ToDoMVC/src/todo.html b/examples/04-ToDoMVC/src/todo.html new file mode 100644 index 0000000..3bdd6a5 --- /dev/null +++ b/examples/04-ToDoMVC/src/todo.html @@ -0,0 +1,141 @@ + + +
    +
    +

    todos

    + +
    +
    + + +
      +
    • +
      + + + +
      + +
    • +
    +
    +
    + { remaining } { 'item' | pluralize(remaining) } left + + +
    +
    + + \ No newline at end of file diff --git a/examples/04-ToDoMVC/src/todo.js b/examples/04-ToDoMVC/src/todo.js new file mode 100644 index 0000000..eed04fb --- /dev/null +++ b/examples/04-ToDoMVC/src/todo.js @@ -0,0 +1,5 @@ +import Todo from './todo.html'; + +const todo = new Todo(); + +todo.$mount('main'); diff --git a/examples/04-ToDoMVC/webpack.config.js b/examples/04-ToDoMVC/webpack.config.js new file mode 100644 index 0000000..29e98b2 --- /dev/null +++ b/examples/04-ToDoMVC/webpack.config.js @@ -0,0 +1,57 @@ +const path = require('path'); +const webpack = require('webpack'); +const focusEdit = require('./src/focusEdit'); +const TerserPlugin = require('terser-webpack-plugin'); + +const config = { + mode: 'production', + context: __dirname, + entry: './src/todo', + output: { + filename: 'bundle.js', + libraryTarget: 'umd', + path: path.resolve(__dirname, 'dist') + }, + module: { + rules: [{ + test: /\.html$/, + use: { + loader: path.resolve(__dirname, '../../loader.js'), + options: { + directives: [focusEdit] + } + } + }] + }, + resolve: { + alias: { + 'trebor/tools': path.resolve(__dirname, '../../tools/index.js'), + }, + }, + plugins: [ + new webpack.optimize.ModuleConcatenationPlugin() + ], + optimization: { + usedExports: true, + minimize: true, + minimizer: [ + new TerserPlugin({ + terserOptions: { + mangle: false, + module: true, + toplevel: true, + parse: { ecma: 9 }, + output: { + quote_style: 1, indent_level: 2, beautify: true, braces: true + }, + compress: { + passes: 2, keep_fargs: false, inline: false, if_return: false, sequences: false, + reduce_vars: false, reduce_funcs: false, conditionals: false, join_vars: false + } + } + }) + ] + } +}; + +module.exports = config; diff --git a/examples/animation/dist/index.html b/examples/animation/dist/index.html deleted file mode 100644 index 0d24834..0000000 --- a/examples/animation/dist/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - TreborJS • Animation - - - -
    - - - diff --git a/examples/animation/dist/js/animation.js b/examples/animation/dist/js/animation.js deleted file mode 100644 index 649bd71..0000000 --- a/examples/animation/dist/js/animation.js +++ /dev/null @@ -1,115 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./main.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../../../../trebor-transitions/node_modules/hash-sum/hash-sum.js": -/*!****************************************************************************!*\ - !*** h:/trebor-repos/trebor-transitions/node_modules/hash-sum/hash-sum.js ***! - \****************************************************************************/ -/*! no static exports found */ -/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nfunction pad (hash, len) {\n while (hash.length < len) {\n hash = '0' + hash;\n }\n return hash;\n}\n\nfunction fold (hash, text) {\n var i;\n var chr;\n var len;\n if (text.length === 0) {\n return hash;\n }\n for (i = 0, len = text.length; i < len; i++) {\n chr = text.charCodeAt(i);\n hash = ((hash << 5) - hash) + chr;\n hash |= 0;\n }\n return hash < 0 ? hash * -2 : hash;\n}\n\nfunction foldObject (hash, o, seen) {\n return Object.keys(o).sort().reduce(foldKey, hash);\n function foldKey (hash, key) {\n return foldValue(hash, o[key], key, seen);\n }\n}\n\nfunction foldValue (input, value, key, seen) {\n var hash = fold(fold(fold(input, key), toString(value)), typeof value);\n if (value === null) {\n return fold(hash, 'null');\n }\n if (value === undefined) {\n return fold(hash, 'undefined');\n }\n if (typeof value === 'object') {\n if (seen.indexOf(value) !== -1) {\n return fold(hash, '[Circular]' + key);\n }\n seen.push(value);\n return foldObject(hash, value, seen);\n }\n return fold(hash, value.toString());\n}\n\nfunction toString (o) {\n return Object.prototype.toString.call(o);\n}\n\nfunction sum (o) {\n return pad(foldValue(0, o, '', []).toString(16), 8);\n}\n\nmodule.exports = sum;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vaDovdHJlYm9yLXJlcG9zL3RyZWJvci10cmFuc2l0aW9ucy9ub2RlX21vZHVsZXMvaGFzaC1zdW0vaGFzaC1zdW0uanM/M2Y5YyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYTs7QUFFYjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnQ0FBZ0MsU0FBUztBQUN6QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQSIsImZpbGUiOiIuLi8uLi8uLi8uLi90cmVib3ItdHJhbnNpdGlvbnMvbm9kZV9tb2R1bGVzL2hhc2gtc3VtL2hhc2gtc3VtLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5mdW5jdGlvbiBwYWQgKGhhc2gsIGxlbikge1xuICB3aGlsZSAoaGFzaC5sZW5ndGggPCBsZW4pIHtcbiAgICBoYXNoID0gJzAnICsgaGFzaDtcbiAgfVxuICByZXR1cm4gaGFzaDtcbn1cblxuZnVuY3Rpb24gZm9sZCAoaGFzaCwgdGV4dCkge1xuICB2YXIgaTtcbiAgdmFyIGNocjtcbiAgdmFyIGxlbjtcbiAgaWYgKHRleHQubGVuZ3RoID09PSAwKSB7XG4gICAgcmV0dXJuIGhhc2g7XG4gIH1cbiAgZm9yIChpID0gMCwgbGVuID0gdGV4dC5sZW5ndGg7IGkgPCBsZW47IGkrKykge1xuICAgIGNociA9IHRleHQuY2hhckNvZGVBdChpKTtcbiAgICBoYXNoID0gKChoYXNoIDw8IDUpIC0gaGFzaCkgKyBjaHI7XG4gICAgaGFzaCB8PSAwO1xuICB9XG4gIHJldHVybiBoYXNoIDwgMCA/IGhhc2ggKiAtMiA6IGhhc2g7XG59XG5cbmZ1bmN0aW9uIGZvbGRPYmplY3QgKGhhc2gsIG8sIHNlZW4pIHtcbiAgcmV0dXJuIE9iamVjdC5rZXlzKG8pLnNvcnQoKS5yZWR1Y2UoZm9sZEtleSwgaGFzaCk7XG4gIGZ1bmN0aW9uIGZvbGRLZXkgKGhhc2gsIGtleSkge1xuICAgIHJldHVybiBmb2xkVmFsdWUoaGFzaCwgb1trZXldLCBrZXksIHNlZW4pO1xuICB9XG59XG5cbmZ1bmN0aW9uIGZvbGRWYWx1ZSAoaW5wdXQsIHZhbHVlLCBrZXksIHNlZW4pIHtcbiAgdmFyIGhhc2ggPSBmb2xkKGZvbGQoZm9sZChpbnB1dCwga2V5KSwgdG9TdHJpbmcodmFsdWUpKSwgdHlwZW9mIHZhbHVlKTtcbiAgaWYgKHZhbHVlID09PSBudWxsKSB7XG4gICAgcmV0dXJuIGZvbGQoaGFzaCwgJ251bGwnKTtcbiAgfVxuICBpZiAodmFsdWUgPT09IHVuZGVmaW5lZCkge1xuICAgIHJldHVybiBmb2xkKGhhc2gsICd1bmRlZmluZWQnKTtcbiAgfVxuICBpZiAodHlwZW9mIHZhbHVlID09PSAnb2JqZWN0Jykge1xuICAgIGlmIChzZWVuLmluZGV4T2YodmFsdWUpICE9PSAtMSkge1xuICAgICAgcmV0dXJuIGZvbGQoaGFzaCwgJ1tDaXJjdWxhcl0nICsga2V5KTtcbiAgICB9XG4gICAgc2Vlbi5wdXNoKHZhbHVlKTtcbiAgICByZXR1cm4gZm9sZE9iamVjdChoYXNoLCB2YWx1ZSwgc2Vlbik7XG4gIH1cbiAgcmV0dXJuIGZvbGQoaGFzaCwgdmFsdWUudG9TdHJpbmcoKSk7XG59XG5cbmZ1bmN0aW9uIHRvU3RyaW5nIChvKSB7XG4gIHJldHVybiBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwobyk7XG59XG5cbmZ1bmN0aW9uIHN1bSAobykge1xuICByZXR1cm4gcGFkKGZvbGRWYWx1ZSgwLCBvLCAnJywgW10pLnRvU3RyaW5nKDE2KSwgOCk7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gc3VtO1xuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///../../../../trebor-transitions/node_modules/hash-sum/hash-sum.js\n"); - -/***/ }), - -/***/ "./main.ts": -/*!*****************************!*\ - !*** ./main.ts + 5 modules ***! - \*****************************/ -/*! no exports provided */ -/*! ModuleConcatenation bailout: Cannot concat with h:/trebor-repos/trebor-transitions/node_modules/hash-sum/hash-sum.js (<- Module is not an ECMAScript module) */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("\n// CONCATENATED MODULE: h:/trebor-repos/trebor-tools/index.js\nvar PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers'];\r\nvar PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' };\r\nvar TPS = window[PROP_MAP.p] || (window[PROP_MAP.p] = []);\n\nvar array = Array[PROP_MAP.h];\r\nfunction _$toArgs(args, start) {\r\n if (start === void 0) { start = 0; }\r\n return array.slice.call(args, start);\r\n}\r\nfunction _$arrayValues(list, value, root, key) {\r\n array.push.apply(list, value.map(function (v, i) {\r\n if (list.length !== 0)\r\n i += list.length;\r\n return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, key + \".\" + i) : v;\r\n }));\r\n}\r\nfunction _$List(value, root, key) {\r\n var self = this;\r\n Array.apply(self, [value.length]);\r\n var desc = { writable: false, configurable: false, enumerable: false };\r\n _$define(self, '_key', _$assign({ value: key }, desc));\r\n _$define(self, '_root', _$assign({ value: root }, desc));\r\n _$arrayValues(self, value, root, key);\r\n desc.writable = true;\r\n _$define(self, 'length', _$assign({ value: self.length }, desc));\r\n}\r\n_$extends(_$List, Array);\r\n['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) {\r\n _$List[PROP_MAP.h][method] = function () {\r\n var self = this;\r\n var old = self.slice();\r\n var result;\r\n if (method === 'push') {\r\n _$arrayValues(self, _$toArgs(arguments), self._root, self._key);\r\n result = self.length;\r\n }\r\n else {\r\n result = array[method].apply(self, arguments);\r\n }\r\n _$dispatch(self._root, self._key, old, self.slice());\r\n return result;\r\n };\r\n});\r\n_$List[PROP_MAP.h].pull = function (index) {\r\n var self = this;\r\n var items = _$toArgs(arguments, 1);\r\n var length = self.length;\r\n if (index > length) {\r\n length = index + 1;\r\n var pull = new Array(index - self.length);\r\n pull.push.apply(pull, items);\r\n for (var i = 0; i < length; i++) {\r\n if (i === index) {\r\n self.push.apply(self, pull);\r\n }\r\n }\r\n }\r\n else {\r\n self.splice.apply(self, [index, 1].concat(items));\r\n }\r\n};\n\nfunction _$select(selector, parent) {\r\n return _$isString(selector) ? (parent || document).querySelector(selector) : selector;\r\n}\r\nfunction _$docFragment() {\r\n return document.createDocumentFragment();\r\n}\r\nfunction _$append(parent, child, sibling) {\r\n if (_$isType(sibling, 'boolean') && sibling)\r\n parent.parentElement.replaceChild(child, parent);\r\n else if (!sibling)\r\n parent.appendChild(child);\r\n else\r\n parent.insertBefore(child, sibling);\r\n}\r\nfunction _$assignEl(source, dest) {\r\n var childNodes = source.childNodes, attributes = source.attributes;\r\n for (var i = 0; i < childNodes.length; i++) {\r\n _$append(dest, childNodes[i]);\r\n }\r\n for (var i = 0; i < attributes.length; i++) {\r\n var attr = attributes[i];\r\n dest.setAttributeNS(source.namespaceURI, attr.name, attr.value);\r\n }\r\n source.parentElement.replaceChild(dest, source);\r\n return dest;\r\n}\r\nfunction _$removeEl(el, parent) {\r\n var root = parent || el.parentElement;\r\n if (root)\r\n root.removeChild(el);\r\n}\r\nfunction _$el(tagName) {\r\n return document.createElement(tagName || 'div');\r\n}\r\nfunction _$svg(tagName) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg');\r\n}\r\nfunction _$text(content) {\r\n return document.createTextNode(content || '');\r\n}\r\nfunction _$comment(content) {\r\n return document.createComment(content || '');\r\n}\r\nfunction _$setAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el.setAttribute(attr, _$toString(value));\r\n if (_$isValueAttr(attr) && !_$isString(value))\r\n el[PROP_MAP._] = value;\r\n}\r\nfunction _$getAttr(el, attr) {\r\n return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr);\r\n}\r\nfunction _$getValue(el) {\r\n return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v];\r\n}\r\nfunction _$addListener(el, event, handler) {\r\n el.addEventListener(event, handler, false);\r\n}\r\nfunction _$updateListener(el, event, oldHandler, newHandler) {\r\n _$removeListener(el, event, oldHandler);\r\n _$addListener(el, event, oldHandler = newHandler);\r\n return oldHandler;\r\n}\r\nfunction _$removeListener(el, event, handler) {\r\n el.removeEventListener(event, handler, false);\r\n}\r\nfunction _$bindGroup(input, selection) {\r\n var _value = _$getValue(input);\r\n var _$index = selection.indexOf(_value);\r\n input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1);\r\n}\r\nfunction _$bindMultiSelect(select, selections) {\r\n if (!selections.length)\r\n return;\r\n var options = select.options;\r\n for (var i = 0; i < options.length; i++) {\r\n options[i].selected = !!~selections.indexOf(_$getValue(options[i]));\r\n }\r\n}\r\nfunction _$updateMultiSelect(select, obj, prop) {\r\n var items = [];\r\n var selection = obj[prop];\r\n var selectedOptions = select.selectedOptions;\r\n for (var i = 0; i < selectedOptions.length; i++) {\r\n items.push(_$getValue(selectedOptions[i]));\r\n }\r\n obj[prop] = new _$List(items, selection['_root'], selection['_key']);\r\n obj.$update();\r\n}\r\nfunction _$insertStyle(id, css) {\r\n var isNew = false;\r\n var style = _$select(\"#\" + id, document.head);\r\n if (!style) {\r\n isNew = true;\r\n style = _$el('style');\r\n style.id = id;\r\n _$setAttr(style, ['refs', 1]);\r\n }\r\n if (style.textContent !== css) {\r\n style.textContent = css;\r\n }\r\n if (isNew) {\r\n _$append(document.head, style);\r\n }\r\n else {\r\n var count = +_$getAttr(style, 'refs');\r\n _$setAttr(style, ['refs', ++count]);\r\n }\r\n}\r\nfunction _$removeStyle(id) {\r\n var style = _$select(\"#\" + id, document.head);\r\n if (style) {\r\n var count = +_$getAttr(style, 'refs');\r\n if (--count === 0) {\r\n _$removeEl(style, document.head);\r\n }\r\n else {\r\n _$setAttr(style, ['refs', count]);\r\n }\r\n }\r\n}\n\nfunction _$toLowerCase(str) {\r\n return str.toLowerCase();\r\n}\r\nvar _$assign = Object['assign'] || function (t) {\r\n for (var s = void 0, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s)\r\n if (_$hasProp(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nfunction _$apply(callee, args, globs, thisArg) {\r\n if (thisArg === void 0) { thisArg = null; }\r\n return callee.apply(thisArg, args.concat(globs));\r\n}\r\nfunction _$isValueAttr(attr) {\r\n return attr === 'value';\r\n}\r\nfunction _$subscribers(dep, listener) {\r\n if (!this[PROP_MAP.s][dep]) {\r\n this[PROP_MAP.s][dep] = [];\r\n }\r\n return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1;\r\n}\r\nfunction _$define(obj, key, desc) {\r\n Object.defineProperty(obj, key, desc);\r\n}\r\nfunction _$dispatch(root, key, oldVal, value) {\r\n root.$notify(key);\r\n if (root[PROP_MAP.w][key]) {\r\n _$each(root[PROP_MAP.w][key], function (watcher) { watcher(oldVal, value); });\r\n }\r\n root.$update();\r\n}\r\nfunction _$extends(ctor, exts) {\r\n ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]);\r\n ctor[PROP_MAP.h].constructor = ctor;\r\n}\r\nfunction _$isType(value, type) {\r\n return _$type(type) === 'string' ? type.split('\\|').some(function (t) { return t.trim() === _$type(value); }) : value instanceof type;\r\n}\r\nfunction _$isObject(obj) {\r\n return _$isType(obj, 'object');\r\n}\r\nfunction _$isArray(obj) {\r\n return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array');\r\n}\r\nfunction _$isFunction(obj) {\r\n return _$isType(obj, 'function');\r\n}\r\nfunction _$isString(obj) {\r\n return _$isType(obj, 'string');\r\n}\r\nfunction _$toType(value, type, root, key) {\r\n switch (type) {\r\n case 'date':\r\n return new Date(value);\r\n case 'string':\r\n return _$toString(value);\r\n case 'number':\r\n return +value;\r\n case 'boolean':\r\n return _$isString(value) && !value ? true : !!value;\r\n case 'array':\r\n return _$isType(value, _$List) ? value : new _$List(value, root, key);\r\n default:\r\n return value;\r\n }\r\n}\r\nfunction _$type(obj) {\r\n return _$toLowerCase(/ (\\w+)/.exec({}.toString.call(obj))[1]);\r\n}\r\nfunction _$hasProp(obj, prop) {\r\n return obj.hasOwnProperty(prop);\r\n}\r\nfunction _$directive(dd) {\r\n var hasProp = function (prop, instance, options, element) { return _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); };\r\n return {\r\n $init: function (instance, options, element) {\r\n hasProp('$init', instance, options, element);\r\n },\r\n $inserted: function (instance, options, element) {\r\n hasProp('$inserted', instance, options, element);\r\n },\r\n $update: function (instance, options, element) {\r\n if (_$isFunction(dd)) {\r\n dd(instance, options, element);\r\n }\r\n else {\r\n hasProp('$update', instance, options, element);\r\n }\r\n },\r\n $destroy: function (instance, options, element) {\r\n hasProp('$destroy', instance, options, element);\r\n }\r\n };\r\n}\r\nfunction _$noop() { }\r\nfunction _$addChild(inst, Child, attrs) {\r\n var child = null;\r\n if (Child) {\r\n child = new Child(attrs, inst);\r\n inst.$children.push(child);\r\n }\r\n return child;\r\n}\r\nfunction _$removeChild(inst, child) {\r\n var index = inst.$children.indexOf(child);\r\n index >= 0 && inst.$children.splice(index, 1);\r\n}\r\nfunction _$toString(obj) {\r\n var str = _$type(obj);\r\n return !/null|undefined/.test(str) ? obj.toString() : str;\r\n}\r\nfunction _$toPlainObject(obj) {\r\n var data = {};\r\n _$each(_$isObject(obj) ? obj : {}, function (_v, k) {\r\n if (k[0] !== '$' && !_$isFunction(obj[k])) {\r\n if (_$isType(obj[k], _$List)) {\r\n data[k] = obj[k].map(_$toPlainObject);\r\n }\r\n else if (_$isObject(obj[k])) {\r\n data[k] = _$toPlainObject(obj[k]);\r\n }\r\n else {\r\n data[k] = obj[k];\r\n }\r\n }\r\n });\r\n return _$isObject(obj) ? data : obj;\r\n}\r\nfunction _$setReference(refs, prop, node) {\r\n if (!_$hasProp(refs, prop)) {\r\n var value_1 = [];\r\n _$define(refs, prop, {\r\n get: function () { return value_1.length <= 1 ? value_1[0] : value_1; },\r\n set: function (val) { val && !~value_1.indexOf(val) && value_1.push(val); },\r\n enumerable: true, configurable: true\r\n });\r\n }\r\n refs[prop] = node;\r\n}\r\nfunction _$accesor(object, path, value) {\r\n return path.split('.').reduce(function (obj, key, i, arr) {\r\n if (_$isType(value, 'undefined')) {\r\n if (obj == null) {\r\n arr.splice(0, arr.length);\r\n return i > 0 && obj === null ? obj : undefined;\r\n }\r\n }\r\n else {\r\n if (i === arr.length - 1) {\r\n if (_$isType(obj, _$List) && _$toString(+key) === key) {\r\n obj.pull(+key, value);\r\n }\r\n else {\r\n var oldVal = obj[key];\r\n obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value;\r\n _$dispatch(object, path, oldVal, obj[key]);\r\n }\r\n }\r\n else if (!_$isObject(obj[key])) {\r\n obj[key] = {};\r\n }\r\n }\r\n return obj ? obj[key] : null;\r\n }, object);\r\n}\r\nfunction _$emptyElse() {\r\n return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop };\r\n}\r\nfunction _$isKey(event, key) {\r\n return _$toLowerCase(event.key) === key || !!event[key + \"Key\"];\r\n}\r\nfunction _$bindClasses(value) {\r\n var classes = '';\r\n if (_$isString(value)) {\r\n classes += \" \" + value;\r\n }\r\n else if (_$isArray(value)) {\r\n classes = value.map(_$bindClasses).join(' ');\r\n }\r\n else if (_$isObject(value)) {\r\n for (var key in value)\r\n if (_$hasProp(value, key) && value[key])\r\n classes += \" \" + key;\r\n }\r\n return classes.trim();\r\n}\r\nfunction _$bindStyle(value) {\r\n var el = _$el();\r\n if (_$isObject(value)) {\r\n var style_1 = el.style;\r\n _$each(value, function (val, prop) {\r\n if (val !== style_1[prop])\r\n style_1[prop] = val;\r\n });\r\n return style_1.cssText;\r\n }\r\n else if (_$isString(value)) {\r\n return value;\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\nfunction _$conditionalUpdate(block, condition, parent, anchor, inst) {\r\n var globs = _$toArgs(arguments, 5);\r\n if (block && block.type === _$apply(condition, [inst], globs).type) {\r\n _$apply(block.$update, [inst], globs, block);\r\n }\r\n else {\r\n block && block.$destroy();\r\n block = _$apply(condition, [inst], globs);\r\n block.$create();\r\n block.$mount(parent || inst.$parentEl, anchor);\r\n }\r\n return block;\r\n}\r\nfunction _$bindUpdate(el, binding) {\r\n var attr = binding[0], value = binding[1];\r\n var _value = _$toString(value);\r\n if (_$isValueAttr(attr)) {\r\n if (el[attr] !== _value)\r\n el[attr] = _value;\r\n el[PROP_MAP._] = value;\r\n }\r\n else if (_$getAttr(el, attr) !== _value) {\r\n _$setAttr(el, [attr, _value]);\r\n }\r\n}\r\nfunction _$bindBooleanAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true);\r\n}\r\nfunction _$textUpdate(text, value) {\r\n if (text.data !== (value = _$toString(value)))\r\n text.data = value;\r\n}\r\nfunction _$tagUpdate(node, tag) {\r\n return _$toLowerCase(tag) !== _$toLowerCase(node.tagName) ? _$assignEl(node, _$el(tag)) : node;\r\n}\r\nfunction _$removeReference(refs, prop, node) {\r\n var nodes = refs[prop];\r\n _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]);\r\n}\r\nfunction _$htmlUpdate(node, value) {\r\n if (node.innerHTML !== (value = _$toString(value)))\r\n node.innerHTML = value;\r\n}\r\nfunction _$componentUpdate(parent, Ctor, inst, value, attrs, el, sibling) {\r\n if (value === Ctor) {\r\n inst && inst.$update();\r\n }\r\n else {\r\n Ctor = value;\r\n if (inst) {\r\n inst.$destroy();\r\n _$removeChild(parent, inst);\r\n }\r\n if (inst) {\r\n inst = _$addChild(parent, Ctor, attrs);\r\n inst.$create();\r\n inst.$mount(el, sibling);\r\n }\r\n }\r\n return [inst, Ctor];\r\n}\r\nfunction _$destroyComponent(component) {\r\n component.$unmount();\r\n component.$parent = null;\r\n component.$parentEl = null;\r\n component.$siblingEl = null;\r\n component.$children.splice(0, component.$children.length);\r\n}\r\nfunction _$setElements(component, parent, sibling) {\r\n var brother = _$select(sibling);\r\n component.$siblingEl = brother;\r\n component.$parentEl = sibling && brother.parentElement || _$select(parent);\r\n}\r\nfunction _$forLoop(root, obj, loop) {\r\n var items = {}, loopParent, loopSibling;\r\n var globs = _$toArgs(arguments, 3);\r\n _$each(obj, function (item, i, index) { items[i] = _$apply(loop, [root, item, i, index], globs); });\r\n return {\r\n $create: function () {\r\n _$each(items, function (item) { item.$create(); });\r\n },\r\n $mount: function (parent, sibling) {\r\n loopParent = _$select(parent);\r\n loopSibling = _$select(sibling);\r\n _$each(items, function (item) { item.$mount(loopParent, loopSibling); });\r\n },\r\n $update: function (root, obj) {\r\n var globs = _$toArgs(arguments, 2);\r\n _$each(items, function (item, i, index) {\r\n if (obj[i]) {\r\n _$apply(item.$update, [root, obj[i], i, index], globs, item);\r\n }\r\n else {\r\n item.$destroy();\r\n delete items[i];\r\n }\r\n });\r\n _$each(obj, function (item, i, index) {\r\n if (!items[i]) {\r\n items[i] = _$apply(loop, [root, item, i, index], globs);\r\n items[i].$create();\r\n items[i].$mount(loopParent, loopSibling);\r\n }\r\n });\r\n },\r\n $destroy: function () {\r\n _$each(items, function (item) { item.$destroy(); });\r\n }\r\n };\r\n}\r\nfunction _$each(obj, cb) {\r\n var i = 0;\r\n for (var key in obj) {\r\n if (_$hasProp(obj, key)) {\r\n cb(obj[key], (isNaN(+key) ? key : +key), i++);\r\n }\r\n }\r\n}\n\nfunction _$BaseComponent(attrs, template, options, parent) {\r\n var self = this;\r\n var _$set = function (prop, value) { _$define(self, prop, { value: value, writable: true }); };\r\n if (!attrs)\r\n attrs = {};\r\n _$each(PROPS, function (prop) { _$define(self, prop, { value: {} }); });\r\n _$set('$parent', parent || null);\r\n _$set('$children', []);\r\n _$set(PROP_MAP.s, {});\r\n _$set('$options', options);\r\n var opts = self.$options;\r\n if (!opts.attrs)\r\n opts.attrs = {};\r\n if (!opts.children)\r\n opts.children = {};\r\n _$each(TPS, function (plugin) { plugin.fn.call(self, _$BaseComponent, plugin.options); });\r\n if (opts.filters)\r\n _$assign(self.$filters, opts.filters);\r\n if (opts.directives)\r\n _$each(opts.directives, function (drt, k) { self.$directives[k] = _$directive(drt); });\r\n _$each(opts.attrs, function (attrOps, key) {\r\n _$define(self, (_$isType(key, 'number') ? attrOps : key), {\r\n get: function () {\r\n if (_$isString(attrOps)) {\r\n var value = attrs[attrOps];\r\n return _$isFunction(value) ? value() : value;\r\n }\r\n else {\r\n if (!_$hasProp(attrs, key) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' is required.\");\r\n }\r\n else {\r\n var value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key];\r\n if (value === void 0 && _$hasProp(attrOps, 'default')) {\r\n var def = attrOps.default;\r\n value = _$isFunction(def) ? def() : def;\r\n }\r\n var typ = attrOps.type;\r\n if (typ && !_$isType(value, typ) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' must be type '\" + typ + \"'.\");\r\n }\r\n value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key);\r\n if (value !== void 0 && _$hasProp(attrOps, 'validator')) {\r\n var validator = attrOps.validator;\r\n if (_$isFunction(validator) && !validator(value)) {\r\n return console.error(\"Assigment '\" + key + \"'='\" + JSON.stringify(value) + \"' invalid.\");\r\n }\r\n }\r\n return value;\r\n }\r\n }\r\n },\r\n set: function () {\r\n console.error(\"'\" + key + \"' is read only.\");\r\n },\r\n enumerable: true, configurable: true\r\n });\r\n });\r\n var data = opts.model || {};\r\n var _loop_1 = function (key) {\r\n if (_$hasProp(data, key)) {\r\n var desc = Object.getOwnPropertyDescriptor(data, key);\r\n if (desc.value && _$isArray(desc.value)) {\r\n desc.value = new _$List(desc.value, self, key);\r\n }\r\n else {\r\n if (desc.get) {\r\n var getter_1 = desc.get;\r\n desc.get = function () {\r\n var value = getter_1.call(self);\r\n if (_$isArray(value))\r\n value = new _$List(value, self, key);\r\n return value;\r\n };\r\n }\r\n if (desc.set) {\r\n var setter_1 = desc.set;\r\n desc.set = function (v) {\r\n if (_$isArray(v))\r\n v = new _$List(v, self, key);\r\n setter_1.call(self, v);\r\n };\r\n }\r\n }\r\n _$define(self, key, desc);\r\n }\r\n };\r\n for (var key in data) {\r\n _loop_1(key);\r\n }\r\n var tpl = template(self);\r\n _$each(tpl, function (value, key) {\r\n _$define(self, key, {\r\n value: (function (key) {\r\n var hook = key[1].toUpperCase() + key.slice(2);\r\n var bhook = opts[\"will\" + hook];\r\n var ahook = opts[\"did\" + hook];\r\n return function () {\r\n bhook && bhook.call(this);\r\n key === '$update' ? value.call(this, this) : value.apply(this, arguments);\r\n ahook && ahook.call(this);\r\n };\r\n })(key)\r\n });\r\n });\r\n _$define(self, '$data', {\r\n get: function () {\r\n return _$toPlainObject(this);\r\n }\r\n });\r\n}\r\n_$assign(_$BaseComponent[PROP_MAP.h], {\r\n $get: function (path) {\r\n return _$accesor(this, path);\r\n },\r\n $set: function (path, value) {\r\n _$accesor(this, path, value);\r\n },\r\n $on: function (event, handler) {\r\n var _this = this;\r\n if (!this[PROP_MAP.e][event]) {\r\n this[PROP_MAP.e][event] = [];\r\n }\r\n var i = this[PROP_MAP.e][event].push(handler);\r\n return {\r\n $off: function () {\r\n _this[PROP_MAP.e][event].splice(i - 1, 1);\r\n }\r\n };\r\n },\r\n $once: function (event, handler) {\r\n var e = this.$on(event, function (args) {\r\n handler(args);\r\n e.$off();\r\n });\r\n },\r\n $fire: function (event, data) {\r\n if (this[PROP_MAP.e][event]) {\r\n _$each(this[PROP_MAP.e][event], function (handler) { handler(data); });\r\n }\r\n },\r\n $notify: function (key) {\r\n if (this[PROP_MAP.s][key]) {\r\n _$each(this[PROP_MAP.s][key], function (suscriber) { suscriber(); });\r\n }\r\n },\r\n $observe: function (deps, listener) {\r\n var _this = this;\r\n var subs = [];\r\n if (_$isArray(deps)) {\r\n _$each(deps, function (dep) {\r\n subs.push({ sub: dep, i: _$subscribers.call(_this, dep, listener) });\r\n });\r\n }\r\n else {\r\n subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) });\r\n }\r\n return {\r\n $unobserve: function () {\r\n _$each(subs, function (sub) {\r\n _this[PROP_MAP.s][sub.sub].splice(sub.i, 1);\r\n });\r\n }\r\n };\r\n },\r\n $watch: function (key, watcher) {\r\n var _this = this;\r\n if (!this[PROP_MAP.w][key]) {\r\n this[PROP_MAP.w][key] = [];\r\n }\r\n var i = this[PROP_MAP.w][key].push(watcher.bind(this));\r\n return {\r\n $unwatch: function () {\r\n _this[PROP_MAP.w][key].splice(i - 1, 1);\r\n }\r\n };\r\n }\r\n});\r\nfunction _$Ctor(moduleName, tpl, options) {\r\n var _a;\r\n var ctor = (_a = {},\r\n _a[moduleName] = function (_$attrs, _$parent) {\r\n _$BaseComponent.call(this, _$attrs, tpl, options, _$parent);\r\n !_$parent && this.$create();\r\n },\r\n _a)[moduleName];\r\n ctor.plugin = function (fn, options) {\r\n TPS.push({ options: options, fn: fn });\r\n };\r\n _$extends(ctor, _$BaseComponent);\r\n return ctor;\r\n}\n\n\n//# sourceMappingURL=index.js.map\n\n// EXTERNAL MODULE: h:/trebor-repos/trebor-transitions/node_modules/hash-sum/hash-sum.js\nvar hash_sum = __webpack_require__(\"../../../../trebor-transitions/node_modules/hash-sum/hash-sum.js\");\nvar hash_sum_default = /*#__PURE__*/__webpack_require__.n(hash_sum);\n\n// CONCATENATED MODULE: h:/trebor-repos/trebor-transitions/transition.js\nvar HALF = .5;\r\nvar PI = Math.PI, pow = Math.pow, sin = Math.sin;\r\nvar NEWTON_ITERATIONS = 4;\r\nvar NEWTON_MIN_SLOPE = 0.001;\r\nvar SUBDIVISION_PRECISION = 0.0000001;\r\nvar SUBDIVISION_MAX_ITERATIONS = 10;\r\nvar kSplineTableSize = 11;\r\nvar kSampleStepSize = 1 / (kSplineTableSize - 1);\r\nvar float32ArraySupported = typeof Float32Array === 'function';\r\nfunction C(aA1) { return 3 * aA1; }\r\nfunction now() { return performance.now(); }\r\nfunction B(aA1, aA2) { return C(aA2) - 6 * aA1; }\r\nfunction A(aA1, aA2) { return 1 - C(aA2) + C(aA1); }\r\nfunction calcBezier(aT, aA1, aA2) {\r\n return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;\r\n}\r\nfunction getSlope(aT, aA1, aA2) {\r\n return C(A(aA1, aA2) * aT * aT + 2 * B(aA1, aA2) * aT + C(aA1));\r\n}\r\nfunction binarySubdivide(aX, aA, aB, mX1, mX2) {\r\n var currentX, currentT, i = 0;\r\n do {\r\n currentT = aA + (aB - aA) / 2;\r\n currentX = calcBezier(currentT, mX1, mX2) - aX;\r\n if (currentX > 0) {\r\n aB = currentT;\r\n }\r\n else {\r\n aA = currentT;\r\n }\r\n } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);\r\n return currentT;\r\n}\r\nfunction newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\r\n for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\r\n var currentSlope = getSlope(aGuessT, mX1, mX2);\r\n if (currentSlope === 0) {\r\n return aGuessT;\r\n }\r\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\r\n aGuessT -= currentX / currentSlope;\r\n }\r\n return aGuessT;\r\n}\r\nfunction cubicBezier(mX1, mY1, mX2, mY2) {\r\n if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) {\r\n throw new Error('bezier x values must be in [0, 1] range');\r\n }\r\n if (mX1 === mY1 && mX2 === mY2) {\r\n return function (x) { return x; };\r\n }\r\n var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);\r\n for (var i = 0; i < kSplineTableSize; ++i) {\r\n sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\r\n }\r\n function getTForX(aX) {\r\n var currentSample = 1;\r\n var intervalStart = 0;\r\n var lastSample = kSplineTableSize - 1;\r\n for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {\r\n intervalStart += kSampleStepSize;\r\n }\r\n --currentSample;\r\n var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);\r\n var guessForT = intervalStart + dist * kSampleStepSize;\r\n var initialSlope = getSlope(guessForT, mX1, mX2);\r\n if (initialSlope >= NEWTON_MIN_SLOPE) {\r\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\r\n }\r\n else if (initialSlope === 0) {\r\n return guessForT;\r\n }\r\n else {\r\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);\r\n }\r\n }\r\n return function (x) {\r\n if (x === 0)\r\n return 0;\r\n if (x === 1)\r\n return 1;\r\n return calcBezier(getTForX(x), mY1, mY2);\r\n };\r\n}\r\nfunction bounceOut(t) {\r\n var c = .9, a = 4 / 11, b = 8 / 11;\r\n var ca = 4356 / 361, cb = 35442 / 1805, cc = 16061 / 1805, t2 = t * t;\r\n return t < a ? 7.5625 * t2 : t < b ? 9.075 * t2 - 9.9 * t + 3.4 : t < c ? ca * t2 - cb * t + cc : 10.8 * t * t - 20.52 * t + 10.72;\r\n}\r\nfunction bounceInOut(t) {\r\n return t < HALF ? HALF * (1 - bounceOut(1 - t * 2)) : HALF * bounceOut(t * 2 - 1) + HALF;\r\n}\r\nfunction bounceIn(t) {\r\n return 1 - bounceOut(1 - t);\r\n}\r\nfunction elasticInOut(t) {\r\n return t < HALF\r\n ? HALF * sin(13 * PI / 2 * 2 * t) * pow(2, 10 * (2 * t - 1))\r\n : HALF * sin(-13 * PI / 2 * ((2 * t - 1) + 1)) * pow(2, -10 * (2 * t - 1)) + 1;\r\n}\r\nfunction elasticIn(t) {\r\n return sin(13 * t * PI / 2) * pow(2, 10 * (t - 1));\r\n}\r\nfunction elasticOut(t) {\r\n return sin(-13 * (t + 1) * PI / 2) * pow(2, -10 * t) + 1;\r\n}\r\nvar snap = cubicBezier(0, 1, HALF, 1);\r\nvar easeIn = cubicBezier(.42, 0, 1, 1);\r\nvar easeOut = cubicBezier(0, 0, .58, 1);\r\nvar inOut = cubicBezier(.42, 0, .58, 1);\r\nvar linear = cubicBezier(.25, .25, .75, .75);\r\nvar backIn = cubicBezier(.6, -.28, .735, .045);\r\nvar circIn = cubicBezier(.6, .04, .98, .335);\r\nvar cubicIn = cubicBezier(.55, .055, .675, .19);\r\nvar expoIn = cubicBezier(.95, .05, .795, .035);\r\nvar quadIn = cubicBezier(.55, .085, .68, .53);\r\nvar quartIn = cubicBezier(.895, .03, .685, .22);\r\nvar quintIn = cubicBezier(.755, .05, .855, .06);\r\nvar sineIn = cubicBezier(.47, 0, .745, .715);\r\nvar backOut = cubicBezier(.175, .885, .32, 1.275);\r\nvar circOut = cubicBezier(.075, .82, .165, 1);\r\nvar cubicOut = cubicBezier(.215, .61, .355, 1);\r\nvar expoOut = cubicBezier(.19, 1, .22, 1);\r\nvar quadOut = cubicBezier(.25, .46, .45, .94);\r\nvar quartOut = cubicBezier(.165, .84, .44, 1);\r\nvar quintOut = cubicBezier(.23, 1, .32, 1);\r\nvar sineOut = cubicBezier(.39, .575, .565, 1);\r\nvar backInOut = cubicBezier(.68, -.55, .265, 1.55);\r\nvar circInOut = cubicBezier(.785, .135, .15, .86);\r\nvar cubicInOut = cubicBezier(.645, .045, .355, 1);\r\nvar expoInOut = cubicBezier(1, 0, 0, 1);\r\nvar quadInOut = cubicBezier(.455, .03, .515, .955);\r\nvar quartInOut = cubicBezier(.77, 0, .175, 1);\r\nvar quintInOut = cubicBezier(.86, 0, .07, 1);\r\nvar sineInOut = cubicBezier(.445, .05, .55, .95);\r\nfunction transition(_a) {\r\n var _b = _a.ease, ease = _b === void 0 ? easeIn : _b, duration = _a.duration, _c = _a.loop, loop = _c === void 0 ? false : _c, _d = _a.delay, delay = _d === void 0 ? 0 : _d;\r\n var diff = 0;\r\n var start, change, ended;\r\n function init() {\r\n start = now();\r\n !this.running && (this.running = true);\r\n requestAnimationFrame(animate.bind(this));\r\n }\r\n function animate(time) {\r\n if (this.paused || !change)\r\n return;\r\n var fraction = (time - start + diff) / (duration || 800);\r\n var progress = ease(fraction > 1 ? fraction = 1 : fraction);\r\n change(progress);\r\n if (fraction < 1) {\r\n requestAnimationFrame(animate.bind(this));\r\n }\r\n else if (loop) {\r\n diff = 0;\r\n init.call(this);\r\n }\r\n else {\r\n this.running = false;\r\n ended && ended();\r\n }\r\n }\r\n return {\r\n paused: false,\r\n running: false,\r\n on: function (event, handler) {\r\n event === 'ended' && (ended = handler);\r\n event === 'change' && (change = handler);\r\n },\r\n run: function (d, l) {\r\n delay = l || delay || 0;\r\n duration = d || duration || 800;\r\n delay > 0 ? setTimeout(init.bind(this), delay) : init.call(this);\r\n },\r\n pause: function () {\r\n if (!this.running)\r\n return;\r\n this.paused = true;\r\n diff += now() - start;\r\n },\r\n play: function () {\r\n if (!this.running)\r\n return;\r\n this.paused = false;\r\n init.call(this);\r\n }\r\n };\r\n}\r\n\n// CONCATENATED MODULE: h:/trebor-repos/trebor-transitions/tools.js\nvar __assign = (undefined && undefined.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\n\r\nfunction animate(options, run) {\r\n var style = document.querySelector('[animation-style-sheet]');\r\n if (!style) {\r\n style = document.createElement('style');\r\n style.setAttribute('animation-style-sheet', '');\r\n document.head.appendChild(style);\r\n }\r\n var el, styleIndex;\r\n var styleSheet = style.sheet;\r\n var className = \"animation_\" + hash_sum_default()(run);\r\n var _a = __assign({ delay: 0, duration: 400, ease: easeIn }, options), ease = _a.ease, delay = _a.delay, duration = _a.duration;\r\n var inAnimation = transition({ duration: duration, delay: delay, ease: ease });\r\n var outAnimation = transition({ duration: duration, delay: delay, ease: function (x) { return 1 - ease(1 - x); } });\r\n function setChangeCB(node, animation) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n el = node;\r\n var anime = animation === 'in' ? inAnimation : outAnimation;\r\n var change = run(node);\r\n el.classList.add(className);\r\n anime.on('change', function (progress) {\r\n styleSheet.cssRules.length && styleSheet.deleteRule(styleIndex);\r\n var styleTxt = change(animation === 'in' ? progress : 1 - progress);\r\n styleSheet.insertRule(\".\" + className + \"{\" + styleTxt + \"}\");\r\n styleIndex = styleSheet.cssRules.length - 1;\r\n });\r\n anime.run.apply(anime, args);\r\n }\r\n return {\r\n state: 'in',\r\n started: false,\r\n ended: function (handler) {\r\n var callback = function () {\r\n el.classList.remove(className);\r\n handler && handler();\r\n styleSheet.deleteRule(styleIndex);\r\n };\r\n inAnimation.on('ended', callback);\r\n outAnimation.on('ended', function () {\r\n callback();\r\n });\r\n },\r\n run: function (node) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var self = this;\r\n if (self.state === 'in') {\r\n self.in.apply(self, [node].concat(args));\r\n self.state = 'out';\r\n }\r\n else {\r\n self.out.apply(self, [node].concat(args));\r\n self.state = 'in';\r\n }\r\n },\r\n in: function (node) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n setChangeCB.apply(void 0, [node, 'in'].concat(args));\r\n },\r\n out: function (node) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n setChangeCB.apply(void 0, [node, 'out'].concat(args));\r\n }\r\n };\r\n}\r\n\n// CONCATENATED MODULE: h:/trebor-repos/trebor-transitions/index.js\nvar trebor_transitions_assign = (undefined && undefined.__assign) || function () {\r\n trebor_transitions_assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return trebor_transitions_assign.apply(this, arguments);\r\n};\r\n\r\n\r\nfunction FadeAnimation(options) {\r\n options = options || { delay: 0, duration: 400 };\r\n return animate(options, function (node) {\r\n var opacity = +(getComputedStyle(node).opacity || 0);\r\n return function (progress) { return \"opacity: \" + progress * opacity + \";\"; };\r\n });\r\n}\r\nfunction FlyAnimation(options) {\r\n options = options || { delay: 0, duration: 400, x: 0, y: 0, ease: cubicOut };\r\n return animate(options, function (node) {\r\n var opacity, transform;\r\n var _a = trebor_transitions_assign({ x: 0, y: 0 }, options), x = _a.x, y = _a.y;\r\n var style = getComputedStyle(node);\r\n opacity = +(style.opacity || 0);\r\n transform = style.transform === 'none' ? '' : (style.transform ? style.transform + \" \" : '');\r\n return function (progress) { return \"opacity: \" + progress * opacity + \"; \" +\r\n (\"transform: \" + transform + \"translate(\" + (1 - progress) * (x || 0) + \"px, \" + (1 - progress) * (y || 0) + \"px);\"); };\r\n });\r\n}\r\nfunction SlideAnimation(options) {\r\n options = options || { delay: 0, duration: 400, ease: cubicOut };\r\n return animate(options, function (node) {\r\n var opacity, height, paddingTop, paddingBottom, marginTop, marginBottom, borderTopWidth, borderBottomWidth;\r\n var style = getComputedStyle(node);\r\n opacity = +(style.opacity || 0);\r\n height = parseFloat(style.height || '0');\r\n marginTop = parseFloat(style.marginTop || '0');\r\n paddingTop = parseFloat(style.paddingTop || '0');\r\n marginBottom = parseFloat(style.marginBottom || '0');\r\n paddingBottom = parseFloat(style.paddingBottom || '0');\r\n borderTopWidth = parseFloat(style.borderTopWidth || '0');\r\n borderBottomWidth = parseFloat(style.borderBottomWidth || '0');\r\n return function (progress) { return \"overflow: hidden;\" +\r\n (\"height: \" + progress * height + \"px;\") +\r\n (\"margin-top: \" + progress * marginTop + \"px;\") +\r\n (\"padding-top: \" + progress * paddingTop + \"px;\") +\r\n (\"margin-bottom: \" + progress * marginBottom + \"px;\") +\r\n (\"padding-bottom: \" + progress * paddingBottom + \"px;\") +\r\n (\"border-top-width: \" + progress * borderTopWidth + \"px;\") +\r\n (\"opacity: \" + Math.min(progress * 20, 1) * opacity + \";\") +\r\n (\"border-bottom-width: \" + progress * borderBottomWidth + \"px;\"); };\r\n });\r\n}\r\n\n// CONCATENATED MODULE: ./components/animation.html\n\r\n\r\nfunction ifCondition_1(_$state) {\r\n var _$frag, div_1, txt_1, _refs;\r\n _$frag = _$docFragment();\r\n _refs = _$state.$refs;\r\n return {\r\n type: 'if',\r\n\r\n $create: function() {\r\n div_1 = _$el();\r\n txt_1 = _$text('Hello word!');\r\n _$setReference(_refs, 'box', div_1);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: _$noop,\r\n\r\n $unmount: function() {\r\n _$append(div_1, txt_1);\r\n _$append(_$frag, div_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$removeReference(_refs, 'box', div_1);\r\n _$frag = div_1 = txt_1 = _refs = void 0;\r\n }\r\n };\r\n}\r\nfunction condition_1(_$state) {\r\n if (_$state.visible)\r\n return ifCondition_1(_$state);\r\n else\r\n return _$emptyElse();\r\n}\r\nfunction _$tplAnimation(_$state) {\r\n var _$frag, input_1, changeEvent_1, handlerChangeEvent_1, label_1, txt_1, setTxt_1, conditionAnchor_1, conditionBlock_1;\r\n _$frag = _$docFragment();\r\n changeEvent_1 = function(_$state, $event, $el) {\r\n _$state.onChange($el.checked);\r\n };\r\n setTxt_1 = function() {\r\n return 'Visible: ';\r\n };\r\n '+(_$state.visible)+';\r\n '';\r\n conditionAnchor_1 = _$text();\r\n return {\r\n $create: function() {\r\n input_1 = _$el('input');\r\n label_1 = _$el('label');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state);\r\n conditionBlock_1 = condition_1(_$state);\r\n conditionBlock_1.$create();\r\n _$setAttr(input_1, ['id', 'visible']);\r\n _$setAttr(input_1, ['type', 'checkbox']);\r\n _$addListener(input_1, 'change', handlerChangeEvent_1 = function(event) {\r\n changeEvent_1(_$state, event, input_1);\r\n });\r\n _$setAttr(label_1, ['for', 'visible']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$insertStyle(\r\n 'scope_2d826740',\r\n 'div {width:125px;padding:45px 0;color:white;text-align:center;background-color:black;}'\r\n );\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$textUpdate(txt_1, setTxt_1(_$state));\r\n conditionBlock_1 = _$conditionalUpdate(conditionBlock_1, condition_1, undefined, conditionAnchor_1, _$state);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(_$frag, input_1);\r\n _$append(label_1, txt_1);\r\n _$append(_$frag, label_1);\r\n _$append(_$frag, conditionAnchor_1);\r\n conditionBlock_1.$mount(_$frag, conditionAnchor_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n _$removeStyle('scope_2d826740');\r\n _$removeListener(input_1, 'change', handlerChangeEvent_1);\r\n conditionBlock_1.$destroy();\r\n delete _$state.$root;\r\n _$frag = input_1 = changeEvent_1 = handlerChangeEvent_1 = label_1 = txt_1 = setTxt_1 = conditionAnchor_1 = conditionBlock_1 = void 0;\r\n }\r\n };\r\n}\r\nvar animation = SlideAnimation({\r\n y: 300,\r\n duration: 1200\r\n});\r\nvar Animation = _$Ctor('Animation', _$tplAnimation, {\r\n model: {\r\n visible: false,\r\n\r\n onChange: function(value) {\r\n var _this = this;\r\n var refs = this.$refs;\r\n animation.ended(function() {\r\n !value && _this.$update();\r\n });\r\n if (value) {\r\n this.$set('visible', value);\r\n animation.in(refs.box);\r\n } else {\r\n this.visible = value;\r\n animation.out(refs.box);\r\n }\r\n }\r\n }\r\n});\r\n/* harmony default export */ var components_animation = (Animation);\r\n\n// CONCATENATED MODULE: ./main.ts\n\r\nvar main_animation = new components_animation();\r\nmain_animation.$mount('main');\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vaDovdHJlYm9yLXJlcG9zL3RyZWJvci10b29scy9pbmRleC5qcz82NjBlIiwid2VicGFjazovLy9oOi90cmVib3ItcmVwb3MvdHJlYm9yLXRyYW5zaXRpb25zL3RyYW5zaXRpb24uanM/NzkzMiIsIndlYnBhY2s6Ly8vaDovdHJlYm9yLXJlcG9zL3RyZWJvci10cmFuc2l0aW9ucy90b29scy5qcz9hY2UyIiwid2VicGFjazovLy9oOi90cmVib3ItcmVwb3MvdHJlYm9yLXRyYW5zaXRpb25zL2luZGV4LmpzPzllYjMiLCJ3ZWJwYWNrOi8vLy4vY29tcG9uZW50cy9hbmltYXRpb24uaHRtbD9jZDA4Iiwid2VicGFjazovLy8uL21haW4udHM/ODI2OSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBO0FBQ0EsZ0JBQWdCO0FBQ2hCOztBQUVBO0FBQ0E7QUFDQSwyQkFBMkIsV0FBVztBQUN0QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTtBQUNBLGdCQUFnQjtBQUNoQixxQ0FBcUMsYUFBYTtBQUNsRCxzQ0FBc0MsY0FBYztBQUNwRDtBQUNBO0FBQ0EsdUNBQXVDLHFCQUFxQjtBQUM1RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQztBQUNEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSx1QkFBdUIsWUFBWTtBQUNuQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxtQkFBbUIsdUJBQXVCO0FBQzFDO0FBQ0E7QUFDQSxtQkFBbUIsdUJBQXVCO0FBQzFDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsbUJBQW1CLG9CQUFvQjtBQUN2QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG1CQUFtQiw0QkFBNEI7QUFDL0M7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQSxxREFBcUQsT0FBTztBQUM1RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsNkJBQTZCLGdCQUFnQjtBQUM3QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsMERBQTBELHdCQUF3QixFQUFFO0FBQ3BGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSwyRUFBMkUsbUNBQW1DLEVBQUU7QUFDaEg7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EseUNBQXlDO0FBQ3pDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSwrREFBK0QsMkVBQTJFO0FBQzFJO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxtQkFBbUI7QUFDbkI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EscUNBQXFDO0FBQ3JDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsOEJBQThCLG1EQUFtRCxFQUFFO0FBQ25GLGlDQUFpQyxvREFBb0QsRUFBRTtBQUN2RjtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBLFlBQVk7QUFDWjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGtCQUFrQjtBQUNsQjtBQUNBLDJDQUEyQyx5REFBeUQsRUFBRTtBQUN0RztBQUNBO0FBQ0EsMkNBQTJDLGdCQUFnQixFQUFFO0FBQzdELFNBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQSwyQ0FBMkMsc0NBQXNDLEVBQUU7QUFDbkYsU0FBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYixTQUFTO0FBQ1Q7QUFDQSwyQ0FBMkMsaUJBQWlCLEVBQUU7QUFDOUQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0Esd0NBQXdDLHVCQUF1QiwrQkFBK0IsRUFBRTtBQUNoRztBQUNBO0FBQ0EsbUNBQW1DLHVCQUF1QixVQUFVLEVBQUUsRUFBRSxFQUFFO0FBQzFFO0FBQ0E7QUFDQSx3QkFBd0I7QUFDeEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsbUNBQW1DLHVEQUF1RCxFQUFFO0FBQzVGO0FBQ0E7QUFDQTtBQUNBLG1EQUFtRCx3Q0FBd0MsRUFBRTtBQUM3RjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYjtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0EsU0FBUztBQUNULEtBQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiLFNBQVM7QUFDVCxLQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNULEtBQUs7QUFDTDtBQUNBO0FBQ0EsZ0VBQWdFLGVBQWUsRUFBRTtBQUNqRjtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0EsZ0VBQWdFLGFBQWEsRUFBRTtBQUMvRTtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsMkJBQTJCLHdEQUF3RDtBQUNuRixhQUFhO0FBQ2I7QUFDQTtBQUNBLHVCQUF1Qix5REFBeUQ7QUFDaEY7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGlCQUFpQjtBQUNqQjtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLENBQUM7QUFDRDtBQUNBO0FBQ0EsdUJBQXVCO0FBQ3ZCO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0Esa0JBQWtCLDJCQUEyQjtBQUM3QztBQUNBO0FBQ0E7QUFDQTs7QUFFMmtCO0FBQzNrQjs7Ozs7OztBQ2pzQkE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUJBQWlCLGdCQUFnQjtBQUNqQyxnQkFBZ0IsMEJBQTBCO0FBQzFDLHNCQUFzQix5QkFBeUI7QUFDL0Msc0JBQXNCLDRCQUE0QjtBQUNsRDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQTtBQUNBLG1CQUFtQix1QkFBdUI7QUFDMUM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ087QUFDUDtBQUNBO0FBQ0E7QUFDQTtBQUNBLDZCQUE2QixVQUFVO0FBQ3ZDO0FBQ0E7QUFDQSxtQkFBbUIsc0JBQXNCO0FBQ3pDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGNBQWMsbUVBQW1FO0FBQ2pGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNPO0FBQ1A7QUFDQTtBQUNBO0FBQ0E7QUFDTztBQUNQO0FBQ0E7QUFDTztBQUNQO0FBQ0E7QUFDTztBQUNQO0FBQ0E7QUFDQTtBQUNBO0FBQ087QUFDUDtBQUNBO0FBQ087QUFDUDtBQUNBO0FBQ087QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNRO0FBQ2Y7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7OztBQzNMQSxnQkFBZ0IsU0FBSSxJQUFJLFNBQUk7QUFDNUI7QUFDQSxnREFBZ0QsT0FBTztBQUN2RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQzRCO0FBQ3NCO0FBQzNDO0FBQ1A7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLG1DQUFtQyxrQkFBSTtBQUN2Qyx1QkFBdUIsZ0NBQWdDLE1BQU0sRUFBRTtBQUMvRCxzQkFBc0IsVUFBVSxFQUFFLCtDQUErQztBQUNqRix1QkFBdUIsVUFBVSxFQUFFLHVEQUF1RCx3QkFBd0IsRUFBRSxFQUFFO0FBQ3RIO0FBQ0E7QUFDQSx3QkFBd0IsdUJBQXVCO0FBQy9DO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLHNEQUFzRCxpQkFBaUI7QUFDdkU7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYixTQUFTO0FBQ1Q7QUFDQTtBQUNBLDRCQUE0Qix1QkFBdUI7QUFDbkQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0EsNEJBQTRCLHVCQUF1QjtBQUNuRDtBQUNBO0FBQ0E7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBLDRCQUE0Qix1QkFBdUI7QUFDbkQ7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7QUN2RkEsSUFBSSx5QkFBUSxJQUFJLFNBQUksSUFBSSxTQUFJO0FBQzVCLElBQUkseUJBQVE7QUFDWixnREFBZ0QsT0FBTztBQUN2RDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLHlCQUFRO0FBQ25CO0FBQ2tDO0FBQ007QUFDakM7QUFDUCwwQkFBMEI7QUFDMUIsV0FBVyxPQUFPO0FBQ2xCO0FBQ0Esb0NBQW9DLDZDQUE2QyxFQUFFO0FBQ25GLEtBQUs7QUFDTDtBQUNPO0FBQ1AsMEJBQTBCLDRDQUE0QyxRQUFRO0FBQzlFLFdBQVcsT0FBTztBQUNsQjtBQUNBLGlCQUFpQix5QkFBUSxFQUFFLGFBQWE7QUFDeEM7QUFDQTtBQUNBO0FBQ0Esb0NBQW9DLDZDQUE2QztBQUNqRiw4SEFBOEgsR0FBRztBQUNqSSxLQUFLO0FBQ0w7QUFDTztBQUNQLDBCQUEwQixnQ0FBZ0MsUUFBUTtBQUNsRSxXQUFXLE9BQU87QUFDbEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxvQ0FBb0MsMEJBQTBCO0FBQzlELGtEQUFrRDtBQUNsRCx5REFBeUQ7QUFDekQsMkRBQTJEO0FBQzNELCtEQUErRDtBQUMvRCxpRUFBaUU7QUFDakUsb0VBQW9FO0FBQ3BFLG9FQUFvRTtBQUNwRSwwRUFBMEUsR0FBRztBQUM3RSxLQUFLO0FBQ0w7OztBQ25Dc0I7QUFDOEI7QUFDcEQ7QUFDQTtBQUNBLFdBQVcsYUFBYTtBQUN4QjtBQUNBO0FBQ0E7O0FBRUE7QUFDQSxjQUFjLElBQUk7QUFDbEIsY0FBYyxNQUFNO0FBQ3BCLE1BQU0sY0FBYztBQUNwQixLQUFLOztBQUVMO0FBQ0E7QUFDQSxNQUFNLFFBQVEsQ0FBQyxRQUFRLGtCQUFrQixRQUFRO0FBQ2pELEtBQUs7O0FBRUwsYUFBYSxNQUFNOztBQUVuQjtBQUNBLE1BQU0sUUFBUTtBQUNkLE1BQU0sUUFBUTtBQUNkLEtBQUs7O0FBRUw7QUFDQTtBQUNBLE1BQU0saUJBQWlCO0FBQ3ZCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxXQUFXLFdBQVc7QUFDdEI7QUFDQTtBQUNBO0FBQ0EsV0FBVyxhQUFhO0FBQ3hCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxzQkFBc0IsTUFBTTtBQUM1QjtBQUNBO0FBQ0EsZ0JBQWdCLElBQUk7QUFDcEIsZ0JBQWdCLElBQUk7QUFDcEIsY0FBYyxNQUFNO0FBQ3BCO0FBQ0E7QUFDQTtBQUNBLE1BQU0sU0FBUztBQUNmLE1BQU0sU0FBUztBQUNmLE1BQU0sYUFBYTtBQUNuQjtBQUNBLE9BQU87QUFDUCxNQUFNLFNBQVM7QUFDZixLQUFLOztBQUVMO0FBQ0E7QUFDQSxNQUFNLGFBQWE7QUFDbkI7QUFDQSxjQUFjLFlBQVksZUFBZSxZQUFZLGtCQUFrQix3QkFBd0I7QUFDL0Y7QUFDQSxNQUFNLFFBQVEsQ0FBQyxRQUFRLGtCQUFrQixRQUFRO0FBQ2pELE1BQU0sYUFBYTtBQUNuQixLQUFLOztBQUVMO0FBQ0EsTUFBTSxZQUFZO0FBQ2xCLHlCQUF5QixtQkFBbUI7QUFDNUMsS0FBSzs7QUFFTDtBQUNBLE1BQU0sUUFBUTtBQUNkLE1BQU0sUUFBUTtBQUNkLE1BQU0sUUFBUTtBQUNkLE1BQU0sUUFBUTtBQUNkO0FBQ0EsS0FBSzs7QUFFTDtBQUNBLE1BQU0sa0JBQWtCO0FBQ3hCLE1BQU0sYUFBYTtBQUNuQixNQUFNLGdCQUFnQjtBQUN0QjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnQkFBZ0IsY0FBYztBQUM5QjtBQUNBO0FBQ0EsQ0FBQztBQUNELGdCQUFnQixNQUFNO0FBQ3RCO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLE9BQU87QUFDUDtBQUNBO0FBQ0E7QUFDQSxPQUFPO0FBQ1A7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLENBQUM7QUFDYyxrRUFBUyxFQUFDOzs7QUNqSjJCO0FBRXBELElBQU0sY0FBUyxHQUFHLElBQUksb0JBQVMsRUFBRSxDQUFDO0FBRWxDLGNBQVMsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMiLCJmaWxlIjoiLi9tYWluLnRzLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIFBST1BTID0gWyckc2xvdHMnLCAnJHJlZnMnLCAnJGZpbHRlcnMnLCAnJGRpcmVjdGl2ZXMnLCAnX2V2ZW50cycsICdfd2F0Y2hlcnMnXTtcclxudmFyIFBST1BfTUFQID0geyBwOiAnX19UUF9fJywgdjogJ3ZhbHVlJywgXzogJ192YWx1ZScsIHM6ICdfc3Vic2NyaWJlcnMnLCBlOiAnX2V2ZW50cycsIHc6ICdfd2F0Y2hlcnMnLCBoOiAncHJvdG90eXBlJyB9O1xyXG52YXIgVFBTID0gd2luZG93W1BST1BfTUFQLnBdIHx8ICh3aW5kb3dbUFJPUF9NQVAucF0gPSBbXSk7XG5cbnZhciBhcnJheSA9IEFycmF5W1BST1BfTUFQLmhdO1xyXG5mdW5jdGlvbiBfJHRvQXJncyhhcmdzLCBzdGFydCkge1xyXG4gICAgaWYgKHN0YXJ0ID09PSB2b2lkIDApIHsgc3RhcnQgPSAwOyB9XHJcbiAgICByZXR1cm4gYXJyYXkuc2xpY2UuY2FsbChhcmdzLCBzdGFydCk7XHJcbn1cclxuZnVuY3Rpb24gXyRhcnJheVZhbHVlcyhsaXN0LCB2YWx1ZSwgcm9vdCwga2V5KSB7XHJcbiAgICBhcnJheS5wdXNoLmFwcGx5KGxpc3QsIHZhbHVlLm1hcChmdW5jdGlvbiAodiwgaSkge1xyXG4gICAgICAgIGlmIChsaXN0Lmxlbmd0aCAhPT0gMClcclxuICAgICAgICAgICAgaSArPSBsaXN0Lmxlbmd0aDtcclxuICAgICAgICByZXR1cm4gIShfJGlzVHlwZSh2LCBfJExpc3QpKSAmJiBfJGlzQXJyYXkodikgPyBuZXcgXyRMaXN0KHYsIHJvb3QsIGtleSArIFwiLlwiICsgaSkgOiB2O1xyXG4gICAgfSkpO1xyXG59XHJcbmZ1bmN0aW9uIF8kTGlzdCh2YWx1ZSwgcm9vdCwga2V5KSB7XHJcbiAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICBBcnJheS5hcHBseShzZWxmLCBbdmFsdWUubGVuZ3RoXSk7XHJcbiAgICB2YXIgZGVzYyA9IHsgd3JpdGFibGU6IGZhbHNlLCBjb25maWd1cmFibGU6IGZhbHNlLCBlbnVtZXJhYmxlOiBmYWxzZSB9O1xyXG4gICAgXyRkZWZpbmUoc2VsZiwgJ19rZXknLCBfJGFzc2lnbih7IHZhbHVlOiBrZXkgfSwgZGVzYykpO1xyXG4gICAgXyRkZWZpbmUoc2VsZiwgJ19yb290JywgXyRhc3NpZ24oeyB2YWx1ZTogcm9vdCB9LCBkZXNjKSk7XHJcbiAgICBfJGFycmF5VmFsdWVzKHNlbGYsIHZhbHVlLCByb290LCBrZXkpO1xyXG4gICAgZGVzYy53cml0YWJsZSA9IHRydWU7XHJcbiAgICBfJGRlZmluZShzZWxmLCAnbGVuZ3RoJywgXyRhc3NpZ24oeyB2YWx1ZTogc2VsZi5sZW5ndGggfSwgZGVzYykpO1xyXG59XHJcbl8kZXh0ZW5kcyhfJExpc3QsIEFycmF5KTtcclxuWydwb3AnLCAncHVzaCcsICdyZXZlcnNlJywgJ3NoaWZ0JywgJ3NvcnQnLCAnZmlsbCcsICd1bnNoaWZ0JywgJ3NwbGljZSddLmZvckVhY2goZnVuY3Rpb24gKG1ldGhvZCkge1xyXG4gICAgXyRMaXN0W1BST1BfTUFQLmhdW21ldGhvZF0gPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xyXG4gICAgICAgIHZhciBvbGQgPSBzZWxmLnNsaWNlKCk7XHJcbiAgICAgICAgdmFyIHJlc3VsdDtcclxuICAgICAgICBpZiAobWV0aG9kID09PSAncHVzaCcpIHtcclxuICAgICAgICAgICAgXyRhcnJheVZhbHVlcyhzZWxmLCBfJHRvQXJncyhhcmd1bWVudHMpLCBzZWxmLl9yb290LCBzZWxmLl9rZXkpO1xyXG4gICAgICAgICAgICByZXN1bHQgPSBzZWxmLmxlbmd0aDtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgIHJlc3VsdCA9IGFycmF5W21ldGhvZF0uYXBwbHkoc2VsZiwgYXJndW1lbnRzKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgXyRkaXNwYXRjaChzZWxmLl9yb290LCBzZWxmLl9rZXksIG9sZCwgc2VsZi5zbGljZSgpKTtcclxuICAgICAgICByZXR1cm4gcmVzdWx0O1xyXG4gICAgfTtcclxufSk7XHJcbl8kTGlzdFtQUk9QX01BUC5oXS5wdWxsID0gZnVuY3Rpb24gKGluZGV4KSB7XHJcbiAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICB2YXIgaXRlbXMgPSBfJHRvQXJncyhhcmd1bWVudHMsIDEpO1xyXG4gICAgdmFyIGxlbmd0aCA9IHNlbGYubGVuZ3RoO1xyXG4gICAgaWYgKGluZGV4ID4gbGVuZ3RoKSB7XHJcbiAgICAgICAgbGVuZ3RoID0gaW5kZXggKyAxO1xyXG4gICAgICAgIHZhciBwdWxsID0gbmV3IEFycmF5KGluZGV4IC0gc2VsZi5sZW5ndGgpO1xyXG4gICAgICAgIHB1bGwucHVzaC5hcHBseShwdWxsLCBpdGVtcyk7XHJcbiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICBpZiAoaSA9PT0gaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgIHNlbGYucHVzaC5hcHBseShzZWxmLCBwdWxsKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH1cclxuICAgIGVsc2Uge1xyXG4gICAgICAgIHNlbGYuc3BsaWNlLmFwcGx5KHNlbGYsIFtpbmRleCwgMV0uY29uY2F0KGl0ZW1zKSk7XHJcbiAgICB9XHJcbn07XG5cbmZ1bmN0aW9uIF8kc2VsZWN0KHNlbGVjdG9yLCBwYXJlbnQpIHtcclxuICAgIHJldHVybiBfJGlzU3RyaW5nKHNlbGVjdG9yKSA/IChwYXJlbnQgfHwgZG9jdW1lbnQpLnF1ZXJ5U2VsZWN0b3Ioc2VsZWN0b3IpIDogc2VsZWN0b3I7XHJcbn1cclxuZnVuY3Rpb24gXyRkb2NGcmFnbWVudCgpIHtcclxuICAgIHJldHVybiBkb2N1bWVudC5jcmVhdGVEb2N1bWVudEZyYWdtZW50KCk7XHJcbn1cclxuZnVuY3Rpb24gXyRhcHBlbmQocGFyZW50LCBjaGlsZCwgc2libGluZykge1xyXG4gICAgaWYgKF8kaXNUeXBlKHNpYmxpbmcsICdib29sZWFuJykgJiYgc2libGluZylcclxuICAgICAgICBwYXJlbnQucGFyZW50RWxlbWVudC5yZXBsYWNlQ2hpbGQoY2hpbGQsIHBhcmVudCk7XHJcbiAgICBlbHNlIGlmICghc2libGluZylcclxuICAgICAgICBwYXJlbnQuYXBwZW5kQ2hpbGQoY2hpbGQpO1xyXG4gICAgZWxzZVxyXG4gICAgICAgIHBhcmVudC5pbnNlcnRCZWZvcmUoY2hpbGQsIHNpYmxpbmcpO1xyXG59XHJcbmZ1bmN0aW9uIF8kYXNzaWduRWwoc291cmNlLCBkZXN0KSB7XHJcbiAgICB2YXIgY2hpbGROb2RlcyA9IHNvdXJjZS5jaGlsZE5vZGVzLCBhdHRyaWJ1dGVzID0gc291cmNlLmF0dHJpYnV0ZXM7XHJcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGNoaWxkTm9kZXMubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICBfJGFwcGVuZChkZXN0LCBjaGlsZE5vZGVzW2ldKTtcclxuICAgIH1cclxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgYXR0cmlidXRlcy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgIHZhciBhdHRyID0gYXR0cmlidXRlc1tpXTtcclxuICAgICAgICBkZXN0LnNldEF0dHJpYnV0ZU5TKHNvdXJjZS5uYW1lc3BhY2VVUkksIGF0dHIubmFtZSwgYXR0ci52YWx1ZSk7XHJcbiAgICB9XHJcbiAgICBzb3VyY2UucGFyZW50RWxlbWVudC5yZXBsYWNlQ2hpbGQoZGVzdCwgc291cmNlKTtcclxuICAgIHJldHVybiBkZXN0O1xyXG59XHJcbmZ1bmN0aW9uIF8kcmVtb3ZlRWwoZWwsIHBhcmVudCkge1xyXG4gICAgdmFyIHJvb3QgPSBwYXJlbnQgfHwgZWwucGFyZW50RWxlbWVudDtcclxuICAgIGlmIChyb290KVxyXG4gICAgICAgIHJvb3QucmVtb3ZlQ2hpbGQoZWwpO1xyXG59XHJcbmZ1bmN0aW9uIF8kZWwodGFnTmFtZSkge1xyXG4gICAgcmV0dXJuIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQodGFnTmFtZSB8fCAnZGl2Jyk7XHJcbn1cclxuZnVuY3Rpb24gXyRzdmcodGFnTmFtZSkge1xyXG4gICAgcmV0dXJuIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnROUygnaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnLCB0YWdOYW1lIHx8ICdzdmcnKTtcclxufVxyXG5mdW5jdGlvbiBfJHRleHQoY29udGVudCkge1xyXG4gICAgcmV0dXJuIGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKGNvbnRlbnQgfHwgJycpO1xyXG59XHJcbmZ1bmN0aW9uIF8kY29tbWVudChjb250ZW50KSB7XHJcbiAgICByZXR1cm4gZG9jdW1lbnQuY3JlYXRlQ29tbWVudChjb250ZW50IHx8ICcnKTtcclxufVxyXG5mdW5jdGlvbiBfJHNldEF0dHIoZWwsIGF0dHJBbmRWYWx1ZSkge1xyXG4gICAgdmFyIGF0dHIgPSBhdHRyQW5kVmFsdWVbMF0sIHZhbHVlID0gYXR0ckFuZFZhbHVlWzFdO1xyXG4gICAgZWwuc2V0QXR0cmlidXRlKGF0dHIsIF8kdG9TdHJpbmcodmFsdWUpKTtcclxuICAgIGlmIChfJGlzVmFsdWVBdHRyKGF0dHIpICYmICFfJGlzU3RyaW5nKHZhbHVlKSlcclxuICAgICAgICBlbFtQUk9QX01BUC5fXSA9IHZhbHVlO1xyXG59XHJcbmZ1bmN0aW9uIF8kZ2V0QXR0cihlbCwgYXR0cikge1xyXG4gICAgcmV0dXJuIF8kaXNWYWx1ZUF0dHIoYXR0cikgPyBfJGdldFZhbHVlKGVsKSA6IGVsLmdldEF0dHJpYnV0ZShhdHRyKTtcclxufVxyXG5mdW5jdGlvbiBfJGdldFZhbHVlKGVsKSB7XHJcbiAgICByZXR1cm4gXyRoYXNQcm9wKGVsLCBQUk9QX01BUC5fKSA/IGVsW1BST1BfTUFQLl9dIDogZWxbUFJPUF9NQVAudl07XHJcbn1cclxuZnVuY3Rpb24gXyRhZGRMaXN0ZW5lcihlbCwgZXZlbnQsIGhhbmRsZXIpIHtcclxuICAgIGVsLmFkZEV2ZW50TGlzdGVuZXIoZXZlbnQsIGhhbmRsZXIsIGZhbHNlKTtcclxufVxyXG5mdW5jdGlvbiBfJHVwZGF0ZUxpc3RlbmVyKGVsLCBldmVudCwgb2xkSGFuZGxlciwgbmV3SGFuZGxlcikge1xyXG4gICAgXyRyZW1vdmVMaXN0ZW5lcihlbCwgZXZlbnQsIG9sZEhhbmRsZXIpO1xyXG4gICAgXyRhZGRMaXN0ZW5lcihlbCwgZXZlbnQsIG9sZEhhbmRsZXIgPSBuZXdIYW5kbGVyKTtcclxuICAgIHJldHVybiBvbGRIYW5kbGVyO1xyXG59XHJcbmZ1bmN0aW9uIF8kcmVtb3ZlTGlzdGVuZXIoZWwsIGV2ZW50LCBoYW5kbGVyKSB7XHJcbiAgICBlbC5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LCBoYW5kbGVyLCBmYWxzZSk7XHJcbn1cclxuZnVuY3Rpb24gXyRiaW5kR3JvdXAoaW5wdXQsIHNlbGVjdGlvbikge1xyXG4gICAgdmFyIF92YWx1ZSA9IF8kZ2V0VmFsdWUoaW5wdXQpO1xyXG4gICAgdmFyIF8kaW5kZXggPSBzZWxlY3Rpb24uaW5kZXhPZihfdmFsdWUpO1xyXG4gICAgaW5wdXQuY2hlY2tlZCAmJiAhfl8kaW5kZXggPyBzZWxlY3Rpb24ucHVzaChfdmFsdWUpIDogc2VsZWN0aW9uLnNwbGljZShfJGluZGV4LCAxKTtcclxufVxyXG5mdW5jdGlvbiBfJGJpbmRNdWx0aVNlbGVjdChzZWxlY3QsIHNlbGVjdGlvbnMpIHtcclxuICAgIGlmICghc2VsZWN0aW9ucy5sZW5ndGgpXHJcbiAgICAgICAgcmV0dXJuO1xyXG4gICAgdmFyIG9wdGlvbnMgPSBzZWxlY3Qub3B0aW9ucztcclxuICAgIGZvciAodmFyIGkgPSAwOyBpIDwgb3B0aW9ucy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgIG9wdGlvbnNbaV0uc2VsZWN0ZWQgPSAhIX5zZWxlY3Rpb25zLmluZGV4T2YoXyRnZXRWYWx1ZShvcHRpb25zW2ldKSk7XHJcbiAgICB9XHJcbn1cclxuZnVuY3Rpb24gXyR1cGRhdGVNdWx0aVNlbGVjdChzZWxlY3QsIG9iaiwgcHJvcCkge1xyXG4gICAgdmFyIGl0ZW1zID0gW107XHJcbiAgICB2YXIgc2VsZWN0aW9uID0gb2JqW3Byb3BdO1xyXG4gICAgdmFyIHNlbGVjdGVkT3B0aW9ucyA9IHNlbGVjdC5zZWxlY3RlZE9wdGlvbnM7XHJcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHNlbGVjdGVkT3B0aW9ucy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgIGl0ZW1zLnB1c2goXyRnZXRWYWx1ZShzZWxlY3RlZE9wdGlvbnNbaV0pKTtcclxuICAgIH1cclxuICAgIG9ialtwcm9wXSA9IG5ldyBfJExpc3QoaXRlbXMsIHNlbGVjdGlvblsnX3Jvb3QnXSwgc2VsZWN0aW9uWydfa2V5J10pO1xyXG4gICAgb2JqLiR1cGRhdGUoKTtcclxufVxyXG5mdW5jdGlvbiBfJGluc2VydFN0eWxlKGlkLCBjc3MpIHtcclxuICAgIHZhciBpc05ldyA9IGZhbHNlO1xyXG4gICAgdmFyIHN0eWxlID0gXyRzZWxlY3QoXCIjXCIgKyBpZCwgZG9jdW1lbnQuaGVhZCk7XHJcbiAgICBpZiAoIXN0eWxlKSB7XHJcbiAgICAgICAgaXNOZXcgPSB0cnVlO1xyXG4gICAgICAgIHN0eWxlID0gXyRlbCgnc3R5bGUnKTtcclxuICAgICAgICBzdHlsZS5pZCA9IGlkO1xyXG4gICAgICAgIF8kc2V0QXR0cihzdHlsZSwgWydyZWZzJywgMV0pO1xyXG4gICAgfVxyXG4gICAgaWYgKHN0eWxlLnRleHRDb250ZW50ICE9PSBjc3MpIHtcclxuICAgICAgICBzdHlsZS50ZXh0Q29udGVudCA9IGNzcztcclxuICAgIH1cclxuICAgIGlmIChpc05ldykge1xyXG4gICAgICAgIF8kYXBwZW5kKGRvY3VtZW50LmhlYWQsIHN0eWxlKTtcclxuICAgIH1cclxuICAgIGVsc2Uge1xyXG4gICAgICAgIHZhciBjb3VudCA9ICtfJGdldEF0dHIoc3R5bGUsICdyZWZzJyk7XHJcbiAgICAgICAgXyRzZXRBdHRyKHN0eWxlLCBbJ3JlZnMnLCArK2NvdW50XSk7XHJcbiAgICB9XHJcbn1cclxuZnVuY3Rpb24gXyRyZW1vdmVTdHlsZShpZCkge1xyXG4gICAgdmFyIHN0eWxlID0gXyRzZWxlY3QoXCIjXCIgKyBpZCwgZG9jdW1lbnQuaGVhZCk7XHJcbiAgICBpZiAoc3R5bGUpIHtcclxuICAgICAgICB2YXIgY291bnQgPSArXyRnZXRBdHRyKHN0eWxlLCAncmVmcycpO1xyXG4gICAgICAgIGlmICgtLWNvdW50ID09PSAwKSB7XHJcbiAgICAgICAgICAgIF8kcmVtb3ZlRWwoc3R5bGUsIGRvY3VtZW50LmhlYWQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgXyRzZXRBdHRyKHN0eWxlLCBbJ3JlZnMnLCBjb3VudF0pO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxufVxuXG5mdW5jdGlvbiBfJHRvTG93ZXJDYXNlKHN0cikge1xyXG4gICAgcmV0dXJuIHN0ci50b0xvd2VyQ2FzZSgpO1xyXG59XHJcbnZhciBfJGFzc2lnbiA9IE9iamVjdFsnYXNzaWduJ10gfHwgZnVuY3Rpb24gKHQpIHtcclxuICAgIGZvciAodmFyIHMgPSB2b2lkIDAsIGkgPSAxLCBuID0gYXJndW1lbnRzLmxlbmd0aDsgaSA8IG47IGkrKykge1xyXG4gICAgICAgIHMgPSBhcmd1bWVudHNbaV07XHJcbiAgICAgICAgZm9yICh2YXIgcCBpbiBzKVxyXG4gICAgICAgICAgICBpZiAoXyRoYXNQcm9wKHMsIHApKVxyXG4gICAgICAgICAgICAgICAgdFtwXSA9IHNbcF07XHJcbiAgICB9XHJcbiAgICByZXR1cm4gdDtcclxufTtcclxuZnVuY3Rpb24gXyRhcHBseShjYWxsZWUsIGFyZ3MsIGdsb2JzLCB0aGlzQXJnKSB7XHJcbiAgICBpZiAodGhpc0FyZyA9PT0gdm9pZCAwKSB7IHRoaXNBcmcgPSBudWxsOyB9XHJcbiAgICByZXR1cm4gY2FsbGVlLmFwcGx5KHRoaXNBcmcsIGFyZ3MuY29uY2F0KGdsb2JzKSk7XHJcbn1cclxuZnVuY3Rpb24gXyRpc1ZhbHVlQXR0cihhdHRyKSB7XHJcbiAgICByZXR1cm4gYXR0ciA9PT0gJ3ZhbHVlJztcclxufVxyXG5mdW5jdGlvbiBfJHN1YnNjcmliZXJzKGRlcCwgbGlzdGVuZXIpIHtcclxuICAgIGlmICghdGhpc1tQUk9QX01BUC5zXVtkZXBdKSB7XHJcbiAgICAgICAgdGhpc1tQUk9QX01BUC5zXVtkZXBdID0gW107XHJcbiAgICB9XHJcbiAgICByZXR1cm4gdGhpc1tQUk9QX01BUC5zXVtkZXBdLnB1c2gobGlzdGVuZXIuYmluZCh0aGlzKSkgLSAxO1xyXG59XHJcbmZ1bmN0aW9uIF8kZGVmaW5lKG9iaiwga2V5LCBkZXNjKSB7XHJcbiAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqLCBrZXksIGRlc2MpO1xyXG59XHJcbmZ1bmN0aW9uIF8kZGlzcGF0Y2gocm9vdCwga2V5LCBvbGRWYWwsIHZhbHVlKSB7XHJcbiAgICByb290LiRub3RpZnkoa2V5KTtcclxuICAgIGlmIChyb290W1BST1BfTUFQLnddW2tleV0pIHtcclxuICAgICAgICBfJGVhY2gocm9vdFtQUk9QX01BUC53XVtrZXldLCBmdW5jdGlvbiAod2F0Y2hlcikgeyB3YXRjaGVyKG9sZFZhbCwgdmFsdWUpOyB9KTtcclxuICAgIH1cclxuICAgIHJvb3QuJHVwZGF0ZSgpO1xyXG59XHJcbmZ1bmN0aW9uIF8kZXh0ZW5kcyhjdG9yLCBleHRzKSB7XHJcbiAgICBjdG9yW1BST1BfTUFQLmhdID0gT2JqZWN0LmNyZWF0ZShleHRzW1BST1BfTUFQLmhdKTtcclxuICAgIGN0b3JbUFJPUF9NQVAuaF0uY29uc3RydWN0b3IgPSBjdG9yO1xyXG59XHJcbmZ1bmN0aW9uIF8kaXNUeXBlKHZhbHVlLCB0eXBlKSB7XHJcbiAgICByZXR1cm4gXyR0eXBlKHR5cGUpID09PSAnc3RyaW5nJyA/IHR5cGUuc3BsaXQoJ1xcfCcpLnNvbWUoZnVuY3Rpb24gKHQpIHsgcmV0dXJuIHQudHJpbSgpID09PSBfJHR5cGUodmFsdWUpOyB9KSA6IHZhbHVlIGluc3RhbmNlb2YgdHlwZTtcclxufVxyXG5mdW5jdGlvbiBfJGlzT2JqZWN0KG9iaikge1xyXG4gICAgcmV0dXJuIF8kaXNUeXBlKG9iaiwgJ29iamVjdCcpO1xyXG59XHJcbmZ1bmN0aW9uIF8kaXNBcnJheShvYmopIHtcclxuICAgIHJldHVybiBBcnJheS5pc0FycmF5ID8gQXJyYXkuaXNBcnJheShvYmopIDogXyRpc1R5cGUob2JqLCAnYXJyYXknKTtcclxufVxyXG5mdW5jdGlvbiBfJGlzRnVuY3Rpb24ob2JqKSB7XHJcbiAgICByZXR1cm4gXyRpc1R5cGUob2JqLCAnZnVuY3Rpb24nKTtcclxufVxyXG5mdW5jdGlvbiBfJGlzU3RyaW5nKG9iaikge1xyXG4gICAgcmV0dXJuIF8kaXNUeXBlKG9iaiwgJ3N0cmluZycpO1xyXG59XHJcbmZ1bmN0aW9uIF8kdG9UeXBlKHZhbHVlLCB0eXBlLCByb290LCBrZXkpIHtcclxuICAgIHN3aXRjaCAodHlwZSkge1xyXG4gICAgICAgIGNhc2UgJ2RhdGUnOlxyXG4gICAgICAgICAgICByZXR1cm4gbmV3IERhdGUodmFsdWUpO1xyXG4gICAgICAgIGNhc2UgJ3N0cmluZyc6XHJcbiAgICAgICAgICAgIHJldHVybiBfJHRvU3RyaW5nKHZhbHVlKTtcclxuICAgICAgICBjYXNlICdudW1iZXInOlxyXG4gICAgICAgICAgICByZXR1cm4gK3ZhbHVlO1xyXG4gICAgICAgIGNhc2UgJ2Jvb2xlYW4nOlxyXG4gICAgICAgICAgICByZXR1cm4gXyRpc1N0cmluZyh2YWx1ZSkgJiYgIXZhbHVlID8gdHJ1ZSA6ICEhdmFsdWU7XHJcbiAgICAgICAgY2FzZSAnYXJyYXknOlxyXG4gICAgICAgICAgICByZXR1cm4gXyRpc1R5cGUodmFsdWUsIF8kTGlzdCkgPyB2YWx1ZSA6IG5ldyBfJExpc3QodmFsdWUsIHJvb3QsIGtleSk7XHJcbiAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xyXG4gICAgfVxyXG59XHJcbmZ1bmN0aW9uIF8kdHlwZShvYmopIHtcclxuICAgIHJldHVybiBfJHRvTG93ZXJDYXNlKC8gKFxcdyspLy5leGVjKHt9LnRvU3RyaW5nLmNhbGwob2JqKSlbMV0pO1xyXG59XHJcbmZ1bmN0aW9uIF8kaGFzUHJvcChvYmosIHByb3ApIHtcclxuICAgIHJldHVybiBvYmouaGFzT3duUHJvcGVydHkocHJvcCk7XHJcbn1cclxuZnVuY3Rpb24gXyRkaXJlY3RpdmUoZGQpIHtcclxuICAgIHZhciBoYXNQcm9wID0gZnVuY3Rpb24gKHByb3AsIGluc3RhbmNlLCBvcHRpb25zLCBlbGVtZW50KSB7IHJldHVybiBfJGlzT2JqZWN0KGRkKSAmJiBkZFtwcm9wXSAmJiBkZFtwcm9wXShpbnN0YW5jZSwgb3B0aW9ucywgZWxlbWVudCk7IH07XHJcbiAgICByZXR1cm4ge1xyXG4gICAgICAgICRpbml0OiBmdW5jdGlvbiAoaW5zdGFuY2UsIG9wdGlvbnMsIGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgaGFzUHJvcCgnJGluaXQnLCBpbnN0YW5jZSwgb3B0aW9ucywgZWxlbWVudCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICAkaW5zZXJ0ZWQ6IGZ1bmN0aW9uIChpbnN0YW5jZSwgb3B0aW9ucywgZWxlbWVudCkge1xyXG4gICAgICAgICAgICBoYXNQcm9wKCckaW5zZXJ0ZWQnLCBpbnN0YW5jZSwgb3B0aW9ucywgZWxlbWVudCk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICAkdXBkYXRlOiBmdW5jdGlvbiAoaW5zdGFuY2UsIG9wdGlvbnMsIGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgaWYgKF8kaXNGdW5jdGlvbihkZCkpIHtcclxuICAgICAgICAgICAgICAgIGRkKGluc3RhbmNlLCBvcHRpb25zLCBlbGVtZW50KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGhhc1Byb3AoJyR1cGRhdGUnLCBpbnN0YW5jZSwgb3B0aW9ucywgZWxlbWVudCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgICAgICRkZXN0cm95OiBmdW5jdGlvbiAoaW5zdGFuY2UsIG9wdGlvbnMsIGVsZW1lbnQpIHtcclxuICAgICAgICAgICAgaGFzUHJvcCgnJGRlc3Ryb3knLCBpbnN0YW5jZSwgb3B0aW9ucywgZWxlbWVudCk7XHJcbiAgICAgICAgfVxyXG4gICAgfTtcclxufVxyXG5mdW5jdGlvbiBfJG5vb3AoKSB7IH1cclxuZnVuY3Rpb24gXyRhZGRDaGlsZChpbnN0LCBDaGlsZCwgYXR0cnMpIHtcclxuICAgIHZhciBjaGlsZCA9IG51bGw7XHJcbiAgICBpZiAoQ2hpbGQpIHtcclxuICAgICAgICBjaGlsZCA9IG5ldyBDaGlsZChhdHRycywgaW5zdCk7XHJcbiAgICAgICAgaW5zdC4kY2hpbGRyZW4ucHVzaChjaGlsZCk7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gY2hpbGQ7XHJcbn1cclxuZnVuY3Rpb24gXyRyZW1vdmVDaGlsZChpbnN0LCBjaGlsZCkge1xyXG4gICAgdmFyIGluZGV4ID0gaW5zdC4kY2hpbGRyZW4uaW5kZXhPZihjaGlsZCk7XHJcbiAgICBpbmRleCA+PSAwICYmIGluc3QuJGNoaWxkcmVuLnNwbGljZShpbmRleCwgMSk7XHJcbn1cclxuZnVuY3Rpb24gXyR0b1N0cmluZyhvYmopIHtcclxuICAgIHZhciBzdHIgPSBfJHR5cGUob2JqKTtcclxuICAgIHJldHVybiAhL251bGx8dW5kZWZpbmVkLy50ZXN0KHN0cikgPyBvYmoudG9TdHJpbmcoKSA6IHN0cjtcclxufVxyXG5mdW5jdGlvbiBfJHRvUGxhaW5PYmplY3Qob2JqKSB7XHJcbiAgICB2YXIgZGF0YSA9IHt9O1xyXG4gICAgXyRlYWNoKF8kaXNPYmplY3Qob2JqKSA/IG9iaiA6IHt9LCBmdW5jdGlvbiAoX3YsIGspIHtcclxuICAgICAgICBpZiAoa1swXSAhPT0gJyQnICYmICFfJGlzRnVuY3Rpb24ob2JqW2tdKSkge1xyXG4gICAgICAgICAgICBpZiAoXyRpc1R5cGUob2JqW2tdLCBfJExpc3QpKSB7XHJcbiAgICAgICAgICAgICAgICBkYXRhW2tdID0gb2JqW2tdLm1hcChfJHRvUGxhaW5PYmplY3QpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2UgaWYgKF8kaXNPYmplY3Qob2JqW2tdKSkge1xyXG4gICAgICAgICAgICAgICAgZGF0YVtrXSA9IF8kdG9QbGFpbk9iamVjdChvYmpba10pO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgZGF0YVtrXSA9IG9ialtrXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH0pO1xyXG4gICAgcmV0dXJuIF8kaXNPYmplY3Qob2JqKSA/IGRhdGEgOiBvYmo7XHJcbn1cclxuZnVuY3Rpb24gXyRzZXRSZWZlcmVuY2UocmVmcywgcHJvcCwgbm9kZSkge1xyXG4gICAgaWYgKCFfJGhhc1Byb3AocmVmcywgcHJvcCkpIHtcclxuICAgICAgICB2YXIgdmFsdWVfMSA9IFtdO1xyXG4gICAgICAgIF8kZGVmaW5lKHJlZnMsIHByb3AsIHtcclxuICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7IHJldHVybiB2YWx1ZV8xLmxlbmd0aCA8PSAxID8gdmFsdWVfMVswXSA6IHZhbHVlXzE7IH0sXHJcbiAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKHZhbCkgeyB2YWwgJiYgIX52YWx1ZV8xLmluZGV4T2YodmFsKSAmJiB2YWx1ZV8xLnB1c2godmFsKTsgfSxcclxuICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwgY29uZmlndXJhYmxlOiB0cnVlXHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcbiAgICByZWZzW3Byb3BdID0gbm9kZTtcclxufVxyXG5mdW5jdGlvbiBfJGFjY2Vzb3Iob2JqZWN0LCBwYXRoLCB2YWx1ZSkge1xyXG4gICAgcmV0dXJuIHBhdGguc3BsaXQoJy4nKS5yZWR1Y2UoZnVuY3Rpb24gKG9iaiwga2V5LCBpLCBhcnIpIHtcclxuICAgICAgICBpZiAoXyRpc1R5cGUodmFsdWUsICd1bmRlZmluZWQnKSkge1xyXG4gICAgICAgICAgICBpZiAob2JqID09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoMCwgYXJyLmxlbmd0aCk7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gaSA+IDAgJiYgb2JqID09PSBudWxsID8gb2JqIDogdW5kZWZpbmVkO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBpZiAoaSA9PT0gYXJyLmxlbmd0aCAtIDEpIHtcclxuICAgICAgICAgICAgICAgIGlmIChfJGlzVHlwZShvYmosIF8kTGlzdCkgJiYgXyR0b1N0cmluZygra2V5KSA9PT0ga2V5KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb2JqLnB1bGwoK2tleSwgdmFsdWUpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIG9sZFZhbCA9IG9ialtrZXldO1xyXG4gICAgICAgICAgICAgICAgICAgIG9ialtrZXldID0gIV8kaXNUeXBlKHZhbHVlLCBfJExpc3QpICYmIF8kaXNBcnJheSh2YWx1ZSkgPyBuZXcgXyRMaXN0KHZhbHVlLCBvYmplY3QsIGtleSkgOiB2YWx1ZTtcclxuICAgICAgICAgICAgICAgICAgICBfJGRpc3BhdGNoKG9iamVjdCwgcGF0aCwgb2xkVmFsLCBvYmpba2V5XSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSBpZiAoIV8kaXNPYmplY3Qob2JqW2tleV0pKSB7XHJcbiAgICAgICAgICAgICAgICBvYmpba2V5XSA9IHt9O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBvYmogPyBvYmpba2V5XSA6IG51bGw7XHJcbiAgICB9LCBvYmplY3QpO1xyXG59XHJcbmZ1bmN0aW9uIF8kZW1wdHlFbHNlKCkge1xyXG4gICAgcmV0dXJuIHsgdHlwZTogJ2VtcHR5LWVsc2UnLCAkY3JlYXRlOiBfJG5vb3AsICRtb3VudDogXyRub29wLCAkdXBkYXRlOiBfJG5vb3AsICRkZXN0cm95OiBfJG5vb3AgfTtcclxufVxyXG5mdW5jdGlvbiBfJGlzS2V5KGV2ZW50LCBrZXkpIHtcclxuICAgIHJldHVybiBfJHRvTG93ZXJDYXNlKGV2ZW50LmtleSkgPT09IGtleSB8fCAhIWV2ZW50W2tleSArIFwiS2V5XCJdO1xyXG59XHJcbmZ1bmN0aW9uIF8kYmluZENsYXNzZXModmFsdWUpIHtcclxuICAgIHZhciBjbGFzc2VzID0gJyc7XHJcbiAgICBpZiAoXyRpc1N0cmluZyh2YWx1ZSkpIHtcclxuICAgICAgICBjbGFzc2VzICs9IFwiIFwiICsgdmFsdWU7XHJcbiAgICB9XHJcbiAgICBlbHNlIGlmIChfJGlzQXJyYXkodmFsdWUpKSB7XHJcbiAgICAgICAgY2xhc3NlcyA9IHZhbHVlLm1hcChfJGJpbmRDbGFzc2VzKS5qb2luKCcgJyk7XHJcbiAgICB9XHJcbiAgICBlbHNlIGlmIChfJGlzT2JqZWN0KHZhbHVlKSkge1xyXG4gICAgICAgIGZvciAodmFyIGtleSBpbiB2YWx1ZSlcclxuICAgICAgICAgICAgaWYgKF8kaGFzUHJvcCh2YWx1ZSwga2V5KSAmJiB2YWx1ZVtrZXldKVxyXG4gICAgICAgICAgICAgICAgY2xhc3NlcyArPSBcIiBcIiArIGtleTtcclxuICAgIH1cclxuICAgIHJldHVybiBjbGFzc2VzLnRyaW0oKTtcclxufVxyXG5mdW5jdGlvbiBfJGJpbmRTdHlsZSh2YWx1ZSkge1xyXG4gICAgdmFyIGVsID0gXyRlbCgpO1xyXG4gICAgaWYgKF8kaXNPYmplY3QodmFsdWUpKSB7XHJcbiAgICAgICAgdmFyIHN0eWxlXzEgPSBlbC5zdHlsZTtcclxuICAgICAgICBfJGVhY2godmFsdWUsIGZ1bmN0aW9uICh2YWwsIHByb3ApIHtcclxuICAgICAgICAgICAgaWYgKHZhbCAhPT0gc3R5bGVfMVtwcm9wXSlcclxuICAgICAgICAgICAgICAgIHN0eWxlXzFbcHJvcF0gPSB2YWw7XHJcbiAgICAgICAgfSk7XHJcbiAgICAgICAgcmV0dXJuIHN0eWxlXzEuY3NzVGV4dDtcclxuICAgIH1cclxuICAgIGVsc2UgaWYgKF8kaXNTdHJpbmcodmFsdWUpKSB7XHJcbiAgICAgICAgcmV0dXJuIHZhbHVlO1xyXG4gICAgfVxyXG4gICAgZWxzZSB7XHJcbiAgICAgICAgcmV0dXJuICcnO1xyXG4gICAgfVxyXG59XHJcbmZ1bmN0aW9uIF8kY29uZGl0aW9uYWxVcGRhdGUoYmxvY2ssIGNvbmRpdGlvbiwgcGFyZW50LCBhbmNob3IsIGluc3QpIHtcclxuICAgIHZhciBnbG9icyA9IF8kdG9BcmdzKGFyZ3VtZW50cywgNSk7XHJcbiAgICBpZiAoYmxvY2sgJiYgYmxvY2sudHlwZSA9PT0gXyRhcHBseShjb25kaXRpb24sIFtpbnN0XSwgZ2xvYnMpLnR5cGUpIHtcclxuICAgICAgICBfJGFwcGx5KGJsb2NrLiR1cGRhdGUsIFtpbnN0XSwgZ2xvYnMsIGJsb2NrKTtcclxuICAgIH1cclxuICAgIGVsc2Uge1xyXG4gICAgICAgIGJsb2NrICYmIGJsb2NrLiRkZXN0cm95KCk7XHJcbiAgICAgICAgYmxvY2sgPSBfJGFwcGx5KGNvbmRpdGlvbiwgW2luc3RdLCBnbG9icyk7XHJcbiAgICAgICAgYmxvY2suJGNyZWF0ZSgpO1xyXG4gICAgICAgIGJsb2NrLiRtb3VudChwYXJlbnQgfHwgaW5zdC4kcGFyZW50RWwsIGFuY2hvcik7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gYmxvY2s7XHJcbn1cclxuZnVuY3Rpb24gXyRiaW5kVXBkYXRlKGVsLCBiaW5kaW5nKSB7XHJcbiAgICB2YXIgYXR0ciA9IGJpbmRpbmdbMF0sIHZhbHVlID0gYmluZGluZ1sxXTtcclxuICAgIHZhciBfdmFsdWUgPSBfJHRvU3RyaW5nKHZhbHVlKTtcclxuICAgIGlmIChfJGlzVmFsdWVBdHRyKGF0dHIpKSB7XHJcbiAgICAgICAgaWYgKGVsW2F0dHJdICE9PSBfdmFsdWUpXHJcbiAgICAgICAgICAgIGVsW2F0dHJdID0gX3ZhbHVlO1xyXG4gICAgICAgIGVsW1BST1BfTUFQLl9dID0gdmFsdWU7XHJcbiAgICB9XHJcbiAgICBlbHNlIGlmIChfJGdldEF0dHIoZWwsIGF0dHIpICE9PSBfdmFsdWUpIHtcclxuICAgICAgICBfJHNldEF0dHIoZWwsIFthdHRyLCBfdmFsdWVdKTtcclxuICAgIH1cclxufVxyXG5mdW5jdGlvbiBfJGJpbmRCb29sZWFuQXR0cihlbCwgYXR0ckFuZFZhbHVlKSB7XHJcbiAgICB2YXIgYXR0ciA9IGF0dHJBbmRWYWx1ZVswXSwgdmFsdWUgPSBhdHRyQW5kVmFsdWVbMV07XHJcbiAgICBlbFthdHRyXSA9IHZhbHVlID09IG51bGwgfHwgdmFsdWUgPT09IGZhbHNlID8gKGVsLnJlbW92ZUF0dHJpYnV0ZShhdHRyKSwgZmFsc2UpIDogKF8kc2V0QXR0cihlbCwgW2F0dHIsICcnXSksIHRydWUpO1xyXG59XHJcbmZ1bmN0aW9uIF8kdGV4dFVwZGF0ZSh0ZXh0LCB2YWx1ZSkge1xyXG4gICAgaWYgKHRleHQuZGF0YSAhPT0gKHZhbHVlID0gXyR0b1N0cmluZyh2YWx1ZSkpKVxyXG4gICAgICAgIHRleHQuZGF0YSA9IHZhbHVlO1xyXG59XHJcbmZ1bmN0aW9uIF8kdGFnVXBkYXRlKG5vZGUsIHRhZykge1xyXG4gICAgcmV0dXJuIF8kdG9Mb3dlckNhc2UodGFnKSAhPT0gXyR0b0xvd2VyQ2FzZShub2RlLnRhZ05hbWUpID8gXyRhc3NpZ25FbChub2RlLCBfJGVsKHRhZykpIDogbm9kZTtcclxufVxyXG5mdW5jdGlvbiBfJHJlbW92ZVJlZmVyZW5jZShyZWZzLCBwcm9wLCBub2RlKSB7XHJcbiAgICB2YXIgbm9kZXMgPSByZWZzW3Byb3BdO1xyXG4gICAgXyRpc0FycmF5KG5vZGVzKSA/IHJlZnNbcHJvcF0uc3BsaWNlKG5vZGVzLmluZGV4T2Yobm9kZSksIDEpIDogKGRlbGV0ZSByZWZzW3Byb3BdKTtcclxufVxyXG5mdW5jdGlvbiBfJGh0bWxVcGRhdGUobm9kZSwgdmFsdWUpIHtcclxuICAgIGlmIChub2RlLmlubmVySFRNTCAhPT0gKHZhbHVlID0gXyR0b1N0cmluZyh2YWx1ZSkpKVxyXG4gICAgICAgIG5vZGUuaW5uZXJIVE1MID0gdmFsdWU7XHJcbn1cclxuZnVuY3Rpb24gXyRjb21wb25lbnRVcGRhdGUocGFyZW50LCBDdG9yLCBpbnN0LCB2YWx1ZSwgYXR0cnMsIGVsLCBzaWJsaW5nKSB7XHJcbiAgICBpZiAodmFsdWUgPT09IEN0b3IpIHtcclxuICAgICAgICBpbnN0ICYmIGluc3QuJHVwZGF0ZSgpO1xyXG4gICAgfVxyXG4gICAgZWxzZSB7XHJcbiAgICAgICAgQ3RvciA9IHZhbHVlO1xyXG4gICAgICAgIGlmIChpbnN0KSB7XHJcbiAgICAgICAgICAgIGluc3QuJGRlc3Ryb3koKTtcclxuICAgICAgICAgICAgXyRyZW1vdmVDaGlsZChwYXJlbnQsIGluc3QpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAoaW5zdCkge1xyXG4gICAgICAgICAgICBpbnN0ID0gXyRhZGRDaGlsZChwYXJlbnQsIEN0b3IsIGF0dHJzKTtcclxuICAgICAgICAgICAgaW5zdC4kY3JlYXRlKCk7XHJcbiAgICAgICAgICAgIGluc3QuJG1vdW50KGVsLCBzaWJsaW5nKTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbiAgICByZXR1cm4gW2luc3QsIEN0b3JdO1xyXG59XHJcbmZ1bmN0aW9uIF8kZGVzdHJveUNvbXBvbmVudChjb21wb25lbnQpIHtcclxuICAgIGNvbXBvbmVudC4kdW5tb3VudCgpO1xyXG4gICAgY29tcG9uZW50LiRwYXJlbnQgPSBudWxsO1xyXG4gICAgY29tcG9uZW50LiRwYXJlbnRFbCA9IG51bGw7XHJcbiAgICBjb21wb25lbnQuJHNpYmxpbmdFbCA9IG51bGw7XHJcbiAgICBjb21wb25lbnQuJGNoaWxkcmVuLnNwbGljZSgwLCBjb21wb25lbnQuJGNoaWxkcmVuLmxlbmd0aCk7XHJcbn1cclxuZnVuY3Rpb24gXyRzZXRFbGVtZW50cyhjb21wb25lbnQsIHBhcmVudCwgc2libGluZykge1xyXG4gICAgdmFyIGJyb3RoZXIgPSBfJHNlbGVjdChzaWJsaW5nKTtcclxuICAgIGNvbXBvbmVudC4kc2libGluZ0VsID0gYnJvdGhlcjtcclxuICAgIGNvbXBvbmVudC4kcGFyZW50RWwgPSBzaWJsaW5nICYmIGJyb3RoZXIucGFyZW50RWxlbWVudCB8fCBfJHNlbGVjdChwYXJlbnQpO1xyXG59XHJcbmZ1bmN0aW9uIF8kZm9yTG9vcChyb290LCBvYmosIGxvb3ApIHtcclxuICAgIHZhciBpdGVtcyA9IHt9LCBsb29wUGFyZW50LCBsb29wU2libGluZztcclxuICAgIHZhciBnbG9icyA9IF8kdG9BcmdzKGFyZ3VtZW50cywgMyk7XHJcbiAgICBfJGVhY2gob2JqLCBmdW5jdGlvbiAoaXRlbSwgaSwgaW5kZXgpIHsgaXRlbXNbaV0gPSBfJGFwcGx5KGxvb3AsIFtyb290LCBpdGVtLCBpLCBpbmRleF0sIGdsb2JzKTsgfSk7XHJcbiAgICByZXR1cm4ge1xyXG4gICAgICAgICRjcmVhdGU6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgXyRlYWNoKGl0ZW1zLCBmdW5jdGlvbiAoaXRlbSkgeyBpdGVtLiRjcmVhdGUoKTsgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICAkbW91bnQ6IGZ1bmN0aW9uIChwYXJlbnQsIHNpYmxpbmcpIHtcclxuICAgICAgICAgICAgbG9vcFBhcmVudCA9IF8kc2VsZWN0KHBhcmVudCk7XHJcbiAgICAgICAgICAgIGxvb3BTaWJsaW5nID0gXyRzZWxlY3Qoc2libGluZyk7XHJcbiAgICAgICAgICAgIF8kZWFjaChpdGVtcywgZnVuY3Rpb24gKGl0ZW0pIHsgaXRlbS4kbW91bnQobG9vcFBhcmVudCwgbG9vcFNpYmxpbmcpOyB9KTtcclxuICAgICAgICB9LFxyXG4gICAgICAgICR1cGRhdGU6IGZ1bmN0aW9uIChyb290LCBvYmopIHtcclxuICAgICAgICAgICAgdmFyIGdsb2JzID0gXyR0b0FyZ3MoYXJndW1lbnRzLCAyKTtcclxuICAgICAgICAgICAgXyRlYWNoKGl0ZW1zLCBmdW5jdGlvbiAoaXRlbSwgaSwgaW5kZXgpIHtcclxuICAgICAgICAgICAgICAgIGlmIChvYmpbaV0pIHtcclxuICAgICAgICAgICAgICAgICAgICBfJGFwcGx5KGl0ZW0uJHVwZGF0ZSwgW3Jvb3QsIG9ialtpXSwgaSwgaW5kZXhdLCBnbG9icywgaXRlbSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpdGVtLiRkZXN0cm95KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGl0ZW1zW2ldO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgXyRlYWNoKG9iaiwgZnVuY3Rpb24gKGl0ZW0sIGksIGluZGV4KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIWl0ZW1zW2ldKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaXRlbXNbaV0gPSBfJGFwcGx5KGxvb3AsIFtyb290LCBpdGVtLCBpLCBpbmRleF0sIGdsb2JzKTtcclxuICAgICAgICAgICAgICAgICAgICBpdGVtc1tpXS4kY3JlYXRlKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaXRlbXNbaV0uJG1vdW50KGxvb3BQYXJlbnQsIGxvb3BTaWJsaW5nKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICAkZGVzdHJveTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICBfJGVhY2goaXRlbXMsIGZ1bmN0aW9uIChpdGVtKSB7IGl0ZW0uJGRlc3Ryb3koKTsgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgfTtcclxufVxyXG5mdW5jdGlvbiBfJGVhY2gob2JqLCBjYikge1xyXG4gICAgdmFyIGkgPSAwO1xyXG4gICAgZm9yICh2YXIga2V5IGluIG9iaikge1xyXG4gICAgICAgIGlmIChfJGhhc1Byb3Aob2JqLCBrZXkpKSB7XHJcbiAgICAgICAgICAgIGNiKG9ialtrZXldLCAoaXNOYU4oK2tleSkgPyBrZXkgOiAra2V5KSwgaSsrKTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbn1cblxuZnVuY3Rpb24gXyRCYXNlQ29tcG9uZW50KGF0dHJzLCB0ZW1wbGF0ZSwgb3B0aW9ucywgcGFyZW50KSB7XHJcbiAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICB2YXIgXyRzZXQgPSBmdW5jdGlvbiAocHJvcCwgdmFsdWUpIHsgXyRkZWZpbmUoc2VsZiwgcHJvcCwgeyB2YWx1ZTogdmFsdWUsIHdyaXRhYmxlOiB0cnVlIH0pOyB9O1xyXG4gICAgaWYgKCFhdHRycylcclxuICAgICAgICBhdHRycyA9IHt9O1xyXG4gICAgXyRlYWNoKFBST1BTLCBmdW5jdGlvbiAocHJvcCkgeyBfJGRlZmluZShzZWxmLCBwcm9wLCB7IHZhbHVlOiB7fSB9KTsgfSk7XHJcbiAgICBfJHNldCgnJHBhcmVudCcsIHBhcmVudCB8fCBudWxsKTtcclxuICAgIF8kc2V0KCckY2hpbGRyZW4nLCBbXSk7XHJcbiAgICBfJHNldChQUk9QX01BUC5zLCB7fSk7XHJcbiAgICBfJHNldCgnJG9wdGlvbnMnLCBvcHRpb25zKTtcclxuICAgIHZhciBvcHRzID0gc2VsZi4kb3B0aW9ucztcclxuICAgIGlmICghb3B0cy5hdHRycylcclxuICAgICAgICBvcHRzLmF0dHJzID0ge307XHJcbiAgICBpZiAoIW9wdHMuY2hpbGRyZW4pXHJcbiAgICAgICAgb3B0cy5jaGlsZHJlbiA9IHt9O1xyXG4gICAgXyRlYWNoKFRQUywgZnVuY3Rpb24gKHBsdWdpbikgeyBwbHVnaW4uZm4uY2FsbChzZWxmLCBfJEJhc2VDb21wb25lbnQsIHBsdWdpbi5vcHRpb25zKTsgfSk7XHJcbiAgICBpZiAob3B0cy5maWx0ZXJzKVxyXG4gICAgICAgIF8kYXNzaWduKHNlbGYuJGZpbHRlcnMsIG9wdHMuZmlsdGVycyk7XHJcbiAgICBpZiAob3B0cy5kaXJlY3RpdmVzKVxyXG4gICAgICAgIF8kZWFjaChvcHRzLmRpcmVjdGl2ZXMsIGZ1bmN0aW9uIChkcnQsIGspIHsgc2VsZi4kZGlyZWN0aXZlc1trXSA9IF8kZGlyZWN0aXZlKGRydCk7IH0pO1xyXG4gICAgXyRlYWNoKG9wdHMuYXR0cnMsIGZ1bmN0aW9uIChhdHRyT3BzLCBrZXkpIHtcclxuICAgICAgICBfJGRlZmluZShzZWxmLCAoXyRpc1R5cGUoa2V5LCAnbnVtYmVyJykgPyBhdHRyT3BzIDoga2V5KSwge1xyXG4gICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIGlmIChfJGlzU3RyaW5nKGF0dHJPcHMpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gYXR0cnNbYXR0ck9wc107XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8kaXNGdW5jdGlvbih2YWx1ZSkgPyB2YWx1ZSgpIDogdmFsdWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIV8kaGFzUHJvcChhdHRycywga2V5KSAmJiBhdHRyT3BzLnJlcXVpcmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zb2xlLmVycm9yKFwiQXR0cmlidXRlICdcIiArIGtleSArIFwiJyBpcyByZXF1aXJlZC5cIik7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBfJGlzRnVuY3Rpb24oYXR0cnNba2V5XSkgPyBhdHRyc1trZXldKCkgOiBhdHRyc1trZXldO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT09IHZvaWQgMCAmJiBfJGhhc1Byb3AoYXR0ck9wcywgJ2RlZmF1bHQnKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRlZiA9IGF0dHJPcHMuZGVmYXVsdDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlID0gXyRpc0Z1bmN0aW9uKGRlZikgPyBkZWYoKSA6IGRlZjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdHlwID0gYXR0ck9wcy50eXBlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwICYmICFfJGlzVHlwZSh2YWx1ZSwgdHlwKSAmJiBhdHRyT3BzLnJlcXVpcmVkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29uc29sZS5lcnJvcihcIkF0dHJpYnV0ZSAnXCIgKyBrZXkgKyBcIicgbXVzdCBiZSB0eXBlICdcIiArIHR5cCArIFwiJy5cIik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgPSBfJHRvVHlwZSh2YWx1ZSwgdmFsdWUgPT09IHZvaWQgMCA/ICd1bmRlZmluZWQnIDogdHlwLCBzZWxmLCBrZXkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUgIT09IHZvaWQgMCAmJiBfJGhhc1Byb3AoYXR0ck9wcywgJ3ZhbGlkYXRvcicpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdmFsaWRhdG9yID0gYXR0ck9wcy52YWxpZGF0b3I7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoXyRpc0Z1bmN0aW9uKHZhbGlkYXRvcikgJiYgIXZhbGlkYXRvcih2YWx1ZSkpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29uc29sZS5lcnJvcihcIkFzc2lnbWVudCAnXCIgKyBrZXkgKyBcIic9J1wiICsgSlNPTi5zdHJpbmdpZnkodmFsdWUpICsgXCInIGludmFsaWQuXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihcIidcIiArIGtleSArIFwiJyBpcyByZWFkIG9ubHkuXCIpO1xyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLCBjb25maWd1cmFibGU6IHRydWVcclxuICAgICAgICB9KTtcclxuICAgIH0pO1xyXG4gICAgdmFyIGRhdGEgPSBvcHRzLm1vZGVsIHx8IHt9O1xyXG4gICAgdmFyIF9sb29wXzEgPSBmdW5jdGlvbiAoa2V5KSB7XHJcbiAgICAgICAgaWYgKF8kaGFzUHJvcChkYXRhLCBrZXkpKSB7XHJcbiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihkYXRhLCBrZXkpO1xyXG4gICAgICAgICAgICBpZiAoZGVzYy52YWx1ZSAmJiBfJGlzQXJyYXkoZGVzYy52YWx1ZSkpIHtcclxuICAgICAgICAgICAgICAgIGRlc2MudmFsdWUgPSBuZXcgXyRMaXN0KGRlc2MudmFsdWUsIHNlbGYsIGtleSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoZGVzYy5nZXQpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZ2V0dGVyXzEgPSBkZXNjLmdldDtcclxuICAgICAgICAgICAgICAgICAgICBkZXNjLmdldCA9IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gZ2V0dGVyXzEuY2FsbChzZWxmKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF8kaXNBcnJheSh2YWx1ZSkpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IG5ldyBfJExpc3QodmFsdWUsIHNlbGYsIGtleSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgaWYgKGRlc2Muc2V0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHNldHRlcl8xID0gZGVzYy5zZXQ7XHJcbiAgICAgICAgICAgICAgICAgICAgZGVzYy5zZXQgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoXyRpc0FycmF5KHYpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdiA9IG5ldyBfJExpc3Qodiwgc2VsZiwga2V5KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGVyXzEuY2FsbChzZWxmLCB2KTtcclxuICAgICAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIF8kZGVmaW5lKHNlbGYsIGtleSwgZGVzYyk7XHJcbiAgICAgICAgfVxyXG4gICAgfTtcclxuICAgIGZvciAodmFyIGtleSBpbiBkYXRhKSB7XHJcbiAgICAgICAgX2xvb3BfMShrZXkpO1xyXG4gICAgfVxyXG4gICAgdmFyIHRwbCA9IHRlbXBsYXRlKHNlbGYpO1xyXG4gICAgXyRlYWNoKHRwbCwgZnVuY3Rpb24gKHZhbHVlLCBrZXkpIHtcclxuICAgICAgICBfJGRlZmluZShzZWxmLCBrZXksIHtcclxuICAgICAgICAgICAgdmFsdWU6IChmdW5jdGlvbiAoa2V5KSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgaG9vayA9IGtleVsxXS50b1VwcGVyQ2FzZSgpICsga2V5LnNsaWNlKDIpO1xyXG4gICAgICAgICAgICAgICAgdmFyIGJob29rID0gb3B0c1tcIndpbGxcIiArIGhvb2tdO1xyXG4gICAgICAgICAgICAgICAgdmFyIGFob29rID0gb3B0c1tcImRpZFwiICsgaG9va107XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGJob29rICYmIGJob29rLmNhbGwodGhpcyk7XHJcbiAgICAgICAgICAgICAgICAgICAga2V5ID09PSAnJHVwZGF0ZScgPyB2YWx1ZS5jYWxsKHRoaXMsIHRoaXMpIDogdmFsdWUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcclxuICAgICAgICAgICAgICAgICAgICBhaG9vayAmJiBhaG9vay5jYWxsKHRoaXMpO1xyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgfSkoa2V5KVxyXG4gICAgICAgIH0pO1xyXG4gICAgfSk7XHJcbiAgICBfJGRlZmluZShzZWxmLCAnJGRhdGEnLCB7XHJcbiAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBfJHRvUGxhaW5PYmplY3QodGhpcyk7XHJcbiAgICAgICAgfVxyXG4gICAgfSk7XHJcbn1cclxuXyRhc3NpZ24oXyRCYXNlQ29tcG9uZW50W1BST1BfTUFQLmhdLCB7XHJcbiAgICAkZ2V0OiBmdW5jdGlvbiAocGF0aCkge1xyXG4gICAgICAgIHJldHVybiBfJGFjY2Vzb3IodGhpcywgcGF0aCk7XHJcbiAgICB9LFxyXG4gICAgJHNldDogZnVuY3Rpb24gKHBhdGgsIHZhbHVlKSB7XHJcbiAgICAgICAgXyRhY2Nlc29yKHRoaXMsIHBhdGgsIHZhbHVlKTtcclxuICAgIH0sXHJcbiAgICAkb246IGZ1bmN0aW9uIChldmVudCwgaGFuZGxlcikge1xyXG4gICAgICAgIHZhciBfdGhpcyA9IHRoaXM7XHJcbiAgICAgICAgaWYgKCF0aGlzW1BST1BfTUFQLmVdW2V2ZW50XSkge1xyXG4gICAgICAgICAgICB0aGlzW1BST1BfTUFQLmVdW2V2ZW50XSA9IFtdO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgaSA9IHRoaXNbUFJPUF9NQVAuZV1bZXZlbnRdLnB1c2goaGFuZGxlcik7XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgJG9mZjogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgX3RoaXNbUFJPUF9NQVAuZV1bZXZlbnRdLnNwbGljZShpIC0gMSwgMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9O1xyXG4gICAgfSxcclxuICAgICRvbmNlOiBmdW5jdGlvbiAoZXZlbnQsIGhhbmRsZXIpIHtcclxuICAgICAgICB2YXIgZSA9IHRoaXMuJG9uKGV2ZW50LCBmdW5jdGlvbiAoYXJncykge1xyXG4gICAgICAgICAgICBoYW5kbGVyKGFyZ3MpO1xyXG4gICAgICAgICAgICBlLiRvZmYoKTtcclxuICAgICAgICB9KTtcclxuICAgIH0sXHJcbiAgICAkZmlyZTogZnVuY3Rpb24gKGV2ZW50LCBkYXRhKSB7XHJcbiAgICAgICAgaWYgKHRoaXNbUFJPUF9NQVAuZV1bZXZlbnRdKSB7XHJcbiAgICAgICAgICAgIF8kZWFjaCh0aGlzW1BST1BfTUFQLmVdW2V2ZW50XSwgZnVuY3Rpb24gKGhhbmRsZXIpIHsgaGFuZGxlcihkYXRhKTsgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgICRub3RpZnk6IGZ1bmN0aW9uIChrZXkpIHtcclxuICAgICAgICBpZiAodGhpc1tQUk9QX01BUC5zXVtrZXldKSB7XHJcbiAgICAgICAgICAgIF8kZWFjaCh0aGlzW1BST1BfTUFQLnNdW2tleV0sIGZ1bmN0aW9uIChzdXNjcmliZXIpIHsgc3VzY3JpYmVyKCk7IH0pO1xyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICAkb2JzZXJ2ZTogZnVuY3Rpb24gKGRlcHMsIGxpc3RlbmVyKSB7XHJcbiAgICAgICAgdmFyIF90aGlzID0gdGhpcztcclxuICAgICAgICB2YXIgc3VicyA9IFtdO1xyXG4gICAgICAgIGlmIChfJGlzQXJyYXkoZGVwcykpIHtcclxuICAgICAgICAgICAgXyRlYWNoKGRlcHMsIGZ1bmN0aW9uIChkZXApIHtcclxuICAgICAgICAgICAgICAgIHN1YnMucHVzaCh7IHN1YjogZGVwLCBpOiBfJHN1YnNjcmliZXJzLmNhbGwoX3RoaXMsIGRlcCwgbGlzdGVuZXIpIH0pO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgIHN1YnMucHVzaCh7IHN1YjogZGVwcywgaTogXyRzdWJzY3JpYmVycy5jYWxsKHRoaXMsIGRlcHMsIGxpc3RlbmVyKSB9KTtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgJHVub2JzZXJ2ZTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgXyRlYWNoKHN1YnMsIGZ1bmN0aW9uIChzdWIpIHtcclxuICAgICAgICAgICAgICAgICAgICBfdGhpc1tQUk9QX01BUC5zXVtzdWIuc3ViXS5zcGxpY2Uoc3ViLmksIDEpO1xyXG4gICAgICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9O1xyXG4gICAgfSxcclxuICAgICR3YXRjaDogZnVuY3Rpb24gKGtleSwgd2F0Y2hlcikge1xyXG4gICAgICAgIHZhciBfdGhpcyA9IHRoaXM7XHJcbiAgICAgICAgaWYgKCF0aGlzW1BST1BfTUFQLnddW2tleV0pIHtcclxuICAgICAgICAgICAgdGhpc1tQUk9QX01BUC53XVtrZXldID0gW107XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHZhciBpID0gdGhpc1tQUk9QX01BUC53XVtrZXldLnB1c2god2F0Y2hlci5iaW5kKHRoaXMpKTtcclxuICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAkdW53YXRjaDogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgX3RoaXNbUFJPUF9NQVAud11ba2V5XS5zcGxpY2UoaSAtIDEsIDEpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfTtcclxuICAgIH1cclxufSk7XHJcbmZ1bmN0aW9uIF8kQ3Rvcihtb2R1bGVOYW1lLCB0cGwsIG9wdGlvbnMpIHtcclxuICAgIHZhciBfYTtcclxuICAgIHZhciBjdG9yID0gKF9hID0ge30sXHJcbiAgICAgICAgX2FbbW9kdWxlTmFtZV0gPSBmdW5jdGlvbiAoXyRhdHRycywgXyRwYXJlbnQpIHtcclxuICAgICAgICAgICAgXyRCYXNlQ29tcG9uZW50LmNhbGwodGhpcywgXyRhdHRycywgdHBsLCBvcHRpb25zLCBfJHBhcmVudCk7XHJcbiAgICAgICAgICAgICFfJHBhcmVudCAmJiB0aGlzLiRjcmVhdGUoKTtcclxuICAgICAgICB9LFxyXG4gICAgICAgIF9hKVttb2R1bGVOYW1lXTtcclxuICAgIGN0b3IucGx1Z2luID0gZnVuY3Rpb24gKGZuLCBvcHRpb25zKSB7XHJcbiAgICAgICAgVFBTLnB1c2goeyBvcHRpb25zOiBvcHRpb25zLCBmbjogZm4gfSk7XHJcbiAgICB9O1xyXG4gICAgXyRleHRlbmRzKGN0b3IsIF8kQmFzZUNvbXBvbmVudCk7XHJcbiAgICByZXR1cm4gY3RvcjtcclxufVxuXG5leHBvcnQgeyBfJHJlbW92ZUNoaWxkLCBfJGJpbmRHcm91cCwgXyRlbXB0eUVsc2UsIF8kQ3RvciwgXyRiaW5kTXVsdGlTZWxlY3QsIF8kc2V0QXR0ciwgXyRyZW1vdmVFbCwgXyRhc3NpZ25FbCwgXyRlbCwgXyRiaW5kU3R5bGUsIF8kZm9yTG9vcCwgXyRlYWNoLCBfJGluc2VydFN0eWxlLCBfJHJlbW92ZVN0eWxlLCBfJGdldEF0dHIsIF8kYWRkTGlzdGVuZXIsIF8kdXBkYXRlTGlzdGVuZXIsIF8kcmVtb3ZlTGlzdGVuZXIsIF8kYmluZENsYXNzZXMsIF8kZGVzdHJveUNvbXBvbmVudCwgXyRzdmcsIF8kbm9vcCwgXyR0b1N0cmluZywgXyRzZXRSZWZlcmVuY2UsIF8kaXNUeXBlLCBfJGlzS2V5LCBfJHNlbGVjdCwgXyRkb2NGcmFnbWVudCwgXyRhcHBlbmQsIF8kdXBkYXRlTXVsdGlTZWxlY3QsIF8kY29tcG9uZW50VXBkYXRlLCBfJGh0bWxVcGRhdGUsIF8kdGFnVXBkYXRlLCBfJGJpbmRCb29sZWFuQXR0ciwgXyRyZW1vdmVSZWZlcmVuY2UsIF8kYWRkQ2hpbGQsIF8kdGV4dFVwZGF0ZSwgXyRnZXRWYWx1ZSwgXyR0ZXh0LCBfJGNvbmRpdGlvbmFsVXBkYXRlLCBfJGJpbmRVcGRhdGUsIF8kY29tbWVudCwgXyRzZXRFbGVtZW50cyB9O1xuLy8jIHNvdXJjZU1hcHBpbmdVUkw9aW5kZXguanMubWFwXG4iLCJ2YXIgSEFMRiA9IC41O1xyXG52YXIgUEkgPSBNYXRoLlBJLCBwb3cgPSBNYXRoLnBvdywgc2luID0gTWF0aC5zaW47XHJcbnZhciBORVdUT05fSVRFUkFUSU9OUyA9IDQ7XHJcbnZhciBORVdUT05fTUlOX1NMT1BFID0gMC4wMDE7XHJcbnZhciBTVUJESVZJU0lPTl9QUkVDSVNJT04gPSAwLjAwMDAwMDE7XHJcbnZhciBTVUJESVZJU0lPTl9NQVhfSVRFUkFUSU9OUyA9IDEwO1xyXG52YXIga1NwbGluZVRhYmxlU2l6ZSA9IDExO1xyXG52YXIga1NhbXBsZVN0ZXBTaXplID0gMSAvIChrU3BsaW5lVGFibGVTaXplIC0gMSk7XHJcbnZhciBmbG9hdDMyQXJyYXlTdXBwb3J0ZWQgPSB0eXBlb2YgRmxvYXQzMkFycmF5ID09PSAnZnVuY3Rpb24nO1xyXG5mdW5jdGlvbiBDKGFBMSkgeyByZXR1cm4gMyAqIGFBMTsgfVxyXG5mdW5jdGlvbiBub3coKSB7IHJldHVybiBwZXJmb3JtYW5jZS5ub3coKTsgfVxyXG5mdW5jdGlvbiBCKGFBMSwgYUEyKSB7IHJldHVybiBDKGFBMikgLSA2ICogYUExOyB9XHJcbmZ1bmN0aW9uIEEoYUExLCBhQTIpIHsgcmV0dXJuIDEgLSBDKGFBMikgKyBDKGFBMSk7IH1cclxuZnVuY3Rpb24gY2FsY0JlemllcihhVCwgYUExLCBhQTIpIHtcclxuICAgIHJldHVybiAoKEEoYUExLCBhQTIpICogYVQgKyBCKGFBMSwgYUEyKSkgKiBhVCArIEMoYUExKSkgKiBhVDtcclxufVxyXG5mdW5jdGlvbiBnZXRTbG9wZShhVCwgYUExLCBhQTIpIHtcclxuICAgIHJldHVybiBDKEEoYUExLCBhQTIpICogYVQgKiBhVCArIDIgKiBCKGFBMSwgYUEyKSAqIGFUICsgQyhhQTEpKTtcclxufVxyXG5mdW5jdGlvbiBiaW5hcnlTdWJkaXZpZGUoYVgsIGFBLCBhQiwgbVgxLCBtWDIpIHtcclxuICAgIHZhciBjdXJyZW50WCwgY3VycmVudFQsIGkgPSAwO1xyXG4gICAgZG8ge1xyXG4gICAgICAgIGN1cnJlbnRUID0gYUEgKyAoYUIgLSBhQSkgLyAyO1xyXG4gICAgICAgIGN1cnJlbnRYID0gY2FsY0JlemllcihjdXJyZW50VCwgbVgxLCBtWDIpIC0gYVg7XHJcbiAgICAgICAgaWYgKGN1cnJlbnRYID4gMCkge1xyXG4gICAgICAgICAgICBhQiA9IGN1cnJlbnRUO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgYUEgPSBjdXJyZW50VDtcclxuICAgICAgICB9XHJcbiAgICB9IHdoaWxlIChNYXRoLmFicyhjdXJyZW50WCkgPiBTVUJESVZJU0lPTl9QUkVDSVNJT04gJiYgKytpIDwgU1VCRElWSVNJT05fTUFYX0lURVJBVElPTlMpO1xyXG4gICAgcmV0dXJuIGN1cnJlbnRUO1xyXG59XHJcbmZ1bmN0aW9uIG5ld3RvblJhcGhzb25JdGVyYXRlKGFYLCBhR3Vlc3NULCBtWDEsIG1YMikge1xyXG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBORVdUT05fSVRFUkFUSU9OUzsgKytpKSB7XHJcbiAgICAgICAgdmFyIGN1cnJlbnRTbG9wZSA9IGdldFNsb3BlKGFHdWVzc1QsIG1YMSwgbVgyKTtcclxuICAgICAgICBpZiAoY3VycmVudFNsb3BlID09PSAwKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBhR3Vlc3NUO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgY3VycmVudFggPSBjYWxjQmV6aWVyKGFHdWVzc1QsIG1YMSwgbVgyKSAtIGFYO1xyXG4gICAgICAgIGFHdWVzc1QgLT0gY3VycmVudFggLyBjdXJyZW50U2xvcGU7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gYUd1ZXNzVDtcclxufVxyXG5leHBvcnQgZnVuY3Rpb24gY3ViaWNCZXppZXIobVgxLCBtWTEsIG1YMiwgbVkyKSB7XHJcbiAgICBpZiAoISgwIDw9IG1YMSAmJiBtWDEgPD0gMSAmJiAwIDw9IG1YMiAmJiBtWDIgPD0gMSkpIHtcclxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ2JlemllciB4IHZhbHVlcyBtdXN0IGJlIGluIFswLCAxXSByYW5nZScpO1xyXG4gICAgfVxyXG4gICAgaWYgKG1YMSA9PT0gbVkxICYmIG1YMiA9PT0gbVkyKSB7XHJcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh4KSB7IHJldHVybiB4OyB9O1xyXG4gICAgfVxyXG4gICAgdmFyIHNhbXBsZVZhbHVlcyA9IGZsb2F0MzJBcnJheVN1cHBvcnRlZCA/IG5ldyBGbG9hdDMyQXJyYXkoa1NwbGluZVRhYmxlU2l6ZSkgOiBuZXcgQXJyYXkoa1NwbGluZVRhYmxlU2l6ZSk7XHJcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGtTcGxpbmVUYWJsZVNpemU7ICsraSkge1xyXG4gICAgICAgIHNhbXBsZVZhbHVlc1tpXSA9IGNhbGNCZXppZXIoaSAqIGtTYW1wbGVTdGVwU2l6ZSwgbVgxLCBtWDIpO1xyXG4gICAgfVxyXG4gICAgZnVuY3Rpb24gZ2V0VEZvclgoYVgpIHtcclxuICAgICAgICB2YXIgY3VycmVudFNhbXBsZSA9IDE7XHJcbiAgICAgICAgdmFyIGludGVydmFsU3RhcnQgPSAwO1xyXG4gICAgICAgIHZhciBsYXN0U2FtcGxlID0ga1NwbGluZVRhYmxlU2l6ZSAtIDE7XHJcbiAgICAgICAgZm9yICg7IGN1cnJlbnRTYW1wbGUgIT09IGxhc3RTYW1wbGUgJiYgc2FtcGxlVmFsdWVzW2N1cnJlbnRTYW1wbGVdIDw9IGFYOyArK2N1cnJlbnRTYW1wbGUpIHtcclxuICAgICAgICAgICAgaW50ZXJ2YWxTdGFydCArPSBrU2FtcGxlU3RlcFNpemU7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIC0tY3VycmVudFNhbXBsZTtcclxuICAgICAgICB2YXIgZGlzdCA9IChhWCAtIHNhbXBsZVZhbHVlc1tjdXJyZW50U2FtcGxlXSkgLyAoc2FtcGxlVmFsdWVzW2N1cnJlbnRTYW1wbGUgKyAxXSAtIHNhbXBsZVZhbHVlc1tjdXJyZW50U2FtcGxlXSk7XHJcbiAgICAgICAgdmFyIGd1ZXNzRm9yVCA9IGludGVydmFsU3RhcnQgKyBkaXN0ICoga1NhbXBsZVN0ZXBTaXplO1xyXG4gICAgICAgIHZhciBpbml0aWFsU2xvcGUgPSBnZXRTbG9wZShndWVzc0ZvclQsIG1YMSwgbVgyKTtcclxuICAgICAgICBpZiAoaW5pdGlhbFNsb3BlID49IE5FV1RPTl9NSU5fU0xPUEUpIHtcclxuICAgICAgICAgICAgcmV0dXJuIG5ld3RvblJhcGhzb25JdGVyYXRlKGFYLCBndWVzc0ZvclQsIG1YMSwgbVgyKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSBpZiAoaW5pdGlhbFNsb3BlID09PSAwKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBndWVzc0ZvclQ7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICByZXR1cm4gYmluYXJ5U3ViZGl2aWRlKGFYLCBpbnRlcnZhbFN0YXJ0LCBpbnRlcnZhbFN0YXJ0ICsga1NhbXBsZVN0ZXBTaXplLCBtWDEsIG1YMik7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIGZ1bmN0aW9uICh4KSB7XHJcbiAgICAgICAgaWYgKHggPT09IDApXHJcbiAgICAgICAgICAgIHJldHVybiAwO1xyXG4gICAgICAgIGlmICh4ID09PSAxKVxyXG4gICAgICAgICAgICByZXR1cm4gMTtcclxuICAgICAgICByZXR1cm4gY2FsY0JlemllcihnZXRURm9yWCh4KSwgbVkxLCBtWTIpO1xyXG4gICAgfTtcclxufVxyXG5leHBvcnQgZnVuY3Rpb24gYm91bmNlT3V0KHQpIHtcclxuICAgIHZhciBjID0gLjksIGEgPSA0IC8gMTEsIGIgPSA4IC8gMTE7XHJcbiAgICB2YXIgY2EgPSA0MzU2IC8gMzYxLCBjYiA9IDM1NDQyIC8gMTgwNSwgY2MgPSAxNjA2MSAvIDE4MDUsIHQyID0gdCAqIHQ7XHJcbiAgICByZXR1cm4gdCA8IGEgPyA3LjU2MjUgKiB0MiA6IHQgPCBiID8gOS4wNzUgKiB0MiAtIDkuOSAqIHQgKyAzLjQgOiB0IDwgYyA/IGNhICogdDIgLSBjYiAqIHQgKyBjYyA6IDEwLjggKiB0ICogdCAtIDIwLjUyICogdCArIDEwLjcyO1xyXG59XHJcbmV4cG9ydCBmdW5jdGlvbiBib3VuY2VJbk91dCh0KSB7XHJcbiAgICByZXR1cm4gdCA8IEhBTEYgPyBIQUxGICogKDEgLSBib3VuY2VPdXQoMSAtIHQgKiAyKSkgOiBIQUxGICogYm91bmNlT3V0KHQgKiAyIC0gMSkgKyBIQUxGO1xyXG59XHJcbmV4cG9ydCBmdW5jdGlvbiBib3VuY2VJbih0KSB7XHJcbiAgICByZXR1cm4gMSAtIGJvdW5jZU91dCgxIC0gdCk7XHJcbn1cclxuZXhwb3J0IGZ1bmN0aW9uIGVsYXN0aWNJbk91dCh0KSB7XHJcbiAgICByZXR1cm4gdCA8IEhBTEZcclxuICAgICAgICA/IEhBTEYgKiBzaW4oMTMgKiBQSSAvIDIgKiAyICogdCkgKiBwb3coMiwgMTAgKiAoMiAqIHQgLSAxKSlcclxuICAgICAgICA6IEhBTEYgKiBzaW4oLTEzICogUEkgLyAyICogKCgyICogdCAtIDEpICsgMSkpICogcG93KDIsIC0xMCAqICgyICogdCAtIDEpKSArIDE7XHJcbn1cclxuZXhwb3J0IGZ1bmN0aW9uIGVsYXN0aWNJbih0KSB7XHJcbiAgICByZXR1cm4gc2luKDEzICogdCAqIFBJIC8gMikgKiBwb3coMiwgMTAgKiAodCAtIDEpKTtcclxufVxyXG5leHBvcnQgZnVuY3Rpb24gZWxhc3RpY091dCh0KSB7XHJcbiAgICByZXR1cm4gc2luKC0xMyAqICh0ICsgMSkgKiBQSSAvIDIpICogcG93KDIsIC0xMCAqIHQpICsgMTtcclxufVxyXG5leHBvcnQgdmFyIHNuYXAgPSBjdWJpY0JlemllcigwLCAxLCBIQUxGLCAxKTtcclxuZXhwb3J0IHZhciBlYXNlSW4gPSBjdWJpY0JlemllciguNDIsIDAsIDEsIDEpO1xyXG5leHBvcnQgdmFyIGVhc2VPdXQgPSBjdWJpY0JlemllcigwLCAwLCAuNTgsIDEpO1xyXG5leHBvcnQgdmFyIGluT3V0ID0gY3ViaWNCZXppZXIoLjQyLCAwLCAuNTgsIDEpO1xyXG5leHBvcnQgdmFyIGxpbmVhciA9IGN1YmljQmV6aWVyKC4yNSwgLjI1LCAuNzUsIC43NSk7XHJcbmV4cG9ydCB2YXIgYmFja0luID0gY3ViaWNCZXppZXIoLjYsIC0uMjgsIC43MzUsIC4wNDUpO1xyXG5leHBvcnQgdmFyIGNpcmNJbiA9IGN1YmljQmV6aWVyKC42LCAuMDQsIC45OCwgLjMzNSk7XHJcbmV4cG9ydCB2YXIgY3ViaWNJbiA9IGN1YmljQmV6aWVyKC41NSwgLjA1NSwgLjY3NSwgLjE5KTtcclxuZXhwb3J0IHZhciBleHBvSW4gPSBjdWJpY0JlemllciguOTUsIC4wNSwgLjc5NSwgLjAzNSk7XHJcbmV4cG9ydCB2YXIgcXVhZEluID0gY3ViaWNCZXppZXIoLjU1LCAuMDg1LCAuNjgsIC41Myk7XHJcbmV4cG9ydCB2YXIgcXVhcnRJbiA9IGN1YmljQmV6aWVyKC44OTUsIC4wMywgLjY4NSwgLjIyKTtcclxuZXhwb3J0IHZhciBxdWludEluID0gY3ViaWNCZXppZXIoLjc1NSwgLjA1LCAuODU1LCAuMDYpO1xyXG5leHBvcnQgdmFyIHNpbmVJbiA9IGN1YmljQmV6aWVyKC40NywgMCwgLjc0NSwgLjcxNSk7XHJcbmV4cG9ydCB2YXIgYmFja091dCA9IGN1YmljQmV6aWVyKC4xNzUsIC44ODUsIC4zMiwgMS4yNzUpO1xyXG5leHBvcnQgdmFyIGNpcmNPdXQgPSBjdWJpY0JlemllciguMDc1LCAuODIsIC4xNjUsIDEpO1xyXG5leHBvcnQgdmFyIGN1YmljT3V0ID0gY3ViaWNCZXppZXIoLjIxNSwgLjYxLCAuMzU1LCAxKTtcclxuZXhwb3J0IHZhciBleHBvT3V0ID0gY3ViaWNCZXppZXIoLjE5LCAxLCAuMjIsIDEpO1xyXG5leHBvcnQgdmFyIHF1YWRPdXQgPSBjdWJpY0JlemllciguMjUsIC40NiwgLjQ1LCAuOTQpO1xyXG5leHBvcnQgdmFyIHF1YXJ0T3V0ID0gY3ViaWNCZXppZXIoLjE2NSwgLjg0LCAuNDQsIDEpO1xyXG5leHBvcnQgdmFyIHF1aW50T3V0ID0gY3ViaWNCZXppZXIoLjIzLCAxLCAuMzIsIDEpO1xyXG5leHBvcnQgdmFyIHNpbmVPdXQgPSBjdWJpY0JlemllciguMzksIC41NzUsIC41NjUsIDEpO1xyXG5leHBvcnQgdmFyIGJhY2tJbk91dCA9IGN1YmljQmV6aWVyKC42OCwgLS41NSwgLjI2NSwgMS41NSk7XHJcbmV4cG9ydCB2YXIgY2lyY0luT3V0ID0gY3ViaWNCZXppZXIoLjc4NSwgLjEzNSwgLjE1LCAuODYpO1xyXG5leHBvcnQgdmFyIGN1YmljSW5PdXQgPSBjdWJpY0JlemllciguNjQ1LCAuMDQ1LCAuMzU1LCAxKTtcclxuZXhwb3J0IHZhciBleHBvSW5PdXQgPSBjdWJpY0JlemllcigxLCAwLCAwLCAxKTtcclxuZXhwb3J0IHZhciBxdWFkSW5PdXQgPSBjdWJpY0JlemllciguNDU1LCAuMDMsIC41MTUsIC45NTUpO1xyXG5leHBvcnQgdmFyIHF1YXJ0SW5PdXQgPSBjdWJpY0JlemllciguNzcsIDAsIC4xNzUsIDEpO1xyXG5leHBvcnQgdmFyIHF1aW50SW5PdXQgPSBjdWJpY0JlemllciguODYsIDAsIC4wNywgMSk7XHJcbmV4cG9ydCB2YXIgc2luZUluT3V0ID0gY3ViaWNCZXppZXIoLjQ0NSwgLjA1LCAuNTUsIC45NSk7XHJcbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHRyYW5zaXRpb24oX2EpIHtcclxuICAgIHZhciBfYiA9IF9hLmVhc2UsIGVhc2UgPSBfYiA9PT0gdm9pZCAwID8gZWFzZUluIDogX2IsIGR1cmF0aW9uID0gX2EuZHVyYXRpb24sIF9jID0gX2EubG9vcCwgbG9vcCA9IF9jID09PSB2b2lkIDAgPyBmYWxzZSA6IF9jLCBfZCA9IF9hLmRlbGF5LCBkZWxheSA9IF9kID09PSB2b2lkIDAgPyAwIDogX2Q7XHJcbiAgICB2YXIgZGlmZiA9IDA7XHJcbiAgICB2YXIgc3RhcnQsIGNoYW5nZSwgZW5kZWQ7XHJcbiAgICBmdW5jdGlvbiBpbml0KCkge1xyXG4gICAgICAgIHN0YXJ0ID0gbm93KCk7XHJcbiAgICAgICAgIXRoaXMucnVubmluZyAmJiAodGhpcy5ydW5uaW5nID0gdHJ1ZSk7XHJcbiAgICAgICAgcmVxdWVzdEFuaW1hdGlvbkZyYW1lKGFuaW1hdGUuYmluZCh0aGlzKSk7XHJcbiAgICB9XHJcbiAgICBmdW5jdGlvbiBhbmltYXRlKHRpbWUpIHtcclxuICAgICAgICBpZiAodGhpcy5wYXVzZWQgfHwgIWNoYW5nZSlcclxuICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIHZhciBmcmFjdGlvbiA9ICh0aW1lIC0gc3RhcnQgKyBkaWZmKSAvIChkdXJhdGlvbiB8fCA4MDApO1xyXG4gICAgICAgIHZhciBwcm9ncmVzcyA9IGVhc2UoZnJhY3Rpb24gPiAxID8gZnJhY3Rpb24gPSAxIDogZnJhY3Rpb24pO1xyXG4gICAgICAgIGNoYW5nZShwcm9ncmVzcyk7XHJcbiAgICAgICAgaWYgKGZyYWN0aW9uIDwgMSkge1xyXG4gICAgICAgICAgICByZXF1ZXN0QW5pbWF0aW9uRnJhbWUoYW5pbWF0ZS5iaW5kKHRoaXMpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSBpZiAobG9vcCkge1xyXG4gICAgICAgICAgICBkaWZmID0gMDtcclxuICAgICAgICAgICAgaW5pdC5jYWxsKHRoaXMpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgdGhpcy5ydW5uaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgIGVuZGVkICYmIGVuZGVkKCk7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIHtcclxuICAgICAgICBwYXVzZWQ6IGZhbHNlLFxyXG4gICAgICAgIHJ1bm5pbmc6IGZhbHNlLFxyXG4gICAgICAgIG9uOiBmdW5jdGlvbiAoZXZlbnQsIGhhbmRsZXIpIHtcclxuICAgICAgICAgICAgZXZlbnQgPT09ICdlbmRlZCcgJiYgKGVuZGVkID0gaGFuZGxlcik7XHJcbiAgICAgICAgICAgIGV2ZW50ID09PSAnY2hhbmdlJyAmJiAoY2hhbmdlID0gaGFuZGxlcik7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBydW46IGZ1bmN0aW9uIChkLCBsKSB7XHJcbiAgICAgICAgICAgIGRlbGF5ID0gbCB8fCBkZWxheSB8fCAwO1xyXG4gICAgICAgICAgICBkdXJhdGlvbiA9IGQgfHwgZHVyYXRpb24gfHwgODAwO1xyXG4gICAgICAgICAgICBkZWxheSA+IDAgPyBzZXRUaW1lb3V0KGluaXQuYmluZCh0aGlzKSwgZGVsYXkpIDogaW5pdC5jYWxsKHRoaXMpO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcGF1c2U6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgaWYgKCF0aGlzLnJ1bm5pbmcpXHJcbiAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgIHRoaXMucGF1c2VkID0gdHJ1ZTtcclxuICAgICAgICAgICAgZGlmZiArPSBub3coKSAtIHN0YXJ0O1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcGxheTogZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICBpZiAoIXRoaXMucnVubmluZylcclxuICAgICAgICAgICAgICAgIHJldHVybjtcclxuICAgICAgICAgICAgdGhpcy5wYXVzZWQgPSBmYWxzZTtcclxuICAgICAgICAgICAgaW5pdC5jYWxsKHRoaXMpO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbn1cclxuIiwidmFyIF9fYXNzaWduID0gKHRoaXMgJiYgdGhpcy5fX2Fzc2lnbikgfHwgZnVuY3Rpb24gKCkge1xyXG4gICAgX19hc3NpZ24gPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uKHQpIHtcclxuICAgICAgICBmb3IgKHZhciBzLCBpID0gMSwgbiA9IGFyZ3VtZW50cy5sZW5ndGg7IGkgPCBuOyBpKyspIHtcclxuICAgICAgICAgICAgcyA9IGFyZ3VtZW50c1tpXTtcclxuICAgICAgICAgICAgZm9yICh2YXIgcCBpbiBzKSBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHMsIHApKVxyXG4gICAgICAgICAgICAgICAgdFtwXSA9IHNbcF07XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0O1xyXG4gICAgfTtcclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59O1xyXG5pbXBvcnQgaGFzaCBmcm9tICdoYXNoLXN1bSc7XHJcbmltcG9ydCB0cmFuc2l0aW9uLCB7IGVhc2VJbiB9IGZyb20gJy4vdHJhbnNpdGlvbic7XHJcbmV4cG9ydCBmdW5jdGlvbiBhbmltYXRlKG9wdGlvbnMsIHJ1bikge1xyXG4gICAgdmFyIHN0eWxlID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcignW2FuaW1hdGlvbi1zdHlsZS1zaGVldF0nKTtcclxuICAgIGlmICghc3R5bGUpIHtcclxuICAgICAgICBzdHlsZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJyk7XHJcbiAgICAgICAgc3R5bGUuc2V0QXR0cmlidXRlKCdhbmltYXRpb24tc3R5bGUtc2hlZXQnLCAnJyk7XHJcbiAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChzdHlsZSk7XHJcbiAgICB9XHJcbiAgICB2YXIgZWwsIHN0eWxlSW5kZXg7XHJcbiAgICB2YXIgc3R5bGVTaGVldCA9IHN0eWxlLnNoZWV0O1xyXG4gICAgdmFyIGNsYXNzTmFtZSA9IFwiYW5pbWF0aW9uX1wiICsgaGFzaChydW4pO1xyXG4gICAgdmFyIF9hID0gX19hc3NpZ24oeyBkZWxheTogMCwgZHVyYXRpb246IDQwMCwgZWFzZTogZWFzZUluIH0sIG9wdGlvbnMpLCBlYXNlID0gX2EuZWFzZSwgZGVsYXkgPSBfYS5kZWxheSwgZHVyYXRpb24gPSBfYS5kdXJhdGlvbjtcclxuICAgIHZhciBpbkFuaW1hdGlvbiA9IHRyYW5zaXRpb24oeyBkdXJhdGlvbjogZHVyYXRpb24sIGRlbGF5OiBkZWxheSwgZWFzZTogZWFzZSB9KTtcclxuICAgIHZhciBvdXRBbmltYXRpb24gPSB0cmFuc2l0aW9uKHsgZHVyYXRpb246IGR1cmF0aW9uLCBkZWxheTogZGVsYXksIGVhc2U6IGZ1bmN0aW9uICh4KSB7IHJldHVybiAxIC0gZWFzZSgxIC0geCk7IH0gfSk7XHJcbiAgICBmdW5jdGlvbiBzZXRDaGFuZ2VDQihub2RlLCBhbmltYXRpb24pIHtcclxuICAgICAgICB2YXIgYXJncyA9IFtdO1xyXG4gICAgICAgIGZvciAodmFyIF9pID0gMjsgX2kgPCBhcmd1bWVudHMubGVuZ3RoOyBfaSsrKSB7XHJcbiAgICAgICAgICAgIGFyZ3NbX2kgLSAyXSA9IGFyZ3VtZW50c1tfaV07XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsID0gbm9kZTtcclxuICAgICAgICB2YXIgYW5pbWUgPSBhbmltYXRpb24gPT09ICdpbicgPyBpbkFuaW1hdGlvbiA6IG91dEFuaW1hdGlvbjtcclxuICAgICAgICB2YXIgY2hhbmdlID0gcnVuKG5vZGUpO1xyXG4gICAgICAgIGVsLmNsYXNzTGlzdC5hZGQoY2xhc3NOYW1lKTtcclxuICAgICAgICBhbmltZS5vbignY2hhbmdlJywgZnVuY3Rpb24gKHByb2dyZXNzKSB7XHJcbiAgICAgICAgICAgIHN0eWxlU2hlZXQuY3NzUnVsZXMubGVuZ3RoICYmIHN0eWxlU2hlZXQuZGVsZXRlUnVsZShzdHlsZUluZGV4KTtcclxuICAgICAgICAgICAgdmFyIHN0eWxlVHh0ID0gY2hhbmdlKGFuaW1hdGlvbiA9PT0gJ2luJyA/IHByb2dyZXNzIDogMSAtIHByb2dyZXNzKTtcclxuICAgICAgICAgICAgc3R5bGVTaGVldC5pbnNlcnRSdWxlKFwiLlwiICsgY2xhc3NOYW1lICsgXCJ7XCIgKyBzdHlsZVR4dCArIFwifVwiKTtcclxuICAgICAgICAgICAgc3R5bGVJbmRleCA9IHN0eWxlU2hlZXQuY3NzUnVsZXMubGVuZ3RoIC0gMTtcclxuICAgICAgICB9KTtcclxuICAgICAgICBhbmltZS5ydW4uYXBwbHkoYW5pbWUsIGFyZ3MpO1xyXG4gICAgfVxyXG4gICAgcmV0dXJuIHtcclxuICAgICAgICBzdGF0ZTogJ2luJyxcclxuICAgICAgICBzdGFydGVkOiBmYWxzZSxcclxuICAgICAgICBlbmRlZDogZnVuY3Rpb24gKGhhbmRsZXIpIHtcclxuICAgICAgICAgICAgdmFyIGNhbGxiYWNrID0gZnVuY3Rpb24gKCkge1xyXG4gICAgICAgICAgICAgICAgZWwuY2xhc3NMaXN0LnJlbW92ZShjbGFzc05hbWUpO1xyXG4gICAgICAgICAgICAgICAgaGFuZGxlciAmJiBoYW5kbGVyKCk7XHJcbiAgICAgICAgICAgICAgICBzdHlsZVNoZWV0LmRlbGV0ZVJ1bGUoc3R5bGVJbmRleCk7XHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIGluQW5pbWF0aW9uLm9uKCdlbmRlZCcsIGNhbGxiYWNrKTtcclxuICAgICAgICAgICAgb3V0QW5pbWF0aW9uLm9uKCdlbmRlZCcsIGZ1bmN0aW9uICgpIHtcclxuICAgICAgICAgICAgICAgIGNhbGxiYWNrKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgIH0sXHJcbiAgICAgICAgcnVuOiBmdW5jdGlvbiAobm9kZSkge1xyXG4gICAgICAgICAgICB2YXIgYXJncyA9IFtdO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBfaSA9IDE7IF9pIDwgYXJndW1lbnRzLmxlbmd0aDsgX2krKykge1xyXG4gICAgICAgICAgICAgICAgYXJnc1tfaSAtIDFdID0gYXJndW1lbnRzW19pXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XHJcbiAgICAgICAgICAgIGlmIChzZWxmLnN0YXRlID09PSAnaW4nKSB7XHJcbiAgICAgICAgICAgICAgICBzZWxmLmluLmFwcGx5KHNlbGYsIFtub2RlXS5jb25jYXQoYXJncykpO1xyXG4gICAgICAgICAgICAgICAgc2VsZi5zdGF0ZSA9ICdvdXQnO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgc2VsZi5vdXQuYXBwbHkoc2VsZiwgW25vZGVdLmNvbmNhdChhcmdzKSk7XHJcbiAgICAgICAgICAgICAgICBzZWxmLnN0YXRlID0gJ2luJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgaW46IGZ1bmN0aW9uIChub2RlKSB7XHJcbiAgICAgICAgICAgIHZhciBhcmdzID0gW107XHJcbiAgICAgICAgICAgIGZvciAodmFyIF9pID0gMTsgX2kgPCBhcmd1bWVudHMubGVuZ3RoOyBfaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBhcmdzW19pIC0gMV0gPSBhcmd1bWVudHNbX2ldO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNldENoYW5nZUNCLmFwcGx5KHZvaWQgMCwgW25vZGUsICdpbiddLmNvbmNhdChhcmdzKSk7XHJcbiAgICAgICAgfSxcclxuICAgICAgICBvdXQ6IGZ1bmN0aW9uIChub2RlKSB7XHJcbiAgICAgICAgICAgIHZhciBhcmdzID0gW107XHJcbiAgICAgICAgICAgIGZvciAodmFyIF9pID0gMTsgX2kgPCBhcmd1bWVudHMubGVuZ3RoOyBfaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBhcmdzW19pIC0gMV0gPSBhcmd1bWVudHNbX2ldO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHNldENoYW5nZUNCLmFwcGx5KHZvaWQgMCwgW25vZGUsICdvdXQnXS5jb25jYXQoYXJncykpO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbn1cclxuIiwidmFyIF9fYXNzaWduID0gKHRoaXMgJiYgdGhpcy5fX2Fzc2lnbikgfHwgZnVuY3Rpb24gKCkge1xyXG4gICAgX19hc3NpZ24gPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uKHQpIHtcclxuICAgICAgICBmb3IgKHZhciBzLCBpID0gMSwgbiA9IGFyZ3VtZW50cy5sZW5ndGg7IGkgPCBuOyBpKyspIHtcclxuICAgICAgICAgICAgcyA9IGFyZ3VtZW50c1tpXTtcclxuICAgICAgICAgICAgZm9yICh2YXIgcCBpbiBzKSBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHMsIHApKVxyXG4gICAgICAgICAgICAgICAgdFtwXSA9IHNbcF07XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0O1xyXG4gICAgfTtcclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59O1xyXG5pbXBvcnQgeyBhbmltYXRlIH0gZnJvbSAnLi90b29scyc7XHJcbmltcG9ydCB7IGN1YmljT3V0IH0gZnJvbSAnLi90cmFuc2l0aW9uJztcclxuZXhwb3J0IGZ1bmN0aW9uIEZhZGVBbmltYXRpb24ob3B0aW9ucykge1xyXG4gICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkZWxheTogMCwgZHVyYXRpb246IDQwMCB9O1xyXG4gICAgcmV0dXJuIGFuaW1hdGUob3B0aW9ucywgZnVuY3Rpb24gKG5vZGUpIHtcclxuICAgICAgICB2YXIgb3BhY2l0eSA9ICsoZ2V0Q29tcHV0ZWRTdHlsZShub2RlKS5vcGFjaXR5IHx8IDApO1xyXG4gICAgICAgIHJldHVybiBmdW5jdGlvbiAocHJvZ3Jlc3MpIHsgcmV0dXJuIFwib3BhY2l0eTogXCIgKyBwcm9ncmVzcyAqIG9wYWNpdHkgKyBcIjtcIjsgfTtcclxuICAgIH0pO1xyXG59XHJcbmV4cG9ydCBmdW5jdGlvbiBGbHlBbmltYXRpb24ob3B0aW9ucykge1xyXG4gICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwgeyBkZWxheTogMCwgZHVyYXRpb246IDQwMCwgeDogMCwgeTogMCwgZWFzZTogY3ViaWNPdXQgfTtcclxuICAgIHJldHVybiBhbmltYXRlKG9wdGlvbnMsIGZ1bmN0aW9uIChub2RlKSB7XHJcbiAgICAgICAgdmFyIG9wYWNpdHksIHRyYW5zZm9ybTtcclxuICAgICAgICB2YXIgX2EgPSBfX2Fzc2lnbih7IHg6IDAsIHk6IDAgfSwgb3B0aW9ucyksIHggPSBfYS54LCB5ID0gX2EueTtcclxuICAgICAgICB2YXIgc3R5bGUgPSBnZXRDb21wdXRlZFN0eWxlKG5vZGUpO1xyXG4gICAgICAgIG9wYWNpdHkgPSArKHN0eWxlLm9wYWNpdHkgfHwgMCk7XHJcbiAgICAgICAgdHJhbnNmb3JtID0gc3R5bGUudHJhbnNmb3JtID09PSAnbm9uZScgPyAnJyA6IChzdHlsZS50cmFuc2Zvcm0gPyBzdHlsZS50cmFuc2Zvcm0gKyBcIiBcIiA6ICcnKTtcclxuICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHByb2dyZXNzKSB7IHJldHVybiBcIm9wYWNpdHk6IFwiICsgcHJvZ3Jlc3MgKiBvcGFjaXR5ICsgXCI7IFwiICtcclxuICAgICAgICAgICAgKFwidHJhbnNmb3JtOiBcIiArIHRyYW5zZm9ybSArIFwidHJhbnNsYXRlKFwiICsgKDEgLSBwcm9ncmVzcykgKiAoeCB8fCAwKSArIFwicHgsIFwiICsgKDEgLSBwcm9ncmVzcykgKiAoeSB8fCAwKSArIFwicHgpO1wiKTsgfTtcclxuICAgIH0pO1xyXG59XHJcbmV4cG9ydCBmdW5jdGlvbiBTbGlkZUFuaW1hdGlvbihvcHRpb25zKSB7XHJcbiAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7IGRlbGF5OiAwLCBkdXJhdGlvbjogNDAwLCBlYXNlOiBjdWJpY091dCB9O1xyXG4gICAgcmV0dXJuIGFuaW1hdGUob3B0aW9ucywgZnVuY3Rpb24gKG5vZGUpIHtcclxuICAgICAgICB2YXIgb3BhY2l0eSwgaGVpZ2h0LCBwYWRkaW5nVG9wLCBwYWRkaW5nQm90dG9tLCBtYXJnaW5Ub3AsIG1hcmdpbkJvdHRvbSwgYm9yZGVyVG9wV2lkdGgsIGJvcmRlckJvdHRvbVdpZHRoO1xyXG4gICAgICAgIHZhciBzdHlsZSA9IGdldENvbXB1dGVkU3R5bGUobm9kZSk7XHJcbiAgICAgICAgb3BhY2l0eSA9ICsoc3R5bGUub3BhY2l0eSB8fCAwKTtcclxuICAgICAgICBoZWlnaHQgPSBwYXJzZUZsb2F0KHN0eWxlLmhlaWdodCB8fCAnMCcpO1xyXG4gICAgICAgIG1hcmdpblRvcCA9IHBhcnNlRmxvYXQoc3R5bGUubWFyZ2luVG9wIHx8ICcwJyk7XHJcbiAgICAgICAgcGFkZGluZ1RvcCA9IHBhcnNlRmxvYXQoc3R5bGUucGFkZGluZ1RvcCB8fCAnMCcpO1xyXG4gICAgICAgIG1hcmdpbkJvdHRvbSA9IHBhcnNlRmxvYXQoc3R5bGUubWFyZ2luQm90dG9tIHx8ICcwJyk7XHJcbiAgICAgICAgcGFkZGluZ0JvdHRvbSA9IHBhcnNlRmxvYXQoc3R5bGUucGFkZGluZ0JvdHRvbSB8fCAnMCcpO1xyXG4gICAgICAgIGJvcmRlclRvcFdpZHRoID0gcGFyc2VGbG9hdChzdHlsZS5ib3JkZXJUb3BXaWR0aCB8fCAnMCcpO1xyXG4gICAgICAgIGJvcmRlckJvdHRvbVdpZHRoID0gcGFyc2VGbG9hdChzdHlsZS5ib3JkZXJCb3R0b21XaWR0aCB8fCAnMCcpO1xyXG4gICAgICAgIHJldHVybiBmdW5jdGlvbiAocHJvZ3Jlc3MpIHsgcmV0dXJuIFwib3ZlcmZsb3c6IGhpZGRlbjtcIiArXHJcbiAgICAgICAgICAgIChcImhlaWdodDogXCIgKyBwcm9ncmVzcyAqIGhlaWdodCArIFwicHg7XCIpICtcclxuICAgICAgICAgICAgKFwibWFyZ2luLXRvcDogXCIgKyBwcm9ncmVzcyAqIG1hcmdpblRvcCArIFwicHg7XCIpICtcclxuICAgICAgICAgICAgKFwicGFkZGluZy10b3A6IFwiICsgcHJvZ3Jlc3MgKiBwYWRkaW5nVG9wICsgXCJweDtcIikgK1xyXG4gICAgICAgICAgICAoXCJtYXJnaW4tYm90dG9tOiBcIiArIHByb2dyZXNzICogbWFyZ2luQm90dG9tICsgXCJweDtcIikgK1xyXG4gICAgICAgICAgICAoXCJwYWRkaW5nLWJvdHRvbTogXCIgKyBwcm9ncmVzcyAqIHBhZGRpbmdCb3R0b20gKyBcInB4O1wiKSArXHJcbiAgICAgICAgICAgIChcImJvcmRlci10b3Atd2lkdGg6IFwiICsgcHJvZ3Jlc3MgKiBib3JkZXJUb3BXaWR0aCArIFwicHg7XCIpICtcclxuICAgICAgICAgICAgKFwib3BhY2l0eTogXCIgKyBNYXRoLm1pbihwcm9ncmVzcyAqIDIwLCAxKSAqIG9wYWNpdHkgKyBcIjtcIikgK1xyXG4gICAgICAgICAgICAoXCJib3JkZXItYm90dG9tLXdpZHRoOiBcIiArIHByb2dyZXNzICogYm9yZGVyQm90dG9tV2lkdGggKyBcInB4O1wiKTsgfTtcclxuICAgIH0pO1xyXG59XHJcbiIsImltcG9ydCB7XHJcbiAgXyRlbXB0eUVsc2UsXHJcbiAgXyRDdG9yLFxyXG4gIF8kc2V0QXR0cixcclxuICBfJGVsLFxyXG4gIF8kaW5zZXJ0U3R5bGUsXHJcbiAgXyRyZW1vdmVTdHlsZSxcclxuICBfJGFkZExpc3RlbmVyLFxyXG4gIF8kcmVtb3ZlTGlzdGVuZXIsXHJcbiAgXyRkZXN0cm95Q29tcG9uZW50LFxyXG4gIF8kbm9vcCxcclxuICBfJHNldFJlZmVyZW5jZSxcclxuICBfJHNlbGVjdCxcclxuICBfJGRvY0ZyYWdtZW50LFxyXG4gIF8kYXBwZW5kLFxyXG4gIF8kcmVtb3ZlUmVmZXJlbmNlLFxyXG4gIF8kdGV4dFVwZGF0ZSxcclxuICBfJHRleHQsXHJcbiAgXyRjb25kaXRpb25hbFVwZGF0ZSxcclxuICBfJHNldEVsZW1lbnRzLFxyXG59IGZyb20gJ3RyZWJvci10b29scyc7XHJcbmltcG9ydCB7IFNsaWRlQW5pbWF0aW9uIH0gZnJvbSAndHJlYm9yLXRyYW5zaXRpb25zJztcclxuZnVuY3Rpb24gaWZDb25kaXRpb25fMShfJHN0YXRlKSB7XHJcbiAgdmFyIF8kZnJhZywgZGl2XzEsIHR4dF8xLCBfcmVmcztcclxuICBfJGZyYWcgPSBfJGRvY0ZyYWdtZW50KCk7XHJcbiAgX3JlZnMgPSBfJHN0YXRlLiRyZWZzO1xyXG4gIHJldHVybiB7XHJcbiAgICB0eXBlOiAnaWYnLFxyXG5cclxuICAgICRjcmVhdGU6IGZ1bmN0aW9uKCkge1xyXG4gICAgICBkaXZfMSA9IF8kZWwoKTtcclxuICAgICAgdHh0XzEgPSBfJHRleHQoJ0hlbGxvIHdvcmQhJyk7XHJcbiAgICAgIF8kc2V0UmVmZXJlbmNlKF9yZWZzLCAnYm94JywgZGl2XzEpO1xyXG4gICAgfSxcclxuXHJcbiAgICAkbW91bnQ6IGZ1bmN0aW9uKHBhcmVudCwgc2libGluZykge1xyXG4gICAgICB0aGlzLiR1bm1vdW50KCk7XHJcbiAgICAgIF8kYXBwZW5kKF8kc2VsZWN0KHBhcmVudCksIF8kZnJhZywgXyRzZWxlY3Qoc2libGluZykpO1xyXG4gICAgfSxcclxuXHJcbiAgICAkdXBkYXRlOiBfJG5vb3AsXHJcblxyXG4gICAgJHVubW91bnQ6IGZ1bmN0aW9uKCkge1xyXG4gICAgICBfJGFwcGVuZChkaXZfMSwgdHh0XzEpO1xyXG4gICAgICBfJGFwcGVuZChfJGZyYWcsIGRpdl8xKTtcclxuICAgIH0sXHJcblxyXG4gICAgJGRlc3Ryb3k6IGZ1bmN0aW9uKCkge1xyXG4gICAgICB0aGlzLiR1bm1vdW50KCk7XHJcbiAgICAgIF8kcmVtb3ZlUmVmZXJlbmNlKF9yZWZzLCAnYm94JywgZGl2XzEpO1xyXG4gICAgICBfJGZyYWcgPSBkaXZfMSA9IHR4dF8xID0gX3JlZnMgPSB2b2lkIDA7XHJcbiAgICB9XHJcbiAgfTtcclxufVxyXG5mdW5jdGlvbiBjb25kaXRpb25fMShfJHN0YXRlKSB7XHJcbiAgaWYgKF8kc3RhdGUudmlzaWJsZSlcclxuICAgIHJldHVybiBpZkNvbmRpdGlvbl8xKF8kc3RhdGUpO1xyXG4gIGVsc2VcclxuICAgIHJldHVybiBfJGVtcHR5RWxzZSgpO1xyXG59XHJcbmZ1bmN0aW9uIF8kdHBsQW5pbWF0aW9uKF8kc3RhdGUpIHtcclxuICB2YXIgXyRmcmFnLCBpbnB1dF8xLCBjaGFuZ2VFdmVudF8xLCBoYW5kbGVyQ2hhbmdlRXZlbnRfMSwgbGFiZWxfMSwgdHh0XzEsIHNldFR4dF8xLCBjb25kaXRpb25BbmNob3JfMSwgY29uZGl0aW9uQmxvY2tfMTtcclxuICBfJGZyYWcgPSBfJGRvY0ZyYWdtZW50KCk7XHJcbiAgY2hhbmdlRXZlbnRfMSA9IGZ1bmN0aW9uKF8kc3RhdGUsICRldmVudCwgJGVsKSB7XHJcbiAgICBfJHN0YXRlLm9uQ2hhbmdlKCRlbC5jaGVja2VkKTtcclxuICB9O1xyXG4gIHNldFR4dF8xID0gZnVuY3Rpb24oKSB7XHJcbiAgICByZXR1cm4gJ1Zpc2libGU6ICc7XHJcbiAgfTtcclxuICAnKyhfJHN0YXRlLnZpc2libGUpKyc7XHJcbiAgJyc7XHJcbiAgY29uZGl0aW9uQW5jaG9yXzEgPSBfJHRleHQoKTtcclxuICByZXR1cm4ge1xyXG4gICAgJGNyZWF0ZTogZnVuY3Rpb24oKSB7XHJcbiAgICAgIGlucHV0XzEgPSBfJGVsKCdpbnB1dCcpO1xyXG4gICAgICBsYWJlbF8xID0gXyRlbCgnbGFiZWwnKTtcclxuICAgICAgdHh0XzEgPSBfJHRleHQoKTtcclxuICAgICAgdHh0XzEuZGF0YSA9IHNldFR4dF8xKF8kc3RhdGUpO1xyXG4gICAgICBjb25kaXRpb25CbG9ja18xID0gY29uZGl0aW9uXzEoXyRzdGF0ZSk7XHJcbiAgICAgIGNvbmRpdGlvbkJsb2NrXzEuJGNyZWF0ZSgpO1xyXG4gICAgICBfJHNldEF0dHIoaW5wdXRfMSwgWydpZCcsICd2aXNpYmxlJ10pO1xyXG4gICAgICBfJHNldEF0dHIoaW5wdXRfMSwgWyd0eXBlJywgJ2NoZWNrYm94J10pO1xyXG4gICAgICBfJGFkZExpc3RlbmVyKGlucHV0XzEsICdjaGFuZ2UnLCBoYW5kbGVyQ2hhbmdlRXZlbnRfMSA9IGZ1bmN0aW9uKGV2ZW50KSB7XHJcbiAgICAgICAgY2hhbmdlRXZlbnRfMShfJHN0YXRlLCBldmVudCwgaW5wdXRfMSk7XHJcbiAgICAgIH0pO1xyXG4gICAgICBfJHNldEF0dHIobGFiZWxfMSwgWydmb3InLCAndmlzaWJsZSddKTtcclxuICAgIH0sXHJcblxyXG4gICAgJG1vdW50OiBmdW5jdGlvbihwYXJlbnQsIHNpYmxpbmcpIHtcclxuICAgICAgdGhpcy4kdW5tb3VudCgpO1xyXG4gICAgICBfJGluc2VydFN0eWxlKFxyXG4gICAgICAgICdzY29wZV8yZDgyNjc0MCcsXHJcbiAgICAgICAgJ2RpdiB7d2lkdGg6MTI1cHg7cGFkZGluZzo0NXB4IDA7Y29sb3I6d2hpdGU7dGV4dC1hbGlnbjpjZW50ZXI7YmFja2dyb3VuZC1jb2xvcjpibGFjazt9J1xyXG4gICAgICApO1xyXG4gICAgICBfJGFwcGVuZChfJHNlbGVjdChwYXJlbnQpLCBfJGZyYWcsIF8kc2VsZWN0KHNpYmxpbmcpKTtcclxuICAgICAgXyRzZXRFbGVtZW50cyh0aGlzLCBwYXJlbnQsIHNpYmxpbmcpO1xyXG4gICAgfSxcclxuXHJcbiAgICAkdXBkYXRlOiBmdW5jdGlvbihfJHN0YXRlKSB7XHJcbiAgICAgIF8kdGV4dFVwZGF0ZSh0eHRfMSwgc2V0VHh0XzEoXyRzdGF0ZSkpO1xyXG4gICAgICBjb25kaXRpb25CbG9ja18xID0gXyRjb25kaXRpb25hbFVwZGF0ZShjb25kaXRpb25CbG9ja18xLCBjb25kaXRpb25fMSwgdW5kZWZpbmVkLCBjb25kaXRpb25BbmNob3JfMSwgXyRzdGF0ZSk7XHJcbiAgICB9LFxyXG5cclxuICAgICR1bm1vdW50OiBmdW5jdGlvbigpIHtcclxuICAgICAgXyRhcHBlbmQoXyRmcmFnLCBpbnB1dF8xKTtcclxuICAgICAgXyRhcHBlbmQobGFiZWxfMSwgdHh0XzEpO1xyXG4gICAgICBfJGFwcGVuZChfJGZyYWcsIGxhYmVsXzEpO1xyXG4gICAgICBfJGFwcGVuZChfJGZyYWcsIGNvbmRpdGlvbkFuY2hvcl8xKTtcclxuICAgICAgY29uZGl0aW9uQmxvY2tfMS4kbW91bnQoXyRmcmFnLCBjb25kaXRpb25BbmNob3JfMSk7XHJcbiAgICB9LFxyXG5cclxuICAgICRkZXN0cm95OiBmdW5jdGlvbigpIHtcclxuICAgICAgXyRkZXN0cm95Q29tcG9uZW50KHRoaXMpO1xyXG4gICAgICBfJHJlbW92ZVN0eWxlKCdzY29wZV8yZDgyNjc0MCcpO1xyXG4gICAgICBfJHJlbW92ZUxpc3RlbmVyKGlucHV0XzEsICdjaGFuZ2UnLCBoYW5kbGVyQ2hhbmdlRXZlbnRfMSk7XHJcbiAgICAgIGNvbmRpdGlvbkJsb2NrXzEuJGRlc3Ryb3koKTtcclxuICAgICAgZGVsZXRlIF8kc3RhdGUuJHJvb3Q7XHJcbiAgICAgIF8kZnJhZyA9IGlucHV0XzEgPSBjaGFuZ2VFdmVudF8xID0gaGFuZGxlckNoYW5nZUV2ZW50XzEgPSBsYWJlbF8xID0gdHh0XzEgPSBzZXRUeHRfMSA9IGNvbmRpdGlvbkFuY2hvcl8xID0gY29uZGl0aW9uQmxvY2tfMSA9IHZvaWQgMDtcclxuICAgIH1cclxuICB9O1xyXG59XHJcbnZhciBhbmltYXRpb24gPSBTbGlkZUFuaW1hdGlvbih7XHJcbiAgeTogMzAwLFxyXG4gIGR1cmF0aW9uOiAxMjAwXHJcbn0pO1xyXG52YXIgQW5pbWF0aW9uID0gXyRDdG9yKCdBbmltYXRpb24nLCBfJHRwbEFuaW1hdGlvbiwge1xyXG4gIG1vZGVsOiB7XHJcbiAgICB2aXNpYmxlOiBmYWxzZSxcclxuXHJcbiAgICBvbkNoYW5nZTogZnVuY3Rpb24odmFsdWUpIHtcclxuICAgICAgdmFyIF90aGlzID0gdGhpcztcclxuICAgICAgdmFyIHJlZnMgPSB0aGlzLiRyZWZzO1xyXG4gICAgICBhbmltYXRpb24uZW5kZWQoZnVuY3Rpb24oKSB7XHJcbiAgICAgICAgIXZhbHVlICYmIF90aGlzLiR1cGRhdGUoKTtcclxuICAgICAgfSk7XHJcbiAgICAgIGlmICh2YWx1ZSkge1xyXG4gICAgICAgIHRoaXMuJHNldCgndmlzaWJsZScsIHZhbHVlKTtcclxuICAgICAgICBhbmltYXRpb24uaW4ocmVmcy5ib3gpO1xyXG4gICAgICB9IGVsc2Uge1xyXG4gICAgICAgIHRoaXMudmlzaWJsZSA9IHZhbHVlO1xyXG4gICAgICAgIGFuaW1hdGlvbi5vdXQocmVmcy5ib3gpO1xyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgfVxyXG59KTtcclxuZXhwb3J0IGRlZmF1bHQgQW5pbWF0aW9uO1xyXG4iLCJpbXBvcnQgQW5pbWF0aW9uIGZyb20gJy4vY29tcG9uZW50cy9hbmltYXRpb24uaHRtbCc7XHJcblxyXG5jb25zdCBhbmltYXRpb24gPSBuZXcgQW5pbWF0aW9uKCk7XHJcblxyXG5hbmltYXRpb24uJG1vdW50KCdtYWluJyk7XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./main.ts\n"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/examples/animation/src/components/animation.html b/examples/animation/src/components/animation.html deleted file mode 100644 index 53f4b4d..0000000 --- a/examples/animation/src/components/animation.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - -
    Hello word!
    - - \ No newline at end of file diff --git a/examples/animation/src/main.ts b/examples/animation/src/main.ts deleted file mode 100644 index 09e65f9..0000000 --- a/examples/animation/src/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Animation from './components/animation.html'; - -const animation = new Animation(); - -animation.$mount('main'); diff --git a/examples/animation/src/types.d.ts b/examples/animation/src/types.d.ts deleted file mode 100644 index e268685..0000000 --- a/examples/animation/src/types.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -declare module "*.html" { - type AttrTypes = string | number | RegExp | null | boolean; - interface AttrDefinition { - required?: boolean; - type: 'string' | 'number' | 'object' | 'boolean' | 'function' | 'array' | Function; - default?: AttrTypes | (() => AttrTypes | Object); - } - interface DirectiveOptions { - value: any; - expression: string; - modifiers: { [key: string]: boolean } - } - interface DirectiveDefinition { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void - } - interface DirectivesOption { - [key: string]: DirectiveDefinition - } - interface ComponentOptions { - model: { [key: string]: any }; - attrs: string[] | { [key: string]: AttrDefinition }; - filters: { [key: string]: (...args: any[]) => any }; - children: { [key: string]: Component }; - directives: { - [key: string]: (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefinition - }; - } - interface Component { - readonly $refs: { [key: string]: HTMLElement[] }; - readonly $slots: { [key: string]: DocumentFragment }; - readonly $filters: { [key: string]: (...args: any[]) => any }; - readonly $options: ComponentOptions; - readonly $directives: DirectivesOption; - $create(): void; - $hydrate?(): void; - $mount(parent: string | HTMLElement, sibling?: string | HTMLElement): void; - $update(state: Object, ...args: any[]): void; - $destroy(): void; - $set(data: Object): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; - $once(event: string, handler: (data?: any) => void): void; - $fire(event: string, data?: any): void; - $notify(key: string): void; - $observe(key: string | string[], handler: () => void): { $unobserve(): void }; - $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; - } - interface ComponentConstructor { - new (attrs?: string[] | { [key: string]: AttrDefinition }): T; - prototype: Component; - } - const component: ComponentConstructor; - export default component; -} \ No newline at end of file diff --git a/examples/animation/tsconfig.json b/examples/animation/tsconfig.json deleted file mode 100644 index a752e63..0000000 --- a/examples/animation/tsconfig.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": ["./src/types.d.ts"], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file diff --git a/examples/animation/webpack.config.js b/examples/animation/webpack.config.js deleted file mode 100644 index 4ddb912..0000000 --- a/examples/animation/webpack.config.js +++ /dev/null @@ -1,46 +0,0 @@ -const { resolve } = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { optimize: { ModuleConcatenationPlugin } } = require('webpack'); - -module.exports = { - context: resolve(__dirname, 'src'), - entry: './main.ts', - output: { - filename: 'animation.js', - path: resolve(__dirname, 'dist/js') - }, - mode: 'development', - devtool: 'eval-source-map', - module: { - rules: [ - { - test: /\.html$/, - use: 'trebor-loader', - exclude: /index\.html/ - }, - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - } - ], - }, - resolve: { - alias: { - 'trebor-tools': resolve(__dirname, '../../../trebor-tools'), - 'trebor-transitions': resolve(__dirname, '../../../trebor-transitions') - } - }, - resolveLoader: { - alias: { - 'trebor-loader': resolve(__dirname, '../../loader.js') - } - }, - plugins: [ - new ModuleConcatenationPlugin(), - new HtmlWebpackPlugin({ - filename: resolve(__dirname, 'dist/index.html'), - template: './index.html' - }) - ] -}; \ No newline at end of file diff --git a/examples/calendar/dist/index.html b/examples/calendar/dist/index.html deleted file mode 100644 index af89873..0000000 --- a/examples/calendar/dist/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - TreborJS • Calendar - - - -
    - - - \ No newline at end of file diff --git a/examples/calendar/dist/js/calendar.js b/examples/calendar/dist/js/calendar.js deleted file mode 100644 index 79f6317..0000000 --- a/examples/calendar/dist/js/calendar.js +++ /dev/null @@ -1,101 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./main.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./main.ts": -/*!*****************************!*\ - !*** ./main.ts + 3 modules ***! - \*****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("\n// CONCATENATED MODULE: h:/trebor-repos/trebor-tools/index.js\nvar PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers'];\r\nvar PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' };\r\nvar TPS = window[PROP_MAP.p] || (window[PROP_MAP.p] = []);\n\nvar array = Array[PROP_MAP.h];\r\nfunction _$toArgs(args, start) {\r\n if (start === void 0) { start = 0; }\r\n return array.slice.call(args, start);\r\n}\r\nfunction _$arrayValues(list, value, root, key) {\r\n array.push.apply(list, value.map(function (v, i) {\r\n if (list.length !== 0)\r\n i += list.length;\r\n return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, key + \".\" + i) : v;\r\n }));\r\n}\r\nfunction _$List(value, root, key) {\r\n var self = this;\r\n Array.apply(self, [value.length]);\r\n var desc = { writable: false, configurable: false, enumerable: false };\r\n _$define(self, '_key', _$assign({ value: key }, desc));\r\n _$define(self, '_root', _$assign({ value: root }, desc));\r\n _$arrayValues(self, value, root, key);\r\n desc.writable = true;\r\n _$define(self, 'length', _$assign({ value: self.length }, desc));\r\n}\r\n_$extends(_$List, Array);\r\n['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) {\r\n _$List[PROP_MAP.h][method] = function () {\r\n var self = this;\r\n var old = self.slice();\r\n var result;\r\n if (method === 'push') {\r\n _$arrayValues(self, _$toArgs(arguments), self._root, self._key);\r\n result = self.length;\r\n }\r\n else {\r\n result = array[method].apply(self, arguments);\r\n }\r\n _$dispatch(self._root, self._key, old, self.slice());\r\n return result;\r\n };\r\n});\r\n_$List[PROP_MAP.h].pull = function (index) {\r\n var self = this;\r\n var items = _$toArgs(arguments, 1);\r\n var length = self.length;\r\n if (index > length) {\r\n length = index + 1;\r\n var pull = new Array(index - self.length);\r\n pull.push.apply(pull, items);\r\n for (var i = 0; i < length; i++) {\r\n if (i === index) {\r\n self.push.apply(self, pull);\r\n }\r\n }\r\n }\r\n else {\r\n self.splice.apply(self, [index, 1].concat(items));\r\n }\r\n};\n\nfunction _$select(selector, parent) {\r\n return _$isString(selector) ? (parent || document).querySelector(selector) : selector;\r\n}\r\nfunction _$docFragment() {\r\n return document.createDocumentFragment();\r\n}\r\nfunction _$append(parent, child, sibling) {\r\n if (_$isType(sibling, 'boolean') && sibling)\r\n parent.parentElement.replaceChild(child, parent);\r\n else if (!sibling)\r\n parent.appendChild(child);\r\n else\r\n parent.insertBefore(child, sibling);\r\n}\r\nfunction _$assignEl(source, dest) {\r\n var childNodes = source.childNodes, attributes = source.attributes;\r\n for (var i = 0; i < childNodes.length; i++) {\r\n _$append(dest, childNodes[i]);\r\n }\r\n for (var i = 0; i < attributes.length; i++) {\r\n var attr = attributes[i];\r\n dest.setAttributeNS(source.namespaceURI, attr.name, attr.value);\r\n }\r\n source.parentElement.replaceChild(dest, source);\r\n return dest;\r\n}\r\nfunction _$removeEl(el, parent) {\r\n var root = parent || el.parentElement;\r\n if (root)\r\n root.removeChild(el);\r\n}\r\nfunction _$el(tagName) {\r\n return document.createElement(tagName || 'div');\r\n}\r\nfunction _$svg(tagName) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg');\r\n}\r\nfunction _$text(content) {\r\n return document.createTextNode(content || '');\r\n}\r\nfunction _$comment(content) {\r\n return document.createComment(content || '');\r\n}\r\nfunction _$setAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el.setAttribute(attr, _$toString(value));\r\n if (_$isValueAttr(attr) && !_$isString(value))\r\n el[PROP_MAP._] = value;\r\n}\r\nfunction _$getAttr(el, attr) {\r\n return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr);\r\n}\r\nfunction _$getValue(el) {\r\n return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v];\r\n}\r\nfunction _$addListener(el, event, handler) {\r\n el.addEventListener(event, handler, false);\r\n}\r\nfunction _$updateListener(el, event, oldHandler, newHandler) {\r\n _$removeListener(el, event, oldHandler);\r\n _$addListener(el, event, oldHandler = newHandler);\r\n return oldHandler;\r\n}\r\nfunction _$removeListener(el, event, handler) {\r\n el.removeEventListener(event, handler, false);\r\n}\r\nfunction _$bindGroup(input, selection) {\r\n var _value = _$getValue(input);\r\n var _$index = selection.indexOf(_value);\r\n input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1);\r\n}\r\nfunction _$bindMultiSelect(select, selections) {\r\n if (!selections.length)\r\n return;\r\n var options = select.options;\r\n for (var i = 0; i < options.length; i++) {\r\n options[i].selected = !!~selections.indexOf(_$getValue(options[i]));\r\n }\r\n}\r\nfunction _$updateMultiSelect(select, obj, prop) {\r\n var items = [];\r\n var selection = obj[prop];\r\n var selectedOptions = select.selectedOptions;\r\n for (var i = 0; i < selectedOptions.length; i++) {\r\n items.push(_$getValue(selectedOptions[i]));\r\n }\r\n obj[prop] = new _$List(items, selection['_root'], selection['_key']);\r\n obj.$update();\r\n}\r\nfunction _$insertStyle(id, css) {\r\n var isNew = false;\r\n var style = _$select(\"#\" + id, document.head);\r\n if (!style) {\r\n isNew = true;\r\n style = _$el('style');\r\n style.id = id;\r\n _$setAttr(style, ['refs', 1]);\r\n }\r\n if (style.textContent !== css) {\r\n style.textContent = css;\r\n }\r\n if (isNew) {\r\n _$append(document.head, style);\r\n }\r\n else {\r\n var count = +_$getAttr(style, 'refs');\r\n _$setAttr(style, ['refs', ++count]);\r\n }\r\n}\r\nfunction _$removeStyle(id) {\r\n var style = _$select(\"#\" + id, document.head);\r\n if (style) {\r\n var count = +_$getAttr(style, 'refs');\r\n if (--count === 0) {\r\n _$removeEl(style, document.head);\r\n }\r\n else {\r\n _$setAttr(style, ['refs', count]);\r\n }\r\n }\r\n}\n\nfunction _$toLowerCase(str) {\r\n return str.toLowerCase();\r\n}\r\nvar _$assign = Object['assign'] || function (t) {\r\n for (var s = void 0, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s)\r\n if (_$hasProp(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nfunction _$apply(callee, args, globs, thisArg) {\r\n if (thisArg === void 0) { thisArg = null; }\r\n return callee.apply(thisArg, args.concat(globs));\r\n}\r\nfunction _$isValueAttr(attr) {\r\n return attr === 'value';\r\n}\r\nfunction _$subscribers(dep, listener) {\r\n if (!this[PROP_MAP.s][dep]) {\r\n this[PROP_MAP.s][dep] = [];\r\n }\r\n return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1;\r\n}\r\nfunction _$define(obj, key, desc) {\r\n Object.defineProperty(obj, key, desc);\r\n}\r\nfunction _$dispatch(root, key, oldVal, value) {\r\n root.$notify(key);\r\n if (root[PROP_MAP.w][key]) {\r\n _$each(root[PROP_MAP.w][key], function (watcher) { watcher(oldVal, value); });\r\n }\r\n root.$update();\r\n}\r\nfunction _$extends(ctor, exts) {\r\n ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]);\r\n ctor[PROP_MAP.h].constructor = ctor;\r\n}\r\nfunction _$isType(value, type) {\r\n return _$type(type) === 'string' ? type.split('\\|').some(function (t) { return t.trim() === _$type(value); }) : value instanceof type;\r\n}\r\nfunction _$isObject(obj) {\r\n return _$isType(obj, 'object');\r\n}\r\nfunction _$isArray(obj) {\r\n return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array');\r\n}\r\nfunction _$isFunction(obj) {\r\n return _$isType(obj, 'function');\r\n}\r\nfunction _$isString(obj) {\r\n return _$isType(obj, 'string');\r\n}\r\nfunction _$toType(value, type, root, key) {\r\n switch (type) {\r\n case 'date':\r\n return new Date(value);\r\n case 'string':\r\n return _$toString(value);\r\n case 'number':\r\n return +value;\r\n case 'boolean':\r\n return _$isString(value) && !value ? true : !!value;\r\n case 'array':\r\n return _$isType(value, _$List) ? value : new _$List(value, root, key);\r\n default:\r\n return value;\r\n }\r\n}\r\nfunction _$type(obj) {\r\n return _$toLowerCase(/ (\\w+)/.exec({}.toString.call(obj))[1]);\r\n}\r\nfunction _$hasProp(obj, prop) {\r\n return obj.hasOwnProperty(prop);\r\n}\r\nfunction _$directive(dd) {\r\n var hasProp = function (prop, instance, options, element) { return _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); };\r\n return {\r\n $init: function (instance, options, element) {\r\n hasProp('$init', instance, options, element);\r\n },\r\n $inserted: function (instance, options, element) {\r\n hasProp('$inserted', instance, options, element);\r\n },\r\n $update: function (instance, options, element) {\r\n if (_$isFunction(dd)) {\r\n dd(instance, options, element);\r\n }\r\n else {\r\n hasProp('$update', instance, options, element);\r\n }\r\n },\r\n $destroy: function (instance, options, element) {\r\n hasProp('$destroy', instance, options, element);\r\n }\r\n };\r\n}\r\nfunction _$noop() { }\r\nfunction _$addChild(inst, Child, attrs) {\r\n var child = null;\r\n if (Child) {\r\n child = new Child(attrs, inst);\r\n inst.$children.push(child);\r\n }\r\n return child;\r\n}\r\nfunction _$removeChild(inst, child) {\r\n var index = inst.$children.indexOf(child);\r\n index >= 0 && inst.$children.splice(index, 1);\r\n}\r\nfunction _$toString(obj) {\r\n var str = _$type(obj);\r\n return !/null|undefined/.test(str) ? obj.toString() : str;\r\n}\r\nfunction _$toPlainObject(obj) {\r\n var data = {};\r\n _$each(_$isObject(obj) ? obj : {}, function (_v, k) {\r\n if (k[0] !== '$' && !_$isFunction(obj[k])) {\r\n if (_$isType(obj[k], _$List)) {\r\n data[k] = obj[k].map(_$toPlainObject);\r\n }\r\n else if (_$isObject(obj[k])) {\r\n data[k] = _$toPlainObject(obj[k]);\r\n }\r\n else {\r\n data[k] = obj[k];\r\n }\r\n }\r\n });\r\n return _$isObject(obj) ? data : obj;\r\n}\r\nfunction _$setReference(refs, prop, node) {\r\n if (!_$hasProp(refs, prop)) {\r\n var value_1 = [];\r\n _$define(refs, prop, {\r\n get: function () { return value_1.length <= 1 ? value_1[0] : value_1; },\r\n set: function (val) { val && !~value_1.indexOf(val) && value_1.push(val); },\r\n enumerable: true, configurable: true\r\n });\r\n }\r\n refs[prop] = node;\r\n}\r\nfunction _$accesor(object, path, value) {\r\n return path.split('.').reduce(function (obj, key, i, arr) {\r\n if (_$isType(value, 'undefined')) {\r\n if (obj == null) {\r\n arr.splice(0, arr.length);\r\n return i > 0 && obj === null ? obj : undefined;\r\n }\r\n }\r\n else {\r\n if (i === arr.length - 1) {\r\n if (_$isType(obj, _$List) && _$toString(+key) === key) {\r\n obj.pull(+key, value);\r\n }\r\n else {\r\n var oldVal = obj[key];\r\n obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value;\r\n _$dispatch(object, path, oldVal, obj[key]);\r\n }\r\n }\r\n else if (!_$isObject(obj[key])) {\r\n obj[key] = {};\r\n }\r\n }\r\n return obj ? obj[key] : null;\r\n }, object);\r\n}\r\nfunction _$emptyElse() {\r\n return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop };\r\n}\r\nfunction _$isKey(event, key) {\r\n return _$toLowerCase(event.key) === key || !!event[key + \"Key\"];\r\n}\r\nfunction _$bindClasses(value) {\r\n var classes = '';\r\n if (_$isString(value)) {\r\n classes += \" \" + value;\r\n }\r\n else if (_$isArray(value)) {\r\n classes = value.map(_$bindClasses).join(' ');\r\n }\r\n else if (_$isObject(value)) {\r\n for (var key in value)\r\n if (_$hasProp(value, key) && value[key])\r\n classes += \" \" + key;\r\n }\r\n return classes.trim();\r\n}\r\nfunction _$bindStyle(value) {\r\n var el = _$el();\r\n if (_$isObject(value)) {\r\n var style_1 = el.style;\r\n _$each(value, function (val, prop) {\r\n if (val !== style_1[prop])\r\n style_1[prop] = val;\r\n });\r\n return style_1.cssText;\r\n }\r\n else if (_$isString(value)) {\r\n return value;\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\nfunction _$conditionalUpdate(block, condition, parent, anchor, inst) {\r\n var globs = _$toArgs(arguments, 5);\r\n if (block && block.type === _$apply(condition, [inst], globs).type) {\r\n _$apply(block.$update, [inst], globs, block);\r\n }\r\n else {\r\n block && block.$destroy();\r\n block = _$apply(condition, [inst], globs);\r\n block.$create();\r\n block.$mount(parent || inst.$parentEl, anchor);\r\n }\r\n return block;\r\n}\r\nfunction _$bindUpdate(el, binding) {\r\n var attr = binding[0], value = binding[1];\r\n var _value = _$toString(value);\r\n if (_$isValueAttr(attr)) {\r\n if (el[attr] !== _value)\r\n el[attr] = _value;\r\n el[PROP_MAP._] = value;\r\n }\r\n else if (_$getAttr(el, attr) !== _value) {\r\n _$setAttr(el, [attr, _value]);\r\n }\r\n}\r\nfunction _$bindBooleanAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true);\r\n}\r\nfunction _$textUpdate(text, value) {\r\n if (text.data !== (value = _$toString(value)))\r\n text.data = value;\r\n}\r\nfunction _$tagUpdate(node, tag) {\r\n return _$toLowerCase(tag) !== _$toLowerCase(node.tagName) ? _$assignEl(node, _$el(tag)) : node;\r\n}\r\nfunction _$removeReference(refs, prop, node) {\r\n var nodes = refs[prop];\r\n _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]);\r\n}\r\nfunction _$htmlUpdate(node, value) {\r\n if (node.innerHTML !== (value = _$toString(value)))\r\n node.innerHTML = value;\r\n}\r\nfunction _$componentUpdate(parent, Ctor, inst, value, attrs, el, sibling) {\r\n if (value === Ctor) {\r\n inst && inst.$update();\r\n }\r\n else {\r\n Ctor = value;\r\n if (inst) {\r\n inst.$destroy();\r\n _$removeChild(parent, inst);\r\n }\r\n if (inst) {\r\n inst = _$addChild(parent, Ctor, attrs);\r\n inst.$create();\r\n inst.$mount(el, sibling);\r\n }\r\n }\r\n return [inst, Ctor];\r\n}\r\nfunction _$destroyComponent(component) {\r\n component.$unmount();\r\n component.$parent = null;\r\n component.$parentEl = null;\r\n component.$siblingEl = null;\r\n component.$children.splice(0, component.$children.length);\r\n}\r\nfunction _$setElements(component, parent, sibling) {\r\n var brother = _$select(sibling);\r\n component.$siblingEl = brother;\r\n component.$parentEl = sibling && brother.parentElement || _$select(parent);\r\n}\r\nfunction _$forLoop(root, obj, loop) {\r\n var items = {}, loopParent, loopSibling;\r\n var globs = _$toArgs(arguments, 3);\r\n _$each(obj, function (item, i, index) { items[i] = _$apply(loop, [root, item, i, index], globs); });\r\n return {\r\n $create: function () {\r\n _$each(items, function (item) { item.$create(); });\r\n },\r\n $mount: function (parent, sibling) {\r\n loopParent = _$select(parent);\r\n loopSibling = _$select(sibling);\r\n _$each(items, function (item) { item.$mount(loopParent, loopSibling); });\r\n },\r\n $update: function (root, obj) {\r\n var globs = _$toArgs(arguments, 2);\r\n _$each(items, function (item, i, index) {\r\n if (obj[i]) {\r\n _$apply(item.$update, [root, obj[i], i, index], globs, item);\r\n }\r\n else {\r\n item.$destroy();\r\n delete items[i];\r\n }\r\n });\r\n _$each(obj, function (item, i, index) {\r\n if (!items[i]) {\r\n items[i] = _$apply(loop, [root, item, i, index], globs);\r\n items[i].$create();\r\n items[i].$mount(loopParent, loopSibling);\r\n }\r\n });\r\n },\r\n $destroy: function () {\r\n _$each(items, function (item) { item.$destroy(); });\r\n }\r\n };\r\n}\r\nfunction _$each(obj, cb) {\r\n var i = 0;\r\n for (var key in obj) {\r\n if (_$hasProp(obj, key)) {\r\n cb(obj[key], (isNaN(+key) ? key : +key), i++);\r\n }\r\n }\r\n}\n\nfunction _$BaseComponent(attrs, template, options, parent) {\r\n var self = this;\r\n var _$set = function (prop, value) { _$define(self, prop, { value: value, writable: true }); };\r\n if (!attrs)\r\n attrs = {};\r\n _$each(PROPS, function (prop) { _$define(self, prop, { value: {} }); });\r\n _$set('$parent', parent || null);\r\n _$set('$children', []);\r\n _$set(PROP_MAP.s, {});\r\n _$set('$options', options);\r\n var opts = self.$options;\r\n if (!opts.attrs)\r\n opts.attrs = {};\r\n if (!opts.children)\r\n opts.children = {};\r\n _$each(TPS, function (plugin) { plugin.fn.call(self, _$BaseComponent, plugin.options); });\r\n if (opts.filters)\r\n _$assign(self.$filters, opts.filters);\r\n if (opts.directives)\r\n _$each(opts.directives, function (drt, k) { self.$directives[k] = _$directive(drt); });\r\n _$each(opts.attrs, function (attrOps, key) {\r\n _$define(self, (_$isType(key, 'number') ? attrOps : key), {\r\n get: function () {\r\n if (_$isString(attrOps)) {\r\n var value = attrs[attrOps];\r\n return _$isFunction(value) ? value() : value;\r\n }\r\n else {\r\n if (!_$hasProp(attrs, key) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' is required.\");\r\n }\r\n else {\r\n var value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key];\r\n if (value === void 0 && _$hasProp(attrOps, 'default')) {\r\n var def = attrOps.default;\r\n value = _$isFunction(def) ? def() : def;\r\n }\r\n var typ = attrOps.type;\r\n if (typ && !_$isType(value, typ) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' must be type '\" + typ + \"'.\");\r\n }\r\n value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key);\r\n if (value !== void 0 && _$hasProp(attrOps, 'validator')) {\r\n var validator = attrOps.validator;\r\n if (_$isFunction(validator) && !validator(value)) {\r\n return console.error(\"Assigment '\" + key + \"'='\" + JSON.stringify(value) + \"' invalid.\");\r\n }\r\n }\r\n return value;\r\n }\r\n }\r\n },\r\n set: function () {\r\n console.error(\"'\" + key + \"' is read only.\");\r\n },\r\n enumerable: true, configurable: true\r\n });\r\n });\r\n var data = opts.model || {};\r\n var _loop_1 = function (key) {\r\n if (_$hasProp(data, key)) {\r\n var desc = Object.getOwnPropertyDescriptor(data, key);\r\n if (desc.value && _$isArray(desc.value)) {\r\n desc.value = new _$List(desc.value, self, key);\r\n }\r\n else {\r\n if (desc.get) {\r\n var getter_1 = desc.get;\r\n desc.get = function () {\r\n var value = getter_1.call(self);\r\n if (_$isArray(value))\r\n value = new _$List(value, self, key);\r\n return value;\r\n };\r\n }\r\n if (desc.set) {\r\n var setter_1 = desc.set;\r\n desc.set = function (v) {\r\n if (_$isArray(v))\r\n v = new _$List(v, self, key);\r\n setter_1.call(self, v);\r\n };\r\n }\r\n }\r\n _$define(self, key, desc);\r\n }\r\n };\r\n for (var key in data) {\r\n _loop_1(key);\r\n }\r\n var tpl = template(self);\r\n _$each(tpl, function (value, key) {\r\n _$define(self, key, {\r\n value: (function (key) {\r\n var hook = key[1].toUpperCase() + key.slice(2);\r\n var bhook = opts[\"will\" + hook];\r\n var ahook = opts[\"did\" + hook];\r\n return function () {\r\n bhook && bhook.call(this);\r\n key === '$update' ? value.call(this, this) : value.apply(this, arguments);\r\n ahook && ahook.call(this);\r\n };\r\n })(key)\r\n });\r\n });\r\n _$define(self, '$data', {\r\n get: function () {\r\n return _$toPlainObject(this);\r\n }\r\n });\r\n}\r\n_$assign(_$BaseComponent[PROP_MAP.h], {\r\n $get: function (path) {\r\n return _$accesor(this, path);\r\n },\r\n $set: function (path, value) {\r\n _$accesor(this, path, value);\r\n },\r\n $on: function (event, handler) {\r\n var _this = this;\r\n if (!this[PROP_MAP.e][event]) {\r\n this[PROP_MAP.e][event] = [];\r\n }\r\n var i = this[PROP_MAP.e][event].push(handler);\r\n return {\r\n $off: function () {\r\n _this[PROP_MAP.e][event].splice(i - 1, 1);\r\n }\r\n };\r\n },\r\n $once: function (event, handler) {\r\n var e = this.$on(event, function (args) {\r\n handler(args);\r\n e.$off();\r\n });\r\n },\r\n $fire: function (event, data) {\r\n if (this[PROP_MAP.e][event]) {\r\n _$each(this[PROP_MAP.e][event], function (handler) { handler(data); });\r\n }\r\n },\r\n $notify: function (key) {\r\n if (this[PROP_MAP.s][key]) {\r\n _$each(this[PROP_MAP.s][key], function (suscriber) { suscriber(); });\r\n }\r\n },\r\n $observe: function (deps, listener) {\r\n var _this = this;\r\n var subs = [];\r\n if (_$isArray(deps)) {\r\n _$each(deps, function (dep) {\r\n subs.push({ sub: dep, i: _$subscribers.call(_this, dep, listener) });\r\n });\r\n }\r\n else {\r\n subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) });\r\n }\r\n return {\r\n $unobserve: function () {\r\n _$each(subs, function (sub) {\r\n _this[PROP_MAP.s][sub.sub].splice(sub.i, 1);\r\n });\r\n }\r\n };\r\n },\r\n $watch: function (key, watcher) {\r\n var _this = this;\r\n if (!this[PROP_MAP.w][key]) {\r\n this[PROP_MAP.w][key] = [];\r\n }\r\n var i = this[PROP_MAP.w][key].push(watcher.bind(this));\r\n return {\r\n $unwatch: function () {\r\n _this[PROP_MAP.w][key].splice(i - 1, 1);\r\n }\r\n };\r\n }\r\n});\r\nfunction _$Ctor(moduleName, tpl, options) {\r\n var _a;\r\n var ctor = (_a = {},\r\n _a[moduleName] = function (_$attrs, _$parent) {\r\n _$BaseComponent.call(this, _$attrs, tpl, options, _$parent);\r\n !_$parent && this.$create();\r\n },\r\n _a)[moduleName];\r\n ctor.plugin = function (fn, options) {\r\n TPS.push({ options: options, fn: fn });\r\n };\r\n _$extends(ctor, _$BaseComponent);\r\n return ctor;\r\n}\n\n\n//# sourceMappingURL=index.js.map\n\n// CONCATENATED MODULE: ./components/calendar.ts\n/* harmony default export */ var calendar = ({\r\n attrs: {\r\n value: {\r\n type: 'date',\r\n default: function () { return new Date(); }\r\n },\r\n show: {\r\n type: 'boolean',\r\n default: true\r\n },\r\n place: {\r\n type: 'string',\r\n default: 'right'\r\n },\r\n labelTemplate: {\r\n type: 'string',\r\n default: '${month} of ${year}'\r\n },\r\n options: {\r\n type: 'object',\r\n default: function () { return ({\r\n daysOfWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'],\r\n months: [\r\n 'January', 'February', 'March', 'April', 'May', 'June', 'July',\r\n 'August', 'September', 'October', 'November', 'Dicember',\r\n ]\r\n }); }\r\n }\r\n },\r\n didMount: function () {\r\n this.$set('date', new Date(this.value.valueOf()));\r\n this.createCalendar(this.date.getMonth(), this.date.getFullYear());\r\n },\r\n model: {\r\n view: '',\r\n month: [],\r\n date: new Date(),\r\n get viewLabel() {\r\n switch (this.view) {\r\n case 'months':\r\n return this.date.getFullYear();\r\n case 'years':\r\n var part = this.date.getFullYear().toString().substring(0, 3);\r\n return part + \"0 - \" + part + \"9\";\r\n default:\r\n return this.labelTemplate\r\n .replace(/\\${day}/g, this.date.getDate() + '')\r\n .replace(/\\${month}/g, this.options.months[this.date.getMonth()])\r\n .replace(/\\${year}/g, this.date.getFullYear() + '');\r\n }\r\n },\r\n get decade() {\r\n return this.yearInDecade(this.date.getFullYear());\r\n },\r\n get months() {\r\n var _this = this;\r\n var d = new Date();\r\n return this.options.months.map(function (month, i) { return ({\r\n value: i, month: month.substring(0, 3),\r\n active: d.getMonth() === i && d.getFullYear() === _this.date.getFullYear()\r\n }); });\r\n },\r\n get visibility() {\r\n if (!this.show) {\r\n this.$set('view', '');\r\n }\r\n return this.show;\r\n },\r\n selectView: function () {\r\n this.$set('view', this.view === '' ? 'months' : 'years');\r\n },\r\n itemState: function (item) {\r\n return { active: item.active, disabled: item.disabled, selected: item.selected };\r\n },\r\n resetDate: function () {\r\n this.$set('date', new Date());\r\n this.$fire('change', new Date());\r\n this.createCalendar(this.date.getMonth(), this.date.getFullYear());\r\n },\r\n resetDaySelection: function () {\r\n this.month.forEach(function (week) {\r\n week.days.forEach(function (day) {\r\n day.selected && (day.selected = false);\r\n });\r\n });\r\n },\r\n selectDay: function (day) {\r\n if (!day.disabled) {\r\n this.resetDaySelection();\r\n var date = new Date(this.date.getFullYear(), this.date.getMonth(), day.day);\r\n this.$fire('change', date);\r\n day.selected = true;\r\n this.$update();\r\n }\r\n },\r\n selectMonth: function (month) {\r\n if (!month.disabled) {\r\n this.date.setMonth(month.value);\r\n this.createCalendar(this.date.getMonth(), this.date.getFullYear());\r\n this.$set('view', '');\r\n }\r\n },\r\n selectYear: function (year) {\r\n if (!year.disabled) {\r\n this.date.setFullYear(year.year);\r\n this.$set('view', 'months');\r\n }\r\n },\r\n weekOfYear: function (day, month, year) {\r\n var target = new Date(year, month, day);\r\n var dayNr = (target.getDay() + 6) % 7;\r\n target.setDate(target.getDate() - dayNr + 3);\r\n var firstThursday = target.valueOf();\r\n target.setMonth(0, 1);\r\n if (target.getDay() !== 4) {\r\n target.setMonth(0, 1 + ((4 - target.getDay()) + 7) % 7);\r\n }\r\n return 1 + Math.ceil((firstThursday - target.valueOf()) / 604800000);\r\n },\r\n monthOfYear: function (row) {\r\n switch (row) {\r\n case 1:\r\n return this.months.slice(4, 8);\r\n case 2:\r\n return this.months.slice(8);\r\n default:\r\n return this.months.slice(0, 4);\r\n }\r\n },\r\n yearOfDecade: function (row) {\r\n switch (row) {\r\n case 1:\r\n return this.decade.slice(4, 8);\r\n case 2:\r\n return this.decade.slice(8);\r\n default:\r\n return this.decade.slice(0, 4);\r\n }\r\n },\r\n yearInDecade: function (year) {\r\n var now = new Date();\r\n var range = [];\r\n var text = year.toString();\r\n var first = parseInt(text.substring(0, text.length - 1) + 0);\r\n for (var i = 0; i < 12; i++) {\r\n if (i === 0) {\r\n range[i] = { year: first - 1, disabled: true, };\r\n }\r\n else if (i === 11) {\r\n range[i] = { year: first + 10, disabled: true, };\r\n }\r\n else {\r\n var y = first + i - 1;\r\n range[i] = { year: y, active: y === now.getFullYear() };\r\n }\r\n }\r\n return range;\r\n },\r\n daysOfMonth: function (month, year) {\r\n return 32 - new Date(year, month, 32).getDate();\r\n },\r\n createCalendar: function (month, year) {\r\n var date = new Date(year, month, 1).getDay();\r\n var numDays = this.daysOfMonth(month, year);\r\n var lastDay = this.daysOfMonth(month - 1, year);\r\n var start = 1;\r\n var end = 7 - date;\r\n var d = new Date();\r\n var weeks = [];\r\n while (start <= numDays) {\r\n var days = [];\r\n var length_1 = end - start + 1;\r\n for (var i = 0; i < length_1; i++) {\r\n days[i] = {\r\n day: start + i,\r\n active: (start + i) === d.getDate() && d.getMonth() === month && d.getFullYear() === year\r\n };\r\n }\r\n if (days.length < 7 && start === 1) {\r\n for (var i = 0; i < date; i++) {\r\n days.unshift({ day: lastDay - i, disabled: true });\r\n }\r\n }\r\n else if (days.length < 7 && days.length > 0) {\r\n var nend = 7 - days.length;\r\n for (var i = 1; i <= nend; i++) {\r\n days[days.length] = { day: i, disabled: true };\r\n }\r\n }\r\n var week = {\r\n start: start, end: end, days: days,\r\n weekYear: this.weekOfYear(end, month, year)\r\n };\r\n weeks[weeks.length] = week;\r\n start = end + 1;\r\n end = start === 1 && end === 8 ? 1 : end + 7;\r\n if (end > numDays) {\r\n end = numDays;\r\n }\r\n }\r\n if (weeks.length === 4 || date === 0) {\r\n var days = [];\r\n for (var i = 0; i < 7; i++) {\r\n days[6 - i] = { day: lastDay - i, disabled: true };\r\n }\r\n var start_1 = days[0].day;\r\n var end_1 = days[days.length - 1].day;\r\n weeks.unshift({\r\n start: start_1, end: end_1, days: days,\r\n weekYear: this.weekOfYear(end_1, month - 1, year)\r\n });\r\n }\r\n if (weeks.length === 5) {\r\n var days = [];\r\n var start_2 = 1;\r\n var end_2 = 7;\r\n var lastWeek = weeks[weeks.length - 1];\r\n var lastDay_1 = lastWeek.days[lastWeek.days.length - 1];\r\n if (!~[28, 29, 30, 31].indexOf(lastDay_1.day)) {\r\n start_2 = lastDay_1.day + 1;\r\n end_2 = 6 + start_2;\r\n }\r\n for (var i = 0; i < 7; i++) {\r\n days[i] = { day: start_2 + i, disabled: true };\r\n }\r\n weeks.push({\r\n start: start_2, end: end_2, days: days,\r\n weekYear: this.weekOfYear(end_2, month + 1, year)\r\n });\r\n }\r\n this.$set('month', weeks);\r\n },\r\n prev: function () {\r\n if (this.view === 'years') {\r\n this.date = new Date(this.date.getFullYear() - 10, this.date.getMonth(), this.date.getDate());\r\n }\r\n else if (this.view === 'months') {\r\n this.date = new Date(this.date.getFullYear() - 1, this.date.getMonth(), this.date.getDate());\r\n }\r\n else {\r\n this.date = new Date(this.date.getFullYear(), this.date.getMonth() - 1, 1);\r\n this.createCalendar(this.date.getMonth(), this.date.getFullYear());\r\n }\r\n this.$update();\r\n },\r\n next: function () {\r\n if (this.view === 'years') {\r\n this.date = new Date(this.date.getFullYear() + 10, this.date.getMonth(), this.date.getDate());\r\n }\r\n else if (this.view === 'months') {\r\n this.date = new Date(this.date.getFullYear() + 1, this.date.getMonth(), this.date.getDate());\r\n }\r\n else {\r\n this.date = new Date(this.date.getFullYear(), this.date.getMonth() + 1, 1);\r\n this.createCalendar(this.date.getMonth(), this.date.getFullYear());\r\n }\r\n this.$update();\r\n }\r\n }\r\n});\r\n\n// CONCATENATED MODULE: ./components/calendar.html\n\r\n\r\nfunction itemLoop_1(_$state, dayOfWeek) {\r\n var _$frag, th_1, txt_1, setTxt_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state, dayOfWeek) {\r\n return dayOfWeek;\r\n };\r\n return {\r\n $create: function() {\r\n th_1 = _$el('th');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state, dayOfWeek);\r\n _$setAttr(th_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, dayOfWeek) {\r\n _$textUpdate(txt_1, setTxt_1(_$state, dayOfWeek));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(th_1, txt_1);\r\n _$append(_$frag, th_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$frag = th_1 = txt_1 = setTxt_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction ifCondition_1(_$state) {\r\n var _$frag, thead_1, tr_1, th_1, loopAnchor_1_1, loopBlock_1;\r\n _$frag = _$docFragment();\r\n loopBlock_1 = _$forLoop(_$state, _$state.options.daysOfWeek, itemLoop_1);\r\n loopAnchor_1_1 = _$text();\r\n return {\r\n type: 'if',\r\n\r\n $create: function() {\r\n thead_1 = _$el('thead');\r\n tr_1 = _$el('tr');\r\n th_1 = _$el('th');\r\n th_1.innerHTML = 'W#';\r\n loopBlock_1.$create();\r\n _$setAttr(th_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(tr_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(thead_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state) {\r\n loopBlock_1.$update(_$state, _$state.options.daysOfWeek);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(tr_1, th_1);\r\n _$append(tr_1, loopAnchor_1_1);\r\n loopBlock_1.$mount(tr_1, loopAnchor_1_1);\r\n _$append(thead_1, tr_1);\r\n _$append(_$frag, thead_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_1.$destroy();\r\n _$frag = thead_1 = tr_1 = th_1 = loopAnchor_1_1 = loopBlock_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction condition_1(_$state) {\r\n if (_$state.view === '')\r\n return ifCondition_1(_$state);\r\n else\r\n return _$emptyElse();\r\n}\r\nfunction ifCondition_3(_$state, year, row) {\r\n var _$frag, a_1, txt_1, setTxt_1, bindClassA_1, clickEvent_1, handlerClickEvent_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state, year) {\r\n return year.year;\r\n };\r\n bindClassA_1 = function(_$state, year) {\r\n return [\r\n 'class',\r\n ('scope_126c28ac ' + _$bindClasses(_$state.itemState(year))).trim()\r\n ];\r\n };\r\n clickEvent_1 = function(_$state, year) {\r\n _$state.selectYear(year);\r\n };\r\n return {\r\n type: 'if',\r\n\r\n $create: function() {\r\n a_1 = _$el('a');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state, year, row);\r\n _$setAttr(a_1, ['href', '#']);\r\n _$setAttr(a_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(a_1, bindClassA_1(_$state, year, row));\r\n _$addListener(a_1, 'click', handlerClickEvent_1 = function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, year, row, event, a_1);\r\n });\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, year, row) {\r\n _$textUpdate(txt_1, setTxt_1(_$state, year, row));\r\n _$bindUpdate(a_1, bindClassA_1(_$state, year, row));\r\n handlerClickEvent_1 = _$updateListener(a_1, 'click', handlerClickEvent_1, function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, year, row, event, a_1);\r\n });\r\n },\r\n\r\n $unmount: function() {\r\n _$append(a_1, txt_1);\r\n _$append(_$frag, a_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$removeListener(a_1, 'click', handlerClickEvent_1);\r\n _$frag = a_1 = txt_1 = setTxt_1 = bindClassA_1 = clickEvent_1 = handlerClickEvent_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction elseCondition_3() {\r\n var _$frag, template_1;\r\n _$frag = _$docFragment();\r\n return {\r\n type: 'else',\r\n\r\n $create: function() {\r\n template_1 = _$docFragment();\r\n template_1 = _$el('template');\r\n template_1.innerHTML = '';\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: _$noop,\r\n\r\n $unmount: function() {\r\n _$append(_$frag, template_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$frag = template_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction condition_3(_$state, year, row) {\r\n if (!year.disabled)\r\n return ifCondition_3(_$state, year, row);\r\n else\r\n return elseCondition_3(_$state, year, row);\r\n}\r\nfunction itemLoop_3(_$state, year, _$v, _$i, row) {\r\n var _$frag, td_1, conditionAnchor_1, conditionBlock_1, bindClassTd_1;\r\n _$frag = _$docFragment();\r\n conditionAnchor_1 = _$text();\r\n bindClassTd_1 = function(_$state, year) {\r\n return ['class', ('scope_126c28ac ' + _$bindClasses({\r\n disabled: year.disabled\r\n })).trim()];\r\n };\r\n return {\r\n $create: function() {\r\n td_1 = _$el('td');\r\n conditionBlock_1 = condition_3(_$state, year, row);\r\n conditionBlock_1.$create();\r\n _$setAttr(td_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(td_1, bindClassTd_1(_$state, year, row));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, year, _$v, _$i, row) {\r\n conditionBlock_1 = _$conditionalUpdate(conditionBlock_1, condition_3, td_1, conditionAnchor_1, _$state, year, row);\r\n _$bindUpdate(td_1, bindClassTd_1(_$state, year, row));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(td_1, conditionAnchor_1);\r\n conditionBlock_1.$mount(td_1, conditionAnchor_1);\r\n _$append(_$frag, td_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n conditionBlock_1.$destroy();\r\n _$frag = td_1 = conditionAnchor_1 = conditionBlock_1 = bindClassTd_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction itemLoop_2(_$state, row) {\r\n var _$frag, tr_1, loopAnchor_3_1, loopBlock_3;\r\n _$frag = _$docFragment();\r\n loopBlock_3 = _$forLoop(_$state, _$state.yearOfDecade(row), itemLoop_3, row);\r\n loopAnchor_3_1 = _$text();\r\n return {\r\n $create: function() {\r\n tr_1 = _$el('tr');\r\n loopBlock_3.$create();\r\n _$setAttr(tr_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, row) {\r\n loopBlock_3.$update(_$state, _$state.yearOfDecade(row), row);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(tr_1, loopAnchor_3_1);\r\n loopBlock_3.$mount(tr_1, loopAnchor_3_1);\r\n _$append(_$frag, tr_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_3.$destroy();\r\n _$frag = tr_1 = loopAnchor_3_1 = loopBlock_3 = void 0;\r\n }\r\n };\r\n}\r\nfunction ifCondition_2(_$state) {\r\n var _$frag, tbody_1, loopAnchor_2_1, loopBlock_2;\r\n _$frag = _$docFragment();\r\n loopBlock_2 = _$forLoop(_$state, [0, 1, 2], itemLoop_2);\r\n loopAnchor_2_1 = _$text();\r\n return {\r\n type: 'if',\r\n\r\n $create: function() {\r\n tbody_1 = _$el('tbody');\r\n loopBlock_2.$create();\r\n _$setAttr(tbody_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state) {\r\n loopBlock_2.$update(_$state, [0, 1, 2]);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(tbody_1, loopAnchor_2_1);\r\n loopBlock_2.$mount(tbody_1, loopAnchor_2_1);\r\n _$append(_$frag, tbody_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_2.$destroy();\r\n _$frag = tbody_1 = loopAnchor_2_1 = loopBlock_2 = void 0;\r\n }\r\n };\r\n}\r\nfunction ifCondition_4(_$state, month, row) {\r\n var _$frag, a_1, txt_1, setTxt_1, bindClassA_1, clickEvent_1, handlerClickEvent_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state, month) {\r\n return month.month;\r\n };\r\n bindClassA_1 = function(_$state, month) {\r\n return [\r\n 'class',\r\n ('scope_126c28ac ' + _$bindClasses(_$state.itemState(month))).trim()\r\n ];\r\n };\r\n clickEvent_1 = function(_$state, month) {\r\n _$state.selectMonth(month);\r\n };\r\n return {\r\n type: 'if',\r\n\r\n $create: function() {\r\n a_1 = _$el('a');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state, month, row);\r\n _$setAttr(a_1, ['href', '#']);\r\n _$setAttr(a_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(a_1, bindClassA_1(_$state, month, row));\r\n _$addListener(a_1, 'click', handlerClickEvent_1 = function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, month, row, event, a_1);\r\n });\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, month, row) {\r\n _$textUpdate(txt_1, setTxt_1(_$state, month, row));\r\n _$bindUpdate(a_1, bindClassA_1(_$state, month, row));\r\n handlerClickEvent_1 = _$updateListener(a_1, 'click', handlerClickEvent_1, function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, month, row, event, a_1);\r\n });\r\n },\r\n\r\n $unmount: function() {\r\n _$append(a_1, txt_1);\r\n _$append(_$frag, a_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$removeListener(a_1, 'click', handlerClickEvent_1);\r\n _$frag = a_1 = txt_1 = setTxt_1 = bindClassA_1 = clickEvent_1 = handlerClickEvent_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction elseCondition_4() {\r\n var _$frag, template_1;\r\n _$frag = _$docFragment();\r\n return {\r\n type: 'else',\r\n\r\n $create: function() {\r\n template_1 = _$docFragment();\r\n template_1 = _$el('template');\r\n template_1.innerHTML = '';\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: _$noop,\r\n\r\n $unmount: function() {\r\n _$append(_$frag, template_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$frag = template_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction condition_4(_$state, month, row) {\r\n if (!month.disabled)\r\n return ifCondition_4(_$state, month, row);\r\n else\r\n return elseCondition_4(_$state, month, row);\r\n}\r\nfunction itemLoop_5(_$state, month, _$v, _$i, row) {\r\n var _$frag, td_1, conditionAnchor_1, conditionBlock_1, bindClassTd_1;\r\n _$frag = _$docFragment();\r\n conditionAnchor_1 = _$text();\r\n bindClassTd_1 = function(_$state, month) {\r\n return ['class', ('scope_126c28ac ' + _$bindClasses({\r\n disabled: month.disabled\r\n })).trim()];\r\n };\r\n return {\r\n $create: function() {\r\n td_1 = _$el('td');\r\n conditionBlock_1 = condition_4(_$state, month, row);\r\n conditionBlock_1.$create();\r\n _$setAttr(td_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(td_1, bindClassTd_1(_$state, month, row));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, month, _$v, _$i, row) {\r\n conditionBlock_1 = _$conditionalUpdate(\r\n conditionBlock_1,\r\n condition_4,\r\n td_1,\r\n conditionAnchor_1,\r\n _$state,\r\n month,\r\n row\r\n );\r\n _$bindUpdate(td_1, bindClassTd_1(_$state, month, row));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(td_1, conditionAnchor_1);\r\n conditionBlock_1.$mount(td_1, conditionAnchor_1);\r\n _$append(_$frag, td_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n conditionBlock_1.$destroy();\r\n _$frag = td_1 = conditionAnchor_1 = conditionBlock_1 = bindClassTd_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction itemLoop_4(_$state, row) {\r\n var _$frag, tr_1, loopAnchor_5_1, loopBlock_5;\r\n _$frag = _$docFragment();\r\n loopBlock_5 = _$forLoop(_$state, _$state.monthOfYear(row), itemLoop_5, row);\r\n loopAnchor_5_1 = _$text();\r\n return {\r\n $create: function() {\r\n tr_1 = _$el('tr');\r\n loopBlock_5.$create();\r\n _$setAttr(tr_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, row) {\r\n loopBlock_5.$update(_$state, _$state.monthOfYear(row), row);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(tr_1, loopAnchor_5_1);\r\n loopBlock_5.$mount(tr_1, loopAnchor_5_1);\r\n _$append(_$frag, tr_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_5.$destroy();\r\n _$frag = tr_1 = loopAnchor_5_1 = loopBlock_5 = void 0;\r\n }\r\n };\r\n}\r\nfunction elseIf_1_condition_2(_$state) {\r\n var _$frag, tbody_1, loopAnchor_4_1, loopBlock_4;\r\n _$frag = _$docFragment();\r\n loopBlock_4 = _$forLoop(_$state, [0, 1, 2], itemLoop_4);\r\n loopAnchor_4_1 = _$text();\r\n return {\r\n type: 'elseIf_1',\r\n\r\n $create: function() {\r\n tbody_1 = _$el('tbody');\r\n loopBlock_4.$create();\r\n _$setAttr(tbody_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state) {\r\n loopBlock_4.$update(_$state, [0, 1, 2]);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(tbody_1, loopAnchor_4_1);\r\n loopBlock_4.$mount(tbody_1, loopAnchor_4_1);\r\n _$append(_$frag, tbody_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_4.$destroy();\r\n _$frag = tbody_1 = loopAnchor_4_1 = loopBlock_4 = void 0;\r\n }\r\n };\r\n}\r\nfunction ifCondition_5(_$state, day, week) {\r\n var _$frag, a_1, txt_1, setTxt_1, bindClassA_1, clickEvent_1, handlerClickEvent_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state, day) {\r\n return day.day < 10 ? '0' + day.day : day.day;\r\n };\r\n bindClassA_1 = function(_$state, day) {\r\n return [\r\n 'class',\r\n ('scope_126c28ac ' + _$bindClasses(_$state.itemState(day))).trim()\r\n ];\r\n };\r\n clickEvent_1 = function(_$state, day) {\r\n _$state.selectDay(day);\r\n };\r\n return {\r\n type: 'if',\r\n\r\n $create: function() {\r\n a_1 = _$el('a');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state, day, week);\r\n _$setAttr(a_1, ['href', '#']);\r\n _$setAttr(a_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(a_1, bindClassA_1(_$state, day, week));\r\n _$addListener(a_1, 'click', handlerClickEvent_1 = function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, day, week, event, a_1);\r\n });\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, day, week) {\r\n _$textUpdate(txt_1, setTxt_1(_$state, day, week));\r\n _$bindUpdate(a_1, bindClassA_1(_$state, day, week));\r\n handlerClickEvent_1 = _$updateListener(a_1, 'click', handlerClickEvent_1, function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, day, week, event, a_1);\r\n });\r\n },\r\n\r\n $unmount: function() {\r\n _$append(a_1, txt_1);\r\n _$append(_$frag, a_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$removeListener(a_1, 'click', handlerClickEvent_1);\r\n _$frag = a_1 = txt_1 = setTxt_1 = bindClassA_1 = clickEvent_1 = handlerClickEvent_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction elseCondition_5() {\r\n var _$frag, template_1;\r\n _$frag = _$docFragment();\r\n return {\r\n type: 'else',\r\n\r\n $create: function() {\r\n template_1 = _$docFragment();\r\n template_1 = _$el('template');\r\n template_1.innerHTML = '';\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: _$noop,\r\n\r\n $unmount: function() {\r\n _$append(_$frag, template_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$frag = template_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction condition_5(_$state, day, week) {\r\n if (!day.disabled)\r\n return ifCondition_5(_$state, day, week);\r\n else\r\n return elseCondition_5(_$state, day, week);\r\n}\r\nfunction itemLoop_7(_$state, day, _$v, _$i, week) {\r\n var _$frag, td_1, conditionAnchor_1, conditionBlock_1, bindClassTd_1;\r\n _$frag = _$docFragment();\r\n conditionAnchor_1 = _$text();\r\n bindClassTd_1 = function(_$state, day) {\r\n return ['class', ('scope_126c28ac ' + _$bindClasses({\r\n disabled: day.disabled\r\n })).trim()];\r\n };\r\n return {\r\n $create: function() {\r\n td_1 = _$el('td');\r\n conditionBlock_1 = condition_5(_$state, day, week);\r\n conditionBlock_1.$create();\r\n _$setAttr(td_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(td_1, bindClassTd_1(_$state, day, week));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, day, _$v, _$i, week) {\r\n conditionBlock_1 = _$conditionalUpdate(conditionBlock_1, condition_5, td_1, conditionAnchor_1, _$state, day, week);\r\n _$bindUpdate(td_1, bindClassTd_1(_$state, day, week));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(td_1, conditionAnchor_1);\r\n conditionBlock_1.$mount(td_1, conditionAnchor_1);\r\n _$append(_$frag, td_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n conditionBlock_1.$destroy();\r\n _$frag = td_1 = conditionAnchor_1 = conditionBlock_1 = bindClassTd_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction itemLoop_6(_$state, week) {\r\n var _$frag, tr_1, td_1, txt_1, setTxt_1, loopAnchor_7_1, loopBlock_7;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state, week) {\r\n return week.weekYear < 10 ? '0' + week.weekYear : week.weekYear;\r\n };\r\n loopBlock_7 = _$forLoop(_$state, week.days, itemLoop_7, week);\r\n loopAnchor_7_1 = _$text();\r\n return {\r\n $create: function() {\r\n tr_1 = _$el('tr');\r\n td_1 = _$el('td');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state, week);\r\n loopBlock_7.$create();\r\n _$setAttr(td_1, ['class', 'scope_126c28ac week']);\r\n _$setAttr(tr_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, week) {\r\n _$textUpdate(txt_1, setTxt_1(_$state, week));\r\n loopBlock_7.$update(_$state, week.days, week);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(td_1, txt_1);\r\n _$append(tr_1, td_1);\r\n _$append(tr_1, loopAnchor_7_1);\r\n loopBlock_7.$mount(tr_1, loopAnchor_7_1);\r\n _$append(_$frag, tr_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_7.$destroy();\r\n _$frag = tr_1 = td_1 = txt_1 = setTxt_1 = loopAnchor_7_1 = loopBlock_7 = void 0;\r\n }\r\n };\r\n}\r\nfunction elseCondition_2(_$state) {\r\n var _$frag, tbody_1, loopAnchor_6_1, loopBlock_6;\r\n _$frag = _$docFragment();\r\n loopBlock_6 = _$forLoop(_$state, _$state.month, itemLoop_6);\r\n loopAnchor_6_1 = _$text();\r\n return {\r\n type: 'else',\r\n\r\n $create: function() {\r\n tbody_1 = _$el('tbody');\r\n loopBlock_6.$create();\r\n _$setAttr(tbody_1, ['class', 'scope_126c28ac']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state) {\r\n loopBlock_6.$update(_$state, _$state.month);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(tbody_1, loopAnchor_6_1);\r\n loopBlock_6.$mount(tbody_1, loopAnchor_6_1);\r\n _$append(_$frag, tbody_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_6.$destroy();\r\n _$frag = tbody_1 = loopAnchor_6_1 = loopBlock_6 = void 0;\r\n }\r\n };\r\n}\r\nfunction condition_2(_$state) {\r\n if (_$state.view === 'years')\r\n return ifCondition_2(_$state);\r\n else if (_$state.view === 'months')\r\n return elseIf_1_condition_2(_$state);\r\n else\r\n return elseCondition_2(_$state);\r\n}\r\nfunction _$tplCalendar(_$state) {\r\n var _$frag, div_1, div_2, a_1, txt_1, clickEvent_1, handlerClickEvent_1, a_2, txt_2, setTxt_2, clickEvent_2, handlerClickEvent_2, a_3, txt_3, clickEvent_3, handlerClickEvent_3, a_4, txt_4, clickEvent_4, handlerClickEvent_4, table_1, conditionAnchor_1, conditionBlock_1, conditionAnchor_2, conditionBlock_2, bindClassTable_1, displayDiv_1, bindClassDiv_1;\r\n _$frag = _$docFragment();\r\n clickEvent_1 = function(_$state) {\r\n _$state.prev();\r\n };\r\n setTxt_2 = function(_$state) {\r\n return _$state.viewLabel;\r\n };\r\n clickEvent_2 = function(_$state) {\r\n _$state.selectView();\r\n };\r\n clickEvent_3 = function(_$state) {\r\n _$state.resetDate();\r\n };\r\n clickEvent_4 = function(_$state) {\r\n _$state.next();\r\n };\r\n conditionAnchor_1 = _$text();\r\n conditionAnchor_2 = _$text();\r\n bindClassTable_1 = function(_$state) {\r\n return ['class', ('scope_126c28ac ' + _$bindClasses(['calendar-view', {\r\n months: _$state.view === 'months',\r\n years: _$state.view === 'years'\r\n }])).trim()];\r\n };\r\n var showDiv_1 = function(_$state, el, display) {\r\n el.style.display = _$state.visibility ? display : 'none';\r\n };\r\n bindClassDiv_1 = function(_$state) {\r\n return [\r\n 'class',\r\n ('scope_126c28ac ' + _$bindClasses(['panel calendar', _$state.place])).trim()\r\n ];\r\n };\r\n return {\r\n $create: function() {\r\n div_1 = _$el();\r\n div_2 = _$el();\r\n a_1 = _$el('a');\r\n txt_1 = _$text('«');\r\n a_2 = _$el('a');\r\n txt_2 = _$text();\r\n txt_2.data = setTxt_2(_$state);\r\n a_3 = _$el('a');\r\n txt_3 = _$text(' ⎌');\r\n a_4 = _$el('a');\r\n txt_4 = _$text('»');\r\n table_1 = _$el('table');\r\n conditionBlock_1 = condition_1(_$state);\r\n conditionBlock_1.$create();\r\n conditionBlock_2 = condition_2(_$state);\r\n conditionBlock_2.$create();\r\n _$setAttr(a_1, ['href', '#']);\r\n _$setAttr(a_1, ['class', 'scope_126c28ac backward']);\r\n _$addListener(a_1, 'click', handlerClickEvent_1 = function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, event, a_1);\r\n });\r\n _$setAttr(a_2, ['href', '#']);\r\n _$setAttr(a_2, ['class', 'scope_126c28ac month']);\r\n _$addListener(a_2, 'click', handlerClickEvent_2 = function(event) {\r\n event.preventDefault();\r\n clickEvent_2(_$state, event, a_2);\r\n });\r\n _$setAttr(a_3, ['href', '#']);\r\n _$setAttr(a_3, ['class', 'scope_126c28ac today']);\r\n _$addListener(a_3, 'click', handlerClickEvent_3 = function(event) {\r\n event.preventDefault();\r\n clickEvent_3(_$state, event, a_3);\r\n });\r\n _$setAttr(a_4, ['href', '#']);\r\n _$setAttr(a_4, ['class', 'scope_126c28ac forward']);\r\n _$addListener(a_4, 'click', handlerClickEvent_4 = function(event) {\r\n event.preventDefault();\r\n clickEvent_4(_$state, event, a_4);\r\n });\r\n _$setAttr(div_2, ['class', 'scope_126c28ac panel-heading calendar-actions']);\r\n _$setAttr(table_1, ['class', 'scope_126c28ac']);\r\n _$setAttr(table_1, bindClassTable_1(_$state));\r\n _$setAttr(div_1, ['class', 'scope_126c28ac']);\r\n displayDiv_1 = div_1.style.display;\r\n showDiv_1(_$state, div_1, displayDiv_1);\r\n _$setAttr(div_1, bindClassDiv_1(_$state));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$insertStyle(\r\n 'scope_126c28ac',\r\n 'table.scope_126c28ac{border-spacing:0;border-collapse:collapse;}.scope_126c28ac.panel.calendar{width:266px;}.scope_126c28ac.panel-heading.calendar-actions,tr.scope_126c28ac th.scope_126c28ac,tr.scope_126c28ac td.scope_126c28ac{text-align:center;}.scope_126c28ac.panel-heading.calendar-actions{position:relative;}.scope_126c28ac.panel-heading.calendar-actions .scope_126c28ac.forward{float:right;}.scope_126c28ac.panel-heading.calendar-actions .scope_126c28ac.backward{float:left;}.scope_126c28ac.panel-heading.calendar-actions .scope_126c28ac.today{right:50px;position:absolute;}.scope_126c28ac.calendar-view,tr.scope_126c28ac th.scope_126c28ac,tr.scope_126c28ac td.scope_126c28ac{border:1px solid #000;}tr.scope_126c28ac th.scope_126c28ac{padding:1px 3px;color:#fff;background-color:#000;border-bottom:2px solid #000;}tr.scope_126c28ac th.scope_126c28ac,tr.scope_126c28ac td.scope_126c28ac{cursor:pointer;}tr.scope_126c28ac td.scope_126c28ac{padding:4px 8px;}tr.scope_126c28ac td.scope_126c28ac:first-child,tr.scope_126c28ac td.disabled.scope_126c28ac{cursor:default;}tr.scope_126c28ac td.scope_126c28ac:first-child,tr.scope_126c28ac td.disabled.scope_126c28ac,td.scope_126c28ac a.active.scope_126c28ac,td.scope_126c28ac a.scope_126c28ac:hover{background-color:#a5a5a5;}td.scope_126c28ac a.scope_126c28ac{color:#000;display:table-cell;text-decoration:none;background-color:#fff;}td.scope_126c28ac a.selected.scope_126c28ac{color:#e9e9e9;background-color:#3b3b3b;}'\r\n );\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$textUpdate(txt_2, setTxt_2(_$state));\r\n conditionBlock_1 = _$conditionalUpdate(conditionBlock_1, condition_1, table_1, conditionAnchor_1, _$state);\r\n conditionBlock_2 = _$conditionalUpdate(conditionBlock_2, condition_2, table_1, conditionAnchor_2, _$state);\r\n _$bindUpdate(table_1, bindClassTable_1(_$state));\r\n showDiv_1(_$state, div_1, displayDiv_1);\r\n _$bindUpdate(div_1, bindClassDiv_1(_$state));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(a_1, txt_1);\r\n _$append(div_2, a_1);\r\n _$append(a_2, txt_2);\r\n _$append(div_2, a_2);\r\n _$append(a_3, txt_3);\r\n _$append(div_2, a_3);\r\n _$append(a_4, txt_4);\r\n _$append(div_2, a_4);\r\n _$append(div_1, div_2);\r\n _$append(table_1, conditionAnchor_1);\r\n conditionBlock_1.$mount(table_1, conditionAnchor_1);\r\n _$append(table_1, conditionAnchor_2);\r\n conditionBlock_2.$mount(table_1, conditionAnchor_2);\r\n _$append(div_1, table_1);\r\n _$append(_$frag, div_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n _$removeStyle('scope_126c28ac');\r\n _$removeListener(a_1, 'click', handlerClickEvent_1);\r\n _$removeListener(a_2, 'click', handlerClickEvent_2);\r\n _$removeListener(a_3, 'click', handlerClickEvent_3);\r\n _$removeListener(a_4, 'click', handlerClickEvent_4);\r\n conditionBlock_1.$destroy();\r\n conditionBlock_2.$destroy();\r\n delete _$state.$root;\r\n _$frag = div_1 = div_2 = a_1 = txt_1 = clickEvent_1 = handlerClickEvent_1 = a_2 = txt_2 = setTxt_2 = clickEvent_2 = handlerClickEvent_2 = a_3 = txt_3 = clickEvent_3 = handlerClickEvent_3 = a_4 = txt_4 = clickEvent_4 = handlerClickEvent_4 = table_1 = conditionAnchor_1 = conditionBlock_1 = conditionAnchor_2 = conditionBlock_2 = bindClassTable_1 = displayDiv_1 = bindClassDiv_1 = void 0;\r\n }\r\n };\r\n}\r\nvar Calendar = _$Ctor('Calendar', _$tplCalendar, calendar);\r\n/* harmony default export */ var components_calendar = (Calendar);\r\n\n// CONCATENATED MODULE: ./main.ts\n\r\nvar main_calendar = new components_calendar();\r\nmain_calendar.$mount('main');\r\n\n\n//# sourceURL=webpack:///./main.ts_+_3_modules?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/examples/calendar/src/components/calendar.html b/examples/calendar/src/components/calendar.html deleted file mode 100644 index b939abc..0000000 --- a/examples/calendar/src/components/calendar.html +++ /dev/null @@ -1,120 +0,0 @@ - - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    W#{{ dayOfWeek }}
    - - {{ year.year }} - - -
    - - {{ month.month }} - - -
    {{ week.weekYear < 10 ? '0' + week.weekYear : week.weekYear }} - - {{ day.day < 10 ? '0' + day.day : day.day }} - - -
    -
    - - \ No newline at end of file diff --git a/examples/calendar/src/components/calendar.ts b/examples/calendar/src/components/calendar.ts deleted file mode 100644 index 7eebff9..0000000 --- a/examples/calendar/src/components/calendar.ts +++ /dev/null @@ -1,282 +0,0 @@ -interface CalendarItem { - active?: boolean; - disabled?: boolean; - selected?: boolean; -} - -interface Day extends CalendarItem { - day: number; -} - -interface Week { - days: Day[]; - end: number; - start: number; - weekYear: number; -} - -interface Month extends CalendarItem { - month: string; - value: number; -} - -interface Year extends CalendarItem { - year: number; -} - -export default { - attrs: { - value: { - type: 'date', - default: () => new Date() - }, - show: { - type: 'boolean', - default: true - }, - place: { - type: 'string', - default: 'right' - }, - labelTemplate: { - type: 'string', - default: '${month} of ${year}' - }, - options: { - type: 'object', - default: () => ({ - daysOfWeek: ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'], - months: [ - 'January', 'February', 'March', 'April', 'May', 'June', 'July', - 'August', 'September', 'October', 'November', 'Dicember', - ] - }) - } - }, - didMount() { - this.$set('date', new Date(this.value.valueOf())); - this.createCalendar(this.date.getMonth(), this.date.getFullYear()); - }, - model: { - view: '', - month: [], - date: new Date(), - get viewLabel() { - switch (this.view) { - case 'months': - return this.date.getFullYear(); - case 'years': - let part = this.date.getFullYear().toString().substring(0, 3); - return `${part}0 - ${part}9`; - default: - return this.labelTemplate - .replace(/\${day}/g, this.date.getDate() + '') - .replace(/\${month}/g, this.options.months[this.date.getMonth()]) - .replace(/\${year}/g, this.date.getFullYear() + ''); - } - }, - get decade() { - return this.yearInDecade(this.date.getFullYear()); - }, - get months(): Month[] { - let d = new Date(); - return this.options.months.map((month, i) => ({ - value: i, month: month.substring(0, 3), - active: d.getMonth() === i && d.getFullYear() === this.date.getFullYear() - })); - }, - get visibility() { - if (!this.show) { - this.$set('view', ''); - } - return this.show; - }, - selectView() { - this.$set('view', this.view === '' ? 'months' : 'years'); - }, - itemState(item: Day | Month | Year) { - return { active: item.active, disabled: item.disabled, selected: item.selected }; - }, - resetDate() { - this.$set('date', new Date()); - this.$fire('change', new Date()); - this.createCalendar(this.date.getMonth(), this.date.getFullYear()); - }, - resetDaySelection() { - this.month.forEach(week => { - week.days.forEach(day => { - day.selected && (day.selected = false); - }); - }); - }, - selectDay(day: Day) { - if (!day.disabled) { - this.resetDaySelection(); - let date = new Date(this.date.getFullYear(), this.date.getMonth(), day.day); - this.$fire('change', date); - day.selected = true; - this.$update(); - } - }, - selectMonth(month: Month) { - if (!month.disabled) { - this.date.setMonth(month.value); - this.createCalendar(this.date.getMonth(), this.date.getFullYear()); - this.$set('view', ''); - } - }, - selectYear(year: Year) { - if (!year.disabled) { - this.date.setFullYear(year.year); - this.$set('view', 'months'); - } - }, - weekOfYear(day: number, month: number, year: number) { - let target = new Date(year, month, day); - let dayNr = (target.getDay() + 6) % 7; - target.setDate(target.getDate() - dayNr + 3); - let firstThursday = target.valueOf(); - target.setMonth(0, 1); - if (target.getDay() !== 4) { - target.setMonth(0, 1 + ((4 - target.getDay()) + 7) % 7); - } - return 1 + Math.ceil((firstThursday - target.valueOf()) / 604800000); - }, - monthOfYear(row: number) { - switch (row) { - case 1: - return this.months.slice(4, 8); - case 2: - return this.months.slice(8); - default: - return this.months.slice(0, 4); - } - }, - yearOfDecade(row: number) { - switch (row) { - case 1: - return this.decade.slice(4, 8); - case 2: - return this.decade.slice(8); - default: - return this.decade.slice(0, 4); - } - }, - yearInDecade(year: number) { - let now = new Date(); - let range: Year[] = []; - let text = year.toString(); - let first = parseInt(text.substring(0, text.length - 1) + 0); - for (let i = 0; i < 12; i++) { - if (i === 0) { - range[i] = { year: first - 1, disabled: true, }; - } else if (i === 11) { - range[i] = { year: first + 10, disabled: true, }; - } else { - let y = first + i - 1; - range[i] = { year: y, active: y === now.getFullYear() }; - } - } - return range; - }, - daysOfMonth(month: number, year: number) { - return 32 - new Date(year, month, 32).getDate(); - }, - createCalendar(month: number, year: number) { - let date = new Date(year, month, 1).getDay(); - let numDays = this.daysOfMonth(month, year); - let lastDay = this.daysOfMonth(month - 1, year); - - let start = 1; - let end = 7 - date; - let d = new Date(); - let weeks: Week[] = []; - while (start <= numDays) { - let days: Day[] = []; - let length = end - start + 1; - for (let i = 0; i < length; i++) { - days[i] = { - day: start + i, - active: (start + i) === d.getDate() && d.getMonth() === month && d.getFullYear() === year - }; - } - if (days.length < 7 && start === 1) { - for (let i = 0; i < date; i++) { - days.unshift({ day: lastDay - i, disabled: true }); - } - } else if (days.length < 7 && days.length > 0) { - let nend = 7 - days.length; - for (let i = 1; i <= nend; i++) { - days[days.length] = { day: i, disabled: true }; - } - } - let week = { - start, end, days, - weekYear: this.weekOfYear(end, month, year) - }; - weeks[weeks.length] = week; - start = end + 1; - end = start === 1 && end === 8 ? 1 : end + 7; - if (end > numDays) { - end = numDays; - } - } - - if (weeks.length === 4 || date === 0) { - let days: Day[] = []; - for (let i = 0; i < 7; i++) { - days[6 - i] = { day: lastDay - i, disabled: true }; - } - let start = days[0].day; - let end = days[days.length - 1].day; - weeks.unshift({ - start, end, days, - weekYear: this.weekOfYear(end, month - 1, year) - }); - } - - if (weeks.length === 5) { - let days = []; - let start = 1; - let end = 7; - let lastWeek = weeks[weeks.length - 1]; - let lastDay = lastWeek.days[lastWeek.days.length - 1]; - if (!~[28, 29, 30, 31].indexOf(lastDay.day)) { - start = lastDay.day + 1; - end = 6 + start; - } - for (let i = 0; i < 7; i++) { - days[i] = { day: start + i, disabled: true }; - } - weeks.push({ - start, end, days, - weekYear: this.weekOfYear(end, month + 1, year) - }); - } - - this.$set('month', weeks); - }, - prev() { - if (this.view === 'years') { - this.date = new Date(this.date.getFullYear() - 10, this.date.getMonth(), this.date.getDate()); - } else if (this.view === 'months') { - this.date = new Date(this.date.getFullYear() - 1, this.date.getMonth(), this.date.getDate()); - } else { - this.date = new Date(this.date.getFullYear(), this.date.getMonth() - 1, 1); - this.createCalendar(this.date.getMonth(), this.date.getFullYear()); - } - this.$update(); - }, - next() { - if (this.view === 'years') { - this.date = new Date(this.date.getFullYear() + 10, this.date.getMonth(), this.date.getDate()); - } else if (this.view === 'months') { - this.date = new Date(this.date.getFullYear() + 1, this.date.getMonth(), this.date.getDate()); - } else { - this.date = new Date(this.date.getFullYear(), this.date.getMonth() + 1, 1); - this.createCalendar(this.date.getMonth(), this.date.getFullYear()); - } - this.$update(); - } - } -}; \ No newline at end of file diff --git a/examples/calendar/src/main.ts b/examples/calendar/src/main.ts deleted file mode 100644 index 73d61b9..0000000 --- a/examples/calendar/src/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Calendar from './components/calendar.html'; - -const calendar = new Calendar(); - -calendar.$mount('main'); diff --git a/examples/calendar/src/types.d.ts b/examples/calendar/src/types.d.ts deleted file mode 100644 index e3be9c4..0000000 --- a/examples/calendar/src/types.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -declare module "*.html" { - type AttrTypes = string | number | RegExp | null | boolean; - interface AttrDefinition { - required?: boolean; - type: 'string' | 'number' | 'object' | 'boolean' | 'function' | 'array' | Function; - default?: AttrTypes | (() => AttrTypes | Object); - } - interface DirectiveOptions { - value: any; - expression: string; - modifiers: { [key: string]: boolean } - } - interface DirectiveDefinition { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void - } - interface DirectivesOption { - [key: string]: DirectiveDefinition - } - interface ComponentOptions { - mounted(): void; - model: { [key: string]: any }; - attrs: string[] | { [key: string]: AttrDefinition }; - filters: { [key: string]: (...args: any[]) => any }; - children: { [key: string]: Component }; - directives: { - [key: string]: (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefinition - }; - } - interface Component { - readonly $refs: { [key: string]: HTMLElement[] }; - readonly $slots: { [key: string]: DocumentFragment }; - readonly $filters: { [key: string]: (...args: any[]) => any }; - readonly $options: ComponentOptions; - readonly $directives: DirectivesOption; - $create(): void; - $hydrate?(): void; - $mount(parent: string | HTMLElement, sibling?: string | HTMLElement): void; - $update(state: Object, ...args: any[]): void; - $destroy(): void; - $set(data: Object): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; - $once(event: string, handler: (data?: any) => void): void; - $fire(event: string, data?: any): void; - $notify(key: string): void; - $observe(key: string | string[], handler: () => void): { $unobserve(): void }; - $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; - } - interface ComponentConstructor { - new (attrs?: string[] | { [key: string]: AttrDefinition }): T; - prototype: Component; - } - const component: ComponentConstructor; - export default component; -} \ No newline at end of file diff --git a/examples/calendar/tsconfig.json b/examples/calendar/tsconfig.json deleted file mode 100644 index a752e63..0000000 --- a/examples/calendar/tsconfig.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": ["./src/types.d.ts"], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file diff --git a/examples/calendar/webpack.config.js b/examples/calendar/webpack.config.js deleted file mode 100644 index b5a5a12..0000000 --- a/examples/calendar/webpack.config.js +++ /dev/null @@ -1,44 +0,0 @@ -const { resolve } = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { optimize: { ModuleConcatenationPlugin } } = require('webpack'); - -module.exports = { - context: resolve(__dirname, 'src'), - entry: './main.ts', - output: { - filename: 'calendar.js', - path: resolve(__dirname, 'dist/js') - }, - mode: 'development', - module: { - rules: [ - { - test: /\.html$/, - use: 'trebor-loader', - exclude: /index\.html/ - }, - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - } - ], - }, - resolve: { - alias: { - 'trebor-tools': resolve(__dirname, '../../../trebor-tools') - } - }, - resolveLoader: { - alias: { - 'trebor-loader': resolve(__dirname, '../../loader.js') - } - }, - plugins: [ - new ModuleConcatenationPlugin(), - new HtmlWebpackPlugin({ - filename: resolve(__dirname, 'dist/index.html'), - template: './index.html' - }) - ] -}; \ No newline at end of file diff --git a/examples/clock/dist/index.html b/examples/clock/dist/index.html deleted file mode 100644 index 5325f81..0000000 --- a/examples/clock/dist/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - TreborJS • Clock - - - -
    - - - \ No newline at end of file diff --git a/examples/clock/dist/js/clock.js b/examples/clock/dist/js/clock.js deleted file mode 100644 index 0ae89bb..0000000 --- a/examples/clock/dist/js/clock.js +++ /dev/null @@ -1,101 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./main.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./main.ts": -/*!*****************************!*\ - !*** ./main.ts + 3 modules ***! - \*****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("\n// CONCATENATED MODULE: h:/trebor-repos/trebor-tools/index.js\nvar PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers'];\r\nvar PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' };\r\nvar TPS = window[PROP_MAP.p] || (window[PROP_MAP.p] = []);\n\nvar array = Array[PROP_MAP.h];\r\nfunction _$toArgs(args, start) {\r\n if (start === void 0) { start = 0; }\r\n return array.slice.call(args, start);\r\n}\r\nfunction _$arrayValues(list, value, root, key) {\r\n array.push.apply(list, value.map(function (v, i) {\r\n if (list.length !== 0)\r\n i += list.length;\r\n return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, key + \".\" + i) : v;\r\n }));\r\n}\r\nfunction _$List(value, root, key) {\r\n var self = this;\r\n Array.apply(self, [value.length]);\r\n var desc = { writable: false, configurable: false, enumerable: false };\r\n _$define(self, '_key', _$assign({ value: key }, desc));\r\n _$define(self, '_root', _$assign({ value: root }, desc));\r\n _$arrayValues(self, value, root, key);\r\n desc.writable = true;\r\n _$define(self, 'length', _$assign({ value: self.length }, desc));\r\n}\r\n_$extends(_$List, Array);\r\n['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) {\r\n _$List[PROP_MAP.h][method] = function () {\r\n var self = this;\r\n var old = self.slice();\r\n var result;\r\n if (method === 'push') {\r\n _$arrayValues(self, _$toArgs(arguments), self._root, self._key);\r\n result = self.length;\r\n }\r\n else {\r\n result = array[method].apply(self, arguments);\r\n }\r\n _$dispatch(self._root, self._key, old, self.slice());\r\n return result;\r\n };\r\n});\r\n_$List[PROP_MAP.h].pull = function (index) {\r\n var self = this;\r\n var items = _$toArgs(arguments, 1);\r\n var length = self.length;\r\n if (index > length) {\r\n length = index + 1;\r\n var pull = new Array(index - self.length);\r\n pull.push.apply(pull, items);\r\n for (var i = 0; i < length; i++) {\r\n if (i === index) {\r\n self.push.apply(self, pull);\r\n }\r\n }\r\n }\r\n else {\r\n self.splice.apply(self, [index, 1].concat(items));\r\n }\r\n};\n\nfunction _$select(selector, parent) {\r\n return _$isString(selector) ? (parent || document).querySelector(selector) : selector;\r\n}\r\nfunction _$docFragment() {\r\n return document.createDocumentFragment();\r\n}\r\nfunction _$append(parent, child, sibling) {\r\n if (_$isType(sibling, 'boolean') && sibling)\r\n parent.parentElement.replaceChild(child, parent);\r\n else if (!sibling)\r\n parent.appendChild(child);\r\n else\r\n parent.insertBefore(child, sibling);\r\n}\r\nfunction _$assignEl(source, dest) {\r\n var childNodes = source.childNodes, attributes = source.attributes;\r\n for (var i = 0; i < childNodes.length; i++) {\r\n _$append(dest, childNodes[i]);\r\n }\r\n for (var i = 0; i < attributes.length; i++) {\r\n var attr = attributes[i];\r\n dest.setAttributeNS(source.namespaceURI, attr.name, attr.value);\r\n }\r\n source.parentElement.replaceChild(dest, source);\r\n return dest;\r\n}\r\nfunction _$removeEl(el, parent) {\r\n var root = parent || el.parentElement;\r\n if (root)\r\n root.removeChild(el);\r\n}\r\nfunction _$el(tagName) {\r\n return document.createElement(tagName || 'div');\r\n}\r\nfunction _$svg(tagName) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg');\r\n}\r\nfunction _$text(content) {\r\n return document.createTextNode(content || '');\r\n}\r\nfunction _$comment(content) {\r\n return document.createComment(content || '');\r\n}\r\nfunction _$setAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el.setAttribute(attr, _$toString(value));\r\n if (_$isValueAttr(attr) && !_$isString(value))\r\n el[PROP_MAP._] = value;\r\n}\r\nfunction _$getAttr(el, attr) {\r\n return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr);\r\n}\r\nfunction _$getValue(el) {\r\n return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v];\r\n}\r\nfunction _$addListener(el, event, handler) {\r\n el.addEventListener(event, handler, false);\r\n}\r\nfunction _$updateListener(el, event, oldHandler, newHandler) {\r\n _$removeListener(el, event, oldHandler);\r\n _$addListener(el, event, oldHandler = newHandler);\r\n return oldHandler;\r\n}\r\nfunction _$removeListener(el, event, handler) {\r\n el.removeEventListener(event, handler, false);\r\n}\r\nfunction _$bindGroup(input, selection) {\r\n var _value = _$getValue(input);\r\n var _$index = selection.indexOf(_value);\r\n input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1);\r\n}\r\nfunction _$bindMultiSelect(select, selections) {\r\n if (!selections.length)\r\n return;\r\n var options = select.options;\r\n for (var i = 0; i < options.length; i++) {\r\n options[i].selected = !!~selections.indexOf(_$getValue(options[i]));\r\n }\r\n}\r\nfunction _$updateMultiSelect(select, obj, prop) {\r\n var items = [];\r\n var selection = obj[prop];\r\n var selectedOptions = select.selectedOptions;\r\n for (var i = 0; i < selectedOptions.length; i++) {\r\n items.push(_$getValue(selectedOptions[i]));\r\n }\r\n obj[prop] = new _$List(items, selection['_root'], selection['_key']);\r\n obj.$update();\r\n}\r\nfunction _$insertStyle(id, css) {\r\n var isNew = false;\r\n var style = _$select(\"#\" + id, document.head);\r\n if (!style) {\r\n isNew = true;\r\n style = _$el('style');\r\n style.id = id;\r\n _$setAttr(style, ['refs', 1]);\r\n }\r\n if (style.textContent !== css) {\r\n style.textContent = css;\r\n }\r\n if (isNew) {\r\n _$append(document.head, style);\r\n }\r\n else {\r\n var count = +_$getAttr(style, 'refs');\r\n _$setAttr(style, ['refs', ++count]);\r\n }\r\n}\r\nfunction _$removeStyle(id) {\r\n var style = _$select(\"#\" + id, document.head);\r\n if (style) {\r\n var count = +_$getAttr(style, 'refs');\r\n if (--count === 0) {\r\n _$removeEl(style, document.head);\r\n }\r\n else {\r\n _$setAttr(style, ['refs', count]);\r\n }\r\n }\r\n}\n\nfunction _$toLowerCase(str) {\r\n return str.toLowerCase();\r\n}\r\nvar _$assign = Object['assign'] || function (t) {\r\n for (var s = void 0, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s)\r\n if (_$hasProp(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nfunction _$apply(callee, args, globs, thisArg) {\r\n if (thisArg === void 0) { thisArg = null; }\r\n return callee.apply(thisArg, args.concat(globs));\r\n}\r\nfunction _$isValueAttr(attr) {\r\n return attr === 'value';\r\n}\r\nfunction _$subscribers(dep, listener) {\r\n if (!this[PROP_MAP.s][dep]) {\r\n this[PROP_MAP.s][dep] = [];\r\n }\r\n return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1;\r\n}\r\nfunction _$define(obj, key, desc) {\r\n Object.defineProperty(obj, key, desc);\r\n}\r\nfunction _$dispatch(root, key, oldVal, value) {\r\n root.$notify(key);\r\n if (root[PROP_MAP.w][key]) {\r\n _$each(root[PROP_MAP.w][key], function (watcher) { watcher(oldVal, value); });\r\n }\r\n root.$update();\r\n}\r\nfunction _$extends(ctor, exts) {\r\n ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]);\r\n ctor[PROP_MAP.h].constructor = ctor;\r\n}\r\nfunction _$isType(value, type) {\r\n return _$type(type) === 'string' ? type.split('\\|').some(function (t) { return t.trim() === _$type(value); }) : value instanceof type;\r\n}\r\nfunction _$isObject(obj) {\r\n return _$isType(obj, 'object');\r\n}\r\nfunction _$isArray(obj) {\r\n return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array');\r\n}\r\nfunction _$isFunction(obj) {\r\n return _$isType(obj, 'function');\r\n}\r\nfunction _$isString(obj) {\r\n return _$isType(obj, 'string');\r\n}\r\nfunction _$toType(value, type, root, key) {\r\n switch (type) {\r\n case 'date':\r\n return new Date(value);\r\n case 'string':\r\n return _$toString(value);\r\n case 'number':\r\n return +value;\r\n case 'boolean':\r\n return _$isString(value) && !value ? true : !!value;\r\n case 'array':\r\n return _$isType(value, _$List) ? value : new _$List(value, root, key);\r\n default:\r\n return value;\r\n }\r\n}\r\nfunction _$type(obj) {\r\n return _$toLowerCase(/ (\\w+)/.exec({}.toString.call(obj))[1]);\r\n}\r\nfunction _$hasProp(obj, prop) {\r\n return obj.hasOwnProperty(prop);\r\n}\r\nfunction _$directive(dd) {\r\n var hasProp = function (prop, instance, options, element) { return _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); };\r\n return {\r\n $init: function (instance, options, element) {\r\n hasProp('$init', instance, options, element);\r\n },\r\n $inserted: function (instance, options, element) {\r\n hasProp('$inserted', instance, options, element);\r\n },\r\n $update: function (instance, options, element) {\r\n if (_$isFunction(dd)) {\r\n dd(instance, options, element);\r\n }\r\n else {\r\n hasProp('$update', instance, options, element);\r\n }\r\n },\r\n $destroy: function (instance, options, element) {\r\n hasProp('$destroy', instance, options, element);\r\n }\r\n };\r\n}\r\nfunction _$noop() { }\r\nfunction _$addChild(inst, Child, attrs) {\r\n var child = null;\r\n if (Child) {\r\n child = new Child(attrs, inst);\r\n inst.$children.push(child);\r\n }\r\n return child;\r\n}\r\nfunction _$removeChild(inst, child) {\r\n var index = inst.$children.indexOf(child);\r\n index >= 0 && inst.$children.splice(index, 1);\r\n}\r\nfunction _$toString(obj) {\r\n var str = _$type(obj);\r\n return !/null|undefined/.test(str) ? obj.toString() : str;\r\n}\r\nfunction _$toPlainObject(obj) {\r\n var data = {};\r\n _$each(_$isObject(obj) ? obj : {}, function (_v, k) {\r\n if (k[0] !== '$' && !_$isFunction(obj[k])) {\r\n if (_$isType(obj[k], _$List)) {\r\n data[k] = obj[k].map(_$toPlainObject);\r\n }\r\n else if (_$isObject(obj[k])) {\r\n data[k] = _$toPlainObject(obj[k]);\r\n }\r\n else {\r\n data[k] = obj[k];\r\n }\r\n }\r\n });\r\n return _$isObject(obj) ? data : obj;\r\n}\r\nfunction _$setReference(refs, prop, node) {\r\n if (!_$hasProp(refs, prop)) {\r\n var value_1 = [];\r\n _$define(refs, prop, {\r\n get: function () { return value_1.length <= 1 ? value_1[0] : value_1; },\r\n set: function (val) { val && !~value_1.indexOf(val) && value_1.push(val); },\r\n enumerable: true, configurable: true\r\n });\r\n }\r\n refs[prop] = node;\r\n}\r\nfunction _$accesor(object, path, value) {\r\n return path.split('.').reduce(function (obj, key, i, arr) {\r\n if (_$isType(value, 'undefined')) {\r\n if (obj == null) {\r\n arr.splice(0, arr.length);\r\n return i > 0 && obj === null ? obj : undefined;\r\n }\r\n }\r\n else {\r\n if (i === arr.length - 1) {\r\n if (_$isType(obj, _$List) && _$toString(+key) === key) {\r\n obj.pull(+key, value);\r\n }\r\n else {\r\n var oldVal = obj[key];\r\n obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value;\r\n _$dispatch(object, path, oldVal, obj[key]);\r\n }\r\n }\r\n else if (!_$isObject(obj[key])) {\r\n obj[key] = {};\r\n }\r\n }\r\n return obj ? obj[key] : null;\r\n }, object);\r\n}\r\nfunction _$emptyElse() {\r\n return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop };\r\n}\r\nfunction _$isKey(event, key) {\r\n return _$toLowerCase(event.key) === key || !!event[key + \"Key\"];\r\n}\r\nfunction _$bindClasses(value) {\r\n var classes = '';\r\n if (_$isString(value)) {\r\n classes += \" \" + value;\r\n }\r\n else if (_$isArray(value)) {\r\n classes = value.map(_$bindClasses).join(' ');\r\n }\r\n else if (_$isObject(value)) {\r\n for (var key in value)\r\n if (_$hasProp(value, key) && value[key])\r\n classes += \" \" + key;\r\n }\r\n return classes.trim();\r\n}\r\nfunction _$bindStyle(value) {\r\n var el = _$el();\r\n if (_$isObject(value)) {\r\n var style_1 = el.style;\r\n _$each(value, function (val, prop) {\r\n if (val !== style_1[prop])\r\n style_1[prop] = val;\r\n });\r\n return style_1.cssText;\r\n }\r\n else if (_$isString(value)) {\r\n return value;\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\nfunction _$conditionalUpdate(block, condition, parent, anchor, inst) {\r\n var globs = _$toArgs(arguments, 5);\r\n if (block && block.type === _$apply(condition, [inst], globs).type) {\r\n _$apply(block.$update, [inst], globs, block);\r\n }\r\n else {\r\n block && block.$destroy();\r\n block = _$apply(condition, [inst], globs);\r\n block.$create();\r\n block.$mount(parent || inst.$parentEl, anchor);\r\n }\r\n return block;\r\n}\r\nfunction _$bindUpdate(el, binding) {\r\n var attr = binding[0], value = binding[1];\r\n var _value = _$toString(value);\r\n if (_$isValueAttr(attr)) {\r\n if (el[attr] !== _value)\r\n el[attr] = _value;\r\n el[PROP_MAP._] = value;\r\n }\r\n else if (_$getAttr(el, attr) !== _value) {\r\n _$setAttr(el, [attr, _value]);\r\n }\r\n}\r\nfunction _$bindBooleanAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true);\r\n}\r\nfunction _$textUpdate(text, value) {\r\n if (text.data !== (value = _$toString(value)))\r\n text.data = value;\r\n}\r\nfunction _$tagUpdate(node, tag) {\r\n return _$toLowerCase(tag) !== _$toLowerCase(node.tagName) ? _$assignEl(node, _$el(tag)) : node;\r\n}\r\nfunction _$removeReference(refs, prop, node) {\r\n var nodes = refs[prop];\r\n _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]);\r\n}\r\nfunction _$htmlUpdate(node, value) {\r\n if (node.innerHTML !== (value = _$toString(value)))\r\n node.innerHTML = value;\r\n}\r\nfunction _$componentUpdate(parent, Ctor, inst, value, attrs, el, sibling) {\r\n if (value === Ctor) {\r\n inst && inst.$update();\r\n }\r\n else {\r\n Ctor = value;\r\n if (inst) {\r\n inst.$destroy();\r\n _$removeChild(parent, inst);\r\n }\r\n if (inst) {\r\n inst = _$addChild(parent, Ctor, attrs);\r\n inst.$create();\r\n inst.$mount(el, sibling);\r\n }\r\n }\r\n return [inst, Ctor];\r\n}\r\nfunction _$destroyComponent(component) {\r\n component.$unmount();\r\n component.$parent = null;\r\n component.$parentEl = null;\r\n component.$siblingEl = null;\r\n component.$children.splice(0, component.$children.length);\r\n}\r\nfunction _$setElements(component, parent, sibling) {\r\n var brother = _$select(sibling);\r\n component.$siblingEl = brother;\r\n component.$parentEl = sibling && brother.parentElement || _$select(parent);\r\n}\r\nfunction _$forLoop(root, obj, loop) {\r\n var items = {}, loopParent, loopSibling;\r\n var globs = _$toArgs(arguments, 3);\r\n _$each(obj, function (item, i, index) { items[i] = _$apply(loop, [root, item, i, index], globs); });\r\n return {\r\n $create: function () {\r\n _$each(items, function (item) { item.$create(); });\r\n },\r\n $mount: function (parent, sibling) {\r\n loopParent = _$select(parent);\r\n loopSibling = _$select(sibling);\r\n _$each(items, function (item) { item.$mount(loopParent, loopSibling); });\r\n },\r\n $update: function (root, obj) {\r\n var globs = _$toArgs(arguments, 2);\r\n _$each(items, function (item, i, index) {\r\n if (obj[i]) {\r\n _$apply(item.$update, [root, obj[i], i, index], globs, item);\r\n }\r\n else {\r\n item.$destroy();\r\n delete items[i];\r\n }\r\n });\r\n _$each(obj, function (item, i, index) {\r\n if (!items[i]) {\r\n items[i] = _$apply(loop, [root, item, i, index], globs);\r\n items[i].$create();\r\n items[i].$mount(loopParent, loopSibling);\r\n }\r\n });\r\n },\r\n $destroy: function () {\r\n _$each(items, function (item) { item.$destroy(); });\r\n }\r\n };\r\n}\r\nfunction _$each(obj, cb) {\r\n var i = 0;\r\n for (var key in obj) {\r\n if (_$hasProp(obj, key)) {\r\n cb(obj[key], (isNaN(+key) ? key : +key), i++);\r\n }\r\n }\r\n}\n\nfunction _$BaseComponent(attrs, template, options, parent) {\r\n var self = this;\r\n var _$set = function (prop, value) { _$define(self, prop, { value: value, writable: true }); };\r\n if (!attrs)\r\n attrs = {};\r\n _$each(PROPS, function (prop) { _$define(self, prop, { value: {} }); });\r\n _$set('$parent', parent || null);\r\n _$set('$children', []);\r\n _$set(PROP_MAP.s, {});\r\n _$set('$options', options);\r\n var opts = self.$options;\r\n if (!opts.attrs)\r\n opts.attrs = {};\r\n if (!opts.children)\r\n opts.children = {};\r\n _$each(TPS, function (plugin) { plugin.fn.call(self, _$BaseComponent, plugin.options); });\r\n if (opts.filters)\r\n _$assign(self.$filters, opts.filters);\r\n if (opts.directives)\r\n _$each(opts.directives, function (drt, k) { self.$directives[k] = _$directive(drt); });\r\n _$each(opts.attrs, function (attrOps, key) {\r\n _$define(self, (_$isType(key, 'number') ? attrOps : key), {\r\n get: function () {\r\n if (_$isString(attrOps)) {\r\n var value = attrs[attrOps];\r\n return _$isFunction(value) ? value() : value;\r\n }\r\n else {\r\n if (!_$hasProp(attrs, key) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' is required.\");\r\n }\r\n else {\r\n var value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key];\r\n if (value === void 0 && _$hasProp(attrOps, 'default')) {\r\n var def = attrOps.default;\r\n value = _$isFunction(def) ? def() : def;\r\n }\r\n var typ = attrOps.type;\r\n if (typ && !_$isType(value, typ) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' must be type '\" + typ + \"'.\");\r\n }\r\n value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key);\r\n if (value !== void 0 && _$hasProp(attrOps, 'validator')) {\r\n var validator = attrOps.validator;\r\n if (_$isFunction(validator) && !validator(value)) {\r\n return console.error(\"Assigment '\" + key + \"'='\" + JSON.stringify(value) + \"' invalid.\");\r\n }\r\n }\r\n return value;\r\n }\r\n }\r\n },\r\n set: function () {\r\n console.error(\"'\" + key + \"' is read only.\");\r\n },\r\n enumerable: true, configurable: true\r\n });\r\n });\r\n var data = opts.model || {};\r\n var _loop_1 = function (key) {\r\n if (_$hasProp(data, key)) {\r\n var desc = Object.getOwnPropertyDescriptor(data, key);\r\n if (desc.value && _$isArray(desc.value)) {\r\n desc.value = new _$List(desc.value, self, key);\r\n }\r\n else {\r\n if (desc.get) {\r\n var getter_1 = desc.get;\r\n desc.get = function () {\r\n var value = getter_1.call(self);\r\n if (_$isArray(value))\r\n value = new _$List(value, self, key);\r\n return value;\r\n };\r\n }\r\n if (desc.set) {\r\n var setter_1 = desc.set;\r\n desc.set = function (v) {\r\n if (_$isArray(v))\r\n v = new _$List(v, self, key);\r\n setter_1.call(self, v);\r\n };\r\n }\r\n }\r\n _$define(self, key, desc);\r\n }\r\n };\r\n for (var key in data) {\r\n _loop_1(key);\r\n }\r\n var tpl = template(self);\r\n _$each(tpl, function (value, key) {\r\n _$define(self, key, {\r\n value: (function (key) {\r\n var hook = key[1].toUpperCase() + key.slice(2);\r\n var bhook = opts[\"will\" + hook];\r\n var ahook = opts[\"did\" + hook];\r\n return function () {\r\n bhook && bhook.call(this);\r\n key === '$update' ? value.call(this, this) : value.apply(this, arguments);\r\n ahook && ahook.call(this);\r\n };\r\n })(key)\r\n });\r\n });\r\n _$define(self, '$data', {\r\n get: function () {\r\n return _$toPlainObject(this);\r\n }\r\n });\r\n}\r\n_$assign(_$BaseComponent[PROP_MAP.h], {\r\n $get: function (path) {\r\n return _$accesor(this, path);\r\n },\r\n $set: function (path, value) {\r\n _$accesor(this, path, value);\r\n },\r\n $on: function (event, handler) {\r\n var _this = this;\r\n if (!this[PROP_MAP.e][event]) {\r\n this[PROP_MAP.e][event] = [];\r\n }\r\n var i = this[PROP_MAP.e][event].push(handler);\r\n return {\r\n $off: function () {\r\n _this[PROP_MAP.e][event].splice(i - 1, 1);\r\n }\r\n };\r\n },\r\n $once: function (event, handler) {\r\n var e = this.$on(event, function (args) {\r\n handler(args);\r\n e.$off();\r\n });\r\n },\r\n $fire: function (event, data) {\r\n if (this[PROP_MAP.e][event]) {\r\n _$each(this[PROP_MAP.e][event], function (handler) { handler(data); });\r\n }\r\n },\r\n $notify: function (key) {\r\n if (this[PROP_MAP.s][key]) {\r\n _$each(this[PROP_MAP.s][key], function (suscriber) { suscriber(); });\r\n }\r\n },\r\n $observe: function (deps, listener) {\r\n var _this = this;\r\n var subs = [];\r\n if (_$isArray(deps)) {\r\n _$each(deps, function (dep) {\r\n subs.push({ sub: dep, i: _$subscribers.call(_this, dep, listener) });\r\n });\r\n }\r\n else {\r\n subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) });\r\n }\r\n return {\r\n $unobserve: function () {\r\n _$each(subs, function (sub) {\r\n _this[PROP_MAP.s][sub.sub].splice(sub.i, 1);\r\n });\r\n }\r\n };\r\n },\r\n $watch: function (key, watcher) {\r\n var _this = this;\r\n if (!this[PROP_MAP.w][key]) {\r\n this[PROP_MAP.w][key] = [];\r\n }\r\n var i = this[PROP_MAP.w][key].push(watcher.bind(this));\r\n return {\r\n $unwatch: function () {\r\n _this[PROP_MAP.w][key].splice(i - 1, 1);\r\n }\r\n };\r\n }\r\n});\r\nfunction _$Ctor(moduleName, tpl, options) {\r\n var _a;\r\n var ctor = (_a = {},\r\n _a[moduleName] = function (_$attrs, _$parent) {\r\n _$BaseComponent.call(this, _$attrs, tpl, options, _$parent);\r\n !_$parent && this.$create();\r\n },\r\n _a)[moduleName];\r\n ctor.plugin = function (fn, options) {\r\n TPS.push({ options: options, fn: fn });\r\n };\r\n _$extends(ctor, _$BaseComponent);\r\n return ctor;\r\n}\n\n\n//# sourceMappingURL=index.js.map\n\n// CONCATENATED MODULE: ./components/clock.ts\n/* harmony default export */ var clock = ({\r\n didMount: function () {\r\n var _this = this;\r\n this.interval = setInterval(function () {\r\n _this.$set('time', new Date());\r\n }, 1000);\r\n },\r\n willDestroy: function () {\r\n clearInterval(this.interval);\r\n },\r\n model: {\r\n interval: null,\r\n time: new Date(),\r\n get hours() {\r\n return this.time.getHours();\r\n },\r\n get minutes() {\r\n return this.time.getMinutes();\r\n },\r\n get seconds() {\r\n return this.time.getSeconds();\r\n }\r\n }\r\n});\r\n\n// CONCATENATED MODULE: ./components/clock.html\n\r\n\r\nfunction itemLoop_2(_$state, offset, _$v, _$i, minute) {\r\n var _$frag, line_1, bindTransformLine_1;\r\n _$frag = _$docFragment();\r\n bindTransformLine_1 = function(_$state, offset, minute) {\r\n return ['transform', 'rotate(' + 6 * (minute + offset) + ')'];\r\n };\r\n return {\r\n $create: function() {\r\n line_1 = _$svg('line');\r\n _$setAttr(line_1, ['class', 'scope_735eee30 minor']);\r\n _$setAttr(line_1, ['y1', '42']);\r\n _$setAttr(line_1, ['y2', '45']);\r\n _$setAttr(line_1, bindTransformLine_1(_$state, offset, minute));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, offset, _$v, _$i, minute) {\r\n _$bindUpdate(line_1, bindTransformLine_1(_$state, offset, minute));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(_$frag, line_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$frag = line_1 = bindTransformLine_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction itemLoop_1(_$state, minute) {\r\n var _$frag, template_1, comment_1, line_1, bindTransformLine_1, loopAnchor_2_1, loopBlock_2;\r\n _$frag = _$docFragment();\r\n bindTransformLine_1 = function(_$state, minute) {\r\n return ['transform', 'rotate(' + 30 * minute + ')'];\r\n };\r\n loopBlock_2 = _$forLoop(_$state, [1, 2, 3, 4], itemLoop_2, minute);\r\n loopAnchor_2_1 = _$text();\r\n return {\r\n $create: function() {\r\n template_1 = _$docFragment();\r\n comment_1 = _$comment('');\r\n line_1 = _$svg('line');\r\n loopBlock_2.$create();\r\n _$setAttr(line_1, ['class', 'scope_735eee30 major']);\r\n _$setAttr(line_1, ['y1', '35']);\r\n _$setAttr(line_1, ['y2', '45']);\r\n _$setAttr(line_1, bindTransformLine_1(_$state, minute));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n },\r\n\r\n $update: function(_$state, minute) {\r\n _$bindUpdate(line_1, bindTransformLine_1(_$state, minute));\r\n loopBlock_2.$update(_$state, [1, 2, 3, 4], minute);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(template_1, comment_1);\r\n _$append(template_1, line_1);\r\n _$append(template_1, loopAnchor_2_1);\r\n loopBlock_2.$mount(template_1, loopAnchor_2_1);\r\n _$append(_$frag, template_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n loopBlock_2.$destroy();\r\n _$frag = template_1 = comment_1 = line_1 = bindTransformLine_1 = loopAnchor_2_1 = loopBlock_2 = void 0;\r\n }\r\n };\r\n}\r\nfunction _$tplClock(_$state) {\r\n var _$frag, svg_1, circle_1, loopAnchor_1_1, loopBlock_1, comment_1, line_1, bindTransformLine_1, comment_2, line_2, bindTransformLine_2, comment_3, g_1, line_3, line_4, bindTransformG_1;\r\n _$frag = _$docFragment();\r\n loopBlock_1 = _$forLoop(_$state, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55], itemLoop_1);\r\n loopAnchor_1_1 = _$text();\r\n bindTransformLine_1 = function(_$state) {\r\n return ['transform', 'rotate(' + (30 * _$state.hours + _$state.minutes / 2) + ')'];\r\n };\r\n bindTransformLine_2 = function(_$state) {\r\n return [\r\n 'transform',\r\n 'rotate(' + (6 * _$state.minutes + _$state.seconds / 10) + ')'\r\n ];\r\n };\r\n bindTransformG_1 = function(_$state) {\r\n return ['transform', 'rotate(' + 6 * _$state.seconds + ')'];\r\n };\r\n return {\r\n $create: function() {\r\n svg_1 = _$svg();\r\n circle_1 = _$svg('circle');\r\n circle_1.innerHTML = '';\r\n loopBlock_1.$create();\r\n comment_1 = _$comment('');\r\n line_1 = _$svg('line');\r\n comment_2 = _$comment('');\r\n line_2 = _$svg('line');\r\n comment_3 = _$comment('');\r\n g_1 = _$svg('g');\r\n line_3 = _$svg('line');\r\n line_3.innerHTML = '';\r\n line_4 = _$svg('line');\r\n line_4.innerHTML = '';\r\n _$setAttr(circle_1, ['class', 'scope_735eee30 clock-face']);\r\n _$setAttr(circle_1, ['r', '48']);\r\n _$setAttr(line_1, ['class', 'scope_735eee30 hour']);\r\n _$setAttr(line_1, ['y1', '2']);\r\n _$setAttr(line_1, ['y2', '-20']);\r\n _$setAttr(line_1, bindTransformLine_1(_$state));\r\n _$setAttr(line_2, ['class', 'scope_735eee30 minute']);\r\n _$setAttr(line_2, ['y1', '4']);\r\n _$setAttr(line_2, ['y2', '-30']);\r\n _$setAttr(line_2, bindTransformLine_2(_$state));\r\n _$setAttr(line_3, ['class', 'scope_735eee30 second']);\r\n _$setAttr(line_3, ['y1', '10']);\r\n _$setAttr(line_3, ['y2', '-38']);\r\n _$setAttr(line_4, ['class', 'scope_735eee30 second-counterweight']);\r\n _$setAttr(line_4, ['y1', '10']);\r\n _$setAttr(line_4, ['y2', '2']);\r\n _$setAttr(g_1, ['class', 'scope_735eee30']);\r\n _$setAttr(g_1, bindTransformG_1(_$state));\r\n _$setAttr(svg_1, ['xmlns', 'http://www.w3.org/2000/svg']);\r\n _$setAttr(svg_1, ['viewBox', '-50 -50 100 100']);\r\n _$setAttr(svg_1, ['class', 'scope_735eee30']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$insertStyle(\r\n 'scope_735eee30',\r\n 'svg.scope_735eee30{width:30%;height:30%;}.scope_735eee30.clock-face,.scope_735eee30.major,.scope_735eee30.hour{stroke:#333;}.scope_735eee30.clock-face{fill:white;}.scope_735eee30.minor{stroke:#999;stroke-width:0.5;}.scope_735eee30.major{stroke-width:1;}.scope_735eee30.minute{stroke:#666;}.scope_735eee30.second,.scope_735eee30.second-counterweight{stroke:rgb(180,0,0);}.scope_735eee30.second-counterweight{stroke-width:3;}'\r\n );\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n loopBlock_1.$update(_$state, [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]);\r\n _$bindUpdate(line_1, bindTransformLine_1(_$state));\r\n _$bindUpdate(line_2, bindTransformLine_2(_$state));\r\n _$bindUpdate(g_1, bindTransformG_1(_$state));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(svg_1, circle_1);\r\n _$append(svg_1, loopAnchor_1_1);\r\n loopBlock_1.$mount(svg_1, loopAnchor_1_1);\r\n _$append(svg_1, comment_1);\r\n _$append(svg_1, line_1);\r\n _$append(svg_1, comment_2);\r\n _$append(svg_1, line_2);\r\n _$append(svg_1, comment_3);\r\n _$append(g_1, line_3);\r\n _$append(g_1, line_4);\r\n _$append(svg_1, g_1);\r\n _$append(_$frag, svg_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n _$removeStyle('scope_735eee30');\r\n loopBlock_1.$destroy();\r\n delete _$state.$root;\r\n _$frag = svg_1 = circle_1 = loopAnchor_1_1 = loopBlock_1 = comment_1 = line_1 = bindTransformLine_1 = comment_2 = line_2 = bindTransformLine_2 = comment_3 = g_1 = line_3 = line_4 = bindTransformG_1 = void 0;\r\n }\r\n };\r\n}\r\nvar Clock = _$Ctor('Clock', _$tplClock, clock);\r\n/* harmony default export */ var components_clock = (Clock);\r\n\n// CONCATENATED MODULE: ./main.ts\n\r\nvar main_clock = new components_clock();\r\nmain_clock.$mount('main');\r\n\n\n//# sourceURL=webpack:///./main.ts_+_3_modules?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/examples/clock/src/components/clock.html b/examples/clock/src/components/clock.html deleted file mode 100644 index 0908b47..0000000 --- a/examples/clock/src/components/clock.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/clock/src/components/clock.ts b/examples/clock/src/components/clock.ts deleted file mode 100644 index 9118865..0000000 --- a/examples/clock/src/components/clock.ts +++ /dev/null @@ -1,23 +0,0 @@ -export default { - didMount() { - this.interval = setInterval(() => { - this.$set('time', new Date()); - }, 1000); - }, - willDestroy() { - clearInterval(this.interval); - }, - model: { - interval: null, - time: new Date(), - get hours() { - return this.time.getHours(); - }, - get minutes() { - return this.time.getMinutes(); - }, - get seconds() { - return this.time.getSeconds(); - } - } -}; \ No newline at end of file diff --git a/examples/clock/src/main.ts b/examples/clock/src/main.ts deleted file mode 100644 index 272d4b1..0000000 --- a/examples/clock/src/main.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Clock from './components/clock.html'; - -const clock = new Clock(); - -clock.$mount('main'); diff --git a/examples/clock/src/types.d.ts b/examples/clock/src/types.d.ts deleted file mode 100644 index e3be9c4..0000000 --- a/examples/clock/src/types.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -declare module "*.html" { - type AttrTypes = string | number | RegExp | null | boolean; - interface AttrDefinition { - required?: boolean; - type: 'string' | 'number' | 'object' | 'boolean' | 'function' | 'array' | Function; - default?: AttrTypes | (() => AttrTypes | Object); - } - interface DirectiveOptions { - value: any; - expression: string; - modifiers: { [key: string]: boolean } - } - interface DirectiveDefinition { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void - } - interface DirectivesOption { - [key: string]: DirectiveDefinition - } - interface ComponentOptions { - mounted(): void; - model: { [key: string]: any }; - attrs: string[] | { [key: string]: AttrDefinition }; - filters: { [key: string]: (...args: any[]) => any }; - children: { [key: string]: Component }; - directives: { - [key: string]: (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefinition - }; - } - interface Component { - readonly $refs: { [key: string]: HTMLElement[] }; - readonly $slots: { [key: string]: DocumentFragment }; - readonly $filters: { [key: string]: (...args: any[]) => any }; - readonly $options: ComponentOptions; - readonly $directives: DirectivesOption; - $create(): void; - $hydrate?(): void; - $mount(parent: string | HTMLElement, sibling?: string | HTMLElement): void; - $update(state: Object, ...args: any[]): void; - $destroy(): void; - $set(data: Object): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; - $once(event: string, handler: (data?: any) => void): void; - $fire(event: string, data?: any): void; - $notify(key: string): void; - $observe(key: string | string[], handler: () => void): { $unobserve(): void }; - $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; - } - interface ComponentConstructor { - new (attrs?: string[] | { [key: string]: AttrDefinition }): T; - prototype: Component; - } - const component: ComponentConstructor; - export default component; -} \ No newline at end of file diff --git a/examples/clock/tsconfig.json b/examples/clock/tsconfig.json deleted file mode 100644 index 4e5122a..0000000 --- a/examples/clock/tsconfig.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": false, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": ["./src/types.d.ts"], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file diff --git a/examples/clock/webpack.config.js b/examples/clock/webpack.config.js deleted file mode 100644 index 1472bcc..0000000 --- a/examples/clock/webpack.config.js +++ /dev/null @@ -1,44 +0,0 @@ -const { resolve } = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { optimize: { ModuleConcatenationPlugin } } = require('webpack'); - -module.exports = { - context: resolve(__dirname, 'src'), - entry: './main.ts', - output: { - filename: 'clock.js', - path: resolve(__dirname, 'dist/js') - }, - mode: 'development', - module: { - rules: [ - { - test: /\.html$/, - use: 'trebor-loader', - exclude: /index\.html/ - }, - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - } - ], - }, - resolve: { - alias: { - 'trebor-tools': resolve(__dirname, '../../../trebor-tools') - } - }, - resolveLoader: { - alias: { - 'trebor-loader': resolve(__dirname, '../../loader.js') - } - }, - plugins: [ - new ModuleConcatenationPlugin(), - new HtmlWebpackPlugin({ - filename: resolve(__dirname, 'dist/index.html'), - template: './index.html' - }) - ] -}; \ No newline at end of file diff --git a/examples/counter/dist/css/bulma.css b/examples/counter/dist/css/bulma.css deleted file mode 100644 index 72df389..0000000 --- a/examples/counter/dist/css/bulma.css +++ /dev/null @@ -1,10070 +0,0 @@ -/*! bulma.io v0.6.0 | MIT License | github.com/jgthms/bulma */ -@-webkit-keyframes spinAround { - from { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } -} -@keyframes spinAround { - from { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - to { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } -} - -/*! minireset.css v0.0.2 | MIT License | github.com/jgthms/minireset.css */ -html, -body, -p, -ol, -ul, -li, -dl, -dt, -dd, -blockquote, -figure, -fieldset, -legend, -textarea, -pre, -iframe, -hr, -h1, -h2, -h3, -h4, -h5, -h6 { - margin: 0; - padding: 0; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: 100%; - font-weight: normal; -} - -ul { - list-style: none; -} - -button, -input, -select, -textarea { - margin: 0; -} - -html { - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -* { - -webkit-box-sizing: inherit; - box-sizing: inherit; -} - -*:before, *:after { - -webkit-box-sizing: inherit; - box-sizing: inherit; -} - -img, -embed, -object, -audio, -video { - max-width: 100%; -} - -iframe { - border: 0; -} - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, -th { - padding: 0; - text-align: left; -} - -html { - background-color: #fff; - font-size: 16px; - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - min-width: 300px; - overflow-x: hidden; - overflow-y: scroll; - text-rendering: optimizeLegibility; - -webkit-text-size-adjust: 100%; - -moz-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - text-size-adjust: 100%; -} - -article, -aside, -figure, -footer, -header, -hgroup, -section { - display: block; -} - -body, -button, -input, -select, -textarea { - font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; -} - -code, -pre { - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: auto; - font-family: monospace; -} - -body { - color: #4a4a4a; - font-size: 1rem; - font-weight: 400; - line-height: 1.5; -} - -a { - color: #3273dc; - cursor: pointer; - text-decoration: none; -} - -a strong { - color: currentColor; -} - -a:hover { - color: #363636; -} - -code { - background-color: whitesmoke; - color: #ff3860; - font-size: 0.875em; - font-weight: normal; - padding: 0.25em 0.5em 0.25em; -} - -hr { - background-color: #dbdbdb; - border: none; - display: block; - height: 1px; - margin: 1.5rem 0; -} - -img { - height: auto; - max-width: 100%; -} - -input[type="checkbox"], -input[type="radio"] { - vertical-align: baseline; -} - -small { - font-size: 0.875em; -} - -span { - font-style: inherit; - font-weight: inherit; -} - -strong { - color: #363636; - font-weight: 700; -} - -pre { - -webkit-overflow-scrolling: touch; - background-color: whitesmoke; - color: #4a4a4a; - font-size: 0.875em; - overflow-x: auto; - padding: 1.25rem 1.5rem; - white-space: pre; - word-wrap: normal; -} - -pre code { - background-color: transparent; - color: currentColor; - font-size: 1em; - padding: 0; -} - -table td, -table th { - text-align: left; - vertical-align: top; -} - -table th { - color: #363636; -} - -.is-clearfix:after { - clear: both; - content: " "; - display: table; -} - -.is-pulled-left { - float: left !important; -} - -.is-pulled-right { - float: right !important; -} - -.is-clipped { - overflow: hidden !important; -} - -.is-overlay { - bottom: 0; - left: 0; - position: absolute; - right: 0; - top: 0; -} - -.is-size-1 { - font-size: 3rem !important; -} - -.is-size-2 { - font-size: 2.5rem !important; -} - -.is-size-3 { - font-size: 2rem !important; -} - -.is-size-4 { - font-size: 1.5rem !important; -} - -.is-size-5 { - font-size: 1.25rem !important; -} - -.is-size-6 { - font-size: 1rem !important; -} - -.is-size-7 { - font-size: 0.75rem !important; -} - -@media screen and (max-width: 768px) { - .is-size-1-mobile { - font-size: 3rem !important; - } - .is-size-2-mobile { - font-size: 2.5rem !important; - } - .is-size-3-mobile { - font-size: 2rem !important; - } - .is-size-4-mobile { - font-size: 1.5rem !important; - } - .is-size-5-mobile { - font-size: 1.25rem !important; - } - .is-size-6-mobile { - font-size: 1rem !important; - } - .is-size-7-mobile { - font-size: 0.75rem !important; - } -} - -@media screen and (min-width: 769px), print { - .is-size-1-tablet { - font-size: 3rem !important; - } - .is-size-2-tablet { - font-size: 2.5rem !important; - } - .is-size-3-tablet { - font-size: 2rem !important; - } - .is-size-4-tablet { - font-size: 1.5rem !important; - } - .is-size-5-tablet { - font-size: 1.25rem !important; - } - .is-size-6-tablet { - font-size: 1rem !important; - } - .is-size-7-tablet { - font-size: 0.75rem !important; - } -} - -@media screen and (max-width: 1023px) { - .is-size-1-touch { - font-size: 3rem !important; - } - .is-size-2-touch { - font-size: 2.5rem !important; - } - .is-size-3-touch { - font-size: 2rem !important; - } - .is-size-4-touch { - font-size: 1.5rem !important; - } - .is-size-5-touch { - font-size: 1.25rem !important; - } - .is-size-6-touch { - font-size: 1rem !important; - } - .is-size-7-touch { - font-size: 0.75rem !important; - } -} - -@media screen and (min-width: 1024px) { - .is-size-1-desktop { - font-size: 3rem !important; - } - .is-size-2-desktop { - font-size: 2.5rem !important; - } - .is-size-3-desktop { - font-size: 2rem !important; - } - .is-size-4-desktop { - font-size: 1.5rem !important; - } - .is-size-5-desktop { - font-size: 1.25rem !important; - } - .is-size-6-desktop { - font-size: 1rem !important; - } - .is-size-7-desktop { - font-size: 0.75rem !important; - } -} - -@media screen and (min-width: 1216px) { - .is-size-1-widescreen { - font-size: 3rem !important; - } - .is-size-2-widescreen { - font-size: 2.5rem !important; - } - .is-size-3-widescreen { - font-size: 2rem !important; - } - .is-size-4-widescreen { - font-size: 1.5rem !important; - } - .is-size-5-widescreen { - font-size: 1.25rem !important; - } - .is-size-6-widescreen { - font-size: 1rem !important; - } - .is-size-7-widescreen { - font-size: 0.75rem !important; - } -} - -@media screen and (min-width: 1408px) { - .is-size-1-fullhd { - font-size: 3rem !important; - } - .is-size-2-fullhd { - font-size: 2.5rem !important; - } - .is-size-3-fullhd { - font-size: 2rem !important; - } - .is-size-4-fullhd { - font-size: 1.5rem !important; - } - .is-size-5-fullhd { - font-size: 1.25rem !important; - } - .is-size-6-fullhd { - font-size: 1rem !important; - } - .is-size-7-fullhd { - font-size: 0.75rem !important; - } -} - -.has-text-centered { - text-align: center !important; -} - -@media screen and (max-width: 768px) { - .has-text-centered-mobile { - text-align: center !important; - } -} - -@media screen and (min-width: 769px), print { - .has-text-centered-tablet { - text-align: center !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .has-text-centered-tablet-only { - text-align: center !important; - } -} - -@media screen and (max-width: 1023px) { - .has-text-centered-touch { - text-align: center !important; - } -} - -@media screen and (min-width: 1024px) { - .has-text-centered-desktop { - text-align: center !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .has-text-centered-desktop-only { - text-align: center !important; - } -} - -@media screen and (min-width: 1216px) { - .has-text-centered-widescreen { - text-align: center !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .has-text-centered-widescreen-only { - text-align: center !important; - } -} - -@media screen and (min-width: 1408px) { - .has-text-centered-fullhd { - text-align: center !important; - } -} - -.has-text-justified { - text-align: justify !important; -} - -@media screen and (max-width: 768px) { - .has-text-justified-mobile { - text-align: justify !important; - } -} - -@media screen and (min-width: 769px), print { - .has-text-justified-tablet { - text-align: justify !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .has-text-justified-tablet-only { - text-align: justify !important; - } -} - -@media screen and (max-width: 1023px) { - .has-text-justified-touch { - text-align: justify !important; - } -} - -@media screen and (min-width: 1024px) { - .has-text-justified-desktop { - text-align: justify !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .has-text-justified-desktop-only { - text-align: justify !important; - } -} - -@media screen and (min-width: 1216px) { - .has-text-justified-widescreen { - text-align: justify !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .has-text-justified-widescreen-only { - text-align: justify !important; - } -} - -@media screen and (min-width: 1408px) { - .has-text-justified-fullhd { - text-align: justify !important; - } -} - -.has-text-left { - text-align: left !important; -} - -@media screen and (max-width: 768px) { - .has-text-left-mobile { - text-align: left !important; - } -} - -@media screen and (min-width: 769px), print { - .has-text-left-tablet { - text-align: left !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .has-text-left-tablet-only { - text-align: left !important; - } -} - -@media screen and (max-width: 1023px) { - .has-text-left-touch { - text-align: left !important; - } -} - -@media screen and (min-width: 1024px) { - .has-text-left-desktop { - text-align: left !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .has-text-left-desktop-only { - text-align: left !important; - } -} - -@media screen and (min-width: 1216px) { - .has-text-left-widescreen { - text-align: left !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .has-text-left-widescreen-only { - text-align: left !important; - } -} - -@media screen and (min-width: 1408px) { - .has-text-left-fullhd { - text-align: left !important; - } -} - -.has-text-right { - text-align: right !important; -} - -@media screen and (max-width: 768px) { - .has-text-right-mobile { - text-align: right !important; - } -} - -@media screen and (min-width: 769px), print { - .has-text-right-tablet { - text-align: right !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .has-text-right-tablet-only { - text-align: right !important; - } -} - -@media screen and (max-width: 1023px) { - .has-text-right-touch { - text-align: right !important; - } -} - -@media screen and (min-width: 1024px) { - .has-text-right-desktop { - text-align: right !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .has-text-right-desktop-only { - text-align: right !important; - } -} - -@media screen and (min-width: 1216px) { - .has-text-right-widescreen { - text-align: right !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .has-text-right-widescreen-only { - text-align: right !important; - } -} - -@media screen and (min-width: 1408px) { - .has-text-right-fullhd { - text-align: right !important; - } -} - -.is-capitalized { - text-transform: capitalize !important; -} - -.is-lowercase { - text-transform: lowercase !important; -} - -.is-uppercase { - text-transform: uppercase !important; -} - -.has-text-white { - color: white !important; -} - -a.has-text-white:hover, a.has-text-white:focus { - color: #e6e6e6 !important; -} - -.has-text-black { - color: #0a0a0a !important; -} - -a.has-text-black:hover, a.has-text-black:focus { - color: black !important; -} - -.has-text-light { - color: whitesmoke !important; -} - -a.has-text-light:hover, a.has-text-light:focus { - color: #dbdbdb !important; -} - -.has-text-dark { - color: #363636 !important; -} - -a.has-text-dark:hover, a.has-text-dark:focus { - color: #1c1c1c !important; -} - -.has-text-primary { - color: #00d1b2 !important; -} - -a.has-text-primary:hover, a.has-text-primary:focus { - color: #009e86 !important; -} - -.has-text-link { - color: #3273dc !important; -} - -a.has-text-link:hover, a.has-text-link:focus { - color: #205bbc !important; -} - -.has-text-info { - color: #209cee !important; -} - -a.has-text-info:hover, a.has-text-info:focus { - color: #0f81cc !important; -} - -.has-text-success { - color: #23d160 !important; -} - -a.has-text-success:hover, a.has-text-success:focus { - color: #1ca64c !important; -} - -.has-text-warning { - color: #ffdd57 !important; -} - -a.has-text-warning:hover, a.has-text-warning:focus { - color: #ffd324 !important; -} - -.has-text-danger { - color: #ff3860 !important; -} - -a.has-text-danger:hover, a.has-text-danger:focus { - color: #ff0537 !important; -} - -.has-text-black-bis { - color: #121212 !important; -} - -.has-text-black-ter { - color: #242424 !important; -} - -.has-text-grey-darker { - color: #363636 !important; -} - -.has-text-grey-dark { - color: #4a4a4a !important; -} - -.has-text-grey { - color: #7a7a7a !important; -} - -.has-text-grey-light { - color: #b5b5b5 !important; -} - -.has-text-grey-lighter { - color: #dbdbdb !important; -} - -.has-text-white-ter { - color: whitesmoke !important; -} - -.has-text-white-bis { - color: #fafafa !important; -} - -.has-text-weight-light { - font-weight: 300 !important; -} - -.has-text-weight-normal { - font-weight: 400 !important; -} - -.has-text-weight-semibold { - font-weight: 600 !important; -} - -.has-text-weight-bold { - font-weight: 700 !important; -} - -.is-block { - display: block !important; -} - -@media screen and (max-width: 768px) { - .is-block-mobile { - display: block !important; - } -} - -@media screen and (min-width: 769px), print { - .is-block-tablet { - display: block !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .is-block-tablet-only { - display: block !important; - } -} - -@media screen and (max-width: 1023px) { - .is-block-touch { - display: block !important; - } -} - -@media screen and (min-width: 1024px) { - .is-block-desktop { - display: block !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .is-block-desktop-only { - display: block !important; - } -} - -@media screen and (min-width: 1216px) { - .is-block-widescreen { - display: block !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .is-block-widescreen-only { - display: block !important; - } -} - -@media screen and (min-width: 1408px) { - .is-block-fullhd { - display: block !important; - } -} - -.is-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; -} - -@media screen and (max-width: 768px) { - .is-flex-mobile { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 769px), print { - .is-flex-tablet { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .is-flex-tablet-only { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (max-width: 1023px) { - .is-flex-touch { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 1024px) { - .is-flex-desktop { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .is-flex-desktop-only { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 1216px) { - .is-flex-widescreen { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .is-flex-widescreen-only { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -@media screen and (min-width: 1408px) { - .is-flex-fullhd { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } -} - -.is-inline { - display: inline !important; -} - -@media screen and (max-width: 768px) { - .is-inline-mobile { - display: inline !important; - } -} - -@media screen and (min-width: 769px), print { - .is-inline-tablet { - display: inline !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .is-inline-tablet-only { - display: inline !important; - } -} - -@media screen and (max-width: 1023px) { - .is-inline-touch { - display: inline !important; - } -} - -@media screen and (min-width: 1024px) { - .is-inline-desktop { - display: inline !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .is-inline-desktop-only { - display: inline !important; - } -} - -@media screen and (min-width: 1216px) { - .is-inline-widescreen { - display: inline !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .is-inline-widescreen-only { - display: inline !important; - } -} - -@media screen and (min-width: 1408px) { - .is-inline-fullhd { - display: inline !important; - } -} - -.is-inline-block { - display: inline-block !important; -} - -@media screen and (max-width: 768px) { - .is-inline-block-mobile { - display: inline-block !important; - } -} - -@media screen and (min-width: 769px), print { - .is-inline-block-tablet { - display: inline-block !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .is-inline-block-tablet-only { - display: inline-block !important; - } -} - -@media screen and (max-width: 1023px) { - .is-inline-block-touch { - display: inline-block !important; - } -} - -@media screen and (min-width: 1024px) { - .is-inline-block-desktop { - display: inline-block !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .is-inline-block-desktop-only { - display: inline-block !important; - } -} - -@media screen and (min-width: 1216px) { - .is-inline-block-widescreen { - display: inline-block !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .is-inline-block-widescreen-only { - display: inline-block !important; - } -} - -@media screen and (min-width: 1408px) { - .is-inline-block-fullhd { - display: inline-block !important; - } -} - -.is-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; -} - -@media screen and (max-width: 768px) { - .is-inline-flex-mobile { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 769px), print { - .is-inline-flex-tablet { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .is-inline-flex-tablet-only { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (max-width: 1023px) { - .is-inline-flex-touch { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 1024px) { - .is-inline-flex-desktop { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .is-inline-flex-desktop-only { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 1216px) { - .is-inline-flex-widescreen { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .is-inline-flex-widescreen-only { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media screen and (min-width: 1408px) { - .is-inline-flex-fullhd { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -.is-hidden { - display: none !important; -} - -@media screen and (max-width: 768px) { - .is-hidden-mobile { - display: none !important; - } -} - -@media screen and (min-width: 769px), print { - .is-hidden-tablet { - display: none !important; - } -} - -@media screen and (min-width: 769px) and (max-width: 1023px) { - .is-hidden-tablet-only { - display: none !important; - } -} - -@media screen and (max-width: 1023px) { - .is-hidden-touch { - display: none !important; - } -} - -@media screen and (min-width: 1024px) { - .is-hidden-desktop { - display: none !important; - } -} - -@media screen and (min-width: 1024px) and (max-width: 1215px) { - .is-hidden-desktop-only { - display: none !important; - } -} - -@media screen and (min-width: 1216px) { - .is-hidden-widescreen { - display: none !important; - } -} - -@media screen and (min-width: 1216px) and (max-width: 1407px) { - .is-hidden-widescreen-only { - display: none !important; - } -} - -@media screen and (min-width: 1408px) { - .is-hidden-fullhd { - display: none !important; - } -} - -.is-marginless { - margin: 0 !important; -} - -.is-paddingless { - padding: 0 !important; -} - -.is-radiusless { - border-radius: 0 !important; -} - -.is-shadowless { - -webkit-box-shadow: none !important; - box-shadow: none !important; -} - -.is-unselectable { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.box { - background-color: white; - border-radius: 5px; - -webkit-box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - color: #4a4a4a; - display: block; - padding: 1.25rem; -} - -.box:not(:last-child) { - margin-bottom: 1.5rem; -} - -a.box:hover, a.box:focus { - -webkit-box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px #3273dc; - box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px #3273dc; -} - -a.box:active { - -webkit-box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.2), 0 0 0 1px #3273dc; - box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.2), 0 0 0 1px #3273dc; -} - -.button { - -moz-appearance: none; - -webkit-appearance: none; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: 1px solid transparent; - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 1rem; - height: 2.25em; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - line-height: 1.5; - padding-bottom: calc(0.375em - 1px); - padding-left: calc(0.625em - 1px); - padding-right: calc(0.625em - 1px); - padding-top: calc(0.375em - 1px); - position: relative; - vertical-align: top; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-color: white; - border-color: #dbdbdb; - color: #363636; - cursor: pointer; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - padding-left: 0.75em; - padding-right: 0.75em; - text-align: center; - white-space: nowrap; -} - -.button:focus, .button.is-focused, .button:active, .button.is-active { - outline: none; -} - -.button[disabled] { - cursor: not-allowed; -} - -.button strong { - color: inherit; -} - -.button .icon, .button .icon.is-small, .button .icon.is-medium, .button .icon.is-large { - height: 1.5em; - width: 1.5em; -} - -.button .icon:first-child:not(:last-child) { - margin-left: calc(-0.375em - 1px); - margin-right: 0.1875em; -} - -.button .icon:last-child:not(:first-child) { - margin-left: 0.1875em; - margin-right: calc(-0.375em - 1px); -} - -.button .icon:first-child:last-child { - margin-left: calc(-0.375em - 1px); - margin-right: calc(-0.375em - 1px); -} - -.button:hover, .button.is-hovered { - border-color: #b5b5b5; - color: #363636; -} - -.button:focus, .button.is-focused { - border-color: #3273dc; - color: #363636; -} - -.button:focus:not(:active), .button.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -.button:active, .button.is-active { - border-color: #4a4a4a; - color: #363636; -} - -.button.is-text { - background-color: transparent; - border-color: transparent; - color: #4a4a4a; - text-decoration: underline; -} - -.button.is-text:hover, .button.is-text.is-hovered, .button.is-text:focus, .button.is-text.is-focused { - background-color: whitesmoke; - color: #363636; -} - -.button.is-text:active, .button.is-text.is-active { - background-color: #e8e8e8; - color: #363636; -} - -.button.is-text[disabled] { - background-color: transparent; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-white { - background-color: white; - border-color: transparent; - color: #0a0a0a; -} - -.button.is-white:hover, .button.is-white.is-hovered { - background-color: #f9f9f9; - border-color: transparent; - color: #0a0a0a; -} - -.button.is-white:focus, .button.is-white.is-focused { - border-color: transparent; - color: #0a0a0a; -} - -.button.is-white:focus:not(:active), .button.is-white.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.25); -} - -.button.is-white:active, .button.is-white.is-active { - background-color: #f2f2f2; - border-color: transparent; - color: #0a0a0a; -} - -.button.is-white[disabled] { - background-color: white; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-white.is-inverted { - background-color: #0a0a0a; - color: white; -} - -.button.is-white.is-inverted:hover { - background-color: black; -} - -.button.is-white.is-inverted[disabled] { - background-color: #0a0a0a; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: white; -} - -.button.is-white.is-loading:after { - border-color: transparent transparent #0a0a0a #0a0a0a !important; -} - -.button.is-white.is-outlined { - background-color: transparent; - border-color: white; - color: white; -} - -.button.is-white.is-outlined:hover, .button.is-white.is-outlined:focus { - background-color: white; - border-color: white; - color: #0a0a0a; -} - -.button.is-white.is-outlined.is-loading:after { - border-color: transparent transparent white white !important; -} - -.button.is-white.is-outlined[disabled] { - background-color: transparent; - border-color: white; - -webkit-box-shadow: none; - box-shadow: none; - color: white; -} - -.button.is-white.is-inverted.is-outlined { - background-color: transparent; - border-color: #0a0a0a; - color: #0a0a0a; -} - -.button.is-white.is-inverted.is-outlined:hover, .button.is-white.is-inverted.is-outlined:focus { - background-color: #0a0a0a; - color: white; -} - -.button.is-white.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #0a0a0a; - -webkit-box-shadow: none; - box-shadow: none; - color: #0a0a0a; -} - -.button.is-black { - background-color: #0a0a0a; - border-color: transparent; - color: white; -} - -.button.is-black:hover, .button.is-black.is-hovered { - background-color: #040404; - border-color: transparent; - color: white; -} - -.button.is-black:focus, .button.is-black.is-focused { - border-color: transparent; - color: white; -} - -.button.is-black:focus:not(:active), .button.is-black.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(10, 10, 10, 0.25); - box-shadow: 0 0 0 0.125em rgba(10, 10, 10, 0.25); -} - -.button.is-black:active, .button.is-black.is-active { - background-color: black; - border-color: transparent; - color: white; -} - -.button.is-black[disabled] { - background-color: #0a0a0a; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-black.is-inverted { - background-color: white; - color: #0a0a0a; -} - -.button.is-black.is-inverted:hover { - background-color: #f2f2f2; -} - -.button.is-black.is-inverted[disabled] { - background-color: white; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #0a0a0a; -} - -.button.is-black.is-loading:after { - border-color: transparent transparent white white !important; -} - -.button.is-black.is-outlined { - background-color: transparent; - border-color: #0a0a0a; - color: #0a0a0a; -} - -.button.is-black.is-outlined:hover, .button.is-black.is-outlined:focus { - background-color: #0a0a0a; - border-color: #0a0a0a; - color: white; -} - -.button.is-black.is-outlined.is-loading:after { - border-color: transparent transparent #0a0a0a #0a0a0a !important; -} - -.button.is-black.is-outlined[disabled] { - background-color: transparent; - border-color: #0a0a0a; - -webkit-box-shadow: none; - box-shadow: none; - color: #0a0a0a; -} - -.button.is-black.is-inverted.is-outlined { - background-color: transparent; - border-color: white; - color: white; -} - -.button.is-black.is-inverted.is-outlined:hover, .button.is-black.is-inverted.is-outlined:focus { - background-color: white; - color: #0a0a0a; -} - -.button.is-black.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: white; - -webkit-box-shadow: none; - box-shadow: none; - color: white; -} - -.button.is-light { - background-color: whitesmoke; - border-color: transparent; - color: #363636; -} - -.button.is-light:hover, .button.is-light.is-hovered { - background-color: #eeeeee; - border-color: transparent; - color: #363636; -} - -.button.is-light:focus, .button.is-light.is-focused { - border-color: transparent; - color: #363636; -} - -.button.is-light:focus:not(:active), .button.is-light.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(245, 245, 245, 0.25); - box-shadow: 0 0 0 0.125em rgba(245, 245, 245, 0.25); -} - -.button.is-light:active, .button.is-light.is-active { - background-color: #e8e8e8; - border-color: transparent; - color: #363636; -} - -.button.is-light[disabled] { - background-color: whitesmoke; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-light.is-inverted { - background-color: #363636; - color: whitesmoke; -} - -.button.is-light.is-inverted:hover { - background-color: #292929; -} - -.button.is-light.is-inverted[disabled] { - background-color: #363636; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: whitesmoke; -} - -.button.is-light.is-loading:after { - border-color: transparent transparent #363636 #363636 !important; -} - -.button.is-light.is-outlined { - background-color: transparent; - border-color: whitesmoke; - color: whitesmoke; -} - -.button.is-light.is-outlined:hover, .button.is-light.is-outlined:focus { - background-color: whitesmoke; - border-color: whitesmoke; - color: #363636; -} - -.button.is-light.is-outlined.is-loading:after { - border-color: transparent transparent whitesmoke whitesmoke !important; -} - -.button.is-light.is-outlined[disabled] { - background-color: transparent; - border-color: whitesmoke; - -webkit-box-shadow: none; - box-shadow: none; - color: whitesmoke; -} - -.button.is-light.is-inverted.is-outlined { - background-color: transparent; - border-color: #363636; - color: #363636; -} - -.button.is-light.is-inverted.is-outlined:hover, .button.is-light.is-inverted.is-outlined:focus { - background-color: #363636; - color: whitesmoke; -} - -.button.is-light.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #363636; - -webkit-box-shadow: none; - box-shadow: none; - color: #363636; -} - -.button.is-dark { - background-color: #363636; - border-color: transparent; - color: whitesmoke; -} - -.button.is-dark:hover, .button.is-dark.is-hovered { - background-color: #2f2f2f; - border-color: transparent; - color: whitesmoke; -} - -.button.is-dark:focus, .button.is-dark.is-focused { - border-color: transparent; - color: whitesmoke; -} - -.button.is-dark:focus:not(:active), .button.is-dark.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(54, 54, 54, 0.25); - box-shadow: 0 0 0 0.125em rgba(54, 54, 54, 0.25); -} - -.button.is-dark:active, .button.is-dark.is-active { - background-color: #292929; - border-color: transparent; - color: whitesmoke; -} - -.button.is-dark[disabled] { - background-color: #363636; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-dark.is-inverted { - background-color: whitesmoke; - color: #363636; -} - -.button.is-dark.is-inverted:hover { - background-color: #e8e8e8; -} - -.button.is-dark.is-inverted[disabled] { - background-color: whitesmoke; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #363636; -} - -.button.is-dark.is-loading:after { - border-color: transparent transparent whitesmoke whitesmoke !important; -} - -.button.is-dark.is-outlined { - background-color: transparent; - border-color: #363636; - color: #363636; -} - -.button.is-dark.is-outlined:hover, .button.is-dark.is-outlined:focus { - background-color: #363636; - border-color: #363636; - color: whitesmoke; -} - -.button.is-dark.is-outlined.is-loading:after { - border-color: transparent transparent #363636 #363636 !important; -} - -.button.is-dark.is-outlined[disabled] { - background-color: transparent; - border-color: #363636; - -webkit-box-shadow: none; - box-shadow: none; - color: #363636; -} - -.button.is-dark.is-inverted.is-outlined { - background-color: transparent; - border-color: whitesmoke; - color: whitesmoke; -} - -.button.is-dark.is-inverted.is-outlined:hover, .button.is-dark.is-inverted.is-outlined:focus { - background-color: whitesmoke; - color: #363636; -} - -.button.is-dark.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: whitesmoke; - -webkit-box-shadow: none; - box-shadow: none; - color: whitesmoke; -} - -.button.is-primary { - background-color: #00d1b2; - border-color: transparent; - color: #fff; -} - -.button.is-primary:hover, .button.is-primary.is-hovered { - background-color: #00c4a7; - border-color: transparent; - color: #fff; -} - -.button.is-primary:focus, .button.is-primary.is-focused { - border-color: transparent; - color: #fff; -} - -.button.is-primary:focus:not(:active), .button.is-primary.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(0, 209, 178, 0.25); - box-shadow: 0 0 0 0.125em rgba(0, 209, 178, 0.25); -} - -.button.is-primary:active, .button.is-primary.is-active { - background-color: #00b89c; - border-color: transparent; - color: #fff; -} - -.button.is-primary[disabled] { - background-color: #00d1b2; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-primary.is-inverted { - background-color: #fff; - color: #00d1b2; -} - -.button.is-primary.is-inverted:hover { - background-color: #f2f2f2; -} - -.button.is-primary.is-inverted[disabled] { - background-color: #fff; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #00d1b2; -} - -.button.is-primary.is-loading:after { - border-color: transparent transparent #fff #fff !important; -} - -.button.is-primary.is-outlined { - background-color: transparent; - border-color: #00d1b2; - color: #00d1b2; -} - -.button.is-primary.is-outlined:hover, .button.is-primary.is-outlined:focus { - background-color: #00d1b2; - border-color: #00d1b2; - color: #fff; -} - -.button.is-primary.is-outlined.is-loading:after { - border-color: transparent transparent #00d1b2 #00d1b2 !important; -} - -.button.is-primary.is-outlined[disabled] { - background-color: transparent; - border-color: #00d1b2; - -webkit-box-shadow: none; - box-shadow: none; - color: #00d1b2; -} - -.button.is-primary.is-inverted.is-outlined { - background-color: transparent; - border-color: #fff; - color: #fff; -} - -.button.is-primary.is-inverted.is-outlined:hover, .button.is-primary.is-inverted.is-outlined:focus { - background-color: #fff; - color: #00d1b2; -} - -.button.is-primary.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #fff; - -webkit-box-shadow: none; - box-shadow: none; - color: #fff; -} - -.button.is-link { - background-color: #3273dc; - border-color: transparent; - color: #fff; -} - -.button.is-link:hover, .button.is-link.is-hovered { - background-color: #276cda; - border-color: transparent; - color: #fff; -} - -.button.is-link:focus, .button.is-link.is-focused { - border-color: transparent; - color: #fff; -} - -.button.is-link:focus:not(:active), .button.is-link.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -.button.is-link:active, .button.is-link.is-active { - background-color: #2366d1; - border-color: transparent; - color: #fff; -} - -.button.is-link[disabled] { - background-color: #3273dc; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-link.is-inverted { - background-color: #fff; - color: #3273dc; -} - -.button.is-link.is-inverted:hover { - background-color: #f2f2f2; -} - -.button.is-link.is-inverted[disabled] { - background-color: #fff; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #3273dc; -} - -.button.is-link.is-loading:after { - border-color: transparent transparent #fff #fff !important; -} - -.button.is-link.is-outlined { - background-color: transparent; - border-color: #3273dc; - color: #3273dc; -} - -.button.is-link.is-outlined:hover, .button.is-link.is-outlined:focus { - background-color: #3273dc; - border-color: #3273dc; - color: #fff; -} - -.button.is-link.is-outlined.is-loading:after { - border-color: transparent transparent #3273dc #3273dc !important; -} - -.button.is-link.is-outlined[disabled] { - background-color: transparent; - border-color: #3273dc; - -webkit-box-shadow: none; - box-shadow: none; - color: #3273dc; -} - -.button.is-link.is-inverted.is-outlined { - background-color: transparent; - border-color: #fff; - color: #fff; -} - -.button.is-link.is-inverted.is-outlined:hover, .button.is-link.is-inverted.is-outlined:focus { - background-color: #fff; - color: #3273dc; -} - -.button.is-link.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #fff; - -webkit-box-shadow: none; - box-shadow: none; - color: #fff; -} - -.button.is-info { - background-color: #209cee; - border-color: transparent; - color: #fff; -} - -.button.is-info:hover, .button.is-info.is-hovered { - background-color: #1496ed; - border-color: transparent; - color: #fff; -} - -.button.is-info:focus, .button.is-info.is-focused { - border-color: transparent; - color: #fff; -} - -.button.is-info:focus:not(:active), .button.is-info.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(32, 156, 238, 0.25); - box-shadow: 0 0 0 0.125em rgba(32, 156, 238, 0.25); -} - -.button.is-info:active, .button.is-info.is-active { - background-color: #118fe4; - border-color: transparent; - color: #fff; -} - -.button.is-info[disabled] { - background-color: #209cee; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-info.is-inverted { - background-color: #fff; - color: #209cee; -} - -.button.is-info.is-inverted:hover { - background-color: #f2f2f2; -} - -.button.is-info.is-inverted[disabled] { - background-color: #fff; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #209cee; -} - -.button.is-info.is-loading:after { - border-color: transparent transparent #fff #fff !important; -} - -.button.is-info.is-outlined { - background-color: transparent; - border-color: #209cee; - color: #209cee; -} - -.button.is-info.is-outlined:hover, .button.is-info.is-outlined:focus { - background-color: #209cee; - border-color: #209cee; - color: #fff; -} - -.button.is-info.is-outlined.is-loading:after { - border-color: transparent transparent #209cee #209cee !important; -} - -.button.is-info.is-outlined[disabled] { - background-color: transparent; - border-color: #209cee; - -webkit-box-shadow: none; - box-shadow: none; - color: #209cee; -} - -.button.is-info.is-inverted.is-outlined { - background-color: transparent; - border-color: #fff; - color: #fff; -} - -.button.is-info.is-inverted.is-outlined:hover, .button.is-info.is-inverted.is-outlined:focus { - background-color: #fff; - color: #209cee; -} - -.button.is-info.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #fff; - -webkit-box-shadow: none; - box-shadow: none; - color: #fff; -} - -.button.is-success { - background-color: #23d160; - border-color: transparent; - color: #fff; -} - -.button.is-success:hover, .button.is-success.is-hovered { - background-color: #22c65b; - border-color: transparent; - color: #fff; -} - -.button.is-success:focus, .button.is-success.is-focused { - border-color: transparent; - color: #fff; -} - -.button.is-success:focus:not(:active), .button.is-success.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(35, 209, 96, 0.25); - box-shadow: 0 0 0 0.125em rgba(35, 209, 96, 0.25); -} - -.button.is-success:active, .button.is-success.is-active { - background-color: #20bc56; - border-color: transparent; - color: #fff; -} - -.button.is-success[disabled] { - background-color: #23d160; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-success.is-inverted { - background-color: #fff; - color: #23d160; -} - -.button.is-success.is-inverted:hover { - background-color: #f2f2f2; -} - -.button.is-success.is-inverted[disabled] { - background-color: #fff; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #23d160; -} - -.button.is-success.is-loading:after { - border-color: transparent transparent #fff #fff !important; -} - -.button.is-success.is-outlined { - background-color: transparent; - border-color: #23d160; - color: #23d160; -} - -.button.is-success.is-outlined:hover, .button.is-success.is-outlined:focus { - background-color: #23d160; - border-color: #23d160; - color: #fff; -} - -.button.is-success.is-outlined.is-loading:after { - border-color: transparent transparent #23d160 #23d160 !important; -} - -.button.is-success.is-outlined[disabled] { - background-color: transparent; - border-color: #23d160; - -webkit-box-shadow: none; - box-shadow: none; - color: #23d160; -} - -.button.is-success.is-inverted.is-outlined { - background-color: transparent; - border-color: #fff; - color: #fff; -} - -.button.is-success.is-inverted.is-outlined:hover, .button.is-success.is-inverted.is-outlined:focus { - background-color: #fff; - color: #23d160; -} - -.button.is-success.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #fff; - -webkit-box-shadow: none; - box-shadow: none; - color: #fff; -} - -.button.is-warning { - background-color: #ffdd57; - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning:hover, .button.is-warning.is-hovered { - background-color: #ffdb4a; - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning:focus, .button.is-warning.is-focused { - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning:focus:not(:active), .button.is-warning.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 221, 87, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 221, 87, 0.25); -} - -.button.is-warning:active, .button.is-warning.is-active { - background-color: #ffd83d; - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning[disabled] { - background-color: #ffdd57; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-warning.is-inverted { - background-color: rgba(0, 0, 0, 0.7); - color: #ffdd57; -} - -.button.is-warning.is-inverted:hover { - background-color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning.is-inverted[disabled] { - background-color: rgba(0, 0, 0, 0.7); - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #ffdd57; -} - -.button.is-warning.is-loading:after { - border-color: transparent transparent rgba(0, 0, 0, 0.7) rgba(0, 0, 0, 0.7) !important; -} - -.button.is-warning.is-outlined { - background-color: transparent; - border-color: #ffdd57; - color: #ffdd57; -} - -.button.is-warning.is-outlined:hover, .button.is-warning.is-outlined:focus { - background-color: #ffdd57; - border-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning.is-outlined.is-loading:after { - border-color: transparent transparent #ffdd57 #ffdd57 !important; -} - -.button.is-warning.is-outlined[disabled] { - background-color: transparent; - border-color: #ffdd57; - -webkit-box-shadow: none; - box-shadow: none; - color: #ffdd57; -} - -.button.is-warning.is-inverted.is-outlined { - background-color: transparent; - border-color: rgba(0, 0, 0, 0.7); - color: rgba(0, 0, 0, 0.7); -} - -.button.is-warning.is-inverted.is-outlined:hover, .button.is-warning.is-inverted.is-outlined:focus { - background-color: rgba(0, 0, 0, 0.7); - color: #ffdd57; -} - -.button.is-warning.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: rgba(0, 0, 0, 0.7); - -webkit-box-shadow: none; - box-shadow: none; - color: rgba(0, 0, 0, 0.7); -} - -.button.is-danger { - background-color: #ff3860; - border-color: transparent; - color: #fff; -} - -.button.is-danger:hover, .button.is-danger.is-hovered { - background-color: #ff2b56; - border-color: transparent; - color: #fff; -} - -.button.is-danger:focus, .button.is-danger.is-focused { - border-color: transparent; - color: #fff; -} - -.button.is-danger:focus:not(:active), .button.is-danger.is-focused:not(:active) { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 56, 96, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 56, 96, 0.25); -} - -.button.is-danger:active, .button.is-danger.is-active { - background-color: #ff1f4b; - border-color: transparent; - color: #fff; -} - -.button.is-danger[disabled] { - background-color: #ff3860; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} - -.button.is-danger.is-inverted { - background-color: #fff; - color: #ff3860; -} - -.button.is-danger.is-inverted:hover { - background-color: #f2f2f2; -} - -.button.is-danger.is-inverted[disabled] { - background-color: #fff; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - color: #ff3860; -} - -.button.is-danger.is-loading:after { - border-color: transparent transparent #fff #fff !important; -} - -.button.is-danger.is-outlined { - background-color: transparent; - border-color: #ff3860; - color: #ff3860; -} - -.button.is-danger.is-outlined:hover, .button.is-danger.is-outlined:focus { - background-color: #ff3860; - border-color: #ff3860; - color: #fff; -} - -.button.is-danger.is-outlined.is-loading:after { - border-color: transparent transparent #ff3860 #ff3860 !important; -} - -.button.is-danger.is-outlined[disabled] { - background-color: transparent; - border-color: #ff3860; - -webkit-box-shadow: none; - box-shadow: none; - color: #ff3860; -} - -.button.is-danger.is-inverted.is-outlined { - background-color: transparent; - border-color: #fff; - color: #fff; -} - -.button.is-danger.is-inverted.is-outlined:hover, .button.is-danger.is-inverted.is-outlined:focus { - background-color: #fff; - color: #ff3860; -} - -.button.is-danger.is-inverted.is-outlined[disabled] { - background-color: transparent; - border-color: #fff; - -webkit-box-shadow: none; - box-shadow: none; - color: #fff; -} - -.button.is-small { - border-radius: 2px; - font-size: 0.75rem; -} - -.button.is-medium { - font-size: 1.25rem; -} - -.button.is-large { - font-size: 1.5rem; -} - -.button[disabled] { - background-color: white; - border-color: #dbdbdb; - -webkit-box-shadow: none; - box-shadow: none; - opacity: 0.5; -} - -.button.is-fullwidth { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - width: 100%; -} - -.button.is-loading { - color: transparent !important; - pointer-events: none; -} - -.button.is-loading:after { - -webkit-animation: spinAround 500ms infinite linear; - animation: spinAround 500ms infinite linear; - border: 2px solid #dbdbdb; - border-radius: 290486px; - border-right-color: transparent; - border-top-color: transparent; - content: ""; - display: block; - height: 1em; - position: relative; - width: 1em; - position: absolute; - left: calc(50% - (1em / 2)); - top: calc(50% - (1em / 2)); - position: absolute !important; -} - -.button.is-static { - background-color: whitesmoke; - border-color: #dbdbdb; - color: #7a7a7a; - -webkit-box-shadow: none; - box-shadow: none; - pointer-events: none; -} - -.container { - margin: 0 auto; - position: relative; -} - -@media screen and (min-width: 1024px) { - .container { - max-width: 960px; - width: 960px; - } - .container.is-fluid { - margin-left: 32px; - margin-right: 32px; - max-width: none; - width: auto; - } -} - -@media screen and (max-width: 1215px) { - .container.is-widescreen { - max-width: 1152px; - width: auto; - } -} - -@media screen and (max-width: 1407px) { - .container.is-fullhd { - max-width: 1344px; - width: auto; - } -} - -@media screen and (min-width: 1216px) { - .container { - max-width: 1152px; - width: 1152px; - } -} - -@media screen and (min-width: 1408px) { - .container { - max-width: 1344px; - width: 1344px; - } -} - -.content:not(:last-child) { - margin-bottom: 1.5rem; -} - -.content li + li { - margin-top: 0.25em; -} - -.content p:not(:last-child), -.content dl:not(:last-child), -.content ol:not(:last-child), -.content ul:not(:last-child), -.content blockquote:not(:last-child), -.content pre:not(:last-child), -.content table:not(:last-child) { - margin-bottom: 1em; -} - -.content h1, -.content h2, -.content h3, -.content h4, -.content h5, -.content h6 { - color: #363636; - font-weight: 400; - line-height: 1.125; -} - -.content h1 { - font-size: 2em; - margin-bottom: 0.5em; -} - -.content h1:not(:first-child) { - margin-top: 1em; -} - -.content h2 { - font-size: 1.75em; - margin-bottom: 0.5714em; -} - -.content h2:not(:first-child) { - margin-top: 1.1428em; -} - -.content h3 { - font-size: 1.5em; - margin-bottom: 0.6666em; -} - -.content h3:not(:first-child) { - margin-top: 1.3333em; -} - -.content h4 { - font-size: 1.25em; - margin-bottom: 0.8em; -} - -.content h5 { - font-size: 1.125em; - margin-bottom: 0.8888em; -} - -.content h6 { - font-size: 1em; - margin-bottom: 1em; -} - -.content blockquote { - background-color: whitesmoke; - border-left: 5px solid #dbdbdb; - padding: 1.25em 1.5em; -} - -.content ol { - list-style: decimal outside; - margin-left: 2em; - margin-top: 1em; -} - -.content ul { - list-style: disc outside; - margin-left: 2em; - margin-top: 1em; -} - -.content ul ul { - list-style-type: circle; - margin-top: 0.5em; -} - -.content ul ul ul { - list-style-type: square; -} - -.content dd { - margin-left: 2em; -} - -.content figure { - margin-left: 2em; - margin-right: 2em; - text-align: center; -} - -.content figure:not(:first-child) { - margin-top: 2em; -} - -.content figure:not(:last-child) { - margin-bottom: 2em; -} - -.content figure img { - display: inline-block; -} - -.content figure figcaption { - font-style: italic; -} - -.content pre { - -webkit-overflow-scrolling: touch; - overflow-x: auto; - padding: 1.25em 1.5em; - white-space: pre; - word-wrap: normal; -} - -.content sup, -.content sub { - font-size: 75%; -} - -.content table { - width: 100%; -} - -.content table td, -.content table th { - border: 1px solid #dbdbdb; - border-width: 0 0 1px; - padding: 0.5em 0.75em; - vertical-align: top; -} - -.content table th { - color: #363636; - text-align: left; -} - -.content table tr:hover { - background-color: whitesmoke; -} - -.content table thead td, -.content table thead th { - border-width: 0 0 2px; - color: #363636; -} - -.content table tfoot td, -.content table tfoot th { - border-width: 2px 0 0; - color: #363636; -} - -.content table tbody tr:last-child td, -.content table tbody tr:last-child th { - border-bottom-width: 0; -} - -.content.is-small { - font-size: 0.75rem; -} - -.content.is-medium { - font-size: 1.25rem; -} - -.content.is-large { - font-size: 1.5rem; -} - -.input, -.textarea { - -moz-appearance: none; - -webkit-appearance: none; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: 1px solid transparent; - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 1rem; - height: 2.25em; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - line-height: 1.5; - padding-bottom: calc(0.375em - 1px); - padding-left: calc(0.625em - 1px); - padding-right: calc(0.625em - 1px); - padding-top: calc(0.375em - 1px); - position: relative; - vertical-align: top; - background-color: white; - border-color: #dbdbdb; - color: #363636; - -webkit-box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); - box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); - max-width: 100%; - width: 100%; -} - -.input:focus, .input.is-focused, .input:active, .input.is-active, -.textarea:focus, -.textarea.is-focused, -.textarea:active, -.textarea.is-active { - outline: none; -} - -.input[disabled], -.textarea[disabled] { - cursor: not-allowed; -} - -.input::-moz-placeholder, -.textarea::-moz-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.input::-webkit-input-placeholder, -.textarea::-webkit-input-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.input:-moz-placeholder, -.textarea:-moz-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.input:-ms-input-placeholder, -.textarea:-ms-input-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.input:hover, .input.is-hovered, -.textarea:hover, -.textarea.is-hovered { - border-color: #b5b5b5; -} - -.input:focus, .input.is-focused, .input:active, .input.is-active, -.textarea:focus, -.textarea.is-focused, -.textarea:active, -.textarea.is-active { - border-color: #3273dc; - -webkit-box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -.input[disabled], -.textarea[disabled] { - background-color: whitesmoke; - border-color: whitesmoke; - -webkit-box-shadow: none; - box-shadow: none; - color: #7a7a7a; -} - -.input[disabled]::-moz-placeholder, -.textarea[disabled]::-moz-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.input[disabled]::-webkit-input-placeholder, -.textarea[disabled]::-webkit-input-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.input[disabled]:-moz-placeholder, -.textarea[disabled]:-moz-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.input[disabled]:-ms-input-placeholder, -.textarea[disabled]:-ms-input-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.input[type="search"], -.textarea[type="search"] { - border-radius: 290486px; -} - -.input[readonly], -.textarea[readonly] { - -webkit-box-shadow: none; - box-shadow: none; -} - -.input.is-white, -.textarea.is-white { - border-color: white; -} - -.input.is-white:focus, .input.is-white.is-focused, .input.is-white:active, .input.is-white.is-active, -.textarea.is-white:focus, -.textarea.is-white.is-focused, -.textarea.is-white:active, -.textarea.is-white.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.25); -} - -.input.is-black, -.textarea.is-black { - border-color: #0a0a0a; -} - -.input.is-black:focus, .input.is-black.is-focused, .input.is-black:active, .input.is-black.is-active, -.textarea.is-black:focus, -.textarea.is-black.is-focused, -.textarea.is-black:active, -.textarea.is-black.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(10, 10, 10, 0.25); - box-shadow: 0 0 0 0.125em rgba(10, 10, 10, 0.25); -} - -.input.is-light, -.textarea.is-light { - border-color: whitesmoke; -} - -.input.is-light:focus, .input.is-light.is-focused, .input.is-light:active, .input.is-light.is-active, -.textarea.is-light:focus, -.textarea.is-light.is-focused, -.textarea.is-light:active, -.textarea.is-light.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(245, 245, 245, 0.25); - box-shadow: 0 0 0 0.125em rgba(245, 245, 245, 0.25); -} - -.input.is-dark, -.textarea.is-dark { - border-color: #363636; -} - -.input.is-dark:focus, .input.is-dark.is-focused, .input.is-dark:active, .input.is-dark.is-active, -.textarea.is-dark:focus, -.textarea.is-dark.is-focused, -.textarea.is-dark:active, -.textarea.is-dark.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(54, 54, 54, 0.25); - box-shadow: 0 0 0 0.125em rgba(54, 54, 54, 0.25); -} - -.input.is-primary, -.textarea.is-primary { - border-color: #00d1b2; -} - -.input.is-primary:focus, .input.is-primary.is-focused, .input.is-primary:active, .input.is-primary.is-active, -.textarea.is-primary:focus, -.textarea.is-primary.is-focused, -.textarea.is-primary:active, -.textarea.is-primary.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(0, 209, 178, 0.25); - box-shadow: 0 0 0 0.125em rgba(0, 209, 178, 0.25); -} - -.input.is-link, -.textarea.is-link { - border-color: #3273dc; -} - -.input.is-link:focus, .input.is-link.is-focused, .input.is-link:active, .input.is-link.is-active, -.textarea.is-link:focus, -.textarea.is-link.is-focused, -.textarea.is-link:active, -.textarea.is-link.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -.input.is-info, -.textarea.is-info { - border-color: #209cee; -} - -.input.is-info:focus, .input.is-info.is-focused, .input.is-info:active, .input.is-info.is-active, -.textarea.is-info:focus, -.textarea.is-info.is-focused, -.textarea.is-info:active, -.textarea.is-info.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(32, 156, 238, 0.25); - box-shadow: 0 0 0 0.125em rgba(32, 156, 238, 0.25); -} - -.input.is-success, -.textarea.is-success { - border-color: #23d160; -} - -.input.is-success:focus, .input.is-success.is-focused, .input.is-success:active, .input.is-success.is-active, -.textarea.is-success:focus, -.textarea.is-success.is-focused, -.textarea.is-success:active, -.textarea.is-success.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(35, 209, 96, 0.25); - box-shadow: 0 0 0 0.125em rgba(35, 209, 96, 0.25); -} - -.input.is-warning, -.textarea.is-warning { - border-color: #ffdd57; -} - -.input.is-warning:focus, .input.is-warning.is-focused, .input.is-warning:active, .input.is-warning.is-active, -.textarea.is-warning:focus, -.textarea.is-warning.is-focused, -.textarea.is-warning:active, -.textarea.is-warning.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 221, 87, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 221, 87, 0.25); -} - -.input.is-danger, -.textarea.is-danger { - border-color: #ff3860; -} - -.input.is-danger:focus, .input.is-danger.is-focused, .input.is-danger:active, .input.is-danger.is-active, -.textarea.is-danger:focus, -.textarea.is-danger.is-focused, -.textarea.is-danger:active, -.textarea.is-danger.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 56, 96, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 56, 96, 0.25); -} - -.input.is-small, -.textarea.is-small { - border-radius: 2px; - font-size: 0.75rem; -} - -.input.is-medium, -.textarea.is-medium { - font-size: 1.25rem; -} - -.input.is-large, -.textarea.is-large { - font-size: 1.5rem; -} - -.input.is-fullwidth, -.textarea.is-fullwidth { - display: block; - width: 100%; -} - -.input.is-inline, -.textarea.is-inline { - display: inline; - width: auto; -} - -.input.is-static { - background-color: transparent; - border-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; - padding-left: 0; - padding-right: 0; -} - -.textarea { - display: block; - max-width: 100%; - min-width: 100%; - padding: 0.625em; - resize: vertical; -} - -.textarea:not([rows]) { - max-height: 600px; - min-height: 120px; -} - -.textarea[rows] { - height: unset; -} - -.textarea.has-fixed-size { - resize: none; -} - -.checkbox, -.radio { - cursor: pointer; - display: inline-block; - line-height: 1.25; - position: relative; -} - -.checkbox input, -.radio input { - cursor: pointer; -} - -.checkbox:hover, -.radio:hover { - color: #363636; -} - -.checkbox[disabled], -.radio[disabled] { - color: #7a7a7a; - cursor: not-allowed; -} - -.radio + .radio { - margin-left: 0.5em; -} - -.select { - display: inline-block; - max-width: 100%; - position: relative; - vertical-align: top; -} - -.select:not(.is-multiple) { - height: 2.25em; -} - -.select:not(.is-multiple)::after { - border: 1px solid #3273dc; - border-right: 0; - border-top: 0; - content: " "; - display: block; - height: 0.5em; - pointer-events: none; - position: absolute; - -webkit-transform: rotate(-45deg); - transform: rotate(-45deg); - width: 0.5em; - margin-top: -0.375em; - right: 1.125em; - top: 50%; - z-index: 4; -} - -.select select { - -moz-appearance: none; - -webkit-appearance: none; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: 1px solid transparent; - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 1rem; - height: 2.25em; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - line-height: 1.5; - padding-bottom: calc(0.375em - 1px); - padding-left: calc(0.625em - 1px); - padding-right: calc(0.625em - 1px); - padding-top: calc(0.375em - 1px); - position: relative; - vertical-align: top; - background-color: white; - border-color: #dbdbdb; - color: #363636; - cursor: pointer; - display: block; - font-size: 1em; - max-width: 100%; - outline: none; -} - -.select select:focus, .select select.is-focused, .select select:active, .select select.is-active { - outline: none; -} - -.select select[disabled] { - cursor: not-allowed; -} - -.select select::-moz-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.select select::-webkit-input-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.select select:-moz-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.select select:-ms-input-placeholder { - color: rgba(54, 54, 54, 0.3); -} - -.select select:hover, .select select.is-hovered { - border-color: #b5b5b5; -} - -.select select:focus, .select select.is-focused, .select select:active, .select select.is-active { - border-color: #3273dc; - -webkit-box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -.select select[disabled] { - background-color: whitesmoke; - border-color: whitesmoke; - -webkit-box-shadow: none; - box-shadow: none; - color: #7a7a7a; -} - -.select select[disabled]::-moz-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.select select[disabled]::-webkit-input-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.select select[disabled]:-moz-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.select select[disabled]:-ms-input-placeholder { - color: rgba(122, 122, 122, 0.3); -} - -.select select::-ms-expand { - display: none; -} - -.select select[disabled]:hover { - border-color: whitesmoke; -} - -.select select:not([multiple]) { - padding-right: 2.5em; -} - -.select select[multiple] { - height: unset; - padding: 0; -} - -.select select[multiple] option { - padding: 0.5em 1em; -} - -.select:hover::after { - border-color: #363636; -} - -.select.is-white select { - border-color: white; -} - -.select.is-white select:focus, .select.is-white select.is-focused, .select.is-white select:active, .select.is-white select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 255, 255, 0.25); -} - -.select.is-black select { - border-color: #0a0a0a; -} - -.select.is-black select:focus, .select.is-black select.is-focused, .select.is-black select:active, .select.is-black select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(10, 10, 10, 0.25); - box-shadow: 0 0 0 0.125em rgba(10, 10, 10, 0.25); -} - -.select.is-light select { - border-color: whitesmoke; -} - -.select.is-light select:focus, .select.is-light select.is-focused, .select.is-light select:active, .select.is-light select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(245, 245, 245, 0.25); - box-shadow: 0 0 0 0.125em rgba(245, 245, 245, 0.25); -} - -.select.is-dark select { - border-color: #363636; -} - -.select.is-dark select:focus, .select.is-dark select.is-focused, .select.is-dark select:active, .select.is-dark select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(54, 54, 54, 0.25); - box-shadow: 0 0 0 0.125em rgba(54, 54, 54, 0.25); -} - -.select.is-primary select { - border-color: #00d1b2; -} - -.select.is-primary select:focus, .select.is-primary select.is-focused, .select.is-primary select:active, .select.is-primary select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(0, 209, 178, 0.25); - box-shadow: 0 0 0 0.125em rgba(0, 209, 178, 0.25); -} - -.select.is-link select { - border-color: #3273dc; -} - -.select.is-link select:focus, .select.is-link select.is-focused, .select.is-link select:active, .select.is-link select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25); -} - -.select.is-info select { - border-color: #209cee; -} - -.select.is-info select:focus, .select.is-info select.is-focused, .select.is-info select:active, .select.is-info select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(32, 156, 238, 0.25); - box-shadow: 0 0 0 0.125em rgba(32, 156, 238, 0.25); -} - -.select.is-success select { - border-color: #23d160; -} - -.select.is-success select:focus, .select.is-success select.is-focused, .select.is-success select:active, .select.is-success select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(35, 209, 96, 0.25); - box-shadow: 0 0 0 0.125em rgba(35, 209, 96, 0.25); -} - -.select.is-warning select { - border-color: #ffdd57; -} - -.select.is-warning select:focus, .select.is-warning select.is-focused, .select.is-warning select:active, .select.is-warning select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 221, 87, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 221, 87, 0.25); -} - -.select.is-danger select { - border-color: #ff3860; -} - -.select.is-danger select:focus, .select.is-danger select.is-focused, .select.is-danger select:active, .select.is-danger select.is-active { - -webkit-box-shadow: 0 0 0 0.125em rgba(255, 56, 96, 0.25); - box-shadow: 0 0 0 0.125em rgba(255, 56, 96, 0.25); -} - -.select.is-small { - border-radius: 2px; - font-size: 0.75rem; -} - -.select.is-medium { - font-size: 1.25rem; -} - -.select.is-large { - font-size: 1.5rem; -} - -.select.is-disabled::after { - border-color: #7a7a7a; -} - -.select.is-fullwidth { - width: 100%; -} - -.select.is-fullwidth select { - width: 100%; -} - -.select.is-loading::after { - -webkit-animation: spinAround 500ms infinite linear; - animation: spinAround 500ms infinite linear; - border: 2px solid #dbdbdb; - border-radius: 290486px; - border-right-color: transparent; - border-top-color: transparent; - content: ""; - display: block; - height: 1em; - position: relative; - width: 1em; - margin-top: 0; - position: absolute; - right: 0.625em; - top: 0.625em; - -webkit-transform: none; - transform: none; -} - -.select.is-loading.is-small:after { - font-size: 0.75rem; -} - -.select.is-loading.is-medium:after { - font-size: 1.25rem; -} - -.select.is-loading.is-large:after { - font-size: 1.5rem; -} - -.file { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - position: relative; -} - -.file.is-white .file-cta { - background-color: white; - border-color: transparent; - color: #0a0a0a; -} - -.file.is-white:hover .file-cta, .file.is-white.is-hovered .file-cta { - background-color: #f9f9f9; - border-color: transparent; - color: #0a0a0a; -} - -.file.is-white:focus .file-cta, .file.is-white.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(255, 255, 255, 0.25); - box-shadow: 0 0 0.5em rgba(255, 255, 255, 0.25); - color: #0a0a0a; -} - -.file.is-white:active .file-cta, .file.is-white.is-active .file-cta { - background-color: #f2f2f2; - border-color: transparent; - color: #0a0a0a; -} - -.file.is-black .file-cta { - background-color: #0a0a0a; - border-color: transparent; - color: white; -} - -.file.is-black:hover .file-cta, .file.is-black.is-hovered .file-cta { - background-color: #040404; - border-color: transparent; - color: white; -} - -.file.is-black:focus .file-cta, .file.is-black.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(10, 10, 10, 0.25); - box-shadow: 0 0 0.5em rgba(10, 10, 10, 0.25); - color: white; -} - -.file.is-black:active .file-cta, .file.is-black.is-active .file-cta { - background-color: black; - border-color: transparent; - color: white; -} - -.file.is-light .file-cta { - background-color: whitesmoke; - border-color: transparent; - color: #363636; -} - -.file.is-light:hover .file-cta, .file.is-light.is-hovered .file-cta { - background-color: #eeeeee; - border-color: transparent; - color: #363636; -} - -.file.is-light:focus .file-cta, .file.is-light.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(245, 245, 245, 0.25); - box-shadow: 0 0 0.5em rgba(245, 245, 245, 0.25); - color: #363636; -} - -.file.is-light:active .file-cta, .file.is-light.is-active .file-cta { - background-color: #e8e8e8; - border-color: transparent; - color: #363636; -} - -.file.is-dark .file-cta { - background-color: #363636; - border-color: transparent; - color: whitesmoke; -} - -.file.is-dark:hover .file-cta, .file.is-dark.is-hovered .file-cta { - background-color: #2f2f2f; - border-color: transparent; - color: whitesmoke; -} - -.file.is-dark:focus .file-cta, .file.is-dark.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(54, 54, 54, 0.25); - box-shadow: 0 0 0.5em rgba(54, 54, 54, 0.25); - color: whitesmoke; -} - -.file.is-dark:active .file-cta, .file.is-dark.is-active .file-cta { - background-color: #292929; - border-color: transparent; - color: whitesmoke; -} - -.file.is-primary .file-cta { - background-color: #00d1b2; - border-color: transparent; - color: #fff; -} - -.file.is-primary:hover .file-cta, .file.is-primary.is-hovered .file-cta { - background-color: #00c4a7; - border-color: transparent; - color: #fff; -} - -.file.is-primary:focus .file-cta, .file.is-primary.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(0, 209, 178, 0.25); - box-shadow: 0 0 0.5em rgba(0, 209, 178, 0.25); - color: #fff; -} - -.file.is-primary:active .file-cta, .file.is-primary.is-active .file-cta { - background-color: #00b89c; - border-color: transparent; - color: #fff; -} - -.file.is-link .file-cta { - background-color: #3273dc; - border-color: transparent; - color: #fff; -} - -.file.is-link:hover .file-cta, .file.is-link.is-hovered .file-cta { - background-color: #276cda; - border-color: transparent; - color: #fff; -} - -.file.is-link:focus .file-cta, .file.is-link.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(50, 115, 220, 0.25); - box-shadow: 0 0 0.5em rgba(50, 115, 220, 0.25); - color: #fff; -} - -.file.is-link:active .file-cta, .file.is-link.is-active .file-cta { - background-color: #2366d1; - border-color: transparent; - color: #fff; -} - -.file.is-info .file-cta { - background-color: #209cee; - border-color: transparent; - color: #fff; -} - -.file.is-info:hover .file-cta, .file.is-info.is-hovered .file-cta { - background-color: #1496ed; - border-color: transparent; - color: #fff; -} - -.file.is-info:focus .file-cta, .file.is-info.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(32, 156, 238, 0.25); - box-shadow: 0 0 0.5em rgba(32, 156, 238, 0.25); - color: #fff; -} - -.file.is-info:active .file-cta, .file.is-info.is-active .file-cta { - background-color: #118fe4; - border-color: transparent; - color: #fff; -} - -.file.is-success .file-cta { - background-color: #23d160; - border-color: transparent; - color: #fff; -} - -.file.is-success:hover .file-cta, .file.is-success.is-hovered .file-cta { - background-color: #22c65b; - border-color: transparent; - color: #fff; -} - -.file.is-success:focus .file-cta, .file.is-success.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(35, 209, 96, 0.25); - box-shadow: 0 0 0.5em rgba(35, 209, 96, 0.25); - color: #fff; -} - -.file.is-success:active .file-cta, .file.is-success.is-active .file-cta { - background-color: #20bc56; - border-color: transparent; - color: #fff; -} - -.file.is-warning .file-cta { - background-color: #ffdd57; - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.file.is-warning:hover .file-cta, .file.is-warning.is-hovered .file-cta { - background-color: #ffdb4a; - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.file.is-warning:focus .file-cta, .file.is-warning.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(255, 221, 87, 0.25); - box-shadow: 0 0 0.5em rgba(255, 221, 87, 0.25); - color: rgba(0, 0, 0, 0.7); -} - -.file.is-warning:active .file-cta, .file.is-warning.is-active .file-cta { - background-color: #ffd83d; - border-color: transparent; - color: rgba(0, 0, 0, 0.7); -} - -.file.is-danger .file-cta { - background-color: #ff3860; - border-color: transparent; - color: #fff; -} - -.file.is-danger:hover .file-cta, .file.is-danger.is-hovered .file-cta { - background-color: #ff2b56; - border-color: transparent; - color: #fff; -} - -.file.is-danger:focus .file-cta, .file.is-danger.is-focused .file-cta { - border-color: transparent; - -webkit-box-shadow: 0 0 0.5em rgba(255, 56, 96, 0.25); - box-shadow: 0 0 0.5em rgba(255, 56, 96, 0.25); - color: #fff; -} - -.file.is-danger:active .file-cta, .file.is-danger.is-active .file-cta { - background-color: #ff1f4b; - border-color: transparent; - color: #fff; -} - -.file.is-small { - font-size: 0.75rem; -} - -.file.is-medium { - font-size: 1.25rem; -} - -.file.is-medium .file-icon .fa { - font-size: 21px; -} - -.file.is-large { - font-size: 1.5rem; -} - -.file.is-large .file-icon .fa { - font-size: 28px; -} - -.file.has-name .file-cta { - border-bottom-right-radius: 0; - border-top-right-radius: 0; -} - -.file.has-name .file-name { - border-bottom-left-radius: 0; - border-top-left-radius: 0; -} - -.file.is-centered { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.file.is-right { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; -} - -.file.is-boxed .file-label { - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; -} - -.file.is-boxed .file-cta { - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - height: auto; - padding: 1em 3em; -} - -.file.is-boxed .file-name { - border-width: 0 1px 1px; -} - -.file.is-boxed .file-icon { - height: 1.5em; - width: 1.5em; -} - -.file.is-boxed .file-icon .fa { - font-size: 21px; -} - -.file.is-boxed.is-small .file-icon .fa { - font-size: 14px; -} - -.file.is-boxed.is-medium .file-icon .fa { - font-size: 28px; -} - -.file.is-boxed.is-large .file-icon .fa { - font-size: 35px; -} - -.file.is-boxed.has-name .file-cta { - border-radius: 3px 3px 0 0; -} - -.file.is-boxed.has-name .file-name { - border-radius: 0 0 3px 3px; - border-width: 0 1px 1px; -} - -.file.is-right .file-cta { - border-radius: 0 3px 3px 0; -} - -.file.is-right .file-name { - border-radius: 3px 0 0 3px; - border-width: 1px 0 1px 1px; - -webkit-box-ordinal-group: 0; - -ms-flex-order: -1; - order: -1; -} - -.file.is-fullwidth .file-label { - width: 100%; -} - -.file.is-fullwidth .file-name { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - max-width: none; -} - -.file-label { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - cursor: pointer; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - overflow: hidden; - position: relative; -} - -.file-label:hover .file-cta { - background-color: #eeeeee; - color: #363636; -} - -.file-label:hover .file-name { - border-color: #d5d5d5; -} - -.file-label:active .file-cta { - background-color: #e8e8e8; - color: #363636; -} - -.file-label:active .file-name { - border-color: #cfcfcf; -} - -.file-input { - height: 0.01em; - left: 0; - outline: none; - position: absolute; - top: 0; - width: 0.01em; -} - -.file-cta, -.file-name { - -moz-appearance: none; - -webkit-appearance: none; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: 1px solid transparent; - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 1rem; - height: 2.25em; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - line-height: 1.5; - padding-bottom: calc(0.375em - 1px); - padding-left: calc(0.625em - 1px); - padding-right: calc(0.625em - 1px); - padding-top: calc(0.375em - 1px); - position: relative; - vertical-align: top; - border-color: #dbdbdb; - border-radius: 3px; - font-size: 1em; - padding-left: 1em; - padding-right: 1em; - white-space: nowrap; -} - -.file-cta:focus, .file-cta.is-focused, .file-cta:active, .file-cta.is-active, -.file-name:focus, -.file-name.is-focused, -.file-name:active, -.file-name.is-active { - outline: none; -} - -.file-cta[disabled], -.file-name[disabled] { - cursor: not-allowed; -} - -.file-cta { - background-color: whitesmoke; - color: #4a4a4a; -} - -.file-name { - border-color: #dbdbdb; - border-style: solid; - border-width: 1px 1px 1px 0; - display: block; - max-width: 16em; - overflow: hidden; - text-align: left; - text-overflow: ellipsis; -} - -.file-icon { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - height: 1em; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - margin-right: 0.5em; - width: 1em; -} - -.file-icon .fa { - font-size: 14px; -} - -.label { - color: #363636; - display: block; - font-size: 1rem; - font-weight: 700; -} - -.label:not(:last-child) { - margin-bottom: 0.5em; -} - -.label.is-small { - font-size: 0.75rem; -} - -.label.is-medium { - font-size: 1.25rem; -} - -.label.is-large { - font-size: 1.5rem; -} - -.help { - display: block; - font-size: 0.75rem; - margin-top: 0.25rem; -} - -.help.is-white { - color: white; -} - -.help.is-black { - color: #0a0a0a; -} - -.help.is-light { - color: whitesmoke; -} - -.help.is-dark { - color: #363636; -} - -.help.is-primary { - color: #00d1b2; -} - -.help.is-link { - color: #3273dc; -} - -.help.is-info { - color: #209cee; -} - -.help.is-success { - color: #23d160; -} - -.help.is-warning { - color: #ffdd57; -} - -.help.is-danger { - color: #ff3860; -} - -.field:not(:last-child) { - margin-bottom: 0.75rem; -} - -.field.has-addons { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.field.has-addons .control:not(:last-child) { - margin-right: -1px; -} - -.field.has-addons .control:first-child .button, -.field.has-addons .control:first-child .input, -.field.has-addons .control:first-child .select select { - border-bottom-left-radius: 3px; - border-top-left-radius: 3px; -} - -.field.has-addons .control:last-child .button, -.field.has-addons .control:last-child .input, -.field.has-addons .control:last-child .select select { - border-bottom-right-radius: 3px; - border-top-right-radius: 3px; -} - -.field.has-addons .control .button, -.field.has-addons .control .input, -.field.has-addons .control .select select { - border-radius: 0; -} - -.field.has-addons .control .button:hover, .field.has-addons .control .button.is-hovered, -.field.has-addons .control .input:hover, -.field.has-addons .control .input.is-hovered, -.field.has-addons .control .select select:hover, -.field.has-addons .control .select select.is-hovered { - z-index: 2; -} - -.field.has-addons .control .button:focus, .field.has-addons .control .button.is-focused, .field.has-addons .control .button:active, .field.has-addons .control .button.is-active, -.field.has-addons .control .input:focus, -.field.has-addons .control .input.is-focused, -.field.has-addons .control .input:active, -.field.has-addons .control .input.is-active, -.field.has-addons .control .select select:focus, -.field.has-addons .control .select select.is-focused, -.field.has-addons .control .select select:active, -.field.has-addons .control .select select.is-active { - z-index: 3; -} - -.field.has-addons .control .button:focus:hover, .field.has-addons .control .button.is-focused:hover, .field.has-addons .control .button:active:hover, .field.has-addons .control .button.is-active:hover, -.field.has-addons .control .input:focus:hover, -.field.has-addons .control .input.is-focused:hover, -.field.has-addons .control .input:active:hover, -.field.has-addons .control .input.is-active:hover, -.field.has-addons .control .select select:focus:hover, -.field.has-addons .control .select select.is-focused:hover, -.field.has-addons .control .select select:active:hover, -.field.has-addons .control .select select.is-active:hover { - z-index: 4; -} - -.field.has-addons .control.is-expanded { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; -} - -.field.has-addons.has-addons-centered { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.field.has-addons.has-addons-right { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; -} - -.field.has-addons.has-addons-fullwidth .control { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.field.is-grouped { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.field.is-grouped > .control { - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.field.is-grouped > .control:not(:last-child) { - margin-bottom: 0; - margin-right: 0.75rem; -} - -.field.is-grouped > .control.is-expanded { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; -} - -.field.is-grouped.is-grouped-centered { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.field.is-grouped.is-grouped-right { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; -} - -.field.is-grouped.is-grouped-multiline { - -ms-flex-wrap: wrap; - flex-wrap: wrap; -} - -.field.is-grouped.is-grouped-multiline > .control:last-child, .field.is-grouped.is-grouped-multiline > .control:not(:last-child) { - margin-bottom: 0.75rem; -} - -.field.is-grouped.is-grouped-multiline:last-child { - margin-bottom: -0.75rem; -} - -.field.is-grouped.is-grouped-multiline:not(:last-child) { - margin-bottom: 0; -} - -@media screen and (min-width: 769px), print { - .field.is-horizontal { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } -} - -.field-label .label { - font-size: inherit; -} - -@media screen and (max-width: 768px) { - .field-label { - margin-bottom: 0.5rem; - } -} - -@media screen and (min-width: 769px), print { - .field-label { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - margin-right: 1.5rem; - text-align: right; - } - .field-label.is-small { - font-size: 0.75rem; - padding-top: 0.375em; - } - .field-label.is-normal { - padding-top: 0.375em; - } - .field-label.is-medium { - font-size: 1.25rem; - padding-top: 0.375em; - } - .field-label.is-large { - font-size: 1.5rem; - padding-top: 0.375em; - } -} - -.field-body .field .field { - margin-bottom: 0; -} - -@media screen and (min-width: 769px), print { - .field-body { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 5; - -ms-flex-positive: 5; - flex-grow: 5; - -ms-flex-negative: 1; - flex-shrink: 1; - } - .field-body .field { - margin-bottom: 0; - } - .field-body > .field { - -ms-flex-negative: 1; - flex-shrink: 1; - } - .field-body > .field:not(.is-narrow) { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - } - .field-body > .field:not(:last-child) { - margin-right: 0.75rem; - } -} - -.control { - font-size: 1rem; - position: relative; - text-align: left; -} - -.control.has-icon .icon { - color: #dbdbdb; - height: 2.25em; - pointer-events: none; - position: absolute; - top: 0; - width: 2.25em; - z-index: 4; -} - -.control.has-icon .input:focus + .icon { - color: #7a7a7a; -} - -.control.has-icon .input.is-small + .icon { - font-size: 0.75rem; -} - -.control.has-icon .input.is-medium + .icon { - font-size: 1.25rem; -} - -.control.has-icon .input.is-large + .icon { - font-size: 1.5rem; -} - -.control.has-icon:not(.has-icon-right) .icon { - left: 0; -} - -.control.has-icon:not(.has-icon-right) .input { - padding-left: 2.25em; -} - -.control.has-icon.has-icon-right .icon { - right: 0; -} - -.control.has-icon.has-icon-right .input { - padding-right: 2.25em; -} - -.control.has-icons-left .input:focus ~ .icon, -.control.has-icons-left .select:focus ~ .icon, .control.has-icons-right .input:focus ~ .icon, -.control.has-icons-right .select:focus ~ .icon { - color: #7a7a7a; -} - -.control.has-icons-left .input.is-small ~ .icon, -.control.has-icons-left .select.is-small ~ .icon, .control.has-icons-right .input.is-small ~ .icon, -.control.has-icons-right .select.is-small ~ .icon { - font-size: 0.75rem; -} - -.control.has-icons-left .input.is-medium ~ .icon, -.control.has-icons-left .select.is-medium ~ .icon, .control.has-icons-right .input.is-medium ~ .icon, -.control.has-icons-right .select.is-medium ~ .icon { - font-size: 1.25rem; -} - -.control.has-icons-left .input.is-large ~ .icon, -.control.has-icons-left .select.is-large ~ .icon, .control.has-icons-right .input.is-large ~ .icon, -.control.has-icons-right .select.is-large ~ .icon { - font-size: 1.5rem; -} - -.control.has-icons-left .icon, .control.has-icons-right .icon { - color: #dbdbdb; - height: 2.25em; - pointer-events: none; - position: absolute; - top: 0; - width: 2.25em; - z-index: 4; -} - -.control.has-icons-left .input, -.control.has-icons-left .select select { - padding-left: 2.25em; -} - -.control.has-icons-left .icon.is-left { - left: 0; -} - -.control.has-icons-right .input, -.control.has-icons-right .select select { - padding-right: 2.25em; -} - -.control.has-icons-right .icon.is-right { - right: 0; -} - -.control.is-loading::after { - -webkit-animation: spinAround 500ms infinite linear; - animation: spinAround 500ms infinite linear; - border: 2px solid #dbdbdb; - border-radius: 290486px; - border-right-color: transparent; - border-top-color: transparent; - content: ""; - display: block; - height: 1em; - position: relative; - width: 1em; - position: absolute !important; - right: 0.625em; - top: 0.625em; -} - -.control.is-loading.is-small:after { - font-size: 0.75rem; -} - -.control.is-loading.is-medium:after { - font-size: 1.25rem; -} - -.control.is-loading.is-large:after { - font-size: 1.5rem; -} - -.icon { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - height: 1.5rem; - width: 1.5rem; -} - -.icon.is-small { - height: 1rem; - width: 1rem; -} - -.icon.is-medium { - height: 2rem; - width: 2rem; -} - -.icon.is-large { - height: 3rem; - width: 3rem; -} - -.image { - display: block; - position: relative; -} - -.image img { - display: block; - height: auto; - width: 100%; -} - -.image.is-square img, .image.is-1by1 img, .image.is-4by3 img, .image.is-3by2 img, .image.is-16by9 img, .image.is-2by1 img { - bottom: 0; - left: 0; - position: absolute; - right: 0; - top: 0; - height: 100%; - width: 100%; -} - -.image.is-square, .image.is-1by1 { - padding-top: 100%; -} - -.image.is-4by3 { - padding-top: 75%; -} - -.image.is-3by2 { - padding-top: 66.6666%; -} - -.image.is-16by9 { - padding-top: 56.25%; -} - -.image.is-2by1 { - padding-top: 50%; -} - -.image.is-16x16 { - height: 16px; - width: 16px; -} - -.image.is-24x24 { - height: 24px; - width: 24px; -} - -.image.is-32x32 { - height: 32px; - width: 32px; -} - -.image.is-48x48 { - height: 48px; - width: 48px; -} - -.image.is-64x64 { - height: 64px; - width: 64px; -} - -.image.is-96x96 { - height: 96px; - width: 96px; -} - -.image.is-128x128 { - height: 128px; - width: 128px; -} - -.notification { - background-color: whitesmoke; - border-radius: 3px; - padding: 1.25rem 2.5rem 1.25rem 1.5rem; - position: relative; -} - -.notification:not(:last-child) { - margin-bottom: 1.5rem; -} - -.notification a:not(.button) { - color: currentColor; - text-decoration: underline; -} - -.notification strong { - color: currentColor; -} - -.notification code, -.notification pre { - background: white; -} - -.notification pre code { - background: transparent; -} - -.notification > .delete { - position: absolute; - right: 0.5em; - top: 0.5em; -} - -.notification .title, -.notification .subtitle, -.notification .content { - color: currentColor; -} - -.notification.is-white { - background-color: white; - color: #0a0a0a; -} - -.notification.is-black { - background-color: #0a0a0a; - color: white; -} - -.notification.is-light { - background-color: whitesmoke; - color: #363636; -} - -.notification.is-dark { - background-color: #363636; - color: whitesmoke; -} - -.notification.is-primary { - background-color: #00d1b2; - color: #fff; -} - -.notification.is-link { - background-color: #3273dc; - color: #fff; -} - -.notification.is-info { - background-color: #209cee; - color: #fff; -} - -.notification.is-success { - background-color: #23d160; - color: #fff; -} - -.notification.is-warning { - background-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.notification.is-danger { - background-color: #ff3860; - color: #fff; -} - -.progress { - -moz-appearance: none; - -webkit-appearance: none; - border: none; - border-radius: 290486px; - display: block; - height: 1rem; - overflow: hidden; - padding: 0; - width: 100%; -} - -.progress:not(:last-child) { - margin-bottom: 1.5rem; -} - -.progress::-webkit-progress-bar { - background-color: #dbdbdb; -} - -.progress::-webkit-progress-value { - background-color: #4a4a4a; -} - -.progress::-moz-progress-bar { - background-color: #4a4a4a; -} - -.progress.is-white::-webkit-progress-value { - background-color: white; -} - -.progress.is-white::-moz-progress-bar { - background-color: white; -} - -.progress.is-black::-webkit-progress-value { - background-color: #0a0a0a; -} - -.progress.is-black::-moz-progress-bar { - background-color: #0a0a0a; -} - -.progress.is-light::-webkit-progress-value { - background-color: whitesmoke; -} - -.progress.is-light::-moz-progress-bar { - background-color: whitesmoke; -} - -.progress.is-dark::-webkit-progress-value { - background-color: #363636; -} - -.progress.is-dark::-moz-progress-bar { - background-color: #363636; -} - -.progress.is-primary::-webkit-progress-value { - background-color: #00d1b2; -} - -.progress.is-primary::-moz-progress-bar { - background-color: #00d1b2; -} - -.progress.is-link::-webkit-progress-value { - background-color: #3273dc; -} - -.progress.is-link::-moz-progress-bar { - background-color: #3273dc; -} - -.progress.is-info::-webkit-progress-value { - background-color: #209cee; -} - -.progress.is-info::-moz-progress-bar { - background-color: #209cee; -} - -.progress.is-success::-webkit-progress-value { - background-color: #23d160; -} - -.progress.is-success::-moz-progress-bar { - background-color: #23d160; -} - -.progress.is-warning::-webkit-progress-value { - background-color: #ffdd57; -} - -.progress.is-warning::-moz-progress-bar { - background-color: #ffdd57; -} - -.progress.is-danger::-webkit-progress-value { - background-color: #ff3860; -} - -.progress.is-danger::-moz-progress-bar { - background-color: #ff3860; -} - -.progress.is-small { - height: 0.75rem; -} - -.progress.is-medium { - height: 1.25rem; -} - -.progress.is-large { - height: 1.5rem; -} - -.table { - background-color: white; - color: #363636; - margin-bottom: 1.5rem; -} - -.table td, -.table th { - border: 1px solid #dbdbdb; - border-width: 0 0 1px; - padding: 0.5em 0.75em; - vertical-align: top; -} - -.table td.is-white, -.table th.is-white { - background-color: white; - border-color: white; - color: #0a0a0a; -} - -.table td.is-black, -.table th.is-black { - background-color: #0a0a0a; - border-color: #0a0a0a; - color: white; -} - -.table td.is-light, -.table th.is-light { - background-color: whitesmoke; - border-color: whitesmoke; - color: #363636; -} - -.table td.is-dark, -.table th.is-dark { - background-color: #363636; - border-color: #363636; - color: whitesmoke; -} - -.table td.is-primary, -.table th.is-primary { - background-color: #00d1b2; - border-color: #00d1b2; - color: #fff; -} - -.table td.is-link, -.table th.is-link { - background-color: #3273dc; - border-color: #3273dc; - color: #fff; -} - -.table td.is-info, -.table th.is-info { - background-color: #209cee; - border-color: #209cee; - color: #fff; -} - -.table td.is-success, -.table th.is-success { - background-color: #23d160; - border-color: #23d160; - color: #fff; -} - -.table td.is-warning, -.table th.is-warning { - background-color: #ffdd57; - border-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.table td.is-danger, -.table th.is-danger { - background-color: #ff3860; - border-color: #ff3860; - color: #fff; -} - -.table td.is-narrow, -.table th.is-narrow { - white-space: nowrap; - width: 1%; -} - -.table th { - color: #363636; - text-align: left; -} - -.table tr.is-selected { - background-color: #00d1b2; - color: #fff; -} - -.table tr.is-selected a, -.table tr.is-selected strong { - color: currentColor; -} - -.table tr.is-selected td, -.table tr.is-selected th { - border-color: #fff; - color: currentColor; -} - -.table thead td, -.table thead th { - border-width: 0 0 2px; - color: #363636; -} - -.table tfoot td, -.table tfoot th { - border-width: 2px 0 0; - color: #363636; -} - -.table tbody tr:last-child td, -.table tbody tr:last-child th { - border-bottom-width: 0; -} - -.table.is-bordered td, -.table.is-bordered th { - border-width: 1px; -} - -.table.is-bordered tr:last-child td, -.table.is-bordered tr:last-child th { - border-bottom-width: 1px; -} - -.table.is-fullwidth { - width: 100%; -} - -.table.is-hoverable tbody tr:hover { - background-color: #fafafa; -} - -.table.is-hoverable.is-striped tbody tr:not(.is-selected):hover { - background-color: whitesmoke; -} - -.table.is-narrow td, -.table.is-narrow th { - padding: 0.25em 0.5em; -} - -.table.is-striped tbody tr:not(.is-selected):nth-child(even) { - background-color: #fafafa; -} - -.tags { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.tags .tag { - margin-bottom: 0.5rem; -} - -.tags .tag:not(:last-child) { - margin-right: 0.5rem; -} - -.tags:last-child { - margin-bottom: -0.5rem; -} - -.tags:not(:last-child) { - margin-bottom: 1rem; -} - -.tags.has-addons .tag { - margin-right: 0; -} - -.tags.has-addons .tag:not(:first-child) { - border-bottom-left-radius: 0; - border-top-left-radius: 0; -} - -.tags.has-addons .tag:not(:last-child) { - border-bottom-right-radius: 0; - border-top-right-radius: 0; -} - -.tag:not(body) { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - background-color: whitesmoke; - border-radius: 3px; - color: #4a4a4a; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 0.75rem; - height: 2em; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - line-height: 1.5; - padding-left: 0.75em; - padding-right: 0.75em; - white-space: nowrap; -} - -.tag:not(body) .delete { - margin-left: 0.25em; - margin-right: -0.375em; -} - -.tag:not(body).is-white { - background-color: white; - color: #0a0a0a; -} - -.tag:not(body).is-black { - background-color: #0a0a0a; - color: white; -} - -.tag:not(body).is-light { - background-color: whitesmoke; - color: #363636; -} - -.tag:not(body).is-dark { - background-color: #363636; - color: whitesmoke; -} - -.tag:not(body).is-primary { - background-color: #00d1b2; - color: #fff; -} - -.tag:not(body).is-link { - background-color: #3273dc; - color: #fff; -} - -.tag:not(body).is-info { - background-color: #209cee; - color: #fff; -} - -.tag:not(body).is-success { - background-color: #23d160; - color: #fff; -} - -.tag:not(body).is-warning { - background-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.tag:not(body).is-danger { - background-color: #ff3860; - color: #fff; -} - -.tag:not(body).is-medium { - font-size: 1rem; -} - -.tag:not(body).is-large { - font-size: 1.25rem; -} - -.tag:not(body).is-delete { - margin-left: 1px; - padding: 0; - position: relative; - width: 2em; -} - -.tag:not(body).is-delete:before, .tag:not(body).is-delete:after { - background-color: currentColor; - content: ""; - display: block; - left: 50%; - position: absolute; - top: 50%; - -webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg); - transform: translateX(-50%) translateY(-50%) rotate(45deg); - -webkit-transform-origin: center center; - transform-origin: center center; -} - -.tag:not(body).is-delete:before { - height: 1px; - width: 50%; -} - -.tag:not(body).is-delete:after { - height: 50%; - width: 1px; -} - -.tag:not(body).is-delete:hover, .tag:not(body).is-delete:focus { - background-color: #e8e8e8; -} - -.tag:not(body).is-delete:active { - background-color: #dbdbdb; -} - -.tag:not(body).is-rounded { - border-radius: 290486px; -} - -a.tag:hover { - text-decoration: underline; -} - -.title, -.subtitle { - word-break: break-word; -} - -.title:not(:last-child), -.subtitle:not(:last-child) { - margin-bottom: 1.5rem; -} - -.title em, -.title span, -.subtitle em, -.subtitle span { - font-weight: inherit; -} - -.title .tag, -.subtitle .tag { - vertical-align: middle; -} - -.title { - color: #363636; - font-size: 2rem; - font-weight: 600; - line-height: 1.125; -} - -.title strong { - color: inherit; - font-weight: inherit; -} - -.title + .highlight { - margin-top: -0.75rem; -} - -.title:not(.is-spaced) + .subtitle { - margin-top: -1.5rem; -} - -.title.is-1 { - font-size: 3rem; -} - -.title.is-2 { - font-size: 2.5rem; -} - -.title.is-3 { - font-size: 2rem; -} - -.title.is-4 { - font-size: 1.5rem; -} - -.title.is-5 { - font-size: 1.25rem; -} - -.title.is-6 { - font-size: 1rem; -} - -.title.is-7 { - font-size: 0.75rem; -} - -.subtitle { - color: #4a4a4a; - font-size: 1.25rem; - font-weight: 400; - line-height: 1.25; -} - -.subtitle strong { - color: #363636; - font-weight: 600; -} - -.subtitle:not(.is-spaced) + .title { - margin-top: -1.5rem; -} - -.subtitle.is-1 { - font-size: 3rem; -} - -.subtitle.is-2 { - font-size: 2.5rem; -} - -.subtitle.is-3 { - font-size: 2rem; -} - -.subtitle.is-4 { - font-size: 1.5rem; -} - -.subtitle.is-5 { - font-size: 1.25rem; -} - -.subtitle.is-6 { - font-size: 1rem; -} - -.subtitle.is-7 { - font-size: 0.75rem; -} - -.block:not(:last-child) { - margin-bottom: 1.5rem; -} - -.delete { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -moz-appearance: none; - -webkit-appearance: none; - background-color: rgba(10, 10, 10, 0.2); - border: none; - border-radius: 290486px; - cursor: pointer; - display: inline-block; - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - font-size: 1rem; - height: 20px; - max-height: 20px; - max-width: 20px; - min-height: 20px; - min-width: 20px; - outline: none; - position: relative; - vertical-align: top; - width: 20px; -} - -.delete:before, .delete:after { - background-color: white; - content: ""; - display: block; - left: 50%; - position: absolute; - top: 50%; - -webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg); - transform: translateX(-50%) translateY(-50%) rotate(45deg); - -webkit-transform-origin: center center; - transform-origin: center center; -} - -.delete:before { - height: 2px; - width: 50%; -} - -.delete:after { - height: 50%; - width: 2px; -} - -.delete:hover, .delete:focus { - background-color: rgba(10, 10, 10, 0.3); -} - -.delete:active { - background-color: rgba(10, 10, 10, 0.4); -} - -.delete.is-small { - height: 16px; - max-height: 16px; - max-width: 16px; - min-height: 16px; - min-width: 16px; - width: 16px; -} - -.delete.is-medium { - height: 24px; - max-height: 24px; - max-width: 24px; - min-height: 24px; - min-width: 24px; - width: 24px; -} - -.delete.is-large { - height: 32px; - max-height: 32px; - max-width: 32px; - min-height: 32px; - min-width: 32px; - width: 32px; -} - -.heading { - display: block; - font-size: 11px; - letter-spacing: 1px; - margin-bottom: 5px; - text-transform: uppercase; -} - -.highlight { - font-weight: 400; - max-width: 100%; - overflow: hidden; - padding: 0; -} - -.highlight:not(:last-child) { - margin-bottom: 1.5rem; -} - -.highlight pre { - overflow: auto; - max-width: 100%; -} - -.loader { - -webkit-animation: spinAround 500ms infinite linear; - animation: spinAround 500ms infinite linear; - border: 2px solid #dbdbdb; - border-radius: 290486px; - border-right-color: transparent; - border-top-color: transparent; - content: ""; - display: block; - height: 1em; - position: relative; - width: 1em; -} - -.number { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - background-color: whitesmoke; - border-radius: 290486px; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 1.25rem; - height: 2em; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - margin-right: 1.5rem; - min-width: 2.5em; - padding: 0.25rem 0.5rem; - text-align: center; - vertical-align: top; -} - -.breadcrumb { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - font-size: 1rem; - overflow: hidden; - overflow-x: auto; - white-space: nowrap; -} - -.breadcrumb:not(:last-child) { - margin-bottom: 1.5rem; -} - -.breadcrumb a { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - color: #3273dc; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - padding: 0.5em 0.75em; -} - -.breadcrumb a:hover { - color: #363636; -} - -.breadcrumb li { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.breadcrumb li:first-child a { - padding-left: 0; -} - -.breadcrumb li.is-active a { - color: #363636; - cursor: default; - pointer-events: none; -} - -.breadcrumb li + li::before { - color: #4a4a4a; - content: "\0002f"; -} - -.breadcrumb ul, .breadcrumb ol { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.breadcrumb .icon:first-child { - margin-right: 0.5em; -} - -.breadcrumb .icon:last-child { - margin-left: 0.5em; -} - -.breadcrumb.is-centered ol, .breadcrumb.is-centered ul { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.breadcrumb.is-right ol, .breadcrumb.is-right ul { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; -} - -.breadcrumb.is-small { - font-size: 0.75rem; -} - -.breadcrumb.is-medium { - font-size: 1.25rem; -} - -.breadcrumb.is-large { - font-size: 1.5rem; -} - -.breadcrumb.has-arrow-separator li + li::before { - content: "\02192"; -} - -.breadcrumb.has-bullet-separator li + li::before { - content: "\02022"; -} - -.breadcrumb.has-dot-separator li + li::before { - content: "\000b7"; -} - -.breadcrumb.has-succeeds-separator li + li::before { - content: "\0227B"; -} - -.card { - background-color: white; - -webkit-box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - color: #4a4a4a; - max-width: 100%; - position: relative; -} - -.card-header { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - -webkit-box-shadow: 0 1px 2px rgba(10, 10, 10, 0.1); - box-shadow: 0 1px 2px rgba(10, 10, 10, 0.1); - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.card-header-title { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - color: #363636; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - font-weight: 700; - padding: 0.75rem; -} - -.card-header-title.is-centered { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.card-header-icon { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - cursor: pointer; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - padding: 0.75rem; -} - -.card-image { - display: block; - position: relative; -} - -.card-content { - padding: 1.5rem; -} - -.card-footer { - border-top: 1px solid #dbdbdb; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.card-footer-item { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - padding: 0.75rem; -} - -.card-footer-item:not(:last-child) { - border-right: 1px solid #dbdbdb; -} - -.card .media:not(:last-child) { - margin-bottom: 0.75rem; -} - -.dropdown { - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - position: relative; - vertical-align: top; -} - -.dropdown.is-active .dropdown-menu, .dropdown.is-hoverable:hover .dropdown-menu { - display: block; -} - -.dropdown.is-right .dropdown-menu { - left: auto; - right: 0; -} - -.dropdown.is-up .dropdown-menu { - bottom: 100%; - padding-bottom: 4px; - padding-top: unset; - top: auto; -} - -.dropdown-menu { - display: none; - left: 0; - min-width: 12rem; - padding-top: 4px; - position: absolute; - top: 100%; - z-index: 20; -} - -.dropdown-content { - background-color: white; - border-radius: 3px; - -webkit-box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - padding-bottom: 0.5rem; - padding-top: 0.5rem; -} - -.dropdown-item { - color: #4a4a4a; - display: block; - font-size: 0.875rem; - line-height: 1.5; - padding: 0.375rem 1rem; - position: relative; -} - -a.dropdown-item { - padding-right: 3rem; - white-space: nowrap; -} - -a.dropdown-item:hover { - background-color: whitesmoke; - color: #0a0a0a; -} - -a.dropdown-item.is-active { - background-color: #3273dc; - color: #fff; -} - -.dropdown-divider { - background-color: #dbdbdb; - border: none; - display: block; - height: 1px; - margin: 0.5rem 0; -} - -.level { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; -} - -.level:not(:last-child) { - margin-bottom: 1.5rem; -} - -.level code { - border-radius: 3px; -} - -.level img { - display: inline-block; - vertical-align: top; -} - -.level.is-mobile { - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.level.is-mobile .level-left, -.level.is-mobile .level-right { - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.level.is-mobile .level-left + .level-right { - margin-top: 0; -} - -.level.is-mobile .level-item { - margin-right: 0.75rem; -} - -.level.is-mobile .level-item:not(:last-child) { - margin-bottom: 0; -} - -.level.is-mobile .level-item:not(.is-narrow) { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; -} - -@media screen and (min-width: 769px), print { - .level { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .level > .level-item:not(.is-narrow) { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - } -} - -.level-item { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-preferred-size: auto; - flex-basis: auto; - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.level-item .title, -.level-item .subtitle { - margin-bottom: 0; -} - -@media screen and (max-width: 768px) { - .level-item:not(:last-child) { - margin-bottom: 0.75rem; - } -} - -.level-left, -.level-right { - -ms-flex-preferred-size: auto; - flex-basis: auto; - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.level-left .level-item.is-flexible, -.level-right .level-item.is-flexible { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; -} - -@media screen and (min-width: 769px), print { - .level-left .level-item:not(:last-child), - .level-right .level-item:not(:last-child) { - margin-right: 0.75rem; - } -} - -.level-left { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -@media screen and (max-width: 768px) { - .level-left + .level-right { - margin-top: 1.5rem; - } -} - -@media screen and (min-width: 769px), print { - .level-left { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } -} - -.level-right { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; -} - -@media screen and (min-width: 769px), print { - .level-right { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } -} - -.media { - -webkit-box-align: start; - -ms-flex-align: start; - align-items: flex-start; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - text-align: left; -} - -.media .content:not(:last-child) { - margin-bottom: 0.75rem; -} - -.media .media { - border-top: 1px solid rgba(219, 219, 219, 0.5); - display: -webkit-box; - display: -ms-flexbox; - display: flex; - padding-top: 0.75rem; -} - -.media .media .content:not(:last-child), -.media .media .control:not(:last-child) { - margin-bottom: 0.5rem; -} - -.media .media .media { - padding-top: 0.5rem; -} - -.media .media .media + .media { - margin-top: 0.5rem; -} - -.media + .media { - border-top: 1px solid rgba(219, 219, 219, 0.5); - margin-top: 1rem; - padding-top: 1rem; -} - -.media.is-large + .media { - margin-top: 1.5rem; - padding-top: 1.5rem; -} - -.media-left, -.media-right { - -ms-flex-preferred-size: auto; - flex-basis: auto; - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.media-left { - margin-right: 1rem; -} - -.media-right { - margin-left: 1rem; -} - -.media-content { - -ms-flex-preferred-size: auto; - flex-basis: auto; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - text-align: left; -} - -.menu { - font-size: 1rem; -} - -.menu.is-small { - font-size: 0.75rem; -} - -.menu.is-medium { - font-size: 1.25rem; -} - -.menu.is-large { - font-size: 1.5rem; -} - -.menu-list { - line-height: 1.25; -} - -.menu-list a { - border-radius: 2px; - color: #4a4a4a; - display: block; - padding: 0.5em 0.75em; -} - -.menu-list a:hover { - background-color: whitesmoke; - color: #363636; -} - -.menu-list a.is-active { - background-color: #3273dc; - color: #fff; -} - -.menu-list li ul { - border-left: 1px solid #dbdbdb; - margin: 0.75em; - padding-left: 0.75em; -} - -.menu-label { - color: #7a7a7a; - font-size: 0.75em; - letter-spacing: 0.1em; - text-transform: uppercase; -} - -.menu-label:not(:first-child) { - margin-top: 1em; -} - -.menu-label:not(:last-child) { - margin-bottom: 1em; -} - -.message { - background-color: whitesmoke; - border-radius: 3px; - font-size: 1rem; -} - -.message:not(:last-child) { - margin-bottom: 1.5rem; -} - -.message strong { - color: currentColor; -} - -.message a:not(.button):not(.tag) { - color: currentColor; - text-decoration: underline; -} - -.message.is-small { - font-size: 0.75rem; -} - -.message.is-medium { - font-size: 1.25rem; -} - -.message.is-large { - font-size: 1.5rem; -} - -.message.is-white { - background-color: white; -} - -.message.is-white .message-header { - background-color: white; - color: #0a0a0a; -} - -.message.is-white .message-body { - border-color: white; - color: #4d4d4d; -} - -.message.is-black { - background-color: #fafafa; -} - -.message.is-black .message-header { - background-color: #0a0a0a; - color: white; -} - -.message.is-black .message-body { - border-color: #0a0a0a; - color: #090909; -} - -.message.is-light { - background-color: #fafafa; -} - -.message.is-light .message-header { - background-color: whitesmoke; - color: #363636; -} - -.message.is-light .message-body { - border-color: whitesmoke; - color: #505050; -} - -.message.is-dark { - background-color: #fafafa; -} - -.message.is-dark .message-header { - background-color: #363636; - color: whitesmoke; -} - -.message.is-dark .message-body { - border-color: #363636; - color: #2a2a2a; -} - -.message.is-primary { - background-color: #f5fffd; -} - -.message.is-primary .message-header { - background-color: #00d1b2; - color: #fff; -} - -.message.is-primary .message-body { - border-color: #00d1b2; - color: #021310; -} - -.message.is-link { - background-color: #f6f9fe; -} - -.message.is-link .message-header { - background-color: #3273dc; - color: #fff; -} - -.message.is-link .message-body { - border-color: #3273dc; - color: #22509a; -} - -.message.is-info { - background-color: #f6fbfe; -} - -.message.is-info .message-header { - background-color: #209cee; - color: #fff; -} - -.message.is-info .message-body { - border-color: #209cee; - color: #12537e; -} - -.message.is-success { - background-color: #f6fef9; -} - -.message.is-success .message-header { - background-color: #23d160; - color: #fff; -} - -.message.is-success .message-body { - border-color: #23d160; - color: #0e301a; -} - -.message.is-warning { - background-color: #fffdf5; -} - -.message.is-warning .message-header { - background-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.message.is-warning .message-body { - border-color: #ffdd57; - color: #3b3108; -} - -.message.is-danger { - background-color: #fff5f7; -} - -.message.is-danger .message-header { - background-color: #ff3860; - color: #fff; -} - -.message.is-danger .message-body { - border-color: #ff3860; - color: #cd0930; -} - -.message-header { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - background-color: #4a4a4a; - border-radius: 3px 3px 0 0; - color: #fff; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; - line-height: 1.25; - padding: 0.5em 0.75em; - position: relative; -} - -.message-header .delete { - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - margin-left: 0.75em; -} - -.message-header + .message-body { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-top: none; -} - -.message-body { - border: 1px solid #dbdbdb; - border-radius: 3px; - color: #4a4a4a; - padding: 1em 1.25em; -} - -.message-body code, -.message-body pre { - background-color: white; -} - -.message-body pre code { - background-color: transparent; -} - -.modal { - bottom: 0; - left: 0; - position: absolute; - right: 0; - top: 0; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: none; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - overflow: hidden; - position: fixed; - z-index: 20; -} - -.modal.is-active { - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.modal-background { - bottom: 0; - left: 0; - position: absolute; - right: 0; - top: 0; - background-color: rgba(10, 10, 10, 0.86); -} - -.modal-content, -.modal-card { - margin: 0 20px; - max-height: calc(100vh - 160px); - overflow: auto; - position: relative; - width: 100%; -} - -@media screen and (min-width: 769px), print { - .modal-content, - .modal-card { - margin: 0 auto; - max-height: calc(100vh - 40px); - width: 640px; - } -} - -.modal-close { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -moz-appearance: none; - -webkit-appearance: none; - background-color: rgba(10, 10, 10, 0.2); - border: none; - border-radius: 290486px; - cursor: pointer; - display: inline-block; - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - font-size: 1rem; - height: 20px; - max-height: 20px; - max-width: 20px; - min-height: 20px; - min-width: 20px; - outline: none; - position: relative; - vertical-align: top; - width: 20px; - background: none; - height: 40px; - position: fixed; - right: 20px; - top: 20px; - width: 40px; -} - -.modal-close:before, .modal-close:after { - background-color: white; - content: ""; - display: block; - left: 50%; - position: absolute; - top: 50%; - -webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg); - transform: translateX(-50%) translateY(-50%) rotate(45deg); - -webkit-transform-origin: center center; - transform-origin: center center; -} - -.modal-close:before { - height: 2px; - width: 50%; -} - -.modal-close:after { - height: 50%; - width: 2px; -} - -.modal-close:hover, .modal-close:focus { - background-color: rgba(10, 10, 10, 0.3); -} - -.modal-close:active { - background-color: rgba(10, 10, 10, 0.4); -} - -.modal-close.is-small { - height: 16px; - max-height: 16px; - max-width: 16px; - min-height: 16px; - min-width: 16px; - width: 16px; -} - -.modal-close.is-medium { - height: 24px; - max-height: 24px; - max-width: 24px; - min-height: 24px; - min-width: 24px; - width: 24px; -} - -.modal-close.is-large { - height: 32px; - max-height: 32px; - max-width: 32px; - min-height: 32px; - min-width: 32px; - width: 32px; -} - -.modal-card { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - max-height: calc(100vh - 40px); - overflow: hidden; -} - -.modal-card-head, -.modal-card-foot { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - background-color: whitesmoke; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - padding: 20px; - position: relative; -} - -.modal-card-head { - border-bottom: 1px solid #dbdbdb; - border-top-left-radius: 5px; - border-top-right-radius: 5px; -} - -.modal-card-title { - color: #363636; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - font-size: 1.5rem; - line-height: 1; -} - -.modal-card-foot { - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; - border-top: 1px solid #dbdbdb; -} - -.modal-card-foot .button:not(:last-child) { - margin-right: 10px; -} - -.modal-card-body { - -webkit-overflow-scrolling: touch; - background-color: white; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - overflow: auto; - padding: 20px; -} - -.navbar { - background-color: white; - min-height: 3.25rem; - position: relative; -} - -.navbar.is-white { - background-color: white; - color: #0a0a0a; -} - -.navbar.is-white .navbar-brand > .navbar-item, -.navbar.is-white .navbar-brand .navbar-link { - color: #0a0a0a; -} - -.navbar.is-white .navbar-brand > a.navbar-item:hover, .navbar.is-white .navbar-brand > a.navbar-item.is-active, -.navbar.is-white .navbar-brand .navbar-link:hover, -.navbar.is-white .navbar-brand .navbar-link.is-active { - background-color: #f2f2f2; - color: #0a0a0a; -} - -.navbar.is-white .navbar-brand .navbar-link::after { - border-color: #0a0a0a; -} - -@media screen and (min-width: 1024px) { - .navbar.is-white .navbar-start > .navbar-item, - .navbar.is-white .navbar-start .navbar-link, - .navbar.is-white .navbar-end > .navbar-item, - .navbar.is-white .navbar-end .navbar-link { - color: #0a0a0a; - } - .navbar.is-white .navbar-start > a.navbar-item:hover, .navbar.is-white .navbar-start > a.navbar-item.is-active, - .navbar.is-white .navbar-start .navbar-link:hover, - .navbar.is-white .navbar-start .navbar-link.is-active, - .navbar.is-white .navbar-end > a.navbar-item:hover, - .navbar.is-white .navbar-end > a.navbar-item.is-active, - .navbar.is-white .navbar-end .navbar-link:hover, - .navbar.is-white .navbar-end .navbar-link.is-active { - background-color: #f2f2f2; - color: #0a0a0a; - } - .navbar.is-white .navbar-start .navbar-link::after, - .navbar.is-white .navbar-end .navbar-link::after { - border-color: #0a0a0a; - } - .navbar.is-white .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-white .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #f2f2f2; - color: #0a0a0a; - } - .navbar.is-white .navbar-dropdown a.navbar-item.is-active { - background-color: white; - color: #0a0a0a; - } -} - -.navbar.is-black { - background-color: #0a0a0a; - color: white; -} - -.navbar.is-black .navbar-brand > .navbar-item, -.navbar.is-black .navbar-brand .navbar-link { - color: white; -} - -.navbar.is-black .navbar-brand > a.navbar-item:hover, .navbar.is-black .navbar-brand > a.navbar-item.is-active, -.navbar.is-black .navbar-brand .navbar-link:hover, -.navbar.is-black .navbar-brand .navbar-link.is-active { - background-color: black; - color: white; -} - -.navbar.is-black .navbar-brand .navbar-link::after { - border-color: white; -} - -@media screen and (min-width: 1024px) { - .navbar.is-black .navbar-start > .navbar-item, - .navbar.is-black .navbar-start .navbar-link, - .navbar.is-black .navbar-end > .navbar-item, - .navbar.is-black .navbar-end .navbar-link { - color: white; - } - .navbar.is-black .navbar-start > a.navbar-item:hover, .navbar.is-black .navbar-start > a.navbar-item.is-active, - .navbar.is-black .navbar-start .navbar-link:hover, - .navbar.is-black .navbar-start .navbar-link.is-active, - .navbar.is-black .navbar-end > a.navbar-item:hover, - .navbar.is-black .navbar-end > a.navbar-item.is-active, - .navbar.is-black .navbar-end .navbar-link:hover, - .navbar.is-black .navbar-end .navbar-link.is-active { - background-color: black; - color: white; - } - .navbar.is-black .navbar-start .navbar-link::after, - .navbar.is-black .navbar-end .navbar-link::after { - border-color: white; - } - .navbar.is-black .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-black .navbar-item.has-dropdown.is-active .navbar-link { - background-color: black; - color: white; - } - .navbar.is-black .navbar-dropdown a.navbar-item.is-active { - background-color: #0a0a0a; - color: white; - } -} - -.navbar.is-light { - background-color: whitesmoke; - color: #363636; -} - -.navbar.is-light .navbar-brand > .navbar-item, -.navbar.is-light .navbar-brand .navbar-link { - color: #363636; -} - -.navbar.is-light .navbar-brand > a.navbar-item:hover, .navbar.is-light .navbar-brand > a.navbar-item.is-active, -.navbar.is-light .navbar-brand .navbar-link:hover, -.navbar.is-light .navbar-brand .navbar-link.is-active { - background-color: #e8e8e8; - color: #363636; -} - -.navbar.is-light .navbar-brand .navbar-link::after { - border-color: #363636; -} - -@media screen and (min-width: 1024px) { - .navbar.is-light .navbar-start > .navbar-item, - .navbar.is-light .navbar-start .navbar-link, - .navbar.is-light .navbar-end > .navbar-item, - .navbar.is-light .navbar-end .navbar-link { - color: #363636; - } - .navbar.is-light .navbar-start > a.navbar-item:hover, .navbar.is-light .navbar-start > a.navbar-item.is-active, - .navbar.is-light .navbar-start .navbar-link:hover, - .navbar.is-light .navbar-start .navbar-link.is-active, - .navbar.is-light .navbar-end > a.navbar-item:hover, - .navbar.is-light .navbar-end > a.navbar-item.is-active, - .navbar.is-light .navbar-end .navbar-link:hover, - .navbar.is-light .navbar-end .navbar-link.is-active { - background-color: #e8e8e8; - color: #363636; - } - .navbar.is-light .navbar-start .navbar-link::after, - .navbar.is-light .navbar-end .navbar-link::after { - border-color: #363636; - } - .navbar.is-light .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #e8e8e8; - color: #363636; - } - .navbar.is-light .navbar-dropdown a.navbar-item.is-active { - background-color: whitesmoke; - color: #363636; - } -} - -.navbar.is-dark { - background-color: #363636; - color: whitesmoke; -} - -.navbar.is-dark .navbar-brand > .navbar-item, -.navbar.is-dark .navbar-brand .navbar-link { - color: whitesmoke; -} - -.navbar.is-dark .navbar-brand > a.navbar-item:hover, .navbar.is-dark .navbar-brand > a.navbar-item.is-active, -.navbar.is-dark .navbar-brand .navbar-link:hover, -.navbar.is-dark .navbar-brand .navbar-link.is-active { - background-color: #292929; - color: whitesmoke; -} - -.navbar.is-dark .navbar-brand .navbar-link::after { - border-color: whitesmoke; -} - -@media screen and (min-width: 1024px) { - .navbar.is-dark .navbar-start > .navbar-item, - .navbar.is-dark .navbar-start .navbar-link, - .navbar.is-dark .navbar-end > .navbar-item, - .navbar.is-dark .navbar-end .navbar-link { - color: whitesmoke; - } - .navbar.is-dark .navbar-start > a.navbar-item:hover, .navbar.is-dark .navbar-start > a.navbar-item.is-active, - .navbar.is-dark .navbar-start .navbar-link:hover, - .navbar.is-dark .navbar-start .navbar-link.is-active, - .navbar.is-dark .navbar-end > a.navbar-item:hover, - .navbar.is-dark .navbar-end > a.navbar-item.is-active, - .navbar.is-dark .navbar-end .navbar-link:hover, - .navbar.is-dark .navbar-end .navbar-link.is-active { - background-color: #292929; - color: whitesmoke; - } - .navbar.is-dark .navbar-start .navbar-link::after, - .navbar.is-dark .navbar-end .navbar-link::after { - border-color: whitesmoke; - } - .navbar.is-dark .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-dark .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #292929; - color: whitesmoke; - } - .navbar.is-dark .navbar-dropdown a.navbar-item.is-active { - background-color: #363636; - color: whitesmoke; - } -} - -.navbar.is-primary { - background-color: #00d1b2; - color: #fff; -} - -.navbar.is-primary .navbar-brand > .navbar-item, -.navbar.is-primary .navbar-brand .navbar-link { - color: #fff; -} - -.navbar.is-primary .navbar-brand > a.navbar-item:hover, .navbar.is-primary .navbar-brand > a.navbar-item.is-active, -.navbar.is-primary .navbar-brand .navbar-link:hover, -.navbar.is-primary .navbar-brand .navbar-link.is-active { - background-color: #00b89c; - color: #fff; -} - -.navbar.is-primary .navbar-brand .navbar-link::after { - border-color: #fff; -} - -@media screen and (min-width: 1024px) { - .navbar.is-primary .navbar-start > .navbar-item, - .navbar.is-primary .navbar-start .navbar-link, - .navbar.is-primary .navbar-end > .navbar-item, - .navbar.is-primary .navbar-end .navbar-link { - color: #fff; - } - .navbar.is-primary .navbar-start > a.navbar-item:hover, .navbar.is-primary .navbar-start > a.navbar-item.is-active, - .navbar.is-primary .navbar-start .navbar-link:hover, - .navbar.is-primary .navbar-start .navbar-link.is-active, - .navbar.is-primary .navbar-end > a.navbar-item:hover, - .navbar.is-primary .navbar-end > a.navbar-item.is-active, - .navbar.is-primary .navbar-end .navbar-link:hover, - .navbar.is-primary .navbar-end .navbar-link.is-active { - background-color: #00b89c; - color: #fff; - } - .navbar.is-primary .navbar-start .navbar-link::after, - .navbar.is-primary .navbar-end .navbar-link::after { - border-color: #fff; - } - .navbar.is-primary .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-primary .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #00b89c; - color: #fff; - } - .navbar.is-primary .navbar-dropdown a.navbar-item.is-active { - background-color: #00d1b2; - color: #fff; - } -} - -.navbar.is-link { - background-color: #3273dc; - color: #fff; -} - -.navbar.is-link .navbar-brand > .navbar-item, -.navbar.is-link .navbar-brand .navbar-link { - color: #fff; -} - -.navbar.is-link .navbar-brand > a.navbar-item:hover, .navbar.is-link .navbar-brand > a.navbar-item.is-active, -.navbar.is-link .navbar-brand .navbar-link:hover, -.navbar.is-link .navbar-brand .navbar-link.is-active { - background-color: #2366d1; - color: #fff; -} - -.navbar.is-link .navbar-brand .navbar-link::after { - border-color: #fff; -} - -@media screen and (min-width: 1024px) { - .navbar.is-link .navbar-start > .navbar-item, - .navbar.is-link .navbar-start .navbar-link, - .navbar.is-link .navbar-end > .navbar-item, - .navbar.is-link .navbar-end .navbar-link { - color: #fff; - } - .navbar.is-link .navbar-start > a.navbar-item:hover, .navbar.is-link .navbar-start > a.navbar-item.is-active, - .navbar.is-link .navbar-start .navbar-link:hover, - .navbar.is-link .navbar-start .navbar-link.is-active, - .navbar.is-link .navbar-end > a.navbar-item:hover, - .navbar.is-link .navbar-end > a.navbar-item.is-active, - .navbar.is-link .navbar-end .navbar-link:hover, - .navbar.is-link .navbar-end .navbar-link.is-active { - background-color: #2366d1; - color: #fff; - } - .navbar.is-link .navbar-start .navbar-link::after, - .navbar.is-link .navbar-end .navbar-link::after { - border-color: #fff; - } - .navbar.is-link .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-link .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #2366d1; - color: #fff; - } - .navbar.is-link .navbar-dropdown a.navbar-item.is-active { - background-color: #3273dc; - color: #fff; - } -} - -.navbar.is-info { - background-color: #209cee; - color: #fff; -} - -.navbar.is-info .navbar-brand > .navbar-item, -.navbar.is-info .navbar-brand .navbar-link { - color: #fff; -} - -.navbar.is-info .navbar-brand > a.navbar-item:hover, .navbar.is-info .navbar-brand > a.navbar-item.is-active, -.navbar.is-info .navbar-brand .navbar-link:hover, -.navbar.is-info .navbar-brand .navbar-link.is-active { - background-color: #118fe4; - color: #fff; -} - -.navbar.is-info .navbar-brand .navbar-link::after { - border-color: #fff; -} - -@media screen and (min-width: 1024px) { - .navbar.is-info .navbar-start > .navbar-item, - .navbar.is-info .navbar-start .navbar-link, - .navbar.is-info .navbar-end > .navbar-item, - .navbar.is-info .navbar-end .navbar-link { - color: #fff; - } - .navbar.is-info .navbar-start > a.navbar-item:hover, .navbar.is-info .navbar-start > a.navbar-item.is-active, - .navbar.is-info .navbar-start .navbar-link:hover, - .navbar.is-info .navbar-start .navbar-link.is-active, - .navbar.is-info .navbar-end > a.navbar-item:hover, - .navbar.is-info .navbar-end > a.navbar-item.is-active, - .navbar.is-info .navbar-end .navbar-link:hover, - .navbar.is-info .navbar-end .navbar-link.is-active { - background-color: #118fe4; - color: #fff; - } - .navbar.is-info .navbar-start .navbar-link::after, - .navbar.is-info .navbar-end .navbar-link::after { - border-color: #fff; - } - .navbar.is-info .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-info .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #118fe4; - color: #fff; - } - .navbar.is-info .navbar-dropdown a.navbar-item.is-active { - background-color: #209cee; - color: #fff; - } -} - -.navbar.is-success { - background-color: #23d160; - color: #fff; -} - -.navbar.is-success .navbar-brand > .navbar-item, -.navbar.is-success .navbar-brand .navbar-link { - color: #fff; -} - -.navbar.is-success .navbar-brand > a.navbar-item:hover, .navbar.is-success .navbar-brand > a.navbar-item.is-active, -.navbar.is-success .navbar-brand .navbar-link:hover, -.navbar.is-success .navbar-brand .navbar-link.is-active { - background-color: #20bc56; - color: #fff; -} - -.navbar.is-success .navbar-brand .navbar-link::after { - border-color: #fff; -} - -@media screen and (min-width: 1024px) { - .navbar.is-success .navbar-start > .navbar-item, - .navbar.is-success .navbar-start .navbar-link, - .navbar.is-success .navbar-end > .navbar-item, - .navbar.is-success .navbar-end .navbar-link { - color: #fff; - } - .navbar.is-success .navbar-start > a.navbar-item:hover, .navbar.is-success .navbar-start > a.navbar-item.is-active, - .navbar.is-success .navbar-start .navbar-link:hover, - .navbar.is-success .navbar-start .navbar-link.is-active, - .navbar.is-success .navbar-end > a.navbar-item:hover, - .navbar.is-success .navbar-end > a.navbar-item.is-active, - .navbar.is-success .navbar-end .navbar-link:hover, - .navbar.is-success .navbar-end .navbar-link.is-active { - background-color: #20bc56; - color: #fff; - } - .navbar.is-success .navbar-start .navbar-link::after, - .navbar.is-success .navbar-end .navbar-link::after { - border-color: #fff; - } - .navbar.is-success .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-success .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #20bc56; - color: #fff; - } - .navbar.is-success .navbar-dropdown a.navbar-item.is-active { - background-color: #23d160; - color: #fff; - } -} - -.navbar.is-warning { - background-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.navbar.is-warning .navbar-brand > .navbar-item, -.navbar.is-warning .navbar-brand .navbar-link { - color: rgba(0, 0, 0, 0.7); -} - -.navbar.is-warning .navbar-brand > a.navbar-item:hover, .navbar.is-warning .navbar-brand > a.navbar-item.is-active, -.navbar.is-warning .navbar-brand .navbar-link:hover, -.navbar.is-warning .navbar-brand .navbar-link.is-active { - background-color: #ffd83d; - color: rgba(0, 0, 0, 0.7); -} - -.navbar.is-warning .navbar-brand .navbar-link::after { - border-color: rgba(0, 0, 0, 0.7); -} - -@media screen and (min-width: 1024px) { - .navbar.is-warning .navbar-start > .navbar-item, - .navbar.is-warning .navbar-start .navbar-link, - .navbar.is-warning .navbar-end > .navbar-item, - .navbar.is-warning .navbar-end .navbar-link { - color: rgba(0, 0, 0, 0.7); - } - .navbar.is-warning .navbar-start > a.navbar-item:hover, .navbar.is-warning .navbar-start > a.navbar-item.is-active, - .navbar.is-warning .navbar-start .navbar-link:hover, - .navbar.is-warning .navbar-start .navbar-link.is-active, - .navbar.is-warning .navbar-end > a.navbar-item:hover, - .navbar.is-warning .navbar-end > a.navbar-item.is-active, - .navbar.is-warning .navbar-end .navbar-link:hover, - .navbar.is-warning .navbar-end .navbar-link.is-active { - background-color: #ffd83d; - color: rgba(0, 0, 0, 0.7); - } - .navbar.is-warning .navbar-start .navbar-link::after, - .navbar.is-warning .navbar-end .navbar-link::after { - border-color: rgba(0, 0, 0, 0.7); - } - .navbar.is-warning .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-warning .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #ffd83d; - color: rgba(0, 0, 0, 0.7); - } - .navbar.is-warning .navbar-dropdown a.navbar-item.is-active { - background-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); - } -} - -.navbar.is-danger { - background-color: #ff3860; - color: #fff; -} - -.navbar.is-danger .navbar-brand > .navbar-item, -.navbar.is-danger .navbar-brand .navbar-link { - color: #fff; -} - -.navbar.is-danger .navbar-brand > a.navbar-item:hover, .navbar.is-danger .navbar-brand > a.navbar-item.is-active, -.navbar.is-danger .navbar-brand .navbar-link:hover, -.navbar.is-danger .navbar-brand .navbar-link.is-active { - background-color: #ff1f4b; - color: #fff; -} - -.navbar.is-danger .navbar-brand .navbar-link::after { - border-color: #fff; -} - -@media screen and (min-width: 1024px) { - .navbar.is-danger .navbar-start > .navbar-item, - .navbar.is-danger .navbar-start .navbar-link, - .navbar.is-danger .navbar-end > .navbar-item, - .navbar.is-danger .navbar-end .navbar-link { - color: #fff; - } - .navbar.is-danger .navbar-start > a.navbar-item:hover, .navbar.is-danger .navbar-start > a.navbar-item.is-active, - .navbar.is-danger .navbar-start .navbar-link:hover, - .navbar.is-danger .navbar-start .navbar-link.is-active, - .navbar.is-danger .navbar-end > a.navbar-item:hover, - .navbar.is-danger .navbar-end > a.navbar-item.is-active, - .navbar.is-danger .navbar-end .navbar-link:hover, - .navbar.is-danger .navbar-end .navbar-link.is-active { - background-color: #ff1f4b; - color: #fff; - } - .navbar.is-danger .navbar-start .navbar-link::after, - .navbar.is-danger .navbar-end .navbar-link::after { - border-color: #fff; - } - .navbar.is-danger .navbar-item.has-dropdown:hover .navbar-link, - .navbar.is-danger .navbar-item.has-dropdown.is-active .navbar-link { - background-color: #ff1f4b; - color: #fff; - } - .navbar.is-danger .navbar-dropdown a.navbar-item.is-active { - background-color: #ff3860; - color: #fff; - } -} - -.navbar > .container { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - min-height: 3.25rem; - width: 100%; -} - -.navbar.has-shadow { - -webkit-box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1); - box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1); -} - -.navbar-brand, -.navbar-tabs { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-negative: 0; - flex-shrink: 0; - min-height: 3.25rem; -} - -.navbar-tabs { - -webkit-overflow-scrolling: touch; - max-width: 100vw; - overflow-x: auto; - overflow-y: hidden; -} - -.navbar-burger { - cursor: pointer; - display: block; - height: 3.25rem; - position: relative; - width: 3.25rem; - margin-left: auto; -} - -.navbar-burger span { - background-color: currentColor; - display: block; - height: 1px; - left: 50%; - margin-left: -7px; - position: absolute; - top: 50%; - -webkit-transition: none 86ms ease-out; - transition: none 86ms ease-out; - -webkit-transition-property: background, left, opacity, -webkit-transform; - transition-property: background, left, opacity, -webkit-transform; - transition-property: background, left, opacity, transform; - transition-property: background, left, opacity, transform, -webkit-transform; - width: 15px; -} - -.navbar-burger span:nth-child(1) { - margin-top: -6px; -} - -.navbar-burger span:nth-child(2) { - margin-top: -1px; -} - -.navbar-burger span:nth-child(3) { - margin-top: 4px; -} - -.navbar-burger:hover { - background-color: rgba(0, 0, 0, 0.05); -} - -.navbar-burger.is-active span:nth-child(1) { - margin-left: -5px; - -webkit-transform: rotate(45deg); - transform: rotate(45deg); - -webkit-transform-origin: left top; - transform-origin: left top; -} - -.navbar-burger.is-active span:nth-child(2) { - opacity: 0; -} - -.navbar-burger.is-active span:nth-child(3) { - margin-left: -5px; - -webkit-transform: rotate(-45deg); - transform: rotate(-45deg); - -webkit-transform-origin: left bottom; - transform-origin: left bottom; -} - -.navbar-menu { - display: none; -} - -.navbar-item, -.navbar-link { - color: #4a4a4a; - display: block; - line-height: 1.5; - padding: 0.5rem 1rem; - position: relative; -} - -a.navbar-item:hover, a.navbar-item.is-active, -.navbar-link:hover, -.navbar-link.is-active { - background-color: whitesmoke; - color: #0a0a0a; -} - -.navbar-item { - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.navbar-item img { - max-height: 1.75rem; -} - -.navbar-item.has-dropdown { - padding: 0; -} - -.navbar-item.is-tab { - border-bottom: 1px solid transparent; - min-height: 3.25rem; - padding-bottom: calc(0.5rem - 1px); -} - -.navbar-item.is-tab:hover { - background-color: transparent; - border-bottom-color: #3273dc; -} - -.navbar-item.is-tab.is-active { - background-color: transparent; - border-bottom-color: #3273dc; - border-bottom-style: solid; - border-bottom-width: 3px; - color: #3273dc; - padding-bottom: calc(0.5rem - 3px); -} - -.navbar-content { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; -} - -.navbar-link { - padding-right: 2.5em; -} - -.navbar-dropdown { - font-size: 0.875rem; - padding-bottom: 0.5rem; - padding-top: 0.5rem; -} - -.navbar-dropdown .navbar-item { - padding-left: 1.5rem; - padding-right: 1.5rem; -} - -.navbar-divider { - background-color: #dbdbdb; - border: none; - display: none; - height: 1px; - margin: 0.5rem 0; -} - -@media screen and (max-width: 1023px) { - .navbar > .container { - display: block; - } - .navbar-brand .navbar-item, - .navbar-tabs .navbar-item { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .navbar-menu { - background-color: white; - -webkit-box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1); - box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1); - padding: 0.5rem 0; - } - .navbar-menu.is-active { - display: block; - } -} - -@media screen and (min-width: 1024px) { - .navbar, - .navbar-menu, - .navbar-start, - .navbar-end { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .navbar { - min-height: 3.25rem; - } - .navbar.is-transparent a.navbar-item:hover, .navbar.is-transparent a.navbar-item.is-active, - .navbar.is-transparent .navbar-link:hover, - .navbar.is-transparent .navbar-link.is-active { - background-color: transparent !important; - } - .navbar.is-transparent .navbar-item.has-dropdown.is-active .navbar-link, .navbar.is-transparent .navbar-item.has-dropdown.is-hoverable:hover .navbar-link { - background-color: transparent !important; - } - .navbar.is-transparent .navbar-dropdown a.navbar-item:hover { - background-color: whitesmoke; - color: #0a0a0a; - } - .navbar.is-transparent .navbar-dropdown a.navbar-item.is-active { - background-color: whitesmoke; - color: #3273dc; - } - .navbar-burger { - display: none; - } - .navbar-item, - .navbar-link { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .navbar-item.has-dropdown { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - } - .navbar-item.is-active .navbar-dropdown, .navbar-item.is-hoverable:hover .navbar-dropdown { - display: block; - } - .navbar-item.is-active .navbar-dropdown.is-boxed, .navbar-item.is-hoverable:hover .navbar-dropdown.is-boxed { - opacity: 1; - pointer-events: auto; - -webkit-transform: translateY(0); - transform: translateY(0); - } - .navbar-link::after { - border: 1px solid #3273dc; - border-right: 0; - border-top: 0; - content: " "; - display: block; - height: 0.5em; - pointer-events: none; - position: absolute; - -webkit-transform: rotate(-45deg); - transform: rotate(-45deg); - width: 0.5em; - margin-top: -0.375em; - right: 1.125em; - top: 50%; - } - .navbar-menu { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - } - .navbar-start { - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - margin-right: auto; - } - .navbar-end { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; - margin-left: auto; - } - .navbar-dropdown { - background-color: white; - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; - border-top: 1px solid #dbdbdb; - -webkit-box-shadow: 0 8px 8px rgba(10, 10, 10, 0.1); - box-shadow: 0 8px 8px rgba(10, 10, 10, 0.1); - display: none; - font-size: 0.875rem; - left: 0; - min-width: 100%; - position: absolute; - top: 100%; - z-index: 20; - } - .navbar-dropdown .navbar-item { - padding: 0.375rem 1rem; - white-space: nowrap; - } - .navbar-dropdown a.navbar-item { - padding-right: 3rem; - } - .navbar-dropdown a.navbar-item:hover { - background-color: whitesmoke; - color: #0a0a0a; - } - .navbar-dropdown a.navbar-item.is-active { - background-color: whitesmoke; - color: #3273dc; - } - .navbar-dropdown.is-boxed { - border-radius: 5px; - border-top: none; - -webkit-box-shadow: 0 8px 8px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - box-shadow: 0 8px 8px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); - display: block; - opacity: 0; - pointer-events: none; - top: calc(100% + (-4px)); - -webkit-transform: translateY(-5px); - transform: translateY(-5px); - -webkit-transition-duration: 86ms; - transition-duration: 86ms; - -webkit-transition-property: opacity, -webkit-transform; - transition-property: opacity, -webkit-transform; - transition-property: opacity, transform; - transition-property: opacity, transform, -webkit-transform; - } - .navbar-dropdown.is-right { - left: auto; - right: 0; - } - .navbar-divider { - display: block; - } - .container > .navbar .navbar-brand { - margin-left: -1rem; - } - .container > .navbar .navbar-menu { - margin-right: -1rem; - } - a.navbar-item.is-active, - .navbar-link.is-active { - color: #0a0a0a; - } - a.navbar-item.is-active:not(:hover), - .navbar-link.is-active:not(:hover) { - background-color: transparent; - } - .navbar-item.has-dropdown:hover .navbar-link, .navbar-item.has-dropdown.is-active .navbar-link { - background-color: whitesmoke; - } -} - -.pagination { - font-size: 1rem; - margin: -0.25rem; -} - -.pagination.is-small { - font-size: 0.75rem; -} - -.pagination.is-medium { - font-size: 1.25rem; -} - -.pagination.is-large { - font-size: 1.5rem; -} - -.pagination, -.pagination-list { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - text-align: center; -} - -.pagination-previous, -.pagination-next, -.pagination-link, -.pagination-ellipsis { - -moz-appearance: none; - -webkit-appearance: none; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: 1px solid transparent; - border-radius: 3px; - -webkit-box-shadow: none; - box-shadow: none; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - font-size: 1rem; - height: 2.25em; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - line-height: 1.5; - padding-bottom: calc(0.375em - 1px); - padding-left: calc(0.625em - 1px); - padding-right: calc(0.625em - 1px); - padding-top: calc(0.375em - 1px); - position: relative; - vertical-align: top; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - font-size: 1em; - padding-left: 0.5em; - padding-right: 0.5em; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - margin: 0.25rem; - text-align: center; -} - -.pagination-previous:focus, .pagination-previous.is-focused, .pagination-previous:active, .pagination-previous.is-active, -.pagination-next:focus, -.pagination-next.is-focused, -.pagination-next:active, -.pagination-next.is-active, -.pagination-link:focus, -.pagination-link.is-focused, -.pagination-link:active, -.pagination-link.is-active, -.pagination-ellipsis:focus, -.pagination-ellipsis.is-focused, -.pagination-ellipsis:active, -.pagination-ellipsis.is-active { - outline: none; -} - -.pagination-previous[disabled], -.pagination-next[disabled], -.pagination-link[disabled], -.pagination-ellipsis[disabled] { - cursor: not-allowed; -} - -.pagination-previous, -.pagination-next, -.pagination-link { - border-color: #dbdbdb; - min-width: 2.25em; -} - -.pagination-previous:hover, -.pagination-next:hover, -.pagination-link:hover { - border-color: #b5b5b5; - color: #363636; -} - -.pagination-previous:focus, -.pagination-next:focus, -.pagination-link:focus { - border-color: #3273dc; -} - -.pagination-previous:active, -.pagination-next:active, -.pagination-link:active { - -webkit-box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.2); - box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.2); -} - -.pagination-previous[disabled], -.pagination-next[disabled], -.pagination-link[disabled] { - background-color: #dbdbdb; - border-color: #dbdbdb; - -webkit-box-shadow: none; - box-shadow: none; - color: #7a7a7a; - opacity: 0.5; -} - -.pagination-previous, -.pagination-next { - padding-left: 0.75em; - padding-right: 0.75em; - white-space: nowrap; -} - -.pagination-link.is-current { - background-color: #3273dc; - border-color: #3273dc; - color: #fff; -} - -.pagination-ellipsis { - color: #b5b5b5; - pointer-events: none; -} - -.pagination-list { - -ms-flex-wrap: wrap; - flex-wrap: wrap; -} - -@media screen and (max-width: 768px) { - .pagination { - -ms-flex-wrap: wrap; - flex-wrap: wrap; - } - .pagination-previous, - .pagination-next { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - } - .pagination-list li { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - } -} - -@media screen and (min-width: 769px), print { - .pagination-list { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .pagination-previous { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .pagination-next { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } - .pagination { - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; - } - .pagination.is-centered .pagination-previous { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .pagination.is-centered .pagination-list { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .pagination.is-centered .pagination-next { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } - .pagination.is-right .pagination-previous { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .pagination.is-right .pagination-next { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .pagination.is-right .pagination-list { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } -} - -.panel { - font-size: 1rem; -} - -.panel:not(:last-child) { - margin-bottom: 1.5rem; -} - -.panel-heading, -.panel-tabs, -.panel-block { - border-bottom: 1px solid #dbdbdb; - border-left: 1px solid #dbdbdb; - border-right: 1px solid #dbdbdb; -} - -.panel-heading:first-child, -.panel-tabs:first-child, -.panel-block:first-child { - border-top: 1px solid #dbdbdb; -} - -.panel-heading { - background-color: whitesmoke; - border-radius: 3px 3px 0 0; - color: #363636; - font-size: 1.25em; - font-weight: 300; - line-height: 1.25; - padding: 0.5em 0.75em; -} - -.panel-tabs { - -webkit-box-align: end; - -ms-flex-align: end; - align-items: flex-end; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - font-size: 0.875em; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.panel-tabs a { - border-bottom: 1px solid #dbdbdb; - margin-bottom: -1px; - padding: 0.5em; -} - -.panel-tabs a.is-active { - border-bottom-color: #4a4a4a; - color: #363636; -} - -.panel-list a { - color: #4a4a4a; -} - -.panel-list a:hover { - color: #3273dc; -} - -.panel-block { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - color: #363636; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - padding: 0.5em 0.75em; -} - -.panel-block input[type="checkbox"] { - margin-right: 0.75em; -} - -.panel-block > .control { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - width: 100%; -} - -.panel-block.is-wrapped { - -ms-flex-wrap: wrap; - flex-wrap: wrap; -} - -.panel-block.is-active { - border-left-color: #3273dc; - color: #363636; -} - -.panel-block.is-active .panel-icon { - color: #3273dc; -} - -a.panel-block, -label.panel-block { - cursor: pointer; -} - -a.panel-block:hover, -label.panel-block:hover { - background-color: whitesmoke; -} - -.panel-icon { - display: inline-block; - font-size: 14px; - height: 1em; - line-height: 1em; - text-align: center; - vertical-align: top; - width: 1em; - color: #7a7a7a; - margin-right: 0.75em; -} - -.panel-icon .fa { - font-size: inherit; - line-height: inherit; -} - -.tabs { - -webkit-overflow-scrolling: touch; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - font-size: 1rem; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; - overflow: hidden; - overflow-x: auto; - white-space: nowrap; -} - -.tabs:not(:last-child) { - margin-bottom: 1.5rem; -} - -.tabs a { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border-bottom-color: #dbdbdb; - border-bottom-style: solid; - border-bottom-width: 1px; - color: #4a4a4a; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - margin-bottom: -1px; - padding: 0.5em 1em; - vertical-align: top; -} - -.tabs a:hover { - border-bottom-color: #363636; - color: #363636; -} - -.tabs li { - display: block; -} - -.tabs li.is-active a { - border-bottom-color: #3273dc; - color: #3273dc; -} - -.tabs ul { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border-bottom-color: #dbdbdb; - border-bottom-style: solid; - border-bottom-width: 1px; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.tabs ul.is-left { - padding-right: 0.75em; -} - -.tabs ul.is-center { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - padding-left: 0.75em; - padding-right: 0.75em; -} - -.tabs ul.is-right { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; - padding-left: 0.75em; -} - -.tabs .icon:first-child { - margin-right: 0.5em; -} - -.tabs .icon:last-child { - margin-left: 0.5em; -} - -.tabs.is-centered ul { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.tabs.is-right ul { - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; -} - -.tabs.is-boxed a { - border: 1px solid transparent; - border-radius: 3px 3px 0 0; -} - -.tabs.is-boxed a:hover { - background-color: whitesmoke; - border-bottom-color: #dbdbdb; -} - -.tabs.is-boxed li.is-active a { - background-color: white; - border-color: #dbdbdb; - border-bottom-color: transparent !important; -} - -.tabs.is-fullwidth li { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.tabs.is-toggle a { - border-color: #dbdbdb; - border-style: solid; - border-width: 1px; - margin-bottom: 0; - position: relative; -} - -.tabs.is-toggle a:hover { - background-color: whitesmoke; - border-color: #b5b5b5; - z-index: 2; -} - -.tabs.is-toggle li + li { - margin-left: -1px; -} - -.tabs.is-toggle li:first-child a { - border-radius: 3px 0 0 3px; -} - -.tabs.is-toggle li:last-child a { - border-radius: 0 3px 3px 0; -} - -.tabs.is-toggle li.is-active a { - background-color: #3273dc; - border-color: #3273dc; - color: #fff; - z-index: 1; -} - -.tabs.is-toggle ul { - border-bottom: none; -} - -.tabs.is-small { - font-size: 0.75rem; -} - -.tabs.is-medium { - font-size: 1.25rem; -} - -.tabs.is-large { - font-size: 1.5rem; -} - -.column { - display: block; - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - padding: 0.75rem; -} - -.columns.is-mobile > .column.is-narrow { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; -} - -.columns.is-mobile > .column.is-full { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; -} - -.columns.is-mobile > .column.is-three-quarters { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; -} - -.columns.is-mobile > .column.is-two-thirds { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; -} - -.columns.is-mobile > .column.is-half { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; -} - -.columns.is-mobile > .column.is-one-third { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; -} - -.columns.is-mobile > .column.is-one-quarter { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; -} - -.columns.is-mobile > .column.is-offset-three-quarters { - margin-left: 75%; -} - -.columns.is-mobile > .column.is-offset-two-thirds { - margin-left: 66.6666%; -} - -.columns.is-mobile > .column.is-offset-half { - margin-left: 50%; -} - -.columns.is-mobile > .column.is-offset-one-third { - margin-left: 33.3333%; -} - -.columns.is-mobile > .column.is-offset-one-quarter { - margin-left: 25%; -} - -.columns.is-mobile > .column.is-1 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; -} - -.columns.is-mobile > .column.is-offset-1 { - margin-left: 8.33333%; -} - -.columns.is-mobile > .column.is-2 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; -} - -.columns.is-mobile > .column.is-offset-2 { - margin-left: 16.66667%; -} - -.columns.is-mobile > .column.is-3 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; -} - -.columns.is-mobile > .column.is-offset-3 { - margin-left: 25%; -} - -.columns.is-mobile > .column.is-4 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; -} - -.columns.is-mobile > .column.is-offset-4 { - margin-left: 33.33333%; -} - -.columns.is-mobile > .column.is-5 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; -} - -.columns.is-mobile > .column.is-offset-5 { - margin-left: 41.66667%; -} - -.columns.is-mobile > .column.is-6 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; -} - -.columns.is-mobile > .column.is-offset-6 { - margin-left: 50%; -} - -.columns.is-mobile > .column.is-7 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; -} - -.columns.is-mobile > .column.is-offset-7 { - margin-left: 58.33333%; -} - -.columns.is-mobile > .column.is-8 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; -} - -.columns.is-mobile > .column.is-offset-8 { - margin-left: 66.66667%; -} - -.columns.is-mobile > .column.is-9 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; -} - -.columns.is-mobile > .column.is-offset-9 { - margin-left: 75%; -} - -.columns.is-mobile > .column.is-10 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; -} - -.columns.is-mobile > .column.is-offset-10 { - margin-left: 83.33333%; -} - -.columns.is-mobile > .column.is-11 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; -} - -.columns.is-mobile > .column.is-offset-11 { - margin-left: 91.66667%; -} - -.columns.is-mobile > .column.is-12 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; -} - -.columns.is-mobile > .column.is-offset-12 { - margin-left: 100%; -} - -@media screen and (max-width: 768px) { - .column.is-narrow-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - } - .column.is-full-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-three-quarters-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-two-thirds-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; - } - .column.is-half-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-one-third-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; - } - .column.is-one-quarter-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-three-quarters-mobile { - margin-left: 75%; - } - .column.is-offset-two-thirds-mobile { - margin-left: 66.6666%; - } - .column.is-offset-half-mobile { - margin-left: 50%; - } - .column.is-offset-one-third-mobile { - margin-left: 33.3333%; - } - .column.is-offset-one-quarter-mobile { - margin-left: 25%; - } - .column.is-1-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .column.is-offset-1-mobile { - margin-left: 8.33333%; - } - .column.is-2-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .column.is-offset-2-mobile { - margin-left: 16.66667%; - } - .column.is-3-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-3-mobile { - margin-left: 25%; - } - .column.is-4-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .column.is-offset-4-mobile { - margin-left: 33.33333%; - } - .column.is-5-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .column.is-offset-5-mobile { - margin-left: 41.66667%; - } - .column.is-6-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-offset-6-mobile { - margin-left: 50%; - } - .column.is-7-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .column.is-offset-7-mobile { - margin-left: 58.33333%; - } - .column.is-8-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .column.is-offset-8-mobile { - margin-left: 66.66667%; - } - .column.is-9-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-offset-9-mobile { - margin-left: 75%; - } - .column.is-10-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .column.is-offset-10-mobile { - margin-left: 83.33333%; - } - .column.is-11-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .column.is-offset-11-mobile { - margin-left: 91.66667%; - } - .column.is-12-mobile { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-offset-12-mobile { - margin-left: 100%; - } -} - -@media screen and (min-width: 769px), print { - .column.is-narrow, .column.is-narrow-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - } - .column.is-full, .column.is-full-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-three-quarters, .column.is-three-quarters-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-two-thirds, .column.is-two-thirds-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; - } - .column.is-half, .column.is-half-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-one-third, .column.is-one-third-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; - } - .column.is-one-quarter, .column.is-one-quarter-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-three-quarters, .column.is-offset-three-quarters-tablet { - margin-left: 75%; - } - .column.is-offset-two-thirds, .column.is-offset-two-thirds-tablet { - margin-left: 66.6666%; - } - .column.is-offset-half, .column.is-offset-half-tablet { - margin-left: 50%; - } - .column.is-offset-one-third, .column.is-offset-one-third-tablet { - margin-left: 33.3333%; - } - .column.is-offset-one-quarter, .column.is-offset-one-quarter-tablet { - margin-left: 25%; - } - .column.is-1, .column.is-1-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .column.is-offset-1, .column.is-offset-1-tablet { - margin-left: 8.33333%; - } - .column.is-2, .column.is-2-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .column.is-offset-2, .column.is-offset-2-tablet { - margin-left: 16.66667%; - } - .column.is-3, .column.is-3-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-3, .column.is-offset-3-tablet { - margin-left: 25%; - } - .column.is-4, .column.is-4-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .column.is-offset-4, .column.is-offset-4-tablet { - margin-left: 33.33333%; - } - .column.is-5, .column.is-5-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .column.is-offset-5, .column.is-offset-5-tablet { - margin-left: 41.66667%; - } - .column.is-6, .column.is-6-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-offset-6, .column.is-offset-6-tablet { - margin-left: 50%; - } - .column.is-7, .column.is-7-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .column.is-offset-7, .column.is-offset-7-tablet { - margin-left: 58.33333%; - } - .column.is-8, .column.is-8-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .column.is-offset-8, .column.is-offset-8-tablet { - margin-left: 66.66667%; - } - .column.is-9, .column.is-9-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-offset-9, .column.is-offset-9-tablet { - margin-left: 75%; - } - .column.is-10, .column.is-10-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .column.is-offset-10, .column.is-offset-10-tablet { - margin-left: 83.33333%; - } - .column.is-11, .column.is-11-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .column.is-offset-11, .column.is-offset-11-tablet { - margin-left: 91.66667%; - } - .column.is-12, .column.is-12-tablet { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-offset-12, .column.is-offset-12-tablet { - margin-left: 100%; - } -} - -@media screen and (max-width: 1023px) { - .column.is-narrow-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - } - .column.is-full-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-three-quarters-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-two-thirds-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; - } - .column.is-half-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-one-third-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; - } - .column.is-one-quarter-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-three-quarters-touch { - margin-left: 75%; - } - .column.is-offset-two-thirds-touch { - margin-left: 66.6666%; - } - .column.is-offset-half-touch { - margin-left: 50%; - } - .column.is-offset-one-third-touch { - margin-left: 33.3333%; - } - .column.is-offset-one-quarter-touch { - margin-left: 25%; - } - .column.is-1-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .column.is-offset-1-touch { - margin-left: 8.33333%; - } - .column.is-2-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .column.is-offset-2-touch { - margin-left: 16.66667%; - } - .column.is-3-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-3-touch { - margin-left: 25%; - } - .column.is-4-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .column.is-offset-4-touch { - margin-left: 33.33333%; - } - .column.is-5-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .column.is-offset-5-touch { - margin-left: 41.66667%; - } - .column.is-6-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-offset-6-touch { - margin-left: 50%; - } - .column.is-7-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .column.is-offset-7-touch { - margin-left: 58.33333%; - } - .column.is-8-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .column.is-offset-8-touch { - margin-left: 66.66667%; - } - .column.is-9-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-offset-9-touch { - margin-left: 75%; - } - .column.is-10-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .column.is-offset-10-touch { - margin-left: 83.33333%; - } - .column.is-11-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .column.is-offset-11-touch { - margin-left: 91.66667%; - } - .column.is-12-touch { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-offset-12-touch { - margin-left: 100%; - } -} - -@media screen and (min-width: 1024px) { - .column.is-narrow-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - } - .column.is-full-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-three-quarters-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-two-thirds-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; - } - .column.is-half-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-one-third-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; - } - .column.is-one-quarter-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-three-quarters-desktop { - margin-left: 75%; - } - .column.is-offset-two-thirds-desktop { - margin-left: 66.6666%; - } - .column.is-offset-half-desktop { - margin-left: 50%; - } - .column.is-offset-one-third-desktop { - margin-left: 33.3333%; - } - .column.is-offset-one-quarter-desktop { - margin-left: 25%; - } - .column.is-1-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .column.is-offset-1-desktop { - margin-left: 8.33333%; - } - .column.is-2-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .column.is-offset-2-desktop { - margin-left: 16.66667%; - } - .column.is-3-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-3-desktop { - margin-left: 25%; - } - .column.is-4-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .column.is-offset-4-desktop { - margin-left: 33.33333%; - } - .column.is-5-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .column.is-offset-5-desktop { - margin-left: 41.66667%; - } - .column.is-6-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-offset-6-desktop { - margin-left: 50%; - } - .column.is-7-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .column.is-offset-7-desktop { - margin-left: 58.33333%; - } - .column.is-8-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .column.is-offset-8-desktop { - margin-left: 66.66667%; - } - .column.is-9-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-offset-9-desktop { - margin-left: 75%; - } - .column.is-10-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .column.is-offset-10-desktop { - margin-left: 83.33333%; - } - .column.is-11-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .column.is-offset-11-desktop { - margin-left: 91.66667%; - } - .column.is-12-desktop { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-offset-12-desktop { - margin-left: 100%; - } -} - -@media screen and (min-width: 1216px) { - .column.is-narrow-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - } - .column.is-full-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-three-quarters-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-two-thirds-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; - } - .column.is-half-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-one-third-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; - } - .column.is-one-quarter-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-three-quarters-widescreen { - margin-left: 75%; - } - .column.is-offset-two-thirds-widescreen { - margin-left: 66.6666%; - } - .column.is-offset-half-widescreen { - margin-left: 50%; - } - .column.is-offset-one-third-widescreen { - margin-left: 33.3333%; - } - .column.is-offset-one-quarter-widescreen { - margin-left: 25%; - } - .column.is-1-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .column.is-offset-1-widescreen { - margin-left: 8.33333%; - } - .column.is-2-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .column.is-offset-2-widescreen { - margin-left: 16.66667%; - } - .column.is-3-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-3-widescreen { - margin-left: 25%; - } - .column.is-4-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .column.is-offset-4-widescreen { - margin-left: 33.33333%; - } - .column.is-5-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .column.is-offset-5-widescreen { - margin-left: 41.66667%; - } - .column.is-6-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-offset-6-widescreen { - margin-left: 50%; - } - .column.is-7-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .column.is-offset-7-widescreen { - margin-left: 58.33333%; - } - .column.is-8-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .column.is-offset-8-widescreen { - margin-left: 66.66667%; - } - .column.is-9-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-offset-9-widescreen { - margin-left: 75%; - } - .column.is-10-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .column.is-offset-10-widescreen { - margin-left: 83.33333%; - } - .column.is-11-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .column.is-offset-11-widescreen { - margin-left: 91.66667%; - } - .column.is-12-widescreen { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-offset-12-widescreen { - margin-left: 100%; - } -} - -@media screen and (min-width: 1408px) { - .column.is-narrow-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - } - .column.is-full-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-three-quarters-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-two-thirds-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.6666%; - } - .column.is-half-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-one-third-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.3333%; - } - .column.is-one-quarter-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-three-quarters-fullhd { - margin-left: 75%; - } - .column.is-offset-two-thirds-fullhd { - margin-left: 66.6666%; - } - .column.is-offset-half-fullhd { - margin-left: 50%; - } - .column.is-offset-one-third-fullhd { - margin-left: 33.3333%; - } - .column.is-offset-one-quarter-fullhd { - margin-left: 25%; - } - .column.is-1-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .column.is-offset-1-fullhd { - margin-left: 8.33333%; - } - .column.is-2-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .column.is-offset-2-fullhd { - margin-left: 16.66667%; - } - .column.is-3-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .column.is-offset-3-fullhd { - margin-left: 25%; - } - .column.is-4-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .column.is-offset-4-fullhd { - margin-left: 33.33333%; - } - .column.is-5-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .column.is-offset-5-fullhd { - margin-left: 41.66667%; - } - .column.is-6-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .column.is-offset-6-fullhd { - margin-left: 50%; - } - .column.is-7-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .column.is-offset-7-fullhd { - margin-left: 58.33333%; - } - .column.is-8-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .column.is-offset-8-fullhd { - margin-left: 66.66667%; - } - .column.is-9-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .column.is-offset-9-fullhd { - margin-left: 75%; - } - .column.is-10-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .column.is-offset-10-fullhd { - margin-left: 83.33333%; - } - .column.is-11-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .column.is-offset-11-fullhd { - margin-left: 91.66667%; - } - .column.is-12-fullhd { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } - .column.is-offset-12-fullhd { - margin-left: 100%; - } -} - -.columns { - margin-left: -0.75rem; - margin-right: -0.75rem; - margin-top: -0.75rem; -} - -.columns:last-child { - margin-bottom: -0.75rem; -} - -.columns:not(:last-child) { - margin-bottom: calc(1.5rem - 0.75rem); -} - -.columns.is-centered { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.columns.is-gapless { - margin-left: 0; - margin-right: 0; - margin-top: 0; -} - -.columns.is-gapless > .column { - margin: 0; - padding: 0 !important; -} - -.columns.is-gapless:not(:last-child) { - margin-bottom: 1.5rem; -} - -.columns.is-gapless:last-child { - margin-bottom: 0; -} - -.columns.is-mobile { - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.columns.is-multiline { - -ms-flex-wrap: wrap; - flex-wrap: wrap; -} - -.columns.is-vcentered { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -@media screen and (min-width: 769px), print { - .columns:not(.is-desktop) { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } -} - -@media screen and (min-width: 1024px) { - .columns.is-desktop { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } -} - -.columns.is-variable { - --columnGap: 0.75rem; - margin-left: calc(-1 * var(--columnGap)); - margin-right: calc(-1 * var(--columnGap)); -} - -.columns.is-variable .column { - padding-left: var(--columnGap); - padding-right: var(--columnGap); -} - -.columns.is-variable.is-0 { - --columnGap: 0rem; -} - -.columns.is-variable.is-1 { - --columnGap: 0.25rem; -} - -.columns.is-variable.is-2 { - --columnGap: 0.5rem; -} - -.columns.is-variable.is-3 { - --columnGap: 0.75rem; -} - -.columns.is-variable.is-4 { - --columnGap: 1rem; -} - -.columns.is-variable.is-5 { - --columnGap: 1.25rem; -} - -.columns.is-variable.is-6 { - --columnGap: 1.5rem; -} - -.columns.is-variable.is-7 { - --columnGap: 1.75rem; -} - -.columns.is-variable.is-8 { - --columnGap: 2rem; -} - -.tile { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: block; - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; - min-height: -webkit-min-content; - min-height: -moz-min-content; - min-height: min-content; -} - -.tile.is-ancestor { - margin-left: -0.75rem; - margin-right: -0.75rem; - margin-top: -0.75rem; -} - -.tile.is-ancestor:last-child { - margin-bottom: -0.75rem; -} - -.tile.is-ancestor:not(:last-child) { - margin-bottom: 0.75rem; -} - -.tile.is-child { - margin: 0 !important; -} - -.tile.is-parent { - padding: 0.75rem; -} - -.tile.is-vertical { - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; -} - -.tile.is-vertical > .tile.is-child:not(:last-child) { - margin-bottom: 1.5rem !important; -} - -@media screen and (min-width: 769px), print { - .tile:not(.is-child) { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .tile.is-1 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 8.33333%; - } - .tile.is-2 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 16.66667%; - } - .tile.is-3 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 25%; - } - .tile.is-4 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 33.33333%; - } - .tile.is-5 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 41.66667%; - } - .tile.is-6 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 50%; - } - .tile.is-7 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 58.33333%; - } - .tile.is-8 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 66.66667%; - } - .tile.is-9 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 75%; - } - .tile.is-10 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 83.33333%; - } - .tile.is-11 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 91.66667%; - } - .tile.is-12 { - -webkit-box-flex: 0; - -ms-flex: none; - flex: none; - width: 100%; - } -} - -.hero { - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; -} - -.hero .navbar { - background: none; -} - -.hero .tabs ul { - border-bottom: none; -} - -.hero.is-white { - background-color: white; - color: #0a0a0a; -} - -.hero.is-white a:not(.button), -.hero.is-white strong { - color: inherit; -} - -.hero.is-white .title { - color: #0a0a0a; -} - -.hero.is-white .subtitle { - color: rgba(10, 10, 10, 0.9); -} - -.hero.is-white .subtitle a:not(.button), -.hero.is-white .subtitle strong { - color: #0a0a0a; -} - -@media screen and (max-width: 1023px) { - .hero.is-white .navbar-menu { - background-color: white; - } -} - -.hero.is-white .navbar-item, -.hero.is-white .navbar-link { - color: rgba(10, 10, 10, 0.7); -} - -.hero.is-white a.navbar-item:hover, .hero.is-white a.navbar-item.is-active, -.hero.is-white .navbar-link:hover, -.hero.is-white .navbar-link.is-active { - background-color: #f2f2f2; - color: #0a0a0a; -} - -.hero.is-white .tabs a { - color: #0a0a0a; - opacity: 0.9; -} - -.hero.is-white .tabs a:hover { - opacity: 1; -} - -.hero.is-white .tabs li.is-active a { - opacity: 1; -} - -.hero.is-white .tabs.is-boxed a, .hero.is-white .tabs.is-toggle a { - color: #0a0a0a; -} - -.hero.is-white .tabs.is-boxed a:hover, .hero.is-white .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-white .tabs.is-boxed li.is-active a, .hero.is-white .tabs.is-boxed li.is-active a:hover, .hero.is-white .tabs.is-toggle li.is-active a, .hero.is-white .tabs.is-toggle li.is-active a:hover { - background-color: #0a0a0a; - border-color: #0a0a0a; - color: white; -} - -.hero.is-white.is-bold { - background-image: linear-gradient(141deg, #e6e6e6 0%, white 71%, white 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-white.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #e6e6e6 0%, white 71%, white 100%); - } -} - -.hero.is-black { - background-color: #0a0a0a; - color: white; -} - -.hero.is-black a:not(.button), -.hero.is-black strong { - color: inherit; -} - -.hero.is-black .title { - color: white; -} - -.hero.is-black .subtitle { - color: rgba(255, 255, 255, 0.9); -} - -.hero.is-black .subtitle a:not(.button), -.hero.is-black .subtitle strong { - color: white; -} - -@media screen and (max-width: 1023px) { - .hero.is-black .navbar-menu { - background-color: #0a0a0a; - } -} - -.hero.is-black .navbar-item, -.hero.is-black .navbar-link { - color: rgba(255, 255, 255, 0.7); -} - -.hero.is-black a.navbar-item:hover, .hero.is-black a.navbar-item.is-active, -.hero.is-black .navbar-link:hover, -.hero.is-black .navbar-link.is-active { - background-color: black; - color: white; -} - -.hero.is-black .tabs a { - color: white; - opacity: 0.9; -} - -.hero.is-black .tabs a:hover { - opacity: 1; -} - -.hero.is-black .tabs li.is-active a { - opacity: 1; -} - -.hero.is-black .tabs.is-boxed a, .hero.is-black .tabs.is-toggle a { - color: white; -} - -.hero.is-black .tabs.is-boxed a:hover, .hero.is-black .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-black .tabs.is-boxed li.is-active a, .hero.is-black .tabs.is-boxed li.is-active a:hover, .hero.is-black .tabs.is-toggle li.is-active a, .hero.is-black .tabs.is-toggle li.is-active a:hover { - background-color: white; - border-color: white; - color: #0a0a0a; -} - -.hero.is-black.is-bold { - background-image: linear-gradient(141deg, black 0%, #0a0a0a 71%, #181616 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-black.is-bold .navbar-menu { - background-image: linear-gradient(141deg, black 0%, #0a0a0a 71%, #181616 100%); - } -} - -.hero.is-light { - background-color: whitesmoke; - color: #363636; -} - -.hero.is-light a:not(.button), -.hero.is-light strong { - color: inherit; -} - -.hero.is-light .title { - color: #363636; -} - -.hero.is-light .subtitle { - color: rgba(54, 54, 54, 0.9); -} - -.hero.is-light .subtitle a:not(.button), -.hero.is-light .subtitle strong { - color: #363636; -} - -@media screen and (max-width: 1023px) { - .hero.is-light .navbar-menu { - background-color: whitesmoke; - } -} - -.hero.is-light .navbar-item, -.hero.is-light .navbar-link { - color: rgba(54, 54, 54, 0.7); -} - -.hero.is-light a.navbar-item:hover, .hero.is-light a.navbar-item.is-active, -.hero.is-light .navbar-link:hover, -.hero.is-light .navbar-link.is-active { - background-color: #e8e8e8; - color: #363636; -} - -.hero.is-light .tabs a { - color: #363636; - opacity: 0.9; -} - -.hero.is-light .tabs a:hover { - opacity: 1; -} - -.hero.is-light .tabs li.is-active a { - opacity: 1; -} - -.hero.is-light .tabs.is-boxed a, .hero.is-light .tabs.is-toggle a { - color: #363636; -} - -.hero.is-light .tabs.is-boxed a:hover, .hero.is-light .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-light .tabs.is-boxed li.is-active a, .hero.is-light .tabs.is-boxed li.is-active a:hover, .hero.is-light .tabs.is-toggle li.is-active a, .hero.is-light .tabs.is-toggle li.is-active a:hover { - background-color: #363636; - border-color: #363636; - color: whitesmoke; -} - -.hero.is-light.is-bold { - background-image: linear-gradient(141deg, #dfd8d9 0%, whitesmoke 71%, white 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-light.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #dfd8d9 0%, whitesmoke 71%, white 100%); - } -} - -.hero.is-dark { - background-color: #363636; - color: whitesmoke; -} - -.hero.is-dark a:not(.button), -.hero.is-dark strong { - color: inherit; -} - -.hero.is-dark .title { - color: whitesmoke; -} - -.hero.is-dark .subtitle { - color: rgba(245, 245, 245, 0.9); -} - -.hero.is-dark .subtitle a:not(.button), -.hero.is-dark .subtitle strong { - color: whitesmoke; -} - -@media screen and (max-width: 1023px) { - .hero.is-dark .navbar-menu { - background-color: #363636; - } -} - -.hero.is-dark .navbar-item, -.hero.is-dark .navbar-link { - color: rgba(245, 245, 245, 0.7); -} - -.hero.is-dark a.navbar-item:hover, .hero.is-dark a.navbar-item.is-active, -.hero.is-dark .navbar-link:hover, -.hero.is-dark .navbar-link.is-active { - background-color: #292929; - color: whitesmoke; -} - -.hero.is-dark .tabs a { - color: whitesmoke; - opacity: 0.9; -} - -.hero.is-dark .tabs a:hover { - opacity: 1; -} - -.hero.is-dark .tabs li.is-active a { - opacity: 1; -} - -.hero.is-dark .tabs.is-boxed a, .hero.is-dark .tabs.is-toggle a { - color: whitesmoke; -} - -.hero.is-dark .tabs.is-boxed a:hover, .hero.is-dark .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-dark .tabs.is-boxed li.is-active a, .hero.is-dark .tabs.is-boxed li.is-active a:hover, .hero.is-dark .tabs.is-toggle li.is-active a, .hero.is-dark .tabs.is-toggle li.is-active a:hover { - background-color: whitesmoke; - border-color: whitesmoke; - color: #363636; -} - -.hero.is-dark.is-bold { - background-image: linear-gradient(141deg, #1f191a 0%, #363636 71%, #46403f 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-dark.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #1f191a 0%, #363636 71%, #46403f 100%); - } -} - -.hero.is-primary { - background-color: #00d1b2; - color: #fff; -} - -.hero.is-primary a:not(.button), -.hero.is-primary strong { - color: inherit; -} - -.hero.is-primary .title { - color: #fff; -} - -.hero.is-primary .subtitle { - color: rgba(255, 255, 255, 0.9); -} - -.hero.is-primary .subtitle a:not(.button), -.hero.is-primary .subtitle strong { - color: #fff; -} - -@media screen and (max-width: 1023px) { - .hero.is-primary .navbar-menu { - background-color: #00d1b2; - } -} - -.hero.is-primary .navbar-item, -.hero.is-primary .navbar-link { - color: rgba(255, 255, 255, 0.7); -} - -.hero.is-primary a.navbar-item:hover, .hero.is-primary a.navbar-item.is-active, -.hero.is-primary .navbar-link:hover, -.hero.is-primary .navbar-link.is-active { - background-color: #00b89c; - color: #fff; -} - -.hero.is-primary .tabs a { - color: #fff; - opacity: 0.9; -} - -.hero.is-primary .tabs a:hover { - opacity: 1; -} - -.hero.is-primary .tabs li.is-active a { - opacity: 1; -} - -.hero.is-primary .tabs.is-boxed a, .hero.is-primary .tabs.is-toggle a { - color: #fff; -} - -.hero.is-primary .tabs.is-boxed a:hover, .hero.is-primary .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-primary .tabs.is-boxed li.is-active a, .hero.is-primary .tabs.is-boxed li.is-active a:hover, .hero.is-primary .tabs.is-toggle li.is-active a, .hero.is-primary .tabs.is-toggle li.is-active a:hover { - background-color: #fff; - border-color: #fff; - color: #00d1b2; -} - -.hero.is-primary.is-bold { - background-image: linear-gradient(141deg, #009e6c 0%, #00d1b2 71%, #00e7eb 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-primary.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #009e6c 0%, #00d1b2 71%, #00e7eb 100%); - } -} - -.hero.is-link { - background-color: #3273dc; - color: #fff; -} - -.hero.is-link a:not(.button), -.hero.is-link strong { - color: inherit; -} - -.hero.is-link .title { - color: #fff; -} - -.hero.is-link .subtitle { - color: rgba(255, 255, 255, 0.9); -} - -.hero.is-link .subtitle a:not(.button), -.hero.is-link .subtitle strong { - color: #fff; -} - -@media screen and (max-width: 1023px) { - .hero.is-link .navbar-menu { - background-color: #3273dc; - } -} - -.hero.is-link .navbar-item, -.hero.is-link .navbar-link { - color: rgba(255, 255, 255, 0.7); -} - -.hero.is-link a.navbar-item:hover, .hero.is-link a.navbar-item.is-active, -.hero.is-link .navbar-link:hover, -.hero.is-link .navbar-link.is-active { - background-color: #2366d1; - color: #fff; -} - -.hero.is-link .tabs a { - color: #fff; - opacity: 0.9; -} - -.hero.is-link .tabs a:hover { - opacity: 1; -} - -.hero.is-link .tabs li.is-active a { - opacity: 1; -} - -.hero.is-link .tabs.is-boxed a, .hero.is-link .tabs.is-toggle a { - color: #fff; -} - -.hero.is-link .tabs.is-boxed a:hover, .hero.is-link .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-link .tabs.is-boxed li.is-active a, .hero.is-link .tabs.is-boxed li.is-active a:hover, .hero.is-link .tabs.is-toggle li.is-active a, .hero.is-link .tabs.is-toggle li.is-active a:hover { - background-color: #fff; - border-color: #fff; - color: #3273dc; -} - -.hero.is-link.is-bold { - background-image: linear-gradient(141deg, #1577c6 0%, #3273dc 71%, #4366e5 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-link.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #1577c6 0%, #3273dc 71%, #4366e5 100%); - } -} - -.hero.is-info { - background-color: #209cee; - color: #fff; -} - -.hero.is-info a:not(.button), -.hero.is-info strong { - color: inherit; -} - -.hero.is-info .title { - color: #fff; -} - -.hero.is-info .subtitle { - color: rgba(255, 255, 255, 0.9); -} - -.hero.is-info .subtitle a:not(.button), -.hero.is-info .subtitle strong { - color: #fff; -} - -@media screen and (max-width: 1023px) { - .hero.is-info .navbar-menu { - background-color: #209cee; - } -} - -.hero.is-info .navbar-item, -.hero.is-info .navbar-link { - color: rgba(255, 255, 255, 0.7); -} - -.hero.is-info a.navbar-item:hover, .hero.is-info a.navbar-item.is-active, -.hero.is-info .navbar-link:hover, -.hero.is-info .navbar-link.is-active { - background-color: #118fe4; - color: #fff; -} - -.hero.is-info .tabs a { - color: #fff; - opacity: 0.9; -} - -.hero.is-info .tabs a:hover { - opacity: 1; -} - -.hero.is-info .tabs li.is-active a { - opacity: 1; -} - -.hero.is-info .tabs.is-boxed a, .hero.is-info .tabs.is-toggle a { - color: #fff; -} - -.hero.is-info .tabs.is-boxed a:hover, .hero.is-info .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-info .tabs.is-boxed li.is-active a, .hero.is-info .tabs.is-boxed li.is-active a:hover, .hero.is-info .tabs.is-toggle li.is-active a, .hero.is-info .tabs.is-toggle li.is-active a:hover { - background-color: #fff; - border-color: #fff; - color: #209cee; -} - -.hero.is-info.is-bold { - background-image: linear-gradient(141deg, #04a6d7 0%, #209cee 71%, #3287f5 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-info.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #04a6d7 0%, #209cee 71%, #3287f5 100%); - } -} - -.hero.is-success { - background-color: #23d160; - color: #fff; -} - -.hero.is-success a:not(.button), -.hero.is-success strong { - color: inherit; -} - -.hero.is-success .title { - color: #fff; -} - -.hero.is-success .subtitle { - color: rgba(255, 255, 255, 0.9); -} - -.hero.is-success .subtitle a:not(.button), -.hero.is-success .subtitle strong { - color: #fff; -} - -@media screen and (max-width: 1023px) { - .hero.is-success .navbar-menu { - background-color: #23d160; - } -} - -.hero.is-success .navbar-item, -.hero.is-success .navbar-link { - color: rgba(255, 255, 255, 0.7); -} - -.hero.is-success a.navbar-item:hover, .hero.is-success a.navbar-item.is-active, -.hero.is-success .navbar-link:hover, -.hero.is-success .navbar-link.is-active { - background-color: #20bc56; - color: #fff; -} - -.hero.is-success .tabs a { - color: #fff; - opacity: 0.9; -} - -.hero.is-success .tabs a:hover { - opacity: 1; -} - -.hero.is-success .tabs li.is-active a { - opacity: 1; -} - -.hero.is-success .tabs.is-boxed a, .hero.is-success .tabs.is-toggle a { - color: #fff; -} - -.hero.is-success .tabs.is-boxed a:hover, .hero.is-success .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-success .tabs.is-boxed li.is-active a, .hero.is-success .tabs.is-boxed li.is-active a:hover, .hero.is-success .tabs.is-toggle li.is-active a, .hero.is-success .tabs.is-toggle li.is-active a:hover { - background-color: #fff; - border-color: #fff; - color: #23d160; -} - -.hero.is-success.is-bold { - background-image: linear-gradient(141deg, #12af2f 0%, #23d160 71%, #2ce28a 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-success.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #12af2f 0%, #23d160 71%, #2ce28a 100%); - } -} - -.hero.is-warning { - background-color: #ffdd57; - color: rgba(0, 0, 0, 0.7); -} - -.hero.is-warning a:not(.button), -.hero.is-warning strong { - color: inherit; -} - -.hero.is-warning .title { - color: rgba(0, 0, 0, 0.7); -} - -.hero.is-warning .subtitle { - color: rgba(0, 0, 0, 0.9); -} - -.hero.is-warning .subtitle a:not(.button), -.hero.is-warning .subtitle strong { - color: rgba(0, 0, 0, 0.7); -} - -@media screen and (max-width: 1023px) { - .hero.is-warning .navbar-menu { - background-color: #ffdd57; - } -} - -.hero.is-warning .navbar-item, -.hero.is-warning .navbar-link { - color: rgba(0, 0, 0, 0.7); -} - -.hero.is-warning a.navbar-item:hover, .hero.is-warning a.navbar-item.is-active, -.hero.is-warning .navbar-link:hover, -.hero.is-warning .navbar-link.is-active { - background-color: #ffd83d; - color: rgba(0, 0, 0, 0.7); -} - -.hero.is-warning .tabs a { - color: rgba(0, 0, 0, 0.7); - opacity: 0.9; -} - -.hero.is-warning .tabs a:hover { - opacity: 1; -} - -.hero.is-warning .tabs li.is-active a { - opacity: 1; -} - -.hero.is-warning .tabs.is-boxed a, .hero.is-warning .tabs.is-toggle a { - color: rgba(0, 0, 0, 0.7); -} - -.hero.is-warning .tabs.is-boxed a:hover, .hero.is-warning .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-warning .tabs.is-boxed li.is-active a, .hero.is-warning .tabs.is-boxed li.is-active a:hover, .hero.is-warning .tabs.is-toggle li.is-active a, .hero.is-warning .tabs.is-toggle li.is-active a:hover { - background-color: rgba(0, 0, 0, 0.7); - border-color: rgba(0, 0, 0, 0.7); - color: #ffdd57; -} - -.hero.is-warning.is-bold { - background-image: linear-gradient(141deg, #ffaf24 0%, #ffdd57 71%, #fffa70 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-warning.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #ffaf24 0%, #ffdd57 71%, #fffa70 100%); - } -} - -.hero.is-danger { - background-color: #ff3860; - color: #fff; -} - -.hero.is-danger a:not(.button), -.hero.is-danger strong { - color: inherit; -} - -.hero.is-danger .title { - color: #fff; -} - -.hero.is-danger .subtitle { - color: rgba(255, 255, 255, 0.9); -} - -.hero.is-danger .subtitle a:not(.button), -.hero.is-danger .subtitle strong { - color: #fff; -} - -@media screen and (max-width: 1023px) { - .hero.is-danger .navbar-menu { - background-color: #ff3860; - } -} - -.hero.is-danger .navbar-item, -.hero.is-danger .navbar-link { - color: rgba(255, 255, 255, 0.7); -} - -.hero.is-danger a.navbar-item:hover, .hero.is-danger a.navbar-item.is-active, -.hero.is-danger .navbar-link:hover, -.hero.is-danger .navbar-link.is-active { - background-color: #ff1f4b; - color: #fff; -} - -.hero.is-danger .tabs a { - color: #fff; - opacity: 0.9; -} - -.hero.is-danger .tabs a:hover { - opacity: 1; -} - -.hero.is-danger .tabs li.is-active a { - opacity: 1; -} - -.hero.is-danger .tabs.is-boxed a, .hero.is-danger .tabs.is-toggle a { - color: #fff; -} - -.hero.is-danger .tabs.is-boxed a:hover, .hero.is-danger .tabs.is-toggle a:hover { - background-color: rgba(10, 10, 10, 0.1); -} - -.hero.is-danger .tabs.is-boxed li.is-active a, .hero.is-danger .tabs.is-boxed li.is-active a:hover, .hero.is-danger .tabs.is-toggle li.is-active a, .hero.is-danger .tabs.is-toggle li.is-active a:hover { - background-color: #fff; - border-color: #fff; - color: #ff3860; -} - -.hero.is-danger.is-bold { - background-image: linear-gradient(141deg, #ff0561 0%, #ff3860 71%, #ff5257 100%); -} - -@media screen and (max-width: 768px) { - .hero.is-danger.is-bold .navbar-menu { - background-image: linear-gradient(141deg, #ff0561 0%, #ff3860 71%, #ff5257 100%); - } -} - -.hero.is-small .hero-body { - padding-bottom: 1.5rem; - padding-top: 1.5rem; -} - -@media screen and (min-width: 769px), print { - .hero.is-medium .hero-body { - padding-bottom: 9rem; - padding-top: 9rem; - } -} - -@media screen and (min-width: 769px), print { - .hero.is-large .hero-body { - padding-bottom: 18rem; - padding-top: 18rem; - } -} - -.hero.is-halfheight .hero-body, .hero.is-fullheight .hero-body { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.hero.is-halfheight .hero-body > .container, .hero.is-fullheight .hero-body > .container { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 1; - flex-shrink: 1; -} - -.hero.is-halfheight { - min-height: 50vh; -} - -.hero.is-fullheight { - min-height: 100vh; -} - -.hero-video { - bottom: 0; - left: 0; - position: absolute; - right: 0; - top: 0; - overflow: hidden; -} - -.hero-video video { - left: 50%; - min-height: 100%; - min-width: 100%; - position: absolute; - top: 50%; - -webkit-transform: translate3d(-50%, -50%, 0); - transform: translate3d(-50%, -50%, 0); -} - -.hero-video.is-transparent { - opacity: 0.3; -} - -@media screen and (max-width: 768px) { - .hero-video { - display: none; - } -} - -.hero-buttons { - margin-top: 1.5rem; -} - -@media screen and (max-width: 768px) { - .hero-buttons .button { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .hero-buttons .button:not(:last-child) { - margin-bottom: 0.75rem; - } -} - -@media screen and (min-width: 769px), print { - .hero-buttons { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - } - .hero-buttons .button:not(:last-child) { - margin-right: 1.5rem; - } -} - -.hero-head, -.hero-foot { - -webkit-box-flex: 0; - -ms-flex-positive: 0; - flex-grow: 0; - -ms-flex-negative: 0; - flex-shrink: 0; -} - -.hero-body { - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -ms-flex-negative: 0; - flex-shrink: 0; - padding: 3rem 1.5rem; -} - -.section { - padding: 3rem 1.5rem; -} - -@media screen and (min-width: 1024px) { - .section.is-medium { - padding: 9rem 1.5rem; - } - .section.is-large { - padding: 18rem 1.5rem; - } -} - -.footer { - background-color: whitesmoke; - padding: 3rem 1.5rem 6rem; -} -/*# sourceMappingURL=bulma.css.map */ \ No newline at end of file diff --git a/examples/counter/dist/index.html b/examples/counter/dist/index.html deleted file mode 100644 index 93174cf..0000000 --- a/examples/counter/dist/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - TreborJS • Counter - - - - -
    - - - diff --git a/examples/counter/dist/js/counter.js b/examples/counter/dist/js/counter.js deleted file mode 100644 index da6922c..0000000 --- a/examples/counter/dist/js/counter.js +++ /dev/null @@ -1,101 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./main.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./main.ts": -/*!*****************************!*\ - !*** ./main.ts + 2 modules ***! - \*****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("\n// CONCATENATED MODULE: h:/trebor-repos/trebor-tools/index.js\nvar PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers'];\r\nvar PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' };\r\nvar TPS = window[PROP_MAP.p] || (window[PROP_MAP.p] = []);\n\nvar array = Array[PROP_MAP.h];\r\nfunction _$toArgs(args, start) {\r\n if (start === void 0) { start = 0; }\r\n return array.slice.call(args, start);\r\n}\r\nfunction _$arrayValues(list, value, root, key) {\r\n array.push.apply(list, value.map(function (v, i) {\r\n if (list.length !== 0)\r\n i += list.length;\r\n return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, key + \".\" + i) : v;\r\n }));\r\n}\r\nfunction _$List(value, root, key) {\r\n var self = this;\r\n Array.apply(self, [value.length]);\r\n var desc = { writable: false, configurable: false, enumerable: false };\r\n _$define(self, '_key', _$assign({ value: key }, desc));\r\n _$define(self, '_root', _$assign({ value: root }, desc));\r\n _$arrayValues(self, value, root, key);\r\n desc.writable = true;\r\n _$define(self, 'length', _$assign({ value: self.length }, desc));\r\n}\r\n_$extends(_$List, Array);\r\n['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) {\r\n _$List[PROP_MAP.h][method] = function () {\r\n var self = this;\r\n var old = self.slice();\r\n var result;\r\n if (method === 'push') {\r\n _$arrayValues(self, _$toArgs(arguments), self._root, self._key);\r\n result = self.length;\r\n }\r\n else {\r\n result = array[method].apply(self, arguments);\r\n }\r\n _$dispatch(self._root, self._key, old, self.slice());\r\n return result;\r\n };\r\n});\r\n_$List[PROP_MAP.h].pull = function (index) {\r\n var self = this;\r\n var items = _$toArgs(arguments, 1);\r\n var length = self.length;\r\n if (index > length) {\r\n length = index + 1;\r\n var pull = new Array(index - self.length);\r\n pull.push.apply(pull, items);\r\n for (var i = 0; i < length; i++) {\r\n if (i === index) {\r\n self.push.apply(self, pull);\r\n }\r\n }\r\n }\r\n else {\r\n self.splice.apply(self, [index, 1].concat(items));\r\n }\r\n};\n\nfunction _$select(selector, parent) {\r\n return _$isString(selector) ? (parent || document).querySelector(selector) : selector;\r\n}\r\nfunction _$docFragment() {\r\n return document.createDocumentFragment();\r\n}\r\nfunction _$append(parent, child, sibling) {\r\n if (_$isType(sibling, 'boolean') && sibling)\r\n parent.parentElement.replaceChild(child, parent);\r\n else if (!sibling)\r\n parent.appendChild(child);\r\n else\r\n parent.insertBefore(child, sibling);\r\n}\r\nfunction _$assignEl(source, dest) {\r\n var childNodes = source.childNodes, attributes = source.attributes;\r\n for (var i = 0; i < childNodes.length; i++) {\r\n _$append(dest, childNodes[i]);\r\n }\r\n for (var i = 0; i < attributes.length; i++) {\r\n var attr = attributes[i];\r\n dest.setAttributeNS(source.namespaceURI, attr.name, attr.value);\r\n }\r\n source.parentElement.replaceChild(dest, source);\r\n return dest;\r\n}\r\nfunction _$removeEl(el, parent) {\r\n var root = parent || el.parentElement;\r\n if (root)\r\n root.removeChild(el);\r\n}\r\nfunction _$el(tagName) {\r\n return document.createElement(tagName || 'div');\r\n}\r\nfunction _$svg(tagName) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg');\r\n}\r\nfunction _$text(content) {\r\n return document.createTextNode(content || '');\r\n}\r\nfunction _$comment(content) {\r\n return document.createComment(content || '');\r\n}\r\nfunction _$setAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el.setAttribute(attr, _$toString(value));\r\n if (_$isValueAttr(attr) && !_$isString(value))\r\n el[PROP_MAP._] = value;\r\n}\r\nfunction _$getAttr(el, attr) {\r\n return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr);\r\n}\r\nfunction _$getValue(el) {\r\n return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v];\r\n}\r\nfunction _$addListener(el, event, handler) {\r\n el.addEventListener(event, handler, false);\r\n}\r\nfunction _$updateListener(el, event, oldHandler, newHandler) {\r\n _$removeListener(el, event, oldHandler);\r\n _$addListener(el, event, oldHandler = newHandler);\r\n return oldHandler;\r\n}\r\nfunction _$removeListener(el, event, handler) {\r\n el.removeEventListener(event, handler, false);\r\n}\r\nfunction _$bindGroup(input, selection) {\r\n var _value = _$getValue(input);\r\n var _$index = selection.indexOf(_value);\r\n input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1);\r\n}\r\nfunction _$bindMultiSelect(select, selections) {\r\n if (!selections.length)\r\n return;\r\n var options = select.options;\r\n for (var i = 0; i < options.length; i++) {\r\n options[i].selected = !!~selections.indexOf(_$getValue(options[i]));\r\n }\r\n}\r\nfunction _$updateMultiSelect(select, obj, prop) {\r\n var items = [];\r\n var selection = obj[prop];\r\n var selectedOptions = select.selectedOptions;\r\n for (var i = 0; i < selectedOptions.length; i++) {\r\n items.push(_$getValue(selectedOptions[i]));\r\n }\r\n obj[prop] = new _$List(items, selection['_root'], selection['_key']);\r\n obj.$update();\r\n}\r\nfunction _$insertStyle(id, css) {\r\n var isNew = false;\r\n var style = _$select(\"#\" + id, document.head);\r\n if (!style) {\r\n isNew = true;\r\n style = _$el('style');\r\n style.id = id;\r\n _$setAttr(style, ['refs', 1]);\r\n }\r\n if (style.textContent !== css) {\r\n style.textContent = css;\r\n }\r\n if (isNew) {\r\n _$append(document.head, style);\r\n }\r\n else {\r\n var count = +_$getAttr(style, 'refs');\r\n _$setAttr(style, ['refs', ++count]);\r\n }\r\n}\r\nfunction _$removeStyle(id) {\r\n var style = _$select(\"#\" + id, document.head);\r\n if (style) {\r\n var count = +_$getAttr(style, 'refs');\r\n if (--count === 0) {\r\n _$removeEl(style, document.head);\r\n }\r\n else {\r\n _$setAttr(style, ['refs', count]);\r\n }\r\n }\r\n}\n\nfunction _$toLowerCase(str) {\r\n return str.toLowerCase();\r\n}\r\nvar _$assign = Object['assign'] || function (t) {\r\n for (var s = void 0, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s)\r\n if (_$hasProp(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nfunction _$apply(callee, args, globs, thisArg) {\r\n if (thisArg === void 0) { thisArg = null; }\r\n return callee.apply(thisArg, args.concat(globs));\r\n}\r\nfunction _$isValueAttr(attr) {\r\n return attr === 'value';\r\n}\r\nfunction _$subscribers(dep, listener) {\r\n if (!this[PROP_MAP.s][dep]) {\r\n this[PROP_MAP.s][dep] = [];\r\n }\r\n return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1;\r\n}\r\nfunction _$define(obj, key, desc) {\r\n Object.defineProperty(obj, key, desc);\r\n}\r\nfunction _$dispatch(root, key, oldVal, value) {\r\n root.$notify(key);\r\n if (root[PROP_MAP.w][key]) {\r\n _$each(root[PROP_MAP.w][key], function (watcher) { watcher(oldVal, value); });\r\n }\r\n root.$update();\r\n}\r\nfunction _$extends(ctor, exts) {\r\n ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]);\r\n ctor[PROP_MAP.h].constructor = ctor;\r\n}\r\nfunction _$isType(value, type) {\r\n return _$type(type) === 'string' ? type.split('\\|').some(function (t) { return t.trim() === _$type(value); }) : value instanceof type;\r\n}\r\nfunction _$isObject(obj) {\r\n return _$isType(obj, 'object');\r\n}\r\nfunction _$isArray(obj) {\r\n return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array');\r\n}\r\nfunction _$isFunction(obj) {\r\n return _$isType(obj, 'function');\r\n}\r\nfunction _$isString(obj) {\r\n return _$isType(obj, 'string');\r\n}\r\nfunction _$toType(value, type, root, key) {\r\n switch (type) {\r\n case 'date':\r\n return new Date(value);\r\n case 'string':\r\n return _$toString(value);\r\n case 'number':\r\n return +value;\r\n case 'boolean':\r\n return _$isString(value) && !value ? true : !!value;\r\n case 'array':\r\n return _$isType(value, _$List) ? value : new _$List(value, root, key);\r\n default:\r\n return value;\r\n }\r\n}\r\nfunction _$type(obj) {\r\n return _$toLowerCase(/ (\\w+)/.exec({}.toString.call(obj))[1]);\r\n}\r\nfunction _$hasProp(obj, prop) {\r\n return obj.hasOwnProperty(prop);\r\n}\r\nfunction _$directive(dd) {\r\n var hasProp = function (prop, instance, options, element) { return _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); };\r\n return {\r\n $init: function (instance, options, element) {\r\n hasProp('$init', instance, options, element);\r\n },\r\n $inserted: function (instance, options, element) {\r\n hasProp('$inserted', instance, options, element);\r\n },\r\n $update: function (instance, options, element) {\r\n if (_$isFunction(dd)) {\r\n dd(instance, options, element);\r\n }\r\n else {\r\n hasProp('$update', instance, options, element);\r\n }\r\n },\r\n $destroy: function (instance, options, element) {\r\n hasProp('$destroy', instance, options, element);\r\n }\r\n };\r\n}\r\nfunction _$noop() { }\r\nfunction _$addChild(inst, Child, attrs) {\r\n var child = null;\r\n if (Child) {\r\n child = new Child(attrs, inst);\r\n inst.$children.push(child);\r\n }\r\n return child;\r\n}\r\nfunction _$removeChild(inst, child) {\r\n var index = inst.$children.indexOf(child);\r\n index >= 0 && inst.$children.splice(index, 1);\r\n}\r\nfunction _$toString(obj) {\r\n var str = _$type(obj);\r\n return !/null|undefined/.test(str) ? obj.toString() : str;\r\n}\r\nfunction _$toPlainObject(obj) {\r\n var data = {};\r\n _$each(_$isObject(obj) ? obj : {}, function (_v, k) {\r\n if (k[0] !== '$' && !_$isFunction(obj[k])) {\r\n if (_$isType(obj[k], _$List)) {\r\n data[k] = obj[k].map(_$toPlainObject);\r\n }\r\n else if (_$isObject(obj[k])) {\r\n data[k] = _$toPlainObject(obj[k]);\r\n }\r\n else {\r\n data[k] = obj[k];\r\n }\r\n }\r\n });\r\n return _$isObject(obj) ? data : obj;\r\n}\r\nfunction _$setReference(refs, prop, node) {\r\n if (!_$hasProp(refs, prop)) {\r\n var value_1 = [];\r\n _$define(refs, prop, {\r\n get: function () { return value_1.length <= 1 ? value_1[0] : value_1; },\r\n set: function (val) { val && !~value_1.indexOf(val) && value_1.push(val); },\r\n enumerable: true, configurable: true\r\n });\r\n }\r\n refs[prop] = node;\r\n}\r\nfunction _$accesor(object, path, value) {\r\n return path.split('.').reduce(function (obj, key, i, arr) {\r\n if (_$isType(value, 'undefined')) {\r\n if (obj == null) {\r\n arr.splice(0, arr.length);\r\n return i > 0 && obj === null ? obj : undefined;\r\n }\r\n }\r\n else {\r\n if (i === arr.length - 1) {\r\n if (_$isType(obj, _$List) && _$toString(+key) === key) {\r\n obj.pull(+key, value);\r\n }\r\n else {\r\n var oldVal = obj[key];\r\n obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value;\r\n _$dispatch(object, path, oldVal, obj[key]);\r\n }\r\n }\r\n else if (!_$isObject(obj[key])) {\r\n obj[key] = {};\r\n }\r\n }\r\n return obj ? obj[key] : null;\r\n }, object);\r\n}\r\nfunction _$emptyElse() {\r\n return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop };\r\n}\r\nfunction _$isKey(event, key) {\r\n return _$toLowerCase(event.key) === key || !!event[key + \"Key\"];\r\n}\r\nfunction _$bindClasses(value) {\r\n var classes = '';\r\n if (_$isString(value)) {\r\n classes += \" \" + value;\r\n }\r\n else if (_$isArray(value)) {\r\n classes = value.map(_$bindClasses).join(' ');\r\n }\r\n else if (_$isObject(value)) {\r\n for (var key in value)\r\n if (_$hasProp(value, key) && value[key])\r\n classes += \" \" + key;\r\n }\r\n return classes.trim();\r\n}\r\nfunction _$bindStyle(value) {\r\n var el = _$el();\r\n if (_$isObject(value)) {\r\n var style_1 = el.style;\r\n _$each(value, function (val, prop) {\r\n if (val !== style_1[prop])\r\n style_1[prop] = val;\r\n });\r\n return style_1.cssText;\r\n }\r\n else if (_$isString(value)) {\r\n return value;\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\nfunction _$conditionalUpdate(block, condition, parent, anchor, inst) {\r\n var globs = _$toArgs(arguments, 5);\r\n if (block && block.type === _$apply(condition, [inst], globs).type) {\r\n _$apply(block.$update, [inst], globs, block);\r\n }\r\n else {\r\n block && block.$destroy();\r\n block = _$apply(condition, [inst], globs);\r\n block.$create();\r\n block.$mount(parent || inst.$parentEl, anchor);\r\n }\r\n return block;\r\n}\r\nfunction _$bindUpdate(el, binding) {\r\n var attr = binding[0], value = binding[1];\r\n var _value = _$toString(value);\r\n if (_$isValueAttr(attr)) {\r\n if (el[attr] !== _value)\r\n el[attr] = _value;\r\n el[PROP_MAP._] = value;\r\n }\r\n else if (_$getAttr(el, attr) !== _value) {\r\n _$setAttr(el, [attr, _value]);\r\n }\r\n}\r\nfunction _$bindBooleanAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true);\r\n}\r\nfunction _$textUpdate(text, value) {\r\n if (text.data !== (value = _$toString(value)))\r\n text.data = value;\r\n}\r\nfunction _$tagUpdate(node, tag) {\r\n return _$toLowerCase(tag) !== _$toLowerCase(node.tagName) ? _$assignEl(node, _$el(tag)) : node;\r\n}\r\nfunction _$removeReference(refs, prop, node) {\r\n var nodes = refs[prop];\r\n _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]);\r\n}\r\nfunction _$htmlUpdate(node, value) {\r\n if (node.innerHTML !== (value = _$toString(value)))\r\n node.innerHTML = value;\r\n}\r\nfunction _$componentUpdate(parent, Ctor, inst, value, attrs, el, sibling) {\r\n if (value === Ctor) {\r\n inst && inst.$update();\r\n }\r\n else {\r\n Ctor = value;\r\n if (inst) {\r\n inst.$destroy();\r\n _$removeChild(parent, inst);\r\n }\r\n if (inst) {\r\n inst = _$addChild(parent, Ctor, attrs);\r\n inst.$create();\r\n inst.$mount(el, sibling);\r\n }\r\n }\r\n return [inst, Ctor];\r\n}\r\nfunction _$destroyComponent(component) {\r\n component.$unmount();\r\n component.$parent = null;\r\n component.$parentEl = null;\r\n component.$siblingEl = null;\r\n component.$children.splice(0, component.$children.length);\r\n}\r\nfunction _$setElements(component, parent, sibling) {\r\n var brother = _$select(sibling);\r\n component.$siblingEl = brother;\r\n component.$parentEl = sibling && brother.parentElement || _$select(parent);\r\n}\r\nfunction _$forLoop(root, obj, loop) {\r\n var items = {}, loopParent, loopSibling;\r\n var globs = _$toArgs(arguments, 3);\r\n _$each(obj, function (item, i, index) { items[i] = _$apply(loop, [root, item, i, index], globs); });\r\n return {\r\n $create: function () {\r\n _$each(items, function (item) { item.$create(); });\r\n },\r\n $mount: function (parent, sibling) {\r\n loopParent = _$select(parent);\r\n loopSibling = _$select(sibling);\r\n _$each(items, function (item) { item.$mount(loopParent, loopSibling); });\r\n },\r\n $update: function (root, obj) {\r\n var globs = _$toArgs(arguments, 2);\r\n _$each(items, function (item, i, index) {\r\n if (obj[i]) {\r\n _$apply(item.$update, [root, obj[i], i, index], globs, item);\r\n }\r\n else {\r\n item.$destroy();\r\n delete items[i];\r\n }\r\n });\r\n _$each(obj, function (item, i, index) {\r\n if (!items[i]) {\r\n items[i] = _$apply(loop, [root, item, i, index], globs);\r\n items[i].$create();\r\n items[i].$mount(loopParent, loopSibling);\r\n }\r\n });\r\n },\r\n $destroy: function () {\r\n _$each(items, function (item) { item.$destroy(); });\r\n }\r\n };\r\n}\r\nfunction _$each(obj, cb) {\r\n var i = 0;\r\n for (var key in obj) {\r\n if (_$hasProp(obj, key)) {\r\n cb(obj[key], (isNaN(+key) ? key : +key), i++);\r\n }\r\n }\r\n}\n\nfunction _$BaseComponent(attrs, template, options, parent) {\r\n var self = this;\r\n var _$set = function (prop, value) { _$define(self, prop, { value: value, writable: true }); };\r\n if (!attrs)\r\n attrs = {};\r\n _$each(PROPS, function (prop) { _$define(self, prop, { value: {} }); });\r\n _$set('$parent', parent || null);\r\n _$set('$children', []);\r\n _$set(PROP_MAP.s, {});\r\n _$set('$options', options);\r\n var opts = self.$options;\r\n if (!opts.attrs)\r\n opts.attrs = {};\r\n if (!opts.children)\r\n opts.children = {};\r\n _$each(TPS, function (plugin) { plugin.fn.call(self, _$BaseComponent, plugin.options); });\r\n if (opts.filters)\r\n _$assign(self.$filters, opts.filters);\r\n if (opts.directives)\r\n _$each(opts.directives, function (drt, k) { self.$directives[k] = _$directive(drt); });\r\n _$each(opts.attrs, function (attrOps, key) {\r\n _$define(self, (_$isType(key, 'number') ? attrOps : key), {\r\n get: function () {\r\n if (_$isString(attrOps)) {\r\n var value = attrs[attrOps];\r\n return _$isFunction(value) ? value() : value;\r\n }\r\n else {\r\n if (!_$hasProp(attrs, key) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' is required.\");\r\n }\r\n else {\r\n var value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key];\r\n if (value === void 0 && _$hasProp(attrOps, 'default')) {\r\n var def = attrOps.default;\r\n value = _$isFunction(def) ? def() : def;\r\n }\r\n var typ = attrOps.type;\r\n if (typ && !_$isType(value, typ) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' must be type '\" + typ + \"'.\");\r\n }\r\n value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key);\r\n if (value !== void 0 && _$hasProp(attrOps, 'validator')) {\r\n var validator = attrOps.validator;\r\n if (_$isFunction(validator) && !validator(value)) {\r\n return console.error(\"Assigment '\" + key + \"'='\" + JSON.stringify(value) + \"' invalid.\");\r\n }\r\n }\r\n return value;\r\n }\r\n }\r\n },\r\n set: function () {\r\n console.error(\"'\" + key + \"' is read only.\");\r\n },\r\n enumerable: true, configurable: true\r\n });\r\n });\r\n var data = opts.model || {};\r\n var _loop_1 = function (key) {\r\n if (_$hasProp(data, key)) {\r\n var desc = Object.getOwnPropertyDescriptor(data, key);\r\n if (desc.value && _$isArray(desc.value)) {\r\n desc.value = new _$List(desc.value, self, key);\r\n }\r\n else {\r\n if (desc.get) {\r\n var getter_1 = desc.get;\r\n desc.get = function () {\r\n var value = getter_1.call(self);\r\n if (_$isArray(value))\r\n value = new _$List(value, self, key);\r\n return value;\r\n };\r\n }\r\n if (desc.set) {\r\n var setter_1 = desc.set;\r\n desc.set = function (v) {\r\n if (_$isArray(v))\r\n v = new _$List(v, self, key);\r\n setter_1.call(self, v);\r\n };\r\n }\r\n }\r\n _$define(self, key, desc);\r\n }\r\n };\r\n for (var key in data) {\r\n _loop_1(key);\r\n }\r\n var tpl = template(self);\r\n _$each(tpl, function (value, key) {\r\n _$define(self, key, {\r\n value: (function (key) {\r\n var hook = key[1].toUpperCase() + key.slice(2);\r\n var bhook = opts[\"will\" + hook];\r\n var ahook = opts[\"did\" + hook];\r\n return function () {\r\n bhook && bhook.call(this);\r\n key === '$update' ? value.call(this, this) : value.apply(this, arguments);\r\n ahook && ahook.call(this);\r\n };\r\n })(key)\r\n });\r\n });\r\n _$define(self, '$data', {\r\n get: function () {\r\n return _$toPlainObject(this);\r\n }\r\n });\r\n}\r\n_$assign(_$BaseComponent[PROP_MAP.h], {\r\n $get: function (path) {\r\n return _$accesor(this, path);\r\n },\r\n $set: function (path, value) {\r\n _$accesor(this, path, value);\r\n },\r\n $on: function (event, handler) {\r\n var _this = this;\r\n if (!this[PROP_MAP.e][event]) {\r\n this[PROP_MAP.e][event] = [];\r\n }\r\n var i = this[PROP_MAP.e][event].push(handler);\r\n return {\r\n $off: function () {\r\n _this[PROP_MAP.e][event].splice(i - 1, 1);\r\n }\r\n };\r\n },\r\n $once: function (event, handler) {\r\n var e = this.$on(event, function (args) {\r\n handler(args);\r\n e.$off();\r\n });\r\n },\r\n $fire: function (event, data) {\r\n if (this[PROP_MAP.e][event]) {\r\n _$each(this[PROP_MAP.e][event], function (handler) { handler(data); });\r\n }\r\n },\r\n $notify: function (key) {\r\n if (this[PROP_MAP.s][key]) {\r\n _$each(this[PROP_MAP.s][key], function (suscriber) { suscriber(); });\r\n }\r\n },\r\n $observe: function (deps, listener) {\r\n var _this = this;\r\n var subs = [];\r\n if (_$isArray(deps)) {\r\n _$each(deps, function (dep) {\r\n subs.push({ sub: dep, i: _$subscribers.call(_this, dep, listener) });\r\n });\r\n }\r\n else {\r\n subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) });\r\n }\r\n return {\r\n $unobserve: function () {\r\n _$each(subs, function (sub) {\r\n _this[PROP_MAP.s][sub.sub].splice(sub.i, 1);\r\n });\r\n }\r\n };\r\n },\r\n $watch: function (key, watcher) {\r\n var _this = this;\r\n if (!this[PROP_MAP.w][key]) {\r\n this[PROP_MAP.w][key] = [];\r\n }\r\n var i = this[PROP_MAP.w][key].push(watcher.bind(this));\r\n return {\r\n $unwatch: function () {\r\n _this[PROP_MAP.w][key].splice(i - 1, 1);\r\n }\r\n };\r\n }\r\n});\r\nfunction _$Ctor(moduleName, tpl, options) {\r\n var _a;\r\n var ctor = (_a = {},\r\n _a[moduleName] = function (_$attrs, _$parent) {\r\n _$BaseComponent.call(this, _$attrs, tpl, options, _$parent);\r\n !_$parent && this.$create();\r\n },\r\n _a)[moduleName];\r\n ctor.plugin = function (fn, options) {\r\n TPS.push({ options: options, fn: fn });\r\n };\r\n _$extends(ctor, _$BaseComponent);\r\n return ctor;\r\n}\n\n\n//# sourceMappingURL=index.js.map\n\n// CONCATENATED MODULE: ./components/counter.html\n\r\nfunction _$tplCounter(_$state) {\r\n var _$frag, div_1, h3_1, label_1, strong_1, txt_1, setTxt_1, bindClassStrong_1, br_1, button_1, txt_2, clickEvent_1, handlerClickEvent_1, button_2, txt_3, clickEvent_2, handlerClickEvent_2;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state) {\r\n return _$state.count;\r\n };\r\n bindClassStrong_1 = function(_$state) {\r\n return ['class', _$bindClasses(_$state.negative).trim()];\r\n };\r\n clickEvent_1 = function(_$state) {\r\n _$state.increment();\r\n };\r\n clickEvent_2 = function(_$state) {\r\n _$state.decrement();\r\n };\r\n return {\r\n $create: function() {\r\n div_1 = _$el();\r\n h3_1 = _$el('h3');\r\n h3_1.innerHTML = 'Counter Example';\r\n label_1 = _$el('label');\r\n label_1.innerHTML = 'Counter: ';\r\n strong_1 = _$el('strong');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state);\r\n br_1 = _$el('br');\r\n br_1.innerHTML = '';\r\n button_1 = _$el('button');\r\n txt_2 = _$text('Increment');\r\n button_2 = _$el('button');\r\n txt_3 = _$text('Decrement');\r\n _$setAttr(h3_1, ['class', 'title is-3']);\r\n _$setAttr(strong_1, bindClassStrong_1(_$state));\r\n _$setAttr(button_1, ['class', 'button is-primary']);\r\n _$addListener(button_1, 'click', handlerClickEvent_1 = function(event) {\r\n clickEvent_1(_$state, event, button_1);\r\n });\r\n _$setAttr(button_2, ['class', 'button is-danger']);\r\n _$addListener(button_2, 'click', handlerClickEvent_2 = function(event) {\r\n clickEvent_2(_$state, event, button_2);\r\n });\r\n _$setAttr(div_1, ['class', 'container']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$insertStyle('scope_a64f8780', '.negative {color:crimson;}');\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$textUpdate(txt_1, setTxt_1(_$state));\r\n _$bindUpdate(strong_1, bindClassStrong_1(_$state));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(div_1, h3_1);\r\n _$append(div_1, label_1);\r\n _$append(strong_1, txt_1);\r\n _$append(div_1, strong_1);\r\n _$append(div_1, br_1);\r\n _$append(button_1, txt_2);\r\n _$append(div_1, button_1);\r\n _$append(button_2, txt_3);\r\n _$append(div_1, button_2);\r\n _$append(_$frag, div_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n _$removeStyle('scope_a64f8780');\r\n _$removeListener(button_1, 'click', handlerClickEvent_1);\r\n _$removeListener(button_2, 'click', handlerClickEvent_2);\r\n delete _$state.$root;\r\n _$frag = div_1 = h3_1 = label_1 = strong_1 = txt_1 = setTxt_1 = bindClassStrong_1 = br_1 = button_1 = txt_2 = clickEvent_1 = handlerClickEvent_1 = button_2 = txt_3 = clickEvent_2 = handlerClickEvent_2 = void 0;\r\n }\r\n };\r\n}\r\nvar Counter = _$Ctor('Counter', _$tplCounter, {\r\n model: {\r\n count: 0,\r\n\r\n increment: function() {\r\n this.$set('count', this.count + 1);\r\n },\r\n\r\n decrement: function() {\r\n this.$set('count', this.count - 1);\r\n },\r\n\r\n get negative() {\r\n return {\r\n negative: this.count < 0\r\n };\r\n }\r\n }\r\n});\r\n/* harmony default export */ var counter = (Counter);\r\n\n// CONCATENATED MODULE: ./main.ts\n\r\nvar main_counter = new counter();\r\nmain_counter.$mount('main');\r\n\n\n//# sourceURL=webpack:///./main.ts_+_2_modules?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/examples/counter/src/components/counter.html b/examples/counter/src/components/counter.html deleted file mode 100644 index a71636a..0000000 --- a/examples/counter/src/components/counter.html +++ /dev/null @@ -1,31 +0,0 @@ - - -
    -

    Counter Example

    - - {{ count }} -
    - - -
    - - \ No newline at end of file diff --git a/examples/counter/src/index.html b/examples/counter/src/index.html deleted file mode 100644 index 60cf9d5..0000000 --- a/examples/counter/src/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - TreborJS • Counter - - - - -
    - - - diff --git a/examples/counter/src/main.ts b/examples/counter/src/main.ts deleted file mode 100644 index 79a82b6..0000000 --- a/examples/counter/src/main.ts +++ /dev/null @@ -1,4 +0,0 @@ -import Counter from './components/counter.html'; - -const counter = new Counter(); -counter.$mount('main'); diff --git a/examples/counter/src/types.d.ts b/examples/counter/src/types.d.ts deleted file mode 100644 index e268685..0000000 --- a/examples/counter/src/types.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -declare module "*.html" { - type AttrTypes = string | number | RegExp | null | boolean; - interface AttrDefinition { - required?: boolean; - type: 'string' | 'number' | 'object' | 'boolean' | 'function' | 'array' | Function; - default?: AttrTypes | (() => AttrTypes | Object); - } - interface DirectiveOptions { - value: any; - expression: string; - modifiers: { [key: string]: boolean } - } - interface DirectiveDefinition { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void - } - interface DirectivesOption { - [key: string]: DirectiveDefinition - } - interface ComponentOptions { - model: { [key: string]: any }; - attrs: string[] | { [key: string]: AttrDefinition }; - filters: { [key: string]: (...args: any[]) => any }; - children: { [key: string]: Component }; - directives: { - [key: string]: (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefinition - }; - } - interface Component { - readonly $refs: { [key: string]: HTMLElement[] }; - readonly $slots: { [key: string]: DocumentFragment }; - readonly $filters: { [key: string]: (...args: any[]) => any }; - readonly $options: ComponentOptions; - readonly $directives: DirectivesOption; - $create(): void; - $hydrate?(): void; - $mount(parent: string | HTMLElement, sibling?: string | HTMLElement): void; - $update(state: Object, ...args: any[]): void; - $destroy(): void; - $set(data: Object): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; - $once(event: string, handler: (data?: any) => void): void; - $fire(event: string, data?: any): void; - $notify(key: string): void; - $observe(key: string | string[], handler: () => void): { $unobserve(): void }; - $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; - } - interface ComponentConstructor { - new (attrs?: string[] | { [key: string]: AttrDefinition }): T; - prototype: Component; - } - const component: ComponentConstructor; - export default component; -} \ No newline at end of file diff --git a/examples/counter/tsconfig.json b/examples/counter/tsconfig.json deleted file mode 100644 index a752e63..0000000 --- a/examples/counter/tsconfig.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": ["./src/types.d.ts"], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file diff --git a/examples/counter/webpack.config.js b/examples/counter/webpack.config.js deleted file mode 100644 index 604ba00..0000000 --- a/examples/counter/webpack.config.js +++ /dev/null @@ -1,44 +0,0 @@ -const { resolve } = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { optimize: { ModuleConcatenationPlugin } } = require('webpack'); - -module.exports = { - context: resolve(__dirname, 'src'), - entry: './main.ts', - output: { - filename: 'counter.js', - path: resolve(__dirname, 'dist/js') - }, - mode: 'development', - module: { - rules: [ - { - test: /\.html$/, - use: 'trebor-loader', - exclude: /index\.html/ - }, - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - } - ], - }, - resolve: { - alias: { - 'trebor-tools': resolve(__dirname, '../../../trebor-tools') - } - }, - resolveLoader: { - alias: { - 'trebor-loader': resolve(__dirname, '../../loader.js') - } - }, - plugins: [ - new ModuleConcatenationPlugin(), - new HtmlWebpackPlugin({ - filename: resolve(__dirname, 'dist/index.html'), - template: './index.html' - }) - ] -}; \ No newline at end of file diff --git a/examples/dynamic-component/dist/index.html b/examples/dynamic-component/dist/index.html deleted file mode 100644 index 7f22181..0000000 --- a/examples/dynamic-component/dist/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - TreborJS • Dynamic - - - -
    - - - diff --git a/examples/dynamic-component/dist/js/dynamic.js b/examples/dynamic-component/dist/js/dynamic.js deleted file mode 100644 index 7982e75..0000000 --- a/examples/dynamic-component/dist/js/dynamic.js +++ /dev/null @@ -1,101 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./main.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./main.ts": -/*!*****************************!*\ - !*** ./main.ts + 5 modules ***! - \*****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("\n// CONCATENATED MODULE: h:/trebor-repos/trebor-tools/index.js\nvar PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers'];\r\nvar PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' };\r\nvar TPS = window[PROP_MAP.p] || (window[PROP_MAP.p] = []);\n\nvar array = Array[PROP_MAP.h];\r\nfunction _$toArgs(args, start) {\r\n if (start === void 0) { start = 0; }\r\n return array.slice.call(args, start);\r\n}\r\nfunction _$arrayValues(list, value, root, key) {\r\n array.push.apply(list, value.map(function (v, i) {\r\n if (list.length !== 0)\r\n i += list.length;\r\n return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, key + \".\" + i) : v;\r\n }));\r\n}\r\nfunction _$List(value, root, key) {\r\n var self = this;\r\n Array.apply(self, [value.length]);\r\n var desc = { writable: false, configurable: false, enumerable: false };\r\n _$define(self, '_key', _$assign({ value: key }, desc));\r\n _$define(self, '_root', _$assign({ value: root }, desc));\r\n _$arrayValues(self, value, root, key);\r\n desc.writable = true;\r\n _$define(self, 'length', _$assign({ value: self.length }, desc));\r\n}\r\n_$extends(_$List, Array);\r\n['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) {\r\n _$List[PROP_MAP.h][method] = function () {\r\n var self = this;\r\n var old = self.slice();\r\n var result;\r\n if (method === 'push') {\r\n _$arrayValues(self, _$toArgs(arguments), self._root, self._key);\r\n result = self.length;\r\n }\r\n else {\r\n result = array[method].apply(self, arguments);\r\n }\r\n _$dispatch(self._root, self._key, old, self.slice());\r\n return result;\r\n };\r\n});\r\n_$List[PROP_MAP.h].pull = function (index) {\r\n var self = this;\r\n var items = _$toArgs(arguments, 1);\r\n var length = self.length;\r\n if (index > length) {\r\n length = index + 1;\r\n var pull = new Array(index - self.length);\r\n pull.push.apply(pull, items);\r\n for (var i = 0; i < length; i++) {\r\n if (i === index) {\r\n self.push.apply(self, pull);\r\n }\r\n }\r\n }\r\n else {\r\n self.splice.apply(self, [index, 1].concat(items));\r\n }\r\n};\n\nfunction _$select(selector, parent) {\r\n return _$isString(selector) ? (parent || document).querySelector(selector) : selector;\r\n}\r\nfunction _$docFragment() {\r\n return document.createDocumentFragment();\r\n}\r\nfunction _$append(parent, child, sibling) {\r\n if (_$isType(sibling, 'boolean') && sibling)\r\n parent.parentElement.replaceChild(child, parent);\r\n else if (!sibling)\r\n parent.appendChild(child);\r\n else\r\n parent.insertBefore(child, sibling);\r\n}\r\nfunction _$assignEl(source, dest) {\r\n var childNodes = source.childNodes, attributes = source.attributes;\r\n for (var i = 0; i < childNodes.length; i++) {\r\n _$append(dest, childNodes[i]);\r\n }\r\n for (var i = 0; i < attributes.length; i++) {\r\n var attr = attributes[i];\r\n dest.setAttributeNS(source.namespaceURI, attr.name, attr.value);\r\n }\r\n source.parentElement.replaceChild(dest, source);\r\n return dest;\r\n}\r\nfunction _$removeEl(el, parent) {\r\n var root = parent || el.parentElement;\r\n if (root)\r\n root.removeChild(el);\r\n}\r\nfunction _$el(tagName) {\r\n return document.createElement(tagName || 'div');\r\n}\r\nfunction _$svg(tagName) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg');\r\n}\r\nfunction _$text(content) {\r\n return document.createTextNode(content || '');\r\n}\r\nfunction _$comment(content) {\r\n return document.createComment(content || '');\r\n}\r\nfunction _$setAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el.setAttribute(attr, _$toString(value));\r\n if (_$isValueAttr(attr) && !_$isString(value))\r\n el[PROP_MAP._] = value;\r\n}\r\nfunction _$getAttr(el, attr) {\r\n return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr);\r\n}\r\nfunction _$getValue(el) {\r\n return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v];\r\n}\r\nfunction _$addListener(el, event, handler) {\r\n el.addEventListener(event, handler, false);\r\n}\r\nfunction _$updateListener(el, event, oldHandler, newHandler) {\r\n _$removeListener(el, event, oldHandler);\r\n _$addListener(el, event, oldHandler = newHandler);\r\n return oldHandler;\r\n}\r\nfunction _$removeListener(el, event, handler) {\r\n el.removeEventListener(event, handler, false);\r\n}\r\nfunction _$bindGroup(input, selection) {\r\n var _value = _$getValue(input);\r\n var _$index = selection.indexOf(_value);\r\n input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1);\r\n}\r\nfunction _$bindMultiSelect(select, selections) {\r\n if (!selections.length)\r\n return;\r\n var options = select.options;\r\n for (var i = 0; i < options.length; i++) {\r\n options[i].selected = !!~selections.indexOf(_$getValue(options[i]));\r\n }\r\n}\r\nfunction _$updateMultiSelect(select, obj, prop) {\r\n var items = [];\r\n var selection = obj[prop];\r\n var selectedOptions = select.selectedOptions;\r\n for (var i = 0; i < selectedOptions.length; i++) {\r\n items.push(_$getValue(selectedOptions[i]));\r\n }\r\n obj[prop] = new _$List(items, selection['_root'], selection['_key']);\r\n obj.$update();\r\n}\r\nfunction _$insertStyle(id, css) {\r\n var isNew = false;\r\n var style = _$select(\"#\" + id, document.head);\r\n if (!style) {\r\n isNew = true;\r\n style = _$el('style');\r\n style.id = id;\r\n _$setAttr(style, ['refs', 1]);\r\n }\r\n if (style.textContent !== css) {\r\n style.textContent = css;\r\n }\r\n if (isNew) {\r\n _$append(document.head, style);\r\n }\r\n else {\r\n var count = +_$getAttr(style, 'refs');\r\n _$setAttr(style, ['refs', ++count]);\r\n }\r\n}\r\nfunction _$removeStyle(id) {\r\n var style = _$select(\"#\" + id, document.head);\r\n if (style) {\r\n var count = +_$getAttr(style, 'refs');\r\n if (--count === 0) {\r\n _$removeEl(style, document.head);\r\n }\r\n else {\r\n _$setAttr(style, ['refs', count]);\r\n }\r\n }\r\n}\n\nfunction _$toLowerCase(str) {\r\n return str.toLowerCase();\r\n}\r\nvar _$assign = Object['assign'] || function (t) {\r\n for (var s = void 0, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s)\r\n if (_$hasProp(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nfunction _$apply(callee, args, globs, thisArg) {\r\n if (thisArg === void 0) { thisArg = null; }\r\n return callee.apply(thisArg, args.concat(globs));\r\n}\r\nfunction _$isValueAttr(attr) {\r\n return attr === 'value';\r\n}\r\nfunction _$subscribers(dep, listener) {\r\n if (!this[PROP_MAP.s][dep]) {\r\n this[PROP_MAP.s][dep] = [];\r\n }\r\n return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1;\r\n}\r\nfunction _$define(obj, key, desc) {\r\n Object.defineProperty(obj, key, desc);\r\n}\r\nfunction _$dispatch(root, key, oldVal, value) {\r\n root.$notify(key);\r\n if (root[PROP_MAP.w][key]) {\r\n _$each(root[PROP_MAP.w][key], function (watcher) { watcher(oldVal, value); });\r\n }\r\n root.$update();\r\n}\r\nfunction _$extends(ctor, exts) {\r\n ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]);\r\n ctor[PROP_MAP.h].constructor = ctor;\r\n}\r\nfunction _$isType(value, type) {\r\n return _$type(type) === 'string' ? type.split('\\|').some(function (t) { return t.trim() === _$type(value); }) : value instanceof type;\r\n}\r\nfunction _$isObject(obj) {\r\n return _$isType(obj, 'object');\r\n}\r\nfunction _$isArray(obj) {\r\n return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array');\r\n}\r\nfunction _$isFunction(obj) {\r\n return _$isType(obj, 'function');\r\n}\r\nfunction _$isString(obj) {\r\n return _$isType(obj, 'string');\r\n}\r\nfunction _$toType(value, type, root, key) {\r\n switch (type) {\r\n case 'date':\r\n return new Date(value);\r\n case 'string':\r\n return _$toString(value);\r\n case 'number':\r\n return +value;\r\n case 'boolean':\r\n return _$isString(value) && !value ? true : !!value;\r\n case 'array':\r\n return _$isType(value, _$List) ? value : new _$List(value, root, key);\r\n default:\r\n return value;\r\n }\r\n}\r\nfunction _$type(obj) {\r\n return _$toLowerCase(/ (\\w+)/.exec({}.toString.call(obj))[1]);\r\n}\r\nfunction _$hasProp(obj, prop) {\r\n return obj.hasOwnProperty(prop);\r\n}\r\nfunction _$directive(dd) {\r\n var hasProp = function (prop, instance, options, element) { return _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); };\r\n return {\r\n $init: function (instance, options, element) {\r\n hasProp('$init', instance, options, element);\r\n },\r\n $inserted: function (instance, options, element) {\r\n hasProp('$inserted', instance, options, element);\r\n },\r\n $update: function (instance, options, element) {\r\n if (_$isFunction(dd)) {\r\n dd(instance, options, element);\r\n }\r\n else {\r\n hasProp('$update', instance, options, element);\r\n }\r\n },\r\n $destroy: function (instance, options, element) {\r\n hasProp('$destroy', instance, options, element);\r\n }\r\n };\r\n}\r\nfunction _$noop() { }\r\nfunction _$addChild(inst, Child, attrs) {\r\n var child = null;\r\n if (Child) {\r\n child = new Child(attrs, inst);\r\n inst.$children.push(child);\r\n }\r\n return child;\r\n}\r\nfunction _$removeChild(inst, child) {\r\n var index = inst.$children.indexOf(child);\r\n index >= 0 && inst.$children.splice(index, 1);\r\n}\r\nfunction _$toString(obj) {\r\n var str = _$type(obj);\r\n return !/null|undefined/.test(str) ? obj.toString() : str;\r\n}\r\nfunction _$toPlainObject(obj) {\r\n var data = {};\r\n _$each(_$isObject(obj) ? obj : {}, function (_v, k) {\r\n if (k[0] !== '$' && !_$isFunction(obj[k])) {\r\n if (_$isType(obj[k], _$List)) {\r\n data[k] = obj[k].map(_$toPlainObject);\r\n }\r\n else if (_$isObject(obj[k])) {\r\n data[k] = _$toPlainObject(obj[k]);\r\n }\r\n else {\r\n data[k] = obj[k];\r\n }\r\n }\r\n });\r\n return _$isObject(obj) ? data : obj;\r\n}\r\nfunction _$setReference(refs, prop, node) {\r\n if (!_$hasProp(refs, prop)) {\r\n var value_1 = [];\r\n _$define(refs, prop, {\r\n get: function () { return value_1.length <= 1 ? value_1[0] : value_1; },\r\n set: function (val) { val && !~value_1.indexOf(val) && value_1.push(val); },\r\n enumerable: true, configurable: true\r\n });\r\n }\r\n refs[prop] = node;\r\n}\r\nfunction _$accesor(object, path, value) {\r\n return path.split('.').reduce(function (obj, key, i, arr) {\r\n if (_$isType(value, 'undefined')) {\r\n if (obj == null) {\r\n arr.splice(0, arr.length);\r\n return i > 0 && obj === null ? obj : undefined;\r\n }\r\n }\r\n else {\r\n if (i === arr.length - 1) {\r\n if (_$isType(obj, _$List) && _$toString(+key) === key) {\r\n obj.pull(+key, value);\r\n }\r\n else {\r\n var oldVal = obj[key];\r\n obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value;\r\n _$dispatch(object, path, oldVal, obj[key]);\r\n }\r\n }\r\n else if (!_$isObject(obj[key])) {\r\n obj[key] = {};\r\n }\r\n }\r\n return obj ? obj[key] : null;\r\n }, object);\r\n}\r\nfunction _$emptyElse() {\r\n return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop };\r\n}\r\nfunction _$isKey(event, key) {\r\n return _$toLowerCase(event.key) === key || !!event[key + \"Key\"];\r\n}\r\nfunction _$bindClasses(value) {\r\n var classes = '';\r\n if (_$isString(value)) {\r\n classes += \" \" + value;\r\n }\r\n else if (_$isArray(value)) {\r\n classes = value.map(_$bindClasses).join(' ');\r\n }\r\n else if (_$isObject(value)) {\r\n for (var key in value)\r\n if (_$hasProp(value, key) && value[key])\r\n classes += \" \" + key;\r\n }\r\n return classes.trim();\r\n}\r\nfunction _$bindStyle(value) {\r\n var el = _$el();\r\n if (_$isObject(value)) {\r\n var style_1 = el.style;\r\n _$each(value, function (val, prop) {\r\n if (val !== style_1[prop])\r\n style_1[prop] = val;\r\n });\r\n return style_1.cssText;\r\n }\r\n else if (_$isString(value)) {\r\n return value;\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\nfunction _$conditionalUpdate(block, condition, parent, anchor, inst) {\r\n var globs = _$toArgs(arguments, 5);\r\n if (block && block.type === _$apply(condition, [inst], globs).type) {\r\n _$apply(block.$update, [inst], globs, block);\r\n }\r\n else {\r\n block && block.$destroy();\r\n block = _$apply(condition, [inst], globs);\r\n block.$create();\r\n block.$mount(parent || inst.$parentEl, anchor);\r\n }\r\n return block;\r\n}\r\nfunction _$bindUpdate(el, binding) {\r\n var attr = binding[0], value = binding[1];\r\n var _value = _$toString(value);\r\n if (_$isValueAttr(attr)) {\r\n if (el[attr] !== _value)\r\n el[attr] = _value;\r\n el[PROP_MAP._] = value;\r\n }\r\n else if (_$getAttr(el, attr) !== _value) {\r\n _$setAttr(el, [attr, _value]);\r\n }\r\n}\r\nfunction _$bindBooleanAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true);\r\n}\r\nfunction _$textUpdate(text, value) {\r\n if (text.data !== (value = _$toString(value)))\r\n text.data = value;\r\n}\r\nfunction _$tagUpdate(node, tag) {\r\n return _$toLowerCase(tag) !== _$toLowerCase(node.tagName) ? _$assignEl(node, _$el(tag)) : node;\r\n}\r\nfunction _$removeReference(refs, prop, node) {\r\n var nodes = refs[prop];\r\n _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]);\r\n}\r\nfunction _$htmlUpdate(node, value) {\r\n if (node.innerHTML !== (value = _$toString(value)))\r\n node.innerHTML = value;\r\n}\r\nfunction _$componentUpdate(parent, Ctor, inst, value, attrs, el, sibling) {\r\n if (value === Ctor) {\r\n inst && inst.$update();\r\n }\r\n else {\r\n Ctor = value;\r\n if (inst) {\r\n inst.$destroy();\r\n _$removeChild(parent, inst);\r\n }\r\n if (inst) {\r\n inst = _$addChild(parent, Ctor, attrs);\r\n inst.$create();\r\n inst.$mount(el || parent.$parentEl, sibling);\r\n }\r\n }\r\n return [inst, Ctor];\r\n}\r\nfunction _$destroyComponent(component) {\r\n component.$unmount();\r\n component.$parent = null;\r\n component.$parentEl = null;\r\n component.$siblingEl = null;\r\n component.$children.splice(0, component.$children.length);\r\n}\r\nfunction _$setElements(component, parent, sibling) {\r\n var brother = _$select(sibling);\r\n component.$siblingEl = brother;\r\n component.$parentEl = sibling && brother.parentElement || _$select(parent);\r\n}\r\nfunction _$forLoop(root, obj, loop) {\r\n var items = {}, loopParent, loopSibling;\r\n var globs = _$toArgs(arguments, 3);\r\n _$each(obj, function (item, i, index) { items[i] = _$apply(loop, [root, item, i, index], globs); });\r\n return {\r\n $create: function () {\r\n _$each(items, function (item) { item.$create(); });\r\n },\r\n $mount: function (parent, sibling) {\r\n loopParent = _$select(parent);\r\n loopSibling = _$select(sibling);\r\n _$each(items, function (item) { item.$mount(loopParent, loopSibling); });\r\n },\r\n $update: function (root, obj) {\r\n var globs = _$toArgs(arguments, 2);\r\n _$each(items, function (item, i, index) {\r\n if (obj[i]) {\r\n _$apply(item.$update, [root, obj[i], i, index], globs, item);\r\n }\r\n else {\r\n item.$destroy();\r\n delete items[i];\r\n }\r\n });\r\n _$each(obj, function (item, i, index) {\r\n if (!items[i]) {\r\n items[i] = _$apply(loop, [root, item, i, index], globs);\r\n items[i].$create();\r\n items[i].$mount(loopParent, loopSibling);\r\n }\r\n });\r\n },\r\n $destroy: function () {\r\n _$each(items, function (item) { item.$destroy(); });\r\n }\r\n };\r\n}\r\nfunction _$each(obj, cb) {\r\n var i = 0;\r\n for (var key in obj) {\r\n if (_$hasProp(obj, key)) {\r\n cb(obj[key], (isNaN(+key) ? key : +key), i++);\r\n }\r\n }\r\n}\n\nfunction _$BaseComponent(attrs, template, options, parent) {\r\n var self = this;\r\n var _$set = function (prop, value) { _$define(self, prop, { value: value, writable: true }); };\r\n if (!attrs)\r\n attrs = {};\r\n _$each(PROPS, function (prop) { _$define(self, prop, { value: {} }); });\r\n _$set('$parent', parent || null);\r\n _$set('$children', []);\r\n _$set(PROP_MAP.s, {});\r\n _$set('$options', options);\r\n var opts = self.$options;\r\n if (!opts.attrs)\r\n opts.attrs = {};\r\n if (!opts.children)\r\n opts.children = {};\r\n _$each(TPS, function (plugin) { plugin.fn.call(self, _$BaseComponent, plugin.options); });\r\n if (opts.filters)\r\n _$assign(self.$filters, opts.filters);\r\n if (opts.directives)\r\n _$each(opts.directives, function (drt, k) { self.$directives[k] = _$directive(drt); });\r\n _$each(opts.attrs, function (attrOps, key) {\r\n _$define(self, (_$isType(key, 'number') ? attrOps : key), {\r\n get: function () {\r\n if (_$isString(attrOps)) {\r\n var value = attrs[attrOps];\r\n return _$isFunction(value) ? value() : value;\r\n }\r\n else {\r\n if (!_$hasProp(attrs, key) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' is required.\");\r\n }\r\n else {\r\n var value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key];\r\n if (value === void 0 && _$hasProp(attrOps, 'default')) {\r\n var def = attrOps.default;\r\n value = _$isFunction(def) ? def() : def;\r\n }\r\n var typ = attrOps.type;\r\n if (typ && !_$isType(value, typ) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' must be type '\" + typ + \"'.\");\r\n }\r\n value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key);\r\n if (value !== void 0 && _$hasProp(attrOps, 'validator')) {\r\n var validator = attrOps.validator;\r\n if (_$isFunction(validator) && !validator(value)) {\r\n return console.error(\"Assigment '\" + key + \"'='\" + JSON.stringify(value) + \"' invalid.\");\r\n }\r\n }\r\n return value;\r\n }\r\n }\r\n },\r\n set: function () {\r\n console.error(\"'\" + key + \"' is read only.\");\r\n },\r\n enumerable: true, configurable: true\r\n });\r\n });\r\n var data = opts.model || {};\r\n var _loop_1 = function (key) {\r\n if (_$hasProp(data, key)) {\r\n var desc = Object.getOwnPropertyDescriptor(data, key);\r\n if (desc.value && _$isArray(desc.value)) {\r\n desc.value = new _$List(desc.value, self, key);\r\n }\r\n else {\r\n if (desc.get) {\r\n var getter_1 = desc.get;\r\n desc.get = function () {\r\n var value = getter_1.call(self);\r\n if (_$isArray(value))\r\n value = new _$List(value, self, key);\r\n return value;\r\n };\r\n }\r\n if (desc.set) {\r\n var setter_1 = desc.set;\r\n desc.set = function (v) {\r\n if (_$isArray(v))\r\n v = new _$List(v, self, key);\r\n setter_1.call(self, v);\r\n };\r\n }\r\n }\r\n _$define(self, key, desc);\r\n }\r\n };\r\n for (var key in data) {\r\n _loop_1(key);\r\n }\r\n var tpl = template(self);\r\n _$each(tpl, function (value, key) {\r\n _$define(self, key, {\r\n value: (function (key) {\r\n var hook = key[1].toUpperCase() + key.slice(2);\r\n var bhook = opts[\"will\" + hook];\r\n var ahook = opts[\"did\" + hook];\r\n return function () {\r\n bhook && bhook.call(this);\r\n key === '$update' ? value.call(this, this) : value.apply(this, arguments);\r\n ahook && ahook.call(this);\r\n };\r\n })(key)\r\n });\r\n });\r\n _$define(self, '$data', {\r\n get: function () {\r\n return _$toPlainObject(this);\r\n }\r\n });\r\n}\r\n_$assign(_$BaseComponent[PROP_MAP.h], {\r\n $get: function (path) {\r\n return _$accesor(this, path);\r\n },\r\n $set: function (path, value) {\r\n _$accesor(this, path, value);\r\n },\r\n $on: function (event, handler) {\r\n var _this = this;\r\n if (!this[PROP_MAP.e][event]) {\r\n this[PROP_MAP.e][event] = [];\r\n }\r\n var i = this[PROP_MAP.e][event].push(handler);\r\n return {\r\n $off: function () {\r\n _this[PROP_MAP.e][event].splice(i - 1, 1);\r\n }\r\n };\r\n },\r\n $once: function (event, handler) {\r\n var e = this.$on(event, function (args) {\r\n handler(args);\r\n e.$off();\r\n });\r\n },\r\n $fire: function (event, data) {\r\n if (this[PROP_MAP.e][event]) {\r\n _$each(this[PROP_MAP.e][event], function (handler) { handler(data); });\r\n }\r\n },\r\n $notify: function (key) {\r\n if (this[PROP_MAP.s][key]) {\r\n _$each(this[PROP_MAP.s][key], function (suscriber) { suscriber(); });\r\n }\r\n },\r\n $observe: function (deps, listener) {\r\n var _this = this;\r\n var subs = [];\r\n if (_$isArray(deps)) {\r\n _$each(deps, function (dep) {\r\n subs.push({ sub: dep, i: _$subscribers.call(_this, dep, listener) });\r\n });\r\n }\r\n else {\r\n subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) });\r\n }\r\n return {\r\n $unobserve: function () {\r\n _$each(subs, function (sub) {\r\n _this[PROP_MAP.s][sub.sub].splice(sub.i, 1);\r\n });\r\n }\r\n };\r\n },\r\n $watch: function (key, watcher) {\r\n var _this = this;\r\n if (!this[PROP_MAP.w][key]) {\r\n this[PROP_MAP.w][key] = [];\r\n }\r\n var i = this[PROP_MAP.w][key].push(watcher.bind(this));\r\n return {\r\n $unwatch: function () {\r\n _this[PROP_MAP.w][key].splice(i - 1, 1);\r\n }\r\n };\r\n }\r\n});\r\nfunction _$Ctor(moduleName, tpl, options) {\r\n var _a;\r\n var ctor = (_a = {},\r\n _a[moduleName] = function (_$attrs, _$parent) {\r\n _$BaseComponent.call(this, _$attrs, tpl, options, _$parent);\r\n !_$parent && this.$create();\r\n },\r\n _a)[moduleName];\r\n ctor.plugin = function (fn, options) {\r\n TPS.push({ options: options, fn: fn });\r\n };\r\n _$extends(ctor, _$BaseComponent);\r\n return ctor;\r\n}\n\n\n//# sourceMappingURL=index.js.map\n\n// CONCATENATED MODULE: ./components/red.html\n\r\nfunction _$tplRed(_$state) {\r\n var _$frag, h2_1, span_1, txt_1, setTxt_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state) {\r\n return 'Red ' + _$state.text;\r\n };\r\n return {\r\n $create: function() {\r\n h2_1 = _$el('h2');\r\n h2_1.innerHTML = 'Component Red:';\r\n span_1 = _$el('span');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state);\r\n _$setAttr(span_1, ['style', 'color: red']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$textUpdate(txt_1, setTxt_1(_$state));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(_$frag, h2_1);\r\n _$append(span_1, txt_1);\r\n _$append(_$frag, span_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n delete _$state.$root;\r\n _$frag = h2_1 = span_1 = txt_1 = setTxt_1 = void 0;\r\n }\r\n };\r\n}\r\nvar Red = _$Ctor('Red', _$tplRed, {\r\n attrs: ['text']\r\n});\r\n/* harmony default export */ var red = (Red);\r\n\n// CONCATENATED MODULE: ./components/blue.html\n\r\nfunction _$tplBlue(_$state) {\r\n var _$frag, h2_1, p_1, txt_1, setTxt_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state) {\r\n return 'Blue ' + _$state.text;\r\n };\r\n return {\r\n $create: function() {\r\n h2_1 = _$el('h2');\r\n h2_1.innerHTML = 'Component Blue:';\r\n p_1 = _$el('p');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state);\r\n _$setAttr(p_1, ['style', 'color: blue']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$textUpdate(txt_1, setTxt_1(_$state));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(_$frag, h2_1);\r\n _$append(p_1, txt_1);\r\n _$append(_$frag, p_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n delete _$state.$root;\r\n _$frag = h2_1 = p_1 = txt_1 = setTxt_1 = void 0;\r\n }\r\n };\r\n}\r\nvar Blue = _$Ctor('Blue', _$tplBlue, {\r\n attrs: ['text']\r\n});\r\n/* harmony default export */ var blue = (Blue);\r\n\n// CONCATENATED MODULE: ./components/green.html\n\r\nfunction _$tplGreen(_$state) {\r\n var _$frag, h2_1, span_1, txt_1, setTxt_1;\r\n _$frag = _$docFragment();\r\n setTxt_1 = function(_$state) {\r\n return 'Green ' + _$state.text;\r\n };\r\n return {\r\n $create: function() {\r\n h2_1 = _$el('h2');\r\n h2_1.innerHTML = 'Component Green:';\r\n span_1 = _$el('span');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state);\r\n _$setAttr(span_1, ['style', 'color: green']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$textUpdate(txt_1, setTxt_1(_$state));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(_$frag, h2_1);\r\n _$append(span_1, txt_1);\r\n _$append(_$frag, span_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n delete _$state.$root;\r\n _$frag = h2_1 = span_1 = txt_1 = setTxt_1 = void 0;\r\n }\r\n };\r\n}\r\nvar Green = _$Ctor('Green', _$tplGreen, {\r\n attrs: ['text']\r\n});\r\n/* harmony default export */ var green = (Green);\r\n\n// CONCATENATED MODULE: ./components/app.html\n\r\n\r\n\r\n\r\nfunction _$tplApp(_$state) {\r\n var children = _$state.$options.children;\r\n var _$frag, a_1, txt_1, clickEvent_1, handlerClickEvent_1, a_2, txt_2, clickEvent_2, handlerClickEvent_2, a_3, txt_3, clickEvent_3, handlerClickEvent_3, componentAnchor_1, component_1, setComponent_1, setAttrsComponent_1;\r\n _$frag = _$docFragment();\r\n clickEvent_1 = function(_$state) {\r\n _$state.$set('foo', 'red');\r\n };\r\n clickEvent_2 = function(_$state) {\r\n _$state.$set('foo', 'blue');\r\n };\r\n clickEvent_3 = function(_$state) {\r\n _$state.$set('foo', 'green');\r\n };\r\n setAttrsComponent_1 = function() {\r\n return {\r\n text: 'thing'\r\n };\r\n };\r\n setComponent_1 = function(_$state) {\r\n var comp = _$state.children[_$state.foo];\r\n return _$isType(comp, 'string') ? children[comp] : comp;\r\n };\r\n var Component_1 = setComponent_1(_$state);\r\n componentAnchor_1 = _$text();\r\n component_1 = _$addChild(_$state, Component_1, setAttrsComponent_1());\r\n return {\r\n $create: function() {\r\n a_1 = _$el('a');\r\n txt_1 = _$text('Red ');\r\n a_2 = _$el('a');\r\n txt_2 = _$text('Blue ');\r\n a_3 = _$el('a');\r\n txt_3 = _$text('Gree ');\r\n component_1.$create();\r\n _$setAttr(a_1, ['href', '#']);\r\n _$addListener(a_1, 'click', handlerClickEvent_1 = function(event) {\r\n event.preventDefault();\r\n clickEvent_1(_$state, event, a_1);\r\n });\r\n _$setAttr(a_2, ['href', '#']);\r\n _$addListener(a_2, 'click', handlerClickEvent_2 = function(event) {\r\n event.preventDefault();\r\n clickEvent_2(_$state, event, a_2);\r\n });\r\n _$setAttr(a_3, ['href', '#']);\r\n _$addListener(a_3, 'click', handlerClickEvent_3 = function(event) {\r\n event.preventDefault();\r\n clickEvent_3(_$state, event, a_3);\r\n });\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n var _a;\r\n _a = _$componentUpdate(\r\n _$state,\r\n Component_1,\r\n component_1,\r\n setComponent_1(_$state),\r\n setAttrsComponent_1(),\r\n undefined,\r\n componentAnchor_1\r\n ), component_1 = _a[0], Component_1 = _a[1];\r\n },\r\n\r\n $unmount: function() {\r\n _$append(a_1, txt_1);\r\n _$append(_$frag, a_1);\r\n _$append(a_2, txt_2);\r\n _$append(_$frag, a_2);\r\n _$append(a_3, txt_3);\r\n _$append(_$frag, a_3);\r\n _$append(_$frag, componentAnchor_1);\r\n component_1.$mount(_$frag, componentAnchor_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n _$removeListener(a_1, 'click', handlerClickEvent_1);\r\n _$removeListener(a_2, 'click', handlerClickEvent_2);\r\n _$removeListener(a_3, 'click', handlerClickEvent_3);\r\n component_1 && component_1.$destroy();\r\n delete _$state.$root;\r\n _$frag = a_1 = txt_1 = clickEvent_1 = handlerClickEvent_1 = a_2 = txt_2 = clickEvent_2 = handlerClickEvent_2 = a_3 = txt_3 = clickEvent_3 = handlerClickEvent_3 = componentAnchor_1 = component_1 = setComponent_1 = setAttrsComponent_1 = void 0;\r\n }\r\n };\r\n}\r\nvar App = _$Ctor('App', _$tplApp, {\r\n model: {\r\n foo: 'red',\r\n\r\n children: {\r\n red: red,\r\n blue: blue,\r\n green: green\r\n }\r\n }\r\n});\r\n/* harmony default export */ var app = (App);\r\n\n// CONCATENATED MODULE: ./main.ts\n\r\nvar main_app = new app();\r\nmain_app.$mount('main');\r\n\n\n//# sourceURL=webpack:///./main.ts_+_5_modules?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/examples/dynamic-component/src/components/app.html b/examples/dynamic-component/src/components/app.html deleted file mode 100644 index e1bc2de..0000000 --- a/examples/dynamic-component/src/components/app.html +++ /dev/null @@ -1,18 +0,0 @@ -Red -Blue -Gree - - - - \ No newline at end of file diff --git a/examples/dynamic-component/src/components/blue.html b/examples/dynamic-component/src/components/blue.html deleted file mode 100644 index a1ed531..0000000 --- a/examples/dynamic-component/src/components/blue.html +++ /dev/null @@ -1,8 +0,0 @@ -

    Component Blue:

    -

    Blue {{ text }}

    - - \ No newline at end of file diff --git a/examples/dynamic-component/src/components/green.html b/examples/dynamic-component/src/components/green.html deleted file mode 100644 index 37bf1d9..0000000 --- a/examples/dynamic-component/src/components/green.html +++ /dev/null @@ -1,8 +0,0 @@ -

    Component Green:

    -Green {{ text }} - - \ No newline at end of file diff --git a/examples/dynamic-component/src/components/red.html b/examples/dynamic-component/src/components/red.html deleted file mode 100644 index ce13ee0..0000000 --- a/examples/dynamic-component/src/components/red.html +++ /dev/null @@ -1,8 +0,0 @@ -

    Component Red:

    -Red {{ text }} - - \ No newline at end of file diff --git a/examples/dynamic-component/src/index.html b/examples/dynamic-component/src/index.html deleted file mode 100644 index 61b8452..0000000 --- a/examples/dynamic-component/src/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - TreborJS • Dynamic - - - -
    - - - diff --git a/examples/dynamic-component/src/main.ts b/examples/dynamic-component/src/main.ts deleted file mode 100644 index 1b91a9e..0000000 --- a/examples/dynamic-component/src/main.ts +++ /dev/null @@ -1,4 +0,0 @@ -import App from './components/app.html'; - -const app = new App(); -app.$mount('main'); diff --git a/examples/dynamic-component/src/types.d.ts b/examples/dynamic-component/src/types.d.ts deleted file mode 100644 index e268685..0000000 --- a/examples/dynamic-component/src/types.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -declare module "*.html" { - type AttrTypes = string | number | RegExp | null | boolean; - interface AttrDefinition { - required?: boolean; - type: 'string' | 'number' | 'object' | 'boolean' | 'function' | 'array' | Function; - default?: AttrTypes | (() => AttrTypes | Object); - } - interface DirectiveOptions { - value: any; - expression: string; - modifiers: { [key: string]: boolean } - } - interface DirectiveDefinition { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void - } - interface DirectivesOption { - [key: string]: DirectiveDefinition - } - interface ComponentOptions { - model: { [key: string]: any }; - attrs: string[] | { [key: string]: AttrDefinition }; - filters: { [key: string]: (...args: any[]) => any }; - children: { [key: string]: Component }; - directives: { - [key: string]: (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefinition - }; - } - interface Component { - readonly $refs: { [key: string]: HTMLElement[] }; - readonly $slots: { [key: string]: DocumentFragment }; - readonly $filters: { [key: string]: (...args: any[]) => any }; - readonly $options: ComponentOptions; - readonly $directives: DirectivesOption; - $create(): void; - $hydrate?(): void; - $mount(parent: string | HTMLElement, sibling?: string | HTMLElement): void; - $update(state: Object, ...args: any[]): void; - $destroy(): void; - $set(data: Object): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; - $once(event: string, handler: (data?: any) => void): void; - $fire(event: string, data?: any): void; - $notify(key: string): void; - $observe(key: string | string[], handler: () => void): { $unobserve(): void }; - $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; - } - interface ComponentConstructor { - new (attrs?: string[] | { [key: string]: AttrDefinition }): T; - prototype: Component; - } - const component: ComponentConstructor; - export default component; -} \ No newline at end of file diff --git a/examples/dynamic-component/tsconfig.json b/examples/dynamic-component/tsconfig.json deleted file mode 100644 index a752e63..0000000 --- a/examples/dynamic-component/tsconfig.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": ["./src/types.d.ts"], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file diff --git a/examples/dynamic-component/webpack.config.js b/examples/dynamic-component/webpack.config.js deleted file mode 100644 index e242cbf..0000000 --- a/examples/dynamic-component/webpack.config.js +++ /dev/null @@ -1,44 +0,0 @@ -const { resolve } = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { optimize: { ModuleConcatenationPlugin } } = require('webpack'); - -module.exports = { - context: resolve(__dirname, 'src'), - entry: './main.ts', - mode: 'development', - output: { - filename: 'dynamic.js', - path: resolve(__dirname, 'dist/js') - }, - module: { - rules: [ - { - test: /\.html$/, - use: 'trebor-loader', - exclude: /index\.html/ - }, - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - } - ], - }, - resolve: { - alias: { - 'trebor-tools': resolve(__dirname, '../../../trebor-tools') - } - }, - resolveLoader: { - alias: { - 'trebor-loader': resolve(__dirname, '../../loader.js') - } - }, - plugins: [ - new ModuleConcatenationPlugin(), - new HtmlWebpackPlugin({ - filename: resolve(__dirname, 'dist/index.html'), - template: './index.html' - }) - ] -}; \ No newline at end of file diff --git a/examples/todomvc/dist/index.html b/examples/todomvc/dist/index.html deleted file mode 100644 index 2abbce8..0000000 --- a/examples/todomvc/dist/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - TreborJS • TodoMVC - - - - -
    - - - - diff --git a/examples/todomvc/dist/js/todo.js b/examples/todomvc/dist/js/todo.js deleted file mode 100644 index 8e9486b..0000000 --- a/examples/todomvc/dist/js/todo.js +++ /dev/null @@ -1,101 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./main.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./main.ts": -/*!*****************************!*\ - !*** ./main.ts + 3 modules ***! - \*****************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -eval("\n// CONCATENATED MODULE: h:/trebor-repos/trebor-tools/index.js\nvar PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers'];\r\nvar PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' };\r\nvar TPS = window[PROP_MAP.p] || (window[PROP_MAP.p] = []);\n\nvar array = Array[PROP_MAP.h];\r\nfunction _$toArgs(args, start) {\r\n if (start === void 0) { start = 0; }\r\n return array.slice.call(args, start);\r\n}\r\nfunction _$arrayValues(list, value, root, key) {\r\n array.push.apply(list, value.map(function (v, i) {\r\n if (list.length !== 0)\r\n i += list.length;\r\n return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, key + \".\" + i) : v;\r\n }));\r\n}\r\nfunction _$List(value, root, key) {\r\n var self = this;\r\n Array.apply(self, [value.length]);\r\n var desc = { writable: false, configurable: false, enumerable: false };\r\n _$define(self, '_key', _$assign({ value: key }, desc));\r\n _$define(self, '_root', _$assign({ value: root }, desc));\r\n _$arrayValues(self, value, root, key);\r\n desc.writable = true;\r\n _$define(self, 'length', _$assign({ value: self.length }, desc));\r\n}\r\n_$extends(_$List, Array);\r\n['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) {\r\n _$List[PROP_MAP.h][method] = function () {\r\n var self = this;\r\n var old = self.slice();\r\n var result;\r\n if (method === 'push') {\r\n _$arrayValues(self, _$toArgs(arguments), self._root, self._key);\r\n result = self.length;\r\n }\r\n else {\r\n result = array[method].apply(self, arguments);\r\n }\r\n _$dispatch(self._root, self._key, old, self.slice());\r\n return result;\r\n };\r\n});\r\n_$List[PROP_MAP.h].pull = function (index) {\r\n var self = this;\r\n var items = _$toArgs(arguments, 1);\r\n var length = self.length;\r\n if (index > length) {\r\n length = index + 1;\r\n var pull = new Array(index - self.length);\r\n pull.push.apply(pull, items);\r\n for (var i = 0; i < length; i++) {\r\n if (i === index) {\r\n self.push.apply(self, pull);\r\n }\r\n }\r\n }\r\n else {\r\n self.splice.apply(self, [index, 1].concat(items));\r\n }\r\n};\n\nfunction _$select(selector, parent) {\r\n return _$isString(selector) ? (parent || document).querySelector(selector) : selector;\r\n}\r\nfunction _$docFragment() {\r\n return document.createDocumentFragment();\r\n}\r\nfunction _$append(parent, child, sibling) {\r\n if (_$isType(sibling, 'boolean') && sibling)\r\n parent.parentElement.replaceChild(child, parent);\r\n else if (!sibling)\r\n parent.appendChild(child);\r\n else\r\n parent.insertBefore(child, sibling);\r\n}\r\nfunction _$assignEl(source, dest) {\r\n var childNodes = source.childNodes, attributes = source.attributes;\r\n for (var i = 0; i < childNodes.length; i++) {\r\n _$append(dest, childNodes[i]);\r\n }\r\n for (var i = 0; i < attributes.length; i++) {\r\n var attr = attributes[i];\r\n dest.setAttributeNS(source.namespaceURI, attr.name, attr.value);\r\n }\r\n source.parentElement.replaceChild(dest, source);\r\n return dest;\r\n}\r\nfunction _$removeEl(el, parent) {\r\n var root = parent || el.parentElement;\r\n if (root)\r\n root.removeChild(el);\r\n}\r\nfunction _$el(tagName) {\r\n return document.createElement(tagName || 'div');\r\n}\r\nfunction _$svg(tagName) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg');\r\n}\r\nfunction _$text(content) {\r\n return document.createTextNode(content || '');\r\n}\r\nfunction _$comment(content) {\r\n return document.createComment(content || '');\r\n}\r\nfunction _$setAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el.setAttribute(attr, _$toString(value));\r\n if (_$isValueAttr(attr) && !_$isString(value))\r\n el[PROP_MAP._] = value;\r\n}\r\nfunction _$getAttr(el, attr) {\r\n return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr);\r\n}\r\nfunction _$getValue(el) {\r\n return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v];\r\n}\r\nfunction _$addListener(el, event, handler) {\r\n el.addEventListener(event, handler, false);\r\n}\r\nfunction _$updateListener(el, event, oldHandler, newHandler) {\r\n _$removeListener(el, event, oldHandler);\r\n _$addListener(el, event, oldHandler = newHandler);\r\n return oldHandler;\r\n}\r\nfunction _$removeListener(el, event, handler) {\r\n el.removeEventListener(event, handler, false);\r\n}\r\nfunction _$bindGroup(input, selection) {\r\n var _value = _$getValue(input);\r\n var _$index = selection.indexOf(_value);\r\n input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1);\r\n}\r\nfunction _$bindMultiSelect(select, selections) {\r\n if (!selections.length)\r\n return;\r\n var options = select.options;\r\n for (var i = 0; i < options.length; i++) {\r\n options[i].selected = !!~selections.indexOf(_$getValue(options[i]));\r\n }\r\n}\r\nfunction _$updateMultiSelect(select, obj, prop) {\r\n var items = [];\r\n var selection = obj[prop];\r\n var selectedOptions = select.selectedOptions;\r\n for (var i = 0; i < selectedOptions.length; i++) {\r\n items.push(_$getValue(selectedOptions[i]));\r\n }\r\n obj[prop] = new _$List(items, selection['_root'], selection['_key']);\r\n obj.$update();\r\n}\r\nfunction _$insertStyle(id, css) {\r\n var isNew = false;\r\n var style = _$select(\"#\" + id, document.head);\r\n if (!style) {\r\n isNew = true;\r\n style = _$el('style');\r\n style.id = id;\r\n _$setAttr(style, ['refs', 1]);\r\n }\r\n if (style.textContent !== css) {\r\n style.textContent = css;\r\n }\r\n if (isNew) {\r\n _$append(document.head, style);\r\n }\r\n else {\r\n var count = +_$getAttr(style, 'refs');\r\n _$setAttr(style, ['refs', ++count]);\r\n }\r\n}\r\nfunction _$removeStyle(id) {\r\n var style = _$select(\"#\" + id, document.head);\r\n if (style) {\r\n var count = +_$getAttr(style, 'refs');\r\n if (--count === 0) {\r\n _$removeEl(style, document.head);\r\n }\r\n else {\r\n _$setAttr(style, ['refs', count]);\r\n }\r\n }\r\n}\n\nfunction _$toLowerCase(str) {\r\n return str.toLowerCase();\r\n}\r\nvar _$assign = Object['assign'] || function (t) {\r\n for (var s = void 0, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s)\r\n if (_$hasProp(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nfunction _$apply(callee, args, globs, thisArg) {\r\n if (thisArg === void 0) { thisArg = null; }\r\n return callee.apply(thisArg, args.concat(globs));\r\n}\r\nfunction _$isValueAttr(attr) {\r\n return attr === 'value';\r\n}\r\nfunction _$subscribers(dep, listener) {\r\n if (!this[PROP_MAP.s][dep]) {\r\n this[PROP_MAP.s][dep] = [];\r\n }\r\n return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1;\r\n}\r\nfunction _$define(obj, key, desc) {\r\n Object.defineProperty(obj, key, desc);\r\n}\r\nfunction _$dispatch(root, key, oldVal, value) {\r\n root.$notify(key);\r\n if (root[PROP_MAP.w][key]) {\r\n _$each(root[PROP_MAP.w][key], function (watcher) { watcher(oldVal, value); });\r\n }\r\n root.$update();\r\n}\r\nfunction _$extends(ctor, exts) {\r\n ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]);\r\n ctor[PROP_MAP.h].constructor = ctor;\r\n}\r\nfunction _$isType(value, type) {\r\n return _$type(type) === 'string' ? type.split('\\|').some(function (t) { return t.trim() === _$type(value); }) : value instanceof type;\r\n}\r\nfunction _$isObject(obj) {\r\n return _$isType(obj, 'object');\r\n}\r\nfunction _$isArray(obj) {\r\n return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array');\r\n}\r\nfunction _$isFunction(obj) {\r\n return _$isType(obj, 'function');\r\n}\r\nfunction _$isString(obj) {\r\n return _$isType(obj, 'string');\r\n}\r\nfunction _$toType(value, type, root, key) {\r\n switch (type) {\r\n case 'date':\r\n return new Date(value);\r\n case 'string':\r\n return _$toString(value);\r\n case 'number':\r\n return +value;\r\n case 'boolean':\r\n return _$isString(value) && !value ? true : !!value;\r\n case 'array':\r\n return _$isType(value, _$List) ? value : new _$List(value, root, key);\r\n default:\r\n return value;\r\n }\r\n}\r\nfunction _$type(obj) {\r\n return _$toLowerCase(/ (\\w+)/.exec({}.toString.call(obj))[1]);\r\n}\r\nfunction _$hasProp(obj, prop) {\r\n return obj.hasOwnProperty(prop);\r\n}\r\nfunction _$directive(dd) {\r\n var hasProp = function (prop, instance, options, element) { return _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); };\r\n return {\r\n $init: function (instance, options, element) {\r\n hasProp('$init', instance, options, element);\r\n },\r\n $inserted: function (instance, options, element) {\r\n hasProp('$inserted', instance, options, element);\r\n },\r\n $update: function (instance, options, element) {\r\n if (_$isFunction(dd)) {\r\n dd(instance, options, element);\r\n }\r\n else {\r\n hasProp('$update', instance, options, element);\r\n }\r\n },\r\n $destroy: function (instance, options, element) {\r\n hasProp('$destroy', instance, options, element);\r\n }\r\n };\r\n}\r\nfunction _$noop() { }\r\nfunction _$addChild(inst, Child, attrs) {\r\n var child = null;\r\n if (Child) {\r\n child = new Child(attrs, inst);\r\n inst.$children.push(child);\r\n }\r\n return child;\r\n}\r\nfunction _$removeChild(inst, child) {\r\n var index = inst.$children.indexOf(child);\r\n index >= 0 && inst.$children.splice(index, 1);\r\n}\r\nfunction _$toString(obj) {\r\n var str = _$type(obj);\r\n return !/null|undefined/.test(str) ? obj.toString() : str;\r\n}\r\nfunction _$toPlainObject(obj) {\r\n var data = {};\r\n _$each(_$isObject(obj) ? obj : {}, function (_v, k) {\r\n if (k[0] !== '$' && !_$isFunction(obj[k])) {\r\n if (_$isType(obj[k], _$List)) {\r\n data[k] = obj[k].map(_$toPlainObject);\r\n }\r\n else if (_$isObject(obj[k])) {\r\n data[k] = _$toPlainObject(obj[k]);\r\n }\r\n else {\r\n data[k] = obj[k];\r\n }\r\n }\r\n });\r\n return _$isObject(obj) ? data : obj;\r\n}\r\nfunction _$setReference(refs, prop, node) {\r\n if (!_$hasProp(refs, prop)) {\r\n var value_1 = [];\r\n _$define(refs, prop, {\r\n get: function () { return value_1.length <= 1 ? value_1[0] : value_1; },\r\n set: function (val) { val && !~value_1.indexOf(val) && value_1.push(val); },\r\n enumerable: true, configurable: true\r\n });\r\n }\r\n refs[prop] = node;\r\n}\r\nfunction _$accesor(object, path, value) {\r\n return path.split('.').reduce(function (obj, key, i, arr) {\r\n if (_$isType(value, 'undefined')) {\r\n if (obj == null) {\r\n arr.splice(0, arr.length);\r\n return i > 0 && obj === null ? obj : undefined;\r\n }\r\n }\r\n else {\r\n if (i === arr.length - 1) {\r\n if (_$isType(obj, _$List) && _$toString(+key) === key) {\r\n obj.pull(+key, value);\r\n }\r\n else {\r\n var oldVal = obj[key];\r\n obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value;\r\n _$dispatch(object, path, oldVal, obj[key]);\r\n }\r\n }\r\n else if (!_$isObject(obj[key])) {\r\n obj[key] = {};\r\n }\r\n }\r\n return obj ? obj[key] : null;\r\n }, object);\r\n}\r\nfunction _$emptyElse() {\r\n return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop };\r\n}\r\nfunction _$isKey(event, key) {\r\n return _$toLowerCase(event.key) === key || !!event[key + \"Key\"];\r\n}\r\nfunction _$bindClasses(value) {\r\n var classes = '';\r\n if (_$isString(value)) {\r\n classes += \" \" + value;\r\n }\r\n else if (_$isArray(value)) {\r\n classes = value.map(_$bindClasses).join(' ');\r\n }\r\n else if (_$isObject(value)) {\r\n for (var key in value)\r\n if (_$hasProp(value, key) && value[key])\r\n classes += \" \" + key;\r\n }\r\n return classes.trim();\r\n}\r\nfunction _$bindStyle(value) {\r\n var el = _$el();\r\n if (_$isObject(value)) {\r\n var style_1 = el.style;\r\n _$each(value, function (val, prop) {\r\n if (val !== style_1[prop])\r\n style_1[prop] = val;\r\n });\r\n return style_1.cssText;\r\n }\r\n else if (_$isString(value)) {\r\n return value;\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\nfunction _$conditionalUpdate(block, condition, parent, anchor, inst) {\r\n var globs = _$toArgs(arguments, 5);\r\n if (block && block.type === _$apply(condition, [inst], globs).type) {\r\n _$apply(block.$update, [inst], globs, block);\r\n }\r\n else {\r\n block && block.$destroy();\r\n block = _$apply(condition, [inst], globs);\r\n block.$create();\r\n block.$mount(parent || inst.$parentEl, anchor);\r\n }\r\n return block;\r\n}\r\nfunction _$bindUpdate(el, binding) {\r\n var attr = binding[0], value = binding[1];\r\n var _value = _$toString(value);\r\n if (_$isValueAttr(attr)) {\r\n if (el[attr] !== _value)\r\n el[attr] = _value;\r\n el[PROP_MAP._] = value;\r\n }\r\n else if (_$getAttr(el, attr) !== _value) {\r\n _$setAttr(el, [attr, _value]);\r\n }\r\n}\r\nfunction _$bindBooleanAttr(el, attrAndValue) {\r\n var attr = attrAndValue[0], value = attrAndValue[1];\r\n el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true);\r\n}\r\nfunction _$textUpdate(text, value) {\r\n if (text.data !== (value = _$toString(value)))\r\n text.data = value;\r\n}\r\nfunction _$tagUpdate(node, tag) {\r\n return _$toLowerCase(tag) !== _$toLowerCase(node.tagName) ? _$assignEl(node, _$el(tag)) : node;\r\n}\r\nfunction _$removeReference(refs, prop, node) {\r\n var nodes = refs[prop];\r\n _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]);\r\n}\r\nfunction _$htmlUpdate(node, value) {\r\n if (node.innerHTML !== (value = _$toString(value)))\r\n node.innerHTML = value;\r\n}\r\nfunction _$componentUpdate(parent, Ctor, inst, value, attrs, el, sibling) {\r\n if (value === Ctor) {\r\n inst && inst.$update();\r\n }\r\n else {\r\n Ctor = value;\r\n if (inst) {\r\n inst.$destroy();\r\n _$removeChild(parent, inst);\r\n }\r\n if (inst) {\r\n inst = _$addChild(parent, Ctor, attrs);\r\n inst.$create();\r\n inst.$mount(el, sibling);\r\n }\r\n }\r\n return [inst, Ctor];\r\n}\r\nfunction _$destroyComponent(component) {\r\n component.$unmount();\r\n component.$parent = null;\r\n component.$parentEl = null;\r\n component.$siblingEl = null;\r\n component.$children.splice(0, component.$children.length);\r\n}\r\nfunction _$setElements(component, parent, sibling) {\r\n var brother = _$select(sibling);\r\n component.$siblingEl = brother;\r\n component.$parentEl = sibling && brother.parentElement || _$select(parent);\r\n}\r\nfunction _$forLoop(root, obj, loop) {\r\n var items = {}, loopParent, loopSibling;\r\n var globs = _$toArgs(arguments, 3);\r\n _$each(obj, function (item, i, index) { items[i] = _$apply(loop, [root, item, i, index], globs); });\r\n return {\r\n $create: function () {\r\n _$each(items, function (item) { item.$create(); });\r\n },\r\n $mount: function (parent, sibling) {\r\n loopParent = _$select(parent);\r\n loopSibling = _$select(sibling);\r\n _$each(items, function (item) { item.$mount(loopParent, loopSibling); });\r\n },\r\n $update: function (root, obj) {\r\n var globs = _$toArgs(arguments, 2);\r\n _$each(items, function (item, i, index) {\r\n if (obj[i]) {\r\n _$apply(item.$update, [root, obj[i], i, index], globs, item);\r\n }\r\n else {\r\n item.$destroy();\r\n delete items[i];\r\n }\r\n });\r\n _$each(obj, function (item, i, index) {\r\n if (!items[i]) {\r\n items[i] = _$apply(loop, [root, item, i, index], globs);\r\n items[i].$create();\r\n items[i].$mount(loopParent, loopSibling);\r\n }\r\n });\r\n },\r\n $destroy: function () {\r\n _$each(items, function (item) { item.$destroy(); });\r\n }\r\n };\r\n}\r\nfunction _$each(obj, cb) {\r\n var i = 0;\r\n for (var key in obj) {\r\n if (_$hasProp(obj, key)) {\r\n cb(obj[key], (isNaN(+key) ? key : +key), i++);\r\n }\r\n }\r\n}\n\nfunction _$BaseComponent(attrs, template, options, parent) {\r\n var self = this;\r\n var _$set = function (prop, value) { _$define(self, prop, { value: value, writable: true }); };\r\n if (!attrs)\r\n attrs = {};\r\n _$each(PROPS, function (prop) { _$define(self, prop, { value: {} }); });\r\n _$set('$parent', parent || null);\r\n _$set('$children', []);\r\n _$set(PROP_MAP.s, {});\r\n _$set('$options', options);\r\n var opts = self.$options;\r\n if (!opts.attrs)\r\n opts.attrs = {};\r\n if (!opts.children)\r\n opts.children = {};\r\n _$each(TPS, function (plugin) { plugin.fn.call(self, _$BaseComponent, plugin.options); });\r\n if (opts.filters)\r\n _$assign(self.$filters, opts.filters);\r\n if (opts.directives)\r\n _$each(opts.directives, function (drt, k) { self.$directives[k] = _$directive(drt); });\r\n _$each(opts.attrs, function (attrOps, key) {\r\n _$define(self, (_$isType(key, 'number') ? attrOps : key), {\r\n get: function () {\r\n if (_$isString(attrOps)) {\r\n var value = attrs[attrOps];\r\n return _$isFunction(value) ? value() : value;\r\n }\r\n else {\r\n if (!_$hasProp(attrs, key) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' is required.\");\r\n }\r\n else {\r\n var value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key];\r\n if (value === void 0 && _$hasProp(attrOps, 'default')) {\r\n var def = attrOps.default;\r\n value = _$isFunction(def) ? def() : def;\r\n }\r\n var typ = attrOps.type;\r\n if (typ && !_$isType(value, typ) && attrOps.required) {\r\n return console.error(\"Attribute '\" + key + \"' must be type '\" + typ + \"'.\");\r\n }\r\n value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key);\r\n if (value !== void 0 && _$hasProp(attrOps, 'validator')) {\r\n var validator = attrOps.validator;\r\n if (_$isFunction(validator) && !validator(value)) {\r\n return console.error(\"Assigment '\" + key + \"'='\" + JSON.stringify(value) + \"' invalid.\");\r\n }\r\n }\r\n return value;\r\n }\r\n }\r\n },\r\n set: function () {\r\n console.error(\"'\" + key + \"' is read only.\");\r\n },\r\n enumerable: true, configurable: true\r\n });\r\n });\r\n var data = opts.model || {};\r\n var _loop_1 = function (key) {\r\n if (_$hasProp(data, key)) {\r\n var desc = Object.getOwnPropertyDescriptor(data, key);\r\n if (desc.value && _$isArray(desc.value)) {\r\n desc.value = new _$List(desc.value, self, key);\r\n }\r\n else {\r\n if (desc.get) {\r\n var getter_1 = desc.get;\r\n desc.get = function () {\r\n var value = getter_1.call(self);\r\n if (_$isArray(value))\r\n value = new _$List(value, self, key);\r\n return value;\r\n };\r\n }\r\n if (desc.set) {\r\n var setter_1 = desc.set;\r\n desc.set = function (v) {\r\n if (_$isArray(v))\r\n v = new _$List(v, self, key);\r\n setter_1.call(self, v);\r\n };\r\n }\r\n }\r\n _$define(self, key, desc);\r\n }\r\n };\r\n for (var key in data) {\r\n _loop_1(key);\r\n }\r\n var tpl = template(self);\r\n _$each(tpl, function (value, key) {\r\n _$define(self, key, {\r\n value: (function (key) {\r\n var hook = key[1].toUpperCase() + key.slice(2);\r\n var bhook = opts[\"will\" + hook];\r\n var ahook = opts[\"did\" + hook];\r\n return function () {\r\n bhook && bhook.call(this);\r\n key === '$update' ? value.call(this, this) : value.apply(this, arguments);\r\n ahook && ahook.call(this);\r\n };\r\n })(key)\r\n });\r\n });\r\n _$define(self, '$data', {\r\n get: function () {\r\n return _$toPlainObject(this);\r\n }\r\n });\r\n}\r\n_$assign(_$BaseComponent[PROP_MAP.h], {\r\n $get: function (path) {\r\n return _$accesor(this, path);\r\n },\r\n $set: function (path, value) {\r\n _$accesor(this, path, value);\r\n },\r\n $on: function (event, handler) {\r\n var _this = this;\r\n if (!this[PROP_MAP.e][event]) {\r\n this[PROP_MAP.e][event] = [];\r\n }\r\n var i = this[PROP_MAP.e][event].push(handler);\r\n return {\r\n $off: function () {\r\n _this[PROP_MAP.e][event].splice(i - 1, 1);\r\n }\r\n };\r\n },\r\n $once: function (event, handler) {\r\n var e = this.$on(event, function (args) {\r\n handler(args);\r\n e.$off();\r\n });\r\n },\r\n $fire: function (event, data) {\r\n if (this[PROP_MAP.e][event]) {\r\n _$each(this[PROP_MAP.e][event], function (handler) { handler(data); });\r\n }\r\n },\r\n $notify: function (key) {\r\n if (this[PROP_MAP.s][key]) {\r\n _$each(this[PROP_MAP.s][key], function (suscriber) { suscriber(); });\r\n }\r\n },\r\n $observe: function (deps, listener) {\r\n var _this = this;\r\n var subs = [];\r\n if (_$isArray(deps)) {\r\n _$each(deps, function (dep) {\r\n subs.push({ sub: dep, i: _$subscribers.call(_this, dep, listener) });\r\n });\r\n }\r\n else {\r\n subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) });\r\n }\r\n return {\r\n $unobserve: function () {\r\n _$each(subs, function (sub) {\r\n _this[PROP_MAP.s][sub.sub].splice(sub.i, 1);\r\n });\r\n }\r\n };\r\n },\r\n $watch: function (key, watcher) {\r\n var _this = this;\r\n if (!this[PROP_MAP.w][key]) {\r\n this[PROP_MAP.w][key] = [];\r\n }\r\n var i = this[PROP_MAP.w][key].push(watcher.bind(this));\r\n return {\r\n $unwatch: function () {\r\n _this[PROP_MAP.w][key].splice(i - 1, 1);\r\n }\r\n };\r\n }\r\n});\r\nfunction _$Ctor(moduleName, tpl, options) {\r\n var _a;\r\n var ctor = (_a = {},\r\n _a[moduleName] = function (_$attrs, _$parent) {\r\n _$BaseComponent.call(this, _$attrs, tpl, options, _$parent);\r\n !_$parent && this.$create();\r\n },\r\n _a)[moduleName];\r\n ctor.plugin = function (fn, options) {\r\n TPS.push({ options: options, fn: fn });\r\n };\r\n _$extends(ctor, _$BaseComponent);\r\n return ctor;\r\n}\n\n\n//# sourceMappingURL=index.js.map\n\n// CONCATENATED MODULE: ./components/todo.ts\nvar filters = {\r\n actives: function (todos) {\r\n return todos.filter(function (todo) { return !todo.completed; });\r\n },\r\n filterByView: function (todos, view) {\r\n switch (view) {\r\n case 'active':\r\n return todos.filter(function (todo) { return !todo.completed; });\r\n case 'completed':\r\n return todos.filter(function (todo) { return todo.completed; });\r\n default:\r\n return todos;\r\n }\r\n },\r\n pluralize: function (word, count) {\r\n return \"\" + word + (count !== 1 ? 's' : '');\r\n }\r\n};\r\nvar model = {\r\n view: '',\r\n todos: [],\r\n newTodo: '',\r\n oldTitle: '',\r\n _allDone: false,\r\n editedTodo: null,\r\n get remaining() {\r\n return this.$filters.actives(this.todos).length;\r\n },\r\n get allDone() {\r\n return this._allDone || this.remaining === 0;\r\n },\r\n set allDone(value) {\r\n this._allDone = value;\r\n },\r\n mark: function (item, value) {\r\n this.$set(\"todos.\" + item + \".completed\", value);\r\n this.$set('allDone', this.remaining === 0);\r\n },\r\n markAll: function (value) {\r\n this.todos.forEach(function (todo) { todo.completed = value; });\r\n this.$set('allDone', value);\r\n },\r\n addTodo: function () {\r\n var title = this.newTodo && this.newTodo.trim();\r\n if (!title)\r\n return;\r\n this.newTodo = '';\r\n this.todos.push({ title: title, completed: false });\r\n this.$set('allDone', this.remaining === 0);\r\n },\r\n editTodo: function (todo) {\r\n this.editedTodo = todo;\r\n this.oldTitle = todo.title;\r\n this.$update();\r\n },\r\n doneEdit: function (todo, e) {\r\n if (e.key === 'Enter') {\r\n todo.title = todo.title.trim();\r\n if (!todo.title) {\r\n this.removeTodo(todo);\r\n }\r\n this.clearTmps();\r\n }\r\n else if (e.key === 'Escape') {\r\n todo.title = this.oldTitle;\r\n this.clearTmps();\r\n }\r\n },\r\n removeTodo: function (todo) {\r\n var index = this.todos.indexOf(todo);\r\n this.todos.splice(index, 1);\r\n this.$set('allDone', this.remaining === 0);\r\n },\r\n removeCompleted: function () {\r\n this.$set('todos', this.$filters.actives(this.todos));\r\n },\r\n clearTmps: function () {\r\n this.editedTodo = null;\r\n this.oldTitle = '';\r\n this.$update();\r\n }\r\n};\r\nvar directives = {\r\n 'focus-edit': function (_inst, options, el) {\r\n if (options.value) {\r\n el.focus();\r\n }\r\n }\r\n};\r\n/* harmony default export */ var components_todo = ({ model: model, filters: filters, directives: directives });\r\n\n// CONCATENATED MODULE: ./components/todo.html\n\r\n\r\nfunction itemLoop_1(_$state, todo, i) {\r\n var _$frag, li_1, div_1, input_1, bindCheckedInput_1, changeEvent_1, handlerChangeEvent_1, label_1, txt_1, setTxt_1, dblclickEvent_1, handlerDblclickEvent_1, button_1, clickEvent_1, handlerClickEvent_1, input_2, focusEditDirective, inputEvent_1, handlerInputEvent_1, bindValueInput_2, blurEvent_1, handlerBlurEvent_1, keyupEvent_1, handlerKeyupEvent_1, bindClassLi_1;\r\n _$frag = _$docFragment();\r\n bindCheckedInput_1 = function(_$state, todo) {\r\n return ['checked', todo.completed];\r\n };\r\n changeEvent_1 = function(_$state, todo, i, $event, $el) {\r\n _$state.mark(i, $el.checked);\r\n };\r\n setTxt_1 = function(_$state, todo) {\r\n return todo.title;\r\n };\r\n dblclickEvent_1 = function(_$state, todo, i) {\r\n _$state.editTodo(todo, i);\r\n };\r\n clickEvent_1 = function(_$state, todo) {\r\n _$state.removeTodo(todo);\r\n };\r\n focusEditDirective = _$state.$directives['focus-edit'];\r\n inputEvent_1 = function(_$state, todo, i, $event, $el) {\r\n todo.title = $el.value;\r\n };\r\n bindValueInput_2 = function(_$state, todo) {\r\n return ['value', todo.title];\r\n };\r\n blurEvent_1 = function(_$state) {\r\n _$state.$set('editedTodo', null);\r\n };\r\n keyupEvent_1 = function(_$state, todo, i, $event) {\r\n _$state.doneEdit(todo, $event);\r\n };\r\n bindClassLi_1 = function(_$state, todo) {\r\n return ['class', ('scope_4827b611 todo ' + _$bindClasses({\r\n completed: todo.completed,\r\n editing: todo === _$state.editedTodo\r\n })).trim()];\r\n };\r\n return {\r\n $create: function() {\r\n li_1 = _$el('li');\r\n div_1 = _$el();\r\n input_1 = _$el('input');\r\n label_1 = _$el('label');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state, todo, i);\r\n button_1 = _$el('button');\r\n input_2 = _$el('input');\r\n _$setAttr(input_1, ['class', 'scope_4827b611 toggle']);\r\n _$setAttr(input_1, ['type', 'checkbox']);\r\n _$bindBooleanAttr(input_1, bindCheckedInput_1(_$state, todo, i));\r\n _$addListener(input_1, 'change', handlerChangeEvent_1 = function(event) {\r\n changeEvent_1(_$state, todo, i, event, input_1);\r\n });\r\n _$setAttr(label_1, ['class', 'scope_4827b611']);\r\n _$addListener(label_1, 'dblclick', handlerDblclickEvent_1 = function(event) {\r\n dblclickEvent_1(_$state, todo, i, event, label_1);\r\n });\r\n _$setAttr(button_1, ['class', 'scope_4827b611 destroy']);\r\n _$addListener(button_1, 'click', handlerClickEvent_1 = function(event) {\r\n clickEvent_1(_$state, todo, i, event, button_1);\r\n });\r\n _$setAttr(div_1, ['class', 'scope_4827b611 view']);\r\n _$setAttr(input_2, ['type', 'text']);\r\n _$setAttr(input_2, ['class', 'scope_4827b611 edit']);\r\n focusEditDirective.$init(_$state, {\r\n value: todo === _$state.editedTodo,\r\n expression: 'todo === editedTodo',\r\n modifiers: {}\r\n }, input_2);\r\n _$addListener(input_2, 'input', handlerInputEvent_1 = function(event) {\r\n inputEvent_1(_$state, todo, i, event, input_2);\r\n });\r\n input_2.value = _$toString(bindValueInput_2(_$state, todo, i)[1]);\r\n _$addListener(input_2, 'blur', handlerBlurEvent_1 = function(event) {\r\n blurEvent_1(_$state, todo, i, event, input_2);\r\n });\r\n _$addListener(input_2, 'keyup', handlerKeyupEvent_1 = function(event) {\r\n keyupEvent_1(_$state, todo, i, event, input_2);\r\n });\r\n _$setAttr(li_1, ['class', 'scope_4827b611 todo']);\r\n _$setAttr(li_1, bindClassLi_1(_$state, todo, i));\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n focusEditDirective.$inserted(_$state, {\r\n value: todo === _$state.editedTodo,\r\n expression: 'todo === editedTodo',\r\n modifiers: {}\r\n }, input_2);\r\n },\r\n\r\n $update: function(_$state, todo, i) {\r\n _$bindBooleanAttr(input_1, bindCheckedInput_1(_$state, todo, i));\r\n handlerChangeEvent_1 = _$updateListener(input_1, 'change', handlerChangeEvent_1, function(event) {\r\n changeEvent_1(_$state, todo, i, event, input_1);\r\n });\r\n _$textUpdate(txt_1, setTxt_1(_$state, todo, i));\r\n handlerDblclickEvent_1 = _$updateListener(label_1, 'dblclick', handlerDblclickEvent_1, function(event) {\r\n dblclickEvent_1(_$state, todo, i, event, label_1);\r\n });\r\n handlerClickEvent_1 = _$updateListener(button_1, 'click', handlerClickEvent_1, function(event) {\r\n clickEvent_1(_$state, todo, i, event, button_1);\r\n });\r\n focusEditDirective.$update(_$state, {\r\n value: todo === _$state.editedTodo,\r\n expression: 'todo === editedTodo',\r\n modifiers: {}\r\n }, input_2);\r\n handlerInputEvent_1 = _$updateListener(input_2, 'input', handlerInputEvent_1, function(event) {\r\n inputEvent_1(_$state, todo, i, event, input_2);\r\n });\r\n _$bindUpdate(input_2, bindValueInput_2(_$state, todo, i));\r\n handlerBlurEvent_1 = _$updateListener(input_2, 'blur', handlerBlurEvent_1, function(event) {\r\n blurEvent_1(_$state, todo, i, event, input_2);\r\n });\r\n handlerKeyupEvent_1 = _$updateListener(input_2, 'keyup', handlerKeyupEvent_1, function(event) {\r\n keyupEvent_1(_$state, todo, i, event, input_2);\r\n });\r\n _$bindUpdate(li_1, bindClassLi_1(_$state, todo, i));\r\n },\r\n\r\n $unmount: function() {\r\n _$append(div_1, input_1);\r\n _$append(label_1, txt_1);\r\n _$append(div_1, label_1);\r\n _$append(div_1, button_1);\r\n _$append(li_1, div_1);\r\n _$append(li_1, input_2);\r\n _$append(_$frag, li_1);\r\n },\r\n\r\n $destroy: function() {\r\n this.$unmount();\r\n _$removeListener(input_1, 'change', handlerChangeEvent_1);\r\n _$removeListener(label_1, 'dblclick', handlerDblclickEvent_1);\r\n _$removeListener(button_1, 'click', handlerClickEvent_1);\r\n focusEditDirective.$destroy(_$state, {\r\n value: todo === _$state.editedTodo,\r\n expression: 'todo === editedTodo',\r\n modifiers: {}\r\n }, input_2);\r\n _$removeListener(input_2, 'input', handlerInputEvent_1);\r\n _$removeListener(input_2, 'blur', handlerBlurEvent_1);\r\n _$removeListener(input_2, 'keyup', handlerKeyupEvent_1);\r\n _$frag = li_1 = div_1 = input_1 = bindCheckedInput_1 = changeEvent_1 = handlerChangeEvent_1 = label_1 = txt_1 = setTxt_1 = dblclickEvent_1 = handlerDblclickEvent_1 = button_1 = clickEvent_1 = handlerClickEvent_1 = input_2 = focusEditDirective = inputEvent_1 = handlerInputEvent_1 = bindValueInput_2 = blurEvent_1 = handlerBlurEvent_1 = keyupEvent_1 = handlerKeyupEvent_1 = bindClassLi_1 = void 0;\r\n }\r\n };\r\n}\r\nfunction _$tplTodo(_$state) {\r\n var _$frag, section_1, header_1, h1_1, input_1, inputEvent_1, handlerInputEvent_1, bindValueInput_1, keyupEvent_1, handlerKeyupEvent_1, section_2, input_2, bindCheckedInput_2, changeEvent_1, handlerChangeEvent_1, label_1, ul_1, loopAnchor_1_1, loopBlock_1, displaySection_2, footer_1, span_1, txt_1, setTxt_1, ul_2, li_1, a_1, txt_2, bindClassA_1, clickEvent_1, handlerClickEvent_1, li_2, a_2, txt_3, bindClassA_2, clickEvent_2, handlerClickEvent_2, li_3, a_3, txt_4, bindClassA_3, clickEvent_3, handlerClickEvent_3, button_1, txt_5, clickEvent_4, handlerClickEvent_4, displayButton_1, displayFooter_1;\r\n _$frag = _$docFragment();\r\n inputEvent_1 = function(_$state, $event, $el) {\r\n _$state.$set('newTodo', $el.value);\r\n };\r\n bindValueInput_1 = function(_$state) {\r\n return ['value', _$state.newTodo];\r\n };\r\n keyupEvent_1 = function(_$state) {\r\n _$state.addTodo();\r\n };\r\n bindCheckedInput_2 = function(_$state) {\r\n return ['checked', _$state.allDone];\r\n };\r\n changeEvent_1 = function(_$state, $event, $el) {\r\n _$state.markAll($el.checked);\r\n };\r\n loopBlock_1 = _$forLoop(\r\n _$state,\r\n _$state.$filters.filterByView(_$state.todos, _$state.view),\r\n itemLoop_1\r\n );\r\n loopAnchor_1_1 = _$text();\r\n var showSection_2 = function(_$state, el, display) {\r\n el.style.display = _$state.todos.length ? display : 'none';\r\n };\r\n setTxt_1 = function(_$state) {\r\n return _$state.remaining + ' ' + _$state.$filters.pluralize('item', _$state.remaining) + ' left';\r\n };\r\n bindClassA_1 = function(_$state) {\r\n return ['class', ('scope_4827b611 ' + _$bindClasses({\r\n selected: _$state.view === ''\r\n })).trim()];\r\n };\r\n clickEvent_1 = function(_$state) {\r\n _$state.$set('view', '');\r\n };\r\n bindClassA_2 = function(_$state) {\r\n return ['class', ('scope_4827b611 ' + _$bindClasses({\r\n selected: _$state.view === 'active'\r\n })).trim()];\r\n };\r\n clickEvent_2 = function(_$state) {\r\n _$state.$set('view', 'active');\r\n };\r\n bindClassA_3 = function(_$state) {\r\n return ['class', ('scope_4827b611 ' + _$bindClasses({\r\n selected: _$state.view === 'completed'\r\n })).trim()];\r\n };\r\n clickEvent_3 = function(_$state) {\r\n _$state.$set('view', 'completed');\r\n };\r\n clickEvent_4 = function(_$state) {\r\n _$state.removeCompleted();\r\n };\r\n var showButton_1 = function(_$state, el, display) {\r\n el.style.display = _$state.todos.length > _$state.remaining ? display : 'none';\r\n };\r\n var showFooter_1 = function(_$state, el, display) {\r\n el.style.display = _$state.todos.length ? display : 'none';\r\n };\r\n return {\r\n $create: function() {\r\n section_1 = _$el('section');\r\n header_1 = _$el('header');\r\n h1_1 = _$el('h1');\r\n h1_1.innerHTML = 'todos';\r\n input_1 = _$el('input');\r\n section_2 = _$el('section');\r\n input_2 = _$el('input');\r\n label_1 = _$el('label');\r\n label_1.innerHTML = 'Mark all as complete';\r\n ul_1 = _$el('ul');\r\n loopBlock_1.$create();\r\n footer_1 = _$el('footer');\r\n span_1 = _$el('span');\r\n txt_1 = _$text();\r\n txt_1.data = setTxt_1(_$state);\r\n ul_2 = _$el('ul');\r\n li_1 = _$el('li');\r\n a_1 = _$el('a');\r\n txt_2 = _$text('All');\r\n li_2 = _$el('li');\r\n a_2 = _$el('a');\r\n txt_3 = _$text('Active');\r\n li_3 = _$el('li');\r\n a_3 = _$el('a');\r\n txt_4 = _$text('Completed');\r\n button_1 = _$el('button');\r\n txt_5 = _$text(' Clear completed ');\r\n _$setAttr(h1_1, ['class', 'scope_4827b611']);\r\n _$setAttr(input_1, ['class', 'scope_4827b611 new-todo']);\r\n _$setAttr(input_1, ['placeholder', 'What needs to be done?']);\r\n _$setAttr(input_1, ['autofocus', '']);\r\n _$addListener(input_1, 'input', handlerInputEvent_1 = function(event) {\r\n inputEvent_1(_$state, event, input_1);\r\n });\r\n input_1.value = _$toString(bindValueInput_1(_$state)[1]);\r\n _$addListener(input_1, 'keyup', handlerKeyupEvent_1 = function(event) {\r\n if (_$isKey(event, 'enter')) {\r\n keyupEvent_1(_$state, event, input_1);\r\n }\r\n });\r\n _$setAttr(header_1, ['class', 'scope_4827b611 header']);\r\n _$setAttr(input_2, ['class', 'scope_4827b611 toggle-all']);\r\n _$setAttr(input_2, ['type', 'checkbox']);\r\n _$bindBooleanAttr(input_2, bindCheckedInput_2(_$state));\r\n _$addListener(input_2, 'change', handlerChangeEvent_1 = function(event) {\r\n changeEvent_1(_$state, event, input_2);\r\n });\r\n _$setAttr(label_1, ['for', 'toggle-all']);\r\n _$setAttr(label_1, ['class', 'scope_4827b611']);\r\n _$setAttr(ul_1, ['class', 'scope_4827b611 todo-list']);\r\n _$setAttr(section_2, ['class', 'scope_4827b611 main']);\r\n displaySection_2 = section_2.style.display;\r\n showSection_2(_$state, section_2, displaySection_2);\r\n _$setAttr(span_1, ['class', 'scope_4827b611 todo-count']);\r\n _$setAttr(a_1, ['href', '#/']);\r\n _$setAttr(a_1, ['class', 'scope_4827b611']);\r\n _$setAttr(a_1, bindClassA_1(_$state));\r\n _$addListener(a_1, 'click', handlerClickEvent_1 = function(event) {\r\n clickEvent_1(_$state, event, a_1);\r\n });\r\n _$setAttr(li_1, ['class', 'scope_4827b611']);\r\n _$setAttr(a_2, ['href', '#/active']);\r\n _$setAttr(a_2, ['class', 'scope_4827b611']);\r\n _$setAttr(a_2, bindClassA_2(_$state));\r\n _$addListener(a_2, 'click', handlerClickEvent_2 = function(event) {\r\n clickEvent_2(_$state, event, a_2);\r\n });\r\n _$setAttr(li_2, ['class', 'scope_4827b611']);\r\n _$setAttr(a_3, ['href', '#/completed']);\r\n _$setAttr(a_3, ['class', 'scope_4827b611']);\r\n _$setAttr(a_3, bindClassA_3(_$state));\r\n _$addListener(a_3, 'click', handlerClickEvent_3 = function(event) {\r\n clickEvent_3(_$state, event, a_3);\r\n });\r\n _$setAttr(li_3, ['class', 'scope_4827b611']);\r\n _$setAttr(ul_2, ['class', 'scope_4827b611 filters']);\r\n _$setAttr(button_1, ['class', 'scope_4827b611 clear-completed']);\r\n _$addListener(button_1, 'click', handlerClickEvent_4 = function(event) {\r\n clickEvent_4(_$state, event, button_1);\r\n });\r\n displayButton_1 = button_1.style.display;\r\n showButton_1(_$state, button_1, displayButton_1);\r\n _$setAttr(footer_1, ['class', 'scope_4827b611 footer']);\r\n displayFooter_1 = footer_1.style.display;\r\n showFooter_1(_$state, footer_1, displayFooter_1);\r\n _$setAttr(section_1, ['class', 'scope_4827b611 todoapp']);\r\n },\r\n\r\n $mount: function(parent, sibling) {\r\n this.$unmount();\r\n _$insertStyle(\r\n 'scope_4827b611',\r\n '.scope_4827b611.view label.scope_4827b611{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;}'\r\n );\r\n _$append(_$select(parent), _$frag, _$select(sibling));\r\n _$setElements(this, parent, sibling);\r\n },\r\n\r\n $update: function(_$state) {\r\n _$bindUpdate(input_1, bindValueInput_1(_$state));\r\n _$bindBooleanAttr(input_2, bindCheckedInput_2(_$state));\r\n loopBlock_1.$update(_$state, _$state.$filters.filterByView(_$state.todos, _$state.view));\r\n showSection_2(_$state, section_2, displaySection_2);\r\n _$textUpdate(txt_1, setTxt_1(_$state));\r\n _$bindUpdate(a_1, bindClassA_1(_$state));\r\n _$bindUpdate(a_2, bindClassA_2(_$state));\r\n _$bindUpdate(a_3, bindClassA_3(_$state));\r\n showButton_1(_$state, button_1, displayButton_1);\r\n showFooter_1(_$state, footer_1, displayFooter_1);\r\n },\r\n\r\n $unmount: function() {\r\n _$append(header_1, h1_1);\r\n _$append(header_1, input_1);\r\n _$append(section_1, header_1);\r\n _$append(section_2, input_2);\r\n _$append(section_2, label_1);\r\n _$append(ul_1, loopAnchor_1_1);\r\n loopBlock_1.$mount(ul_1, loopAnchor_1_1);\r\n _$append(section_2, ul_1);\r\n _$append(section_1, section_2);\r\n _$append(span_1, txt_1);\r\n _$append(footer_1, span_1);\r\n _$append(a_1, txt_2);\r\n _$append(li_1, a_1);\r\n _$append(ul_2, li_1);\r\n _$append(a_2, txt_3);\r\n _$append(li_2, a_2);\r\n _$append(ul_2, li_2);\r\n _$append(a_3, txt_4);\r\n _$append(li_3, a_3);\r\n _$append(ul_2, li_3);\r\n _$append(footer_1, ul_2);\r\n _$append(button_1, txt_5);\r\n _$append(footer_1, button_1);\r\n _$append(section_1, footer_1);\r\n _$append(_$frag, section_1);\r\n },\r\n\r\n $destroy: function() {\r\n _$destroyComponent(this);\r\n _$removeStyle('scope_4827b611');\r\n _$removeListener(input_1, 'input', handlerInputEvent_1);\r\n _$removeListener(input_1, 'keyup', handlerKeyupEvent_1);\r\n _$removeListener(input_2, 'change', handlerChangeEvent_1);\r\n loopBlock_1.$destroy();\r\n _$removeListener(a_1, 'click', handlerClickEvent_1);\r\n _$removeListener(a_2, 'click', handlerClickEvent_2);\r\n _$removeListener(a_3, 'click', handlerClickEvent_3);\r\n _$removeListener(button_1, 'click', handlerClickEvent_4);\r\n delete _$state.$root;\r\n _$frag = section_1 = header_1 = h1_1 = input_1 = inputEvent_1 = handlerInputEvent_1 = bindValueInput_1 = keyupEvent_1 = handlerKeyupEvent_1 = section_2 = input_2 = bindCheckedInput_2 = changeEvent_1 = handlerChangeEvent_1 = label_1 = ul_1 = loopAnchor_1_1 = loopBlock_1 = displaySection_2 = footer_1 = span_1 = txt_1 = setTxt_1 = ul_2 = li_1 = a_1 = txt_2 = bindClassA_1 = clickEvent_1 = handlerClickEvent_1 = li_2 = a_2 = txt_3 = bindClassA_2 = clickEvent_2 = handlerClickEvent_2 = li_3 = a_3 = txt_4 = bindClassA_3 = clickEvent_3 = handlerClickEvent_3 = button_1 = txt_5 = clickEvent_4 = handlerClickEvent_4 = displayButton_1 = displayFooter_1 = void 0;\r\n }\r\n };\r\n}\r\nvar Todo = _$Ctor('Todo', _$tplTodo, components_todo);\r\n/* harmony default export */ var components_todo_0 = (Todo);\r\n\n// CONCATENATED MODULE: ./main.ts\n\r\nvar main_todo = new components_todo_0();\r\nmain_todo.$mount('main');\r\n\n\n//# sourceURL=webpack:///./main.ts_+_3_modules?"); - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/examples/todomvc/src/components/todo.html b/examples/todomvc/src/components/todo.html deleted file mode 100644 index ad7969e..0000000 --- a/examples/todomvc/src/components/todo.html +++ /dev/null @@ -1,46 +0,0 @@ - - -
    -
    -

    todos

    - -
    -
    - - -
      -
    • -
      - - - -
      - -
    • -
    -
    -
    - {{ remaining }} {{ 'item' | pluralize remaining }} left - - -
    -
    - - \ No newline at end of file diff --git a/examples/todomvc/src/components/todo.ts b/examples/todomvc/src/components/todo.ts deleted file mode 100644 index 0e08b67..0000000 --- a/examples/todomvc/src/components/todo.ts +++ /dev/null @@ -1,96 +0,0 @@ -interface Todo { - title: string; - completed: boolean; -} - -const filters = { - actives(todos: Todo[]) { - return todos.filter(todo => !todo.completed); - }, - filterByView(todos: Todo[], view: string) { - switch (view) { - case 'active': - return todos.filter(todo => !todo.completed); - case 'completed': - return todos.filter(todo => todo.completed); - default: - return todos; - } - }, - pluralize(word: string, count: number) { - return `${word}${count !== 1 ? 's' : ''}`; - } -}; - -const model = { - view: '', - todos: [], - newTodo: '', - oldTitle: '', - _allDone: false, - editedTodo: null, - get remaining() { - return this.$filters.actives(this.todos).length; - }, - get allDone() { - return this._allDone || this.remaining === 0; - }, - set allDone(value: boolean) { - this._allDone = value; - }, - mark(item: number, value: boolean) { - this.$set(`todos.${item}.completed`, value); - this.$set('allDone', this.remaining === 0); - }, - markAll(value: boolean) { - this.todos.forEach(todo => { todo.completed = value; }); - this.$set('allDone', value); - }, - addTodo() { - const title = this.newTodo && this.newTodo.trim(); - if (!title) return; - this.newTodo = ''; - this.todos.push({ title: title, completed: false }); - this.$set('allDone', this.remaining === 0); - }, - editTodo(todo: Todo) { - this.editedTodo = todo; - this.oldTitle = todo.title; - this.$update(); - }, - doneEdit(todo: Todo, e: KeyboardEvent) { - if (e.key === 'Enter') { - todo.title = todo.title.trim(); - if (!todo.title) { - this.removeTodo(todo); - } - this.clearTmps(); - } else if (e.key === 'Escape') { - todo.title = this.oldTitle; - this.clearTmps(); - } - }, - removeTodo(todo: Todo) { - const index = this.todos.indexOf(todo); - this.todos.splice(index, 1); - this.$set('allDone', this.remaining === 0); - }, - removeCompleted() { - this.$set('todos', this.$filters.actives(this.todos)); - }, - clearTmps() { - this.editedTodo = null; - this.oldTitle = ''; - this.$update(); - } -}; - -const directives = { - 'focus-edit': function (_inst, options, el) { - if (options.value) { - el.focus(); - } - } -}; - -export default { model, filters, directives }; \ No newline at end of file diff --git a/examples/todomvc/src/main.ts b/examples/todomvc/src/main.ts deleted file mode 100644 index 3029472..0000000 --- a/examples/todomvc/src/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -// import Calendar from './components/calendar.html'; -import Todo from './components/todo.html'; - -const todo = new Todo(); -// const calendar = new Calendar(); -todo.$mount('main'); -// calendar.$mount('main'); diff --git a/examples/todomvc/src/types.d.ts b/examples/todomvc/src/types.d.ts deleted file mode 100644 index d591623..0000000 --- a/examples/todomvc/src/types.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -declare module "*.html" { - type AttrTypes = string | number | RegExp | null | boolean; - type PluginFn = (this: Component, ctor: ComponentConstructor, pluginOptions?: ObjectLike) => void; - type DirectiveDefinition = (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefObject; - - interface ObjectLike { [key: string]: T; } - - interface DirectiveDefObject { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - } - - interface AttrDefinition { - required?: boolean; - type: string | Function; - default?: AttrTypes | (() => AttrTypes | Object); - } - - interface DirectiveOptions { - value: any; - expression: string; - modifiers: ObjectLike; - } - - interface ComponentOptions { - model: ObjectLike; - attrs: string[] | ObjectLike; - filters: ObjectLike<(...args: any[]) => any>; - children: ObjectLike; - directives: ObjectLike; - } - - interface ComponentTemplate { - $create(): void; - $hydrate?(): void; - $mount(parent: string | Element, sibling?: string | boolean | Element): void; - $update(state: Component, ...args: any[]): void; - $unmout(): void; - $destroy(): void; - } - - interface Component extends ComponentTemplate { - $parent: Component; - readonly $refs: ObjectLike; - readonly $slots: ObjectLike; - readonly $filters: ObjectLike<(...args: any[]) => any>; - readonly $options: ComponentOptions; - readonly $children: Component[]; - readonly $directives: ObjectLike; - $get(path: string): T; - $set(path: string, value: T): void; - $update(): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; - $once(event: string, handler: (data?: any) => void): void; - $fire(event: string, data?: any): void; - $notify(key: string): void; - $observe(key: string | string[], handler: () => void): { $unobserve(): void }; - $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; - } - - interface ComponentConstructor { - new (attrs?: string[] | ObjectLike, parent?: Component): T; - plugin(fn: PluginFn, options?: ObjectLike): void; - prototype: Component; - } - const component: ComponentConstructor; - export default component; -} \ No newline at end of file diff --git a/examples/todomvc/tsconfig.json b/examples/todomvc/tsconfig.json deleted file mode 100644 index a752e63..0000000 --- a/examples/todomvc/tsconfig.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - // "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": ["./src/types.d.ts"], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file diff --git a/examples/todomvc/webpack.config.js b/examples/todomvc/webpack.config.js deleted file mode 100644 index 6077644..0000000 --- a/examples/todomvc/webpack.config.js +++ /dev/null @@ -1,44 +0,0 @@ -const { resolve } = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const { optimize: { ModuleConcatenationPlugin } } = require('webpack'); - -module.exports = { - context: resolve(__dirname, 'src'), - entry: './main.ts', - mode: 'development', - output: { - filename: 'todo.js', - path: resolve(__dirname, 'dist/js') - }, - module: { - rules: [ - { - test: /\.html$/, - use: 'trebor-loader', - exclude: /index\.html/ - }, - { - test: /\.ts$/, - use: 'ts-loader', - exclude: /node_modules/ - } - ], - }, - resolve: { - alias: { - 'trebor-tools': resolve(__dirname, '../../../trebor-tools') - } - }, - resolveLoader: { - alias: { - 'trebor-loader': resolve(__dirname, '../../loader.js') - } - }, - plugins: [ - new ModuleConcatenationPlugin(), - new HtmlWebpackPlugin({ - filename: resolve(__dirname, 'dist/index.html'), - template: './index.html' - }) - ] -}; \ No newline at end of file diff --git a/lib/CSSParse.js b/lib/CSSParse.js deleted file mode 100644 index d30893a..0000000 --- a/lib/CSSParse.js +++ /dev/null @@ -1,550 +0,0 @@ -// Module by visionmedia -// https://github.com/reworkcss/css-parse -// -// http://www.w3.org/TR/CSS21/grammar.html -// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 -var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; - -module.exports = function (css, options) { - options = options || {}; - options.position = options.position === false ? false : true; - options.delimiters = options.delimiters || ['{%', '%}']; - /** - * Positional. - */ - - var lineno = 1; - var column = 1; - - /** - * Update lineno and column based on `str`. - */ - - function updatePosition(str) { - var lines = str.match(/\n/g); - if (lines) lineno += lines.length; - var i = str.lastIndexOf('\n'); - column = ~i ? str.length - i : column + str.length; - } - - /** - * Mark position and patch `node.position`. - */ - - function position() { - var start = { line: lineno, column: column }; - if (!options.position) return positionNoop; - - return function (node) { - node.position = new Position(start); - whitespace(); - return node; - }; - } - - /** - * Store position information for a node - */ - - function Position(start) { - this.start = start; - this.end = { line: lineno, column: column }; - this.source = options.source; - } - - /** - * Non-enumerable source string - */ - - Position.prototype.content = css; - - /** - * Return `node`. - */ - - function positionNoop(node) { - whitespace(); - return node; - } - - /** - * Error `msg`. - */ - - function error(msg) { - var err = new Error(msg + ' near line ' + lineno + ':' + column); - err.filename = options.source; - err.line = lineno; - err.column = column; - err.source = css; - throw err; - } - - /** - * Parse stylesheet. - */ - - function stylesheet() { - return { - type: 'stylesheet', - stylesheet: { - rules: rules() - } - }; - } - - /** - * Opening brace. - */ - - function open() { - return match(/^{\s*/); - } - - /** - * Closing brace. - */ - - function close() { - return match(/^}/); - } - - /** - * Parse ruleset. - */ - - function rules() { - var node; - var rules = []; - whitespace(); - comments(rules); - while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) { - rules.push(node); - comments(rules); - } - return rules; - } - - /** - * Match `re` and return captures. - */ - - function match(re) { - var m = re.exec(css); - if (!m) return; - var str = m[0]; - updatePosition(str); - css = css.slice(str.length); - return m; - } - - /** - * Parse whitespace. - */ - - function whitespace() { - match(/^\s*/); - } - - /** - * Parse comments; - */ - - function comments(rules) { - var c; - rules = rules || []; - while (c = comment()) rules.push(c); - return rules; - } - - /** - * Parse comment. - */ - - function comment() { - var pos = position(); - if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) return; - - var i = 2; - while ("" !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1)))++i; - i += 2; - - if ("" === css.charAt(i - 1)) { - return error('End of comment missing'); - } - - var str = css.slice(2, i - 2); - column += 2; - updatePosition(str); - css = css.slice(i); - column += 2; - - return pos({ - type: 'comment', - comment: str - }); - } - - /** - * Parse selector. - */ - - function selector() { - var m = match(/^([^{]+)/); - if (!m) return; - /* @fix Remove all comments from selectors - * http://ostermiller.org/findcomment.html */ - return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').split(/\s*,\s*/); - } - - /** - * Parse declaration. - */ - - function declaration() { - var pos = position(); - - // prop - var prop = match(/^(\*?[-#\/\*\w]+(\[[0-9a-z_-]+\])?)\s*/); - if (!prop) return; - prop = trim(prop[0]); - - // : - if (!match(/^:\s*/)) return error("property missing ':'"); - - // template - var delimiters = options.delimiters; - var reg = new RegExp('(\\w*\\s*)*' + delimiters[0] + '( )?(.+?)( )?' + delimiters[1] + '(\\s*\\w*)'); - var val = match(reg); - // val - if (!val) { - val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); - } - if (!val) return error('property missing value'); - - var ret = pos({ - type: 'declaration', - property: prop.replace(commentre, ''), - value: trim(val[0]).replace(commentre, '') - }); - - // ; - match(/^[;\s]*/); - - return ret; - } - - /** - * Parse declarations. - */ - - function declarations() { - var decls = []; - - if (!open()) return error("missing '{'"); - comments(decls); - - // declarations - var decl; - while (decl = declaration()) { - decls.push(decl); - comments(decls); - } - - if (!close()) return error("missing '}'"); - return decls; - } - - /** - * Parse keyframe. - */ - - function keyframe() { - var m; - var vals = []; - var pos = position(); - - while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) { - vals.push(m[1]); - match(/^,\s*/); - } - - if (!vals.length) return; - - return pos({ - type: 'keyframe', - values: vals, - declarations: declarations() - }); - } - - /** - * Parse keyframes. - */ - - function atkeyframes() { - var pos = position(); - var m = match(/^@([-\w]+)?keyframes */); - - if (!m) return; - var vendor = m[1]; - - // identifier - var m = match(/^([-\w]+)\s*/); - if (!m) return error("@keyframes missing name"); - var name = m[1]; - - if (!open()) return error("@keyframes missing '{'"); - - var frame; - var frames = comments(); - while (frame = keyframe()) { - frames.push(frame); - frames = frames.concat(comments()); - } - - if (!close()) return error("@keyframes missing '}'"); - - return pos({ - type: 'keyframes', - name: name, - vendor: vendor, - keyframes: frames - }); - } - - /** - * Parse supports. - */ - - function atsupports() { - var pos = position(); - var m = match(/^@supports *([^{]+)/); - - if (!m) return; - var supports = trim(m[1]); - - if (!open()) return error("@supports missing '{'"); - - var style = comments().concat(rules()); - - if (!close()) return error("@supports missing '}'"); - - return pos({ - type: 'supports', - supports: supports, - rules: style - }); - } - - /** - * Parse host. - */ - - function athost() { - var pos = position(); - var m = match(/^@host */); - - if (!m) return; - - if (!open()) return error("@host missing '{'"); - - var style = comments().concat(rules()); - - if (!close()) return error("@host missing '}'"); - - return pos({ - type: 'host', - rules: style - }); - } - - /** - * Parse media. - */ - - function atmedia() { - var pos = position(); - var m = match(/^@media *([^{]+)/); - - if (!m) return; - var media = trim(m[1]); - - if (!open()) return error("@media missing '{'"); - - var style = comments().concat(rules()); - - if (!close()) return error("@media missing '}'"); - - return pos({ - type: 'media', - media: media, - rules: style - }); - } - - /** - * Parse paged media. - */ - - function atpage() { - var pos = position(); - var m = match(/^@page */); - if (!m) return; - - var sel = selector() || []; - - if (!open()) return error("@page missing '{'"); - var decls = comments(); - - // declarations - var decl; - while (decl = declaration()) { - decls.push(decl); - decls = decls.concat(comments()); - } - - if (!close()) return error("@page missing '}'"); - - return pos({ - type: 'page', - selectors: sel, - declarations: decls - }); - } - - /** - * Parse document. - */ - - function atdocument() { - var pos = position(); - var m = match(/^@([-\w]+)?document *([^{]+)/); - if (!m) return; - - var vendor = trim(m[1]); - var doc = trim(m[2]); - - if (!open()) return error("@document missing '{'"); - - var style = comments().concat(rules()); - - if (!close()) return error("@document missing '}'"); - - return pos({ - type: 'document', - document: doc, - vendor: vendor, - rules: style - }); - } - - /** - * Parse font-face. - */ - - function atfontface() { - var pos = position(); - var m = match(/^@font-face */); - if (!m) return; - - if (!open()) return error("@font-face missing '{'"); - var decls = comments(); - - // declarations - var decl; - while (decl = declaration()) { - decls.push(decl); - decls = decls.concat(comments()); - } - - if (!close()) return error("@font-face missing '}'"); - - return pos({ - type: 'font-face', - declarations: decls - }); - } - - /** - * Parse import - */ - - var atimport = _compileAtrule('import'); - - /** - * Parse charset - */ - - var atcharset = _compileAtrule('charset'); - - /** - * Parse namespace - */ - - var atnamespace = _compileAtrule('namespace'); - - /** - * Parse non-block at-rules - */ - - - function _compileAtrule(name) { - var re = new RegExp('^@' + name + ' *([^;\\n]+);'); - return function () { - var pos = position(); - var m = match(re); - if (!m) return; - var ret = { type: name }; - ret[name] = m[1].trim(); - return pos(ret); - }; - } - - /** - * Parse at rule. - */ - - function atrule() { - if (css[0] !== '@') return; - - return atkeyframes() - || atmedia() - || atsupports() - || atimport() - || atcharset() - || atnamespace() - || atdocument() - || atpage() - || athost() - || atfontface(); - } - - /** - * Parse rule. - */ - - function rule() { - var pos = position(); - var sel = selector(); - - if (!sel) return error('selector missing'); - comments(); - - return pos({ - type: 'rule', - selectors: sel, - declarations: declarations() - }); - } - - return stylesheet(); -}; - -/** - * Trim `str`. - */ - -function trim(str) { - return str ? str.replace(/^\s+|\s+$/g, '') : ''; -} \ No newline at end of file diff --git a/loader.js b/loader.js index d927c9a..1327e89 100644 --- a/loader.js +++ b/loader.js @@ -1,23 +1,24 @@ +const { parseSource } = require('./build'); const { extname, basename } = require('path'); const { getOptions } = require('loader-utils'); -const { transpileModule } = require('typescript'); -const { genSource, exportFormat } = require('./build'); -const { optimize } = require('./build/utilities/context'); -const { kebabToCamelCases, capitalize } = require('./build/utilities/tools'); +const { snakeToCamel, capitalize } = require('./build/utils'); -module.exports = function (code, map, meta) { - const format = 'es'; +module.exports = function (html, sourceMap, meta) { + let { comments = false, format = 'esm', directives = [] } = getOptions(this) || {}; const ext = extname(this.resourcePath); - const file = basename(this.resourcePath, ext); - const moduleName = kebabToCamelCases(capitalize(file).replace(/\./g, '_')); - const { comments } = getOptions(this) || {}; - const { imports, source } = genSource(code, { - noComments: !comments, moduleName, format, input: this.resourcePath - }); - const src = [source, exportFormat(format, moduleName)].join('\n'); - const { outputText, sourceMapText } = transpileModule(src, { - compilerOptions: { target: 1, module: 5, removeComments: !comments } + const moduleName = capitalize(snakeToCamel(basename(this.resourcePath, ext))); + const { code, map, error } = parseSource(html, { + filePath: this.resourcePath, + compilerOptions: { + comments, format: /^(esm|cjs)$/i.test(format) ? format : 'esm', + minify: false, moduleName, optimize: false + }, + directives }); - this.callback(null, optimize([...imports, outputText].join('\n')), sourceMapText, meta); + if (error) { + throw error; + } + + this.callback(null, code, map, meta); }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 39e73c5..2841290 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,4 +1,5692 @@ { + "name": "trebor", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@rollup/plugin-alias": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-2.2.0.tgz", + "integrity": "sha512-//6zmlHGbmousaatu4pBlC61gqZykLbH0c2GESBO4JgK5xFZgb/ih0zlg/5/BmTAczX5R/xsHRnsYsu4KyHV5w==", + "dev": true, + "requires": { + "slash": "^3.0.0" + } + }, + "@types/css": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/@types/css/-/css-0.0.31.tgz", + "integrity": "sha512-Xt3xp8o0zueqrdIkAOO5gy5YNs+jYfmIUPeoeKiwrcmCRXuNWkIgR2Ph6vHuVfi1y6c9Tx214EQBWPEkU97djw==", + "dev": true + }, + "@types/eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", + "dev": true + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", + "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/html-entities": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@types/html-entities/-/html-entities-1.2.16.tgz", + "integrity": "sha512-CI6fHfFvkTtX2Nlr4JBA6yIFTfA4p9E6w9ky64X6PrfXiTALhUh/SOa+Sxvv2p87m+y5AH71lAUrx0lSYx4hKQ==", + "dev": true + }, + "@types/jasmine": { + "version": "3.4.6", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.4.6.tgz", + "integrity": "sha512-hpQHs+lmZ0uuCrGyqypdI1Ho7jRFolOBT6OkNdZPFziLSSEKvWu+VxWU6bGdNEA/hoV4jV8pdDeNx8EWlmfNAw==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz", + "integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "12.12.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz", + "integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==", + "dev": true + }, + "@types/puppeteer": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-1.20.2.tgz", + "integrity": "sha512-oSFCtftHSfVx8K9XPdNNYs79Zt4pYJs/0NP78ltuGCB25zS3UNGJSiypBfbhbvRC5Dcsh0k1R5Z0i8HHtqQUPQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.8.0.tgz", + "integrity": "sha512-jZ05E4SxCbbXseQGXOKf3ESKcsGxT8Ucpkp1jiVp55MGhOvZB2twmWKf894PAuVQTCgbPbJz9ZbRDqtUWzP8xA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.8.0", + "eslint-scope": "^5.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + } + } + }, + "@typescript-eslint/parser": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.8.0.tgz", + "integrity": "sha512-NseXWzhkucq+JM2HgqAAoKEzGQMb5LuTRjFPLQzGIdLthXMNUfuiskbl7QSykvWW6mvzCtYbw1fYWGa2EIaekw==", + "dev": true, + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.8.0", + "@typescript-eslint/typescript-estree": "2.8.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.8.0.tgz", + "integrity": "sha512-ksvjBDTdbAQ04cR5JyFSDX113k66FxH1tAXmi+dj6hufsl/G0eMc/f1GgLjEVPkYClDbRKv+rnBFuE5EusomUw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash.unescape": "4.0.1", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@webassemblyjs/ast": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", + "integrity": "sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ==", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/wast-parser": "1.8.5" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz", + "integrity": "sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz", + "integrity": "sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz", + "integrity": "sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz", + "integrity": "sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.8.5" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz", + "integrity": "sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow==", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz", + "integrity": "sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "mamacro": "^0.0.3" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz", + "integrity": "sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz", + "integrity": "sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz", + "integrity": "sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.8.5.tgz", + "integrity": "sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.8.5.tgz", + "integrity": "sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz", + "integrity": "sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/helper-wasm-section": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5", + "@webassemblyjs/wasm-opt": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5", + "@webassemblyjs/wast-printer": "1.8.5" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz", + "integrity": "sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/ieee754": "1.8.5", + "@webassemblyjs/leb128": "1.8.5", + "@webassemblyjs/utf8": "1.8.5" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz", + "integrity": "sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz", + "integrity": "sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-api-error": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/ieee754": "1.8.5", + "@webassemblyjs/leb128": "1.8.5", + "@webassemblyjs/utf8": "1.8.5" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz", + "integrity": "sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/floating-point-hex-parser": "1.8.5", + "@webassemblyjs/helper-api-error": "1.8.5", + "@webassemblyjs/helper-code-frame": "1.8.5", + "@webassemblyjs/helper-fsm": "1.8.5", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz", + "integrity": "sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/wast-parser": "1.8.5", + "@xtuc/long": "4.2.2" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "acorn": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", + "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "dev": true + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", + "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", + "dev": true + }, + "ajv-keywords": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", + "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", + "dev": true + }, + "ansi-escapes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", + "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", + "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", + "dev": true + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true + }, + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true + }, + "bluebird": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.1.tgz", + "integrity": "sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cacache": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", + "integrity": "sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w==", + "dev": true, + "requires": { + "chownr": "^1.1.2", + "figgy-pudding": "^3.5.1", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.2", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.0.0", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "p-map": "^3.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^2.7.1", + "ssri": "^7.0.0", + "unique-filename": "^1.1.1" + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, + "chownr": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "ci-info": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.2.0.tgz", + "integrity": "sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ==", + "dev": true + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "cyclist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", + "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "dom-serializer": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", + "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==", + "dev": true + }, + "entities": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "duplexify": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "dev": true, + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "elliptic": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz", + "integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "enhanced-resolve": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz", + "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + }, + "dependencies": { + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", + "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + } + } + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.1.tgz", + "integrity": "sha512-UWzBS79pNcsDSxgxbdjkmzn/B6BhsXMfUaOHnNwyE8nD+Q6pyT96ow2MccVayUTV4yMid4qLhMiQaywctRkBLA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "eslint-scope": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", + "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "eslint-plugin-html": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-6.0.0.tgz", + "integrity": "sha512-PQcGippOHS+HTbQCStmH5MY1BF2MaU8qW/+Mvo/8xTa/ioeMXdSP+IiaBw2+nh0KEMfYQKuTz1Zo+vHynjwhbg==", + "dev": true, + "requires": { + "htmlparser2": "^3.10.1" + } + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, + "espree": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", + "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", + "dev": true, + "requires": { + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz", + "integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "dev": true, + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, + "figgy-pudding": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", + "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", + "dev": true + }, + "figures": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", + "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-cache-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.1.0.tgz", + "integrity": "sha512-zw+EFiNBNPgI2NTrKkDd1xd7q0cs6wr/iWnr/oUkI0yF9K9GqQ+riIt4aiyFaaqpaWbxPrJXHI+QvmNUQbX+0Q==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.0", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "findup-sync": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", + "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "dev": true + }, + "flush-write-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", + "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-minipass": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.0.0.tgz", + "integrity": "sha512-40Qz+LFXmd9tzYVnnBmZvFfvAADfUA14TXPK1s7IfElJTIZ97rA8w4Kin7Wt5JBrC3ShnnFJO/5vPjPEeJIq9A==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", + "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.12.1", + "node-pre-gyp": "^0.12.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true, + "optional": true + }, + "minipass": { + "version": "2.3.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.3.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^4.1.0", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.12.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.7.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "requires": { + "global-prefix": "^3.0.0" + }, + "dependencies": { + "global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + } + } + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + } + }, + "globals": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.1.1.tgz", + "integrity": "sha512-i4wvLF+QFfPq/gNA1S8dL4Z2f2Cb62ZvxDhj38fZIProAfyUidDmUQILIg1jc5iwqJr4PVJSUB5usYvFxSzg+A==", + "requires": { + "type-fest": "^0.8.1" + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "html-entities": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", + "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=" + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dev": true, + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "https-proxy-agent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz", + "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==", + "dev": true, + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "hyntax": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/hyntax/-/hyntax-1.1.2.tgz", + "integrity": "sha512-NaUcW8eza3VJ2swuEudvLmDmMRll8xh05pf+4Z/aJejef8eJf4Hg+VGF+n0bQCRKBYaht9kVjX5WaaRtuSttDQ==" + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + } + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "inquirer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.0.tgz", + "integrity": "sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^2.4.2", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^4.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + } + } + }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "jasmine": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz", + "integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==", + "dev": true, + "requires": { + "glob": "^7.1.4", + "jasmine-core": "~3.5.0" + } + }, + "jasmine-console-reporter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jasmine-console-reporter/-/jasmine-console-reporter-3.1.0.tgz", + "integrity": "sha512-fNP6XlgkIyNvfr6JVMJudZL9qWNY2K7l934Ojj4k8J09/QXf4xYf2Mc7MUgcsDhqIb2zTkLd2LsBJWFvJz41/w==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "ci-info": "^1.4.0", + "node-emoji": "^1.8.1", + "ora": "^3.0.0", + "perfy": "^1.1.5" + } + }, + "jasmine-core": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz", + "integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==", + "dev": true + }, + "jest-worker": { + "version": "24.9.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", + "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "requires": { + "minimist": "^1.2.0" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "^2.0.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "loader-runner": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", + "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==", + "dev": true + }, + "loader-utils": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", + "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^2.0.0", + "json5": "^1.0.1" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "lodash.toarray": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.toarray/-/lodash.toarray-4.4.0.tgz", + "integrity": "sha1-JMS/zWsvuji/0FlNsRedjptlZWE=", + "dev": true + }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + }, + "dependencies": { + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "make-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.0.tgz", + "integrity": "sha512-grNJDhb8b1Jm1qeqW5R/O63wUo4UXo2v2HMic6YT9i/HBlF93S8jkMgH7yugvY9ABDShH4VZMn8I+U8+fCNegw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "mamacro": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", + "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", + "dev": true + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "meriyah": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-1.9.3.tgz", + "integrity": "sha512-MvKPdlPlvGP4OIO1NJ6gh+LNJD4sQCp3KbywYMQVqNHnUFhFph6Zvdj5cotWQsXNRCEiEbqN4rUVH9ajMF+1oA==" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==", + "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "minipass": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.1.tgz", + "integrity": "sha512-UFqVihv6PQgwj8/yTGvl9kPz7xIAY+R5z6XYjRInD3Gk3qx6QGSD6zEcpeG4Dy/lQnv1J6zv8ejV90hyYIKf3w==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-pipeline": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.2.tgz", + "integrity": "sha512-3JS5A2DKhD2g0Gg8x3yamO0pj7YeKGwVlDS90pF++kxptwx/F+B//roxf9SqYil5tQo65bijy+dAuAFZmYOouA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "mississippi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", + "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-emoji": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", + "integrity": "sha512-Yt3384If5H6BYGVHiHwTL+99OzJKHhgp82S8/dktEK73T26BazdgZ4JZh92xSVtGNJvz9UbXdNAc5hcrXV42vw==", + "dev": true, + "requires": { + "lodash.toarray": "^4.4.0" + } + }, + "node-libs-browser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", + "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^3.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.1", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.11.0", + "vm-browserify": "^1.0.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "ora": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz", + "integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-spinners": "^2.0.0", + "log-symbols": "^2.2.0", + "strip-ansi": "^5.2.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + } + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "dev": true + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "pako": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", + "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==", + "dev": true + }, + "parallel-transform": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", + "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", + "dev": true, + "requires": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-asn1": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "perfy": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/perfy/-/perfy-1.1.5.tgz", + "integrity": "sha512-/ieVBpMaPTJf83YTUl2TImsSwMEJ23qGP2w27pE6aX+NrB/ZRGqOnQZpl7J719yFwd+ebDiHguPNFeMSamyK7w==", + "dev": true + }, + "picomatch": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz", + "integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA==", + "dev": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "puppeteer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.0.0.tgz", + "integrity": "sha512-t3MmTWzQxPRP71teU6l0jX47PHXlc4Z52sQv4LJQSZLq1ttkKS2yGM3gaI57uQwZkNaoGd0+HPPMELZkcyhlqA==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^3.0.0", + "mime": "^2.0.3", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "dependencies": { + "global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + } + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rollup": { + "version": "1.26.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.26.5.tgz", + "integrity": "sha512-c6Pv0yWzjYNpy2DIhLFUnyP6e1UTGownr4IfpJcPY/k186RJjpaGGPRwKQ62KCauctG6dgtHt88pw1EGrPRkuA==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/node": "*", + "acorn": "^7.1.0" + }, + "dependencies": { + "acorn": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", + "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "dev": true + } + } + }, + "rollup-plugin-terser": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.1.2.tgz", + "integrity": "sha512-sWKBCOS+vUkRtHtEiJPAf+WnBqk/C402fBD9AVHxSIXMqjsY7MnYWKYEUqGixtr0c8+1DjzUEPlNgOYQPVrS1g==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "jest-worker": "^24.6.0", + "rollup-pluginutils": "^2.8.1", + "serialize-javascript": "^1.7.0", + "terser": "^4.1.0" + }, + "dependencies": { + "serialize-javascript": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz", + "integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==", + "dev": true + } + } + }, + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "requires": { + "estree-walker": "^0.6.1" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "rxjs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "serialize-javascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.0.tgz", + "integrity": "sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "ssri": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", + "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "minipass": "^3.1.1" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + } + }, + "tapable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", + "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", + "dev": true + }, + "terser": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.4.0.tgz", + "integrity": "sha512-oDG16n2WKm27JO8h4y/w3iqBGAOSCtq7k8dRmrn4Wf9NouL0b2WpMHGChFGZq4nFAQy1FsNJrVQHfurXOSTmOA==", + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + } + }, + "terser-webpack-plugin": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.2.1.tgz", + "integrity": "sha512-jwdauV5Al7zopR6OAYvIIRcxXCSvLjZjr7uZE8l2tIWb/ryrGN48sJftqGf5k9z09tWhajx53ldp0XPI080YnA==", + "dev": true, + "requires": { + "cacache": "^13.0.1", + "find-cache-dir": "^3.0.0", + "jest-worker": "^24.9.0", + "schema-utils": "^2.5.0", + "serialize-javascript": "^2.1.0", + "source-map": "^0.6.1", + "terser": "^4.3.9", + "webpack-sources": "^1.4.3" + }, + "dependencies": { + "schema-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.5.0.tgz", + "integrity": "sha512-32ISrwW2scPXHUSusP8qMg5dLUawKkyV+/qIEV9JdXKx+rsM6mi8vZY8khg2M69Qom16rtroWXD3Ybtiws38gQ==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "timers-browserify": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", + "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "ts-loader": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.2.1.tgz", + "integrity": "sha512-Dd9FekWuABGgjE1g0TlQJ+4dFUfYGbYcs52/HQObE0ZmUNjQlmLAS7xXsSzy23AMaMwipsx5sNHvoEpT2CZq1g==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^1.0.2", + "micromatch": "^4.0.0", + "semver": "^6.0.0" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true + }, + "tsutils": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", + "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.2.tgz", + "integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==", + "dev": true + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", + "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", + "dev": true, + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "v8-compile-cache": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz", + "integrity": "sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w==", + "dev": true + }, + "vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", + "dev": true + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "dev": true, + "requires": { + "chokidar": "^2.0.2", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "webpack": { + "version": "4.41.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.41.2.tgz", + "integrity": "sha512-Zhw69edTGfbz9/8JJoyRQ/pq8FYUoY0diOXqW0T6yhgdhCv6wr0hra5DwwWexNRns2Z2+gsnrNcbe9hbGBgk/A==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-module-context": "1.8.5", + "@webassemblyjs/wasm-edit": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5", + "acorn": "^6.2.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^4.1.0", + "eslint-scope": "^4.0.3", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.1", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", + "schema-utils": "^1.0.0", + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.1", + "watchpack": "^1.6.0", + "webpack-sources": "^1.4.1" + }, + "dependencies": { + "cacache": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz", + "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "serialize-javascript": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz", + "integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==", + "dev": true + }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + }, + "terser-webpack-plugin": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz", + "integrity": "sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg==", + "dev": true, + "requires": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^1.7.0", + "source-map": "^0.6.1", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + } + } + } + }, + "webpack-cli": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.10.tgz", + "integrity": "sha512-u1dgND9+MXaEt74sJR4PR7qkPxXUSQ0RXYq8x1L6Jg1MYVEmGPrH6Ah6C4arD4r0J1P5HKjRqpab36k0eIzPqg==", + "dev": true, + "requires": { + "chalk": "2.4.2", + "cross-spawn": "6.0.5", + "enhanced-resolve": "4.1.0", + "findup-sync": "3.0.0", + "global-modules": "2.0.0", + "import-local": "2.0.0", + "interpret": "1.2.0", + "loader-utils": "1.2.3", + "supports-color": "6.1.0", + "v8-compile-cache": "2.0.3", + "yargs": "13.2.4" + }, + "dependencies": { + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "webpack-sources": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "worker-farm": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", + "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yargs": { + "version": "13.2.4", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz", + "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "os-locale": "^3.1.0", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, + "requires": { + "fd-slicer": "~1.0.1" + } + } + } +======= "name": "trebor", "version": "0.3.3", "lockfileVersion": 1, diff --git a/package.json b/package.json index b6f41cf..b18adae 100644 --- a/package.json +++ b/package.json @@ -1,80 +1,73 @@ { - "name": "trebor", - "version": "0.3.3", - "description": "A node js module to make standalone web components.", - "main": "./build/index.js", - "bin": { - "trebor": "./bin/trebor.js" - }, - "scripts": { - "build:src": "tsc -p ./src", - "build:tools": "tsc -p ./tools", - "build:example:clock": "webpack --config ./examples/clock/webpack.config.js --watch", - "build:example:todo": "webpack --config ./examples/todomvc/webpack.config.js --watch", - "build:example:counter": "webpack --config ./examples/counter/webpack.config.js --watch", - "build:example:calendar": "webpack --config ./examples/calendar/webpack.config.js --watch", - "build:example:animation": "webpack --config ./examples/animation/webpack.config.js --watch", - "build:example:dynamic": "webpack --config ./examples/dynamic-component/webpack.config.js --watch", - "build:test": "node ./specs/helpers/setup.js && phantomjs ./specs/run.js ./specs/test.html", - "build:test:src": "tsc -p ./test/src && node ./bin/trebor.js -i ./test/components -o ./specs/components -f iif", - "test": "npm run build:test:src && npm run build:test" - }, - "engines": { - "node": ">=8" - }, - "dependencies": { - "eslint-scope": "^4.0.0", - "espree": "^4.1.0", - "glob": "^7.1.3", - "globals": "^11.8.0", - "html-entities": "^1.2.1", - "html-tag-names": "^1.1.3", - "loader-utils": "^1.1.0", - "parse5": "^5.1.0", - "recast": "^0.16.0", - "rollup-pluginutils": "^2.3.3", - "svg-tag-names": "^1.1.1", - "tslib": "^1.9.3", - "typescript": "^3.1.3", - "uglify-es": "^3.3.9", - "uglify-js": "^3.4.9", - "yargs": "^12.0.2" - }, - "devDependencies": { - "@types/css": "0.0.31", - "@types/eslint-scope": "^3.7.0", - "@types/esprima": "^4.0.2", - "@types/glob": "^7.1.1", - "@types/html-entities": "^1.2.16", - "@types/html-tag-names": "^1.1.0", - "@types/jasmine": "^2.8.9", - "@types/node": "^10.12.1", - "@types/parse5": "^5.0.0", - "@types/uglify-js": "^3.0.4", - "html-webpack-plugin": "^3.2.0", - "jasmine": "^3.3.0", - "phantomjs-prebuilt": "^2.1.16", - "ts-loader": "^5.2.2", - "webpack": "^4.23.1", - "webpack-cli": "^3.1.2" - }, - "keywords": [ - "single-file-component", - "standalone-components", - "no-framework", - "cli", - "web-components" - ], - "author": "InDIOS", - "repository": { - "type": "git", - "url": "git+https://github.com/InDIOS/trebor.git" - }, - "license": "MIT", - "contributors": [ - { - "email": "robert04siel@gmail.com", - "name": "Roberto Asiel Guevara Castañeda" - } - ] + "name": "trebor", + "version": "1.0.0", + "description": "A Nodejs module to make standalone web components.", + "bin": { + "trebor": "./bin/trebor.js" + }, + "main": "./build/index.js", + "engines": { + "node": ">=8" + }, + "dependencies": { + "commander": "^2.20.0", + "glob": "^7.1.6", + "globals": "^12.1.1", + "html-entities": "^1.2.1", + "hyntax": "^1.1.2", + "loader-utils": "^1.2.3", + "meriyah": "^1.9.3", + "rollup-pluginutils": "^2.6.0", + "terser": "^4.4.0" + }, + "devDependencies": { + "@rollup/plugin-alias": "^2.2.0", + "@types/css": "0.0.31", + "@types/glob": "^7.1.1", + "@types/html-entities": "^1.2.16", + "@types/jasmine": "^3.4.6", + "@types/node": "^12.12.7", + "@types/puppeteer": "^1.20.2", + "@typescript-eslint/parser": "^2.8.0", + "eslint": "^6.7.1", + "eslint-plugin-html": "^6.0.0", + "jasmine": "^3.5.0", + "jasmine-console-reporter": "^3.1.0", + "puppeteer": "^2.0.0", + "rollup": "^1.26.5", + "rollup-plugin-terser": "^5.1.2", + "terser-webpack-plugin": "^2.2.1", + "ts-loader": "^6.2.1", + "typescript": "^3.7.2", + "webpack": "^4.41.2", + "webpack-cli": "^3.3.10" + }, + "scripts": { + "build": "tsc -p ./src && tsc -p ./tools", + "build:cli-example": "node bin/trebor.js -i examples/01-Hello_World/hello.html", + "build:webpack-example": "webpack --config examples/02-Webpack/webpack.config.js", + "build:rollup-example": "rollup --config examples/03-Rollup/rollup.config.js", + "build:todomvc-example": "webpack --config examples/04-ToDoMVC/webpack.config.js", + "build:test:components": "node bin/trebor.js -i test/components/*.html", + "test": "tsc -p ./test && node test/index.js" + }, + "keywords": [ + "single-file-component", + "standalone-components", + "non-framework", + "cli", + "web-components" + ], + "author": "InDIOS", + "repository": { + "type": "git", + "url": "git+https://github.com/InDIOS/trebor.git" + }, + "license": "MIT", + "contributors": [ + { + "email": "robert04siel@gmail.com", + "name": "Roberto Asiel Guevara Castañeda" + } + ] } diff --git a/plugin.js b/plugin.js index da8b0bb..2bd6eb8 100644 --- a/plugin.js +++ b/plugin.js @@ -1,32 +1,26 @@ +const { parseSource } = require('./build'); const { extname, basename } = require('path'); -const { transpileModule } = require('typescript'); const { createFilter } = require('rollup-pluginutils'); -const { genSource, exportFormat } = require('./build'); -const { optimize } = require('./build/utilities/context'); -const { kebabToCamelCases, capitalize } = require('./build/utilities/tools'); +const { snakeToCamel, capitalize } = require('./build/utils'); -module.exports = function ({ include, exclude, comments } = {}) { - const format = 'es'; - const filter = createFilter(include || './**/*.html', exclude); +module.exports = function ({ include, exclude, comments = false, format = 'esm', directives = [] } = {}) { + format = /^(esm|cjs)$/i.test(format) ? format : 'esm'; + const filter = createFilter(include || './**/*.html', exclude); return { name: 'rollup-plugin-trebor', - transform(code, id) { - if (!filter(id)) return; - const ext = extname(id); - const file = basename(id, ext); - const moduleName = kebabToCamelCases(capitalize(file).replace(/\./g, '_')); - const { imports, source } = genSource(code, { - noComments: !comments, moduleName, format, input: id - }); - const src = [source, exportFormat(format, moduleName)].join('\n'); - const { outputText, sourceMapText } = transpileModule(src, { - compilerOptions: { sourceMap: true, target: 1, module: 5, removeComments: !comments } + transform(html, filePath) { + if (!filter(filePath)) return; + const ext = extname(filePath); + const file = basename(filePath, ext); + const moduleName = capitalize(snakeToCamel(file)); + + const { code, map } = parseSource(html, { + filePath: this.resourcePath, + compilerOptions: { comments, format, minify: false, moduleName }, + directives, optimize: false }); - return { - code: optimize([...imports, outputText].join('\n')), - map: sourceMapText - }; + return { code, map }; } }; }; \ No newline at end of file diff --git a/specs/components/readme.txt b/specs/components/readme.txt deleted file mode 100644 index 9af0551..0000000 --- a/specs/components/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Spec Components folder \ No newline at end of file diff --git a/src/attributes/binding.ts b/src/attributes/binding.ts new file mode 100644 index 0000000..e369fd9 --- /dev/null +++ b/src/attributes/binding.ts @@ -0,0 +1,46 @@ +import ctx from '../parsers/script/context'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { callExpression, literal } from '../parsers/script/nodes'; +import { capitalize, snakeToCamel, toValidate, filters, filterPlaceholders } from '../utils'; + +const isBooleanAttr = toValidate(`allowfullscreen,async,autofocus,autoplay,checked,compact,controls, +declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate, +hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate, +nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate, +truespeed,typemustmatch,visible`); + +export default function bindAttribute(node: Element, attr: string, expression: string, segmts: Segments) { + const { varName } = node; + const type = node.hasAttribute('multiple') ? 'multiple' : node.getAttribute('type'); + const bindFuncName = `_$bind${capitalize(snakeToCamel(attr))}${capitalize(varName.replace('_$', ''))}`; + const isMultiSelect = node.tagName === 'select' && node.hasAttribute('multiple'); + expression = expression || (attr === 'class' ? 'true' : snakeToCamel(attr)); + let bindExp = ctx(filters(expression, segmts), segmts.globals, segmts.globalTools || []); + if (attr === 'class' || attr === 'style') { + const tool = `_$bind${capitalize(attr)}`; + segmts.addImport('trebor/tools', tool); + bindExp = `${tool}('${node.getAttribute(attr) || ''}', ${bindExp})`; + } + const params = filterPlaceholders([...segmts.globals]); + const bindFunc = callExpression(bindFuncName, params); + segmts.init.push(bindFuncName); + segmts.extras.add(`${bindFuncName} = (${params.join(', ')}) => (${bindExp});`); + let toolName = ''; + let toolArgs = [varName, literal(attr), bindFunc]; + if (attr === 'value' && !/checkbox|radio/.test(type)) { + toolName = `_$${isMultiSelect ? 'bindMultiSelect' : 'bindUpdate'}`; + toolArgs = [varName, bindFunc]; + } else { + toolName = `_$${isBooleanAttr(attr) ? 'bindBooleanAttr' : 'bindUpdate'}`; + if (toolName === '_$bindUpdate' && attr === 'value') { + toolArgs = [varName, bindFunc]; + } + } + const segmt = callExpression(toolName, toolArgs); + segmts.addImport('trebor/tools',toolName); + segmts.unmount.add(segmt); + segmts.update.add(segmt); +} + +module.exports = bindAttribute; \ No newline at end of file diff --git a/src/attributes/event.ts b/src/attributes/event.ts new file mode 100644 index 0000000..aa8983b --- /dev/null +++ b/src/attributes/event.ts @@ -0,0 +1,69 @@ +import ctx from '../parsers/script/context'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { capitalize, filterPlaceholders } from '../utils'; +import { + callExpression, literal, arrowFunctionExpression, ifStatement, expressionStatement, assignmentExpression +} from '../parsers/script/nodes'; +import { BlockStatement } from '../parsers/script/estree'; + +export default function eventAttribute(node: Element, eventArgs: string, expression: string, segmts: Segments) { + const { varName } = node; + const evenArgName = '$event'; + const isComp = node.isUnknownElement; + const [eventName, ...args] = eventArgs.split('.'); + const hasStop = args.indexOf('stop'); + const hasPrevent = args.indexOf('prevent'); + const isKeyEvent = eventName.startsWith('key'); + const event = segmts.addVar(`${eventName}Event`); + const listener = `_$listener${capitalize(event, 2)}`; + let keys = null; + if (isKeyEvent && args.length) { + segmts.addImport('trebor/tools', '_$eventKeys'); + keys = callExpression('_$eventKeys', [evenArgName, ...args.reduce((params, key, i) => { + if (i !== hasPrevent && i !== hasStop) { + params.push(literal(key)); + } + return params; + }, [])]); + } + const params = filterPlaceholders([...segmts.globals]); + segmts.init.push(listener); + segmts.globalTools = (segmts.globalTools || []).concat([evenArgName, '$el']); + segmts.extras.add(`${event} = (${params.join(', ')}, ${evenArgName}${isComp ? '' : ', $el'}) => { + ${ctx(expression, segmts.globals, segmts.globalTools)}; + };`); + const handler = arrowFunctionExpression([evenArgName], []); + const { body } = handler.body; + if (!!~hasStop) { + segmts.addImport('trebor/tools', '_$eventStop'); + body.push(expressionStatement(callExpression('_$eventStop', [evenArgName]))); + } + if (!!~hasPrevent) { + segmts.addImport('trebor/tools', '_$eventPrevent'); + body.push(expressionStatement(callExpression('_$eventPrevent', [evenArgName]))); + } + params.push(evenArgName); + const eventExp = callExpression(event, isComp ? params : [...params, varName]); + if (keys) { + body.push(ifStatement(keys, [expressionStatement(eventExp)])); + } else { + body.push(expressionStatement(eventExp)); + } + + const setEvent = (eventFunc: string) => { + segmts.addImport('trebor/tools', `_$${eventFunc}`); + return callExpression(`_$${eventFunc}`, [ + varName, literal(eventName), + eventFunc === 'addEvent' ? assignmentExpression(listener, handler) : listener + ]); + }; + segmts.create.add(setEvent('addEvent')); + if (varName.startsWith('_$node')) { + segmts.addImport('trebor/tools', '_$updateEvent'); + segmts.update.add(assignmentExpression(listener, callExpression('_$updateEvent', [ + varName, literal(eventName), listener, handler + ]))); + } + segmts.destroy.add(setEvent('removeEvent')); +} diff --git a/src/attributes/reference.ts b/src/attributes/reference.ts new file mode 100644 index 0000000..d0333ea --- /dev/null +++ b/src/attributes/reference.ts @@ -0,0 +1,20 @@ +import { Segments } from '../parsers/script/segments'; +import { + callExpression, literal, assignmentExpression, memberExpression +} from '../parsers/script/nodes'; + +export default function referenceAttribute(varName: string, ref: string, segmts: Segments) { + const refVar = '_$refs'; + const initRef = assignmentExpression(refVar, memberExpression('_$ctx', refVar.slice(1))); + if (!segmts.extras.includes(initRef)) { + segmts.init.push(refVar); + segmts.extras.add(initRef); + } + const [setRef, removeRef] = ['setReference', 'removeReference'].map(func => { + const funcName = `_$${func}`; + segmts.addImport('trebor/tools', funcName); + return callExpression(funcName, [refVar, literal(ref), varName]); + }); + segmts.unmount.add(setRef); + segmts.destroy.add(removeRef); +} \ No newline at end of file diff --git a/src/component/index.ts b/src/component/index.ts new file mode 100644 index 0000000..8ce5f4f --- /dev/null +++ b/src/component/index.ts @@ -0,0 +1,112 @@ +import ctx from '../parsers/script/context'; +import { processElementSlot } from './slot'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import parseDirectives from '../parsers/script/parseDirective'; +import { capitalize, snakeToCamel, each } from '../utils'; +import { + literal, callExpression, assignmentExpression, memberExpression, arrayPattern +} from '../parsers/script/nodes'; + +const COMP_NAME = 'component'; + +export default function parseComponent(node: Element, segmts: Segments, parentVarName: string, createTpl: Function, index: number) { + const tag = node.tagName; + const isComp = tag === COMP_NAME; + const component = snakeToCamel(tag); + const varName = segmts.addVar(component); + const anchor = segmts.addVar(`${component}Anchor`); + node.varName = varName; + + let isValue: string = ''; + const isIsAttrExp = node.hasAttribute(':is'); + if (isComp) { + const isAttr = `${isIsAttrExp ? ':' : ''}is`; + isValue = node.getAttribute(isAttr); + node.removeAttribute(isAttr); + } + + let attrs = '{'; + parseDirectives(node, segmts, parentVarName, createTpl); + const extras: string[] = []; + node.attributes.forEach(({ name, value }) => { + const [type, attr] = [name[0], name.slice(1)]; + switch (type) { + case '$': + throw new Error(`Directive '${attr}' is not registered.`); + case ':': + attrs += `${snakeToCamel(attr)}() { return ${ctx(value, segmts.globals)}; },`; + break; + case '@': { + const eventVar = `event${capitalize(snakeToCamel(attr))}${capitalize(varName)}`; + segmts.init.push(eventVar); + const code = ctx(value, segmts.globals, [' $data']); + extras.push(`${eventVar} = ${varName}.$on('${attr}', $data => { ${code}; });`); + segmts.destroy.add(callExpression(memberExpression(eventVar, '$off'))); + break; + } + default: + attrs += `${snakeToCamel(name)}: '${value}'`; + break; + } + }); + attrs += '}'; + + const globName = capitalize(component); + const params = [...segmts.globals]; + const componentName = varName.replace('_$', ''); + const setComponent = `_$set${capitalize(componentName)}`; + const setAttrsComp = `_$setAttrs${capitalize(componentName)}`; + const setComponentCall = callExpression(setComponent, isIsAttrExp ? params : []); + if (isComp) { + segmts.init.push(setComponent, setAttrsComp, 'children'); + segmts.extras.add(assignmentExpression('_$children', memberExpression( + memberExpression('_$ctx', '$options'), 'children' + ))); + segmts.extras.add(`${setAttrsComp} = () => (${attrs});`); + segmts.extras.add(`${setComponent} = ${isIsAttrExp ? `(${params.join(', ')}) => { + const comp = ${ctx(isValue, segmts.globals)}; + return isString(comp) ? children[comp] : comp; + }` : `() => _$children['${isValue}']`};`); + segmts.init.push(globName); + segmts.extras.add(assignmentExpression(globName, setComponentCall)); + } else { + const init = assignmentExpression(globName, callExpression('_$getComponent', ['_$ctx', + ...(component === 'selfRef' ? [] : [literal(tag), literal(globName)]) + ])); + if (!segmts.extras.includes(init)) { + segmts.extras.add(init); + segmts.init.push(globName); + segmts.addImport('trebor/tools', '_$getComponent'); + } + } + segmts.addImport('trebor/tools', '_$callHook'); + segmts.addImport('trebor/tools', '_$addChild'); + const calls = (hook = 'destroy', params = []) => callExpression( + '_$callHook', [varName, literal(`$${hook}`), ...params] + ); + segmts.extras.add(`${varName} = _$addChild(_$ctx, ${globName}, ${isComp ? `${setAttrsComp}()` : attrs});`); + segmts.create.add(assignmentExpression(anchor, callExpression( + '_$child', index ? [parentVarName, literal(index)] : [parentVarName] + ))); + segmts.create.add(calls('create')); + extras.forEach(stmt => segmts.extras.add(stmt)); + each(node.childNodes, node => { + processElementSlot(node, segmts, varName, createTpl); + }); + segmts.unmount.add(calls('mount', [parentVarName, anchor])); + if (isComp) { + segmts.addImport('trebor/tools', '_$componentUpdate'); + const update = assignmentExpression( + arrayPattern([varName, globName]), + callExpression('_$componentUpdate', [ + '_$ctx', varName, globName, setComponentCall, + callExpression(setAttrsComp), parentVarName, anchor + ]) + ); + segmts.update.add(update); + } else { + segmts.update.add(calls('update')); + } + segmts.destroy.add(calls()); +} diff --git a/src/component/slot.ts b/src/component/slot.ts new file mode 100644 index 0000000..0de263a --- /dev/null +++ b/src/component/slot.ts @@ -0,0 +1,73 @@ +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { snakeToCamel, capitalize } from '../utils'; +import { + Identifier, CallExpression, ExpressionStatement, ArrayExpression +} from '../parsers/script/estree'; +import { + callExpression, literal, assignmentExpression, memberExpression, arrayExpression, isCallExpression, + isExpressionStatement +} from '../parsers/script/nodes'; +import ctx from '../parsers/script/context'; +import { expression } from '../parsers/script/context/expression'; +import { generate } from '../parsers/script/generator'; + +export function processSlot(node: Element, segmts: Segments, parentVarName: string, createTpl: Function) { + const slot = `_$slots`; + const init = assignmentExpression(slot, memberExpression('_$ctx', '$slots')); + const isDinamycName = node.hasAttribute(':name'); + let slotExp = node.getAttribute(`${isDinamycName ? ':' : ''}name`) || 'default'; + const slotAttr = expression(isDinamycName ? ctx(slotExp, segmts.globals, segmts.globalTools) : `'${slotExp}'`); + const dec = '_$declareSlots'; + const slotName = generate(slotAttr); + const slotDec = memberExpression(slot, slotAttr.expression, true); + if (!segmts.extras.includes(init)) { + segmts.init.push(slot); + segmts.extras.add(init); + } + let decl = segmts.extras.find(stmt => { + if (isExpressionStatement(stmt) && isCallExpression(stmt.expression)) { + return (stmt.expression.callee).name === dec; + } + return false; + }); + if (decl) { + ((decl.expression).arguments[1]).elements.push(slotAttr.expression); + } else { + segmts.addImport('trebor/tools', dec); + segmts.extras.add(callExpression(dec, [slot, arrayExpression([slotAttr.expression])])); + } + node.parentElement.removeChild(node); + const appendSlots = callExpression('_$appendSlots', [slot, parentVarName]); + let appendSlotsIndex = segmts.unmount.index(appendSlots); + if (!~appendSlotsIndex) { + segmts.addImport('trebor/tools', '_$appendSlots'); + segmts.unmount.add(appendSlots); + appendSlotsIndex = 0; + } + const html = createTpl(node.childNodes, segmts, null, slotDec); + segmts.addImport('trebor/tools', '_$initSlot'); + segmts.unmount.insert(`_$initSlot(${slot}, ${slotName}, ['${html}'])`, appendSlotsIndex); +} + +export function processElementSlot(node: Element, segmts: Segments, component: string, createTpl: Function) { + const type = node.nodeType; + if (type !== 8) { + const slotName = node.getAttribute('slot') || 'default'; + node.removeAttribute('slot'); + const slotVar = `${snakeToCamel(slotName)}${capitalize(component.replace('_$', ''))}`; + const init = assignmentExpression(slotVar, callExpression('_$emptySlot', [component, literal(slotName)])); + if (!segmts.extras.includes(init)) { + segmts.extras.add(init); + segmts.init.push(slotVar); + segmts.addImport('trebor/tools', '_$emptySlot'); + } + const slot = segmts.addVar(type === 1 ? node.tagName : 'txt'); + const _node = node.tagName === 'template' ? node : { childNodes: [node] }; + const html = createTpl(_node.childNodes, segmts, null, slot); + segmts.addImport('trebor/tools', '_$setSlotContent'); + segmts.unmount.add(`_$setSlotContent(${slotVar}, ['${html}']);`); + } +} + +module.exports = { processSlot, processElementSlot }; \ No newline at end of file diff --git a/src/directives/condition.ts b/src/directives/condition.ts new file mode 100644 index 0000000..ff76ed3 --- /dev/null +++ b/src/directives/condition.ts @@ -0,0 +1,125 @@ +import { Directive } from './index'; +import { Element } from '../parsers/html'; +import ctx from '../parsers/script/context'; +import { Segments } from '../parsers/script'; +import { + assignmentExpression, callExpression, memberExpression, thisExpression +} from '../parsers/script/nodes'; +import { each, replaceItem, replaceVar, capitalize, filterPlaceholders } from '../utils'; + +interface ConditionExpressions { + ifExp: string; + elseExp: boolean; + elseIfExps: string[]; +} + +export default function conditionDirective(node: Element, expression: string, segmts: Segments, parentVarName: string) { + const index = ++segmts.conditions; + const anchor = `_$conditionAnchor_${index}`; + const condition = `_$conditionBlock_${index}`; + replaceItem(segmts.init, node.varName, anchor); + replaceVar(segmts.create, node.varName, anchor); + segmts.variables.set(node.tagName, segmts.variables.get(node.tagName) - 1); + const params = filterPlaceholders([...segmts.globals]); + segmts.body.add(...createCondition(node, 'if', index, segmts, this)); + + const parent = node.parentElement; + segmts.addImport('trebor/tools', '_$apply'); + segmts.addImport('trebor/tools', '_$slice'); + let sibling = node.nextElementSibling; + const conditionExp: ConditionExpressions = { ifExp: expression, elseIfExps: [], elseExp: false }; + if (sibling) { + if (sibling.hasAttribute('$else-if')) { + alternativeCondition(sibling, segmts, conditionExp, index, this); + } + if (node.nextElementSibling.hasAttribute('$else')) { + const sibling = node.nextElementSibling; + conditionExp.elseExp = true; + sibling.removeAttribute('$else'); + segmts.body.add(...createCondition(sibling, 'else', index, segmts, this)); + parent.removeChild(sibling); + } else { + segmts.addImport('trebor/tools', '_$noop'); + } + } + + parent.removeChild(node); + segmts.init.push(condition); + segmts.body.add(conditionTpl(conditionExp, index, segmts.globals)); + segmts.extras.add(assignmentExpression(condition, callExpression(`_$condition_${index}`, params))); + segmts.create.add(callExpression(memberExpression(condition, '$create'))); + segmts.unmount.add(callExpression(memberExpression(condition, '$mount'), [parentVarName, anchor])); + segmts.update.add(assignmentExpression(condition, callExpression('_$conditionalUpdate', [ + condition, `_$condition_${index}`, anchor, ...params + ]))); + segmts.destroy.add(callExpression(memberExpression(condition, '$destroy'))); + this.tools = tools; +} + +function alternativeCondition(node: Element, segmts: Segments, conditionExp: ConditionExpressions, index: number, directive: Directive) { + conditionExp.elseIfExps.push(node.getAttribute('$else-if')); + node.removeAttribute('$else-if'); + let sibling = node.nextElementSibling; + const condition = `elseIf_${conditionExp.elseIfExps.length}`; + segmts.body.add(...createCondition(node, condition, index, segmts, directive)); + if (sibling && sibling.hasAttribute('$else-if')) { + alternativeCondition(sibling, segmts, conditionExp, index, directive); + } + node.parentElement.removeChild(node); +} + +function createCondition(node: Element, type: string, index: number, segmts: Segments, directive: Directive) { + const subSegmts = new Segments(segmts); + const condType = type ? type : 'else'; + const _node = node.tagName === 'template' ? node : { childNodes: [node] }; + const condName = type.includes('elseIf') ? 'Condition' : capitalize('condition'); + subSegmts.globals = new Set(filterPlaceholders([...segmts.globals])); + subSegmts.destroy.replace(callExpression(memberExpression(thisExpression(), '$unmount'))); + const conditionName = `${condType}${condName}_${index}`; + const conditionFunc = (directive.createTpl)(_node.childNodes, subSegmts, conditionName); + + segmts.loops = subSegmts.loops; + segmts._imports = subSegmts._imports; + segmts.conditions = subSegmts.conditions; + + return conditionFunc; +} + +function conditionTpl({ ifExp, elseIfExps, elseExp }, index: number, parameters: Set) { + const funcName = `Condition_${index}`; + const params = filterPlaceholders([...parameters]).join(', '); + let condition = `function _$${funcName.toLowerCase()}(${params}) { + let condition = null; + if (${ctx(ifExp, parameters)}) { + condition = _$if${funcName}(${params}); + condition.type = 'if'; + }\n`; + each(elseIfExps, (elseIfCond, i) => { + condition += `else if (${ctx(elseIfCond, parameters)}) { + condition = _$elseIf_${i + 1}${funcName}(${params}); + condition.type = 'elseIf_${i + 1}'; + }\n`; + }); + condition += `else { + condition = ${elseExp ? `_$else${funcName}(${params})` : '_$emptyElse()'}; + condition.type = 'else'; + }\n`; + condition += `return condition;\n}`; + return condition; +} + +let tools = `function _$conditionalUpdate(block, condition, anchor) { + const params = _$slice(arguments, 3); + if (block && block.type === _$apply(condition, params).type) { + block.$update(...params); + } else { + block && block.$destroy(); + block = _$apply(condition, params); + block.$create(); + block.$mount(anchor.parentElement || params[0].$parentEl, anchor); + } + return block; +} +function _$emptyElse() { + return { $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop }; +}`; diff --git a/src/directives/html.ts b/src/directives/html.ts new file mode 100644 index 0000000..9c6d0cf --- /dev/null +++ b/src/directives/html.ts @@ -0,0 +1,29 @@ +import ctx from '../parsers/script/context'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { capitalize, filterPlaceholders } from '../utils'; +import { callExpression, literal } from '../parsers/script/nodes'; + +export default function htmlDirective(node: Element, expression: string, segmts: Segments) { + const { varName } = node; + if (expression) { + const setContent = `_$content${capitalize(varName, 2)}`; + const params = filterPlaceholders([...segmts.globals]); + const content = callExpression(setContent, params); + segmts.init.push(setContent); + segmts.extras.add(`${setContent} = (${params.join(', ')}) => ${ctx(expression, segmts.globals)};`); + segmts.update.add(callExpression('_$htmlUpdate', [varName, content])); + segmts.unmount.add(callExpression('_$htmlUpdate', [varName, content])); + segmts.addImport('trebor/tools', '_$toString'); + this.tools = `function _$htmlUpdate(node, value) { + if (node.innerHTML !== (value = _$toString(value))) { + node.innerHTML = value; + } + }`; + } else { + this.tools = `function _$htmlValue(node, value) { + node.innerHTML = value; + }`; + segmts.unmount.add(callExpression('_$htmlValue', [varName, literal(node.innerHTML)])); + } +} diff --git a/src/directives/index.ts b/src/directives/index.ts new file mode 100644 index 0000000..c8b2a8f --- /dev/null +++ b/src/directives/index.ts @@ -0,0 +1,90 @@ +import tag from './tag'; +import loop from './loop'; +import show from './show'; +import name from './name'; +import html from './html'; +import value from './value'; +import condition from './condition'; +import { Element } from '../parsers/html/element'; +import { Statement } from '../parsers/script/estree'; +import { Segments } from '../parsers/script/segments'; + +interface Directive { + attr: string; + tools: string; + priority: number; + action(node: Element, expression: string, segmts: Segments, parentVarName: string): void; + reference?: true; + walkChildren?: false; + ctx?(source: string, params?: Set, extras?: string[]): string; + createTpl?(nodes: Element[], segmts: Segments, tplName?: string, varName?: string): string | Statement[]; +} + +let directives: Directive[] = [ + { + attr: 'for', + tools: '', + priority: -2, + action: loop, + reference: true + }, + { + attr: 'if', + tools: '', + priority: -1, + action: condition, + reference: true + }, + { + attr: 'value', + tools: '', + priority: 10, + action: value + }, + { + attr: 'name', + tools: '', + priority: 10, + action: name + }, + { + attr: 'tag', + tools: '', + priority: 10, + action: tag + }, + { + attr: 'html', + tools: '', + priority: -1, + action: html, + walkChildren: false + }, + { + attr: 'show', + tools: '', + priority: 10, + action: show + } +]; + +export { Directive, directives }; + +export default function prepareDirectives(customeDirectives: Directive[]) { + directives = customeDirectives.concat(directives); + + directives.sort((a, b) => a.priority - b.priority); + + const specialAttrs: string[] = []; + const nonWalkAttrs: string[] = []; + + directives.forEach(directive => { + if (directive.reference === true) { + specialAttrs.push(directive.attr); + nonWalkAttrs.push(directive.attr); + } else if (directive.walkChildren === false) { + nonWalkAttrs.push(directive.attr); + } + }); + return { specialAttrs, nonWalkAttrs }; +} diff --git a/src/directives/loop.ts b/src/directives/loop.ts new file mode 100644 index 0000000..9b92006 --- /dev/null +++ b/src/directives/loop.ts @@ -0,0 +1,90 @@ +import ctx from '../parsers/script/context'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { replaceItem, replaceVar, filters, filterPlaceholders } from '../utils'; +import { callExpression, memberExpression, thisExpression } from '../parsers/script/nodes'; + +export default function loopDirective(node: Element, expression: string, segmts: Segments, parentVarName: string) { + this.tools = tools; + const loopIndex = ++segmts.loops; + const loopItem = `loop_${loopIndex}`; + const loop = `_$loopBlock_${loopIndex}`; + const anchor = `_$loopAnchor_${loopIndex}`; + replaceItem(segmts.init, node.varName, anchor); + replaceVar(segmts.create, node.varName, anchor); + segmts.variables.set(node.tagName, segmts.variables.get(node.tagName) - 1); + segmts.addImport('trebor/tools', '_$each'); + segmts.addImport('trebor/tools', '_$slice'); + segmts.addImport('trebor/tools', '_$apply'); + + let [iterator, variable] = expression.split(' in '); + const [value, key, index] = iterator.split(',').map(v => v.replace(/[()]/g, '').trim()); + let [asNumber, ...rest] = variable.split('\|'); + let [start, end] = asNumber.split('..'); + if (!isNaN(+start)) { + let length = (+end || 0) - (+start); + let array = [...Array(length > 0 ? length : -length)].map((_, i) => end ? i + (+start) : i); + variable = [`[${array.join(', ')}]`, ...rest].join('|'); + } + const args = filterPlaceholders([...segmts.globals].slice(1)); + const params = args ? `, ${args.join(', ')}` : ''; + const code = ctx(filters(variable, segmts), segmts.globals, segmts.globalTools); + + segmts.init.push(loop); + segmts.extras.add(`${loop} = _$forLoop(_$ctx, ${code}, _$${loopItem}${params});`); + segmts.create.add(callExpression(memberExpression(loop, '$create'))); + segmts.unmount.add(callExpression(memberExpression(loop, '$mount'), [parentVarName, anchor])); + segmts.update.add(`${loop}.$update(_$ctx, ${code}${params});`); + segmts.destroy.add(callExpression(memberExpression(loop, '$destroy'))); + + const subSegmts = new Segments(segmts); + const _node = node.tagName === 'template' ? node : { childNodes: [node] }; + + subSegmts.globals.add(value).add(key || '_$v').add(index || '_$i'); + args.forEach(arg => subSegmts.globals.add(arg)); + subSegmts.destroy.replace(callExpression(memberExpression(thisExpression(), '$unmount'))); + const loopItemFunc = this.createTpl(_node.childNodes, subSegmts, loopItem); + + segmts.loops = subSegmts.loops; + segmts.body.add(...loopItemFunc); + segmts._imports = subSegmts._imports; + segmts.conditions = subSegmts.conditions; +} + +const tools = `function _$forLoop(ctx, list, loop) { + const items = {}; + const globs = _$slice(arguments, 3); + let loopParent, loopSibling; + _$each(list, (item, key, index) => { items[key] = _$apply(loop, [ctx, item, key, index], globs); }); + return { + $create() { + _$each(items, item => { item.$create(); }); + }, + $mount(parent, sibling) { + loopParent = _$(parent); + loopSibling = _$(sibling); + _$each(items, item => { item.$mount(loopParent, loopSibling); }); + }, + $update(ctx, obj) { + const globs = _$slice(arguments, 2); + _$each(items, (item, key, index) => { + if (obj[key]) { + _$apply(item.$update, [ctx, obj[key], key, index], globs, item); + } else { + item.$destroy(); + delete items[key]; + } + }); + _$each(obj, (item, key, index) => { + if (!items[key]) { + items[key] = _$apply(loop, [ctx, item, key, index], globs); + items[key].$create(); + items[key].$mount(loopParent, loopSibling); + } + }); + }, + $destroy() { + _$each(items, item => { item.$destroy(); }); + } + }; +}`; diff --git a/src/directives/name.ts b/src/directives/name.ts new file mode 100644 index 0000000..f9793e0 --- /dev/null +++ b/src/directives/name.ts @@ -0,0 +1,35 @@ +import eventAttr from '../attributes/event'; +import bindAttr from '../attributes/binding'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; + +export default function nameDirective(node: Element, group: string, segmts: Segments) { + const type = node.getAttribute('type'); + if (/checkbox|radio/.test(type) && node.tagName === 'input') { + const { varName } = node; + let bindExp = '', eventExp = ''; + segmts.addImport('trebor/tools', '_$attr'); + if (type === 'checkbox') { + this.tools = tools; + segmts.globalTools.push('_$bindGroup', '_$attr', varName); + eventExp = `_$bindGroup($el, ${group})`; + bindExp = `!!~${group}.indexOf(_$attr(${varName}))`; + } else { + segmts.globalTools.push('_$attr', varName); + eventExp = `${group} = $el.checked ? _$attr($el) : ${group}`; + bindExp = `${group} === _$attr(${varName})`; + } + bindAttr(node, 'checked', bindExp, segmts); + eventAttr(node, 'change', eventExp, segmts); + } +} + +const tools = `function _$bindGroup(input, selection) { + const _value = _$attr(input); + const index = selection.indexOf(_value); + if (input.checked && !~index) { + selection.push(_value); + } else { + selection.splice(index, 1); + } +}`; diff --git a/src/directives/show.ts b/src/directives/show.ts new file mode 100644 index 0000000..e1f65d7 --- /dev/null +++ b/src/directives/show.ts @@ -0,0 +1,33 @@ +import ctx from '../parsers/script/context'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { capitalize, filterPlaceholders } from '../utils'; +import { callExpression } from '../parsers/script/nodes'; + +export default function showDirective(node: Element, expression: string, segmts: Segments) { + this.tools = tools; + const { varName } = node; + const funcName = `_$show${capitalize(varName, 2)}`; + const varDisplay = `_$display${capitalize(varName, 2)}`; + const [scope, ...params] = filterPlaceholders([...segmts.globals]); + segmts.init.push(varDisplay); + segmts.addImport('trebor/tools', '_$toString'); + segmts.update.add(callExpression(funcName, [scope, varName, varDisplay, ...params])); + segmts.extras.add(`const ${funcName} = (${scope}, $el, $display${toParams(params)}) => { + _$showValue($el, ${ctx(expression, segmts.globals)} ? $display : 'none'); + };`); + segmts.unmount.add(`${varDisplay} = _$showValue(${varName});`); + segmts.unmount.add(`${funcName}(${scope}, ${varName}, ${varDisplay}${toParams(params)});`); +} + +function toParams(params: string[]) { + return params.length ? `, ${params.join(', ')}` : ''; +} + +const tools = `function _$showValue(node, value) { + const style = node.style; + if (style.display !== value) { + style.display = _$toString(value); + } + return style.display; +}`; diff --git a/src/directives/tag.ts b/src/directives/tag.ts new file mode 100644 index 0000000..67c85b2 --- /dev/null +++ b/src/directives/tag.ts @@ -0,0 +1,41 @@ +import ctx from '../parsers/script/context'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; +import { CallExpression, Literal } from '../parsers/script/estree'; +import { replaceItem, replaceVar, capitalize, filters, filterPlaceholders } from '../utils'; +import { callExpression, assignmentExpression, literal } from '../parsers/script/nodes'; + +export default function tagDirective(node: Element, expression: string, segmts: Segments) { + if (expression) { + const varName = segmts.addVar('node'); + replaceItem(segmts.init, node.varName); + replaceVar(segmts.create, node.varName, varName); + segmts.variables.set(node.tagName, segmts.variables.get(node.tagName) - 1); + node.varName = varName; + this.tools = tools; + const setElement = `_$setTag${capitalize(varName, 2)}`; + segmts.init.push(setElement); + const code = ctx(filters(expression, segmts), segmts.globals); + const params = filterPlaceholders([...segmts.globals]); + const setTag = callExpression(setElement, params); + const setTagNode = (tag: CallExpression | Literal) => assignmentExpression( + varName, callExpression('_$tagUpdate', [varName, tag]) + ); + segmts.extras.add(`${setElement} = (${params.join(', ')}) => ${code};`); + segmts.update.add(setTagNode(setTag)); + segmts.unmount.add(setTagNode(literal(node.tagName))); + } +} + +const tools = `function _$tagUpdate(node, tag) { + if (tag.toUpperCase() !== node.tagName) { + const _node = document.createElement(tag); + const childNodes = node.childNodes, attributes = node.attributes; + _$each(childNodes, node => _$append(_node, node)); + _$each(attributes, ({ name, value }) => _node.setAttributeNS(node.namespaceURI, name, value)); + node.parentElement.replaceChild(_node, node); + return _node; + } else { + return node; + } +}`; diff --git a/src/directives/value.ts b/src/directives/value.ts new file mode 100644 index 0000000..31862d9 --- /dev/null +++ b/src/directives/value.ts @@ -0,0 +1,47 @@ +import eventAttr from '../attributes/event'; +import bindAttr from '../attributes/binding'; +import { Element } from '../parsers/html/element'; +import { Segments } from '../parsers/script/segments'; + +export default function valueDirective(node: Element, expression: string, segmts: Segments) { + let exp = ''; + let event = ''; + let attr = 'value'; + const { varName } = node; + const type = node.getAttribute('type'); + const isMultiSelect = /select/.test(node.tagName) && node.hasAttribute('multiple'); + if (/input|select|textarea/.test(node.tagName) && !/checkbox|radio/.test(type)) { + event = /date|file/.test(type) || node.tagName === 'select' ? 'change' : 'input'; + exp = getExpresion.call(this, varName, expression, type, isMultiSelect, segmts); + } else if (node.tagName === 'input' && /checkbox|radio/.test(type)) { + attr = 'checked'; + event = 'change'; + exp = `${expression} = $el.checked`; + } else { + event = `update_${attr}`; + exp = `${expression} = $event`; + } + eventAttr(node, event, exp, segmts); + bindAttr(node, attr, expression, segmts); +} + +const tools = `function _$updateMultiSelect(select, component, prop) { + const items = []; + const selection = component[prop]; + const selectedOptions = select.selectedOptions; + _$each([...selectedOptions], option => items.push(_$attr(option))) + component[prop] = new List(items, selection._root, selection._key); + component.$update(); +}`; + +function getExpresion(varName: string, expression: string, type: string, isMultiSelect: boolean, segmts: Segments) { + let exp = ''; + if (isMultiSelect) { + this.tools = tools; + exp = `_$updateMultiSelect(${varName}, _$ctx, '${expression}')`; + segmts.globalTools.push('_$updateMultiSelect'); + } else { + exp = `${expression} = ${/number|range/.test(type) ? '+' : ''}$el.value`; + } + return exp; +} diff --git a/src/generators/attributes.ts b/src/generators/attributes.ts deleted file mode 100644 index 2076ae3..0000000 --- a/src/generators/attributes.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Attribute } from 'parse5'; -import { genEvent } from './events'; -import { genBind } from './bindings'; -import { kebabToCamelCases } from '../utilities/tools'; -import { BlockAreas, NodeElement } from '../utilities/classes'; -import { genShow, genDirective, genValue, genName, genRefs } from './directives'; - -export function genSetAttrs(target: string, node: NodeElement, scope: string, areas: BlockAreas) { - const attrs = sortAttrs(node.attributes); - let { length } = attrs; - for (let i = 0; i < length; i++) { - const { name, value } = attrs[i]; - let [attr] = name.split('.'); - if (attr === '$show') { - genShow(target, node, areas, scope); - } else if (attr === '$value' || attr === '$name') { - if (attr === '$value') { - node.removeAttribute('$name'); - genValue(target, node, areas, scope); - } else if (!node.hasAttribute('$value') && attr === '$name') { - genName(target, node, areas, scope); - } - } else if (attr[0] === '$') { - genDirective(target, name.slice(1), value, areas, scope); - } else if (attr[0] === '@') { - genEvent(target, name.slice(1), value, areas, scope); - } else if (attr[0] === ':') { - const type = node.getAttribute('type'); - const classes = node.getAttribute('class'); - if (node.hasAttribute('class') && attr.slice(1) === 'class') node.removeAttribute('class'); - genBind(target, attr.slice(1), value, areas, scope, type || null, classes || null); - } else if (attr[0] === '#') { - genRefs(scope, areas, kebabToCamelCases(name.slice(1)), target); - } else { - areas.hydrate.push(`_$setAttr(${target}, ['${attr}', ${value ? `'${value}'` : `''`}]);`); - } - if (length !== attrs.length) { - i--; - length = attrs.length; - } - } -} - -function sortAttrs(attrs: Attribute[]) { - let attrRegExp = /^[$@:#]/; - return attrs.sort((a, b) => attrRegExp.test(a.name) && !attrRegExp.test(b.name) ? 1 : - !attrRegExp.test(a.name) && attrRegExp.test(b.name) ? -1 : 0); -} \ No newline at end of file diff --git a/src/generators/bindings.ts b/src/generators/bindings.ts deleted file mode 100644 index fbf5983..0000000 --- a/src/generators/bindings.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ctx } from '../utilities/context'; -import { BlockAreas } from '../utilities/classes'; -import { capitalize, filterParser, toMap } from '../utilities/tools'; - -const isBooleanAttr = toMap(`allowfullscreen,async,autofocus,autoplay,checked,compact,controls, -declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate, -hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate, -nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate, -truespeed,typemustmatch,visible`); - -export function genBind(variable: string, attr: string, expression: string, areas: BlockAreas, scope: string, type: string, classes: string) { - [scope] = scope.split(', '); - const globals = [variable, '_$getAttr']; - const bindFuncName = `bind${capitalize(attr)}${capitalize(variable)}`; - const isSelMulti = /select/.test(variable) && type === 'multiple'; - let params = areas.globals.length > 0 ? `, ${areas.globals.join(', ')}` : ''; - let bindExp = expression === null ? 'true' : `${ctx(filterParser(expression), scope, areas.globals.concat(globals))}`; - if (attr === 'class' || attr === 'style') { - bindExp = attr === 'style' ? - `_$bindStyle(${bindExp})` : `(${classes ? `'${classes} ' + ` : ''}_$bindClasses(${bindExp})).trim()`; - } - areas.variables.push(bindFuncName); - areas.extras.push(`${bindFuncName} = (${scope}${params}) => (['${attr}', ${bindExp}]);`); - let bindFunc = `${bindFuncName}(${scope}${params})`; - if (attr === 'value' && /input|select|textarea/.test(variable) && !/checkbox|radio/.test(type)) { - if (isSelMulti) { - areas.update.push(`_$bindMultiSelect(${variable}, ${bindFunc}[1]);`); - areas.unmount.push(`_$bindMultiSelect(${variable}, ${bindFunc}[1]);`); - } else { - areas.hydrate.push(`${variable}.value = _$toString(${bindFunc}[1]);`); - } - } else if (isBooleanAttr(attr)) { - areas.update.push(`_$bindBooleanAttr(${variable}, ${bindFunc});`); - areas.hydrate.push(`_$bindBooleanAttr(${variable}, ${bindFunc});`); - } else { - areas.hydrate.push(`_$setAttr(${variable}, ${bindFunc});`); - } - !isSelMulti && !isBooleanAttr(attr) && areas.update.push(`_$bindUpdate(${variable}, ${bindFunc});`); -} diff --git a/src/generators/commons.ts b/src/generators/commons.ts deleted file mode 100644 index 98cfcbd..0000000 --- a/src/generators/commons.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { genIf } from './conditions'; -import { genForItem } from './loops'; -import { genHtml } from './directives'; -import { ctx } from '../utilities/context'; -import { genSetAttrs } from './attributes'; -import { AllHtmlEntities } from 'html-entities'; -import { genSlot, genComponent, genTag } from './components'; -import { NodeElement, BlockAreas } from '../utilities/classes'; -import { - getVarName, capitalize, createNode, createElement, escapeExp, filterParser, clearText -} from '../utilities/tools'; - -const entities = new AllHtmlEntities(); - -export function genBlockAreas(node: NodeElement, areas: BlockAreas, scope: string) { - if (node.nodeType === 3) { - let variable = ''; - if (node.hasExpression()) { - [scope] = scope.split(','); - variable = getVarName(areas.variables, 'txt'); - const setVariable = `set${capitalize(variable)}`; - areas.variables.push(setVariable); - const code = node.textContent.split(/(\{\{\s*(?:(?!\}\})(?:.|\n))*\}\})/).map(int => { - if (int.startsWith('{{') && int.endsWith('}}')) { - int = int.replace(/\{\{(\s*((?!\}\})(.|\n))*)\}\}/g, (_, replacer: string) => replacer.trim()); - return `(${ctx(filterParser(int), scope, areas.globals)})`; - } - return `'${clearText(entities.decode(int))}'`; - }).join('+').replace(/^'\s*'\+/, '').replace(/\+'\s*'$/, ''); - let params = areas.globals && areas.globals.length > 0 ? `, ${areas.globals.join(', ')}` : ''; - const setTxt = `${setVariable}(${scope}${params})`; - areas.extras.push(`${setVariable} = (${scope}${params}) => ${code};`); - areas.create.push(`${createNode(variable)} - ${variable}.data = ${setTxt};`); - areas.update.push(`_$textUpdate(${variable}, ${setTxt});`); - return variable; - } else { - variable = getVarName(areas.variables, 'txt'); - areas.create.push(createNode(variable, `'${clearText(entities.decode(node.textContent))}'`)); - return variable; - } - } else if (node.nodeType === 1) { - switch (true) { - case node.hasAttribute('$for') && !node.hasAttribute('$if'): - return genForItem(node, areas, scope); - case node.hasAttribute('$if'): - return genIf(node, areas, scope); - case !node.hasExpression() || node.hasAttribute('$html') && !node.getAttribute('$html'): - return genHtml(node, areas); - case node.hasAttribute('$html') && !!node.getAttribute('$html'): - return genHtml(node, areas, scope); - case node.tagName === 'slot': - return genSlot(node, areas, scope); - case node.isUnknownElement: - return genComponent(node, areas, scope); - default: - const tag = node.tagName; - const isTpl = tag === 'template'; - const isBlock = node.isBlock; - let variable = getVarName(areas.variables, tag); - node.varName = variable; - if (node.hasAttribute('$tag')) { - areas.variables.pop(); - variable = genTag(node, areas, scope); - delete node.varName; - } else if (!isTpl || !isBlock) { - areas.create.push(createElement(variable, tag, node.isSVGElement)); - } - let childNodes: NodeElement[] = node.childNodes; - if (isTpl) { - childNodes = node.content.childNodes; - } - let { length } = childNodes; - for (let i = 0; i < length; i++) { - const n = childNodes[i]; - const el = genBlockAreas(n, areas, scope); - if (el) { - areas.unmount.push(`_$append(${variable}${isTpl && !isBlock ? '.content' : ''}, ${el});`); - } - if (length !== childNodes.length) { - i--; - length = childNodes.length; - } - } - genSetAttrs(variable, node, scope, areas); - if (isTpl && areas.create.length === 0) { - areas.variables.splice(areas.variables.indexOf(variable), 1); - variable = ''; - } - return variable; - } - } else if (node.nodeType === 8) { - const variable = getVarName(areas.variables, 'comment'); - areas.create.push(createNode(variable, `'${escapeExp(node.textContent).replace(/'/g, `\\'`)}'`)); - return variable; - } -} - -export function genBody(funcName: string, scope: string, areas: BlockAreas, condType?: string) { - return `${!areas.outer.length ? '' : `${areas.outer.join('\n')} - `}function ${funcName}(${scope}) { - let { children } = ${scope.split(',')[0]}.$options; - ${!areas.variables.length ? '' : `let ${areas.variables.join(', ')}`};${!areas.extras.length ? '' : ` - ${areas.extras.join('\n')}`} - return { - ${!condType ? '' : `type: '${condType}' - ,`}$create${!!areas.create.length ? `() { - ${areas.create.join('\n')}${!areas.hydrate.length ? '' : ` - ${areas.hydrate.join('\n')}`} - }` : ': _$noop'}, - $mount(parent, sibling) { - this.$unmount(); - ${areas.mount.join('\n')}${!areas.mountDirt.length ? '' : ` - ${areas.mountDirt.join('\n')}`} - ${condType || scope.includes(',') ? '' : `_$setElements(this, parent, sibling);`} - }, - $update${!!areas.update.length ? `(${scope}) { - ${areas.update.join('\n')} - }` : ': _$noop'}, - $unmount${!!areas.unmount.length ? `() { - ${areas.unmount.join('\n')} - }` : ': _$noop'}, - $destroy() { - ${condType || scope.includes(',') ? 'this.$unmount();' : `_$destroyComponent(this);`} - ${areas.destroy.join('\n')} - ${areas.variables.join(' = ')} = void 0; - } - }; - }`; -} diff --git a/src/generators/components.ts b/src/generators/components.ts deleted file mode 100644 index 99c000b..0000000 --- a/src/generators/components.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { genBlockAreas } from './commons'; -import { ctx } from '../utilities/context'; -import { genSetAttrs } from './attributes'; -import { genDirective } from './directives'; -import { NodeElement, BlockAreas } from '../utilities/classes'; -import { kebabToCamelCases, getVarName, capitalize, createElement, filterParser, toMap } from '../utilities/tools'; - -const buildinDirective = toMap(`for,if,value,name,show,html`); - -export function genTag(node: NodeElement, areas: BlockAreas, scope: string) { - [scope] = scope.split(','); - let element = getVarName(areas.variables, '_$node'); - const expression = node.getAttribute('$tag'); - node.removeAttribute('$tag'); - if (node.childNodes.length) node.dymTag = element; - if (expression) { - const setElement = `setTag${capitalize(element)}`; - areas.variables.push(setElement); - const code = ctx(filterParser(expression), scope, areas.globals); - let params = areas.globals && areas.globals.length > 0 ? `, ${areas.globals.join(', ')}` : ''; - const setTag = `${setElement}(${scope}${params})`; - areas.extras.push(`${setElement} = (${scope}${params}) => ${code};`); - areas.create.push(`${element} = _$el(${setTag});`); - areas.update.push(`${element} = _$tagUpdate(${element}, ${setTag});`); - } else { - element = getVarName(areas.variables, node.tagName); - } - return element; -} - -export function genSlot(node: NodeElement, areas: BlockAreas, scope: string) { - const slotName = node.getAttribute('name') || 'default'; - const slot = `_$slots`; - const slotDec = `${slot}['${slotName}']`; - const init = `const ${slot} = ${scope.split(', ')[0]}.$slots;`; - !areas.extras.includes(init) && areas.extras.push(init); - let dec = areas.extras.find(extra => extra.startsWith('_$declareSlots(_$slots, [')); - if (dec) { - let index = areas.extras.indexOf(dec); - dec = dec.replace(']);', `, '${slotName}']);`); - areas.extras.splice(index, 1, dec); - } else { - areas.extras.push(`_$declareSlots(${slot}, ['${slotName}']);`); - } - const roots: string[] = []; - node.childNodes.forEach(n => { - const el = genBlockAreas(n, areas, scope); - if (el) { - roots.push(el); - areas.unmount.push(`_$appendToSlot(${slot}, '${slotName}', ${el});`); - } - }); - const parent = node.parentElement; - let root = parent.dymTag ? parent.dymTag : parent.varName; - areas.unmount.push(`_$append(${root || '_$frag'}, ${slotDec});`); -} - -function genSlotElement(node: NodeElement, areas: BlockAreas, scope: string, variable: string) { - const type = node.nodeType; - if (type !== 8) { - const tag = node.tagName; - const slot = type > 1 ? genBlockAreas(node, areas, scope) : getVarName(areas.variables, tag); - const slotName = node.getAttribute('slot') || 'default'; - const slotVar = `${kebabToCamelCases(slotName)}_${variable}`; - const init = `const ${slotVar} = _$emptySlot(${variable}, '${slotName}');`; - !areas.extras.includes(init) && areas.extras.push(init); - if (type === 1) { - if (tag !== 'template') { - areas.create.push(createElement(slot, tag, node.isSVGElement)); - } else { - areas.create.push(`${slot} = _$docFragment();`); - node.appendChild(node.content); - } - node.childNodes.forEach(child => { - const el = genBlockAreas(child, areas, scope); - el && areas.unmount.push(`_$append(${slot}, ${el});`); - }); - genSetAttrs(slot, node, scope, areas); - } - areas.unmount.push(`${slotVar} && _$append(${slotVar}, ${slot});`); - } -} - -export function genComponent(node: NodeElement, areas: BlockAreas, scope: string) { - const tag = node.tagName; - let params: string[] = []; - [scope, ...params] = scope.split(', '); - const varName = kebabToCamelCases(tag); - const anchor = getVarName(areas.variables, `${varName}Anchor`); - const variable = getVarName(areas.variables, varName); - const parent = node.parentElement; - let root = parent.dymTag ? parent.dymTag : parent.varName; - let attrs = '{'; - const extras: string[] = []; - let isValue: string; - let isIsAttrExp = node.hasAttribute(':is'); - if (varName === 'component') { - let isAttr = `${isIsAttrExp ? ':' : ''}is`; - isValue = node.getAttribute(isAttr); - node.removeAttribute(isAttr); - } - node.attributes.forEach(({ name, value }) => { - if (name[0] === '@') { - const eventVar = `event${capitalize(kebabToCamelCases(name.slice(1)))}${capitalize(variable)}`; - areas.variables.push(eventVar); - extras.push(`${eventVar} = ${variable}.$on('${name.slice(1)}', $data => { ${ctx(value, scope, params)}; });`); - areas.destroy.push(`${eventVar}.$off();`); - } else if (name[0] === ':') { - attrs += `${kebabToCamelCases(name.slice(1))}() { return ${ctx(value, scope, params)}; },`; - } else if (name[0] === '$' && !buildinDirective(name.slice(1))) { - genDirective(variable, name.slice(1), value, areas, scope); - } else { - attrs += `${kebabToCamelCases(name)}: '${value}'`; - } - }); - attrs += '}'; - let globCompName = capitalize(varName); - let init = `const `; - let setComponent = `set${capitalize(variable)}`; - let setAttrsComponent = `setAttrs${capitalize(variable)}`; - let setComponentCall = `${setComponent}(${isIsAttrExp ? [scope, ...params].join(', ') : ''})`; - if (varName === 'component') { - globCompName = capitalize(variable); - areas.variables.push(setComponent, setAttrsComponent); - areas.extras.push(`${setAttrsComponent} = () => (${attrs}); - ${setComponent} = ${isIsAttrExp ? `(${[scope, params].join(', ')}) => { - let comp = ${ctx(isValue, scope, areas.globals.concat(params))}; - return _$isType(comp, 'string') ? children[comp] : comp; - }` : `() => children['${isValue}']`};`); - init += `${globCompName} = ${setComponentCall};`; - areas.extras.push(`${init} - ${anchor} = _$text(); - ${variable} = _$addChild(${scope}, ${globCompName}, ${setAttrsComponent}());`); - } else { - init += `${globCompName} = ${varName === 'selfRef' ? `${scope}.constructor` : `children['${tag}'] || window.${globCompName}`};`; - !areas.extras.includes(init) && areas.extras.push(init); - areas.extras.push(`${anchor} = _$text(); - ${variable} = _$addChild(${scope}, ${globCompName}, ${attrs});`); - } - areas.create.push(`${variable}.$create();`); - areas.extras = areas.extras.concat(extras); - areas.unmount.push(`_$append(${root || '_$frag'}, ${anchor});`); - node.childNodes.forEach(n => { - genSlotElement(n, areas, scope, variable); - }); - areas.unmount.push(`${variable}.$mount(${root || '_$frag'}, ${anchor});`); - if (varName === 'component') { - areas.update.push(`[${variable}, ${globCompName}] = _$componentUpdate(${scope}, - ${globCompName}, - ${variable}, - ${setComponentCall}, - ${setAttrsComponent}(), - ${root}, - ${anchor});`); - } else { - areas.update.push(`${variable} && ${variable}.$update();`); - } - areas.destroy.push(`${variable} && ${variable}.$destroy();`); -} \ No newline at end of file diff --git a/src/generators/conditions.ts b/src/generators/conditions.ts deleted file mode 100644 index 04cba2b..0000000 --- a/src/generators/conditions.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { ctx } from '../utilities/context'; -import { genBlockAreas, genBody } from './commons'; -import { getVarName, capitalize } from '../utilities/tools'; -import { NodeElement, BlockAreas, Condition } from '../utilities/classes'; - -export function genIf(node: NodeElement, areas: BlockAreas, scope: string) { - areas.conditions = areas.conditions + 1; - const ifCond = ctx(node.getAttribute('$if'), scope.split(',')[0], areas.globals || []); - const condition: Condition = { ifCond, index: areas.conditions }; - const anchor = getVarName(areas.variables, 'conditionAnchor'); - const block = getVarName(areas.variables, 'conditionBlock'); - const parent = node.parentElement; - let root = parent.dymTag ? parent.dymTag : parent.varName; - areas.unmount.push(`_$append(${root || '_$frag'}, ${anchor});`); - node.removeAttribute('$if'); - areas.outer.push(genItemCondition(scope, node, areas, condition.index, 'if')); - areas.extras.push(`${anchor} = _$text();`); - areas.create.push(`${block} = condition_${condition.index}(${scope});`); - if (node.nextElementSibling) { - if (node.nextElementSibling.hasAttribute('$else-if')) { - genElseIf(scope, node.nextElementSibling, condition, areas); - } - if (node.nextElementSibling.hasAttribute('$else')) { - const sibling = node.nextElementSibling; - condition.elseCond = condition.elseCond || true; - sibling.removeAttribute('$else'); - areas.outer.push(genItemCondition(scope, sibling, areas, condition.index, 'else')); - parent.removeChild(sibling); - } - } - parent.removeChild(node); - areas.outer.push(genCondition(scope, condition, condition.index)); - areas.create.push(`${block}.$create();`); - areas.unmount.push(`${block}.$mount(${root || '_$frag'}, ${anchor});`); - areas.update.push(`${block} = _$conditionalUpdate(${block}, condition_${condition.index}, ${root}, ${anchor}, ${scope});`); - areas.destroy.push(`${block}.$destroy();`); -} - -function genElseIf(scope: string, node: NodeElement, condition: Condition, areas: BlockAreas) { - const elseifCond = ctx(node.getAttribute('$else-if'), scope, []); - condition.elseIfConds = condition.elseIfConds || []; - condition.elseIfConds.push(elseifCond); - node.removeAttribute('$else-if'); - areas.outer.push(genItemCondition(scope, node, areas, condition.index, `elseIf_${condition.elseIfConds.length}`)); - if (node.nextElementSibling.hasAttribute('$else-if')) { - genElseIf(scope, node.nextElementSibling, condition, areas); - } - node.parentElement.removeChild(node); -} - -function genItemCondition(scope: string, node: NodeElement, areas: BlockAreas, index: number, type?: string) { - const subareas: BlockAreas = new BlockAreas(areas.loops, areas.conditions); - subareas.globals = areas.globals; - subareas.variables.push('_$frag'); - subareas.extras.push('_$frag = _$docFragment();'); - node.isBlock = true; - let condition = genBlockAreas(node, subareas, scope); - delete node.isBlock; - areas.loops = subareas.loops; - areas.conditions = subareas.conditions; - const tag = node.tagName; - if (condition) { - tag === 'template' && subareas.create.unshift(`${condition} = _$docFragment();`); - subareas.unmount.push(`_$append(_$frag, ${condition});`); - } - subareas.mount.push('_$append(_$select(parent), _$frag, _$select(sibling));'); - const condType = type ? type : 'else'; - const condName = type.includes('elseIf') ? '_condition' : capitalize('condition'); - return genBody(`${condType}${condName}_${index}`, scope, subareas, condType); -} - -function genCondition(scope: string, { ifCond, elseIfConds, elseCond }: Condition, count: number) { - const funcName = `condition_${count}`; - let condition = `function ${funcName}(${scope}) {`; - if (ifCond) { - condition += `if (${ifCond}) return if${capitalize(funcName)}(${scope});`; - } - if (elseIfConds) { - for (let i = 0; i < elseIfConds.length; i++) { - const elseIfCond = elseIfConds[i]; - condition += `else if (${elseIfCond}) return elseIf_${i + 1}_${funcName}(${scope});`; - } - } - if (elseCond) { - condition += `else return else${capitalize(funcName)}(${scope});`; - } else { - condition += `else return _$emptyElse();`; - } - condition += '}'; - return condition; -} diff --git a/src/generators/directives.ts b/src/generators/directives.ts deleted file mode 100644 index 238c691..0000000 --- a/src/generators/directives.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { genEvent } from './events'; -import { genBind } from './bindings'; -import { ctx } from '../utilities/context'; -import { genSetAttrs } from './attributes'; -import { BlockAreas, NodeElement } from '../utilities/classes'; -import { capitalize, getVarName, createElement, camelToKebabCase, kebabToCamelCases } from '../utilities/tools'; - -export function genValue(target: string, node: NodeElement, areas: BlockAreas, scope: string) { - const type = node.getAttribute('type'); - const value = node.getAttribute('$value'); - const isMultiSelect = /select/.test(node.tagName) && node.hasAttribute('multiple'); - if (/input|select|textarea/.test(node.tagName) && !/checkbox|radio/.test(type)) { - const event = /date|file/.test(type) || node.tagName === 'select' ? 'change' : 'input'; - const expression = isMultiSelect ? `_$updateMultiSelect(${target}, ${scope}, '${value}')` : - `${value} = ${/number|range/.test(type) ? '+' : ''}$el.value`; - genEvent(target, event, expression, areas, scope); - genBind(target, 'value', value, areas, scope, isMultiSelect ? 'multiple' : type, null); - } else if (node.tagName === 'input' && /checkbox|radio/.test(type)) { - genEvent(target, 'change', `${value} = $el.checked`, areas, scope); - genBind(target, 'checked', value, areas, scope, type, null); - } else { - genEvent(target, `update-${camelToKebabCase(value)}`, `$val => { ${value} = $val }`, areas, scope); - genBind(target, 'value', value, areas, scope, null, null); - } -} - -export function genName(target: string, node: NodeElement, areas: BlockAreas, scope: string) { - const type = node.getAttribute('type'); - if (node.tagName === 'input' && /checkbox|radio/.test(type)) { - const group = node.getAttribute('$name'); - if (type === 'checkbox') { - genEvent(target, 'change', `_$bindGroup($el, ${group})`, areas, scope); - genBind(target, 'checked', `!!~${group}.indexOf(_$getAttr(${target}, 'value'))`, areas, scope, type, null); - } else if (type === 'radio') { - genEvent(target, 'change', `${group} = $el.checked ? _$getValue($el) : ${group}`, areas, scope); - genBind(target, 'checked', `${group} === _$getAttr(${target}, 'value')`, areas, scope, type, null); - } - } -} - -export function genShow(target: string, node: NodeElement, areas: BlockAreas, scope: string) { - const funcName = `show${capitalize(target)}`; - const varDisplay = `display${capitalize(target)}`; - areas.variables.push(varDisplay); - areas.update.push(`${funcName}(${scope}, ${target}, ${varDisplay});`); - areas.outer = areas.outer || []; - [scope] = scope.split(', '); - let params = areas.globals && areas.globals.length > 0 ? `, ${areas.globals.join(', ')}` : ''; - const expression = ctx(node.getAttribute('$show'), scope, areas.globals); - areas.extras.push(`const ${funcName} = (${scope}${params}, el, display) => { - el.style.display = ${expression} ? display : 'none'; - };`); - areas.hydrate.push(`${varDisplay} = ${target}.style.display; - ${funcName}(${scope}${params}, ${target}, ${varDisplay});`); -} - -export function genHtml(node: NodeElement, areas: BlockAreas, scope?: string) { - const tag = node.tagName; - const html = node.getAttribute('$html'); - node.removeAttribute('$html'); - const variable = getVarName(areas.variables, tag); - areas.create.push(createElement(variable, tag, node.isSVGElement)); - let content = ''; - if (html) { - const setContent = getVarName(areas.variables, `content${capitalize(variable)}`); - content = `${setContent}(${scope})`; - areas.extras.push(`${setContent} = (${scope}) => ${ctx(html, scope.split(', ')[0], areas.globals)};`); - areas.update.push(`_$htmlUpdate(${variable}, ${content});`); - } else { - content = `'${node.innerHTML}'`; - } - genSetAttrs(variable, node, scope, areas); - areas.create.push(`${variable}.innerHTML = ${content};`); - return variable; -} - -export function genRefs(scope: string, areas: BlockAreas, value: string, target: string) { - [scope] = scope.split(', '); - const init = `_refs = ${scope}.$refs;`; - if (!areas.extras.includes(init)) { - areas.variables.push('_refs'); - areas.extras.push(`_refs = ${scope}.$refs;`); - } - areas.create.push(`_$setReference(_refs, '${value}', ${target});`); - areas.destroy.push(`_$removeReference(_refs, '${value}', ${target});`); -} - -export function genDirective(target: string, attr: string, value: string, areas: BlockAreas, scope: string) { - [scope] = scope.split(', '); - const [directive, ...mods] = attr.split('.'); - const modifs = JSON.stringify(mods.reduce((acc, cur) => (acc[cur] = true, acc), {})); - const dirtVarName = `${kebabToCamelCases(directive)}Directive`; - const values = `{ - value: ${ctx(value, scope, areas.globals)}, - expression: '${value.replace(/'/g, `\\'`)}', - modifiers: ${modifs}, - }`; - const params = `${scope}, ${values}, ${target}`; - if (!areas.variables.includes(dirtVarName)) { - areas.variables.push(dirtVarName); - areas.extras.push(`${dirtVarName} = ${scope}.$directives['${directive}'];`); - } - areas.hydrate.push(`${dirtVarName}.$init(${params});`); - areas.mountDirt.push(`${dirtVarName}.$inserted(${params});`); - areas.update.push(`${dirtVarName}.$update(${params});`); - areas.destroy.push(`${dirtVarName}.$destroy(${params});`); -} \ No newline at end of file diff --git a/src/generators/events.ts b/src/generators/events.ts deleted file mode 100644 index 6d863ed..0000000 --- a/src/generators/events.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ctx } from '../utilities/context'; -import { BlockAreas } from '../utilities/classes'; -import { getVarName, capitalize } from '../utilities/tools'; - -const globals = ['_$bindGroup', '_$updateMultiSelect', '_$getAttr', '_$getValue']; -export function genEvent(variable: string, eventArgs: string, expression: string, areas: BlockAreas, scope: string) { - const [event, ...args] = eventArgs.split('.'); - const hasStop = args.indexOf('stop'); - const hasPrevent = args.indexOf('prevent'); - const isKeyEvent = event.startsWith('key'); - let keys = ''; - if (isKeyEvent && args.length) { - keys = args.reduce((nargs, arg, i) => { - if (i !== hasPrevent && i !== hasStop) { - nargs += `_$isKey(event, '${arg}')${i < args.length - 1 ? ' &&' : ''}`; - } - return nargs; - }, ''); - } - const eventFuncName = getVarName(areas.variables, `${event}Event`); - const handlerFuncName = `handler${capitalize(eventFuncName)}`; - areas.variables.push(handlerFuncName); - [scope] = scope.split(', '); - let params = areas.globals && areas.globals.length > 0 ? `, ${areas.globals.join(', ')}` : ''; - areas.extras.push(`${eventFuncName} = (${scope}${params}, $event, $el) => { - ${ctx(expression, scope, ['$event', '$el'].concat(globals, areas.variables, areas.globals))}; - };`); - const handler = `event => { - ${!!~hasPrevent ? `event.preventDefault();` : ''} - ${!!~hasStop ? `event.stopPropagation();` : ''} - ${keys ? `if (${keys}) {` : ''} - ${eventFuncName}(${scope}${params}, event, ${variable}); - ${keys ? '}' : ''} - }`; - areas.hydrate.push(`_$addListener(${variable}, '${event}', ${handlerFuncName} = ${handler});`); - if (!!areas.globals.length || variable.startsWith('_$node')) { - areas.update.push(`${handlerFuncName} = _$updateListener(${variable}, '${event}', ${handlerFuncName}, ${handler});`); - } - areas.destroy.push(`_$removeListener(${variable}, '${event}', ${handlerFuncName});`); -} \ No newline at end of file diff --git a/src/generators/index.ts b/src/generators/index.ts deleted file mode 100644 index 0e0ba9f..0000000 --- a/src/generators/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -import abs from '../utilities/jsonToCss'; -import toJSON from '../utilities/cssToJson'; -import { walkNode } from '../utilities/html'; -import { toOptions } from '../utilities/context'; -import { genBlockAreas, genBody } from './commons'; -import { hash, capitalize } from '../utilities/tools'; -import { NodeElement, BlockAreas } from '../utilities/classes'; - -const toCSS = abs({ minify: true }); - -export interface CompilerOptions { - out?: string; - input?: string; - minify?: boolean; - moduleName?: string; - noComments?: boolean; - format?: 'es' | 'iif' | 'umd' | 'amd' | 'cjs' | 'system'; -} - -export function genTemplate(node: NodeElement, scope: string, opts: CompilerOptions) { - const areas: BlockAreas = new BlockAreas(); - const links = node.querySelectorAll('links'); - const styleNode = node.querySelector('style'); - const scriptNode = node.querySelector('script'); - if (styleNode) { - styleNode.remove(); - if (styleNode.hasAttribute('scoped')) { - const styleAst = toJSON(styleNode.textContent); - const { className, styleText } = toCSS(styleAst); - areas.mount.push(`_$insertStyle('${className}', ${JSON.stringify(styleText)});`); - areas.destroy.push(`_$removeStyle('${className}');`); - walkNode(node, el => { - if (el.nodeType === 1 && !/template|slot|options/.test(el.tagName)) { - el.setAttribute('class', `${className}${el.getAttribute('class') ? ` ${el.getAttribute('class')}` : ''}`); - } - }); - } else { - const className = `scope_${hash(opts.input)}`; - areas.mount.push(`_$insertStyle('${className}', ${JSON.stringify(toCSS.minify(styleNode.textContent.trim()))});`); - areas.destroy.push(`_$removeStyle('${className}');`); - } - } else if (links.length) { - links.forEach(link => { - if (link.getAttribute('rel') === 'stylesheet') { - const className = `scope_${hash(link.getAttribute('href'))}`; - areas.outer.push(`import style${capitalize(className)} from '${link.getAttribute('href')}';`); - areas.mount.push(`_$insertStyle('${className}', style${capitalize(className)});`); - areas.destroy.push(`_$removeStyle('${className}');`); - } - }); - } - let script = 'export default {}'; - if (scriptNode) { - scriptNode.remove(); - if (scriptNode.hasAttribute('src')) { - script = `import options from '${scriptNode.getAttribute('src') || ''}'; - export default options;`; - } else { - script = scriptNode.textContent.trim(); - } - } - const { imports, options, extras } = toOptions(script); - areas.variables.push('_$frag'); - areas.extras.push('_$frag = _$docFragment();'); - let { length } = node.childNodes; - for (let i = 0; i < length; i++) { - const n = node.childNodes[i]; - const el = genBlockAreas(n, areas, scope); - if (el) { - areas.unmount.push(`_$append(_$frag, ${el});`); - } - if (length !== node.childNodes.length) { - i--; - length = node.childNodes.length; - } - } - areas.mount.push('_$append(_$select(parent), _$frag, _$select(sibling));'); - areas.destroy.push(`delete ${scope}.$root;`); - const template = genBody(`_$tpl${opts.moduleName}`, scope, areas); - return { imports, template, extras, options }; -} \ No newline at end of file diff --git a/src/generators/loops.ts b/src/generators/loops.ts deleted file mode 100644 index 103891a..0000000 --- a/src/generators/loops.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { ctx } from '../utilities/context'; -import { genBlockAreas, genBody } from './commons'; -import { NodeElement, BlockAreas } from '../utilities/classes'; -import { getVarName, filterParser } from '../utilities/tools'; - -export function genForItem(node: NodeElement, areas: BlockAreas, scope: string) { - areas.loops = areas.loops + 1; - let params = scope.split(', '); - scope = params.shift(); - const value = node.getAttribute('$for'); - node.removeAttribute('$for'); - const parent = node.parentElement; - let root = parent.dymTag ? parent.dymTag : parent.varName; - const anchor = getVarName(areas.variables, `loopAnchor_${areas.loops}`); - areas.unmount.push(`_$append(${root || '_$frag'}, ${anchor});`); - const loopBlock = `loopBlock_${areas.loops}`; - let [vars, variable] = value.split(' in '); - const [key, val, index] = vars.split(',').map(v => v.replace(/[()]/g, '').trim()); - let [asNumber, ...rest] = variable.split('\|'); - let [start, end] = asNumber.split('..'); - let globs = `${params.length ? `, ${params.join(', ')}` : ''}`; - let fglobs = `${params.length ? `, ${params.filter(p => (p !== '_$i' && p !== '_$v')).join(', ')}` : ''}`; - if (!isNaN(+start)) { - let length = (+end || 0) - (+start); - let array = [...Array(length > 0 ? length : -length)].map((_, i) => end ? i + (+start) : i); - variable = [`[${array.join(', ')}]`, ...rest].join('|'); - } - variable = ctx(filterParser(variable), scope, areas.globals.concat(params)); - areas.variables.push(loopBlock); - areas.extras.push(`${loopBlock} = _$forLoop(${scope}, ${variable}, itemLoop_${areas.loops}${fglobs}); - ${anchor} = _$text();`); - areas.outer.push(genLoopItem(`${scope}${globs}`, node, key, val, index, areas)); - areas.create.push(`${loopBlock}.$create();`); - areas.unmount.push(`${loopBlock}.$mount(${root || '_$frag'}, ${anchor});`); - areas.update.push(`${loopBlock}.$update(${scope}, ${variable}${fglobs});`); - areas.destroy.push(`${loopBlock}.$destroy();`); -} - -function genLoopItem(scope: string, node: NodeElement, variable: string, value: string, index: string, areas: BlockAreas) { - const subareas: BlockAreas = new BlockAreas(areas.loops, areas.conditions); - const loop = `itemLoop_${areas.loops}`; - let params: string[] = []; - [scope, ...params] = scope.split(', '); - subareas.globals.push(variable); - value && subareas.globals.push(value); - index && subareas.globals.push(index); - subareas.globals.push(...params); - scope = [...new Set([scope, variable, value || '_$v', index || '_$i', ...params])].join(', '); - const tag = node.tagName; - if (tag === 'template') { - node.appendChild(node.content); - } - subareas.variables.push('_$frag'); - subareas.extras.push('_$frag = _$docFragment();'); - node.isBlock = true; - let item = genBlockAreas(node, subareas, scope.replace(', _$v', '').replace(', _$i', '')); - delete node.isBlock; - areas.loops = subareas.loops; - areas.conditions = subareas.conditions; - if (tag === 'template') { - subareas.create.unshift(`${item} = _$docFragment();`); - } - item && subareas.unmount.push(`_$append(_$frag, ${item});`); - subareas.mount.push('_$append(_$select(parent), _$frag, _$select(sibling));'); - return genBody(loop, scope, subareas); -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 476adf8..7c64b27 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,140 +1,110 @@ -import glob = require('glob'); -import { minify } from 'uglify-js'; -import { getDoc } from './utilities/html'; +import { snakeToCamel } from './utils'; import { transpileModule } from 'typescript'; -import { optimize } from './utilities/context'; -import { minify as minifyES } from 'uglify-es'; -import { basename, extname, dirname, join } from 'path'; -import { genTemplate, CompilerOptions } from './generators'; -import { readFileSync, statSync, writeFile, existsSync } from 'fs'; -import { kebabToCamelCases, capitalize, camelToKebabCase } from './utilities/tools'; +import { readFileSync, writeFile } from 'fs'; +import { minify, MinifyOptions } from 'terser'; +import { program } from './parsers/script/nodes'; +import { generate } from './parsers/script/generator'; +import { basename, join, resolve, dirname } from 'path'; +import compiler, { CompileSourceOptions, CompilerOptions } from './parsers'; -const dest = `{ - _$bindUpdate, _$comment, _$setElements, _$emptySlot, _$appendToSlot, _$declareSlots, - _$updateMultiSelect, _$componentUpdate, _$htmlUpdate, _$tagUpdate, _$bindBooleanAttr, - _$removeReference, _$addChild, _$textUpdate, _$getValue, _$text, _$conditionalUpdate, - _$noop, _$toString, _$setReference, _$isType, _$isKey, _$select, _$docFragment, _$append, - _$removeChild, _$bindGroup, _$emptyElse, _$Ctor, _$bindMultiSelect, _$setAttr, _$removeEl, - _$assignEl, _$el, _$bindStyle, _$forLoop, _$each, _$insertStyle, _$removeStyle, _$getAttr, - _$addListener, _$updateListener, _$removeListener, _$bindClasses, _$destroyComponent, _$svg, -}`; -const esDeps = `import ${dest} from 'trebor-tools';`; -const cjsDeps = `const ${dest} = require('trebor-tools');`; -const tools = readFileSync(join(__dirname, '../tools/index.js'), 'utf8'); - -export function genSource(html: string, opts: CompilerOptions) { - const body = getDoc(html, !!opts.minify); - const { moduleName } = opts; - const { imports, template, extras, options } = genTemplate(body, '_$state', opts); - if (opts.format === 'es') { - imports.unshift(esDeps); - } - const source = [template, extras, `const ${moduleName} = _$Ctor(_$tpl${moduleName}, ${options});`] - .filter(c => !!c.length).join('\n'); - return { imports, source }; +export interface CompileFileOptions extends CompileSourceOptions { + extension?: string; + compilerOptions: CompilerOptions & { + outDir?: string; + }; } -function compileFile(options: CompilerOptions) { - options.format = options.format || 'umd'; - const html = readFileSync(options.input, 'utf8'); - const ext = extname(options.input); - const dir = dirname(options.input); - const file = basename(options.input, ext); - let moduleName = kebabToCamelCases(capitalize(file).replace(/\./g, '_')); - options.moduleName = options.moduleName || moduleName; - const fileName = `${file}.${options.format}.js`; - if (!options.out) { - options.out = dir; - } - const { compilerOptions, uglifyOptions } = getOptions(options); - const { imports, source } = genSource(html, options); - const code = [ - options.format === 'es' ? '' : options.format === 'cjs' ? cjsDeps : [ - ...imports, tools - ].join('\n'), source, exportFormat(options.format, moduleName) - ].join('\n'); - let { outputText } = transpileModule(code, { compilerOptions, moduleName: camelToKebabCase(moduleName) }); +export function parseFile(filePath: string, options?: CompileFileOptions, cb?: (err?: Error) => void) { + let { compilerOptions: { outDir }, extension } = options; + const htmlCode = readFileSync(resolve(filePath), 'utf8'); - outputText = optimize(options.format === 'es' ? [...imports, outputText].join('\n') : outputText); + if (!extension) { + extension = 'html'; + } - if (options.format === 'umd') { - outputText = umdTpl(moduleName, outputText); - } else if (options.format === 'iif') { - if (options.minify) { - uglifyOptions.compress = uglifyOptions.compress || {}; - uglifyOptions.compress.top_retain = [moduleName]; - } - outputText = iifTpl(moduleName, outputText); - } - const min = options.format === 'es' ? minifyES : minify; - return [join(options.out, fileName), options.minify ? min(outputText, uglifyOptions).code : outputText]; -} + const fileName = basename(filePath, `.${extension}`); + options.compilerOptions.moduleName = snakeToCamel(fileName); -export function exportFormat(format: string, moduleName: string) { - return `${format === 'es' ? 'export default' : 'export ='} ${moduleName};`; -} + filePath = outDir || join(dirname(filePath), `${fileName}.js`); + if (!filePath.endsWith('.js')) { + join(filePath, `${fileName}.js`); + } + options.filePath = filePath; + const jsCode = parseSource(htmlCode, options); -function getOptions(options: CompilerOptions) { - let uglifyOptions: { [key: string]: any } = { compress: { toplevel: true } }; - let compilerOptions: { [key: string]: any } = { - sourceMap: false, importHelpers: false, target: 1, module: 1, removeComments: true - }; - if (typeof options.noComments !== 'boolean') { - options.noComments = false; - } - if (options.format === 'es') { - compilerOptions.module = 5; - } else if (options.format === 'amd') { - compilerOptions.module = 2; - } else if (options.format === 'cjs') { - compilerOptions.module = 1; - } else if (options.format === 'system') { - compilerOptions.module = 4; - } - if (options.minify) { - uglifyOptions.mangle = {}; - } - return { uglifyOptions, compilerOptions }; -} + if (!cb) { + cb = err => err && console.log(err); + } -function umdTpl(moduleName: string, body: string) { - return `!function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define('${camelToKebabCase(moduleName)}', factory) : - (global.${moduleName} = factory()); - }(this, function () { - ${body.replace('module.exports =', 'return')} - });`; + if (!jsCode.code) { + cb(jsCode.error); + } else { + writeFile(filePath, jsCode.code, 'utf8', cb); + } } -function iifTpl(moduleName: string, body: string) { - return `!function(glob) { - ${body.replace('module.exports =', `glob.${moduleName} =`)} - }(this);`; +export function parseSource(htmlCode: string, options?: CompileSourceOptions) { + let map = ''; + let code = ''; + let astBody = []; + let error = null; + try { + astBody = compiler(htmlCode, options); + const terserOptions = getTerserOptions(options.compilerOptions.minify); + const jsCode = generate(program(astBody, 'module'), { semicolon: true, quotemark: `'` }); + const result = transpileModule(jsCode, { + moduleName: options.compilerOptions.moduleName, + compilerOptions: { + target: 1, + sourceMap: true, + importHelpers: false, + module: getModuleKind(options.compilerOptions.format || 'esm'), + removeComments: true + } + }); + + if (options.compilerOptions.optimize) { + const output = minify(result.outputText, terserOptions); + code = output.code; + error = output.error; + map = output.map; + } else { + code = result.outputText; + map = result.sourceMapText; + } + } catch (err) { + error = err; + } + return { code, map, error }; } -function checkExistToolsModule() { - return existsSync(join(__dirname, '..', '..', 'trebor-tools', 'package.json')); +function getModuleKind(modType: 'esm' | 'cjs' | 'iif') { + switch (modType) { + case 'cjs': + return 1; + case 'esm': + return 99; + default: + return 5; + } } -export default function cli(options: CompilerOptions) { - const info = statSync(options.input); - if (options.format && /es|cjs/.test(options.format) && !checkExistToolsModule()) { - console.log('You must install `trebor-tools` or set it as dependency if you want use the components.'); - } - if (info.isFile()) { - let [path, code] = compileFile(options); - writeFile(path, code, 'utf8', err => err && console.log(err)); - } else if (info.isDirectory()) { - glob(`${options.input}/**/*.html`, (err, files) => { - if (err) throw err; - let codes = files.filter(f => !f.includes('node_modules')).map(file => { - let [path, code] = compileFile({ ...options, ...{ input: file } }); - return new Promise((res, rej) => { - writeFile(path, code, 'utf8', err => err ? rej(err) : res()); - }); - }); - Promise.all(codes); - }); - } -} \ No newline at end of file +function getTerserOptions(minify: boolean) { + const options: MinifyOptions = { + mangle: true, + module: true, + toplevel: true, + parse: { ecma: 9 }, + output: { quote_style: 1 }, + compress: { passes: 2, keep_fargs: false } + }; + if (!minify) { + options.mangle = false; + Object.assign(options.compress, { + inline: false, if_return: false, sequences: false, reduce_vars: false, reduce_funcs: false, + conditionals: false, join_vars: false + }); + Object.assign(options.output, { indent_level: 2, beautify: true, braces: true }); + } + return options; +} diff --git a/src/parsers/css/CSSParse.ts b/src/parsers/css/CSSParse.ts new file mode 100644 index 0000000..c203de3 --- /dev/null +++ b/src/parsers/css/CSSParse.ts @@ -0,0 +1,500 @@ +// Module by visionmedia +// https://github.com/reworkcss/css-parse +// +// http://www.w3.org/TR/CSS21/grammar.html +// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 +interface ParserOptions { + source?: any; + position?: boolean; + delimiters?: string[]; +} + +const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; + +export default function (css: string, options?: ParserOptions) { + options = options || {}; + options.position = options.position === false ? false : true; + options.delimiters = options.delimiters || ['{%', '%}']; + /** + * Positional. + */ + let lineno = 1; + let column = 1; + /** + * Update lineno and column based on `str`. + */ + function updatePosition(str: string) { + let lines = str.match(/\n/g); + if (lines) lineno += lines.length; + let i = str.lastIndexOf('\n'); + column = ~i ? str.length - i : column + str.length; + } + /** + * Mark position and patch `node.position`. + */ + function position() { + let start = { line: lineno, column: column }; + if (!options.position) return positionNoop; + + return function (node) { + node.position = new Position(start); + whitespace(); + return node; + }; + } + /** + * Store position information for a node + */ + function Position(start: { line: number, column: number }) { + this.start = start; + this.end = { line: lineno, column: column }; + this.source = options.source; + } + /** + * Non-enumerable source string + */ + Position.prototype.content = css; + /** + * Return `node`. + */ + function positionNoop(node) { + whitespace(); + return node; + } + /** + * Error `msg`. + */ + function error(msg: string) { + let err = new Error(`${msg} near line ${lineno}:${column}`); + err['filename'] = options.source; + err['line'] = lineno; + err['column'] = column; + err['source'] = css; + throw err; + } + /** + * Parse stylesheet. + */ + function stylesheet() { + return { + type: 'stylesheet', + stylesheet: { + rules: rules() + } + }; + } + /** + * Opening brace. + */ + function open() { + return match(/^{\s*/); + } + /** + * Closing brace. + */ + function close() { + return match(/^}/); + } + /** + * Parse ruleset. + */ + function rules() { + let node; + let rules = []; + whitespace(); + comments(rules); + while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) { + rules.push(node); + comments(rules); + } + return rules; + } + /** + * Match `re` and return captures. + */ + function match(re: RegExp) { + let m = re.exec(css); + if (!m) return; + let str = m[0]; + updatePosition(str); + css = css.slice(str.length); + return m; + } + /** + * Parse whitespace. + */ + function whitespace() { + match(/^\s*/); + } + /** + * Parse comments; + */ + function comments(rules?) { + let c; + rules = rules || []; + while (c = comment()) rules.push(c); + return rules; + } + /** + * Parse comment. + */ + function comment() { + let pos = position(); + if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) return; + + let i = 2; + while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1)))++i; + i += 2; + + if ('' === css.charAt(i - 1)) { + return error('End of comment missing'); + } + + let str = css.slice(2, i - 2); + column += 2; + updatePosition(str); + css = css.slice(i); + column += 2; + + return pos({ + type: 'comment', + comment: str + }); + } + /** + * Parse selector. + */ + function selector() { + let m = match(/^([^{]+)/); + if (!m) return; + /* @fix Remove all comments from selectors + * http://ostermiller.org/findcomment.html */ + return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').split(/\s*,\s*/); + } + /** + * Parse declaration. + */ + function declaration() { + let pos = position(); + + // prop + let prop: RegExpExecArray | string = match(/^(\*?[-#\/\*\w]+(\[[0-9a-z_-]+\])?)\s*/); + if (!prop) return; + prop = trim(prop[0]); + + // : + if (!match(/^:\s*/)) return error('property missing \':\''); + + // template + let delimiters = options.delimiters; + let reg = new RegExp('(\\w*\\s*)*' + delimiters[0] + '( )?(.+?)( )?' + delimiters[1] + '(\\s*\\w*)'); + let val = match(reg); + // val + if (!val) { + val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); + } + if (!val) return error('property missing value'); + + let ret = pos({ + type: 'declaration', + property: prop.replace(commentre, ''), + value: trim(val[0]).replace(commentre, '') + }); + + // ; + match(/^[;\s]*/); + + return ret; + } + /** + * Parse declarations. + */ + function declarations() { + let decls = []; + + if (!open()) return error('missing \'{\''); + comments(decls); + + // declarations + let decl; + while (decl = declaration()) { + decls.push(decl); + comments(decls); + } + + if (!close()) return error('missing \'}\''); + return decls; + } + /** + * Parse keyframe. + */ + function keyframe() { + let m; + let vals = []; + let pos = position(); + + while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) { + vals.push(m[1]); + match(/^,\s*/); + } + + if (!vals.length) return; + + return pos({ + type: 'keyframe', + values: vals, + declarations: declarations() + }); + } + /** + * Parse keyframes. + */ + function atkeyframes() { + let pos = position(); + let m = match(/^@([-\w]+)?keyframes */); + + if (!m) return; + let vendor = m[1]; + + // identifier + m = match(/^([-\w]+)\s*/); + if (!m) return error('@keyframes missing name'); + let name = m[1]; + + if (!open()) return error('@keyframes missing \'{\''); + + let frame; + let frames = comments(); + while (frame = keyframe()) { + frames.push(frame); + frames = frames.concat(comments()); + } + + if (!close()) return error('@keyframes missing \'}\''); + + return pos({ + type: 'keyframes', + name: name, + vendor: vendor, + keyframes: frames + }); + } + /** + * Parse supports. + */ + function atsupports() { + let pos = position(); + let m = match(/^@supports *([^{]+)/); + + if (!m) return; + let supports = trim(m[1]); + + if (!open()) return error('@supports missing \'{\''); + + let style = comments().concat(rules()); + + if (!close()) return error('@supports missing \'}\''); + + return pos({ + type: 'supports', + supports: supports, + rules: style + }); + } + /** + * Parse host. + */ + function athost() { + let pos = position(); + let m = match(/^@host */); + + if (!m) return; + + if (!open()) return error('@host missing \'{\''); + + let style = comments().concat(rules()); + + if (!close()) return error('@host missing \'}\''); + + return pos({ + type: 'host', + rules: style + }); + } + /** + * Parse media. + */ + function atmedia() { + let pos = position(); + let m = match(/^@media *([^{]+)/); + + if (!m) return; + let media = trim(m[1]); + + if (!open()) return error('@media missing \'{\''); + + let style = comments().concat(rules()); + + if (!close()) return error('@media missing \'}\''); + + return pos({ + type: 'media', + media: media, + rules: style + }); + } + /** + * Parse paged media. + */ + function atpage() { + let pos = position(); + let m = match(/^@page */); + if (!m) return; + + let sel = selector() || []; + + if (!open()) return error('@page missing \'{\''); + let decls = comments(); + + // declarations + let decl; + while (decl = declaration()) { + decls.push(decl); + decls = decls.concat(comments()); + } + + if (!close()) return error('@page missing \'}\''); + + return pos({ + type: 'page', + selectors: sel, + declarations: decls + }); + } + /** + * Parse document. + */ + function atdocument() { + let pos = position(); + let m = match(/^@([-\w]+)?document *([^{]+)/); + if (!m) return; + + let vendor = trim(m[1]); + let doc = trim(m[2]); + + if (!open()) return error('@document missing \'{\''); + + let style = comments().concat(rules()); + + if (!close()) return error('@document missing \'}\''); + + return pos({ + type: 'document', + document: doc, + vendor: vendor, + rules: style + }); + } + /** + * Parse font-face. + */ + function atfontface() { + let pos = position(); + let m = match(/^@font-face */); + if (!m) return; + + if (!open()) return error('@font-face missing \'{\''); + let decls = comments(); + + // declarations + let decl; + while (decl = declaration()) { + decls.push(decl); + decls = decls.concat(comments()); + } + + if (!close()) return error('@font-face missing \'}\''); + + return pos({ + type: 'font-face', + declarations: decls + }); + } + /** + * Parse import + */ + + let atimport = _compileAtrule('import'); + + /** + * Parse charset + */ + + let atcharset = _compileAtrule('charset'); + + /** + * Parse namespace + */ + + let atnamespace = _compileAtrule('namespace'); + + /** + * Parse non-block at-rules + */ + + + function _compileAtrule(name) { + let re = new RegExp('^@' + name + ' *([^;\\n]+);'); + return function () { + let pos = position(); + let m = match(re); + if (!m) return; + let ret = { type: name }; + ret[name] = m[1].trim(); + return pos(ret); + }; + } + /** + * Parse at rule. + */ + function atrule() { + if (css[0] !== '@') return; + + return atkeyframes() + || atmedia() + || atsupports() + || atimport() + || atcharset() + || atnamespace() + || atdocument() + || atpage() + || athost() + || atfontface(); + } + /** + * Parse rule. + */ + function rule() { + let pos = position(); + let sel = selector(); + + if (!sel) return error('selector missing'); + comments(); + + return pos({ + type: 'rule', + selectors: sel, + declarations: declarations() + }); + } + + return stylesheet(); +}; + +/** + * Trim `str`. + */ + +function trim(str: string) { + return str ? str.replace(/^\s+|\s+$/g, '') : ''; +} \ No newline at end of file diff --git a/src/parsers/css/cssToJson.ts b/src/parsers/css/cssToJson.ts new file mode 100644 index 0000000..3ac81d1 --- /dev/null +++ b/src/parsers/css/cssToJson.ts @@ -0,0 +1,117 @@ +import parser from './CSSParse'; + +import { + Rule, Declaration, Charset, Document, + FontFace, Namespace, KeyFrames, KeyFrame, + Media, Import, Page, Supports, Stylesheet +} from 'css'; + +export default function parseCSS(cssData: string) { + try { + let parsed = parser(cssData); + return cssRules(parsed); + } catch (err) { + console.log('Error during parsing css data:', err.message, err.stack); + } +} + +function declarationNodes(props: Object, declarations: Declaration[]) { + for (let j = 0; j < declarations.length; j++) { + let declaration = declarations[j]; + if (declaration.type === 'declaration') { + props[declaration.property] = declaration.value; + } + } +} + +function ruleNode(node: Rule | FontFace | Page) { + let body: { [key: string]: string } = {}; + declarationNodes(body, node.declarations); + let selector = node.type === 'rule' ? (node).selectors.join(', ') : `@${node.type}`; + return { selector, body }; +} + +function keyframesNode(node: KeyFrames) { + let frames = {}; + for (let i = 0; i < node.keyframes.length; i++) { + let rule = node.keyframes[i]; + if (rule.type === 'keyframe') { + let frame = {}; + declarationNodes(frame, rule.declarations); + frames[rule.values.join(', ')] = frame; + } + } + const body = { name: node.name, frames }; + return { selector: node.type, body }; +} + +function unNestedAtRuleNodes(node: Charset | Import | Namespace) { + return { selector: `@${node.type}`, body: node[node.type] }; +} + +function nestedAtRuleNode(node: Document | Media | Supports) { + let body = {}; + for (let i = 0; i < node.rules.length; i++) { + const rule = node.rules[i]; + let parts = { selector: '', body: {} }; + switch (rule.type) { + case 'import': + case 'charset': + case 'namesapce': { + parts = unNestedAtRuleNodes(rule); + break; + } + case 'rule': + case 'page': + case 'fontface': { + parts = ruleNode(rule); + break; + } + case 'keyframes': { + parts = keyframesNode(rule); + break; + } + default: + parts = nestedAtRuleNode(rule); + break; + } + body[parts.selector] = parts.body; + } + return { selector: `@${node.type}${node[node.type] ? ` ${node[node.type]}` : ''}`, body }; +} + +function cssRules(ast: Stylesheet) { + let json: { [key: string]: any } = {}; + if (ast && ast.type === 'stylesheet' && ast.stylesheet && ast.stylesheet.rules) { + for (let j = 0; j < ast.stylesheet.rules.length; j++) { + let rule = ast.stylesheet.rules[j]; + if (rule.type === 'comment') { + continue; + } + let parts = { selector: '', body: {} }; + switch (rule.type) { + case 'import': + case 'charset': + case 'namesapce': { + parts = unNestedAtRuleNodes(rule); + break; + } + case 'rule': + case 'page': + case 'fontface': { + parts = ruleNode(rule); + break; + } + case 'keyframes': { + parts = keyframesNode(rule); + break; + } + default: + parts = nestedAtRuleNode(rule); + break; + } + json[parts.selector] = { ...(json[parts.selector] || {}), ...parts.body }; + } + } + return json; +} diff --git a/src/parsers/css/index.ts b/src/parsers/css/index.ts new file mode 100644 index 0000000..dbad642 --- /dev/null +++ b/src/parsers/css/index.ts @@ -0,0 +1,15 @@ +import cssToJson from './cssToJson'; +import jsonToCss from './jsonToCss'; + +export default function parse(css: string, options?: { minify?: boolean, scoped?: boolean }) { + const opts = options || { minify: false, scoped: false }; + + const styleAst = cssToJson(css); + const toCSS = jsonToCss(opts); + const { className, styleText } = toCSS(styleAst); + + return { + scope: className, + css: opts.scoped ? styleText : styleText.replace(new RegExp(`\\.${className}`, 'g'), '') + }; +} diff --git a/src/parsers/css/jsonToCss.ts b/src/parsers/css/jsonToCss.ts new file mode 100644 index 0000000..6d94bd7 --- /dev/null +++ b/src/parsers/css/jsonToCss.ts @@ -0,0 +1,447 @@ +import { hash } from '../../utils'; +import { camelToSnake } from '../../utils'; + +interface AbtStyle { + (objRules: Object, scope?: string): { className: string, styleText: string }; + [key: string]: any; +} + +let newline = '\n'; +let defaultOptions = { + minify: false, + keepCamelCase: false, + combineSelectors: true +}; + +function toCSS(rules: { [key: string]: any }, options: { [key: string]: any }, indent?: string[]) { + let css = ''; + indent = indent || options['indent'] || ['', ' ']; + for (let selector in rules) { + // handling raw content + if (~selector.indexOf('____raw')) { + let rawSel = /(____raw_)/.exec(selector)[0]; + css += rules[selector][rawSel] + newline; + // handling normal styles + } else { + let entityStyle = `${indent[0]}${selector} {${newline}`; + let entity = ''; + for (let prop in rules[selector]) { + let value = rules[selector][prop]; + if (value === '') { + value = '""'; + } + prop = prop.replace(/[$]\d*/, ''); + prop = options && options.keepCamelCase === true ? prop : prop.replace(/([A-Z])/g, w => `-${w.toLowerCase()}`); + entity += `${indent[1]}${prop}: ${value};${newline}`; + } + if (entity !== '') { + entityStyle += entity; + entityStyle += `${indent[0]}}${newline}`; + css += entityStyle; + } + } + } + return css; +} + +// combining selectors +function combineSelectors(rules: { [key: string]: any }, preventCombining: string[], keepCamelCase: boolean) { + let map = [], arr = {}; + preventCombining = [].concat(preventCombining || []); + preventCombining.splice(0, 0, ''); + let prevent = preventCombining.join('|'); + // extracting every property + for (let selector in rules) { + let props = rules[selector]; + for (let prop in props) { + map.push({ + selector: selector, + prop: prop, + value: props[prop], + combine: prevent.indexOf('|' + prop) < 0 && selector.indexOf('@font-face') < 0 + }); + } + } + // combining + for (let i = 0; i < map.length; i++) { + if (map[i].combine === true && map[i].selector !== false) { + for (let j = i + 1; j < map.length; j++) { + let propi = keepCamelCase ? map[i].prop : camelToSnake(map[i].prop); + let propj = keepCamelCase ? map[j].prop : camelToSnake(map[j].prop); + if (propi === propj && map[i].value === map[j].value) { + map[i].selector += ', ' + map[j].selector.replace(/[$]\d*/, ''); + map[j].selector = false; // marking for removal + } + } + } + } + // preparing the result + for (let i = 0; i < map.length; i++) { + if (map[i].selector !== false) { + if (!arr[map[i].selector]) { + arr[map[i].selector] = {}; + } + arr[map[i].selector][map[i].prop] = map[i].value; + } + } + return arr; +} + +function minify(content: string) { + return content + // Remove comments, newlines and tabs + .replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, '') + // Remove more than single adjacent spaces + .replace(/ {2,}/g, ' ') + .replace(/ ([{:}]) /g, '$1') + .replace(/: /g, ':') + .replace(/([;,]) /g, '$1') + .replace(/ !/g, '!'); +} + +function processor(rules: { [stylesheet: string]: { [key: string]: any } }, options?: { [key: string]: any }) { + options = options || defaultOptions; + let css = ''; + for (let stylesheet in rules) { + let r = rules[stylesheet]; + r = options.combineSelectors ? combineSelectors(r, options.preventCombining, options.keepCamelCase) : r; + if (stylesheet === 'mainstream') { + css += toCSS(r, options); + } else { + css += `${stylesheet} {${newline}${toCSS(r, options, [' ', ' '])}}${newline}`; + } + } + // Minification + if (options.minify) { + css = minify(css); + } + return css; +} + +function abstractStyle(options: { minify?: boolean }) { + const localPlugins: { [key: string]: any } = {}; + let HASHCLASS = '____HASHCLASS____'; + + localPlugins['keyframes'] = keyframes; + + let abtStyle: AbtStyle = (objRules: Object) => { + let ruleResgitered = []; + let allRules = { mainstream: {} }; + const opts = { ...{ combineSelectors: true, preventCombining: ['@font-face'] }, ...(options || {}) }; + + function execPlugins(selector, property, value, stylesheet, parentSelector) { + let { prop, prefix } = nonPrefixProp(property); + let plugin = localPlugins[prop]; + if (typeof plugin !== 'undefined') { + let pluginResponse = plugin(value, prefix); + if (pluginResponse) { + addRule(selector, pluginResponse, stylesheet, parentSelector); + } + return true; + } else { + return false; + } + } + + function addRule(selector, props, stylesheet, parentSelector?) { + stylesheet = stylesheet || 'mainstream'; + // catching null values + if (props === null || typeof props === 'undefined' || props === false) { + return; + } + if (!parentSelector && !selector) { + selector = ''; + } + // classify + if (typeof props.classify !== 'undefined' && props.classify === true) { + props = typeof props.toJSON !== 'undefined' ? props.toJSON() : props.toString(); + } + // multiple selectors + if (/, ?/g.test(selector) && opts.combineSelectors) { + let parts = selector.replace(/, /g, ',').split(','); + for (let i = 0; i < parts.length; i++) { + let p = parts[i]; + addRule(p, props, stylesheet, parentSelector); + } + return; + } + // check for plugin + if (execPlugins(null, selector, props, stylesheet, parentSelector)) { + return; + } + // if array is passed + if (typeof props.length !== 'undefined' && typeof props === 'object') { + for (let i = 0; i < props.length; i++) { + let prop = props[i]; + if (prop) { + addRule(selector, prop, stylesheet, parentSelector); + } + } + return; + } + + let _props = {}, + _selector = selector, + _objects = {}, + _functions = {}; + // processing props + for (let prop in props) { + // classify + let value = props[prop]; + if (value && typeof value.classify !== 'undefined' && value.classify === true) { + value = typeof value.toJSON !== 'undefined' ? value.toJSON() : value.toString(); + } + let type = typeof value; + if (type !== 'object' && type !== 'function' && value !== false && value !== true) { + if (execPlugins(selector, prop, value, stylesheet, parentSelector) === false) { + // moving the selector to the top of the chain + if (_selector.indexOf('^') === 0) { + _selector = _selector.substr(1, _selector.length - 1) + (typeof parentSelector !== 'undefined' ? ' ' + parentSelector : ''); + } else { + _selector = typeof parentSelector !== 'undefined' ? parentSelector + ' ' + selector : selector; + } + _props[prop] = value; + addPrefixes(prop, _props); + } + } else if (type === 'object') { + _objects[prop] = value; + } else if (type === 'function') { + _functions[prop] = value; + } + } + + ruleResgitered.push({ + selector: _selector, + props: _props, + stylesheet: stylesheet + }); + + for (let prop in _objects) { + // check for pseudo classes + if (prop.charAt(0) === ':') { + addRule(selector + prop, _objects[prop], stylesheet, parentSelector); + // check for ampersand operator + } else if (/&/g.test(prop)) { + if (/, ?/g.test(prop) && opts.combineSelectors) { + let parts = prop.replace(/, /g, ',').split(','); + for (let i = 0; i < parts.length; i++) { + let part = parts[i]; + if (part.indexOf('&') >= 0) { + addRule(part.replace(/&/g, selector), _objects[prop], stylesheet, parentSelector); + } else { + addRule(part, _objects[prop], stylesheet, typeof parentSelector !== 'undefined' ? parentSelector + ' ' + selector : selector); + } + } + } else { + addRule(prop.replace(/&/g, selector), _objects[prop], stylesheet, parentSelector); + } + // check for media query + } /* else if (prop.indexOf('@media') === 0 || prop.indexOf('@supports') === 0 || prop.indexOf('@document') === 0) { + addRule(selector, _objects[prop], prop, parentSelector); + // check for media query + } */ else if (selector.indexOf('@media') === 0 || prop.indexOf('@supports') === 0 || prop.indexOf('@document') === 0) { + addRule(prop, _objects[prop], selector, parentSelector); + // moving the selector to the top of the chain + } else if (selector.indexOf('^') === 0) { + // selector, props, stylesheet, parentSelector + let sel = selector.substr(1, selector.length - 1) + (typeof parentSelector !== 'undefined' ? ' ' + parentSelector : '') + ' ' + prop; + addRule(sel, _objects[prop], stylesheet); + // check for plugins + } else if (execPlugins(selector, prop, _objects[prop], stylesheet, parentSelector) === false) { + addRule(prop, _objects[prop], stylesheet, (parentSelector ? parentSelector + ' ' : '') + selector); + } + } + + for (let prop in _functions) { + let obj = {}; + obj[prop] = _functions[prop](); + addRule(selector, obj, stylesheet, parentSelector); + } + } + + try { + let stylesheet = 'mainstream'; + for (let selector in objRules) { + addRule(selector, objRules[selector], stylesheet); + } + // looping through the rules for registering + for (let i = 0; i < ruleResgitered.length; i++) { + stylesheet = ruleResgitered[i].stylesheet; + let props = ruleResgitered[i].props; + let selector = addScope(ruleResgitered[i].selector, `.${HASHCLASS}`); + // overwrite already added value + allRules[stylesheet] = allRules[stylesheet] || {}; + let rules = allRules[stylesheet]; + let current = rules[selector] || {}; + for (let prop in props) { + let value = props[prop]; + if (typeof value !== 'object') { + if (value.toString().charAt(0) === '+') { + if (current && current[prop]) { + current[prop] = current[prop] + ', ' + value.substr(1, value.length - 1); + } else { + current[prop] = value.substr(1, value.length - 1); + } + } else if (value.toString().charAt(0) === '>') { + if (current && current[prop]) { + current[prop] = current[prop] + ' ' + value.substr(1, value.length - 1); + } else { + current[prop] = value.substr(1, value.length - 1); + } + } else { + current[prop] = value; + } + } + } + rules[selector] = current; + } + } catch (err) { + throw new Error('Error adding: ' + JSON.stringify({ rules: objRules, error: err.toString() })); + } + + let styleText = processor(allRules, opts); + let toHash = minify(styleText.replace(new RegExp(`\\.${HASHCLASS}`, 'g'), '')); + let className = `scope_${hash(toHash)}`; + styleText = styleText.replace(new RegExp(HASHCLASS, 'g'), className); + + return { className, styleText: opts.minify ? minify(styleText) : styleText }; + }; + + abtStyle.minify = minify; + + abtStyle.prop = (pluginName: string, pluginAction: (value: any) => { [key: string]: any }) => { + localPlugins[pluginName] = pluginAction; + return abtStyle; + }; + + abtStyle.process = (rules: { [key: string]: any }, options: { [key: string]: any }) => { + return processor({ mainstream: rules }, options); + }; + + abtStyle.raw = (rules: { [key: string]: any }, options: { [key: string]: any }) => { + return rawContent(processor({ mainstream: rules }, options)); + }; + + return abtStyle; +} + +export default abstractStyle; + +function rawContent(raw: string) { + let id = '____raw_', object = { [id]: { [id]: raw } }; + return object; +} + +function keyframes(value: { [key: string]: any }) { + if (typeof value === 'object') { + let frames; + if (value['frames'] === void 0) { + frames = value['frames']; + } + let key = `@keyframes ${value['name']}`; + let wkey = `@-webkit-keyframes ${value['name']}`; + let frm = processor({ mainstream: frames }, { combineSelectors: false, indent: [' ', ' '] }); + return rawContent(`${key} {\n${frm}}\n${wkey} {\n${frm}}`); + } +} + +function removeExtraSpaces(sel) { + return sel.trim() + .replace(/\s*(,)\s*/g, '$1') + .replace(/\s*(>)\s*/g, '$1') + .replace(/\s*(\+)\s*/g, '$1') + .replace(/\s*(~)\s*/g, '$1'); +} + +function include(sel: string) { + return !!(~sel.indexOf(' ') || ~sel.indexOf(',') || ~sel.indexOf('>') || ~sel.indexOf('+') || ~sel.indexOf('~')); +} + +function addScope(sel: string, scope: string) { + sel = removeExtraSpaces(sel); + let prefix = sel.charAt(0); + if (include(sel)) { + if (~sel.indexOf(' ')) { + sel = addScopeToList(sel, scope, ' '); + } else if (~sel.indexOf(',')) { + sel = addScopeToList(sel, scope, ', '); + } else if (~sel.indexOf('>')) { + sel = addScopeToList(sel, scope, ' > '); + } else if (~sel.indexOf('+')) { + sel = addScopeToList(sel, scope, ' + '); + } else if (~sel.indexOf('~')) { + sel = addScopeToList(sel, scope, ' ~ '); + } + } else if (prefix === '.' || prefix === '#' || prefix === '[') { + sel = scope + sel; + } else if (~sel.indexOf(':')) { + let parts = sel.split(':'); + sel = parts[0] + scope + ':' + parts.slice(1).join(':'); + } else if (prefix !== '@') { + let parts = sel.split(' '); + sel = parts[0] + scope + ' ' + parts.slice(1).join(' '); + } + return sel.trim(); +} + +function addScopeToList(sel: string, scope: string, sep: string) { + if (!~sel.indexOf('@')) { + sel = sel.split(sep !== ' ' ? sep.trim() : sep) + .map(select => addScope(select, scope)).join(sep); + } + return sel; +} + +// http://docs.emmet.io/css-abbreviations/vendor-prefixes/ (w: webkit, m: moz, s: ms, o: o) +function prefixExtract(prop: string) { + let result: { prefix?: string | boolean, prop?: string } = {}; + let match = prop.match(/^\-(w|m|s|o)+\-/); + if ((match || prop.charAt(0) === '-') && !prop.match(/^\-(webkit|moz|ms)+\-/)) { + if (match !== null && match[0]) { + result = { prefix: match[0].replace(/-/g, '') }; + result.prop = prop.replace(match[0], ''); + } else { + result = { prefix: '' }; + result.prop = prop.substr(1, prop.length); + } + } else { + result = { + prefix: false, + prop: prop + }; + } + return result; +} + +function addPrefixes(prop: string, obj: Object) { + let originalProp = prop, p = prefixExtract(prop), value = obj[prop]; + if (p.prefix !== false) { + delete obj[originalProp]; + obj[p.prop] = value; + let isEmpty = p.prefix === ''; + if (isEmpty || ~(p.prefix).indexOf('w')) { + obj[`-webkit-${p.prop}`] = value; + } + if (isEmpty || ~(p.prefix).indexOf('m')) { + obj[`-moz-${p.prop}`] = value; + } + if (isEmpty || ~(p.prefix).indexOf('s')) { + obj[`-ms-${p.prop}`] = value; + } + if (isEmpty || ~(p.prefix).indexOf('o')) { + obj[`-o-${p.prop}`] = value; + } + } +} + +function nonPrefixProp(prop: string) { + let p = prefixExtract(prop); + if (p.prefix !== false) { + if (p.prefix === '') { + p.prefix = '-'; + } else { + p.prefix = `-${p.prefix}-`; + } + } + return p; +} \ No newline at end of file diff --git a/src/parsers/html/element.ts b/src/parsers/html/element.ts new file mode 100644 index 0000000..f52854f --- /dev/null +++ b/src/parsers/html/element.ts @@ -0,0 +1,182 @@ +import { serialize } from './serializer'; +import { TreeConstructor } from 'hyntax'; +import { nodeTypes, svg2, html5, toNode } from './utils'; +import { parseTextExpression, escapeCharacters } from '../../utils'; + +type AnyNode = TreeConstructor.AnyNode; +type TextNode = TreeConstructor.NodeContents.Text; +type ElementNode = TreeConstructor.NodeContents.Tag; + +export class Element { + varName: string; + nodeType: 1 | 3 | 8 | 11; + tagName: string; + isUnknownElement: boolean; + isSVGElement: boolean; + _textContent: string; + attributes: { name: string, value: string }[]; + parentElement: Element; + childNodes: Element[]; + + constructor(node: AnyNode, parent: Element, comments: boolean = false) { + const { nodeType, content } = node; + const { value } = content; + const { name, attributes, children } = content; + + this.nodeType = nodeTypes(nodeType); + this.tagName = nodeType === 'tag' ? name : /style|script/.test(nodeType) ? nodeType : `#${nodeType}`; + this.isUnknownElement = false; + this.isSVGElement = this.tagName === 'svg'; + this._textContent = value ? value.content : ''; + this.attributes = attributes ? attributes + .reduce((attrs, { key, value }) => { + if (key && key.content.trim()) { + attrs.push({ name: key.content.trim(), value: (value || { content: '' }).content }); + } + return attrs; + }, []) : []; + this.childNodes = []; + this.parentElement = null; + if (parent) { + this.parentElement = parent; + this.isSVGElement = parent.isSVGElement; + } + if (this.nodeType === 1) { + this.isUnknownElement = !(svg2(this.tagName) || html5(this.tagName)); + } + if (children) { + this.childNodes = children.reduce((nodes, node) => { + const nodeType = nodeTypes(node.nodeType); + const text = nodeType === 3 ? (node.content).value.content.trim() : ''; + if (nodeType === 1 || text || comments && nodeType === 8) { + nodes.push(new Element(node, this, comments)); + } + return nodes; + }, []); + } + if (/style|script/.test(nodeType)) { + this.childNodes.push(new Element({ + nodeType: 'text', content: { value: { content: this._textContent } } + }, this, comments)); + } + } + + get children() { + return this.childNodes.filter(n => n.nodeType === 1); + } + + get textContent() { + if (this.nodeType === 1 || this.nodeType === 11) { + this._textContent = this.childNodes + .reduce((text, child) => text += ` ${child.textContent}`, '').trim(); + } + return this._textContent; + } + + set textContent(value) { + if (this.nodeType === 1 || this.nodeType === 11) { + const text = new Element({ + nodeType: 'text', content: { value: { content: value } } + }, this); + this.appendChild(text); + } else { + this._textContent = value; + } + } + + get nextElementSibling() { + if (this.parentElement) { + if (this.nodeType === 1) { + const index = this.parentElement.children.indexOf(this); + return this.parentElement.children[index + 1] || null; + } else { + const index = this.parentElement.childNodes.indexOf(this); + const { length } = this.parentElement.childNodes; + const nexts = this.parentElement.childNodes.slice(index + 1, length); + return nexts.filter(n => n.nodeType === 1)[0] || null; + } + } + return null; + } + + get innerHTML() { + const html = serialize({ + nodeName: '#document', + childNodes: this.childNodes.map(toNode), + tagName: '', attrs: [], parentNode: null + }); + return escapeCharacters(html); + } + + querySelectorAll(tagName: string) { + let elements: Element[] = []; + this.childNodes.forEach(el => { + if (el.nodeType === 1) { + if (el.tagName === tagName) { + elements.push(el); + } else { + elements = elements.concat(el.querySelectorAll(tagName)); + } + } + }); + return elements; + } + + querySelector(tagName: string) { + return this.querySelectorAll(tagName)[0]; + } + + hasAttribute(name: string) { + return !!this.attributes.find(attr => attr.name.split('.')[0] === name); + } + + getAttribute(name: string) { + const attr = this.attributes.find(attr => attr.name.split('.')[0] === name); + return attr ? attr.value : null; + } + + setAttribute(name: string, value: any) { + const attr = this.attributes.find(attr => attr.name.split('.')[0] === name); + if (attr) attr.value = value; + else this.attributes.push({ name, value }); + } + + removeAttribute(name: string) { + const position = this.attributes.findIndex(attr => attr.name.split('.')[0] === name); + ~position && this.attributes.splice(position, 1); + } + + appendChild(...children: Element[]) { + children.forEach(node => { + if (node.nodeType === 11) { + this.appendChild(...node.childNodes); + } else { + node.parentElement = this; + this.childNodes.push(node); + } + }); + } + + hasExpression(includeChildren = true) { + // /{\s*([^}]*(?:}[^}]*)*)\s*}/ React style + // /\{\{\s*((?!\}\})(.|\n))*\}\}/ Mustache style + const thisHas = this.isUnknownElement || this.tagName === 'slot' || + this.attributes.some(a => /^[$@:#]/.test(a.name)) || + (this.nodeType === 3 && parseTextExpression(this.textContent, true)); + return includeChildren ? thisHas || this.childNodes.some(c => c.hasExpression()) : thisHas; + } + + removeChild(child: Element) { + const i = this.childNodes.indexOf(child); + if (~i) { + child.parentElement = null; + this.childNodes.splice(i, 1); + } + } + + remove() { + if (this.parentElement) { + this.parentElement.removeChild(this); + } + } +} diff --git a/src/parsers/html/index.ts b/src/parsers/html/index.ts new file mode 100644 index 0000000..677de22 --- /dev/null +++ b/src/parsers/html/index.ts @@ -0,0 +1,11 @@ +import { Element } from './element'; +import { tokenize, constructTree } from 'hyntax'; + +export { Element }; +export default function parse(html: string, options?: { comments?: boolean }) { + const { tokens } = tokenize(html); + const { ast } = constructTree(tokens); + const { comments } = (options || { comments: false }); + + return new Element(ast, null, comments); +} diff --git a/src/parsers/html/serializer.ts b/src/parsers/html/serializer.ts new file mode 100644 index 0000000..fac0b74 --- /dev/null +++ b/src/parsers/html/serializer.ts @@ -0,0 +1,153 @@ +const AMP_REGEX = /&/g; +const NBSP_REGEX = /\u00a0/g; +const DOUBLE_QUOTE_REGEX = /"/g; +const LT_REGEX = //g; + +export type SerializerNode = HtmlElement | HtmlText | HtmlComment; + +export interface HtmlNode { + nodeName: string; + parentNode: HtmlElement; +} + +export interface HtmlElement extends HtmlNode { + tagName: string; + childNodes: SerializerNode[]; + attrs: { name: string, value: any }[]; +} + +export interface HtmlText extends HtmlNode { + value: string; +} + +export interface HtmlComment extends HtmlNode { + data: string; +} + +export class Serializer { + html: string; + startNode: SerializerNode; + + constructor(node: SerializerNode) { + this.html = ''; + this.startNode = node; + } + + serialize() { + this._serializeChildNodes(this.startNode); + + return this.html; + } + + _serializeChildNodes(parentNode: HtmlElement) { + const childNodes = parentNode.childNodes; + + for (let i = 0, cnLength = childNodes.length; i < cnLength; i++) { + const currentNode = childNodes[i]; + + if ((currentNode).tagName) { + this._serializeElement(currentNode); + } else if (currentNode.nodeName === '#text') { + this._serializeTextNode(currentNode); + } else if (currentNode.nodeName === '#comment') { + this._serializeCommentNode(currentNode); + } + } + } + + _serializeElement(node: HtmlElement) { + const tn = node.tagName; + + this.html += `<${tn}`; + this._serializeAttributes(node); + this.html += '>'; + + if ( + tn !== 'area' && + tn !== 'base' && + tn !== 'basefont' && + tn !== 'bgsound' && + tn !== 'br' && + tn !== 'col' && + tn !== 'command' && + tn !== 'embed' && + tn !== 'frame' && + tn !== 'hr' && + tn !== 'image' && + tn !== 'img' && + tn !== 'input' && + tn !== 'isindex' && + tn !== 'keygen' && + tn !== 'link' && + tn !== 'menuitem' && + tn !== 'meta' && + tn !== 'nextid' && + tn !== 'param' && + tn !== 'source' && + tn !== 'track' && + tn !== 'wbr' + ) { + const childNodesHolder = node; + + this._serializeChildNodes(childNodesHolder); + this.html += ``; + } + } + + _serializeAttributes(node: HtmlElement) { + const attrs = node.attrs; + + for (let i = 0, attrsLength = attrs.length; i < attrsLength; i++) { + const attr = attrs[i]; + const value = escapeString(attr.value, true); + this.html += ` ${attr.name}="${value}"`; + } + } + + _serializeTextNode(node: HtmlText) { + const content = node.value; + const parent = node.parentNode; + let parentTn = void 0; + + if (parent && parent.tagName) { + parentTn = parent.tagName; + } + + if ( + parentTn === 'style' || + parentTn === 'script' || + parentTn === 'xmp' || + parentTn === 'iframe' || + parentTn === 'noembed' || + parentTn === 'noframes' || + parentTn === 'plaintext' || + parentTn === 'noscript' + ) { + this.html += content; + } else { + this.html += escapeString(content, false); + } + } + + _serializeCommentNode(node: HtmlComment) { + this.html += ``; + } +} + +function escapeString(str: string, attrMode?: boolean) { + str = str.replace(AMP_REGEX, '&').replace(NBSP_REGEX, ' '); + + if (attrMode) { + str = str.replace(DOUBLE_QUOTE_REGEX, '"'); + } else { + str = str.replace(LT_REGEX, '<').replace(GT_REGEX, '>'); + } + + return str; +} + +export function serialize(node: SerializerNode) { + const serializer = new Serializer(node); + return serializer.serialize(); +} diff --git a/src/parsers/html/utils.ts b/src/parsers/html/utils.ts new file mode 100644 index 0000000..e084fee --- /dev/null +++ b/src/parsers/html/utils.ts @@ -0,0 +1,63 @@ +import { Element } from './element'; +import { toValidate } from '../../utils'; + +const html5 = toValidate([ + 'a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', + 'basefont', 'bdi', 'bdo', 'bgsound', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', + 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'content', 'data', 'datalist', 'dd', + 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'embed', 'fieldset', + 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', + 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'image', 'img', 'input', 'ins', + 'isindex', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'listing', 'main', 'map', 'mark', + 'marquee', 'math', 'menu', 'menuitem', 'meta', 'meter', 'multicol', 'nav', 'nextid', 'nobr', 'noembed', + 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', + 'plaintext', 'pre', 'progress', 'q', 'rb', 'rbc', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script', + 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', + 'style', 'sub', 'summary', 'sup', 'svg', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', + 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr', 'xmp' +]); + +const svg2 = toValidate([ + 'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', + 'animateTransform', 'animation', 'audio', 'canvas', 'circle', 'clipPath', 'color-profile', 'cursor', + 'defs', 'desc', 'discard', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', + 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', + 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', + 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', + 'feTile', 'feTurbulence', 'filter', 'font', 'font-face', 'font-face-format', 'font-face-name', + 'font-face-src', 'font-face-uri', 'foreignObject', 'g', 'glyph', 'glyphRef', 'handler', 'hkern', + 'iframe', 'image', 'line', 'linearGradient', 'listener', 'marker', 'mask', 'metadata', 'missing-glyph', + 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'prefetch', 'radialGradient', 'rect', 'script', + 'set', 'solidColor', 'stop', 'style', 'svg', 'switch', 'symbol', 'tbreak', 'text', 'textArea', + 'textPath', 'title', 'tref', 'tspan', 'unknown', 'use', 'video', 'view', 'vkern' +]); + +function nodeTypes(type: string) { + switch (type) { + case 'text': + return 3; + case 'comment': + return 8; + case 'document': + return 11; + default: + return 1; + } +} + +function toNode(element: Element) { + const node = Object.create(null); + node.nodeName = element.tagName; + if (element.nodeType === 1) { + node.tagName = element.tagName; + node.attrs = element.attributes; + node.childNodes = element.childNodes.map(toNode); + } else if (element.nodeType === 3) { + node.value = element.textContent; + } else { + node.data = element.textContent; + } + return node; +} + +export { toNode, nodeTypes, svg2, html5 }; diff --git a/src/parsers/index.ts b/src/parsers/index.ts new file mode 100644 index 0000000..d813297 --- /dev/null +++ b/src/parsers/index.ts @@ -0,0 +1,120 @@ +import parseCss from './css'; +import { readFileSync } from 'fs'; +import parseJs from './script/parser'; +import { iif } from './script/wrappers'; +import { hash, capitalize } from '../utils'; +import parseHtml, { Element } from './html'; +import { join, dirname, resolve } from 'path'; +import parseScript from './script/parseScript'; +import prepareDirectives, { Directive } from '../directives'; +import { callExpression, exportDefaultDeclaration } from './script/nodes'; +import createTpl, { Segments, setSpecialAttrs, setNonWalkAttrs } from './script'; + +type ObjectMap = Record; + +export interface CompilerOptions { + minify?: boolean; + comments?: boolean; + moduleName: string; + optimize?: boolean; + format?: 'esm' | 'cjs' | 'iif'; +} + +export interface CompileSourceOptions { + filePath: string; + compilerOptions: CompilerOptions; + cssParser?(source: string, options: ObjectMap): string; + htmlParser?(source: string, options: ObjectMap): string; + jsParser?(source: string, options: ObjectMap): string; + directives?: Directive[]; +} + +let tools = null; + +export default function compiler(html: string, option: CompileSourceOptions) { + const { compilerOptions, directives, cssParser, htmlParser, jsParser, filePath } = option; + const moduleName = capitalize(compilerOptions.moduleName); + + html = htmlParser ? htmlParser(html, compilerOptions) : html; + const document = parseHtml(html, compilerOptions); + + const segmts = new Segments(); + const cssImports: string[] = []; + const links = document.querySelectorAll('link'); + const styles = document.querySelector('style'); + const scripts = document.querySelector('script'); + + if (styles) { + styles.remove(); + const isScoped = styles.hasAttribute('scoped'); + const style = cssParser ? cssParser(styles.textContent, compilerOptions) : styles.textContent; + const { scope, css } = parseCss(style, { minify: compilerOptions.minify, scoped: isScoped }); + const className = isScoped ? scope : `scope_${hash(filePath)}`; + segmts.addImport('trebor/tools', '_$insertStyle'); + segmts.addImport('trebor/tools', '_$removeStyle'); + segmts.destroy.add(`_$removeStyle('${className}');`); + segmts.mount.add(`_$insertStyle('${className}', ${JSON.stringify(css)});`); + if (isScoped) { + document.childNodes.forEach(scopedElement(scope)); + } + } else if (links.length) { + segmts.addImport('trebor/tools', '_$insertStyle'); + segmts.addImport('trebor/tools', '_$removeStyle'); + links.forEach(link => { + if (link.getAttribute('rel') === 'stylesheet') { + const className = `scope_${hash(link.getAttribute('href'))}`; + cssImports.push(`import style${capitalize(className)} from '${link.getAttribute('href')}';`); + segmts.mount.add(`_$insertStyle('${className}', style${capitalize(className)});`); + segmts.destroy.add(`_$removeStyle('${className}');`); + } + }); + } + + let script = 'export default class {}'; + if (scripts) { + scripts.remove(); + if (scripts.hasAttribute('src')) { + const dir = dirname(filePath); + const file = resolve(dir, scripts.getAttribute('src')); + script = readFileSync(file, 'utf8'); + } else { + script = scripts.textContent; + } + } + + const ast = parseJs(jsParser ? jsParser(script, compilerOptions) : script); + const { imports, extras, options } = parseScript(ast); + const { specialAttrs, nonWalkAttrs } = prepareDirectives(directives || []); + + setSpecialAttrs(specialAttrs); + setNonWalkAttrs(nonWalkAttrs); + + const tplName = `tpl${moduleName}`; + const tpl = createTpl(document.childNodes, segmts, tplName); + const compCreator = '_$createComponent'; + segmts.addImport('trebor/tools', compCreator); + const moduleClass = options.declaration; + const code = []; + + if (compilerOptions.format === 'iif') { + if (!tools) { + tools = parseJs(readFileSync(join(__dirname, '../../tools/index.js'), 'utf8')); + tools.body.pop(); + } + code.push(iif(moduleName, moduleClass, [...tools.body, ...segmts.getTools(), ...extras, ...tpl])); + } else { + code.push(...segmts.imports, ...imports); + const opt = exportDefaultDeclaration(callExpression(compCreator, [moduleClass, `_$${tplName}`])); + code.push(...segmts.getTools(), ...extras, ...tpl, opt); + } + return code; +} + +function scopedElement(scope: string) { + return (el: Element) => { + if (el.nodeType === 1 && !/template|slot|options/.test(el.tagName)) { + el.setAttribute('class', `${scope}${el.getAttribute('class') ? ` ${el.getAttribute('class')}` : ''}`); + el.childNodes.forEach(scopedElement(scope)); + } + }; +} diff --git a/src/parsers/script/context/buildins.ts b/src/parsers/script/context/buildins.ts new file mode 100644 index 0000000..97b32e7 --- /dev/null +++ b/src/parsers/script/context/buildins.ts @@ -0,0 +1,11 @@ +import { builtin, browser, node as nodejs, amd } from 'globals'; + +const allBuildins: string[] = [builtin, browser, nodejs, amd].reduce((result, build) => { + return result.concat(Object.keys(build)); +}, []); + +export const buildins = [...new Set(allBuildins)]; + +export function isBuildIn(varName: string) { + return varName !== 'name' && buildins.includes(varName); +} diff --git a/src/parsers/script/context/expression.ts b/src/parsers/script/context/expression.ts new file mode 100644 index 0000000..537c7e3 --- /dev/null +++ b/src/parsers/script/context/expression.ts @@ -0,0 +1,16 @@ +import parse from '../parser'; +import { Statement, BaseNode } from '../estree'; + +export function expression(source = '', options?: Object) { + const ast = parse(source, options); + return ast.body[0]; +} + +export function compare(node1: BaseNode, node2: BaseNode) { + return node1.type === node2.type && JSON.stringify(node1) === JSON.stringify(node2); +} + +export function assignNode(nodeTo: BaseNode, nodeFrom: BaseNode) { + Object.keys(nodeTo).forEach(k => k !== 'parent' && delete nodeTo[k]); + return Object.assign(nodeTo, nodeFrom); +} \ No newline at end of file diff --git a/src/parsers/script/context/globals.ts b/src/parsers/script/context/globals.ts new file mode 100644 index 0000000..3afb5ca --- /dev/null +++ b/src/parsers/script/context/globals.ts @@ -0,0 +1,178 @@ +import visit from '../visit'; +import isRef from './reference'; +import { parseModule } from 'meriyah'; +import { + isProgram, isFunctionDeclaration, isFunctionExpression, isArrowFunctionExpression, isBlockStatement +} from '../nodes'; +import { + BaseNode, Identifier, ObjectPattern, ArrayPattern, RestElement, AssignmentPattern, AssignmentProperty, + FunctionDeclaration, FunctionExpression, ArrowFunctionExpression, ClassDeclaration, ClassExpression, + Program, VariableDeclaration, CatchClause, ImportModuleSpecifier +} from '../estree'; +import { isBuildIn } from './buildins'; + +export type Node = BaseNode & { + parent?: Node; +} + +const locals = Symbol('locals'); + +function isFunctionNode(node: Node) { + return isFunctionExpression(node) || isFunctionDeclaration(node); +} + +function isScope(node: Node) { + return isFunctionNode(node) || isArrowFunctionExpression(node) || isProgram(node); +} + +function isBlockScope(node: Node) { + return isBlockStatement(node) || isScope(node); +} + +function declarePattern(node: Node, parent: Node) { + switch (node.type) { + case 'Identifier': + parent[locals].has((node).name); + break; + case 'ObjectPattern': + (node).properties.forEach(node => { + declarePattern((node).value || (node).argument, parent); + }); + break; + case 'ArrayPattern': + (node).elements.forEach(node => { + if (node) declarePattern(node, parent); + }); + break; + case 'RestElement': + declarePattern((node).argument, parent); + break; + case 'AssignmentPattern': + declarePattern((node).left, parent); + break; + default: + throw new Error('Unrecognized pattern type: ' + node.type); + } +} + +function declareFunction(node: Node & (FunctionDeclaration | FunctionExpression | ArrowFunctionExpression)) { + initLocals(node); + node.params.forEach(param => { + declarePattern(param, node); + }); + if (node.id) { + node[locals].has(node.id.name); + } +} + +function declareClass(node: Node & (ClassDeclaration | ClassExpression)) { + initLocals(node); + if (node.id) { + node[locals].has(node.id.name); + } +} + +function declareModuleSpecifier(ast: Node) { + initLocals(ast); + return (node: Node & ImportModuleSpecifier) => { + ast[locals].has(node.local.name); + }; +} + +function finder(node: Node, condition: (parent: Node) => boolean) { + let parent = node, found = false; + while (parent && !found) { + if (condition(parent)) { + found = true; + } else { + parent = parent.parent; + } + } + return { parent, found }; +} + +function initLocals(node: Node) { + node[locals] = node[locals] || new Set(); +} + +function isGlobal(globals: Set, { name }: { name: string }) { + return globals.has(name) || isBuildIn(name) +} + +export default function findGlobals(source: string | Program, globals: Set = new Set()) { + const globalMap: Map = new Map(); + const ast = typeof source === 'string' ? parseModule(source) : source; + + if (!(ast && typeof ast === 'object' && ast.type === 'Program')) { + throw new TypeError('Source must be either a string of JavaScript or a Meriyah AST'); + } + + visit(ast, { + enter(node) { + if (!node.parent) { + node.parent = this.parent; + } + }, + Identifier(node: Node & Identifier) { + let name = node.name; + if (name === 'undefined') return; + if (node.parent && !isRef(node, node.parent)) return; + const { found } = finder(node.parent, parent => { + if (name === 'arguments' && isFunctionNode(parent)) { + return true; + } + if (parent[locals] && parent[locals].has(name)) { + return true; + } + }); + if (!found && !isGlobal(globals, node)) { + if (!globalMap.has(name)) { + globalMap.set(name, []); + } + globalMap.get(name).push(node); + } + }, + VariableDeclaration({ kind, declarations }: Node & VariableDeclaration) { + const scope = kind === 'var' ? isScope : isBlockScope; + const { parent } = finder(this.parent, p => scope(p)); + initLocals(parent); + declarations.forEach(declaration => { + declarePattern(declaration.id, parent); + }); + }, + FunctionDeclaration(node: Node & FunctionDeclaration) { + const { parent } = finder(node.parent, p => isScope(p)); + initLocals(parent); + if (node.id) { + parent[locals].has(node.id.name); + } + declareFunction(node); + }, + FunctionExpression: declareFunction, + ArrowFunctionExpression: declareFunction, + ClassDeclaration(node: Node & ClassDeclaration) { + const { parent } = finder(node.parent, p => isBlockScope(p)); + initLocals(parent); + if (node.id) { + parent[locals].has(node.id.name); + } + declareClass(node); + }, + ClassExpression: declareClass, + CatchClause(node: Node & CatchClause) { + if (node.param) { + initLocals(node); + declarePattern(node.param, node); + } + }, + ImportDefaultSpecifier: declareModuleSpecifier(ast), + ImportSpecifier: declareModuleSpecifier(ast), + ImportNamespaceSpecifier: declareModuleSpecifier(ast) + }); + + const result: { name: string; nodes: (Node & Identifier)[] }[] = []; + globalMap.forEach((nodes, name) => { + return result.push({ name, nodes }); + }); + return result; +} diff --git a/src/parsers/script/context/index.ts b/src/parsers/script/context/index.ts new file mode 100644 index 0000000..b788668 --- /dev/null +++ b/src/parsers/script/context/index.ts @@ -0,0 +1,115 @@ +import parse from '../parser'; +import findGlobals, { Node as BaseNode } from './globals'; +import { generate } from '../generator'; +import { assignNode, expression } from './expression'; +import { + memberExpression, literal, binaryExpression, callExpression, isLiteral, isAssignmentExpression, + isIdentifier, isUpdateExpression, isMemberExpression, ExpressionParameter, arrowFunctionExpression, + expressionStatement, arrayPattern +} from '../nodes'; +import { + Node as AnyNode, ExpressionStatement, MemberExpression, UpdateExpression, AssignmentExpression, + Identifier, Program +} from '../estree'; + +interface Node extends BaseNode { + scoped?: boolean; +} + +function visitors(nodeType: string) { + const _visitors = { + UpdateExpression(node: Node & UpdateExpression) { + _visitors.AssignmentExpression(node); + }, + AssignmentExpression(node: Node & (AssignmentExpression | UpdateExpression)) { + assignify(node); + } + }; + return _visitors[nodeType]; +} + +function assignify(node: Node & (AssignmentExpression | UpdateExpression)) { + if (isAssignable(node)) { + let operator: string, left: ExpressionParameter, _right: ExpressionParameter; + if (isAssignmentExpression(node)) { + left = node.left; + const { right } = node; + operator = node.operator.replace('=', '').trim(); + _right = operator ? binaryExpression(left, right, operator) : right; + } else { + left = node.argument; + _right = binaryExpression(left, literal(1), node.operator[0]); + } + const key = expression(`(\`${literalify(left)}\`)`); + const caller = memberExpression('_$ctx', '$set'); + const _node = callExpression(caller, [key.expression, _right]); + assignNode(node, _node); + } +} + +function literalify(node: any) { + if (isIdentifier(node)) { + return (node).name; + } else { + let path = isIdentifier(node.object) ? `${node.object.name}` : literalify(node.object); + const _node = [node.property]; + let prop = isLiteral(_node[0]) ? _node[0].value : generate(_node[0]); + prop = node.computed && !isLiteral(_node[0]) ? `.\${${prop}}` : `.${prop}`; + return `${path}${prop}`; + } +} + +function findAssignParent(parent: Node) { + let node = parent; + let isAssig = false; + while (node && !isAssig) { + if (/(Assignment|Update)E/.test(node.type)) { + isAssig = true; + } else { + node = node.parent; + } + } + return isAssig ? node : void 0; +} + +function isAssignable(node: Node) { + switch (true) { + case isAssignmentExpression(node): + return isAssignable((node).left); + case isUpdateExpression(node): + return isAssignable((node).argument); + case isMemberExpression(node): + return isAssignable((node).object); + default: + return isIdentifier(node); + } +} + +export default function context(source: string, params: Set = new Set(), extras: string[] = []) { + const ast = parse(`(${source})`); + const parameters = new Set(['_$ctx', ...params, ...(extras || [])]); + let globs = findGlobals(ast, parameters); + const globals = globs.flatMap(glob => glob.nodes); + globals.forEach(({ parent }) => { + const assign = findAssignParent(parent); + if (assign) { + const visitor = visitors(assign.type); + if (visitor) { + visitor(assign); + } + } + }); + + globs = findGlobals(ast, parameters); + const args = globs.map(glob => glob.name); + if (args.length) { + const exp = (ast.body[0]).expression; + const callee = arrowFunctionExpression([arrayPattern(args)], exp); + const expression = callExpression('_$context', [ + '_$ctx', callee, ...args.map(arg => literal(arg)) + ]); + ast.body = [expressionStatement(expression)]; + } + + return (generate(ast)).trim(); +} diff --git a/src/parsers/script/context/reference.ts b/src/parsers/script/context/reference.ts new file mode 100644 index 0000000..f88619d --- /dev/null +++ b/src/parsers/script/context/reference.ts @@ -0,0 +1,103 @@ +type Node = Record; + +export default function isReferenced(node: Node, parent: Node, grandparent?: Node) { + switch (parent.type) { + // yes: { [NODE]: '' } + // yes: { NODE } + // no: { NODE: '' } + case 'Property': + return parent.value === node || parent.computed; + // no: break NODE; + // no: continue NODE; + case 'BreakStatement': + case 'ContinueStatement': + return false; + // yes: left = NODE; + // yes: NODE = right; + case 'AssignmentExpression': + return true; + // yes: PARENT[NODE] + // yes: NODE.child + // no: parent.NODE + case "MemberExpression": + if (parent.property === node) { + return !!parent.computed; + } + return parent.object === node; + // no: let NODE = init; + // yes: let id = NODE; + case "VariableDeclarator": + return parent.init === node; + // yes: () => NODE + // no: (NODE) => {} + case "ArrowFunctionExpression": + return parent.body === node; + // no: export { foo as NODE }; + // yes: export { NODE as foo }; + // no: export { NODE as foo } from "foo"; + case "ExportSpecifier": + if (!grandparent || grandparent.source) { + return false; + } + return parent.local === node; + // yes: class { [NODE] = value; } + // yes: class { key = NODE; } + // yes: class { [NODE]() {} } + // no: class { NODE() {} } + // no: class { NODE = value; } + case "MethodDefinition": + if (parent.key === node) { + return !!parent.computed; + } + if (parent.value === node) { + return !grandparent || grandparent.type !== "ObjectPattern"; + } + return true; + // no: class NODE {} + // yes: class Foo extends NODE {} + case "ClassDeclaration": + case "ClassExpression": + return parent.superClass === node; + // no: [NODE = foo] = []; + // yes: [foo = NODE] = []; + case "AssignmentPattern": + return parent.right === node; + // no: NODE: for (;;) {} + case "LabeledStatement": + return false; + // no: try {} catch (NODE) {} + case "CatchClause": + return false; + // no: function foo(...NODE) {} + case "RestElement": + return false; + // no: function NODE() {} + // no: function foo(NODE) {} + case "FunctionDeclaration": + case "FunctionExpression": + return false; + // no: export NODE from "foo"; + // no: export * as NODE from "foo"; + case "ExportNamespaceSpecifier": + return false; + // no: import NODE from "foo"; + // no: import * as NODE from "foo"; + // no: import { NODE as foo } from "foo"; + // no: import { foo as NODE } from "foo"; + // no: import NODE from "bar"; + case "ImportDefaultSpecifier": + case "ImportNamespaceSpecifier": + case "ImportSpecifier": + return false; + // no: [NODE] = []; + // no: ({ NODE }) = []; + case "ObjectPattern": + case "ArrayPattern": + return false; + // no: new.NODE + // no: NODE.target + case "MetaProperty": + return false; + } + return true; +} \ No newline at end of file diff --git a/src/parsers/script/estree.d.ts b/src/parsers/script/estree.d.ts new file mode 100644 index 0000000..dd935ec --- /dev/null +++ b/src/parsers/script/estree.d.ts @@ -0,0 +1,563 @@ +// Types +export type Declaration = VariableDeclaration | FunctionDeclaration | ClassDeclaration; +export type ImportModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier; +export type DefaultDeclaration = AnonymousFunctionDeclaration | FunctionDeclaration | ClassExpression | ClassDeclaration | Expression; +export type FunctionNode = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; +export type Statement = BlockStatement | ExpressionStatement | EmptyStatement | DebuggerStatement | + WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | + IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | + ForStatement | ForInStatement | ForOfStatement | Declaration; +export type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration; +export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern; +export type Expression = Identifier | Literal | RegExpLiteral | ThisExpression | ArrayExpression | ObjectExpression | + FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | + AssignmentExpression | LogicalExpression | MemberExpression | ConditionalExpression | + CallExpression | NewExpression | SequenceExpression | Super | ArrowFunctionExpression | + YieldExpression | TemplateLiteral | TaggedTemplateExpression | AwaitExpression | MetaProperty | + ClassExpression | ImportExpression; +export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; +export type UpdateOperator = "++" | "--"; +export type LogicalOperator = "&&" | "||"; +export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | + ">>>" | "+" | "-" | "*" | "**" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof"; +export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "**=" | "/=" | "%=" | "<<=" | ">>=" | + ">>>=" | "|=" | "^=" | "&="; +type InnerNode = MethodDefinition | Property | ExportSpecifier | VariableDeclarator | CatchClause; +export type Node = InnerNode | Declaration | ImportModuleSpecifier | Statement | ModuleDeclaration + | Pattern | Expression; + +export interface NodeType { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' +} + +// Interfaces +export interface BaseNode { + type: string; + start?: number; + end?: number; + loc?: SourceLocation | null; + comments?: string; + trailingComments?: string; +} + +interface BaseFunction extends BaseNode { + id: Identifier | null; + params: Pattern[]; + body: BlockStatement | Expression; + async: boolean; +} + +interface BaseForLoop extends BaseNode { + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +interface BaseProperty extends BaseNode { + type: "Property"; + key: Expression; + value: Pattern | Expression; + method: boolean; + shorthand: boolean; + computed: boolean; + kind: "init" | "get" | "set"; +} + +interface BaseClass extends BaseNode { + id: Identifier | null; + superClass: Expression | null; + body: ClassBody; +} + +interface BaseModuleSpecifier extends BaseNode { + local: Identifier; +} + +interface AnonymousFunctionDeclaration extends BaseFunction { + type: "FunctionDeclaration"; + id: null; + body: BlockStatement +} + +interface ClassExpression extends BaseClass { + type: "ClassExpression"; + id: null; +} + +interface AssignmentProperty extends BaseProperty { + value: Pattern; + kind: "init"; + method: false; +} + +// Globas +export interface SourceLocation { + source?: string | null; + start: Position; + end: Position; +} + +export interface Position { + line: number; + column: number; +} + +export interface Identifier extends BaseNode { + type: "Identifier"; + name: string; + pattern?: boolean; +} + +export interface Literal extends BaseNode { + type: "Literal"; + value: string | boolean | null | number; + raw?: string; +} + +export interface RegExpLiteral extends BaseNode { + type: "Literal"; + value: RegExp; + regex: { + pattern: string; + flags: string; + }; + raw?: string; +} + +export interface Program extends BaseNode { + sourceType: "script" | "module"; + body: (Statement | ModuleDeclaration)[]; +} + +// Statements +export interface ExpressionStatement extends BaseNode { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface BlockStatement extends BaseNode { + type: "BlockStatement"; + body: Statement[]; +} + +export interface EmptyStatement extends BaseNode { + type: "EmptyStatement"; +} + +export interface DebuggerStatement extends BaseNode { + type: "DebuggerStatement"; +} + +export interface WithStatement extends BaseNode { + type: "WithStatement"; + object: Expression; + body: Statement; +} + +export interface ReturnStatement extends BaseNode { + type: "ReturnStatement"; + argument: Expression | null; +} + +export interface LabeledStatement extends BaseNode { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends BaseNode { + type: "BreakStatement"; + label: Identifier | null; +} + +export interface ContinueStatement extends BaseNode { + type: "ContinueStatement"; + label: Identifier | null; +} + +export interface IfStatement extends BaseNode { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate: Statement | null; +} + +export interface SwitchStatement extends BaseNode { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test: Expression | null; + consequent: Statement[]; +} + +export interface ThrowStatement extends BaseNode { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseNode { + type: "TryStatement"; + block: BlockStatement; + handler: CatchClause | null; + finalizer: BlockStatement | null; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Pattern | null; + body: BlockStatement; +} + +export interface WhileStatement extends BaseNode { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends BaseNode { + type: "DoWhileStatement"; + body: Statement; + test: Expression; +} + +export interface ForStatement extends BaseNode { + type: "ForStatement"; + init: VariableDeclaration | Expression | null; + test: Expression | null; + update: Expression | null; + body: Statement; +} + +export interface ForInStatement extends BaseForLoop { + type: "ForInStatement"; +} + +export interface ForOfStatement extends BaseForLoop { + type: "ForOfStatement"; + await: boolean; +} + +export interface FunctionDeclaration extends BaseFunction { + type: "FunctionDeclaration"; + id: Identifier; + body: BlockStatement; + generator: boolean; +} + +export interface VariableDeclaration extends BaseNode { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const"; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: Pattern; + init: Expression | null; +} + +export interface ClassDeclaration extends BaseClass { + type: "ClassDeclaration"; + id: Identifier; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: MethodDefinition[]; +} + +export interface MethodDefinition extends BaseNode { + type: "MethodDefinition"; + key: Expression; + value: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; +} + +// Expressions +export interface ThisExpression extends BaseNode { + type: "ThisExpression"; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface ArrayExpression extends BaseNode { + type: "ArrayExpression"; + elements: (Expression | SpreadElement | null)[]; +} + +export interface ObjectExpression extends BaseNode { + type: "ObjectExpression"; + properties: (Property | SpreadElement)[]; +} + +export interface Property extends BaseProperty { + value: Expression; +} + +export interface FunctionExpression extends BaseFunction { + type: "FunctionExpression"; + body: BlockStatement; + generator: boolean; +} + +export interface ArrowFunctionExpression extends BaseFunction { + type: "ArrowFunctionExpression"; + body: BlockStatement | Expression; + expression: boolean; +} + +export interface UnaryExpression extends BaseNode { + type: "UnaryExpression"; + operator: UnaryOperator; + prefix: boolean; + argument: Expression; +} + +export interface UpdateExpression extends BaseNode { + type: "UpdateExpression"; + operator: UpdateOperator; + argument: Expression; + prefix: boolean; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface BinaryExpression extends BaseNode { + type: "BinaryExpression"; + operator: BinaryOperator; + left: Expression; + right: Expression; +} + +export interface AssignmentExpression extends BaseNode { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: Pattern | MemberExpression; + right: Expression; +} + +export interface LogicalExpression extends BaseNode { + type: "LogicalExpression"; + operator: LogicalOperator; + left: Expression; + right: Expression; +} + +export interface MemberExpression extends BaseNode { + type: "MemberExpression"; + object: Expression | Super; + property: Expression; + computed: boolean; +} + +export interface ConditionalExpression extends BaseNode { + type: "ConditionalExpression"; + test: Expression; + alternate: Expression; + consequent: Expression; +} + +export interface CallExpression extends BaseNode { + type: "CallExpression"; + callee: Expression | Super; + arguments: (Expression | SpreadElement)[]; +} + +export interface NewExpression extends BaseNode { + type: "NewExpression"; + callee: Expression; + arguments: (Expression | SpreadElement)[]; +} + +export interface SequenceExpression extends BaseNode { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface YieldExpression extends BaseNode { + type: "YieldExpression"; + argument: Expression | null; + delegate: boolean; +} + +export interface TemplateLiteral extends BaseNode { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface TaggedTemplateExpression extends BaseNode { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + tail: boolean; + value: { + cooked: string | null; + raw: string; + }; +} + +export interface ClassExpression extends BaseClass { + type: "ClassExpression"; +} + +export interface MetaProperty extends BaseNode { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export interface AwaitExpression extends BaseNode { + type: "AwaitExpression"; + argument: Expression; +} + +export interface ImportExpression extends BaseNode { + type: "ImportExpression"; + source: Expression +} + +// Patterns +export interface ObjectPattern extends BaseNode { + type: "ObjectPattern"; + properties: (AssignmentProperty | RestElement)[]; +} + +export interface ArrayPattern extends BaseNode { + type: "ArrayPattern"; + elements: (Pattern | null)[]; +} + +export interface RestElement extends BaseNode { + type: "RestElement"; + argument: Pattern; +} + +export interface AssignmentPattern extends BaseNode { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; +} + +// Modules +export interface ImportDeclaration extends BaseNode { + type: "ImportDeclaration"; + specifiers: ImportModuleSpecifier[]; + source: Literal; +} + +export interface ImportSpecifier extends BaseModuleSpecifier { + type: "ImportSpecifier"; + imported: Identifier; +} + +export interface ImportDefaultSpecifier extends BaseModuleSpecifier { + type: "ImportDefaultSpecifier"; +} + +export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { + type: "ImportNamespaceSpecifier"; +} + +export interface ExportNamedDeclaration extends BaseNode { + type: "ExportNamedDeclaration"; + declaration: Declaration | null; + specifiers: ExportSpecifier[]; + source: Literal | null; +} + +export interface ExportSpecifier extends BaseModuleSpecifier { + type: "ExportSpecifier"; + exported: Identifier; +} + +export interface ExportDefaultDeclaration extends BaseNode { + type: "ExportDefaultDeclaration"; + declaration: DefaultDeclaration; +} + +export interface ExportAllDeclaration extends BaseNode { + type: "ExportAllDeclaration"; + source: Literal; +} diff --git a/src/parsers/script/generator.ts b/src/parsers/script/generator.ts new file mode 100644 index 0000000..287ebe9 --- /dev/null +++ b/src/parsers/script/generator.ts @@ -0,0 +1,999 @@ +import { + Node, Literal, RegExpLiteral, Identifier, MetaProperty, UpdateExpression, AssignmentExpression, + AssignmentPattern, ConditionalExpression, NewExpression, CallExpression, MemberExpression, + BinaryExpression, UnaryExpression, SequenceExpression, Property, ObjectExpression, + ArrayExpression, TemplateLiteral, AwaitExpression, YieldExpression, RestElement, + TaggedTemplateExpression, ForInStatement, FunctionDeclaration, BlockStatement, + ForOfStatement, Program, ExpressionStatement, IfStatement, LabeledStatement, BreakStatement, + ContinueStatement, WithStatement, SwitchStatement, ReturnStatement, ThrowStatement, TryStatement, + WhileStatement, DoWhileStatement, ForStatement, VariableDeclaration, VariableDeclarator, + ClassDeclaration, ImportDeclaration, ImportSpecifier, ExportDefaultDeclaration, + ExportNamedDeclaration, ExportAllDeclaration, MethodDefinition, ClassExpression, + ArrowFunctionExpression, ObjectPattern +} from './estree'; +import { Writable } from 'stream'; +// const { stringify } = JSON; + +type _Node = { type: string }; + +if (!String.prototype.repeat) { + throw new Error(`String.prototype.repeat is undefined`); +} + +function precedence(node: Node) { + switch (node.type) { + case 'SequenceExpression': + return 1; + case 'ArrowFunctionExpression': + case 'YieldExpression': + return 2; + case 'AssignmentExpression': + return 3; + case 'ConditionalExpression': + return 4; + case 'LogicalExpression': + switch (node.operator) { + case '||': + return 5; + case '&&': + return 6; + } + case 'BinaryExpression': + switch (node.operator) { + case '|': + return 7; + case '^': + return 8; + case '&': + return 9; + case '==': + case '!=': + case '===': + case '!==': + return 10; + case '<': + case '<=': + case '>': + case '>=': + case 'in': + case 'instanceof': + return 11; + case '<<': + case '>>': + case '>>>': + return 12; + case '+': + case '-': + return 13; + case '*': + case '/': + case '%': + return 14; + case '**': + return 15; + } + case 'UnaryExpression': + case 'AwaitExpression': + return 16; + case 'UpdateExpression': + return node.prefix ? 16 : 17; + case 'Literal': + case 'ObjectExpression': + return 17; + case 'CallExpression': + case 'MemberExpression': + return 18; + case 'NewExpression': + return !node.arguments.length ? 18 : 19; + default: + return 20; + } +} + +function stringify(value: string | boolean | number | null, quote = `'`) { + const quoteReplacer = new RegExp(`${quote}`, 'g'); + switch (typeof value) { + case 'string': + value = JSON.stringify(value); + return `${quote}${value.slice(1, value.length - 1).replace(quoteReplacer, `\\${quote}`)}${quote}`; + case 'number': + case 'boolean': + case 'object': + return `${value}`; + default: + throw new Error(`Not supported type '${typeof value}' stringifycation.`); + } +} + +function formatSequence(state: State, nodes: _Node[]) { + /* + Writes into `state` a sequence of `nodes`. + */ + const { generator } = state; + state.write('('); + if (nodes != null && nodes.length > 0) { + generator[nodes[0].type](state, nodes[0]); + const { length } = nodes; + for (let i = 1; i < length; i++) { + const param = nodes[i]; + state.write(', '); + generator[param.type](state, param); + } + } + state.write(')'); +} + +function expressionNeedsParenthesis(node: _Node, parentNode: _Node, isRightHand: boolean) { + const nodePrecedence = precedence(node); + const parentNodePrecedence = precedence(parentNode); + let needs = false; + + if (nodePrecedence === parentNodePrecedence && nodePrecedence === 15) { + // Exponentiation operator has right-to-left associativity + needs = !isRightHand; + } else if (nodePrecedence !== parentNodePrecedence) { + // Different node types + needs = nodePrecedence < parentNodePrecedence; + } else if (nodePrecedence !== 13 && nodePrecedence !== 14) { + // Not a `LogicalExpression` or `BinaryExpression` + needs = false; + } else if (isRightHand) { + // Parenthesis are used if both operators have the same precedence + needs = nodePrecedence <= parentNodePrecedence; + } else { + needs = nodePrecedence < parentNodePrecedence; + } + + return needs; +} + +function formatBinaryExpressionPart(state: State, node: _Node, parentNode: _Node, isRightHand: boolean) { + /* + Writes into `state` a left-hand or right-hand expression `node` + from a binary expression applying the provided `operator`. + The `isRightHand` parameter should be `true` if the `node` is a right-hand argument. + */ + const { generator } = state; + if (expressionNeedsParenthesis(node, parentNode, isRightHand)) { + state.write('('); + generator[node.type](state, node); + state.write(')'); + } else { + generator[node.type](state, node); + } +} + +function reindent(state: State, text: string, indent: string, lineEnd: string) { + /* + Writes into `state` the `text` string reindented with the provided `indent`. + */ + const lines = text.split('\n'); + const end = lines.length - 1; + state.write(lines[0].trim()); + if (end > 0) { + state.write(lineEnd); + for (let i = 1; i < end; i++) { + state.write(indent + lines[i].trim() + lineEnd); + } + state.write(indent + lines[end].trim()); + } +} + +function formatComments(state: State, comments: any, indent: string, lineEnd: string) { + /* + Writes into `state` the provided list of `comments`, with the given `indent` and `lineEnd` strings. + Line comments will end with `"\n"` regardless of the value of `lineEnd`. + Expects to start on a new unindented line. + */ + const { length } = comments; + for (let i = 0; i < length; i++) { + const comment = comments[i]; + state.write(indent); + if (comment.type[0] === 'L') { + // Line comment + state.write('// ' + comment.value.trim() + '\n'); + } else { + // Block comment + state.write('/*'); + reindent(state, comment.value, indent, lineEnd); + state.write('*/' + lineEnd); + } + } +} + +function hasCallExpression(node: Node) { + /* + Returns `true` if the provided `node` contains a call expression and `false` otherwise. + */ + let currentNode = node; + while (currentNode != null) { + const { type } = currentNode; + if (type[0] === 'C' && type[1] === 'a') { + // Is CallExpression + return true; + } else if (type[0] === 'M' && type[1] === 'e' && type[2] === 'm') { + // Is MemberExpression + currentNode = (currentNode).object; + } else { + return false; + } + } +} + +function formatVariableDeclaration(state: State, node: VariableDeclaration) { + /* + Writes into `state` a variable declaration. + */ + const { generator } = state; + const { declarations } = node; + const { length } = declarations; + if (length > 0) { + state.write(node.kind + ' '); + generator.VariableDeclarator(state, declarations[0]); + for (let i = 1; i < length; i++) { + state.write(', '); + generator.VariableDeclarator(state, declarations[i]); + } + } +} + +let forInStatement: (state: State, node: ForInStatement | ForOfStatement) => void, + functionDeclaration: (state: State, node: FunctionDeclaration) => void, + restElement: (state: State, node: RestElement) => void, + binaryExpression: (state: State, node: BinaryExpression) => void, + arrayExpression: (state: State, node: ArrayExpression) => void, + blockStatement: (state: State, node: BlockStatement) => void; + +export const generator = { + Program(state: State, node: Program) { + const indent = state.indent.repeat(state.indentLevel); + const { lineEnd, writeComments } = state; + if (writeComments && node.comments != null) { + formatComments(state, node.comments, indent, lineEnd); + } + const statements = node.body; + const { length } = statements; + for (let i = 0; i < length; i++) { + const statement = statements[i]; + if (writeComments && statement.comments != null) { + formatComments(state, statement.comments, indent, lineEnd); + } + state.write(indent); + this[statement.type](state, statement); + state.write(lineEnd); + } + if (writeComments && node.trailingComments != null) { + formatComments(state, node.trailingComments, indent, lineEnd); + } + }, + BlockStatement: (blockStatement = (state, node) => { + const indent = state.indent.repeat(state.indentLevel++); + const { lineEnd, writeComments } = state; + const statementIndent = indent + state.indent; + state.write('{'); + const statements = node.body; + if (statements != null && statements.length > 0) { + state.write(lineEnd); + if (writeComments && node.comments != null) { + formatComments(state, node.comments, statementIndent, lineEnd); + } + const { length } = statements; + for (let i = 0; i < length; i++) { + const statement = statements[i]; + if (writeComments && statement.comments != null) { + formatComments(state, statement.comments, statementIndent, lineEnd); + } + state.write(statementIndent); + generator[statement.type](state, statement); + state.write(lineEnd); + } + state.write(indent); + } else { + if (writeComments && node.comments != null) { + state.write(lineEnd); + formatComments(state, node.comments, statementIndent, lineEnd); + state.write(indent); + } else { + state.write(' '); + } + } + if (writeComments && node.trailingComments != null) { + formatComments(state, node.trailingComments, statementIndent, lineEnd); + } + state.write('}'); + state.indentLevel--; + }), + ClassBody: blockStatement, + EmptyStatement(state: State) { + state.end(); + }, + ExpressionStatement(state: State, node: ExpressionStatement) { + if (node.expression.type[0] === 'O' && node.expression.type[6] === 'E') { + state.write('('); + this[node.expression.type](state, node.expression); + state.write(')'); + } else { + this[node.expression.type](state, node.expression); + } + state.end(); + }, + IfStatement(state: State, node: IfStatement) { + state.write('if ('); + this[node.test.type](state, node.test); + state.write(') '); + this[node.consequent.type](state, node.consequent); + if (node.alternate != null) { + state.write(' else '); + this[node.alternate.type](state, node.alternate); + } + }, + LabeledStatement(state: State, node: LabeledStatement) { + this[node.label.type](state, node.label); + state.write(': '); + this[node.body.type](state, node.body); + }, + BreakStatement(state: State, node: BreakStatement) { + state.write('break'); + if (node.label != null) { + state.write(' '); + this[node.label.type](state, node.label); + } + state.end(); + }, + ContinueStatement(state: State, node: ContinueStatement) { + state.write('continue'); + if (node.label != null) { + state.write(' '); + this[node.label.type](state, node.label); + } + state.end(); + }, + WithStatement(state: State, node: WithStatement) { + state.write('with ('); + this[node.object.type](state, node.object); + state.write(') '); + this[node.body.type](state, node.body); + }, + SwitchStatement(state: State, node: SwitchStatement) { + const indent = state.indent.repeat(state.indentLevel++); + const { lineEnd, writeComments } = state; + state.indentLevel++; + const caseIndent = indent + state.indent; + const statementIndent = caseIndent + state.indent; + state.write('switch ('); + this[node.discriminant.type](state, node.discriminant); + state.write(') {' + lineEnd); + const { cases: occurences } = node; + const { length: occurencesCount } = occurences; + for (let i = 0; i < occurencesCount; i++) { + const occurence = occurences[i]; + if (writeComments && occurence.comments != null) { + formatComments(state, occurence.comments, caseIndent, lineEnd); + } + if (occurence.test) { + state.write(caseIndent + 'case '); + this[occurence.test.type](state, occurence.test); + state.write(':' + lineEnd); + } else { + state.write(caseIndent + 'default:' + lineEnd); + } + const { consequent } = occurence; + const { length: consequentCount } = consequent; + for (let i = 0; i < consequentCount; i++) { + const statement = consequent[i]; + if (writeComments && statement.comments != null) { + formatComments(state, statement.comments, statementIndent, lineEnd); + } + state.write(statementIndent); + this[statement.type](state, statement); + state.write(lineEnd); + } + } + state.indentLevel -= 2; + state.write(indent + '}'); + }, + ReturnStatement(state: State, node: ReturnStatement) { + state.write('return'); + if (node.argument) { + state.write(' '); + this[node.argument.type](state, node.argument); + } + state.end(); + }, + ThrowStatement(state: State, node: ThrowStatement) { + state.write('throw '); + this[node.argument.type](state, node.argument); + state.end(); + }, + TryStatement(state: State, node: TryStatement) { + state.write('try '); + this[node.block.type](state, node.block); + if (node.handler) { + const { handler } = node; + if (handler.param == null) { + state.write(' catch '); + } else { + state.write(' catch ('); + this[handler.param.type](state, handler.param); + state.write(') '); + } + this[handler.body.type](state, handler.body); + } + if (node.finalizer) { + state.write(' finally '); + this[node.finalizer.type](state, node.finalizer); + } + }, + WhileStatement(state: State, node: WhileStatement) { + state.write('while ('); + this[node.test.type](state, node.test); + state.write(') '); + this[node.body.type](state, node.body); + }, + DoWhileStatement(state: State, node: DoWhileStatement) { + state.write('do '); + this[node.body.type](state, node.body); + state.write(' while ('); + this[node.test.type](state, node.test); + state.write(');'); + }, + ForStatement(state: State, node: ForStatement) { + state.write('for ('); + if (node.init != null) { + const { init } = node; + if (init.type[0] === 'V') { + formatVariableDeclaration(state, init); + } else { + this[init.type](state, init); + } + } + state.write('; '); + if (node.test) { + this[node.test.type](state, node.test); + } + state.write('; '); + if (node.update) { + this[node.update.type](state, node.update); + } + state.write(') '); + this[node.body.type](state, node.body); + }, + ForInStatement: (forInStatement = (state, node) => { + state.write(`for ${(node).await ? 'await ' : ''}(`); + const { left } = node; + if (left.type[0] === 'V') { + formatVariableDeclaration(state, left); + } else { + generator[left.type](state, left); + } + // Identifying whether node.type is `ForInStatement` or `ForOfStatement` + state.write(node.type[3] === 'I' ? ' in ' : ' of '); + generator[node.right.type](state, node.right); + state.write(') '); + generator[node.body.type](state, node.body); + }), + ForOfStatement: forInStatement, + DebuggerStatement(state: State) { + state.write('debugger;' + state.lineEnd); + }, + FunctionDeclaration: (functionDeclaration = (state, node) => { + node.async && state.write('async '); + state.write('function'); + node.generator && state.write('*'); + state.write(` ${node.id ? node.id.name : ''}`); + formatSequence(state, node.params); + state.write(' '); + generator[node.body.type](state, node.body); + }), + FunctionExpression: functionDeclaration, + VariableDeclaration(state: State, node: VariableDeclaration) { + formatVariableDeclaration(state, node); + node.declarations.length && state.end(); + }, + VariableDeclarator(state: State, node: VariableDeclarator) { + this[node.id.type](state, node.id); + if (node.init != null) { + state.write(' = '); + this[node.init.type](state, node.init); + } + }, + ClassDeclaration(state: State, node: ClassDeclaration) { + state.write(`class ${node.id ? `${node.id.name} ` : ''}`); + if (node.superClass) { + state.write('extends '); + this[node.superClass.type](state, node.superClass); + state.write(' '); + } + this.ClassBody(state, node.body); + }, + ImportDeclaration(state: State, node: ImportDeclaration) { + state.write('import '); + const { specifiers } = node; + const { length } = specifiers; + // NOTE: Once babili is fixed, put this after condition + // https://github.com/babel/babili/issues/430 + let i = 0; + if (length > 0) { + for (; i < length;) { + if (i > 0) { + state.write(', '); + } + const specifier = specifiers[i]; + const type = specifier.type[6]; + if (type === 'D') { + // ImportDefaultSpecifier + state.write(specifier.local.name); + i++; + } else if (type === 'N') { + // ImportNamespaceSpecifier + state.write('* as ' + specifier.local.name); + i++; + } else { + // ImportSpecifier + break; + } + } + if (i < length) { + state.write('{ '); + for (; ;) { + const specifier = specifiers[i]; + const { name } = (specifier).imported; + state.write(name); + if (name !== specifier.local.name) { + state.write(' as ' + specifier.local.name); + } + if (++i < length) { + state.write(', '); + } else { + break; + } + } + state.write(' }'); + } + state.write(' from '); + } + this.Literal(state, node.source); + state.end(); + }, + ExportDefaultDeclaration(state: State, node: ExportDefaultDeclaration) { + state.write('export default '); + this[node.declaration.type](state, node.declaration); + if (node.declaration.type[0] !== 'F') { + // All expression nodes except `FunctionExpression` + state.end(); + } + }, + ExportNamedDeclaration(state: State, node: ExportNamedDeclaration) { + state.write('export '); + if (node.declaration) { + this[node.declaration.type](state, node.declaration); + } else { + state.write('{'); + const { specifiers } = node, + { length } = specifiers; + if (length > 0) { + for (let i = 0; ;) { + const specifier = specifiers[i]; + const { name } = specifier.local; + state.write(name); + if (name !== specifier.exported.name) { + state.write(' as ' + specifier.exported.name); + } + if (++i < length) { + state.write(', '); + } else { + break; + } + } + } + state.write('}'); + if (node.source) { + state.write(' from '); + this.Literal(state, node.source); + } + state.end(); + } + }, + ExportAllDeclaration(state: State, node: ExportAllDeclaration) { + state.write('export * from '); + this.Literal(state, node.source); + state.end(); + }, + MethodDefinition(state: State, node: MethodDefinition) { + if (node.static) { + state.write('static '); + } + const kind = node.kind[0]; + if (kind === 'g' || kind === 's') { + // Getter or setter + state.write(node.kind + ' '); + } + if (node.value.async) { + state.write('async '); + } + if (node.value.generator) { + state.write('*'); + } + if (node.computed) { + state.write('['); + this[node.key.type](state, node.key); + state.write(']'); + } else { + this[node.key.type](state, node.key); + } + formatSequence(state, node.value.params); + state.write(' '); + this[node.value.body.type](state, node.value.body); + }, + ClassExpression(state: State, node: ClassExpression) { + this.ClassDeclaration(node, state); + }, + ArrowFunctionExpression(state: State, node: ArrowFunctionExpression) { + state.write(node.async ? 'async ' : ''); + const { params } = node; + if (params != null) { + // Omit parenthesis if only one named parameter + if (params.length === 1 && params[0].type[0] === 'I') { + // If params[0].type[0] starts with 'I', it can't be `ImportDeclaration` nor `IfStatement` + // and thus is`Identifier` + state.write((params[0]).name); + } else { + formatSequence(state, node.params); + } + } + state.write(' => '); + if (node.body.type[0] === 'O') { + // Body is an object expression + state.write('('); + this.ObjectExpression(state, node.body); + state.write(')'); + } else { + this[node.body.type](state, node.body); + } + }, + ThisExpression(state: State) { + state.write('this'); + }, + Super(state: State) { + state.write('super'); + }, + RestElement: (restElement = (state: State, node: RestElement) => { + state.write('...'); + generator[node.argument.type](state, node.argument); + }), + SpreadElement: restElement, + YieldExpression(state: State, node: YieldExpression) { + state.write(node.delegate ? 'yield*' : 'yield'); + if (node.argument) { + state.write(' '); + this[node.argument.type](state, node.argument); + } + }, + AwaitExpression(state: State, node: AwaitExpression) { + state.write('await '); + if (node.argument) { + this[node.argument.type](state, node.argument); + } + }, + TemplateLiteral(state: State, node: TemplateLiteral) { + const { quasis, expressions } = node; + state.write('`'); + const { length } = expressions; + for (let i = 0; i < length; i++) { + const expression = expressions[i]; + state.write(quasis[i].value.raw); + state.write('${'); + this[expression.type](state, expression); + state.write('}'); + } + state.write(quasis[quasis.length - 1].value.raw); + state.write('`'); + }, + TaggedTemplateExpression(state: State, node: TaggedTemplateExpression) { + this[node.tag.type](state, node.tag); + this[node.quasi.type](state, node.quasi); + }, + ArrayExpression: (arrayExpression = (state: State, node: ArrayExpression) => { + state.write('['); + if (node.elements.length > 0) { + const { elements } = node, + { length } = elements; + for (let i = 0; ;) { + const element = elements[i]; + if (element != null) { + generator[element.type](state, element); + } + if (++i < length) { + state.write(', '); + } else { + if (element == null) { + state.write(', '); + } + break; + } + } + } + state.write(']'); + }), + ArrayPattern: arrayExpression, + ObjectExpression(state: State, node: ObjectExpression) { + const indent = state.indent.repeat(state.indentLevel++); + const { lineEnd, writeComments } = state; + const propertyIndent = indent + state.indent; + state.write('{'); + if (node.properties.length > 0) { + state.write(lineEnd); + if (writeComments && node.comments != null) { + formatComments(state, node.comments, propertyIndent, lineEnd); + } + const comma = ',' + lineEnd; + const { properties } = node, + { length } = properties; + for (let i = 0; ;) { + const property = properties[i]; + if (writeComments && property.comments != null) { + formatComments(state, property.comments, propertyIndent, lineEnd); + } + state.write(propertyIndent); + this[property.type](state, property); + if (++i < length) { + state.write(comma); + } else { + break; + } + } + state.write(lineEnd); + if (writeComments && node.trailingComments != null) { + formatComments(state, node.trailingComments, propertyIndent, lineEnd); + } + state.write(indent + '}'); + } else if (writeComments) { + if (node.comments != null) { + state.write(lineEnd); + formatComments(state, node.comments, propertyIndent, lineEnd); + if (node.trailingComments != null) { + formatComments(state, node.trailingComments, propertyIndent, lineEnd); + } + state.write(indent + '}'); + } else if (node.trailingComments != null) { + state.write(lineEnd); + formatComments(state, node.trailingComments, propertyIndent, lineEnd); + state.write(indent + '}'); + } else { + state.write('}'); + } + } else { + state.write('}'); + } + state.indentLevel--; + }, + Property(state: State, node: Property) { + if (node.method || node.kind[0] !== 'i') { + // Either a method or of kind `set` or `get` (not `init`) + this.MethodDefinition(state, node); + } else { + if (!node.shorthand) { + if (node.computed) { + state.write('['); + this[node.key.type](state, node.key); + state.write(']'); + } else { + this[node.key.type](state, node.key); + } + state.write(': '); + } + this[node.value.type](state, node.value); + } + }, + ObjectPattern(state: State, node: ObjectPattern) { + state.write('{'); + if (node.properties.length > 0) { + const { properties } = node, + { length } = properties; + for (let i = 0; ;) { + this[properties[i].type](state, properties[i]); + if (++i < length) { + state.write(', '); + } else { + break; + } + } + } + state.write('}'); + }, + SequenceExpression(state: State, node: SequenceExpression) { + formatSequence(state, node.expressions); + }, + UnaryExpression(state: State, node: UnaryExpression) { + state.write(node.operator); + if (node.operator.length > 1) { + state.write(' '); + } + if (precedence(node.argument) < precedence(node)) { + state.write('('); + this[node.argument.type](state, node.argument); + state.write(')'); + } else { + this[node.argument.type](state, node.argument); + } + }, + UpdateExpression(state: State, node: UpdateExpression) { + // Always applied to identifiers or members, no parenthesis check needed + if (node.prefix) { + state.write(node.operator); + this[node.argument.type](state, node.argument); + } else { + this[node.argument.type](state, node.argument); + state.write(node.operator); + } + }, + AssignmentExpression(state: State, node: AssignmentExpression) { + this[node.left.type](state, node.left); + state.write(' ' + node.operator + ' '); + this[node.right.type](state, node.right); + }, + AssignmentPattern(state: State, node: AssignmentPattern) { + this[node.left.type](state, node.left); + state.write(' = '); + this[node.right.type](state, node.right); + }, + BinaryExpression: (binaryExpression = (state: State, node: BinaryExpression) => { + formatBinaryExpressionPart(state, node.left, node, false); + state.write(` ${node.operator} `); + formatBinaryExpressionPart(state, node.right, node, true); + }), + LogicalExpression: binaryExpression, + ConditionalExpression(state: State, node: ConditionalExpression) { + if (precedence(node.test) > precedence(node)) { + this[node.test.type](state, node.test); + } else { + state.write('('); + this[node.test.type](state, node.test); + state.write(')'); + } + state.write(' ? '); + this[node.consequent.type](state, node.consequent); + state.write(' : '); + this[node.alternate.type](state, node.alternate); + }, + NewExpression(state: State, node: NewExpression) { + state.write('new '); + const callExp = { type: 'CallExpression' }; + if (precedence(node.callee) < precedence(callExp) || hasCallExpression(node.callee)) { + state.write('('); + this[node.callee.type](state, node.callee); + state.write(')'); + } else { + this[node.callee.type](state, node.callee); + } + formatSequence(state, node['arguments']); + }, + CallExpression(state: State, node: CallExpression) { + if (precedence(node.callee) < precedence(node)) { + state.write('('); + this[node.callee.type](state, node.callee); + state.write(')'); + } else { + this[node.callee.type](state, node.callee); + } + formatSequence(state, node['arguments']); + }, + MemberExpression(state: State, node: MemberExpression) { + if (precedence(node.object) < precedence(node)) { + state.write('('); + this[node.object.type](state, node.object); + state.write(')'); + } else { + this[node.object.type](state, node.object); + } + if (node.computed) { + state.write('['); + this[node.property.type](state, node.property); + state.write(']'); + } else { + state.write('.'); + this[node.property.type](state, node.property); + } + }, + MetaProperty(state: State, node: MetaProperty) { + state.write(node.meta.name + '.' + node.property.name); + }, + Identifier(state: State, node: Identifier) { + state.write(node.name); + }, + Literal(state: State, node: Literal | RegExpLiteral) { + if (node.raw != null) { + state.write(node.raw); + } else if ((node).regex != null) { + const { regex } = node; + state.write(`/${regex.pattern}/${regex.flags}`); + } else { + state.write(stringify((node).value, state.quotemark)); + } + }, + FieldDefinition(state: State, node: any) { + if (node.static) { + state.write('static '); + } + node.computed && state.write('['); + this[node.key.type](state, node.key); + node.computed && state.write(']'); + state.write(' = '); + if (node.value != null) { + this[node.value.type](state, node.value); + } + // TO-DO: Write Decorators on node.decorators[] + state.end(); + } +}; + +const EMPTY_OBJECT = {}; + +class State { + + indent: string; + lineEnd: string; + quotemark: string; + indentLevel: number; + writeComments: boolean; + output: Writable | string; + generator: { [key: string]: (state: State, node?: _Node) => void }; + + + constructor(options?: GeneratorOptions) { + const setup: GeneratorOptions = options == null ? EMPTY_OBJECT : options; + // Functional options + if (setup.output != null) { + this.output = setup.output; + this.write = this.writeToStream; + } else { + this.output = ''; + } + this.end = setup.semicolon ? this.end : (() => { }); + this.generator = setup.generator != null ? setup.generator : generator; + // Formating setup + this.indent = setup.indent != null ? setup.indent : ' '; + this.lineEnd = setup.lineEnd != null ? setup.lineEnd : '\n'; + this.quotemark = setup.quotemark != null ? setup.quotemark : '"'; + this.indentLevel = + setup.startingIndentLevel != null ? setup.startingIndentLevel : 0; + this.writeComments = setup.comments ? setup.comments : false; + } + write(code: string) { + this.output += code; + } + writeToStream(code: string) { + (this.output).write(code); + } + end() { + this.write(';'); + } + toString() { + return this.output; + } +} + +interface GeneratorOptions { + // - `indent`: string to use for indentation(defaults to`␣␣`) + indent?: string; + // - `lineEnd`: string to use for line endings(defaults to`\n`) + lineEnd?: string; + // - `quotemark`: string to use for quotetion(defaults to`"`) + quotemark?: string; + // - `startingIndentLevel`: indent level to start from(defaults to`0`) + startingIndentLevel?: number; + // - `comments`: generate comments if `true`(defaults to`false`) + comments?: boolean; + // - `output`: output stream to write the rendered code to(defaults to`null`) + output?: Writable | null; + // - `semicolon`: control of semicolon at the end of some statements(defaults to`false`) + semicolon?: boolean; + // - `generator`: custom code generator(defaults to`baseGenerator`) + generator?: { [key: string]: (state: State, node?: _Node) => void }; +} + +export function generate(node: Node | Program, options?: GeneratorOptions) { + const state = new State(options); + state.generator[node.type](state, node); + return state.output; +} diff --git a/src/parsers/script/index.ts b/src/parsers/script/index.ts new file mode 100644 index 0000000..67f158c --- /dev/null +++ b/src/parsers/script/index.ts @@ -0,0 +1,172 @@ +import ctx from './context'; +import { Segments } from './segments'; +import componentTpl from './templates'; +import { Element } from '../html/element'; +import parseComponent from '../../component'; +import parseDirective from './parseDirective'; +import { serialize } from '../html/serializer'; +import { AllHtmlEntities } from 'html-entities'; +import processEvent from '../../attributes/event'; +import { processSlot } from '../../component/slot'; +import processBinding from '../../attributes/binding'; +import processReference from '../../attributes/reference'; +import { callExpression, assignmentExpression, literal } from './nodes'; +import { capitalize, each, filters, parseTextExpression, filterPlaceholders } from '../../utils'; + +const entities = new AllHtmlEntities(); + +function getChildExp(parent: string, childIndex = 0) { + return callExpression('_$child', childIndex ? [parent, literal(childIndex)] : [parent]); +} + +function hasSpecialAttrs(element: Element, specials: string[]) { + return specials.some(attr => element.hasAttribute(`$${attr}`)); +} + +function isExpAttr(attr: { name: string }) { + return /^[$@:#]/.test(attr.name); +} + +function toNodeWithoutExp(element: Element) { + const node = Object.create(null); + node.nodeName = element.tagName; + if (element.nodeType === 1) { + node.tagName = element.tagName; + } + if (element.hasExpression(false)) { + if (element.nodeType === 1) { + if (hasSpecialAttrs(element, specialAttrs) || element.isUnknownElement) { + node.nodeName = '#comment'; + delete node.tagName; + node.data = ''; + } else { + if (node.tagName === 'slot') { + node.nodeName = '#text'; + delete node.tagName; + node.value = ''; + } else { + node.attrs = element.attributes.filter(attr => !isExpAttr(attr)); + } + } + } else { + node.value = ' '; + } + } else { + if (element.nodeType === 8) { + node.data = element.textContent; + } else if (element.nodeType === 3) { + node.value = entities.decode(element.textContent); + } else { + node.attrs = element.attributes; + } + } + node.childNodes = hasSpecialAttrs(element, nonWalkAttrs) ? [] : element.childNodes.map(toNodeWithoutExp); + return node; +} + +function htmlWihtoutExp(element: { childNodes: Element[] }) { + const childNodes = element.childNodes.map(el => toNodeWithoutExp(el)); + const node = { nodeName: '#document', childNodes, tagName: '', attrs: [], parentNode: null }; + const html = serialize(node); + return html.split(''); +} + +function parseAttrs(node: Element, segmts: Segments) { + const { varName, attributes } = node; + if (!attributes.length) { + return; + } + const attrs = attributes.filter(attr => isExpAttr(attr)); + if (attrs.length) { + each(attrs, ({ name, value }) => { + const [type, attr] = [name[0], name.slice(1)]; + switch (type) { + case '$': + throw new Error(`Directive '${attr}' is not registered.`); + case ':': + processBinding(node, attr, value, segmts); + break; + case '@': + processEvent(node, attr, value, segmts); + break; + case '#': + processReference(varName, attr, segmts); + break; + default: { + throw new Error(`Unknown pattern '${type}' on attribute ${name}.`); + } + } + }); + } +} + +function parseTextNode(node: Element, parentVarName: string, text: string, index: number, segmts: Segments) { + const { varName } = node; + const setText = `_$set${capitalize(varName, 2)}`; + segmts.addImport('trebor/tools', '_$updateTxt'); + const params = filterPlaceholders([...segmts.globals]); + const textUpdateCall = callExpression('_$updateTxt', [varName, callExpression(setText, params)]); + const code = parseTextExpression(text, exp => filters(exp, segmts)); + segmts.init.push(setText); + segmts.extras.add(`${setText} = (${params.join(', ')}) => ${ctx(code, segmts.globals, segmts.globalTools)};`); + segmts.create.add(assignmentExpression(varName, getChildExp(parentVarName, index))); + segmts.update.add(textUpdateCall); + segmts.unmount.add(textUpdateCall); +} + +function parseNode(node: Element, index: number, segmts: Segments, parentVarName = '_$tpl') { + if (node.hasExpression()) { + const type = node.nodeType; + if (type === 1 || type === 3) { + if (node.isUnknownElement || node.tagName === 'slot') { + const func = node.tagName === 'slot' ? processSlot : parseComponent; + func(node, segmts, parentVarName, createTpl, index); + } else { + const varName = node.varName = segmts.addVar(type === 1 ? node.tagName : 'txt'); + if (type === 3) { + parseTextNode(node, parentVarName, node.textContent.trim(), index, segmts); + } else { + segmts.create.add(assignmentExpression(varName, getChildExp(parentVarName, index))); + const walkChildren = !hasSpecialAttrs(node, nonWalkAttrs); + parseDirective(node, segmts, parentVarName, createTpl); + if (walkChildren) { + parseAttrs(node, segmts); + each(node.childNodes, (child, i) => parseNode(child, i, segmts, varName)); + } + } + } + } + } +} + +let specialAttrs: string[] = []; +let nonWalkAttrs: string[] = []; + +export function setSpecialAttrs(specials: string[]) { + specialAttrs = specialAttrs.concat(specials); +} + +export function setNonWalkAttrs(nonWalk: string[]) { + nonWalkAttrs = nonWalkAttrs.concat(nonWalk); +} + +export { Segments }; + +export default function createTpl(nodes: Element[], segmts: Segments, tplName?: string, varName?: string) { + let realIndex = 0; + let content = ['']; + const { length } = nodes; + each(nodes, (node, index) => { + const html = htmlWihtoutExp({ childNodes: [node] }); + if (html.length === 1) { + content[content.length - 1] += html[0]; + } else { + content[content.length - 1] += html.shift(); + content = content.concat(html); + } + segmts.addImport('trebor/tools', '_$child'); + realIndex = length !== nodes.length ? realIndex + 1 : index; + parseNode(node, realIndex, segmts, varName); + }); + return tplName ? componentTpl(tplName, segmts, content) : content.join(`','`); +} diff --git a/src/parsers/script/nodes.d.ts b/src/parsers/script/nodes.d.ts new file mode 100644 index 0000000..a2aecbf --- /dev/null +++ b/src/parsers/script/nodes.d.ts @@ -0,0 +1,192 @@ +import { + BaseNode, Program, Expression, SpreadElement, AssignmentPattern, RestElement, ArrayPattern, ObjectPattern, + Identifier, ClassDeclaration, FunctionDeclaration, VariableDeclaration, ExportAllDeclaration, + ExportDefaultDeclaration, ExportNamedDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, + ImportSpecifier, Property, Literal, FunctionExpression, Declaration, Statement, ArrayExpression, + ArrowFunctionExpression, AssignmentExpression, BlockStatement, AwaitExpression, BinaryExpression, + BreakStatement, CallExpression, CatchClause, MethodDefinition, ClassBody, ClassExpression, + ConditionalExpression, ContinueStatement, DebuggerStatement, DoWhileStatement, EmptyStatement, + ExportSpecifier, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, IfStatement, + ImportDeclaration, LabeledStatement, LogicalExpression, MemberExpression, MetaProperty, + NewExpression, ObjectExpression, ReturnStatement, SequenceExpression, Super, SwitchCase, + SwitchStatement, TemplateLiteral, TaggedTemplateExpression, TemplateElement, ThisExpression, + ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclarator, + WhileStatement, WithStatement, YieldExpression, RegExpLiteral, ImportExpression, Pattern, + DefaultDeclaration, ImportModuleSpecifier, UnaryOperator, UpdateOperator, BinaryOperator, + AssignmentOperator, LogicalOperator, NodeType +} from "./estree"; + +export type Parameter = string | Pattern; +export type ExpressionParameter = string | Expression; +export type ArrayPatternElement = string | Pattern | null; +export type ObjectPatternProperty = Property | RestElement; +export type ExportableNamedDeclaration = Declaration | null; +export type ObjectExpressionProperty = Property | SpreadElement; +export type ArrayExpressionElement = ArgumentListElement | null; +export type ArgumentListElement = string | Expression | SpreadElement; +export type ExportableDefaultDeclaration = string | DefaultDeclaration; +export type PropertyValueParam = string | Pattern | FunctionExpression; + +interface BaseFunctionOptions { + async?: boolean; +} +interface BasePropertyOptions { + kind?: string; + computed?: boolean; +} + +export interface FunctionOptions extends BaseFunctionOptions { + generator?: boolean; +} +export interface ArrowFunctionOptions extends BaseFunctionOptions{ + expression?: boolean; +} +export interface PropertyOptions extends BasePropertyOptions { + method?: boolean; + shorthand?: boolean; +} +export interface MethodOptions extends BasePropertyOptions { + static?: boolean; +} + +export const Syntax: NodeType; + +// Node Builders +export function arrayExpression(elements?: ArrayExpressionElement[]): ArrayExpression; +export function arrayPattern(elements?: ArrayPatternElement[]): ArrayPattern; +export function arrowFunctionExpression(params: Parameter[], body: Expression | Statement[], options?: ArrowFunctionOptions): ArrowFunctionExpression; +export function assignmentExpression(left: string | Pattern | MemberExpression, right: ExpressionParameter, operator?: AssignmentOperator): AssignmentExpression; +export function assignmentPattern(left: Parameter, right: ExpressionParameter): ArrayPattern; +export function awaitExpression(argument: ExpressionParameter): AwaitExpression; +export function binaryExpression(left: ExpressionParameter, right: ExpressionParameter, operator: string | BinaryOperator): BinaryExpression; +export function blockStatement(body: Statement[]): BlockStatement; +export function breakStatement(label: string | null): BreakStatement; +export function callExpression(callee: ExpressionParameter | ImportExpression, args?: ArgumentListElement[]): CallExpression; +export function catchClause(param: Parameter, body: Statement[]): CatchClause; +export function classBody(body?: MethodDefinition[]): ClassBody; +export function classDeclaration(id: string, superClass?: string | null, body?: MethodDefinition[]): ClassDeclaration; +export function classExpression(id?: string | null, superClass?: string | null, body?: MethodDefinition[]): ClassExpression; +export function conditionalExpression(test: ExpressionParameter, consequent: ExpressionParameter, alternate: ExpressionParameter): ConditionalExpression; +export function continueStatement(label: string | null): ContinueStatement; +export function debuggerStatement(): DebuggerStatement; +export function doWhileStatement(test: ExpressionParameter, body: Statement | Statement[]): DoWhileStatement; +export function emptyStatement(): EmptyStatement; +export function exportAllDeclaration(source: string): ExportAllDeclaration; +export function exportDefaultDeclaration(declaration: ExportableDefaultDeclaration): ExportDefaultDeclaration; +export function exportNamedDeclaration(declaration: ExportableNamedDeclaration): ExportNamedDeclaration; +export function exportNamedExpression(specifiers: ExportSpecifier[], source: string): ExportNamedDeclaration; +export function exportSpecifier(local: string, exported: string): ExportSpecifier; +export function expressionStatement(expression: ExpressionParameter): ExpressionStatement; +export function forInStatement(left: ExpressionParameter, right: ExpressionParameter, body: Statement | Statement[]): ForInStatement; +export function forOfStatement(left: ExpressionParameter, right: ExpressionParameter, body: Statement | Statement[]): ForOfStatement; +export function forStatement(body?: Statement | Statement[], init?: ExpressionParameter, test?: ExpressionParameter, update?: ExpressionParameter): ForStatement; +export function functionDeclaration(id: string, params?: Parameter[], body?: Statement[], options?: FunctionOptions): FunctionDeclaration; +export function functionExpression(id?: string, params?: Parameter[], body?: Statement[], options?: FunctionOptions): FunctionExpression; +export function identifier(name: string): Identifier; +export function ifStatement(test: ExpressionParameter, consequent: Statement | Statement[], alternate?: Statement | Statement[]): IfStatement; +export function importExpression(source: ExpressionParameter): ImportExpression; +export function importDeclaration(specifiers: ImportModuleSpecifier[], source: string): ImportDeclaration; +export function importDefaultSpecifier(local: string): ImportDefaultSpecifier; +export function importNamespaceSpecifier(local: string): ImportNamespaceSpecifier; +export function importSpecifier(local: string, exported?: string): ImportSpecifier; +export function labeledStatement(label: string, body: Statement | Statement[]): LabeledStatement; +export function literal(value: boolean | string | number | null): Literal; +export function logicalExpression(left: ExpressionParameter, right: ExpressionParameter, operator: LogicalOperator): LogicalExpression; +export function memberExpression(object: ExpressionParameter, property: ExpressionParameter, computed?: boolean): MemberExpression; +export function metaProperty(meta: string, property: string): MetaProperty; +export function methodDefinition(key: ExpressionParameter, value: FunctionExpression, options?: MethodOptions): MethodDefinition; +export function newExpression(callee: ExpressionParameter, args?: ArgumentListElement[]): NewExpression; +export function objectExpression(properties: ObjectExpressionProperty[]): ObjectExpression; +export function objectPattern(properties: ObjectPatternProperty[]): ObjectPattern; +export function program(body: Statement[], sourceType: 'script' | 'module'): Program; +export function property(key: ExpressionParameter, value: ExpressionParameter, options?: PropertyOptions): Property; +export function regexLiteral(value: RegExp): RegExpLiteral; +export function restElement(argument: Parameter): RestElement; +export function returnStatement(argument?: ExpressionParameter): ReturnStatement; +export function sequenceExpression(expressions: ExpressionParameter[]): SequenceExpression; +export function spreadElement(argument: ExpressionParameter): SpreadElement; +export function superExpression(): Super; +export function switchCase(test?: ExpressionParameter, consequent?: Statement[]): SwitchCase; +export function switchStatement(discriminant: ExpressionParameter, cases?: SwitchCase[]): SwitchStatement; +export function taggedTemplateExpression(tag: ExpressionParameter, quasi: TemplateLiteral): TaggedTemplateExpression; +export function templateElement(value: string, tail: boolean): TemplateElement; +export function templateLiteral(quasis: TemplateElement[], expressions: ExpressionParameter[]): TemplateLiteral; +export function thisExpression(): ThisExpression; +export function throwStatement(argument: ExpressionParameter): ThrowStatement; +export function tryStatement(block: Statement[], handler?: CatchClause, finalizer?: Statement[]): TryStatement; +export function unaryExpression(operator: UnaryOperator, argument: ExpressionParameter): UnaryExpression; +export function updateExpression(operator: UpdateOperator, argument: ExpressionParameter, prefix?: boolean): UpdateExpression; +export function variableDeclaration(declarations: VariableDeclarator[], kind?: string): VariableDeclaration; +export function variableDeclarator(id: Parameter, init?: ExpressionParameter): VariableDeclarator; +export function whileStatement(test: ExpressionParameter, body?: Statement | Statement[]): WhileStatement; +export function withStatement(object: Expression, body?: Statement | Statement[]): WithStatement; +export function yieldExpression(argument?: ExpressionParameter, delegate?: boolean): YieldExpression; +// Types verificators +export function isArrayExpression(node: BaseNode): node is ArrayExpression; +export function isArrayPattern(node: BaseNode): node is ArrayPattern; +export function isArrowFunctionExpression(node: BaseNode): node is ArrowFunctionExpression; +export function isAssignmentExpression(node: BaseNode): node is AssignmentExpression; +export function isAssignmentPattern(node: BaseNode): node is ArrayPattern; +export function isAwaitExpression(node: BaseNode): node is AwaitExpression; +export function isBinaryExpression(node: BaseNode): node is BinaryExpression; +export function isBlockStatement(node: BaseNode): node is BlockStatement; +export function isBreakStatement(node: BaseNode): node is BreakStatement; +export function isCallExpression(node: BaseNode): node is CallExpression; +export function isCatchClause(node: BaseNode): node is CatchClause; +export function isClassBody(node: BaseNode): node is ClassBody; +export function isClassDeclaration(node: BaseNode): node is ClassDeclaration; +export function isClassExpression(node: BaseNode): node is ClassExpression; +export function isConditionalExpression(node: BaseNode): node is ConditionalExpression; +export function isContinueStatement(node: BaseNode): node is ContinueStatement; +export function isDebuggerStatement(node: BaseNode): node is DebuggerStatement; +export function isDoWhileStatement(node: BaseNode): node is DoWhileStatement; +export function isEmptyStatement(node: BaseNode): node is EmptyStatement; +export function isExportAllDeclaration(node: BaseNode): node is ExportAllDeclaration; +export function isExportDefaultDeclaration(node: BaseNode): node is ExportDefaultDeclaration; +export function isExportNamedDeclaration(node: BaseNode): node is ExportNamedDeclaration; +export function isExportSpecifier(node: BaseNode): node is ExportSpecifier; +export function isExpressionStatement(node: BaseNode): node is ExpressionStatement; +export function isForInStatement(node: BaseNode): node is ForInStatement; +export function isForOfStatement(node: BaseNode): node is ForOfStatement; +export function isForStatement(node: BaseNode): node is ForStatement; +export function isFunctionDeclaration(node: BaseNode): node is FunctionDeclaration; +export function isFunctionExpression(node: BaseNode): node is FunctionExpression; +export function isIdentifier(node: BaseNode): node is Identifier; +export function isIfStatement(node: BaseNode): node is IfStatement; +export function isImportExpression(node: BaseNode): node is ImportExpression; +export function isImportDeclaration(node: BaseNode): node is ImportDeclaration; +export function isImportDefaultSpecifier(node: BaseNode): node is ImportDefaultSpecifier; +export function isImportNamespaceSpecifier(node: BaseNode): node is ImportNamespaceSpecifier; +export function isImportSpecifier(node: BaseNode): node is ImportSpecifier; +export function isLabeledStatement(node: BaseNode): node is LabeledStatement; +export function isLiteral(node: BaseNode): node is Literal; +export function isLogicalExpression(node: BaseNode): node is LogicalExpression; +export function isMemberExpression(node: BaseNode): node is MemberExpression; +export function isMetaProperty(node: BaseNode): node is MetaProperty; +export function isMethodDefinition(node: BaseNode): node is MethodDefinition; +export function isNewExpression(node: BaseNode): node is NewExpression; +export function isObjectExpression(node: BaseNode): node is ObjectExpression; +export function isObjectPattern(node: BaseNode): node is ObjectPattern; +export function isProgram(node: BaseNode): node is Program; +export function isProperty(node: BaseNode): node is Property; +export function isRegexLiteral(node: BaseNode): node is RegExpLiteral; +export function isRestElement(node: BaseNode): node is RestElement; +export function isReturnStatement(node: BaseNode): node is ReturnStatement; +export function isSequenceExpression(node: BaseNode): node is SequenceExpression; +export function isSpreadElement(node: BaseNode): node is SpreadElement; +export function isSuper(node: BaseNode): node is Super; +export function isSwitchCase(node: BaseNode): node is SwitchCase; +export function isSwitchStatement(node: BaseNode): node is SwitchStatement; +export function isTaggedTemplateExpression(node: BaseNode): node is TaggedTemplateExpression; +export function isTemplateElement(node: BaseNode): node is TemplateElement; +export function isTemplateLiteral(node: BaseNode): node is TemplateLiteral; +export function isThisExpression(node: BaseNode): node is ThisExpression; +export function isThrowStatement(node: BaseNode): node is ThrowStatement; +export function isTryStatement(node: BaseNode): node is TryStatement; +export function isUnaryExpression(node: BaseNode): node is UnaryExpression; +export function isUpdateExpression(node: BaseNode): node is UpdateExpression; +export function isVariableDeclaration(node: BaseNode): node is VariableDeclaration; +export function isVariableDeclarator(node: BaseNode): node is VariableDeclarator; +export function isWhileStatement(node: BaseNode): node is WhileStatement; +export function isWithStatement(node: BaseNode): node is WithStatement; +export function isYieldExpression(node: BaseNode): node is YieldExpression; \ No newline at end of file diff --git a/src/parsers/script/nodes.js b/src/parsers/script/nodes.js new file mode 100644 index 0000000..cc95017 --- /dev/null +++ b/src/parsers/script/nodes.js @@ -0,0 +1,555 @@ +const { strictEqual } = require('assert'); + +const Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForOfStatement: 'ForOfStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchCase: 'SwitchCase', + SwitchStatement: 'SwitchStatement', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' +}; +exports.Syntax = Syntax; + +function arrayExpression(elements) { + return arrays(Syntax.ArrayExpression, elements); +}; +exports.arrayExpression = arrayExpression; + +function arrayPattern(elements) { + return arrays(Syntax.ArrayPattern, elements); +}; +exports.arrayPattern = arrayPattern; + +function arrowFunctionExpression(params, body, isAsync) { + const options = { expression: !array(body), async: isAsync }; + return functionTpl(Syntax.ArrowFunctionExpression, null, params, body, options); +}; +exports.arrowFunctionExpression = arrowFunctionExpression; + +function assignmentExpression(left, right, operator) { + return binary(Syntax.AssignmentExpression, left, right, operator || '='); +}; +exports.assignmentExpression = assignmentExpression; + +function assignmentPattern(left, right) { + return binary(Syntax.AssignmentPattern, left, right); +}; +exports.assignmentPattern = assignmentPattern; + +function awaitExpression(argument) { + return unary(Syntax.AwaitExpression, argument); +}; +exports.awaitExpression = awaitExpression; + +function binaryExpression(left, right, operator) { + return binary(Syntax.BinaryExpression, left, right, operator); +}; +exports.binaryExpression = binaryExpression; + +function blockStatement(body) { + return block(Syntax.BlockStatement, body); +}; +exports.blockStatement = blockStatement; + +function breakStatement(label) { + return labeled(Syntax.BreakStatement, label); +}; +exports.breakStatement = breakStatement; + +function callExpression(callee, args = []) { + return call(Syntax.CallExpression, callee, args); +}; +exports.callExpression = callExpression; + +function catchClause(param, body = []) { + return { type: Syntax.CatchClause, param: asId(param), body: blockStatement(body) }; +}; +exports.catchClause = catchClause; + +function classBody(body = []) { + return block(Syntax.ClassBody, body); +}; +exports.classBody = classBody; + +function classDeclaration(id, superClass, body) { + return classes(Syntax.ClassDeclaration, id, superClass, body); +}; +exports.classDeclaration = classDeclaration; + +function classExpression(id, superClass, body) { + return classes(Syntax.ClassDeclaration, id, superClass, body); +}; +exports.classExpression = classExpression; + +function conditionalExpression(test, consequent, alternate) { + return condition(Syntax.ConditionalExpression, test, consequent, alternate); +}; +exports.conditionalExpression = conditionalExpression; + +function continueStatement(label) { + return labeled(Syntax.ContinueStatement, label); +}; +exports.continueStatement = continueStatement; + +function debuggerStatement() { + return { type: Syntax.DebuggerStatement }; +}; +exports.debuggerStatement = debuggerStatement; + +function doWhileStatement(test, body) { + return whileStmt(Syntax.DoWhileStatement, test, body); +}; +exports.doWhileStatement = doWhileStatement; + +function emptyStatement() { + return { type: Syntax.EmptyStatement }; +}; +exports.emptyStatement = emptyStatement; + +function exportAllDeclaration(source) { + return { type: Syntax.ExportAllDeclaration, source: literal(source) }; +}; +exports.exportAllDeclaration = exportAllDeclaration; + +function exportDefaultDeclaration(declaration) { + return { type: Syntax.ExportDefaultDeclaration, declaration: asId(declaration) }; +}; +exports.exportDefaultDeclaration = exportDefaultDeclaration; + +function exportNamedDeclaration(declaration) { + return exportNames(declaration, []); +}; +exports.exportNamedDeclaration = exportNamedDeclaration; + +function exportNamedExpression(specifiers, source) { + return exportNames(null, specifiers, source); +}; +exports.exportNamedExpression = exportNamedExpression; + +function exportSpecifier(local, exported) { + return { type: Syntax.ExportSpecifier, local: asId(local), exported: asId(exported || local) }; +}; +exports.exportSpecifier = exportSpecifier; + +function expressionStatement(expression) { + return expression ? { type: Syntax.ExpressionStatement, expression: asId(expression) } : expression; +}; +exports.expressionStatement = expressionStatement; + +function forInStatement(left, right, body) { + return forStmt(Syntax.ForInStatement, left, right, body, false); +}; +exports.forInStatement = forInStatement; + +function forOfStatement(left, right, body, isAsync) { + return forStmt(Syntax.ForOfStatement, left, right, body, isAsync); +}; +exports.forOfStatement = forOfStatement; + +function forStatement(body, init, test, update) { + return { type: Syntax.ForStatement, init: asId(init), test: asId(test), update, body: asBlock(body) }; +}; +exports.forStatement = forStatement; + +function functionDeclaration(id, params = [], body = [], generator = false, isAsync = false) { + return functionTpl(Syntax.FunctionDeclaration, id, params, body, { generator, async: isAsync }); +}; +exports.functionDeclaration = functionDeclaration; + +function functionExpression(id, params = [], body = [], generator = false, isAsync = false) { + return functionTpl(Syntax.FunctionDeclaration, id, params, body, { generator, async: isAsync }); +}; +exports.functionExpression = functionExpression; + +function identifier(name) { + espect(name, 'name').toBeType('string'); + return { type: Syntax.Identifier, name }; +}; +exports.identifier = identifier; + +function ifStatement(test, consequent, alternate) { + return condition(Syntax.IfStatement, test, consequent, alternate); +}; +exports.ifStatement = ifStatement; + +function importExpression(source) { + return { type: Syntax.ImportExpression, source }; +}; +exports.importExpression = importExpression; + +function importDeclaration(specifiers, source) { + espect(specifiers, 'specifiers').toBeType('array'); + return { type: Syntax.ImportDeclaration, specifiers, source: literal(source) }; +}; +exports.importDeclaration = importDeclaration; + +function importDefaultSpecifier(local) { + return importSpec(Syntax.ImportDefaultSpecifier, local); +}; +exports.importDefaultSpecifier = importDefaultSpecifier; + +function importNamespaceSpecifier(local) { + return importSpec(Syntax.ImportNamespaceSpecifier, local); +}; +exports.importNamespaceSpecifier = importNamespaceSpecifier; + +function importSpecifier(local, imported) { + return importSpec(Syntax.ImportSpecifier, local, imported); +}; +exports.importSpecifier = importSpecifier; + +function labeledStatement(label, body) { + return { ...labeled(Syntax.LabeledStatement, label), body: asBlock(body) }; +}; +exports.labeledStatement = labeledStatement; + +function literal(value) { + return literals(value); +}; +exports.literal = literal; + +function logicalExpression(left, right, operator) { + return binary(Syntax.LogicalExpression, left, right, operator); +}; +exports.logicalExpression = logicalExpression; + +function memberExpression(object, property, computed) { + return { type: Syntax.MemberExpression, object: asId(object), property: asId(property), computed }; +}; +exports.memberExpression = memberExpression; + +function metaProperty(meta, property) { + return { type: Syntax.MetaProperty, meta: identifier(meta), property: identifier(property) }; +}; +exports.metaProperty = metaProperty; + +function methodDefinition(key, value, options) { + return properties(Syntax.MethodDefinition, key, value, options); +}; +exports.methodDefinition = methodDefinition; + +function newExpression(callee, args) { + return call(Syntax.NewExpression, callee, args); +}; +exports.newExpression = newExpression; + +function objectExpression(properties) { + return objects(Syntax.ObjectExpression, properties); +}; +exports.objectExpression = objectExpression; + +function objectPattern(properties) { + return objects(Syntax.ObjectPattern, properties); +}; +exports.objectPattern = objectPattern; + +function program(body, sourceType) { + espect(body, 'body').toBeType('array'); + return { type: Syntax.Program, body, sourceType }; +}; +exports.program = program; + +function property(key, value, options) { + return properties(Syntax.Property, key, value, options); +}; +exports.property = property; + +function regexLiteral(value) { + return literals(value); +}; +exports.regexLiteral = regexLiteral; + +function restElement(argument) { + return unary(Syntax.RestElement, argument); +}; +exports.restElement = restElement; + +function returnStatement(argument) { + return unary(Syntax.ReturnStatement, argument); +}; +exports.returnStatement = returnStatement; + +function sequenceExpression(expressions) { + return sequence(Syntax.SequenceExpression, expressions); +}; +exports.sequenceExpression = sequenceExpression; + +function spreadElement(argument) { + return unary(Syntax.SpreadElement, argument); +}; +exports.spreadElement = spreadElement; + +function superExpression() { + return { type: Syntax.Super }; +}; +exports.superExpression = superExpression; + +function switchCase(test, consequent = []) { + espect(consequent, 'consequent').toBeType('array'); + return { type: Syntax.SwitchCase, test: asId(test), consequent }; +}; +exports.switchCase = switchCase; + +function switchStatement(discriminant, cases = []) { + espect(cases, 'cases').toBeType('array'); + return { type: Syntax.SwitchStatement, discriminant: asId(discriminant), cases }; +}; +exports.switchStatement = switchStatement; + +function taggedTemplateExpression(tag, quasi) { + return { type: Syntax.TaggedTemplateExpression, tag: asId(tag), quasi }; +}; +exports.taggedTemplateExpression = taggedTemplateExpression; + +function templateElement(value, tail) { + return { type: Syntax.TemplateElement, value: { cooked: `${value}`, raw: `${value}` }, tail }; +}; +exports.templateElement = templateElement; + +function templateLiteral(quasis, expressions) { + espect(quasis, 'quasis').toBeType('array'); + return { ...sequence(Syntax.TemplateLiteral, expressions), quasis }; +}; +exports.templateLiteral = templateLiteral; + +function thisExpression() { + return { type: Syntax.ThisExpression }; +}; +exports.thisExpression = thisExpression; + +function throwStatement(argument) { + return unary(Syntax.ThrowStatement, argument); +}; +exports.throwStatement = throwStatement; + +function tryStatement(block, handler, finalizer) { + handler && espect(handler.type, 'handler.type').toBe(Syntax.CatchClause); + return { + type: Syntax.TryStatement, handler, + block: blockStatement(block), finalizer: blockStatement(finalizer) + }; +}; +exports.tryStatement = tryStatement; + +function unaryExpression(operator, argument) { + return unary(Syntax.UnaryExpression, argument, { operator, prefix: true }); +}; +exports.unaryExpression = unaryExpression; + +function updateExpression(operator, argument, prefix = true) { + return unary(Syntax.UpdateExpression, argument, { operator, prefix }); +}; +exports.updateExpression = updateExpression; + +function variableDeclaration(declarations, kind) { + espect(declarations, 'declarations').toBeType('array'); + return { type: Syntax.VariableDeclaration, kind, declarations }; +}; +exports.variableDeclaration = variableDeclaration; + +function variableDeclarator(id, init) { + return { type: Syntax.VariableDeclarator, id: asId(id), init: asId(init) }; +}; +exports.variableDeclarator = variableDeclarator; + +function whileStatement(test, body) { + return whileStmt(Syntax.WhileStatement, test, body); +}; +exports.whileStatement = whileStatement; + +function withStatement(object, body) { + return { type: Syntax.WithStatement, object: asId(object), body: asBlock(body) }; +}; +exports.withStatement = withStatement; + +function yieldExpression(argument, delegate = false) { + return unary(Syntax.YieldExpression, argument, { delegate }); +}; +exports.yieldExpression = yieldExpression; + +(function () { + const _loop = (_type) => ({ type }) => type === _type; + for (const key in Syntax) { + exports[`is${key}`] = _loop(key); + } +})(); + +// Tools +function espect(assert, propName = 'assert') { + const proto = Object.prototype; + return { + toBe(value) { + strictEqual(assert, value, `'${propName}' must be equal to ${JSON.stringify(value)}`); + }, + toBeType(type) { + const _type = proto.toString.call(assert).slice(8, -1).toLowerCase(); + strictEqual(_type, type, `'${propName}' must be type '${type}' but got '${_type}'`); + } + }; +} + +function asId(value = null) { + return typeof value === 'object' ? value : identifier(value); +} + +function asBlock(body) { + return array(body) ? blockStatement(body) : body; +} + +function array(value) { + return Array.isArray(value); +} + +function arrays(type, elements) { + espect(elements, 'elements').toBeType('array'); + return { type, elements: elements.map(asId) }; +} + +function binary(type, left, right, operator) { + const node = { left: asId(left), right: asId(right) }; + return !operator ? { type, ...node } : { type, operator, ...node }; +} + +function block(type, body) { + espect(body, 'body').toBeType('array'); + return { type, body }; +} + +function call(type, callee, args) { + espect(args, 'arguments').toBeType('array'); + return { type, callee: asId(callee), arguments: args.map(asId) }; +} + +function classes(type, id, superClass, body) { + return { type, id: asId(id), superClass: asId(superClass), body: classBody(body) }; +} + +function condition(type, test, consequent, alternate) { + if (Syntax.IfStatement === type) { + alternate = array(alternate) ? blockStatement(alternate) : expressionStatement(alternate); + consequent = array(consequent) ? blockStatement(consequent) : expressionStatement(consequent); + } + return { type, test: asId(test), consequent: asId(consequent), alternate: asId(alternate) }; +} + +function exportNames(declaration, specifiers = [], source = null) { + espect(specifiers, 'specifiers').toBeType('array'); + if (declaration) { + specifiers = []; + source = null; + } + return { + type: Syntax.ExportNamedDeclaration, + declaration, specifiers, source: source !== null ? literal(source) : source + }; +} + +function forStmt(type, left, right, body, isAsync) { + return { type, left: asId(left), right: asId(right), body: asBlock(body), await: isAsync }; +} + +function functionTpl(type, id, params, body, options) { + espect(params, 'params').toBeType('array'); + return { params: params.map(asId), body: asBlock(body), type, id: asId(id), ...options }; +} + +function importSpec(type, local, imported) { + const regexp = /Import(Namespace|Default)/; + const node = { type, local: asId(local) }; + return regexp.test(type) ? node : { ...node, imported: asId(imported || local) }; +} + +function labeled(type, label) { + return { type, label: asId(label) }; +} + +function literals(value) { + const isRegExp = value instanceof RegExp; + let node = { type: Syntax.Literal, value }; + return isRegExp ? { ...node, ...{ pattern: value.source, flags: value.flags } } : node; +} + +function objects(type, properties) { + espect(properties, 'properties').toBeType('array'); + return { type, properties }; +} + +function properties(type, key, value, options = { kind: 'init'}) { + options.kind = options.kind || 'init'; + return { type, key: asId(key), value: asId(value || key), ...options }; +} + +function sequence(type, expressions) { + espect(expressions, 'expressions').toBeType('array'); + return { type, expressions: expressions.map(asId) }; +} + +function unary(type, argument, args) { + const node = { type, argument: asId(argument) }; + return args ? { ...node, ...args } : node; +} + +function whileStmt(type, test, body) { + return { type, test: asId(test), body: asBlock(body) }; +} diff --git a/src/parsers/script/parseDirective.ts b/src/parsers/script/parseDirective.ts new file mode 100644 index 0000000..bb2ba61 --- /dev/null +++ b/src/parsers/script/parseDirective.ts @@ -0,0 +1,26 @@ +import { each } from '../../utils'; +import { Segments } from './segments'; +import { Element } from '../html/element'; +import ctx from './context'; +import { directives } from '../../directives'; + +export default function parseDirectives(node: Element, segmts: Segments, parentVarName: string, createTpl: any) { + const attrs = node.attributes.filter(({ name }) => name[0] === '$'); + if (attrs.length) { + each(directives, directive => { + const attr = `$${directive.attr}`; + if (node.hasAttribute(attr)) { + const expression = node.getAttribute(attr); + node.removeAttribute(attr); + segmts.globalTools = []; + directive.ctx = ctx; + directive.createTpl = createTpl; + directive.action(node, expression, segmts, parentVarName); + delete segmts.globalTools; + if (directive.tools) { + segmts.tools.add(directive.tools); + } + } + }); + } +} diff --git a/src/parsers/script/parseScript.ts b/src/parsers/script/parseScript.ts new file mode 100644 index 0000000..6c10bc9 --- /dev/null +++ b/src/parsers/script/parseScript.ts @@ -0,0 +1,103 @@ +import visit from './visit'; +import { generate } from './generator'; +import { assignNode, expression } from './context/expression'; +import { + isExportDefaultDeclaration, isImportDeclaration, + binaryExpression, literal, callExpression, memberExpression, + isExpressionStatement, isMemberExpression, isAssignmentExpression, + isIdentifier, isLiteral, isBlockStatement, expressionStatement, isThisExpression +} from './nodes'; +import { + BaseNode as Node, Program, LabeledStatement, MemberExpression, + Identifier, ExpressionStatement, AssignmentExpression, + UpdateExpression, BinaryOperator, Expression, BlockStatement, Statement +} from './estree'; + +export default function (content: Program) { + const state = { imports: [], extras: [], options: null }; + + for (let i = 0; i < content.body.length; i++) { + const statement = content.body[i]; + if (isImportDeclaration(statement)) { + state.imports.push(statement); + } else { + visit(statement, { + LabeledStatement(node: LabeledStatement & { parent: any }) { + if (isValidLabeled(node)) { + if (isValidExpression(node.body)) { + assignNode(node, expressionParser(node.body.expression)); + } else { + const body: Statement[] = (node.body).body.map(stmt => { + return isValidExpression(stmt) ? expressionParser(stmt.expression) : stmt; + }); + const index = this.parent[this.property].indexOf(node); + this.parent[this.property].splice(index, 1, ...body); + } + node.parent = this.parent; + } + } + }); + if (isExportDefaultDeclaration(statement)) { + state.options = statement; + } else { + state.extras.push(statement); + } + } + } + + return state; +} + +function isValidExpression(node: Node): node is ExpressionStatement { + return isExpressionStatement(node) && /(Assignment|Update)E/.test(node.expression.type); +} + +function isValidLabeled(node: LabeledStatement) { + if (node.label.name === '$') { + if (isBlockStatement(node.body)) { + return node.body.body.some(stmt => isValidExpression(stmt)); + } + return isValidExpression(node.body); + } + return false; +} + +function expressionParser(node: Expression) { + let left = (node).left || (node).argument; + if (isMemberExpression(left)) { + const prop = getMemberObject(left); + let operator: BinaryOperator, right: Expression; + if (isAssignmentExpression(node)) { + [{ right }] = [node]; + operator = node.operator.replace('=', '').trim(); + right = operator ? binaryExpression(left, right, operator) : right; + } else { + right = binaryExpression(left, literal(1), (node).operator[0]); + } + let path = `(\`${literalify(left)}\`)`; + const key = expression(path); + const caller = memberExpression(prop, '$set'); + return expressionStatement(callExpression(caller, [key.expression, right])); + } else { + return expressionStatement(node); + } +} + +function getMemberObject(node: MemberExpression): Identifier { + return (isMemberExpression(node.object) ? getMemberObject(node.object) : node.object); +} + +function literalify(node: MemberExpression | Identifier) { + if (isIdentifier(node)) { + return (node).name; + } else { + const property = node.property; + let prop = isLiteral(property) ? property.value : generate(property); + prop = node.computed && !isLiteral(property) ? `\${${prop}}` : `${prop}`; + if (isMemberExpression(node) && (isIdentifier(node.object) || isThisExpression(node.object))) { + return prop; + } else { + return `${literalify(node.object)}.${prop}`; + } + } +} diff --git a/src/parsers/script/parser.ts b/src/parsers/script/parser.ts new file mode 100644 index 0000000..dd1ffa8 --- /dev/null +++ b/src/parsers/script/parser.ts @@ -0,0 +1,6 @@ +import { parse } from 'meriyah'; +import { Program } from './estree'; + +export default function parser(source = '', options = {}) { + return parse(source, Object.assign({ module: true, next: true, ranges: true }, options)); +} diff --git a/src/parsers/script/segments.ts b/src/parsers/script/segments.ts new file mode 100644 index 0000000..dd883c3 --- /dev/null +++ b/src/parsers/script/segments.ts @@ -0,0 +1,140 @@ +import parse from './parser'; +import { expression, compare } from './context/expression'; +import { ImportDeclaration, Statement } from './estree'; +import { + importDefaultSpecifier, importSpecifier, importDeclaration, expressionStatement, callExpression, + thisExpression, + ExpressionParameter +} from './nodes'; + +export class Segments { + loops: number; + body: Segment; + mount: Segment; + extras: Segment; + create: Segment; + update: Segment; + _init: string[]; + unmount: Segment; + destroy: Segment; + _imports: Map; + conditions: number; + tools: Set; + globals: Set; + globalTools?: string[]; + variables: Map; + + constructor({ loops, conditions, _imports } = { loops: 0, conditions: 0, _imports: new Map() }) { + this._init = []; + this.loops = loops; + this.tools = new Set(); + this.globalTools = null; + this._imports = _imports; + this.body = new Segment(); + this.mount = new Segment(); + this.extras = new Segment(); + this.create = new Segment(); + this.update = new Segment(); + this.unmount = new Segment(); + this.destroy = new Segment(); + this.variables = new Map(); + this.conditions = conditions; + this.globals = new Set(['_$ctx']); + this.destroy.add(callExpression('_$destroyComponent', [thisExpression()])); + } + + addImport(mod: string, id: string, isDefault = false, alias = '') { + if (!(this._imports.has(mod))) this._imports.set(mod, importDeclaration([], mod)); + const { specifiers } = this._imports.get(mod); + const exist = specifiers.some(node => alias ? node.local.name === alias : node.local.name === id); + if (!exist) { + const imported = isDefault ? importDefaultSpecifier(id) : importSpecifier(alias || id, id); + specifiers.push(imported); + } + } + + addVar(variable: string) { + if (!this.variables.has(variable)) { + this.variables.set(variable, 1); + } else { + const index = this.variables.get(variable); + this.variables.set(variable, index + 1); + } + const length = this._init.push(`_$${variable}_${this.variables.get(variable)}`); + return this._init[length - 1]; + } + + get init() { + return this._init; + } + + get imports() { + return [...this._imports.values()]; + } + + getTools() { + return [...this.tools].reduce((tools, tool) => { + return tools.concat(parse(tool, { ranges: false }).body); + }, []); + } + + removeVar(varName: string) { + const index = this._init.indexOf(varName); + if (~index) { + this._init.splice(index, 1); + } + } +} + +export class Segment { + _statements: Statement[]; + + constructor() { + this._statements = []; + } + get statements() { + return this._statements; + } + get size() { + return this._statements.length; + } + add(...stmts: ExpressionParameter[]) { + return this._statements.push(...stmts.map(toStatement)); + } + insert(stmt: ExpressionParameter, index = 0) { + let node = toStatement(stmt); + if (index === 0) this._statements.unshift(node); + else if (~index) this._statements.splice(index, 0, node); + return this; + } + index(cb: ExpressionParameter | ((value: Statement, index?: number, obj?: Statement[]) => boolean)) { + if (typeof cb !== 'function') { + const value = cb; + cb = n => compare(n, toStatement(value)); + } + return this._statements.findIndex(cb); + } + includes(stmt: ExpressionParameter) { + return !!~this.index(n => compare(n, toStatement(stmt))); + } + find(cb: (value: Statement, index?: number, obj?: Statement[]) => boolean) { + return this._statements.find(cb); + } + replace(stmt: ExpressionParameter, oldStmt?: ExpressionParameter) { + const index = arguments.length === 1 ? 0 : this.index(oldStmt); + if (~index) { + this._statements.splice(index, 1, toStatement(stmt)); + } + } + remove(stmt: string) { + const index = this.index(n => compare(n, expression(stmt))); + return ~index ? this._statements.splice(index, 1) : null; + } + isEmpty() { + return this.size === 0; + } +} + +function toStatement(stmt: ExpressionParameter) { + return typeof stmt === 'string' ? expression(stmt) : expressionStatement(stmt); +} diff --git a/src/parsers/script/templates.ts b/src/parsers/script/templates.ts new file mode 100644 index 0000000..1b2a24f --- /dev/null +++ b/src/parsers/script/templates.ts @@ -0,0 +1,79 @@ +import { Segments } from './segments'; +import { + variableDeclarator, variableDeclaration, functionExpression, literal, + unaryExpression, callExpression, thisExpression, assignmentExpression, returnStatement, + objectExpression, property, memberExpression, functionDeclaration, expressionStatement, + arrayPattern, restElement, +} from './nodes'; +import { + AssignmentExpression, Statement, ExpressionStatement, CallExpression, Identifier +} from './estree'; + +export default function tpl(tplName: string, segmts: Segments, htmlCode: string[]) { + const { init, globals, create, mount, update, unmount, destroy, extras, body } = segmts; + const _this = thisExpression(); + const params = [...globals]; + init.unshift('_$tpl', '_$elements'); + const _init = init.map(_var => variableDeclarator(_var)); + const _unmount = expressionStatement(callExpression(memberExpression(_this, '$unmount'))); + + if (init.length) { + const _vars = init.slice(); + let clear = assignmentExpression(_vars.shift(), null); + destroyVars(_vars, clear); + destroy.add(clear); + } + segmts.addImport('trebor/tools', '_$'); + segmts.addImport('trebor/tools', '_$append'); + segmts.addImport('trebor/tools', '_$fragTpl'); + segmts.addImport('trebor/tools', '_$context'); + segmts.addImport('trebor/tools', '_$prepareFragment'); + const initEls = arrayPattern(['_$tpl', restElement('_$elements')]); + const initTpl = assignmentExpression(initEls, callExpression('_$fragTpl', htmlCode.map(literal))); + const appendTpl = callExpression('_$append', [ + callExpression('_$', ['parent']), '_$tpl', callExpression('_$', ['sibling']) + ]); + unmount.insert(callExpression('_$prepareFragment', ['_$tpl', '_$elements'])); + extras.add(initTpl); + mount.add(appendTpl); + + const method = (key: string, value: Statement[], params = []) => { + if (value.length) { + return property(key, functionExpression(null, params, value)); + } else { + segmts.addImport('trebor/tools', '_$noop'); + return property(key, '_$noop'); + } + }; + + const mayBeDestroyComp = destroy.statements[0]; + if (((mayBeDestroyComp.expression).callee).name === '_$destroyComponent') { + segmts.addImport('trebor/tools', '_$setElements'); + segmts.addImport('trebor/tools', '_$destroyComponent'); + mount.add(callExpression('_$setElements', [_this, 'parent', 'sibling'])); + } + + const updateArgs = params.filter(param => !['_$v', '_$i'].includes(param)); + const methods = [ + method('$create', create.statements), + method('$mount', [_unmount, ...mount.statements], ['parent', 'sibling']), + method('$update', update.statements, updateArgs), + method('$unmount', unmount.statements), + method('$destroy', destroy.statements) + ]; + return [...body.statements, functionDeclaration(`_$${tplName}`, params, [ + variableDeclaration(_init, 'let'), + ...extras.statements, + returnStatement(objectExpression(methods)) + ])]; +} + + +function destroyVars(variables: string[], assign: AssignmentExpression) { + if (variables.length) { + assign.right = assignmentExpression(variables.shift(), null); + destroyVars(variables, assign.right); + } else { + assign.right = unaryExpression('void', literal(0)); + } +} diff --git a/src/parsers/script/visit.ts b/src/parsers/script/visit.ts new file mode 100644 index 0000000..a2816a5 --- /dev/null +++ b/src/parsers/script/visit.ts @@ -0,0 +1,161 @@ +import { BaseNode } from './estree'; + +interface Node extends BaseNode { + parent?: Node; +} + +interface Path { + __node: Node; + parent: Node; + property: string; + parentPath: Path; + __skippedKeys: string[]; + skip(...keys: string[]): void; + visit(...keys: string[]): void; + findParent(cb: (parent: Node) => boolean): Node; + replace(property: string, newNode: Node, noVisit?: boolean): void; +} + +type VisitorsObject = { + enter?(this: Path, node: Node): void; + leave?(this: Path, node: Node): void; +} & Record void>; + +const keysCache: Map = new Map(); + +function createObj(obj = {}, proto = null) { + const p = proto ? Object.create(null) : null; + proto && Object.assign(p, proto); + const o = Object.create(p); + Object.assign(o, obj); + return o; +} + +function isObject(obj: any): obj is Object { + return typeof obj === 'object'; +} + +function isArray(array: any): array is any[] { + return Array.isArray(array); +} + +function isNode(obj: any) { + return obj != null && isObject(obj) && obj.type && typeof obj.type === 'string'; +} + +function nodeKeys(node: Node) { + if (!keysCache.has(node.type)) { + const keys: string[] = []; + for (const key in node) { + if (key !== 'parent' && (isArray(node[key]) || isNode(node[key]) || node[key] === null)) { + keys.push(key); + } + } + keysCache.set(node.type, keys); + } + return keysCache.get(node.type); +} + +function createPath(visitors: VisitorsObject, node = null, parent = null, property = null, parentPath = null): Path { + return createObj({ parent, property, parentPath, __node: node, __skippedKeys: null }, { + ...visitors, + skip(...keys: string[]) { + this.__skippedKeys = this.__skippedKeys ? [...this.__skippedKeys, ...keys] : keys; + }, + visit(...keys: string[]) { + keys = keys.length ? keys : nodeKeys(this.__node); + for (let i = 0; i < keys.length; i++) { + const property = keys[i]; + const node = this.__node[property]; + if (isArray(node)) { + node.forEach(n => { + const childPath = createPath(visitors, n, this.__node, property, this); + visit(n, childPath, visitors); + }); + } else { + const childPath = createPath(visitors, node, this.__node, property, this); + visit(node, childPath, visitors); + } + } + this.skip(); + }, + replace(property: string, newNode: Node, noVisit = false) { + const node = this.__node; + const prop = node[property]; + if (prop !== undefined) { + node[property] = newNode; + } + if (noVisit) { + this.skip(property); + } + }, + findParent(cb: (parent: Node) => boolean) { + if (this.parentPath == null) { + return null; + } + let { parentPath: parent } = this; + while (parent) { + if (cb(parent.parent)) { + return parent.parent; + } + parent = parent.parentPath; + } + return null; + } + }); +} + +function skipper(node: Node, path: Path) { + return (handler: Function) => { + handler.call(path, node); + return isArray(path.__skippedKeys) && !path.__skippedKeys.length; + }; +} + +function visit(node: Node, path: Path, visitors: VisitorsObject = {}) { + if (!isNode(node)) { + throw new Error(`'node' must be a valid AST node`); + } + + const keys = nodeKeys(node); + const skip = skipper(node, path); + + if (visitors.enter && skip(visitors.enter)) { + return; + } + + if (visitors[node.type] && skip(visitors[node.type])) { + return; + } + + + for (let i = 0, length = keys.length; i < length; i++) { + const key = keys[i]; + const value: Node | Node[] = node[key]; + + if (value == null || ~(path.__skippedKeys || []).indexOf(key)) { + continue; + } + + const currPath = createPath(visitors, value, node, key, path); + + if (isArray(value)) { + for (let j = 0; j < value.length; j += 1) { + if (isNode(value[j])) { + currPath.__node = value[j]; + visit(value[j], currPath, visitors); + } + } + } else { + visit(value, currPath, visitors); + } + } + + if (visitors.leave) { + visitors.leave.call(path, node); + } +} + +export default function visitor(ast: Node, visitors: VisitorsObject) { + visit(ast, createPath(visitors, ast), createObj(visitors)); +} diff --git a/src/parsers/script/wrappers.ts b/src/parsers/script/wrappers.ts new file mode 100644 index 0000000..a875f1f --- /dev/null +++ b/src/parsers/script/wrappers.ts @@ -0,0 +1,43 @@ +import { + logicalExpression, expressionStatement, callExpression, + assignmentExpression, memberExpression, thisExpression, + conditionalExpression, binaryExpression, sequenceExpression, + functionExpression, unaryExpression, returnStatement, literal, + ArgumentListElement, ExpressionParameter +} from './nodes'; +import { BinaryOperator } from './estree'; + +function iif(component: string, moduleClass: ArgumentListElement, statements = []) { + const glob = 'root'; + const ctor = callExpression('_$createComponent', [moduleClass, `_$tpl${component}`]); + const assign = assignmentExpression(memberExpression(glob, component), ctor); + statements.push(expressionStatement(assign)); + const call = callExpression(functionExpression(null, [glob], statements), [thisExpression()]); + return expressionStatement(unaryExpression('!', call)); +} + +function umd(component: string, moduleClass: ArgumentListElement, statements = []) { + const glo = 'root', mod = 'module', exp = 'exports', def = 'define', fac = 'factory', and = '&&'; + const factoryCall = callExpression(fac); + const setGlob = assignmentExpression(glo, logicalExpression(glo, 'self', '||')); + const setGlobVal = assignmentExpression(memberExpression(glo, component), factoryCall); + const alternate = sequenceExpression([setGlob, setGlobVal]); + const testCommon = logicalExpression(isType(exp, 'object'), isType(mod, 'undefined', false), and); + const consequentCommon = assignmentExpression(memberExpression(mod, exp), factoryCall); + const testAmd = logicalExpression(isType(def, 'function'), memberExpression(def, 'amd'), and); + const consequentAmd = callExpression(def, [fac]); + const conditionAmd = conditionalExpression(testAmd, consequentAmd, alternate); + statements.push(returnStatement(callExpression('_$createComponent', [moduleClass, `_$tpl${component}`]))); + const call = callExpression(functionExpression(null, [glo, fac], [ + expressionStatement(conditionalExpression(testCommon, consequentCommon, conditionAmd)) + ]), [thisExpression(), functionExpression(null, [], statements)]); + return expressionStatement(unaryExpression('!', call)); +} + +function isType(value: ExpressionParameter, type: string, isEqual = true) { + const right = literal(type); + const left = unaryExpression('typeof', value); + return binaryExpression(left, right, `${isEqual ? '=' : '!'}==`); +} + +export { iif, umd }; diff --git a/src/tsconfig.json b/src/tsconfig.json index f39b78e..2dd347f 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,37 +1,44 @@ { "compilerOptions": { /* Basic Options */ - "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ + // "incremental": true, /* Enable incremental compilation */ + "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation: */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + "allowJs": true, /* Allow javascript files to be compiled. */ + "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "../build", /* Redirect output structure to the directory. */ + "resolveJsonModule": true, "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ "removeComments": true, /* Do not emit comments to output. */ - "noEmitOnError": true, /* Do not emit outputs. */ - "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ - // "strict": true /* Enable all strict type-checking options. */ + // "strict": true, /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - + /* Additional Checks */ "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - + /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ @@ -40,17 +47,18 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file + } +} diff --git a/src/types/recast.d.ts b/src/types/recast.d.ts deleted file mode 100644 index 53717b3..0000000 --- a/src/types/recast.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { - Node, BinaryExpression, Literal, CallExpression, - MemberExpression, Identifier, Expression, BinaryOperator, Program, Property, ExpressionStatement, TemplateLiteral, ArrayExpression, ConditionalExpression, SpreadElement, UnaryExpression, LogicalExpression, UpdateExpression, AssignmentExpression, ImportDeclaration, ExportDefaultDeclaration, VariableDeclaration, FunctionDeclaration, FunctionExpression, SwitchStatement, WhileStatement, IfStatement, TryStatement, SequenceExpression -} from 'estree'; - -interface NamedType { - check(node: Node): boolean; - assert(value: Node, deep: boolean): void; -} - -interface LiteralType extends NamedType { - name: 'Literal' -} -interface FunctionType extends NamedType { - name: 'Function' -} -interface IdentifierType extends NamedType { - name: 'Identifier' -} -interface IfStatementType extends NamedType { - name: 'IfStatement' -} -interface BlockStatementType extends NamedType { - name: 'BlockStatement' -} -interface UnaryExpressionType extends NamedType { - name: 'UnaryExpression' -} -interface MemberExpressionType extends NamedType { - name: 'MemberExpression' -} -interface UpdateExpressionType extends NamedType { - name: 'UpdateExpression' -} -interface AssignmentExpressionType extends NamedType { - name: 'AssignmentExpression' -} - -interface NamedTypes { - Literal: LiteralType; - Function: FunctionType; - Identifier: IdentifierType; - IfStatement: IfStatementType; - BlockStatement: BlockStatementType; - UnaryExpression: UnaryExpressionType; - MemberExpression: MemberExpressionType; - UpdateExpression: UpdateExpressionType; - AssignmentExpression: AssignmentExpressionType; -} - -interface Builders { - identifier(name: string): Identifier; - literal(value: string | number | boolean | null | RegExp): Literal; - callExpression(callee: Expression, arguments: Expression[]): CallExpression; - memberExpression(object: Expression, property: Expression, computed: boolean): MemberExpression; - binaryExpression(operator: BinaryOperator, left: Expression, right: Expression): BinaryExpression; -} - -interface Scope { - declares(name: string): boolean; -} - -interface Path { - node: T; - value: T; - scope: Scope; - parent: Path; - prune(): void; - replace(node: Node) - get(key: string, position?: number): Path; -} - -interface Visitor { - abort(): void; - traverse(path: Path): void; - [key: string]: (this: Visitor, path: Path, ...args: any[]) => boolean | void; -} - -interface Types { - builders: Builders; - namedTypes: NamedTypes; - visit(node: RecastAST | Node, visitors: { - visitProperty?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitIfStatement?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitTryStatement?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitSpreadElement?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitWhileStatement?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitCallExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitTemplateLiteral?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitSwitchStatement?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitArrayExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitUnaryExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitBinaryExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitMemberExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitUpdateExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitLogicalExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitImportDeclaration?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitSequenceExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitFunctionExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitFunctionDeclaration?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitExpressionStatement?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitVariableDeclaration?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitAssignmentExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitConditionalExpression?(this: Visitor, path: Path, ...args: any[]): boolean | void; - visitExportDefaultDeclaration?(this: Visitor, path: Path, ...args: any[]): boolean | void; - [key: string]: (this: Visitor, path: Path, ...args: any[]) => boolean | void - }): void; -} - -interface RecastAST { - type: 'File'; - program: Program; - original: Program; -} - -interface Recast { - types: Types; - print(node: RecastAST | Node, options?: { [key: string]: any }): { code: string }; - parse(code: string, options?: { [key: string]: any }): RecastAST; -} diff --git a/src/types/svg-tag-names.d.ts b/src/types/svg-tag-names.d.ts deleted file mode 100644 index 66d6329..0000000 --- a/src/types/svg-tag-names.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module 'svg-tag-names' { - const svgTagNames: string[]; - export = svgTagNames; -} \ No newline at end of file diff --git a/src/utilities/classes.ts b/src/utilities/classes.ts deleted file mode 100644 index 4019f58..0000000 --- a/src/utilities/classes.ts +++ /dev/null @@ -1,216 +0,0 @@ -import svg2 from 'svg-tag-names'; -import html5 from 'html-tag-names'; -import { escapeExp } from './tools'; -import { removeEmptyNodes, stripWhitespace } from './html'; -import { serialize, DefaultTreeNode, DefaultTreeElement, DefaultTreeTextNode, Attribute } from 'parse5'; - -export interface Condition { - index: number; - ifCond?: string; - elseIfConds?: string[]; - elseCond?: boolean; -} - -export class BlockAreas { - loops: number; - conditions: number; - variables: string[] = []; - create: string[] = []; - hydrate: string[] = []; - mount: string[] = []; - mountDirt: string[] = []; - update: string[] = []; - unmount: string[] = []; - destroy: string[] = []; - outer: string[] = []; - extras: string[] = []; - globals: string[] = []; - - constructor(loops: number = 0, conditions: number = 0) { - this.loops = loops || 0; - this.conditions = conditions || 0; - } -} - -export class NodeElement { - isBlock: boolean; - varName: string; - dymTag: string; - tagName: string; - nodeType: number; - isSVGElement: boolean; - private _textContent: string; - content: NodeElement; - parentElement: NodeElement; - childNodes: NodeElement[]; - attributes: Attribute[]; - isUnknownElement: boolean; - - constructor(node: DefaultTreeNode, parent: NodeElement) { - this.nodeType = nodeType(node.nodeName); - this.tagName = (node).tagName || node.nodeName; - this.isUnknownElement = false; - this.isSVGElement = (node).namespaceURI === 'http://www.w3.org/2000/svg' && this.tagName !== 'template'; - if (this.nodeType === 1) { - this.isUnknownElement = !(html5.includes(this.tagName) || svg2.includes(this.tagName)); - } - this._textContent = (node).value || ''; - this.attributes = (node).attrs || []; - this.content = null; - this.childNodes = []; - this.parentElement = null; - if (parent) this.parentElement = parent; - if ((node).childNodes && this.tagName !== 'template') { - this.childNodes = (node).childNodes.map(n => new NodeElement(n, this)); - } - if (this.nodeType === 1 && this.tagName === 'template') { - const childNodes = removeEmptyNodes(stripWhitespace(node['content'] ? node['content'].childNodes : (node).childNodes)); - this.content = new NodeElement({ nodeName: '#document-fragment', childNodes }, null); - } - } - - get children() { - return this.childNodes.filter(n => n.nodeType === 1); - } - - get textContent() { - if (this.nodeType === 1 || this.nodeType === 11) { - this._textContent = this.childNodes.reduce((acc, cur) => acc += cur.textContent, ''); - } - return this._textContent; - } - - set textContent(value: string) { - if (this.nodeType === 1 || this.nodeType === 11) { - const text = new NodeElement({ nodeName: '#text', value }, this); - this.appendChild(text); - } else { - this._textContent = value; - } - } - - get nextElementSibling() { - if (this.parentElement) { - if (this.nodeType === 1) { - const index = this.parentElement.children.indexOf(this); - return this.parentElement.children[index + 1] || null; - } else { - const index = this.parentElement.childNodes.indexOf(this); - const { length } = this.parentElement.childNodes; - const nexts = this.parentElement.childNodes.slice(index + 1, length); - return nexts.filter(n => n.nodeType === 1).shift() || null; - } - } - return null; - } - - get innerHTML() { - const html = serialize({ - nodeName: '#document-fragment', - childNodes: this.childNodes.map(toNode) - }); - return escapeExp(html); - } - - querySelectorAll(tagName: string) { - let elements: NodeElement[] = []; - this.childNodes.forEach(el => { - if (el.nodeType === 1) { - if (el.tagName === tagName) { - elements.push(el); - } else { - elements = elements.concat(el.querySelectorAll(tagName)); - } - } - }); - return elements; - } - - querySelector(tagName: string) { - return this.querySelectorAll(tagName)[0]; - } - - hasAttribute(name: string) { - return !!this.attributes.find(attr => attr.name.split('.')[0] === name); - } - - getAttribute(name: string) { - const attr = this.attributes.find(attr => attr.name.split('.')[0] === name); - return attr ? attr.value : undefined; - } - - setAttribute(name: string, value?: any) { - const attr = this.attributes.find(attr => attr.name.split('.')[0] === name); - if (attr) attr.value = value; - else this.attributes.push({ name, value }); - } - - removeAttribute(name: string) { - const position = this.attributes.findIndex(attr => attr.name.split('.')[0] === name); - ~position && this.attributes.splice(position, 1); - } - - appendChild(...children: NodeElement[]) { - children.forEach(node => { - if (node.nodeType === 11) { - this.appendChild(...node.childNodes); - } else { - node.parentElement = this; - this.childNodes.push(node); - } - }); - } - - hasExpression(): boolean { - return this.isBlock || this.isUnknownElement || this.tagName === 'slot' || - this.attributes.some(a => /^[$@:#]/.test(a.name)) || - /\{\{\s*((?!\}\})(.|\n))*\}\}/.test(this.textContent) || - this.childNodes.some(c => c.hasExpression()); - } - - removeChild(child: NodeElement) { - const i = this.childNodes.indexOf(child); - if (~i) { - child.parentElement = null; - this.childNodes.splice(i, 1); - } - } - - remove() { - if (this.parentElement) { - this.parentElement.removeChild(this); - } - } -} - -function nodeType(type: string) { - switch (type) { - case '#text': - return 3; - case '#comment': - return 8; - case '#document-fragment': - return 11; - default: - return 1; - } -} - -function toNode(node: NodeElement) { - const n: DefaultTreeNode = { nodeName: node.tagName }; - if (node.nodeType === 1) { - n['tagName'] = node.tagName; - n['attrs'] = node.attributes; - n['childNodes'] = []; - if (n.nodeName === 'template') { - n['content'] = node.childNodes.map(toNode); - } else { - n['childNodes'] = node.childNodes.map(toNode); - } - } else if (node.nodeType === 3) { - n['value'] = node.textContent; - } else if (node.nodeType === 8) { - n['data'] = node.textContent; - } - return n; -} diff --git a/src/utilities/context.ts b/src/utilities/context.ts deleted file mode 100644 index 8440da0..0000000 --- a/src/utilities/context.ts +++ /dev/null @@ -1,549 +0,0 @@ -import recast from 'recast'; -import { parse as parser } from 'espree'; -import { Recast, Path, RecastAST } from '../types/recast'; -import { builtin, browser, node as nodejs, amd } from 'globals'; -import { analyze, Scope, Variable, Reference } from 'eslint-scope'; -import { - Node, Expression, Identifier, AssignmentExpression, UpdateExpression, - UnaryExpression, BinaryExpression, BinaryOperator, Literal, UnaryOperator, - ExportDefaultDeclaration, BlockStatement, VariableDeclaration, ImportDeclaration, FunctionExpression -} from 'estree'; - -const { print, types, parse } = recast; -const STATEMENT_TYPE = /(?:Statement|Declaration)$/; -const LOOP_STATEMENT = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/; -const { binaryExpression, literal, callExpression, memberExpression, identifier } = types.builders; -const { Identifier, BlockStatement, Literal, UnaryExpression, AssignmentExpression, IfStatement } = types.namedTypes; - -export function ctx(src: string, context: string, globals: string[] = []) { - if (src[0] === '{') src = `let _$o = ${src}`; - let ast = toAst(src); - visitExpressions(ast, context, globals.concat([context])); - return toCode(ast).code.replace('let _$o = ', ''); -} - -export function toOptions(src: string) { - let ast = toAst(src, 'module'); - return visitOptions(ast); -} - -export function optimize(src: string) { - let ast = toAst(src, 'module'); - visitOptimize(ast); - return toCode(ast).code; -} - -function assignify(node: Node, ctx: string, path: Path, globals: string[]) { - if (isReplaceable(node, path, globals)) { - if (AssignmentExpression.check(node)) { - let { operator, left, right } = node; - operator = operator.replace('=', '').trim(); - return settify(ctx, left, operator ? binaryExpression(operator, left, right) : right); - } else { - let { argument, operator } = node; - return settify(ctx, argument, binaryExpression(operator[0], argument, literal(1))); - } - } else { - return node; - } -} - -function settify(ctx: string, left: Node, right: Expression) { - let callee = memberExpression(identifier(ctx), identifier('$set'), false); - let args = [literal(print(left).code), Identifier.check(right) ? toMember(right, ctx) : right]; - return callExpression(callee, args); -} - -function visitExpressions(ast: RecastAST, ctx: string, globals: string[]) { - types.visit(ast, { - visitProperty(path) { - let { node } = path; - node.shorthand = false; - if (node.computed) { - if (canBeReplaced(node.key, path, globals)) { - replace('key', ctx, path); - } - this.traverse(path); - } - if (canBeReplaced(node.value, path, globals)) { - replace('value', ctx, path); - return false; - } - this.traverse(path); - }, - visitCallExpression(path) { - let { node } = path; - canBeReplaced(node.callee, path, globals) && replace('callee', ctx, path); - node.arguments.forEach((argument, i) => { - canBeReplaced(argument, path, globals) && replace('arguments', ctx, path, i); - }); - return this.traverse(path); - }, - visitMemberExpression(path) { - let { node } = path; - if (canBeReplaced(node.object, path, globals)) { - replace('object', ctx, path); - if (node.computed && canBeReplaced(node.property, path, globals)) { - replace('property', ctx, path); - return false; - } - } - this.traverse(path); - }, - visitExpressionStatement(path) { - let { node } = path; - if (canBeReplaced(node.expression, path, globals)) { - replace('expression', ctx, path); - } - this.traverse(path); - }, - visitSequenceExpression(path) { - this.visitTemplateLiteral(path); - }, - visitTemplateLiteral(path) { - let { node } = path; - node.expressions.forEach((expression, i) => { - canBeReplaced(expression, path, globals) && replace('expressions', ctx, path, i); - }); - this.traverse(path); - }, - visitArrayExpression(path) { - let { node } = path; - node.elements.forEach((element, i) => { - canBeReplaced(element, path, globals) && replace('elements', ctx, path, i); - }); - this.traverse(path); - }, - visitConditionalExpression(path) { - let { node } = path; - canBeReplaced(node.test, path, globals) && replace('test', ctx, path); - canBeReplaced(node.alternate, path, globals) && replace('alternate', ctx, path); - canBeReplaced(node.consequent, path, globals) && replace('consequent', ctx, path); - this.traverse(path); - }, - visitSpreadElement(path) { - this.visitUnaryExpression(path); - }, - visitUnaryExpression(path) { - let { node } = path; - canBeReplaced(node.argument, path, globals) && replace('argument', ctx, path); - this.traverse(path); - }, - visitBinaryExpression(path) { - this.visitLogicalExpression(path); - }, - visitLogicalExpression(path) { - let { node } = path; - canBeReplaced(node.left, path, globals) && replace('left', ctx, path); - canBeReplaced(node.right, path, globals) && replace('right', ctx, path); - this.traverse(path); - }, - visitUpdateExpression(path) { - this.visitAssignmentExpression(path); - }, - visitAssignmentExpression(path) { - let { node, parent } = path; - let newNode = assignify(node, ctx, path, globals); - if ('expressions' in parent.node) { - let i = parent.node.expressions.indexOf(node); - node !== newNode && parent.get('expressions', i).replace(newNode); - } else { - node !== newNode && parent.get('expression').replace(newNode); - if (node === newNode && AssignmentExpression.check(node)) { - canBeReplaced(node.right, path, globals) && replace('right', ctx, path); - } - } - this.traverse(path); - } - }); - return ast; -} - -function visitOptions(ast) { - let options = ''; - const imports: string[] = []; - types.visit(ast, { - visitImportDeclaration(path) { - return this.extract(path, node => { imports.push(print(node).code); }); - }, - visitExportDefaultDeclaration(path) { - return this.extract(path, ({ declaration }: ExportDefaultDeclaration) => { - options = print(declaration).code; - }); - }, - extract(path, extractor: (node: Node) => boolean) { - extractor(path.node); - path.prune(); - return false; - } - }); - let extras = print(ast).code; - return { imports, extras, options }; -} - -function visitOptimize(ast: RecastAST) { - let iterations = 0; - let unused = findUnused(ast); - let isUnused = (node: Identifier) => !!unused.find(id => isSameIdentifier(id, node)); - while (iterations < 5) { - types.visit(ast, { - // Remove unused declarations - visitImportDeclaration(path) { - this.declarations(path, 'specifiers', 'local'); - }, - visitVariableDeclaration(path) { - this.declarations(path, 'declarations', 'id'); - }, - visitFunctionExpression(path) { - let { params } = path.node; - for (let i = params.length - 1; i >= 0; i--) { - isUnused(params[i]) ? path.get('params', i).prune() : (i = -1); - } - this.traverse(path); - }, - visitFunctionDeclaration(path) { - let { id } = path.node; - if (isUnused(id)) { - path.prune(); - return false; - } - this.visitFunctionExpression(path); - }, - // Remove empty block statements - visitSwitchStatement(path) { - let { node } = path; - return this.emptyStatement(path, !node.cases.length); - }, - visitWhileStatement(path) { - let { body } = path.node; - return this.emptyStatement(path, BlockStatement.check(body) && !(body).body.length); - }, - visitIfStatement(path) { - let { node } = path; - if (BlockStatement.check(node.alternate)) { - !(node.alternate).body.length && path.get('alternate').prune(); - } else if (IfStatement.check(node.alternate)) { - this.traverse(path); - } - let condition = BlockStatement.check(node.consequent) - && !(node.consequent).body.length && !node.alternate; - return this.emptyStatement(path, condition); - }, - visitTryStatement(path) { - let { node } = path; - if (BlockStatement.check(node.finalizer) && !node.finalizer.body.length) { - path.get('finalizer').prune(); - } - let condition = BlockStatement.check(node.block) && !node.block.body.length - && BlockStatement.check(node.handler.body) && !node.handler.body.body.length; - return this.emptyStatement(path, condition); - }, - // reduce expressions - visitUnaryExpression(path) { - let { node } = path; - if (Literal.check(node.argument) && node.operator !== 'void') { - path.replace(toLiteral(node)); - } - this.traverse(path); - }, - visitLogicalExpression(path) { - this.visitBinaryExpression(path); - }, - visitBinaryExpression(path) { - this.traverse(path); - let { node } = path; - if (Literal.check(node.left) && Literal.check(node.right)) { - path.replace(toLiteral(node)); - } - }, - // utils - declarations(path, list: string, prop: string) { - let node = path.node; - let items = node[list]; - for (let i = items.length - 1; i >= 0; i--) { - isUnused(items[i][prop]) && path.get(list, i).prune(); - } - !items.length && prop === 'local' && path.prune(); - this.traverse(path); - }, - emptyStatement(path, condition: boolean) { - if (condition) { - path.prune(); - return false; - } - this.traverse(path); - } - }); - unused = findUnused(ast); - iterations++; - if (!unused.length) { - iterations = 5; - } - } -} - -function toLiteral(node: Node) { - if (UnaryExpression.check(node)) { - let { operator, argument } = node; - return literal(evalUnary(operator, (argument).value)); - } else { - let { operator, left, right } = node; - return literal(evalBinary(operator, (left).value, (right).value)); - } -} - -function evalUnary(operator: UnaryOperator, argument: any) { - let evaluate = `${/typeof|delete/.test(operator) ? `${operator} ` : operator}${toValue(argument)}`; - return eval(evaluate); -} - -function evalBinary(operator: BinaryOperator, left: any, right: any) { - let evaluate = `${toValue(left)}${operator}${toValue(right)}`; - return eval(evaluate); -} - -function toValue(value: any) { - return typeof value === 'string' ? `'${value}'` : value; -} - -function findUnused({ program }: RecastAST) { - types.visit(program, { - visitNode(path) { - if (path.node.type !== 'Program') path.node['parent'] = path.parent.node; - this.traverse(path); - } - }); - let scopeManager = analyze(program, { sourceType: 'module', ecmaVersion: 10 }); - return collectUnuseds(scopeManager.acquire(program), []).reduce((result, variable) => { - if (variable.references.length) { - result.push(...variable.references.map(({ identifier: id, resolved }) => { - return id['parent'].type === 'CallExpression' ? resolved.defs[0].name : id; - })); - } else { - result.push(...variable.defs.map(d => d.name)); - } - return result; - }, []); -} - -function isInLoop(node: Node) { - while (node && !types.namedTypes.Function.check(node)) { - if (LOOP_STATEMENT.test(node.type)) return true; - node = node['parent']; - } - return false; -} - -function getUpperFunction(node: Node) { - while (node) { - if (types.namedTypes.Function.check(node)) return node; - node = node['parent']; - } - return null; -} - -function getRhsNode(ref: Reference, prevRhsNode: Node) { - const id = ref.identifier; - const parent = id['parent']; - const granpa = parent.parent; - const refScope = ref.from.variableScope; - const varScope = ref.resolved['scope'].variableScope; - const canBeUsedLater = refScope !== varScope || isInLoop(id); - - if (prevRhsNode && isInside(id, prevRhsNode)) { - return prevRhsNode; - } - if (parent.type === 'AssignmentExpression' && granpa.type === 'ExpressionStatement' && - id === parent.left && !canBeUsedLater - ) { - return parent.right; - } - return null; -} - -function isStorableFunction(funcNode: Identifier, rhsNode: Node) { - let node = funcNode; - let parent: Node = funcNode['parent']; - - while (parent && isInside(parent, rhsNode)) { - switch (parent.type) { - case 'SequenceExpression': - if (parent.expressions[parent.expressions.length - 1] !== node) { - return false; - } - break; - case 'CallExpression': - case 'NewExpression': - return parent.callee !== node; - case 'AssignmentExpression': - case 'TaggedTemplateExpression': - case 'YieldExpression': - return true; - default: - if (STATEMENT_TYPE.test(parent.type)) { - return true; - } - } - node = parent; - parent = parent['parent']; - } - return false; -} - -function isExported(variable: Variable) { - const definition = variable.defs[0]; - if (definition) { - let node: Node = definition.node; - if (node.type === 'VariableDeclarator') { - node = node['parent']; - } else if (definition.type === 'Parameter') { - return false; - } - return node['parent'].type.indexOf('Export') === 0; - } - return false; -} - -function isReadRef(ref: Reference) { - return ref.isRead(); -} - -function isSelfReference(ref: Reference, nodes: Node[]) { - let scope = ref.from; - while (scope) { - if (nodes.indexOf(scope.block) >= 0) { - return true; - } - scope = scope.upper; - } - return false; -} - -function isInside(inner: Identifier, outer: Node) { - return (inner.range[0] >= outer.range[0] && inner.range[1] <= outer.range[1]); -} - -function isInsideOfStorableFunction(id, rhsNode) { - const funcNode = getUpperFunction(id); - return (funcNode && isInside(funcNode, rhsNode) && isStorableFunction(funcNode, rhsNode)); -} - -function isReadForItself(ref: Reference, rhsNode: Node) { - const id = ref.identifier; - const parent = id['parent']; - const isExpStmt = parent.parent.type === 'ExpressionStatement'; - return ref.isRead() && ( - (parent.type === 'AssignmentExpression' && isExpStmt && parent.left === id) || - (parent.type === 'UpdateExpression' && isExpStmt) || - (rhsNode && isInside(id, rhsNode) && !isInsideOfStorableFunction(id, rhsNode)) - ); -} - -function isForInRef(ref: Reference) { - let target: Node = ref.identifier['parent']; - if (target.type === 'VariableDeclarator') target = target['parent'].parent; - if (target.type !== 'ForInStatement') return false; - target = target.body.type === 'BlockStatement' ? target.body.body[0] : target.body; - if (!target) return false; - return target.type === 'ReturnStatement'; -} - -function isUsedVar({ defs, references }: Variable) { - const fNodes = defs.filter(def => def.type === 'FunctionName') - .map(def => def.node), isFuncDef = fNodes.length > 0; - let rhsNode: Node = null; - - return references.some(ref => { - if (isForInRef(ref)) return true; - const forItself = isReadForItself(ref, rhsNode); - rhsNode = getRhsNode(ref, rhsNode); - return (isReadRef(ref) && !forItself && - !(isFuncDef && isSelfReference(ref, fNodes))); - }); -} - -function collectUnuseds(scope: Scope, unusedVars: Variable[]) { - let i, l; - const { variables, childScopes } = scope; - for (i = 0, l = variables.length; i < l; ++i) { - const variable = variables[i]; - if (scope.type === 'class' && (scope.block).id === variable.identifiers[0]) { - continue; - } - if (scope.functionExpressionScope || variable['eslintUsed']) { - continue; - } - if (scope.type === 'function' && variable.name === 'arguments' && variable.identifiers.length === 0) { - continue; - } - const def = variable.defs[0]; - if (def && def.type === 'Parameter') { - const { type, kind } = def.node['parent']; - if ((type === 'Property' || type === 'MethodDefinition') && kind === 'set') { - continue; - } - } - !isUsedVar(variable) && !isExported(variable) && unusedVars.push(variable); - } - for (i = 0, l = childScopes.length; i < l; ++i) { - collectUnuseds(childScopes[i], unusedVars); - } - return unusedVars; -} - -function toAst(src: string, sourceType: string = 'script') { - return parse(src, { - parser: { - parse(source: string, options) { - return parser(source, { ...options, ...{ ecmaVersion: 10, sourceType, range: true, loc: true } }); - } - } - }); -} - -function toMember(node: Expression, ctx: string) { - return memberExpression(identifier(ctx), node, false); -} - -function toCode(ast: RecastAST) { - return print(ast, { tabWidth: 2, quote: 'single' }); -} - -function canBeReplaced(node: Node, path, globals) { - return Identifier.check(node) && !isDeclared(node, path) && !isGlobal(node, globals); -} - -function replace(name: string, ctx: string, path, position?: number) { - if (typeof position === 'number') { - let node = path.get(name, position).value; - path.get(name, position).replace(toMember(node, ctx)); - } else { - let node = path.get(name).value; - path.get(name).replace(toMember(node, ctx)); - } -} - -function isDeclared(node: Identifier, { scope }: Path) { - return scope.declares(node.name); -} - -function isGlobal(node: Identifier, globals = []) { - let { name } = node; - let isGlob = name in builtin || name in browser || name in nodejs || name in amd; - return name === 'name' ? false : isGlob || !!~globals.indexOf(name); -} - -function isReplaceable(node: Node, path: Path, globals: string[]) { - let checks = types.namedTypes; - return checks.AssignmentExpression.check(node) ? - isReplaceable((node).left, path, globals) : - checks.UpdateExpression.check(node) ? - isReplaceable((node).argument, path, globals) : - checks.MemberExpression.check(node) ? - isReplaceable((node).object, path, globals) : - canBeReplaced(node, path, globals); -} - -function isSameIdentifier(a: Identifier, b: Identifier) { - return a.name === b.name && JSON.stringify(a.loc) === JSON.stringify(b.loc); -} diff --git a/src/utilities/cssToJson.ts b/src/utilities/cssToJson.ts deleted file mode 100644 index 0c9283e..0000000 --- a/src/utilities/cssToJson.ts +++ /dev/null @@ -1,113 +0,0 @@ -import parser = require('../../lib/CSSParse'); -import { - Rule, Declaration, Charset, Document, - FontFace, Namespace, KeyFrames, KeyFrame, - Media, Import, Page, Supports, Stylesheet -} from 'css'; - -export default function parseCSS(cssData) { - try { - let parsed = parser(cssData); - return cssRules(parsed); - } catch (err) { - console.log('Error during parsing css data:', err.message, err.stack); - } -} - -function declarationNodes(props: Object, declarations: Declaration[]) { - for (let j = 0; j < declarations.length; j++) { - let declaration = declarations[j]; - if (declaration.type === 'declaration') { - props[declaration.property] = declaration.value; - } - } -} - -function ruleNode(node: Rule | FontFace | Page) { - let body: { [key: string]: string } = {}; - declarationNodes(body, node.declarations); - let selector = node.type === 'rule' ? (node).selectors.join(', ') : `@${node.type}`; - return { selector, body }; -} - -function keyframesNode(node: KeyFrames) { - let frames = {}; - for (let i = 0; i < node.keyframes.length; i++) { - let rule = node.keyframes[i]; - if (rule.type === 'keyframe') { - let frame = {}; - declarationNodes(frame, rule.declarations); - frames[rule.values.join(', ')] = frame; - } - } - const body = { name: node.name, frames }; - return { selector: node.type, body }; -} - -function unNestedAtRuleNodes(node: Charset | Import | Namespace) { - return { selector: `@${node.type}`, body: node[node.type] }; -} - -function nestedAtRuleNode(node: Document | Media | Supports) { - let body = {}; - for (let i = 0; i < node.rules.length; i++) { - const rule = node.rules[i]; - let parts = { selector: '', body: {} }; - switch (rule.type) { - case 'import': - case 'charset': - case 'namesapce': { - parts = unNestedAtRuleNodes(rule); - break; - } - case 'rule': - case 'page': - case 'fontface': { - parts = ruleNode(rule); - break; - } - case 'keyframes': { - parts = keyframesNode(rule); - break; - } - default: - parts = nestedAtRuleNode(rule); - break; - } - body[parts.selector] = parts.body; - } - return { selector: `@${node.type}${node[node.type] ? ` ${node[node.type]}` : ''}`, body }; -} - -function cssRules(ast: Stylesheet) { - let json = {}; - if (ast && ast.type === 'stylesheet' && ast.stylesheet && ast.stylesheet.rules) { - for (let j = 0; j < ast.stylesheet.rules.length; j++) { - let rule = ast.stylesheet.rules[j]; - let parts = { selector: '', body: {} }; - switch (rule.type) { - case 'import': - case 'charset': - case 'namesapce': { - parts = unNestedAtRuleNodes(rule); - break; - } - case 'rule': - case 'page': - case 'fontface': { - parts = ruleNode(rule); - break; - } - case 'keyframes': { - parts = keyframesNode(rule); - break; - } - default: - parts = nestedAtRuleNode(rule); - break; - } - json[parts.selector] = { ...(json[parts.selector] || {}),...parts.body}; - } - } - return json; -} diff --git a/src/utilities/html.ts b/src/utilities/html.ts deleted file mode 100644 index 7f97fbc..0000000 --- a/src/utilities/html.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { NodeElement } from './classes'; -import { parseFragment, DefaultTreeNode, DefaultTreeElement, DefaultTreeDocumentFragment, DefaultTreeCommentNode, DefaultTreeTextNode } from 'parse5'; - -export function removeEmptyNodes(nodes: DefaultTreeNode[]) { - return nodes.filter(node => { - if ((node).tagName) { - (node).childNodes = removeEmptyNodes((node).childNodes); - return true; - } - let prop = 'value' in node ? 'value' : 'data'; - return (node)[prop].length; - }); -} - -export function stripWhitespace(nodes: DefaultTreeNode[]) { - return nodes.map(node => { - if ((node).tagName) { - (node).childNodes = stripWhitespace((node).childNodes); - } else { - let prop = 'value' in node ? 'value' : 'data'; - let value = node[prop]; - (node)[prop] = value.trim() ? value : ''; - } - return node; - }); -} - -export function removeComments(nodes: DefaultTreeNode[]) { - return nodes.map(node => { - if ((node).tagName) { - (node).childNodes = removeComments((node).childNodes); - } else if (node.nodeName === '#comment') { - (node).data = ''; - } - return node; - }); -} - -export function walkNode(root: NodeElement, walk: (el: NodeElement) => void, includeRoot: boolean = false) { - if (includeRoot) walk(root); - const nodes = root.content ? root.content.childNodes : root.childNodes; - nodes.forEach(node => { - if (node.nodeType === 1) { - if (!includeRoot) walk(node); - walkNode(node, walk, includeRoot); - } else { - walk(node); - } - }); -} - -function getNodes(html: string, noComments: boolean = false) { - let ast = parseFragment(html); - let nodes = noComments ? removeComments(ast.childNodes) : stripWhitespace(ast.childNodes); - return removeEmptyNodes(nodes); -} - -export function getDoc(html: string, noComments: boolean = false) { - const childNodes: DefaultTreeNode[] = getNodes(html, noComments); - return new NodeElement({ nodeName: '#document-fragment', childNodes }, null); -} diff --git a/src/utilities/jsonToCss.ts b/src/utilities/jsonToCss.ts deleted file mode 100644 index 88d87fd..0000000 --- a/src/utilities/jsonToCss.ts +++ /dev/null @@ -1,447 +0,0 @@ -import { hash, camelToKebabCase } from './tools'; - -let newline = '\n'; -let defaultOptions = { - minify: false, - keepCamelCase: false, - combineSelectors: true -}; - -function toCSS(rules: { [key: string]: any }, options: { [key: string]: any }, indent?: string[]) { - let css = ''; - indent = indent || options['indent'] || ['', ' ']; - for (let selector in rules) { - // handling raw content - if (~selector.indexOf('____raw')) { - let rawSel = /(____raw_)/.exec(selector)[0]; - css += rules[selector][rawSel] + newline; - // handling normal styles - } else { - let entityStyle = `${indent[0]}${selector} {${newline}`; - let entity = ''; - for (let prop in rules[selector]) { - let value = rules[selector][prop]; - if (value === '') { - value = '""'; - } - prop = prop.replace(/[$]\d*/, ''); - prop = options && options.keepCamelCase === true ? prop : prop.replace(/([A-Z])/g, w => `-${w.toLowerCase()}`); - entity += `${indent[1]}${prop}: ${value};${newline}`; - } - if (entity !== '') { - entityStyle += entity; - entityStyle += `${indent[0]}}${newline}`; - css += entityStyle; - } - } - } - return css; -} - -// combining selectors -function combineSelectors(rules: { [key: string]: any }, preventCombining: string[], keepCamelCase: boolean) { - let map = [], arr = {}; - preventCombining = [].concat(preventCombining || []); - preventCombining.splice(0, 0, ''); - let prevent = preventCombining.join('|'); - // extracting every property - for (let selector in rules) { - let props = rules[selector]; - for (let prop in props) { - map.push({ - selector: selector, - prop: prop, - value: props[prop], - combine: prevent.indexOf('|' + prop) < 0 && selector.indexOf('@font-face') < 0 - }); - } - } - // combining - for (let i = 0; i < map.length; i++) { - if (map[i].combine === true && map[i].selector !== false) { - for (let j = i + 1; j < map.length; j++) { - let propi = keepCamelCase ? map[i].prop : camelToKebabCase(map[i].prop); - let propj = keepCamelCase ? map[j].prop : camelToKebabCase(map[j].prop); - if (propi === propj && map[i].value === map[j].value) { - map[i].selector += ', ' + map[j].selector.replace(/[$]\d*/, ''); - map[j].selector = false; // marking for removal - } - } - } - } - // preparing the result - for (let i = 0; i < map.length; i++) { - if (map[i].selector !== false) { - if (!arr[map[i].selector]) { - arr[map[i].selector] = {}; - } - arr[map[i].selector][map[i].prop] = map[i].value; - } - } - return arr; -} - -function minify(content: string) { - return content - // Remove comments, newlines and tabs - .replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, '') - // Remove more than single adjacent spaces - .replace(/ {2,}/g, ' ') - .replace(/ ([{:}]) /g, '$1') - .replace(/: /g, ':') - .replace(/([;,]) /g, '$1') - .replace(/ !/g, '!'); -} - -function processor(rules: { [stylesheet: string]: { [key: string]: any } }, options?: { [key: string]: any }) { - options = options || defaultOptions; - let css = ''; - for (let stylesheet in rules) { - let r = rules[stylesheet]; - r = options.combineSelectors ? combineSelectors(r, options.preventCombining, options.keepCamelCase) : r; - if (stylesheet === 'mainstream') { - css += toCSS(r, options); - } else { - css += `${stylesheet} {${newline}${toCSS(r, options, [' ', ' '])}}${newline}`; - } - } - // Minification - if (options.minify) { - css = minify(css); - } - return css; -} - -function abstractStyle(options: { [key: string]: any }) { - const localPlugins: { [key: string]: any } = {}; - let HASHCLASS = '____HASHCLASS____'; - - localPlugins['keyframes'] = keyframes; - - let abtStyle: any = (objRules: Object, scope?: string) => { - let scopeClass = scope ? `scope_${hash(scope)}` : HASHCLASS; - let ruleResgitered = []; - let allRules = { mainstream: {} }; - options = { ...{ combineSelectors: true, preventCombining: ['@font-face'] }, ...(options || {}) }; - - function execPlugins(selector, property, value, stylesheet, parentSelector) { - let { prop, prefix } = nonPrefixProp(property); - let plugin = localPlugins[prop]; - if (typeof plugin !== 'undefined') { - let pluginResponse = plugin(value, prefix); - if (pluginResponse) { - addRule(selector, pluginResponse, stylesheet, parentSelector); - } - return true; - } else { - return false; - } - } - - function addRule(selector, props, stylesheet, parentSelector?) { - stylesheet = stylesheet || 'mainstream'; - // catching null values - if (props === null || typeof props === 'undefined' || props === false) { - return; - } - if (!parentSelector && !selector) { - selector = ''; - } - // classify - if (typeof props.classify !== 'undefined' && props.classify === true) { - props = typeof props.toJSON !== 'undefined' ? props.toJSON() : props.toString(); - } - // multiple selectors - if (/, ?/g.test(selector) && options.combineSelectors) { - let parts = selector.replace(/, /g, ',').split(','); - for (let i = 0; i < parts.length; i++) { - let p = parts[i]; - addRule(p, props, stylesheet, parentSelector); - } - return; - } - // check for plugin - if (execPlugins(null, selector, props, stylesheet, parentSelector)) { - return; - } - // if array is passed - if (typeof props.length !== 'undefined' && typeof props === 'object') { - for (let i = 0; i < props.length; i++) { - let prop = props[i]; - if (prop) { - addRule(selector, prop, stylesheet, parentSelector); - } - } - return; - } - - let _props = {}, - _selector = selector, - _objects = {}, - _functions = {}; - // processing props - for (let prop in props) { - // classify - let value = props[prop]; - if (value && typeof value.classify !== 'undefined' && value.classify === true) { - value = typeof value.toJSON !== 'undefined' ? value.toJSON() : value.toString(); - } - let type = typeof value; - if (type !== 'object' && type !== 'function' && value !== false && value !== true) { - if (execPlugins(selector, prop, value, stylesheet, parentSelector) === false) { - // moving the selector to the top of the chain - if (_selector.indexOf('^') === 0) { - _selector = _selector.substr(1, _selector.length - 1) + (typeof parentSelector !== 'undefined' ? ' ' + parentSelector : ''); - } else { - _selector = typeof parentSelector !== 'undefined' ? parentSelector + ' ' + selector : selector; - } - _props[prop] = value; - addPrefixes(prop, _props); - } - } else if (type === 'object') { - _objects[prop] = value; - } else if (type === 'function') { - _functions[prop] = value; - } - } - - ruleResgitered.push({ - selector: _selector, - props: _props, - stylesheet: stylesheet - }); - - for (let prop in _objects) { - // check for pseudo classes - if (prop.charAt(0) === ':') { - addRule(selector + prop, _objects[prop], stylesheet, parentSelector); - // check for ampersand operator - } else if (/&/g.test(prop)) { - if (/, ?/g.test(prop) && options.combineSelectors) { - let parts = prop.replace(/, /g, ',').split(','); - for (let i = 0; i < parts.length; i++) { - let part = parts[i]; - if (part.indexOf('&') >= 0) { - addRule(part.replace(/&/g, selector), _objects[prop], stylesheet, parentSelector); - } else { - addRule(part, _objects[prop], stylesheet, typeof parentSelector !== 'undefined' ? parentSelector + ' ' + selector : selector); - } - } - } else { - addRule(prop.replace(/&/g, selector), _objects[prop], stylesheet, parentSelector); - } - // check for media query - } /* else if (prop.indexOf('@media') === 0 || prop.indexOf('@supports') === 0 || prop.indexOf('@document') === 0) { - addRule(selector, _objects[prop], prop, parentSelector); - // check for media query - } */ else if (selector.indexOf('@media') === 0 || prop.indexOf('@supports') === 0 || prop.indexOf('@document') === 0) { - addRule(prop, _objects[prop], selector, parentSelector); - // moving the selector to the top of the chain - } else if (selector.indexOf('^') === 0) { - // selector, props, stylesheet, parentSelector - let sel = selector.substr(1, selector.length - 1) + (typeof parentSelector !== 'undefined' ? ' ' + parentSelector : '') + ' ' + prop; - addRule(sel, _objects[prop], stylesheet); - // check for plugins - } else if (execPlugins(selector, prop, _objects[prop], stylesheet, parentSelector) === false) { - addRule(prop, _objects[prop], stylesheet, (parentSelector ? parentSelector + ' ' : '') + selector); - } - } - - for (let prop in _functions) { - let obj = {}; - obj[prop] = _functions[prop](); - addRule(selector, obj, stylesheet, parentSelector); - } - } - - try { - let stylesheet = 'mainstream'; - for (let selector in objRules) { - addRule(selector, objRules[selector], stylesheet); - } - // looping through the rules for registering - for (let i = 0; i < ruleResgitered.length; i++) { - stylesheet = ruleResgitered[i].stylesheet; - let props = ruleResgitered[i].props; - let selector = addScope(ruleResgitered[i].selector, `.${scopeClass || HASHCLASS}`); - // overwrite already added value - allRules[stylesheet] = allRules[stylesheet] || {}; - let rules = allRules[stylesheet]; - let current = rules[selector] || {}; - for (let prop in props) { - let value = props[prop]; - if (typeof value !== 'object') { - if (value.toString().charAt(0) === '+') { - if (current && current[prop]) { - current[prop] = current[prop] + ', ' + value.substr(1, value.length - 1); - } else { - current[prop] = value.substr(1, value.length - 1); - } - } else if (value.toString().charAt(0) === '>') { - if (current && current[prop]) { - current[prop] = current[prop] + ' ' + value.substr(1, value.length - 1); - } else { - current[prop] = value.substr(1, value.length - 1); - } - } else { - current[prop] = value; - } - } - } - rules[selector] = current; - } - } catch (err) { - throw new Error('Error adding: ' + JSON.stringify({ rules: objRules, error: err.toString() })); - } - - let className = ''; - let styleText = processor(allRules, options); - if (scope) { - className = scopeClass; - } else { - let toHash = minify(styleText.replace(new RegExp(`\\.${HASHCLASS}`, 'g'), '')); - className = `scope_${hash(toHash)}`; - styleText = styleText.replace(new RegExp(HASHCLASS, 'g'), className); - } - - return { className, styleText: minify(styleText) }; - }; - - abtStyle.minify = minify; - - abtStyle.prop = (pluginName: string, pluginAction: (value: any) => { [key: string]: any }) => { - localPlugins[pluginName] = pluginAction; - return abtStyle; - }; - - abtStyle.process = (rules: { [key: string]: any }, options: { [key: string]: any }) => { - return processor({ mainstream: rules }, options); - }; - - abtStyle.raw = (rules: { [key: string]: any }, options: { [key: string]: any }) => { - return rawContent(processor({ mainstream: rules }, options)); - }; - - return abtStyle; -} - -export default abstractStyle; - -function rawContent(raw: string) { - let id = '____raw_', object = { [id]: { [id]: raw } }; - return object; -} - -function keyframes(value: { [key: string]: any }) { - if (typeof value === 'object') { - let frames; - if (value['frames'] === void 0) { - frames = value['frames']; - } - let key = `@keyframes ${value['name']}`; - let wkey = `@-webkit-keyframes ${value['name']}`; - let frm = processor({ mainstream: frames }, { combineSelectors: false, indent: [' ', ' '] }); - return rawContent(`${key} {\n${frm}}\n${wkey} {\n${frm}}`); - } -} - -function removeExtraSpaces(sel) { - return sel.trim() - .replace(/\s*(,)\s*/g, '$1') - .replace(/\s*(>)\s*/g, '$1') - .replace(/\s*(\+)\s*/g, '$1') - .replace(/\s*(~)\s*/g, '$1'); -} - -function include(sel: string) { - return !!(~sel.indexOf(' ') || ~sel.indexOf(',') || ~sel.indexOf('>') || ~sel.indexOf('+') || ~sel.indexOf('~')); -} - -function addScope(sel: string, scope: string) { - sel = removeExtraSpaces(sel); - let prefix = sel.charAt(0); - if (include(sel)) { - if (~sel.indexOf(' ')) { - sel = addScopeToList(sel, scope, ' '); - } else if (~sel.indexOf(',')) { - sel = addScopeToList(sel, scope, ', '); - } else if (~sel.indexOf('>')) { - sel = addScopeToList(sel, scope, ' > '); - } else if (~sel.indexOf('+')) { - sel = addScopeToList(sel, scope, ' + '); - } else if (~sel.indexOf('~')) { - sel = addScopeToList(sel, scope, ' ~ '); - } - } else if (prefix === '.' || prefix === '#' || prefix === '[') { - sel = scope + sel; - } else if (~sel.indexOf(':')) { - let parts = sel.split(':'); - sel = parts[0] + scope + ':' + parts.slice(1).join(':'); - } else if (prefix !== '@') { - let parts = sel.split(' '); - sel = parts[0] + scope + ' ' + parts.slice(1).join(' '); - } - return sel.trim(); -} - -function addScopeToList(sel: string, scope: string, sep: string) { - if (!~sel.indexOf('@')) { - sel = sel.split(sep !== ' ' ? sep.trim() : sep) - .map(select => addScope(select, scope)).join(sep); - } - return sel; -} - -// http://docs.emmet.io/css-abbreviations/vendor-prefixes/ (w: webkit, m: moz, s: ms, o: o) -function prefixExtract(prop: string) { - let result: { prefix?: string | boolean, prop?: string } = {}; - let match = prop.match(/^\-(w|m|s|o)+\-/); - if ((match || prop.charAt(0) === '-') && !prop.match(/^\-(webkit|moz|ms)+\-/)) { - if (match !== null && match[0]) { - result = { prefix: match[0].replace(/-/g, '') }; - result.prop = prop.replace(match[0], ''); - } else { - result = { prefix: '' }; - result.prop = prop.substr(1, prop.length); - } - } else { - result = { - prefix: false, - prop: prop - }; - } - return result; -} - -function addPrefixes(prop: string, obj: Object) { - let originalProp = prop, p = prefixExtract(prop), value = obj[prop]; - if (p.prefix !== false) { - delete obj[originalProp]; - obj[p.prop] = value; - let isEmpty = p.prefix === ''; - if (isEmpty || ~(p.prefix).indexOf('w')) { - obj[`-webkit-${p.prop}`] = value; - } - if (isEmpty || ~(p.prefix).indexOf('m')) { - obj[`-moz-${p.prop}`] = value; - } - if (isEmpty || ~(p.prefix).indexOf('s')) { - obj[`-ms-${p.prop}`] = value; - } - if (isEmpty || ~(p.prefix).indexOf('o')) { - obj[`-o-${p.prop}`] = value; - } - } -} - -function nonPrefixProp(prop: string) { - let p = prefixExtract(prop); - if (p.prefix !== false) { - if (p.prefix === '') { - p.prefix = '-'; - } else { - p.prefix = `-${p.prefix}-`; - } - } - return p; -} \ No newline at end of file diff --git a/src/utilities/tools.ts b/src/utilities/tools.ts deleted file mode 100644 index c6f3474..0000000 --- a/src/utilities/tools.ts +++ /dev/null @@ -1,107 +0,0 @@ -export function capitalize(str: string) { - return str[0].toUpperCase() + str.slice(1); -} - -export function clearText(str: string) { - return str.replace(/[\r\t\n]/g, ' ').replace(/\s{2,}/g, ' '); -} - -export function escapeExp(str: string) { - return str.replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/'/g, `\\'`); -} - -export function createElement(variable: string, tag: string, isSVG: boolean) { - return `${variable} = ${isSVG ? '_$svg' : '_$el'}(${tag === 'div' || tag === 'svg' ? '' : `'${tag}'`});`; -} - -export function createNode(variable: string, content?: string) { - return `${variable} = ${variable.split('_')[0] === 'txt' ? '_$text' : '_$comment'}(${content || ''});`; -} - -export function getVarName(variables: string[], variable: string) { - variable = `${variable}_1`; - if (variables.includes(variable)) { - let [varName] = variable.split('_'); - let count = variables.filter(varb => varb.split('_')[0] === varName).length; - varName = `${varName}_${count + 1}`; - variables.push(varName); - return varName; - } else { - let varName = variables.push(variable); - return variables[varName - 1]; - } -} - -export function kebabToCamelCases(str: string) { - return str.replace(/-([a-z0-9_])/g, (_, w) => w.toUpperCase()); -} - -export function camelToKebabCase(str: string) { - let kebab = str.replace(/([A-Z])/g, w => `-${w.toLowerCase()}`); - if (kebab.charAt(0) === '-') kebab = kebab.substring(1); - return kebab; -} - -export function toMap(str: string) { - const map: Record = str - .split(',').reduce((map, val) => (map[val.trim()] = 1, map), {}); - return (val: string) => !!map[val]; -} - -function pad(hash: string, len: number) { - while (hash.length < len) { - hash = `0${hash}`; - } - return hash; -} - -function fold(hash: number, text: string) { - let i, chr, len; - if (text.length === 0) { - return hash; - } - for (i = 0, len = text.length; i < len; i++) { - chr = text.charCodeAt(i); - hash = ((hash << 5) - hash) + chr; - hash |= 0; - } - return hash < 0 ? hash * -2 : hash; -} - -export function hash(value: string) { - let preHash = fold(0, value); - if (value === null) { - preHash = fold(preHash, 'null'); - } else if (value === undefined) { - preHash = fold(preHash, 'undefined'); - } else { - preHash = fold(preHash, value.toString()); - } - return pad(preHash.toString(16), 8); -} - -export function filterParser(expression: string) { - let pos = 0; - let variable = ''; - let exps = expression.split(/\s*\|\s*/); - for (let i = 0; i < exps.length; i++) { - const exp = exps[i]; - if (exps[i + 1] === '') { - let after = exps[i + 2]; - variable = `${variable ? variable : exp} || ${after}`; - i++; - } else { - pos = i; - i = exps.length; - } - } - if (!variable) { - variable = exps[pos]; - } - let filters = exps.slice(pos + 1, exps.length); - return filters.length === 0 ? variable : filters.reduce((prevfilter, filter) => { - const [filterName, ...args] = filter.split(/\s/); - const params = args.join(', '); - return `$filters.${filterName}(${prevfilter ? prevfilter : variable}${params ? `, ${params}` : params})`; - }, ''); -} \ No newline at end of file diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..0b2c7e1 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,195 @@ +import { AllHtmlEntities } from 'html-entities'; +import { Segment, Segments } from '../parsers/script/segments'; +import { Identifier, ExpressionStatement, AssignmentExpression } from '../parsers/script/estree'; +import { isAssignmentExpression, isCallExpression, isExpressionStatement } from '../parsers/script/nodes'; + +const entities = new AllHtmlEntities(); + +function replaceVar(array: Segment, oldVar: string, newVar: string) { + const assign = array.find(stmt => { + if (isExpressionStatement(stmt)) { + const exp = stmt.expression; + return isAssignmentExpression(exp) && (exp.left).name === oldVar && + isCallExpression(exp.right) && (exp.right.callee).name === '_$child'; + } + return false; + }); + if (assign) { + ((assign.expression).left).name = newVar; + } +} + +function replaceItem(array: T[], item: T, replacer?: T) { + const index = array.indexOf(item); + if (~index) { + if (replacer) { + array.splice(index, 1, replacer); + } else { + array.splice(index, 1); + } + } +} + +function capitalize(str: string, from?: number) { + str = typeof from === 'number' ? str.slice(from) : str; + return str[0].toUpperCase() + str.slice(1); +} + +function snakeToCamel(str: string) { + return str.replace(/([-_]\w)/g, w => w[1].toUpperCase()); +} + +function camelToSnake(str: string) { + return str.replace(/[\w]([A-Z])/g, m => `${m[0]}_${m[1]}`).toLowerCase(); +} + +function each(array: T[], cb: (item: T, i: number, array: T[]) => void) { + if (!cb) { + return; + } + let { length } = array; + for (let i = 0; i < length; i++) { + cb(array[i], i, array); + if (length !== array.length) { + i--; + length = array.length; + } + } +} + +function escapeCharacters(str: string) { + return str.replace(/(\t|\r|\n|')/g, match => { + switch (match) { + case '\n': return '\\n'; + case '\r': return '\\r'; + case '\t': return '\\t'; + case '\'': return `\\'`; + default: break; + } + }); +} + +function toValidate(str: string | string[]) { + const list = Array.isArray(str) ? str : str.split(','); + return (val: string) => list.includes(val); +} + +function filterPlaceholders(list: string[]) { + return list.filter(g => !['_$v', '_$i'].includes(g)); +} + +function pad(hash: string, len: number) { + while (hash.length < len) { + hash = `0${hash}`; + } + return hash; +} + +function fold(hash: number, text: string) { + let i: number, chr: number, len: number; + if (text.length === 0) { + return hash; + } + for (i = 0, len = text.length; i < len; i++) { + chr = text.charCodeAt(i); + hash = ((hash << 5) - hash) + chr; + hash |= 0; + } + return hash < 0 ? hash * -2 : hash; +} + +function hash(value: string) { + let preHash = fold(0, value); + if (value === null) { + preHash = fold(preHash, 'null'); + } else if (value === undefined) { + preHash = fold(preHash, 'undefined'); + } else { + preHash = fold(preHash, value.toString()); + } + return pad(preHash.toString(16), 8); +} + +function filters(expression: string, segmts: Segments) { + let pos = 0; + let stmt = ''; + const exps = expression.split(/\s*\|\s*/); + for (let i = 0; i < exps.length; i++) { + const exp = exps[i]; + if (exps[i + 1] === '') { + let after = exps[i + 2]; + stmt = `${stmt ? stmt : exp} || ${after}`; + i++; + } else { + pos = i; + i = exps.length; + } + } + if (!stmt) { + stmt = exps[pos]; + } + const filters = exps.slice(pos + 1, exps.length); + if (filters.length) { + segmts.addImport('trebor/tools', '_$filters'); + segmts.globalTools = segmts.globalTools || []; + segmts.globalTools.push('_$filters'); + return `_$filters(_$ctx, ${stmt}, ${filters.map(filter => { + const [name, params] = filter.split(/\((.*)\)/); + return `['${name.trim()}'${params ? `, ${params}` : ''}]`; + }, '')})`; + } else { + return stmt; + } +} + +function parseTextExpression(str: string, checkOrCb?: boolean | ((exp: string) => string)) { + let exp = ''; + let code = ''; + let text = '`'; + let quotemark = ''; + let blockLevel = 0; + let blockStart = -1; + let blockClose = false; + const quotemarks = `"'\``; + + for (let currentPos = 0, length = str.length; currentPos < length; currentPos++) { + blockClose = false; + let char = str[currentPos]; + if (char !== '\\') { // skip escaped characters + const index = quotemarks.indexOf(char); // Check for blocks inside strings + if (~index) { + // Check for unfinished strings + const hasPair = char !== quotemark && !!~str.slice(currentPos + 1).indexOf(char); + quotemark = hasPair ? quotemarks[index] : ''; // Set to corresponding closing quote + } else if (!quotemark) { + if (char === '}' && str[currentPos - 1] !== '\\') { + if (blockLevel === 1) { + blockLevel = 0; + blockClose = true; + exp = code.trim(); // Collect expression parts + text += exp ? `\${${typeof checkOrCb === 'function' && checkOrCb(exp) || exp}}` : ''; + code = ''; + if (checkOrCb === true) { + currentPos = length; + } + } else { + blockLevel && blockLevel--; // Check for block closing tag without starting tag + } + } else if (char === '{' && str[currentPos - 1] !== '\\') { // New block handling + blockLevel++; + blockStart = currentPos; + text += entities.decode(code); // Collect text parts + code = ''; + } + } + code += blockStart !== currentPos && !blockClose ? char : ''; + } + } + text += `${entities.decode(code)}\``; + return checkOrCb === true ? !!exp : text; +} + +export { + replaceVar, replaceItem, capitalize, snakeToCamel, camelToSnake, each, toValidate, filters, + filterPlaceholders, hash, parseTextExpression, escapeCharacters +}; \ No newline at end of file diff --git a/test/components/bind.html b/test/components/bind.html index e2d9f87..12934da 100644 --- a/test/components/bind.html +++ b/test/components/bind.html @@ -16,14 +16,12 @@ \ No newline at end of file diff --git a/test/components/components.html b/test/components/components.html index 88b0a8f..387cd81 100644 --- a/test/components/components.html +++ b/test/components/components.html @@ -1,17 +1,13 @@ Some other text - Some span text - Some header - Some footer + Some span text + Some header + Some footer \ No newline at end of file diff --git a/test/components/condition.html b/test/components/condition.html index 2099a12..69c0a8a 100644 --- a/test/components/condition.html +++ b/test/components/condition.html @@ -5,10 +5,8 @@
    1
    \ No newline at end of file diff --git a/test/components/filters.html b/test/components/filters.html new file mode 100644 index 0000000..540a255 --- /dev/null +++ b/test/components/filters.html @@ -0,0 +1,24 @@ +{ `${text} ` | trim } +{ 'some text uppercase' | upper } +
      +
    • { item | upper | trim }
    • +
    + + \ No newline at end of file diff --git a/test/components/html.html b/test/components/html.html index d50c916..c885911 100644 --- a/test/components/html.html +++ b/test/components/html.html @@ -3,20 +3,18 @@

    Any kind of content here. Such as <p>, <table>. You name it!

    -

    Some paragraph with text {{expression}}

    +

    Some paragraph with text {expression}

    -

    Some paragraph with {{text}} and {{attribute}} expressions

    +

    Some paragraph with {text} and {attribute} expressions

    -

    Some paragraph with text intentional {{escaped}}

    +

    Some paragraph with text intentional {escaped}

    \ No newline at end of file diff --git a/test/components/init.html b/test/components/init.html index 9a2513c..8ddeae4 100644 --- a/test/components/init.html +++ b/test/components/init.html @@ -1,9 +1,7 @@ -

    Hello, {{ text }}!!

    +

    Hello, { text }!

    \ No newline at end of file diff --git a/test/components/interpolation.html b/test/components/interpolation.html index eef0191..cee0239 100644 --- a/test/components/interpolation.html +++ b/test/components/interpolation.html @@ -1,13 +1,11 @@ -
    Test interpolation with {{ text_1 }}.
    -Test interpolation with {{ text_1 }} {{ text_2 }} {{ text_3 }} -

    Test {{ text_1 }} with {{ text_3 }} and some expresions with {{ text_2.toUpperCase() }}

    +
    Test interpolation with {text_1}.
    +Test interpolation with {text_1} {text_2} {text_3} +

    Test {text_1} with {text_3} and some expresions with {text_2.toUpperCase()}

    \ No newline at end of file diff --git a/test/components/loop.html b/test/components/loop.html index b327045..f4e5bda 100644 --- a/test/components/loop.html +++ b/test/components/loop.html @@ -1,58 +1,56 @@
      -
    • {{ item }}
    • +
    • { item }
      -
    • {{ item }}
    • +
    • { item }
      -
    • {{ item }}
    • +
    • { item }
      -
    • {{ item }}
    • +
    • { item }
      -
    • {{ item }}
    • +
    • { item }
      -
    • {{i + 1}} {{ item }}
    • +
    • {i + 1} { item }
    • - {{ index + 1 }}. {{ key }}: {{ value }} + { index + 1 }. { key }: { value }
      -
    • {{ i + 1 }} {{ item }}
    • +
    • { i + 1 } { item }
      -
    • {{ i + 1 }} {{ item }}
    • +
    • { i + 1 } { item }
      -
    • {{ i + 1 }} {{ item }}
    • +
    • { i + 1 } { item }
    • - {{ `${i + 1}.${item}.${index + 1} - ${key}: ${value}` }} + { `${i + 1}.${item}.${index + 1} - ${key}: ${value}` }
    \ No newline at end of file diff --git a/test/index.ts b/test/index.ts new file mode 100644 index 0000000..88c387d --- /dev/null +++ b/test/index.ts @@ -0,0 +1,30 @@ +import Jasmine from 'jasmine'; +import JasmineConsoleReporter from 'jasmine-console-reporter'; + +// setup Jasmine +const jasmine = new Jasmine({}); +jasmine.loadConfig({ + spec_dir: 'test/specs', + spec_files: ['**/*[sS]pec.js'], + random: false, + seed: null, + stopSpecOnExpectationFailure: false +}); +jasmine.jasmine['DEFAULT_TIMEOUT_INTERVAL'] = 15000; + +// setup console reporter +const reporter = new JasmineConsoleReporter({ + colors: 1, + emoji: true, + verbosity: 4, + cleanStack: 1, + timeUnit: 'ms', + listStyle: 'indent', + activity: 'bouncingBar', + timeThreshold: { ok: 500, warn: 1000, ouch: 3000 }, +}); + +// initialize and execute +jasmine.env.clearReporters(); +jasmine.addReporter(reporter); +jasmine.execute(); diff --git a/test/specs/bindValue.spec.ts b/test/specs/bindValue.spec.ts new file mode 100644 index 0000000..179f643 --- /dev/null +++ b/test/specs/bindValue.spec.ts @@ -0,0 +1,93 @@ +import { Page, Browser, JSHandle, ElementHandle } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component Binding', () => { + let page: Page; + let browser: Browser; + let instance: JSHandle; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'bind'); + [, instance] = await getComponent(page, 'Bind'); + }); + + afterAll(async () => { + await browser.close(); + }); + + describe('$name directive', () => { + describe('in a checked checkbox', () => { + it('should add value to an array', async () => { + await page.click('#checkbox_1'); + expect(await exec(instance, i => i.checkboxes.length)).toBe(1); + expect(await exec(instance, i => i.checkboxes[0])).toBe('Yes'); + }); + + it('with bond value should add object to an array', async () => { + await page.click('#checkbox_3'); + expect(await exec(instance, i => i.checkboxes_1.length)).toBe(1); + const obj: { value: string } = await exec(instance, i => i.checkboxes_1[0]); + expect(obj).toBeDefined(); + expect(typeof obj).toBe('object'); + expect(obj).toEqual({ value: 'Yes' }); + }); + }); + + describe('in an unchecked checkbox', () => { + it('should remove value from the array',async () => { + await page.click('#checkbox_1'); + expect(await exec(instance, i => i.checkboxes.length)).toBe(0); + }); + + it('with bond value should remove value from the array', async () => { + await page.click('#checkbox_3'); + expect(await exec(instance, i => i.checkboxes_1.length)).toBe(0); + }); + }); + + describe('in a checked radio', () => { + it('should assign value to the property', async () => { + await page.click('#radio_1'); + await page.click('#radio_1'); + expect(await exec(instance, i => i.radios)).toBe('radio 1'); + }); + + it('with bond value should assign the object value to the property', async () => { + await page.click('#radio_5'); + const obj: { value: string } = await exec(instance, i => i.radios_1); + expect(obj).toBeDefined(); + expect(typeof obj).toBe('object'); + expect(obj).toEqual({ value: 'radio 5' }); + }); + }); + }); + + describe('$value directive', () => { + it('should change text input value from model', async () => { + await exec(instance, i => i.$set('textValue', 'some text')); + const input: ElementHandle = await page.$('#text'); + expect(await exec(input, e => e.value)).toBe('some text'); + }); + + it('should change number input value from model', async () => { + await exec(instance, i => i.$set('numValue', 10)); + const input: ElementHandle = await page.$('#number'); + expect(await exec(input, e => e.value)).toBe('10'); + }); + }); + + describe('input.value', () => { + it('should change text input value in model', async () => { + await page.click('#text', { clickCount: 3 }); + await page.type('#text', 'text test'); + expect(await exec(instance, i => i.textValue)).toBe('text test'); + }); + + it('should change number input value in model', async () => { + await page.click('#number', { clickCount: 3 }); + await page.type('#number', '5'); + expect(await exec(instance, i => i.numValue)).toBe(5); + }); + }); +}); \ No newline at end of file diff --git a/test/specs/components.spec.ts b/test/specs/components.spec.ts new file mode 100644 index 0000000..16dc002 --- /dev/null +++ b/test/specs/components.spec.ts @@ -0,0 +1,49 @@ +import { Page, Browser, JSHandle, ElementHandle } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component instance', () => { + let page: Page = null; + let browser: Browser = null; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'components', 'comp'); + await getComponent(page, 'Components'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('should mount all instances', async () => { + const main: ElementHandle = await page.$('main'); + expect(await exec(main, m => m.children.length)).toBe(3); + }); + + it('should be mounted and render the default slot', async () => { + const main: ElementHandle = await page.$('main'); + expect(await exec(main, m => m.firstChild.nodeName)).toBe('DIV'); + expect(await exec(main, m => m.firstChild.textContent)).toBe('Some text'); + }); + + it('should be mounted and overwrite the default slot', async () => { + const main: ElementHandle = await page.$('main'); + const children: JSHandle = await main.getProperty('children'); + const child: JSHandle = await children.getProperty('1'); + expect(await exec(child, c => c.nodeName)).toBe('DIV'); + expect(await exec(child, c => c.textContent)).toBe('Some other text'); + }); + + it('should set the slot correctly', async () => { + const main: ElementHandle = await page.$('main'); + const children: JSHandle = await main.getProperty('children'); + const child: JSHandle = await children.getProperty('2'); + expect(await exec(child, c => c.nodeName)).toBe('DIV'); + expect(await exec(child, c => c.children[0].tagName)).toBe('SPAN'); + expect(await exec(child, c => c.children[0].textContent)).toBe('Some header'); + expect(await exec(child, c => c.children[1].tagName)).toBe('SPAN'); + expect(await exec(child, c => c.children[1].textContent)).toBe('Some span text'); + expect(await exec(child, c => c.children[2].tagName)).toBe('SPAN'); + expect(await exec(child, c => c.children[2].textContent)).toBe('Some footer'); + }); +}); \ No newline at end of file diff --git a/test/specs/condition.spec.ts b/test/specs/condition.spec.ts new file mode 100644 index 0000000..a3c82b6 --- /dev/null +++ b/test/specs/condition.spec.ts @@ -0,0 +1,46 @@ +import { Page, Browser, JSHandle, ElementHandle } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component Conditions', () => { + let page: Page; + let browser: Browser; + let instance: JSHandle; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'condition'); + [, instance] = await getComponent(page, 'Condition'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('`$if` should be rendered', async () => { + const span: ElementHandle = await page.$('main span'); + expect(await exec(span, s => s.textContent)).toBe('1'); + }); + + it('`$else-if` should be rendered', async () => { + await exec(instance, i => i.$set('condition', 2)); + const span: ElementHandle = await page.$('main span'); + expect(await exec(span, s => s.textContent)).toBe('2'); + }); + + it('`$else` should be rendered', async () => { + await exec(instance, i => i.$set('condition', 3)); + const span: ElementHandle = await page.$('main span'); + expect(await exec(span, s => s.textContent)).toBe('other'); + }); + + it('`$if` only should be rendered', async () => { + const div: ElementHandle = await page.$('main div'); + expect(await exec(div, d => d.textContent)).toBe('1'); + }); + + it('`$if` only should be hidden', async () => { + await exec(instance, i => i.$set('condition_1', 2)); + let div: ElementHandle = await page.$('main div'); + expect(div).toBeNull(); + }); +}); \ No newline at end of file diff --git a/test/specs/filters.spec.ts b/test/specs/filters.spec.ts new file mode 100644 index 0000000..0f548cb --- /dev/null +++ b/test/specs/filters.spec.ts @@ -0,0 +1,46 @@ +import { Page, Browser, JSHandle, ElementHandle } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component Filters', () => { + let page: Page; + let browser: Browser; + let instance: JSHandle; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'filters'); + [, instance] = await getComponent(page, 'Filters'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('should be declared', async () => { + const filters = await instance.getProperty('$filters'); + expect(await exec(filters, f => f.trim)).toBeDefined(); + expect(await exec(filters, f => f.upper)).toBeDefined(); + expect(await exec(filters, f => f.filterBy)).toBeDefined(); + }); + + it('should be functions', async () => { + const filters = await instance.getProperty('$filters'); + expect(await exec(filters, f => typeof f.trim)).toBe('function'); + expect(await exec(filters, f => typeof f.upper)).toBe('function'); + expect(await exec(filters, f => typeof f.filterBy)).toBe('function'); + }); + + it('should be filtered correctly', async () => { + const main = await page.$('main'); + const children: JSHandle = await main.getProperty('children'); + const ul: JSHandle = await children.getProperty('2'); + const span: JSHandle = await children.getProperty('0'); + const span1: JSHandle = await children.getProperty('1'); + expect(await exec(span, s => s.textContent)).toBe('some test text'); + expect(await exec(span1, s => s.textContent)).toBe('some text uppercase'.toUpperCase()); + await exec(instance, i => i.$set('filter', 'a')); + expect(await exec(ul, u => u.children.length)).toBe(2); + expect(await exec(ul, u => u.children[0].textContent)).toBe('AB'); + expect(await exec(ul, u => u.children[1].textContent)).toBe('A C'); + }); +}); \ No newline at end of file diff --git a/test/specs/html.spec.ts b/test/specs/html.spec.ts new file mode 100644 index 0000000..d3ad4a5 --- /dev/null +++ b/test/specs/html.spec.ts @@ -0,0 +1,37 @@ +import { Page, Browser } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component Html', () => { + let page: Page; + let browser: Browser; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'html'); + await getComponent(page, 'html'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('nodes without expression should be normally rendered', async () => { + const divs = await page.$$('div'); + const div = divs[0]; + expect(await exec(div, d => d.innerHTML)).toBe('

    Here\'s a very interesting note displayed in a lovely shadowed box.

    Any kind of content here. Such as <p>, <table>. You name it!

    '); + }); + + it('nodes with expression should not escape expressions', async () => { + const divs = await page.$$('div'); + const div_1 = divs[1], div_2 = divs[2]; + expect(await exec(div_1, d => d.innerHTML)).toBe('

    Some paragraph with text undefined

    '); + expect(await exec(div_2, d => d.innerHTML)).toBe('

    Some paragraph with undefined and undefined expressions

    '); + }); + + it('`$html` should escape expressions', async () => { + const divs = await page.$$('div'); + const div_1 = divs[3], div_2 = divs[4]; + expect(await exec(div_1, d => d.innerHTML)).toBe('

    Some paragraph with text intentional {escaped}

    '); + expect(await exec(div_2, d => d.innerHTML)).toBe('

    Some paragraph with text from {model}

    '); + }); +}); \ No newline at end of file diff --git a/test/specs/initialize.spec.ts b/test/specs/initialize.spec.ts new file mode 100644 index 0000000..1232b8b --- /dev/null +++ b/test/specs/initialize.spec.ts @@ -0,0 +1,70 @@ +import { Page, Browser, JSHandle, ElementHandle } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component', () => { + let page: Page; + let browser: Browser; + let instance: JSHandle; + let Init: JSHandle; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'init'); + [Init, instance] = await getComponent(page, 'Init'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('should be a function constructor', async () => { + expect(await exec(Init, i => i)).not.toBeNull(); + expect(await exec(Init, i => typeof i)).toBe('function'); + }); + + it('should get an instance when is used with new', async () => { + expect(await exec(instance, i => typeof i)).toBe('object'); + expect(await exec(instance, i => i.constructor.name)).toEqual('$ComponentCtor'); + }); + + it('instance should have prototype methods', async () => { + expect(await exec(instance, i => '$refs' in i)).toBeTruthy(); + expect(await exec(instance, i => '$mount' in i)).toBeTruthy(); + expect(await exec(instance, i => '$watch' in i)).toBeTruthy(); + expect(await exec(instance, i => '$create' in i)).toBeTruthy(); + expect(await exec(instance, i => '$update' in i)).toBeTruthy(); + expect(await exec(instance, i => '$unmount' in i)).toBeTruthy(); + expect(await exec(instance, i => '$destroy' in i)).toBeTruthy(); + expect(await exec(instance, i => '$observe' in i)).toBeTruthy(); + }); + + it('instance should have option properties', async () => { + expect(await exec(instance, i => 'text' in i)).toBeTruthy(); + expect(await exec(instance, i => i.text)).toBe('World'); + }); + + it('should be mounted in an element selector', async () => { + expect(await exec(instance, i => i.$parentEl.nodeName)).toEqual('MAIN'); + }); + + it('should be mounted correctly', async () => { + const main = await page.$('main'); + const h1: JSHandle = await main.getProperty('firstChild'); + expect(await exec(h1, h => h.nodeName)).toEqual('H1'); + expect(await exec(h1, h => h.textContent)).toEqual('Hello, World!'); + }); + + it('should update the view correctly', async () => { + const main = await page.$('main'); + const h1: JSHandle = await main.getProperty('firstChild'); + await exec(instance, i => i.$set('text', 'Somebody')); + expect(await exec(h1, h => h.textContent)).toEqual('Hello, Somebody!'); + }); + + it('should not update the view if `$set` method is not used', async () => { + const main = await page.$('main'); + const h1: JSHandle = await main.getProperty('firstChild'); + await exec(instance, i => i.text = 'World'); + expect(await exec(h1, h => h.textContent)).toEqual('Hello, Somebody!'); + }); +}); diff --git a/test/specs/interpolation.spec.ts b/test/specs/interpolation.spec.ts new file mode 100644 index 0000000..235ca43 --- /dev/null +++ b/test/specs/interpolation.spec.ts @@ -0,0 +1,26 @@ +import { Page, Browser } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component Text interpolation', () => { + let page: Page; + let browser: Browser; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'interpolation'); + await getComponent(page, 'Interpolation'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('should render text correctly', async () => { + const text_1 = await page.$('#text_1'); + const text_2 = await page.$('#text_2'); + const text_3 = await page.$('#text_3'); + expect(await exec(text_1, t => t.textContent)).toBe('Test interpolation with some text.'); + expect(await exec(text_2, t => t.textContent)).toBe('Test interpolation with some text and some text with quote \' and double quote "'); + expect(await exec(text_3, t => t.textContent)).toBe('Test some text with some text with quote \' and double quote " and some expresions with AND'); + }); +}); \ No newline at end of file diff --git a/test/specs/loop.spec.ts b/test/specs/loop.spec.ts new file mode 100644 index 0000000..4b43d70 --- /dev/null +++ b/test/specs/loop.spec.ts @@ -0,0 +1,120 @@ +import { Page, Browser, JSHandle, ElementHandle } from 'puppeteer'; +import { getBrowser, getPage, getComponent, exec } from '../utils'; + +describe('Component Loop', () => { + let page: Page; + let browser: Browser; + let instance: JSHandle; + + beforeAll(async () => { + browser = await getBrowser(); + page = await getPage(browser, 'loop'); + [, instance] = await getComponent(page, 'Loop'); + }); + + afterAll(async () => { + await browser.close(); + }); + + it('should loop over an array variable', async () => { + const items = await page.$$('#loop_1 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i + 1}`); + } + }); + + it('should loop over an object', async () => { + const items = await page.$$('#loop_2 li'); + expect(items.length).toBe(5); + expect(await exec(items[0], item => item.textContent)).toBe('a'); + expect(await exec(items[4], item => item.textContent)).toBe('e'); + }); + + it('should loop over an array', async () => { + const items = await page.$$('#loop_3 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i + 1}`); + } + }); + + it('should loop over a number', async () => { + const items = await page.$$('#loop_4 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i}`); + } + }); + + it('should loop over a range of numbers', async () => { + const items = await page.$$('#loop_5 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i}`); + } + }); + + it('should loop over an array variable with the given index', async () => { + const items = await page.$$('#loop_6 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i + 1} ${i + 1}`); + } + }); + + it('should loop over an object with the given index', async () => { + const items = await page.$$('#loop_7 li'); + expect(items.length).toBe(5); + expect(await exec(items[0], item => item.textContent)).toBe('1. a: a'); + expect(await exec(items[4], item => item.textContent)).toBe('5. e: e'); + }); + + it('should loop over an array with the given index', async () => { + const items = await page.$$('#loop_8 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i + 1} ${i + 1}`); + } + }); + + it('should loop over a number with the given index', async () => { + const items = await page.$$('#loop_9 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i + 1} ${i}`); + } + }); + + it('should loop over a range of numbers with the given index', async () => { + const items = await page.$$('#loop_10 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + expect(await exec(items[i], item => item.textContent)).toBe(`${i + 1} ${i}`); + } + }); + + it('nested loops should render with the according scope', async () => { + const items = await page.$$('#loop_11 li'); + expect(items.length).toBe(5); + for (let i = 0; i < items.length; i++) { + const children = await items[i].$$('span'); + expect(children.length).toBe(5); + for (let j = 0; j < children.length; j++) { + const item: ElementHandle = children[j]; + const value: string = await exec(item, item => item.textContent); + expect(value.startsWith(`${i + 1}.${i + 1}.${j + 1} - `)).toBeTruthy(); + } + } + }); + + it('items should be modified', async () => { + await exec(instance, i => i.items.splice(3, 1)); + const items = await page.$$('#loop_1 li'); + expect(items.length).toBe(4); + expect(await exec(items[0], item => item.textContent)).toBe('1'); + expect(await exec(items[1], item => item.textContent)).toBe('2'); + expect(await exec(items[2], item => item.textContent)).toBe('3'); + expect(await exec(items[3], item => item.textContent)).toBe('5'); + }); +}); \ No newline at end of file diff --git a/test/specs/types.d.ts b/test/specs/types.d.ts new file mode 100644 index 0000000..f119f29 --- /dev/null +++ b/test/specs/types.d.ts @@ -0,0 +1,21 @@ +declare type MountParam = string | HTMLElement; + +declare class Component { + $set(key: string, value: any): void; + $destroy(): void; + $mount(parent: MountParam, sibling?: MountParam | boolean): void; + [key: string]: any; +} + +declare interface ComponentConstructor { + new(...args: any[]): Component; +} + +declare const Bind: ComponentConstructor; +declare const Html: ComponentConstructor; +declare const Init: ComponentConstructor; +declare const Loop: ComponentConstructor; +declare const Filters: ComponentConstructor; +declare const Condition: ComponentConstructor; +declare const Components: ComponentConstructor; +declare const Interpolation: ComponentConstructor; diff --git a/test/src/helpers/config.ts b/test/src/helpers/config.ts deleted file mode 100644 index e8af8c7..0000000 --- a/test/src/helpers/config.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const specs = 'specs/spec/**/*.spec.js'; -export const components = 'specs/components/**/*.iif.js'; \ No newline at end of file diff --git a/test/src/helpers/setup.ts b/test/src/helpers/setup.ts deleted file mode 100644 index bd6ffc7..0000000 --- a/test/src/helpers/setup.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { join } from 'path'; -import glob = require('glob'); -import { writeFileSync } from 'fs'; -import { specs, components } from './config'; - -const jasmineCoreDir = '../node_modules/jasmine-core'; - -glob(specs, (err, test) => { - if (err) console.log(err); - glob(components, (err, utils) => { - if (err) console.log(err); - writeFileSync(join(__dirname, '../test.html'), ` - - - - Jasmine Spec Runner - - - - - - - - - ${insertScripts(utils)} - - ${insertScripts(test)} - - -
    - -`, 'utf8'); - }); -}); - -function insertScripts(scripts: string[]) { - return scripts.map(u => ``).join('\n '); -} diff --git a/test/src/run.ts b/test/src/run.ts deleted file mode 100644 index 2dfe27f..0000000 --- a/test/src/run.ts +++ /dev/null @@ -1,98 +0,0 @@ -let system = require('system'); - -if (system.args.length !== 2) { - console.log('Usage: test.js URL'); - phantom.exit(1); -} - -let page = require('webpage').create(); - -page.onConsoleMessage = msg => { - console.log(msg); -}; - -page.open(system.args[1], status => { - if (status !== 'success') { - console.log(`Unable to access to '${system.args[1]}'`); - phantom.exit(); - } else { - waitFor(() => page.evaluate(() => window['jsApiReporter'].status() === 'done'), () => { - let exitCode = page.evaluate(() => { - function padString(str: string, chars: string, length: number) { - for (let i = 0; i < length; i++) str += chars; - return str; - } - - function $(sel: string, parent?: HTMLElement) { - return (parent || document.body).querySelector(sel); - } - - console.log(''); - - let version = $('.jasmine-version').innerText; - let duration = $('.jasmine-duration').innerText; - console.log(`Jasmine v${version} - ${duration}`); - - let symbols = $('.jasmine-symbol-summary'); - let symbs = ''; - for (let i = 0; i < symbols.children.length; i++) { - let sym = symbols.children[i]; - symbs += sym.classList.contains('jasmine-passed') ? 'o ' : 'x '; - } - let pad = padString('', '-', symbs.length - 1); - console.log(pad); - console.log(symbs.trim()); - console.log(pad); - - let failures = $('.jasmine-results > .jasmine-failures'); - if (failures.children.length > 0) { - let list = failures.querySelectorAll('.jasmine-spec-detail.jasmine-failed'); - if (list && list.length > 0) { - console.log(''); - console.log(`${list.length} test${list.length > 1 ? 's' : ''} of ${symbols.children.length} FAILED:`); - for (let i = 0; i < list.length; ++i) { - let el = list[i], desc = $('.jasmine-description', el), - msg = $('.jasmine-messages > .jasmine-result-message', el), - stack = $('.jasmine-messages > .jasmine-stack-trace', el); - console.log(''); - let d = ''; - let descs = desc.innerText.split(' > '); - for (let j = 0; j < descs.length; j++) { - d += `${padString('', ' ', j ? j + 3 : 0)}${j === 0 ? `${i + 1}) ` : ''}- ${descs[j]}\n`; - } - console.log(d); - console.log(msg.innerText); - console.log(' on file:', stack.innerText.replace(//g, '').replace('file:///', '').trim()); - (i + 1) === list.length && console.log(''); - } - } - return 1; - } else { - console.log($('.jasmine-bar.jasmine-passed').innerText); - return 0; - } - }); - !exitCode && console.log(''); - console.log(`Tests finished ${exitCode ? 'with errors' : 'successfully'}.`); - exitCode && console.log(''); - phantom.exit(exitCode); - }, 30000); - } -}); - -function waitFor(testFx: string | (() => any), onReady: string | (() => any), timeOutMillis?: number) { - let maxtimeOutMillis = timeOutMillis || 3001, start = new Date().getTime(), condition = false, - interval = setInterval(() => { - if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) { - condition = typeof testFx === 'string' ? eval(testFx) : testFx(); - } else { - if (!condition) { - console.log('Test took too much time to execute'); - phantom.exit(1); - } else { - typeof onReady === 'string' ? eval(onReady) : onReady(); - clearInterval(interval); - } - } - }, 100); -} diff --git a/test/src/spec/bind_value.spec.ts b/test/src/spec/bind_value.spec.ts deleted file mode 100644 index 64c09ee..0000000 --- a/test/src/spec/bind_value.spec.ts +++ /dev/null @@ -1,107 +0,0 @@ -function fireEvent(el: HTMLElement, name: string, type?: string) { // element to click on - // Create the event. - var event = document.createEvent(`${type ? type[0].toUpperCase() + type.slice(1) : ''}Event`); - // Define that the event name is 'build'. - event.initEvent(name, true, true); - // target can be any Element or other EventTarget. - return el.dispatchEvent(event); -} - -describe('Component Bind', () => { - let instance; - - beforeEach(done => { - instance = new Bind(); - instance.$mount('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - describe('$name directive', () => { - describe('in checked checkbox', () => { - it('should add value to an array', () => { - let input: HTMLInputElement = document.querySelector('#checkbox_1'); - fireEvent(input, 'click', 'mouse'); - expect(instance.checkboxes.length).toBe(1); - expect(instance.checkboxes[0]).toBe('Yes'); - }); - - it('with bond value should add object to an array', () => { - let input: HTMLInputElement = document.querySelector('#checkbox_3'); - fireEvent(input, 'click', 'mouse'); - expect(instance.checkboxes_1.length).toBe(1); - let obj = instance.checkboxes_1[0]; - expect(obj).toBeDefined(); - expect(typeof obj).toBe('object'); - expect(obj).toEqual({ value: 'Yes' }); - }); - }); - - describe('in a unchecked checkbox', () => { - it('should remove value from the array', () => { - let input: HTMLInputElement = document.querySelector('#checkbox_1'); - fireEvent(input, 'click', 'mouse'); - fireEvent(input, 'click', 'mouse'); - expect(instance.checkboxes.length).toBe(0); - }); - - it('with bond value should remove value from the array', () => { - let input: HTMLInputElement = document.querySelector('#checkbox_4'); - fireEvent(input, 'click', 'mouse'); - fireEvent(input, 'click', 'mouse'); - expect(instance.checkboxes_1.length).toBe(0); - }); - }); - - describe('in a checked radio', () => { - it('should assign value to the property', () => { - let input: HTMLInputElement = document.querySelector('#radio_1'); - fireEvent(input, 'click', 'mouse'); - expect(instance.radios).toBe('radio 1'); - }); - - it('with bond value should assign the object value to the property', () => { - let input: HTMLInputElement = document.querySelector('#radio_5'); - fireEvent(input, 'click', 'mouse'); - let obj = instance.radios_1; - expect(obj).toBeDefined(); - expect(typeof obj).toBe('object'); - expect(obj).toEqual({ value: 'radio 5' }); - }); - }); - }); - - describe('$value directive', () => { - it('should change text input value from model', () => { - instance.$set('textValue', 'some text'); - let input: HTMLInputElement = document.querySelector('#text'); - expect(input.value).toBe('some text'); - }); - - it('should change number input value from model', () => { - instance.$set('numValue', 10); - let input: HTMLInputElement = document.querySelector('#number'); - expect(input.value).toBe('10'); - }); - }); - - describe('input.value', () => { - it('should change text input value in model', () => { - let input: HTMLInputElement = document.querySelector('#text'); - input.value = 'text test'; - fireEvent(input, 'input'); - expect(instance.textValue).toBe('text test'); - }); - - it('should change number input value in model', () => { - let input: HTMLInputElement = document.querySelector('#number'); - input.value = '5'; - fireEvent(input, 'input'); - expect(instance.numValue).toBe(5); - }); - }); -}); \ No newline at end of file diff --git a/test/src/spec/components.spec.ts b/test/src/spec/components.spec.ts deleted file mode 100644 index 4927de4..0000000 --- a/test/src/spec/components.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -describe('Component instance', () => { - let instance; - - beforeEach(done => { - instance = new Components(); - instance.$mount('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - it('should mount all instances', () => { - let main: HTMLInputElement = document.querySelector('main'); - expect(main.children.length).toBe(3); - }); - - it('should be mounted and render the default slot', () => { - let main: HTMLInputElement = document.querySelector('main'); - expect(main.firstChild.nodeName).toBe('DIV'); - expect(main.firstChild.textContent).toBe('Some text'); - }); - - it('should be mounted and overwrite the default slot', () => { - let main: HTMLInputElement = document.querySelector('main'); - let child = main.children[1]; - expect(child.nodeName).toBe('DIV'); - expect(child.textContent).toBe('Some other text'); - }); - - it('should set the slot correctly', () => { - let main: HTMLInputElement = document.querySelector('main'); - let child = main.children[2]; - expect(child.nodeName).toBe('DIV'); - expect(child.children[0].tagName).toBe('SPAN'); - expect(child.children[0].textContent).toBe('Some header'); - expect(child.children[1].tagName).toBe('SPAN'); - expect(child.children[1].textContent).toBe('Some span text'); - expect(child.children[2].tagName).toBe('SPAN'); - expect(child.children[2].textContent).toBe('Some footer'); - }); -}); \ No newline at end of file diff --git a/test/src/spec/condition.spec.ts b/test/src/spec/condition.spec.ts deleted file mode 100644 index a1ec65c..0000000 --- a/test/src/spec/condition.spec.ts +++ /dev/null @@ -1,42 +0,0 @@ -describe('Component Conditions', () => { - let instance, span: HTMLSpanElement, div: HTMLDivElement; - - beforeEach(done => { - instance = new Condition(); - instance.$mount('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - it('`$if` should be rendered', () => { - span = document.querySelector('main span'); - expect(span.textContent).toBe('1'); - }); - - it('`$else-if` should be rendered', () => { - instance.$set('condition', 2); - span = document.querySelector('main span'); - expect(span.textContent).toBe('2'); - }); - - it('`$else` should be rendered', () => { - instance.$set('condition', 3); - span = document.querySelector('main span'); - expect(span.textContent).toBe('other'); - }); - - it('`$if` only should be rendered', () => { - div = document.querySelector('main div'); - expect(div.textContent).toBe('1'); - }); - - it('`$if` only should be hidden', () => { - instance.$set('condition_1', 2); - div = document.querySelector('main div'); - expect(div).toBeNull(); - }); -}); \ No newline at end of file diff --git a/test/src/spec/html.spec.ts b/test/src/spec/html.spec.ts deleted file mode 100644 index 890f6c3..0000000 --- a/test/src/spec/html.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -describe('Component Html', () => { - let instance, divs: NodeListOf; - - beforeEach(done => { - instance = new Html(); - instance.$mount('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - it('nodes without expression should be normally rendered', () => { - divs = document.querySelectorAll('div'); - let div = divs.item(0); - expect(div.innerHTML).toBe('

    Here\'s a very interesting note displayed in a lovely shadowed box.

    Any kind of content here. Such as <p>, <table>. You name it!

    '); - }); - - it('nodes with expression should not escape expressions', () => { - divs = document.querySelectorAll('div'); - let div_1 = divs.item(1), div_2 = divs.item(2); - expect(div_1.innerHTML).toBe('

    Some paragraph with text undefined

    '); - expect(div_2.innerHTML).toBe('

    Some paragraph with undefined and undefined expressions

    '); - }); - - it('`$html` should escape expressions', () => { - divs = document.querySelectorAll('div'); - let div_1 = divs.item(3), div_2 = divs.item(4); - expect(div_1.innerHTML).toBe('

    Some paragraph with text intentional {{escaped}}

    '); - expect(div_2.innerHTML).toBe('

    Some paragraph with text from {{model}}

    '); - }); -}); \ No newline at end of file diff --git a/test/src/spec/initialize.spec.ts b/test/src/spec/initialize.spec.ts deleted file mode 100644 index 092d117..0000000 --- a/test/src/spec/initialize.spec.ts +++ /dev/null @@ -1,76 +0,0 @@ -describe('Component', () => { - - it('should be a function constructor', () => { - expect(Init).not.toBeNull(); - expect(typeof Init).toBe('function'); - }); - - it('should get an instance when is used with new', () => { - let instance = new Init(); - expect(typeof instance).toBe('object'); - expect(instance.constructor).toEqual(Init); - }); - - it('instance should have prototype methods', () => { - let instance = new Init(); - expect('$refs' in instance).toBeTruthy(); - expect('$create' in instance).toBeTruthy(); - expect('$mount' in instance).toBeTruthy(); - expect('$update' in instance).toBeTruthy(); - expect('$unmount' in instance).toBeTruthy(); - expect('$destroy' in instance).toBeTruthy(); - expect('$watch' in instance).toBeTruthy(); - expect('$observe' in instance).toBeTruthy(); - }); - - it('instance should have option properties', () => { - let instance = new Init(); - expect('text' in instance).toBeTruthy(); - expect(instance.text).toBe('World'); - }); -}); - -describe('Component Instance', () => { - let instance, main; - beforeEach(done => { - instance = new Init(); - main = document.querySelector('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - it('should be mounted in an element selector', () => { - instance.$mount('main'); - expect(instance.$parentEl).toEqual(main); - }); - - it('should be mounted in an element', () => { - instance.$mount(main); - expect(instance.$parentEl).toEqual(main); - }); - - it('should be mounted correctly', () => { - instance.$mount('main'); - let h1 = main.firstChild; - expect(h1.nodeName).toEqual('H1'); - expect(h1.textContent).toBe('Hello, World!!'); - }); - - it('should update the view correctly', () => { - instance.$mount('main'); - let h1 = main.firstChild; - instance.$set('text', 'Somebody'); - expect(h1.textContent).toBe('Hello, Somebody!!'); - }); - - it('should not update the view correctly if `$set` method is not used', () => { - instance.$mount('main'); - let h1 = main.firstChild; - instance.text = 'Somebody'; - expect(h1.textContent).toBe('Hello, World!!'); - }); -}); diff --git a/test/src/spec/interpolation.spec.ts b/test/src/spec/interpolation.spec.ts deleted file mode 100644 index 74c9f2a..0000000 --- a/test/src/spec/interpolation.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -describe('Component Text interpolation', () => { - let instance; - - beforeEach(done => { - instance = new Interpolation(); - instance.$mount('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - it('should render text correctly', () => { - let text_1 = document.querySelector('#text_1'); - let text_2 = document.querySelector('#text_2'); - let text_3 = document.querySelector('#text_3'); - expect(text_1.textContent).toBe('Test interpolation with some text.'); - expect(text_2.textContent).toBe('Test interpolation with some text and some text with quote \' and double quote "'); - expect(text_3.textContent).toBe('Test some text with some text with quote \' and double quote " and some expresions with AND'); - }); -}); \ No newline at end of file diff --git a/test/src/spec/loop.spec.ts b/test/src/spec/loop.spec.ts deleted file mode 100644 index 08431f4..0000000 --- a/test/src/spec/loop.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -describe('Component Loop', () => { - let instance, items: NodeListOf; - - beforeEach(done => { - instance = new Loop(); - instance.$mount('main'); - done(); - }); - - afterEach(done => { - instance && instance.$destroy(); - done(); - }); - - it('should loop over an array variable', () => { - items = document.querySelectorAll('#loop_1 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i + 1}`); - } - }); - - it('should loop over an object', () => { - items = document.querySelectorAll('#loop_2 li'); - expect(items.length).toBe(5); - expect(items.item(0).textContent).toBe('a'); - expect(items.item(4).textContent).toBe('e'); - }); - - it('should loop over an array', () => { - items = document.querySelectorAll('#loop_3 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i + 1}`); - } - }); - - it('should loop over a number', () => { - items = document.querySelectorAll('#loop_4 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i}`); - } - }); - - it('should loop over a range of numbers', () => { - items = document.querySelectorAll('#loop_5 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i}`); - } - }); - - it('should loop over an array variable with the given index', () => { - items = document.querySelectorAll('#loop_6 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i + 1} ${i + 1}`); - } - }); - - it('should loop over an object with the given index', () => { - items = document.querySelectorAll('#loop_7 li'); - expect(items.length).toBe(5); - expect(items.item(0).textContent).toBe('1. a: a'); - expect(items.item(4).textContent).toBe('5. e: e'); - }); - - it('should loop over an array with the given index', () => { - items = document.querySelectorAll('#loop_8 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i + 1} ${i + 1}`); - } - }); - - it('should loop over a number with the given index', () => { - items = document.querySelectorAll('#loop_9 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i + 1} ${i}`); - } - }); - - it('should loop over a range of numbers with the given index', () => { - items = document.querySelectorAll('#loop_10 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - expect(items.item(i).textContent).toBe(`${i + 1} ${i}`); - } - }); - - it('nested loops should render with the according scope', () => { - items = document.querySelectorAll('#loop_11 li'); - expect(items.length).toBe(5); - for (let i = 0; i < items.length; i++) { - let { children } = items.item(i); - expect(children.length).toBe(5); - for (let j = 0; j < children.length; j++) { - expect(!!~children[j].textContent.indexOf(`${i + 1}.${i + 1}.${j + 1}`)).toBeTruthy(); - } - } - }); - - it('items should be modified', () => { - instance.items.splice(3, 1); - items = document.querySelectorAll('#loop_1 li'); - expect(items.length).toBe(4); - expect(items.item(0).textContent).toBe('1'); - expect(items.item(1).textContent).toBe('2'); - expect(items.item(2).textContent).toBe('3'); - expect(items.item(3).textContent).toBe('5'); - }); -}); \ No newline at end of file diff --git a/test/src/types.d.ts b/test/src/types.d.ts deleted file mode 100644 index a31e4a2..0000000 --- a/test/src/types.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -declare var phantom: { - exit(code?: number): void; -} - -interface Component { - $set(key: string, value: any): void; - $destroy(): void; - $mount(parent: HTMLElement, sibling?: HTMLElement | boolean): void; - [key: string]: any; -} - -interface ComponentConstructor { - new(...args: any[]): Component; -} - -declare const Bind: ComponentConstructor; -declare const Html: ComponentConstructor; -declare const Init: ComponentConstructor; -declare const Loop: ComponentConstructor; -declare const Condition: ComponentConstructor; -declare const Components: ComponentConstructor; -declare const Interpolation: ComponentConstructor; - -declare module 'system' { - interface System { - args: string[] - } - - var system: System; - - export = system; -} - -declare module 'webpage' { - interface Page { - open(url: string, callback: (status: string) => any): void; - open(url: string, method: string, callback: (status: string) => any): void; - open(url: string, method: string, data: any, callback: (status: string) => any): void; - onConsoleMessage: (msg: string, lineNum?: number, sourceId?: string) => any; - evaluate(fn: Function, ...args: any[]): T; - } - - interface WebPage { - create(): Page - } - - var webPage: WebPage; - - export = webPage; -} diff --git a/test/src/tsconfig.json b/test/tsconfig.json similarity index 88% rename from test/src/tsconfig.json rename to test/tsconfig.json index cf5eee9..14aa206 100644 --- a/test/src/tsconfig.json +++ b/test/tsconfig.json @@ -1,16 +1,16 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ + // "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ - "sourceMap": false, /* Generates corresponding '.map' file. */ + "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "../../specs", /* Redirect output structure to the directory. */ + // "outDir": "./", /* Redirect output structure to the directory. */ "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "removeComments": true, /* Do not emit comments to output. */ // "noEmitOnError": true, /* Do not emit outputs. */ @@ -36,7 +36,7 @@ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ - "types": ["../../node_modules/@types/jasmine"], /* Type declaration files to be included in compilation. */ + // "types": ["../../node_modules/@types/jasmine", "./specs/types"], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ diff --git a/test/utils.ts b/test/utils.ts new file mode 100644 index 0000000..9ee22bb --- /dev/null +++ b/test/utils.ts @@ -0,0 +1,48 @@ +import { resolve } from 'path'; +import { readFileSync } from 'fs'; +import puppeteer, { LaunchOptions, Browser, Page, JSHandle, ScriptTagOptions } from 'puppeteer'; + +const width = 1366; +const height = 768; + +export async function getBrowser(options: LaunchOptions = {}) { + const browser = await puppeteer.launch(Object.assign({ + headless: true, + args: [`--window-size=${width},${height}`, '--no-sandbox'] + }, options)); + return browser; +} + +export async function getPage(browser: Browser, ...files: string[]) { + const page = await browser.newPage(); + await page.setContent(''); + await page.setViewport({ width, height }); + const scripts: ScriptTagOptions[] = files + .map(file => ({ content: readFileSync(resolve(__dirname, `./components/${file}.js`), 'utf8') })); + scripts.unshift({ content: scriptInit(files[0][0].toUpperCase() + files[0].slice(1)) }); + scripts.reverse().forEach(async script => { + await page.addScriptTag(script); + }); + return page; +} + +export async function getComponent(page: Page, component: string): Promise<[JSHandle, JSHandle]> { + const windowHandle = await page.evaluateHandle(() => window); + const instance: JSHandle = await windowHandle.getProperty('instance'); + const Component: JSHandle = await windowHandle.getProperty(component); + windowHandle.dispose(); + return [Component, instance]; +} + +export async function exec(handle: JSHandle, cb: (obj: T) => any) { + return handle.evaluate(cb); +} + +function scriptInit(component: string) { + const i = 'instance'; + return `const main = document.createElement('main'); + document.body.append(main); + const ${i} = new ${component}(); + ${i}.$mount('main'); + window.${i} = ${i};`; +} diff --git a/tools/index.d.ts b/tools/index.d.ts new file mode 100644 index 0000000..bb43dfa --- /dev/null +++ b/tools/index.d.ts @@ -0,0 +1,66 @@ +type ObjectMap = Record; +type AttrTypes = string | number | RegExp | null | boolean; +type PluginFn = (this: Component, ctor: typeof Component, pluginOptions?: ObjectMap) => void; + +interface AttrDefinition { + required?: boolean; + type: string | Function; + validator?(value: any): boolean; + default?: AttrTypes | (() => AttrTypes | Object); +} + +interface ComponentOptions { + $children?: ObjectMap; + $filters?: ObjectMap<(...args: any[]) => any>; + $attributes?: string[] | ObjectMap; +} + +declare class BaseComponent { + $parent: Component; + $parentEl: HTMLElement; + $siblingEl: HTMLElement; + readonly $refs: ObjectMap; + readonly $slots: ObjectMap; + readonly $filters: ObjectMap<(...args: any[]) => any>; + readonly $options: ComponentOptions; + readonly $children: Component[]; + + $get(path: string): T; + $set(path: string, value: T): void; + $on(event: string, handler: (data?: any) => void): void; + $off(event: string, handler: (data?: any) => void): void; + $once(event: string, handler: (data?: any) => void): void; + $fire(event: string, data?: any): void; + $notify(key: string): void; + $observe(key: string | string[], handler: () => void): { $unobserve(): void }; + $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; +} + +declare class Component extends BaseComponent { + static $children?: ObjectMap; + static $filters?: ObjectMap<(...args: any[]) => any>; + static $attributes?: string[] | ObjectMap; + static $plugin(fn: PluginFn, options?: ObjectMap): void; + + constructor(attrs?: ObjectMap, parent?: Component); + + willCreate?(this: Component): void; + willMount?(this: Component): void; + willUpdate?(this: Component): void; + willUnmount?(this: Component): void; + willDestroy?(this: Component): void; + + didCreate?(this: Component): void; + didMount?(this: Component): void; + didUpdate?(this: Component): void; + didUnmount?(this: Component): void; + didDestroy?(this: Component): void; + + $create(): void; + $mount(parent: string | Element, sibling?: string | boolean | Element): void; + $update(this: Component, ...args: any[]): void; + $unmount(): void; + $destroy(): void; + + [key: string]: any; +} diff --git a/tools/index.ts b/tools/index.ts index 54acb66..976e4d2 100644 --- a/tools/index.ts +++ b/tools/index.ts @@ -1,18 +1,6 @@ +type ObjectMap = Record; type AttrTypes = string | number | RegExp | null | boolean; -type AttrParams = string[] | ObjectLike; -type DirectiveDefinition = (inst: Component, options: DirectiveOptions, node: HTMLElement) => void | DirectiveDefObject; -type TemplateFn = (component: Component) => ComponentTemplate; -type IterateKey = T extends any[] ? number : string; -type IterateValue = T extends any[] ? T[number] : T[keyof T]; -type PluginFn = (this: Component, ctor: ComponentConstructor, pluginOptions?: ObjectLike) => void; -interface ObjectLike { [key: string]: T; } - -interface DirectiveDefObject { - $init?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $inserted?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $update(inst: Component, options: DirectiveOptions, node: HTMLElement): void; - $destroy?(inst: Component, options: DirectiveOptions, node: HTMLElement): void; -} +type PluginFn = (this: Component, ctor: typeof Component, pluginOptions?: ObjectMap) => void; interface AttrDefinition { required?: boolean; @@ -21,345 +9,98 @@ interface AttrDefinition { default?: AttrTypes | (() => AttrTypes | Object); } -interface DirectiveOptions { - value: any; - expression: string; - modifiers: ObjectLike; -} - interface ComponentOptions { - model: ObjectLike; - attrs: string[] | ObjectLike; - filters: ObjectLike<(...args: any[]) => any>; - children: ObjectLike; - directives: ObjectLike; -} - -interface ComponentTemplate { - $create(): void; - $mount(parent: string | Element, sibling?: string | boolean | Element): void; - $update(state: Component, ...args: any[]): void; - $unmount(): void; - $destroy(): void; + children?: ObjectMap; + filters?: ObjectMap<(...args: any[]) => any>; + attributes?: string[] | ObjectMap; } -interface Component extends ComponentTemplate { +declare class BaseComponent { $parent: Component; $parentEl: HTMLElement; $siblingEl: HTMLElement; - readonly $refs: ObjectLike; - readonly $slots: ObjectLike; - readonly $filters: ObjectLike<(...args: any[]) => any>; + readonly $refs: ObjectMap; + readonly $slots: ObjectMap; + readonly $filters: ObjectMap<(...args: any[]) => any>; readonly $options: ComponentOptions; readonly $children: Component[]; - readonly $directives: ObjectLike; - $get(path: string): T; - $set(path: string, value: T): void; - $update(): void; - $on(event: string, handler: (data?: any) => void): { $off(): void }; + + $get(path: string): T; + $set(path: string, value: T): void; + $on(event: string, handler: (data?: any) => void): void; + $off(event: string, handler: (data?: any) => void): void; $once(event: string, handler: (data?: any) => void): void; $fire(event: string, data?: any): void; $notify(key: string): void; $observe(key: string | string[], handler: () => void): { $unobserve(): void }; $watch(key: string, handler: (oldValue?: any, newValue?: any) => void): { $unwatch(): void }; - [key: string]: any; } -interface ComponentConstructor { - new (attrs?: string[] | ObjectLike, parent?: Component): T; - plugin(fn: PluginFn, options?: ObjectLike): void; - prototype: Component; +declare class TemplateObject extends BaseComponent { + $create(): void; + $mount(parent: string | Element, sibling?: string | boolean | Element): void; + $update(this: Component, ...args: any[]): void; + $unmount(): void; + $destroy(): void; } -const PROP_MAP = { p: '__TP__', v: 'value', _: '_value', s: '_subscribers', e: '_events', w: '_watchers', h: 'prototype' }; -const PROPS = ['$slots', '$refs', '$filters', '$directives', '_events', '_watchers']; -let TPS: { options: ObjectLike, fn: PluginFn }[] = window[PROP_MAP.p] || (window[PROP_MAP.p] = []); -const _$assign = Object['assign'] || function (t: Object) { - for (let s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (const p in s) if (_$hasProp(s, p)) t[p] = s[p]; - } - return t; -}; -function _$BaseComponent(attrs: AttrParams, template: TemplateFn, options: ComponentOptions, parent: Component) { - const self = this; - const _$set = (prop: string, value: any) => { _$define(self, prop, { value, writable: true }); }; - if (!attrs) attrs = {}; - _$each(PROPS, prop => { _$define(self, prop, { value: {} }); }); - _$set('$parent', parent || null); - _$set('$children', []); - _$set(PROP_MAP.s, {}); - _$set('$options', options); - const opts: ComponentOptions = self.$options; - if (!opts.attrs) opts.attrs = {}; - if (!opts.children) opts.children = {}; - _$each(TPS, (plugin) => { plugin.fn.call(self, _$BaseComponent, plugin.options); }); - if (opts.filters) _$assign(self.$filters, opts.filters); - if (opts.directives) _$each(opts.directives, (drt, k) => { self.$directives[k] = _$directive(drt); }); - _$each(opts.attrs, (attrOps, key) => { - _$define(self, (_$isType(key, 'number') ? attrOps : key), { - get() { - if (_$isString(attrOps)) { - let value = attrs[attrOps]; - return _$isFunction(value) ? value() : value; - } else { - if (!_$hasProp(attrs, key) && (attrOps).required) { - return console.error(`Attribute '${key}' is required.`); - } else { - let value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key]; - if (value === void 0 && _$hasProp(attrOps, 'default')) { - const def = (attrOps).default; - value = _$isFunction(def) ? (def)() : def; - } - const typ = (attrOps).type; - if (typ && !_$isType(value, typ) && (attrOps).required) { - return console.error(`Attribute '${key}' must be type '${typ}'.`); - } - value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key); - if (value !== void 0 && _$hasProp(attrOps, 'validator')) { - const validator = (attrOps).validator; - if (_$isFunction(validator) && !validator(value)) { - return console.error(`Assigment '${key}'='${JSON.stringify(value)}' invalid.`); - } - } - return value; - } - } - }, - set() { - console.error(`'${key}' is read only.`); - }, - enumerable: true, configurable: true - }); - }); - let data = opts.model || {}; - for (const key in data) { - if (_$hasProp(data, key)) { - const desc = Object.getOwnPropertyDescriptor(data, key); - if (desc.value && _$isArray(desc.value)) { - desc.value = new _$List(desc.value, self, key); - } else { - if (desc.get) { - let getter = desc.get; - desc.get = function () { - let value = getter.call(self); - if (_$isArray(value)) value = new _$List(value, self, key); - return value; - }; - } - if (desc.set) { - let setter = desc.set; - desc.set = function (v: any) { - if (_$isArray(v)) v = new _$List(v, self, key); - setter.call(self, v); - }; - } - } - _$define(self, key, desc); - } - } - const tpl = template(self); - _$each(tpl, (value, key) => { - _$define(self, key, { - value: (function (key) { - const hook = key[1].toUpperCase() + key.slice(2); - const bhook = opts[`will${hook}`]; - const ahook = opts[`did${hook}`]; - return function () { - bhook && bhook.call(this); - key.slice(1) === 'update' ? value.call(this, this) : value.apply(this, arguments); - ahook && ahook.call(this); - }; - })(key) - }); - }); - _$define(self, '$data', { - get() { - return _$toPlainObj(this); - } - }); -} -function _$isValueAttr(attr: string) { - return attr === 'value'; +declare class Component extends TemplateObject { + static $children?: ObjectMap; + static $filters?: ObjectMap<(...args: any[]) => any>; + static $attributes?: string[] | ObjectMap; + static $plugin(fn: PluginFn, options?: ObjectMap): void; + + constructor(attrs?: ObjectMap, parent?: Component); + + willCreate?(this: Component): void; + willMount?(this: Component): void; + willUpdate?(this: Component): void; + willUnmount?(this: Component): void; + willDestroy?(this: Component): void; + + didCreate?(this: Component): void; + didMount?(this: Component): void; + didUpdate?(this: Component): void; + didUnmount?(this: Component): void; + didDestroy?(this: Component): void; + + [key: string]: any; } -function _$subscribers(dep: string, listener: Function) { - if (!this[PROP_MAP.s][dep]) { - this[PROP_MAP.s][dep] = []; - } - return this[PROP_MAP.s][dep].push(listener.bind(this)) - 1; + +function _$extends(d: Function, b: Function) { + _$assign(d, b); + function _() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (_.prototype = b.prototype, new _()); } -function _$define(obj: Object, key: string, desc: PropertyDescriptor) { - Object.defineProperty(obj, key, desc); +function _$(selector: string | HTMLElement, parent?: Element): HTMLElement { + return _$isString(selector) ? (parent || document.body).querySelector(selector) : selector; } -_$assign(_$BaseComponent[PROP_MAP.h], { - $get(path: string) { - return _$accesor(this, path); - }, - $set(path: string, value: any) { - _$accesor(this, path, value); - }, - $on(event: string, handler: Function) { - if (!this[PROP_MAP.e][event]) { - this[PROP_MAP.e][event] = []; - } - const i = this[PROP_MAP.e][event].push(handler); - return { - $off: () => { - this[PROP_MAP.e][event].splice(i - 1, 1); - } - }; - }, - $once(event: string, handler: Function) { - const e = this.$on(event, args => { - handler(args); - e.$off(); - }); - }, - $fire(event: string, data: any) { - if (this[PROP_MAP.e][event]) { - _$each(this[PROP_MAP.e][event], handler => { handler(data); }); - } - }, - $notify(key: string) { - if (this[PROP_MAP.s][key]) { - _$each(this[PROP_MAP.s][key], suscriber => { suscriber(); }); - } - }, - $observe(deps: string | string[], listener: Function) { - const subs: { sub: string, i: number }[] = []; - if (_$isArray(deps)) { - _$each(deps, dep => { - subs.push({ sub: dep, i: _$subscribers.call(this, dep, listener) }); - }); - } else { - subs.push({ sub: deps, i: _$subscribers.call(this, deps, listener) }); - } - return { - $unobserve: () => { - _$each(subs, sub => { - this[PROP_MAP.s][sub.sub].splice(sub.i, 1); - }); - } - }; - }, - $watch(key: string, watcher: Function) { - if (!this[PROP_MAP.w][key]) { - this[PROP_MAP.w][key] = []; - } - const i = this[PROP_MAP.w][key].push(watcher.bind(this)); - return { - $unwatch: () => { - this[PROP_MAP.w][key].splice(i - 1, 1); - } - }; - } -}); -const array = Array[PROP_MAP.h]; -function _$toArgs(args: IArguments, start: number = 0): any[] { - return array.slice.call(args, start); -} -function _$arrayValues(list, value: any[], root: Component, key: string) { - array.push.apply(list, value.map((v, i) => { - if (list.length !== 0) i += list.length; - return !(_$isType(v, _$List)) && _$isArray(v) ? new _$List(v, root, `${key}.${i}`) : v; - })); -} -function _$List(value: any[], root: Component, key: string) { - let self = this; - Array.apply(self, [value.length]); - let desc = { writable: false, configurable: false, enumerable: false }; - _$define(self, '_key', _$assign({ value: key }, desc)); - _$define(self, '_root', _$assign({ value: root }, desc)); - _$arrayValues(self, value, root, key); - desc.writable = true; - _$define(self, 'length', _$assign({ value: self.length }, desc)); -} -_$extends(_$List, Array); -['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(method => { - _$List[PROP_MAP.h][method] = function () { - let self = this; - const old = self.slice(); - let result; - if (method === 'push') { - _$arrayValues(self, _$toArgs(arguments), self._root, self._key); - result = self.length; - } else { - result = array[method].apply(self, arguments); - } - _$dispatch(self._root, self._key, old, self.slice()); - return result; - }; -}); -_$List[PROP_MAP.h].pull = function (index: number) { - let self = this; - let items = _$toArgs(arguments, 1); - let length = self.length; - if (index > length) { - length = index + 1; - const pull = new Array(index - self.length); - pull.push.apply(pull, items); - for (let i = 0; i < length; i++) { - if (i === index) { - self.push.apply(self, pull); - } - } - } else { - self.splice.apply(self, [index, 1].concat(items)); - } -}; -function _$dispatch(root: Component, key: string, oldVal, value) { - root.$notify(key); - if (root[PROP_MAP.w][key]) { - _$each(root[PROP_MAP.w][key], watcher => { watcher(oldVal, value); }); - } - root.$update(); -} -function _$extends(ctor: Function, exts: Function) { - ctor[PROP_MAP.h] = Object.create(exts[PROP_MAP.h]); - ctor[PROP_MAP.h].constructor = ctor; -} -export function _$Ctor(tpl: Function, options: Object) { - const ctor: ComponentConstructor = function (_$attrs, _$parent) { - _$BaseComponent.call(this, _$attrs, tpl, options, _$parent); - !_$parent && this.$create(); - }; - ctor.plugin = (fn: PluginFn, options?: ObjectLike) => { - TPS.push({ options, fn }); - }; - _$extends(ctor, _$BaseComponent); - return ctor; -} -export function _$isType(value: any, type: string | Function) { - return _$type(type) === 'string' ? (type).split('|').some(t => t.trim() === _$type(value)) : value instanceof type; -} -export function _$destroyComponent(component: Component) { - component.$unmount(); - component.$parent = null; - component.$parentEl = null; - component.$siblingEl = null; - component.$children.splice(0, component.$children.length); +function _$type(obj: any) { + return _$lowerCase(Object.prototype.toString.call(obj).slice(8, -1)); } -export function _$setElements(component: Component, parent: HTMLElement, sibling?: HTMLElement) { - let brother = _$select(sibling); - component.$siblingEl = brother; - component.$parentEl = sibling && brother.parentElement || _$select(parent); +function _$isType(obj: any, objType: string | Function) { + return _$isString(objType) ? _$type(obj) === objType : obj instanceof objType; } -function _$apply(callee: Function, args: any[], globs: any[], thisArg: any = null) { - return callee.apply(thisArg, args.concat(globs)); +function _$isString(str: any): str is string { + return _$type(str) === 'string'; } -function _$isObject(obj) { - return _$isType(obj, 'object'); +function _$isArray(array: any): array is Array { + return _$type(array) === 'array' || array instanceof _$List; } -function _$isArray(obj) { - return Array.isArray ? Array.isArray(obj) : _$isType(obj, 'array'); +function _$isObject(obj: any): obj is Object { + return _$type(obj) === 'object'; } -function _$isFunction(obj) { - return _$isType(obj, 'function'); +function _$isFunction(obj: any): obj is Function { + return _$type(obj) === 'function'; } -function _$isString(obj) { - return _$isType(obj, 'string'); +function _$toString(obj: any): string { + if (_$isString(obj)) { + return obj; + } + var str = _$type(obj); + return /(^(null|undefined)$)/.test(str) ? str : obj.toString(); } -function _$toType(value, type, root: Component, key: string) { +function _$toType(value: any, type: any, component: Component, key: string) { switch (type) { case 'date': return new Date(value); @@ -370,84 +111,99 @@ function _$toType(value, type, root: Component, key: string) { case 'boolean': return _$isString(value) && !value ? true : !!value; case 'array': - return _$isType(value, _$List) ? value : new _$List(value, root, key); + return _$isType(value, _$List) ? value : new _$List(value, component, key); default: return value; } } -function _$type(obj: any) { - return / (\w+)/.exec(({}).toString.call(obj))[1].toLowerCase(); +function _$slice(array: { length: number, [key: number]: T }, from?: number) { + const args: T[] = []; + from = from || 0; + for (let i = from; i < array.length; i++) { + args[i - from] = array[i]; + } + return args; } function _$hasProp(obj: Object, prop: string) { return obj.hasOwnProperty(prop); } -function _$directive(dd: DirectiveDefinition): DirectiveDefObject { - const hasProp = (prop, instance, options, element) => - _$isObject(dd) && dd[prop] && dd[prop](instance, options, element); - return { - $init(instance, options, element) { - hasProp('$init', instance, options, element); - }, - $inserted(instance, options, element) { - hasProp('$inserted', instance, options, element); - }, - $update(instance, options, element) { - if (_$isFunction(dd)) { - dd(instance, options, element); - } else { - hasProp('$update', instance, options, element); - } - }, - $destroy(instance, options, element) { - hasProp('$destroy', instance, options, element); +function _$define(obj: Object, mapDesc: PropertyDescriptorMap) { + Object.defineProperties(obj, mapDesc); +} +function _$each(obj: T, cb: (item: T[number], key: number) => void): void; +function _$each(obj: T, cb: (item: T[string], key: string, index: number) => void): void; +function _$each(obj: Object, cb: (item: any, key: any, index?: number) => void) { + if (_$isArray(obj)) { + for (let i = 0; i < obj.length; i++) { + cb(obj[i], i); } - }; + } + else if (_$isObject(obj)) { + const keys = Object.keys(obj); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + cb(obj[key], key, i); + } + } } -export function _$noop() { } -export function _$addChild(inst: Component, Child: ComponentConstructor, attrs: string[] | ObjectLike) { - let child: Component = null; - if (Child) { - child = new Child(attrs, inst); - inst.$children.push(child); +function _$lowerCase(str: string) { + return str.toLowerCase(); +} +function _$camelToSnake(str: string) { + var result = str.replace(/([A-Z])/g, w => '-' + _$lowerCase(w)); + return result[0] === '-' ? result.slice(1) : result; +} +function _$apply(callee: Function, args: any[], globs?: any, thisArg?: any) { + if (globs && !_$isArray(globs)) { + thisArg = globs; + globs = []; + } else if (globs === void 0) { + globs = []; + } else if (thisArg === void 0) { + thisArg = null; + } + return callee.apply(thisArg, args.concat(globs)); +} +function _$removeItem(list: T[], item: T) { + var index = list.indexOf(item); + if (~index) { + list.splice(index, 1); + } +} +function _$treborPlugins(): { plugin: Function, options: ObjectMap }[] { + var TREBOR_PK = '__TREBOR_PLUGINS__'; + if (!window[TREBOR_PK]) { + _$define(window, { + [TREBOR_PK]: { value: [], configurable: true, writable: true, enumerable: false } + }); + } + return window[TREBOR_PK]; +} +function _$assign(child: Object, parent: Object) { + for (const property in parent) { + if (parent.hasOwnProperty(property)) { + child[property] = parent[property]; + } } return child; } -export function _$removeChild(inst: Component, child: Component) { - let index = inst.$children.indexOf(child); - index >= 0 && inst.$children.splice(index, 1); -} -export function _$toString(obj: any): string { - const str: string = _$type(obj); - return !/null|undefined/.test(str) ? obj.toString() : str; -} -function _$toPlainObj(obj: Component) { - const data: ObjectLike = {}; - _$each(_$isObject(obj) ? obj : {}, (_v, k) => { - if (k[0] !== '$' && !_$isFunction(obj[k])) { - if (_$isType(obj[k], _$List)) { - data[k] = obj[k].map(_$toPlainObj); - } else if (_$isObject(obj[k])) { - data[k] = _$toPlainObj(obj[k]); +function _$plainObject(obj: any) { + const data = {}; + _$each(_$isObject(obj) ? obj : {}, function (value, k) { + if (k[0] !== '$' && !_$isFunction(value)) { + if (_$isType(value, _$List)) { + data[k] = value.map(_$plainObject); + } else if (_$isObject(value)) { + data[k] = _$plainObject(value); } else { - data[k] = obj[k]; + data[k] = value; } } }); return _$isObject(obj) ? data : obj; } -export function _$setReference(refs: Object, prop: string, node: HTMLElement) { - if (!_$hasProp(refs, prop)) { - const value = []; - _$define(refs, prop, { - get: () => value.length <= 1 ? value[0] : value, - set: val => { val && !~value.indexOf(val) && value.push(val); }, - enumerable: true, configurable: true - }); - } - refs[prop] = node; -} -function _$accesor(object: Component, path: string, value?: any) { - return path.split('.').reduce((obj, key, i, arr) => { +function _$accesor(component: Component, path: string, value?: any) { + return path.split('.').reduce((obj: any, key: string, i: number, arr) => { if (_$isType(value, 'undefined')) { if (obj == null) { arr.splice(0, arr.length); @@ -458,250 +214,558 @@ function _$accesor(object: Component, path: string, value?: any) { if (_$isType(obj, _$List) && _$toString(+key) === key) { obj.pull(+key, value); } else { - let oldVal = obj[key]; - obj[key] = !_$isType(value, _$List) && _$isArray(value) ? new _$List(value, object, key) : value; - _$dispatch(object, path, oldVal, obj[key]); + const oldVal = obj[key]; + obj[key] = Array.isArray(value) ? new _$List(value, component, key) : value; + _$dispatch(component, path, oldVal, obj[key]); } } else if (!_$isObject(obj[key])) { obj[key] = {}; } } return obj ? obj[key] : null; - }, object); -} -export function _$emptyElse() { - return { type: 'empty-else', $create: _$noop, $mount: _$noop, $update: _$noop, $destroy: _$noop }; -} -export function _$emptySlot(inst: Component, slot: string) { - let slots = inst.$slots; - return slots[slot] && !slots[slot].hasChildNodes() ? (slots[slot] = _$docFragment()) : null; -} -export function _$isKey(event: KeyboardEvent, key: string) { - return event.key.toLowerCase() === key || !!event[`${key}Key`]; + }, component); } -export function _$bindGroup(input: HTMLInputElement, selection: string[]) { - let _value = _$getValue(input); - let _$index = selection.indexOf(_value); - input.checked && !~_$index ? selection.push(_value) : selection.splice(_$index, 1); -} -export function _$bindMultiSelect(select: HTMLSelectElement, selections: any[]) { - if (!selections.length) return; - let { options } = select; - for (let i = 0; i < options.length; i++) { - options[i].selected = !!~selections.indexOf(_$getValue(options[i])); +function _$dispatch(component: Component, key: string, oldVal: any, value: any) { + component.$notify(key); + if (component._watchers[key]) { + _$each(component._watchers[key], function (watcher) { watcher(oldVal, value); }); } + component.$update(); } -export function _$updateMultiSelect(select: HTMLSelectElement, obj: Component, prop: string) { - let items = []; - let selection = obj[prop]; - let { selectedOptions } = select; - for (let i = 0; i < selectedOptions.length; i++) { - items.push(_$getValue(selectedOptions[i])); +function _$subscribers(dep: string, handler: () => void) { + if (!this._subscribers[dep]) { + this._subscribers[dep] = []; } - obj[prop] = new _$List(items, selection['_root'], selection['_key']); - obj.$update(); -} -export function _$select(selector: string | Element, parent?: Element): HTMLElement { - return _$isString(selector) ? (parent || document).querySelector(selector) : selector; -} -export function _$docFragment() { - return document.createDocumentFragment(); + return this._subscribers[dep].push(handler.bind(this)) - 1; +} +const _$Component = (function () { + function _$Component(attrs: ObjectMap, compCtor: typeof Component, parent: Component) { + const self = this; + if (!attrs) + attrs = {}; + const propMap: ObjectMap = { + $refs: { value: {}, enumerable: false, configurable: true }, + $slots: { value: {}, enumerable: false, configurable: true }, + $parent: { value: parent || null, enumerable: false, configurable: true }, + $children: { value: [], enumerable: false, configurable: true }, + $filters: { value: {}, enumerable: false, configurable: true }, + $options: { + value: { + filters: compCtor.$filters || {}, + children: compCtor.$children || {}, + attributes: compCtor.$attributes || {} + }, enumerable: false, configurable: true + }, + }; + _$each(compCtor.$attributes || [], (attrOps: string | AttrDefinition, key: string) => { + key = _$isType(key, 'number') ? attrOps : key; + propMap[key] = { + get() { + if (_$isString(attrOps)) { + const value = attrs[attrOps]; + return _$isFunction(value) ? value() : value; + } else { + if (!_$hasProp(attrs, key) && attrOps.required) { + return console.error('Attribute \'' + key + '\' is required.'); + } else { + let value = _$isFunction(attrs[key]) ? attrs[key]() : attrs[key]; + if (value === void 0 && _$hasProp(attrOps, 'default')) { + const def = attrOps.default; + value = _$isFunction(def) ? def() : def; + } + const typ = attrOps.type; + if (typ && !_$isType(value, typ) && attrOps.required) { + return console.error('Attribute \'' + key + '\' must be type \'' + typ + '\'.'); + } + value = _$toType(value, value === void 0 ? 'undefined' : typ, self, key); + if (value !== void 0 && _$hasProp(attrOps, 'validator')) { + const validator = attrOps.validator; + if (_$isFunction(validator) && !validator(value)) { + return console.error('Assigment \'' + key + '\'=\'' + JSON.stringify(value) + '\' invalid.'); + } + } + return value; + } + } + }, + set() { + console.error('\'' + key + '\' is read only.'); + }, + enumerable: true, configurable: true + }; + }); + const desc = { enumerable: false, configurable: false }; + propMap._events = _$assign({ value: {}, }, desc); + propMap._watchers = _$assign({ value: {}, }, desc); + propMap._subscribers = _$assign({ value: {}, }, desc); + _$define(self, propMap); + _$assign(self.$filters, compCtor.$filters || {}); + } + const prototype = _$Component.prototype; + _$define(prototype, { + $data: { + get() { + return _$plainObject(this); + }, + enumerable: true, + configurable: true + } + }); + prototype.$get = function (path: string) { + return _$accesor(this, path); + }; + prototype.$set = function (path: string, value: any) { + _$accesor(this, path, value); + }; + prototype.$on = function (event: string, handler: (data: any) => void) { + if (!this._events[event]) { + this._events[event] = []; + } + this._events[event].push(handler); + }; + prototype.$off = function (event: string, handler: (data: any) => void) { + const index = this._events[event].indexOf(handler); + !!~index && this._events[event].splice(index, 1); + }; + prototype.$once = function (event: string, handler: (data: any) => void) { + const _this = this; + const _handler = function (args: any) { + handler(args); + _this.$off(event, _handler); + }; + this.$on(event, _handler); + }; + prototype.$fire = function (event: string, data: any) { + if (this._events[event]) { + _$each(this._events[event], function (handler) { handler(data); }); + } + }; + prototype.$notify = function (key: string) { + if (this._subscribers[key]) { + _$each(this._subscribers[key], function (suscriber) { suscriber(); }); + } + }; + prototype.$observe = function (keyOrKeys: string | string[], handler: () => void) { + const _this = this; + const subs: { subscrition: string, index: number }[] = []; + if (_$isArray(keyOrKeys)) { + _$each(keyOrKeys, key => { + subs.push({ subscrition: key, index: _$subscribers.call(_this, key, handler) }); + }); + } else { + subs.push({ + subscrition: keyOrKeys, index: _$subscribers.call(this, keyOrKeys, handler) + }); + } + return { + $unobserve() { + _$each(subs, ({ subscrition, index }) => { + _this._subscribers[subscrition].splice(index, 1); + }); + } + }; + }; + prototype.$watch = function (key: string, handler: () => void) { + const _this = this; + if (!this._watchers[key]) { + this._watchers[key] = []; + } + const i = this._watchers[key].push(handler.bind(this)); + return { + $unwatch() { + _this._watchers[key].splice(i - 1, 1); + } + }; + }; + return _$Component; +}()); +const _$List = (function (_super) { + _$extends(List, _super); + function List(value: any[], component: Component, key: string) { + _super.call(this, value.length); + const self = this; + _$define(self, { + _key: { value: key, enumerable: false }, + _root: { value: component, enumerable: false } + }); + _$apply(_super.prototype.push, value.map((val, i) => { + if (self.length !== 0) + i += self.length; + return !_$isType(val, List) && _$isArray(val) ? new List(val, component, key + '.' + i) : val; + }), [], self); + } + List.prototype.pull = function (index: number) { + const self = this; + const args = _$slice(arguments, 1); + let length = self.length; + if (index > length) { + length = index + 1; + const pull = new Array(index - self.length); + _$apply(pull.push, args, [], pull); + for (let i = 0; i < length; i++) { + if (i === index) { + _$apply(self.push, pull, [], self); + } + } + } else { + _$apply(self.splice, [index, 1].concat(args), [], self); + } + }; + ['pop', 'push', 'reverse', 'shift', 'sort', 'fill', 'unshift', 'splice'].forEach(function (method) { + List.prototype[method] = function () { + const self = this; + const args = _$slice(arguments); + const old = self.slice(); + let result = void 0; + if (method === 'push') { + _$apply([].push, args.map(function (v, i) { + if (self.length !== 0) + i += self.length; + return !(_$isType(v, List)) && _$isArray(v) ? new List(v, self._root, `${self._key}.${i}`) : v; + }), [], self); + result = self.length; + } else { + result = _$apply(Array.prototype[method], args, [], self); + } + _$dispatch(self._root, self._key, old, self.slice()); + return result; + }; + }); + return List; +}(Array)); +function _$createComponent($ComponentClass: Function, templateFn: (ctx: Component) => TemplateObject) { + function $ComponentCtor(attrs: Record, parent: Component) { + const self: Component = this; + _$apply(_$Component, [attrs, $ComponentCtor, parent], [], self); + $ComponentClass.call(self); + const descriptors = {}; + _$each(self, (_, key) => { + if (_$hasProp(self, key)) { + const descriptor = Object.getOwnPropertyDescriptor(self, key); + if (descriptor.value && _$isArray(descriptor.value)) { + descriptor.value = new _$List(descriptor.value, self, key); + } else { + if (descriptor.get) { + const getter_1 = descriptor.get; + descriptor.get = function () { + let value = getter_1.call(this); + if (_$isArray(value)) + value = new _$List(value, this, key); + return value; + }; + } + if (descriptor.set) { + const setter_1 = descriptor.set; + descriptor.set = function (value) { + if (_$isArray(value)) + value = new _$List(value, this, key); + setter_1.call(this, value); + }; + } + } + descriptors[key] = descriptor; + } + }); + _$define(self, descriptors); + const tpl = templateFn(self); + const tplDesc = {}; + _$each(tpl, (value: (...args: any[]) => void, key) => { + tplDesc[key] = ((key, value) => { + const hook = key[1].toUpperCase() + _$slice(key, 2); + return { + enumerable: false, configurable: false, writable: false, + value() { + const args = _$slice(arguments); + const ahook = this['did' + hook]; + const bhook = this['will' + hook]; + bhook && bhook.call(this); + _$apply(value, key === '$update' ? [this, _$slice(args, 1)] : args, this); + ahook && ahook.call(this); + } + }; + })(key, value); + }); + _$define(self, tplDesc); + _$each(_$treborPlugins(), ({ plugin, options }) => { plugin.call(self, $ComponentCtor, options); }); + !parent && this.$create(); + } + const proto = [$ComponentClass.prototype, _$Component.prototype].reduceRight((superProto, proto) => { + const inheritedProto = Object.create(superProto); + for (const key in proto) { + if (proto.hasOwnProperty(key)) { + const desc = Object.getOwnPropertyDescriptor(proto, key); + Object.defineProperty(inheritedProto, key, desc); + } + } + _$assign($ComponentCtor, proto.constructor); + inheritedProto.constructor = proto.constructor; + return inheritedProto; + }, Object.prototype); + + $ComponentCtor.prototype = Object.create(proto); + $ComponentCtor.prototype.constructor = $ComponentCtor; + $ComponentCtor.$plugin = function (plugin: Function, options: Record) { + _$treborPlugins().push({ options, plugin }); + }; + return $ComponentCtor; } -export function _$append(parent: Element, child: Element, sibling?: boolean | Element) { - if (_$isType(sibling, 'boolean') && sibling) parent.parentElement.replaceChild(child, parent); - else if (!sibling) parent.appendChild(child); - else parent.insertBefore(child, sibling); +function _$setReference(refs: Record, prop: string, node: HTMLElement) { + if (!_$hasProp(refs, prop)) { + const value: HTMLElement[] = []; + _$define(refs, { + [prop]: { + get() { return value.length <= 1 ? value[0] : value; }, + set(val: HTMLElement) { val && !~value.indexOf(val) && value.push(val); }, + enumerable: true, configurable: true + } + }); + } + refs[prop] = node; } -export function _$appendToSlot(slots: ObjectLike, slot: string, el: HTMLElement) { - !slots[slot].firstChild && _$append(slots[slot], el); +function _$removeReference(refs: Record, prop: string, node: HTMLElement) { + const nodes = refs[prop]; + _$isArray(nodes) ? _$removeItem(nodes, node) : (delete refs[prop]); +} +function _$fragTpl(...htmlParts: string[]) { + const template = document.createElement('template'); + template.innerHTML = htmlParts.join(''); + const fragment = template.content; + const nodes = _$slice(fragment.childNodes); + nodes.unshift(fragment); + return nodes; +} +function _$prepareFragment(frag: DocumentFragment, els: Node[]) { + if (!frag.hasChildNodes()) { + _$each(els, el => frag.append(el)); + } } -export function _$declareSlots($slots: ObjectLike, slots: string[]) { - _$each(slots, slot => { $slots[slot] = _$docFragment(); }); +function _$updateTxt(txt: Text, newData: string) { + if (txt.data !== newData) { + txt.data = newData; + } } -export function _$assignEl(source: Element, dest: Element) { - const { childNodes, attributes } = source; - for (let i = 0; i < childNodes.length; i++) { - _$append(dest, childNodes[i]); +function _$noop() { } +function _$child(el: Node, index?: number) { + if (index === void 0) { index = 0; } + var node = el.childNodes[index]; + if (node.nodeType === 3) { + (node).data = ''; } - for (let i = 0; i < attributes.length; i++) { - const attr = attributes[i]; - dest.setAttributeNS(source.namespaceURI, attr.name, attr.value); + return node; +} +function _$append(parent: Node, child: Node, sibling?: Node | boolean) { + if (sibling === true) + parent.parentElement.replaceChild(child, parent); + else if (!sibling) + parent.appendChild(child); + else + parent.insertBefore(child, sibling); +} +function _$attr(el: HTMLElement, attribute?: string, value?: any) { + if (attribute === void 0) { attribute = 'value'; } + var isValueAttr = attribute === 'value'; + var _value = isValueAttr ? `_${attribute}` : null; + if (value === void 0) { + if (isValueAttr) { + return _$hasProp(el, _value) ? el[_value] : el[attribute]; + } else { + return el.getAttribute(attribute); + } + } else { + el.setAttribute(attribute, _$toString(value)); } - source.parentElement.replaceChild(dest, source); - return dest; -} -export function _$removeEl(el: Element, parent: Element) { - let root = parent || el.parentElement; - if (root) root.removeChild(el); } -export function _$el(tagName?: T) { - return document.createElement(tagName || 'div'); +function _$eventKeys(event: KeyboardEvent) { + var keys = _$slice(arguments, 1); + var i = 0; + while (i < keys.length) { + var key = keys[i]; + if (!(_$lowerCase(event.key) === key || !!event[`${key}Key`])) { + return false; + } + i++; + } + return true; } -export function _$svg(tagName?: T) { - return document.createElementNS('http://www.w3.org/2000/svg', tagName || 'svg'); +function _$eventStop(event: Event) { + event.stopPropagation(); } -export function _$text(content?: string) { - return document.createTextNode(content || ''); +function _$eventPrevent(event: Event) { + event.preventDefault(); } -export function _$comment(content?: string) { - return document.createComment(content || ''); +function _$addEvent(node: Node | Component, event: string, listener: (...args: any[]) => void) { + if (_$type(node).indexOf('html') === 0) { + node.addEventListener(event, listener, false); + } + else { + (node).$on(event, listener); + } } -export function _$setAttr(el: Element & { _value?: any }, attrAndValue: [string, any]) { - let [attr, value] = attrAndValue; - el.setAttribute(attr, _$toString(value)); - if (_$isValueAttr(attr) && !_$isString(value)) el[PROP_MAP._] = value; +function _$removeEvent(node: Node | Component, event: string, listener: (...args: any[]) => void) { + if (_$type(node).indexOf('html') === 0) { + node.removeEventListener(event, listener, false); + } else { + (node).$off(event, listener); + } } -export function _$getAttr(el: Element, attr: string) { - return _$isValueAttr(attr) ? _$getValue(el) : el.getAttribute(attr); +function _$initSlot(slots: Record, slotName: string, children: string[]) { + if (!slots[slotName].hasChildNodes()) { + slots[slotName] = _$apply(_$fragTpl, children)[0]; + } } -export function _$getValue(el: (HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLOptionElement) & { _value?: any }) { - return _$hasProp(el, PROP_MAP._) ? el[PROP_MAP._] : el[PROP_MAP.v]; +function _$declareSlots(slots: Record, slotsList: string[]) { + _$each(slotsList, slotName => { + slots[slotName] = _$apply(_$fragTpl, [])[0]; + }); } -export function _$addListener(el: HTMLElement, event: string, handler: EventListenerOrEventListenerObject) { - el.addEventListener(event, handler, false); +function _$appendSlots(slots: Record, parent: Node) { + _$each(slots, slot => { + _$append(parent, slot); + }); } -export function _$updateListener(el: HTMLElement, event: string, oldHandler: EventListenerOrEventListenerObject, newHandler: EventListenerOrEventListenerObject) { - _$removeListener(el, event, oldHandler); - _$addListener(el, event, oldHandler = newHandler); - return oldHandler; +function _$emptySlot(component: Component, slot: string) { + var slots = component.$slots; + return slots[slot] && !slots[slot].hasChildNodes() ? (slots[slot] = _$apply(_$fragTpl, [])[0]) : null; } -export function _$removeListener(el: HTMLElement, event: string, handler: EventListenerOrEventListenerObject) { - el.removeEventListener(event, handler, false); +function _$setSlotContent(slot: DocumentFragment, content: string[]) { + slot && _$append(slot, _$apply(_$fragTpl, content)[0]); } -export function _$bindClasses(value: string | ObjectLike | (string | ObjectLike)[]) { - let classes = ''; - if (_$isString(value)) { - classes += ` ${value}`; - } else if (_$isArray(value)) { - classes = (value).map(_$bindClasses).join(' '); - } else if (_$isObject(value)) { - for (let key in value) - if (_$hasProp(value, key) && value[key]) classes += ` ${key}`; +function _$setElements(component: Component, parent: HTMLElement, sibling: boolean | HTMLElement) { + var brother = _$(sibling); + if (brother && _$type(brother) !== 'boolean') { + component.$siblingEl = brother; + component.$parentEl = brother.parentElement; } - return classes.trim(); -} -export function _$bindStyle(value: string | ObjectLike) { - let el = _$el(); - if (_$isObject(value)) { - const { style } = el; - _$each(value, (val, prop) => { - if (val !== style[prop]) style[prop] = val; - }); - return style.cssText; - } else if (_$isString(value)) { - return value; - } else { - return ''; + else { + component.$parentEl = _$(parent); } } -export function _$conditionalUpdate(block: { type: string } & ComponentTemplate, condition: Function, parent: Element, anchor: Element, inst: Component) { - let globs = _$toArgs(arguments, 5); - if (block && block.type === _$apply(condition, [inst], globs).type) { - _$apply(block.$update, [inst], globs, block); - } else { - block && block.$destroy(); - block = _$apply(condition, [inst], globs); - block.$create(); - block.$mount(parent || inst.$parentEl, anchor); - } - return block; +function _$getComponent(parent: Component, tag: string, globName: string) { + return !tag && !globName ? parent.constructor : parent.$options.children[tag] || window[globName]; } -export function _$bindBooleanAttr(el: HTMLElement, attrAndValue: [string, any]) { - let [attr, value] = attrAndValue; - el[attr] = value == null || value === false ? (el.removeAttribute(attr), false) : (_$setAttr(el, [attr, '']), true); +function _$callHook(component: Component, hook: string) { + const args = _$slice(arguments, 2); + component && _$apply(component[hook], args, component); } -export function _$bindUpdate(el: (HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement) & { _value: any }, binding: [string, any]) { - let [attr, value] = binding; - let _value: string = _$toString(value); - if (_$isValueAttr(attr)) { - if (el[attr] !== _value) el[attr] = _value; - el[PROP_MAP._] = value; - } else if (_$getAttr(el, attr) !== _value) { - _$setAttr(el, [attr, _value]); +function _$addChild(component: Component, Child: typeof Component, attrs: Record) { + let child = null; + if (Child) { + child = new Child(attrs, component); + component.$children.push(child); } + return child; } -export function _$textUpdate(text: Text, value: string) { - if (text.data !== (value = _$toString(value))) text.data = value; -} -export function _$tagUpdate(node: HTMLElement, tag: T) { - return tag.toUpperCase() !== node.tagName ? _$assignEl(node, _$el(tag)) : node; -} -export function _$removeReference(refs: Object, prop: string, node: HTMLElement) { - let nodes = refs[prop]; - _$isArray(nodes) ? refs[prop].splice(nodes.indexOf(node), 1) : (delete refs[prop]); -} -export function _$htmlUpdate(node: HTMLElement, value: string) { - if (node.innerHTML !== (value = _$toString(value))) node.innerHTML = value; -} -export function _$componentUpdate(parent: Component, Ctor: ComponentConstructor, inst: Component, value: ComponentConstructor, attrs: AttrParams, el: HTMLElement, sibling: HTMLElement) { - if (value === Ctor) { +function _$componentUpdate(parent: Component, inst: Component, ctor: typeof Component, value: typeof Component, attrs: Record, el: HTMLElement, sibling: boolean | HTMLElement) { + if (value === ctor) { inst && inst.$update(); - } else { - Ctor = value; + } + else { + ctor = value; if (inst) { inst.$destroy(); - _$removeChild(parent, inst); - } - if (inst) { - inst = _$addChild(parent, Ctor, attrs); + _$removeItem(parent.$children, inst); + inst = _$addChild(parent, ctor, attrs); inst.$create(); inst.$mount(el || parent.$parentEl, sibling); } } - return [inst, Ctor]; -} -export function _$forLoop(root: Component, obj: any[], loop: (...args: any[]) => ComponentTemplate) { - let items: ObjectLike = {}, loopParent: Element, loopSibling: Element; - let globs = _$toArgs(arguments, 3); - _$each(obj, (item, i, index) => { items[i] = _$apply(loop, [root, item, i, index], globs); }); - return { - $create() { - _$each(items, item => { item.$create(); }); - }, - $mount(parent, sibling) { - loopParent = _$select(parent); - loopSibling = _$select(sibling); - _$each(items, item => { item.$mount(loopParent, loopSibling); }); - }, - $update(root: Component, obj: any[]) { - let globs = _$toArgs(arguments, 2); - _$each(items, (item, i, index) => { - if (obj[i]) { - _$apply(item.$update, [root, obj[i], i, index], globs, item); - } else { - item.$destroy(); - delete items[i]; - } + return [inst, ctor]; +} +function _$destroyComponent(component: Component) { + component.$unmount(); + component.$parent = null; + component.$parentEl = null; + component.$siblingEl = null; + component.$children.splice(0); +} +function _$bindClass(classes: string, classValue: string | string[] | Record) { + function parseClasses(classes: string, classValue: string | string[] | Record) { + let classList = classes.split(' '); + if (_$isString(classValue)) { + classList = classList.concat(classValue.split(' ')); + } + else if (_$isArray(classValue)) { + classValue.forEach(c => { + classList = classList.concat(parseClasses('', c)); }); - _$each(obj, (item, i, index) => { - if (!items[i]) { - items[i] = _$apply(loop, [root, item, i, index], globs); - items[i].$create(); - items[i].$mount(loopParent, loopSibling); - } + } + else if (_$isObject(classValue)) { + _$each(classValue, (value, prop) => { + value && classList.push(prop); }); - }, - $destroy() { - _$each(items, item => { item.$destroy(); }); } - }; + return classList.filter((c, i) => classList.indexOf(c) === i); + } + return parseClasses(classes, classValue).join(' '); +} +function _$bindStyle(style: string, styles: string | Record) { + if (_$isObject(styles)) { + _$each(styles, (value, prop) => { + style += `;${_$camelToSnake(prop)}:${value}`; + }); + return style; + } else if (_$isString(styles)) { + return `${style};${styles}`; + } + return style; +} +function _$bindBooleanAttr(node: HTMLElement, attr: string, value: boolean) { + if (value == null || value === false) { + node.removeAttribute(attr); + node[attr] = false; + } else { + _$attr(node, attr, ''); + node[attr] = true; + } } -export function _$each(obj: T, cb: (value: IterateValue, key: IterateKey, index?: number) => void) { - let i = 0; - for (const key in obj) { - if (_$hasProp(obj, key)) { - cb(obj[key], (isNaN(+key) ? key : +key), i++); +function _$bindUpdate(node: HTMLElement, attr: any, value?: any) { + if (value === void 0) { + value = attr; + attr = 'value'; + } + var _value = _$toString(value); + if (attr === 'value') { + if (node[attr] !== _value) { + node[attr] = _value; + node[`_${attr}`] = value; } + } else if (_$attr(node, attr) !== _value) { + _$attr(node, attr, _value); } } -export function _$insertStyle(id: string, css: string) { +function _$bindMultiSelect(select: HTMLSelectElement, selections) { + if (!selections.length) { + return; + } + const options = select.options; + _$each(options, (option: HTMLOptionElement) => { + option.selected = !!~selections.indexOf(_$attr(option)); + }); +} +function _$filters(component: Component, value) { + const filterArgs = _$slice(arguments, 2); + _$each(filterArgs, (args: any[]) => { + const filter = args.splice(0, 1, value)[0]; + value = _$apply(component.$filters[filter], args, component); + }); + return value; +} +function _$context(ctx: Component, cb: (args?: any[]) => any) { + const props = _$slice(arguments, 2); + const args = props.map(prop => { + const value = prop in ctx ? ctx[prop] : window[prop]; + return _$isFunction(value) ? value.bind(ctx) : value; + }); + return args.length ? cb(args) : cb(); +} +function _$insertStyle(id: string, css: string) { let isNew = false; - let style = _$select(`#${id}`, document.head); + let style = _$('#' + id, document.head); if (!style) { isNew = true; - style = _$el('style'); + style = document.createElement('style'); style.id = id; - _$setAttr(style, ['refs', 1]); + _$attr(style, 'refs', 1); } if (style.textContent !== css) { style.textContent = css; @@ -709,18 +773,26 @@ export function _$insertStyle(id: string, css: string) { if (isNew) { _$append(document.head, style); } else { - let count = +_$getAttr(style, 'refs'); - _$setAttr(style, ['refs', ++count]); + let count = +_$attr(style, 'refs'); + _$attr(style, 'refs', ++count); } } -export function _$removeStyle(id: string) { - let style = _$select(`#${id}`, document.head); +function _$removeStyle(id: string) { + const style = _$('#' + id, document.head); if (style) { - let count = +_$getAttr(style, 'refs'); + let count = +_$attr(style, 'refs'); if (--count === 0) { - _$removeEl(style, document.head); + document.head.removeChild(style); } else { - _$setAttr(style, ['refs', count]); + _$attr(style, 'refs', count); } } } + +export { + _$, _$attr, _$declareSlots, _$initSlot, _$bindBooleanAttr, _$bindMultiSelect, _$appendSlots, _$emptySlot, + _$addEvent, _$removeEvent, _$noop, _$eventStop, _$eventPrevent, _$child, _$append, _$updateTxt, _$bindClass, + _$bindStyle, _$eventKeys, _$fragTpl, _$setReference, _$removeReference, _$filters, _$type, _$each, _$apply, + _$bindUpdate, _$getComponent, _$addChild, _$componentUpdate, _$destroyComponent, _$setElements, _$callHook, + _$prepareFragment, _$context, _$createComponent, _$insertStyle, _$removeStyle, _$setSlotContent, _$slice, _$toString +}; diff --git a/tools/tsconfig.json b/tools/tsconfig.json index 3d5c86d..008f0ec 100644 --- a/tools/tsconfig.json +++ b/tools/tsconfig.json @@ -1,17 +1,22 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["dom", "es5"], /* Specify library files to be included in the compilation. */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ + // "outDir": "../build", /* Redirect output structure to the directory. */ + // "resolveJsonModule": true, "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */ @@ -23,13 +28,14 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noUnusedLocals": true, /* Report errors on unused locals. */ + "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ @@ -39,19 +45,20 @@ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ - "types": [], /* Type declaration files to be included in compilation. */ + // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - } -} \ No newline at end of file + } +} diff --git a/tslint.json b/tslint.json index 6baf0eb..03bace3 100644 --- a/tslint.json +++ b/tslint.json @@ -1,13 +1,18 @@ { - "rules": { - "semicolon": [ - true, "always" - ], - "triple-equals": [ - true, "allow-null-check" - ], - "quotemark": [ - true, "single" - ] - } + "defaultSeverity": "error", + "rules": { + "semicolon": [ + true, + "always" + ], + "no-unused-variable": [true], + "triple-equals": [ + true, + "allow-null-check" + ], + "quotemark": [ + true, + "single" + ] + } } \ No newline at end of file