@codenotch/codenotch.react 1.0.82 → 2.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/README.md +50 -12
- package/dist/components/CodeEditor.d.ts +1 -1
- package/dist/components/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeEditor.js +66 -64
- package/dist/index.d.ts +85 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -22
- package/dist/models/Codenotch.d.ts +20 -2
- package/dist/models/Codenotch.d.ts.map +1 -1
- package/package.json +46 -44
- package/src/components/CodeEditor.tsx +204 -203
- package/src/index.ts +531 -385
- package/src/models/Codenotch.ts +21 -2
- package/dist/components/Auml.d.ts +0 -46
- package/dist/components/Auml.d.ts.map +0 -1
- package/dist/components/Auml.js +0 -208
- package/dist/models/AppManifestModels.d.ts +0 -46
- package/dist/models/AppManifestModels.d.ts.map +0 -1
- package/dist/models/AppManifestModels.js +0 -2
- package/dist/models/ProjectManifestModels.d.ts +0 -126
- package/dist/models/ProjectManifestModels.d.ts.map +0 -1
- package/dist/models/ProjectManifestModels.js +0 -158
- package/dist/utils/I18nUtils.d.ts +0 -7
- package/dist/utils/I18nUtils.d.ts.map +0 -1
- package/dist/utils/I18nUtils.js +0 -37
package/dist/utils/I18nUtils.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class I18nUtils {
|
|
4
|
-
static compileAuml(auml, env) {
|
|
5
|
-
auml = this.injectI18n(auml, env);
|
|
6
|
-
return auml;
|
|
7
|
-
}
|
|
8
|
-
static revertI18n(i18n) {
|
|
9
|
-
let result = {};
|
|
10
|
-
for (let language in i18n) {
|
|
11
|
-
let translations = i18n[language];
|
|
12
|
-
for (let key in translations) {
|
|
13
|
-
if (!result[key]) {
|
|
14
|
-
result[key] = {};
|
|
15
|
-
}
|
|
16
|
-
result[key][language] = translations[key];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
static injectI18n(auml, env) {
|
|
22
|
-
let i18n = this.revertI18n(env.i18n ?? {});
|
|
23
|
-
if (Object.keys(i18n).length === 0) {
|
|
24
|
-
// No i18n variables, return original auml
|
|
25
|
-
return auml;
|
|
26
|
-
}
|
|
27
|
-
// Obtain the root tag of the file
|
|
28
|
-
let match = auml.match(/<([^!\r\n\t\f\v> ]+)/);
|
|
29
|
-
if (!match) {
|
|
30
|
-
return auml;
|
|
31
|
-
}
|
|
32
|
-
let rootTag = match[1];
|
|
33
|
-
auml = auml.replace(`</${rootTag}>`, `<${rootTag}.I18n><![CDATA[${JSON.stringify(i18n)}]]></${rootTag}.I18n></${rootTag}>`);
|
|
34
|
-
return auml;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.default = I18nUtils;
|