@theia/mini-browser 1.45.1 → 1.46.0-next.72

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 (63) hide show
  1. package/README.md +45 -45
  2. package/lib/browser/environment/mini-browser-environment-module.d.ts +3 -3
  3. package/lib/browser/environment/mini-browser-environment-module.js +24 -24
  4. package/lib/browser/environment/mini-browser-environment.d.ts +25 -25
  5. package/lib/browser/environment/mini-browser-environment.js +95 -95
  6. package/lib/browser/environment/mini-browser-environment.js.map +1 -1
  7. package/lib/browser/location-mapper-service.d.ts +58 -58
  8. package/lib/browser/location-mapper-service.js +140 -140
  9. package/lib/browser/mini-browser-content-style.d.ts +17 -17
  10. package/lib/browser/mini-browser-content-style.js +36 -36
  11. package/lib/browser/mini-browser-content.d.ts +177 -177
  12. package/lib/browser/mini-browser-content.js +554 -554
  13. package/lib/browser/mini-browser-frontend-module.d.ts +4 -4
  14. package/lib/browser/mini-browser-frontend-module.js +70 -70
  15. package/lib/browser/mini-browser-frontend-security-warnings.d.ts +11 -11
  16. package/lib/browser/mini-browser-frontend-security-warnings.js +73 -73
  17. package/lib/browser/mini-browser-open-handler.d.ts +76 -76
  18. package/lib/browser/mini-browser-open-handler.js +292 -292
  19. package/lib/browser/mini-browser.d.ts +25 -25
  20. package/lib/browser/mini-browser.js +118 -118
  21. package/lib/common/mini-browser-endpoint.d.ts +12 -12
  22. package/lib/common/mini-browser-endpoint.js +31 -31
  23. package/lib/common/mini-browser-service.d.ts +14 -14
  24. package/lib/common/mini-browser-service.js +20 -20
  25. package/lib/electron-browser/environment/electron-mini-browser-environment-module.d.ts +3 -3
  26. package/lib/electron-browser/environment/electron-mini-browser-environment-module.js +25 -25
  27. package/lib/electron-browser/environment/electron-mini-browser-environment.d.ts +9 -9
  28. package/lib/electron-browser/environment/electron-mini-browser-environment.js +60 -60
  29. package/lib/electron-main/mini-browser-electron-main-contribution.d.ts +12 -12
  30. package/lib/electron-main/mini-browser-electron-main-contribution.js +54 -54
  31. package/lib/node/mini-browser-backend-module.d.ts +3 -3
  32. package/lib/node/mini-browser-backend-module.js +41 -41
  33. package/lib/node/mini-browser-backend-security-warnings.d.ts +5 -5
  34. package/lib/node/mini-browser-backend-security-warnings.js +51 -51
  35. package/lib/node/mini-browser-endpoint.d.ts +97 -97
  36. package/lib/node/mini-browser-endpoint.js +268 -268
  37. package/lib/node/mini-browser-endpoint.js.map +1 -1
  38. package/lib/node/mini-browser-ws-validator.d.ts +12 -12
  39. package/lib/node/mini-browser-ws-validator.js +69 -69
  40. package/lib/package.spec.js +18 -18
  41. package/package.json +5 -6
  42. package/src/browser/environment/mini-browser-environment-module.ts +24 -24
  43. package/src/browser/environment/mini-browser-environment.ts +87 -87
  44. package/src/browser/location-mapper-service.ts +150 -150
  45. package/src/browser/mini-browser-content-style.ts +32 -32
  46. package/src/browser/mini-browser-content.ts +630 -630
  47. package/src/browser/mini-browser-frontend-module.ts +86 -86
  48. package/src/browser/mini-browser-frontend-security-warnings.ts +59 -59
  49. package/src/browser/mini-browser-open-handler.ts +312 -312
  50. package/src/browser/mini-browser.ts +110 -110
  51. package/src/browser/pdfobject.d.ts +99 -99
  52. package/src/browser/style/index.css +157 -157
  53. package/src/browser/style/mini-browser.svg +17 -17
  54. package/src/common/mini-browser-endpoint.ts +28 -28
  55. package/src/common/mini-browser-service.ts +29 -29
  56. package/src/electron-browser/environment/electron-mini-browser-environment-module.ts +25 -25
  57. package/src/electron-browser/environment/electron-mini-browser-environment.ts +53 -53
  58. package/src/electron-main/mini-browser-electron-main-contribution.ts +42 -42
  59. package/src/node/mini-browser-backend-module.ts +41 -41
  60. package/src/node/mini-browser-backend-security-warnings.ts +45 -45
  61. package/src/node/mini-browser-endpoint.ts +315 -315
  62. package/src/node/mini-browser-ws-validator.ts +56 -56
  63. package/src/package.spec.ts +21 -21
