@adcops/autocore-react 3.0.39 → 3.1.1
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/AutoCoreTagContext.md +441 -0
- package/dist/assets/BlocklyLogo.d.ts +1 -0
- package/dist/assets/BlocklyLogo.d.ts.map +1 -0
- package/dist/assets/Distance.d.ts +1 -0
- package/dist/assets/Distance.d.ts.map +1 -0
- package/dist/assets/JogLong.d.ts +1 -0
- package/dist/assets/JogLong.d.ts.map +1 -0
- package/dist/assets/JogMedium.d.ts +1 -0
- package/dist/assets/JogMedium.d.ts.map +1 -0
- package/dist/assets/JogShort.d.ts +1 -0
- package/dist/assets/JogShort.d.ts.map +1 -0
- package/dist/assets/PythonLogo.d.ts +1 -0
- package/dist/assets/PythonLogo.d.ts.map +1 -0
- package/dist/assets/Rotation3D.d.ts +1 -0
- package/dist/assets/Rotation3D.d.ts.map +1 -0
- package/dist/assets/RotationCcw.d.ts +1 -0
- package/dist/assets/RotationCcw.d.ts.map +1 -0
- package/dist/assets/RotationCcwA.d.ts +1 -0
- package/dist/assets/RotationCcwA.d.ts.map +1 -0
- package/dist/assets/RotationCcwB.d.ts +1 -0
- package/dist/assets/RotationCcwB.d.ts.map +1 -0
- package/dist/assets/RotationCcwC.d.ts +1 -0
- package/dist/assets/RotationCcwC.d.ts.map +1 -0
- package/dist/assets/RotationCw.d.ts +1 -0
- package/dist/assets/RotationCw.d.ts.map +1 -0
- package/dist/assets/RotationCwA.d.ts +1 -0
- package/dist/assets/RotationCwA.d.ts.map +1 -0
- package/dist/assets/RotationCwB.d.ts +1 -0
- package/dist/assets/RotationCwB.d.ts.map +1 -0
- package/dist/assets/RotationCwC.d.ts +1 -0
- package/dist/assets/RotationCwC.d.ts.map +1 -0
- package/dist/assets/Run.d.ts +1 -0
- package/dist/assets/Run.d.ts.map +1 -0
- package/dist/assets/Speed.d.ts +1 -0
- package/dist/assets/Speed.d.ts.map +1 -0
- package/dist/assets/SpeedFast.d.ts +1 -0
- package/dist/assets/SpeedFast.d.ts.map +1 -0
- package/dist/assets/SpeedMedium.d.ts +1 -0
- package/dist/assets/SpeedMedium.d.ts.map +1 -0
- package/dist/assets/SpeedNone.d.ts +1 -0
- package/dist/assets/SpeedNone.d.ts.map +1 -0
- package/dist/assets/SpeedSlow.d.ts +1 -0
- package/dist/assets/SpeedSlow.d.ts.map +1 -0
- package/dist/assets/Walk.d.ts +1 -0
- package/dist/assets/Walk.d.ts.map +1 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/components/AutoCoreDevPanel.d.ts +144 -0
- package/dist/components/AutoCoreDevPanel.d.ts.map +1 -0
- package/dist/components/AutoCoreDevPanel.js +1 -0
- package/dist/components/BlocklyEditor.d.ts +1 -0
- package/dist/components/BlocklyEditor.d.ts.map +1 -0
- package/dist/components/BlocklyEditor.js +1 -1
- package/dist/components/CodeEditor.d.ts +2 -1
- package/dist/components/CodeEditor.d.ts.map +1 -0
- package/dist/components/CodeEditor.js +1 -1
- package/dist/components/FileList.d.ts +1 -0
- package/dist/components/FileList.d.ts.map +1 -0
- package/dist/components/FileList.js +1 -1
- package/dist/components/FileSelect.d.ts +1 -0
- package/dist/components/FileSelect.d.ts.map +1 -0
- package/dist/components/FileSelect.js +1 -1
- package/dist/components/FitText.d.ts +1 -0
- package/dist/components/FitText.d.ts.map +1 -0
- package/dist/components/FitText.js +1 -1
- package/dist/components/Indicator.d.ts +2 -1
- package/dist/components/Indicator.d.ts.map +1 -0
- package/dist/components/Indicator.js +1 -1
- package/dist/components/IndicatorButton.d.ts +23 -137
- package/dist/components/IndicatorButton.d.ts.map +1 -0
- package/dist/components/IndicatorButton.js +1 -1
- package/dist/components/IndicatorRect.d.ts +2 -1
- package/dist/components/IndicatorRect.d.ts.map +1 -0
- package/dist/components/JogPanel.d.ts +1 -0
- package/dist/components/JogPanel.d.ts.map +1 -0
- package/dist/components/Lamp.d.ts +2 -1
- package/dist/components/Lamp.d.ts.map +1 -0
- package/dist/components/Lamp.js +1 -1
- package/dist/components/Osk.d.ts +1 -0
- package/dist/components/Osk.d.ts.map +1 -0
- package/dist/components/Osk.js +1 -1
- package/dist/components/OskDialog.d.ts +1 -0
- package/dist/components/OskDialog.d.ts.map +1 -0
- package/dist/components/ProgressBarWithValue.d.ts +1 -0
- package/dist/components/ProgressBarWithValue.d.ts.map +1 -0
- package/dist/components/ProgressBarWithValue.js +1 -1
- package/dist/components/TextInput.d.ts +62 -103
- package/dist/components/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput.js +1 -1
- package/dist/components/ToggleGroup.d.ts +2 -1
- package/dist/components/ToggleGroup.d.ts.map +1 -0
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/ValueDisplay.d.ts +3 -2
- package/dist/components/ValueDisplay.d.ts.map +1 -0
- package/dist/components/ValueDisplay.js +1 -1
- package/dist/components/ValueIndicator.d.ts +2 -1
- package/dist/components/ValueIndicator.d.ts.map +1 -0
- package/dist/components/ValueIndicator.js +1 -1
- package/dist/components/ValueInput.d.ts +2 -1
- package/dist/components/ValueInput.d.ts.map +1 -0
- package/dist/components/ValueInput.js +1 -1
- package/dist/core/ActionMode.d.ts +1 -0
- package/dist/core/ActionMode.d.ts.map +1 -0
- package/dist/core/AutoCoreTagContext.d.ts +224 -0
- package/dist/core/AutoCoreTagContext.d.ts.map +1 -0
- package/dist/core/AutoCoreTagContext.js +1 -0
- package/dist/core/AutoCoreTagTypes.d.ts +162 -0
- package/dist/core/AutoCoreTagTypes.d.ts.map +1 -0
- package/dist/core/AutoCoreTagTypes.js +1 -0
- package/dist/core/EventEmitterContext.d.ts +295 -2
- package/dist/core/EventEmitterContext.d.ts.map +1 -0
- package/dist/core/EventEmitterContext.js +1 -1
- package/dist/core/IndicatorButtonState.d.ts +1 -0
- package/dist/core/IndicatorButtonState.d.ts.map +1 -0
- package/dist/core/IndicatorColor.d.ts +1 -0
- package/dist/core/IndicatorColor.d.ts.map +1 -0
- package/dist/core/MaskPatterns.d.ts +1 -0
- package/dist/core/MaskPatterns.d.ts.map +1 -0
- package/dist/core/NumerableTypes.d.ts +1 -0
- package/dist/core/NumerableTypes.d.ts.map +1 -0
- package/dist/core/NumerableTypes.js +1 -1
- package/dist/core/PositionContext.d.ts +1 -1
- package/dist/core/PositionContext.d.ts.map +1 -0
- package/dist/core/UniqueId.d.ts +1 -0
- package/dist/core/UniqueId.d.ts.map +1 -0
- package/dist/core/ValueSimulator.d.ts +2 -1
- package/dist/core/ValueSimulator.d.ts.map +1 -0
- package/dist/core/ValueSimulator.js +1 -1
- package/dist/core/hoc.d.ts +1 -0
- package/dist/core/hoc.d.ts.map +1 -0
- package/dist/core/hoc.js +1 -1
- package/dist/hooks/adsHooks.d.ts +1 -0
- package/dist/hooks/adsHooks.d.ts.map +1 -0
- package/dist/hooks/adsHooks.js +1 -1
- package/dist/hooks/commandHooks.d.ts +1 -0
- package/dist/hooks/commandHooks.d.ts.map +1 -0
- package/dist/hooks/commandHooks.js +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useAutoCoreTag.d.ts +26 -0
- package/dist/hooks/useAutoCoreTag.d.ts.map +1 -0
- package/dist/hooks/useAutoCoreTag.js +1 -0
- package/dist/hooks/useScaledValue.d.ts +1 -0
- package/dist/hooks/useScaledValue.d.ts.map +1 -0
- package/dist/hooks/useScaledValue.js +1 -1
- package/dist/hub/CommandMessage.d.ts +1 -0
- package/dist/hub/CommandMessage.d.ts.map +1 -0
- package/dist/hub/HubBase.d.ts +3 -2
- package/dist/hub/HubBase.d.ts.map +1 -0
- package/dist/hub/HubSimulate.d.ts +2 -1
- package/dist/hub/HubSimulate.d.ts.map +1 -0
- package/dist/hub/HubSimulate.js +1 -1
- package/dist/hub/HubTauri.d.ts +2 -1
- package/dist/hub/HubTauri.d.ts.map +1 -0
- package/dist/hub/HubTauri.js +1 -1
- package/dist/hub/HubWebSocket.d.ts +2 -1
- package/dist/hub/HubWebSocket.d.ts.map +1 -0
- package/dist/hub/HubWebSocket.js +1 -1
- package/dist/hub/index.d.ts +2 -1
- package/dist/hub/index.d.ts.map +1 -0
- package/dist/hub/index.js +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/components_CodeEditor.CodeEditor.html +108 -101
- package/docs/classes/components_Indicator.Indicator.html +122 -0
- package/docs/classes/components_IndicatorRect.IndicatorRect.html +121 -0
- package/docs/classes/components_JogPanel.JogPanel.html +104 -106
- package/docs/classes/components_Lamp.Lamp.html +96 -79
- package/docs/classes/components_OskDialog.OskDialog.html +125 -0
- package/docs/classes/components_TextInput.TextInput.html +99 -89
- package/docs/classes/components_ValueDisplay.ValueDisplay.html +148 -0
- package/docs/classes/components_ValueIndicator.ValueIndicator.html +98 -91
- package/docs/classes/core_ValueSimulator.ValueSimulator.html +51 -0
- package/docs/classes/hub_HubBase.HubBase.html +106 -0
- package/docs/classes/hub_HubSimulate.HubSimulate.html +75 -0
- package/docs/classes/hub_HubTauri.HubTauri.html +93 -0
- package/docs/classes/hub_HubWebSocket.HubWebSocket.html +75 -69
- package/docs/documents/core_AutoCoreTagContext.AutoCoreTagContext.html +148 -0
- package/docs/enums/components_JogPanel.JogDistanceAction.html +5 -5
- package/docs/enums/components_JogPanel.JogPanelAction.html +18 -18
- package/docs/enums/components_JogPanel.JogSpeedAction.html +5 -5
- package/docs/enums/core_ActionMode.ActionMode.html +6 -6
- package/docs/enums/core_IndicatorColor.IndicatorColor.html +22 -22
- package/docs/functions/assets.BlocklyLogo.html +1 -0
- package/docs/functions/assets.Distance.html +1 -0
- package/docs/functions/assets.JogLong.html +1 -0
- package/docs/functions/assets.JogMedium.html +1 -0
- package/docs/functions/assets.JogShort.html +1 -0
- package/docs/functions/assets.PythonLogo.html +1 -0
- package/docs/functions/assets.Rotation3D.html +1 -0
- package/docs/functions/assets.RotationCcw.html +1 -0
- package/docs/functions/assets.RotationCcwA.html +1 -0
- package/docs/functions/assets.RotationCcwB.html +1 -0
- package/docs/functions/assets.RotationCcwC.html +1 -0
- package/docs/functions/assets.RotationCw.html +1 -0
- package/docs/functions/assets.RotationCwA.html +1 -0
- package/docs/functions/assets.RotationCwB.html +1 -0
- package/docs/functions/assets.RotationCwC.html +1 -0
- package/docs/functions/assets.Run.html +1 -0
- package/docs/functions/assets.Speed.html +1 -0
- package/docs/functions/assets.SpeedFast.html +1 -0
- package/docs/functions/assets.SpeedMedium.html +1 -0
- package/docs/functions/assets.SpeedNone.html +1 -0
- package/docs/functions/assets.SpeedSlow.html +1 -0
- package/docs/functions/assets.Walk.html +1 -0
- package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +5 -5
- package/docs/functions/core_UniqueId.UniqueId.html +9 -0
- package/docs/functions/core_hoc.hocAddSubscription.html +6 -0
- package/docs/functions/hooks_adsHooks.useAdsRegisterSymbols.html +16 -0
- package/docs/functions/hooks_adsHooks.useAdsTapValue.html +8 -0
- package/docs/functions/hooks_adsHooks.useAdsWriteScaledValue.html +18 -0
- package/docs/functions/hooks_adsHooks.useAdsWriteValue.html +9 -0
- package/docs/functions/hooks_commandHooks.useRegisterSymbols.html +16 -0
- package/docs/functions/hooks_commandHooks.useTapValue.html +10 -0
- package/docs/functions/hooks_commandHooks.useWriteScaledValue.html +18 -0
- package/docs/functions/hooks_commandHooks.useWriteValue.html +11 -0
- package/docs/functions/hooks_useAutoCoreTag.ts.makeAutoCoreTagHooks.html +12 -0
- package/docs/functions/hooks_useScaledValue.useScaledValue.html +18 -0
- package/docs/functions/hub.createHub.html +3 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +148 -0
- package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +654 -0
- package/docs/interfaces/components_IndicatorRect.IndicatorRectProps.html +37 -0
- package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +5 -5
- package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +545 -519
- package/docs/interfaces/core_AutoCoreTagTypes.BaseContextValue.html +12 -0
- package/docs/interfaces/core_AutoCoreTagTypes.ScaleConfig.html +13 -0
- package/docs/interfaces/core_EventEmitterContext.Action.html +8 -0
- package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +33 -0
- package/docs/interfaces/core_EventEmitterContext.State.html +8 -0
- package/docs/interfaces/core_EventEmitterContext.Subscription.html +6 -0
- package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +10 -10
- package/docs/interfaces/core_PositionContext.IPositionContext.html +17 -0
- package/docs/interfaces/hub_CommandMessage.CommandMessage.html +6 -6
- package/docs/interfaces/hub_CommandMessage.CommandMessageResult.html +4 -4
- package/docs/modules/assets.html +1 -23
- package/docs/modules/assets_BlocklyLogo.html +1 -2
- package/docs/modules/assets_Distance.html +1 -2
- package/docs/modules/assets_JogLong.html +1 -2
- package/docs/modules/assets_JogMedium.html +1 -2
- package/docs/modules/assets_JogShort.html +1 -2
- package/docs/modules/assets_PythonLogo.html +1 -2
- package/docs/modules/assets_Rotation3D.html +1 -2
- package/docs/modules/assets_RotationCcw.html +1 -2
- package/docs/modules/assets_RotationCcwA.html +1 -2
- package/docs/modules/assets_RotationCcwB.html +1 -2
- package/docs/modules/assets_RotationCcwC.html +1 -2
- package/docs/modules/assets_RotationCw.html +1 -2
- package/docs/modules/assets_RotationCwA.html +1 -2
- package/docs/modules/assets_RotationCwB.html +1 -2
- package/docs/modules/assets_RotationCwC.html +1 -2
- package/docs/modules/assets_Run.html +1 -2
- package/docs/modules/assets_Speed.html +1 -2
- package/docs/modules/assets_SpeedFast.html +1 -2
- package/docs/modules/assets_SpeedMedium.html +1 -2
- package/docs/modules/assets_SpeedNone.html +1 -2
- package/docs/modules/assets_SpeedSlow.html +1 -2
- package/docs/modules/assets_Walk.html +1 -2
- package/docs/modules/components_AutoCoreDevPanel.html +20 -0
- package/docs/modules/components_BlocklyEditor.html +1 -5
- package/docs/modules/components_CodeEditor.html +1 -3
- package/docs/modules/components_FileList.html +1 -3
- package/docs/modules/components_FileSelect.html +1 -0
- package/docs/modules/components_FitText.html +1 -3
- package/docs/modules/components_Indicator.html +1 -0
- package/docs/modules/components_IndicatorButton.html +1 -0
- package/docs/modules/components_IndicatorRect.html +1 -0
- package/docs/modules/components_JogPanel.html +1 -9
- package/docs/modules/components_Lamp.html +1 -4
- package/docs/modules/components_Osk.html +1 -0
- package/docs/modules/components_OskDialog.html +1 -0
- package/docs/modules/components_ProgressBarWithValue.html +1 -0
- package/docs/modules/components_TextInput.html +1 -2
- package/docs/modules/components_ToggleGroup.html +1 -6
- package/docs/modules/components_ValueDisplay.html +1 -0
- package/docs/modules/components_ValueIndicator.html +1 -4
- package/docs/modules/components_ValueInput.html +1 -2
- package/docs/modules/core_ActionMode.html +1 -2
- package/docs/modules/core_AutoCoreTagContext.html +11 -0
- package/docs/modules/core_AutoCoreTagTypes.html +1 -0
- package/docs/modules/core_EventEmitterContext.html +53 -0
- package/docs/modules/core_IndicatorButtonState.html +1 -2
- package/docs/modules/core_IndicatorColor.html +1 -2
- package/docs/modules/core_MaskPatterns.html +1 -0
- package/docs/modules/core_NumerableTypes.html +1 -0
- package/docs/modules/core_PositionContext.html +1 -0
- package/docs/modules/core_UniqueId.html +1 -0
- package/docs/modules/core_ValueSimulator.html +1 -0
- package/docs/modules/core_hoc.html +1 -0
- package/docs/modules/hooks.html +1 -0
- package/docs/modules/hooks_adsHooks.html +1 -0
- package/docs/modules/hooks_commandHooks.html +1 -0
- package/docs/modules/hooks_useAutoCoreTag.ts.html +52 -0
- package/docs/modules/hooks_useScaledValue.html +1 -0
- package/docs/modules/hub.html +1 -0
- package/docs/modules/hub_CommandMessage.html +1 -3
- package/docs/modules/hub_HubBase.html +1 -0
- package/docs/modules/hub_HubSimulate.html +1 -0
- package/docs/modules/hub_HubTauri.html +1 -0
- package/docs/modules/hub_HubWebSocket.html +1 -2
- package/docs/modules.html +23 -0
- package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +1 -1
- package/docs/types/core_AutoCoreTagTypes.ExtractByTag.html +2 -0
- package/docs/types/core_AutoCoreTagTypes.PrimitiveKind.html +1 -0
- package/docs/types/core_AutoCoreTagTypes.TagConfig.html +16 -0
- package/docs/types/core_AutoCoreTagTypes.TagValueMap.html +1 -0
- package/docs/types/core_AutoCoreTagTypes.TagValueOf.html +1 -0
- package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +3 -0
- package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +3 -0
- package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +3 -0
- package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +4 -0
- package/docs/types/core_hoc.HocAddSubscriptionProps.html +6 -0
- package/docs/variables/components_AutoCoreDevPanel.AutoCoreDevPanel.html +43 -0
- package/docs/variables/components_BlocklyEditor.BlocklyEditor.html +13 -0
- package/docs/variables/components_BlocklyEditor.StandardToolbox.html +1 -1
- package/docs/variables/components_FileList.FileList.html +23 -0
- package/docs/variables/components_FileSelect.FileSelect.html +1 -0
- package/docs/variables/components_FitText.FitText.html +4 -0
- package/docs/variables/components_IndicatorButton.IndicatorButton.html +1 -0
- package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +2 -2
- package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +2 -2
- package/docs/variables/components_Osk.Osk.html +1 -0
- package/docs/variables/components_ProgressBarWithValue.ProgressBarWithValue.html +1 -0
- package/docs/variables/components_ToggleGroup.ToggleGroup.html +1 -0
- package/docs/variables/components_ValueInput.ValueInput.html +4 -0
- package/docs/variables/core_AutoCoreTagContext.AutoCoreTagContext.html +1 -0
- package/docs/variables/core_AutoCoreTagContext.AutoCoreTagProvider.html +7 -0
- package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +64 -0
- package/docs/variables/core_EventEmitterContext.EventEmitterProvider.html +10 -0
- package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +14 -0
- package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +15 -0
- package/docs/variables/core_PositionContext.DimensionsContext.html +6 -0
- package/docs/variables/hooks_useScaledValue.kMillimeters2Inches.html +2 -0
- package/docs/variables/hooks_useScaledValue.kNewtons2Pounds.html +2 -0
- package/package.json +32 -27
- package/readme.md +193 -22
- package/src/components/AutoCoreDevPanel.tsx +411 -0
- package/src/components/CodeEditor.tsx +2 -2
- package/src/components/FileList.tsx +2 -2
- package/src/components/Indicator.tsx +2 -2
- package/src/components/IndicatorButton.tsx +187 -333
- package/src/components/IndicatorRect.tsx +2 -2
- package/src/components/Lamp.tsx +3 -3
- package/src/components/TextInput.tsx +159 -240
- package/src/components/ToggleGroup.tsx +3 -3
- package/src/components/ValueDisplay.tsx +4 -4
- package/src/components/ValueIndicator.tsx +2 -2
- package/src/components/ValueInput.tsx +2 -2
- package/src/core/AutoCoreTagContext.tsx +698 -0
- package/src/core/AutoCoreTagTypes.ts +202 -0
- package/src/core/EventEmitterContext.tsx +582 -225
- package/src/core/ValueSimulator.ts +2 -2
- package/src/hooks/useAutoCoreTag.ts +103 -0
- package/src/hub/HubBase.ts +3 -3
- package/src/hub/HubSimulate.ts +2 -2
- package/src/hub/HubTauri.ts +3 -3
- package/src/hub/HubWebSocket.ts +29 -32
- package/src/hub/index.ts +2 -2
- package/tsconfig.json +43 -28
- package/docs/classes/components_BlocklyEditor.BlocklyEditor.html +0 -124
- package/docs/classes/components_ValueInput.ValueInput.html +0 -113
- package/docs/functions/assets_BlocklyLogo.default.html +0 -1
- package/docs/functions/assets_Distance.default.html +0 -1
- package/docs/functions/assets_JogLong.default.html +0 -1
- package/docs/functions/assets_JogMedium.default.html +0 -1
- package/docs/functions/assets_JogShort.default.html +0 -1
- package/docs/functions/assets_PythonLogo.default.html +0 -1
- package/docs/functions/assets_Rotation3D.default.html +0 -1
- package/docs/functions/assets_RotationCcw.default.html +0 -1
- package/docs/functions/assets_RotationCcwA.default.html +0 -1
- package/docs/functions/assets_RotationCcwB.default.html +0 -1
- package/docs/functions/assets_RotationCcwC.default.html +0 -1
- package/docs/functions/assets_RotationCw.default.html +0 -1
- package/docs/functions/assets_RotationCwA.default.html +0 -1
- package/docs/functions/assets_RotationCwB.default.html +0 -1
- package/docs/functions/assets_RotationCwC.default.html +0 -1
- package/docs/functions/assets_Run.default.html +0 -1
- package/docs/functions/assets_Speed.default.html +0 -1
- package/docs/functions/assets_SpeedFast.default.html +0 -1
- package/docs/functions/assets_SpeedMedium.default.html +0 -1
- package/docs/functions/assets_SpeedNone.default.html +0 -1
- package/docs/functions/assets_SpeedSlow.default.html +0 -1
- package/docs/functions/assets_Walk.default.html +0 -1
- package/docs/functions/components_FileList.FileList.html +0 -21
- package/docs/functions/components_FitText.FitText.html +0 -8
- package/docs/functions/components_ToggleGroup.ToggleGroup.html +0 -5
package/readme.md
CHANGED
|
@@ -15,26 +15,202 @@ PrimeReact to supply almost all but the most obscure controls, and adds a wrappe
|
|
|
15
15
|
signals from the backend to the common controls. This allows autocore-react to focus on the additional
|
|
16
16
|
features needed for machine-control user interfaces, while PrimeReact excels at development of components.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Installation
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
communicate with a backed. The Hub abstracts this by defining a common base class, then automatically
|
|
22
|
-
selecting the proper pipeline based upon the environment. If the Tauri environment is detected, HubTauri
|
|
23
|
-
is loaded. For a browser instance, a socket.io connection is used. When running in a development environment,
|
|
24
|
-
a simulated backend that simply echoes responses is used.
|
|
20
|
+
Install from NPM.
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
```
|
|
23
|
+
npm install --save @adcops/autocore-react
|
|
24
|
+
```
|
|
28
25
|
|
|
26
|
+
## Quick Start
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
### 1. Define Your Tags
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
Create `AutoCoreTags.ts` to define all the tags your application will use:
|
|
33
31
|
|
|
32
|
+
```typescript
|
|
33
|
+
import type { TagConfig } from "@adcops/autocore-react/core/AutoCoreTagTypes";
|
|
34
|
+
|
|
35
|
+
export const acTagSpec = [
|
|
36
|
+
{ "tagName": "isControlPowerOk", "domain": "ADS", "symbolName": "GIO.xbControlPowerOk", "valueType": "boolean" },
|
|
37
|
+
{ "tagName": "motorSpeed", "domain": "ADS", "symbolName": "MAIN.ctx.motor.fSpeed", "valueType": "number" },
|
|
38
|
+
{ "tagName": "isAutoCycleRunning", "domain": "ADS", "symbolName": "MAIN.ctx.gm.bAutoCycleRunning", "valueType": "boolean" },
|
|
39
|
+
{ "tagName": "positionScalar", "domain": "MEMORYSTORE", "symbolName": "position_scalar", "valueType": "number", "initialValue": 1.0 }
|
|
40
|
+
] as const satisfies readonly TagConfig[];
|
|
41
|
+
|
|
42
|
+
export default acTagSpec;
|
|
34
43
|
```
|
|
35
|
-
|
|
44
|
+
|
|
45
|
+
### 2. Create Typed Hooks
|
|
46
|
+
|
|
47
|
+
Create `AutoCore.ts` to generate strongly-typed hooks:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { acTagSpec } from "./AutoCoreTags";
|
|
51
|
+
import { AutoCoreTagContext } from "@adcops/autocore-react/core/AutoCoreTagContext";
|
|
52
|
+
import { makeAutoCoreTagHooks } from "@adcops/autocore-react/hooks/useAutoCoreTag";
|
|
53
|
+
|
|
54
|
+
export const AutoCoreHooks = makeAutoCoreTagHooks(AutoCoreTagContext, acTagSpec);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#### Define Scales (Optional)
|
|
59
|
+
For applications that need unit conversion, create `AutoCoreScales.ts` with server-driven scaling:
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { ScaleConfig } from "@adcops/autocore-react/core/AutoCoreTagTypes";
|
|
64
|
+
|
|
65
|
+
export const acScales = {
|
|
66
|
+
position: {
|
|
67
|
+
name: "position",
|
|
68
|
+
scale: 1.0,
|
|
69
|
+
label: "mm",
|
|
70
|
+
serverTag: { domain: "GNV", symbolName: "position_scalar" }
|
|
71
|
+
},
|
|
72
|
+
load: {
|
|
73
|
+
name: "load",
|
|
74
|
+
scale: 1.0,
|
|
75
|
+
label: "N",
|
|
76
|
+
serverTag: { domain: "GNV", symbolName: "load_scalar" }
|
|
77
|
+
}
|
|
78
|
+
} as const satisfies Record<string, ScaleConfig>;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Note: Server tags now store both scale factor and label as a JSON object: `{ scale: 1.0, label: "mm" }`. Legacy numeric-only values are supported for backward compatibility.
|
|
82
|
+
|
|
83
|
+
Next, reference scales in your tag definitions.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// In AutoCoreTags.ts - add scale property to numeric tags
|
|
87
|
+
{ "tagName": "pressPosition", "domain": "ADS", "symbolName": "MAIN.ctx.gm.fPressPosition", "valueType": "number", "scale": "position" },
|
|
88
|
+
{ "tagName": "pressLoad", "domain": "ADS", "symbolName": "MAIN.ctx.gm.fPressLoad", "valueType": "number", "scale": "load" }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3. Wrap Your App
|
|
92
|
+
|
|
93
|
+
Update your `App.tsx` to provide the contexts:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import React from 'react';
|
|
97
|
+
import { PrimeReactProvider } from 'primereact/api';
|
|
98
|
+
import { EventEmitterProvider } from "@adcops/autocore-react/core/EventEmitterContext";
|
|
99
|
+
import { AutoCoreTagProvider } from "@adcops/autocore-react/core/AutoCoreTagContext";
|
|
100
|
+
import { acTagSpec } from "./AutoCoreTags";
|
|
101
|
+
import { acScales } from "./AutoCoreScales";
|
|
102
|
+
|
|
103
|
+
function App() {
|
|
104
|
+
return (
|
|
105
|
+
<EventEmitterProvider>
|
|
106
|
+
<PrimeReactProvider>
|
|
107
|
+
<AutoCoreTagProvider tags={acTagSpec} scales={acScales} eagerRead>
|
|
108
|
+
<div className="app-wrapper">
|
|
109
|
+
<main className="main-wrapper">
|
|
110
|
+
<YourMainContent />
|
|
111
|
+
</main>
|
|
112
|
+
</div>
|
|
113
|
+
</AutoCoreTagProvider>
|
|
114
|
+
</PrimeReactProvider>
|
|
115
|
+
</EventEmitterProvider>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default App;
|
|
36
120
|
```
|
|
37
121
|
|
|
122
|
+
### 4. Use Tags in Components
|
|
123
|
+
|
|
124
|
+
Import your typed hooks and use them in any component:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import React from 'react';
|
|
128
|
+
import { Button } from 'primereact/button';
|
|
129
|
+
import { AutoCoreHooks } from './AutoCore';
|
|
130
|
+
|
|
131
|
+
export const ControlPanel: React.FC = () => {
|
|
132
|
+
// Single tag access
|
|
133
|
+
const { value: powerOk, write: setPowerOk } = AutoCoreHooks.useAutoCoreTag("isControlPowerOk");
|
|
134
|
+
const { value: motorSpeed, write: setMotorSpeed } = AutoCoreHooks.useAutoCoreTag("motorSpeed");
|
|
135
|
+
|
|
136
|
+
// Multiple tag access
|
|
137
|
+
const { values } = AutoCoreHooks.useAutoCoreTags(["isControlPowerOk", "isAutoCycleRunning"]);
|
|
138
|
+
|
|
139
|
+
// Computed state
|
|
140
|
+
const { selected: canStart } = AutoCoreHooks.useAutoCoreSelect(v =>
|
|
141
|
+
!!v["isControlPowerOk"] && !v["isAutoCycleRunning"]
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div>
|
|
146
|
+
<div>Power OK: {powerOk ? "Yes" : "No"}</div>
|
|
147
|
+
<div>Motor Speed: {motorSpeed} RPM</div>
|
|
148
|
+
|
|
149
|
+
<Button
|
|
150
|
+
label="Start Motor"
|
|
151
|
+
disabled={!canStart}
|
|
152
|
+
onClick={() => setMotorSpeed(1000)}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<Button
|
|
156
|
+
label="Emergency Stop"
|
|
157
|
+
severity="danger"
|
|
158
|
+
onClick={() => setPowerOk(false)}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 5. Development Panel (Optional)
|
|
166
|
+
|
|
167
|
+
Add a debugging panel for development:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
|
|
171
|
+
import { acTagSpec } from "./AutoCoreTags";
|
|
172
|
+
|
|
173
|
+
// In your App component:
|
|
174
|
+
{process.env.NODE_ENV === 'development' && (
|
|
175
|
+
<AutoCoreDevPanel
|
|
176
|
+
tags={acTagSpec}
|
|
177
|
+
className="fixed bottom-4 right-4 bg-white shadow-lg"
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## AutoCoreTagContext Features
|
|
183
|
+
|
|
184
|
+
- **Strongly-typed**: Full TypeScript support with IntelliSense for tag names and value types
|
|
185
|
+
- **Global state**: Share tag values across your entire application
|
|
186
|
+
- **Real-time updates**: Automatic subscription to server data changes
|
|
187
|
+
- **No optimistic updates**: UI always reflects true server state
|
|
188
|
+
- **Error handling**: Proper async/await patterns with error feedback
|
|
189
|
+
- **Development tools**: Built-in debugging panel for testing
|
|
190
|
+
|
|
191
|
+
## Architecture
|
|
192
|
+
|
|
193
|
+
### Hub (Internal)
|
|
194
|
+
|
|
195
|
+
The Hub is an internal abstraction that handles communication with the backend. It automatically
|
|
196
|
+
selects the proper pipeline based on the environment: HubTauri for Tauri applications, socket.io
|
|
197
|
+
for browser instances, and a simulated backend for development environments.
|
|
198
|
+
|
|
199
|
+
**Important**: Applications should not interact with the Hub directly. Instead, use the higher-level
|
|
200
|
+
abstractions described below.
|
|
201
|
+
|
|
202
|
+
### EventEmitterContext
|
|
203
|
+
|
|
204
|
+
The EventEmitterContext provides a global event system for component communication and backend
|
|
205
|
+
interaction through `invoke()`, `subscribe()`, and `dispatch()` methods. This is automatically
|
|
206
|
+
available when you wrap your app with `<EventEmitterProvider>`.
|
|
207
|
+
|
|
208
|
+
### AutoCoreTagContext (Recommended)
|
|
209
|
+
|
|
210
|
+
For most backend data interactions, use the AutoCoreTagContext system with strongly-typed hooks.
|
|
211
|
+
This provides the cleanest, most maintainable approach for managing server state in your components.
|
|
212
|
+
See the Quick Start section above for setup and usage.
|
|
213
|
+
|
|
38
214
|
## Development
|
|
39
215
|
|
|
40
216
|
We typically have an external Tauri project designed to import and test the autocore-react library. We find that
|
|
@@ -56,14 +232,12 @@ npm publish --tag staging --access=public
|
|
|
56
232
|
|
|
57
233
|
Note that we have to specify that the access is public because the tag makes this "scoped," which are private by default.
|
|
58
234
|
|
|
59
|
-
|
|
60
235
|
In the test project, simply install the 'staging' tag version.
|
|
61
236
|
|
|
62
237
|
```
|
|
63
238
|
npm install @adcops/autocore-react@staging
|
|
64
239
|
```
|
|
65
240
|
|
|
66
|
-
|
|
67
241
|
### npm link
|
|
68
242
|
|
|
69
243
|
In the root of the autocore-react project, initiate npm link:
|
|
@@ -131,10 +305,6 @@ overwrite existing .tsx files. If you need to update a pre-existing .tsx file, d
|
|
|
131
305
|
Possible options for SVGR:
|
|
132
306
|
https://react-svgr.com/docs/options/
|
|
133
307
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
308
|
## Documentation
|
|
139
309
|
|
|
140
310
|
To generate documentation:
|
|
@@ -144,29 +314,30 @@ npm run generate-docs
|
|
|
144
314
|
|
|
145
315
|
Publishing the package will also regenerate the documentation.
|
|
146
316
|
|
|
147
|
-
|
|
148
|
-
|
|
149
317
|
## Additional Documentation
|
|
150
318
|
|
|
151
319
|
Beyond doc-comments in the code, we provide additional documentation in the additional-docs folder.
|
|
152
320
|
|
|
321
|
+
- AutoCoreTagContext Manual: [AutoCoreTagContext Manual](../additional-docs/AutoCoreTagContext.md).
|
|
153
322
|
- Button API Specs: [Button API Specs](../additional-docs/ButtonApiSpecs.md).
|
|
154
323
|
- Global Event Emitter: [Global Event Emitter](../additional-docs/GlobalEventEmitter.md).
|
|
155
324
|
|
|
156
|
-
|
|
157
325
|
## Acknowledgements
|
|
158
326
|
|
|
159
|
-
Beyond the obvious, inherent React libraries, autocore-react greatly appreciates the works of
|
|
327
|
+
Beyond the obvious, inherent React and TypeScript libraries, autocore-react greatly appreciates the works of
|
|
160
328
|
these additional libraries.
|
|
161
329
|
|
|
162
330
|
- PrimeReact and PrimeIcons
|
|
163
331
|
- numerable
|
|
164
332
|
- Simple Keyboard (https://github.com/hodgef/simple-keyboard)
|
|
165
333
|
- - We customize Simple Keyboard for cleaner physical keyboard integration.
|
|
334
|
+
- Monaco editor
|
|
335
|
+
- socket-io
|
|
336
|
+
- Tauri
|
|
166
337
|
|
|
167
338
|
## Copyright
|
|
168
339
|
|
|
169
|
-
(C) Copyright 2021-
|
|
340
|
+
(C) Copyright 2021-2025 Automated Design Corp. All Rights Reserved.
|
|
170
341
|
|
|
171
342
|
## License
|
|
172
343
|
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2025 Automated Design Corp.. All Rights Reserved.
|
|
3
|
+
* Created Date: 2025-09-05 08:06:09
|
|
4
|
+
* -----
|
|
5
|
+
* Last Modified: 2025-09-10 11:15:10
|
|
6
|
+
* -----
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @module components/AutoCoreDevPanel
|
|
12
|
+
*
|
|
13
|
+
* @summary
|
|
14
|
+
*
|
|
15
|
+
* A development and debugging panel for monitoring and manually interacting with AutoCore tags.
|
|
16
|
+
* This component provides real-time visibility into tag values and allows direct manipulation
|
|
17
|
+
* for testing and debugging purposes.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*
|
|
21
|
+
* The AutoCoreDevPanel is designed to be used during development to:
|
|
22
|
+
* - Monitor live tag values in real-time
|
|
23
|
+
* - Test write operations manually
|
|
24
|
+
* - Debug tag behavior and connectivity
|
|
25
|
+
* - Perform tap operations on boolean tags
|
|
26
|
+
* - Validate tag configurations
|
|
27
|
+
*
|
|
28
|
+
* The panel automatically connects to the global AutoCoreTagContext and displays all
|
|
29
|
+
* tags passed to it. No additional setup or factory functions are required.
|
|
30
|
+
*
|
|
31
|
+
* @example Basic Usage
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import React from 'react';
|
|
34
|
+
* import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
|
|
35
|
+
* import { acTagSpec } from "./AutoCoreTags";
|
|
36
|
+
*
|
|
37
|
+
* function App() {
|
|
38
|
+
* return (
|
|
39
|
+
* <div>
|
|
40
|
+
* <main>
|
|
41
|
+
* <YourMainContent />
|
|
42
|
+
* </main>
|
|
43
|
+
*
|
|
44
|
+
* {process.env.NODE_ENV === 'development' && (
|
|
45
|
+
* <AutoCoreDevPanel
|
|
46
|
+
* tags={acTagSpec}
|
|
47
|
+
* className="fixed bottom-4 right-4 bg-white shadow-lg"
|
|
48
|
+
* />
|
|
49
|
+
* )}
|
|
50
|
+
* </div>
|
|
51
|
+
* );
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example Styled Panel
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
|
|
58
|
+
* import { acTagSpec } from "./AutoCoreTags";
|
|
59
|
+
*
|
|
60
|
+
* // Custom styled panel
|
|
61
|
+
* <AutoCoreDevPanel
|
|
62
|
+
* tags={acTagSpec}
|
|
63
|
+
* title="Machine Status Monitor"
|
|
64
|
+
* className="
|
|
65
|
+
* fixed top-4 left-4
|
|
66
|
+
* bg-gray-900 text-white
|
|
67
|
+
* border border-gray-700
|
|
68
|
+
* shadow-2xl rounded-lg
|
|
69
|
+
* max-w-md
|
|
70
|
+
* "
|
|
71
|
+
* />
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @example Filtered Tags
|
|
75
|
+
* ```tsx
|
|
76
|
+
* import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
|
|
77
|
+
* import { acTagSpec } from "./AutoCoreTags";
|
|
78
|
+
*
|
|
79
|
+
* // Show only specific tags for focused debugging
|
|
80
|
+
* const motorTags = acTagSpec.filter(tag =>
|
|
81
|
+
* tag.tagName.includes('motor') || tag.tagName.includes('axis')
|
|
82
|
+
* );
|
|
83
|
+
*
|
|
84
|
+
* <AutoCoreDevPanel
|
|
85
|
+
* tags={motorTags}
|
|
86
|
+
* title="Motor Control Debug"
|
|
87
|
+
* className="debug-panel"
|
|
88
|
+
* />
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
import React, { useContext, useMemo, useState, useCallback } from "react";
|
|
93
|
+
import type { TagConfig } from "../core/AutoCoreTagTypes";
|
|
94
|
+
import { AutoCoreTagContext } from "../core/AutoCoreTagContext";
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Props for the AutoCoreDevPanel component.
|
|
98
|
+
*/
|
|
99
|
+
interface AutoCoreDevPanelProps {
|
|
100
|
+
/**
|
|
101
|
+
* Array of tag configurations to display in the panel.
|
|
102
|
+
* Each tag will show its current value and provide controls for writing new values.
|
|
103
|
+
*/
|
|
104
|
+
tags: readonly TagConfig[];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Optional title for the panel header.
|
|
108
|
+
* @defaultValue "AutoCore Dev Panel"
|
|
109
|
+
*/
|
|
110
|
+
title?: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Optional CSS class names for custom styling.
|
|
114
|
+
* The panel has default styling but can be customized with Tailwind or custom CSS.
|
|
115
|
+
*/
|
|
116
|
+
className?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* AutoCoreDevPanel - Development and debugging panel for AutoCore tags.
|
|
121
|
+
*
|
|
122
|
+
* This component provides a real-time debugging interface for monitoring and manipulating
|
|
123
|
+
* AutoCore tags during development. It displays current tag values, provides input controls
|
|
124
|
+
* for writing new values, and includes tap functionality for boolean tags.
|
|
125
|
+
*
|
|
126
|
+
* ## Features
|
|
127
|
+
*
|
|
128
|
+
* - **Real-time monitoring**: Shows live tag values as they update from the server
|
|
129
|
+
* - **Direct writes**: Input controls to write new values directly to tags
|
|
130
|
+
* - **Type-aware inputs**: Automatically provides appropriate input types (checkbox for boolean, number input for numeric, etc.)
|
|
131
|
+
* - **Tap functionality**: Special "TAP" buttons for boolean tags that send momentary true→false signals
|
|
132
|
+
* - **Error handling**: Visual feedback for write failures and validation errors
|
|
133
|
+
* - **Live status**: Indicator showing whether the system is loading or live
|
|
134
|
+
* - **JSON support**: Proper formatting and editing for JSON-type tags
|
|
135
|
+
*
|
|
136
|
+
* ## Input Types
|
|
137
|
+
*
|
|
138
|
+
* - **Boolean tags**: Checkbox for direct true/false setting + TAP button for momentary signals
|
|
139
|
+
* - **Number tags**: Number input with validation
|
|
140
|
+
* - **String tags**: Text input
|
|
141
|
+
* - **JSON tags**: Text input with JSON validation and pretty-printing
|
|
142
|
+
*
|
|
143
|
+
* ## Keyboard Shortcuts
|
|
144
|
+
*
|
|
145
|
+
* - **Enter key**: In text/number inputs, immediately sends the value to the server
|
|
146
|
+
* - **Tab navigation**: Navigate between inputs using standard keyboard navigation
|
|
147
|
+
*
|
|
148
|
+
* ## Error Handling
|
|
149
|
+
*
|
|
150
|
+
* Write operations that fail will show error messages below the input field.
|
|
151
|
+
* Common errors include:
|
|
152
|
+
* - Invalid number formats
|
|
153
|
+
* - Malformed JSON
|
|
154
|
+
* - Network/server errors
|
|
155
|
+
* - Tag not found errors
|
|
156
|
+
*/
|
|
157
|
+
export const AutoCoreDevPanel: React.FC<AutoCoreDevPanelProps> = ({
|
|
158
|
+
tags,
|
|
159
|
+
title = "AutoCore Dev Panel",
|
|
160
|
+
className = "",
|
|
161
|
+
}) => {
|
|
162
|
+
const { values, rawValues, isLoading, write, tap, scales } = useContext(AutoCoreTagContext);
|
|
163
|
+
|
|
164
|
+
/** Local editable buffers & errors keyed by tagName */
|
|
165
|
+
const [editBuf, setEditBuf] = useState<Record<string, string>>({});
|
|
166
|
+
const [errors, setErrors] = useState<Record<string, string>>({});
|
|
167
|
+
|
|
168
|
+
const rows = useMemo(() => {
|
|
169
|
+
return tags.map((tag) => {
|
|
170
|
+
const display = values[tag.tagName];
|
|
171
|
+
const raw = rawValues[tag.tagName];
|
|
172
|
+
const scaleName = tag.scale ?? "";
|
|
173
|
+
const s = scaleName ? scales[scaleName] : undefined;
|
|
174
|
+
return {
|
|
175
|
+
tag,
|
|
176
|
+
display,
|
|
177
|
+
raw,
|
|
178
|
+
scaleName,
|
|
179
|
+
factor: s?.scale,
|
|
180
|
+
label: s?.label,
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
}, [tags, values, rawValues, scales]);
|
|
184
|
+
|
|
185
|
+
const setBuf = useCallback((tagName: string, v: string) => {
|
|
186
|
+
setEditBuf((prev) => ({ ...prev, [tagName]: v }));
|
|
187
|
+
setErrors((prev) => ({ ...prev, [tagName]: "" }));
|
|
188
|
+
}, []);
|
|
189
|
+
|
|
190
|
+
const setErr = useCallback((tagName: string, msg: string) => {
|
|
191
|
+
setErrors((prev) => ({ ...prev, [tagName]: msg }));
|
|
192
|
+
}, []);
|
|
193
|
+
|
|
194
|
+
const commit = useCallback(async (tag: TagConfig) => {
|
|
195
|
+
const tagName = tag.tagName;
|
|
196
|
+
const buf = editBuf[tagName];
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
if (tag.valueType === "boolean") {
|
|
200
|
+
// Toggle to the buffer value if explicitly provided, else flip current
|
|
201
|
+
const desired =
|
|
202
|
+
buf === "true" ? true :
|
|
203
|
+
buf === "false" ? false :
|
|
204
|
+
!(values[tagName] as boolean);
|
|
205
|
+
await write(tagName as any, desired as any);
|
|
206
|
+
setBuf(tagName, "");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (tag.valueType === "number") {
|
|
211
|
+
if (buf == null || buf.trim() === "") {
|
|
212
|
+
setErr(tagName, "Enter a number.");
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const n = Number(buf);
|
|
216
|
+
if (Number.isNaN(n)) {
|
|
217
|
+
setErr(tagName, "Invalid number.");
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
await write(tagName as any, n as any);
|
|
221
|
+
setBuf(tagName, "");
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (tag.valueType === "string") {
|
|
226
|
+
await write(tagName as any, (buf ?? "") as any);
|
|
227
|
+
setBuf(tagName, "");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// json
|
|
232
|
+
try {
|
|
233
|
+
const parsed = buf?.trim() ? JSON.parse(buf) : null;
|
|
234
|
+
await write(tagName as any, parsed as any);
|
|
235
|
+
setBuf(tagName, "");
|
|
236
|
+
} catch (e: any) {
|
|
237
|
+
setErr(tagName, "Invalid JSON.");
|
|
238
|
+
}
|
|
239
|
+
} catch (e: any) {
|
|
240
|
+
setErr(tagName, e?.message ?? String(e));
|
|
241
|
+
}
|
|
242
|
+
}, [editBuf, setBuf, setErr, write, values]);
|
|
243
|
+
|
|
244
|
+
const onKeyDownCommit = (ev: React.KeyboardEvent, tag: TagConfig) => {
|
|
245
|
+
if (ev.key === "Enter" && !ev.shiftKey) {
|
|
246
|
+
ev.preventDefault();
|
|
247
|
+
void commit(tag);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<div className={`rounded-md border border-gray-200 bg-white text-sm ${className}`} style={{ minWidth: 680 }}>
|
|
253
|
+
<div className="flex items-center justify-between px-3 py-2" style={{ borderBottom: "1px solid #eee" }}>
|
|
254
|
+
<div className="flex items-center gap-2">
|
|
255
|
+
<strong>{title}</strong>
|
|
256
|
+
<span
|
|
257
|
+
title={isLoading ? "Loading" : "Live"}
|
|
258
|
+
style={{
|
|
259
|
+
width: 8, height: 8, borderRadius: 999,
|
|
260
|
+
background: isLoading ? "#aaa" : "#22c55e",
|
|
261
|
+
display: "inline-block"
|
|
262
|
+
}}
|
|
263
|
+
/>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div style={{ overflowX: "auto" }}>
|
|
268
|
+
<table style={{ borderCollapse: "collapse", width: "100%" }}>
|
|
269
|
+
<thead>
|
|
270
|
+
<tr>
|
|
271
|
+
<Th>Tag</Th>
|
|
272
|
+
<Th>Kind</Th>
|
|
273
|
+
<Th>Domain</Th>
|
|
274
|
+
<Th>Symbol</Th>
|
|
275
|
+
<Th>Display</Th>
|
|
276
|
+
<Th>Raw</Th>
|
|
277
|
+
<Th>Scale</Th>
|
|
278
|
+
<Th>Units</Th>
|
|
279
|
+
<Th>Input</Th>
|
|
280
|
+
<Th>Actions</Th>
|
|
281
|
+
</tr>
|
|
282
|
+
</thead>
|
|
283
|
+
<tbody>
|
|
284
|
+
{rows.map(({ tag, display, raw, scaleName, factor, label }) => {
|
|
285
|
+
const buf = editBuf[tag.tagName] ?? "";
|
|
286
|
+
const err = errors[tag.tagName];
|
|
287
|
+
|
|
288
|
+
return (
|
|
289
|
+
<tr key={tag.tagName}>
|
|
290
|
+
<Td mono>{tag.tagName}</Td>
|
|
291
|
+
<Td mono>{tag.valueType}</Td>
|
|
292
|
+
<Td mono>{tag.domain}</Td>
|
|
293
|
+
<Td mono>{tag.symbolName}</Td>
|
|
294
|
+
<Td mono>{fmt(display)}</Td>
|
|
295
|
+
<Td mono>{fmt(raw)}</Td>
|
|
296
|
+
<Td mono>{scaleName ? `${scaleName} ×${factor ?? 1}` : "—"}</Td>
|
|
297
|
+
<Td mono>{scaleName ? (label ?? "") : "—"}</Td>
|
|
298
|
+
<Td>
|
|
299
|
+
<InputForTag
|
|
300
|
+
tag={tag}
|
|
301
|
+
buf={buf}
|
|
302
|
+
setBuf={(v) => setBuf(tag.tagName, v)}
|
|
303
|
+
onKeyDown={(e) => onKeyDownCommit(e, tag)}
|
|
304
|
+
/>
|
|
305
|
+
{err && <div style={{ color: "#dc2626", marginTop: 4 }}>{err}</div>}
|
|
306
|
+
</Td>
|
|
307
|
+
<Td>
|
|
308
|
+
<div style={{ display: "flex", gap: 6 }}>
|
|
309
|
+
<button onClick={() => commit(tag)}>Write</button>
|
|
310
|
+
{tag.valueType === "boolean" && (
|
|
311
|
+
<button onClick={() => tap(tag.tagName as any)}>TAP</button>
|
|
312
|
+
)}
|
|
313
|
+
</div>
|
|
314
|
+
</Td>
|
|
315
|
+
</tr>
|
|
316
|
+
);
|
|
317
|
+
})}
|
|
318
|
+
</tbody>
|
|
319
|
+
</table>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/** ---------- helpers ---------- */
|
|
326
|
+
|
|
327
|
+
const Th: React.FC<React.PropsWithChildren<{}>> = ({ children }) => (
|
|
328
|
+
<th style={{
|
|
329
|
+
textAlign: "left",
|
|
330
|
+
borderBottom: "1px solid #ddd",
|
|
331
|
+
padding: "6px 8px",
|
|
332
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
333
|
+
}}>{children}</th>
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
const Td: React.FC<React.PropsWithChildren<{ mono?: boolean }>> = ({ children, mono }) => (
|
|
337
|
+
<td style={{
|
|
338
|
+
borderBottom: "1px solid #eee",
|
|
339
|
+
padding: "6px 8px",
|
|
340
|
+
whiteSpace: "nowrap",
|
|
341
|
+
fontFamily: mono ? "ui-monospace, SFMono-Regular, Menlo, monospace" : "inherit"
|
|
342
|
+
}}>{children}</td>
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
const InputForTag: React.FC<{
|
|
346
|
+
tag: TagConfig;
|
|
347
|
+
buf: string;
|
|
348
|
+
setBuf: (v: string) => void;
|
|
349
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
350
|
+
}> = ({ tag, buf, setBuf, onKeyDown }) => {
|
|
351
|
+
if (tag.valueType === "boolean") {
|
|
352
|
+
// Boolean: checkbox controls direct true/false (buffer mirrors state as string)
|
|
353
|
+
return (
|
|
354
|
+
<label style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
|
|
355
|
+
<input
|
|
356
|
+
type="checkbox"
|
|
357
|
+
checked={buf ? buf === "true" : (Boolean as any)}
|
|
358
|
+
onChange={(e) => setBuf(e.target.checked ? "true" : "false")}
|
|
359
|
+
onKeyDown={onKeyDown}
|
|
360
|
+
/>
|
|
361
|
+
<span>set</span>
|
|
362
|
+
</label>
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (tag.valueType === "number") {
|
|
367
|
+
return (
|
|
368
|
+
<input
|
|
369
|
+
type="number"
|
|
370
|
+
step="any"
|
|
371
|
+
value={buf}
|
|
372
|
+
onChange={(e) => setBuf(e.target.value)}
|
|
373
|
+
onKeyDown={onKeyDown}
|
|
374
|
+
style={{ width: 140 }}
|
|
375
|
+
placeholder="number…"
|
|
376
|
+
/>
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (tag.valueType === "string") {
|
|
381
|
+
return (
|
|
382
|
+
<input
|
|
383
|
+
type="text"
|
|
384
|
+
value={buf}
|
|
385
|
+
onChange={(e) => setBuf(e.target.value)}
|
|
386
|
+
onKeyDown={onKeyDown}
|
|
387
|
+
style={{ width: 180 }}
|
|
388
|
+
placeholder="text…"
|
|
389
|
+
/>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// json
|
|
394
|
+
return (
|
|
395
|
+
<textarea
|
|
396
|
+
value={buf}
|
|
397
|
+
onChange={(e) => setBuf(e.target.value)}
|
|
398
|
+
onKeyDown={onKeyDown}
|
|
399
|
+
rows={2}
|
|
400
|
+
style={{ width: 260, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace" }}
|
|
401
|
+
placeholder='{"foo": 42}'
|
|
402
|
+
/>
|
|
403
|
+
);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
function fmt(v: unknown) {
|
|
407
|
+
if (v === null || v === undefined) return "—";
|
|
408
|
+
if (typeof v === "number") return Number.isFinite(v) ? v.toString() : String(v);
|
|
409
|
+
if (typeof v === "string") return v;
|
|
410
|
+
try { return JSON.stringify(v); } catch { return String(v); }
|
|
411
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
|
|
3
3
|
* Created Date: 2024-03-17 08:43:02
|
|
4
4
|
* -----
|
|
5
|
-
* Last Modified:
|
|
5
|
+
* Last Modified: 2025-09-05 14:52:18
|
|
6
6
|
* -----
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import { editor } from 'monaco-editor';
|
|
14
14
|
//import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
15
|
-
import Editor, { Monaco } from '@monaco-editor/react';
|
|
15
|
+
import Editor, { type Monaco } from '@monaco-editor/react';
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
interface CodeEditorProps {
|