@po-ui/ng-code-editor 5.22.0 → 5.22.4
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/README.md +20 -20
- package/bundles/po-ui-ng-code-editor.umd.js +929 -929
- package/bundles/po-ui-ng-code-editor.umd.js.map +1 -1
- package/esm2015/lib/components/po-code-editor/interfaces/po-code-editor-registerable-options.interface.js +2 -2
- package/esm2015/lib/components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface.js +2 -2
- package/esm2015/lib/components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface.js +2 -2
- package/esm2015/lib/components/po-code-editor/interfaces/po-code-editor-registerable.interface.js +2 -2
- package/esm2015/lib/components/po-code-editor/po-code-editor-base.component.js +248 -248
- package/esm2015/lib/components/po-code-editor/po-code-editor-register.service.js +63 -63
- package/esm2015/lib/components/po-code-editor/po-code-editor-suggestion.service.js +28 -28
- package/esm2015/lib/components/po-code-editor/po-code-editor.component.js +225 -225
- package/esm2015/lib/components/po-code-editor/po-code-editor.module.js +31 -31
- package/esm2015/lib/index.js +4 -4
- package/esm2015/po-ui-ng-code-editor.js +6 -6
- package/esm2015/public-api.js +2 -2
- package/fesm2015/po-ui-ng-code-editor.js +574 -574
- package/fesm2015/po-ui-ng-code-editor.js.map +1 -1
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-options.interface.d.ts +22 -22
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface.d.ts +37 -37
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface.d.ts +21 -21
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable.interface.d.ts +17 -17
- package/lib/components/po-code-editor/po-code-editor-base.component.d.ts +191 -191
- package/lib/components/po-code-editor/po-code-editor-register.service.d.ts +67 -67
- package/lib/components/po-code-editor/po-code-editor-suggestion.service.d.ts +7 -7
- package/lib/components/po-code-editor/po-code-editor.component.d.ts +58 -58
- package/lib/components/po-code-editor/po-code-editor.module.d.ts +10 -10
- package/lib/index.d.ts +7 -7
- package/package.json +5 -5
- package/po-ui-ng-code-editor-5.22.4.tgz +0 -0
- package/po-ui-ng-code-editor.d.ts +6 -6
- package/po-ui-ng-code-editor.metadata.json +1 -1
- package/public-api.d.ts +1 -1
- package/schematics/README.md +98 -98
- package/schematics/collection.json +10 -10
- package/schematics/ng-add/index.d.ts +10 -10
- package/schematics/ng-add/index.js +38 -38
- package/schematics/ng-add/index.spec.d.ts +1 -1
- package/schematics/ng-add/index.spec.js +113 -113
- package/schematics/ng-add/schema.json +7 -7
- package/po-ui-ng-code-editor-5.22.0.tgz +0 -0
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
5
|
-
const project_1 = require("@po-ui/ng-schematics/project");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
8
|
-
describe('Schematic: ng-add', () => {
|
|
9
|
-
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
10
|
-
const workspaceOptions = {
|
|
11
|
-
name: 'workspace',
|
|
12
|
-
newProjectRoot: 'projects',
|
|
13
|
-
version: '6.0.0'
|
|
14
|
-
};
|
|
15
|
-
const componentOptions = {
|
|
16
|
-
name: 'po'
|
|
17
|
-
};
|
|
18
|
-
let appTree;
|
|
19
|
-
beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
|
|
21
|
-
appTree = yield runner
|
|
22
|
-
.runExternalSchematicAsync('@schematics/angular', 'application', componentOptions, appTree)
|
|
23
|
-
.toPromise();
|
|
24
|
-
}));
|
|
25
|
-
describe('Dependencies:', () => {
|
|
26
|
-
it('should update package.json with @po-ui/ng-code-editor dependency and run nodePackageInstall', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
28
|
-
const packageJson = JSON.parse(getFileContent(tree, '/package.json'));
|
|
29
|
-
const dependencies = packageJson.dependencies;
|
|
30
|
-
expect(dependencies['@po-ui/ng-code-editor']).toBeDefined();
|
|
31
|
-
expect(Object.keys(dependencies)).toEqual(Object.keys(dependencies).sort());
|
|
32
|
-
expect(runner.tasks.some(task => task.name === 'node-package')).toBe(true);
|
|
33
|
-
}));
|
|
34
|
-
});
|
|
35
|
-
describe('Imports:', () => {
|
|
36
|
-
it('should add the PoCodeEditorModule to the project module', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
const poCodeEditorModuleName = 'PoCodeEditorModule';
|
|
38
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
39
|
-
const fileContent = getFileContent(tree, `projects/${componentOptions.name}/src/app/app.module.ts`);
|
|
40
|
-
expect(fileContent).toContain(poCodeEditorModuleName);
|
|
41
|
-
}));
|
|
42
|
-
});
|
|
43
|
-
describe('Theme configuration:', () => {
|
|
44
|
-
const defaultThemePath = './node_modules/@po-ui/style/css/po-theme-default.min.css';
|
|
45
|
-
it('should add default theme in styles of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
var _a;
|
|
47
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
48
|
-
const workspace = (_a = project_1.getWorkspaceConfigGracefully(tree)) !== null && _a !== void 0 ? _a : {};
|
|
49
|
-
const project = project_1.getProjectFromWorkspace(workspace);
|
|
50
|
-
expectProjectPropertyFile(project, defaultThemePath, 'styles');
|
|
51
|
-
}));
|
|
52
|
-
it('shouldn`t add a theme file in styles of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
var _b;
|
|
54
|
-
writePropertiesFileToWorkspace(appTree, defaultThemePath, 'styles');
|
|
55
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
56
|
-
const workspace = (_b = project_1.getWorkspaceConfigGracefully(tree)) !== null && _b !== void 0 ? _b : {};
|
|
57
|
-
const project = project_1.getProjectFromWorkspace(workspace);
|
|
58
|
-
const styles = project_1.getProjectTargetOptions(project, 'build').styles;
|
|
59
|
-
expect(styles).toEqual([`projects/${componentOptions.name}/src/styles.css`, defaultThemePath]);
|
|
60
|
-
}));
|
|
61
|
-
});
|
|
62
|
-
describe('Assets configuration:', () => {
|
|
63
|
-
const defaultAssetsPath = {
|
|
64
|
-
'glob': '**/*',
|
|
65
|
-
'input': 'node_modules/monaco-editor/min',
|
|
66
|
-
'output': '/assets/monaco/'
|
|
67
|
-
};
|
|
68
|
-
it('should add assets of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
var _a;
|
|
70
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
71
|
-
const workspace = (_a = project_1.getWorkspaceConfigGracefully(tree)) !== null && _a !== void 0 ? _a : {};
|
|
72
|
-
const project = project_1.getProjectFromWorkspace(workspace);
|
|
73
|
-
const assets = project_1.getProjectTargetOptions(project, 'build').assets;
|
|
74
|
-
const hasMonacoAssets = assets.some(element => typeof element === 'object' && JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
|
|
75
|
-
expect(hasMonacoAssets).toBe(true);
|
|
76
|
-
}));
|
|
77
|
-
it('shouldn`t add a monaco assets file in assets of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
-
var _b;
|
|
79
|
-
writePropertiesFileToWorkspace(appTree, `${defaultAssetsPath}`, 'assets');
|
|
80
|
-
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
81
|
-
const workspace = (_b = project_1.getWorkspaceConfigGracefully(tree)) !== null && _b !== void 0 ? _b : {};
|
|
82
|
-
const project = project_1.getProjectFromWorkspace(workspace);
|
|
83
|
-
const assets = project_1.getProjectTargetOptions(project, 'build').assets;
|
|
84
|
-
const getMonacoAssets = assets.filter(element => JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
|
|
85
|
-
expect(getMonacoAssets.length).toBe(1);
|
|
86
|
-
}));
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
/** Gets the content of a specified file from a schematic tree. */
|
|
90
|
-
function getFileContent(tree, filePath) {
|
|
91
|
-
const contentBuffer = tree.read(filePath);
|
|
92
|
-
if (!contentBuffer) {
|
|
93
|
-
throw new Error(`Cannot read "${filePath}" because it does not exist.`);
|
|
94
|
-
}
|
|
95
|
-
return contentBuffer.toString();
|
|
96
|
-
}
|
|
97
|
-
/** Expects the given file to be in the property of the specified workspace project. */
|
|
98
|
-
function expectProjectPropertyFile(project, filePath, property) {
|
|
99
|
-
expect(project_1.getProjectTargetOptions(project, 'build')[property]).toContain(filePath, `Expected "${filePath}" to be added to the project ${property} in the workspace.`);
|
|
100
|
-
}
|
|
101
|
-
function writePropertiesFileToWorkspace(tree, filePath, property) {
|
|
102
|
-
var _a;
|
|
103
|
-
const workspace = (_a = project_1.getWorkspaceConfigGracefully(tree)) !== null && _a !== void 0 ? _a : {};
|
|
104
|
-
const project = project_1.getProjectFromWorkspace(workspace);
|
|
105
|
-
const buildOptions = project_1.getProjectTargetOptions(project, 'build');
|
|
106
|
-
if (!buildOptions[property]) {
|
|
107
|
-
buildOptions[property] = [filePath];
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
buildOptions[property].push(filePath);
|
|
111
|
-
}
|
|
112
|
-
tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
|
|
113
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
5
|
+
const project_1 = require("@po-ui/ng-schematics/project");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
8
|
+
describe('Schematic: ng-add', () => {
|
|
9
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
10
|
+
const workspaceOptions = {
|
|
11
|
+
name: 'workspace',
|
|
12
|
+
newProjectRoot: 'projects',
|
|
13
|
+
version: '6.0.0'
|
|
14
|
+
};
|
|
15
|
+
const componentOptions = {
|
|
16
|
+
name: 'po'
|
|
17
|
+
};
|
|
18
|
+
let appTree;
|
|
19
|
+
beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
appTree = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
|
|
21
|
+
appTree = yield runner
|
|
22
|
+
.runExternalSchematicAsync('@schematics/angular', 'application', componentOptions, appTree)
|
|
23
|
+
.toPromise();
|
|
24
|
+
}));
|
|
25
|
+
describe('Dependencies:', () => {
|
|
26
|
+
it('should update package.json with @po-ui/ng-code-editor dependency and run nodePackageInstall', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
28
|
+
const packageJson = JSON.parse(getFileContent(tree, '/package.json'));
|
|
29
|
+
const dependencies = packageJson.dependencies;
|
|
30
|
+
expect(dependencies['@po-ui/ng-code-editor']).toBeDefined();
|
|
31
|
+
expect(Object.keys(dependencies)).toEqual(Object.keys(dependencies).sort());
|
|
32
|
+
expect(runner.tasks.some(task => task.name === 'node-package')).toBe(true);
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
35
|
+
describe('Imports:', () => {
|
|
36
|
+
it('should add the PoCodeEditorModule to the project module', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const poCodeEditorModuleName = 'PoCodeEditorModule';
|
|
38
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
39
|
+
const fileContent = getFileContent(tree, `projects/${componentOptions.name}/src/app/app.module.ts`);
|
|
40
|
+
expect(fileContent).toContain(poCodeEditorModuleName);
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
describe('Theme configuration:', () => {
|
|
44
|
+
const defaultThemePath = './node_modules/@po-ui/style/css/po-theme-default.min.css';
|
|
45
|
+
it('should add default theme in styles of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
var _a;
|
|
47
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
48
|
+
const workspace = (_a = project_1.getWorkspaceConfigGracefully(tree)) !== null && _a !== void 0 ? _a : {};
|
|
49
|
+
const project = project_1.getProjectFromWorkspace(workspace);
|
|
50
|
+
expectProjectPropertyFile(project, defaultThemePath, 'styles');
|
|
51
|
+
}));
|
|
52
|
+
it('shouldn`t add a theme file in styles of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
var _b;
|
|
54
|
+
writePropertiesFileToWorkspace(appTree, defaultThemePath, 'styles');
|
|
55
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
56
|
+
const workspace = (_b = project_1.getWorkspaceConfigGracefully(tree)) !== null && _b !== void 0 ? _b : {};
|
|
57
|
+
const project = project_1.getProjectFromWorkspace(workspace);
|
|
58
|
+
const styles = project_1.getProjectTargetOptions(project, 'build').styles;
|
|
59
|
+
expect(styles).toEqual([`projects/${componentOptions.name}/src/styles.css`, defaultThemePath]);
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
describe('Assets configuration:', () => {
|
|
63
|
+
const defaultAssetsPath = {
|
|
64
|
+
'glob': '**/*',
|
|
65
|
+
'input': 'node_modules/monaco-editor/min',
|
|
66
|
+
'output': '/assets/monaco/'
|
|
67
|
+
};
|
|
68
|
+
it('should add assets of build project', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
var _a;
|
|
70
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
71
|
+
const workspace = (_a = project_1.getWorkspaceConfigGracefully(tree)) !== null && _a !== void 0 ? _a : {};
|
|
72
|
+
const project = project_1.getProjectFromWorkspace(workspace);
|
|
73
|
+
const assets = project_1.getProjectTargetOptions(project, 'build').assets;
|
|
74
|
+
const hasMonacoAssets = assets.some(element => typeof element === 'object' && JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
|
|
75
|
+
expect(hasMonacoAssets).toBe(true);
|
|
76
|
+
}));
|
|
77
|
+
it('shouldn`t add a monaco assets file in assets of build project multiple times', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
var _b;
|
|
79
|
+
writePropertiesFileToWorkspace(appTree, `${defaultAssetsPath}`, 'assets');
|
|
80
|
+
const tree = yield runner.runSchematicAsync('ng-add', componentOptions, appTree).toPromise();
|
|
81
|
+
const workspace = (_b = project_1.getWorkspaceConfigGracefully(tree)) !== null && _b !== void 0 ? _b : {};
|
|
82
|
+
const project = project_1.getProjectFromWorkspace(workspace);
|
|
83
|
+
const assets = project_1.getProjectTargetOptions(project, 'build').assets;
|
|
84
|
+
const getMonacoAssets = assets.filter(element => JSON.stringify(element) === JSON.stringify(defaultAssetsPath));
|
|
85
|
+
expect(getMonacoAssets.length).toBe(1);
|
|
86
|
+
}));
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
/** Gets the content of a specified file from a schematic tree. */
|
|
90
|
+
function getFileContent(tree, filePath) {
|
|
91
|
+
const contentBuffer = tree.read(filePath);
|
|
92
|
+
if (!contentBuffer) {
|
|
93
|
+
throw new Error(`Cannot read "${filePath}" because it does not exist.`);
|
|
94
|
+
}
|
|
95
|
+
return contentBuffer.toString();
|
|
96
|
+
}
|
|
97
|
+
/** Expects the given file to be in the property of the specified workspace project. */
|
|
98
|
+
function expectProjectPropertyFile(project, filePath, property) {
|
|
99
|
+
expect(project_1.getProjectTargetOptions(project, 'build')[property]).toContain(filePath, `Expected "${filePath}" to be added to the project ${property} in the workspace.`);
|
|
100
|
+
}
|
|
101
|
+
function writePropertiesFileToWorkspace(tree, filePath, property) {
|
|
102
|
+
var _a;
|
|
103
|
+
const workspace = (_a = project_1.getWorkspaceConfigGracefully(tree)) !== null && _a !== void 0 ? _a : {};
|
|
104
|
+
const project = project_1.getProjectFromWorkspace(workspace);
|
|
105
|
+
const buildOptions = project_1.getProjectTargetOptions(project, 'build');
|
|
106
|
+
if (!buildOptions[property]) {
|
|
107
|
+
buildOptions[property] = [filePath];
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
buildOptions[property].push(filePath);
|
|
111
|
+
}
|
|
112
|
+
tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
|
|
113
|
+
}
|
|
114
114
|
//# sourceMappingURL=index.spec.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsNgAdd",
|
|
4
|
-
"title": "Ng Add Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"required": []
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsNgAdd",
|
|
4
|
+
"title": "Ng Add Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": []
|
|
7
|
+
}
|
|
Binary file
|