tja-parser 0.1.0 → 0.1.2

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.
Files changed (50) hide show
  1. package/dist/class/Bar.d.ts +25 -0
  2. package/dist/class/Bar.d.ts.map +1 -0
  3. package/dist/class/Bar.js +96 -0
  4. package/dist/class/Bar.js.map +1 -0
  5. package/dist/class/BarLine.d.ts +14 -0
  6. package/dist/class/BarLine.d.ts.map +1 -0
  7. package/dist/class/BarLine.js +26 -0
  8. package/dist/class/BarLine.js.map +1 -0
  9. package/dist/class/Branch.d.ts +27 -0
  10. package/dist/class/Branch.d.ts.map +1 -0
  11. package/dist/class/Branch.js +38 -0
  12. package/dist/class/Branch.js.map +1 -0
  13. package/dist/class/Command.d.ts +65 -0
  14. package/dist/class/Command.d.ts.map +1 -0
  15. package/dist/class/Command.js +172 -0
  16. package/dist/class/Command.js.map +1 -0
  17. package/dist/class/Course.d.ts +47 -0
  18. package/dist/class/Course.d.ts.map +1 -0
  19. package/dist/class/Course.js +396 -0
  20. package/dist/class/Course.js.map +1 -0
  21. package/dist/class/Item.d.ts +12 -0
  22. package/dist/class/Item.d.ts.map +1 -0
  23. package/dist/class/Item.js +59 -0
  24. package/dist/class/Item.js.map +1 -0
  25. package/dist/class/Note.d.ts +88 -0
  26. package/dist/class/Note.d.ts.map +1 -0
  27. package/dist/class/Note.js +188 -0
  28. package/dist/class/Note.js.map +1 -0
  29. package/dist/class/Song.d.ts +31 -0
  30. package/dist/class/Song.d.ts.map +1 -0
  31. package/dist/class/Song.js +72 -0
  32. package/dist/class/Song.js.map +1 -0
  33. package/dist/exception/ParseException.d.ts +12 -0
  34. package/dist/exception/ParseException.d.ts.map +1 -0
  35. package/dist/exception/ParseException.js +26 -0
  36. package/dist/exception/ParseException.js.map +1 -0
  37. package/dist/exception/TjaException.d.ts +3 -0
  38. package/dist/exception/TjaException.d.ts.map +1 -0
  39. package/dist/exception/TjaException.js +8 -0
  40. package/dist/exception/TjaException.js.map +1 -0
  41. package/dist/index.d.ts +11 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +26 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/types.d.ts +2 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +3 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +2 -1
  50. package/src/index.ts +9 -1
