@omegagrid/code 0.3.68 → 0.4.1
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/components/code.d.ts +170 -2
- package/dist/components/code.d.ts.map +1 -1
- package/dist/components/code.js +21 -13
- package/dist/components/code.js.map +1 -1
- package/dist/components/codeBlock.d.ts +199 -0
- package/dist/components/codeBlock.d.ts.map +1 -0
- package/dist/components/codeBlock.js +175 -0
- package/dist/components/codeBlock.js.map +1 -0
- package/dist/components/{highlighter.d.ts → codeView.d.ts} +2 -2
- package/dist/components/codeView.d.ts.map +1 -0
- package/dist/components/{highlighter.js → codeView.js} +18 -16
- package/dist/components/codeView.js.map +1 -0
- package/dist/components/{highlighter.style.d.ts → codeView.style.d.ts} +1 -1
- package/dist/components/codeView.style.d.ts.map +1 -0
- package/dist/components/{highlighter.style.js → codeView.style.js} +3 -2
- package/dist/components/codeView.style.js.map +1 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/package.json +4 -3
- package/dist/components/highlighter.d.ts.map +0 -1
- package/dist/components/highlighter.js.map +0 -1
- package/dist/components/highlighter.style.d.ts.map +0 -1
- package/dist/components/highlighter.style.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Layout } from '@omegagrid/core';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import * as monaco from 'monaco-editor';
|
|
3
|
+
import type * as monaco from 'monaco-editor';
|
|
4
4
|
export declare class CodeEvent extends Event {
|
|
5
5
|
readonly editor: monaco.editor.IStandaloneCodeEditor;
|
|
6
|
-
|
|
6
|
+
readonly changes: monaco.editor.IModelContentChange[];
|
|
7
|
+
constructor(type: string, args: Partial<CodeEvent>);
|
|
7
8
|
}
|
|
8
9
|
export declare class Code extends LitElement implements Layout {
|
|
9
10
|
static monaco: typeof monaco;
|
|
@@ -11,6 +12,7 @@ export declare class Code extends LitElement implements Layout {
|
|
|
11
12
|
language: string;
|
|
12
13
|
private _content;
|
|
13
14
|
private _initialized;
|
|
15
|
+
options: monaco.editor.IStandaloneEditorConstructionOptions;
|
|
14
16
|
get content(): string;
|
|
15
17
|
set content(val: string);
|
|
16
18
|
get selectedContent(): string;
|
|
@@ -20,6 +22,172 @@ export declare class Code extends LitElement implements Layout {
|
|
|
20
22
|
get theme(): "vs" | "vs-dark";
|
|
21
23
|
onStyleChange: () => void;
|
|
22
24
|
initMonaco(): Promise<void>;
|
|
25
|
+
getOptions: () => {
|
|
26
|
+
value: string;
|
|
27
|
+
language: string;
|
|
28
|
+
theme: string;
|
|
29
|
+
fontLigatures: string;
|
|
30
|
+
model?: monaco.editor.ITextModel;
|
|
31
|
+
autoDetectHighContrast?: boolean;
|
|
32
|
+
accessibilityHelpUrl?: string;
|
|
33
|
+
ariaContainerElement?: HTMLElement;
|
|
34
|
+
dimension?: monaco.editor.IDimension;
|
|
35
|
+
overflowWidgetsDomNode?: HTMLElement;
|
|
36
|
+
inDiffEditor?: boolean;
|
|
37
|
+
ariaLabel?: string;
|
|
38
|
+
ariaRequired?: boolean;
|
|
39
|
+
screenReaderAnnounceInlineSuggestion?: boolean;
|
|
40
|
+
tabIndex?: number;
|
|
41
|
+
rulers?: (number | monaco.editor.IRulerOption)[];
|
|
42
|
+
wordSeparators?: string;
|
|
43
|
+
selectionClipboard?: boolean;
|
|
44
|
+
lineNumbers?: monaco.editor.LineNumbersType;
|
|
45
|
+
cursorSurroundingLines?: number;
|
|
46
|
+
cursorSurroundingLinesStyle?: "default" | "all";
|
|
47
|
+
renderFinalNewline?: "on" | "off" | "dimmed";
|
|
48
|
+
unusualLineTerminators?: "off" | "auto" | "prompt";
|
|
49
|
+
selectOnLineNumbers?: boolean;
|
|
50
|
+
lineNumbersMinChars?: number;
|
|
51
|
+
glyphMargin?: boolean;
|
|
52
|
+
lineDecorationsWidth?: string | number;
|
|
53
|
+
revealHorizontalRightPadding?: number;
|
|
54
|
+
roundedSelection?: boolean;
|
|
55
|
+
extraEditorClassName?: string;
|
|
56
|
+
readOnly?: boolean;
|
|
57
|
+
readOnlyMessage?: monaco.IMarkdownString;
|
|
58
|
+
domReadOnly?: boolean;
|
|
59
|
+
linkedEditing?: boolean;
|
|
60
|
+
renameOnType?: boolean;
|
|
61
|
+
renderValidationDecorations?: "on" | "off" | "editable";
|
|
62
|
+
scrollbar?: monaco.editor.IEditorScrollbarOptions;
|
|
63
|
+
stickyScroll?: monaco.editor.IEditorStickyScrollOptions;
|
|
64
|
+
minimap?: monaco.editor.IEditorMinimapOptions;
|
|
65
|
+
find?: monaco.editor.IEditorFindOptions;
|
|
66
|
+
fixedOverflowWidgets?: boolean;
|
|
67
|
+
overviewRulerLanes?: number;
|
|
68
|
+
overviewRulerBorder?: boolean;
|
|
69
|
+
cursorBlinking?: "blink" | "smooth" | "phase" | "expand" | "solid";
|
|
70
|
+
mouseWheelZoom?: boolean;
|
|
71
|
+
mouseStyle?: "default" | "text" | "copy";
|
|
72
|
+
cursorSmoothCaretAnimation?: "on" | "off" | "explicit";
|
|
73
|
+
cursorStyle?: "line" | "block" | "underline" | "line-thin" | "block-outline" | "underline-thin";
|
|
74
|
+
cursorWidth?: number;
|
|
75
|
+
fontVariations?: string | boolean;
|
|
76
|
+
defaultColorDecorators?: boolean;
|
|
77
|
+
disableLayerHinting?: boolean;
|
|
78
|
+
disableMonospaceOptimizations?: boolean;
|
|
79
|
+
hideCursorInOverviewRuler?: boolean;
|
|
80
|
+
scrollBeyondLastLine?: boolean;
|
|
81
|
+
scrollBeyondLastColumn?: number;
|
|
82
|
+
smoothScrolling?: boolean;
|
|
83
|
+
automaticLayout?: boolean;
|
|
84
|
+
wordWrap?: "on" | "off" | "wordWrapColumn" | "bounded";
|
|
85
|
+
wordWrapOverride1?: "on" | "off" | "inherit";
|
|
86
|
+
wordWrapOverride2?: "on" | "off" | "inherit";
|
|
87
|
+
wordWrapColumn?: number;
|
|
88
|
+
wrappingIndent?: "none" | "same" | "indent" | "deepIndent";
|
|
89
|
+
wrappingStrategy?: "simple" | "advanced";
|
|
90
|
+
wordWrapBreakBeforeCharacters?: string;
|
|
91
|
+
wordWrapBreakAfterCharacters?: string;
|
|
92
|
+
wordBreak?: "normal" | "keepAll";
|
|
93
|
+
stopRenderingLineAfter?: number;
|
|
94
|
+
hover?: monaco.editor.IEditorHoverOptions;
|
|
95
|
+
links?: boolean;
|
|
96
|
+
colorDecorators?: boolean;
|
|
97
|
+
colorDecoratorsActivatedOn?: "click" | "clickAndHover" | "hover";
|
|
98
|
+
colorDecoratorsLimit?: number;
|
|
99
|
+
comments?: monaco.editor.IEditorCommentsOptions;
|
|
100
|
+
contextmenu?: boolean;
|
|
101
|
+
mouseWheelScrollSensitivity?: number;
|
|
102
|
+
fastScrollSensitivity?: number;
|
|
103
|
+
scrollPredominantAxis?: boolean;
|
|
104
|
+
columnSelection?: boolean;
|
|
105
|
+
multiCursorModifier?: "ctrlCmd" | "alt";
|
|
106
|
+
multiCursorMergeOverlapping?: boolean;
|
|
107
|
+
multiCursorPaste?: "spread" | "full";
|
|
108
|
+
multiCursorLimit?: number;
|
|
109
|
+
accessibilitySupport?: "on" | "off" | "auto";
|
|
110
|
+
accessibilityPageSize?: number;
|
|
111
|
+
suggest?: monaco.editor.ISuggestOptions;
|
|
112
|
+
inlineSuggest?: monaco.editor.IInlineSuggestOptions;
|
|
113
|
+
smartSelect?: monaco.editor.ISmartSelectOptions;
|
|
114
|
+
gotoLocation?: monaco.editor.IGotoLocationOptions;
|
|
115
|
+
quickSuggestions?: boolean | monaco.editor.IQuickSuggestionsOptions;
|
|
116
|
+
quickSuggestionsDelay?: number;
|
|
117
|
+
padding?: monaco.editor.IEditorPaddingOptions;
|
|
118
|
+
parameterHints?: monaco.editor.IEditorParameterHintOptions;
|
|
119
|
+
autoClosingBrackets?: monaco.editor.EditorAutoClosingStrategy;
|
|
120
|
+
autoClosingComments?: monaco.editor.EditorAutoClosingStrategy;
|
|
121
|
+
autoClosingQuotes?: monaco.editor.EditorAutoClosingStrategy;
|
|
122
|
+
autoClosingDelete?: monaco.editor.EditorAutoClosingEditStrategy;
|
|
123
|
+
autoClosingOvertype?: monaco.editor.EditorAutoClosingEditStrategy;
|
|
124
|
+
autoSurround?: monaco.editor.EditorAutoSurroundStrategy;
|
|
125
|
+
autoIndent?: "none" | "advanced" | "full" | "brackets" | "keep";
|
|
126
|
+
stickyTabStops?: boolean;
|
|
127
|
+
formatOnType?: boolean;
|
|
128
|
+
formatOnPaste?: boolean;
|
|
129
|
+
dragAndDrop?: boolean;
|
|
130
|
+
suggestOnTriggerCharacters?: boolean;
|
|
131
|
+
acceptSuggestionOnEnter?: "on" | "off" | "smart";
|
|
132
|
+
acceptSuggestionOnCommitCharacter?: boolean;
|
|
133
|
+
snippetSuggestions?: "none" | "top" | "bottom" | "inline";
|
|
134
|
+
emptySelectionClipboard?: boolean;
|
|
135
|
+
copyWithSyntaxHighlighting?: boolean;
|
|
136
|
+
suggestSelection?: "first" | "recentlyUsed" | "recentlyUsedByPrefix";
|
|
137
|
+
suggestFontSize?: number;
|
|
138
|
+
suggestLineHeight?: number;
|
|
139
|
+
tabCompletion?: "on" | "off" | "onlySnippets";
|
|
140
|
+
selectionHighlight?: boolean;
|
|
141
|
+
occurrencesHighlight?: "off" | "singleFile" | "multiFile";
|
|
142
|
+
codeLens?: boolean;
|
|
143
|
+
codeLensFontFamily?: string;
|
|
144
|
+
codeLensFontSize?: number;
|
|
145
|
+
lightbulb?: monaco.editor.IEditorLightbulbOptions;
|
|
146
|
+
codeActionsOnSaveTimeout?: number;
|
|
147
|
+
folding?: boolean;
|
|
148
|
+
foldingStrategy?: "auto" | "indentation";
|
|
149
|
+
foldingHighlight?: boolean;
|
|
150
|
+
foldingImportsByDefault?: boolean;
|
|
151
|
+
foldingMaximumRegions?: number;
|
|
152
|
+
showFoldingControls?: "always" | "never" | "mouseover";
|
|
153
|
+
unfoldOnClickAfterEndOfLine?: boolean;
|
|
154
|
+
matchBrackets?: "always" | "never" | "near";
|
|
155
|
+
experimentalWhitespaceRendering?: "off" | "svg" | "font";
|
|
156
|
+
renderWhitespace?: "all" | "none" | "boundary" | "selection" | "trailing";
|
|
157
|
+
renderControlCharacters?: boolean;
|
|
158
|
+
renderLineHighlight?: "all" | "line" | "none" | "gutter";
|
|
159
|
+
renderLineHighlightOnlyWhenFocus?: boolean;
|
|
160
|
+
useTabStops?: boolean;
|
|
161
|
+
fontFamily?: string;
|
|
162
|
+
fontWeight?: string;
|
|
163
|
+
fontSize?: number;
|
|
164
|
+
lineHeight?: number;
|
|
165
|
+
letterSpacing?: number;
|
|
166
|
+
showUnused?: boolean;
|
|
167
|
+
peekWidgetDefaultFocus?: "editor" | "tree";
|
|
168
|
+
definitionLinkOpensInPeek?: boolean;
|
|
169
|
+
showDeprecated?: boolean;
|
|
170
|
+
matchOnWordStartOnly?: boolean;
|
|
171
|
+
inlayHints?: monaco.editor.IEditorInlayHintsOptions;
|
|
172
|
+
useShadowDOM?: boolean;
|
|
173
|
+
guides?: monaco.editor.IGuidesOptions;
|
|
174
|
+
unicodeHighlight?: monaco.editor.IUnicodeHighlightOptions;
|
|
175
|
+
bracketPairColorization?: monaco.editor.IBracketPairColorizationOptions;
|
|
176
|
+
dropIntoEditor?: monaco.editor.IDropIntoEditorOptions;
|
|
177
|
+
pasteAs?: monaco.editor.IPasteAsOptions;
|
|
178
|
+
tabFocusMode?: boolean;
|
|
179
|
+
inlineCompletionsAccessibilityVerbose?: boolean;
|
|
180
|
+
tabSize?: number;
|
|
181
|
+
insertSpaces?: boolean;
|
|
182
|
+
detectIndentation?: boolean;
|
|
183
|
+
trimAutoWhitespace?: boolean;
|
|
184
|
+
largeFileOptimizations?: boolean;
|
|
185
|
+
wordBasedSuggestions?: "off" | "currentDocument" | "matchingDocuments" | "allDocuments";
|
|
186
|
+
wordBasedSuggestionsOnlySameLanguage?: boolean;
|
|
187
|
+
'semanticHighlighting.enabled'?: boolean | "configuredByTheme";
|
|
188
|
+
stablePeek?: boolean;
|
|
189
|
+
maxTokenizationLineLength?: number;
|
|
190
|
+
};
|
|
23
191
|
initEditor(): Promise<void>;
|
|
24
192
|
updated(): void;
|
|
25
193
|
connectedCallback(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/components/code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/components/code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,qBAAa,SAAU,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;gBAE1C,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;CAIlD;AAED,qBACa,IAAK,SAAQ,UAAW,YAAW,MAAM;IAErD,MAAM,CAAC,MAAM,EAAE,OAAO,MAAM,CAAC;IAC7B,MAAM,CAAC,MAAM,0BAQX;IAGF,QAAQ,SAAgB;IAExB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,YAAY,CAAS;IAG7B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,oCAAoC,CAAC;IAE5D,IACI,OAAO,IAEM,MAAM,CAFsD;IAE7E,IAAI,OAAO,CAAC,GAAG,EAAE,MAAM,EAItB;IAED,IAAI,eAAe,WAKlB;IAGD,QAAQ,EAAE,cAAc,CAAC;IAEzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC;IAC5C,kBAAkB,UAAS;IAE3B,IAAI,KAAK,qBAA+E;IAExF,aAAa,aAEZ;IAEK,UAAU;IAOhB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MASP;IAEG,UAAU;IAmBhB,OAAO;IAIP,iBAAiB;IAKjB,oBAAoB;IAIpB,MAAM,6CAEJ;IAEF,MAAM;CAIN"}
|
package/dist/components/code.js
CHANGED
|
@@ -13,9 +13,9 @@ const lit_1 = require("lit");
|
|
|
13
13
|
const decorators_js_1 = require("lit/decorators.js");
|
|
14
14
|
const loader_1 = require("../loader");
|
|
15
15
|
class CodeEvent extends Event {
|
|
16
|
-
constructor(type,
|
|
16
|
+
constructor(type, args) {
|
|
17
17
|
super(`code.${type}`, { bubbles: true, composed: true });
|
|
18
|
-
this
|
|
18
|
+
Object.assign(this, args);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.CodeEvent = CodeEvent;
|
|
@@ -29,6 +29,15 @@ let Code = Code_1 = class Code extends lit_1.LitElement {
|
|
|
29
29
|
this.onStyleChange = () => {
|
|
30
30
|
this.editor.updateOptions({ theme: this.theme });
|
|
31
31
|
};
|
|
32
|
+
this.getOptions = () => ({
|
|
33
|
+
...this.options,
|
|
34
|
+
value: this._content,
|
|
35
|
+
language: this.language,
|
|
36
|
+
theme: this.theme,
|
|
37
|
+
// workaround for caret positioning issue in chrome
|
|
38
|
+
// https://github.com/microsoft/monaco-editor/issues/3217#issuecomment-1511978166
|
|
39
|
+
fontLigatures: ''
|
|
40
|
+
});
|
|
32
41
|
this.render = () => (0, lit_1.html) `
|
|
33
42
|
<div id="codeRoot"></div>
|
|
34
43
|
`;
|
|
@@ -60,18 +69,14 @@ let Code = Code_1 = class Code extends lit_1.LitElement {
|
|
|
60
69
|
var _a;
|
|
61
70
|
await this.initMonaco();
|
|
62
71
|
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
63
|
-
this.editor = Code_1.monaco.editor.create(this.codeRoot,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
theme: this.theme,
|
|
67
|
-
// workaround for caret positioning issue in chrome
|
|
68
|
-
// https://github.com/microsoft/monaco-editor/issues/3217#issuecomment-1511978166
|
|
69
|
-
fontLigatures: ''
|
|
70
|
-
});
|
|
71
|
-
this.dispatchEvent(new CodeEvent('ready', this.editor));
|
|
72
|
-
this.editor.onDidChangeModelContent(() => {
|
|
72
|
+
this.editor = Code_1.monaco.editor.create(this.codeRoot, this.getOptions());
|
|
73
|
+
this.dispatchEvent(new CodeEvent('ready', { editor: this.editor }));
|
|
74
|
+
this.editor.onDidChangeModelContent(e => {
|
|
73
75
|
if (!this.preventChangeEvent)
|
|
74
|
-
this.dispatchEvent(new CodeEvent('change',
|
|
76
|
+
this.dispatchEvent(new CodeEvent('change', {
|
|
77
|
+
editor: this.editor,
|
|
78
|
+
changes: e.changes
|
|
79
|
+
}));
|
|
75
80
|
else
|
|
76
81
|
this.preventChangeEvent = false;
|
|
77
82
|
});
|
|
@@ -105,6 +110,9 @@ Code.styles = (0, lit_1.css) `
|
|
|
105
110
|
__decorate([
|
|
106
111
|
(0, decorators_js_1.property)({ type: String })
|
|
107
112
|
], Code.prototype, "language", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
115
|
+
], Code.prototype, "options", void 0);
|
|
108
116
|
__decorate([
|
|
109
117
|
(0, decorators_js_1.property)({ type: String, noAccessor: true })
|
|
110
118
|
], Code.prototype, "content", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/components/code.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,0CAA+D;AAC/D,6BAA4C;AAC5C,qDAAmE;
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/components/code.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,0CAA+D;AAC/D,6BAA4C;AAC5C,qDAAmE;AACnE,sCAAyC;AAGzC,MAAa,SAAU,SAAQ,KAAK;IAInC,YAAY,IAAY,EAAE,IAAwB;QACjD,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;IAC3B,CAAC;CACD;AARD,8BAQC;AAGM,IAAM,IAAI,YAAV,MAAM,IAAK,SAAQ,gBAAU;IAA7B;;QAcN,aAAQ,GAAG,YAAY,CAAC;QAEhB,aAAQ,GAAG,EAAE,CAAC;QACd,iBAAY,GAAG,KAAK,CAAC;QAyB7B,uBAAkB,GAAG,KAAK,CAAC;QAI3B,kBAAa,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAC,CAAC,CAAC;QAChD,CAAC,CAAA;QASD,eAAU,GAAG,GAAG,EAAE,CAAC,CAAC;YACnB,GAAG,IAAI,CAAC,OAAO;YACf,KAAK,EAAE,IAAI,CAAC,QAAQ;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YAEjB,mDAAmD;YACnD,iFAAiF;YACjF,aAAa,EAAE,EAAE;SACjB,CAAC,CAAC;QAkCH,WAAM,GAA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,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;IAMD,MAAM;;QACL,MAAA,IAAI,CAAC,MAAM,0CAAE,MAAM,EAAE,CAAC;IACvB,CAAC;;AA1GW,oBAAI;AAGT,WAAM,GAAG,IAAA,SAAG,EAAA;;;;;;;;EAQlB,AARY,CAQX;AAGF;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sCACD;AAMxB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCACmC;AAG5D;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC;mCACkC;AAgB7E;IADC,IAAA,qBAAK,EAAC,WAAW,CAAC;sCACM;eAvCb,IAAI;IADhB,IAAA,6BAAa,EAAC,SAAS,CAAC;GACZ,IAAI,CA4GhB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { Layout } from '@omegagrid/core';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { Code, CodeEvent } from './code';
|
|
4
|
+
import { TreeAdapter, TreeEvent, TreeOptions } from '@omegagrid/tree';
|
|
5
|
+
import type * as monaco from 'monaco-editor';
|
|
6
|
+
declare class LangTreeAdapter extends TreeAdapter {
|
|
7
|
+
getTree(): Promise<{
|
|
8
|
+
k: string;
|
|
9
|
+
v: string;
|
|
10
|
+
}[]>;
|
|
11
|
+
getOptions(): TreeOptions;
|
|
12
|
+
}
|
|
13
|
+
export declare class CodeBlock extends LitElement implements Layout {
|
|
14
|
+
#private;
|
|
15
|
+
static styles: import("lit").CSSResult;
|
|
16
|
+
language: string;
|
|
17
|
+
dynamicHeight: boolean;
|
|
18
|
+
maxHeight: number;
|
|
19
|
+
editor: Code;
|
|
20
|
+
editorOptions: monaco.editor.IStandaloneEditorConstructionOptions;
|
|
21
|
+
get languageAdapter(): LangTreeAdapter;
|
|
22
|
+
get content(): string;
|
|
23
|
+
set content(value: string);
|
|
24
|
+
get monacoEditor(): monaco.editor.IStandaloneCodeEditor;
|
|
25
|
+
updateHeight(): void;
|
|
26
|
+
_onChange: (_e: CodeEvent) => void;
|
|
27
|
+
willUpdate(changedProps: Map<PropertyKey, unknown>): Promise<void>;
|
|
28
|
+
_onLanguageChange: (e: TreeEvent) => void;
|
|
29
|
+
getEditorOptions: () => {
|
|
30
|
+
model?: monaco.editor.ITextModel;
|
|
31
|
+
value?: string;
|
|
32
|
+
language?: string;
|
|
33
|
+
theme?: string;
|
|
34
|
+
autoDetectHighContrast?: boolean;
|
|
35
|
+
accessibilityHelpUrl?: string;
|
|
36
|
+
ariaContainerElement?: HTMLElement;
|
|
37
|
+
dimension?: monaco.editor.IDimension;
|
|
38
|
+
overflowWidgetsDomNode?: HTMLElement;
|
|
39
|
+
inDiffEditor?: boolean;
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
ariaRequired?: boolean;
|
|
42
|
+
screenReaderAnnounceInlineSuggestion?: boolean;
|
|
43
|
+
tabIndex?: number;
|
|
44
|
+
rulers?: (number | monaco.editor.IRulerOption)[];
|
|
45
|
+
wordSeparators?: string;
|
|
46
|
+
selectionClipboard?: boolean;
|
|
47
|
+
lineNumbers?: monaco.editor.LineNumbersType;
|
|
48
|
+
cursorSurroundingLines?: number;
|
|
49
|
+
cursorSurroundingLinesStyle?: "default" | "all";
|
|
50
|
+
renderFinalNewline?: "on" | "off" | "dimmed";
|
|
51
|
+
unusualLineTerminators?: "off" | "auto" | "prompt";
|
|
52
|
+
selectOnLineNumbers?: boolean;
|
|
53
|
+
lineNumbersMinChars?: number;
|
|
54
|
+
glyphMargin?: boolean;
|
|
55
|
+
lineDecorationsWidth?: string | number;
|
|
56
|
+
revealHorizontalRightPadding?: number;
|
|
57
|
+
roundedSelection?: boolean;
|
|
58
|
+
extraEditorClassName?: string;
|
|
59
|
+
readOnly?: boolean;
|
|
60
|
+
readOnlyMessage?: monaco.IMarkdownString;
|
|
61
|
+
domReadOnly?: boolean;
|
|
62
|
+
linkedEditing?: boolean;
|
|
63
|
+
renameOnType?: boolean;
|
|
64
|
+
renderValidationDecorations?: "on" | "off" | "editable";
|
|
65
|
+
scrollbar?: monaco.editor.IEditorScrollbarOptions;
|
|
66
|
+
stickyScroll?: monaco.editor.IEditorStickyScrollOptions;
|
|
67
|
+
minimap?: monaco.editor.IEditorMinimapOptions;
|
|
68
|
+
find?: monaco.editor.IEditorFindOptions;
|
|
69
|
+
fixedOverflowWidgets?: boolean;
|
|
70
|
+
overviewRulerLanes?: number;
|
|
71
|
+
overviewRulerBorder?: boolean;
|
|
72
|
+
cursorBlinking?: "blink" | "smooth" | "phase" | "expand" | "solid";
|
|
73
|
+
mouseWheelZoom?: boolean;
|
|
74
|
+
mouseStyle?: "default" | "text" | "copy";
|
|
75
|
+
cursorSmoothCaretAnimation?: "on" | "off" | "explicit";
|
|
76
|
+
cursorStyle?: "line" | "block" | "underline" | "line-thin" | "block-outline" | "underline-thin";
|
|
77
|
+
cursorWidth?: number;
|
|
78
|
+
fontLigatures?: string | boolean;
|
|
79
|
+
fontVariations?: string | boolean;
|
|
80
|
+
defaultColorDecorators?: boolean;
|
|
81
|
+
disableLayerHinting?: boolean;
|
|
82
|
+
disableMonospaceOptimizations?: boolean;
|
|
83
|
+
hideCursorInOverviewRuler?: boolean;
|
|
84
|
+
scrollBeyondLastLine: boolean;
|
|
85
|
+
scrollBeyondLastColumn?: number;
|
|
86
|
+
smoothScrolling?: boolean;
|
|
87
|
+
automaticLayout?: boolean;
|
|
88
|
+
wordWrap?: "on" | "off" | "wordWrapColumn" | "bounded";
|
|
89
|
+
wordWrapOverride1?: "on" | "off" | "inherit";
|
|
90
|
+
wordWrapOverride2?: "on" | "off" | "inherit";
|
|
91
|
+
wordWrapColumn?: number;
|
|
92
|
+
wrappingIndent?: "none" | "same" | "indent" | "deepIndent";
|
|
93
|
+
wrappingStrategy?: "simple" | "advanced";
|
|
94
|
+
wordWrapBreakBeforeCharacters?: string;
|
|
95
|
+
wordWrapBreakAfterCharacters?: string;
|
|
96
|
+
wordBreak?: "normal" | "keepAll";
|
|
97
|
+
stopRenderingLineAfter?: number;
|
|
98
|
+
hover?: monaco.editor.IEditorHoverOptions;
|
|
99
|
+
links?: boolean;
|
|
100
|
+
colorDecorators?: boolean;
|
|
101
|
+
colorDecoratorsActivatedOn?: "click" | "clickAndHover" | "hover";
|
|
102
|
+
colorDecoratorsLimit?: number;
|
|
103
|
+
comments?: monaco.editor.IEditorCommentsOptions;
|
|
104
|
+
contextmenu?: boolean;
|
|
105
|
+
mouseWheelScrollSensitivity?: number;
|
|
106
|
+
fastScrollSensitivity?: number;
|
|
107
|
+
scrollPredominantAxis?: boolean;
|
|
108
|
+
columnSelection?: boolean;
|
|
109
|
+
multiCursorModifier?: "ctrlCmd" | "alt";
|
|
110
|
+
multiCursorMergeOverlapping?: boolean;
|
|
111
|
+
multiCursorPaste?: "spread" | "full";
|
|
112
|
+
multiCursorLimit?: number;
|
|
113
|
+
accessibilitySupport?: "on" | "off" | "auto";
|
|
114
|
+
accessibilityPageSize?: number;
|
|
115
|
+
suggest?: monaco.editor.ISuggestOptions;
|
|
116
|
+
inlineSuggest?: monaco.editor.IInlineSuggestOptions;
|
|
117
|
+
smartSelect?: monaco.editor.ISmartSelectOptions;
|
|
118
|
+
gotoLocation?: monaco.editor.IGotoLocationOptions;
|
|
119
|
+
quickSuggestions?: boolean | monaco.editor.IQuickSuggestionsOptions;
|
|
120
|
+
quickSuggestionsDelay?: number;
|
|
121
|
+
padding?: monaco.editor.IEditorPaddingOptions;
|
|
122
|
+
parameterHints?: monaco.editor.IEditorParameterHintOptions;
|
|
123
|
+
autoClosingBrackets?: monaco.editor.EditorAutoClosingStrategy;
|
|
124
|
+
autoClosingComments?: monaco.editor.EditorAutoClosingStrategy;
|
|
125
|
+
autoClosingQuotes?: monaco.editor.EditorAutoClosingStrategy;
|
|
126
|
+
autoClosingDelete?: monaco.editor.EditorAutoClosingEditStrategy;
|
|
127
|
+
autoClosingOvertype?: monaco.editor.EditorAutoClosingEditStrategy;
|
|
128
|
+
autoSurround?: monaco.editor.EditorAutoSurroundStrategy;
|
|
129
|
+
autoIndent?: "none" | "advanced" | "full" | "brackets" | "keep";
|
|
130
|
+
stickyTabStops?: boolean;
|
|
131
|
+
formatOnType?: boolean;
|
|
132
|
+
formatOnPaste?: boolean;
|
|
133
|
+
dragAndDrop?: boolean;
|
|
134
|
+
suggestOnTriggerCharacters?: boolean;
|
|
135
|
+
acceptSuggestionOnEnter?: "on" | "off" | "smart";
|
|
136
|
+
acceptSuggestionOnCommitCharacter?: boolean;
|
|
137
|
+
snippetSuggestions?: "none" | "top" | "bottom" | "inline";
|
|
138
|
+
emptySelectionClipboard?: boolean;
|
|
139
|
+
copyWithSyntaxHighlighting?: boolean;
|
|
140
|
+
suggestSelection?: "first" | "recentlyUsed" | "recentlyUsedByPrefix";
|
|
141
|
+
suggestFontSize?: number;
|
|
142
|
+
suggestLineHeight?: number;
|
|
143
|
+
tabCompletion?: "on" | "off" | "onlySnippets";
|
|
144
|
+
selectionHighlight?: boolean;
|
|
145
|
+
occurrencesHighlight?: "off" | "singleFile" | "multiFile";
|
|
146
|
+
codeLens?: boolean;
|
|
147
|
+
codeLensFontFamily?: string;
|
|
148
|
+
codeLensFontSize?: number;
|
|
149
|
+
lightbulb?: monaco.editor.IEditorLightbulbOptions;
|
|
150
|
+
codeActionsOnSaveTimeout?: number;
|
|
151
|
+
folding?: boolean;
|
|
152
|
+
foldingStrategy?: "auto" | "indentation";
|
|
153
|
+
foldingHighlight?: boolean;
|
|
154
|
+
foldingImportsByDefault?: boolean;
|
|
155
|
+
foldingMaximumRegions?: number;
|
|
156
|
+
showFoldingControls?: "always" | "never" | "mouseover";
|
|
157
|
+
unfoldOnClickAfterEndOfLine?: boolean;
|
|
158
|
+
matchBrackets?: "always" | "never" | "near";
|
|
159
|
+
experimentalWhitespaceRendering?: "off" | "svg" | "font";
|
|
160
|
+
renderWhitespace?: "all" | "none" | "boundary" | "selection" | "trailing";
|
|
161
|
+
renderControlCharacters?: boolean;
|
|
162
|
+
renderLineHighlight?: "all" | "line" | "none" | "gutter";
|
|
163
|
+
renderLineHighlightOnlyWhenFocus?: boolean;
|
|
164
|
+
useTabStops?: boolean;
|
|
165
|
+
fontFamily?: string;
|
|
166
|
+
fontWeight?: string;
|
|
167
|
+
fontSize?: number;
|
|
168
|
+
lineHeight?: number;
|
|
169
|
+
letterSpacing?: number;
|
|
170
|
+
showUnused?: boolean;
|
|
171
|
+
peekWidgetDefaultFocus?: "editor" | "tree";
|
|
172
|
+
definitionLinkOpensInPeek?: boolean;
|
|
173
|
+
showDeprecated?: boolean;
|
|
174
|
+
matchOnWordStartOnly?: boolean;
|
|
175
|
+
inlayHints?: monaco.editor.IEditorInlayHintsOptions;
|
|
176
|
+
useShadowDOM?: boolean;
|
|
177
|
+
guides?: monaco.editor.IGuidesOptions;
|
|
178
|
+
unicodeHighlight?: monaco.editor.IUnicodeHighlightOptions;
|
|
179
|
+
bracketPairColorization?: monaco.editor.IBracketPairColorizationOptions;
|
|
180
|
+
dropIntoEditor?: monaco.editor.IDropIntoEditorOptions;
|
|
181
|
+
pasteAs?: monaco.editor.IPasteAsOptions;
|
|
182
|
+
tabFocusMode?: boolean;
|
|
183
|
+
inlineCompletionsAccessibilityVerbose?: boolean;
|
|
184
|
+
tabSize?: number;
|
|
185
|
+
insertSpaces?: boolean;
|
|
186
|
+
detectIndentation?: boolean;
|
|
187
|
+
trimAutoWhitespace?: boolean;
|
|
188
|
+
largeFileOptimizations?: boolean;
|
|
189
|
+
wordBasedSuggestions?: "off" | "currentDocument" | "matchingDocuments" | "allDocuments";
|
|
190
|
+
wordBasedSuggestionsOnlySameLanguage?: boolean;
|
|
191
|
+
'semanticHighlighting.enabled'?: boolean | "configuredByTheme";
|
|
192
|
+
stablePeek?: boolean;
|
|
193
|
+
maxTokenizationLineLength?: number;
|
|
194
|
+
};
|
|
195
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
196
|
+
layout(): void;
|
|
197
|
+
}
|
|
198
|
+
export {};
|
|
199
|
+
//# sourceMappingURL=codeBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlock.d.ts","sourceRoot":"","sources":["../../src/components/codeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,cAAM,eAAgB,SAAQ,WAAW;IAClC,OAAO;;;;IASb,UAAU,IAAK,WAAW;CAO1B;AAED,qBACa,SAAU,SAAQ,UAAW,YAAW,MAAM;;IAE1D,MAAM,CAAC,MAAM,0BAqCX;IAGF,QAAQ,SAAgB;IAGxB,aAAa,UAAS;IAGtB,SAAS,SAAO;IAGhB,MAAM,EAAE,IAAI,CAAC;IAGb,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,oCAAoC,CAAC;IAGlE,IAAI,eAAe,oBAGlB;IAGD,IAAI,OAAO,IACQ,MAAM,CADqC;IAC9D,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAGxB;IAED,IAAI,YAAY,wCAAiC;IAEjD,YAAY;IASZ,SAAS,OAAQ,SAAS,UAExB;IAEI,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IAMxD,iBAAiB,MAAO,SAAS,UAMhC;IAED,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGb;IAEH,MAAM,6CAgBJ;IAEF,MAAM;CAIN"}
|
|
@@ -0,0 +1,175 @@
|
|
|
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 __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
14
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
15
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
16
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
17
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
18
|
+
};
|
|
19
|
+
var _CodeBlock_languageAdapter, _CodeBlock_content;
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.CodeBlock = void 0;
|
|
22
|
+
const core_1 = require("@omegagrid/core");
|
|
23
|
+
const lit_1 = require("lit");
|
|
24
|
+
const decorators_js_1 = require("lit/decorators.js");
|
|
25
|
+
const tree_1 = require("@omegagrid/tree");
|
|
26
|
+
const utils_1 = require("../utils");
|
|
27
|
+
class LangTreeAdapter extends tree_1.TreeAdapter {
|
|
28
|
+
async getTree() {
|
|
29
|
+
const languages = await (0, utils_1.getLanguages)();
|
|
30
|
+
languages.sort();
|
|
31
|
+
return languages.map(lang => ({
|
|
32
|
+
k: lang,
|
|
33
|
+
v: lang,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
getOptions() {
|
|
37
|
+
return {
|
|
38
|
+
search: true,
|
|
39
|
+
selectMode: 'single',
|
|
40
|
+
autoClose: true
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let CodeBlock = class CodeBlock extends lit_1.LitElement {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.language = 'typescript';
|
|
48
|
+
this.dynamicHeight = false;
|
|
49
|
+
this.maxHeight = 400;
|
|
50
|
+
_CodeBlock_languageAdapter.set(this, void 0);
|
|
51
|
+
_CodeBlock_content.set(this, void 0);
|
|
52
|
+
this._onChange = (_e) => {
|
|
53
|
+
this.updateHeight();
|
|
54
|
+
};
|
|
55
|
+
this._onLanguageChange = (e) => {
|
|
56
|
+
this.language = e.node.key;
|
|
57
|
+
this.dispatchEvent(new core_1.events.ChangeEvent({
|
|
58
|
+
type: 'changeLanguage',
|
|
59
|
+
value: this.language
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
this.getEditorOptions = () => ({
|
|
63
|
+
scrollBeyondLastLine: !this.dynamicHeight,
|
|
64
|
+
...this.editorOptions
|
|
65
|
+
});
|
|
66
|
+
this.render = () => (0, lit_1.html) `
|
|
67
|
+
<div class="toolbar">
|
|
68
|
+
<og-tree-dropdown
|
|
69
|
+
@change="${this._onLanguageChange}"
|
|
70
|
+
.adapter="${this.languageAdapter}"
|
|
71
|
+
.value="${[[this.language, 0, 1]]}">
|
|
72
|
+
</og-tree-dropdown>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<og-code
|
|
76
|
+
.content="${this.content}"
|
|
77
|
+
.language="${this.language}"
|
|
78
|
+
.options="${this.getEditorOptions()}"
|
|
79
|
+
@code.change="${this._onChange}"
|
|
80
|
+
@code.ready="${() => this.updateHeight()}">
|
|
81
|
+
</og-code>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
get languageAdapter() {
|
|
85
|
+
if (!__classPrivateFieldGet(this, _CodeBlock_languageAdapter, "f"))
|
|
86
|
+
__classPrivateFieldSet(this, _CodeBlock_languageAdapter, new LangTreeAdapter(), "f");
|
|
87
|
+
return __classPrivateFieldGet(this, _CodeBlock_languageAdapter, "f");
|
|
88
|
+
}
|
|
89
|
+
get content() { var _a, _b; return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _CodeBlock_content, "f"); }
|
|
90
|
+
set content(value) {
|
|
91
|
+
__classPrivateFieldSet(this, _CodeBlock_content, value, "f");
|
|
92
|
+
if (this.editor)
|
|
93
|
+
this.editor.content = value;
|
|
94
|
+
}
|
|
95
|
+
get monacoEditor() { var _a; return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.editor; }
|
|
96
|
+
updateHeight() {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
if (!this.dynamicHeight)
|
|
99
|
+
return;
|
|
100
|
+
const height = (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.editor) === null || _b === void 0 ? void 0 : _b.getScrollHeight();
|
|
101
|
+
if (height == null)
|
|
102
|
+
return;
|
|
103
|
+
core_1.dom.setSize(this.editor, { h: Math.min(this.maxHeight, height) });
|
|
104
|
+
this.layout();
|
|
105
|
+
}
|
|
106
|
+
async willUpdate(changedProps) {
|
|
107
|
+
if (changedProps.has('language')) {
|
|
108
|
+
this.language = await (0, utils_1.validateLanguage)(this.language);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
layout() {
|
|
112
|
+
var _a;
|
|
113
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.layout();
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
exports.CodeBlock = CodeBlock;
|
|
117
|
+
_CodeBlock_languageAdapter = new WeakMap();
|
|
118
|
+
_CodeBlock_content = new WeakMap();
|
|
119
|
+
CodeBlock.styles = (0, lit_1.css) `
|
|
120
|
+
* {
|
|
121
|
+
box-sizing: border-box;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:host {
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
width: 100%;
|
|
128
|
+
height: 100%;
|
|
129
|
+
position: relative;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:host([dynamicHeight]) {
|
|
133
|
+
display: block;
|
|
134
|
+
height: auto;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
og-code {
|
|
138
|
+
flex: 1;
|
|
139
|
+
user-select: text;
|
|
140
|
+
width: 100%;
|
|
141
|
+
height: 100%;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.toolbar {
|
|
145
|
+
flex: 0;
|
|
146
|
+
height: 28px;
|
|
147
|
+
display: flex;
|
|
148
|
+
border-bottom: 1px solid var(--og-border-color);
|
|
149
|
+
padding: 4px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
og-tree-dropdown {
|
|
153
|
+
width: 150px;
|
|
154
|
+
height: 20px;
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, decorators_js_1.property)({ type: String })
|
|
159
|
+
], CodeBlock.prototype, "language", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, decorators_js_1.property)({ type: Boolean, reflect: true })
|
|
162
|
+
], CodeBlock.prototype, "dynamicHeight", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, decorators_js_1.property)({ type: Number })
|
|
165
|
+
], CodeBlock.prototype, "maxHeight", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, decorators_js_1.query)('og-code')
|
|
168
|
+
], CodeBlock.prototype, "editor", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, decorators_js_1.property)({ type: Object })
|
|
171
|
+
], CodeBlock.prototype, "editorOptions", void 0);
|
|
172
|
+
exports.CodeBlock = CodeBlock = __decorate([
|
|
173
|
+
(0, decorators_js_1.customElement)('og-code-block')
|
|
174
|
+
], CodeBlock);
|
|
175
|
+
//# sourceMappingURL=codeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlock.js","sourceRoot":"","sources":["../../src/components/codeBlock.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,0CAAsD;AACtD,6BAA4C;AAC5C,qDAAmE;AAEnE,0CAAsE;AACtE,oCAA0D;AAG1D,MAAM,eAAgB,SAAQ,kBAAW;IACxC,KAAK,CAAC,OAAO;QACZ,MAAM,SAAS,GAAG,MAAM,IAAA,oBAAY,GAAE,CAAC;QACvC,SAAS,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7B,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,IAAI;SACP,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACT,OAAO;YACN,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,QAAQ;YACpB,SAAS,EAAE,IAAI;SACf,CAAC;IACH,CAAC;CACD;AAGM,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,gBAAU;IAAlC;;QA0CN,aAAQ,GAAG,YAAY,CAAC;QAGxB,kBAAa,GAAG,KAAK,CAAC;QAGtB,cAAS,GAAG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,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;4CACT;AAGhB;IADC,IAAA,qBAAK,EAAC,SAAS,CAAC;yCACJ;AAGb;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;gDACyC;oBAtDtD,SAAS;IADrB,IAAA,6BAAa,EAAC,eAAe,CAAC;GAClB,SAAS,CA6HrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Alert } from '@omegagrid/core';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class CodeView extends LitElement {
|
|
4
4
|
static styles: import("lit").CSSResult[];
|
|
5
5
|
language: string;
|
|
6
6
|
scrollable: boolean;
|
|
@@ -16,4 +16,4 @@ export declare class Highlighter extends LitElement {
|
|
|
16
16
|
copyContent: () => void;
|
|
17
17
|
render: () => import("lit-html").TemplateResult<1>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=codeView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeView.d.ts","sourceRoot":"","sources":["../../src/components/codeView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAOvC,qBACa,QAAS,SAAQ,UAAU;IAEvC,MAAM,CAAC,MAAM,4BAAW;IAGxB,QAAQ,SAAgB;IAGxB,UAAU,UAAS;IAGnB,OAAO,EAAE,MAAM,CAAC;IAGhB,IAAI,UAAS;IAGb,IAAI,EAAE,cAAc,CAAC;IAGrB,SAAS,EAAE,KAAK,CAAC;IAEjB,IAAI,KAAK,qBAA+E;IAExF,aAAa,aAA8B;IAErC,OAAO;IAQb,iBAAiB;IAKjB,oBAAoB;IAIpB,WAAW,aAIV;IAED,MAAM,6CAkBJ;CAEF"}
|
|
@@ -6,14 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.CodeView = void 0;
|
|
10
10
|
const core_1 = require("@omegagrid/core");
|
|
11
11
|
const lit_1 = require("lit");
|
|
12
12
|
const decorators_js_1 = require("lit/decorators.js");
|
|
13
13
|
const loader_1 = require("../loader");
|
|
14
14
|
const localize_1 = require("@omegagrid/localize");
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const codeView_style_1 = require("./codeView.style");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
let CodeView = class CodeView extends lit_1.LitElement {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
19
20
|
this.language = 'typescript';
|
|
@@ -50,7 +51,8 @@ let Highlighter = class Highlighter extends lit_1.LitElement {
|
|
|
50
51
|
this.root.innerHTML = '';
|
|
51
52
|
this.root.textContent = this.content;
|
|
52
53
|
const monaco = await loader_1.MonacoLoader.get();
|
|
53
|
-
|
|
54
|
+
const language = await (0, utils_1.validateLanguage)(this.language);
|
|
55
|
+
monaco.editor.colorizeElement(this.root, { mimeType: language, theme: this.theme });
|
|
54
56
|
}
|
|
55
57
|
connectedCallback() {
|
|
56
58
|
super.connectedCallback();
|
|
@@ -60,27 +62,27 @@ let Highlighter = class Highlighter extends lit_1.LitElement {
|
|
|
60
62
|
(0, core_1.getThemeManager)().removeEventListener('change', this.onStyleChange);
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
exports.
|
|
64
|
-
|
|
65
|
+
exports.CodeView = CodeView;
|
|
66
|
+
CodeView.styles = [codeView_style_1.style];
|
|
65
67
|
__decorate([
|
|
66
68
|
(0, decorators_js_1.property)({ type: String })
|
|
67
|
-
],
|
|
69
|
+
], CodeView.prototype, "language", void 0);
|
|
68
70
|
__decorate([
|
|
69
71
|
(0, decorators_js_1.property)({ type: Boolean })
|
|
70
|
-
],
|
|
72
|
+
], CodeView.prototype, "scrollable", void 0);
|
|
71
73
|
__decorate([
|
|
72
74
|
(0, decorators_js_1.property)({ type: String })
|
|
73
|
-
],
|
|
75
|
+
], CodeView.prototype, "content", void 0);
|
|
74
76
|
__decorate([
|
|
75
77
|
(0, decorators_js_1.property)({ type: Boolean })
|
|
76
|
-
],
|
|
78
|
+
], CodeView.prototype, "copy", void 0);
|
|
77
79
|
__decorate([
|
|
78
80
|
(0, decorators_js_1.query)('#root')
|
|
79
|
-
],
|
|
81
|
+
], CodeView.prototype, "root", void 0);
|
|
80
82
|
__decorate([
|
|
81
83
|
(0, decorators_js_1.query)('#alertCopy')
|
|
82
|
-
],
|
|
83
|
-
exports.
|
|
84
|
-
(0, decorators_js_1.customElement)('og-
|
|
85
|
-
],
|
|
86
|
-
//# sourceMappingURL=
|
|
84
|
+
], CodeView.prototype, "alertCopy", void 0);
|
|
85
|
+
exports.CodeView = CodeView = __decorate([
|
|
86
|
+
(0, decorators_js_1.customElement)('og-code-view')
|
|
87
|
+
], CodeView);
|
|
88
|
+
//# sourceMappingURL=codeView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeView.js","sourceRoot":"","sources":["../../src/components/codeView.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0CAAyD;AACzD,6BAAuC;AACvC,qDAAmE;AACnE,sCAAyC;AACzC,kDAA0C;AAC1C,qDAAyC;AACzC,oCAA4C;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,gBAAU;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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BAAiB,EAAE,CAAC;QAC1B,IAAA,sBAAe,GAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAClE,CAAC;IAED,oBAAoB;QACnB,IAAA,sBAAe,GAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;;AAzCW,4BAAQ;AAEb,eAAM,GAAG,CAAC,sBAAK,CAAC,AAAV,CAAW;AAGxB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACD;AAGxB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;4CACP;AAGnB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACT;AAGhB;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;sCACb;AAGb;IADC,IAAA,qBAAK,EAAC,OAAO,CAAC;sCACM;AAGrB;IADC,IAAA,qBAAK,EAAC,YAAY,CAAC;2CACH;mBApBL,QAAQ;IADpB,IAAA,6BAAa,EAAC,cAAc,CAAC;GACjB,QAAQ,CAqEpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const style: import("lit").CSSResult;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=codeView.style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeView.style.d.ts","sourceRoot":"","sources":["../../src/components/codeView.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAkEjB,CAAC"}
|
|
@@ -8,6 +8,7 @@ exports.style = (0, lit_1.css) `
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
:host {
|
|
11
|
+
white-space: normal;
|
|
11
12
|
user-select: text;
|
|
12
13
|
display: block;
|
|
13
14
|
position: relative;
|
|
@@ -19,10 +20,10 @@ exports.style = (0, lit_1.css) `
|
|
|
19
20
|
font-size: var(--og-font-size);
|
|
20
21
|
padding: 4px;
|
|
21
22
|
overflow: visible;
|
|
23
|
+
min-height: 25px;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
#btnCopy {
|
|
25
|
-
//display: none;
|
|
26
27
|
position: absolute;
|
|
27
28
|
top: 4px;
|
|
28
29
|
right: 4px;
|
|
@@ -68,4 +69,4 @@ exports.style = (0, lit_1.css) `
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
`;
|
|
71
|
-
//# sourceMappingURL=
|
|
72
|
+
//# sourceMappingURL=codeView.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeView.style.js","sourceRoot":"","sources":["../../src/components/codeView.style.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAEb,QAAA,KAAK,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./code"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./codeBlock"), exports);
|
|
19
|
+
__exportStar(require("./codeView"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,8CAA4B;AAC5B,6CAA2B"}
|
package/dist/loader.d.ts
CHANGED
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAI7C,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,MAAM,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC;KACd;CACJ;AAED,qBAAa,YAAY;IAExB,MAAM,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;IAC9B,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC;IAE7B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM;WAa5B,GAAG;IAKhB,MAAM,CAAC,IAAI;CAaX"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEditorContentHeight = exports.getLanguages = exports.validateLanguage = void 0;
|
|
4
|
+
const loader_1 = require("./loader");
|
|
5
|
+
async function validateLanguage(language) {
|
|
6
|
+
language = language ? language.toLowerCase() : '';
|
|
7
|
+
const languages = await getLanguages();
|
|
8
|
+
return languages.includes(language) ? language : 'plaintext';
|
|
9
|
+
}
|
|
10
|
+
exports.validateLanguage = validateLanguage;
|
|
11
|
+
async function getLanguages() {
|
|
12
|
+
const monaco = await loader_1.MonacoLoader.get();
|
|
13
|
+
return monaco.languages.getLanguages().map(lang => lang.id).filter(lang => lang.indexOf('.') == -1);
|
|
14
|
+
}
|
|
15
|
+
exports.getLanguages = getLanguages;
|
|
16
|
+
function getEditorContentHeight(editor) {
|
|
17
|
+
const dom = editor.getDomNode();
|
|
18
|
+
if (!dom)
|
|
19
|
+
return null;
|
|
20
|
+
const container = dom.getElementsByClassName('view-lines')[0];
|
|
21
|
+
const lineHeight = container.firstElementChild ? container.firstElementChild.offsetHeight : 18;
|
|
22
|
+
const model = editor.getModel();
|
|
23
|
+
return model.getLineCount() * lineHeight;
|
|
24
|
+
}
|
|
25
|
+
exports.getEditorContentHeight = getEditorContentHeight;
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AAGjC,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;AAJD,4CAIC;AAEM,KAAK,UAAU,YAAY;IACjC,MAAM,MAAM,GAAG,MAAM,qBAAY,CAAC,GAAG,EAAE,CAAC;IACxC,OAAO,MAAM,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;AACrG,CAAC;AAHD,oCAGC;AAED,SAAgB,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;AAPD,wDAOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Monaco editor webcomponent",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fortawesome/fontawesome-svg-core": "6.4.2",
|
|
31
|
-
"@omegagrid/core": "^0.
|
|
32
|
-
"@omegagrid/localize": "^0.
|
|
31
|
+
"@omegagrid/core": "^0.4.1",
|
|
32
|
+
"@omegagrid/localize": "^0.4.1",
|
|
33
|
+
"@omegagrid/tree": "^0.4.1",
|
|
33
34
|
"@riovir/wc-fontawesome": "^0.1.9",
|
|
34
35
|
"lit": "^3.1.1",
|
|
35
36
|
"monaco-editor": "^0.45.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"highlighter.d.ts","sourceRoot":"","sources":["../../src/components/highlighter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAMvC,qBACa,WAAY,SAAQ,UAAU;IAE1C,MAAM,CAAC,MAAM,4BAAW;IAGxB,QAAQ,SAAgB;IAGxB,UAAU,UA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OAAO,EAAC,CAAC;yCACb;AAGb;IADC,IAAA,qBAAK,EAAC,OAAO,CAAC;yCACM;AAGrB;IADC,IAAA,qBAAK,EAAC,YAAY,CAAC;8CACH;sBApBL,WAAW;IADvB,IAAA,6BAAa,EAAC,gBAAgB,CAAC;GACnB,WAAW,CAoEvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"highlighter.style.d.ts","sourceRoot":"","sources":["../../src/components/highlighter.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAiEjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"highlighter.style.js","sourceRoot":"","sources":["../../src/components/highlighter.style.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAEb,QAAA,KAAK,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEvB,CAAC"}
|