@opalkelly/frontpanel-react-components 0.2.1 → 0.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.
- package/LICENSE +1 -1
- package/README.md +4 -8
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/FrontPanel/FrontPanel.props.d.ts +1 -1
- package/dist/cjs/types/components/types.d.ts +1 -1
- package/dist/cjs/types/contexts/FrontPanelContext.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/FrontPanel/FrontPanel.props.d.ts +1 -1
- package/dist/esm/types/components/types.d.ts +1 -1
- package/dist/esm/types/contexts/FrontPanelContext.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +24 -27
- package/src/components/FrontPanel/FrontPanel.props.ts +1 -1
- package/src/components/FrontPanelIndicator/FrontPanelIndicator.tsx +3 -3
- package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.tsx +4 -4
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.stories.tsx +1 -1
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.tsx +4 -4
- package/src/components/FrontPanelPushButton/FrontPanelPushButton.tsx +2 -2
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.stories.tsx +1 -1
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.tsx +2 -2
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntry.stories.tsx +1 -1
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.tsx +3 -3
- package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.tsx +2 -2
- package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.tsx +2 -2
- package/src/components/types.ts +1 -1
- package/src/contexts/FrontPanelContext.ts +1 -1
- package/src/stories/decorators/FrontPanel.decorator.tsx +1 -1
@@ -13,7 +13,7 @@ import FrontPanelIndicatorProps from "./FrontPanelIndicator.props";
|
|
13
13
|
|
14
14
|
import { FrontPanelContext } from "../../contexts";
|
15
15
|
|
16
|
-
import { IFrontPanel } from "@opalkelly/frontpanel-
|
16
|
+
import { IFrontPanel } from "@opalkelly/frontpanel-platform-api";
|
17
17
|
|
18
18
|
type FrontPanelIndicatorElement = React.ElementRef<typeof Indicator>;
|
19
19
|
|
@@ -67,10 +67,10 @@ const FrontPanelIndicator = React.forwardRef<
|
|
67
67
|
React.useEffect(() => {
|
68
68
|
onUpdateWireValue(device);
|
69
69
|
|
70
|
-
const subscription = eventSource?.
|
70
|
+
const subscription = eventSource?.wireOutValuesChangedEvent.subscribe(onUpdateWireValue);
|
71
71
|
|
72
72
|
return () => {
|
73
|
-
subscription?.
|
73
|
+
subscription?.cancel();
|
74
74
|
};
|
75
75
|
}, [device, eventSource, onUpdateWireValue]);
|
76
76
|
|
@@ -17,7 +17,7 @@ import { FrontPanelContext } from "../../contexts";
|
|
17
17
|
|
18
18
|
import { CalculateBitLength } from "../../core";
|
19
19
|
|
20
|
-
import { IFrontPanel, WIREOUT_ADDRESS_RANGE } from "@opalkelly/frontpanel-
|
20
|
+
import { IFrontPanel, WIREOUT_ADDRESS_RANGE } from "@opalkelly/frontpanel-platform-api";
|
21
21
|
|
22
22
|
type FrontPanelNumberDisplayElement = React.ElementRef<typeof NumberDisplay>;
|
23
23
|
|
@@ -81,7 +81,7 @@ const FrontPanelNumberDisplay = React.forwardRef<
|
|
81
81
|
|
82
82
|
for (
|
83
83
|
let sourceWireAddress = fpEndpoint.epAddress + 1;
|
84
|
-
(sourceWireAddress <= WIREOUT_ADDRESS_RANGE.
|
84
|
+
(sourceWireAddress <= WIREOUT_ADDRESS_RANGE.maximum) &&
|
85
85
|
(currentWireSpanBitMask > 0n);
|
86
86
|
sourceWireAddress++
|
87
87
|
) {
|
@@ -108,10 +108,10 @@ const FrontPanelNumberDisplay = React.forwardRef<
|
|
108
108
|
React.useEffect(() => {
|
109
109
|
onUpdateWireValue(device);
|
110
110
|
|
111
|
-
const subscription = eventSource?.
|
111
|
+
const subscription = eventSource?.wireOutValuesChangedEvent.subscribe(onUpdateWireValue);
|
112
112
|
|
113
113
|
return () => {
|
114
|
-
subscription?.
|
114
|
+
subscription?.cancel();
|
115
115
|
};
|
116
116
|
}, [device, eventSource, onUpdateWireValue]);
|
117
117
|
|
@@ -18,7 +18,7 @@ import { FrontPanelContext } from "../../contexts";
|
|
18
18
|
|
19
19
|
import { NumeralSystem } from "../../core";
|
20
20
|
|
21
|
-
import { WireValue } from "@opalkelly/frontpanel-
|
21
|
+
import { WireValue } from "@opalkelly/frontpanel-platform-api";
|
22
22
|
|
23
23
|
// Configure Story metadata
|
24
24
|
const meta = {
|
@@ -17,7 +17,7 @@ import { FrontPanelContext } from "../../contexts";
|
|
17
17
|
|
18
18
|
import { CalculateBitLength } from "../../core";
|
19
19
|
|
20
|
-
import { IFrontPanel, WIREIN_ADDRESS_RANGE } from "@opalkelly/frontpanel-
|
20
|
+
import { IFrontPanel, WIREIN_ADDRESS_RANGE } from "@opalkelly/frontpanel-platform-api";
|
21
21
|
|
22
22
|
type FrontPanelNumberEntryElement = React.ElementRef<typeof NumberEntry>;
|
23
23
|
|
@@ -87,7 +87,7 @@ const FrontPanelNumberEntry = React.forwardRef<
|
|
87
87
|
|
88
88
|
for (
|
89
89
|
let sourceWireAddress = fpEndpoint.epAddress + 1;
|
90
|
-
(sourceWireAddress <= WIREIN_ADDRESS_RANGE.
|
90
|
+
(sourceWireAddress <= WIREIN_ADDRESS_RANGE.maximum) &&
|
91
91
|
(currentWireSpanBitMask > 0n);
|
92
92
|
sourceWireAddress++
|
93
93
|
) {
|
@@ -118,7 +118,7 @@ const FrontPanelNumberEntry = React.forwardRef<
|
|
118
118
|
const onNumberEntryValueChange = React.useCallback(
|
119
119
|
async (value: bigint): Promise<void> => {
|
120
120
|
if ((device != null) && (workQueue != null)) {
|
121
|
-
await workQueue.
|
121
|
+
await workQueue.post(async () => {
|
122
122
|
let targetWireBitMask = targetWireSpanBitMask & 0xffffffffn;
|
123
123
|
let targetWireValue = Number(
|
124
124
|
(value << BigInt(fpEndpoint.bitOffset)) & targetWireBitMask
|
@@ -138,7 +138,7 @@ const FrontPanelNumberEntry = React.forwardRef<
|
|
138
138
|
|
139
139
|
for (
|
140
140
|
let targetWireAddress = fpEndpoint.epAddress + 1;
|
141
|
-
(targetWireAddress <= WIREIN_ADDRESS_RANGE.
|
141
|
+
(targetWireAddress <= WIREIN_ADDRESS_RANGE.maximum) &&
|
142
142
|
(currentWireSpanBitMask > 0n);
|
143
143
|
targetWireAddress++
|
144
144
|
) {
|
@@ -53,7 +53,7 @@ const FrontPanelPushButton = React.forwardRef<
|
|
53
53
|
|
54
54
|
const onButtonUp = React.useCallback(async (): Promise<void> => {
|
55
55
|
if ((device != null) && (workQueue != null)) {
|
56
|
-
await workQueue.
|
56
|
+
await workQueue.post(async () => {
|
57
57
|
device.setWireInValue(fpEndpoint.epAddress, 0, targetWireBitMask);
|
58
58
|
await device.updateWireIns();
|
59
59
|
});
|
@@ -62,7 +62,7 @@ const FrontPanelPushButton = React.forwardRef<
|
|
62
62
|
|
63
63
|
const onButtonDown = React.useCallback(async (): Promise<void> => {
|
64
64
|
if ((device != null) && (workQueue != null)) {
|
65
|
-
await workQueue.
|
65
|
+
await workQueue.post(async () => {
|
66
66
|
device.setWireInValue(fpEndpoint.epAddress, 0xffffffff, targetWireBitMask);
|
67
67
|
await device.updateWireIns();
|
68
68
|
});
|
@@ -16,7 +16,7 @@ import FrontPanelRangeSlider from "./FrontPanelRangeSlider";
|
|
16
16
|
|
17
17
|
import { FrontPanelContext } from "../../contexts";
|
18
18
|
|
19
|
-
import { WireValue } from "@opalkelly/frontpanel-
|
19
|
+
import { WireValue } from "@opalkelly/frontpanel-platform-api";
|
20
20
|
|
21
21
|
// Configure Story metadata
|
22
22
|
const meta = {
|
@@ -15,7 +15,7 @@ import { FrontPanelContext } from "../../contexts";
|
|
15
15
|
|
16
16
|
import { CalculateBitLength } from "../../core";
|
17
17
|
|
18
|
-
import { IFrontPanel } from "@opalkelly/frontpanel-
|
18
|
+
import { IFrontPanel } from "@opalkelly/frontpanel-platform-api";
|
19
19
|
|
20
20
|
type FrontPanelRangeSliderElement = React.ElementRef<typeof RangeSlider>;
|
21
21
|
|
@@ -79,7 +79,7 @@ const FrontPanelRangeSlider = React.forwardRef<
|
|
79
79
|
const onSelectedValueChangeHandler = React.useCallback(
|
80
80
|
(value: number) => {
|
81
81
|
if ((device != null) && (workQueue != null)) {
|
82
|
-
workQueue.
|
82
|
+
workQueue.post(async () => {
|
83
83
|
device.setWireInValue(
|
84
84
|
fpEndpoint.epAddress,
|
85
85
|
value << fpEndpoint.bitOffset,
|
@@ -16,7 +16,7 @@ import FrontPanelSelectEntry from "./FrontPanelSelectEntry";
|
|
16
16
|
|
17
17
|
import { FrontPanelContext } from "../../contexts";
|
18
18
|
|
19
|
-
import { WireValue } from "@opalkelly/frontpanel-
|
19
|
+
import { WireValue } from "@opalkelly/frontpanel-platform-api";
|
20
20
|
|
21
21
|
// Configure Story metadata
|
22
22
|
const meta = {
|
@@ -15,7 +15,7 @@ import { FrontPanelContext } from "../../contexts";
|
|
15
15
|
|
16
16
|
import { CalculateBitLength } from "../../core";
|
17
17
|
|
18
|
-
import { IFrontPanel, WIREIN_ADDRESS_RANGE } from "@opalkelly/frontpanel-
|
18
|
+
import { IFrontPanel, WIREIN_ADDRESS_RANGE } from "@opalkelly/frontpanel-platform-api";
|
19
19
|
|
20
20
|
interface FrontPanelSelectEntryRootCombinedProps
|
21
21
|
extends React.ComponentPropsWithoutRef<typeof SelectEntry.Root>,
|
@@ -82,7 +82,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
82
82
|
|
83
83
|
for (
|
84
84
|
let sourceWireAddress = fpEndpoint.epAddress + 1;
|
85
|
-
(sourceWireAddress <= WIREIN_ADDRESS_RANGE.
|
85
|
+
(sourceWireAddress <= WIREIN_ADDRESS_RANGE.maximum) &&
|
86
86
|
(currentWireSpanBitMask > 0n);
|
87
87
|
sourceWireAddress++
|
88
88
|
) {
|
@@ -110,7 +110,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
|
|
110
110
|
(value: string) => {
|
111
111
|
if ((device != null) && (workQueue != null)) {
|
112
112
|
const targetWireSpanValue = BigInt(value);
|
113
|
-
workQueue.
|
113
|
+
workQueue.post(async () => {
|
114
114
|
let targetWireBitMask = targetWireSpanBitMask & 0xffffffffn;
|
115
115
|
let targetWireValue = Number(
|
116
116
|
(targetWireSpanValue << BigInt(fpEndpoint.bitOffset)) & targetWireBitMask
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import React from "react";
|
9
9
|
|
10
|
-
import { IFrontPanel, WireValue } from "@opalkelly/frontpanel-
|
10
|
+
import { IFrontPanel, WireValue } from "@opalkelly/frontpanel-platform-api";
|
11
11
|
|
12
12
|
import { ToggleState } from "../../core";
|
13
13
|
|
@@ -75,7 +75,7 @@ const FrontPanelToggleSwitch = React.forwardRef<
|
|
75
75
|
const onToggleStateChanged = React.useCallback(
|
76
76
|
async (state: ToggleState): Promise<void> => {
|
77
77
|
if ((device != null) && (workQueue != null)) {
|
78
|
-
await workQueue.
|
78
|
+
await workQueue.post(async () => {
|
79
79
|
// Set the value of the target bit of the Wire endpoint based on the toggle state
|
80
80
|
const targetWireValue: WireValue = state === ToggleState.On ? 0xffffffff : 0;
|
81
81
|
|
@@ -52,8 +52,8 @@ const FrontPanelTriggerButton = React.forwardRef<
|
|
52
52
|
const { fpEndpoint, disabled, ...buttonProps } = props;
|
53
53
|
|
54
54
|
const onButtonDown = React.useCallback(async (): Promise<void> => {
|
55
|
-
if((device != null) && (workQueue != null)) {
|
56
|
-
await workQueue.
|
55
|
+
if ((device != null) && (workQueue != null)) {
|
56
|
+
await workQueue.post(async () => {
|
57
57
|
await device.activateTriggerIn(fpEndpoint.epAddress, fpEndpoint.bitOffset);
|
58
58
|
});
|
59
59
|
}
|
package/src/components/types.ts
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
* See the LICENSE file found in the root directory of this project.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { BitCount } from "@opalkelly/frontpanel-
|
8
|
+
import { BitCount } from "@opalkelly/frontpanel-platform-api";
|
9
9
|
|
10
10
|
export interface EndpointAddressProps {
|
11
11
|
epAddress: number;
|
@@ -11,7 +11,7 @@ import type { Decorator } from "@storybook/react";
|
|
11
11
|
|
12
12
|
import { FrontPanel } from "../../components";
|
13
13
|
|
14
|
-
import { MockFrontPanel, ByteCount } from "@opalkelly/frontpanel-
|
14
|
+
import { MockFrontPanel, ByteCount } from "@opalkelly/frontpanel-platform-api";
|
15
15
|
|
16
16
|
const mockDevice: MockFrontPanel = new MockFrontPanel(32, 32);
|
17
17
|
|