@yamcs/opi 1.3.14 → 1.4.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.
Files changed (70) hide show
  1. package/README.md +0 -66
  2. package/dist/opi.js +20 -19
  3. package/dist/opi.js.map +4 -4
  4. package/dist/opi.standalone.js +19 -18
  5. package/dist/types/Bevel.d.ts +16 -0
  6. package/dist/types/DecimalFormat.d.ts +8 -0
  7. package/dist/types/Display.d.ts +84 -2
  8. package/dist/types/EventHandler.d.ts +10 -0
  9. package/dist/types/Font.d.ts +2 -0
  10. package/dist/types/Graphics.d.ts +69 -6
  11. package/dist/types/HitRegionSpecification.d.ts +1 -0
  12. package/dist/types/Widget.d.ts +11 -0
  13. package/dist/types/XMLNode.d.ts +12 -0
  14. package/dist/types/actions/Action.d.ts +2 -0
  15. package/dist/types/actions/ExecuteCommandAction.d.ts +1 -1
  16. package/dist/types/actions/ExecuteJavaScriptAction.d.ts +1 -1
  17. package/dist/types/actions/OpenDisplayAction.d.ts +1 -1
  18. package/dist/types/actions/OpenFileAction.d.ts +1 -1
  19. package/dist/types/actions/OpenWebpageAction.d.ts +1 -1
  20. package/dist/types/actions/PlaySoundAction.d.ts +1 -1
  21. package/dist/types/actions/RunCommandAction.d.ts +1 -1
  22. package/dist/types/actions/RunProcedureAction.d.ts +1 -1
  23. package/dist/types/actions/RunStackAction.d.ts +1 -1
  24. package/dist/types/actions/WritePVAction.d.ts +1 -1
  25. package/dist/types/actions.d.ts +1 -1
  26. package/dist/types/index.d.ts +1 -1
  27. package/dist/types/positioning.d.ts +14 -0
  28. package/dist/types/properties.d.ts +2 -0
  29. package/dist/types/pv/LocalPV.d.ts +2 -2
  30. package/dist/types/pv/PVEngine.d.ts +23 -1
  31. package/dist/types/pv/formulas/parser.d.ts +3 -3
  32. package/dist/types/scale.d.ts +22 -0
  33. package/dist/types/scripting/ArrayWrapper.d.ts +21 -0
  34. package/dist/types/scripting/Java.d.ts +1 -1
  35. package/dist/types/scripting/PVUtil.d.ts +1 -1
  36. package/dist/types/scripting/PVWrapper.d.ts +1 -0
  37. package/dist/types/scripting/WidgetWrapper.d.ts +2 -0
  38. package/dist/types/widgets/controls/ActionButton.d.ts +7 -0
  39. package/dist/types/widgets/controls/BooleanButton.d.ts +4 -0
  40. package/dist/types/widgets/controls/BooleanSwitch.d.ts +4 -0
  41. package/dist/types/widgets/controls/CheckBox.d.ts +2 -0
  42. package/dist/types/widgets/controls/ImageBooleanButton.d.ts +16 -0
  43. package/dist/types/widgets/controls/Knob.d.ts +64 -0
  44. package/dist/types/widgets/controls/ScaledSlider.d.ts +81 -0
  45. package/dist/types/widgets/controls/Spinner.d.ts +49 -0
  46. package/dist/types/widgets/controls/TextInput.d.ts +17 -2
  47. package/dist/types/widgets/controls/ThumbWheel.d.ts +42 -0
  48. package/dist/types/widgets/figures/Ramp.d.ts +1 -1
  49. package/dist/types/widgets/figures/Scale.d.ts +64 -0
  50. package/dist/types/widgets/graphics/ImageWidget.d.ts +56 -0
  51. package/dist/types/widgets/graphics/Label.d.ts +36 -0
  52. package/dist/types/widgets/graphics/Polygon.d.ts +30 -0
  53. package/dist/types/widgets/graphics/Polyline.d.ts +36 -0
  54. package/dist/types/widgets/monitors/Gauge.d.ts +6 -0
  55. package/dist/types/widgets/monitors/ImageBooleanIndicator.d.ts +18 -0
  56. package/dist/types/widgets/monitors/IntensityGraph.d.ts +46 -0
  57. package/dist/types/widgets/monitors/IntensityGraphRegion.d.ts +15 -0
  58. package/dist/types/widgets/monitors/Meter.d.ts +9 -0
  59. package/dist/types/widgets/monitors/TextUpdate.d.ts +10 -0
  60. package/dist/types/widgets/monitors/xygraph/Axis.d.ts +1 -1
  61. package/dist/types/widgets/others/AbstractContainerWidget.d.ts +8 -0
  62. package/dist/types/widgets/others/ArrayWidget.d.ts +97 -0
  63. package/dist/types/widgets/others/Connection.d.ts +58 -0
  64. package/dist/types/widgets/others/DisplayWidget.d.ts +3 -1
  65. package/dist/types/widgets/others/GridLayout.d.ts +25 -0
  66. package/dist/types/widgets/others/GroupingContainer.d.ts +60 -0
  67. package/dist/types/widgets/others/LinkingContainer.d.ts +25 -3
  68. package/dist/types/widgets/others/SashContainer.d.ts +29 -0
  69. package/package.json +2 -2
  70. package/dist/types/widgets/graphics/ImageHelper.d.ts +0 -3
