├── .eslintignore
├── .travis.yml
├── .editorconfig
├── .gitignore
├── .npmignore
├── .babelrc
├── src
├── main.js
├── debug.js
├── loader.js
├── blyde.js
├── shared.js
├── methods
│ ├── blyde.js
│ ├── list.js
│ ├── event.js
│ └── node.js
└── register.js
├── LICENSE
├── test
└── index.html
├── config
├── rollup.config.js
└── bs-config.js
├── package.json
├── plugins
└── exampleplugin.js
├── README.md
├── .eslintrc
└── dist
└── blyde.min.js
/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | config/*.js
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | script: npm run build
2 | language: node_js
3 | node_js:
4 | - "7"
5 | cache:
6 | directories:
7 | - node_modules
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = tab
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [package.json]
12 | indent_style = space
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated files
2 | bin/
3 | gen/
4 |
5 | # Log Files
6 | *.log
7 | *.log.*
8 |
9 | # Temp Files
10 | *~
11 | *.*~
12 | .fuse_*
13 | yarn.lock
14 | cache/
15 |
16 | # Project files
17 |
18 | # node modules
19 | node_modules/
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # Generated files
2 | bin/
3 | gen/
4 |
5 | # Log Files
6 | *.log
7 | *.log.*
8 |
9 | # Temp Files
10 | *~
11 | *.*~
12 | .fuse_*
13 | yarn.lock
14 | cache/
15 |
16 | # Project files
17 | plugins/
18 | test/
19 |
20 | # node modules
21 | node_modules/
22 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["es2015",
4 | {
5 | "modules": false
6 | }],
7 | "stage-2"
8 | ],
9 | "plugins": [
10 | ["transform-runtime", {
11 | "polyfill": true
12 | }],
13 | "closure-elimination",
14 | "tailcall-optimization",
15 | "external-helpers"
16 | ],
17 | "comments": false
18 | }
19 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | /* global define */
2 | 'use strict'
3 |
4 | import Blyde from './loader.js'
5 | import { warn } from './debug.js'
6 |
7 | if (typeof module !== 'undefined' && module.exports) {
8 | module.exports = Blyde
9 | } else if (typeof define === 'function' && define.amd) {
10 | define(() => Blyde)
11 | } else {
12 | Object.defineProperty(window, 'Blyde', { value: Blyde })
13 | if (window.$) warn(`"window.$" may have been taken by another library, use "window.Blyde" for non-conflict usage.`)
14 | else Object.defineProperty(window, '$', { value: Blyde })
15 | }
16 |
--------------------------------------------------------------------------------
/src/debug.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import logger from 'loglevel'
4 | const log = console.log.bind(null, '[Blyde]')
5 | const trace = logger.trace.bind(null, '[Blyde]')
6 | const debug = logger.debug.bind(null, '[Blyde]')
7 | const info = logger.info.bind(null, '[Blyde]')
8 | const warn = logger.warn.bind(null, '[Blyde]')
9 | const error = logger.error.bind(null, '[Blyde]')
10 |
11 | if (ENV === 'production' && !localStorage.bdFlag) {
12 | logger.setLevel('error')
13 | } else {
14 | logger.setLevel('trace')
15 | }
16 |
17 | info('Debug logging enabled!')
18 |
19 | export { log, trace, debug, info, warn, error, logger }
20 |
--------------------------------------------------------------------------------
/src/loader.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import Blyde from './blyde.js'
4 | import regFn from './register.js'
5 | import nodeMethods from './methods/node.js'
6 | import listMethods from './methods/list.js'
7 | import blydeMethods from './methods/blyde.js'
8 | import eventHandlers from './methods/event.js'
9 | import { $cache, $node } from './shared.js'
10 |
11 | regFn(() => {
12 | const plugin = {
13 | name: 'Blyde',
14 | node: Object.assign(nodeMethods, eventHandlers),
15 | list: listMethods,
16 | blyde: blydeMethods
17 | }
18 | return plugin
19 | }, {
20 | autoNameSpace: false
21 | })
22 |
23 | Object.defineProperty(Node.prototype, '$', {
24 | get() {
25 | return $cache[this.$id] || new $node(this)
26 | }
27 | })
28 |
29 | export default Blyde
30 |
--------------------------------------------------------------------------------
/src/blyde.js:
--------------------------------------------------------------------------------
1 | /* global VERSION */
2 | 'use strict'
3 |
4 | import { info, warn } from './debug.js'
5 |
6 | const initQuery = []
7 | let loaded = false
8 |
9 | const Blyde = (fn) => {
10 | if (typeof(fn) === 'function') {
11 | if (loaded) {
12 | fn.call(window)
13 | } else {
14 | initQuery.push(fn)
15 | }
16 | } else {
17 | warn(fn, 'is not a function!')
18 | }
19 | }
20 |
21 | const init = function() {
22 | document.removeEventListener('DOMContentLoaded', init, false)
23 | if (window.Velocity) Blyde.useVelocity(window.Velocity)
24 | loaded = true
25 | initQuery.forEach(i => i.call(window))
26 | info(`Blyde v${VERSION} initlized!`)
27 | }
28 |
29 | document.addEventListener('DOMContentLoaded', init, false)
30 | if (document.readyState === "interactive" || document.readyState === "complete") init()
31 |
32 | export default Blyde
33 |
--------------------------------------------------------------------------------
/src/shared.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const $cache = {}
4 | const $methods = {
5 | node: {},
6 | list: {},
7 | blyde: {}
8 | }
9 |
10 | const $getSymbol = () => Symbol(Math.floor(Math.random() * Math.pow(10, 16)).toString(36))
11 |
12 | const $node = class {
13 | constructor(node) {
14 | this.$el = node
15 | for (let i in $methods.node) {
16 | if ($methods.node[i] instanceof Function) this[i] = $methods.node[i].bind(node)
17 | else this[i] = $methods.node[i]
18 | }
19 | if (!node.$id) Object.defineProperty(node, '$id', {value: $getSymbol()})
20 | $cache[node.$id] = this
21 | }
22 | }
23 | const $nodeList = class {
24 | constructor(list) {
25 | this.$list = []
26 | for (let i = 0; i < list.length; i++) this.$list.push(list[i].$)
27 | for (let i in $methods.list) {
28 | if ($methods.list[i] instanceof Function) this[i] = $methods.list[i].bind(this.$list)
29 | else this[i] = $methods.node[i]
30 | }
31 | }
32 | }
33 |
34 | export { $cache, $methods, $getSymbol, $node, $nodeList }
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Yukino Song
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Blyde Test Page
6 |
7 |
18 |
19 |
20 |
Blyde Test Page
21 |
Just a test
22 |
23 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper tortor sagittis faucibus tempor. Nunc viverra, nunc et iaculis varius, mauris metus molestie sem, vel finibus ipsum libero ut tellus. Duis pretium nisl at tincidunt malesuada. Ut a dictum ligula. Quisque tincidunt est eu dolor condimentum, sit amet tempus est blandit. Suspendisse massa felis, pretium at risus vitae, luctus ultrices ipsum. Morbi auctor aliquam nisl non bibendum. Donec laoreet elementum justo et rutrum. Donec imperdiet rhoncus nulla. Ut nibh ex, ullamcorper blandit nisi ac, hendrerit accumsan nunc.
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/config/rollup.config.js:
--------------------------------------------------------------------------------
1 | // Rollup plugins
2 | const babel = require('rollup-plugin-babel')
3 | const eslint = require('rollup-plugin-eslint')
4 | const resolve = require('rollup-plugin-node-resolve')
5 | const commonjs = require('rollup-plugin-commonjs')
6 | const replace = require('rollup-plugin-replace')
7 | const uglify = require('rollup-plugin-uglify')
8 | const progress = require('rollup-plugin-progress')
9 | const git = require('git-rev-sync')
10 | const { version } = require('../package.json')
11 |
12 | module.exports = {
13 | entry: 'src/main.js',
14 | devDest: 'test/blyde.dev.js',
15 | proDest: 'dist/blyde.min.js',
16 | format: 'iife',
17 | sourceMap: 'inline',
18 | plugins: [
19 | progress({
20 | clearLine: false
21 | }),
22 | resolve({
23 | jsnext: true,
24 | main: true,
25 | browser: true,
26 | }),
27 | commonjs(),
28 | eslint(),
29 | babel({
30 | exclude: 'node_modules/**',
31 | runtimeHelpers: true
32 | }),
33 | replace({
34 | ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
35 | VERSION: JSON.stringify(`${version}.${git.branch()}.${git.short()}`)
36 | }),
37 | (process.env.NODE_ENV === 'production' && uglify())
38 | ]
39 | }
40 |
--------------------------------------------------------------------------------
/src/methods/blyde.js:
--------------------------------------------------------------------------------
1 | /* global VERSION */
2 | 'use strict'
3 |
4 | import regFn from '../register.js'
5 | import nodeMethods from './node.js'
6 | import eventHandlers from './event.js'
7 | import { $getSymbol } from '../shared.js'
8 | import { log, trace, debug, info, warn, error, logger } from '../debug.js'
9 |
10 | let velocityUsed = false
11 |
12 | const useVelocity = (v) => {
13 | if (velocityUsed) return warn('Velocity.js support has already been enabled!')
14 | regFn(() => {
15 | velocityUsed = true
16 | return {
17 | name: 'Velocity',
18 | node: {
19 | velocity(...args) {
20 | v(this, ...args)
21 | return this.$
22 | }
23 | },
24 | list: {
25 | velocity(...args) {
26 | this.forEach(i => v(i.$el, ...args))
27 | return this
28 | }
29 | }
30 | }
31 | }, {
32 | autoNameSpace: false
33 | })
34 | }
35 |
36 | export default {
37 | version: `Blyde v${VERSION}`,
38 | fn: regFn,
39 | q: nodeMethods.q.bind(document),
40 | qa: nodeMethods.qa.bind(document),
41 | on(...args) {
42 | eventHandlers.on.call(window, ...args)
43 | return this
44 | },
45 | listen(...args) {
46 | eventHandlers.listencall(window, ...args)
47 | return this
48 | },
49 | at(...args) {
50 | eventHandlers.at.call(window, ...args)
51 | return this
52 | },
53 | drop(...args) {
54 | eventHandlers.drop.call(window, ...args)
55 | return this
56 | },
57 | off(...args) {
58 | eventHandlers.off.call(window, ...args)
59 | return this
60 | },
61 | trigger(...args) {
62 | eventHandlers.trigger.call(window, ...args)
63 | return this
64 | },
65 | $getSymbol,
66 | useVelocity,
67 | log,
68 | trace,
69 | debug,
70 | info,
71 | warn,
72 | error,
73 | logger
74 | }
75 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blyde",
3 | "version": "0.1.0-beta.1",
4 | "description": "A blade-sharp javascript library that provides serval simple jQuery like operations",
5 | "main": "dist/blyde.min.js",
6 | "scripts": {
7 | "dev": "node ./build/dev-server.js",
8 | "build": "node ./build/build.js",
9 | "lint": "eslint --ext .js src"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/ClassicOldSong/Blyde.git"
14 | },
15 | "keywords": [
16 | "Blyde",
17 | "Javascript",
18 | "jQuery",
19 | "Dom"
20 | ],
21 | "author": "ClassicOldSong",
22 | "license": "MIT",
23 | "bugs": {
24 | "url": "https://github.com/ClassicOldSong/Blyde/issues"
25 | },
26 | "homepage": "https://github.com/ClassicOldSong/Blyde#readme",
27 | "devDependencies": {
28 | "babel-cli": "^6.18.0",
29 | "babel-plugin-closure-elimination": "^1.1.14",
30 | "babel-plugin-external-helpers": "^6.18.0",
31 | "babel-plugin-tailcall-optimization": "^1.0.11",
32 | "babel-plugin-transform-runtime": "^6.15.0",
33 | "babel-preset-es2015": "^6.18.0",
34 | "babel-preset-stage-2": "^6.18.0",
35 | "browser-sync": "^2.17.5",
36 | "eslint": "^3.9.1",
37 | "git-rev-sync": "^1.8.0",
38 | "loglevel": "^1.4.1",
39 | "node-watch": "^0.4.1",
40 | "rollup": "^0.36.3",
41 | "rollup-plugin-babel": "^2.6.1",
42 | "rollup-plugin-commonjs": "^5.0.5",
43 | "rollup-plugin-eslint": "^3.0.0",
44 | "rollup-plugin-node-resolve": "^2.0.0",
45 | "rollup-plugin-postcss": "^0.2.0",
46 | "rollup-plugin-progress": "^0.1.0",
47 | "rollup-plugin-replace": "^1.1.1",
48 | "rollup-plugin-uglify": "^1.0.1",
49 | "shelljs": "^0.7.5"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/plugins/exampleplugin.js:
--------------------------------------------------------------------------------
1 | /* global console, define */
2 | "use strict"
3 | {
4 | const plugin = (takeSnapShot) => {
5 | // Get the latest snapshot of Blyde
6 | const $ = takeSnapShot()
7 | $.log('Examin all properties that Blyde pass to a snapshot here:\n', $)
8 | let ExampleFunc = function() {
9 | $.log('This should not show up in procduction enviroment.')
10 | $.warn('This also should not show up in procduction enviroment.')
11 | $.error('This SHOULD show up in procduction enviroment!')
12 | }
13 |
14 | return {
15 | name: 'Example',
16 | node: {
17 | // New method to be registered
18 | testFunc: ExampleFunc,
19 | // Will be renamed
20 | toggleClass: 'Renamed',
21 | addClass(...args) {
22 | this.classList.add(...args)
23 | return this
24 | }
25 | },
26 | list: {
27 | // New method to be registered
28 | testFunc: ExampleFunc,
29 | // Will be renamed
30 | toggleClass: 'Renamed',
31 | addClass(...args) {
32 | for (let i = 0; i < this.length; i++) {
33 | this[i].classList.add(...args)
34 | }
35 | return this
36 | }
37 | },
38 | blyde: {
39 | // New method to be registered
40 | testFunc: ExampleFunc,
41 | // Will be renamed
42 | version: `fake ${$.version}`
43 | }
44 | }
45 | }
46 |
47 | if (typeof module !== 'undefined' && module.exports) {
48 | module.exports = plugin
49 | } else if (typeof define === 'function' && define.amd) {
50 | define(() => plugin)
51 | } else if (window.Blyde) {
52 | window.Blyde.fn(plugin, { autoNameSpace: 'rename' })
53 | } else {
54 | window.ExamplePlugin = plugin
55 | console.warn(`Blyde not found! If Blyde is loaded later, use "Blyde.fn(widnow.ExamplePlugin, yourConfig)" to load this plugin.`)
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/methods/list.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import { warn } from '../debug.js'
4 | import nodeMethods from './node.js'
5 | import { $node } from '../shared.js'
6 |
7 | export default {
8 | addClass(className) {
9 | this.forEach((i) => {
10 | i.addClass(className)
11 | })
12 | return this
13 | },
14 |
15 | removeClass(className) {
16 | this.forEach((i) => {
17 | i.removeClass(className)
18 | })
19 | return this
20 | },
21 |
22 | appendTo(node) {
23 | if (node instanceof $node) node = node.$el
24 | const nodes = []
25 | this.forEach((i) => {
26 | nodes.push(i.$el)
27 | })
28 | nodeMethods.append.call(node, ...nodes)
29 | return this
30 | },
31 |
32 | prependTo(node) {
33 | if (node instanceof $node) node = node.$el
34 | const nodes = []
35 | this.forEach((i) => {
36 | nodes.push(i.$el)
37 | })
38 | nodeMethods.prepend.call(node, ...nodes)
39 | return this
40 | },
41 |
42 | toggleClass(className) {
43 | this.forEach((i) => {
44 | i.toggleClass(className)
45 | })
46 | return this
47 | },
48 |
49 | empty() {
50 | this.forEach((i) => {
51 | i.empty()
52 | })
53 | return this
54 | },
55 |
56 | remove() {
57 | this.forEach((i) => {
58 | i.remove()
59 | })
60 | return this
61 | },
62 |
63 | safeRemove() {
64 | this.forEach((i) => {
65 | i.safeRemove()
66 | })
67 | return this
68 | },
69 |
70 | on(type, fn, useCapture) {
71 | if (typeof fn === 'function') {
72 | this.forEach((i) => {
73 | i.on(type, fn, !!useCapture)
74 | })
75 | return this
76 | } else warn(fn, 'is not a function!')
77 | },
78 |
79 | at(type, fn) {
80 | if (typeof fn === 'function') {
81 | this.forEach((i) => {
82 | i.at(type, fn)
83 | })
84 | return this
85 | } else warn(fn, 'is not a function!')
86 | },
87 |
88 | off(type, fn, useCapture) {
89 | if (typeof fn === 'function') {
90 | this.forEach((i) => {
91 | i.off(type, fn, !!useCapture)
92 | })
93 | return this
94 | } else warn(fn, 'is not a function!')
95 | },
96 |
97 | trigger(event, config) {
98 | if (typeof event === 'string') event = new Event(event, config)
99 | this.forEach(i => i.trigger(event))
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/config/bs-config.js:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | |--------------------------------------------------------------------------
4 | | Browser-sync config file
5 | |--------------------------------------------------------------------------
6 | |
7 | | For up-to-date information about the options:
8 | | http://www.browsersync.io/docs/options/
9 | |
10 | | There are more options than you see here, these are just the ones that are
11 | | set internally. See the website for more info.
12 | |
13 | |
14 | */
15 | module.exports = {
16 | "ui": false,
17 | "files": "test/index.html",
18 | "watchOptions": {},
19 | "server": {
20 | baseDir: "./test"
21 | },
22 | "proxy": false,
23 | "port": 3000,
24 | "middleware": false,
25 | "serveStatic": [],
26 | "ghostMode": {
27 | "clicks": true,
28 | "scroll": true,
29 | "forms": {
30 | "submit": true,
31 | "inputs": true,
32 | "toggles": true
33 | }
34 | },
35 | "logLevel": "info",
36 | "logPrefix": "BS",
37 | "logConnections": false,
38 | "logFileChanges": true,
39 | "logSnippet": true,
40 | "rewriteRules": false,
41 | "open": "local",
42 | "browser": "default",
43 | "cors": false,
44 | "xip": false,
45 | "hostnameSuffix": false,
46 | "reloadOnRestart": false,
47 | "notify": false,
48 | "scrollProportionally": true,
49 | "scrollThrottle": 0,
50 | "scrollRestoreTechnique": "window.name",
51 | "scrollElements": [],
52 | "scrollElementMapping": [],
53 | "reloadDelay": 0,
54 | "reloadDebounce": 0,
55 | "reloadThrottle": 0,
56 | "plugins": [],
57 | "injectChanges": true,
58 | "startPath": null,
59 | "minify": true,
60 | "host": null,
61 | "localOnly": false,
62 | "codeSync": true,
63 | "timestamps": true,
64 | "clientEvents": [
65 | "scroll",
66 | "scroll:element",
67 | "input:text",
68 | "input:toggles",
69 | "form:submit",
70 | "form:reset",
71 | "click"
72 | ],
73 | "socket": {
74 | "socketIoOptions": {
75 | "log": false
76 | },
77 | "socketIoClientConfig": {
78 | "reconnectionAttempts": 50
79 | },
80 | "path": "/browser-sync/socket.io",
81 | "clientPath": "/browser-sync",
82 | "namespace": "/browser-sync",
83 | "clients": {
84 | "heartbeatTimeout": 5000
85 | }
86 | },
87 | "tagNames": {
88 | "less": "link",
89 | "scss": "link",
90 | "css": "link",
91 | "jpg": "img",
92 | "jpeg": "img",
93 | "png": "img",
94 | "svg": "img",
95 | "gif": "img",
96 | "js": "script"
97 | }
98 | };
99 |
--------------------------------------------------------------------------------
/src/register.js:
--------------------------------------------------------------------------------
1 | /* global VERSION */
2 | 'use strict'
3 |
4 | import Blyde from './blyde.js'
5 | import { $getSymbol, $methods, $node, $nodeList } from './shared.js'
6 | import { log, trace, debug, info, warn, error, logger } from './debug.js'
7 |
8 | const plugins = {}
9 |
10 | const register = ({name, node, list, blyde}, options) => {
11 | if (!name) return error('Plugin name not precent! Registration aborted.')
12 | if (name in plugins) return warn(`Plugin "${name}" has already been registered.`)
13 | for (let i in node) {
14 | if ($methods.node[i]) {
15 | if (options.autoNameSpace === 'keep') info(`$node property "${i}" has been kept.`)
16 | else {
17 | let fnName = i
18 | if (options.autoNameSpace === 'rename') {
19 | fnName = name + i
20 | info(`$node property "${i}" has been renamed to "${fnName}".`)
21 | } else {
22 | warn(`$node property "${i}" in "${name}" has replaced the original one, set "options.autoNameSpace" to "rename" to keep both.`)
23 | }
24 | $methods.node[fnName] = node[i]
25 | }
26 | } else $methods.node[i] = node[i]
27 | }
28 | for (let i in list) {
29 | if ($methods.list[i]) {
30 | if (options.autoNameSpace === 'keep') info(`$nodeList property "${i}" has been kept.`)
31 | else {
32 | let fnName = i
33 | if (options.autoNameSpace === 'rename') {
34 | fnName = name + i
35 | info(`$nodeList property "${i}" has been renamed to "${fnName}".`)
36 | } else {
37 | warn(`$nodeList property "${i}" in "${name}" has replaced the original one, set "options.autoNameSpace" to "rename" to keep both.`)
38 | }
39 | $methods.list[fnName] = list[i]
40 | }
41 | } else $methods.list[i] = list[i]
42 | }
43 | for (let i in blyde) {
44 | if ($methods.blyde[i]) {
45 | if (options.autoNameSpace === 'keep') info(`Blyde property "${i}" has been kept.`)
46 | else {
47 | let fnName = i
48 | if (options.autoNameSpace === 'rename') {
49 | fnName = name + i
50 | info(`Blyde property "${i}" has been renamed to "${fnName}".`)
51 | } else {
52 | warn(`Blyde property "${i}" in "${name}" has replaced the original one, set "options.autoNameSpace" to "rename" to keep both.`)
53 | }
54 | $methods.blyde[fnName] = blyde[i]
55 | Blyde[fnName] = blyde[i]
56 | }
57 | } else {
58 | $methods.blyde[i] = blyde[i]
59 | Blyde[i] = blyde[i]
60 | }
61 | }
62 | info(`Plugin "${name}" loaded.`)
63 | }
64 |
65 | const takeSnapshot = () => {
66 | const methodsShot = {
67 | node: Object.assign({}, $methods.node),
68 | list: Object.assign({}, $methods.list),
69 | blyde: Object.assign({}, $methods.blyde)
70 | }
71 | const pluginShot = {}
72 | for (let i in plugins) {
73 | pluginShot[i] = {
74 | node: Object.assign({}, plugins[i].node),
75 | list: Object.assign({}, plugins[i].list),
76 | blyde: Object.assign({}, plugins[i].blyde)
77 | }
78 | }
79 | return {
80 | version: `Blyde v${VERSION}`,
81 | plugins: pluginShot,
82 | $methods: methodsShot,
83 | $node,
84 | $nodeList,
85 | $getSymbol,
86 | log,
87 | trace,
88 | debug,
89 | info,
90 | warn,
91 | logger,
92 | error
93 | }
94 | }
95 |
96 | export default (plugin, options = {}) => {
97 | register(plugin(takeSnapshot), options)
98 | }
99 |
--------------------------------------------------------------------------------
/src/methods/event.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import { warn } from '../debug.js'
4 | import { $node } from '../shared.js'
5 |
6 | const listeners = {}
7 | const eventHandler = function(e) {
8 | const targets = []
9 | e.path.forEach((i) => {
10 | if (listeners[this.$id][i.$id]) targets.push(i)
11 | })
12 | if (targets.length === 0) return
13 | for (let i of targets) {
14 | if (listeners[this.$id][i.$id][e.type]) {
15 | let ifBreak = false
16 | listeners[this.$id][i.$id][e.type].forEach((j) => {
17 | if (j.call(i, e) === false) ifBreak = true
18 | })
19 | if (ifBreak) return
20 | }
21 | }
22 | }
23 |
24 | const handlers = {
25 | on(type, fn, useCapture = false) {
26 | const types = type.split(' ')
27 | if (typeof fn === 'function') {
28 | types.forEach(i => this.addEventListener(i, fn, useCapture))
29 | return this.$
30 | } else warn(fn, 'is not a function!')
31 | },
32 |
33 | listen(type, node, fn) {
34 | if (node instanceof $node) node = node.$el
35 | else node = node.$.$el
36 | const types = type.split(' ')
37 | if (typeof fn === 'function') {
38 | types.forEach((i) => {
39 | if (i !== '') {
40 | if (!listeners[this.$id]) listeners[this.$id] = {}
41 | if (!listeners[this.$id][node.$id]) {
42 | this.addEventListener(i, eventHandler, true)
43 | listeners[this.$id][node.$id] = {}
44 | }
45 | if (!listeners[this.$id][node.$id][i]) listeners[this.$id][node.$id][i] = []
46 | listeners[this.$id][node.$id][i].push(fn)
47 | }
48 | })
49 | return this.$
50 | } else warn(fn, 'is not a function!')
51 | },
52 |
53 | at(type, fn) {
54 | handlers.listen.call(window, type, this, fn)
55 | return this.$
56 | },
57 |
58 | drop(type, node, fn) {
59 | if (node instanceof $node) node = node.$el
60 | else node = node.$.$el
61 | const types = type.split(' ')
62 | if (typeof fn === 'function') {
63 | if (listeners[this.$id] && listeners[this.$id][node.$id]) {
64 | types.forEach((i) => {
65 | if (i !== '' && listeners[this.$id][node.$id][i]) {
66 | const fns = listeners[this.$id][node.$id][i]
67 | fns.splice(fns.indexOf(fn), 1)
68 | if (listeners[this.$id][node.$id][i].length === 0) {
69 | delete listeners[this.$id][node.$id][i]
70 | if ((() => {
71 | for (let j in listeners[this.$id]) {
72 | if (listeners[this.$id][j][i]) return false
73 | }
74 | return true
75 | })()) this.removeEventListener(i, eventHandler, true)
76 | if (Object.keys(listeners[this.$id][node.$id]).length === 0) {
77 | delete listeners[this.$id][node.$id]
78 | if (Object.keys(listeners[this.$id]).length === 0) delete listeners[this.$id]
79 | }
80 | }
81 | }
82 | })
83 | }
84 | return this.$
85 | } else warn(fn, 'is not a function!')
86 | },
87 |
88 | off(type, fn, useCapture = false) {
89 | const types = type.split(' ')
90 | if (typeof fn === 'function') {
91 | types.forEach((i) => {
92 | this.removeEventListener(i, fn, useCapture)
93 | handlers.drop.call(window, i, this, fn)
94 | })
95 | return this.$
96 | } else warn(fn, 'is not a function!')
97 | },
98 |
99 | trigger(event, config) {
100 | if (typeof event === 'string') event = new Event(event, config)
101 | this.dispatchEvent(event)
102 | return this.$
103 | }
104 | }
105 |
106 | export default handlers
107 |
--------------------------------------------------------------------------------
/src/methods/node.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import { warn, error } from '../debug.js'
4 | import { $cache, $node, $nodeList } from '../shared.js'
5 |
6 | const safeZone = document.createDocumentFragment()
7 |
8 | export default {
9 | q(selector) {
10 | if (!(selector instanceof Node)) selector = this.querySelector(selector)
11 | if (selector) return new $node(selector)
12 | },
13 |
14 | qa(selector) {
15 | if (selector instanceof NodeList) return new $nodeList(selector)
16 | return new $nodeList(this.querySelectorAll(selector))
17 | },
18 |
19 | addClass(className) {
20 | const classes = className.split(' ')
21 | this.classList.add(...classes)
22 | return this.$
23 | },
24 |
25 | removeClass(className) {
26 | const classes = className.split(' ')
27 | this.classList.remove(...classes)
28 | return this.$
29 | },
30 |
31 | toggleClass(className) {
32 | const classes = className.split(' ')
33 | const classArr = this.className.split(' ')
34 | classes.forEach((i) => {
35 | const classIndex = classArr.indexOf(i)
36 | if (classIndex > -1) {
37 | classArr.splice(classIndex, 1)
38 | } else {
39 | classArr.push(i)
40 | }
41 | })
42 | this.className = classArr.join(' ').trim()
43 | return this.$
44 | },
45 |
46 | replaceWith(node) {
47 | if (node instanceof $node) node = node.$el
48 | const parent = this.parentNode
49 | if (parent) {
50 | parent.replaceChild(node, this)
51 | return node.$
52 | } else {
53 | error(this, 'may not have been attached to document properly.')
54 | return this.$
55 | }
56 | },
57 |
58 | swap(node) {
59 | if (node instanceof $node) node = node.$el
60 | const thisParent = this.parentNode
61 | const nodeParent = node.parentNode
62 | const thisSibling = this.nextSibling
63 | const nodeSibling = node.nextSibling
64 | if (thisParent && nodeParent) {
65 | thisParent.insertBefore(node, thisSibling)
66 | nodeParent.insertBefore(this, nodeSibling)
67 | return node.$
68 | } else {
69 | let errNodes = []
70 | if (thisParent === null) {
71 | errNodes.push(this)
72 | }
73 | if (nodeParent === null) {
74 | errNodes.push(node)
75 | }
76 | error(...errNodes, 'may not have been attached to document properly.')
77 | return this.$
78 | }
79 | },
80 |
81 | before(...nodes) {
82 | if (this.parentNode) {
83 | const tempFragment = document.createDocumentFragment()
84 | nodes.reverse()
85 | nodes.forEach((i) => {
86 | if (i instanceof $node) i = i.$el
87 | tempFragment.appendChild(i)
88 | })
89 | this.parentNode.insertBefore(tempFragment, this)
90 | } else {
91 | error(this, 'may not have been attached to document properly.')
92 | }
93 | return this.$
94 | },
95 |
96 | after(...nodes) {
97 | if (this.parentNode) {
98 | const tempFragment = document.createDocumentFragment()
99 | nodes.forEach((i) => {
100 | if (i instanceof $node) i = i.$el
101 | tempFragment.appendChild(i)
102 | })
103 | if (this.nextSibling) {
104 | this.parentNode.insertBefore(tempFragment, this.nextSibling)
105 | } else {
106 | this.parentNode.append(tempFragment)
107 | }
108 | } else {
109 | error(this, 'may not have been attached to document properly.')
110 | }
111 | return this.$
112 | },
113 |
114 | append(...nodes) {
115 | if ([1,9,11].indexOf(this.nodeType) === -1) {
116 | warn('This node type does not support method "append".')
117 | return
118 | }
119 | const tempFragment = document.createDocumentFragment()
120 | nodes.forEach((i) => {
121 | if (i instanceof $node) i = i.$el
122 | tempFragment.appendChild(i)
123 | })
124 | this.appendChild(tempFragment)
125 | return this.$
126 | },
127 |
128 | prepend(...nodes) {
129 | if ([1,9,11].indexOf(this.nodeType) === -1) {
130 | warn('This node type does not support method "prepend".')
131 | return
132 | }
133 | const tempFragment = document.createDocumentFragment()
134 | nodes.reverse()
135 | nodes.forEach((i) => {
136 | if (i instanceof $node) i = i.$el
137 | tempFragment.appendChild(i)
138 | })
139 | if (this.firstChild) {
140 | this.insertBefore(tempFragment, this.$el.firstChild)
141 | } else {
142 | this.appendChild(tempFragment)
143 | }
144 | return this.$
145 | },
146 |
147 | appendTo(node) {
148 | if (node instanceof $node) node = node.$el
149 | node.appendChild(this)
150 | return this.$
151 | },
152 |
153 | prependTo(node) {
154 | if (node instanceof $node) node = node.$el
155 | if (node.firstChild) {
156 | node.insertBefore(this, node.firstChild)
157 | } else {
158 | node.appendChild(this)
159 | }
160 | return this.$
161 | },
162 |
163 | empty() {
164 | this.innerHTML = ''
165 | },
166 |
167 | remove() {
168 | this.parentNode.removeChild(this)
169 | delete $cache[this.$id]
170 | return this
171 | },
172 |
173 | safeRemove() {
174 | safeZone.appendChild(this)
175 | return this.$
176 | }
177 |
178 | // animate(name) {
179 | // this.$.addClass(`${name}-trans`)
180 | // setTimeout(() => {
181 | // this.$.addClass(`${name}-start`)
182 | // this.$.addClass(`${name}-end`)
183 | // }, 0)
184 | // return this.$
185 | // }
186 | }
187 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blyde
2 | [](https://raw.githubusercontent.com/ClassicOldSong/Blyde/master/LICENSE) [](https://www.npmjs.com/package/blyde) [](https://travis-ci.org/ClassicOldSong/Blyde)
3 |
4 | A blade-sharp javascript library that provides several simple jQuery like operations
5 |
6 | ## Basic Usage
7 | + `node.$`: Wrap the node with Blyde, return a `$node`
8 | + `node.$id`: The special id for this node if wrapped by Blyde already (DO NOT MODIFY!!)
9 | + `Blyde(function)`: Execute the function when document is ready
10 | + `Blyde.version`: Version of Blyde
11 | + `Blyde.fn(plugin)`: Register a plugin for Blyde (See Wiki for Plugin usage \**Not Completed*\*)
12 | + `Blyde.useVelocity(Velocity)`: Add Velocity manually if Velocity is not attached to `window`
13 | + `$(function)`: Same as `Blyde()`
14 | + `$.version`: Same as `Blyde.version`
15 | + `$.fn(plugin)`: Same as `Blyde.fn()`
16 | + `$.q('selector')`: Wrapper for `document.querySelector()` and return a `$node`
17 | + `$.qa('selector')`: Wrapper for `document.querySelectorAll()` and return a `$nodeList`
18 | + `$.on(type, listener[, useCapture])`: Wrapper for `window.addEventListener()`
19 | + `$.listen(type, node, fn)`: Create a delegate for a node on `window`
20 | + `$.at(type, fn)`: Create a delegate for window on `window`
21 | + `$.drop(type, node, fn)`: Remove a delegate for a node on `window`
22 | + `$.off(type, fn[, useCapture])`: Remove enentListeners for this element with `window.removeEventListener()` & `window.drop()`
23 | + `$.$getSymbol()`: Get a `Symbol` with a random string
24 | + `$node.$el`: The original node of this element
25 | + `$node.q('selector')`: Wrapper for `node.querySelector()` and return a `$node`
26 | + `$node.qa('selector')`: Wrapper for `node.querySelectorAll()` and return a `$nodeList`
27 | + `$node.addClass('classe names')`: Add classes to this element, use `space` for multiple class names
28 | + `$node.removeClass('class names')`: Remove classes from this element, use `space` for multiple class names
29 | + `$node.toggleClass('class names')`: Toggle classes for this element, use `space` for multiple class names
30 | + `$node.replaceWith(node)`: Replace this element with a new element
31 | + `$node.swap(node)`: Swap this element with another
32 | + `$node.before(node)`: Insert this element before an element
33 | + `$node.after(node)`: Insert this element after an element
34 | + `$node.append(nodes)`: Append elements to this element
35 | + `$node.prepend(nodes)`: Prepend elements to this element
36 | + `$node.appendTo(node)`: Append this element to an element
37 | + `$node.prependTo(node)`: Prepend this element to an element
38 | + `$node.empty()`: Delete all childnodes from this element
39 | + `$node.remove()`: Delete this element from document and return this element itself *(Not a `$node`!!)*
40 | + `$node.safeRemove()`: Remove this element from document while all event listeners are still maintained
41 | + `$node.on(type, fn[, useCapture])`: Wrapper for `Node.addEventListener()`
42 | + `$node.listen(type, node, fn)`: Create a delegate for a node on this element
43 | + `$node.at(type, fn)`: Create a delegate for this element on `window`
44 | + `$node.drop(type, node, fn)`: Remove a delegate for a node on this element
45 | + `$node.off(type, fn[, useCapture])`: Remove enentListeners for this element with `Node.removeEventListener()` & `$.drop()`
46 |
47 | + `$nodeList.addClass('classe names')`: Add classes to all elements in this nodelist, use `space` for multiple class names
48 | + `$nodeList.removeClass('class names')`: Remove classes from all elements in this nodelist, use `space` for multiple class names
49 | + `$nodeList.toggleClass('class names')`: Toggle classes for all elements in this nodelist, use `space` for multiple class names
50 | + `$nodeList.appendTo(node)`: Append all elements in this nodelist to this element
51 | + `$nodeList.prependTo(node)`: Prepend all elements in this nodelist to this element
52 | + `$nodeList.empty()`: Delete all childnodes from elements in this nodelist
53 | + `$nodeList.remove()`: Delete all elements in this nodelist from document
54 | + `$nodeList.safeRemove()`: Remove all elements in this nodelist from document while all event listeners are still maintained
55 | + `$nodeList.on(type, fn[, useCapture])`: Add event listener to all elements in this nodelist
56 | + `$nodeList.at(type, fn)`: Create delegate to all elements in this nodelist on `window`
57 | + `$nodeList.off(type, fn[, useCapture])`: Remove event listener for all elements in this nodelist
58 |
59 | ## Animation
60 | To use animation, simply add [Velocity.js](http://julian.com/research/velocity/) into your HTML before document is ready:
61 |
62 | ``` javascript
63 |
64 | ```
65 |
66 | or
67 |
68 | ``` javascript
69 | import Blyde from 'blyde'
70 | import Velocity from 'velocity-animate'
71 |
72 | Blyde.useVelocity(Velocity)
73 | ```
74 |
75 | Then you can use:
76 | + `$node.velocity(arguments)`: Animate this element
77 | + `$nodeList.velocity(arguments)`: Animate all elements in this nodelist
78 |
79 | Detial usage please read the instruction of [Velocity.js](http://velocityjs.org/)
80 |
81 | The usage of Velocity.js with Blyde should be similar to that with jQuery.
82 |
83 | ## Compatibility
84 | Currently only supports IE10+, if you would like to use Blyde in IE9+, simply add [classlist-polyfill](https://www.npmjs.com/package/classlist-polyfill) into your project.
85 |
86 | ## Build from source
87 | ```
88 | $ git clone https://github.com/ClassicOldSong/Blyde.git
89 | $ cd Blyde
90 | $ npm install
91 | $ npm run build
92 | ```
93 | Then you can get the fresh-built `blyde.min.js` at the `dist` folder
94 |
95 | **Note:** All debugging messages are disabled in the production version
96 |
97 | ## License
98 | [MIT](http://cos.mit-license.org/)
99 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "commonjs": true,
5 | "es6": true
6 | },
7 | "globals": {
8 | "ENV": true
9 | },
10 | "extends": "eslint:recommended",
11 | "parserOptions": {
12 | "sourceType": "module"
13 | },
14 | "rules": {
15 | "accessor-pairs": "error",
16 | "array-bracket-spacing": [
17 | "error",
18 | "never"
19 | ],
20 | "array-callback-return": "error",
21 | "arrow-body-style": "error",
22 | "arrow-parens": [
23 | "error",
24 | "as-needed",
25 | {
26 | "requireForBlockBody": true
27 | }
28 | ],
29 | "arrow-spacing": [
30 | "error",
31 | {
32 | "after": true,
33 | "before": true
34 | }
35 | ],
36 | "block-scoped-var": "error",
37 | "block-spacing": "error",
38 | "brace-style": [
39 | "error",
40 | "1tbs"
41 | ],
42 | "callback-return": "error",
43 | "camelcase": "warn",
44 | "class-methods-use-this": "error",
45 | "comma-dangle": [
46 | "error",
47 | "only-multiline"
48 | ],
49 | "comma-spacing": "off",
50 | "comma-style": [
51 | "error",
52 | "last"
53 | ],
54 | "complexity": "error",
55 | "computed-property-spacing": [
56 | "error",
57 | "never"
58 | ],
59 | "consistent-return": "off",
60 | "consistent-this": "error",
61 | "curly": "off",
62 | "default-case": "error",
63 | "dot-location": "off",
64 | "dot-notation": "error",
65 | "eol-last": "off",
66 | "eqeqeq": "error",
67 | "func-call-spacing": "error",
68 | "func-names": [
69 | "error",
70 | "never"
71 | ],
72 | "func-style": [
73 | "off",
74 | "expression"
75 | ],
76 | "generator-star-spacing": "error",
77 | "global-require": "error",
78 | "guard-for-in": "off",
79 | "handle-callback-err": "error",
80 | "id-blacklist": "error",
81 | "id-length": "off",
82 | "id-match": "error",
83 | "indent": "off",
84 | "init-declarations": "error",
85 | "jsx-quotes": "error",
86 | "key-spacing": "error",
87 | "keyword-spacing": [
88 | "error",
89 | {
90 | "after": true,
91 | "before": true
92 | }
93 | ],
94 | "line-comment-position": "error",
95 | "linebreak-style": [
96 | "off"
97 | ],
98 | "lines-around-comment": "error",
99 | "lines-around-directive": "off",
100 | "max-depth": "error",
101 | "max-len": "off",
102 | "max-lines": "off",
103 | "max-nested-callbacks": "error",
104 | "max-params": "error",
105 | "max-statements": "off",
106 | "max-statements-per-line": "error",
107 | "multiline-ternary": "error",
108 | "new-parens": "error",
109 | "newline-after-var": "off",
110 | "newline-before-return": "off",
111 | "newline-per-chained-call": "error",
112 | "no-alert": "error",
113 | "no-array-constructor": "error",
114 | "no-bitwise": "error",
115 | "no-caller": "error",
116 | "no-catch-shadow": "error",
117 | "no-confusing-arrow": "error",
118 | "no-console": "off",
119 | "no-continue": "error",
120 | "no-div-regex": "error",
121 | "no-duplicate-imports": "error",
122 | "no-else-return": "off",
123 | "no-empty-function": "error",
124 | "no-eq-null": "error",
125 | "no-eval": "error",
126 | "no-extend-native": "error",
127 | "no-extra-bind": "error",
128 | "no-extra-label": "error",
129 | "no-extra-parens": "off",
130 | "no-floating-decimal": "error",
131 | "no-global-assign": "error",
132 | "no-implicit-globals": "error",
133 | "no-implied-eval": "error",
134 | "no-inline-comments": "error",
135 | "no-invalid-this": "off",
136 | "no-iterator": "error",
137 | "no-label-var": "error",
138 | "no-labels": "error",
139 | "no-lone-blocks": "error",
140 | "no-lonely-if": "error",
141 | "no-loop-func": "error",
142 | "no-magic-numbers": "off",
143 | "no-mixed-operators": "off",
144 | "no-mixed-requires": "error",
145 | "no-multi-spaces": "error",
146 | "no-multi-str": "error",
147 | "no-multiple-empty-lines": "error",
148 | "no-negated-condition": "error",
149 | "no-nested-ternary": "error",
150 | "no-new": "error",
151 | "no-new-func": "error",
152 | "no-new-object": "error",
153 | "no-new-require": "error",
154 | "no-new-wrappers": "error",
155 | "no-octal-escape": "error",
156 | "no-param-reassign": "off",
157 | "no-path-concat": "error",
158 | "no-plusplus": [
159 | "error",
160 | {
161 | "allowForLoopAfterthoughts": true
162 | }
163 | ],
164 | "no-process-env": "error",
165 | "no-process-exit": "error",
166 | "no-proto": "error",
167 | "no-prototype-builtins": "error",
168 | "no-restricted-globals": "error",
169 | "no-restricted-imports": "error",
170 | "no-restricted-modules": "error",
171 | "no-restricted-properties": "error",
172 | "no-restricted-syntax": "error",
173 | "no-return-assign": "error",
174 | "no-script-url": "error",
175 | "no-self-compare": "error",
176 | "no-sequences": "error",
177 | "no-shadow": "off",
178 | "no-shadow-restricted-names": "error",
179 | "no-spaced-func": "error",
180 | "no-sync": "error",
181 | "no-tabs": "off",
182 | "no-template-curly-in-string": "error",
183 | "no-ternary": "error",
184 | "no-throw-literal": "error",
185 | "no-trailing-spaces": "error",
186 | "no-undef-init": "error",
187 | "no-undefined": "error",
188 | "no-underscore-dangle": "off",
189 | "no-unmodified-loop-condition": "error",
190 | "no-unneeded-ternary": "error",
191 | "no-unsafe-negation": "error",
192 | "no-unused-expressions": "error",
193 | "no-use-before-define": "error",
194 | "no-useless-call": "error",
195 | "no-useless-computed-key": "error",
196 | "no-useless-concat": "error",
197 | "no-useless-constructor": "error",
198 | "no-useless-escape": "error",
199 | "no-useless-rename": "error",
200 | "no-var": "error",
201 | "no-void": "error",
202 | "no-warning-comments": "error",
203 | "no-whitespace-before-property": "error",
204 | "no-with": "error",
205 | "object-curly-newline": "off",
206 | "object-curly-spacing": [
207 | "off",
208 | "never"
209 | ],
210 | "object-property-newline": "off",
211 | "object-shorthand": "off",
212 | "one-var": "off",
213 | "one-var-declaration-per-line": "error",
214 | "operator-assignment": "error",
215 | "operator-linebreak": "error",
216 | "padded-blocks": "off",
217 | "prefer-arrow-callback": "error",
218 | "prefer-const": "off",
219 | "prefer-numeric-literals": "error",
220 | "prefer-reflect": "off",
221 | "prefer-rest-params": "error",
222 | "prefer-spread": "error",
223 | "prefer-template": "error",
224 | "quote-props": "off",
225 | "quotes": "off",
226 | "radix": "error",
227 | "require-jsdoc": "off",
228 | "rest-spread-spacing": [
229 | "error",
230 | "never"
231 | ],
232 | "semi": [
233 | "warn",
234 | "never"
235 | ],
236 | "semi-spacing": [
237 | "error",
238 | {
239 | "after": true,
240 | "before": false
241 | }
242 | ],
243 | "sort-imports": "off",
244 | "sort-keys": "off",
245 | "sort-vars": "off",
246 | "space-before-blocks": "error",
247 | "space-before-function-paren": "off",
248 | "space-in-parens": [
249 | "error",
250 | "never"
251 | ],
252 | "space-infix-ops": "error",
253 | "space-unary-ops": [
254 | "error",
255 | {
256 | "nonwords": false,
257 | "words": false
258 | }
259 | ],
260 | "spaced-comment": [
261 | "error",
262 | "always"
263 | ],
264 | "strict": "off",
265 | "symbol-description": "error",
266 | "template-curly-spacing": [
267 | "error",
268 | "never"
269 | ],
270 | "unicode-bom": [
271 | "error",
272 | "never"
273 | ],
274 | "valid-jsdoc": "error",
275 | "vars-on-top": "error",
276 | "wrap-iife": "error",
277 | "wrap-regex": "error",
278 | "yield-star-spacing": "error",
279 | "yoda": [
280 | "error",
281 | "never"
282 | ],
283 | }
284 | }
285 |
--------------------------------------------------------------------------------
/dist/blyde.min.js:
--------------------------------------------------------------------------------
1 | !function(){"use strict";function t(t){return t&&t.__esModule?t.default:t}function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){return t.call(window)}function r(t){t.empty()}function o(t){t.remove()}function i(t){t.safeRemove()}function u(){return re}var a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f=e(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),c=e(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),l=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},s=l,d=function(t,e,n){if(s(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},p=function(t){return"object"==typeof t?null!==t:"function"==typeof t},h=p,y=function(t){if(!h(t))throw TypeError(t+" is not an object!");return t},v=function(t){try{return!!t()}catch(t){return!0}},g=!v(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),m=p,b=f.document,w=m(b)&&m(b.createElement),$=function(t){return w?b.createElement(t):{}},S=!g&&!v(function(){return 7!=Object.defineProperty($("div"),"a",{get:function(){return 7}}).a}),O=p,E=function(t,e){if(!O(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!O(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!O(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!O(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},_=y,j=S,N=E,A=Object.defineProperty,C=g?Object.defineProperty:function(t,e,n){if(_(t),e=N(e,!0),_(n),j)try{return A(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t},L={f:C},x=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},P=L,M=x,T=g?function(t,e,n){return P.f(t,e,M(1,n))}:function(t,e,n){return t[e]=n,t},k=f,F=c,B=d,I=T,R="prototype",D=function(t,e,n){var r,o,i,u=t&D.F,a=t&D.G,f=t&D.S,c=t&D.P,l=t&D.B,s=t&D.W,d=a?F:F[e]||(F[e]={}),p=d[R],h=a?k:f?k[e]:(k[e]||{})[R];a&&(n=e);for(r in n)o=!u&&h&&void 0!==h[r],o&&r in d||(i=o?h[r]:n[r],d[r]=a&&"function"!=typeof h[r]?n[r]:l&&o?B(i,k):s&&h[r]==i?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e[R]=t[R],e}(i):c&&"function"==typeof i?B(Function.call,i):i,c&&((d.virtual||(d.virtual={}))[r]=i,t&D.R&&p&&!p[r]&&I(p,r,i)))};D.F=1,D.G=2,D.S=4,D.P=8,D.B=16,D.W=32,D.U=64,D.R=128;var q=D,W={}.hasOwnProperty,U=function(t,e){return W.call(t,e)},V={}.toString,G=function(t){return V.call(t).slice(8,-1)},J=G,z=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==J(t)?t.split(""):Object(t)},K=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},Y=z,H=K,Q=function(t){return Y(H(t))},X=Math.ceil,Z=Math.floor,tt=function(t){return isNaN(t=+t)?0:(t>0?Z:X)(t)},et=tt,nt=Math.min,rt=function(t){return t>0?nt(et(t),9007199254740991):0},ot=tt,it=Math.max,ut=Math.min,at=function(t,e){return t=ot(t),t<0?it(t+e,0):ut(t,e)},ft=Q,ct=rt,lt=at,st=function(t){return function(e,n,r){var o,i=ft(e),u=ct(i.length),a=lt(r,u);if(t&&n!=n){for(;u>a;)if(o=i[a++],o!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return!t&&-1}},dt=f,pt="__core-js_shared__",ht=dt[pt]||(dt[pt]={}),yt=function(t){return ht[t]||(ht[t]={})},vt=0,gt=Math.random(),mt=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++vt+gt).toString(36))},bt=yt("keys"),wt=mt,$t=function(t){return bt[t]||(bt[t]=wt(t))},St=U,Ot=Q,Et=st(!1),_t=$t("IE_PROTO"),jt=function(t,e){var n,r=Ot(t),o=0,i=[];for(n in r)n!=_t&&St(r,n)&&i.push(n);for(;e.length>o;)St(r,n=e[o++])&&(~Et(i,n)||i.push(n));return i},Nt="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),At=jt,Ct=Nt,Lt=Object.keys||function(t){return At(t,Ct)},xt=Object.getOwnPropertySymbols,Pt={f:xt},Mt={}.propertyIsEnumerable,Tt={f:Mt},kt=K,Ft=function(t){return Object(kt(t))},Bt=Lt,It=Pt,Rt=Tt,Dt=Ft,qt=z,Wt=Object.assign,Ut=!Wt||v(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=Wt({},t)[n]||Object.keys(Wt({},e)).join("")!=r})?function(t,e){for(var n=Dt(t),r=arguments.length,o=1,i=It.f,u=Rt.f;r>o;)for(var a,f=qt(arguments[o++]),c=i?Bt(f).concat(i(f)):Bt(f),l=c.length,s=0;l>s;)u.call(f,a=c[s++])&&(n[a]=f[a]);return n}:Wt,Vt=q;Vt(Vt.S+Vt.F,"Object",{assign:Ut});var Gt=c.Object.assign,Jt=e(function(t){t.exports={default:Gt,__esModule:!0}}),zt=t(Jt),Kt=e(function(t){!function(e,n){"function"==typeof define&&define.amd?define(n):"object"==typeof t&&t.exports?t.exports=n():e.log=n()}(a,function(){function t(t){return typeof console!==a&&(void 0!==console[t]?e(console,t):void 0!==console.log?e(console,"log"):u)}function e(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function n(t,e,n){return function(){typeof console!==a&&(r.call(this,e,n),this[t].apply(this,arguments))}}function r(t,e){for(var n=0;n=0&&e<=l.levels.SILENT))throw"log.setLevel() called with invalid level: "+e;if(c=e,n!==!1&&i(e),r.call(l,e,t),typeof console===a&&eu;)if(r[n=o[u++]]===e)return n},je=Lt,Ne=Pt,Ae=Tt,Ce=function(t){var e=je(t),n=Ne.f;if(n)for(var r,o=n(t),i=Ae.f,u=0;o.length>u;)i.call(t,r=o[u++])&&e.push(r);return e},Le=G,xe=Array.isArray||function(t){return"Array"==Le(t)},Pe=L,Me=y,Te=Lt,ke=g?Object.defineProperties:function(t,e){Me(t);for(var n,r=Te(e),o=r.length,i=0;o>i;)Pe.f(t,n=r[i++],e[n]);return t},Fe=f.document&&document.documentElement,Be=y,Ie=ke,Re=Nt,De=$t("IE_PROTO"),qe=function(){},We="prototype",Ue=function(){var t,e=$("iframe"),n=Re.length,r="<",o=">";for(e.style.display="none",Fe.appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(r+"script"+o+"document.F=Object"+r+"/script"+o),t.close(),Ue=t.F;n--;)delete Ue[We][Re[n]];return Ue()},Ve=Object.create||function(t,e){var n;return null!==t?(qe[We]=Be(t),n=new qe,qe[We]=null,n[De]=t):n=Ue(),void 0===e?n:Ie(n,e)},Ge=jt,Je=Nt.concat("length","prototype"),ze=Object.getOwnPropertyNames||function(t){return Ge(t,Je)},Ke={f:ze},Ye=Q,He=Ke.f,Qe={}.toString,Xe="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Ze=function(t){try{return He(t)}catch(t){return Xe.slice()}},tn=function(t){return Xe&&"[object Window]"==Qe.call(t)?Ze(t):He(Ye(t))},en={f:tn},nn=Tt,rn=x,on=Q,un=E,an=U,fn=S,cn=Object.getOwnPropertyDescriptor,ln=g?cn:function(t,e){if(t=on(t),e=un(e,!0),fn)try{return cn(t,e)}catch(t){}if(an(t,e))return rn(!nn.f.call(t,e),t[e])},sn={f:ln},dn=f,pn=U,hn=g,yn=q,vn=ae,gn=fe.KEY,mn=v,bn=yt,wn=pe,$n=mt,Sn=ce,On=ye,En=Se,_n=_e,jn=Ce,Nn=xe,An=y,Cn=Q,Ln=E,xn=x,Pn=Ve,Mn=en,Tn=sn,kn=L,Fn=Lt,Bn=Tn.f,In=kn.f,Rn=Mn.f,Dn=dn.Symbol,qn=dn.JSON,Wn=qn&&qn.stringify,Un="prototype",Vn=Sn("_hidden"),Gn=Sn("toPrimitive"),Jn={}.propertyIsEnumerable,zn=bn("symbol-registry"),Kn=bn("symbols"),Yn=bn("op-symbols"),Hn=Object[Un],Qn="function"==typeof Dn,Xn=dn.QObject,Zn=!Xn||!Xn[Un]||!Xn[Un].findChild,tr=hn&&mn(function(){return 7!=Pn(In({},"a",{get:function(){return In(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Bn(Hn,e);r&&delete Hn[e],In(t,e,n),r&&t!==Hn&&In(Hn,e,r)}:In,er=function(t){var e=Kn[t]=Pn(Dn[Un]);return e._k=t,e},nr=Qn&&"symbol"==typeof Dn.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof Dn},rr=function(t,e,n){return t===Hn&&rr(Yn,e,n),An(t),e=Ln(e,!0),An(n),pn(Kn,e)?(n.enumerable?(pn(t,Vn)&&t[Vn][e]&&(t[Vn][e]=!1),n=Pn(n,{enumerable:xn(0,!1)})):(pn(t,Vn)||In(t,Vn,xn(1,{})),t[Vn][e]=!0),tr(t,e,n)):In(t,e,n)},or=function(t,e){An(t);for(var n,r=jn(e=Cn(e)),o=0,i=r.length;i>o;)rr(t,n=r[o++],e[n]);return t},ir=function(t,e){return void 0===e?Pn(t):or(Pn(t),e)},ur=function(t){var e=Jn.call(this,t=Ln(t,!0));return!(this===Hn&&pn(Kn,t)&&!pn(Yn,t))&&(!(e||!pn(this,t)||!pn(Kn,t)||pn(this,Vn)&&this[Vn][t])||e)},ar=function(t,e){if(t=Cn(t),e=Ln(e,!0),t!==Hn||!pn(Kn,e)||pn(Yn,e)){var n=Bn(t,e);return!n||!pn(Kn,e)||pn(t,Vn)&&t[Vn][e]||(n.enumerable=!0),n}},fr=function(t){for(var e,n=Rn(Cn(t)),r=[],o=0;n.length>o;)pn(Kn,e=n[o++])||e==Vn||e==gn||r.push(e);return r},cr=function(t){for(var e,n=t===Hn,r=Rn(n?Yn:Cn(t)),o=[],i=0;r.length>i;)!pn(Kn,e=r[i++])||n&&!pn(Hn,e)||o.push(Kn[e]);return o};Qn||(Dn=function(){if(this instanceof Dn)throw TypeError("Symbol is not a constructor!");var t=$n(arguments.length>0?arguments[0]:void 0),e=function(n){this===Hn&&e.call(Yn,n),pn(this,Vn)&&pn(this[Vn],t)&&(this[Vn][t]=!1),tr(this,t,xn(1,n))};return hn&&Zn&&tr(Hn,t,{configurable:!0,set:e}),er(t)},vn(Dn[Un],"toString",function(){return this._k}),Tn.f=ar,kn.f=rr,Ke.f=Mn.f=fr,Tt.f=ur,Pt.f=cr,hn&&!ve&&vn(Hn,"propertyIsEnumerable",ur,!0),On.f=function(t){return er(Sn(t))}),yn(yn.G+yn.W+yn.F*!Qn,{Symbol:Dn});for(var lr="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),sr=0;lr.length>sr;)Sn(lr[sr++]);for(var lr=Fn(Sn.store),sr=0;lr.length>sr;)En(lr[sr++]);yn(yn.S+yn.F*!Qn,"Symbol",{for:function(t){return pn(zn,t+="")?zn[t]:zn[t]=Dn(t)},keyFor:function(t){if(nr(t))return _n(zn,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){Zn=!0},useSimple:function(){Zn=!1}}),yn(yn.S+yn.F*!Qn,"Object",{create:ir,defineProperty:rr,defineProperties:or,getOwnPropertyDescriptor:ar,getOwnPropertyNames:fr,getOwnPropertySymbols:cr}),qn&&yn(yn.S+yn.F*(!Qn||mn(function(){var t=Dn();return"[null]"!=Wn([t])||"{}"!=Wn({a:t})||"{}"!=Wn(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!nr(t)){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);return e=r[1],"function"==typeof e&&(n=e),!n&&Nn(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!nr(e))return e}),r[1]=e,Wn.apply(qn,r)}}}),Dn[Un][Gn]||T(Dn[Un],Gn,Dn[Un].valueOf),wn(Dn,"Symbol"),wn(Math,"Math",!0),wn(dn.JSON,"JSON",!0),Se("asyncIterator"),Se("observable");var dr=c.Symbol,pr=e(function(t){t.exports={default:dr,__esModule:!0}}),hr=t(pr),yr={},vr={node:{},list:{},blyde:{}},gr=function(){return hr(Math.floor(Math.random()*Math.pow(10,16)).toString(36))},mr=function t(e){ue(this,t),this.$el=e;for(var n in vr.node)vr.node[n]instanceof Function?this[n]=vr.node[n].bind(e):this[n]=vr.node[n];e.$id||Object.defineProperty(e,"$id",{value:gr()}),yr[e.$id]=this},br=function t(e){ue(this,t),this.$list=[];for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};$r(t(Sr),e)},Er=tt,_r=K,jr=function(t){return function(e,n){var r,o,i=String(_r(e)),u=Er(n),a=i.length;return u<0||u>=a?t?"":void 0:(r=i.charCodeAt(u),r<55296||r>56319||u+1===a||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):r:t?i.slice(u,u+2):(r-55296<<10)+(o-56320)+65536)}},Nr={},Ar=Ve,Cr=x,Lr=pe,xr={};T(xr,ce("iterator"),function(){return this});var Pr=function(t,e,n){t.prototype=Ar(xr,{next:Cr(1,n)}),Lr(t,e+" Iterator")},Mr=U,Tr=Ft,kr=$t("IE_PROTO"),Fr=Object.prototype,Br=Object.getPrototypeOf||function(t){return t=Tr(t),Mr(t,kr)?t[kr]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Fr:null},Ir=ve,Rr=q,Dr=ae,qr=T,Wr=U,Ur=Nr,Vr=Pr,Gr=pe,Jr=Br,zr=ce("iterator"),Kr=!([].keys&&"next"in[].keys()),Yr="@@iterator",Hr="keys",Qr="values",Xr=function(){return this},Zr=function(t,e,n,r,o,i,u){Vr(n,e,r);var a,f,c,l=function(t){if(!Kr&&t in h)return h[t];switch(t){case Hr:return function(){return new n(this,t)};case Qr:return function(){return new n(this,t)}}return function(){return new n(this,t)}},s=e+" Iterator",d=o==Qr,p=!1,h=t.prototype,y=h[zr]||h[Yr]||o&&h[o],v=y||l(o),g=o?d?l("entries"):v:void 0,m="Array"==e?h.entries||y:y;if(m&&(c=Jr(m.call(new t)),c!==Object.prototype&&(Gr(c,s,!0),Ir||Wr(c,zr)||qr(c,zr,Xr))),d&&y&&y.name!==Qr&&(p=!0,v=function(){return y.call(this)}),Ir&&!u||!Kr&&!p&&h[zr]||qr(h,zr,v),Ur[e]=v,Ur[s]=Xr,o)if(a={values:d?v:l(Qr),keys:i?v:l(Hr),entries:g},u)for(f in a)f in h||Dr(h,f,a[f]);else Rr(Rr.P+Rr.F*(Kr||p),e,a);return a},to=jr(!0);Zr(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=to(e,n),this._i+=t.length,{value:t,done:!1})});var eo=y,no=function(t,e,n,r){try{return r?e(eo(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&eo(o.call(t)),e}},ro=Nr,oo=ce("iterator"),io=Array.prototype,uo=function(t){return void 0!==t&&(ro.Array===t||io[oo]===t)},ao=L,fo=x,co=function(t,e,n){e in t?ao.f(t,e,fo(0,n)):t[e]=n},lo=G,so=ce("toStringTag"),po="Arguments"==lo(function(){return arguments}()),ho=function(t,e){try{return t[e]}catch(t){}},yo=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=ho(e=Object(t),so))?n:po?lo(e):"Object"==(r=lo(e))&&"function"==typeof e.callee?"Arguments":r},vo=yo,go=ce("iterator"),mo=Nr,bo=c.getIteratorMethod=function(t){if(void 0!=t)return t[go]||t["@@iterator"]||mo[vo(t)]},wo=ce("iterator"),$o=!1;try{var So=[7][wo]();So.return=function(){$o=!0},Array.from(So,function(){throw 2})}catch(t){}var Oo=function(t,e){if(!e&&!$o)return!1;var n=!1;try{var r=[7],o=r[wo]();o.next=function(){return{done:n=!0}},r[wo]=function(){return o},t(r)}catch(t){}return n},Eo=d,_o=q,jo=Ft,No=no,Ao=uo,Co=rt,Lo=co,xo=bo;_o(_o.S+_o.F*!Oo(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,r,o,i=jo(t),u="function"==typeof this?this:Array,a=arguments.length,f=a>1?arguments[1]:void 0,c=void 0!==f,l=0,s=xo(i);if(c&&(f=Eo(f,a>2?arguments[2]:void 0,2)),void 0==s||u==Array&&Ao(s))for(e=Co(i.length),n=new u(e);e>l;l++)Lo(n,l,c?f(i[l],l):i[l]);else for(o=s.call(i),n=new u;!(r=o.next()).done;l++)Lo(n,l,c?No(o,f,[r.value,l],!0):r.value);return n.length=l,n}});var Po=c.Array.from,Mo=e(function(t){t.exports={default:Po,__esModule:!0}}),To=e(function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=Mo,o=n(r);e.default=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e-1?n.splice(e,1):n.push(t)}),this.className=n.join(" ").trim(),this.$},replaceWith:function(t){t instanceof mr&&(t=t.$el);var e=this.parentNode;return e?(e.replaceChild(t,this),t.$):(te(this,"may not have been attached to document properly."),this.$)},swap:function(t){t instanceof mr&&(t=t.$el);var e=this.parentNode,n=t.parentNode,r=this.nextSibling,o=t.nextSibling;if(e&&n)return e.insertBefore(t,r),n.insertBefore(this,o),t.$;var i=[];return null===e&&i.push(this),null===n&&i.push(t),te.apply(void 0,i.concat(["may not have been attached to document properly."])),this.$},before:function(){function t(){var t=document.createDocumentFragment();for(r=e.length,o=Array(r),i=0;i=t.length?(this._t=void 0,Qo(1)):"keys"==e?Qo(0,n):"values"==e?Qo(0,t[n]):Qo(0,[n,t[n]])},"values");Xo.Arguments=Xo.Array,Ho("keys"),Ho("values"),Ho("entries");for(var ti=f,ei=T,ni=Nr,ri=ce("toStringTag"),oi=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],ii=0;ii<5;ii++){var ui=oi[ii],ai=ti[ui],fi=ai&&ai.prototype;fi&&!fi[ri]&&ei(fi,ri,ui),ni[ui]=ni.Array}var ci=ye.f("iterator"),li=e(function(t){t.exports={default:ci,__esModule:!0}}),si=e(function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=li,o=n(r),i=pr,u=n(i),a="function"==typeof u.default&&"symbol"==typeof o.default?function(t){return typeof t}:function(t){return t&&"function"==typeof u.default&&t.constructor===u.default&&t!==u.default.prototype?"symbol":typeof t};e.default="function"==typeof u.default&&"symbol"===a(o.default)?function(t){return"undefined"==typeof t?"undefined":a(t)}:function(t){return t&&"function"==typeof u.default&&t.constructor===u.default&&t!==u.default.prototype?"symbol":"undefined"==typeof t?"undefined":a(t)}}),di=t(si),pi=y,hi=bo,yi=c.getIterator=function(t){var e=hi(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return pi(e.call(t))},vi=yi,gi=e(function(t){t.exports={default:vi,__esModule:!0}}),mi=t(gi),bi={},wi=function(t){function e(){function e(e){e.call(r,t)===!1&&(o=!0)}var r=a.value;if(bi[n.$id][r.$id][t.type]){var o=!1;if(bi[n.$id][r.$id][t.type].forEach(e),o)return{v:void 0}}}var n=this,r=[];if(t.path.forEach(function(t){bi[n.$id][t.$id]&&r.push(t)}),0!==r.length){var o=!0,i=!1,u=void 0;try{for(var a,f=e,c=mi(r);!(o=(a=c.next()).done);o=!0){var l=f();if("object"===("undefined"==typeof l?"undefined":di(l)))return l.v}}catch(t){i=!0,u=t}finally{try{!o&&c.return&&c.return()}finally{if(i)throw u}}}},$i={on:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t.split(" ");return"function"==typeof e?(o.forEach(function(t){return n.addEventListener(t,e,r)}),this.$):void Zt(e,"is not a function!")},listen:function(t,e,n){var r=this;e=e instanceof mr?e.$el:e.$.$el;var o=t.split(" ");return"function"==typeof n?(o.forEach(function(t){""!==t&&(bi[r.$id]||(bi[r.$id]={}),bi[r.$id][e.$id]||(r.addEventListener(t,wi,!0),bi[r.$id][e.$id]={}),bi[r.$id][e.$id][t]||(bi[r.$id][e.$id][t]=[]),bi[r.$id][e.$id][t].push(n))}),this.$):void Zt(n,"is not a function!")},at:function(t,e){return $i.listen.call(window,t,this,e),this.$},drop:function(t,e,n){var r=this;e=e instanceof mr?e.$el:e.$.$el;var o=t.split(" ");return"function"==typeof n?(bi[this.$id]&&bi[this.$id][e.$id]&&o.forEach(function(t){if(""!==t&&bi[r.$id][e.$id][t]){var o=bi[r.$id][e.$id][t];o.splice(o.indexOf(n),1),0===bi[r.$id][e.$id][t].length&&(delete bi[r.$id][e.$id][t],function(){for(var e in bi[r.$id])if(bi[r.$id][e][t])return!1;return!0}()&&r.removeEventListener(t,wi,!0),0===zo(bi[r.$id][e.$id]).length&&(delete bi[r.$id][e.$id],0===zo(bi[r.$id]).length&&delete bi[r.$id]))}}),this.$):void Zt(n,"is not a function!")},off:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t.split(" ");return"function"==typeof e?(o.forEach(function(t){n.removeEventListener(t,e,r),$i.drop.call(window,t,n,e)}),this.$):void Zt(e,"is not a function!")},trigger:function(t,e){return"string"==typeof t&&(t=new Event(t,e)),this.dispatchEvent(t),this.$}},Si=!1,Oi=function(t){function e(){for(var e=arguments.length,n=Array(e),r=0;r