@opalkelly/frontpanel-react-components 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/FrontPanel/FrontPanel.props.d.ts +1 -0
  4. package/dist/cjs/types/components/FrontPanelSelectEntry/FrontPanelSelectEntry.d.ts +1 -0
  5. package/dist/cjs/types/primitives/Application/Application.props.d.ts +1 -0
  6. package/dist/cjs/types/primitives/Label/Label.props.d.ts +1 -0
  7. package/dist/cjs/types/primitives/SelectEntry/SelectEntry.d.ts +1 -0
  8. package/dist/cjs/types/primitives/Toggle/Toggle.props.d.ts +1 -0
  9. package/dist/esm/index.js +1 -1
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/types/components/FrontPanel/FrontPanel.props.d.ts +1 -0
  12. package/dist/esm/types/components/FrontPanelSelectEntry/FrontPanelSelectEntry.d.ts +1 -0
  13. package/dist/esm/types/primitives/Application/Application.props.d.ts +1 -0
  14. package/dist/esm/types/primitives/Label/Label.props.d.ts +1 -0
  15. package/dist/esm/types/primitives/SelectEntry/SelectEntry.d.ts +1 -0
  16. package/dist/esm/types/primitives/Toggle/Toggle.props.d.ts +1 -0
  17. package/dist/index.d.ts +1 -0
  18. package/package.json +3 -5
  19. package/src/components/FrontPanel/FrontPanel.props.ts +5 -1
  20. package/src/components/FrontPanelIndicator/FrontPanelIndicator.tsx +3 -3
  21. package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.tsx +5 -5
  22. package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.tsx +8 -8
  23. package/src/components/FrontPanelPushButton/FrontPanelPushButton.tsx +5 -5
  24. package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.tsx +4 -4
  25. package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.tsx +7 -7
  26. package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.tsx +4 -4
  27. package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.tsx +3 -3
  28. package/src/contexts/FrontPanelContext.ts +5 -1
@@ -52,8 +52,8 @@ const FrontPanelPushButton = React.forwardRef<
52
52
  const targetWireBitMask = 1 << fpEndpoint.bitOffset;
53
53
 