@@ -1,110 +1,110 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
18
- import { Message } from '@theia/core/shared/@phosphor/messaging';
19
- import URI from '@theia/core/lib/common/uri';
20
- import { NavigatableWidget, StatefulWidget } from '@theia/core/lib/browser';
21
- import { DisposableCollection } from '@theia/core/lib/common/disposable';
22
- import { BaseWidget, codicon, PanelLayout } from '@theia/core/lib/browser/widgets/widget';
23
- import { MiniBrowserProps, MiniBrowserContentFactory } from './mini-browser-content';
24
-
25
- export { MiniBrowserProps };
26
-
27
- @injectable()
28
- export class MiniBrowserOptions {
29
- uri: URI;
30
- }
31
-
32
- @injectable()
33
- export class MiniBrowser extends BaseWidget implements NavigatableWidget, StatefulWidget {
34
-
35
- static ID = 'mini-browser';
36
- static ICON = codicon('globe');
37
-
38
- @inject(MiniBrowserOptions)
39
- protected readonly options: MiniBrowserOptions;
40
-
41
- @inject(MiniBrowserContentFactory)
42
- protected readonly createContent: MiniBrowserContentFactory;
43
-
44
- @postConstruct()
45
- protected init(): void {
46
- const { uri } = this.options;
47
- this.id = `${MiniBrowser.ID}:${uri.toString()}`;
48
- this.title.closable = true;
49
- this.layout = new PanelLayout({ fitPolicy: 'set-no-constraint' });
50
- }
51
-
52
- getResourceUri(): URI | undefined {
53
- return this.options.uri;
54
- }
55
-
56
- createMoveToUri(resourceUri: URI): URI | undefined {
57
- return this.options.uri && this.options.uri.withPath(resourceUri.path);
58
- }
59
-
60
- protected props: MiniBrowserProps | undefined;
61
- protected readonly toDisposeOnProps = new DisposableCollection();
62
-
63
- setProps(raw: MiniBrowserProps): void {
64
- const props: MiniBrowserProps = {
65
- toolbar: raw.toolbar,
66
- startPage: raw.startPage,
67
- sandbox: raw.sandbox,
68
- iconClass: raw.iconClass,
69
- name: raw.name,
70
- resetBackground: raw.resetBackground
71
- };
72
- if (JSON.stringify(props) === JSON.stringify(this.props)) {
73
- return;
74
- }
75
- this.toDisposeOnProps.dispose();
76
- this.toDispose.push(this.toDisposeOnProps);
77
- this.props = props;
78
-
79
- this.title.caption = this.title.label = props.name || 'Browser';
80
- this.title.iconClass = props.iconClass || MiniBrowser.ICON;
81
-
82
- const content = this.createContent(props);
83
- (this.layout as PanelLayout).addWidget(content);
84
- this.toDisposeOnProps.push(content);
85
- }
86
-
87
- protected override onActivateRequest(msg: Message): void {
88
- super.onActivateRequest(msg);
89
- const widget = (this.layout as PanelLayout).widgets[0];
90
- if (widget) {
91
- widget.activate();
92
- }
93
- }
94
-
95
- storeState(): object {
96
- const { props } = this;
97
- return { props };
98
- }
99
-
100
- restoreState(oldState: object): void {
101
- if (!this.toDisposeOnProps.disposed) {
102
- return;
103
- }
104
- if ('props' in oldState) {
105
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
- this.setProps((<any>oldState)['props']);
107
- }
108
- }
109
-
110
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
18
+ import { Message } from '@theia/core/shared/@phosphor/messaging';
19
+ import URI from '@theia/core/lib/common/uri';
20
+ import { NavigatableWidget, StatefulWidget } from '@theia/core/lib/browser';
21
+ import { DisposableCollection } from '@theia/core/lib/common/disposable';
22
+ import { BaseWidget, codicon, PanelLayout } from '@theia/core/lib/browser/widgets/widget';
23
+ import { MiniBrowserProps, MiniBrowserContentFactory } from './mini-browser-content';
24
+
25
+ export { MiniBrowserProps };
26
+
27
+ @injectable()
28
+ export class MiniBrowserOptions {
29
+ uri: URI;
30
+ }
31
+
32
+ @injectable()
33
+ export class MiniBrowser extends BaseWidget implements NavigatableWidget, StatefulWidget {
34
+
35
+ static ID = 'mini-browser';
36
+ static ICON = codicon('globe');
37
+
38
+ @inject(MiniBrowserOptions)
39
+ protected readonly options: MiniBrowserOptions;
40
+
41
+ @inject(MiniBrowserContentFactory)
42
+ protected readonly createContent: MiniBrowserContentFactory;
43
+
44
+ @postConstruct()
45
+ protected init(): void {
46
+ const { uri } = this.options;
47
+ this.id = `${MiniBrowser.ID}:${uri.toString()}`;
48
+ this.title.closable = true;
49
+ this.layout = new PanelLayout({ fitPolicy: 'set-no-constraint' });
50
+ }
51
+
52
+ getResourceUri(): URI | undefined {
53
+ return this.options.uri;
54
+ }
55
+
56
+ createMoveToUri(resourceUri: URI): URI | undefined {
57
+ return this.options.uri && this.options.uri.withPath(resourceUri.path);
58
+ }
59
+
60
+ protected props: MiniBrowserProps | undefined;
61
+ protected readonly toDisposeOnProps = new DisposableCollection();
62
+
63
+ setProps(raw: MiniBrowserProps): void {
64
+ const props: MiniBrowserProps = {
65
+ toolbar: raw.toolbar,
66
+ startPage: raw.startPage,
67
+ sandbox: raw.sandbox,
68
+ iconClass: raw.iconClass,
69
+ name: raw.name,
70
+ resetBackground: raw.resetBackground
71
+ };
72
+ if (JSON.stringify(props) === JSON.stringify(this.props)) {
73
+ return;
74
+ }
75
+ this.toDisposeOnProps.dispose();
76
+ this.toDispose.push(this.toDisposeOnProps);
77
+ this.props = props;
78
+
79
+ this.title.caption = this.title.label = props.name || 'Browser';
80
+ this.title.iconClass = props.iconClass || MiniBrowser.ICON;
81
+
82
+ const content = this.createContent(props);
83
+ (this.layout as PanelLayout).addWidget(content);
84
+ this.toDisposeOnProps.push(content);
85
+ }
86
+
87
+ protected override onActivateRequest(msg: Message): void {
88
+ super.onActivateRequest(msg);
89
+ const widget = (this.layout as PanelLayout).widgets[0];
90
+ if (widget) {
91
+ widget.activate();
92
+ }
93
+ }
94
+
95
+ storeState(): object {
96
+ const { props } = this;
97
+ return { props };
98
+ }
99
+
100
+ restoreState(oldState: object): void {
101
+ if (!this.toDisposeOnProps.disposed) {
102
+ return;
103
+ }
104
+ if ('props' in oldState) {
105
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
+ this.setProps((<any>oldState)['props']);
107
+ }
108
+ }
109
+
110
+ }
@@ -1,99 +1,99 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- /**
18
- * The documentation was copied from https://pdfobject.com/#api.
19
- * License: MIT (https://pipwerks.mit-license.org)
20
- */
21
- declare module 'pdfobject' {
22
-
23
- interface Options {
24
-
25
- /**
26
- * Alias for PDF Open Parameters "page" option.
27
- * Any number entered here will cause the PDF be opened to the specified page number (if the browser supports it). If left unspecified, the PDF will open on page 1.
28
- */
29
- readonly page?: string;
30
-
31
- /**
32
- * Any string entered here will be appended to the generated <embed> element as the ID.
33
- * If left unspecified, no ID will be appended.
34
- */
35
- readonly id?: string;
36
-
37
- /**
38
- * Will insert the width as an inline style via the style attribute on the <embed> element.
39
- * If left unspecified, `PDFObject` will default to `100%`. Is standard CSS, supports all units, including `px`, `%`, `em`, and `rem`.
40
- */
41
- readonly width?: string;
42
-
43
- /**
44
- * Will insert the height as an inline style via the style attribute on the target element.
45
- * If left unspecified, `PDFObject` will default to `100%`. Is standard CSS, supports all units, including `px`, `%`, `em`, and `rem`.
46
- */
47
- readonly height?: string;
48
-
49
- /**
50
- * Any string entered here will be inserted into the target element when the browser doesn't support inline PDFs.
51
- *
52
- * **Default**: `"<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>"`.
53
- * Supports HTML. Use the shortcode `[url]` to insert the URL of the PDF (as specified via the URL parameter in the `embed()` method).
54
- * Entering `false` will disable the fallback text option and prevent `PDFObject` from inserting fallback text.
55
- */
56
- readonly fallbackLink?: string | boolean;
57
-
58
- /**
59
- * Allows you to specify Adobe's PDF Open Parameters.
60
- *
61
- * **Warning**: These are proprietary and not well supported outside of Adobe products.
62
- * Most PDF readers support the page parameter, but not much else. `PDF.js` supports `page`, `zoom`, `nameddest`, and `pagemode`.
63
- */
64
- readonly pdfOpenParams?: {
65
- readonly page?: string;
66
- readonly zoom?: string;
67
- readonly nameddest?: string;
68
- readonly pagemode?: string;
69
- }
70
- }
71
-
72
- interface PDFObject {
73
-
74
- /**
75
- * Returns the embedded element (`<embed>` for most situations, and `<iframe>` when integrated with PDF.js), or `false` if unable to embed.
76
- *
77
- * The heart of `PDFObject`, the embed method provides a ton of functionality and flexibility.
78
- */
79
- embed(url: string, target?: string | HTMLElement /* | jQuery object (HTML node) for target */, options?: Options): HTMLElement;
80
-
81
- /**
82
- * Returns the version of PDFObject.
83
- */
84
- readonly pdfobjectversion: string;
85
-
86
- /**
87
- * Returns `true` or `false` based on detection of `navigator.mimeTypes['application/pdf']` and/or ActiveX `AcroPDF.PDF` or `PDF.PdfCtrl`.
88
- *
89
- * `PDFObject` does not perform detection for specific vendors (Adobe Reader, FoxIt, PDF.js, etc.).
90
- * Note: For those who wish to target PDF.js, there is an option in `PDFObject.embed()` to force use of PDF.js.
91
- */
92
- readonly supportsPDFs: boolean;
93
- }
94
-
95
- const pdfObject: PDFObject;
96
-
97
- export = pdfObject;
98
-
99
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /**
18
+ * The documentation was copied from https://pdfobject.com/#api.
19
+ * License: MIT (https://pipwerks.mit-license.org)
20
+ */
21
+ declare module 'pdfobject' {
22
+
23
+ interface Options {
24
+
25
+ /**
26
+ * Alias for PDF Open Parameters "page" option.
27
+ * Any number entered here will cause the PDF be opened to the specified page number (if the browser supports it). If left unspecified, the PDF will open on page 1.
28
+ */
29
+ readonly page?: string;
30
+
31
+ /**
32
+ * Any string entered here will be appended to the generated <embed> element as the ID.
33
+ * If left unspecified, no ID will be appended.
34
+ */
35
+ readonly id?: string;
36
+
37
+ /**
38
+ * Will insert the width as an inline style via the style attribute on the <embed> element.
39
+ * If left unspecified, `PDFObject` will default to `100%`. Is standard CSS, supports all units, including `px`, `%`, `em`, and `rem`.
40
+ */
41
+ readonly width?: string;
42
+
43
+ /**
44
+ * Will insert the height as an inline style via the style attribute on the target element.
45
+ * If left unspecified, `PDFObject` will default to `100%`. Is standard CSS, supports all units, including `px`, `%`, `em`, and `rem`.
46
+ */
47
+ readonly height?: string;
48
+
49
+ /**
50
+ * Any string entered here will be inserted into the target element when the browser doesn't support inline PDFs.
51
+ *
52
+ * **Default**: `"<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>"`.
53
+ * Supports HTML. Use the shortcode `[url]` to insert the URL of the PDF (as specified via the URL parameter in the `embed()` method).
54
+ * Entering `false` will disable the fallback text option and prevent `PDFObject` from inserting fallback text.
55
+ */
56
+ readonly fallbackLink?: string | boolean;
57
+
58
+ /**
59
+ * Allows you to specify Adobe's PDF Open Parameters.
60
+ *
61
+ * **Warning**: These are proprietary and not well supported outside of Adobe products.
62
+ * Most PDF readers support the page parameter, but not much else. `PDF.js` supports `page`, `zoom`, `nameddest`, and `pagemode`.
63
+ */
64
+ readonly pdfOpenParams?: {
65
+ readonly page?: string;
66
+ readonly zoom?: string;
67
+ readonly nameddest?: string;
68
+ readonly pagemode?: string;
69
+ }
70
+ }
71
+
72
+ interface PDFObject {
73
+
74
+ /**
75
+ * Returns the embedded element (`<embed>` for most situations, and `<iframe>` when integrated with PDF.js), or `false` if unable to embed.
76
+ *
77
+ * The heart of `PDFObject`, the embed method provides a ton of functionality and flexibility.
78
+ */
79
+ embed(url: string, target?: string | HTMLElement /* | jQuery object (HTML node) for target */, options?: Options): HTMLElement;
80
+
81
+ /**
82
+ * Returns the version of PDFObject.
83
+ */
84
+ readonly pdfobjectversion: string;
85
+
86
+ /**
87
+ * Returns `true` or `false` based on detection of `navigator.mimeTypes['application/pdf']` and/or ActiveX `AcroPDF.PDF` or `PDF.PdfCtrl`.
88
+ *
89
+ * `PDFObject` does not perform detection for specific vendors (Adobe Reader, FoxIt, PDF.js, etc.).
90
+ * Note: For those who wish to target PDF.js, there is an option in `PDFObject.embed()` to force use of PDF.js.
91
+ */
92
+ readonly supportsPDFs: boolean;
93
+ }
94
+
95
+ const pdfObject: PDFObject;
96
+
97
+ export = pdfObject;
98
+
99
+ }