koffing 0.1.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Makefile +21 -0
- package/README.md +181 -4
- package/build/asset-manifest.json +22 -0
- package/build/favicon.png +0 -0
- package/build/index.html +1 -0
- package/build/precache-manifest.5382b78dea2866c8a94cee003da35d84.js +26 -0
- package/build/robots.txt +3 -0
- package/build/service-worker.js +39 -0
- package/build/static/css/main.102b9840.chunk.css +2 -0
- package/build/static/css/main.102b9840.chunk.css.map +1 -0
- package/build/static/js/2.4b3dd85a.chunk.js +3 -0
- package/build/static/js/2.4b3dd85a.chunk.js.LICENSE.txt +67 -0
- package/build/static/js/2.4b3dd85a.chunk.js.map +1 -0
- package/build/static/js/main.07f66bec.chunk.js +2 -0
- package/build/static/js/main.07f66bec.chunk.js.map +1 -0
- package/build/static/js/runtime-main.525bb0ff.js +2 -0
- package/build/static/js/runtime-main.525bb0ff.js.map +1 -0
- package/package.json +42 -30
- package/public/favicon.png +0 -0
- package/public/index.html +30 -0
- package/public/robots.txt +3 -0
- package/src/App.test.js +9 -0
- package/src/components/App.js +18 -0
- package/src/components/AppFooter/AppFooter.css.js +12 -0
- package/src/components/AppFooter/AppFooter.js +31 -0
- package/src/components/AppFooter/index.js +3 -0
- package/src/components/AppHeader/AppHeader.css.js +21 -0
- package/src/components/AppHeader/AppHeader.js +34 -0
- package/src/components/AppHeader/index.js +3 -0
- package/src/components/Board/Board.css.js +21 -0
- package/src/components/Board/Board.js +110 -0
- package/src/components/Board/index.js +3 -0
- package/src/components/BoardInput/BoardInput.css.js +14 -0
- package/src/components/BoardInput/BoardInput.js +36 -0
- package/src/components/BoardInput/index.js +3 -0
- package/src/components/BoardOutput/BoardOutput.css.js +17 -0
- package/src/components/BoardOutput/BoardOutput.js +36 -0
- package/src/components/BoardOutput/index.js +3 -0
- package/src/components/Code/Code.css.js +10 -0
- package/src/components/Code/Code.js +28 -0
- package/src/components/Code/index.js +3 -0
- package/src/components/StyledComponent.js +24 -0
- package/src/components/ThemedApp.js +25 -0
- package/src/core/Koffing.js +71 -0
- package/src/core/Pokemon.js +181 -0
- package/src/core/PokemonTeam.js +78 -0
- package/src/core/PokemonTeamSet.js +52 -0
- package/src/core/ShowdownParser.js +280 -0
- package/src/core/index.js +7 -0
- package/src/img/koffing-shiny.png +0 -0
- package/src/img/koffing.png +0 -0
- package/src/index.css +42 -0
- package/src/index.js +15 -53
- package/src/serviceWorker.js +141 -0
- package/src/setupTests.js +5 -0
- package/src/teams/example.koffing.js +25 -0
- package/src/tools/base64.js +25 -0
- package/src/tools/history.js +17 -0
- package/src/tools/index.js +4 -0
- package/src/variables.json +5 -0
- package/.babelrc +0 -6
- package/.editorconfig +0 -13
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/smogon-parser.iml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/workspace.xml +0 -792
- package/dist/koffing.js +0 -1
- package/src/Parser.js +0 -131
- package/src/Pokemon.js +0 -24
- package/src/Set.js +0 -15
- package/src/Team.js +0 -21
- package/webpack.config-docs.js +0 -30
- package/webpack.config.js +0 -25
package/dist/koffing.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t=n();for(var i in t)("object"==typeof exports?exports:e)[i]=t[i]}}(window,function(){return function(e){var n={};function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=4)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(n,t,i){return t&&e(n.prototype,t),i&&e(n,i),n}}();var r=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=n,this.nickname=void 0,this.gender=void 0,this.item=void 0,this.ability=void 0,this.level=void 0,this.shiny=void 0,this.happiness=void 0,this.evs=void 0,this.ivs=void 0,this.nature=void 0,this.moves=[]}return i(e,[{key:"toString",value:function(){return this.name}}]),e}();n.default=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(n,t,i){return t&&e(n.prototype,t),i&&e(n,i),n}}();var r=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=n,this.format=t,this.pokemon=i}return i(e,[{key:"toString",value:function(){var e="=== ["+this.format+"] "+this.name+" ===\n\n";return(e+=this.pokemon.map(function(e){return e.toString()}).join("\n\n")).trim()}}]),e}();n.default=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(n,t,i){return t&&e(n.prototype,t),i&&e(n,i),n}}();var r=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.teams=n}return i(e,[{key:"toString",value:function(){return this.teams.map(function(e){return e.toString()}).join("\n\n").trim()}}]),e}();n.default=r},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=a(t(1)),r=a(t(0)),o=a(t(2));function a(e){return e&&e.__esModule?e:{default:e}}var u={team:/^=== \[(.*)\] (.*) ===$/,gender:/ \((F|M)\)/i,item:/ @ (.*)$/i,name:/^([^()@]{2,})/i,nickname_name:/^(.*) \(([^()]{2,})\) /i,ability:/^Ability: (.*)$/i,level:/^Level: ([0-9]{1,3})$/i,shiny:/^Shiny: (Yes|No)$/i,happiness:/^Happiness: ([0-9]{1,3})$/i,eivs:/^([EI]Vs): (.*)$/i,eivs_value:/^([0-9]+)\s{1,}(hp|atk|def|spa|spd|spe)$/i,nature:/^(.*) Nature$/,move:/^- (.*)$/i,is:function(e,n){return!!e.match(this[n])},get:function(e,n){return this[n].exec(e)}};n.default=function(e){var n=[],t=null,a=null,f={name:"untitled",format:"gen7"};function s(){t||(t=new i.default(f.name,f.format),n.push(t)),a&&(t.pokemon.push(a),a=null)}function c(e,n,t){u.is(n,t)&&(a[t]=u.get(n,t)[1].trim())}return e.trim().split("\n").map(function(e){return e.trim()}).forEach(function(e){if(u.is(e,"team")){var o=u.get(e,"team");return t=new i.default(o[2],o[1]),void n.push(t)}""!==e?(a||function(e,n){var t=void 0;u.is(n,"nickname_name")?(t=u.get(n,"nickname_name"),e.nickname=t[1].trim(),e.name=t[2].trim()):u.is(n,"name")&&(t=u.get(n,"name"),e.name=t[1].trim())}(a=new r.default,e),c(0,e,"gender"),c(0,e,"item"),c(0,e,"ability"),c(0,e,"level"),c(0,e,"shiny"),c(0,e,"happiness"),c(0,e,"nature"),function(e,n){u.is(n,"move")&&a.moves.push(u.get(n,"move")[1].trim())}(0,e),function(e,n){if(u.is(n,"eivs")){var t=u.get(n,"eivs"),i=t[1].toLowerCase();t[2].split("/").forEach(function(t){var r=u.get(t.trim().toLowerCase(),"eivs_value");if(!r)throw Error("Invalid syntax for "+i+": "+n);e[i]||(e[i]={}),e[i][r[2]]=r[1]})}}(a,e)):s()}),s(),new o.default(n)}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Koffing=void 0;var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(n,t,i){return t&&e(n.prototype,t),i&&e(n,i),n}}(),r=f(t(2)),o=f(t(1)),a=f(t(0)),u=f(t(3));function f(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"parse",value:function(e){if("string"==typeof e||e instanceof String)return(0,u.default)(e);throw new Error("Invalid argument type for 'text'.")}},{key:"stringify",value:function(e){if(e instanceof r.default||e instanceof o.default||e instanceof a.default)return e.toString();throw new Error("Invalid argument type for 'data'.")}},{key:"isValid",value:function(e){try{return"string"==typeof e||e instanceof String?this.parse(e):this.stringify(e),!0}catch(e){return!1}}}]),e}();n.Koffing=s}])});
|
package/src/Parser.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Team from "Team";
|
|
4
|
-
import Pokemon from "Pokemon";
|
|
5
|
-
import Set from "Set";
|
|
6
|
-
|
|
7
|
-
const regexes = {
|
|
8
|
-
"team": /^=== \[(.*)\] (.*) ===$/,
|
|
9
|
-
"gender": / \((F|M)\)/i,
|
|
10
|
-
"item": / @ (.*)$/i,
|
|
11
|
-
"name": /^([^()@]{2,})/i,
|
|
12
|
-
"nickname_name": /^(.*) \(([^()]{2,})\) /i,
|
|
13
|
-
"ability": /^Ability: (.*)$/i,
|
|
14
|
-
"level": /^Level: ([0-9]{1,3})$/i,
|
|
15
|
-
"shiny": /^Shiny: (Yes|No)$/i,
|
|
16
|
-
"happiness": /^Happiness: ([0-9]{1,3})$/i,
|
|
17
|
-
"eivs": /^([EI]Vs): (.*)$/i,
|
|
18
|
-
"eivs_value": /^([0-9]+)\s{1,}(hp|atk|def|spa|spd|spe)$/i,
|
|
19
|
-
"nature": /^(.*) Nature$/,
|
|
20
|
-
"move": /^- (.*)$/i,
|
|
21
|
-
is: function (content, regexName) {
|
|
22
|
-
return content.match(this[regexName]) ? true : false;
|
|
23
|
-
},
|
|
24
|
-
get: function (content, regexName) {
|
|
25
|
-
return this[regexName].exec(content);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const parse = function (content) {
|
|
30
|
-
let lines = content
|
|
31
|
-
.trim()
|
|
32
|
-
.split("\n")
|
|
33
|
-
.map(function (line) {
|
|
34
|
-
return line.trim();
|
|
35
|
-
});
|
|
36
|
-
let teams = [];
|
|
37
|
-
let currTeam = null;
|
|
38
|
-
let currPoke = null;
|
|
39
|
-
let defaultTeamData = {name: "untitled", format: "gen7"};
|
|
40
|
-
|
|
41
|
-
function savePoke() {
|
|
42
|
-
if (!currTeam) {
|
|
43
|
-
currTeam = new Team(defaultTeamData.name, defaultTeamData.format);
|
|
44
|
-
teams.push(currTeam);
|
|
45
|
-
}
|
|
46
|
-
if (currPoke) {
|
|
47
|
-
currTeam.pokemon.push(currPoke);
|
|
48
|
-
currPoke = null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function assign(poke, line, key) {
|
|
53
|
-
if (regexes.is(line, key)) {
|
|
54
|
-
currPoke[key] = regexes.get(line, key)[1].trim();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function assignMoves(poke, line) {
|
|
59
|
-
if (regexes.is(line, 'move')) {
|
|
60
|
-
currPoke.moves.push(regexes.get(line, 'move')[1].trim());
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function assignEivs(poke, line) {
|
|
65
|
-
if (regexes.is(line, 'eivs')) {
|
|
66
|
-
let data = regexes.get(line, 'eivs');
|
|
67
|
-
let prop = data[1].toLowerCase();
|
|
68
|
-
let values = data[2].split('/');
|
|
69
|
-
values.forEach(function (stat) {
|
|
70
|
-
let data = regexes.get(stat.trim().toLowerCase(), 'eivs_value');
|
|
71
|
-
if (!data) {
|
|
72
|
-
throw Error("Invalid syntax for " + prop + ": " + line);
|
|
73
|
-
}
|
|
74
|
-
if (!poke[prop]) {
|
|
75
|
-
poke[prop] = {};
|
|
76
|
-
}
|
|
77
|
-
poke[prop][data[2]] = data[1];
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param {Pokemon} poke
|
|
84
|
-
* @param {String} line
|
|
85
|
-
*/
|
|
86
|
-
function assignName(poke, line) {
|
|
87
|
-
let value;
|
|
88
|
-
|
|
89
|
-
if (regexes.is(line, 'nickname_name')) {
|
|
90
|
-
value = regexes.get(line, 'nickname_name');
|
|
91
|
-
poke.nickname = value[1].trim();
|
|
92
|
-
poke.name = value[2].trim();
|
|
93
|
-
} else if (regexes.is(line, 'name')) {
|
|
94
|
-
value = regexes.get(line, 'name');
|
|
95
|
-
poke.name = value[1].trim();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
lines.forEach(function (line) {
|
|
100
|
-
if (regexes.is(line, "team")) {
|
|
101
|
-
let teamData = regexes.get(line, "team");
|
|
102
|
-
currTeam = new Team(teamData[2], teamData[1]);
|
|
103
|
-
teams.push(currTeam);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (line === "") {
|
|
107
|
-
savePoke();
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (!currPoke) {
|
|
111
|
-
currPoke = new Pokemon();
|
|
112
|
-
assignName(currPoke, line);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
assign(currPoke, line, "gender");
|
|
116
|
-
assign(currPoke, line, "item");
|
|
117
|
-
assign(currPoke, line, "ability");
|
|
118
|
-
assign(currPoke, line, "level");
|
|
119
|
-
assign(currPoke, line, "shiny");
|
|
120
|
-
assign(currPoke, line, "happiness");
|
|
121
|
-
assign(currPoke, line, "nature");
|
|
122
|
-
assignMoves(currPoke, line);
|
|
123
|
-
assignEivs(currPoke, line);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
savePoke();
|
|
127
|
-
|
|
128
|
-
return new Set(teams);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export default parse;
|
package/src/Pokemon.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
class Pokemon {
|
|
4
|
-
constructor(name = undefined) {
|
|
5
|
-
this.name = name;
|
|
6
|
-
this.nickname = undefined;
|
|
7
|
-
this.gender = undefined;
|
|
8
|
-
this.item = undefined;
|
|
9
|
-
this.ability = undefined;
|
|
10
|
-
this.level = undefined;
|
|
11
|
-
this.shiny = undefined;
|
|
12
|
-
this.happiness = undefined;
|
|
13
|
-
this.evs = undefined;
|
|
14
|
-
this.ivs = undefined;
|
|
15
|
-
this.nature = undefined;
|
|
16
|
-
this.moves = [];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
toString() {
|
|
20
|
-
return this.name;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default Pokemon;
|
package/src/Set.js
DELETED
package/src/Team.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
class Team {
|
|
4
|
-
constructor(name = undefined, format = undefined, pokemon = []) {
|
|
5
|
-
this.name = name;
|
|
6
|
-
this.format = format;
|
|
7
|
-
this.pokemon = pokemon;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
toString() {
|
|
11
|
-
let str = `=== [${this.format}] ${this.name} ===\n\n`;
|
|
12
|
-
|
|
13
|
-
str += this.pokemon.map(function (p) {
|
|
14
|
-
return p.toString();
|
|
15
|
-
}).join('\n\n');
|
|
16
|
-
|
|
17
|
-
return str.trim();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default Team;
|
package/webpack.config-docs.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
entry: './docs/src/index.jsx',
|
|
5
|
-
output: {
|
|
6
|
-
path: __dirname + '/docs',
|
|
7
|
-
publicPath: '/',
|
|
8
|
-
filename: 'bundle.min.js'
|
|
9
|
-
},
|
|
10
|
-
module: {
|
|
11
|
-
rules: [
|
|
12
|
-
{
|
|
13
|
-
test: /\.(js|jsx)$/,
|
|
14
|
-
exclude: /node_modules/,
|
|
15
|
-
use: ['babel-loader']
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
resolve: {
|
|
20
|
-
extensions: ['*', '.js', '.jsx'],
|
|
21
|
-
modules: [
|
|
22
|
-
path.resolve(__dirname, 'docs/src'),
|
|
23
|
-
path.resolve(__dirname, 'src'),
|
|
24
|
-
path.resolve(__dirname, 'node_modules')
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
devServer: {
|
|
28
|
-
contentBase: './docs'
|
|
29
|
-
}
|
|
30
|
-
};
|
package/webpack.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
entry: './src/index.js',
|
|
5
|
-
output: {
|
|
6
|
-
libraryTarget: "umd",
|
|
7
|
-
path: __dirname + '/dist',
|
|
8
|
-
filename: 'koffing.js'
|
|
9
|
-
},
|
|
10
|
-
module: {
|
|
11
|
-
rules: [
|
|
12
|
-
{
|
|
13
|
-
test: /\.(js)$/,
|
|
14
|
-
exclude: /node_modules/,
|
|
15
|
-
use: ['babel-loader']
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
resolve: {
|
|
20
|
-
extensions: ['*', '.js'],
|
|
21
|
-
modules: [
|
|
22
|
-
path.resolve(__dirname, 'src')
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
};
|