@adcops/autocore-react 3.3.9 → 3.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +58 -58
- package/additional-docs/AutoCoreTagContext.md +441 -441
- package/additional-docs/ButtonApiSpecs.md +48 -48
- package/additional-docs/GlobalEventEmitter.md +243 -243
- package/additional-docs/general_recommendations.md +22 -22
- package/additional-docs/react_performance_notes.md +94 -94
- package/dist/assets/svg/blockly_logo.svg +82 -82
- package/dist/assets/svg/distance.svg +40 -40
- package/dist/assets/svg/python_logo.svg +246 -246
- package/dist/assets/svg/rotation_ccw.svg +50 -50
- package/dist/assets/svg/rotation_ccw_a.svg +57 -57
- package/dist/assets/svg/rotation_ccw_b.svg +57 -57
- package/dist/assets/svg/rotation_ccw_c.svg +57 -57
- package/dist/assets/svg/rotation_cw.svg +49 -49
- package/dist/assets/svg/rotation_cw_a.svg +30 -30
- package/dist/assets/svg/rotation_cw_b.svg +30 -30
- package/dist/assets/svg/rotation_cw_c.svg +30 -30
- package/dist/assets/svg/speed.svg +39 -39
- package/dist/components/BlocklyEditor.css +93 -93
- package/dist/components/JogPanel.css +41 -41
- package/dist/components/ProgressBarWithValue.css +27 -27
- package/dist/components/ValueIndicator.css +31 -31
- package/dist/components/osk.css +123 -123
- package/dist/core/AutoCoreTagContext.d.ts.map +1 -1
- package/dist/core/AutoCoreTagContext.js +1 -1
- package/dist/hub/HubBase.d.ts +3 -3
- package/dist/hub/HubBase.d.ts.map +1 -1
- package/dist/hub/HubBase.js +1 -1
- package/package.json +104 -104
- package/readme.md +343 -343
- package/src/assets/BlocklyLogo.tsx +27 -27
- package/src/assets/Distance.tsx +18 -18
- package/src/assets/JogLong.tsx +13 -13
- package/src/assets/JogMedium.tsx +13 -13
- package/src/assets/JogShort.tsx +13 -13
- package/src/assets/PythonLogo.tsx +83 -83
- package/src/assets/Rotation3D.tsx +13 -13
- package/src/assets/RotationCcw.tsx +33 -33
- package/src/assets/RotationCcwA.tsx +45 -45
- package/src/assets/RotationCcwB.tsx +45 -45
- package/src/assets/RotationCcwC.tsx +45 -45
- package/src/assets/RotationCw.tsx +31 -31
- package/src/assets/RotationCwA.tsx +42 -42
- package/src/assets/RotationCwB.tsx +42 -42
- package/src/assets/RotationCwC.tsx +42 -42
- package/src/assets/Run.tsx +13 -13
- package/src/assets/Speed.tsx +18 -18
- package/src/assets/SpeedFast.tsx +13 -13
- package/src/assets/SpeedMedium.tsx +13 -13
- package/src/assets/SpeedNone.tsx +13 -13
- package/src/assets/SpeedSlow.tsx +13 -13
- package/src/assets/Walk.tsx +13 -13
- package/src/assets/index.ts +22 -22
- package/src/assets/svg/blockly_logo.svg +82 -82
- package/src/assets/svg/distance.svg +40 -40
- package/src/assets/svg/python_logo.svg +246 -246
- package/src/assets/svg/rotation_ccw.svg +50 -50
- package/src/assets/svg/rotation_ccw_a.svg +57 -57
- package/src/assets/svg/rotation_ccw_b.svg +57 -57
- package/src/assets/svg/rotation_ccw_c.svg +57 -57
- package/src/assets/svg/rotation_cw.svg +49 -49
- package/src/assets/svg/rotation_cw_a.svg +30 -30
- package/src/assets/svg/rotation_cw_b.svg +30 -30
- package/src/assets/svg/rotation_cw_c.svg +30 -30
- package/src/assets/svg/speed.svg +39 -39
- package/src/components/AutoCoreDevPanel.tsx +414 -414
- package/src/components/BlocklyEditor.css +93 -93
- package/src/components/BlocklyEditor.tsx +609 -609
- package/src/components/CodeEditor.tsx +155 -155
- package/src/components/FileList.tsx +390 -390
- package/src/components/FileSelect.tsx +128 -128
- package/src/components/FitText.tsx +35 -35
- package/src/components/Indicator.tsx +188 -188
- package/src/components/IndicatorButton.tsx +214 -214
- package/src/components/IndicatorRect.tsx +172 -172
- package/src/components/JogPanel.css +41 -41
- package/src/components/JogPanel.tsx +461 -461
- package/src/components/Lamp.tsx +243 -243
- package/src/components/Osk.tsx +192 -192
- package/src/components/OskDialog.tsx +164 -164
- package/src/components/ProgressBarWithValue.css +27 -27
- package/src/components/ProgressBarWithValue.tsx +48 -48
- package/src/components/TextInput.tsx +195 -195
- package/src/components/ToggleGroup.tsx +322 -322
- package/src/components/ValueDisplay.tsx +236 -236
- package/src/components/ValueIndicator.css +31 -31
- package/src/components/ValueIndicator.tsx +135 -135
- package/src/components/ValueInput.tsx +368 -368
- package/src/components/osk.css +123 -123
- package/src/core/ActionMode.ts +19 -19
- package/src/core/AutoCoreTagContext.tsx +625 -614
- package/src/core/AutoCoreTagTypes.ts +334 -334
- package/src/core/CoreStreamTypes.ts +512 -512
- package/src/core/EventEmitterContext.tsx +434 -434
- package/src/core/IndicatorButtonState.ts +34 -34
- package/src/core/IndicatorColor.ts +35 -35
- package/src/core/MaskPatterns.ts +87 -87
- package/src/core/NumerableTypes.ts +80 -80
- package/src/core/PositionContext.ts +59 -59
- package/src/core/UniqueId.ts +41 -41
- package/src/core/ValueSimulator.ts +166 -166
- package/src/core/hoc.tsx +65 -65
- package/src/hooks/adsHooks.tsx +287 -287
- package/src/hooks/commandHooks.tsx +300 -300
- package/src/hooks/index.ts +12 -12
- package/src/hooks/useAutoCoreTag.ts +103 -103
- package/src/hooks/useScaledValue.tsx +99 -99
- package/src/hub/CommandMessage.ts +89 -89
- package/src/hub/DebugPanel.ts +307 -307
- package/src/hub/HubBase.ts +249 -236
- package/src/hub/HubSimulate.ts +124 -124
- package/src/hub/HubTauri.ts +140 -140
- package/src/hub/HubWebSocket.ts +250 -250
- package/src/hub/debug.ts +211 -211
- package/src/hub/index.ts +81 -81
- package/src/themes/adc-dark/_extensions.scss +166 -166
- package/src/themes/adc-dark/_variables.scss +913 -913
- package/src/themes/adc-dark/blue/_fonts.scss +23 -23
- package/src/themes/adc-dark/blue/adc_theme.scss +31 -31
- package/src/themes/adc-dark/blue/theme.scss +14 -14
- package/src/themes/theme-base/_colors.scss +17 -17
- package/src/themes/theme-base/_common.scss +74 -74
- package/src/themes/theme-base/_components.scss +111 -111
- package/src/themes/theme-base/_mixins.scss +243 -243
- package/src/themes/theme-base/components/button/_button.scss +644 -644
- package/src/themes/theme-base/components/button/_speeddial.scss +91 -91
- package/src/themes/theme-base/components/button/_splitbutton.scss +358 -358
- package/src/themes/theme-base/components/data/_carousel.scss +39 -39
- package/src/themes/theme-base/components/data/_datascroller.scss +47 -47
- package/src/themes/theme-base/components/data/_datatable.scss +388 -388
- package/src/themes/theme-base/components/data/_dataview.scss +47 -47
- package/src/themes/theme-base/components/data/_filter.scss +137 -137
- package/src/themes/theme-base/components/data/_orderlist.scss +86 -86
- package/src/themes/theme-base/components/data/_organizationchart.scss +50 -50
- package/src/themes/theme-base/components/data/_paginator.scss +91 -91
- package/src/themes/theme-base/components/data/_picklist.scss +73 -73
- package/src/themes/theme-base/components/data/_timeline.scss +38 -38
- package/src/themes/theme-base/components/data/_tree.scss +184 -184
- package/src/themes/theme-base/components/data/_treetable.scss +431 -431
- package/src/themes/theme-base/components/file/_fileupload.scss +41 -41
- package/src/themes/theme-base/components/input/_autocomplete.scss +94 -94
- package/src/themes/theme-base/components/input/_calendar.scss +251 -251
- package/src/themes/theme-base/components/input/_cascadeselect.scss +107 -107
- package/src/themes/theme-base/components/input/_checkbox.scss +181 -181
- package/src/themes/theme-base/components/input/_chips.scss +102 -102
- package/src/themes/theme-base/components/input/_colorpicker.scss +17 -17
- package/src/themes/theme-base/components/input/_dropdown.scss +252 -252
- package/src/themes/theme-base/components/input/_editor.scss +122 -122
- package/src/themes/theme-base/components/input/_iconfield.scss +9 -9
- package/src/themes/theme-base/components/input/_inputgroup.scss +74 -74
- package/src/themes/theme-base/components/input/_inputicon.scss +14 -14
- package/src/themes/theme-base/components/input/_inputnumber.scss +4 -4
- package/src/themes/theme-base/components/input/_inputotp.scss +10 -10
- package/src/themes/theme-base/components/input/_inputswitch.scss +99 -99
- package/src/themes/theme-base/components/input/_inputtext.scss +101 -101
- package/src/themes/theme-base/components/input/_listbox.scss +138 -138
- package/src/themes/theme-base/components/input/_mention.scss +30 -30
- package/src/themes/theme-base/components/input/_multiselect.scss +278 -278
- package/src/themes/theme-base/components/input/_password.scss +32 -32
- package/src/themes/theme-base/components/input/_radiobutton.scss +169 -169
- package/src/themes/theme-base/components/input/_rating.scss +80 -80
- package/src/themes/theme-base/components/input/_selectbutton.scss +49 -49
- package/src/themes/theme-base/components/input/_slider.scss +49 -49
- package/src/themes/theme-base/components/input/_togglebutton.scss +99 -99
- package/src/themes/theme-base/components/input/_treeselect.scss +151 -151
- package/src/themes/theme-base/components/input/_tristatecheckbox.scss +46 -46
- package/src/themes/theme-base/components/menu/_breadcrumb.scss +42 -42
- package/src/themes/theme-base/components/menu/_contextmenu.scss +39 -39
- package/src/themes/theme-base/components/menu/_dock.scss +109 -109
- package/src/themes/theme-base/components/menu/_megamenu.scss +141 -141
- package/src/themes/theme-base/components/menu/_menu.scss +33 -33
- package/src/themes/theme-base/components/menu/_menubar.scss +216 -216
- package/src/themes/theme-base/components/menu/_panelmenu.scss +153 -153
- package/src/themes/theme-base/components/menu/_slidemenu.scss +60 -60
- package/src/themes/theme-base/components/menu/_steps.scss +57 -57
- package/src/themes/theme-base/components/menu/_tabmenu.scss +50 -50
- package/src/themes/theme-base/components/menu/_tieredmenu.scss +43 -43
- package/src/themes/theme-base/components/messages/_inlinemessage.scss +69 -69
- package/src/themes/theme-base/components/messages/_message.scss +107 -107
- package/src/themes/theme-base/components/messages/_toast.scss +100 -100
- package/src/themes/theme-base/components/misc/_avatar.scss +33 -33
- package/src/themes/theme-base/components/misc/_badge.scss +76 -76
- package/src/themes/theme-base/components/misc/_chip.scss +38 -38
- package/src/themes/theme-base/components/misc/_inplace.scss +17 -17
- package/src/themes/theme-base/components/misc/_metergroup.scss +80 -80
- package/src/themes/theme-base/components/misc/_progressbar.scss +17 -17
- package/src/themes/theme-base/components/misc/_scrolltop.scss +24 -24
- package/src/themes/theme-base/components/misc/_skeleton.scss +7 -7
- package/src/themes/theme-base/components/misc/_tag.scss +39 -39
- package/src/themes/theme-base/components/misc/_terminal.scss +12 -12
- package/src/themes/theme-base/components/multimedia/_galleria.scss +153 -153
- package/src/themes/theme-base/components/multimedia/_image.scss +53 -53
- package/src/themes/theme-base/components/overlay/_confirmpopup.scss +72 -72
- package/src/themes/theme-base/components/overlay/_dialog.scss +78 -78
- package/src/themes/theme-base/components/overlay/_overlaypanel.scss +64 -64
- package/src/themes/theme-base/components/overlay/_sidebar.scss +23 -23
- package/src/themes/theme-base/components/overlay/_tooltip.scss +33 -33
- package/src/themes/theme-base/components/panel/_accordion.scss +118 -118
- package/src/themes/theme-base/components/panel/_card.scss +30 -30
- package/src/themes/theme-base/components/panel/_divider.scss +30 -30
- package/src/themes/theme-base/components/panel/_fieldset.scss +47 -47
- package/src/themes/theme-base/components/panel/_panel.scss +47 -47
- package/src/themes/theme-base/components/panel/_scrollpanel.scss +10 -10
- package/src/themes/theme-base/components/panel/_splitter.scss +23 -23
- package/src/themes/theme-base/components/panel/_stepper.scss +136 -136
- package/src/themes/theme-base/components/panel/_tabview.scss +147 -147
- package/src/themes/theme-base/components/panel/_toolbar.scss +11 -11
- package/terser.config.cjs +25 -25
- package/todo.md +18 -18
- package/tools/build-themes.cjs +65 -65
- package/tools/copy-distribution-files.cjs +77 -77
- package/tools/minify.cjs +55 -55
- package/tsconfig.json +48 -48
- package/typedoc.json +12 -12
- package/.claude/settings.local.json +0 -7
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
# AutoCore React Performance & Architecture Notes
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document details the architectural decisions and performance optimizations implemented in the `autocore-react` library, specifically regarding the `EventEmitterContext` and `AutoCoreTagContext`. These changes were made to solve issues with infinite re-render loops and performance bottlenecks when handling high-frequency sensor data (e.g., 50Hz+ updates).
|
|
6
|
-
|
|
7
|
-
## Key Performance Rules
|
|
8
|
-
|
|
9
|
-
### 1. Avoid Global Context State Updates for High-Frequency Data
|
|
10
|
-
|
|
11
|
-
**The Problem:**
|
|
12
|
-
Originally, `EventEmitterContext` stored the latest event payload in its state (`state.eventData`).
|
|
13
|
-
Every time a WebSocket message arrived (e.g., a sensor value update), `setState` was called.
|
|
14
|
-
Since `EventEmitterContext` wraps the entire application, **every single component in the app re-rendered** on every sensor update.
|
|
15
|
-
|
|
16
|
-
**The Fix:**
|
|
17
|
-
We removed the `setState` call from the `dispatch` function.
|
|
18
|
-
- **Old way:** `dispatch` -> `setState` -> `Context Value Change` -> `App Re-render`.
|
|
19
|
-
- **New way:** `dispatch` -> Iterate Subscribers -> `callback(payload)`.
|
|
20
|
-
|
|
21
|
-
**Rule:**
|
|
22
|
-
> Do NOT store high-frequency data (like sensor readings) in a global Context's `value` or `state` property if that Context is consumed by the root component. Use a subscription model (observers/listeners) instead.
|
|
23
|
-
|
|
24
|
-
### 2. Stable Object References (Memoization)
|
|
25
|
-
|
|
26
|
-
**The Problem:**
|
|
27
|
-
In `AutoCoreTagContext`, the `scales` prop was defaulted using a destructuring assignment: `scales = {}`.
|
|
28
|
-
This created a **new object reference** on every render.
|
|
29
|
-
This unstable reference was used in `useEffect` dependency arrays, causing effects to re-run infinitely, leading to subscription storms and infinite loops.
|
|
30
|
-
|
|
31
|
-
**The Fix:**
|
|
32
|
-
We memoized the default empty object:
|
|
33
|
-
```typescript
|
|
34
|
-
const defaultScales = useMemo(() => ({}), []);
|
|
35
|
-
const actualScales = scales ?? defaultScales;
|
|
36
|
-
```
|
|
37
|
-
And used `actualScales` everywhere.
|
|
38
|
-
|
|
39
|
-
**Rule:**
|
|
40
|
-
> Always ensure objects passed to Context Providers or used in `useEffect` dependencies are referentially stable. Use `useMemo` for derived objects and constants.
|
|
41
|
-
|
|
42
|
-
### 3. Side-Effects in Render Phase
|
|
43
|
-
|
|
44
|
-
**The Problem:**
|
|
45
|
-
`EventEmitterProvider` was calling `hub.setContext(contextValue)` directly in the component body (during the render phase).
|
|
46
|
-
React's Concurrent Mode or Strict Mode can call the render function multiple times without committing, leading to unpredictable state in the `Hub` singleton.
|
|
47
|
-
|
|
48
|
-
**The Fix:**
|
|
49
|
-
Moved the side-effect to `useEffect`:
|
|
50
|
-
```typescript
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
hub.setContext(contextValue);
|
|
53
|
-
}, [hub, contextValue]);
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Rule:**
|
|
57
|
-
> Never mutate external Singletons or perform side-effects in the main body of a React Functional Component. Always use `useEffect`.
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Data Flow Architecture
|
|
62
|
-
|
|
63
|
-
### 1. Tag Name vs. FQDN
|
|
64
|
-
|
|
65
|
-
To decouple the UI from the backend implementation:
|
|
66
|
-
- **FQDN (Fully Qualified Domain Name)**: The backend address (e.g., `ADS.Main.bStart`). Used only for wire communication.
|
|
67
|
-
- **TagName**: The local UI alias (e.g., `startCmd`). Used by React components.
|
|
68
|
-
|
|
69
|
-
**The Flow:**
|
|
70
|
-
1. **Component**: Calls `useAutoCoreTag("startCmd")`.
|
|
71
|
-
2. **Context**: Looks up config, finds FQDN `ADS.Main.bStart`.
|
|
72
|
-
3. **Context**: Calls `hub.subscribe("startCmd", "ADS.Main.bStart")`.
|
|
73
|
-
4. **Hub**: Maps `ADS.Main.bStart` -> `startCmd`.
|
|
74
|
-
5. **Backend**: Sends update for `ADS.Main.bStart`.
|
|
75
|
-
6. **Hub**: Receives update, translates topic to `startCmd`, dispatches event.
|
|
76
|
-
7. **Context**: Listens for `startCmd`, updates state.
|
|
77
|
-
8. **Component**: Re-renders with new value.
|
|
78
|
-
|
|
79
|
-
### 2. Dual-State Storage
|
|
80
|
-
|
|
81
|
-
`AutoCoreTagContext` stores two versions of every value:
|
|
82
|
-
1. **`rawValues`**: The exact JSON received from the server. **(Source of Truth)**
|
|
83
|
-
2. **`values`**: The scaled/decoded value for display.
|
|
84
|
-
|
|
85
|
-
When a scale changes (e.g., mm to inches), we recompute `values` from `rawValues`. We never rescale a previously scaled value to avoid floating-point drift.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Best Practices for Team
|
|
90
|
-
|
|
91
|
-
1. **Use Hooks**: Always use `useAutoCoreTag` or `useAutoCoreTags`. Do not consume the Context directly unless necessary.
|
|
92
|
-
2. **Key by TagName**: When adding features, always prefer `tagName` over `fqdn` for local logic.
|
|
93
|
-
3. **Console Logs**: Avoid leaving `console.log` in render paths (components). It floods the console and slows down the browser.
|
|
94
|
-
4. **Strict Mode**: Be aware that React Strict Mode mounts components twice. Your `useEffect` cleanup functions must be robust.
|
|
1
|
+
# AutoCore React Performance & Architecture Notes
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document details the architectural decisions and performance optimizations implemented in the `autocore-react` library, specifically regarding the `EventEmitterContext` and `AutoCoreTagContext`. These changes were made to solve issues with infinite re-render loops and performance bottlenecks when handling high-frequency sensor data (e.g., 50Hz+ updates).
|
|
6
|
+
|
|
7
|
+
## Key Performance Rules
|
|
8
|
+
|
|
9
|
+
### 1. Avoid Global Context State Updates for High-Frequency Data
|
|
10
|
+
|
|
11
|
+
**The Problem:**
|
|
12
|
+
Originally, `EventEmitterContext` stored the latest event payload in its state (`state.eventData`).
|
|
13
|
+
Every time a WebSocket message arrived (e.g., a sensor value update), `setState` was called.
|
|
14
|
+
Since `EventEmitterContext` wraps the entire application, **every single component in the app re-rendered** on every sensor update.
|
|
15
|
+
|
|
16
|
+
**The Fix:**
|
|
17
|
+
We removed the `setState` call from the `dispatch` function.
|
|
18
|
+
- **Old way:** `dispatch` -> `setState` -> `Context Value Change` -> `App Re-render`.
|
|
19
|
+
- **New way:** `dispatch` -> Iterate Subscribers -> `callback(payload)`.
|
|
20
|
+
|
|
21
|
+
**Rule:**
|
|
22
|
+
> Do NOT store high-frequency data (like sensor readings) in a global Context's `value` or `state` property if that Context is consumed by the root component. Use a subscription model (observers/listeners) instead.
|
|
23
|
+
|
|
24
|
+
### 2. Stable Object References (Memoization)
|
|
25
|
+
|
|
26
|
+
**The Problem:**
|
|
27
|
+
In `AutoCoreTagContext`, the `scales` prop was defaulted using a destructuring assignment: `scales = {}`.
|
|
28
|
+
This created a **new object reference** on every render.
|
|
29
|
+
This unstable reference was used in `useEffect` dependency arrays, causing effects to re-run infinitely, leading to subscription storms and infinite loops.
|
|
30
|
+
|
|
31
|
+
**The Fix:**
|
|
32
|
+
We memoized the default empty object:
|
|
33
|
+
```typescript
|
|
34
|
+
const defaultScales = useMemo(() => ({}), []);
|
|
35
|
+
const actualScales = scales ?? defaultScales;
|
|
36
|
+
```
|
|
37
|
+
And used `actualScales` everywhere.
|
|
38
|
+
|
|
39
|
+
**Rule:**
|
|
40
|
+
> Always ensure objects passed to Context Providers or used in `useEffect` dependencies are referentially stable. Use `useMemo` for derived objects and constants.
|
|
41
|
+
|
|
42
|
+
### 3. Side-Effects in Render Phase
|
|
43
|
+
|
|
44
|
+
**The Problem:**
|
|
45
|
+
`EventEmitterProvider` was calling `hub.setContext(contextValue)` directly in the component body (during the render phase).
|
|
46
|
+
React's Concurrent Mode or Strict Mode can call the render function multiple times without committing, leading to unpredictable state in the `Hub` singleton.
|
|
47
|
+
|
|
48
|
+
**The Fix:**
|
|
49
|
+
Moved the side-effect to `useEffect`:
|
|
50
|
+
```typescript
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
hub.setContext(contextValue);
|
|
53
|
+
}, [hub, contextValue]);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Rule:**
|
|
57
|
+
> Never mutate external Singletons or perform side-effects in the main body of a React Functional Component. Always use `useEffect`.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Data Flow Architecture
|
|
62
|
+
|
|
63
|
+
### 1. Tag Name vs. FQDN
|
|
64
|
+
|
|
65
|
+
To decouple the UI from the backend implementation:
|
|
66
|
+
- **FQDN (Fully Qualified Domain Name)**: The backend address (e.g., `ADS.Main.bStart`). Used only for wire communication.
|
|
67
|
+
- **TagName**: The local UI alias (e.g., `startCmd`). Used by React components.
|
|
68
|
+
|
|
69
|
+
**The Flow:**
|
|
70
|
+
1. **Component**: Calls `useAutoCoreTag("startCmd")`.
|
|
71
|
+
2. **Context**: Looks up config, finds FQDN `ADS.Main.bStart`.
|
|
72
|
+
3. **Context**: Calls `hub.subscribe("startCmd", "ADS.Main.bStart")`.
|
|
73
|
+
4. **Hub**: Maps `ADS.Main.bStart` -> `startCmd`.
|
|
74
|
+
5. **Backend**: Sends update for `ADS.Main.bStart`.
|
|
75
|
+
6. **Hub**: Receives update, translates topic to `startCmd`, dispatches event.
|
|
76
|
+
7. **Context**: Listens for `startCmd`, updates state.
|
|
77
|
+
8. **Component**: Re-renders with new value.
|
|
78
|
+
|
|
79
|
+
### 2. Dual-State Storage
|
|
80
|
+
|
|
81
|
+
`AutoCoreTagContext` stores two versions of every value:
|
|
82
|
+
1. **`rawValues`**: The exact JSON received from the server. **(Source of Truth)**
|
|
83
|
+
2. **`values`**: The scaled/decoded value for display.
|
|
84
|
+
|
|
85
|
+
When a scale changes (e.g., mm to inches), we recompute `values` from `rawValues`. We never rescale a previously scaled value to avoid floating-point drift.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Best Practices for Team
|
|
90
|
+
|
|
91
|
+
1. **Use Hooks**: Always use `useAutoCoreTag` or `useAutoCoreTags`. Do not consume the Context directly unless necessary.
|
|
92
|
+
2. **Key by TagName**: When adding features, always prefer `tagName` over `fqdn` for local logic.
|
|
93
|
+
3. **Console Logs**: Avoid leaving `console.log` in render paths (components). It floods the console and slows down the browser.
|
|
94
|
+
4. **Strict Mode**: Be aware that React Strict Mode mounts components twice. Your `useEffect` cleanup functions must be robust.
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
-
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
-
|
|
4
|
-
<svg
|
|
5
|
-
width="34.131214"
|
|
6
|
-
height="38.056591"
|
|
7
|
-
viewBox="0 0 34.131214 38.056592"
|
|
8
|
-
version="1.1"
|
|
9
|
-
id="svg1512"
|
|
10
|
-
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
|
11
|
-
sodipodi:docname="blockly_icon.svg"
|
|
12
|
-
inkscape:export-filename="/usr/local/google/home/epastern/Documents/Blockly Logos/Square/logo_standard.png"
|
|
13
|
-
inkscape:export-xdpi="96"
|
|
14
|
-
inkscape:export-ydpi="96"
|
|
15
|
-
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
16
|
-
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
17
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
xmlns:svg="http://www.w3.org/2000/svg"
|
|
19
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
20
|
-
xmlns:cc="http://creativecommons.org/ns#"
|
|
21
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
22
|
-
<defs
|
|
23
|
-
id="defs1506" />
|
|
24
|
-
<sodipodi:namedview
|
|
25
|
-
id="base"
|
|
26
|
-
pagecolor="#ffffff"
|
|
27
|
-
bordercolor="#666666"
|
|
28
|
-
borderopacity="1.0"
|
|
29
|
-
inkscape:pageopacity="0.0"
|
|
30
|
-
inkscape:pageshadow="2"
|
|
31
|
-
inkscape:zoom="0.7"
|
|
32
|
-
inkscape:cx="-31.428571"
|
|
33
|
-
inkscape:cy="-36.428571"
|
|
34
|
-
inkscape:document-units="px"
|
|
35
|
-
inkscape:current-layer="layer1"
|
|
36
|
-
showgrid="false"
|
|
37
|
-
inkscape:measure-start="215.162,827.567"
|
|
38
|
-
inkscape:measure-end="164.907,827.567"
|
|
39
|
-
fit-margin-top="10"
|
|
40
|
-
fit-margin-right="10"
|
|
41
|
-
fit-margin-bottom="10"
|
|
42
|
-
fit-margin-left="10"
|
|
43
|
-
inkscape:window-width="2400"
|
|
44
|
-
inkscape:window-height="1494"
|
|
45
|
-
inkscape:window-x="-11"
|
|
46
|
-
inkscape:window-y="-11"
|
|
47
|
-
inkscape:window-maximized="1"
|
|
48
|
-
inkscape:showpageshadow="0"
|
|
49
|
-
inkscape:pagecheckerboard="0"
|
|
50
|
-
inkscape:deskcolor="#c8c8c8"
|
|
51
|
-
showborder="false"
|
|
52
|
-
borderlayer="false" />
|
|
53
|
-
<metadata
|
|
54
|
-
id="metadata1509">
|
|
55
|
-
<rdf:RDF>
|
|
56
|
-
<cc:Work
|
|
57
|
-
rdf:about="">
|
|
58
|
-
<dc:format>image/svg+xml</dc:format>
|
|
59
|
-
<dc:type
|
|
60
|
-
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
61
|
-
</cc:Work>
|
|
62
|
-
</rdf:RDF>
|
|
63
|
-
</metadata>
|
|
64
|
-
<g
|
|
65
|
-
inkscape:label="Layer 1"
|
|
66
|
-
inkscape:groupmode="layer"
|
|
67
|
-
id="layer1"
|
|
68
|
-
transform="translate(-9.3927263,-61.769323)">
|
|
69
|
-
<path
|
|
70
|
-
id="path906"
|
|
71
|
-
d="m 12.604934,61.770873 c -1.774567,-0.0015 -3.2136701,1.43764 -3.2122066,3.212207 v 27.706838 c -0.00146,1.774568 1.4376396,3.213669 3.2122066,3.212205 h 1.25057 c 0.616698,2.31294 2.710855,3.922673 5.104598,3.923792 2.392205,-0.003 4.484163,-1.612336 5.100464,-3.923792 h 1.281058 4.160987 c 1.169002,0 2.116666,-0.947663 2.116666,-2.116666 V 63.88754 l -2.116666,-2.116667 z"
|
|
72
|
-
style="fill:#4285f4;stroke-width:0.264583"
|
|
73
|
-
inkscape:connector-curvature="0"
|
|
74
|
-
sodipodi:nodetypes="ccccccccssccc" />
|
|
75
|
-
<path
|
|
76
|
-
sodipodi:nodetypes="ccccccccccccccccc"
|
|
77
|
-
inkscape:connector-curvature="0"
|
|
78
|
-
id="path908"
|
|
79
|
-
d="m 28.444794,61.769323 c -0.0028,4.683852 -0.0021,9.366881 -0.0021,14.053406 l -4.400251,-2.48667 c -0.634301,-0.357915 -1.419291,0.09954 -1.420585,0.827856 V 84.91158 c 0.0013,0.728311 0.786285,1.18577 1.420585,0.827855 l 4.400248,-2.487186 v 9.946164 0.587044 2.116666 h 2.116667 0.377238 9.539468 c 1.683266,-6.8e-5 3.047807,-1.364609 3.047876,-3.047875 V 64.808414 c -0.0057,-1.679229 -1.368601,-3.037482 -3.04784,-3.037541 z"
|
|
80
|
-
style="fill:#c8d1db;stroke-width:0.264583" />
|
|
81
|
-
</g>
|
|
82
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="34.131214"
|
|
6
|
+
height="38.056591"
|
|
7
|
+
viewBox="0 0 34.131214 38.056592"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1512"
|
|
10
|
+
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
|
11
|
+
sodipodi:docname="blockly_icon.svg"
|
|
12
|
+
inkscape:export-filename="/usr/local/google/home/epastern/Documents/Blockly Logos/Square/logo_standard.png"
|
|
13
|
+
inkscape:export-xdpi="96"
|
|
14
|
+
inkscape:export-ydpi="96"
|
|
15
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
16
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
19
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
20
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
21
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
22
|
+
<defs
|
|
23
|
+
id="defs1506" />
|
|
24
|
+
<sodipodi:namedview
|
|
25
|
+
id="base"
|
|
26
|
+
pagecolor="#ffffff"
|
|
27
|
+
bordercolor="#666666"
|
|
28
|
+
borderopacity="1.0"
|
|
29
|
+
inkscape:pageopacity="0.0"
|
|
30
|
+
inkscape:pageshadow="2"
|
|
31
|
+
inkscape:zoom="0.7"
|
|
32
|
+
inkscape:cx="-31.428571"
|
|
33
|
+
inkscape:cy="-36.428571"
|
|
34
|
+
inkscape:document-units="px"
|
|
35
|
+
inkscape:current-layer="layer1"
|
|
36
|
+
showgrid="false"
|
|
37
|
+
inkscape:measure-start="215.162,827.567"
|
|
38
|
+
inkscape:measure-end="164.907,827.567"
|
|
39
|
+
fit-margin-top="10"
|
|
40
|
+
fit-margin-right="10"
|
|
41
|
+
fit-margin-bottom="10"
|
|
42
|
+
fit-margin-left="10"
|
|
43
|
+
inkscape:window-width="2400"
|
|
44
|
+
inkscape:window-height="1494"
|
|
45
|
+
inkscape:window-x="-11"
|
|
46
|
+
inkscape:window-y="-11"
|
|
47
|
+
inkscape:window-maximized="1"
|
|
48
|
+
inkscape:showpageshadow="0"
|
|
49
|
+
inkscape:pagecheckerboard="0"
|
|
50
|
+
inkscape:deskcolor="#c8c8c8"
|
|
51
|
+
showborder="false"
|
|
52
|
+
borderlayer="false" />
|
|
53
|
+
<metadata
|
|
54
|
+
id="metadata1509">
|
|
55
|
+
<rdf:RDF>
|
|
56
|
+
<cc:Work
|
|
57
|
+
rdf:about="">
|
|
58
|
+
<dc:format>image/svg+xml</dc:format>
|
|
59
|
+
<dc:type
|
|
60
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
61
|
+
</cc:Work>
|
|
62
|
+
</rdf:RDF>
|
|
63
|
+
</metadata>
|
|
64
|
+
<g
|
|
65
|
+
inkscape:label="Layer 1"
|
|
66
|
+
inkscape:groupmode="layer"
|
|
67
|
+
id="layer1"
|
|
68
|
+
transform="translate(-9.3927263,-61.769323)">
|
|
69
|
+
<path
|
|
70
|
+
id="path906"
|
|
71
|
+
d="m 12.604934,61.770873 c -1.774567,-0.0015 -3.2136701,1.43764 -3.2122066,3.212207 v 27.706838 c -0.00146,1.774568 1.4376396,3.213669 3.2122066,3.212205 h 1.25057 c 0.616698,2.31294 2.710855,3.922673 5.104598,3.923792 2.392205,-0.003 4.484163,-1.612336 5.100464,-3.923792 h 1.281058 4.160987 c 1.169002,0 2.116666,-0.947663 2.116666,-2.116666 V 63.88754 l -2.116666,-2.116667 z"
|
|
72
|
+
style="fill:#4285f4;stroke-width:0.264583"
|
|
73
|
+
inkscape:connector-curvature="0"
|
|
74
|
+
sodipodi:nodetypes="ccccccccssccc" />
|
|
75
|
+
<path
|
|
76
|
+
sodipodi:nodetypes="ccccccccccccccccc"
|
|
77
|
+
inkscape:connector-curvature="0"
|
|
78
|
+
id="path908"
|
|
79
|
+
d="m 28.444794,61.769323 c -0.0028,4.683852 -0.0021,9.366881 -0.0021,14.053406 l -4.400251,-2.48667 c -0.634301,-0.357915 -1.419291,0.09954 -1.420585,0.827856 V 84.91158 c 0.0013,0.728311 0.786285,1.18577 1.420585,0.827855 l 4.400248,-2.487186 v 9.946164 0.587044 2.116666 h 2.116667 0.377238 9.539468 c 1.683266,-6.8e-5 3.047807,-1.364609 3.047876,-3.047875 V 64.808414 c -0.0057,-1.679229 -1.368601,-3.037482 -3.04784,-3.037541 z"
|
|
80
|
+
style="fill:#c8d1db;stroke-width:0.264583" />
|
|
81
|
+
</g>
|
|
82
|
+
</svg>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
-
<svg
|
|
3
|
-
height="24"
|
|
4
|
-
viewBox="0 -960 960 960"
|
|
5
|
-
width="24"
|
|
6
|
-
fill="white"
|
|
7
|
-
version="1.1"
|
|
8
|
-
id="svg1"
|
|
9
|
-
sodipodi:docname="distance.svg"
|
|
10
|
-
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
|
11
|
-
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
12
|
-
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
13
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
-
xmlns:svg="http://www.w3.org/2000/svg">
|
|
15
|
-
<defs
|
|
16
|
-
id="defs1" />
|
|
17
|
-
<sodipodi:namedview
|
|
18
|
-
id="namedview1"
|
|
19
|
-
pagecolor="#505050"
|
|
20
|
-
bordercolor="#eeeeee"
|
|
21
|
-
borderopacity="1"
|
|
22
|
-
inkscape:showpageshadow="0"
|
|
23
|
-
inkscape:pageopacity="0"
|
|
24
|
-
inkscape:pagecheckerboard="0"
|
|
25
|
-
inkscape:deskcolor="#505050"
|
|
26
|
-
showgrid="false"
|
|
27
|
-
inkscape:zoom="33.875"
|
|
28
|
-
inkscape:cx="12"
|
|
29
|
-
inkscape:cy="12"
|
|
30
|
-
inkscape:window-width="1920"
|
|
31
|
-
inkscape:window-height="1009"
|
|
32
|
-
inkscape:window-x="1912"
|
|
33
|
-
inkscape:window-y="-8"
|
|
34
|
-
inkscape:window-maximized="1"
|
|
35
|
-
inkscape:current-layer="svg1" />
|
|
36
|
-
<path
|
|
37
|
-
d="m 99.28704,-194.46528 q -39.261024,0 -67.219632,-27.95861 Q 4.1088,-250.3825 4.1088,-289.64352 v -380.71296 q 0,-39.26102 27.958608,-67.21963 27.958608,-27.95861 67.219632,-27.95861 h 761.42592 q 39.26102,0 67.21963,27.95861 27.95861,27.95861 27.95861,67.21963 v 380.71296 q 0,39.26102 -27.95861,67.21963 -27.95861,27.95861 -67.21963,27.95861 z m 0,-95.17824 H 860.71296 V -670.35648 H 717.9456 v 142.76736 q 0,20.22538 -13.68187,33.90725 Q 690.58186,-480 670.35648,-480 q -20.22538,0 -33.90725,-13.68187 -13.68187,-13.68187 -13.68187,-33.90725 v -142.76736 h -95.17824 v 142.76736 q 0,20.22538 -13.68187,33.90725 Q 500.22538,-480 480,-480 q -20.22538,0 -33.90725,-13.68187 -13.68187,-13.68187 -13.68187,-33.90725 v -142.76736 h -95.17824 v 142.76736 q 0,20.22538 -13.68187,33.90725 Q 309.8689,-480 289.64352,-480 q -20.22538,0 -33.90725,-13.68187 -13.68187,-13.68187 -13.68187,-33.90725 V -670.35648 H 99.28704 Z M 289.64352,-480 Z M 480,-480 Z m 190.35648,0 z M 480,-480 Z"
|
|
38
|
-
id="path1"
|
|
39
|
-
style="stroke-width:1.18973" />
|
|
40
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
height="24"
|
|
4
|
+
viewBox="0 -960 960 960"
|
|
5
|
+
width="24"
|
|
6
|
+
fill="white"
|
|
7
|
+
version="1.1"
|
|
8
|
+
id="svg1"
|
|
9
|
+
sodipodi:docname="distance.svg"
|
|
10
|
+
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
12
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
15
|
+
<defs
|
|
16
|
+
id="defs1" />
|
|
17
|
+
<sodipodi:namedview
|
|
18
|
+
id="namedview1"
|
|
19
|
+
pagecolor="#505050"
|
|
20
|
+
bordercolor="#eeeeee"
|
|
21
|
+
borderopacity="1"
|
|
22
|
+
inkscape:showpageshadow="0"
|
|
23
|
+
inkscape:pageopacity="0"
|
|
24
|
+
inkscape:pagecheckerboard="0"
|
|
25
|
+
inkscape:deskcolor="#505050"
|
|
26
|
+
showgrid="false"
|
|
27
|
+
inkscape:zoom="33.875"
|
|
28
|
+
inkscape:cx="12"
|
|
29
|
+
inkscape:cy="12"
|
|
30
|
+
inkscape:window-width="1920"
|
|
31
|
+
inkscape:window-height="1009"
|
|
32
|
+
inkscape:window-x="1912"
|
|
33
|
+
inkscape:window-y="-8"
|
|
34
|
+
inkscape:window-maximized="1"
|
|
35
|
+
inkscape:current-layer="svg1" />
|
|
36
|
+
<path
|
|
37
|
+
d="m 99.28704,-194.46528 q -39.261024,0 -67.219632,-27.95861 Q 4.1088,-250.3825 4.1088,-289.64352 v -380.71296 q 0,-39.26102 27.958608,-67.21963 27.958608,-27.95861 67.219632,-27.95861 h 761.42592 q 39.26102,0 67.21963,27.95861 27.95861,27.95861 27.95861,67.21963 v 380.71296 q 0,39.26102 -27.95861,67.21963 -27.95861,27.95861 -67.21963,27.95861 z m 0,-95.17824 H 860.71296 V -670.35648 H 717.9456 v 142.76736 q 0,20.22538 -13.68187,33.90725 Q 690.58186,-480 670.35648,-480 q -20.22538,0 -33.90725,-13.68187 -13.68187,-13.68187 -13.68187,-33.90725 v -142.76736 h -95.17824 v 142.76736 q 0,20.22538 -13.68187,33.90725 Q 500.22538,-480 480,-480 q -20.22538,0 -33.90725,-13.68187 -13.68187,-13.68187 -13.68187,-33.90725 v -142.76736 h -95.17824 v 142.76736 q 0,20.22538 -13.68187,33.90725 Q 309.8689,-480 289.64352,-480 q -20.22538,0 -33.90725,-13.68187 -13.68187,-13.68187 -13.68187,-33.90725 V -670.35648 H 99.28704 Z M 289.64352,-480 Z M 480,-480 Z m 190.35648,0 z M 480,-480 Z"
|
|
38
|
+
id="path1"
|
|
39
|
+
style="stroke-width:1.18973" />
|
|
40
|
+
</svg>
|