@omegagrid/code 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +4 -4
  2. package/dist/components/code.d.ts +0 -33
  3. package/dist/components/code.d.ts.map +0 -1
  4. package/dist/components/code.js +0 -219
  5. package/dist/components/code.js.map +0 -1
  6. package/dist/components/codeBlock.d.ts +0 -208
  7. package/dist/components/codeBlock.d.ts.map +0 -1
  8. package/dist/components/codeBlock.js +0 -211
  9. package/dist/components/codeBlock.js.map +0 -1
  10. package/dist/components/codeDiff.d.ts +0 -35
  11. package/dist/components/codeDiff.d.ts.map +0 -1
  12. package/dist/components/codeDiff.js +0 -243
  13. package/dist/components/codeDiff.js.map +0 -1
  14. package/dist/components/codeView.d.ts +0 -19
  15. package/dist/components/codeView.d.ts.map +0 -1
  16. package/dist/components/codeView.js +0 -85
  17. package/dist/components/codeView.js.map +0 -1
  18. package/dist/components/codeView.style.d.ts +0 -2
  19. package/dist/components/codeView.style.d.ts.map +0 -1
  20. package/dist/components/codeView.style.js +0 -70
  21. package/dist/components/codeView.style.js.map +0 -1
  22. package/dist/components/index.d.ts +0 -6
  23. package/dist/components/index.d.ts.map +0 -1
  24. package/dist/components/index.js +0 -6
  25. package/dist/components/index.js.map +0 -1
  26. package/dist/components/shared.d.ts +0 -9
  27. package/dist/components/shared.d.ts.map +0 -1
  28. package/dist/components/shared.js +0 -8
  29. package/dist/components/shared.js.map +0 -1
  30. package/dist/constants.d.ts +0 -47
  31. package/dist/constants.d.ts.map +0 -1
  32. package/dist/constants.js +0 -5
  33. package/dist/constants.js.map +0 -1
  34. package/dist/index.d.ts +0 -4
  35. package/dist/index.d.ts.map +0 -1
  36. package/dist/index.js +0 -4
  37. package/dist/index.js.map +0 -1
  38. package/dist/loader.d.ts +0 -24
  39. package/dist/loader.d.ts.map +0 -1
  40. package/dist/loader.js +0 -45
  41. package/dist/loader.js.map +0 -1
  42. package/dist/types.d.ts +0 -1
  43. package/dist/types.d.ts.map +0 -1
  44. package/dist/types.js +0 -1
  45. package/dist/types.js.map +0 -1
  46. package/dist/utils.d.ts +0 -5
  47. package/dist/utils.d.ts.map +0 -1
  48. package/dist/utils.js +0 -20
  49. package/dist/utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeView.js","sourceRoot":"","sources":["../../src/components/codeView.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAS,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAKN,aAAQ,GAAG,YAAY,CAAC;QAGxB,eAAU,GAAG,KAAK,CAAC;QAMnB,SAAI,GAAG,KAAK,CAAC;QAUb,kBAAa,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QAmB3C,gBAAW,GAAG,GAAG,EAAE;YAClB,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,CAAC;YACtC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;IAChB,IAAI,CA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,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;4CACP;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACT;AAGhB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;sCACb;AAGb;IADC,KAAK,CAAC,OAAO,CAAC;sCACM;AAGrB;IADC,KAAK,CAAC,YAAY,CAAC;2CACH;AApBL,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CAqEpB","sourcesContent":["import { Alert, getThemeManager } from '@omegagrid/core';\nimport { LitElement, html } from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { MonacoLoader } from '../loader';\nimport { msg } from '@omegagrid/localize';\nimport { style } from './codeView.style';\nimport { validateLanguage } from '../utils';\n\n@customElement('og-code-view')\nexport class CodeView extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property({type: String})\n\tlanguage = 'typescript';\n\n\t@property({type: Boolean})\n\tscrollable = false;\n\t\n\t@property({type: String})\n\tcontent: string;\n\n\t@property({type: Boolean})\n\tcopy = false;\n\t\n\t@query('#root')\n\troot: HTMLDivElement;\n\n\t@query('#alertCopy')\n\talertCopy: Alert;\n\t\n\tget theme() { return getThemeManager().activeTheme?.type == 'light' ? 'vs' : 'vs-dark' }\n\t\n\tonStyleChange = () => this.requestUpdate();\n\n\tasync updated() {\t\n\t\tthis.root.innerHTML = '';\n\t\tthis.root.textContent = this.content;\n\t\tconst monaco = await MonacoLoader.get();\n\t\tconst language = await validateLanguage(this.language);\n\t\tmonaco.editor.colorizeElement(this.root, {mimeType: language, theme: this.theme});\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tgetThemeManager().addEventListener('change', this.onStyleChange);\n\t}\n\n\tdisconnectedCallback() {\n\t\tgetThemeManager().removeEventListener('change', this.onStyleChange);\n\t}\n\n\tcopyContent = () => {\n\t\tnavigator.clipboard.writeText(this.content);\n\t\tthis.alertCopy.className = 'fade-out';\n\t\tsetTimeout(() => this.alertCopy.className = '', 2000);\n\t}\n\n\trender = () => html`\n\t\t${this.copy ? html`\n\t\t\t<og-button\n\t\t\t\tid=\"btnCopy\"\n\t\t\t\ticon=\"copy\"\n\t\t\t\tcolor=\"transparent\"\n\t\t\t\t@click=\"${this.copyContent}\">\n\t\t\t</og-button>\n\t\t\t<og-alert type=\"success\" id=\"alertCopy\"><div slot=\"content\">${msg('copied')}</div></og-alert>\n\t\t` : ''}\n\t\t\n\t\t${this.scrollable ? html`\n\t\t\t<og-container>\n\t\t\t\t<div id=\"root\" slot=\"content\"></div>\n\t\t\t</og-container>\n\t\t`: html`\n\t\t\t<div id=\"root\" slot=\"content\"></div>\n\t\t`}\n\t`;\n\n}"]}
