@operato/twin-figure-capabilities 0.0.0-stage → 0.5.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/entity.d.ts +61 -0
- package/dist/entity.js +89 -0
- package/dist/generate.d.ts +54 -0
- package/dist/generate.js +101 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +12 -0
- package/dist/mobile.d.ts +1 -0
- package/dist/mobile.js +15 -0
- package/dist/module.d.ts +10 -0
- package/dist/module.js +16 -0
- package/dist/operable.d.ts +1 -0
- package/dist/operable.js +16 -0
- package/dist/storable.d.ts +30 -0
- package/dist/storable.js +45 -0
- package/dist/twin-capabilities.module.mjs +1419 -0
- package/dist/values.d.ts +16 -0
- package/dist/values.js +34 -0
- package/dist/words.d.ts +5 -0
- package/dist/words.js +1 -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' }
|
|
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
package/dist/words.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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.0",
|
|
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