@cloud-ru/ds-code-editor 1.0.0
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/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +365 -0
- package/dist/cjs/components/AsyncCodeEditor/AsyncCodeEditor.d.ts +22 -0
- package/dist/cjs/components/AsyncCodeEditor/AsyncCodeEditor.js +33 -0
- package/dist/cjs/components/AsyncCodeEditor/index.d.ts +1 -0
- package/dist/cjs/components/AsyncCodeEditor/index.js +17 -0
- package/dist/cjs/components/CodeEditor/CodeEditor.d.ts +23 -0
- package/dist/cjs/components/CodeEditor/CodeEditor.js +183 -0
- package/dist/cjs/components/CodeEditor/hooks.d.ts +43 -0
- package/dist/cjs/components/CodeEditor/hooks.js +103 -0
- package/dist/cjs/components/CodeEditor/index.d.ts +1 -0
- package/dist/cjs/components/CodeEditor/index.js +17 -0
- package/dist/cjs/components/CodeEditor/styles.module.css +49 -0
- package/dist/cjs/components/LazyCodeEditor/LazyCodeEditor.d.ts +13 -0
- package/dist/cjs/components/LazyCodeEditor/LazyCodeEditor.js +31 -0
- package/dist/cjs/components/LazyCodeEditor/index.d.ts +1 -0
- package/dist/cjs/components/LazyCodeEditor/index.js +17 -0
- package/dist/cjs/components/LazyCodeEditor/styles.module.css +7 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +19 -0
- package/dist/cjs/constants.d.ts +113 -0
- package/dist/cjs/constants.js +132 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/loader.d.ts +10 -0
- package/dist/cjs/loader.js +17 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +56 -0
- package/dist/cjs/types.d.ts +67 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +11 -0
- package/dist/cjs/utils.js +94 -0
- package/dist/cjs/withMonaco.d.ts +6 -0
- package/dist/cjs/withMonaco.js +14 -0
- package/dist/esm/components/AsyncCodeEditor/AsyncCodeEditor.d.ts +22 -0
- package/dist/esm/components/AsyncCodeEditor/AsyncCodeEditor.js +29 -0
- package/dist/esm/components/AsyncCodeEditor/index.d.ts +1 -0
- package/dist/esm/components/AsyncCodeEditor/index.js +1 -0
- package/dist/esm/components/CodeEditor/CodeEditor.d.ts +23 -0
- package/dist/esm/components/CodeEditor/CodeEditor.js +177 -0
- package/dist/esm/components/CodeEditor/hooks.d.ts +43 -0
- package/dist/esm/components/CodeEditor/hooks.js +99 -0
- package/dist/esm/components/CodeEditor/index.d.ts +1 -0
- package/dist/esm/components/CodeEditor/index.js +1 -0
- package/dist/esm/components/CodeEditor/styles.module.css +49 -0
- package/dist/esm/components/LazyCodeEditor/LazyCodeEditor.d.ts +13 -0
- package/dist/esm/components/LazyCodeEditor/LazyCodeEditor.js +25 -0
- package/dist/esm/components/LazyCodeEditor/index.d.ts +1 -0
- package/dist/esm/components/LazyCodeEditor/index.js +1 -0
- package/dist/esm/components/LazyCodeEditor/styles.module.css +7 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/constants.d.ts +113 -0
- package/dist/esm/constants.js +129 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/loader.d.ts +10 -0
- package/dist/esm/loader.js +12 -0
- package/dist/esm/style.css +56 -0
- package/dist/esm/types.d.ts +67 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +11 -0
- package/dist/esm/utils.js +86 -0
- package/dist/esm/withMonaco.d.ts +6 -0
- package/dist/esm/withMonaco.js +10 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +56 -0
- package/src/components/AsyncCodeEditor/AsyncCodeEditor.tsx +33 -0
- package/src/components/AsyncCodeEditor/index.ts +1 -0
- package/src/components/CodeEditor/CodeEditor.tsx +297 -0
- package/src/components/CodeEditor/hooks.ts +138 -0
- package/src/components/CodeEditor/index.ts +1 -0
- package/src/components/CodeEditor/styles.module.scss +66 -0
- package/src/components/LazyCodeEditor/LazyCodeEditor.tsx +39 -0
- package/src/components/LazyCodeEditor/index.ts +1 -0
- package/src/components/LazyCodeEditor/styles.module.scss +10 -0
- package/src/components/index.ts +3 -0
- package/src/constants.ts +135 -0
- package/src/index.ts +5 -0
- package/src/loader.ts +20 -0
- package/src/types.ts +73 -0
- package/src/utils.ts +94 -0
- package/src/withMonaco.ts +14 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2023 Cloud technology Limited (Ltd.)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# CodeEditor
|
|
2
|
+
|
|
3
|
+
`@cloud-ru/ds-code-editor` — Обёртка над monaco-editor с темизацией на токенах дизайн-системы, шапкой с языком и кнопкой копирования, async/lazy-загрузкой и JSON/YAML-валидацией по schema.
|
|
4
|
+
|
|
5
|
+
Тонкая обёртка над [`@monaco-editor/react`](https://github.com/suren-atoyan/monaco-react) с темой на токенах дизайн-системы, опциональной шапкой (language label + copy button) и фиксированными типографическими опциями. Поддерживает JSON/YAML-валидацию по JSON-Schema, async/lazy-варианты загрузки monaco-бандла и встраивание в продуктовые формы и карточки.
|
|
6
|
+
|
|
7
|
+
## Когда использовать
|
|
8
|
+
|
|
9
|
+
- Просмотр и редактирование JSON/YAML конфигов прямо в продукте.
|
|
10
|
+
- Inline-редакторы с подсветкой синтаксиса.
|
|
11
|
+
- Просмотр логов/манифестов с кнопкой копирования всего содержимого.
|
|
12
|
+
|
|
13
|
+
Когда **не** нужен `CodeEditor`:
|
|
14
|
+
|
|
15
|
+
- Большие IDE-сценарии (мульти-файлы, расширения, дебаггер):
|
|
16
|
+
- используйте полноценный monaco-host или web-IDE.
|
|
17
|
+
- Однострочный ввод без подсветки:
|
|
18
|
+
- используйте `Input` / `Textarea` из соответствующих пакетов.
|
|
19
|
+
|
|
20
|
+
## Анатомия
|
|
21
|
+
|
|
22
|
+
### Header (no default, опускается ⇒ скрыта)
|
|
23
|
+
|
|
24
|
+
`hasHeader` не имеет явного дефолта в API; если не передан — шапка не рендерится. Включение шапки добавляет:
|
|
25
|
+
|
|
26
|
+
- Имя языка (`language`), отформатированное с заглавной буквы.
|
|
27
|
+
- Кнопку копирования — копирует текущее значение `value` в clipboard и вызывает `onCopyClick`.
|
|
28
|
+
|
|
29
|
+
### Background (default `true`)
|
|
30
|
+
|
|
31
|
+
- `true` — поверх monaco-области рисуется лёгкий полупрозрачный фон, чтобы редактор не сливался с поверхностью.
|
|
32
|
+
- `false` — режим встраивания в карточки / модалки с собственным фоном.
|
|
33
|
+
|
|
34
|
+
### Language
|
|
35
|
+
|
|
36
|
+
Любое значение, поддерживаемое monaco (`json`, `yaml`, `typescript`, `javascript`, `markdown`, `shell`, …). Для `json` и `yaml` дополнительно поддерживается `jsonSchema` — конфигурация диагностики и автокомплитов через JSON-Schema.
|
|
37
|
+
|
|
38
|
+
### Loading
|
|
39
|
+
|
|
40
|
+
- `loading={true}` — поверх редактора рендерится `<Spinner />`, само Monaco-поле скрыто. Использовать, когда контент ещё загружается из API.
|
|
41
|
+
- `loading={<CustomNode />}` — подменяет дефолтный `<Spinner />` на время инициализации monaco-бандла.
|
|
42
|
+
|
|
43
|
+
### Row numbers (default `true`)
|
|
44
|
+
|
|
45
|
+
`showRowNumber={false}` скрывает колонку с номерами строк (mapping на monaco-опции `lineNumbers: 'off'`, `lineDecorationsWidth: 0`, `lineNumbersMinChars: 0`).
|
|
46
|
+
|
|
47
|
+
## Установка
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm add @cloud-ru/ds-code-editor
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { CodeEditor, LazyCodeEditor, AsyncCodeEditor } from '@cloud-ru/ds-code-editor'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Props
|
|
58
|
+
|
|
59
|
+
**CodeEditorProps**
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Default | Description |
|
|
62
|
+
|------|------|---------|-------------|
|
|
63
|
+
| `background` | `boolean` | — | Включение/отключение псевдобекграунда. |
|
|
64
|
+
| `beforeMount` | `BeforeMount` | — | Signature: function(monaco: Monaco) => void <br/> An event is emitted before the editor is mounted <br/> It gets the monaco instance as a first argument <br/> Defaults to "noop" |
|
|
65
|
+
| `className` | `string` | — | Class name for the editor container |
|
|
66
|
+
| `data-test-id` | `string` | — | |
|
|
67
|
+
| `defaultLanguage` | `string` | — | Default language of the current model |
|
|
68
|
+
| `defaultPath` | `string` | — | Default path of the current model <br/> Will be passed as the third argument to `.createModel` method <br/> `monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))` |
|
|
69
|
+
| `defaultValue` | `string` | — | Default value of the current model |
|
|
70
|
+
| `hasHeader` | `boolean` | — | Включение/отключение шапки. |
|
|
71
|
+
| `height` | `string \| number` | `100%` | Height of the editor wrapper |
|
|
72
|
+
| `jsonSchema` | `JsonSchema` | — | Конфигурация JSON-Schema, по которой monaco валидирует контент. |
|
|
73
|
+
| `keepCurrentModel` | `boolean` | `false` | Indicator whether to dispose the current model when the Editor is unmounted or not |
|
|
74
|
+
| `language` | `string` | — | Language of the current model <br/> Язык контента редактора. Schema-режим работает только для `json` и `yaml`. |
|
|
75
|
+
| `line` | `number` | — | The line to jump on it |
|
|
76
|
+
| `loading` | `ReactNode` | `Loading...` | The loading screen before the editor will be mounted |
|
|
77
|
+
| `onChange` | `OnChange` | — | Signature: function(value: string \| undefined, ev: monaco.editor.IModelContentChangedEvent) => void <br/> An event is emitted when the content of the current model is changed |
|
|
78
|
+
| `onCopyClick` | `(() => void)` | — | Клик по кнопке копирования. |
|
|
79
|
+
| `onMount` | `OnMount` | — | Signature: function(editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) => void <br/> An event is emitted when the editor is mounted <br/> It gets the editor instance as a first argument and the monaco instance as a second <br/> Defaults to "noop" |
|
|
80
|
+
| `onValidate` | `OnValidate` | — | Signature: function(markers: monaco.editor.IMarker[]) => void <br/> An event is emitted when the content of the current model is changed <br/> and the current model markers are ready <br/> Defaults to "noop" |
|
|
81
|
+
| `options` | `IStandaloneEditorConstructionOptions` | — | IStandaloneEditorConstructionOptions |
|
|
82
|
+
| `overrideServices` | `IEditorOverrideServices` | — | IEditorOverrideServices |
|
|
83
|
+
| `path` | `string` | — | Path of the current model <br/> Will be passed as the third argument to `.createModel` method <br/> `monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))` <br/> В schema-режиме путь модели управляется внутренне (нужен стабильный `path`, <br/> совпадающий с `fileMatch`), снаружи задать его нельзя. `never` запрещает <br/> передачу `path` на уровне типа — попытка приводит к compile-time ошибке. |
|
|
84
|
+
| `saveViewState` | `boolean` | — | Indicator whether to save the models' view states between model changes or not <br/> Defaults to true |
|
|
85
|
+
| `showRowNumber` | `boolean` | — | Включение/отключение колонки с номерами строк. |
|
|
86
|
+
| `theme` | `string` | — | Имя зарегистрированной monaco-темы из глобального реестра <br/> (`monaco.editor.defineTheme(name, …)`). По умолчанию подбирается <br/> автоматически по DS-теме провайдера: `'snack'` для светлой, `'snackDark'` <br/> для тёмной. Передавай вручную только если регистрируешь свою кастомную <br/> тему — иначе оставляй `undefined`. |
|
|
87
|
+
| `themeName` | `string` | — | Используется как trigger в effect deps для перепересчёта theme tokens при смене темы. Уникальное значение на каждую тему. |
|
|
88
|
+
| `value` | `string` | — | Value of the current model |
|
|
89
|
+
| `width` | `string \| number` | `100%` | Width of the editor wrapper |
|
|
90
|
+
| `wrapperProps` | `object` | — | Props applied to the wrapper element |
|
|
91
|
+
|
|
92
|
+
#### Related types
|
|
93
|
+
|
|
94
|
+
**JsonSchema**
|
|
95
|
+
|
|
96
|
+
| Prop | Type | Default | Description |
|
|
97
|
+
|------|------|---------|-------------|
|
|
98
|
+
| `fileMatch` | `string` | — | Паттерн match'а пути модели, к которой применяется схема. |
|
|
99
|
+
| `schema` | `JSONSchema` | — | Тело JSON-Schema. |
|
|
100
|
+
| `uri` | `string \| undefined` | — | Идентификатор схемы. Если не задан — генерится автоматически. |
|
|
101
|
+
|
|
102
|
+
## Микрофронтовая интеграция
|
|
103
|
+
|
|
104
|
+
`monaco-editor` — крупный бандл (~3-5 MB после tree-shaking). В микрофронтовой архитектуре он должен грузиться **один раз** на уровне хост-приложения (хоста микрофронтов) и переиспользоваться всеми routed-MFE, иначе каждый микрофронт тянет свою копию.
|
|
105
|
+
|
|
106
|
+
Контракт реализован через глобальный реестр на `window['__snack-monaco-editor-loader__']`: хост регистрирует loader один раз, все MFE переиспользуют его без своей копии бандла.
|
|
107
|
+
|
|
108
|
+
### Хост — однократная регистрация loader'а
|
|
109
|
+
|
|
110
|
+
В корневой конфигурации хоста (single-spa root-config / Module Federation host; вызывается до маунта любого MFE):
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
export function initCodeEditorConfig() {
|
|
114
|
+
if (typeof window === 'undefined') return
|
|
115
|
+
window['__snack-monaco-editor-loader__'] = {
|
|
116
|
+
loadMonaco: () => import('monaco-editor').then(m => m.default),
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Хост содержит `monaco-editor` в собственных `dependencies` и в `monaco-editor-webpack-plugin` / Vite chunk-конфиге; MFE — **не должны его содержать**. Динамический `import('monaco-editor')` даёт отдельный chunk, который грузится только при первом обращении к `loadMonaco()`.
|
|
122
|
+
|
|
123
|
+
### MFE — потребитель
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { LazyCodeEditor } from '@cloud-ru/ds-code-editor'
|
|
127
|
+
|
|
128
|
+
export function ManifestPanel({ manifest }: { manifest: string }) {
|
|
129
|
+
return <LazyCodeEditor height='100%' value={manifest} language='json' options={{ readOnly: true }} />
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`LazyCodeEditor` сам:
|
|
134
|
+
|
|
135
|
+
- Внутри `Suspense` происходит lazy loading `AsyncCodeEditor`-фабрики.
|
|
136
|
+
- В фабрике вызывает `loadMonacoEditor()` — читает `window['__snack-monaco-editor-loader__']`.
|
|
137
|
+
- Если ключа нет (например, MFE отрендерился в standalone-режиме вне хоста) — fallback на дефолтный loader `@monaco-editor/react`, который тянет бандл с jsDelivr CDN.
|
|
138
|
+
|
|
139
|
+
Если нужен собственный `Suspense` (например, общий лоадер MFE), используй `AsyncCodeEditor` напрямую:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { Suspense, lazy } from 'react'
|
|
143
|
+
import { AsyncCodeEditor } from '@cloud-ru/ds-code-editor'
|
|
144
|
+
|
|
145
|
+
const CodeEditor = lazy(() => AsyncCodeEditor())
|
|
146
|
+
|
|
147
|
+
export function MyMfe() {
|
|
148
|
+
return (
|
|
149
|
+
<Suspense fallback={<MfeSpinner />}>
|
|
150
|
+
<CodeEditor language='json' value='' />
|
|
151
|
+
</Suspense>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Prefetch — `preloadMonacoEditor()`
|
|
157
|
+
|
|
158
|
+
Если заранее известно, что пользователь перейдёт к редактору (например, по клику в навигации) — предзагрузи бандл, чтобы Suspense-фолбэк не появлялся:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
import { preloadMonacoEditor } from '@cloud-ru/ds-code-editor'
|
|
162
|
+
|
|
163
|
+
linkRef.current?.addEventListener('mouseenter', () => preloadMonacoEditor(), { once: true })
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Если хост ещё не зарегистрировал loader (`__snack-monaco-editor-loader__` отсутствует), `preloadMonacoEditor()` возвращает `null` — без ошибок.
|
|
167
|
+
|
|
168
|
+
### SSR
|
|
169
|
+
|
|
170
|
+
`loadMonacoEditor` и `preloadMonacoEditor` имеют SSR-guard и в Node-окружении возвращают `null`. Сам `CodeEditor` / `LazyCodeEditor` под SSR не рендерится: `monaco-editor` обращается к `window` и `document.fonts` на module-init. В документации (Astro) demo-примеры монтируются через `client:only='react'` — в продуктовом SPA это не проблема, но при SSR-фреймворке (Next, Remix) оборачивай редактор в `dynamic({ ssr: false })`/аналог.
|
|
171
|
+
|
|
172
|
+
### Self-hosted vs CDN
|
|
173
|
+
|
|
174
|
+
| Сценарий | Что делать |
|
|
175
|
+
|----------|------------|
|
|
176
|
+
| Хост + MFE | Зарегистрируй loader в хосте — `import('monaco-editor')`. MFE использует `LazyCodeEditor`. Один бандл на все MFE. |
|
|
177
|
+
| Standalone-приложение (без хоста) | Можешь либо зарегистрировать тот же loader локально, либо не делать ничего — `@monaco-editor/react` стянет бандл с jsDelivr CDN. Для продакшена предпочтительно self-hosted (offline, контроль версий, CSP). |
|
|
178
|
+
| Прямой `CodeEditor` (не Lazy/Async) | Использует дефолтный loader `@monaco-editor/react` (CDN). Lazy/Async-варианты — единственный способ self-host'а через `__snack-monaco-editor-loader__`. |
|
|
179
|
+
|
|
180
|
+
### 1. JSON
|
|
181
|
+
|
|
182
|
+
Базовый сценарий: json-редактор без шапки
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
import { CodeEditor } from '@cloud-ru/ds-code-editor';
|
|
186
|
+
import { useState } from 'react';
|
|
187
|
+
|
|
188
|
+
const INITIAL = `{
|
|
189
|
+
"name": "@cloud-ru/ds-code-editor",
|
|
190
|
+
"version": "0.0.0",
|
|
191
|
+
"language": "json"
|
|
192
|
+
}
|
|
193
|
+
`;
|
|
194
|
+
|
|
195
|
+
export function Json() {
|
|
196
|
+
const [value, setValue] = useState(INITIAL);
|
|
197
|
+
|
|
198
|
+
return <CodeEditor language='json' value={value} height={220} onChange={v => setValue(v ?? '')} />;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 2. YAML
|
|
203
|
+
|
|
204
|
+
YAML с включённой шапкой и кнопкой копирования
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
import { CodeEditor } from '@cloud-ru/ds-code-editor';
|
|
208
|
+
import { useState } from 'react';
|
|
209
|
+
|
|
210
|
+
const INITIAL = `name: '@cloud-ru/ds-code-editor'
|
|
211
|
+
version: 0.0.0
|
|
212
|
+
language: yaml
|
|
213
|
+
`;
|
|
214
|
+
|
|
215
|
+
export function Yaml() {
|
|
216
|
+
const [value, setValue] = useState(INITIAL);
|
|
217
|
+
|
|
218
|
+
return <CodeEditor language='yaml' value={value} hasHeader height={220} onChange={v => setValue(v ?? '')} />;
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 3. С шапкой и onCopyClick
|
|
223
|
+
|
|
224
|
+
hasHeader + onCopyClick — продуктовая обвязка
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { CodeEditor } from '@cloud-ru/ds-code-editor';
|
|
228
|
+
import { useState } from 'react';
|
|
229
|
+
|
|
230
|
+
const INITIAL = `{
|
|
231
|
+
"copy": "me"
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
|
|
235
|
+
export function WithHeader() {
|
|
236
|
+
const [value, setValue] = useState(INITIAL);
|
|
237
|
+
const [copiedAt, setCopiedAt] = useState<string | null>(null);
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
241
|
+
<CodeEditor
|
|
242
|
+
language='json'
|
|
243
|
+
value={value}
|
|
244
|
+
hasHeader
|
|
245
|
+
height={200}
|
|
246
|
+
onChange={v => setValue(v ?? '')}
|
|
247
|
+
onCopyClick={() => setCopiedAt(new Date().toLocaleTimeString())}
|
|
248
|
+
/>
|
|
249
|
+
<span>Last copy: {copiedAt ?? '—'}</span>
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 4. Без фона
|
|
256
|
+
|
|
257
|
+
background=false — для встраивания в карточки с собственным фоном
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
import { CodeEditor } from '@cloud-ru/ds-code-editor';
|
|
261
|
+
import { useState } from 'react';
|
|
262
|
+
|
|
263
|
+
import styles from './NoBackground.module.scss';
|
|
264
|
+
|
|
265
|
+
const INITIAL = `// transparent background, embedded into a card
|
|
266
|
+
const config = { mode: 'inline' }
|
|
267
|
+
`;
|
|
268
|
+
|
|
269
|
+
export function NoBackground() {
|
|
270
|
+
const [value, setValue] = useState(INITIAL);
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<div className={styles.surface}>
|
|
274
|
+
<CodeEditor
|
|
275
|
+
language='javascript'
|
|
276
|
+
value={value}
|
|
277
|
+
background={false}
|
|
278
|
+
height={220}
|
|
279
|
+
onChange={v => setValue(v ?? '')}
|
|
280
|
+
/>
|
|
281
|
+
</div>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### 5. Lazy-загрузка
|
|
287
|
+
|
|
288
|
+
LazyCodeEditor — Suspense + lazy-chunk с monaco-бандлом
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { LazyCodeEditor } from '@cloud-ru/ds-code-editor';
|
|
292
|
+
import { useState } from 'react';
|
|
293
|
+
|
|
294
|
+
const INITIAL = `{
|
|
295
|
+
"loaded": "lazily"
|
|
296
|
+
}
|
|
297
|
+
`;
|
|
298
|
+
|
|
299
|
+
export function LazyLoaded() {
|
|
300
|
+
const [value, setValue] = useState(INITIAL);
|
|
301
|
+
|
|
302
|
+
return <LazyCodeEditor language='json' value={value} hasHeader height={220} onChange={v => setValue(v ?? '')} />;
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## LazyCodeEditor
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
import { LazyCodeEditor } from '@cloud-ru/ds-code-editor';
|
|
310
|
+
import { useState } from 'react';
|
|
311
|
+
|
|
312
|
+
const INITIAL = `{
|
|
313
|
+
"loaded": "lazily"
|
|
314
|
+
}
|
|
315
|
+
`;
|
|
316
|
+
|
|
317
|
+
export function LazyLoaded() {
|
|
318
|
+
const [value, setValue] = useState(INITIAL);
|
|
319
|
+
|
|
320
|
+
return <LazyCodeEditor language='json' value={value} hasHeader height={220} onChange={v => setValue(v ?? '')} />;
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Props `LazyCodeEditorProps`
|
|
325
|
+
|
|
326
|
+
| Prop | Type | Default | Description |
|
|
327
|
+
|------|------|---------|-------------|
|
|
328
|
+
| `background` | `boolean` | — | Включение/отключение псевдобекграунда. |
|
|
329
|
+
| `beforeMount` | `BeforeMount` | — | Signature: function(monaco: Monaco) => void <br/> An event is emitted before the editor is mounted <br/> It gets the monaco instance as a first argument <br/> Defaults to "noop" |
|
|
330
|
+
| `className` | `string` | — | Class name for the editor container |
|
|
331
|
+
| `data-test-id` | `string` | — | |
|
|
332
|
+
| `defaultLanguage` | `string` | — | Default language of the current model |
|
|
333
|
+
| `defaultPath` | `string` | — | Default path of the current model <br/> Will be passed as the third argument to `.createModel` method <br/> `monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))` |
|
|
334
|
+
| `defaultValue` | `string` | — | Default value of the current model |
|
|
335
|
+
| `hasHeader` | `boolean` | — | Включение/отключение шапки. |
|
|
336
|
+
| `height` | `string \| number` | `100%` | Height of the editor wrapper |
|
|
337
|
+
| `jsonSchema` | `JsonSchema` | — | Конфигурация JSON-Schema, по которой monaco валидирует контент. |
|
|
338
|
+
| `keepCurrentModel` | `boolean` | `false` | Indicator whether to dispose the current model when the Editor is unmounted or not |
|
|
339
|
+
| `language` | `string` | — | Language of the current model <br/> Язык контента редактора. Schema-режим работает только для `json` и `yaml`. |
|
|
340
|
+
| `line` | `number` | — | The line to jump on it |
|
|
341
|
+
| `loading` | `ReactNode` | `Loading...` | The loading screen before the editor will be mounted |
|
|
342
|
+
| `onChange` | `OnChange` | — | Signature: function(value: string \| undefined, ev: monaco.editor.IModelContentChangedEvent) => void <br/> An event is emitted when the content of the current model is changed |
|
|
343
|
+
| `onCopyClick` | `(() => void)` | — | Клик по кнопке копирования. |
|
|
344
|
+
| `onMount` | `OnMount` | — | Signature: function(editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) => void <br/> An event is emitted when the editor is mounted <br/> It gets the editor instance as a first argument and the monaco instance as a second <br/> Defaults to "noop" |
|
|
345
|
+
| `onValidate` | `OnValidate` | — | Signature: function(markers: monaco.editor.IMarker[]) => void <br/> An event is emitted when the content of the current model is changed <br/> and the current model markers are ready <br/> Defaults to "noop" |
|
|
346
|
+
| `options` | `IStandaloneEditorConstructionOptions` | — | IStandaloneEditorConstructionOptions |
|
|
347
|
+
| `overrideServices` | `IEditorOverrideServices` | — | IEditorOverrideServices |
|
|
348
|
+
| `path` | `string` | — | Path of the current model <br/> Will be passed as the third argument to `.createModel` method <br/> `monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))` <br/> В schema-режиме путь модели управляется внутренне (нужен стабильный `path`, <br/> совпадающий с `fileMatch`), снаружи задать его нельзя. `never` запрещает <br/> передачу `path` на уровне типа — попытка приводит к compile-time ошибке. |
|
|
349
|
+
| `saveViewState` | `boolean` | — | Indicator whether to save the models' view states between model changes or not <br/> Defaults to true |
|
|
350
|
+
| `showRowNumber` | `boolean` | — | Включение/отключение колонки с номерами строк. |
|
|
351
|
+
| `theme` | `string` | — | Имя зарегистрированной monaco-темы из глобального реестра <br/> (`monaco.editor.defineTheme(name, …)`). По умолчанию подбирается <br/> автоматически по DS-теме провайдера: `'snack'` для светлой, `'snackDark'` <br/> для тёмной. Передавай вручную только если регистрируешь свою кастомную <br/> тему — иначе оставляй `undefined`. |
|
|
352
|
+
| `themeName` | `string` | — | Используется как trigger в effect deps для перепересчёта theme tokens при смене темы. Уникальное значение на каждую тему. |
|
|
353
|
+
| `value` | `string` | — | Value of the current model |
|
|
354
|
+
| `width` | `string \| number` | `100%` | Width of the editor wrapper |
|
|
355
|
+
| `wrapperProps` | `object` | — | Props applied to the wrapper element |
|
|
356
|
+
|
|
357
|
+
#### Related types
|
|
358
|
+
|
|
359
|
+
**JsonSchema**
|
|
360
|
+
|
|
361
|
+
| Prop | Type | Default | Description |
|
|
362
|
+
|------|------|---------|-------------|
|
|
363
|
+
| `fileMatch` | `string` | — | Паттерн match'а пути модели, к которой применяется схема. |
|
|
364
|
+
| `schema` | `JSONSchema` | — | Тело JSON-Schema. |
|
|
365
|
+
| `uri` | `string \| undefined` | — | Идентификатор схемы. Если не задан — генерится автоматически. |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { CodeEditorProps } from '../CodeEditor';
|
|
3
|
+
/**
|
|
4
|
+
* `CodeEditor` с предзагруженным `monaco-editor`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { Suspense, lazy } from 'react'
|
|
9
|
+
* import { AsyncCodeEditor } from '@cloud-ru/ds-code-editor'
|
|
10
|
+
*
|
|
11
|
+
* const Editor = lazy(() => AsyncCodeEditor())
|
|
12
|
+
*
|
|
13
|
+
* const MyComponent = () => (
|
|
14
|
+
* <Suspense fallback='loading...'>
|
|
15
|
+
* <Editor language='json' value='' />
|
|
16
|
+
* </Suspense>
|
|
17
|
+
* )
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const AsyncCodeEditor: () => Promise<{
|
|
21
|
+
default: ComponentType<CodeEditorProps>;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncCodeEditor = void 0;
|
|
4
|
+
const loader_1 = require("../../loader");
|
|
5
|
+
const withMonaco_1 = require("../../withMonaco");
|
|
6
|
+
/**
|
|
7
|
+
* `CodeEditor` с предзагруженным `monaco-editor`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Suspense, lazy } from 'react'
|
|
12
|
+
* import { AsyncCodeEditor } from '@cloud-ru/ds-code-editor'
|
|
13
|
+
*
|
|
14
|
+
* const Editor = lazy(() => AsyncCodeEditor())
|
|
15
|
+
*
|
|
16
|
+
* const MyComponent = () => (
|
|
17
|
+
* <Suspense fallback='loading...'>
|
|
18
|
+
* <Editor language='json' value='' />
|
|
19
|
+
* </Suspense>
|
|
20
|
+
* )
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
const AsyncCodeEditor = async () => {
|
|
24
|
+
const monaco = await (0, loader_1.loadMonacoEditor)();
|
|
25
|
+
// loadMonacoEditor возвращает `unknown` от внешнего loader'а; минимально
|
|
26
|
+
// проверяем, что это объект с editor namespace'ом, иначе откатываемся
|
|
27
|
+
// на дефолтный CDN-loader (@monaco-editor/react).
|
|
28
|
+
if (monaco && typeof monaco === 'object' && 'editor' in monaco) {
|
|
29
|
+
return { default: (0, withMonaco_1.withMonaco)(monaco).CodeEditor };
|
|
30
|
+
}
|
|
31
|
+
return { default: (0, withMonaco_1.withMonaco)().CodeEditor };
|
|
32
|
+
};
|
|
33
|
+
exports.AsyncCodeEditor = AsyncCodeEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AsyncCodeEditor';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AsyncCodeEditor"), exports);
|