@operato/scene-i18n 10.0.0-beta.4 → 10.0.0-beta.65
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 +29 -9
- package/dist/label.d.ts +42 -38
- package/dist/label.js +0 -3
- package/dist/label.js.map +1 -1
- package/dist/templates/label.js +1 -1
- package/dist/templates/label.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
# @operato/scene-i18n
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> i18n component for things-scene
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
| ---- | ------------------------------------------ | -------------- | ------ |
|
|
7
|
-
| UMD | things-scene-scene-i18n.js | modern browser | O |
|
|
8
|
-
| UMD | things-scene-scene-i18n-ie.js | ie 11 | O |
|
|
9
|
-
| ESM | things-scene-scene-i18n.mjs | modern browser | O |
|
|
5
|
+
<!-- AUTOGEN_BEGIN: do not edit between markers (run scripts/regenerate-readmes.mjs to update) -->
|
|
10
6
|
|
|
11
|
-
##
|
|
7
|
+
## Components
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
- `Label`
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @operato/scene-i18n
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Label } from '@operato/scene-i18n'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Build
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Output: ESM module at `dist/index.js` (single bundle, no UMD/IE legacy).
|
|
30
|
+
|
|
31
|
+
_Version: 10.0.0-beta.14_
|
|
32
|
+
|
|
33
|
+
<!-- AUTOGEN_END -->
|
package/dist/label.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const Label_base: (new (...args: any[]) => {
|
|
3
3
|
contains(x: number, y: number): boolean;
|
|
4
4
|
get path(): {
|
|
@@ -49,7 +49,7 @@ declare const Label_base: (new (...args: any[]) => {
|
|
|
49
49
|
get disposed(): boolean;
|
|
50
50
|
isLayer(): boolean;
|
|
51
51
|
isGroup(): boolean;
|
|
52
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
52
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
53
53
|
isLine(): boolean;
|
|
54
54
|
isRoot(): boolean;
|
|
55
55
|
isRootModel(): boolean;
|
|
@@ -65,9 +65,10 @@ declare const Label_base: (new (...args: any[]) => {
|
|
|
65
65
|
get(property: any): any;
|
|
66
66
|
set(props: any, propval?: any): any;
|
|
67
67
|
getState(property: any): any;
|
|
68
|
-
setState(props:
|
|
68
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
69
69
|
get model(): any;
|
|
70
|
-
get state():
|
|
70
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
71
|
+
get refid(): any;
|
|
71
72
|
get hierarchy(): any;
|
|
72
73
|
get volatile(): never[];
|
|
73
74
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -103,7 +104,7 @@ declare const Label_base: (new (...args: any[]) => {
|
|
|
103
104
|
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
104
105
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
105
106
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
106
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
107
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
107
108
|
prepareIf(condition: boolean): void;
|
|
108
109
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
109
110
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -154,16 +155,16 @@ declare const Label_base: (new (...args: any[]) => {
|
|
|
154
155
|
get started(): boolean;
|
|
155
156
|
set started(v: boolean): any;
|
|
156
157
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
157
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
158
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
159
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
158
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
159
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
160
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
160
161
|
findAnchor(name: string): any;
|
|
161
|
-
isDescendible(container: Component): boolean;
|
|
162
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
162
163
|
getContext(component?: unknown): any;
|
|
163
|
-
get root(): Component;
|
|
164
|
-
get rootModel(): Component;
|
|
165
|
-
get parent(): Component;
|
|
166
|
-
set parent(v: Component): any;
|
|
164
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
165
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
166
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
167
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
167
168
|
get scalable(): boolean;
|
|
168
169
|
get stuck(): boolean;
|
|
169
170
|
get capturable(): boolean;
|
|
@@ -188,47 +189,51 @@ declare const Label_base: (new (...args: any[]) => {
|
|
|
188
189
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
189
190
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
190
191
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
194
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
194
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
199
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
199
200
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
200
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
201
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
202
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
203
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
204
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
201
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
202
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
203
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
204
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
205
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
206
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
205
207
|
on(name: string | object, callback: Function, context?: any): any;
|
|
208
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
206
209
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
210
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
207
211
|
once(name: string | object, callback: Function, context?: any): any;
|
|
212
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
208
213
|
trigger(name: string, ...args: any[]): any;
|
|
209
214
|
delegate_on(delegator: any): any;
|
|
210
215
|
delegate_off(delegator: any): any;
|
|
211
216
|
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
212
217
|
calculateBounds?(): void;
|
|
213
218
|
oncreate_element?(element: HTMLElement): void;
|
|
214
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
215
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
216
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
217
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
218
|
-
findById(id: string): Component | undefined;
|
|
219
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
220
|
-
findAllById(id: string): Component[];
|
|
219
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
220
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
221
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
222
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
223
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
224
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
225
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
221
226
|
resize(): void;
|
|
222
227
|
fit(type?: string): void;
|
|
223
|
-
get components(): Component[] | undefined;
|
|
228
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
224
229
|
get layout(): any;
|
|
225
230
|
get auxOverlay(): HTMLElement | undefined;
|
|
226
231
|
get isReady(): boolean;
|
|
227
232
|
get unitScale(): number;
|
|
228
|
-
get selected(): Component[];
|
|
229
|
-
set selected(_v: Component[]): any;
|
|
230
|
-
get focused(): Component | null;
|
|
231
|
-
set focused(_v: Component | null): any;
|
|
233
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
234
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
235
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
236
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
232
237
|
get hasSameParentForAllSelected(): boolean;
|
|
233
238
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
234
239
|
get fitMode(): string | undefined;
|
|
@@ -238,7 +243,6 @@ declare const Label_base: (new (...args: any[]) => {
|
|
|
238
243
|
}) & typeof Shape;
|
|
239
244
|
export default class Label extends Label_base {
|
|
240
245
|
get nature(): ComponentNature;
|
|
241
|
-
is3dish(): boolean;
|
|
242
246
|
get text(): any;
|
|
243
247
|
}
|
|
244
248
|
export {};
|
package/dist/label.js
CHANGED
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,EAAmB,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEzF,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;IACD,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;AAVoB,KAAK;IADzB,cAAc,CAAC,OAAO,CAAC;GACH,KAAK,CAUzB;eAVoB,KAAK","sourcesContent":["import i18next from 'i18next'\n\nimport { 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 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/dist/templates/label.js
CHANGED
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
3
|
type: 'label',
|
|
4
4
|
description: 'label',
|
|
5
5
|
group: 'textAndMedia',
|
|
6
|
-
/* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|
|
|
6
|
+
/* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|3D|facility|storage|conveyance|transport|form|etc */
|
|
7
7
|
icon,
|
|
8
8
|
model: {
|
|
9
9
|
type: 'label',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/templates/label.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEzE,eAAe;IACb,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,OAAO;IACpB,KAAK,EAAE,cAAc;IACrB,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/templates/label.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEzE,eAAe;IACb,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,OAAO;IACpB,KAAK,EAAE,cAAc;IACrB,wHAAwH;IACxH,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,OAAO;KACrB;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/scene-label.png', import.meta.url).href\n\nexport default {\n type: 'label',\n description: 'label',\n group: 'textAndMedia',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|3D|facility|storage|conveyance|transport|form|etc */\n icon,\n model: {\n type: 'label',\n left: 10,\n top: 10,\n width: 100,\n height: 20,\n strokeStyle: 'black'\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": "10.0.0-beta.
|
|
5
|
+
"version": "10.0.0-beta.65",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
38
|
-
"@things-factory/builder": "^10.0.0-
|
|
39
|
-
"@things-factory/operato-board": "^10.0.0-
|
|
38
|
+
"@things-factory/builder": "^10.0.0-zeta.1",
|
|
39
|
+
"@things-factory/operato-board": "^10.0.0-zeta.1",
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
41
41
|
"@typescript-eslint/parser": "^8.0.0",
|
|
42
42
|
"@web/dev-server": "^0.1.28",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"prettier --write"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "99733bf39e2d279630d68844f19d9687272a4992"
|
|
65
65
|
}
|