@adcops/autocore-react 3.0.34 → 3.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/dist/assets/BlocklyLogo.js +1 -9
  2. package/dist/assets/Distance.js +1 -5
  3. package/dist/assets/JogLong.js +1 -3
  4. package/dist/assets/JogMedium.js +1 -3
  5. package/dist/assets/JogShort.js +1 -3
  6. package/dist/assets/PythonLogo.js +1 -21
  7. package/dist/assets/Rotation3D.js +1 -3
  8. package/dist/assets/RotationCcw.js +1 -10
  9. package/dist/assets/RotationCcwA.js +1 -16
  10. package/dist/assets/RotationCcwB.js +1 -16
  11. package/dist/assets/RotationCcwC.js +1 -16
  12. package/dist/assets/RotationCw.js +1 -10
  13. package/dist/assets/RotationCwA.js +1 -16
  14. package/dist/assets/RotationCwB.js +1 -16
  15. package/dist/assets/RotationCwC.js +1 -16
  16. package/dist/assets/Run.js +1 -3
  17. package/dist/assets/Speed.js +1 -5
  18. package/dist/assets/SpeedFast.js +1 -3
  19. package/dist/assets/SpeedMedium.js +1 -3
  20. package/dist/assets/SpeedNone.js +1 -3
  21. package/dist/assets/SpeedSlow.js +1 -3
  22. package/dist/assets/Walk.js +1 -3
  23. package/dist/assets/index.js +1 -22
  24. package/dist/components/BlocklyEditor.css +71 -2
  25. package/dist/components/BlocklyEditor.js +1 -508
  26. package/dist/components/CodeEditor.js +1 -108
  27. package/dist/components/FileList.js +1 -218
  28. package/dist/components/FileSelect.js +1 -63
  29. package/dist/components/FitText.js +1 -13
  30. package/dist/components/Indicator.js +1 -113
  31. package/dist/components/IndicatorButton.js +1 -187
  32. package/dist/components/IndicatorRect.js +1 -93
  33. package/dist/components/JogPanel.js +1 -295
  34. package/dist/components/Lamp.js +1 -161
  35. package/dist/components/Osk.js +1 -125
  36. package/dist/components/OskDialog.js +1 -128
  37. package/dist/components/ProgressBarWithValue.js +1 -18
  38. package/dist/components/TextInput.js +1 -139
  39. package/dist/components/ToggleGroup.js +1 -204
  40. package/dist/components/ValueDisplay.js +1 -160
  41. package/dist/components/ValueIndicator.js +1 -38
  42. package/dist/components/ValueInput.js +1 -158
  43. package/dist/core/ActionMode.js +1 -18
  44. package/dist/core/EventEmitterContext.js +1 -252
  45. package/dist/core/IndicatorButtonState.js +1 -9
  46. package/dist/core/IndicatorColor.js +1 -36
  47. package/dist/core/MaskPatterns.js +1 -80
  48. package/dist/core/NumerableTypes.js +1 -10
  49. package/dist/core/PositionContext.js +1 -24
  50. package/dist/core/UniqueId.js +1 -32
  51. package/dist/core/ValueSimulator.js +1 -233
  52. package/dist/core/hoc.js +1 -44
  53. package/dist/hooks/adsHooks.js +1 -253
  54. package/dist/hooks/commandHooks.js +1 -252
  55. package/dist/hooks/index.js +1 -10
  56. package/dist/hooks/useScaledValue.js +1 -86
  57. package/dist/hub/CommandMessage.js +1 -9
  58. package/dist/hub/HubBase.js +1 -310
  59. package/dist/hub/HubSimulate.js +1 -46
  60. package/dist/hub/HubTauri.js +1 -130
  61. package/dist/hub/HubWebSocket.js +1 -240
  62. package/dist/hub/index.js +1 -57
  63. package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-Italic-VariableFont_wght.ttf +0 -0
  64. package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-VariableFont_wght.ttf +0 -0
  65. package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Italic-VariableFont_wght.ttf +0 -0
  66. package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Regular.woff2 +0 -0
  67. package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-RegularItalic.woff2 +0 -0
  68. package/dist/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-VariableFont_wght.ttf +0 -0
  69. package/dist/themes/adc-dark/blue/theme.css +7097 -0
  70. package/dist/themes/adc-dark/blue/theme.css.map +1 -0
  71. package/package.json +8 -2
  72. package/src/components/BlocklyEditor.css +71 -2
  73. package/src/themes/adc-dark/_extensions.scss +166 -0
  74. package/src/themes/adc-dark/_variables.scss +913 -0
  75. package/src/themes/adc-dark/blue/_fonts.scss +24 -0
  76. package/src/themes/adc-dark/blue/adc_theme.scss +31 -0
  77. package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-Italic-VariableFont_wght.ttf +0 -0
  78. package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleMono-VariableFont_wght.ttf +0 -0
  79. package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Italic-VariableFont_wght.ttf +0 -0
  80. package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-Regular.woff2 +0 -0
  81. package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-RegularItalic.woff2 +0 -0
  82. package/src/themes/adc-dark/blue/fonts/AtkinsonHyperlegibleNext-VariableFont_wght.ttf +0 -0
  83. package/src/themes/adc-dark/blue/theme.scss +14 -0
  84. package/src/themes/theme-base/_colors.scss +18 -0
  85. package/src/themes/theme-base/_common.scss +75 -0
  86. package/src/themes/theme-base/_components.scss +111 -0
  87. package/src/themes/theme-base/_mixins.scss +243 -0
  88. package/src/themes/theme-base/components/button/_button.scss +644 -0
  89. package/src/themes/theme-base/components/button/_speeddial.scss +91 -0
  90. package/src/themes/theme-base/components/button/_splitbutton.scss +359 -0
  91. package/src/themes/theme-base/components/data/_carousel.scss +39 -0
  92. package/src/themes/theme-base/components/data/_datascroller.scss +47 -0
  93. package/src/themes/theme-base/components/data/_datatable.scss +389 -0
  94. package/src/themes/theme-base/components/data/_dataview.scss +47 -0
  95. package/src/themes/theme-base/components/data/_filter.scss +138 -0
  96. package/src/themes/theme-base/components/data/_orderlist.scss +86 -0
  97. package/src/themes/theme-base/components/data/_organizationchart.scss +50 -0
  98. package/src/themes/theme-base/components/data/_paginator.scss +91 -0
  99. package/src/themes/theme-base/components/data/_picklist.scss +74 -0
  100. package/src/themes/theme-base/components/data/_timeline.scss +38 -0
  101. package/src/themes/theme-base/components/data/_tree.scss +184 -0
  102. package/src/themes/theme-base/components/data/_treetable.scss +431 -0
  103. package/src/themes/theme-base/components/file/_fileupload.scss +41 -0
  104. package/src/themes/theme-base/components/input/_autocomplete.scss +95 -0
  105. package/src/themes/theme-base/components/input/_calendar.scss +251 -0
  106. package/src/themes/theme-base/components/input/_cascadeselect.scss +107 -0
  107. package/src/themes/theme-base/components/input/_checkbox.scss +181 -0
  108. package/src/themes/theme-base/components/input/_chips.scss +102 -0
  109. package/src/themes/theme-base/components/input/_colorpicker.scss +18 -0
  110. package/src/themes/theme-base/components/input/_dropdown.scss +252 -0
  111. package/src/themes/theme-base/components/input/_editor.scss +122 -0
  112. package/src/themes/theme-base/components/input/_iconfield.scss +10 -0
  113. package/src/themes/theme-base/components/input/_inputgroup.scss +74 -0
  114. package/src/themes/theme-base/components/input/_inputicon.scss +15 -0
  115. package/src/themes/theme-base/components/input/_inputnumber.scss +5 -0
  116. package/src/themes/theme-base/components/input/_inputotp.scss +10 -0
  117. package/src/themes/theme-base/components/input/_inputswitch.scss +100 -0
  118. package/src/themes/theme-base/components/input/_inputtext.scss +101 -0
  119. package/src/themes/theme-base/components/input/_listbox.scss +139 -0
  120. package/src/themes/theme-base/components/input/_mention.scss +31 -0
  121. package/src/themes/theme-base/components/input/_multiselect.scss +278 -0
  122. package/src/themes/theme-base/components/input/_password.scss +33 -0
  123. package/src/themes/theme-base/components/input/_radiobutton.scss +170 -0
  124. package/src/themes/theme-base/components/input/_rating.scss +81 -0
  125. package/src/themes/theme-base/components/input/_selectbutton.scss +50 -0
  126. package/src/themes/theme-base/components/input/_slider.scss +49 -0
  127. package/src/themes/theme-base/components/input/_togglebutton.scss +99 -0
  128. package/src/themes/theme-base/components/input/_treeselect.scss +151 -0
  129. package/src/themes/theme-base/components/input/_tristatecheckbox.scss +46 -0
  130. package/src/themes/theme-base/components/menu/_breadcrumb.scss +42 -0
  131. package/src/themes/theme-base/components/menu/_contextmenu.scss +39 -0
  132. package/src/themes/theme-base/components/menu/_dock.scss +109 -0
  133. package/src/themes/theme-base/components/menu/_megamenu.scss +141 -0
  134. package/src/themes/theme-base/components/menu/_menu.scss +33 -0
  135. package/src/themes/theme-base/components/menu/_menubar.scss +216 -0
  136. package/src/themes/theme-base/components/menu/_panelmenu.scss +153 -0
  137. package/src/themes/theme-base/components/menu/_slidemenu.scss +60 -0
  138. package/src/themes/theme-base/components/menu/_steps.scss +57 -0
  139. package/src/themes/theme-base/components/menu/_tabmenu.scss +50 -0
  140. package/src/themes/theme-base/components/menu/_tieredmenu.scss +43 -0
  141. package/src/themes/theme-base/components/messages/_inlinemessage.scss +69 -0
  142. package/src/themes/theme-base/components/messages/_message.scss +107 -0
  143. package/src/themes/theme-base/components/messages/_toast.scss +100 -0
  144. package/src/themes/theme-base/components/misc/_avatar.scss +34 -0
  145. package/src/themes/theme-base/components/misc/_badge.scss +77 -0
  146. package/src/themes/theme-base/components/misc/_blockui.scss +0 -0
  147. package/src/themes/theme-base/components/misc/_chip.scss +39 -0
  148. package/src/themes/theme-base/components/misc/_inplace.scss +17 -0
  149. package/src/themes/theme-base/components/misc/_metergroup.scss +81 -0
  150. package/src/themes/theme-base/components/misc/_progressbar.scss +17 -0
  151. package/src/themes/theme-base/components/misc/_scrolltop.scss +25 -0
  152. package/src/themes/theme-base/components/misc/_skeleton.scss +8 -0
  153. package/src/themes/theme-base/components/misc/_tag.scss +40 -0
  154. package/src/themes/theme-base/components/misc/_terminal.scss +12 -0
  155. package/src/themes/theme-base/components/multimedia/_galleria.scss +153 -0
  156. package/src/themes/theme-base/components/multimedia/_image.scss +54 -0
  157. package/src/themes/theme-base/components/overlay/_confirmpopup.scss +72 -0
  158. package/src/themes/theme-base/components/overlay/_dialog.scss +78 -0
  159. package/src/themes/theme-base/components/overlay/_overlaypanel.scss +64 -0
  160. package/src/themes/theme-base/components/overlay/_sidebar.scss +23 -0
  161. package/src/themes/theme-base/components/overlay/_tooltip.scss +33 -0
  162. package/src/themes/theme-base/components/panel/_accordion.scss +118 -0
  163. package/src/themes/theme-base/components/panel/_card.scss +30 -0
  164. package/src/themes/theme-base/components/panel/_divider.scss +31 -0
  165. package/src/themes/theme-base/components/panel/_fieldset.scss +47 -0
  166. package/src/themes/theme-base/components/panel/_panel.scss +47 -0
  167. package/src/themes/theme-base/components/panel/_scrollpanel.scss +10 -0
  168. package/src/themes/theme-base/components/panel/_splitter.scss +23 -0
  169. package/src/themes/theme-base/components/panel/_stepper.scss +136 -0
  170. package/src/themes/theme-base/components/panel/_tabview.scss +147 -0
  171. package/src/themes/theme-base/components/panel/_toolbar.scss +11 -0
  172. package/tools/build-themes.cjs +66 -0
  173. package/tools/copy-distribution-files.cjs +20 -16
