@operato/scene-i18n 9.0.0-beta.9 → 9.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/dist/label.js +8 -4
- package/dist/label.js.map +1 -1
- package/package.json +5 -5
package/dist/label.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
1
2
|
import i18next from 'i18next';
|
|
2
|
-
import {
|
|
3
|
+
import { RectPath, Shape, sceneComponent } from '@hatiolab/things-scene';
|
|
3
4
|
const NATURE = {
|
|
4
5
|
mutable: false,
|
|
5
6
|
resizable: true,
|
|
@@ -24,7 +25,7 @@ const NATURE = {
|
|
|
24
25
|
'value-property': 'key',
|
|
25
26
|
help: 'scene/component/label'
|
|
26
27
|
};
|
|
27
|
-
|
|
28
|
+
let Label = class Label extends RectPath(Shape) {
|
|
28
29
|
get nature() {
|
|
29
30
|
return NATURE;
|
|
30
31
|
}
|
|
@@ -36,6 +37,9 @@ export default class Label extends RectPath(Shape) {
|
|
|
36
37
|
const language = i18next.language;
|
|
37
38
|
return terms[language] || terms[language.substr(0, 2)] || (key && i18next.t(key)) || fallback;
|
|
38
39
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
40
|
+
};
|
|
41
|
+
Label = __decorate([
|
|
42
|
+
sceneComponent('label')
|
|
43
|
+
], Label);
|
|
44
|
+
export default Label;
|
|
41
45
|
//# sourceMappingURL=label.js.map
|
package/dist/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../src/label.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../src/label.ts"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAA8B,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEpG,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;SACd;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,KAAK;SACZ;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,UAAU;SACjB;KACF;IACD,gBAAgB,EAAE,KAAK;IACvB,IAAI,EAAE,uBAAuB;CAC9B,CAAA;AAGc,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,QAAQ,CAAC,KAAK,CAAC;IAChD,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,IAAI;QACN,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEhD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAA;IAC/F,CAAC;CACF,CAAA;AAfoB,KAAK;IADzB,cAAc,CAAC,OAAO,CAAC;GACH,KAAK,CAezB;eAfoB,KAAK","sourcesContent":["import i18next from 'i18next'\n\nimport { Component, ComponentNature, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'i18n',\n label: 'terms',\n name: 'terms'\n },\n {\n type: 'string',\n label: 'i18n-key',\n name: 'key'\n },\n {\n type: 'string',\n label: 'fallback',\n name: 'fallback'\n }\n ],\n 'value-property': 'key',\n help: 'scene/component/label'\n}\n\n@sceneComponent('label')\nexport default class Label extends RectPath(Shape) {\n get nature() {\n return NATURE\n }\n\n is3dish() {\n return true\n }\n\n get text() {\n const { key, terms = {}, fallback } = this.state\n\n const language = i18next.language\n return terms[language] || terms[language.substr(0, 2)] || (key && i18next.t(key)) || fallback\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/scene-i18n",
|
|
3
3
|
"description": "i18n component for things-scene",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "9.0.0
|
|
5
|
+
"version": "9.0.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"migration": "things-factory-migration"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@hatiolab/things-scene": "^9.0.0
|
|
32
|
-
"@operato/property-editor": "^9.0.0
|
|
33
|
-
"i18next": "^
|
|
31
|
+
"@hatiolab/things-scene": "^9.0.0",
|
|
32
|
+
"@operato/property-editor": "^9.0.0",
|
|
33
|
+
"i18next": "^24.2.1",
|
|
34
34
|
"lit": "^3.1.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"prettier --write"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "0c295810b93773e6373f96d69fe62e930d71c0cd"
|
|
65
65
|
}
|