@@ -0,0 +1,16 @@
1
+ import { Color } from "./Color";
2
+ import { Graphics } from "./Graphics";
3
+ import { Bounds } from "./positioning";
4
+ /**
5
+ * Draws a classic Win95-style 3D bevel border around a rect, as used by
6
+ * SWT/draw2d buttons and scrollbars. Ported from Scrollbar.ts, which
7
+ * originally implemented this for its own up/down/thumb buttons.
8
+ */
9
+ export declare function drawBevelBorder(g: Graphics, bounds: Bounds, scale: number, c1: Color, c2: Color, c3: Color, c4: Color): void;
10
+ export declare function drawRaisedBevelBorder(g: Graphics, bounds: Bounds, scale: number): void;
11
+ export declare function drawPressedBevelBorder(g: Graphics, bounds: Bounds, scale: number): void;
12
+ /**
13
+ * Draws a small filled triangle pointing up, down, left or right, centered
14
+ * within bounds, as used by scrollbar arrow buttons.
15
+ */
16
+ export declare function drawArrowGlyph(g: Graphics, bounds: Bounds, scale: number, direction: "up" | "down" | "left" | "right", color?: Color): void;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Computes a default DecimalFormat pattern for a value range, mirroring
3
+ * Nebula's AbstractScale.createDefaultDecimalFormat (used by CSS/Yamcs
4
+ * Studio's round-scale widgets whenever no explicit value_label_format is
5
+ * set) - so opi.js shows the same decimal precision Yamcs Studio would
6
+ * derive from the same min/max, rather than an arbitrary fixed precision.
7
+ */
8
+ export declare function createDefaultDecimalFormat(min: number, max: number): string;
1
9
  export declare class DecimalFormat {
2
10
  private prefix;
3
11
  private suffix;
@@ -8,7 +8,7 @@ import { PathResolver } from "./PathResolver";
8
8
  import { ScriptLoader } from "./ScriptLoader";
9
9
  import { Widget } from "./Widget";
10
10
  import { OPIEvent, OPIEventMap } from "./events";
11
- import { Bounds } from "./positioning";
11
+ import { Bounds, Point } from "./positioning";
12
12
  import { PVEngine } from "./pv/PVEngine";
13
13
  import { PVProvider } from "./pv/PVProvider";
14
14
  import { Sample } from "./pv/Sample";
@@ -19,10 +19,14 @@ import { CheckBox } from "./widgets/controls/CheckBox";
19
19
  import { ChoiceButton } from "./widgets/controls/ChoiceButton";
20
20
  import { Combo } from "./widgets/controls/Combo";
21
21
  import { ImageBooleanButton } from "./widgets/controls/ImageBooleanButton";
22
+ import { Knob } from "./widgets/controls/Knob";
22
23
  import { MenuButton } from "./widgets/controls/MenuButton";
23
24
  import { RadioBox } from "./widgets/controls/RadioBox";
25
+ import { ScaledSlider } from "./widgets/controls/ScaledSlider";
24
26
  import { Scrollbar } from "./widgets/controls/Scrollbar";
27
+ import { Spinner } from "./widgets/controls/Spinner";
25
28
  import { TextInput } from "./widgets/controls/TextInput";
29
+ import { ThumbWheel } from "./widgets/controls/ThumbWheel";
26
30
  import { Arc } from "./widgets/graphics/Arc";
27
31
  import { Ellipse } from "./widgets/graphics/Ellipse";
28
32
  import { ImageWidget } from "./widgets/graphics/ImageWidget";
@@ -43,12 +47,25 @@ import { TextUpdate } from "./widgets/monitors/TextUpdate";
43
47
  import { Thermometer } from "./widgets/monitors/Thermometer";
44
48
  import { XYGraph } from "./widgets/monitors/xygraph/XYGraph";
45
49
  import { AbstractContainerWidget } from "./widgets/others/AbstractContainerWidget";
50
+ import { ArrayWidget } from "./widgets/others/ArrayWidget";
46
51
  import { DisplayWidget } from "./widgets/others/DisplayWidget";
52
+ import { GridLayout } from "./widgets/others/GridLayout";
47
53
  import { GroupingContainer } from "./widgets/others/GroupingContainer";
48
54
  import { LinkingContainer } from "./widgets/others/LinkingContainer";
55
+ import { SashContainer } from "./widgets/others/SashContainer";
49
56
  import { TabbedContainer } from "./widgets/others/TabbedContainer";
50
57
  import { Table } from "./widgets/others/Table";
51
58
  import { WebBrowser } from "./widgets/others/WebBrowser";
59
+ /**
60
+ * Overrides a display's own `auto_scale_widgets` XML property:
61
+ * `ENABLED`/`DISABLED` force auto-scale on/off regardless of what's
62
+ * authored, `DEFAULT` respects the authored value.
63
+ */
64
+ export declare enum AutoScaleOverride {
65
+ ENABLED = "ENABLED",
66
+ DISABLED = "DISABLED",
67
+ DEFAULT = "DEFAULT"
68
+ }
52
69
  export declare class Display {
53
70
  private readonly targetElement;
54
71
  rootPanel: HTMLDivElement;
@@ -69,12 +86,20 @@ export declare class Display {
69
86
  private _showRuler;
70
87
  private _selection;
71
88
  private _scale;
89
+ private _pixelRatio;
90
+ private pixelRatioOverridden;
72
91
  private _transparent;
73
92
  private _disconnectedColor;
74
93
  private _invalidColor;
75
94
  private _majorColor;
76
95
  private _minorColor;
77
96
  private refreshCycle;
97
+ private originDesignSize?;
98
+ private wasAutoScaleActive;
99
+ private _autoScaleOverride;
100
+ private resizeObserver;
101
+ private eventHandler;
102
+ private stepTimer?;
78
103
  /**
79
104
  * Prefix for images sourced during draw.
80
105
  * (does not include workspace images)
@@ -112,7 +137,15 @@ export declare class Display {
112
137
  */
113
138
  requestRepaint(): void;
114
139
  setTooltip(tooltip: string | undefined): void;
115
- createWidget(kind: string, parent: AbstractContainerWidget): Table | XYGraph | ActionButton | Arc | BooleanButton | BooleanSwitch | ByteMonitor | CheckBox | ChoiceButton | Combo | Ellipse | Gauge | GroupingContainer | ImageWidget | ImageBooleanButton | ImageBooleanIndicator | IntensityGraph | Label | LED | LinkingContainer | MenuButton | Meter | Polygon | Polyline | ProgressBar | RadioBox | Rectangle | RoundedRectangle | Scrollbar | TabbedContainer | Tank | TextInput | TextUpdate | Thermometer | WebBrowser | undefined;
140
+ createWidget(kind: string, parent: AbstractContainerWidget): ActionButton | Arc | ArrayWidget | BooleanButton | BooleanSwitch | ByteMonitor | CheckBox | ChoiceButton | Combo | Ellipse | Gauge | GridLayout | GroupingContainer | ImageBooleanButton | ImageBooleanIndicator | ImageWidget | IntensityGraph | Knob | LED | Label | LinkingContainer | MenuButton | Meter | Polygon | Polyline | ProgressBar | RadioBox | Rectangle | RoundedRectangle | SashContainer | ScaledSlider | Scrollbar | Spinner | TabbedContainer | Table | Tank | TextInput | TextUpdate | Thermometer | ThumbWheel | WebBrowser | XYGraph | undefined;
141
+ /**
142
+ * Releases everything this Display holds outside of its own instance:
143
+ * the repaint loop, the resize observer, canvas/document event
144
+ * listeners, and rootPanel itself (removed from targetElement, which is
145
+ * restored to how it was before construction). The instance is unusable
146
+ * afterwards - this is not the same as reset() between two setSource()
147
+ * calls on a Display that keeps running.
148
+ */
116
149
  destroy(): void;
117
150
  resolvePath(path: string, widget?: Widget): string;
118
151
  setSource(href: string, args?: {
@@ -128,6 +161,16 @@ export declare class Display {
128
161
  * Bounds of this widget relative to the root
129
162
  * of all of its parents.
130
163
  */
164
+ /**
165
+ * Sums the x/y offset contributed by every ancestor of a widget, up to
166
+ * the display root. A plain sum of ancestor.x/y is not enough:
167
+ * TabbedContainer positions its active tab's content at
168
+ * `this.y + labelHeight` (or an equivalent width offset for vertical
169
+ * tabs) without that ever being reflected in the tab-content widget's
170
+ * own x/y, so ancestors of that kind need their extra offset added in
171
+ * explicitly.
172
+ */
173
+ measureAbsoluteOffset(widget: Widget): Point;
131
174
  measureAbsoluteArea(widget: Widget): Bounds;
132
175
  addEventListener<K extends keyof OPIEventMap>(type: K, listener: (ev: OPIEventMap[K]) => void): void;
133
176
  removeEventListener<K extends keyof OPIEventMap>(type: K, listener: (ev: OPIEventMap[K]) => void): void;
@@ -144,6 +187,45 @@ export declare class Display {
144
187
  set editMode(editMode: boolean);
145
188
  get scale(): number;
146
189
  set scale(scale: number);
190
+ /**
191
+ * Overrides the loaded display's own `auto_scale_widgets` XML property.
192
+ * `DEFAULT` (the default) respects the authored value; `ENABLED`/
193
+ * `DISABLED` force auto-scale on/off regardless of what's authored.
194
+ * Intended for demo/dev tooling that wants to exercise auto-scale on
195
+ * displays that don't author it themselves - not part of the OPI file
196
+ * format.
197
+ */
198
+ get autoScaleOverride(): AutoScaleOverride;
199
+ set autoScaleOverride(value: AutoScaleOverride);
200
+ private isAutoScaleActive;
201
+ /**
202
+ * The size to fill when auto-scale is active, or undefined if there's
203
+ * nothing sensible to fill (targetElement has zero size of its own).
204
+ */
205
+ private measureContainerSize;
206
+ /**
207
+ * Applies display-wide widget scaling to fill containerSize, relative to
208
+ * the design-time size captured at load. Mirrors Java's DisplayEditpart
209
+ * resize listener / DisplayModel#scale().
210
+ */
211
+ private applyAutoScale;
212
+ /** Restores the design-time layout if auto-scale was previously applied. */
213
+ private revertAutoScale;
214
+ /**
215
+ * Backing store pixels per CSS pixel. Defaults to the screen's
216
+ * devicePixelRatio, which renders crisply on HiDPI screens, and follows it
217
+ * when the window moves to another screen.
218
+ *
219
+ * Set it to override, which also stops it tracking the screen: 1 renders at
220
+ * CSS resolution, and `Math.min(devicePixelRatio, 2)` caps the memory a
221
+ * large display costs (the canvas, and every offscreen container buffer,
222
+ * scale with the square of this).
223
+ *
224
+ * This does not change the size of anything: all coordinates, fonts and
225
+ * mouse handling stay in CSS pixels.
226
+ */
227
+ get pixelRatio(): number;
228
+ set pixelRatio(pixelRatio: number);
147
229
  get transparent(): boolean;
148
230
  set transparent(transparent: boolean);
149
231
  get utc(): boolean;
@@ -20,13 +20,23 @@ export declare class EventHandler {
20
20
  private documentMouseMoveListener;
21
21
  private documentMouseUpListener;
22
22
  private prevEnteredRegion?;
23
+ private pendingMouseMoveEvent?;
24
+ private mouseMoveRafHandle?;
25
+ private abortController;
23
26
  constructor(display: Display, canvas: HTMLCanvasElement, hitCanvas: HitCanvas);
27
+ /**
28
+ * Removes every listener this instance registered, including the
29
+ * document-level ones left behind by an in-progress grab.
30
+ */
31
+ destroy(): void;
24
32
  private toPoint;
25
33
  private onCanvasClick;
34
+ private onCanvasDblClick;
26
35
  private onCanvasMouseDown;
27
36
  private onCanvasMouseUp;
28
37
  private onCanvasMouseOut;
29
38
  private onCanvasMouseMove;
39
+ private processMouseMove;
30
40
  private initiateGrab;
31
41
  private onDocumentMouseUp;
32
42
  private onDocumentMouseMove;
@@ -1,3 +1,5 @@
1
+ export declare const FONT_SUBSTITUTES: Record<string, string>;
2
+ export declare function markSubstituteLoaded(name: string): void;
1
3
  export declare class Font {
2
4
  name: string;
3
5
  style: number;
@@ -111,14 +111,79 @@ interface PathGradientFill {
111
111
  opacity?: number;
112
112
  }
113
113
  type PathFill = PathColorFill | PathGradientFill;
114
+ /**
115
+ * Splits a destination for drawImage into a whole-device-pixel position, and
116
+ * the sub-pixel remainder that was taken off it.
117
+ *
118
+ * drawImage resamples whenever the destination does not land on a whole
119
+ * device pixel, blurring everything already rasterized into the source
120
+ * canvas. Callers blit at the returned position, and fold the remainder into
121
+ * the source canvas instead (translate it, and grow the canvas to match), so
122
+ * that content keeps its exact sub-pixel position but gets rasterized there
123
+ * directly rather than being drawn on a whole pixel and then shifted.
124
+ *
125
+ * `dx`/`dy` and the returned values are all CSS pixels, but the snapping is
126
+ * done in device space: `ctx` carries the HiDPI scale, and may carry a
127
+ * remainder of its own from an enclosing buffer that did the same thing.
128
+ *
129
+ * The context transform is therefore a uniform scale plus a translation.
130
+ * Never a rotation: widget scaling is baked into coordinates rather than into
131
+ * the context, and the only ctx.rotate() calls are save()/restore()-scoped
132
+ * around leaf text.
133
+ */
134
+ export declare function snapDestination(ctx: CanvasRenderingContext2D, dx: number, dy: number): {
135
+ x: number;
136
+ y: number;
137
+ subPixelX: number;
138
+ subPixelY: number;
139
+ };
114
140
  export declare class Graphics {
115
141
  readonly canvas: HTMLCanvasElement;
142
+ /**
143
+ * Backing store pixels per CSS pixel (HiDPI). All drawing coordinates
144
+ * remain in CSS pixels; this Graphics is the only thing that knows about
145
+ * device pixels, and it applies the ratio as a context transform.
146
+ *
147
+ * The hit canvas is deliberately kept at 1x: it is probed with CSS
148
+ * coordinates straight from the mouse event, and 1 CSS pixel of hit-test
149
+ * precision is plenty.
150
+ *
151
+ * Mutable on the root Graphics (the ratio changes when the window moves
152
+ * to another monitor); it takes effect on the next resize(). Offscreen
153
+ * buffers inherit it at creation.
154
+ */
155
+ pixelRatio: number;
116
156
  readonly ctx: CanvasRenderingContext2D;
117
157
  readonly hitCanvas: HitCanvas;
118
158
  readonly hitCtx: CanvasRenderingContext2D;
119
- constructor(canvas: HTMLCanvasElement, hitCanvas?: HitCanvas);
159
+ private parentOffset?;
160
+ constructor(canvas: HTMLCanvasElement, hitCanvas?: HitCanvas,
161
+ /**
162
+ * Backing store pixels per CSS pixel (HiDPI). All drawing coordinates
163
+ * remain in CSS pixels; this Graphics is the only thing that knows about
164
+ * device pixels, and it applies the ratio as a context transform.
165
+ *
166
+ * The hit canvas is deliberately kept at 1x: it is probed with CSS
167
+ * coordinates straight from the mouse event, and 1 CSS pixel of hit-test
168
+ * precision is plenty.
169
+ *
170
+ * Mutable on the root Graphics (the ratio changes when the window moves
171
+ * to another monitor); it takes effect on the next resize(). Offscreen
172
+ * buffers inherit it at creation.
173
+ */
174
+ pixelRatio?: number);
175
+ /** Width in CSS pixels (the canvas attribute is in device pixels). */
176
+ get cssWidth(): number;
177
+ /** Height in CSS pixels (the canvas attribute is in device pixels). */
178
+ get cssHeight(): number;
120
179
  createChild(width: number, height: number): Graphics;
180
+ /**
181
+ * Offscreen buffer for content that is later copied to (dx, dy) of this
182
+ * Graphics, using copyChild(). See snapDestination().
183
+ */
184
+ createChildAt(dx: number, dy: number, width: number, height: number): Graphics;
121
185
  translate(x: number, y: number): void;
186
+ copyChild(g: Graphics): void;
122
187
  copy(g: Graphics, dx: number, dy: number): void;
123
188
  copyFitted(g: Graphics, dx: number, dy: number, dw: number, dh: number): void;
124
189
  copyScaled(g: Graphics, dx: number, dy: number, dw: number, dh: number): void;
@@ -126,12 +191,10 @@ export declare class Graphics {
126
191
  fillCanvas(color: Color): void;
127
192
  clearCanvas(): void;
128
193
  /**
129
- * Perform a CSS-level rescale of the Canvas.
130
- *
131
- * This resamples the bitmapped canvas area to fit the area made available
132
- * by CSS.
194
+ * Sizes the canvas to a CSS-pixel area. The backing store is allocated at
195
+ * pixelRatio, and the base transform re-applied so that all subsequent
196
+ * drawing remains in CSS pixels.
133
197
  */
134
- scaleCanvas(width: number, height: number): void;
135
198
  resize(width: number, height: number): void;
136
199
  fillRect(fill: RectFill): void;
137
200
  fillText(fill: TextFill): void;
@@ -3,6 +3,7 @@ export type TooltipProvider = () => string | undefined;
3
3
  export interface HitRegionSpecification {
4
4
  id: string;
5
5
  click?: (mouseEvent: OpiMouseEvent) => void;
6
+ dblclick?: (mouseEvent: OpiMouseEvent) => void;
6
7
  mouseEnter?: () => void;
7
8
  mouseMove?: () => void;
8
9
  mouseOut?: () => void;
@@ -23,6 +23,7 @@ export declare abstract class Widget {
23
23
  protected customSize?: Dimension;
24
24
  private customHolderWidth?;
25
25
  private customHolderHeight?;
26
+ private originBounds?;
26
27
  private holderRegion?;
27
28
  properties: PropertySet;
28
29
  readonly vars: Map<string, any>;
@@ -96,6 +97,16 @@ export declare abstract class Widget {
96
97
  get scripts(): ScriptSet;
97
98
  get rules(): RuleSet;
98
99
  get scaleOptions(): ScaleOptions;
100
+ /**
101
+ * Repositions (always) and, per this widget's ScaleOptions, resizes this
102
+ * widget in response to a display-level auto-scale resize. Ratios are
103
+ * relative to the display's design-time (origin) size, not to the widget's
104
+ * current live size, so repeated resizes don't compound rounding drift.
105
+ *
106
+ * Named distinctly from the `scale` getter above (the manual zoom
107
+ * multiplier) -- unrelated, independent scaling axes.
108
+ */
109
+ autoScale(widthRatio: number, heightRatio: number): void;
99
110
  get widgetType(): string | undefined;
100
111
  get text(): string;
101
112
  /**
@@ -74,6 +74,7 @@ export declare class XMLNode {
74
74
  [key: string]: string;
75
75
  };
76
76
  getStringTable(name: string): string[][];
77
+ getMatrix(name: string): number[][];
77
78
  getScripts(name: string): ScriptSet;
78
79
  getScaleOptions(name: string): ScaleOptions;
79
80
  getAutoScaleWidgets(name: string): AutoScaleWidgets;
@@ -82,5 +83,16 @@ export declare class XMLNode {
82
83
  getMacros(name: string): MacroSet;
83
84
  getActions(name: string): ActionSet;
84
85
  private parseColorNode;
86
+ /**
87
+ * Deep-clones this node, optionally rewriting the text content of every
88
+ * descendant `<pv_name>` and/or `<wuid>` element (including nested
89
+ * `<widget>` subtrees). Used by the Array widget to turn a single
90
+ * authored child template into N independent, uniquely-identified and
91
+ * uniquely-PV-bound clones.
92
+ */
93
+ cloneWithOverrides(overrides: {
94
+ pvName?: string;
95
+ wuidSuffix?: string;
96
+ }): XMLNode;
85
97
  private findChild;
86
98
  }
@@ -7,4 +7,6 @@ export declare abstract class Action {
7
7
  parseNode(node: XMLNode): void;
8
8
  abstract execute(widget: Widget): void;
9
9
  get description(): string;
10
+ getDescription(): string;
11
+ getDefaultDescription(): string;
10
12
  }
@@ -6,5 +6,5 @@ export declare class ExecuteCommandAction extends Action {
6
6
  get command(): string;
7
7
  get commandDirectory(): string;
8
8
  get waitTime(): number;
9
- toString(): string;
9
+ getDefaultDescription(): string;
10
10
  }
@@ -6,5 +6,5 @@ export declare class ExecuteJavaScriptAction extends Action {
6
6
  get path(): string;
7
7
  get embedded(): boolean;
8
8
  get scriptText(): string;
9
- toString(): string;
9
+ getDefaultDescription(): string;
10
10
  }
@@ -7,5 +7,5 @@ export declare class OpenDisplayAction extends Action {
7
7
  get macros(): MacroSet;
8
8
  get path(): string;
9
9
  get mode(): number;
10
- toString(): string;
10
+ getDefaultDescription(): string;
11
11
  }
@@ -4,5 +4,5 @@ export declare class OpenFileAction extends Action {
4
4
  constructor();
5
5
  execute(widget: Widget): void;
6
6
  get path(): string;
7
- toString(): string;
7
+ getDefaultDescription(): string;
8
8
  }
@@ -4,5 +4,5 @@ export declare class OpenWebpageAction extends Action {
4
4
  constructor();
5
5
  execute(widget: Widget): void;
6
6
  get hyperlink(): string;
7
- toString(): string;
7
+ getDefaultDescription(): string;
8
8
  }
@@ -4,5 +4,5 @@ export declare class PlaySoundAction extends Action {
4
4
  constructor();
5
5
  execute(widget: Widget): void;
6
6
  get path(): string;
7
- toString(): string;
7
+ getDefaultDescription(): string;
8
8
  }
@@ -8,5 +8,5 @@ export declare class RunCommandAction extends Action {
8
8
  [key: string]: string;
9
9
  };
10
10
  get confirmMessage(): string;
11
- toString(): string;
11
+ getDefaultDescription(): string;
12
12
  }
@@ -8,5 +8,5 @@ export declare class RunProcedureAction extends Action {
8
8
  [key: string]: string;
9
9
  };
10
10
  get confirmMessage(): string;
11
- toString(): string;
11
+ getDefaultDescription(): string;
12
12
  }
@@ -5,5 +5,5 @@ export declare class RunStackAction extends Action {
5
5
  execute(widget: Widget): void;
6
6
  get path(): string;
7
7
  get confirmMessage(): string;
8
- toString(): string;
8
+ getDefaultDescription(): string;
9
9
  }
@@ -7,5 +7,5 @@ export declare class WritePVAction extends Action {
7
7
  get value(): string;
8
8
  get timeout(): number;
9
9
  get confirmMessage(): string;
10
- toString(): string;
10
+ getDefaultDescription(): string;
11
11
  }
@@ -4,7 +4,7 @@ export declare class ActionSet {
4
4
  hookFirstActionToClick: boolean;
5
5
  hookAllActionsToClick: boolean;
6
6
  add(action: Action | null): void;
7
- isClickable(): boolean | 0;
7
+ isClickable(): 0 | boolean;
8
8
  getAction(index: number): Action | null | undefined;
9
9
  toString(): string;
10
10
  }
@@ -1,7 +1,7 @@
1
1
  export { Color, colorFromCssColor } from "./Color";
2
2
  export { ConsoleHandler, DefaultConsoleHandler } from "./ConsoleHandler";
3
3
  export { DefaultDialogHandler, DialogHandler } from "./DialogHandler";
4
- export { Display } from "./Display";
4
+ export { AutoScaleOverride, Display } from "./Display";
5
5
  export { Font } from "./Font";
6
6
  export { FontResolver } from "./FontResolver";
7
7
  export { DefaultImageLoader, ImageLoader } from "./ImageLoader";
@@ -66,4 +66,18 @@ export declare class PolarPoint {
66
66
  toPoint(): Point;
67
67
  }
68
68
  export declare function scalePoints(points: Point[], scale: number): Point[];
69
+ /**
70
+ * Rotates a list of points around its own bounding-box center by `angle`
71
+ * degrees. Mirrors Yamcs Studio's PointsUtil#rotatePoints(PointList, double):
72
+ * because an axis-aligned bounding box does not itself rotate cleanly, the
73
+ * result is re-anchored so its bounding-box center matches the original.
74
+ */
75
+ export declare function rotatePoints(points: Point[], angle: number): Point[];
69
76
  export declare function halfPixelPoints(points: Point[]): Point[];
77
+ /**
78
+ * Ports org.csstudio.swt.widgets.figures.TextFigure#calculateTextLocation's
79
+ * rotated branch: computes the point (relative to textArea) that the text
80
+ * should be translated+rotated around so that the rotated text lines up
81
+ * against textArea per the given alignment.
82
+ */
83
+ export declare function calculateRotatedTextLocation(textArea: Dimension, textSize: Dimension, degrees: number, horizAlignment: number, vertAlignment: number): Point;
@@ -71,6 +71,8 @@ export declare class ColorMapProperty extends Property<ColorMap> {
71
71
  }
72
72
  export declare class PointsProperty extends Property<Point[]> {
73
73
  }
74
+ export declare class MatrixProperty extends Property<number[][]> {
75
+ }
74
76
  export declare class ActionsProperty extends Property<ActionSet> {
75
77
  }
76
78
  export declare class MacrosProperty extends Property<MacroSet> {
@@ -4,7 +4,7 @@ import { Sample } from "./Sample";
4
4
  export type LocalPVType = "VDouble" | "VDoubleArray" | "VString" | "VStringArray";
5
5
  export declare class LocalPV extends PV {
6
6
  type?: LocalPVType | undefined;
7
- readonly initializer?: any | undefined;
8
- constructor(name: string, pvEngine: PVEngine, type?: LocalPVType | undefined, initializer?: any | undefined);
7
+ readonly initializer?: any;
8
+ constructor(name: string, pvEngine: PVEngine, type?: LocalPVType | undefined, initializer?: any);
9
9
  setSample(sample: Sample): void;
10
10
  }
@@ -10,6 +10,7 @@ export declare class PVEngine {
10
10
  private display;
11
11
  private rules;
12
12
  private scripts;
13
+ private valueListeners;
13
14
  private pvs;
14
15
  private providers;
15
16
  readonly scriptLibraries: {
@@ -42,7 +43,24 @@ export declare class PVEngine {
42
43
  setValue(time: Date, pvName: string, value: any, severity?: AlarmSeverity, units?: string | undefined): void;
43
44
  setExternalValues(samples: Map<string, Sample>): void;
44
45
  createScript(widget: Widget, model: Script, scriptText: string, pvs: PV[]): ScriptInstance;
45
- createRule(widget: Widget, model: Rule): void;
46
+ createRule(widget: Widget, model: Rule, pvs: PV[]): void;
47
+ /**
48
+ * Registers a PV listener on behalf of a widget, outside of the
49
+ * rule/script system (e.g. a widget's own intrinsic-value sync, or
50
+ * ArrayWidget's slot write-back). Tracked by owning widget so that
51
+ * removeWidget() can tear it down too, the same as it does for rules and
52
+ * scripts - without this, a widget discarded via LinkingContainer reload
53
+ * (or a TabbedContainer tab switch) leaves a zombie listener behind that
54
+ * keeps reacting to future PV updates.
55
+ */
56
+ trackListener(widget: Widget, pvName: string, listener: PVListener, mayTriggerNow?: boolean): void;
57
+ /**
58
+ * Tears down every rule, script and tracked PV listener belonging to the
59
+ * given widget or any of its descendants (for containers). Used when a
60
+ * subtree is discarded at runtime, e.g. when a LinkingContainer reloads
61
+ * its linked display.
62
+ */
63
+ removeWidget(widget: Widget): void;
46
64
  addProvider(provider: PVProvider): void;
47
65
  addScriptLibrary(name: string, library: any): void;
48
66
  addListener(pvName: string, listener: PVListener, mayTriggerNow?: boolean): void;
@@ -54,6 +72,10 @@ declare class ScriptInstance {
54
72
  readonly text: string;
55
73
  readonly pvs: PV[];
56
74
  scriptEngine: ScriptEngine;
75
+ readonly triggerListeners: {
76
+ pvName: string;
77
+ listener: PVListener;
78
+ }[];
57
79
  constructor(widget: Widget, script: Script, text: string, pvs: PV[]);
58
80
  }
59
81
  export {};
@@ -1,11 +1,11 @@
1
- declare const peg$allowedStartRules: string[];
2
1
  declare class peg$SyntaxError extends SyntaxError {
3
- static buildMessage(expected: any, found: any): string;
4
- constructor(message: any, expected: any, found: any, location: any);
5
2
  expected: any;
6
3
  found: any;
7
4
  location: any;
5
+ constructor(message: any, expected: any, found: any, location: any);
8
6
  format(sources: any): string;
7
+ static buildMessage(expected: any, found: any): string;
9
8
  }
10
9
  declare function peg$parse(input: any, options: any): any;
10
+ declare const peg$allowedStartRules: string[];
11
11
  export { peg$allowedStartRules as StartRules, peg$SyntaxError as SyntaxError, peg$parse as parse };
@@ -1,3 +1,4 @@
1
+ import { Dimension } from "./positioning";
1
2
  export declare class AutoScaleWidgets {
2
3
  /**
3
4
  * If true, ScaleOptions from widgets are applied.
@@ -37,3 +38,24 @@ export declare class ScaleOptions {
37
38
  readonly keepWidthHeightRatio: boolean;
38
39
  constructor(widthScalable: boolean, heightScalable: boolean, keepWidthHeightRatio: boolean);
39
40
  }
41
+ /**
42
+ * Computes a widget's new size given its original (design-time) size and a
43
+ * pair of width/height ratios, honouring its ScaleOptions the same way
44
+ * Java's AbstractWidgetModel#getScaledSize() does: a dimension only changes
45
+ * if its own *Scalable flag is set, and if keepWidthHeightRatio is set (with
46
+ * both dimensions scalable), the smaller of the two ratios is applied to
47
+ * both, deriving one dimension from the other rather than scaling them
48
+ * independently.
49
+ */
50
+ export declare function getScaledSize(originSize: Dimension, widthRatio: number, heightRatio: number, scaleOptions: ScaleOptions): Dimension;
51
+ /**
52
+ * Clamps a pair of auto-scale ratios against ScaleOptions, mirroring
53
+ * AbstractPolyModel#doScale()'s branch structure in the Java reference: if
54
+ * both dimensions are scalable and keepWidthHeightRatio is set, both ratios
55
+ * collapse to the smaller of the two; otherwise a non-scalable dimension's
56
+ * ratio is forced to 1.
57
+ */
58
+ export declare function getScaledRatios(widthRatio: number, heightRatio: number, scaleOptions: ScaleOptions): {
59
+ widthRatio: number;
60
+ heightRatio: number;
61
+ };
@@ -0,0 +1,21 @@
1
+ import { ArrayWidget } from "../widgets/others/ArrayWidget";
2
+ import { WidgetWrapper } from "./WidgetWrapper";
3
+ export declare class ArrayWrapper extends WidgetWrapper {
4
+ private array;
5
+ constructor(array: ArrayWidget);
6
+ getArrayFigure(): {
7
+ getIndex: () => number;
8
+ setIndex: (index: number) => void;
9
+ getArrayLength: () => number;
10
+ };
11
+ getIndex(child: WidgetWrapper): number;
12
+ getArrayLength(): number;
13
+ setArrayLength(length: number): void;
14
+ getDataType(): number;
15
+ setDataType(type: number): void;
16
+ isHorizontal(): boolean;
17
+ isShowSpinner(): boolean;
18
+ isShowScrollbar(): boolean;
19
+ getSpinnerWidth(): number;
20
+ getVisibleElementsCount(): number;
21
+ }
@@ -18,7 +18,7 @@ export declare function createJavaBridge(scriptEngine: ScriptEngine): {
18
18
  }) => void;
19
19
  Thread: {
20
20
  (runnable: any): void;
21
- sleep(delay: number): void;
21
+ sleep: (delay: number) => void;
22
22
  };
23
23
  };
24
24
  util: {
@@ -16,7 +16,7 @@ export declare class PVUtil {
16
16
  getStringArray(pv: PVWrapper): string[];
17
17
  getTimeInMilliseconds(pv: PVWrapper): number;
18
18
  getTimeString(pv: PVWrapper, format?: string): string | null;
19
- getSeverity(pv: PVWrapper): 1 | 2 | 0 | -1;
19
+ getSeverity(pv: PVWrapper): -1 | 0 | 1 | 2;
20
20
  getSeverityString(pv: PVWrapper): string;
21
21
  getStatus(pv: PVWrapper): string;
22
22
  getUnits(pv: PVWrapper): string | null;