@@ -1,36 +1 @@
1
- /*
2
- * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
- * Created Date: 2024-01-21 11:45:09
4
- * -----
5
- * Last Modified: 2024-03-08 07:16:47
6
- * Modified By: ADC
7
- * -----
8
- *
9
- */
10
- /**
11
- * Standardized indicator colors and their meanings. It's probably
12
- * best to use their meaning and not the actual color name.
13
- */
14
- export var IndicatorColor;
15
- (function (IndicatorColor) {
16
- /** Green: On, Ok, Ready, Home, General Use */
17
- IndicatorColor["IndicatorGreen"] = "green";
18
- /** Alias for the ON condition to make meaning clear. Preferred for ON case. */
19
- IndicatorColor["IndicatorOn"] = "green";
20
- /** Off. ONLY USE THIS FOR OFF. */
21
- IndicatorColor["IndicatorOff"] = "gray";
22
- /** Red: Error, Fault, Stop, Stopped. Use sparingly. */
23
- IndicatorColor["IndicatorRed"] = "red";
24
- /** Orange: Warning, Out of position, moving, out of range. */
25
- IndicatorColor["IndicatorOrange"] = "orange";
26
- /** Alias for Red to make meaning clear. Preferred. */
27
- IndicatorColor["IndicatorError"] = "red";
28
- /** Alias for Orange to make meaning clear. Preferred. */
29
- IndicatorColor["IndicatorWarning"] = "orange";
30
- /** Invalid. If an indicator is black, the interface does not know the current value. */
31
- IndicatorColor["IndicatorInvalid"] = "black";
32
- /** Use for navigation buttons. No other meaning allowed. */
33
- IndicatorColor["IndicatorNavigation"] = "cyan";
34
- /** Use for informational buttons. No other meaning allowed. */
35
- IndicatorColor["IndicatorInfo"] = "blue";
36
- })(IndicatorColor || (IndicatorColor = {}));
1
+ export var IndicatorColor;!function(r){r.IndicatorGreen="green",r.IndicatorOn="green",r.IndicatorOff="gray",r.IndicatorRed="red",r.IndicatorOrange="orange",r.IndicatorError="red",r.IndicatorWarning="orange",r.IndicatorInvalid="black",r.IndicatorNavigation="cyan",r.IndicatorInfo="blue"}(IndicatorColor||(IndicatorColor={}));
@@ -1,80 +1 @@
1
- /*
2
- * (C) Copyright 2021 Automated Design Corp. All Rights Reserved.
3
- * File Created: Thursday, 1st April 2021 12:30:41 pm
4
- * Author: Thomas C. Bitsky Jr. Automated Design Corp.
5
- */
6
- /**
7
- * @fileoverview
8
- * Provides a collection of pre-defined patterns for masking/validating different types of user input or data string.
9
- * These patterns come up so regularly in our work that it seemed best to standardize and centralize their definition.
10
- *
11
- * These patterns can be used to ensure that user inputs conform to expected formats, such as real numbers (with or without
12
- * decimal points), positive real numbers, integers, and positive integers. Utilizing these patterns simplifies the process
13
- * of validating and filtering input in forms or any other user input scenarios.
14
- *
15
- * The patterns are defined as regular expressions and are encapsulated within the `InputPatterns` constant for easy access.
16
- * They can be used directly with input validation functions or in conjunction with form validation libraries to enforce
17
- * input constraints.
18
- */
19
- /**
20
- * Regular expressions Common input patterns for matching different input or expected data types.
21
- */
22
- export const RegExMaskPatterns = {
23
- /**
24
- * Regular expression pattern for matching real numbers.
25
- * This pattern matches any real number, including negative and positive numbers with or without a decimal point.
26
- * Examples of valid inputs: "123", "-123", "123.456", "-123.456", ".456", "-.456"
27
- */
28
- RealNumber: /^-?\d*(\.)?(\d+)?$/,
29
- /**
30
- * Regular expression pattern for matching positive real numbers.
31
- * This pattern matches any positive real number with or without a decimal point, excluding negative numbers.
32
- * Examples of valid inputs: "123", "123.456", ".456"
33
- */
34
- RealNumberPositive: /^\d*(\.)?(\d+)?$/,
35
- /**
36
- * Regular expression pattern for matching integers.
37
- * This pattern matches any integer, including negative and positive integers without a decimal point.
38
- * Examples of valid inputs: "123", "-123"
39
- */
40
- Integer: /^-?\d*$/,
41
- /**
42
- * Regular expression pattern for matching positive integers.
43
- * This pattern matches any positive integer without a decimal point, excluding negative numbers.
44
- * Examples of valid inputs: "123"
45
- */
46
- IntegerPositive: /^\d+$/,
47
- /**
48
- * Regular expression for matching IPV4 address.
49
- */
50
- Ipv4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
51
- };
52
- /**
53
- * Patterns for use with PrimeReact.InputMask components
54
- */
55
- export const PrimeReactMaskPatterns = {
56
- /** USA Social Security Number */
57
- SocialSecurityNumber: "999-99-9999",
58
- /** USA phone number with optional extension */
59
- PhoneNumberUS: "(999) 999-9999? x99999",
60
- /** International phone number with optional extension */
61
- PhoneNumberInternational: "+999 999 999 9999? x99999",
62
- /** International phone number with optional extension */
63
- PhoneNumberJapan: "+81 9999 999 9999? x99999",
64
- /** International phone number with optional extension */
65
- PhoneNumberChina: "+86 999 999 9999? x99999",
66
- /** International phone number with optional extension */
67
- PhoneNumberVietnam: "+84 999 999 9999? x99999",
68
- /** International phone number with optional extension */
69
- PhoneNumberSouthKorea: "+82 99 9999 9999 x99999",
70
- /** International phone number with optional extension */
71
- PhoneNumberCanada: "+1 (999) 999-9999 x99999",
72
- /** International phone number with optional extension */
73
- PhoneNumberMexico: "+52 999 999 9999 x99999",
74
- /** International phone number with optional extension */
75
- PhoneNumberScotland: "+44 9999 999999 x99999",
76
- /** International phone number with optional extension */
77
- PhoneNumberEngland: "+44 9999 999999 x99999",
78
- /** International phone number with optional extension */
79
- PhoneNumberIreland: "+353 99 999 9999 x99999",
80
- };
1
+ export const RegExMaskPatterns={RealNumber:/^-?\d*(\.)?(\d+)?$/,RealNumberPositive:/^\d*(\.)?(\d+)?$/,Integer:/^-?\d*$/,IntegerPositive:/^\d+$/,Ipv4:/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/};export const PrimeReactMaskPatterns={SocialSecurityNumber:"999-99-9999",PhoneNumberUS:"(999) 999-9999? x99999",PhoneNumberInternational:"+999 999 999 9999? x99999",PhoneNumberJapan:"+81 9999 999 9999? x99999",PhoneNumberChina:"+86 999 999 9999? x99999",PhoneNumberVietnam:"+84 999 999 9999? x99999",PhoneNumberSouthKorea:"+82 99 9999 9999 x99999",PhoneNumberCanada:"+1 (999) 999-9999 x99999",PhoneNumberMexico:"+52 999 999 9999 x99999",PhoneNumberScotland:"+44 9999 999999 x99999",PhoneNumberEngland:"+44 9999 999999 x99999",PhoneNumberIreland:"+353 99 999 9999 x99999"};
@@ -1,10 +1 @@
1
- /*
2
- * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
- * Created Date: 2024-01-16 14:19:17
4
- * -----
5
- * Last Modified: 2024-03-08 07:55:25
6
- * Modified By: ADC
7
- * -----
8
- *
9
- */
10
- export {};
1
+ export{};
@@ -1,24 +1 @@
1
- /*
2
- * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
- * Created Date: 2024-01-16 14:19:52
4
- * -----
5
- * Last Modified: 2024-03-08 07:48:18
6
- * Modified By: ADC
7
- * -----
8
- *
9
- */
10
- import { createContext } from 'react';
11
- /**
12
- * Creates a React context for position and scaling information of a component using absolute positioning.
13
- * This context provides a standardized way to access and react to changes in scale and positioning offsets,
14
- * enabling components to adjust their layout and rendering behavior dynamically.
15
- *
16
- * The default context values are set to assume no scaling (`scale: 1`) and no offsets (`xOffset: 0, yOffset: 0`),
17
- * which corresponds to the initial state in many applications before any dynamic adjustments are made.
18
- */
19
- export const DimensionsContext = createContext({
20
- scale: 1, /** Default scaling factor indicating no scaling. */
21
- xOffset: 0, /** Default horizontal offset indicating no shift. */
22
- yOffset: 0, /** Default vertical offset indicating no shift. */
23
- });
24
- export default DimensionsContext;
1
+ import{createContext}from"react";export const DimensionsContext=createContext({scale:1,xOffset:0,yOffset:0});export default DimensionsContext;
@@ -1,32 +1 @@
1
- /**
2
- * Generate a unique UUID in the form of RF4122.
3
- * @returns string
4
- */
5
- const PrivateUniqueId = (function () {
6
- function chr4() {
7
- return Math.random().toString(16).slice(-4);
8
- }
9
- return chr4() + chr4() +
10
- '-' + chr4() +
11
- '-' + chr4() +
12
- '-' + chr4() +
13
- '-' + chr4() + chr4() + chr4();
14
- });
15
- /**
16
- * Generates a unique UUID per RFC4122.
17
- * 8 chars, followed by 3 groups of 4 chars, followed by 12 chars.
18
- *
19
- * @returns string UUID
20
- *
21
- * ## Remarks
22
- * NOTE: This format of 8 chars, followed by 3 groups of 4 chars, followed by 12 chars
23
- * is known as a UUID and is defined in RFC4122 and is a standard for generating unique IDs.
24
- * This function DOES NOT implement this standard. It simply outputs a string
25
- * that looks similar. The standard is found here: https://www.ietf.org/rfc/rfc4122.txt
26
- *
27
- * Should avoid duplicates over 10-millions subsequent calls.
28
- *
29
- */
30
- export function UniqueId() {
31
- return PrivateUniqueId();
32
- }
1
+ const PrivateUniqueId=function(){function n(){return Math.random().toString(16).slice(-4)}return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()};export function UniqueId(){return PrivateUniqueId()}
@@ -1,233 +1 @@
1
- /*
2
- * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
- * Created Date: 2024-01-18 12:49:58
4
- * Author: Thomas C. Bitsky Jr.
5
- * -----
6
- * Last Modified: 2024-03-08 09:33:45
7
- * Modified By: ADC
8
- * -----
9
- *
10
- */
11
- /**
12
- * Generates values for simulating data into an HMI.
13
- * Used for demonstration and development testing.
14
- */
15
- export class ValueSimulator {
16
- /**
17
- * Constructor
18
- * @param dispatch EmitterDispatchFunction Dispatch function from the application's EventEmiterContext.
19
- */
20
- constructor(dispatch) {
21
- Object.defineProperty(this, "bBit1", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: false
26
- });
27
- Object.defineProperty(this, "bBit2", {
28
- enumerable: true,
29
- configurable: true,
30
- writable: true,
31
- value: true
32
- });
33
- Object.defineProperty(this, "iRamp1", {
34
- enumerable: true,
35
- configurable: true,
36
- writable: true,
37
- value: 0
38
- });
39
- Object.defineProperty(this, "iRamp2", {
40
- enumerable: true,
41
- configurable: true,
42
- writable: true,
43
- value: 0
44
- });
45
- Object.defineProperty(this, "fRamp1", {
46
- enumerable: true,
47
- configurable: true,
48
- writable: true,
49
- value: 0
50
- });
51
- Object.defineProperty(this, "fRamp2", {
52
- enumerable: true,
53
- configurable: true,
54
- writable: true,
55
- value: 0
56
- });
57
- Object.defineProperty(this, "iSin1", {
58
- enumerable: true,
59
- configurable: true,
60
- writable: true,
61
- value: 0
62
- });
63
- Object.defineProperty(this, "iSin2", {
64
- enumerable: true,
65
- configurable: true,
66
- writable: true,
67
- value: 0
68
- });
69
- Object.defineProperty(this, "fSin1", {
70
- enumerable: true,
71
- configurable: true,
72
- writable: true,
73
- value: 0
74
- });
75
- Object.defineProperty(this, "fSin2", {
76
- enumerable: true,
77
- configurable: true,
78
- writable: true,
79
- value: 0
80
- });
81
- Object.defineProperty(this, "iRamp1DirectionUp", {
82
- enumerable: true,
83
- configurable: true,
84
- writable: true,
85
- value: true
86
- });
87
- Object.defineProperty(this, "iRamp2DirectionUp", {
88
- enumerable: true,
89
- configurable: true,
90
- writable: true,
91
- value: true
92
- });
93
- Object.defineProperty(this, "fRamp1DirectionUp", {
94
- enumerable: true,
95
- configurable: true,
96
- writable: true,
97
- value: true
98
- });
99
- Object.defineProperty(this, "fRamp2DirectionUp", {
100
- enumerable: true,
101
- configurable: true,
102
- writable: true,
103
- value: true
104
- });
105
- Object.defineProperty(this, "iSin1Angle", {
106
- enumerable: true,
107
- configurable: true,
108
- writable: true,
109
- value: Math.random() * Math.PI * 2
110
- });
111
- Object.defineProperty(this, "iSin2Angle", {
112
- enumerable: true,
113
- configurable: true,
114
- writable: true,
115
- value: Math.random() * Math.PI * 2
116
- });
117
- Object.defineProperty(this, "fSin1Angle", {
118
- enumerable: true,
119
- configurable: true,
120
- writable: true,
121
- value: (Math.random() * Math.PI * 2) / 10
122
- });
123
- Object.defineProperty(this, "fSin2Angle", {
124
- enumerable: true,
125
- configurable: true,
126
- writable: true,
127
- value: (Math.random() * Math.PI * 2) / 10
128
- });
129
- Object.defineProperty(this, "intervalId", {
130
- enumerable: true,
131
- configurable: true,
132
- writable: true,
133
- value: 0
134
- });
135
- Object.defineProperty(this, "dispatch", {
136
- enumerable: true,
137
- configurable: true,
138
- writable: true,
139
- value: void 0
140
- });
141
- this.dispatch = dispatch;
142
- }
143
- /**
144
- * Start simulating values on a tick
145
- */
146
- start() {
147
- if (this.intervalId === 0) {
148
- this.intervalId = setInterval(() => this.update(), 1000);
149
- }
150
- }
151
- /**
152
- * Stop simulating values.
153
- */
154
- stop() {
155
- if (this.intervalId !== 0) {
156
- clearInterval(this.intervalId);
157
- this.intervalId = 0;
158
- }
159
- }
160
- /**
161
- * Update and dispatch the values.
162
- */
163
- update() {
164
- this.bBit1 = !this.bBit1;
165
- this.bBit2 = !this.bBit2;
166
- [this.iRamp1, this.iRamp1DirectionUp] = this.updateRamp(this.iRamp1, this.iRamp1DirectionUp, 32767);
167
- [this.iRamp2, this.iRamp2DirectionUp] = this.updateRamp(this.iRamp2, this.iRamp2DirectionUp, 32767);
168
- [this.fRamp1, this.fRamp1DirectionUp] = this.updateRamp(this.fRamp1, this.fRamp1DirectionUp, 3276.7);
169
- [this.fRamp2, this.fRamp2DirectionUp] = this.updateRamp(this.fRamp2, this.fRamp2DirectionUp, 3276.7);
170
- [this.iSin1, this.iSin1Angle] = this.updateSin(this.iSin1, this.iSin1Angle, Math.PI / 180, 32767);
171
- [this.iSin2, this.iSin2Angle] = this.updateSin(this.iSin2, this.iSin2Angle, Math.PI / 180, 32767);
172
- [this.fSin1, this.fSin1Angle] = this.updateSin(this.fSin1, this.fSin1Angle, Math.PI / 180, 3276.7);
173
- [this.fSin2, this.fSin2Angle] = this.updateSin(this.fSin2, this.fSin2Angle, Math.PI / 180, 3276.7);
174
- this.updateTopic("value-simulator-bBit1", this.bBit1);
175
- this.updateTopic("value-simulator-bBit2", this.bBit2);
176
- this.updateTopic("value-simulator-iRamp1", this.iRamp1);
177
- this.updateTopic("value-simulator-iRamp2", this.iRamp2);
178
- this.updateTopic("value-simulator-fRamp1", this.fRamp1);
179
- this.updateTopic("value-simulator-fRamp2", this.fRamp2);
180
- this.updateTopic("value-simulator-iSin1", this.iSin1);
181
- this.updateTopic("value-simulator-iSin2", this.iSin2);
182
- this.updateTopic("value-simulator-fSin1", this.fSin1);
183
- this.updateTopic("value-simulator-fSin2", this.fSin2);
184
- }
185
- /**
186
- * Updates the value of a ramp variable, changing its direction when limits are reached.
187
- * @param {number} value The current value of the ramp variable.
188
- * @param {boolean} directionUp Indicates if the ramp variable is currently increasing.
189
- * @param {number} max The maximum value for the ramp.
190
- * @returns {[number, boolean]} The updated value and direction.
191
- */
192
- updateRamp(value, directionUp, max) {
193
- if (directionUp) {
194
- value++;
195
- if (value >= max)
196
- return [value, false];
197
- }
198
- else {
199
- value--;
200
- if (value <= 0)
201
- return [value, true];
202
- }
203
- return [value, directionUp];
204
- }
205
- /**
206
- * Updates a sine wave value based on the given angle and increments, then calculates the new value and angle.
207
- * This method is useful for scenarios where a sine wave value needs to be progressively updated, such as in animations
208
- * or simulations. The sine of the updated angle is calculated, multiplied by the maximum value to scale it, and both
209
- * the new value and the updated angle are returned.
210
- *
211
- * @param {number} value The current value of the sine wave. This parameter is not directly used in the calculation of the new value,
212
- * but it can be utilized if the method is extended or modified.
213
- * @param {number} angle The current angle in radians. This is the phase of the sine wave.
214
- * @param {number} increment The value by which the angle is to be incremented, in radians. This controls the progression of the wave.
215
- * @param {number} max The maximum value (amplitude) of the sine wave. The calculated sine value will be scaled by this factor.
216
- * @returns {[number,number]} A tuple where the first element is the new sine wave value and the second element is the updated angle.
217
- */
218
- updateSin(value, angle, increment, max) {
219
- angle += increment;
220
- value = Math.sin(angle) * max;
221
- return [value, angle];
222
- }
223
- /**
224
- * Dispatch the update for a particular topic.
225
- */
226
- updateTopic(topic, value) {
227
- this.dispatch({
228
- topic: topic,
229
- payload: value
230
- });
231
- }
232
- }
233
- export default ValueSimulator;
1
+ export class ValueSimulator{constructor(i){Object.defineProperty(this,"bBit1",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"bBit2",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iRamp1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iRamp2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fRamp1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fRamp2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iSin1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iSin2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fSin1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fSin2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iRamp1DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iRamp2DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"fRamp1DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"fRamp2DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iSin1Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2}),Object.defineProperty(this,"iSin2Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2}),Object.defineProperty(this,"fSin1Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2/10}),Object.defineProperty(this,"fSin2Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2/10}),Object.defineProperty(this,"intervalId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"dispatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dispatch=i}start(){0===this.intervalId&&(this.intervalId=setInterval((()=>this.update()),1e3))}stop(){0!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=0)}update(){this.bBit1=!this.bBit1,this.bBit2=!this.bBit2,[this.iRamp1,this.iRamp1DirectionUp]=this.updateRamp(this.iRamp1,this.iRamp1DirectionUp,32767),[this.iRamp2,this.iRamp2DirectionUp]=this.updateRamp(this.iRamp2,this.iRamp2DirectionUp,32767),[this.fRamp1,this.fRamp1DirectionUp]=this.updateRamp(this.fRamp1,this.fRamp1DirectionUp,3276.7),[this.fRamp2,this.fRamp2DirectionUp]=this.updateRamp(this.fRamp2,this.fRamp2DirectionUp,3276.7),[this.iSin1,this.iSin1Angle]=this.updateSin(this.iSin1,this.iSin1Angle,Math.PI/180,32767),[this.iSin2,this.iSin2Angle]=this.updateSin(this.iSin2,this.iSin2Angle,Math.PI/180,32767),[this.fSin1,this.fSin1Angle]=this.updateSin(this.fSin1,this.fSin1Angle,Math.PI/180,3276.7),[this.fSin2,this.fSin2Angle]=this.updateSin(this.fSin2,this.fSin2Angle,Math.PI/180,3276.7),this.updateTopic("value-simulator-bBit1",this.bBit1),this.updateTopic("value-simulator-bBit2",this.bBit2),this.updateTopic("value-simulator-iRamp1",this.iRamp1),this.updateTopic("value-simulator-iRamp2",this.iRamp2),this.updateTopic("value-simulator-fRamp1",this.fRamp1),this.updateTopic("value-simulator-fRamp2",this.fRamp2),this.updateTopic("value-simulator-iSin1",this.iSin1),this.updateTopic("value-simulator-iSin2",this.iSin2),this.updateTopic("value-simulator-fSin1",this.fSin1),this.updateTopic("value-simulator-fSin2",this.fSin2)}updateRamp(i,e,t){if(e){if(++i>=t)return[i,!1]}else if(--i<=0)return[i,!0];return[i,e]}updateSin(i,e,t,a){return e+=t,[Math.sin(e)*a,e]}updateTopic(i,e){this.dispatch({topic:i,payload:e})}}export default ValueSimulator;
package/dist/core/hoc.js CHANGED
@@ -1,44 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /*
3
- * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
4
- * Created Date: 2024-01-18 16:14:20
5
- * -----
6
- * Last Modified: 2024-03-08 09:27:12
7
- * Modified By: ADC
8
- * -----
9
- */
10
- /**
11
- * @fileinfo
12
- * Explanation:
13
- * React.ComponentType<P>: This is a generic type that can accept any React component (functional or class) with props of type P.
14
- * P extends WithSubscriptionProps: Here, P is a generic type parameter that extends WithSubscriptionProps,
15
- * meaning it can be any type that includes the properties of WithSubscriptionProps.
16
- * Omit<P, keyof WithSubscriptionProps>: This utility type creates a new type by omitting properties from
17
- * P that are also in WithSubscriptionProps. This is useful to prevent type clashes.
18
- * useState<any>(): The state is typed as any since the value received from the subscription
19
- * can be of any type. You may choose to make this more specific based on your application's needs.
20
- *
21
- */
22
- import { useState, useEffect, useContext } from 'react';
23
- import { EventEmitterContext } from './EventEmitterContext';
24
- /**
25
- * Creates a higher-order component that subscribes to a specified topic and passes the data to the wrapped component.
26
- *
27
- * @param WrappedComponent The component to be wrapped and enhanced with subscription data.
28
- * @param topic The topic to subscribe to.
29
- * @param propName The name of the prop through which the subscription data is passed to the WrappedComponent.
30
- * @returns A component that subscribes to the given topic and updates its specified prop with the received data.
31
- */
32
- export function hocAddSubscription(WrappedComponent, topic, propName) {
33
- return function (props) {
34
- const [value, setValue] = useState();
35
- const { subscribe, unsubscribe } = useContext(EventEmitterContext);
36
- useEffect(() => {
37
- const unsubscribeToken = subscribe(topic, setValue);
38
- return () => unsubscribe(unsubscribeToken);
39
- }, [topic, subscribe, unsubscribe]);
40
- // Use propName to pass the updated value
41
- const additionalProps = { [propName]: value };
42
- return _jsx(WrappedComponent, { ...props, ...additionalProps });
43
- };
44
- }
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import{EventEmitterContext}from"./EventEmitterContext";export function hocAddSubscription(t,e,r){return function(n){const[o,s]=useState(),{subscribe:u,unsubscribe:i}=useContext(EventEmitterContext);useEffect((()=>{const t=u(e,s);return()=>i(t)}),[e,u,i]);return _jsx(t,{...n,...{[r]:o}})}}