@@ -0,0 +1,25 @@
1
+ import { Command } from "./Command.js";
2
+ import { Item } from "./Item.js";
3
+ import * as math from 'mathjs';
4
+ import { Note } from "./Note.js";
5
+ export declare class Bar {
6
+ private items;
7
+ private notes;
8
+ private commands;
9
+ private start;
10
+ private end;
11
+ private barLength;
12
+ constructor(start: math.Fraction, end: math.Fraction);
13
+ pushItem(...items: Item[]): void;
14
+ getItems(): Item[];
15
+ getNotes(): Note[];
16
+ getCommands(): Command[];
17
+ getStart(): math.Fraction;
18
+ setStart(start: math.Fraction): void;
19
+ getEnd(): math.Fraction;
20
+ setEnd(end: math.Fraction): void;
21
+ getBarLength(): number;
22
+ setBarLength(barLength: number): void;
23
+ toJSON(): any;
24
+ }
25
+ //# sourceMappingURL=Bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bar.d.ts","sourceRoot":"","sources":["../../src/class/Bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,GAAG;IACZ,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,SAAS,CAAK;gBACV,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ;IAKpD,QAAQ,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE;IAKzB,QAAQ;IAGR,QAAQ;IAGR,WAAW;IAIX,QAAQ;IAGR,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ;IAG7B,MAAM;IAGN,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ;IAGzB,YAAY;IAGZ,YAAY,CAAC,SAAS,EAAE,MAAM;IAI9B,MAAM,IAAI,GAAG;CAWhB"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Bar = void 0;
37
+ const Command_js_1 = require("./Command.js");
38
+ const math = __importStar(require("mathjs"));
39
+ const Note_js_1 = require("./Note.js");
40
+ class Bar {
41
+ items = [];
42
+ notes = [];
43
+ commands = [];
44
+ start;
45
+ end;
46
+ barLength = 0;
47
+ constructor(start, end) {
48
+ this.start = start;
49
+ this.end = end;
50
+ }
51
+ pushItem(...items) {
52
+ this.items.push(...items);
53
+ this.notes.push(...items.filter((item) => item instanceof Note_js_1.Note));
54
+ this.commands.push(...items.filter((item) => item instanceof Command_js_1.Command));
55
+ }
56
+ getItems() {
57
+ return Array.from(this.items);
58
+ }
59
+ getNotes() {
60
+ return Array.from(this.notes);
61
+ }
62
+ getCommands() {
63
+ return Array.from(this.commands);
64
+ }
65
+ getStart() {
66
+ return math.fraction(this.start);
67
+ }
68
+ setStart(start) {
69
+ this.start = math.fraction(start);
70
+ }
71
+ getEnd() {
72
+ return math.fraction(this.end);
73
+ }
74
+ setEnd(end) {
75
+ this.end = math.fraction(end);
76
+ }
77
+ getBarLength() {
78
+ return this.barLength;
79
+ }
80
+ setBarLength(barLength) {
81
+ this.barLength = barLength;
82
+ }
83
+ toJSON() {
84
+ return {
85
+ start: this.start.valueOf(),
86
+ end: this.end.valueOf(),
87
+ items: this.items,
88
+ notes: this.notes,
89
+ commands: this.commands,
90
+ barLength: this.barLength,
91
+ type: 'bar'
92
+ };
93
+ }
94
+ }
95
+ exports.Bar = Bar;
96
+ //# sourceMappingURL=Bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bar.js","sourceRoot":"","sources":["../../src/class/Bar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,6CAA+B;AAC/B,uCAAiC;AAEjC,MAAa,GAAG;IACJ,KAAK,GAAW,EAAE,CAAC;IACnB,KAAK,GAAW,EAAE,CAAC;IACnB,QAAQ,GAAc,EAAE,CAAC;IACzB,KA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AAC;IAClC,CAAC;IACD,YAAY;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD,YAAY,CAAC,SAAiB;QAC1B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,MAAM;QACF,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,KAAK;SACd,CAAA;IACL,CAAC;CACJ;AAzDD,kBAyDC"}
@@ -0,0 +1,14 @@
1
+ import { Item } from "./Item";
2
+ export declare class BarLine extends Item {
3
+ type: string;
4
+ private hidden;
5
+ isHidden(): boolean;
6
+ hide(): void;
7
+ show(): void;
8
+ toJSON(): {
9
+ type: string;
10
+ hidden: boolean;
11
+ timing: number;
12
+ };
13
+ }
14
+ //# sourceMappingURL=BarLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarLine.d.ts","sourceRoot":"","sources":["../../src/class/BarLine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,qBAAa,OAAQ,SAAQ,IAAI;IAC7B,IAAI,SAAY;IAChB,OAAO,CAAC,MAAM,CAAkB;IAEhC,QAAQ;IAGR,IAAI;IAGJ,IAAI;IAIJ,MAAM;;;;;CAOT"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BarLine = void 0;
4
+ const Item_1 = require("./Item");
5
+ class BarLine extends Item_1.Item {
6
+ type = 'barline';
7
+ hidden = false;
8
+ isHidden() {
9
+ return this.hidden;
10
+ }
11
+ hide() {
12
+ this.hidden = true;
13
+ }
14
+ show() {
15
+ this.hidden = false;
16
+ }
17
+ toJSON() {
18
+ return {
19
+ ...super.toJSON(),
20
+ type: this.type,
21
+ hidden: this.hidden
22
+ };
23
+ }
24
+ }
25
+ exports.BarLine = BarLine;
26
+ //# sourceMappingURL=BarLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarLine.js","sourceRoot":"","sources":["../../src/class/BarLine.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAE9B,MAAa,OAAQ,SAAQ,WAAI;IAC7B,IAAI,GAAG,SAAS,CAAA;IACR,MAAM,GAAY,KAAK,CAAC;IAEhC,QAAQ;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAI;QACA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IACD,IAAI;QACA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,MAAM;QACF,OAAO;YACH,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;SACtB,CAAA;IACL,CAAC;CACJ;AArBD,0BAqBC"}
@@ -0,0 +1,27 @@
1
+ import * as math from 'mathjs';
2
+ import { Bar } from './Bar.js';
3
+ export declare class Branch extends Bar {
4
+ type: Branch.Type;
5
+ criteria: [number, number];
6
+ normal?: Bar[];
7
+ advanced?: Bar[];
8
+ master?: Bar[];
9
+ constructor(type: Branch.Type, criteria1: [number, number], start: math.Fraction, end: math.Fraction);
10
+ toJSON(): {
11
+ start: any;
12
+ end: any;
13
+ normal: Bar[] | undefined;
14
+ advanced: Bar[] | undefined;
15
+ master: Bar[] | undefined;
16
+ criteria: [number, number];
17
+ type: string;
18
+ branchType: string;
19
+ };
20
+ }
21
+ export declare namespace Branch {
22
+ enum Type {
23
+ ROLL = 0,
24
+ ACCURACY = 1
25
+ }
26
+ }
27
+ //# sourceMappingURL=Branch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Branch.d.ts","sourceRoot":"","sources":["../../src/class/Branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,qBAAa,MAAO,SAAQ,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;gBAEH,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ;IAMpG,MAAM;;;;;;;;;;CAaT;AAED,yBAAiB,MAAM,CAAC;IACpB,KAAY,IAAI;QAAG,IAAI,IAAA;QAAE,QAAQ,IAAA;KAAE;CACtC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Branch = void 0;
4
+ const Bar_js_1 = require("./Bar.js");
5
+ class Branch extends Bar_js_1.Bar {
6
+ type;
7
+ criteria;
8
+ normal;
9
+ advanced;
10
+ master;
11
+ constructor(type, criteria1, start, end) {
12
+ super(start, end);
13
+ this.type = type;
14
+ this.criteria = criteria1;
15
+ }
16
+ toJSON() {
17
+ const superJSON = super.toJSON();
18
+ return {
19
+ start: superJSON.start,
20
+ end: superJSON.end,
21
+ normal: this.normal,
22
+ advanced: this.advanced,
23
+ master: this.master,
24
+ criteria: this.criteria,
25
+ type: 'branch',
26
+ branchType: this.type === Branch.Type.ROLL ? 'roll' : 'acc'
27
+ };
28
+ }
29
+ }
30
+ exports.Branch = Branch;
31
+ (function (Branch) {
32
+ let Type;
33
+ (function (Type) {
34
+ Type[Type["ROLL"] = 0] = "ROLL";
35
+ Type[Type["ACCURACY"] = 1] = "ACCURACY";
36
+ })(Type = Branch.Type || (Branch.Type = {}));
37
+ })(Branch || (exports.Branch = Branch = {}));
38
+ //# sourceMappingURL=Branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Branch.js","sourceRoot":"","sources":["../../src/class/Branch.ts"],"names":[],"mappings":";;;AACA,qCAA+B;AAE/B,MAAa,MAAO,SAAQ,YAAG;IAC3B,IAAI,CAAc;IAClB,QAAQ,CAAmB;IAC3B,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,MAAM,CAAS;IAEf,YAAY,IAAiB,EAAE,SAA2B,EAAE,KAAoB,EAAE,GAAkB;QAChG,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED,MAAM;QACF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACjC,OAAO;YACH,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,GAAG,EAAE,SAAS,CAAC,GAAG;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK;SAC9D,CAAA;IACL,CAAC;CACJ;AA1BD,wBA0BC;AAED,WAAiB,MAAM;IACnB,IAAY,IAAuB;IAAnC,WAAY,IAAI;QAAG,+BAAI,CAAA;QAAE,uCAAQ,CAAA;IAAC,CAAC,EAAvB,IAAI,GAAJ,WAAI,KAAJ,WAAI,QAAmB;AACvC,CAAC,EAFgB,MAAM,sBAAN,MAAM,QAEtB"}
@@ -0,0 +1,65 @@
1
+ import { Item } from "./Item.js";
2
+ import * as math from 'mathjs';
3
+ export declare class Command extends Item {
4
+ static parse(line: string): Command | null;
5
+ constructor(timing: math.Fraction);
6
+ }
7
+ export declare class BarlineCommand extends Command {
8
+ private hide;
9
+ constructor(hide: boolean, timing: math.Fraction);
10
+ getHide(): boolean;
11
+ toJSON(): {
12
+ type: string;
13
+ hide: boolean;
14
+ timing: number;
15
+ };
16
+ }
17
+ export declare class BPMChangeCommand extends Command {
18
+ value: number;
19
+ constructor(value: number, timing: math.Fraction);
20
+ toJSON(): {
21
+ type: string;
22
+ value: number;
23
+ timing: number;
24
+ };
25
+ }
26
+ export declare class MeasureCommand extends Command {
27
+ value: math.Fraction;
28
+ constructor(value: math.Fraction, timing: math.Fraction);
29
+ toJSON(): {
30
+ type: string;
31
+ value: string;
32
+ timing: number;
33
+ };
34
+ }
35
+ export declare class ScrollCommand extends Command {
36
+ value: number;
37
+ constructor(value: number, timing: math.Fraction);
38
+ toJSON(): {
39
+ type: string;
40
+ value: number;
41
+ timing: number;
42
+ };
43
+ }
44
+ export declare class SectionCommand extends Command {
45
+ toJSON(): {
46
+ type: string;
47
+ timing: number;
48
+ };
49
+ }
50
+ export declare class GOGOCommand extends Command {
51
+ type: GOGOCommand.Type;
52
+ constructor(type: GOGOCommand.Type, timing: math.Fraction);
53
+ toJSON(): {
54
+ type: string;
55
+ start: boolean;
56
+ timing: number;
57
+ };
58
+ }
59
+ export declare namespace GOGOCommand {
60
+ enum Type {
61
+ START = 0,
62
+ END = 1
63
+ }
64
+ }
65
+ //# sourceMappingURL=Command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/class/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,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? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.GOGOCommand = exports.SectionCommand = exports.ScrollCommand = exports.MeasureCommand = exports.BPMChangeCommand = exports.BarlineCommand = exports.Command = void 0;
37
+ const Item_js_1 = require("./Item.js");
38
+ const math = __importStar(require("mathjs"));
39
+ class Command extends Item_js_1.Item {
40
+ static parse(line) {
41
+ if (line === '#BARLINEON') {
42
+ return new BarlineCommand(false, math.fraction(0));
43
+ }
44
+ else if (line === "#BARLINEOFF") {
45
+ return new BarlineCommand(true, math.fraction(0));
46
+ }
47
+ else if (line === "#GOGOSTART") {
48
+ return new GOGOCommand(GOGOCommand.Type.START, math.fraction(0));
49
+ }
50
+ else if (line === "#GOGOEND") {
51
+ return new GOGOCommand(GOGOCommand.Type.END, math.fraction(0));
52
+ }
53
+ else if (line === "#SECTION") {
54
+ return new SectionCommand(math.fraction(0));
55
+ }
56
+ else if (line.startsWith('#BPMCHANGE')) {
57
+ const value = Number(line.replace('#BPMCHANGE', ''));
58
+ if (Number.isNaN(value))
59
+ return null;
60
+ return new BPMChangeCommand(value, math.fraction(0));
61
+ }
62
+ else if (line.startsWith('#MEASURE')) {
63
+ return new MeasureCommand(math.fraction(line.replace('#MEASURE', '').trim()), math.fraction(0));
64
+ }
65
+ else if (line.startsWith('#SCROLL')) {
66
+ const value = Number(line.replace('#SCROLL', ''));
67
+ if (Number.isNaN(value))
68
+ return null;
69
+ return new ScrollCommand(value, math.fraction(0));
70
+ }
71
+ return null;
72
+ }
73
+ constructor(timing) {
74
+ super(timing);
75
+ }
76
+ }
77
+ exports.Command = Command;
78
+ class BarlineCommand extends Command {
79
+ hide;
80
+ constructor(hide, timing) {
81
+ super(timing);
82
+ this.hide = hide;
83
+ }
84
+ getHide() {
85
+ return this.hide;
86
+ }
87
+ toJSON() {
88
+ return {
89
+ ...super.toJSON(),
90
+ type: 'command-barline',
91
+ hide: this.hide
92
+ };
93
+ }
94
+ }
95
+ exports.BarlineCommand = BarlineCommand;
96
+ class BPMChangeCommand extends Command {
97
+ value;
98
+ constructor(value, timing) {
99
+ super(timing);
100
+ this.value = value;
101
+ }
102
+ toJSON() {
103
+ return {
104
+ ...super.toJSON(),
105
+ type: 'command-bpmchange',
106
+ value: this.value
107
+ };
108
+ }
109
+ }
110
+ exports.BPMChangeCommand = BPMChangeCommand;
111
+ class MeasureCommand extends Command {
112
+ value;
113
+ constructor(value, timing) {
114
+ super(timing);
115
+ this.value = value;
116
+ }
117
+ toJSON() {
118
+ return {
119
+ ...super.toJSON(),
120
+ type: 'command-measure',
121
+ value: this.value.toString()
122
+ };
123
+ }
124
+ }
125
+ exports.MeasureCommand = MeasureCommand;
126
+ class ScrollCommand extends Command {
127
+ value;
128
+ constructor(value, timing) {
129
+ super(timing);
130
+ this.value = value;
131
+ }
132
+ toJSON() {
133
+ return {
134
+ ...super.toJSON(),
135
+ type: 'command-scroll',
136
+ value: this.value
137
+ };
138
+ }
139
+ }
140
+ exports.ScrollCommand = ScrollCommand;
141
+ class SectionCommand extends Command {
142
+ toJSON() {
143
+ return {
144
+ ...super.toJSON(),
145
+ type: 'command-section'
146
+ };
147
+ }
148
+ }
149
+ exports.SectionCommand = SectionCommand;
150
+ class GOGOCommand extends Command {
151
+ type;
152
+ constructor(type, timing) {
153
+ super(timing);
154
+ this.type = type;
155
+ }
156
+ toJSON() {
157
+ return {
158
+ ...super.toJSON(),
159
+ type: 'command-gogo',
160
+ start: this.type === GOGOCommand.Type.START
161
+ };
162
+ }
163
+ }
164
+ exports.GOGOCommand = GOGOCommand;
165
+ (function (GOGOCommand) {
166
+ let Type;
167
+ (function (Type) {
168
+ Type[Type["START"] = 0] = "START";
169
+ Type[Type["END"] = 1] = "END";
170
+ })(Type = GOGOCommand.Type || (GOGOCommand.Type = {}));
171
+ })(GOGOCommand || (exports.GOGOCommand = GOGOCommand = {}));
172
+ //# sourceMappingURL=Command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Command.js","sourceRoot":"","sources":["../../src/class/Command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAiC;AACjC,6CAA+B;AAE/B,MAAa,OAAQ,SAAQ,cAAI;IAC7B,MAAM,CAAC,KAAK,CAAC,IAAY;QACrB,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;YACxB,OAAO,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC;aACI,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YAC9B,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC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2
+ import { Bar } from "./Bar.js";
3
+ import { Branch } from "./Branch.js";
4
+ import { Song } from "./Song.js";
5
+ export declare class Course {
6
+ static parse(courseTja: string | string[], song?: Song): Course;
7
+ private static parseBar;
8
+ private static groupLines;
9
+ private static convertLineGroupToBar;
10
+ difficulty: Difficulty;
11
+ metadata: Course.Metadata;
12
+ bars: Bar[];
13
+ song?: Song;
14
+ constructor(difficulty: Difficulty, metadata: Course.Metadata, song?: Song);
15
+ getBPM(): number;
16
+ getLevel(): number;
17
+ pushBar(...bars: Bar[]): void;
18
+ getBalloon(): number[];
19
+ getBalloonIterator(): () => number;
20
+ toJSON(): {
21
+ metadata: Course.Metadata;
22
+ difficulty: Difficulty;
23
+ bars: Bar[];
24
+ };
25
+ }
26
+ export declare namespace Course {
27
+ class Metadata {
28
+ level?: number;
29
+ [key: string]: string | number | undefined;
30
+ }
31
+ class LineGroup {
32
+ lines: string[];
33
+ add(line: string): void;
34
+ }
35
+ class BranchedLineGroup {
36
+ type: Branch.Type;
37
+ criteria: [number, number];
38
+ normal?: LineGroup[];
39
+ advanced?: LineGroup[];
40
+ master?: LineGroup[];
41
+ constructor(type: Branch.Type, criteria: [number, number]);
42
+ addNormal(lineGroup: LineGroup): void;
43
+ addAdvanced(lineGroup: LineGroup): void;
44
+ addMaster(lineGroup: LineGroup): void;
45
+ }
46
+ }
47
+ //# sourceMappingURL=Course.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Course.d.ts","sourceRoot":"","sources":["../../src/class/Course.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,qBAAa,MAAM;IAMf,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MA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