@@ -1,2 +0,0 @@
1
- export declare const style: import("lit").CSSResult;
2
- //# sourceMappingURL=codeView.style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeView.style.d.ts","sourceRoot":"","sources":["../../src/components/codeView.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAmEjB,CAAC"}
@@ -1,70 +0,0 @@
1
- import { css } from 'lit';
2
- export const style = css `
3
- * {
4
- box-sizing: border-box;
5
- }
6
-
7
- :host {
8
- white-space: normal;
9
- user-select: text;
10
- display: block;
11
- position: relative;
12
- overflow: hidden;
13
- font-size: var(--og-font-size);
14
- }
15
-
16
- #root {
17
- font-family: Consolas, "Courier New", monospace;
18
- font-size: var(--og-font-size);
19
- padding: 4px;
20
- overflow: visible;
21
- min-height: 25px;
22
- }
23
-
24
- #btnCopy {
25
- position: absolute;
26
- top: 2px;
27
- right: 4px;
28
- }
29
-
30
- :host(:hover) #btnCopy {
31
- display: block;
32
- }
33
-
34
- og-container {
35
- height: 100%;
36
- }
37
-
38
- og-button {
39
- z-index: 1;
40
- }
41
-
42
- og-alert {
43
- position: absolute;
44
- top: 4px;
45
- right: 30px;
46
- width: 80px;
47
- padding: 2px;
48
- font-size: 12px;
49
- text-align: center;
50
- opacity: 0;
51
- visibility: hidden;
52
- }
53
-
54
- og-alert.fade-out {
55
- animation: fadeOut 2s forwards;
56
- visibility: visible;
57
- opacity: 1;
58
- }
59
-
60
- @keyframes fadeOut {
61
- 0% {
62
- opacity: 1;
63
- }
64
- 100% {
65
- opacity: 0;
66
- visibility: hidden;
67
- }
68
- }
69
- `;
70
- //# sourceMappingURL=codeView.style.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeView.style.js","sourceRoot":"","sources":["../../src/components/codeView.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEvB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host {\n\t\twhite-space: normal;\n\t\tuser-select: text;\n\t\tdisplay: block;\n\t\tposition: relative;\n\t\toverflow: hidden;\n\t\tfont-size: var(--og-font-size);\n\t}\n\n\t#root {\n\t\tfont-family: Consolas, \"Courier New\", monospace;\n\t\tfont-size: var(--og-font-size);\n\t\tpadding: 4px;\n\t\toverflow: visible;\n\t\tmin-height: 25px;\n\t}\n\n\t#btnCopy {\n\t\tposition: absolute;\n\t\ttop: 2px;\n\t\tright: 4px;\n\t}\n\n\t:host(:hover) #btnCopy {\n\t\tdisplay: block;\n\t}\n\n\tog-container {\n\t\theight: 100%;\n\t}\n\n\tog-button {\n\t\tz-index: 1;\n\t}\n\n\tog-alert {\n\t\tposition: absolute;\n\t\ttop: 4px;\n\t\tright: 30px;\n\t\twidth: 80px;\n\t\tpadding: 2px;\n\t\tfont-size: 12px;\n\t\ttext-align: center;\n\t\topacity: 0;\n\t\tvisibility: hidden;\n\t}\n\n\tog-alert.fade-out {\n\t\tanimation: fadeOut 2s forwards;\n\t\tvisibility: visible;\n\t\topacity: 1;\n\t}\n\n\t@keyframes fadeOut {\n\t\t0% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 0;\n\t\t\tvisibility: hidden;\n\t\t}\n\t}\n`;"]}
@@ -1,6 +0,0 @@
1
- export * from './code';
2
- export * from './codeDiff';
3
- export * from './codeBlock';
4
- export * from './codeView';
5
- export * from './shared';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './code';
2
- export * from './codeDiff';
3
- export * from './codeBlock';
4
- export * from './codeView';
5
- export * from './shared';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC","sourcesContent":["export * from './code';\nexport * from './codeDiff';\nexport * from './codeBlock';\nexport * from './codeView';\nexport * from './shared';"]}
@@ -1,9 +0,0 @@
1
- import type * as monaco from 'monaco-editor';
2
- export declare class CodeEvent<T extends monaco.editor.IEditor = monaco.editor.IStandaloneCodeEditor> extends Event {
3
- readonly editor: T;
4
- readonly changes: monaco.editor.IModelContentChange[];
5
- readonly origEvent: Event;
6
- constructor(type: string, args: Partial<CodeEvent<T>>, origEvent?: Event);
7
- }
8
- export type CodeDiffEvent = CodeEvent<monaco.editor.IStandaloneDiffEditor>;
9
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/components/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,qBAAa,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAE,SAAQ,KAAK;IAC1G,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;IACtD,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,KAAK;CAKxE;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- export class CodeEvent extends Event {
2
- constructor(type, args, origEvent) {
3
- super(`code.${type}`, { bubbles: true, composed: true });
4
- Object.assign(this, args);
5
- this.origEvent = origEvent;
6
- }
7
- }
8
- //# sourceMappingURL=shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/components/shared.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,SAAiF,SAAQ,KAAK;IAK1G,YAAY,IAAY,EAAE,IAA2B,EAAE,SAAiB;QACvE,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;QACvD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;CACD","sourcesContent":["import type * as monaco from 'monaco-editor';\n\nexport class CodeEvent<T extends monaco.editor.IEditor = monaco.editor.IStandaloneCodeEditor> extends Event {\n\treadonly editor: T;\n\treadonly changes: monaco.editor.IModelContentChange[];\n\treadonly origEvent: Event;\n\n\tconstructor(type: string, args: Partial<CodeEvent<T>>, origEvent?: Event) {\n\t\tsuper(`code.${type}`, {bubbles: true, composed: true});\n\t\tObject.assign(this, args);\n\t\tthis.origEvent = origEvent;\n\t}\n}\n\nexport type CodeDiffEvent = CodeEvent<monaco.editor.IStandaloneDiffEditor>;\n"]}
@@ -1,47 +0,0 @@
1
- declare const _default: {
2
- PREFIX: string;
3
- DEFAULT_ACCENT_COLOR: string;
4
- DEFAULT_ACCENT_COLOR_2: import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | any | ArrayLike<number> | {
5
- [key: string]: any;
6
- }> | ArrayLike<number> | {
7
- [key: string]: any;
8
- }> | ArrayLike<number> | {
9
- [key: string]: any;
10
- }> | ArrayLike<number> | {
11
- [key: string]: any;
12
- }> | ArrayLike<number> | {
13
- [key: string]: any;
14
- }> | ArrayLike<number> | {
15
- [key: string]: any;
16
- }> | ArrayLike<number> | {
17
- [key: string]: any;
18
- }> | ArrayLike<number> | {
19
- [key: string]: any;
20
- }> | ArrayLike<number> | {
21
- [key: string]: any;
22
- }> | ArrayLike<number> | {
23
- [key: string]: any;
24
- }> | ArrayLike<number> | {
25
- [key: string]: any;
26
- }> | ArrayLike<number> | {
27
- [key: string]: any;
28
- }>;
29
- SIZER_SIZE: number;
30
- SLIDER_SIZE: number;
31
- SLIDER_MIN_LENGTH: number;
32
- EXPANDER_SIZE: number;
33
- LIST_ITEM_HEIGHT: number;
34
- LIST_RENDERING_TRESHOLD: number;
35
- LIST_AUTOSCROLL_TRESHOLD: number;
36
- LIST_AUTOSCROLL_DELAY: number;
37
- DEFAULT_TEXT_HIGHLIGHT_COLOR: string;
38
- TOOLTIP_MARGIN: number;
39
- MENU_ITEM_HEIGHT: number;
40
- COLORPICKER_COLOR_SIZE: number;
41
- DEFAULT_NUMBER_FORMAT: string;
42
- BUTTON_HEIGHT: number;
43
- FONT_SIZE: number;
44
- FLOATING_WINDOW_MAX_WIDTH: number;
45
- };
46
- export default _default;
47
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAEE"}
package/dist/constants.js DELETED
@@ -1,5 +0,0 @@
1
- import { constants as coreConstants } from '@omegagrid/core';
2
- export default {
3
- ...coreConstants
4
- };
5
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,eAAe;IACd,GAAG,aAAa;CAChB,CAAC","sourcesContent":["import { constants as coreConstants } from '@omegagrid/core';\n\nexport default {\n\t...coreConstants\n};"]}
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './components';
2
- export { MonacoLoader } from './loader';
3
- export { MonacoLoader as loader } from './loader';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './components';
2
- export { MonacoLoader } from './loader'; // TODO: compatibility, remove later
3
- export { MonacoLoader as loader } from './loader';
4
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC,CAAC,oCAAoC;AAC7E,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export * from './components';\nexport { MonacoLoader } from './loader'; // TODO: compatibility, remove later\nexport { MonacoLoader as loader } from './loader';\n"]}
package/dist/loader.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import type * as monacoNS from 'monaco-editor';
2
- export interface Require {
3
- (paths: string[], callback?: () => void): void;
4
- config: (options: {
5
- [key: string]: unknown;
6
- }) => void;
7
- }
8
- declare global {
9
- interface Window {
10
- monaco: typeof monacoNS;
11
- require: Require;
12
- }
13
- }
14
- export declare class MonacoLoader {
15
- static monaco: typeof monacoNS;
16
- static monacoStyle: string;
17
- static monacoPath: string;
18
- static init(path: string): void;
19
- static get(): Promise<typeof monacoNS>;
20
- static getSync(): typeof monacoNS;
21
- static load(): Promise<typeof monacoNS>;
22
- static loadToIFrame(iframe: HTMLIFrameElement): Promise<typeof monacoNS>;
23
- }
24
- //# sourceMappingURL=loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAC;AAG/C,MAAM,WAAW,OAAO;IACvB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC/C,MAAM,EAAE,CAAC,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,KAAK,IAAI,CAAC;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QAClB,MAAM,EAAE,OAAO,QAAQ,CAAC;QACxB,OAAO,EAAE,OAAO,CAAC;KACd;CACJ;AAED,qBAAa,YAAY;IAExB,MAAM,CAAC,MAAM,EAAE,OAAO,QAAQ,CAAC;IAC/B,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;IAE1B,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;WAIX,GAAG;IAKhB,MAAM,CAAC,OAAO;IAId,MAAM,CAAC,IAAI;WAgBE,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,QAAQ,CAAC;CAoB9E"}
package/dist/loader.js DELETED
@@ -1,45 +0,0 @@
1
- import { AMD, ScriptLoader } from '@omegagrid/core';
2
- export class MonacoLoader {
3
- static init(path) {
4
- MonacoLoader.monacoPath = path;
5
- }
6
- static async get() {
7
- if (!this.monaco)
8
- this.monaco = await this.load();
9
- return this.monaco;
10
- }
11
- static getSync() {
12
- return this.monaco;
13
- }
14
- static load() {
15
- if (!AMD.require) {
16
- throw new Error('AMDLoader is not initialized');
17
- }
18
- AMD.require.config({
19
- paths: { 'vs': MonacoLoader.monacoPath },
20
- });
21
- return new Promise((resolve) => {
22
- AMD.require(['vs/editor/editor.main'], () => {
23
- resolve(self.monaco);
24
- });
25
- });
26
- }
27
- static async loadToIFrame(iframe) {
28
- if (!AMD.require) {
29
- throw new Error('AMDLoader is not initialized');
30
- }
31
- const window = iframe.contentWindow;
32
- if (window.monaco)
33
- return window.monaco;
34
- // window.require = AMD.require;
35
- // window.monaco = await this.load();
36
- await ScriptLoader.load(`${MonacoLoader.monacoPath}/loader.js`, iframe.contentDocument);
37
- window.require.config({ paths: { 'vs': MonacoLoader.monacoPath } });
38
- return await new Promise((resolve) => {
39
- window.require(['vs/editor/editor.main'], () => {
40
- resolve(window.monaco);
41
- });
42
- });
43
- }
44
- }
45
- //# sourceMappingURL=loader.js.map
@@ -1 +0,0 @@
1
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,CAAC,MAAM,CAAC;QAExC,gCAAgC;QAChC,qCAAqC;QAErC,MAAM,YAAY,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,UAAU,YAAY,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;QACxF,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,EAAC,IAAI,EAAE,YAAY,CAAC,UAAU,EAAC,EAAC,CAAC,CAAC;QAChE,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,MAAM,CAAC,OAAO,CAAC,CAAC,uBAAuB,CAAC,EAAE,GAAG,EAAE;gBAC9C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CAED","sourcesContent":["import type * as monacoNS from 'monaco-editor';\nimport { AMD, ScriptLoader } from '@omegagrid/core';\n\nexport interface Require {\n\t(paths: string[], callback?: () => void): void;\n\tconfig: (options: {[key: string]: unknown}) => void;\n}\n\ndeclare global {\n interface Window { \n\t\tmonaco: typeof monacoNS,\n\t\trequire: Require;\n }\n}\n\nexport class MonacoLoader {\n\n\tstatic monaco: typeof monacoNS;\n\tstatic monacoStyle: string;\n\tstatic monacoPath: string;\n\n\tstatic init(path: string) {\n\t\tMonacoLoader.monacoPath = path;\n\t}\n\n\tstatic async get() {\n\t\tif (!this.monaco) this.monaco = await this.load();\n\t\treturn this.monaco;\n\t}\n\n\tstatic getSync() {\n\t\treturn this.monaco;\n\t}\n\n\tstatic load() {\n\t\tif (!AMD.require) {\n\t\t\tthrow new Error('AMDLoader is not initialized');\n\t\t}\n\n\t\tAMD.require.config({\n\t\t\tpaths: {'vs': MonacoLoader.monacoPath},\n\t\t});\n\n\t\treturn new Promise<typeof monacoNS>((resolve) => {\n\t\t\tAMD.require(['vs/editor/editor.main'], () => {\n\t\t\t\tresolve(self.monaco);\n\t\t\t});\n\t\t});\n\t}\n\n\tstatic async loadToIFrame(iframe: HTMLIFrameElement): Promise<typeof monacoNS> {\n\t\tif (!AMD.require) {\n\t\t\tthrow new Error('AMDLoader is not initialized');\n\t\t}\n\n\t\tconst window = iframe.contentWindow;\n\t\tif (window.monaco) return window.monaco;\n\n\t\t// window.require = AMD.require;\n\t\t// window.monaco = await this.load();\n\n\t\tawait ScriptLoader.load(`${MonacoLoader.monacoPath}/loader.js`, iframe.contentDocument);\n\t\twindow.require.config({paths: {'vs': MonacoLoader.monacoPath}});\n\t\treturn await new Promise((resolve) => {\n\t\t\twindow.require(['vs/editor/editor.main'], () => {\n\t\t\t\tresolve(window.monaco);\n\t\t\t});\n\t\t});\n\t}\n\t\n}"]}
package/dist/types.d.ts DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":[""]}
package/dist/utils.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type * as monaco from 'monaco-editor';
2
- export declare function validateLanguage(language: string): Promise<string>;
3
- export declare function getLanguages(): Promise<string[]>;
4
- export declare function getEditorContentHeight(editor: monaco.editor.IStandaloneCodeEditor): number;
5
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIxE;AAED,wBAAsB,YAAY,sBAGjC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,GAAG,MAAM,CAO1F"}
package/dist/utils.js DELETED
@@ -1,20 +0,0 @@
1
- import { MonacoLoader } from "./loader";
2
- export async function validateLanguage(language) {
3
- language = language ? language.toLowerCase() : '';
4
- const languages = await getLanguages();
5
- return languages.includes(language) ? language : 'plaintext';
6
- }
7
- export async function getLanguages() {
8
- const m = await MonacoLoader.get();
9
- return m.languages.getLanguages().map(lang => lang.id).filter(lang => lang.indexOf('.') == -1);
10
- }
11
- export function getEditorContentHeight(editor) {
12
- const dom = editor.getDomNode();
13
- if (!dom)
14
- return null;
15
- const container = dom.getElementsByClassName('view-lines')[0];
16
- const lineHeight = container.firstElementChild ? container.firstElementChild.offsetHeight : 18;
17
- const model = editor.getModel();
18
- return model.getLineCount() * lineHeight;
19
- }
20
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAgB;IACtD,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClD,MAAM,SAAS,GAAG,MAAM,YAAY,EAAE,CAAC;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY;IACjC,MAAM,CAAC,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC;IACnC,OAAO,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,MAA2C;IACjF,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAChC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,SAAS,GAAG,GAAG,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAgB,CAAC;IAC7E,MAAM,UAAU,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAE,SAAS,CAAC,iBAAiC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAChH,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAChC,OAAO,KAAK,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC;AAC1C,CAAC","sourcesContent":["import { MonacoLoader } from \"./loader\";\nimport type * as monaco from 'monaco-editor';\n\nexport async function validateLanguage(language: string): Promise<string> {\n\tlanguage = language ? language.toLowerCase() : '';\n\tconst languages = await getLanguages();\n\treturn languages.includes(language) ? language : 'plaintext';\n}\n\nexport async function getLanguages() {\n\tconst m = await MonacoLoader.get();\n\treturn m.languages.getLanguages().map(lang => lang.id).filter(lang => lang.indexOf('.') == -1);\n}\n\nexport function getEditorContentHeight(editor: monaco.editor.IStandaloneCodeEditor): number {\n\tconst dom = editor.getDomNode();\n\tif (!dom) return null;\n\tconst container = dom.getElementsByClassName('view-lines')[0] as HTMLElement;\n\tconst lineHeight = container.firstElementChild ? (container.firstElementChild as HTMLElement).offsetHeight : 18;\n\tconst model = editor.getModel();\n\treturn model.getLineCount() * lineHeight;\n}"]}