@nuraly/lumenui 0.1.0 → 0.2.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/nuralyui.bundle.js +23024 -17355
- package/dist/nuralyui.bundle.js.gz +0 -0
- package/dist/src/components/alert/alert.component.d.ts +8 -5
- package/dist/src/components/alert/alert.component.js +24 -20
- package/dist/src/components/alert/alert.style.d.ts +0 -7
- package/dist/src/components/alert/alert.style.js +48 -90
- package/dist/src/components/alert/bundle.js +82 -108
- package/dist/src/components/alert/bundle.js.gz +0 -0
- package/dist/src/components/badge/badge.component.d.ts +9 -8
- package/dist/src/components/badge/badge.component.js +17 -14
- package/dist/src/components/badge/badge.style.d.ts +0 -7
- package/dist/src/components/badge/badge.style.js +49 -107
- package/dist/src/components/badge/bundle.js +81 -119
- package/dist/src/components/badge/bundle.js.gz +0 -0
- package/dist/src/components/breadcrumb/breadcrumb.component.d.ts +8 -10
- package/dist/src/components/breadcrumb/breadcrumb.component.js +16 -15
- package/dist/src/components/breadcrumb/breadcrumb.style.d.ts +0 -7
- package/dist/src/components/breadcrumb/breadcrumb.style.js +42 -60
- package/dist/src/components/breadcrumb/bundle.js +96 -93
- package/dist/src/components/breadcrumb/bundle.js.gz +0 -0
- package/dist/src/components/button/bundle.js +221 -470
- package/dist/src/components/button/bundle.js.gz +0 -0
- package/dist/src/components/button/button.component.d.ts +2 -1
- package/dist/src/components/button/button.component.js +6 -6
- package/dist/src/components/button/button.style.d.ts +0 -7
- package/dist/src/components/button/button.style.js +167 -433
- package/dist/src/components/canvas/base-canvas.component.d.ts +2 -1
- package/dist/src/components/canvas/base-canvas.component.js +1 -0
- package/dist/src/components/canvas/bundle.js +16919 -9595
- package/dist/src/components/canvas/bundle.js.gz +0 -0
- package/dist/src/components/canvas/canvas.constants.d.ts +1 -1
- package/dist/src/components/canvas/canvas.constants.js +1 -1
- package/dist/src/components/canvas/chatbot-panel.style.js +31 -31
- package/dist/src/components/canvas/index.d.ts +2 -0
- package/dist/src/components/canvas/index.js +3 -0
- package/dist/src/components/canvas/whiteboard-canvas.component.d.ts +3 -1
- package/dist/src/components/canvas/whiteboard-canvas.component.js +19 -1
- package/dist/src/components/canvas/whiteboard-canvas.style.js +159 -138
- package/dist/src/components/canvas/whiteboard-node.component.d.ts +2 -1
- package/dist/src/components/canvas/whiteboard-node.component.js +2 -1
- package/dist/src/components/canvas/whiteboard-node.style.js +44 -44
- package/dist/src/components/canvas/workflow-canvas-only.d.ts +4 -0
- package/dist/src/components/canvas/workflow-canvas-only.js +5 -0
- package/dist/src/components/canvas/workflow-canvas.component.d.ts +3 -1
- package/dist/src/components/canvas/workflow-canvas.component.js +24 -2
- package/dist/src/components/canvas/workflow-canvas.style.js +776 -648
- package/dist/src/components/canvas/workflow-canvas.types.d.ts +113 -4
- package/dist/src/components/canvas/workflow-canvas.types.js +646 -3
- package/dist/src/components/canvas/workflow-node.component.d.ts +3 -2
- package/dist/src/components/canvas/workflow-node.component.js +5 -5
- package/dist/src/components/canvas/workflow-node.style.js +183 -181
- package/dist/src/components/card/bundle.js +43 -35
- package/dist/src/components/card/bundle.js.gz +0 -0
- package/dist/src/components/card/card.component.d.ts +6 -1
- package/dist/src/components/card/card.component.js +8 -2
- package/dist/src/components/card/card.style.js +26 -30
- package/dist/src/components/carousel/bundle.js +8 -8
- package/dist/src/components/carousel/bundle.js.gz +0 -0
- package/dist/src/components/carousel/carousel.component.d.ts +12 -0
- package/dist/src/components/carousel/carousel.component.js +16 -4
- package/dist/src/components/chatbot/bundle.js +422 -406
- package/dist/src/components/chatbot/bundle.js.gz +0 -0
- package/dist/src/components/chatbot/chatbot.component.d.ts +2 -1
- package/dist/src/components/chatbot/chatbot.component.js +1 -0
- package/dist/src/components/chatbot/chatbot.style.js +277 -277
- package/dist/src/components/checkbox/bundle.js +86 -245
- package/dist/src/components/checkbox/bundle.js.gz +0 -0
- package/dist/src/components/checkbox/checkbox.component.d.ts +5 -2
- package/dist/src/components/checkbox/checkbox.component.js +11 -13
- package/dist/src/components/checkbox/checkbox.style.js +56 -231
- package/dist/src/components/code-editor/bundle.js +151 -25
- package/dist/src/components/code-editor/bundle.js.gz +0 -0
- package/dist/src/components/code-editor/code-editor.component.d.ts +18 -56
- package/dist/src/components/code-editor/code-editor.component.js +141 -394
- package/dist/src/components/code-editor/code-editor.style.js +139 -15
- package/dist/src/components/collapse/bundle.js +97 -84
- package/dist/src/components/collapse/bundle.js.gz +0 -0
- package/dist/src/components/collapse/collapse.component.d.ts +7 -1
- package/dist/src/components/collapse/collapse.component.js +11 -2
- package/dist/src/components/collapse/collapse.style.js +60 -60
- package/dist/src/components/colorpicker/bundle.js +85 -48
- package/dist/src/components/colorpicker/bundle.js.gz +0 -0
- package/dist/src/components/colorpicker/color-holder.component.d.ts +2 -4
- package/dist/src/components/colorpicker/color-holder.component.js +5 -6
- package/dist/src/components/colorpicker/color-holder.style.js +11 -11
- package/dist/src/components/colorpicker/color-picker.component.d.ts +2 -1
- package/dist/src/components/colorpicker/color-picker.component.js +1 -0
- package/dist/src/components/colorpicker/color-picker.style.js +12 -12
- package/dist/src/components/colorpicker/default-color-sets.component.d.ts +2 -2
- package/dist/src/components/colorpicker/default-color-sets.component.js +4 -3
- package/dist/src/components/colorpicker/default-color-sets.style.js +5 -5
- package/dist/src/components/container/bundle.js +24 -14
- package/dist/src/components/container/bundle.js.gz +0 -0
- package/dist/src/components/container/container.component.d.ts +4 -1
- package/dist/src/components/container/container.component.js +7 -5
- package/dist/src/components/container/container.style.js +9 -9
- package/dist/src/components/datepicker/bundle.js +193 -177
- package/dist/src/components/datepicker/bundle.js.gz +0 -0
- package/dist/src/components/datepicker/datepicker.component.d.ts +2 -1
- package/dist/src/components/datepicker/datepicker.component.js +1 -0
- package/dist/src/components/datepicker/datepicker.style.js +65 -65
- package/dist/src/components/datepicker/datepicker.style.variables.js +91 -91
- package/dist/src/components/db-connection-select/bundle.js +7 -6
- package/dist/src/components/db-connection-select/bundle.js.gz +0 -0
- package/dist/src/components/db-connection-select/db-connection-select.component.d.ts +3 -0
- package/dist/src/components/db-connection-select/db-connection-select.component.js +4 -0
- package/dist/src/components/divider/bundle.js +61 -35
- package/dist/src/components/divider/bundle.js.gz +0 -0
- package/dist/src/components/divider/divider.component.d.ts +4 -6
- package/dist/src/components/divider/divider.component.js +10 -14
- package/dist/src/components/divider/divider.style.js +41 -31
- package/dist/src/components/document/bundle.js +50 -48
- package/dist/src/components/document/bundle.js.gz +0 -0
- package/dist/src/components/document/document.component.d.ts +12 -1
- package/dist/src/components/document/document.component.js +18 -6
- package/dist/src/components/document/document.style.js +21 -36
- package/dist/src/components/dropdown/bundle.js +117 -101
- package/dist/src/components/dropdown/bundle.js.gz +0 -0
- package/dist/src/components/dropdown/dropdown.component.d.ts +2 -1
- package/dist/src/components/dropdown/dropdown.component.js +1 -0
- package/dist/src/components/dropdown/dropdown.style.js +68 -68
- package/dist/src/components/file-upload/bundle.js +82 -76
- package/dist/src/components/file-upload/bundle.js.gz +0 -0
- package/dist/src/components/file-upload/file-upload.component.d.ts +2 -1
- package/dist/src/components/file-upload/file-upload.component.js +1 -0
- package/dist/src/components/file-upload/styles.js +59 -59
- package/dist/src/components/flex/bundle.js +18 -8
- package/dist/src/components/flex/bundle.js.gz +0 -0
- package/dist/src/components/flex/flex.component.d.ts +4 -1
- package/dist/src/components/flex/flex.component.js +7 -4
- package/dist/src/components/flex/flex.style.js +2 -2
- package/dist/src/components/form/bundle.js +22 -10
- package/dist/src/components/form/bundle.js.gz +0 -0
- package/dist/src/components/form/form.component.d.ts +4 -1
- package/dist/src/components/form/form.component.js +5 -1
- package/dist/src/components/form/form.style.js +2 -2
- package/dist/src/components/grid/bundle.js +26 -14
- package/dist/src/components/grid/bundle.js.gz +0 -0
- package/dist/src/components/grid/col.component.d.ts +4 -1
- package/dist/src/components/grid/col.component.js +4 -1
- package/dist/src/components/grid/col.style.js +2 -2
- package/dist/src/components/grid/row.component.d.ts +4 -1
- package/dist/src/components/grid/row.component.js +4 -1
- package/dist/src/components/grid/row.style.js +2 -2
- package/dist/src/components/icon/bundle.js +78 -252
- package/dist/src/components/icon/bundle.js.gz +0 -0
- package/dist/src/components/icon/icon-paths.d.ts +2 -0
- package/dist/src/components/icon/icon-paths.js +141 -0
- package/dist/src/components/icon/icon.component.d.ts +10 -12
- package/dist/src/components/icon/icon.component.js +42 -93
- package/dist/src/components/icon/icon.style.js +42 -130
- package/dist/src/components/icon/icon.variables.js +9 -9
- package/dist/src/components/iconpicker/bundle.js +859 -1511
- package/dist/src/components/iconpicker/bundle.js.gz +0 -0
- package/dist/src/components/iconpicker/icon-picker.component.d.ts +2 -1
- package/dist/src/components/iconpicker/icon-picker.component.js +1 -0
- package/dist/src/components/iconpicker/icon-picker.style.js +13 -13
- package/dist/src/components/image/bundle.js +43 -33
- package/dist/src/components/image/bundle.js.gz +0 -0
- package/dist/src/components/image/image.component.d.ts +10 -1
- package/dist/src/components/image/image.component.js +13 -3
- package/dist/src/components/image/image.style.js +19 -26
- package/dist/src/components/input/bundle.js +420 -644
- package/dist/src/components/input/bundle.js.gz +0 -0
- package/dist/src/components/input/input.component.d.ts +16 -3
- package/dist/src/components/input/input.component.js +43 -27
- package/dist/src/components/input/input.style.d.ts +1 -1
- package/dist/src/components/input/input.style.js +331 -634
- package/dist/src/components/kv-secret-select/bundle.js +2 -1
- package/dist/src/components/kv-secret-select/bundle.js.gz +0 -0
- package/dist/src/components/kv-secret-select/kv-secret-select.component.d.ts +3 -0
- package/dist/src/components/kv-secret-select/kv-secret-select.component.js +4 -0
- package/dist/src/components/label/bundle.js +37 -60
- package/dist/src/components/label/bundle.js.gz +0 -0
- package/dist/src/components/label/label.component.d.ts +8 -4
- package/dist/src/components/label/label.component.js +9 -14
- package/dist/src/components/label/label.style.js +17 -25
- package/dist/src/components/label/label.style.variables.js +18 -18
- package/dist/src/components/layout/bundle.js +86 -70
- package/dist/src/components/layout/bundle.js.gz +0 -0
- package/dist/src/components/layout/content.component.d.ts +2 -1
- package/dist/src/components/layout/content.component.js +2 -1
- package/dist/src/components/layout/content.style.js +3 -3
- package/dist/src/components/layout/footer.component.d.ts +2 -1
- package/dist/src/components/layout/footer.component.js +3 -2
- package/dist/src/components/layout/footer.style.js +7 -7
- package/dist/src/components/layout/header.component.d.ts +2 -1
- package/dist/src/components/layout/header.component.js +3 -2
- package/dist/src/components/layout/header.style.js +7 -7
- package/dist/src/components/layout/layout.component.d.ts +4 -7
- package/dist/src/components/layout/layout.component.js +9 -22
- package/dist/src/components/layout/layout.style.js +1 -1
- package/dist/src/components/layout/sider.component.d.ts +3 -1
- package/dist/src/components/layout/sider.component.js +3 -1
- package/dist/src/components/layout/sider.style.js +29 -29
- package/dist/src/components/menu/bundle.js +135 -125
- package/dist/src/components/menu/bundle.js.gz +0 -0
- package/dist/src/components/menu/menu.component.d.ts +2 -1
- package/dist/src/components/menu/menu.component.js +1 -0
- package/dist/src/components/menu/menu.style.js +87 -87
- package/dist/src/components/modal/bundle.js +105 -96
- package/dist/src/components/modal/bundle.js.gz +0 -0
- package/dist/src/components/modal/modal.component.d.ts +2 -1
- package/dist/src/components/modal/modal.component.js +1 -0
- package/dist/src/components/modal/modal.style.js +69 -71
- package/dist/src/components/panel/bundle.js +190 -391
- package/dist/src/components/panel/bundle.js.gz +0 -0
- package/dist/src/components/panel/panel.component.d.ts +2 -1
- package/dist/src/components/panel/panel.component.js +1 -0
- package/dist/src/components/panel/panel.style.js +65 -65
- package/dist/src/components/popconfirm/bundle.js +107 -93
- package/dist/src/components/popconfirm/bundle.js.gz +0 -0
- package/dist/src/components/popconfirm/popconfirm-manager.component.d.ts +2 -1
- package/dist/src/components/popconfirm/popconfirm-manager.component.js +1 -0
- package/dist/src/components/popconfirm/popconfirm-manager.style.js +16 -16
- package/dist/src/components/popconfirm/popconfirm.component.d.ts +2 -1
- package/dist/src/components/popconfirm/popconfirm.component.js +9 -5
- package/dist/src/components/popconfirm/popconfirm.style.js +43 -43
- package/dist/src/components/radio/bundle.js +56 -86
- package/dist/src/components/radio/bundle.js.gz +0 -0
- package/dist/src/components/radio/radio.component.d.ts +8 -2
- package/dist/src/components/radio/radio.component.js +17 -9
- package/dist/src/components/radio/radio.style.js +30 -77
- package/dist/src/components/radio-group/bundle.js +125 -89
- package/dist/src/components/radio-group/bundle.js.gz +0 -0
- package/dist/src/components/radio-group/radio-group.component.d.ts +5 -1
- package/dist/src/components/radio-group/radio-group.component.js +18 -10
- package/dist/src/components/radio-group/radio-group.style.js +44 -44
- package/dist/src/components/select/bundle.js +260 -367
- package/dist/src/components/select/bundle.js.gz +0 -0
- package/dist/src/components/select/select.component.d.ts +12 -17
- package/dist/src/components/select/select.component.js +35 -35
- package/dist/src/components/select/select.style.js +184 -324
- package/dist/src/components/skeleton/bundle.js +82 -162
- package/dist/src/components/skeleton/bundle.js.gz +0 -0
- package/dist/src/components/skeleton/skeleton.component.d.ts +10 -5
- package/dist/src/components/skeleton/skeleton.component.js +20 -7
- package/dist/src/components/skeleton/skeleton.style.js +34 -133
- package/dist/src/components/slider-input/bundle.js +89 -88
- package/dist/src/components/slider-input/bundle.js.gz +0 -0
- package/dist/src/components/slider-input/slider-input.component.d.ts +11 -0
- package/dist/src/components/slider-input/slider-input.component.js +20 -8
- package/dist/src/components/slider-input/slider-input.style.js +47 -47
- package/dist/src/components/slider-input/slider-input.style.variables.js +32 -32
- package/dist/src/components/table/bundle.js +149 -128
- package/dist/src/components/table/bundle.js.gz +0 -0
- package/dist/src/components/table/table.component.d.ts +2 -1
- package/dist/src/components/table/table.component.js +1 -0
- package/dist/src/components/table/table.style.js +79 -79
- package/dist/src/components/tabs/bundle.js +462 -663
- package/dist/src/components/tabs/bundle.js.gz +0 -0
- package/dist/src/components/tabs/tabs.component.d.ts +6 -1
- package/dist/src/components/tabs/tabs.component.js +8 -1
- package/dist/src/components/tabs/tabs.style.js +200 -201
- package/dist/src/components/tag/bundle.js +44 -36
- package/dist/src/components/tag/bundle.js.gz +0 -0
- package/dist/src/components/tag/tag.component.d.ts +7 -6
- package/dist/src/components/tag/tag.component.js +10 -19
- package/dist/src/components/tag/tag.style.js +20 -24
- package/dist/src/components/textarea/bundle.js +131 -94
- package/dist/src/components/textarea/bundle.js.gz +0 -0
- package/dist/src/components/textarea/textarea.component.d.ts +7 -1
- package/dist/src/components/textarea/textarea.component.js +10 -3
- package/dist/src/components/textarea/textarea.style.d.ts +1 -13
- package/dist/src/components/textarea/textarea.style.js +79 -91
- package/dist/src/components/timeline/bundle.js +71 -134
- package/dist/src/components/timeline/bundle.js.gz +0 -0
- package/dist/src/components/timeline/timeline.component.d.ts +9 -6
- package/dist/src/components/timeline/timeline.component.js +16 -13
- package/dist/src/components/timeline/timeline.style.d.ts +0 -7
- package/dist/src/components/timeline/timeline.style.js +41 -122
- package/dist/src/components/timepicker/bundle.js +196 -166
- package/dist/src/components/timepicker/bundle.js.gz +0 -0
- package/dist/src/components/timepicker/timepicker.component.d.ts +2 -1
- package/dist/src/components/timepicker/timepicker.component.js +1 -0
- package/dist/src/components/timepicker/timepicker.style.js +42 -42
- package/dist/src/components/timepicker/timepicker.style.variables.js +91 -91
- package/dist/src/components/toast/bundle.js +97 -81
- package/dist/src/components/toast/bundle.js.gz +0 -0
- package/dist/src/components/toast/toast.component.d.ts +2 -1
- package/dist/src/components/toast/toast.component.js +1 -0
- package/dist/src/components/toast/toast.style.js +62 -62
- package/dist/src/components/tooltips/bundle.js +10 -10
- package/dist/src/components/tooltips/bundle.js.gz +0 -0
- package/dist/src/components/tooltips/tooltips.component.d.ts +8 -0
- package/dist/src/components/tooltips/tooltips.component.js +9 -1
- package/dist/src/components/tooltips/tooltips.style.js +6 -6
- package/dist/src/components/video/bundle.js +47 -36
- package/dist/src/components/video/bundle.js.gz +0 -0
- package/dist/src/components/video/video.component.d.ts +12 -1
- package/dist/src/components/video/video.component.js +18 -6
- package/dist/src/components/video/video.style.js +18 -24
- package/package.json +25 -12
- package/packages/common/dist/VERSIONS.md +2 -2
- package/packages/common/dist/shared/base-mixin.d.ts +21 -19
- package/packages/common/dist/shared/base-mixin.d.ts.map +1 -1
- package/packages/common/dist/shared/base-mixin.js +102 -18
- package/packages/common/dist/shared/base-mixin.js.map +1 -1
- package/packages/common/dist/shared/index.d.ts +1 -0
- package/packages/common/dist/shared/index.d.ts.map +1 -1
- package/packages/common/dist/shared/index.js +2 -0
- package/packages/common/dist/shared/index.js.map +1 -1
- package/packages/common/dist/shared/style-injector.d.ts +11 -0
- package/packages/common/dist/shared/style-injector.d.ts.map +1 -0
- package/packages/common/dist/shared/style-injector.js +53 -0
- package/packages/common/dist/shared/style-injector.js.map +1 -0
- package/packages/common/dist/shared/theme-mixin.d.ts +2 -24
- package/packages/common/dist/shared/theme-mixin.d.ts.map +1 -1
- package/packages/common/dist/shared/theme-mixin.js +5 -38
- package/packages/common/dist/shared/theme-mixin.js.map +1 -1
- package/packages/themes/dist/default.css +0 -10
- package/packages/themes/dist/package.json +1 -1
|
@@ -15,38 +15,28 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
|
15
15
|
import { styles } from './code-editor.style.js';
|
|
16
16
|
import { CODE_EDITOR_THEME } from './code-editor.types.js';
|
|
17
17
|
import { ThemeAwareMixin } from '../../shared/theme-mixin.js';
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (label === 'json') {
|
|
39
|
-
return new jsonWorker();
|
|
40
|
-
}
|
|
41
|
-
if (label === 'html') {
|
|
42
|
-
return new htmlWorker();
|
|
43
|
-
}
|
|
44
|
-
return new editorWorker();
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
18
|
+
import { CodeJar } from 'codejar';
|
|
19
|
+
import hljs from 'highlight.js/lib/core';
|
|
20
|
+
import javascript from 'highlight.js/lib/languages/javascript';
|
|
21
|
+
import typescript from 'highlight.js/lib/languages/typescript';
|
|
22
|
+
import json from 'highlight.js/lib/languages/json';
|
|
23
|
+
import xml from 'highlight.js/lib/languages/xml';
|
|
24
|
+
import css from 'highlight.js/lib/languages/css';
|
|
25
|
+
import markdown from 'highlight.js/lib/languages/markdown';
|
|
26
|
+
import python from 'highlight.js/lib/languages/python';
|
|
27
|
+
import sql from 'highlight.js/lib/languages/sql';
|
|
28
|
+
// Register languages
|
|
29
|
+
hljs.registerLanguage('javascript', javascript);
|
|
30
|
+
hljs.registerLanguage('typescript', typescript);
|
|
31
|
+
hljs.registerLanguage('json', json);
|
|
32
|
+
hljs.registerLanguage('html', xml);
|
|
33
|
+
hljs.registerLanguage('xml', xml);
|
|
34
|
+
hljs.registerLanguage('css', css);
|
|
35
|
+
hljs.registerLanguage('markdown', markdown);
|
|
36
|
+
hljs.registerLanguage('python', python);
|
|
37
|
+
hljs.registerLanguage('sql', sql);
|
|
48
38
|
/**
|
|
49
|
-
* NuralyUI Code Editor component
|
|
39
|
+
* NuralyUI Code Editor component using CodeJar — a lightweight (~2KB) code editor.
|
|
50
40
|
*
|
|
51
41
|
* @example
|
|
52
42
|
* ```html
|
|
@@ -66,20 +56,16 @@ if (typeof self !== 'undefined') {
|
|
|
66
56
|
* @fires nr-ready - Fired when the editor is ready
|
|
67
57
|
*
|
|
68
58
|
* @csspart editor-container - The container wrapping the editor
|
|
69
|
-
*
|
|
70
|
-
* @cssprop [--nr-code-editor-width=100%] - Width of the editor
|
|
71
|
-
* @cssprop [--nr-code-editor-height=100%] - Height of the editor
|
|
72
|
-
* @cssprop [--nr-code-editor-min-height=0] - Minimum height
|
|
73
|
-
* @cssprop [--nr-code-editor-max-height=none] - Maximum height
|
|
74
|
-
* @cssprop [--nr-code-editor-border-radius=4px] - Border radius
|
|
75
59
|
*/
|
|
76
60
|
let NrCodeEditorElement = class NrCodeEditorElement extends ThemeAwareMixin(LitElement) {
|
|
77
61
|
constructor() {
|
|
78
62
|
super(...arguments);
|
|
79
63
|
/** Whether editor is initialized */
|
|
80
64
|
this.isEditorReady = false;
|
|
81
|
-
/** Reference to the editor
|
|
82
|
-
this.
|
|
65
|
+
/** Reference to the editor element */
|
|
66
|
+
this.editorRef = createRef();
|
|
67
|
+
/** Suppress change events during programmatic updates */
|
|
68
|
+
this.suppressChange = false;
|
|
83
69
|
/** Makes the editor read-only */
|
|
84
70
|
this.readonly = false;
|
|
85
71
|
/** Editor theme (vs, vs-dark, hc-black, hc-light) */
|
|
@@ -90,137 +76,134 @@ let NrCodeEditorElement = class NrCodeEditorElement extends ThemeAwareMixin(LitE
|
|
|
90
76
|
this.code = '';
|
|
91
77
|
/** Show line numbers */
|
|
92
78
|
this.lineNumbers = true;
|
|
93
|
-
/** Show minimap */
|
|
94
|
-
this.minimap = false;
|
|
95
|
-
/** Enable word wrap */
|
|
96
|
-
this.wordWrap = false;
|
|
97
79
|
/** Font size in pixels */
|
|
98
80
|
this.fontSize = 13;
|
|
99
|
-
/** Enable
|
|
100
|
-
this.
|
|
101
|
-
/**
|
|
102
|
-
this.
|
|
103
|
-
/** Extra type definitions for Monaco IntelliSense (host-provided) */
|
|
104
|
-
this.extraTypeDefinitions = '';
|
|
81
|
+
/** Enable word wrap */
|
|
82
|
+
this.wordWrap = false;
|
|
83
|
+
/** Tab size in spaces */
|
|
84
|
+
this.tabSize = 2;
|
|
105
85
|
}
|
|
106
86
|
render() {
|
|
87
|
+
const isDark = this.isDarkTheme();
|
|
107
88
|
return html `
|
|
108
|
-
<
|
|
109
|
-
${
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
89
|
+
<div class="editor-container ${isDark ? 'dark' : 'light'}" part="editor-container">
|
|
90
|
+
<div class="line-numbers-gutter" style="display: ${this.lineNumbers ? 'block' : 'none'}"></div>
|
|
91
|
+
<code
|
|
92
|
+
${ref(this.editorRef)}
|
|
93
|
+
class="editor language-${this.language}"
|
|
94
|
+
style="font-size: ${this.fontSize}px; tab-size: ${this.tabSize}; white-space: ${this.wordWrap ? 'pre-wrap' : 'pre'};"
|
|
95
|
+
></code>
|
|
113
96
|
</div>
|
|
114
97
|
`;
|
|
115
98
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Returns the current code contents
|
|
118
|
-
*/
|
|
99
|
+
/** Returns the current code contents */
|
|
119
100
|
getValue() {
|
|
120
101
|
var _a, _b;
|
|
121
|
-
return (_b = (_a = this.
|
|
102
|
+
return (_b = (_a = this.editorRef.value) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : '';
|
|
122
103
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Sets the editor value programmatically
|
|
125
|
-
*/
|
|
104
|
+
/** Sets the editor value programmatically */
|
|
126
105
|
setValue(value) {
|
|
127
|
-
if (this.
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
this.editor.setPosition(cursorPosition);
|
|
132
|
-
}
|
|
106
|
+
if (this.jar) {
|
|
107
|
+
this.suppressChange = true;
|
|
108
|
+
this.jar.updateCode(value);
|
|
109
|
+
this.suppressChange = false;
|
|
133
110
|
}
|
|
134
111
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Updates Monaco editor options
|
|
137
|
-
*/
|
|
138
|
-
setOptions(options) {
|
|
139
|
-
var _a;
|
|
140
|
-
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.updateOptions(options);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Focus the editor
|
|
144
|
-
*/
|
|
112
|
+
/** Focus the editor */
|
|
145
113
|
focus() {
|
|
146
114
|
var _a;
|
|
147
|
-
(_a = this.
|
|
115
|
+
(_a = this.editorRef.value) === null || _a === void 0 ? void 0 : _a.focus();
|
|
148
116
|
}
|
|
149
117
|
firstUpdated() {
|
|
150
|
-
if (!this.
|
|
151
|
-
console.error('NrCodeEditor: Container element not available');
|
|
118
|
+
if (!this.editorRef.value)
|
|
152
119
|
return;
|
|
153
|
-
}
|
|
154
120
|
this.initializeEditor();
|
|
155
121
|
}
|
|
156
122
|
initializeEditor() {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
this.
|
|
185
|
-
|
|
186
|
-
this.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
setupEventListeners() {
|
|
193
|
-
var _a;
|
|
194
|
-
if (!this.editor)
|
|
195
|
-
return;
|
|
196
|
-
// Content change events
|
|
197
|
-
(_a = this.editor.getModel()) === null || _a === void 0 ? void 0 : _a.onDidChangeContent(() => {
|
|
198
|
-
this.emit('nr-change', { value: this.getValue() });
|
|
123
|
+
const el = this.editorRef.value;
|
|
124
|
+
// Set initial content
|
|
125
|
+
el.textContent = this.code;
|
|
126
|
+
// Syntax highlighter using highlight.js
|
|
127
|
+
const highlight = (editor) => {
|
|
128
|
+
const code = editor.textContent || '';
|
|
129
|
+
const lang = this.language || 'plaintext';
|
|
130
|
+
try {
|
|
131
|
+
if (lang !== 'plaintext' && hljs.getLanguage(lang)) {
|
|
132
|
+
editor.innerHTML = hljs.highlight(code, { language: lang }).value;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
editor.innerHTML = this.escapeHtml(code);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (_a) {
|
|
139
|
+
editor.innerHTML = this.escapeHtml(code);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
this.jar = CodeJar(el, highlight, {
|
|
143
|
+
tab: ' '.repeat(this.tabSize),
|
|
144
|
+
indentOn: /[({[]$/,
|
|
145
|
+
addClosing: true,
|
|
146
|
+
catchTab: true,
|
|
147
|
+
preserveIdent: true,
|
|
148
|
+
history: true,
|
|
149
|
+
});
|
|
150
|
+
this.isEditorReady = true;
|
|
151
|
+
// Listen for changes
|
|
152
|
+
this.jar.onUpdate((code) => {
|
|
153
|
+
if (!this.suppressChange) {
|
|
154
|
+
this.code = code;
|
|
155
|
+
this.updateLineNumbers();
|
|
156
|
+
this.emit('nr-change', { value: code });
|
|
157
|
+
}
|
|
199
158
|
});
|
|
200
159
|
// Keyboard events
|
|
201
|
-
|
|
160
|
+
el.addEventListener('keydown', (e) => {
|
|
161
|
+
if (this.readonly) {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
202
165
|
this.emit('nr-keydown', this.createKeyEventDetail(e));
|
|
203
166
|
});
|
|
204
|
-
|
|
167
|
+
el.addEventListener('keyup', (e) => {
|
|
205
168
|
this.emit('nr-keyup', this.createKeyEventDetail(e));
|
|
206
169
|
});
|
|
207
|
-
// Focus
|
|
208
|
-
|
|
209
|
-
|
|
170
|
+
// Focus/blur
|
|
171
|
+
el.addEventListener('focus', () => this.emit('nr-focus'));
|
|
172
|
+
el.addEventListener('blur', () => this.emit('nr-blur'));
|
|
173
|
+
// Readonly
|
|
174
|
+
if (this.readonly) {
|
|
175
|
+
el.setAttribute('contenteditable', 'false');
|
|
176
|
+
}
|
|
177
|
+
// Initial line numbers
|
|
178
|
+
this.updateLineNumbers();
|
|
179
|
+
this.emit('nr-ready', { editor: this.jar });
|
|
180
|
+
}
|
|
181
|
+
escapeHtml(text) {
|
|
182
|
+
return text
|
|
183
|
+
.replace(/&/g, '&')
|
|
184
|
+
.replace(/</g, '<')
|
|
185
|
+
.replace(/>/g, '>');
|
|
186
|
+
}
|
|
187
|
+
updateLineNumbers() {
|
|
188
|
+
var _a, _b, _c;
|
|
189
|
+
const gutter = (_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.line-numbers-gutter')) !== null && _b !== void 0 ? _b : (_c = this.renderRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.line-numbers-gutter');
|
|
190
|
+
if (!gutter || !this.lineNumbers)
|
|
191
|
+
return;
|
|
192
|
+
const code = this.getValue();
|
|
193
|
+
const lines = code.split('\n').length;
|
|
194
|
+
gutter.innerHTML = Array.from({ length: lines }, (_, i) => `<div class="line-number">${i + 1}</div>`).join('');
|
|
210
195
|
}
|
|
211
|
-
/** Helper to create keyboard event detail */
|
|
212
196
|
createKeyEventDetail(e) {
|
|
213
197
|
return {
|
|
214
|
-
event: e
|
|
215
|
-
key: e.
|
|
216
|
-
code: e.
|
|
217
|
-
ctrlKey: e.
|
|
218
|
-
shiftKey: e.
|
|
219
|
-
altKey: e.
|
|
220
|
-
metaKey: e.
|
|
198
|
+
event: e,
|
|
199
|
+
key: e.key,
|
|
200
|
+
code: e.code,
|
|
201
|
+
ctrlKey: e.ctrlKey,
|
|
202
|
+
shiftKey: e.shiftKey,
|
|
203
|
+
altKey: e.altKey,
|
|
204
|
+
metaKey: e.metaKey,
|
|
221
205
|
};
|
|
222
206
|
}
|
|
223
|
-
/** Helper to emit custom events */
|
|
224
207
|
emit(eventName, detail) {
|
|
225
208
|
this.dispatchEvent(new CustomEvent(eventName, {
|
|
226
209
|
detail,
|
|
@@ -228,270 +211,43 @@ let NrCodeEditorElement = class NrCodeEditorElement extends ThemeAwareMixin(LitE
|
|
|
228
211
|
composed: true,
|
|
229
212
|
}));
|
|
230
213
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Convert the mixin's currentTheme to Monaco theme
|
|
238
|
-
* Uses explicit theme prop if set, otherwise derives from data-theme
|
|
239
|
-
*/
|
|
240
|
-
getMonacoThemeFromMixin() {
|
|
241
|
-
// If explicit theme prop is set, use it
|
|
242
|
-
if (this.theme) {
|
|
243
|
-
return this.theme;
|
|
244
|
-
}
|
|
245
|
-
// Use the mixin's currentTheme which handles data-theme and system preference
|
|
246
|
-
const currentTheme = this.currentTheme;
|
|
247
|
-
// Map theme values to Monaco themes
|
|
248
|
-
if (currentTheme.includes('dark')) {
|
|
249
|
-
return CODE_EDITOR_THEME.Dark;
|
|
214
|
+
isDarkTheme() {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
if (this.theme === CODE_EDITOR_THEME.Dark || this.theme === CODE_EDITOR_THEME.HighContrastDark) {
|
|
217
|
+
return true;
|
|
250
218
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Apply the current theme from the mixin to Monaco editor
|
|
255
|
-
*/
|
|
256
|
-
applyThemeFromMixin() {
|
|
257
|
-
if (!this.isEditorReady || !this.editor)
|
|
258
|
-
return;
|
|
259
|
-
const monacoTheme = this.getMonacoThemeFromMixin();
|
|
260
|
-
// Only update if theme has changed
|
|
261
|
-
if (monacoTheme !== this.lastAppliedTheme) {
|
|
262
|
-
try {
|
|
263
|
-
monaco.editor.setTheme(monacoTheme);
|
|
264
|
-
this.lastAppliedTheme = monacoTheme;
|
|
265
|
-
}
|
|
266
|
-
catch (_a) {
|
|
267
|
-
// Ignore errors
|
|
268
|
-
}
|
|
219
|
+
if (this.theme === CODE_EDITOR_THEME.Light || this.theme === CODE_EDITOR_THEME.HighContrastLight) {
|
|
220
|
+
return false;
|
|
269
221
|
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Get the initial theme for the editor
|
|
273
|
-
* Priority: explicit theme prop > data-theme > system preference
|
|
274
|
-
*/
|
|
275
|
-
getInitialTheme() {
|
|
276
|
-
return this.getMonacoThemeFromMixin();
|
|
277
|
-
}
|
|
278
|
-
setupCustomIntelliSense() {
|
|
279
|
-
const tsDefaults = monaco.languages.typescript.typescriptDefaults;
|
|
280
|
-
const jsDefaults = monaco.languages.typescript.javascriptDefaults;
|
|
281
|
-
// Add custom type definitions for both TypeScript and JavaScript
|
|
282
|
-
[tsDefaults, jsDefaults].forEach(defaults => {
|
|
283
|
-
if (this.extraTypeDefinitions) {
|
|
284
|
-
defaults.addExtraLib(this.extraTypeDefinitions, 'database-types.d.ts');
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
// Base compiler options shared between TS and JS
|
|
288
|
-
const baseCompilerOptions = {
|
|
289
|
-
target: monaco.languages.typescript.ScriptTarget.ES2020,
|
|
290
|
-
allowNonTsExtensions: true,
|
|
291
|
-
moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
|
|
292
|
-
module: monaco.languages.typescript.ModuleKind.CommonJS,
|
|
293
|
-
noEmit: true,
|
|
294
|
-
esModuleInterop: true,
|
|
295
|
-
allowJs: true,
|
|
296
|
-
};
|
|
297
|
-
// TypeScript-specific options
|
|
298
|
-
tsDefaults.setCompilerOptions(Object.assign(Object.assign({}, baseCompilerOptions), { jsx: monaco.languages.typescript.JsxEmit.React, reactNamespace: 'React', typeRoots: ['node_modules/@types'] }));
|
|
299
|
-
// JavaScript-specific options
|
|
300
|
-
jsDefaults.setCompilerOptions(Object.assign(Object.assign({}, baseCompilerOptions), { checkJs: false }));
|
|
301
|
-
// Register custom completion provider for Database suggestions
|
|
302
|
-
monaco.languages.registerCompletionItemProvider(['javascript', 'typescript'], {
|
|
303
|
-
provideCompletionItems: () => {
|
|
304
|
-
const suggestions = [
|
|
305
|
-
{
|
|
306
|
-
label: 'Database',
|
|
307
|
-
kind: monaco.languages.CompletionItemKind.Class,
|
|
308
|
-
insertText: 'Database',
|
|
309
|
-
documentation: 'Static Database Client for Nuraly Database Manager',
|
|
310
|
-
detail: 'class Database',
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
label: 'Database.select',
|
|
314
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
315
|
-
insertText: 'Database.select(${1:"tableName"}, {${2:}})',
|
|
316
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
317
|
-
documentation: 'Select data from a table with optional criteria and relations',
|
|
318
|
-
detail: '(method) Database.select(tableName: string, options?: SelectOptions): Promise<any>',
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
label: 'Database.insert',
|
|
322
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
323
|
-
insertText: 'Database.insert(${1:"tableName"}, ${2:{}})',
|
|
324
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
325
|
-
documentation: 'Insert data into a table',
|
|
326
|
-
detail: '(method) Database.insert(tableName: string, data: Record<string, any>): Promise<any>',
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
label: 'Database.update',
|
|
330
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
331
|
-
insertText: 'Database.update(${1:"tableName"}, ${2:{}}, ${3:{}})',
|
|
332
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
333
|
-
documentation: 'Update data in a table',
|
|
334
|
-
detail: '(method) Database.update(tableName: string, data: Record<string, any>, criteria: Record<string, any>): Promise<any>',
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
label: 'Database.delete',
|
|
338
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
339
|
-
insertText: 'Database.delete(${1:"tableName"}, ${2:{}})',
|
|
340
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
341
|
-
documentation: 'Delete data from a table',
|
|
342
|
-
detail: '(method) Database.delete(tableName: string, criteria: Record<string, any>): Promise<any>',
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
label: 'Database.createTable',
|
|
346
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
347
|
-
insertText: 'Database.createTable(${1:"tableName"}, {\n ${2:field}: { type: ${3:"varchar"}, nullable: ${4:false} }\n})',
|
|
348
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
349
|
-
documentation: 'Create a new table with specified schema',
|
|
350
|
-
detail: '(method) Database.createTable(tableName: string, schema: TableSchema, options?: Record<string, any>): Promise<any>',
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
label: 'Database.paginate',
|
|
354
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
355
|
-
insertText: 'Database.paginate(${1:"tableName"}, ${2:1}, ${3:10}, ${4:{}})',
|
|
356
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
357
|
-
documentation: 'Get paginated results with metadata',
|
|
358
|
-
detail: '(method) Database.paginate(tableName: string, page?: number, pageSize?: number, options?: SelectOptions): Promise<PaginationResult<any>>',
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
label: 'Database.schemaQuery',
|
|
362
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
363
|
-
insertText: 'Database.schemaQuery(${1:"LIST_TABLES"}${2:, "tableName"})',
|
|
364
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
365
|
-
documentation: 'Execute schema queries for database introspection',
|
|
366
|
-
detail: '(method) Database.schemaQuery(type: string, tableName?: string): Promise<any>',
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
label: 'Database.join',
|
|
370
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
371
|
-
insertText: 'Database.join(${1:"mainTable"}, [\n { table: ${2:"joinTable"}, on: ${3:"field1 = field2"}, type: ${4:"inner"} }\n], ${5:{}})',
|
|
372
|
-
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
373
|
-
documentation: 'Perform complex join queries',
|
|
374
|
-
detail: '(method) Database.join(mainTable: string, joins: JoinDefinition[], options?: Record<string, any>): Promise<any>',
|
|
375
|
-
},
|
|
376
|
-
];
|
|
377
|
-
return { suggestions };
|
|
378
|
-
},
|
|
379
|
-
});
|
|
380
|
-
// Register hover provider for documentation
|
|
381
|
-
monaco.languages.registerHoverProvider(['javascript', 'typescript'], {
|
|
382
|
-
provideHover: (model, position) => {
|
|
383
|
-
const word = model.getWordAtPosition(position);
|
|
384
|
-
if (!word)
|
|
385
|
-
return;
|
|
386
|
-
const hoverDocs = {
|
|
387
|
-
Database: {
|
|
388
|
-
contents: [
|
|
389
|
-
{ value: '**Database**' },
|
|
390
|
-
{ value: 'Static Database Client for Nuraly Database Manager' },
|
|
391
|
-
{ value: 'Provides a comprehensive interface for database operations including:' },
|
|
392
|
-
{ value: '- Table management (create, drop, schema operations)' },
|
|
393
|
-
{ value: '- Data operations (select, insert, update, delete)' },
|
|
394
|
-
{ value: '- Advanced queries (joins, aggregations, pagination)' },
|
|
395
|
-
{ value: '- Schema introspection and management' },
|
|
396
|
-
],
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
|
-
return hoverDocs[word.word] || null;
|
|
400
|
-
},
|
|
401
|
-
});
|
|
222
|
+
return (_b = (_a = this.currentTheme) === null || _a === void 0 ? void 0 : _a.includes('dark')) !== null && _b !== void 0 ? _b : false;
|
|
402
223
|
}
|
|
403
224
|
updated(changedProperties) {
|
|
404
225
|
var _a;
|
|
405
226
|
super.updated(changedProperties);
|
|
406
|
-
if (!this.isEditorReady || !this.
|
|
227
|
+
if (!this.isEditorReady || !this.jar)
|
|
407
228
|
return;
|
|
408
|
-
// Apply theme from mixin on every update (handles data-theme changes)
|
|
409
|
-
this.applyThemeFromMixin();
|
|
410
229
|
if (changedProperties.has('code') && this.code !== changedProperties.get('code')) {
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
this.editor.setValue((_a = this.code) !== null && _a !== void 0 ? _a : '');
|
|
416
|
-
if (cursorPosition) {
|
|
417
|
-
this.editor.setPosition(cursorPosition);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
catch (_b) {
|
|
421
|
-
// Monaco services might be temporarily unavailable
|
|
422
|
-
}
|
|
230
|
+
const current = this.getValue();
|
|
231
|
+
if (this.code !== current) {
|
|
232
|
+
this.setValue(this.code);
|
|
233
|
+
this.updateLineNumbers();
|
|
423
234
|
}
|
|
424
235
|
}
|
|
425
236
|
if (changedProperties.has('readonly')) {
|
|
426
|
-
|
|
427
|
-
this.editor.updateOptions({ readOnly: this.readonly });
|
|
428
|
-
}
|
|
429
|
-
catch (_c) {
|
|
430
|
-
// Ignore
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
if (changedProperties.has('language') && this.editor.getModel()) {
|
|
434
|
-
try {
|
|
435
|
-
monaco.editor.setModelLanguage(this.editor.getModel(), this.language || 'plaintext');
|
|
436
|
-
}
|
|
437
|
-
catch (_d) {
|
|
438
|
-
// Ignore
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
if (changedProperties.has('theme')) {
|
|
442
|
-
try {
|
|
443
|
-
monaco.editor.setTheme(this.theme);
|
|
444
|
-
}
|
|
445
|
-
catch (_e) {
|
|
446
|
-
// Ignore
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (changedProperties.has('fontSize')) {
|
|
450
|
-
try {
|
|
451
|
-
this.editor.updateOptions({ fontSize: this.fontSize });
|
|
452
|
-
}
|
|
453
|
-
catch (_f) {
|
|
454
|
-
// Ignore
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
if (changedProperties.has('lineNumbers')) {
|
|
458
|
-
try {
|
|
459
|
-
this.editor.updateOptions({ lineNumbers: this.lineNumbers ? 'on' : 'off' });
|
|
460
|
-
}
|
|
461
|
-
catch (_g) {
|
|
462
|
-
// Ignore
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
if (changedProperties.has('minimap')) {
|
|
466
|
-
try {
|
|
467
|
-
this.editor.updateOptions({ minimap: { enabled: this.minimap } });
|
|
468
|
-
}
|
|
469
|
-
catch (_h) {
|
|
470
|
-
// Ignore
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
if (changedProperties.has('wordWrap')) {
|
|
474
|
-
try {
|
|
475
|
-
this.editor.updateOptions({ wordWrap: this.wordWrap ? 'on' : 'off' });
|
|
476
|
-
}
|
|
477
|
-
catch (_j) {
|
|
478
|
-
// Ignore
|
|
479
|
-
}
|
|
237
|
+
(_a = this.editorRef.value) === null || _a === void 0 ? void 0 : _a.setAttribute('contenteditable', this.readonly ? 'false' : 'true');
|
|
480
238
|
}
|
|
481
239
|
}
|
|
482
240
|
disconnectedCallback() {
|
|
483
241
|
super.disconnectedCallback();
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
this.editor.dispose();
|
|
488
|
-
model === null || model === void 0 ? void 0 : model.dispose();
|
|
489
|
-
this.editor = undefined;
|
|
242
|
+
if (this.jar) {
|
|
243
|
+
this.jar.destroy();
|
|
244
|
+
this.jar = undefined;
|
|
490
245
|
}
|
|
491
246
|
this.isEditorReady = false;
|
|
492
247
|
}
|
|
493
248
|
};
|
|
494
249
|
NrCodeEditorElement.styles = styles;
|
|
250
|
+
NrCodeEditorElement.useShadowDom = true;
|
|
495
251
|
__decorate([
|
|
496
252
|
property({ type: Boolean, reflect: true })
|
|
497
253
|
], NrCodeEditorElement.prototype, "readonly", void 0);
|
|
@@ -507,24 +263,15 @@ __decorate([
|
|
|
507
263
|
__decorate([
|
|
508
264
|
property({ type: Boolean, attribute: 'line-numbers' })
|
|
509
265
|
], NrCodeEditorElement.prototype, "lineNumbers", void 0);
|
|
510
|
-
__decorate([
|
|
511
|
-
property({ type: Boolean })
|
|
512
|
-
], NrCodeEditorElement.prototype, "minimap", void 0);
|
|
513
|
-
__decorate([
|
|
514
|
-
property({ type: Boolean, attribute: 'word-wrap' })
|
|
515
|
-
], NrCodeEditorElement.prototype, "wordWrap", void 0);
|
|
516
266
|
__decorate([
|
|
517
267
|
property({ type: Number, attribute: 'font-size' })
|
|
518
268
|
], NrCodeEditorElement.prototype, "fontSize", void 0);
|
|
519
269
|
__decorate([
|
|
520
|
-
property({ type: Boolean, attribute: '
|
|
521
|
-
], NrCodeEditorElement.prototype, "
|
|
522
|
-
__decorate([
|
|
523
|
-
property({ type: String, attribute: 'completions-endpoint' })
|
|
524
|
-
], NrCodeEditorElement.prototype, "completionsEndpoint", void 0);
|
|
270
|
+
property({ type: Boolean, attribute: 'word-wrap' })
|
|
271
|
+
], NrCodeEditorElement.prototype, "wordWrap", void 0);
|
|
525
272
|
__decorate([
|
|
526
|
-
property({ attribute:
|
|
527
|
-
], NrCodeEditorElement.prototype, "
|
|
273
|
+
property({ type: Number, attribute: 'tab-size' })
|
|
274
|
+
], NrCodeEditorElement.prototype, "tabSize", void 0);
|
|
528
275
|
NrCodeEditorElement = __decorate([
|
|
529
276
|
customElement('nr-code-editor')
|
|
530
277
|
], NrCodeEditorElement);
|