definition-generator-framework 1.13.1 → 2.0.0-rc0
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/dist/index.d.mts +198 -0
- package/dist/index.d.ts +198 -17
- package/dist/index.js +43 -50
- package/dist/index.mjs +43 -0
- package/package.json +27 -13
- package/dist/_mocks/mocks.d.ts +0 -7
- package/dist/_mocks/mocks.js +0 -44
- package/dist/decorators/definition-component.d.ts +0 -18
- package/dist/decorators/definition-component.js +0 -52
- package/dist/decorators/definition-generator.d.ts +0 -11
- package/dist/decorators/definition-generator.js +0 -30
- package/dist/framework/context.d.ts +0 -24
- package/dist/framework/context.js +0 -64
- package/dist/framework/definition-component.d.ts +0 -20
- package/dist/framework/definition-component.js +0 -29
- package/dist/framework/definition-generator.d.ts +0 -11
- package/dist/framework/definition-generator.js +0 -22
- package/dist/framework/definition-store.d.ts +0 -25
- package/dist/framework/definition-store.js +0 -121
- package/dist/framework/file-content-generator/file-content-generator.d.ts +0 -19
- package/dist/framework/file-content-generator/file-content-generator.js +0 -117
- package/dist/framework/file-content-generator/file-content-generator.test.d.ts +0 -24
- package/dist/framework/file-content-generator/file-content-generator.test.js +0 -161
- package/dist/framework/file-generators/index-file-generator.d.ts +0 -13
- package/dist/framework/file-generators/index-file-generator.js +0 -139
- package/dist/framework/file-generators/types-file-generator.d.ts +0 -6
- package/dist/framework/file-generators/types-file-generator.js +0 -35
- package/dist/framework/framework.d.ts +0 -28
- package/dist/framework/framework.data.d.ts +0 -6
- package/dist/framework/framework.data.js +0 -17
- package/dist/framework/framework.js +0 -51
- package/dist/framework/framework.model.d.ts +0 -32
- package/dist/framework/framework.model.js +0 -3
- package/dist/framework/index-file-generator/index-file-generator.d.ts +0 -10
- package/dist/framework/index-file-generator/index-file-generator.js +0 -118
- package/dist/framework/interfaces.d.ts +0 -46
- package/dist/framework/interfaces.js +0 -3
- package/dist/framework/kernel.d.ts +0 -12
- package/dist/framework/kernel.js +0 -308
- package/dist/helpers/common-functions/common-functions.d.ts +0 -10
- package/dist/helpers/common-functions/common-functions.js +0 -29
- package/dist/helpers/common-functions/common-functions.spec.d.ts +0 -1
- package/dist/helpers/common-functions/common-functions.spec.js +0 -50
- package/dist/helpers/common-functions/common-functions.test.d.ts +0 -1
- package/dist/helpers/common-functions/common-functions.test.js +0 -51
- package/dist/helpers/duplicate-helper/duplicate-helper.d.ts +0 -11
- package/dist/helpers/duplicate-helper/duplicate-helper.js +0 -40
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.d.ts +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +0 -54
- package/dist/helpers/duplicate-helper/duplicate-helper.test.d.ts +0 -1
- package/dist/helpers/duplicate-helper/duplicate-helper.test.js +0 -55
- package/dist/helpers/output-helper/output-helper.d.ts +0 -30
- package/dist/helpers/output-helper/output-helper.js +0 -143
- package/dist/helpers/output-helper/output-helper.spec.d.ts +0 -24
- package/dist/helpers/output-helper/output-helper.spec.js +0 -261
- package/dist/helpers/output-helper/output-helper.test.d.ts +0 -24
- package/dist/helpers/output-helper/output-helper.test.js +0 -262
- package/dist/helpers/raw-definition-helper/raw-definition.helper.d.ts +0 -7
- package/dist/helpers/raw-definition-helper/raw-definition.helper.js +0 -66
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.d.ts +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +0 -143
- package/dist/helpers/raw-definition-helper/raw-definition.helper.test.d.ts +0 -1
- package/dist/helpers/raw-definition-helper/raw-definition.helper.test.js +0 -136
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.d.ts +0 -16
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.js +0 -48
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +0 -191
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.d.ts +0 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.test.js +0 -213
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.d.ts +0 -13
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.js +0 -53
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.d.ts +0 -1
- package/dist/helpers/validator/custom-validators/helpers/sprite-validation.helper.test.js +0 -96
- package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +0 -14
- package/dist/helpers/validator/custom-validators/image.custom-validator.js +0 -44
- package/dist/helpers/validator/custom-validators/path.custom-validator.d.ts +0 -9
- package/dist/helpers/validator/custom-validators/path.custom-validator.js +0 -30
- package/dist/helpers/validator/custom-validators/position-on-sprite.d.ts +0 -14
- package/dist/helpers/validator/custom-validators/position-on-sprite.js +0 -44
- package/dist/helpers/validator/custom-validators/reference.custom-validator.d.ts +0 -22
- package/dist/helpers/validator/custom-validators/reference.custom-validator.js +0 -123
- package/dist/helpers/validator/custom-validators/sprite.custom-validator.d.ts +0 -14
- package/dist/helpers/validator/custom-validators/sprite.custom-validator.js +0 -43
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +0 -9
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +0 -33
- package/dist/helpers/validator/custom-validators/unique.custom-validator.d.ts +0 -8
- package/dist/helpers/validator/custom-validators/unique.custom-validator.js +0 -20
- package/dist/helpers/validator/joi-custom-validators.d.ts +0 -33
- package/dist/helpers/validator/joi-custom-validators.js +0 -54
- package/dist/helpers/validator/joi-custom-validators.spec.d.ts +0 -1
- package/dist/helpers/validator/joi-custom-validators.spec.js +0 -304
- package/dist/helpers/validator/validator.d.ts +0 -21
- package/dist/helpers/validator/validator.js +0 -74
- package/dist/helpers/validator/validator.spec.d.ts +0 -1
- package/dist/helpers/validator/validator.spec.js +0 -332
- package/dist/helpers/validator/validator.test.d.ts +0 -1
- package/dist/helpers/validator/validator.test.js +0 -329
- package/dist/pipeline/1-select-definitions-helper.d.ts +0 -20
- package/dist/pipeline/1-select-definitions-helper.js +0 -76
- package/dist/pipeline/1-select-definitions.helper.d.ts +0 -20
- package/dist/pipeline/1-select-definitions.helper.js +0 -80
- package/dist/pipeline/1-select-definitions.helper.test.d.ts +0 -1
- package/dist/pipeline/1-select-definitions.helper.test.js +0 -141
- package/dist/pipeline/1-select-definitions.spec.d.ts +0 -1
- package/dist/pipeline/1-select-definitions.spec.js +0 -140
- package/dist/pipeline/2-structure-parser.helper.d.ts +0 -11
- package/dist/pipeline/2-structure-parser.helper.js +0 -70
- package/dist/pipeline/2-structure-parser.helper.spec.d.ts +0 -1
- package/dist/pipeline/2-structure-parser.helper.spec.js +0 -280
- package/dist/pipeline/2-structure-parser.helper.test.d.ts +0 -1
- package/dist/pipeline/2-structure-parser.helper.test.js +0 -281
- package/dist/pipeline/3-config.d.ts +0 -9
- package/dist/pipeline/3-config.js +0 -36
- package/dist/pipeline/_mocks/index.d.ts +0 -13
- package/dist/pipeline/_mocks/index.js +0 -52
- package/dist/pipeline/parsers/array-parser.d.ts +0 -4
- package/dist/pipeline/parsers/array-parser.js +0 -69
- package/dist/pipeline/parsers/array-parser.spec.d.ts +0 -1
- package/dist/pipeline/parsers/array-parser.spec.js +0 -128
- package/dist/pipeline/parsers/array-parser.test.d.ts +0 -1
- package/dist/pipeline/parsers/array-parser.test.js +0 -126
- package/dist/pipeline/parsers/object-parser.d.ts +0 -4
- package/dist/pipeline/parsers/object-parser.js +0 -135
- package/dist/pipeline/parsers/object-parser.spec.d.ts +0 -1
- package/dist/pipeline/parsers/object-parser.spec.js +0 -179
- package/dist/pipeline/parsers/object-parser.test.d.ts +0 -1
- package/dist/pipeline/parsers/object-parser.test.js +0 -186
- package/dist/pipeline/parsers/primitive-parser.d.ts +0 -7
- package/dist/pipeline/parsers/primitive-parser.js +0 -111
- package/dist/pipeline/parsers/primitive-parser.spec.d.ts +0 -1
- package/dist/pipeline/parsers/primitive-parser.spec.js +0 -79
- package/dist/pipeline/parsers/primitive-parser.test.d.ts +0 -1
- package/dist/pipeline/parsers/primitive-parser.test.js +0 -85
- package/dist/pipeline/raw-data-parser.d.ts +0 -5
- package/dist/pipeline/raw-data-parser.js +0 -25
- package/dist/pre-made-components/_validators/shape-validators.d.ts +0 -7
- package/dist/pre-made-components/_validators/shape-validators.js +0 -37
- package/dist/pre-made-components/_validators/sprite-validators.d.ts +0 -7
- package/dist/pre-made-components/_validators/sprite-validators.js +0 -43
- package/dist/pre-made-components/assets/1-sprite.d.ts +0 -15
- package/dist/pre-made-components/assets/1-sprite.js +0 -74
- package/dist/pre-made-components/assets/2-sprite-group.d.ts +0 -11
- package/dist/pre-made-components/assets/2-sprite-group.js +0 -41
- package/dist/pre-made-components/assets/3-font.d.ts +0 -17
- package/dist/pre-made-components/assets/3-font.js +0 -71
- package/dist/pre-made-components/events/1-event.d.ts +0 -6
- package/dist/pre-made-components/events/1-event.js +0 -206
- package/dist/pre-made-components/events/1-script.d.ts +0 -8
- package/dist/pre-made-components/events/1-script.js +0 -102
- package/dist/pre-made-components/events/2-event-test.d.ts +0 -18
- package/dist/pre-made-components/events/2-event-test.js +0 -172
- package/dist/pre-made-components/events/2-script-test.d.ts +0 -7
- package/dist/pre-made-components/events/2-script-test.js +0 -102
- package/dist/pre-made-components/events/3-event.d.ts +0 -7
- package/dist/pre-made-components/events/3-event.js +0 -100
- package/dist/pre-made-components/events/4-event-test.d.ts +0 -7
- package/dist/pre-made-components/events/4-event-test.js +0 -89
- package/dist/pre-made-components/events/event-setup.d.ts +0 -13
- package/dist/pre-made-components/events/event-setup.js +0 -20
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.d.ts +0 -3
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.js +0 -24
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.d.ts +0 -1
- package/dist/pre-made-components/events/helpers/quotes-to-tags.helper.test.js +0 -39
- package/dist/pre-made-components/events/helpers/script-testing.helper.d.ts +0 -33
- package/dist/pre-made-components/events/helpers/script-testing.helper.js +0 -79
- package/dist/pre-made-components/events/script-setup.d.ts +0 -8
- package/dist/pre-made-components/events/script-setup.js +0 -16
- package/dist/pre-made-components/events/scripting-setup.d.ts +0 -33
- package/dist/pre-made-components/events/scripting-setup.js +0 -97
- package/dist/pre-made-components/events/validators.d.ts +0 -6
- package/dist/pre-made-components/events/validators.js +0 -96
- package/dist/setup.d.ts +0 -1
- package/dist/setup.js +0 -10
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrimitiveParser = void 0;
|
|
4
|
-
class PrimitiveParser {
|
|
5
|
-
static parse(content, location) {
|
|
6
|
-
let row = content[0];
|
|
7
|
-
if (row.startsWith('`')) {
|
|
8
|
-
if (content.length === 1) {
|
|
9
|
-
return this.parseSingleLineString(row, location, '`');
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return this.parseMultilineString(content, location);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
else if (content.length > 1) {
|
|
16
|
-
let errorLog = {
|
|
17
|
-
description: `Invalid row! "${content[1]}"`,
|
|
18
|
-
location: { line: location.line + 2, path: location.path }
|
|
19
|
-
};
|
|
20
|
-
throw errorLog;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
if (row.startsWith('"')) {
|
|
24
|
-
return this.parseSingleLineString(row, location, '"');
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return this.parsePlaneString(row, location);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
static parsePlaneString(row, location) {
|
|
32
|
-
if (row.indexOf(' ') !== -1) {
|
|
33
|
-
let errorLog = {
|
|
34
|
-
description: `Unexpected space! "${row}"`,
|
|
35
|
-
location
|
|
36
|
-
};
|
|
37
|
-
throw errorLog;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
return {
|
|
41
|
-
line: location.line,
|
|
42
|
-
rawData: row === 'undefined' ? undefined : row
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
static parseSingleLineString(row, location, quoteCharacter) {
|
|
47
|
-
let regex = new RegExp(quoteCharacter, 'g');
|
|
48
|
-
if ((row.match(regex) || []).length > 2) {
|
|
49
|
-
let errorLog = {
|
|
50
|
-
description: 'There should be only one opening and one closeing quote!',
|
|
51
|
-
location
|
|
52
|
-
};
|
|
53
|
-
throw errorLog;
|
|
54
|
-
}
|
|
55
|
-
else if (!row.endsWith(quoteCharacter)) {
|
|
56
|
-
let errorLog = {
|
|
57
|
-
description: 'Quote is not get closed!',
|
|
58
|
-
location
|
|
59
|
-
};
|
|
60
|
-
throw errorLog;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return {
|
|
64
|
-
line: location.line,
|
|
65
|
-
rawData: row.replace(regex, '')
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
static parseMultilineString(content, location) {
|
|
70
|
-
let lastRow = content[content.length - 1];
|
|
71
|
-
if (content[0] !== '`') {
|
|
72
|
-
let errorLog = {
|
|
73
|
-
description: `There should be new line after backtick "${content[0]}"!`,
|
|
74
|
-
location: { line: location.line, path: location.path }
|
|
75
|
-
};
|
|
76
|
-
throw errorLog;
|
|
77
|
-
}
|
|
78
|
-
else if (lastRow.startsWith('`') && lastRow !== '`') {
|
|
79
|
-
let errorLog = {
|
|
80
|
-
description: `There should be new line after backtick "${lastRow}"!`,
|
|
81
|
-
location: { line: location.line + content.length, path: location.path }
|
|
82
|
-
};
|
|
83
|
-
throw errorLog;
|
|
84
|
-
}
|
|
85
|
-
else if (!lastRow.trim().startsWith('`')) {
|
|
86
|
-
let errorLog = {
|
|
87
|
-
description: `Multiline string should end with backtick in new line "${lastRow}"!`,
|
|
88
|
-
location: { line: location.line + content.length, path: location.path }
|
|
89
|
-
};
|
|
90
|
-
throw errorLog;
|
|
91
|
-
}
|
|
92
|
-
else if (lastRow !== '`') {
|
|
93
|
-
let errorLog = {
|
|
94
|
-
description: `Invalid coding indent!`,
|
|
95
|
-
location: { line: location.line + content.length, path: location.path }
|
|
96
|
-
};
|
|
97
|
-
throw errorLog;
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return {
|
|
101
|
-
line: location.line,
|
|
102
|
-
rawData: content
|
|
103
|
-
.slice(0, content.length - 1)
|
|
104
|
-
.slice(1)
|
|
105
|
-
.join('\n')
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.PrimitiveParser = PrimitiveParser;
|
|
111
|
-
//# sourceMappingURL=primitive-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
const primitive_parser_1 = require('./primitive-parser');
|
|
4
|
-
const _mocks_1 = require('../_mocks');
|
|
5
|
-
const mocks_1 = require('../../_mocks/mocks');
|
|
6
|
-
describe('PRIMITIVE PARSER', () => {
|
|
7
|
-
test('primitive string', () => {
|
|
8
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['text'], mocks_1.SampleLocation1);
|
|
9
|
-
expect(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text', mocks_1.SampleLocation1));
|
|
10
|
-
});
|
|
11
|
-
test('primitive quoted string', () => {
|
|
12
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['"text with spaces"'], mocks_1.SampleLocation1);
|
|
13
|
-
expect(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text with spaces', mocks_1.SampleLocation1));
|
|
14
|
-
});
|
|
15
|
-
test('primitive multiline string', () => {
|
|
16
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['`', 'text text', 'text', '`'], mocks_1.SampleLocation1);
|
|
17
|
-
expect(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text text\ntext', mocks_1.SampleLocation1));
|
|
18
|
-
});
|
|
19
|
-
test('primitive number', () => {
|
|
20
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['123.123'], mocks_1.SampleLocation1);
|
|
21
|
-
expect(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('123.123', mocks_1.SampleLocation1));
|
|
22
|
-
});
|
|
23
|
-
test('primitive undefined', () => {
|
|
24
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['undefined'], mocks_1.SampleLocation1);
|
|
25
|
-
expect(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)(undefined, mocks_1.SampleLocation1));
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
describe('PRIMITIVE PARSER - Error Detection', () => {
|
|
29
|
-
let expectErrorHelper = new _mocks_1.ExpectErrorHelper(primitive_parser_1.PrimitiveParser);
|
|
30
|
-
test.each([' text', 'some text'])('primitive with space "%s"', item => {
|
|
31
|
-
expectErrorHelper.expect([item], {
|
|
32
|
-
description: `Unexpected space! "${item}"`,
|
|
33
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
test('not closed quote string', () => {
|
|
37
|
-
expectErrorHelper.expect(['"some text'], {
|
|
38
|
-
description: 'Quote is not get closed!',
|
|
39
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
test('invalid quote text', () => {
|
|
43
|
-
expectErrorHelper.expect(['"some "text"'], {
|
|
44
|
-
description: 'There should be only one opening and one closeing quote!',
|
|
45
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
test('multiline primitive', () => {
|
|
49
|
-
expectErrorHelper.expect(['text', 'secondRow'], {
|
|
50
|
-
description: 'Invalid row! "secondRow"',
|
|
51
|
-
location: { line: mocks_1.SampleLocation1.line + 2, path: mocks_1.SampleLocation1.path }
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
test('multiline string no character after backtick - openning', () => {
|
|
55
|
-
expectErrorHelper.expect(['`test', 'something'], {
|
|
56
|
-
description: 'There should be new line after backtick "`test"!',
|
|
57
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
test('multiline string no character after backtick - closing', () => {
|
|
61
|
-
expectErrorHelper.expect(['`', 'test', '`,'], {
|
|
62
|
-
description: 'There should be new line after backtick "`,"!',
|
|
63
|
-
location: { line: mocks_1.SampleLocation1.line + 3, path: mocks_1.SampleLocation1.path }
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
test('multiline string should end with backtick', () => {
|
|
67
|
-
expectErrorHelper.expect(['`', 'test`'], {
|
|
68
|
-
description: 'Multiline string should end with backtick in new line "test`"!',
|
|
69
|
-
location: { line: mocks_1.SampleLocation1.line + 2, path: mocks_1.SampleLocation1.path }
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
test('multiline string should end with backtick in the same coding indent', () => {
|
|
73
|
-
expectErrorHelper.expect(['`', 'test', ' `'], {
|
|
74
|
-
description: 'Invalid coding indent!',
|
|
75
|
-
location: { line: mocks_1.SampleLocation1.line + 3, path: mocks_1.SampleLocation1.path }
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=primitive-parser.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const mocks_1 = require("../../_mocks/mocks");
|
|
5
|
-
const _mocks_1 = require("../_mocks");
|
|
6
|
-
const primitive_parser_1 = require("./primitive-parser");
|
|
7
|
-
(0, vitest_1.describe)('PRIMITIVE PARSER', () => {
|
|
8
|
-
(0, vitest_1.test)('primitive string', () => {
|
|
9
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['text'], mocks_1.SampleLocation1);
|
|
10
|
-
(0, vitest_1.expect)(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text', mocks_1.SampleLocation1));
|
|
11
|
-
});
|
|
12
|
-
(0, vitest_1.test)('primitive quoted string', () => {
|
|
13
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['"text with spaces"'], mocks_1.SampleLocation1);
|
|
14
|
-
console.log(result);
|
|
15
|
-
(0, vitest_1.expect)(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text with spaces', mocks_1.SampleLocation1));
|
|
16
|
-
});
|
|
17
|
-
(0, vitest_1.test)('primitive back-tick string', () => {
|
|
18
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['`text with spaces`'], mocks_1.SampleLocation1);
|
|
19
|
-
(0, vitest_1.expect)(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text with spaces', mocks_1.SampleLocation1));
|
|
20
|
-
});
|
|
21
|
-
(0, vitest_1.test)('primitive back-tick multiline string', () => {
|
|
22
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['`', 'text text', 'text', '`'], mocks_1.SampleLocation1);
|
|
23
|
-
(0, vitest_1.expect)(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('text text\ntext', mocks_1.SampleLocation1));
|
|
24
|
-
});
|
|
25
|
-
(0, vitest_1.test)('primitive number', () => {
|
|
26
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['123.123'], mocks_1.SampleLocation1);
|
|
27
|
-
(0, vitest_1.expect)(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)('123.123', mocks_1.SampleLocation1));
|
|
28
|
-
});
|
|
29
|
-
(0, vitest_1.test)('primitive undefined', () => {
|
|
30
|
-
let result = primitive_parser_1.PrimitiveParser.parse(['undefined'], mocks_1.SampleLocation1);
|
|
31
|
-
(0, vitest_1.expect)(result).toStrictEqual((0, _mocks_1.getExpectedParsedStructure)(undefined, mocks_1.SampleLocation1));
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
(0, vitest_1.describe)('PRIMITIVE PARSER - Error Detection', () => {
|
|
35
|
-
let expectErrorHelper = new _mocks_1.ExpectErrorHelper(primitive_parser_1.PrimitiveParser);
|
|
36
|
-
vitest_1.test.each([' text', 'some text'])('primitive with space "%s"', (item) => {
|
|
37
|
-
expectErrorHelper.expect([item], {
|
|
38
|
-
description: `Unexpected space! "${item}"`,
|
|
39
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
(0, vitest_1.test)('not closed quote string', () => {
|
|
43
|
-
expectErrorHelper.expect(['"some text'], {
|
|
44
|
-
description: 'Quote is not get closed!',
|
|
45
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
(0, vitest_1.test)('invalid quote text', () => {
|
|
49
|
-
expectErrorHelper.expect(['"some "text"'], {
|
|
50
|
-
description: 'There should be only one opening and one closeing quote!',
|
|
51
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
(0, vitest_1.test)('multiline primitive', () => {
|
|
55
|
-
expectErrorHelper.expect(['text', 'secondRow'], {
|
|
56
|
-
description: 'Invalid row! "secondRow"',
|
|
57
|
-
location: { line: mocks_1.SampleLocation1.line + 2, path: mocks_1.SampleLocation1.path }
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
(0, vitest_1.test)('multiline string no character after backtick - openning', () => {
|
|
61
|
-
expectErrorHelper.expect(['`test', 'something'], {
|
|
62
|
-
description: 'There should be new line after backtick "`test"!',
|
|
63
|
-
location: { line: mocks_1.SampleLocation1.line, path: mocks_1.SampleLocation1.path }
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
(0, vitest_1.test)('multiline string no character after backtick - closing', () => {
|
|
67
|
-
expectErrorHelper.expect(['`', 'test', '`,'], {
|
|
68
|
-
description: 'There should be new line after backtick "`,"!',
|
|
69
|
-
location: { line: mocks_1.SampleLocation1.line + 3, path: mocks_1.SampleLocation1.path }
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
(0, vitest_1.test)('multiline string should end with backtick', () => {
|
|
73
|
-
expectErrorHelper.expect(['`', 'test`'], {
|
|
74
|
-
description: 'Multiline string should end with backtick in new line "test`"!',
|
|
75
|
-
location: { line: mocks_1.SampleLocation1.line + 2, path: mocks_1.SampleLocation1.path }
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
(0, vitest_1.test)('multiline string should end with backtick in the same coding indent', () => {
|
|
79
|
-
expectErrorHelper.expect(['`', 'test', ' `'], {
|
|
80
|
-
description: 'Invalid coding indent!',
|
|
81
|
-
location: { line: mocks_1.SampleLocation1.line + 3, path: mocks_1.SampleLocation1.path }
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
//# sourceMappingURL=primitive-parser.test.js.map
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RawDataParser = void 0;
|
|
4
|
-
const context_1 = require("../framework/context");
|
|
5
|
-
const _1_select_definitions_helper_1 = require("./1-select-definitions.helper");
|
|
6
|
-
const _2_structure_parser_helper_1 = require("./2-structure-parser.helper");
|
|
7
|
-
const _3_config_1 = require("./3-config");
|
|
8
|
-
class RawDataParser {
|
|
9
|
-
static { this.selectDefinitionsHelper = new _1_select_definitions_helper_1.SelectDefinitionsHelper(); }
|
|
10
|
-
static { this.structureParserHelper = new _2_structure_parser_helper_1.StructureParserHelper(); }
|
|
11
|
-
static process() {
|
|
12
|
-
let definitionPlaneTexts = context_1.Context.files.reduce((acc, file) => {
|
|
13
|
-
let selectDefinitionsResult = this.selectDefinitionsHelper.process(file);
|
|
14
|
-
context_1.Context.addErrorLog(selectDefinitionsResult.errorLogs);
|
|
15
|
-
acc.push(...selectDefinitionsResult.definitionPlaneTexts);
|
|
16
|
-
return acc;
|
|
17
|
-
}, []);
|
|
18
|
-
let structureParserResult = this.structureParserHelper.process(definitionPlaneTexts);
|
|
19
|
-
context_1.Context.rawDefinitions.push(...structureParserResult.rawDefinitions);
|
|
20
|
-
context_1.Context.addErrorLog(structureParserResult.errorLogs);
|
|
21
|
-
_3_config_1.Config.process();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.RawDataParser = RawDataParser;
|
|
25
|
-
//# sourceMappingURL=raw-data-parser.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from 'helpers-lib';
|
|
2
|
-
import Joi from 'joi';
|
|
3
|
-
export declare const PoligonSchema: () => Joi.ArraySchema<Vec2[][]>;
|
|
4
|
-
export declare const Vec2Schema: () => Joi.ObjectSchema<Vec2>;
|
|
5
|
-
export declare const HexColorSchema: () => Joi.StringSchema;
|
|
6
|
-
export declare const RotationSchema: () => Joi.NumberSchema<number>;
|
|
7
|
-
export declare const FixedArraySchema: (itemSchema: Joi.ObjectSchema<any>, size: number) => Joi.ArraySchema;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FixedArraySchema = exports.RotationSchema = exports.HexColorSchema = exports.Vec2Schema = exports.PoligonSchema = void 0;
|
|
7
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
8
|
-
const joi_1 = __importDefault(require("joi"));
|
|
9
|
-
const PoligonSchema = () => joi_1.default.array().items(joi_1.default.array().items((0, exports.Vec2Schema)().required()).min(3).required()).min(1);
|
|
10
|
-
exports.PoligonSchema = PoligonSchema;
|
|
11
|
-
const Vec2Schema = () => joi_1.default.object().keys({
|
|
12
|
-
x: joi_1.default.number().required(),
|
|
13
|
-
y: joi_1.default.number().required()
|
|
14
|
-
});
|
|
15
|
-
exports.Vec2Schema = Vec2Schema;
|
|
16
|
-
const HexColorSchema = () => joi_1.default.string()
|
|
17
|
-
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
18
|
-
.custom(value => helpers_lib_1.ColorHelper.stringColorToRGBColor(value));
|
|
19
|
-
exports.HexColorSchema = HexColorSchema;
|
|
20
|
-
const RotationSchema = () => joi_1.default.number().min(-Math.PI).max(Math.PI);
|
|
21
|
-
exports.RotationSchema = RotationSchema;
|
|
22
|
-
const FixedArraySchema = (itemSchema, size) => joi_1.default.array()
|
|
23
|
-
.items(itemSchema)
|
|
24
|
-
.max(size)
|
|
25
|
-
.custom(value => {
|
|
26
|
-
if (value.length > size) {
|
|
27
|
-
throw new Error(`Array exceeds maximum size of ${size}`);
|
|
28
|
-
}
|
|
29
|
-
while (value.length < size) {
|
|
30
|
-
value.push(undefined);
|
|
31
|
-
}
|
|
32
|
-
return value;
|
|
33
|
-
})
|
|
34
|
-
.default(helpers_lib_1.ArrayHelper.createEmptyArray(size))
|
|
35
|
-
.optional();
|
|
36
|
-
exports.FixedArraySchema = FixedArraySchema;
|
|
37
|
-
//# sourceMappingURL=shape-validators.js.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SpriteSchema = exports.PixelPerfectSpriteSchema = void 0;
|
|
7
|
-
const joi_1 = __importDefault(require("joi"));
|
|
8
|
-
const definition_store_1 = require("../../framework/definition-store");
|
|
9
|
-
const _1_sprite_1 = require("../assets/1-sprite");
|
|
10
|
-
const PixelPerfectSpriteSchema = () => joi_1.default.string()
|
|
11
|
-
.reference(_1_sprite_1.SpriteComponent)
|
|
12
|
-
.custom((value) => {
|
|
13
|
-
let spriteDefinition = definition_store_1.DefinitionStore.getDefinitionOrFail(_1_sprite_1.SpriteComponent, value);
|
|
14
|
-
if (spriteDefinition.url.size.x % 4 !== 0) {
|
|
15
|
-
throw new Error(`Sprite width must be multiplier of four in order to keep the pixel perfection. Got: '${spriteDefinition.url.size.x}'`);
|
|
16
|
-
}
|
|
17
|
-
if (spriteDefinition.url.size.y % 4 !== 0) {
|
|
18
|
-
throw new Error(`Sprite height must be multiplier of four in order to keep the pixel perfection. Got: '${spriteDefinition.url.size.y}'`);
|
|
19
|
-
}
|
|
20
|
-
return value;
|
|
21
|
-
});
|
|
22
|
-
exports.PixelPerfectSpriteSchema = PixelPerfectSpriteSchema;
|
|
23
|
-
const SpriteSchema = (restrictions) => joi_1.default.string()
|
|
24
|
-
.reference(_1_sprite_1.SpriteComponent)
|
|
25
|
-
.custom((value) => {
|
|
26
|
-
let spriteDefinition = definition_store_1.DefinitionStore.getDefinitionOrFail(_1_sprite_1.SpriteComponent, value);
|
|
27
|
-
if (restrictions?.size) {
|
|
28
|
-
if (spriteDefinition.url.size.x !== restrictions.size.x) {
|
|
29
|
-
throw new Error(`Sprite width must be '${restrictions.size.x}px'. Got: '${spriteDefinition.url.size.x}'`);
|
|
30
|
-
}
|
|
31
|
-
if (spriteDefinition.url.size.y !== restrictions.size.y) {
|
|
32
|
-
throw new Error(`Sprite height must be '${restrictions.size.y}px'. Got: '${spriteDefinition.url.size.y}'`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (restrictions?.scale) {
|
|
36
|
-
if (spriteDefinition.scale !== restrictions.scale) {
|
|
37
|
-
throw new Error(`Sprite '${value}' scale must be '${restrictions.scale}'. Got: '${spriteDefinition.scale}'`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
});
|
|
42
|
-
exports.SpriteSchema = SpriteSchema;
|
|
43
|
-
//# sourceMappingURL=sprite-validators.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from 'helpers-lib';
|
|
2
|
-
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
3
|
-
import { Output } from '../../framework/interfaces';
|
|
4
|
-
import { ValidatedSpriteUrl } from '../../helpers/validator/custom-validators/sprite.custom-validator';
|
|
5
|
-
export type SpriteID = string;
|
|
6
|
-
export interface RawSpriteDefinition {
|
|
7
|
-
id: string;
|
|
8
|
-
url: ValidatedSpriteUrl;
|
|
9
|
-
scale: number;
|
|
10
|
-
anchor: Vec2;
|
|
11
|
-
boundingShapes: Vec2[][];
|
|
12
|
-
}
|
|
13
|
-
export declare class SpriteComponent extends DefinitionComponent<RawSpriteDefinition> {
|
|
14
|
-
process(definitions: RawSpriteDefinition[], output: Output): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SpriteComponent = void 0;
|
|
13
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
14
|
-
const joi_1 = __importDefault(require("joi"));
|
|
15
|
-
const definition_component_1 = require("../../decorators/definition-component");
|
|
16
|
-
const shape_validators_1 = require("../_validators/shape-validators");
|
|
17
|
-
let SpriteComponent = class SpriteComponent extends definition_component_1.DefinitionComponent {
|
|
18
|
-
async process(definitions, output) {
|
|
19
|
-
await output.addFile({
|
|
20
|
-
path: '/_premade/assets/sprites.ts',
|
|
21
|
-
preText: `import { AssetDefinition } from 'bard-legends-framework';`,
|
|
22
|
-
variableName: 'SpriteAssets',
|
|
23
|
-
variableType: 'readonly AssetDefinition[]',
|
|
24
|
-
assetUrl: 'url',
|
|
25
|
-
variable: definitions.map(definition => ({
|
|
26
|
-
id: definition.id,
|
|
27
|
-
url: definition.url.url
|
|
28
|
-
}))
|
|
29
|
-
});
|
|
30
|
-
await output.addFile({
|
|
31
|
-
path: '/_premade/asset-definitions/sprites.ts',
|
|
32
|
-
preText: `import { SpriteDefinition } from "bard-legends-framework";`,
|
|
33
|
-
variableName: 'SpriteDefinitions',
|
|
34
|
-
variableType: 'Readonly<Record<string, SpriteDefinition>>',
|
|
35
|
-
variable: helpers_lib_1.JsonHelper.arrayToObject(definitions, 'id', {
|
|
36
|
-
transformFunction: definition => ({
|
|
37
|
-
id: definition.id,
|
|
38
|
-
size: definition.url.size,
|
|
39
|
-
scale: definition.scale,
|
|
40
|
-
anchor: definition.anchor,
|
|
41
|
-
boundingShapes: definition.boundingShapes
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
exports.SpriteComponent = SpriteComponent;
|
|
48
|
-
exports.SpriteComponent = SpriteComponent = __decorate([
|
|
49
|
-
(0, definition_component_1.DefinitionComponentDecorator)({
|
|
50
|
-
componentName: 'SPRITE',
|
|
51
|
-
keyName: 'id',
|
|
52
|
-
validationSchema: joi_1.default.object()
|
|
53
|
-
.keys({
|
|
54
|
-
id: joi_1.default.string().required(),
|
|
55
|
-
url: joi_1.default.string().sprite().required(),
|
|
56
|
-
scale: joi_1.default.number().min(0.1).max(1).default(1).optional(),
|
|
57
|
-
anchor: joi_1.default.object()
|
|
58
|
-
.keys({
|
|
59
|
-
x: joi_1.default.number().min(0).max(1).required(),
|
|
60
|
-
y: joi_1.default.number().min(0).max(1).required()
|
|
61
|
-
})
|
|
62
|
-
.default({ x: 0.5, y: 0.5 })
|
|
63
|
-
.optional(),
|
|
64
|
-
boundingShapes: (0, shape_validators_1.PoligonSchema)().optional()
|
|
65
|
-
})
|
|
66
|
-
.positionOnSprite({
|
|
67
|
-
selectSpriteDefinition: (value) => value,
|
|
68
|
-
positionsJsonPath: ['$..boundingShapes[*][*]'],
|
|
69
|
-
includeRotationFromAnchor: false
|
|
70
|
-
})
|
|
71
|
-
.required()
|
|
72
|
-
})
|
|
73
|
-
], SpriteComponent);
|
|
74
|
-
//# sourceMappingURL=1-sprite.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
2
|
-
import { Output } from '../../framework/interfaces';
|
|
3
|
-
export type SpriteGroupID = string;
|
|
4
|
-
interface SpriteGroupDefinition {
|
|
5
|
-
id: string;
|
|
6
|
-
group: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare class SpriteGroupComponent extends DefinitionComponent<SpriteGroupDefinition> {
|
|
9
|
-
process(definitions: SpriteGroupDefinition[], output: Output): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SpriteGroupComponent = void 0;
|
|
13
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
14
|
-
const joi_1 = __importDefault(require("joi"));
|
|
15
|
-
const definition_component_1 = require("../../decorators/definition-component");
|
|
16
|
-
const _1_sprite_1 = require("./1-sprite");
|
|
17
|
-
let SpriteGroupComponent = class SpriteGroupComponent extends definition_component_1.DefinitionComponent {
|
|
18
|
-
async process(definitions, output) {
|
|
19
|
-
await output.addFile({
|
|
20
|
-
path: '/_premade/asset-definitions/sprite-groups.ts',
|
|
21
|
-
preText: ``,
|
|
22
|
-
variableName: 'SpriteGroupDefinitions',
|
|
23
|
-
variableType: 'Readonly<Record<string, readonly string[]>>',
|
|
24
|
-
variable: helpers_lib_1.JsonHelper.arrayToObject(definitions, 'id', { transformFunction: definition => definition.group })
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.SpriteGroupComponent = SpriteGroupComponent;
|
|
29
|
-
exports.SpriteGroupComponent = SpriteGroupComponent = __decorate([
|
|
30
|
-
(0, definition_component_1.DefinitionComponentDecorator)({
|
|
31
|
-
componentName: 'SPRITE-GROUP',
|
|
32
|
-
keyName: 'id',
|
|
33
|
-
validationSchema: joi_1.default.object()
|
|
34
|
-
.keys({
|
|
35
|
-
id: joi_1.default.string().required(),
|
|
36
|
-
group: joi_1.default.array().items(joi_1.default.string().reference(_1_sprite_1.SpriteComponent)).unique().required()
|
|
37
|
-
})
|
|
38
|
-
.required()
|
|
39
|
-
})
|
|
40
|
-
], SpriteGroupComponent);
|
|
41
|
-
//# sourceMappingURL=2-sprite-group.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
2
|
-
import { Output } from '../../framework/interfaces';
|
|
3
|
-
export type FontID = string;
|
|
4
|
-
interface RawFontDefinition {
|
|
5
|
-
id: string;
|
|
6
|
-
fontFamily: string;
|
|
7
|
-
url: string;
|
|
8
|
-
}
|
|
9
|
-
export interface FontDefinition {
|
|
10
|
-
readonly id: FontID;
|
|
11
|
-
readonly fontFamily: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class FontComponent extends DefinitionComponent<RawFontDefinition> {
|
|
14
|
-
constructor();
|
|
15
|
-
process(definitions: RawFontDefinition[], output: Output): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.FontComponent = void 0;
|
|
16
|
-
const helpers_lib_1 = require("helpers-lib");
|
|
17
|
-
const joi_1 = __importDefault(require("joi"));
|
|
18
|
-
const definition_component_1 = require("../../decorators/definition-component");
|
|
19
|
-
const index_file_generator_1 = require("../../framework/file-generators/index-file-generator");
|
|
20
|
-
const INDEX_ENTRY = `
|
|
21
|
-
export interface FontDefinition {
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly fontFamily: string;
|
|
24
|
-
}`;
|
|
25
|
-
let FontComponent = class FontComponent extends definition_component_1.DefinitionComponent {
|
|
26
|
-
constructor() {
|
|
27
|
-
super();
|
|
28
|
-
index_file_generator_1.IndexFileGenerator.addPremadeInterface(INDEX_ENTRY);
|
|
29
|
-
}
|
|
30
|
-
async process(definitions, output) {
|
|
31
|
-
await output.addFile({
|
|
32
|
-
path: '/_premade/assets/fonts.ts',
|
|
33
|
-
preText: `import { AssetDefinition } from 'bard-legends-framework';`,
|
|
34
|
-
variableName: 'FontAssets',
|
|
35
|
-
variableType: 'readonly AssetDefinition[]',
|
|
36
|
-
assetUrl: 'url',
|
|
37
|
-
variable: definitions.map(definition => ({
|
|
38
|
-
id: definition.id,
|
|
39
|
-
url: definition.url
|
|
40
|
-
}))
|
|
41
|
-
});
|
|
42
|
-
await output.addFile({
|
|
43
|
-
path: '/_premade/asset-definitions/fonts.ts',
|
|
44
|
-
preText: `import { FontDefinition } from "../../";`,
|
|
45
|
-
variableName: 'FontDefinitions',
|
|
46
|
-
variableType: 'Readonly<Record<string, FontDefinition>>',
|
|
47
|
-
variable: helpers_lib_1.JsonHelper.arrayToObject(definitions, 'id', {
|
|
48
|
-
transformFunction: definition => ({
|
|
49
|
-
id: definition.id,
|
|
50
|
-
fontFamily: definition.fontFamily
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
exports.FontComponent = FontComponent;
|
|
57
|
-
exports.FontComponent = FontComponent = __decorate([
|
|
58
|
-
(0, definition_component_1.DefinitionComponentDecorator)({
|
|
59
|
-
componentName: 'FONT',
|
|
60
|
-
keyName: 'id',
|
|
61
|
-
validationSchema: joi_1.default.object()
|
|
62
|
-
.keys({
|
|
63
|
-
id: joi_1.default.string().required(),
|
|
64
|
-
fontFamily: joi_1.default.string().required(),
|
|
65
|
-
url: joi_1.default.string().path().required()
|
|
66
|
-
})
|
|
67
|
-
.required()
|
|
68
|
-
}),
|
|
69
|
-
__metadata("design:paramtypes", [])
|
|
70
|
-
], FontComponent);
|
|
71
|
-
//# sourceMappingURL=3-font.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ScriptDefinition } from 'script-engine-lib';
|
|
2
|
-
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
3
|
-
import { Output } from '../../framework/interfaces';
|
|
4
|
-
export declare class EventComponent extends DefinitionComponent<ScriptDefinition> {
|
|
5
|
-
process(definitions: ScriptDefinition[], output: Output): Promise<void>;
|
|
6
|
-
}
|