Fix bugs and adjust style (#136)

Recovery content
Refactor methods
Changes arrow icons
Add keywords
Add more align types
This commit is contained in:
weryques 2018-10-25 17:15:46 -03:00
parent 2890914451
commit 75e6d691d3
6 changed files with 450 additions and 340 deletions

425
package-lock.json generated
View File

@ -5676,13 +5676,22 @@
} }
}, },
"md5.js": { "md5.js": {
"version": "1.3.4", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
"integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==",
"dev": true, "dev": true,
"requires": { "requires": {
"hash-base": "^3.0.0", "hash-base": "^3.0.0",
"inherits": "^2.0.1" "inherits": "^2.0.1",
"safe-buffer": "^5.1.2"
},
"dependencies": {
"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
}
} }
}, },
"mdi": { "mdi": {
@ -6921,16 +6930,25 @@
"integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ=="
}, },
"public-encrypt": { "public-encrypt": {
"version": "4.0.2", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz",
"integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"bn.js": "^4.1.0", "bn.js": "^4.1.0",
"browserify-rsa": "^4.0.0", "browserify-rsa": "^4.0.0",
"create-hash": "^1.1.0", "create-hash": "^1.1.0",
"parse-asn1": "^5.0.0", "parse-asn1": "^5.0.0",
"randombytes": "^2.0.1" "randombytes": "^2.0.1",
"safe-buffer": "^5.1.2"
},
"dependencies": {
"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
}
} }
}, },
"pump": { "pump": {
@ -7563,9 +7581,9 @@
} }
}, },
"schema-utils": { "schema-utils": {
"version": "0.4.5", "version": "0.4.7",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz",
"integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ajv": "^6.1.0", "ajv": "^6.1.0",
@ -7573,21 +7591,27 @@
}, },
"dependencies": { "dependencies": {
"ajv": { "ajv": {
"version": "6.4.0", "version": "6.5.4",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz",
"integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==",
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^1.0.0", "fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0", "json-schema-traverse": "^0.4.1",
"uri-js": "^3.0.2" "uri-js": "^4.2.2"
} }
}, },
"ajv-keywords": { "fast-deep-equal": {
"version": "3.1.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.1.0.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-rCsnk5xUPpXSwG5/f1wnvkqlQ74=", "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
"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 "dev": true
} }
} }
@ -8003,6 +8027,24 @@
"urix": "^0.1.0" "urix": "^0.1.0"
} }
}, },
"source-map-support": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz",
"integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"source-map-url": { "source-map-url": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
@ -8480,6 +8522,153 @@
"inherits": "2" "inherits": "2"
} }
}, },
"terser": {
"version": "3.10.2",
"resolved": "https://registry.npmjs.org/terser/-/terser-3.10.2.tgz",
"integrity": "sha512-+QrFoqBImmsQGB4c/HvaqgZynmbNvNBwoBxuu7fYXtq5EEtlLUzph+WimDj+xMkuqawXPMl2lgCIz81CdXvt+w==",
"dev": true,
"requires": {
"commander": "~2.17.1",
"source-map": "~0.6.1",
"source-map-support": "~0.5.6"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"terser-webpack-plugin": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz",
"integrity": "sha512-61lV0DSxMAZ8AyZG7/A4a3UPlrbOBo8NIQ4tJzLPAdGOQ+yoNC7l5ijEow27lBAL2humer01KLS6bGIMYQxKoA==",
"dev": true,
"requires": {
"cacache": "^11.0.2",
"find-cache-dir": "^2.0.0",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.4.0",
"source-map": "^0.6.1",
"terser": "^3.8.1",
"webpack-sources": "^1.1.0",
"worker-farm": "^1.5.2"
},
"dependencies": {
"ajv": {
"version": "6.5.4",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz",
"integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==",
"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"
}
},
"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
},
"find-cache-dir": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.0.0.tgz",
"integrity": "sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA==",
"dev": true,
"requires": {
"commondir": "^1.0.1",
"make-dir": "^1.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"
}
},
"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
},
"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-limit": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz",
"integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==",
"dev": true,
"requires": {
"p-try": "^2.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"
}
},
"p-try": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz",
"integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==",
"dev": true
},
"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"
}
},
"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"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"text-table": { "text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -8675,167 +8864,6 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true "dev": true
}, },
"uglify-js": {
"version": "3.4.9",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz",
"integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==",
"dev": true,
"requires": {
"commander": "~2.17.1",
"source-map": "~0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"uglifyjs-webpack-plugin": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.0.1.tgz",
"integrity": "sha512-1HhCHkOB6wRCcv7htcz1QRPVbWPEY074RP9vzt/X0LF4xXm9l4YGd0qja7z88abDixQlnVwBjXsTBs+Xsn/eeQ==",
"dev": true,
"requires": {
"cacache": "^11.2.0",
"find-cache-dir": "^2.0.0",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.4.0",
"source-map": "^0.6.1",
"uglify-js": "^3.0.0",
"webpack-sources": "^1.1.0",
"worker-farm": "^1.5.2"
},
"dependencies": {
"ajv": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz",
"integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==",
"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"
}
},
"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
},
"find-cache-dir": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.0.0.tgz",
"integrity": "sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA==",
"dev": true,
"requires": {
"commondir": "^1.0.1",
"make-dir": "^1.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"
}
},
"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
},
"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-limit": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz",
"integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==",
"dev": true,
"requires": {
"p-try": "^2.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"
}
},
"p-try": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz",
"integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==",
"dev": true
},
"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"
}
},
"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
},
"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"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"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"
}
}
}
},
"unicode-canonical-property-names-ecmascript": { "unicode-canonical-property-names-ecmascript": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
@ -8976,18 +9004,18 @@
"dev": true "dev": true
}, },
"uri-js": { "uri-js": {
"version": "3.0.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-3.0.2.tgz", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
"integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"punycode": "^2.1.0" "punycode": "^2.1.0"
}, },
"dependencies": { "dependencies": {
"punycode": { "punycode": {
"version": "2.1.0", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"dev": true "dev": true
} }
} }
@ -9299,9 +9327,9 @@
} }
}, },
"webpack": { "webpack": {
"version": "4.20.2", "version": "4.22.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.20.2.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.22.0.tgz",
"integrity": "sha512-75WFUMblcWYcocjSLlXCb71QuGyH7egdBZu50FtBGl2Nso8CK3Ej+J7bTZz2FPFq5l6fzCisD9modB7t30ikuA==", "integrity": "sha512-2+3EYFqyhPl12buLQ42QPHEEh8BHn3P9ipRvGRHhdfKJ1u9svhZ3QjhIoEdL5SeIhL5gfOZVbBnartYEabkEsg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@webassemblyjs/ast": "1.7.8", "@webassemblyjs/ast": "1.7.8",
@ -9409,12 +9437,6 @@
"once": "^1.3.1" "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
},
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@ -9456,15 +9478,6 @@
"worker-farm": "^1.5.2" "worker-farm": "^1.5.2"
} }
}, },
"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"
}
},
"webpack-sources": { "webpack-sources": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz",

View File

@ -1,16 +1,21 @@
.wp-block-tainacan-collections-carousel { .wp-block-tainacan-collections-carousel {
min-height: 200px; } min-height: 200px; }
.wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item { .wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item {
display: flex; display: flex; }
margin-top: 20px; }
.wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item .wp-block-tainacan-collections-carousel__carousel-item-first { .wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item .wp-block-tainacan-collections-carousel__carousel-item-first {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
align-content: start; } align-content: start; }
.wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item .wp-block-tainacan-collections-carousel__carousel-item-first img {
padding: 0 !important;
max-width: 100% !important; }
.wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item .wp-block-tainacan-collections-carousel__carousel-item-others { .wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item .wp-block-tainacan-collections-carousel__carousel-item-others {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; } align-items: flex-end; }
.wp-block-tainacan-collections-carousel .wp-block-tainacan-collections-carousel__carousel-item .wp-block-tainacan-collections-carousel__carousel-item-others img {
padding: 0 !important;
max-width: 100% !important; }
.components-modal__frame { .components-modal__frame {
width: 100%; } width: 100%; }

View File

@ -1,6 +1,6 @@
{ {
"version": 3, "version": 3,
"mappings": "AAAA,uCAAwC;EACtC,UAAU,EAAE,KAAK;EAEjB,8FAAuD;IACrD,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAEhB,2JAA6D;MAC3D,OAAO,EAAE,IAAI;MACb,WAAW,EAAE,UAAU;MACvB,aAAa,EAAE,KAAK;IAGtB,4JAA8D;MAC5D,OAAO,EAAE,IAAI;MACb,cAAc,EAAE,MAAM;MACtB,WAAW,EAAE,QAAQ;;AAK3B,wBAAyB;EACvB,KAAK,EAAE,IAAI;;AAGb,iBAAkB;EAChB,QAAQ,EAAE,MAAM;EAChB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,IAAI;EACb,iBAAiB,EAAE,MAAM;EACzB,cAAc,EAAE,MAAM;EACtB,WAAW,EAAE,MAAM;;AAGrB,mDAAoD;EAClD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AAe;EACtB,SAAS,EAAE,eAAe;EAC1B,UAAU,EAAE,eAAe;;AAG7B,qDAAsD;EACpD,MAAM,EAAE,OAAO;;AAGjB,mCAAoC;EAClC,QAAQ,EAAE,QAAQ;EAClB,GAAG,EAAE,CAAC;EACN,MAAM,EAAE,CAAC;EACT,IAAI,EAAE,CAAC;EACP,KAAK,EAAE,CAAC;EACR,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,WAAW;EACpB,OAAO,EAAE,IAAI;EACb,gBAAgB,EAAE,MAAM;EACxB,aAAa,EAAE,MAAM;EACrB,eAAe,EAAE,MAAM;EACvB,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,iBAAiB",
"sources": ["../../gutenberg-blocks/tainacan-collections/collections-carousel/collections-carousel.scss"], "sources": ["../../gutenberg-blocks/tainacan-collections/collections-carousel/collections-carousel.scss"],
"names": [], "names": [],
"file": "tainacan-gutenberg-blocks-style.css" "file": "tainacan-gutenberg-blocks-style.css"

View File

@ -26,7 +26,7 @@ class GutenbergBlock {
add_action('init', array($this, 'add_plugin_settings')); add_action('init', array($this, 'add_plugin_settings'));
add_action('wp_enqueue_scripts', array($this, 'enqueue_on_theme')); add_action('wp_enqueue_scripts', array($this, 'enqueue_on_theme'));
add_filter( 'block_categories', array($this, 'register_tainacan_block_categories'), 10, 2 ); add_filter('block_categories', array($this, 'register_tainacan_block_categories'), 10, 2);
} }
public function register_tainacan_block_categories($categories, $post){ public function register_tainacan_block_categories($categories, $post){

View File

@ -3,18 +3,27 @@
.wp-block-tainacan-collections-carousel__carousel-item { .wp-block-tainacan-collections-carousel__carousel-item {
display: flex; display: flex;
margin-top: 20px;
.wp-block-tainacan-collections-carousel__carousel-item-first { .wp-block-tainacan-collections-carousel__carousel-item-first {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
align-content: start; align-content: start;
img {
padding: 0 !important;
max-width: 100% !important;
}
} }
.wp-block-tainacan-collections-carousel__carousel-item-others { .wp-block-tainacan-collections-carousel__carousel-item-others {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
img {
padding: 0 !important;
max-width: 100% !important;
}
} }
} }
} }

View File

@ -2,13 +2,11 @@ import Carousel from '@brainhubeu/react-carousel';
const { registerBlockType } = wp.blocks; const { registerBlockType } = wp.blocks;
const { Modal, Button, Autocomplete } = wp.components; const { Modal, Button, IconButton } = wp.components;
const { __ } = wp.i18n;
const { RichText } = wp.editor; const { RichText } = wp.editor;
const createHTML = wp.element.createElement; const { __ } = wp.i18n;
import tainacan from '../../api-client/axios.js'; import tainacan from '../../api-client/axios.js';
@ -16,7 +14,6 @@ registerBlockType('tainacan/collections-carousel', {
title: 'Tainacan Collections Carousel', title: 'Tainacan Collections Carousel',
icon: 'images-alt', icon: 'images-alt',
category: 'tainacan-blocks', category: 'tainacan-blocks',
supportHTML: true,
attributes: { attributes: {
isOpen: { isOpen: {
type: Boolean, type: Boolean,
@ -27,12 +24,7 @@ registerBlockType('tainacan/collections-carousel', {
default: [] default: []
}, },
selectedCollections: { selectedCollections: {
type: 'array', type: Array,
source: 'query',
selector: 'div',
query: {
dataValue: { source: 'attribute', attribute: 'content'},
},
default: [] default: []
}, },
items: { items: {
@ -40,7 +32,14 @@ registerBlockType('tainacan/collections-carousel', {
source: 'query', source: 'query',
selector: 'picture', selector: 'picture',
query: { query: {
style: { source: 'attribute', attribute: 'style'}, style: {
source: 'attribute',
attribute: 'style'
},
collection_id: {
source: 'attribute',
attribute: 'class'
},
img: { img: {
source: 'query', source: 'query',
selector: 'img', selector: 'img',
@ -59,35 +58,61 @@ registerBlockType('tainacan/collections-carousel', {
default: [], default: [],
}, },
contentTemp: { contentTemp: {
type: 'array', type: Array,
source: 'html',
selector: 'div',
default: [], default: [],
}, },
content: { content: {
type: 'array', type: 'array',
source: 'children', source: 'children',
selector: 'div' selector: 'div'
} },
}, },
supports: { supports: {
align: ['full'] align: ['full', 'left', 'right', 'wide'],
html: false
}, },
keywords: [__('tainacan', 'tainacan'), __('carousel', 'tainacan'), __('collections', 'tainacan')],
edit({ attributes, setAttributes, className }) { edit({ attributes, setAttributes, className }) {
console.log('edit', attributes); console.log('edit', attributes);
let { contentTemp, collectionsMatched, selectedCollections, items, isOpen } = attributes; let { contentTemp, collectionsMatched, selectedCollections, items, isOpen, content } = attributes;
let isInEdit = true;
const arrowRight = (
<span style={{cursor: 'pointer'}}>
<svg style={{width: '48px', height: '48px'}} viewBox="0 0 24 24">
<path fill="#298596" d="M10,17L15,12L10,7V17Z"/>
</svg>
</span>
);
const arrowLeft = (
<span style={{ cursor: 'pointer' }}>
<svg style={{width: '48px', height: '48px'}} viewBox="0 0 24 24">
<path fill="#298596" d="M14,7L9,12L14,17V7Z" />
</svg>
</span>
);
function prepareCollection(collection) { function prepareCollection(collection) {
return (<div key={ collection.id } content={collection} />); return (
<input style={{display: 'none'}} key={ collection.id } value={collection} />
);
} }
function prepareItem(item, style) { function prepareItem(item, style, collectionName) {
return ( return (
<picture style={style}> <picture
className={`${item.collection_id.split('{}')[0]}{}${collectionName}`}
style={style}>
<img <img
src={item.thumbnail.thumb ? item.thumbnail.thumb : `${tainacan_plugin.base_url}/admin/images/placeholder_square.png`} src={
alt={item.title} /> (item.thumbnail && item.thumbnail.thumb) ?
item.thumbnail.thumb :
( (item.img && item.img[0].src) ?
item.img[0].src : `${tainacan_plugin.base_url}/admin/images/placeholder_square.png`)
}
alt={ item.title ? item.title : item.alt } />
</picture> </picture>
); );
} }
@ -97,8 +122,6 @@ registerBlockType('tainacan/collections-carousel', {
return tainacan.get(`/collection/${collectionID}/items?perpage=3&paged=1&orderby=date`) return tainacan.get(`/collection/${collectionID}/items?perpage=3&paged=1&orderby=date`)
.then(response => { .then(response => {
console.log(response.data);
return response.data; return response.data;
}) })
.catch(error => { .catch(error => {
@ -106,141 +129,200 @@ registerBlockType('tainacan/collections-carousel', {
}); });
} }
function prepareContent(content, items, setAttributes, collection){ function updateContent(contentTemp){
content.push( setAttributes({
<div> content: contentTemp.length ?
<div style={{display: 'flex', flexDirection: 'column', marginRight: '20px'}}> (<div>
<div <Carousel
className={`${className}__carousel-item`} arrowLeft={arrowLeft}
key={collection.id}> arrowRight={arrowRight}
addArrowClickHandler
slidesPerScroll={1}
slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length}
arrows
slides={contentTemp}/>
</div>) : []
});
}
function removeCollection(collectionID) {
let index = contentTemp.findIndex((coll) => {
return coll.key == collectionID;
});
if(index >= 0){
contentTemp.splice(index, 1);
setAttributes({contentTemp: contentTemp});
updateContent(contentTemp);
}
}
function prepareContent(newContent, items, collection){
newContent.push(
<div key={collection.id}>
<div style={{
display: 'flex',
flexDirection: 'column',
marginLeft: '20px'}}>
{ isInEdit ? (
<IconButton
style={{position: 'absolute'}}
label={ __('Remove', 'tainacan') }
onClick={() => {
console.log('clicked', collection.id);
removeCollection(collection.id);
}}
icon="trash"/>
) : null }
<div className={`${className}__carousel-item`}>
<div style={{width: '99px', marginRight: '3px'}} className={`${className}__carousel-item-first`}> <div style={{width: '99px', marginRight: '3px'}} className={`${className}__carousel-item-first`}>
{items[0] ? prepareItem(items[0]) : null} {items[0] ? prepareItem(items[0], null, collection.name) : null}
</div> </div>
<div className={`${className}__carousel-item-others`}> <div className={`${className}__carousel-item-others`}>
{items[1] ? prepareItem(items[1], {width: '42px', height: '42px', marginBottom: '3px'}) : null} {items[1] ? prepareItem(items[1], {width: '42px', height: '42px', marginBottom: '3px'}, collection.name) : null}
{items[2] ? prepareItem(items[2], {width: '42px', height: '42px'}) : null} {items[2] ? prepareItem(items[2], {width: '42px', height: '42px'}, collection.name) : null}
</div> </div>
</div> </div>
<small> <small style={{
<b>{collection.name}</b> maxWidth: '130px',
marginLeft: '10px'}}>
<p style={{
fontSize: '10px',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
fontWeight: '600'
}}>{collection.name}</p>
</small> </small>
</div> </div>
</div> </div>
); );
setAttributes({ contentTemp: content }); setAttributes({ contentTemp: newContent });
} }
const autoCompleters = [ if(content && content.length && content[0].type && !contentTemp.length){
{ let itemsTemp = [];
name: __('Collections', 'tainacan'), let a = 0;
triggerPrefix: '/', let index = 0;
options(keyword) {
if (!keyword) { for(let item of items) {
return []; if(a <= 2) {
if(itemsTemp.length && item.collection_id.split('{}')[0] === itemsTemp[itemsTemp.length-1].collection_id.split('{}')[0]) {
itemsTemp.push(item);
} else if(!itemsTemp.length) {
itemsTemp.push(item);
if (items[index + 1] && item.collection_id.split('{}')[0] !== items[index + 1].collection_id.split('{}')[0]) {
a = 2;
}
} }
}
return tainacan.get(`/collections?search=${keyword}`) let b = false;
.then(response => { if (a === 2) {
console.log(response); a = 0;
return response.data; b = true;
})
.catch(error => {
console.log(error);
});
},
getOptionLabel(option) {
return (<span>{option.name}</span>);
},
getOptionKeywords(option) {
collectionsMatched.push(option.name);
return collectionsMatched; prepareContent(contentTemp, itemsTemp, {
}, name: itemsTemp[0].collection_id.split('{}')[1],
getOptionCompletion(option) { id: itemsTemp[0].collection_id.split('{}')[0]
selectedCollections.push(prepareCollection(option));
getTop3ItemsOf(option).then((res) => {
res.map((item) => {
items.push(prepareItem(item))
});
prepareContent(contentTemp, res, setAttributes, option);
setAttributes({ items: items });
}); });
setAttributes({ selectedCollections: selectedCollections }); itemsTemp = [];
}
return (<abbr title={option.name}>{` | ${option.name} `}</abbr>); index++;
},
isDebounced: true, if(!b) {
a++;
}
} }
]; }
const autocompleters = [{
name: __('Collections', 'tainacan'),
triggerPrefix: '/',
options(keyword) {
if (!keyword) {
return [];
}
return tainacan.get(`/collections?search=${keyword}`)
.then(response => {
console.log(response);
return response.data;
})
.catch(error => {
console.log(error);
});
},
getOptionLabel(option) {
return (<span>{option.name}</span>);
},
getOptionKeywords(option) {
collectionsMatched.push(option.name);
return collectionsMatched;
},
getOptionCompletion(option) {
selectedCollections.push(prepareCollection(option));
getTop3ItemsOf(option).then((res) => {
res.map((item) => {
items.push(prepareItem(item))
});
prepareContent(contentTemp, res, option);
setAttributes({items: items});
});
setAttributes({selectedCollections: selectedCollections});
return (<abbr title={option.name}>{` | ${option.name} `}</abbr>);
},
isDebounced: true,
}];
return ( return (
<div className={ className }> <div className={ className }>
<Button isDefault onClick={ () => setAttributes( { isOpen: true } ) }>{ __('Add collection', 'tainacan') }</Button> <div style={{marginBottom: '20px'}}>
<Button isDefault onClick={ () => setAttributes( { isOpen: true } ) }>{ __('Add collection', 'tainacan') }</Button>
</div>
{ isOpen ? { isOpen ?
<Modal <Modal
shouldCloseOnClickOutside={ false } shouldCloseOnClickOutside={ false }
shouldCloneOnEsc={false}
focusOnMount={false}
title={ __('Add collection', 'tainacan') } title={ __('Add collection', 'tainacan') }
onRequestClose={ () => { onRequestClose={ () => {
setAttributes({
content: (
<div>
{ contentTemp.length ?
<Carousel
slidesPerScroll={1}
slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length}
arrows
slides={contentTemp}/> : null
}
</div>
)});
setAttributes( { isOpen: false } ); setAttributes( { isOpen: false } );
updateContent(contentTemp);
}}> }}>
<div> <div>
<Autocomplete completers={ autoCompleters }> <RichText
{ ( { isExpanded, listBoxId, activeId } ) => ( onChange={() => true}
<div tagName="p"
contentEditable autocompleters={autocompleters}
suppressContentEditableWarning />
aria-autocomplete="list" <p>{ __('Type '+ autocompleters[0].triggerPrefix +' for triggering the autocomplete.', 'tainacan') }</p>
aria-expanded={ isExpanded }
aria-owns={ listBoxId }
aria-activedescendant={ activeId }
>
</div>
) }
</Autocomplete>
<p>{ __('Type '+ autoCompleters[0].triggerPrefix +' for triggering the autocomplete.', 'tainacan') }</p>
</div> </div>
<Button isDefault onClick={ () => { <div>
setAttributes({ <Button isDefault onClick={ () => {
content: ( setAttributes( { isOpen: false } );
<div> updateContent(contentTemp);
{ contentTemp.length ? } }>
<Carousel { __('Close', 'tainacan') }
slidesPerScroll={1} </Button>
slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length} </div>
arrows
slides={contentTemp}/> : null
}
</div>
)});
setAttributes( { isOpen: false } );
} }>
{ __('Close', 'tainacan') }
</Button>
</Modal> </Modal>
: null : null
} }
@ -248,6 +330,9 @@ registerBlockType('tainacan/collections-carousel', {
<div> <div>
{ contentTemp.length ? { contentTemp.length ?
<Carousel <Carousel
arrowLeft={arrowLeft}
arrowRight={arrowRight}
addArrowClickHandler
slidesPerScroll={1} slidesPerScroll={1}
slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length} slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length}
arrows arrows
@ -258,12 +343,10 @@ registerBlockType('tainacan/collections-carousel', {
); );
}, },
save({ attributes }) { save({ attributes }) {
const { content, items } = attributes; console.log('save', attributes);
console.log('save', attributes, items); const { content } = attributes;
console.info(content); return <div>{content}</div>
return <div>{ content }</div>
}, },
}); });