@operato/twin-figure-capabilities 0.0.0-stage → 0.5.3
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/entity.d.ts +59 -0
- package/dist/entity.js +101 -0
- package/dist/generate.d.ts +56 -0
- package/dist/generate.js +104 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +13 -0
- package/dist/mobile.d.ts +1 -0
- package/dist/mobile.js +19 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.js +16 -0
- package/dist/operable.d.ts +1 -0
- package/dist/operable.js +20 -0
- package/dist/storable.d.ts +30 -0
- package/dist/storable.js +49 -0
- package/dist/twin-capabilities.module.mjs +1472 -0
- package/dist/values.d.ts +16 -0
- package/dist/values.js +34 -0
- package/dist/words.d.ts +13 -0
- package/dist/words.js +42 -0
- package/package.json +43 -4
- package/README.md +0 -3
package/dist/values.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Words } from './words.ts';
|
|
2
|
+
/** State field → its closed list in the contract. A field missing here has no rows to fill. */
|
|
3
|
+
export declare const STATE_VALUE_LISTS: Readonly<Record<string, readonly string[]>>;
|
|
4
|
+
/** What a state field is called on the modeller's screen. */
|
|
5
|
+
export declare const STATE_FIELD_WORDS: Readonly<Record<string, Words>>;
|
|
6
|
+
/**
|
|
7
|
+
* The twin's colour for each listed value: the three its 2D cards have drawn (idle grey, busy green, down red), setup
|
|
8
|
+
* amber -- busy getting ready -- and planned stop blue -- stopped on purpose, which must not read as down or as waiting.
|
|
9
|
+
* A value outside the list is the pale default, apart from them all.
|
|
10
|
+
*/
|
|
11
|
+
export declare const VALUE_COLOURS: Readonly<Record<string, string>>;
|
|
12
|
+
export declare const DEFAULT_VALUE_COLOUR = "#d5dade";
|
|
13
|
+
/** The legend rows of a listed field: one per value in the contract's order, and the default. */
|
|
14
|
+
export declare function legendRowsOf(field: string): Record<string, {
|
|
15
|
+
color: string;
|
|
16
|
+
}>;
|
package/dist/values.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EQUIPMENT_STATUS } from '@operato/ops-contract';
|
|
2
|
+
/*
|
|
3
|
+
* The closed value lists the contract gives a state field, and the twin's colour for each value. A field with a list has
|
|
4
|
+
* a legend row per value from the start (ADR-0208 amendment 1 decision 15): an author only picks the parts that show it.
|
|
5
|
+
*/
|
|
6
|
+
/** State field → its closed list in the contract. A field missing here has no rows to fill. */
|
|
7
|
+
export const STATE_VALUE_LISTS = {
|
|
8
|
+
status: EQUIPMENT_STATUS
|
|
9
|
+
};
|
|
10
|
+
/** What a state field is called on the modeller's screen. */
|
|
11
|
+
export const STATE_FIELD_WORDS = {
|
|
12
|
+
status: { ko: '운영 상태', en: 'Operating status', ja: '運用状態', zh: '运行状态', es: 'Estado operativo', ms: 'Status operasi' }
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The twin's colour for each listed value: the three its 2D cards have drawn (idle grey, busy green, down red), setup
|
|
16
|
+
* amber -- busy getting ready -- and planned stop blue -- stopped on purpose, which must not read as down or as waiting.
|
|
17
|
+
* A value outside the list is the pale default, apart from them all.
|
|
18
|
+
*/
|
|
19
|
+
export const VALUE_COLOURS = {
|
|
20
|
+
busy: '#1a8f4c',
|
|
21
|
+
setup: '#d99a1c',
|
|
22
|
+
down: '#c93f30',
|
|
23
|
+
idle: '#8a959c',
|
|
24
|
+
'planned-stop': '#3b6fb6'
|
|
25
|
+
};
|
|
26
|
+
export const DEFAULT_VALUE_COLOUR = '#d5dade';
|
|
27
|
+
/** The legend rows of a listed field: one per value in the contract's order, and the default. */
|
|
28
|
+
export function legendRowsOf(field) {
|
|
29
|
+
const values = STATE_VALUE_LISTS[field] ?? [];
|
|
30
|
+
return {
|
|
31
|
+
...Object.fromEntries(values.map(value => [value, { color: VALUE_COLOURS[value] ?? DEFAULT_VALUE_COLOUR }])),
|
|
32
|
+
default: { color: DEFAULT_VALUE_COLOUR }
|
|
33
|
+
};
|
|
34
|
+
}
|
package/dist/words.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The languages the twin's screens are in; every word this module gives is given in each of them. */
|
|
2
|
+
export declare const TWIN_LANGUAGES: readonly ["ko", "en", "ja", "zh", "es", "ms"];
|
|
3
|
+
export type TwinLanguage = (typeof TWIN_LANGUAGES)[number];
|
|
4
|
+
/** Words a module gives the screen (ADR-0172 decision 7): one per language the twin's screens are in, chosen by the screen. */
|
|
5
|
+
export type Words = Readonly<Record<TwinLanguage, string>>;
|
|
6
|
+
/** A settings key the capability does not use. */
|
|
7
|
+
export declare const unusedSettingWords: (key: string) => Words;
|
|
8
|
+
/** A listed field with no part chosen to show it. */
|
|
9
|
+
export declare const noPartWords: (field: Words) => Words;
|
|
10
|
+
/** A part chosen that the figure does not have. */
|
|
11
|
+
export declare const missingPartWords: (part: string) => Words;
|
|
12
|
+
/** No entity type declared. */
|
|
13
|
+
export declare const NO_ENTITY_TYPE_WORDS: Words;
|
package/dist/words.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** The languages the twin's screens are in; every word this module gives is given in each of them. */
|
|
2
|
+
export const TWIN_LANGUAGES = ['ko', 'en', 'ja', 'zh', 'es', 'ms'];
|
|
3
|
+
/*
|
|
4
|
+
* Why a capability's settings cannot be taken -- the words a modeller reads under the setting. Each takes the names it
|
|
5
|
+
* speaks of as they are written (a settings key, a part name) or as words (a field).
|
|
6
|
+
*/
|
|
7
|
+
/** A settings key the capability does not use. */
|
|
8
|
+
export const unusedSettingWords = (key) => ({
|
|
9
|
+
ko: `${key}은(는) 이 능력에서 사용하지 않는 설정입니다. 삭제하세요.`,
|
|
10
|
+
en: `${key} is not a setting of this capability. Remove it.`,
|
|
11
|
+
ja: `${key} はこの機能では使わない設定です。削除してください。`,
|
|
12
|
+
zh: `${key} 不是此能力使用的设置。请删除。`,
|
|
13
|
+
es: `${key} no es un ajuste de esta capacidad. Elimínelo.`,
|
|
14
|
+
ms: `${key} bukan tetapan keupayaan ini. Padamkannya.`
|
|
15
|
+
});
|
|
16
|
+
/** A listed field with no part chosen to show it. */
|
|
17
|
+
export const noPartWords = (field) => ({
|
|
18
|
+
ko: `${field.ko}을(를) 표시할 부품을 하나 이상 선택하세요.`,
|
|
19
|
+
en: `Choose at least one part to show ${field.en.toLowerCase()}.`,
|
|
20
|
+
ja: `${field.ja}を表示する部品を一つ以上選んでください。`,
|
|
21
|
+
zh: `请至少选择一个显示${field.zh}的部件。`,
|
|
22
|
+
es: `Elija al menos una pieza que muestre ${field.es.toLowerCase()}.`,
|
|
23
|
+
ms: `Pilih sekurang-kurangnya satu bahagian untuk menunjukkan ${field.ms.toLowerCase()}.`
|
|
24
|
+
});
|
|
25
|
+
/** A part chosen that the figure does not have. */
|
|
26
|
+
export const missingPartWords = (part) => ({
|
|
27
|
+
ko: `${part} 부품이 이 피규어에 없습니다. 다른 부품을 선택하세요.`,
|
|
28
|
+
en: `This figure has no part ${part}. Choose another part.`,
|
|
29
|
+
ja: `この図形に部品 ${part} はありません。別の部品を選んでください。`,
|
|
30
|
+
zh: `此图形没有部件 ${part}。请选择其他部件。`,
|
|
31
|
+
es: `Esta figura no tiene la pieza ${part}. Elija otra pieza.`,
|
|
32
|
+
ms: `Figura ini tiada bahagian ${part}. Pilih bahagian lain.`
|
|
33
|
+
});
|
|
34
|
+
/** No entity type declared. */
|
|
35
|
+
export const NO_ENTITY_TYPE_WORDS = {
|
|
36
|
+
ko: '이 피규어가 나타내는 엔티티 종류를 하나 이상 선택하세요.',
|
|
37
|
+
en: 'Choose at least one entity type this figure draws.',
|
|
38
|
+
ja: 'この図形が表すエンティティの種類を一つ以上選んでください。',
|
|
39
|
+
zh: '请至少选择一个此图形表示的实体类型。',
|
|
40
|
+
es: 'Elija al menos un tipo de entidad que represente esta figura.',
|
|
41
|
+
ms: 'Pilih sekurang-kurangnya satu jenis entiti yang dilukis oleh figura ini.'
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/twin-figure-capabilities",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.3",
|
|
4
|
+
"description": "What the twin puts on a figure (ADR-0208): the descriptors of twin.Operable, twin.Storable and twin.Mobile, their pure functions and the twin's default status table, built from the ops-contract observed states. No scene, DOM or API: the twin app registers them with its mixins, and the build makes the capability module (ADR-0172 decision 3) a figure server loads.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./module": "./dist/twin-capabilities.module.mjs"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"README.md",
|
|
18
|
+
"dist",
|
|
19
|
+
"!**/*.map",
|
|
20
|
+
"!**/*.test.*",
|
|
21
|
+
"!**/test/**",
|
|
22
|
+
"!**/*.tsbuildinfo",
|
|
23
|
+
"!**/.DS_Store"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && npm run build:module",
|
|
27
|
+
"build:module": "esbuild src/module.ts --bundle --format=esm --platform=neutral --outfile=dist/twin-capabilities.module.mjs",
|
|
28
|
+
"typecheck": "tsc -p tsconfig.check.json",
|
|
29
|
+
"test": "node --test test/*.test.ts",
|
|
30
|
+
"fingerprint": "node scripts/module-fingerprint.mjs"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@operato/ops-contract": "^0.9.43"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@hatiolab/figure-model": "*"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@hatiolab/figure-model": "^0.12.16"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/README.md
DELETED