@dotglitch/ngx-common 1.0.42 → 1.0.44
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/components/vscode/vscode.component.d.ts +1 -5
- package/esm2020/components/vscode/vscode.component.mjs +49 -50
- package/fesm2015/dotglitch-ngx-common.mjs +49 -50
- package/fesm2015/dotglitch-ngx-common.mjs.map +1 -1
- package/fesm2020/dotglitch-ngx-common.mjs +49 -50
- package/fesm2020/dotglitch-ngx-common.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -10372,7 +10372,7 @@ class VscodeComponent {
|
|
|
10372
10372
|
this.resize = () => {
|
|
10373
10373
|
this.editor?.layout();
|
|
10374
10374
|
};
|
|
10375
|
-
this.
|
|
10375
|
+
InstallMonacoUMD(this.installationLocation);
|
|
10376
10376
|
this._sub = this.typeDebounce.subscribe(t => {
|
|
10377
10377
|
this.codeChange.next(this._code = this.editor.getValue());
|
|
10378
10378
|
});
|
|
@@ -10389,21 +10389,7 @@ class VscodeComponent {
|
|
|
10389
10389
|
Monaco?.editor.setTheme(this.theme);
|
|
10390
10390
|
}
|
|
10391
10391
|
async ngAfterViewInit() {
|
|
10392
|
-
await
|
|
10393
|
-
let count = 0;
|
|
10394
|
-
let i = window.setInterval(() => {
|
|
10395
|
-
count++;
|
|
10396
|
-
if (window['monaco'] != undefined) {
|
|
10397
|
-
window.clearInterval(i);
|
|
10398
|
-
Monaco = window['monaco'];
|
|
10399
|
-
res(true);
|
|
10400
|
-
}
|
|
10401
|
-
if (count >= 100) {
|
|
10402
|
-
window.clearInterval(i);
|
|
10403
|
-
res(false);
|
|
10404
|
-
}
|
|
10405
|
-
}, 100);
|
|
10406
|
-
});
|
|
10392
|
+
await InstallMonacoUMD();
|
|
10407
10393
|
this.createEditor();
|
|
10408
10394
|
}
|
|
10409
10395
|
ngOnDestroy() {
|
|
@@ -10427,35 +10413,6 @@ class VscodeComponent {
|
|
|
10427
10413
|
}
|
|
10428
10414
|
configureLanguageSupport() {
|
|
10429
10415
|
}
|
|
10430
|
-
installMonaco() {
|
|
10431
|
-
if (VscodeComponent.isMonacoInstalled)
|
|
10432
|
-
return;
|
|
10433
|
-
if (window['monaco']) {
|
|
10434
|
-
VscodeComponent.isMonacoInstalled = true;
|
|
10435
|
-
return;
|
|
10436
|
-
}
|
|
10437
|
-
// Monaco has a UMD loader that requires this
|
|
10438
|
-
// Merge with any pre-existing global require objects.
|
|
10439
|
-
if (!window['require'])
|
|
10440
|
-
window['require'] = {};
|
|
10441
|
-
if (!window['require']['paths'])
|
|
10442
|
-
window['require']['paths'] = {};
|
|
10443
|
-
if (this.installationLocation.endsWith('/'))
|
|
10444
|
-
this.installationLocation = this.installationLocation.slice(0, -1);
|
|
10445
|
-
window['require']['paths'].vs = this.installationLocation;
|
|
10446
|
-
const monacoFiles = [
|
|
10447
|
-
'loader.js',
|
|
10448
|
-
'editor/editor.main.nls.js',
|
|
10449
|
-
'editor/editor.main.js',
|
|
10450
|
-
];
|
|
10451
|
-
for (let i = 0; i < monacoFiles.length; i++) {
|
|
10452
|
-
const script = document.createElement("script");
|
|
10453
|
-
script.setAttribute("defer", "");
|
|
10454
|
-
script.setAttribute("src", this.installationLocation + '/' + monacoFiles[i]);
|
|
10455
|
-
document.body.append(script);
|
|
10456
|
-
}
|
|
10457
|
-
VscodeComponent.isMonacoInstalled = true;
|
|
10458
|
-
}
|
|
10459
10416
|
download() {
|
|
10460
10417
|
const code = this.editor.getValue();
|
|
10461
10418
|
let blob = new Blob([code], { type: 'text/log' });
|
|
@@ -10471,10 +10428,6 @@ class VscodeComponent {
|
|
|
10471
10428
|
URL.revokeObjectURL(blobURL);
|
|
10472
10429
|
}
|
|
10473
10430
|
}
|
|
10474
|
-
/**
|
|
10475
|
-
* true if the monaco UMD files are injected into the webpage
|
|
10476
|
-
*/
|
|
10477
|
-
VscodeComponent.isMonacoInstalled = false;
|
|
10478
10431
|
VscodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VscodeComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
10479
10432
|
VscodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: VscodeComponent, isStandalone: true, selector: "app-vscode", inputs: { code: "code", customLanguage: "customLanguage", language: "language", installationLocation: "installationLocation", tabSize: "tabSize", readOnly: "readOnly", theme: "theme", fontFamily: "fontFamily", fontSize: "fontSize", automaticLayout: "automaticLayout", colorDecorators: "colorDecorators", folding: "folding", minimapEnabled: "minimapEnabled", minimap: "minimap", scrollbar: "scrollbar", smoothScrolling: "smoothScrolling", mouseWheelScrollSensitivity: "mouseWheelScrollSensitivity", scrollBeyondLastLine: "scrollBeyondLastLine", scrollBeyondLastColumn: "scrollBeyondLastColumn", lineNumbers: "lineNumbers", restSettings: "restSettings" }, outputs: { codeChange: "codeChange" }, host: { listeners: { "window:resize": "resize($event)" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;height:100%;max-height:100vh;max-width:100vw}\n"] });
|
|
10480
10433
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VscodeComponent, decorators: [{
|
|
@@ -10528,6 +10481,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
10528
10481
|
type: HostListener,
|
|
10529
10482
|
args: ['window:resize', ['$event']]
|
|
10530
10483
|
}] } });
|
|
10484
|
+
const InstallMonacoUMD = async (path) => {
|
|
10485
|
+
if (window['monaco'])
|
|
10486
|
+
return window['monaco'];
|
|
10487
|
+
// Prevent duplicate injection
|
|
10488
|
+
const scriptEls = document.querySelectorAll('body>script[monaco][defer][src]');
|
|
10489
|
+
// Only perform installation if a path is specified.
|
|
10490
|
+
if (path && scriptEls.length == 0) {
|
|
10491
|
+
// Monaco has a UMD loader that requires this
|
|
10492
|
+
// Merge with any pre-existing global require objects.
|
|
10493
|
+
if (!window['require'])
|
|
10494
|
+
window['require'] = {};
|
|
10495
|
+
if (!window['require']['paths'])
|
|
10496
|
+
window['require']['paths'] = {};
|
|
10497
|
+
if (path.endsWith('/'))
|
|
10498
|
+
path = path.slice(0, -1);
|
|
10499
|
+
window['require']['paths'].vs = path;
|
|
10500
|
+
const monacoFiles = [
|
|
10501
|
+
'loader.js',
|
|
10502
|
+
'editor/editor.main.nls.js',
|
|
10503
|
+
'editor/editor.main.js',
|
|
10504
|
+
];
|
|
10505
|
+
for (let i = 0; i < monacoFiles.length; i++) {
|
|
10506
|
+
const script = document.createElement("script");
|
|
10507
|
+
script.setAttribute("monaco", "");
|
|
10508
|
+
script.setAttribute("defer", "");
|
|
10509
|
+
script.setAttribute("src", path + '/' + monacoFiles[i]);
|
|
10510
|
+
document.body.append(script);
|
|
10511
|
+
}
|
|
10512
|
+
}
|
|
10513
|
+
// Return a promise that will resolve when monaco finishes loading
|
|
10514
|
+
return await new Promise((res, rej) => {
|
|
10515
|
+
let count = 0;
|
|
10516
|
+
let i = window.setInterval(() => {
|
|
10517
|
+
count++;
|
|
10518
|
+
if (window['monaco'] != undefined) {
|
|
10519
|
+
window.clearInterval(i);
|
|
10520
|
+
Monaco = window['monaco'];
|
|
10521
|
+
res(true);
|
|
10522
|
+
}
|
|
10523
|
+
else if (count >= 100) {
|
|
10524
|
+
window.clearInterval(i);
|
|
10525
|
+
res(false);
|
|
10526
|
+
}
|
|
10527
|
+
}, 100);
|
|
10528
|
+
});
|
|
10529
|
+
};
|
|
10531
10530
|
|
|
10532
10531
|
/**
|
|
10533
10532
|
* Extend this component to automatically generate
|
|
@@ -10608,5 +10607,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
10608
10607
|
* Generated bundle index. Do not edit.
|
|
10609
10608
|
*/
|
|
10610
10609
|
|
|
10611
|
-
export { ComponentResolveStrategy, DependencyService, DialogService, DynamicHTMLComponent, DynamicHTMLOptions, DynamicHTMLRenderer, Fetch, FileService, FilemanagerComponent, HtmlBypass, KeyboardService, LazyLoaderComponent, LazyLoaderModule, LazyLoaderService, MenuDirective, NGX_DYNAMIC_CONFIG, NGX_LAZY_LOADER_CONFIG, NGX_WEB_COMPONENTS_CONFIG, NavigationService, NgxDynamicHTMLModule, OnMount, ReactMagicWrapperComponent, ResourceBypass, ScriptBypass, StyleBypass, TabulatorComponent, ThemeService, TooltipDirective, UrlBypass, VscodeComponent, openMenu, openTooltip };
|
|
10610
|
+
export { ComponentResolveStrategy, DependencyService, DialogService, DynamicHTMLComponent, DynamicHTMLOptions, DynamicHTMLRenderer, Fetch, FileService, FilemanagerComponent, HtmlBypass, InstallMonacoUMD, KeyboardService, LazyLoaderComponent, LazyLoaderModule, LazyLoaderService, MenuDirective, NGX_DYNAMIC_CONFIG, NGX_LAZY_LOADER_CONFIG, NGX_WEB_COMPONENTS_CONFIG, NavigationService, NgxDynamicHTMLModule, OnMount, ReactMagicWrapperComponent, ResourceBypass, ScriptBypass, StyleBypass, TabulatorComponent, ThemeService, TooltipDirective, UrlBypass, VscodeComponent, openMenu, openTooltip };
|
|
10612
10611
|
//# sourceMappingURL=dotglitch-ngx-common.mjs.map
|