54
54
  const onButtonUp = React.useCallback(async (): Promise<void> => {
55
- if (device != null && workQueue != null) {
56
- await workQueue.Post(async () => {
55
+ if ((device != null) && (workQueue != null)) {
56
+ await workQueue.post(async () => {
57
57
  device.setWireInValue(fpEndpoint.epAddress, 0, targetWireBitMask);
58
58
  await device.updateWireIns();
59
59
  });
@@ -61,8 +61,8 @@ const FrontPanelPushButton = React.forwardRef<
61
61
  }, [device, workQueue, fpEndpoint, targetWireBitMask, workQueue]);
62
62
 
63
63
  const onButtonDown = React.useCallback(async (): Promise<void> => {
64
- if (device != null && workQueue != null) {
65
- await workQueue.Post(async () => {
64
+ if ((device != null) && (workQueue != null)) {
65
+ await workQueue.post(async () => {
66
66
  device.setWireInValue(fpEndpoint.epAddress, 0xffffffff, targetWireBitMask);
67
67
  await device.updateWireIns();
68
68
  });
@@ -73,7 +73,7 @@ const FrontPanelPushButton = React.forwardRef<
73
73
  <Button
74
74
  {...buttonProps}
75
75
  ref={forwardedRef}
76
- disabled={disabled || device == null}
76
+ disabled={disabled || (device == null)}
77
77
  onButtonUp={onButtonUp}
78
78
  onButtonDown={onButtonDown}
79
79
  />
@@ -64,7 +64,7 @@ const FrontPanelRangeSlider = React.forwardRef<
64
64
 
65
65
  const onUpdateWireValue = React.useCallback(
66
66
  (sender?: IFrontPanel): void => {
67
- if (sender != null && workQueue != null) {
67
+ if ((sender != null) && (workQueue != null)) {
68
68
  const sourceWireValue = sender.getWireInValue(fpEndpoint.epAddress);
69
69
  const sourceValue =
70
70
  (BigInt(sourceWireValue) & targetWireBitMask) >> BigInt(fpEndpoint.bitOffset);
@@ -78,8 +78,8 @@ const FrontPanelRangeSlider = React.forwardRef<
78
78
 
79
79
  const onSelectedValueChangeHandler = React.useCallback(
80
80
  (value: number) => {
81
- if (device != null && workQueue != null) {
82
- workQueue.Post(async () => {
81
+ if ((device != null) && (workQueue != null)) {
82
+ workQueue.post(async () => {
83
83
  device.setWireInValue(
84
84
  fpEndpoint.epAddress,
85
85
  value << fpEndpoint.bitOffset,
@@ -100,7 +100,7 @@ const FrontPanelRangeSlider = React.forwardRef<
100
100
  <RangeSlider
101
101
  {...rootProps}
102
102
  ref={forwardedRef}
103
- disabled={disabled || device == null}
103
+ disabled={disabled || (device == null)}
104
104
  defaultValue={Number(value)}
105
105
  maximumValue={maximumValue}
106
106
  onValueChange={onSelectedValueChangeHandler}
@@ -68,7 +68,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
68
68
 
69
69
  const onUpdateWireValue = React.useCallback(
70
70
  (sender?: IFrontPanel): void => {
71
- if (sender != null && workQueue != null) {
71
+ if ((sender != null) && (workQueue != null)) {
72
72
  // Get the wire value for the endpoint
73
73
  let sourceWireValue = sender.getWireInValue(fpEndpoint.epAddress);
74
74
  let targetWireBitMask = targetWireSpanBitMask & 0xffffffffn;
@@ -82,8 +82,8 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
82
82
 
83
83
  for (
84
84
  let sourceWireAddress = fpEndpoint.epAddress + 1;
85
- sourceWireAddress <= WIREIN_ADDRESS_RANGE.Maximum &&
86
- currentWireSpanBitMask > 0n;
85
+ (sourceWireAddress <= WIREIN_ADDRESS_RANGE.maximum) &&
86
+ (currentWireSpanBitMask > 0n);
87
87
  sourceWireAddress++
88
88
  ) {
89
89
  // Get the wire value for the next endpoint
@@ -108,9 +108,9 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
108
108
 
109
109
  const onSelectedValueChangeHandler = React.useCallback(
110
110
  (value: string) => {
111
- if (device != null && workQueue != null) {
111
+ if ((device != null) && (workQueue != null)) {
112
112
  const targetWireSpanValue = BigInt(value);
113
- workQueue.Post(async () => {
113
+ workQueue.post(async () => {
114
114
  let targetWireBitMask = targetWireSpanBitMask & 0xffffffffn;
115
115
  let targetWireValue = Number(
116
116
  (targetWireSpanValue << BigInt(fpEndpoint.bitOffset)) & targetWireBitMask
@@ -132,7 +132,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
132
132
 
133
133
  for (
134
134
  let wireIndex = 1;
135
- wireIndex < maxWireCount && currentWireSpanBitMask > 0n;
135
+ (wireIndex < maxWireCount) && (currentWireSpanBitMask > 0n);
136
136
  wireIndex++
137
137
  ) {
138
138
  targetWireBitMask = currentWireSpanBitMask & 0xffffffffn;
@@ -169,7 +169,7 @@ const FrontPanelSelectEntryRoot: React.FC<FrontPanelSelectEntryRootCombinedProps
169
169
  return (
170
170
  <SelectEntry.Root
171
171
  {...rootProps}
172
- disabled={disabled || device == null}
172
+ disabled={disabled || (device == null)}
173
173
  value={value.toString()}
174
174
  onValueChange={onSelectedValueChangeHandler}
175
175
  />
@@ -59,7 +59,7 @@ const FrontPanelToggleSwitch = React.forwardRef<
59
59
 
60
60
  const onUpdateWireValue = React.useCallback(
61
61
  (sender?: IFrontPanel): void => {
62
- if (sender != null && workQueue != null) {
62
+ if ((sender != null) && (workQueue != null)) {
63
63
  // Set the toggle state based on the value of the target bit of the Wire endpoint
64
64
  const sourceWireValue = sender.getWireInValue(fpEndpoint.epAddress);
65
65
  const sourceBitValue = (sourceWireValue & targetWireBitMask) === targetWireBitMask;
@@ -74,8 +74,8 @@ const FrontPanelToggleSwitch = React.forwardRef<
74
74
 
75
75
  const onToggleStateChanged = React.useCallback(
76
76
  async (state: ToggleState): Promise<void> => {
77
- if (device != null && workQueue != null) {
78
- await workQueue.Post(async () => {
77
+ if ((device != null) && (workQueue != null)) {
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
 
@@ -98,7 +98,7 @@ const FrontPanelToggleSwitch = React.forwardRef<
98
98
  <ToggleSwitch
99
99
  ref={forwardedRef}
100
100
  {...buttonProps}
101
- disabled={disabled || device == null}
101
+ disabled={disabled || (device == null)}
102
102
  state={state}
103
103
  onToggleStateChanged={onToggleStateChanged}
104
104
  />
@@ -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.Post(async () => {
55
+ if ((device != null) && (workQueue != null)) {
56
+ await workQueue.post(async () => {
57
57
  await device.activateTriggerIn(fpEndpoint.epAddress, fpEndpoint.bitOffset);
58
58
  });
59
59
  }
@@ -63,7 +63,7 @@ const FrontPanelTriggerButton = React.forwardRef<
63
63
  <Button
64
64
  {...buttonProps}
65
65
  ref={forwardedRef}
66
- disabled={disabled || device == null}
66
+ disabled={disabled || (device == null)}
67
67
  onButtonDown={onButtonDown}
68
68
  />
69
69
  );
@@ -7,7 +7,11 @@
7
7
 
8
8
  import React from "react";
9
9
 
10
- import { IFrontPanel, IFrontPanelEventSource, WorkQueue } from "@opalkelly/frontpanel-alloy-core";
10
+ import {
11
+ IFrontPanel,
12
+ IFrontPanelEventSource,
13
+ WorkQueue
14
+ } from "@opalkelly/frontpanel-alloy-core";
11
15
 
12
16
  export type FrontPanelContextValue = {
13
17
  device?: IFrontPanel;