@yamcs/opi 1.3.4 → 1.3.5

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.
@@ -2,7 +2,7 @@ import { Color } from "./Color";
2
2
  import { ConsoleHandler } from "./ConsoleHandler";
3
3
  import { DialogHandler } from "./DialogHandler";
4
4
  import { FontResolver } from "./FontResolver";
5
- import { Formatter } from './Formatter';
5
+ import { Formatter } from "./Formatter";
6
6
  import { PathResolver } from "./PathResolver";
7
7
  import { Widget } from "./Widget";
8
8
  import { OPIEvent, OPIEventMap } from "./events";
@@ -6,10 +6,11 @@ export { Font } from "./Font";
6
6
  export { FontResolver } from "./FontResolver";
7
7
  export { DefaultPathResolver, PathResolver } from "./PathResolver";
8
8
  export { Dimension, NullablePoint, Point } from "./positioning";
9
- export { CompiledFormula, DataSourceStatus } from "./pv/formulas/CompiledFormula";
9
+ export { CompiledFormula, DataSourceStatus, } from "./pv/formulas/CompiledFormula";
10
10
  export { FormulaCompiler } from "./pv/formulas/FormulaCompiler";
11
11
  export { HistoricalDataProvider } from "./pv/HistoricalDataProvider";
12
12
  export { AlarmSeverity, PV } from "./pv/PV";
13
13
  export { PVProvider } from "./pv/PVProvider";
14
14
  export { Sample } from "./pv/Sample";
15
+ export { TypeHint } from "./pv/TypeHint";
15
16
  export { Widget } from "./Widget";
@@ -1,12 +1,14 @@
1
1
  import { PVEngine } from "./PVEngine";
2
2
  import { PVProvider } from "./PVProvider";
3
3
  import { Sample } from "./Sample";
4
+ import { TypeHint } from "./TypeHint";
4
5
  export declare class PV {
5
6
  readonly name: string;
6
7
  readonly pvEngine: PVEngine;
7
8
  private _writable;
8
9
  private _units?;
9
10
  private _labels?;
11
+ private _typeHint?;
10
12
  private _lowerDisplayLimit?;
11
13
  private _lowerAlarmLimit?;
12
14
  private _lowerWarningLimit?;
@@ -48,6 +50,7 @@ export declare class PV {
48
50
  get value(): any | undefined;
49
51
  get indexValue(): number | undefined;
50
52
  get severity(): AlarmSeverity;
53
+ get typeHint(): TypeHint | undefined;
51
54
  get alarmName(): string;
52
55
  toNumber(): number | null | undefined;
53
56
  setSample(sample: Sample): void;
@@ -1,4 +1,4 @@
1
- import { Widget } from '../Widget';
1
+ import { Widget } from "../Widget";
2
2
  import { HistoricalDataProvider } from "./HistoricalDataProvider";
3
3
  import { PV } from "./PV";
4
4
  export interface PVProvider {
@@ -1,4 +1,5 @@
1
1
  import { AlarmSeverity } from "./PV";
2
+ import { TypeHint } from "./TypeHint";
2
3
  export interface Sample {
3
4
  time: Date;
4
5
  value: any;
@@ -12,4 +13,9 @@ export interface Sample {
12
13
  * Engineering units
13
14
  */
14
15
  units?: string;
16
+ /**
17
+ * Optional type hint for values that are
18
+ * not JavaScript primitives.
19
+ */
20
+ typeHint?: TypeHint;
15
21
  }
@@ -1,4 +1,4 @@
1
- import { Formatter } from '../Formatter';
1
+ import { Formatter } from "../Formatter";
2
2
  import { PV } from "./PV";
3
3
  import { PVProvider } from "./PVProvider";
4
4
  export declare class SystemPVProvider implements PVProvider {
@@ -0,0 +1,5 @@
1
+ export type TypeHint =
2
+ /**
3
+ * Value is a binary string containing raw bytes.
4
+ */
5
+ "BINARY_STRING";
@@ -1,4 +1,4 @@
1
- import { Formatter } from '../Formatter';
1
+ import { Formatter } from "../Formatter";
2
2
  import { PV } from "./PV";
3
3
  export declare abstract class SimGenerator {
4
4
  readonly pv: PV;
@@ -1,4 +1,4 @@
1
- import { Display } from '../Display';
1
+ import { Display } from "../Display";
2
2
  import { PVWrapper } from "./PVWrapper";
3
3
  import { WidgetWrapper } from "./WidgetWrapper";
4
4
  export declare class PVUtil {
@@ -1,3 +1,4 @@
1
+ import { TypeHint } from "./pv/TypeHint";
1
2
  export declare function roundRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, rx: number, ry: number): void;
2
3
  export declare function normalizePath(base: string, relPath: string): string;
3
- export declare function formatValue(value: any, formatType: number, precision: number): string;
4
+ export declare function formatValue(value: any, formatType: number, precision: number, typeHint: TypeHint | undefined): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamcs/opi",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "OPI Display Renderer",
5
5
  "author": "Yamcs Team <yamcs@spaceapplications.com>",
6
6
  "repository": {
@@ -16,7 +16,9 @@
16
16
  "prepublishOnly": "npm run build",
17
17
  "watch": "esbuild src/index.ts --outfile=dist/opi.js --sourcemap --bundle --platform=browser --format=esm --minify --watch",
18
18
  "peggy": "cd src/pv/formulas && peggy --format es -o parser.js formula-grammar.peggy",
19
- "start": "node ./demo/server.js"
19
+ "start": "node ./demo/server.js",
20
+ "prettier:check": "prettier --check '**/*.ts'",
21
+ "prettier:write": "prettier --check --write '**/*.ts'"
20
22
  },
21
23
  "module": "dist/opi.js",
22
24
  "types": "dist/types/index.d.ts",
@@ -31,6 +33,7 @@
31
33
  "morgan": "^1.10.0",
32
34
  "nunjucks": "^3.2.2",
33
35
  "peggy": "4.2.0",
36
+ "prettier": "^3.5.3",
34
37
  "tslib": "^2.6.3",
35
38
  "typescript": "^5.4.5"
36
39
  }