@adcops/autocore-react 3.1.1 → 3.3.2
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/additional-docs/react_performance_notes.md +94 -0
- package/dist/components/AutoCoreDevPanel.d.ts.map +1 -1
- package/dist/components/AutoCoreDevPanel.js +1 -1
- package/dist/components/FileList.d.ts.map +1 -1
- package/dist/components/FileList.js +1 -1
- package/dist/components/FileSelect.d.ts.map +1 -1
- package/dist/components/FileSelect.js +1 -1
- package/dist/core/AutoCoreTagContext.d.ts +59 -185
- package/dist/core/AutoCoreTagContext.d.ts.map +1 -1
- package/dist/core/AutoCoreTagContext.js +1 -1
- package/dist/core/AutoCoreTagTypes.d.ts +127 -6
- package/dist/core/AutoCoreTagTypes.d.ts.map +1 -1
- package/dist/core/CoreStreamTypes.d.ts +345 -0
- package/dist/core/CoreStreamTypes.d.ts.map +1 -0
- package/dist/core/CoreStreamTypes.js +1 -0
- package/dist/core/EventEmitterContext.d.ts +91 -473
- package/dist/core/EventEmitterContext.d.ts.map +1 -1
- package/dist/core/EventEmitterContext.js +1 -1
- package/dist/hooks/adsHooks.d.ts.map +1 -1
- package/dist/hooks/adsHooks.js +1 -1
- package/dist/hooks/commandHooks.d.ts +3 -3
- package/dist/hooks/commandHooks.d.ts.map +1 -1
- package/dist/hooks/commandHooks.js +1 -1
- package/dist/hooks/useAutoCoreTag.js +1 -1
- package/dist/hub/CommandMessage.d.ts +18 -9
- package/dist/hub/CommandMessage.d.ts.map +1 -1
- package/dist/hub/CommandMessage.js +1 -1
- package/dist/hub/DebugPanel.d.ts +31 -0
- package/dist/hub/DebugPanel.d.ts.map +1 -0
- package/dist/hub/DebugPanel.js +1 -0
- package/dist/hub/HubBase.d.ts +83 -129
- package/dist/hub/HubBase.d.ts.map +1 -1
- package/dist/hub/HubBase.js +1 -1
- package/dist/hub/HubSimulate.d.ts +41 -8
- package/dist/hub/HubSimulate.d.ts.map +1 -1
- package/dist/hub/HubSimulate.js +1 -1
- package/dist/hub/HubTauri.d.ts +24 -60
- package/dist/hub/HubTauri.d.ts.map +1 -1
- package/dist/hub/HubTauri.js +1 -1
- package/dist/hub/HubWebSocket.d.ts +33 -17
- package/dist/hub/HubWebSocket.d.ts.map +1 -1
- package/dist/hub/HubWebSocket.js +1 -1
- package/dist/hub/debug.d.ts +23 -0
- package/dist/hub/debug.d.ts.map +1 -0
- package/dist/hub/debug.js +1 -0
- package/dist/hub/index.d.ts +19 -4
- package/dist/hub/index.d.ts.map +1 -1
- package/dist/hub/index.js +1 -1
- package/package.json +4 -4
- package/src/components/AutoCoreDevPanel.tsx +14 -11
- package/src/components/FileList.tsx +5 -4
- package/src/components/FileSelect.tsx +2 -1
- package/src/core/ActionMode.ts +1 -1
- package/src/core/AutoCoreTagContext.tsx +247 -330
- package/src/core/AutoCoreTagTypes.ts +236 -104
- package/src/core/CoreStreamTypes.ts +512 -0
- package/src/core/EventEmitterContext.tsx +182 -520
- package/src/core/IndicatorButtonState.ts +1 -1
- package/src/core/hoc.tsx +1 -1
- package/src/hooks/adsHooks.tsx +21 -22
- package/src/hooks/commandHooks.tsx +23 -19
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useAutoCoreTag.ts +2 -2
- package/src/hooks/useScaledValue.tsx +1 -1
- package/src/hub/CommandMessage.ts +71 -19
- package/src/hub/DebugPanel.ts +280 -0
- package/src/hub/HubBase.ts +147 -223
- package/src/hub/HubSimulate.ts +93 -24
- package/src/hub/HubTauri.ts +87 -96
- package/src/hub/HubWebSocket.ts +118 -140
- package/src/hub/debug.ts +211 -0
- package/src/hub/index.ts +49 -39
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -134
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1633
- package/docs/classes/components_CodeEditor.CodeEditor.html +0 -135
- package/docs/classes/components_Indicator.Indicator.html +0 -122
- package/docs/classes/components_IndicatorRect.IndicatorRect.html +0 -121
- package/docs/classes/components_JogPanel.JogPanel.html +0 -136
- package/docs/classes/components_Lamp.Lamp.html +0 -122
- package/docs/classes/components_OskDialog.OskDialog.html +0 -125
- package/docs/classes/components_TextInput.TextInput.html +0 -125
- package/docs/classes/components_ValueDisplay.ValueDisplay.html +0 -148
- package/docs/classes/components_ValueIndicator.ValueIndicator.html +0 -126
- package/docs/classes/core_ValueSimulator.ValueSimulator.html +0 -51
- package/docs/classes/hub_HubBase.HubBase.html +0 -106
- package/docs/classes/hub_HubSimulate.HubSimulate.html +0 -75
- package/docs/classes/hub_HubTauri.HubTauri.html +0 -93
- package/docs/classes/hub_HubWebSocket.HubWebSocket.html +0 -112
- package/docs/documents/core_AutoCoreTagContext.AutoCoreTagContext.html +0 -148
- package/docs/enums/components_JogPanel.JogDistanceAction.html +0 -5
- package/docs/enums/components_JogPanel.JogPanelAction.html +0 -18
- package/docs/enums/components_JogPanel.JogSpeedAction.html +0 -5
- package/docs/enums/core_ActionMode.ActionMode.html +0 -6
- package/docs/enums/core_IndicatorColor.IndicatorColor.html +0 -23
- package/docs/functions/assets.BlocklyLogo.html +0 -1
- package/docs/functions/assets.Distance.html +0 -1
- package/docs/functions/assets.JogLong.html +0 -1
- package/docs/functions/assets.JogMedium.html +0 -1
- package/docs/functions/assets.JogShort.html +0 -1
- package/docs/functions/assets.PythonLogo.html +0 -1
- package/docs/functions/assets.Rotation3D.html +0 -1
- package/docs/functions/assets.RotationCcw.html +0 -1
- package/docs/functions/assets.RotationCcwA.html +0 -1
- package/docs/functions/assets.RotationCcwB.html +0 -1
- package/docs/functions/assets.RotationCcwC.html +0 -1
- package/docs/functions/assets.RotationCw.html +0 -1
- package/docs/functions/assets.RotationCwA.html +0 -1
- package/docs/functions/assets.RotationCwB.html +0 -1
- package/docs/functions/assets.RotationCwC.html +0 -1
- package/docs/functions/assets.Run.html +0 -1
- package/docs/functions/assets.Speed.html +0 -1
- package/docs/functions/assets.SpeedFast.html +0 -1
- package/docs/functions/assets.SpeedMedium.html +0 -1
- package/docs/functions/assets.SpeedNone.html +0 -1
- package/docs/functions/assets.SpeedSlow.html +0 -1
- package/docs/functions/assets.Walk.html +0 -1
- package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +0 -6
- package/docs/functions/core_UniqueId.UniqueId.html +0 -9
- package/docs/functions/core_hoc.hocAddSubscription.html +0 -6
- package/docs/functions/hooks_adsHooks.useAdsRegisterSymbols.html +0 -16
- package/docs/functions/hooks_adsHooks.useAdsTapValue.html +0 -8
- package/docs/functions/hooks_adsHooks.useAdsWriteScaledValue.html +0 -18
- package/docs/functions/hooks_adsHooks.useAdsWriteValue.html +0 -9
- package/docs/functions/hooks_commandHooks.useRegisterSymbols.html +0 -16
- package/docs/functions/hooks_commandHooks.useTapValue.html +0 -10
- package/docs/functions/hooks_commandHooks.useWriteScaledValue.html +0 -18
- package/docs/functions/hooks_commandHooks.useWriteValue.html +0 -11
- package/docs/functions/hooks_useAutoCoreTag.ts.makeAutoCoreTagHooks.html +0 -12
- package/docs/functions/hooks_useScaledValue.useScaledValue.html +0 -18
- package/docs/functions/hub.createHub.html +0 -3
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -148
- package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +0 -654
- package/docs/interfaces/components_IndicatorRect.IndicatorRectProps.html +0 -37
- package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +0 -5
- package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +0 -644
- package/docs/interfaces/core_AutoCoreTagTypes.BaseContextValue.html +0 -12
- package/docs/interfaces/core_AutoCoreTagTypes.ScaleConfig.html +0 -13
- package/docs/interfaces/core_EventEmitterContext.Action.html +0 -8
- package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +0 -33
- package/docs/interfaces/core_EventEmitterContext.State.html +0 -8
- package/docs/interfaces/core_EventEmitterContext.Subscription.html +0 -6
- package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +0 -10
- package/docs/interfaces/core_PositionContext.IPositionContext.html +0 -17
- package/docs/interfaces/hub_CommandMessage.CommandMessage.html +0 -6
- package/docs/interfaces/hub_CommandMessage.CommandMessageResult.html +0 -4
- package/docs/modules/assets.html +0 -1
- package/docs/modules/assets_BlocklyLogo.html +0 -1
- package/docs/modules/assets_Distance.html +0 -1
- package/docs/modules/assets_JogLong.html +0 -1
- package/docs/modules/assets_JogMedium.html +0 -1
- package/docs/modules/assets_JogShort.html +0 -1
- package/docs/modules/assets_PythonLogo.html +0 -1
- package/docs/modules/assets_Rotation3D.html +0 -1
- package/docs/modules/assets_RotationCcw.html +0 -1
- package/docs/modules/assets_RotationCcwA.html +0 -1
- package/docs/modules/assets_RotationCcwB.html +0 -1
- package/docs/modules/assets_RotationCcwC.html +0 -1
- package/docs/modules/assets_RotationCw.html +0 -1
- package/docs/modules/assets_RotationCwA.html +0 -1
- package/docs/modules/assets_RotationCwB.html +0 -1
- package/docs/modules/assets_RotationCwC.html +0 -1
- package/docs/modules/assets_Run.html +0 -1
- package/docs/modules/assets_Speed.html +0 -1
- package/docs/modules/assets_SpeedFast.html +0 -1
- package/docs/modules/assets_SpeedMedium.html +0 -1
- package/docs/modules/assets_SpeedNone.html +0 -1
- package/docs/modules/assets_SpeedSlow.html +0 -1
- package/docs/modules/assets_Walk.html +0 -1
- package/docs/modules/components_AutoCoreDevPanel.html +0 -20
- package/docs/modules/components_BlocklyEditor.html +0 -1
- package/docs/modules/components_CodeEditor.html +0 -1
- package/docs/modules/components_FileList.html +0 -1
- package/docs/modules/components_FileSelect.html +0 -1
- package/docs/modules/components_FitText.html +0 -1
- package/docs/modules/components_Indicator.html +0 -1
- package/docs/modules/components_IndicatorButton.html +0 -1
- package/docs/modules/components_IndicatorRect.html +0 -1
- package/docs/modules/components_JogPanel.html +0 -1
- package/docs/modules/components_Lamp.html +0 -1
- package/docs/modules/components_Osk.html +0 -1
- package/docs/modules/components_OskDialog.html +0 -1
- package/docs/modules/components_ProgressBarWithValue.html +0 -1
- package/docs/modules/components_TextInput.html +0 -1
- package/docs/modules/components_ToggleGroup.html +0 -1
- package/docs/modules/components_ValueDisplay.html +0 -1
- package/docs/modules/components_ValueIndicator.html +0 -1
- package/docs/modules/components_ValueInput.html +0 -1
- package/docs/modules/core_ActionMode.html +0 -1
- package/docs/modules/core_AutoCoreTagContext.html +0 -11
- package/docs/modules/core_AutoCoreTagTypes.html +0 -1
- package/docs/modules/core_EventEmitterContext.html +0 -53
- package/docs/modules/core_IndicatorButtonState.html +0 -1
- package/docs/modules/core_IndicatorColor.html +0 -1
- package/docs/modules/core_MaskPatterns.html +0 -1
- package/docs/modules/core_NumerableTypes.html +0 -1
- package/docs/modules/core_PositionContext.html +0 -1
- package/docs/modules/core_UniqueId.html +0 -1
- package/docs/modules/core_ValueSimulator.html +0 -1
- package/docs/modules/core_hoc.html +0 -1
- package/docs/modules/hooks.html +0 -1
- package/docs/modules/hooks_adsHooks.html +0 -1
- package/docs/modules/hooks_commandHooks.html +0 -1
- package/docs/modules/hooks_useAutoCoreTag.ts.html +0 -52
- package/docs/modules/hooks_useScaledValue.html +0 -1
- package/docs/modules/hub.html +0 -1
- package/docs/modules/hub_CommandMessage.html +0 -1
- package/docs/modules/hub_HubBase.html +0 -1
- package/docs/modules/hub_HubSimulate.html +0 -1
- package/docs/modules/hub_HubTauri.html +0 -1
- package/docs/modules/hub_HubWebSocket.html +0 -1
- package/docs/modules.html +0 -23
- package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +0 -1
- package/docs/types/core_AutoCoreTagTypes.ExtractByTag.html +0 -2
- package/docs/types/core_AutoCoreTagTypes.PrimitiveKind.html +0 -1
- package/docs/types/core_AutoCoreTagTypes.TagConfig.html +0 -16
- package/docs/types/core_AutoCoreTagTypes.TagValueMap.html +0 -1
- package/docs/types/core_AutoCoreTagTypes.TagValueOf.html +0 -1
- package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +0 -3
- package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +0 -3
- package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +0 -3
- package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +0 -4
- package/docs/types/core_hoc.HocAddSubscriptionProps.html +0 -6
- package/docs/variables/components_AutoCoreDevPanel.AutoCoreDevPanel.html +0 -43
- package/docs/variables/components_BlocklyEditor.BlocklyEditor.html +0 -13
- package/docs/variables/components_BlocklyEditor.StandardToolbox.html +0 -1
- package/docs/variables/components_FileList.FileList.html +0 -23
- package/docs/variables/components_FileSelect.FileSelect.html +0 -1
- package/docs/variables/components_FitText.FitText.html +0 -4
- package/docs/variables/components_IndicatorButton.IndicatorButton.html +0 -1
- package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +0 -2
- package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +0 -2
- package/docs/variables/components_Osk.Osk.html +0 -1
- package/docs/variables/components_ProgressBarWithValue.ProgressBarWithValue.html +0 -1
- package/docs/variables/components_ToggleGroup.ToggleGroup.html +0 -1
- package/docs/variables/components_ValueInput.ValueInput.html +0 -4
- package/docs/variables/core_AutoCoreTagContext.AutoCoreTagContext.html +0 -1
- package/docs/variables/core_AutoCoreTagContext.AutoCoreTagProvider.html +0 -7
- package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +0 -64
- package/docs/variables/core_EventEmitterContext.EventEmitterProvider.html +0 -10
- package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +0 -14
- package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +0 -15
- package/docs/variables/core_PositionContext.DimensionsContext.html +0 -6
- package/docs/variables/hooks_useScaledValue.kMillimeters2Inches.html +0 -2
- package/docs/variables/hooks_useScaledValue.kNewtons2Pounds.html +0 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (C) 2025 Automated Design Corp.. All Rights Reserved.
|
|
3
3
|
* Created Date: 2025-09-05 07:57:49
|
|
4
4
|
* -----
|
|
5
|
-
* Last Modified:
|
|
5
|
+
* Last Modified: 2026-01-29 09:31:54
|
|
6
6
|
* -----
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
@@ -22,9 +22,9 @@ export type PrimitiveKind = "boolean" | "number" | "string" | "json";
|
|
|
22
22
|
/** Strict JSON value (mirrors serde_json::Value) */
|
|
23
23
|
type JsonPrimitive = string | number | boolean | null;
|
|
24
24
|
export type JsonValue =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
| JsonPrimitive
|
|
26
|
+
| { [key: string]: JsonValue }
|
|
27
|
+
| JsonValue[];
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Extended client-side value you *may* choose to present in the UI.
|
|
@@ -37,10 +37,10 @@ export type ExtendedJsonValue = JsonValue | Date | Map<string, JsonValue>;
|
|
|
37
37
|
* - "json" becomes ExtendedJsonValue so UIs can work with Date/Map when desired.
|
|
38
38
|
*/
|
|
39
39
|
export type TagValueOf<K extends PrimitiveKind> =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
K extends "boolean" ? boolean :
|
|
41
|
+
K extends "number" ? number :
|
|
42
|
+
K extends "string" ? string :
|
|
43
|
+
ExtendedJsonValue;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Runtime binding for a single tag, as returned by hooks like `useAutoCoreTag`.
|
|
@@ -50,39 +50,147 @@ export type TagValueOf<K extends PrimitiveKind> =
|
|
|
50
50
|
* - `tap` is typically for boolean momentaries (provider may pulse true→false)
|
|
51
51
|
*/
|
|
52
52
|
export type TagBinding<T> = Readonly<{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
/** App-visible value (scaled/decoded). */
|
|
54
|
+
value: T | undefined;
|
|
55
|
+
/** Last raw value from the server (pre-scale, pre-codec). */
|
|
56
|
+
rawValue: unknown | undefined;
|
|
57
|
+
/** Write a new app-visible value (provider will inverse-scale/encode). */
|
|
58
|
+
write: (displayValue: T) => Promise<void>;
|
|
59
|
+
/** Momentary action; typically boolean true→false pulse. */
|
|
60
|
+
tap: () => Promise<void>;
|
|
61
|
+
/** True while initial read/bootstrapping is in progress. */
|
|
62
|
+
isLoading: boolean;
|
|
63
63
|
}>;
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Options that control how subscription updates are delivered to the client.
|
|
67
|
+
*
|
|
68
|
+
* This implements the "hybrid" subscription model where:
|
|
69
|
+
* - **Project configuration** defines limits and defaults (e.g., minimum sampling rate)
|
|
70
|
+
* - **Client requests** can customize within those bounds
|
|
71
|
+
*
|
|
72
|
+
* ## Behavior
|
|
73
|
+
*
|
|
74
|
+
* - `undefined` values mean "use server default"
|
|
75
|
+
* - Client requests are clamped to server limits (can't request faster than hardware supports)
|
|
76
|
+
* - All filtering (deadband, on_change_only) is applied server-side before sending updates
|
|
77
|
+
*
|
|
78
|
+
* @example Basic rate limiting
|
|
79
|
+
* ```typescript
|
|
80
|
+
* {
|
|
81
|
+
* tagName: "fastSensor",
|
|
82
|
+
* domain: "MODBUS",
|
|
83
|
+
* symbolName: "sensor.temperature",
|
|
84
|
+
* valueType: "number",
|
|
85
|
+
* subscriptionOptions: {
|
|
86
|
+
* sampling_interval_ms: 500, // Limit to 2 updates/sec
|
|
87
|
+
* on_change_only: true // Only send when value changes
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example Deadband filtering for noisy signals
|
|
93
|
+
* ```typescript
|
|
94
|
+
* {
|
|
95
|
+
* tagName: "analogInput",
|
|
96
|
+
* domain: "MODBUS",
|
|
97
|
+
* symbolName: "ai.pressure",
|
|
98
|
+
* valueType: "number",
|
|
99
|
+
* subscriptionOptions: {
|
|
100
|
+
* deadband_percent: 1.0 // Ignore changes < 1% of full scale
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export interface SubscriptionOptions {
|
|
106
|
+
/**
|
|
107
|
+
* Minimum interval between updates in milliseconds.
|
|
108
|
+
*
|
|
109
|
+
* The server will not send updates faster than this rate, even if the
|
|
110
|
+
* underlying data changes more frequently. This helps prevent UI overload.
|
|
111
|
+
*
|
|
112
|
+
* - `undefined`: Use server default (typically from project configuration)
|
|
113
|
+
* - If client requests faster than hardware polling rate, gets clamped to hardware rate
|
|
114
|
+
*
|
|
115
|
+
* @example `{ sampling_interval_ms: 100 }` - Max 10 updates/second
|
|
116
|
+
*/
|
|
117
|
+
sampling_interval_ms?: number;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Only send updates when the value changes (vs periodic heartbeat).
|
|
121
|
+
*
|
|
122
|
+
* When `true`, the server only sends updates when the value differs from
|
|
123
|
+
* the last sent value (after applying deadband filtering).
|
|
124
|
+
*
|
|
125
|
+
* When `false` or `undefined`, updates may be sent periodically even if unchanged.
|
|
126
|
+
*/
|
|
127
|
+
on_change_only?: boolean;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Deadband as a percentage of full scale (0.0 to 100.0).
|
|
131
|
+
*
|
|
132
|
+
* Updates are suppressed unless the value changes by at least this
|
|
133
|
+
* percentage of the full scale range. This reduces network traffic
|
|
134
|
+
* for noisy signals.
|
|
135
|
+
*
|
|
136
|
+
* - `deadband_percent: 1.0` means ignore changes less than 1% of full scale
|
|
137
|
+
* - Takes precedence over `deadband_absolute` if both are set
|
|
138
|
+
*
|
|
139
|
+
* @example `{ deadband_percent: 2.5 }` - Ignore changes < 2.5% of range
|
|
140
|
+
*/
|
|
141
|
+
deadband_percent?: number;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Deadband as an absolute value change threshold.
|
|
145
|
+
*
|
|
146
|
+
* Updates are suppressed unless the value changes by at least this
|
|
147
|
+
* absolute amount. Useful when you know the meaningful change threshold.
|
|
148
|
+
*
|
|
149
|
+
* - Only used if `deadband_percent` is not set
|
|
150
|
+
*
|
|
151
|
+
* @example `{ deadband_absolute: 5.0 }` - Ignore changes < 5 units
|
|
152
|
+
*/
|
|
153
|
+
deadband_absolute?: number;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Queue size for buffering updates when the client is slow.
|
|
157
|
+
*
|
|
158
|
+
* If the client can't consume updates fast enough, this many updates
|
|
159
|
+
* are queued before older ones are discarded.
|
|
160
|
+
*
|
|
161
|
+
* - `undefined`: Use server default (typically 1 - latest value only)
|
|
162
|
+
* - Higher values useful for historical trending or burst handling
|
|
163
|
+
*/
|
|
164
|
+
queue_size?: number;
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Custom arguments specific for the specified domain.
|
|
169
|
+
*/
|
|
170
|
+
args?: Record<string, unknown>;
|
|
171
|
+
}
|
|
172
|
+
|
|
65
173
|
/**
|
|
66
174
|
* Configuration for a named scale group.
|
|
67
175
|
* Apply by setting `scale: "<name>"` on numeric tags.
|
|
68
176
|
*/
|
|
69
177
|
export interface ScaleConfig {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
178
|
+
/** Unique name for this scale group (e.g., "position", "load") */
|
|
179
|
+
name: string;
|
|
180
|
+
/** Current scale factor — incoming values ×= scale; outgoing values /= scale */
|
|
181
|
+
scale: number;
|
|
182
|
+
/** Units/label for display (e.g., "mm", "in", "lbs") */
|
|
183
|
+
label: string;
|
|
184
|
+
/** Optional description for debugging/documentation */
|
|
185
|
+
description?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Optional server tag that provides the scale dynamically.
|
|
188
|
+
* (If used, your provider should subscribe and update `scale` when it changes.)
|
|
189
|
+
*/
|
|
190
|
+
serverTag?: {
|
|
191
|
+
domain: string;
|
|
192
|
+
symbolName: string;
|
|
193
|
+
};
|
|
86
194
|
}
|
|
87
195
|
|
|
88
196
|
/**
|
|
@@ -92,10 +200,10 @@ export interface ScaleConfig {
|
|
|
92
200
|
* - Map-like blobs: object ⇄ Map<string, JsonValue>
|
|
93
201
|
*/
|
|
94
202
|
export type TagCodec<TIn = unknown, TOut extends JsonValue = JsonValue> = {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
203
|
+
/** raw JSON (from server) → app-visible value */
|
|
204
|
+
fromServer?: (raw: unknown) => TIn;
|
|
205
|
+
/** app-visible value → pure JSON (to server) */
|
|
206
|
+
toServer?: (value: TIn) => TOut;
|
|
99
207
|
};
|
|
100
208
|
|
|
101
209
|
/**
|
|
@@ -105,42 +213,66 @@ export type TagCodec<TIn = unknown, TOut extends JsonValue = JsonValue> = {
|
|
|
105
213
|
* @typeParam T - Primitive kind for type mapping (boolean/number/string/json)
|
|
106
214
|
*/
|
|
107
215
|
export type TagConfig<
|
|
108
|
-
|
|
109
|
-
|
|
216
|
+
K extends string = string,
|
|
217
|
+
T extends PrimitiveKind = PrimitiveKind
|
|
110
218
|
> = {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
219
|
+
/** Local key used by UI/consumers (unique within your spec) */
|
|
220
|
+
tagName: K;
|
|
221
|
+
|
|
222
|
+
/** Fully-Qualified Domain Name - the complete topic path.
|
|
223
|
+
* Format: "domain.path.to.symbol" (e.g., "ads.plc1.gio.bControlPowerOk", "modbus.holding_registers.5")
|
|
224
|
+
* The first segment is the domain, used for routing to the appropriate servelet.
|
|
225
|
+
*/
|
|
226
|
+
fqdn: string;
|
|
227
|
+
|
|
228
|
+
/** Declared primitive kind for typing and DevPanel rendering */
|
|
229
|
+
valueType: T;
|
|
230
|
+
|
|
231
|
+
/** Optional initial **raw** value before first server update */
|
|
232
|
+
initialValue?: TagValueOf<T>;
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Optional scale group for numeric tags.
|
|
237
|
+
* If present, provider will:
|
|
238
|
+
* - Multiply incoming numbers by the group's `scale`
|
|
239
|
+
* - Divide outgoing numbers by the group's `scale`
|
|
240
|
+
*/
|
|
241
|
+
scale?: string;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Optional codec to present richer UI types while keeping JSON on the wire.
|
|
245
|
+
* Only commonly used with `valueType: "json"`.
|
|
246
|
+
*/
|
|
247
|
+
codec?: TagCodec;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Optional subscription options to control how updates are delivered.
|
|
251
|
+
*
|
|
252
|
+
* These options implement the hybrid subscription model where you can
|
|
253
|
+
* configure rate limiting, deadband filtering, and other delivery options
|
|
254
|
+
* to prevent overwhelming the UI with high-frequency updates.
|
|
255
|
+
*
|
|
256
|
+
* @example Rate limit a fast-updating tag
|
|
257
|
+
* ```typescript
|
|
258
|
+
* {
|
|
259
|
+
* tagName: "position",
|
|
260
|
+
* subscriptionOptions: {
|
|
261
|
+
* sampling_interval_ms: 100, // Max 10 updates/sec
|
|
262
|
+
* on_change_only: true
|
|
263
|
+
* }
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @see SubscriptionOptions for all available options
|
|
268
|
+
*/
|
|
269
|
+
subscriptionOptions?: SubscriptionOptions;
|
|
138
270
|
};
|
|
139
271
|
|
|
140
272
|
/** Extract the tag config for a particular tag name `K` from a `Spec` */
|
|
141
273
|
export type ExtractByTag<
|
|
142
|
-
|
|
143
|
-
|
|
274
|
+
Spec extends readonly TagConfig[],
|
|
275
|
+
K
|
|
144
276
|
> = Extract<Spec[number], { tagName: K }>;
|
|
145
277
|
|
|
146
278
|
/**
|
|
@@ -148,15 +280,15 @@ export type ExtractByTag<
|
|
|
148
280
|
* Use with `as const` specs to preserve literal tag names.
|
|
149
281
|
*/
|
|
150
282
|
export type TagValueMap<Spec extends readonly TagConfig[]> = {
|
|
151
|
-
|
|
283
|
+
[K in Spec[number]["tagName"]]: TagValueOf<ExtractByTag<Spec, K>["valueType"]>;
|
|
152
284
|
};
|
|
153
285
|
|
|
154
286
|
/**
|
|
155
287
|
* Helper: binding type for a specific tag name from a spec.
|
|
156
288
|
*/
|
|
157
289
|
export type BindingOf<
|
|
158
|
-
|
|
159
|
-
|
|
290
|
+
Spec extends readonly TagConfig[],
|
|
291
|
+
K extends Spec[number]["tagName"]
|
|
160
292
|
> = TagBinding<TagValueMap<Spec>[K]>;
|
|
161
293
|
|
|
162
294
|
/**
|
|
@@ -167,36 +299,36 @@ export type BindingOf<
|
|
|
167
299
|
* - Inverse-scale/encode on write(t) before invoking backend
|
|
168
300
|
*/
|
|
169
301
|
export interface BaseContextValue<VMap extends Record<string, any>> {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
302
|
+
/** Current app-visible tag values (already scaled/decoded). */
|
|
303
|
+
values: Partial<VMap>;
|
|
304
|
+
|
|
305
|
+
/** Last raw (controller) values, as received (pre-scale, pre-codec). */
|
|
306
|
+
rawValues: Record<string, unknown>;
|
|
307
|
+
|
|
308
|
+
/** Whether initial reads are pending. */
|
|
309
|
+
isLoading: boolean;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Write a single tag value (app-visible → provider will inverse-scale/encode).
|
|
313
|
+
* Strongly typed by tag name when used with a typed Context.
|
|
314
|
+
*/
|
|
315
|
+
write: <K extends keyof VMap & string>(tagName: K, value: VMap[K]) => Promise<void>;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Trigger a momentary/toggle action for a tag.
|
|
319
|
+
* Typically used for boolean "request" bits.
|
|
320
|
+
*/
|
|
321
|
+
tap: <K extends keyof VMap & string>(tagName: K) => Promise<void>;
|
|
322
|
+
|
|
323
|
+
/** Current scale configurations by name. */
|
|
324
|
+
scales: Record<string, ScaleConfig>;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Update a scale group (factor and label). Providers should recompute affected tags from **raw**.
|
|
328
|
+
*
|
|
329
|
+
* @param scaleName - Name of the scale group (e.g., "position")
|
|
330
|
+
* @param newScale - New scale factor (display = raw * newScale)
|
|
331
|
+
* @param newLabel - New units label (e.g., "inches")
|
|
332
|
+
*/
|
|
333
|
+
updateScale: (scaleName: string, newScale: number, newLabel: string) => Promise<void>;
|
|
202
334
|
}
|