simple-circuit-engine 0.0.12 → 0.0.13

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 (51) hide show
  1. package/AGENTS.md +2 -1
  2. package/CLAUDE.md +2 -0
  3. package/dist/core/index.js +83 -73
  4. package/dist/core/setup.d.ts +8 -0
  5. package/dist/core/simulation/behaviors/arithmetic/AdderBehavior.d.ts +28 -0
  6. package/dist/core/simulation/behaviors/arithmetic/ArithmeticBehaviorMixin.d.ts +63 -0
  7. package/dist/core/simulation/behaviors/arithmetic/EightBitAdderBehavior.d.ts +51 -0
  8. package/dist/core/simulation/behaviors/arithmetic/EightBitOnesComplementBehavior.d.ts +29 -0
  9. package/dist/core/simulation/behaviors/arithmetic/HalfAdderBehavior.d.ts +22 -0
  10. package/dist/core/simulation/behaviors/arithmetic/index.d.ts +7 -0
  11. package/dist/core/simulation/behaviors/index.d.ts +4 -0
  12. package/dist/core/simulation/states/arithmetic/AdderState.d.ts +16 -0
  13. package/dist/core/simulation/states/arithmetic/ArithmeticState.d.ts +53 -0
  14. package/dist/core/simulation/states/arithmetic/EightBitAdderState.d.ts +25 -0
  15. package/dist/core/simulation/states/arithmetic/EightBitOnesComplementState.d.ts +18 -0
  16. package/dist/core/simulation/states/arithmetic/HalfAdderState.d.ts +16 -0
  17. package/dist/core/simulation/states/arithmetic/index.d.ts +7 -0
  18. package/dist/core/simulation/states/index.d.ts +5 -0
  19. package/dist/core/simulation/types.d.ts +1 -1
  20. package/dist/core/topology/Component.d.ts +2 -1
  21. package/dist/core/topology/types.d.ts +19 -5
  22. package/dist/{core-Bjta9Y7_.js → core-b6Q8w2sn.js} +1505 -652
  23. package/dist/core-b6Q8w2sn.js.map +1 -0
  24. package/dist/i18n/index.d.ts +882 -0
  25. package/dist/i18n/locales/en.json.d.ts +268 -0
  26. package/dist/i18n/locales/fr.json.d.ts +268 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +137 -120
  29. package/dist/scene/CircuitEngine.d.ts +13 -0
  30. package/dist/scene/index.d.ts +1 -1
  31. package/dist/scene/index.js +50 -45
  32. package/dist/scene/setup.d.ts +8 -0
  33. package/dist/scene/shared/AbstractCircuitController.d.ts +6 -0
  34. package/dist/scene/shared/components/arithmetic/AdderVisualFactory.d.ts +54 -0
  35. package/dist/scene/shared/components/arithmetic/EightBitAdderVisualFactory.d.ts +45 -0
  36. package/dist/scene/shared/components/arithmetic/EightBitOnesComplementVisualFactory.d.ts +63 -0
  37. package/dist/scene/shared/components/arithmetic/HalfAdderVisualFactory.d.ts +55 -0
  38. package/dist/scene/shared/components/arithmetic/index.d.ts +4 -0
  39. package/dist/scene/shared/components/index.d.ts +4 -0
  40. package/dist/scene/shared/types.d.ts +0 -2
  41. package/dist/scene/shared/utils/GeometryUtils.d.ts +76 -0
  42. package/dist/scene/static/CircuitController.d.ts +1 -0
  43. package/dist/scene/static/PinTooltipWidget.d.ts +5 -0
  44. package/dist/scene/static/tools/BuildTool.d.ts +4 -0
  45. package/dist/scene/static/tools/ComponentPickerWidget.d.ts +7 -0
  46. package/dist/scene/static/tools/ConfigPanelWidget.d.ts +14 -0
  47. package/dist/{scene-CVsDdySt.js → scene-D4QcWeiq.js} +2487 -1099
  48. package/dist/scene-D4QcWeiq.js.map +1 -0
  49. package/package.json +14 -9
  50. package/dist/core-Bjta9Y7_.js.map +0 -1
  51. package/dist/scene-CVsDdySt.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,122 +1,139 @@
1
- import { $ as t, A as s, B as e, C as o, D as r, E as i, F as n, G as l, H as c, I as u, J as S, K as y, L as h, M as C, N as G, O as p, P as N, Q as B, R as F, S as m, T as v, U as g, V as E, W as T, X as V, Y as L, Z as I, _ as d, _t as D, a as M, at as R, b as _, bt as A, c as O, ct as b, d as P, dt as w, et as X, f, ft as U, g as k, gt as x, h as W, ht as H, i as z, it as Y, j, k as Q, l as q, lt as J, m as K, mt as Z, n as $, nt as aa, o as ta, ot as sa, p as ea, pt as oa, q as ra, r as ia, rt as na, s as la, st as ca, t as ua, tt as Sa, u as ya, ut as ha, v as Ca, vt as Ga, w as pa, x as Na, y as Ba, yt as Fa, z as ma } from "./core-Bjta9Y7_.js";
2
- import { A as ga, B as Ea, C as Ta, D as Va, E as La, F as Ia, H as da, I as Da, L as Ma, M as Ra, N as _a, O as Aa, P as Oa, R as ba, S as Pa, T as wa, U as Xa, V as fa, W as Ua, _ as ka, a as xa, b as Wa, c as Ha, d as za, f as Ya, g as ja, h as Qa, i as qa, j as Ja, k as Ka, l as Za, m as $a, n as at, o as tt, p as st, r as et, s as ot, t as rt, u as it, v as nt, w as lt, x as ct, y as ut, z as St } from "./scene-CVsDdySt.js";
1
+ import { $ as t, A as e, At as s, B as r, C as i, Ct as o, D as n, Dt as l, E as c, Et as u, F as S, G as h, H as y, I as B, J as C, K as m, L as d, M as p, N as g, O as F, Ot as G, P as E, Q as N, R as v, S as V, St as T, T as A, Tt as L, U as I, V as D, W as M, X as O, Y as R, Z as _, _ as b, _t as P, a as f, at as w, b as X, bt as k, c as H, ct as U, d as x, dt as W, et as z, f as Y, ft as j, g as q, gt as J, h as K, ht as Q, i as Z, it as $, j as aa, k as ta, kt as ea, l as sa, lt as ra, m as ia, mt as oa, n as na, nt as la, o as ca, ot as ua, p as Sa, pt as ha, q as ya, r as Ba, rt as Ca, s as ma, st as da, t as pa, tt as ga, u as Fa, ut as Ga, v as Ea, vt as Na, w as va, wt as Va, x as Ta, xt as Aa, y as La, yt as Ia, z as Da } from "./core-b6Q8w2sn.js";
2
+ import { A as Oa, B as Ra, C as _a, D as ba, E as Pa, F as fa, G as wa, H as Xa, I as ka, J as Ha, K as Ua, L as xa, M as Wa, N as za, O as Ya, P as ja, R as qa, S as Ja, T as Ka, U as Qa, V as Za, W as $a, X as at, Y as tt, Z as et, _ as st, a as rt, b as it, c as ot, d as nt, f as lt, g as ct, h as ut, i as St, j as ht, k as yt, l as Bt, m as Ct, n as mt, o as dt, p as pt, q as gt, r as Ft, s as Gt, t as Et, u as Nt, v as vt, w as Vt, x as Tt, y as At, z as Lt } from "./scene-D4QcWeiq.js";
3
3
  export {
4
- R as ALL_LOGIC_FAMILIES,
5
- Xa as BRANCHING_POINT_SENTINEL,
6
- pa as BatteryBehavior,
7
- T as BatteryState,
8
- ct as BatteryVisualFactory,
9
- i as BehaviorRegistry,
10
- Da as BranchingPointVisualFactory,
11
- da as BuildTool,
12
- sa as CIRCUIT_FILE_VERSION,
13
- wa as CMP_MATERIALS,
14
- ca as COMPONENT_TYPE_METADATA,
15
- D as CameraOptions,
16
- V as Circuit,
17
- Ja as CircuitController,
18
- Ka as CircuitEngine,
19
- X as CircuitMetadata,
20
- Sa as CircuitOptions,
21
- ia as CircuitRunner,
22
- ga as CircuitRunnerController,
23
- St as CircuitWriter,
24
- d as ClockBehavior,
25
- h as ClockState,
26
- st as ClockVisualFactory,
27
- La as CmpMatCategory,
28
- Va as CmpMatType,
29
- Aa as CmpMatVariant,
30
- aa as Component,
31
- Ua as ComponentPickerWidget,
32
- l as ComponentState,
33
- b as ComponentType,
34
- J as DEFAULT_LOGIC_FAMILY,
35
- Ta as DefaultVisualFactory,
36
- M as DirtyTracker,
37
- Ca as DoubleThrowSwitchBehavior,
38
- F as DoubleThrowSwitchState,
39
- $a as DoubleThrowSwitchVisualFactory,
40
- Y as ENode,
41
- ha as ENodeSourceType,
42
- w as ENodeType,
43
- ta as EventQueue,
44
- lt as FactoryRegistry,
45
- Pa as GroupedFactoryRegistry,
46
- ba as HitboxLayers,
47
- Ma as HoverManager,
48
- k as InverterBehavior,
49
- u as InverterState,
50
- Ya as InverterVisualFactory,
51
- Wa as LabelVisualFactory,
52
- o as LightbulbBehavior,
53
- g as LightbulbState,
54
- ut as LightbulbVisualFactory,
55
- Fa as Memoize,
56
- A as MemoizeExpiring,
57
- fa as MultiSelectTool,
58
- K as Nand4GateBehavior,
59
- N as Nand4GateState,
60
- it as Nand4GateVisualFactory,
61
- ea as Nand8GateBehavior,
62
- G as Nand8GateState,
63
- Za as Nand8GateVisualFactory,
64
- W as NandGateBehavior,
65
- n as NandGateState,
66
- za as NandGateVisualFactory,
67
- P as Nor4GateBehavior,
68
- j as Nor4GateState,
69
- ot as Nor4GateVisualFactory,
70
- ya as Nor8GateBehavior,
71
- s as Nor8GateState,
72
- tt as Nor8GateVisualFactory,
73
- f as NorGateBehavior,
74
- C as NorGateState,
75
- Ha as NorGateVisualFactory,
76
- Z as Position,
77
- Ga as Position3D,
78
- m as RectangleLEDBehavior,
79
- E as RectangleLEDState,
80
- nt as RectangleLEDVisualFactory,
81
- Na as RelayBehavior,
82
- e as RelayState,
83
- ka as RelayVisualFactory,
84
- oa as Rotation,
85
- S as SIMULATION_SPEED,
86
- Ea as SelectionManager,
87
- y as SimulationState,
88
- _ as SmallLEDBehavior,
89
- c as SmallLEDState,
90
- ja as SmallLEDVisualFactory,
91
- z as StateManager,
92
- Ba as SwitchBehavior,
93
- ma as SwitchState,
94
- Qa as SwitchVisualFactory,
95
- L as TRANSITION_DEFAULTS,
96
- na as Wire,
97
- Ia as WireVisualManager,
98
- O as Xor4GateBehavior,
99
- p as Xor4GateState,
100
- qa as Xor4GateVisualFactory,
101
- la as Xor8GateBehavior,
102
- r as Xor8GateState,
103
- et as Xor8GateVisualFactory,
104
- q as XorGateBehavior,
105
- Q as XorGateState,
106
- xa as XorGateVisualFactory,
107
- I as classifyGate,
108
- B as computeGateDelay,
109
- t as computeTransitionSpan,
110
- Ra as controllerOptions,
111
- _a as engineOptions,
112
- H as findPositionBestIndex,
113
- U as generateUUID,
114
- v as getTransitionSpan,
115
- Oa as mapControlsOptions,
116
- ua as registerBasicComponentsBehaviors,
117
- rt as registerBasicComponentsFactories,
118
- $ as registerGatesComponentsBehaviors,
119
- at as registerGatesComponentsFactories,
120
- x as simplifyPositions,
121
- ra as unionElectricalStates
4
+ Q as ALL_LOGIC_FAMILIES,
5
+ Fa as AdderBehavior,
6
+ E as AdderState,
7
+ dt as AdderVisualFactory,
8
+ B as ArithmeticState,
9
+ Ha as BRANCHING_POINT_SENTINEL,
10
+ ta as BatteryBehavior,
11
+ z as BatteryState,
12
+ Pa as BatteryVisualFactory,
13
+ aa as BehaviorRegistry,
14
+ Za as BranchingPointVisualFactory,
15
+ gt as BuildTool,
16
+ J as CIRCUIT_FILE_VERSION,
17
+ Oa as CMP_MATERIALS,
18
+ P as COMPONENT_TYPE_METADATA,
19
+ l as CameraOptions,
20
+ ua as Circuit,
21
+ ka as CircuitController,
22
+ ja as CircuitEngine,
23
+ Ga as CircuitMetadata,
24
+ W as CircuitOptions,
25
+ Z as CircuitRunner,
26
+ fa as CircuitRunnerController,
27
+ $a as CircuitWriter,
28
+ V as ClockBehavior,
29
+ ya as ClockState,
30
+ vt as ClockVisualFactory,
31
+ ht as CmpMatCategory,
32
+ Wa as CmpMatType,
33
+ za as CmpMatVariant,
34
+ j as Component,
35
+ tt as ComponentPickerWidget,
36
+ ga as ComponentState,
37
+ Na as ComponentType,
38
+ Ia as DEFAULT_LOGIC_FAMILY,
39
+ Ya as DefaultVisualFactory,
40
+ ca as DirtyTracker,
41
+ i as DoubleThrowSwitchBehavior,
42
+ C as DoubleThrowSwitchState,
43
+ At as DoubleThrowSwitchVisualFactory,
44
+ oa as ENode,
45
+ k as ENodeSourceType,
46
+ Aa as ENodeType,
47
+ sa as EightBitAdderBehavior,
48
+ g as EightBitAdderState,
49
+ rt as EightBitAdderVisualFactory,
50
+ H as EightBitOnesComplementBehavior,
51
+ p as EightBitOnesComplementState,
52
+ St as EightBitOnesComplementVisualFactory,
53
+ ma as EventQueue,
54
+ yt as FactoryRegistry,
55
+ ba as GroupedFactoryRegistry,
56
+ x as HalfAdderBehavior,
57
+ S as HalfAdderState,
58
+ Gt as HalfAdderVisualFactory,
59
+ Qa as HitboxLayers,
60
+ Xa as HoverManager,
61
+ Ta as InverterBehavior,
62
+ m as InverterState,
63
+ st as InverterVisualFactory,
64
+ Ka as LabelVisualFactory,
65
+ F as LightbulbBehavior,
66
+ t as LightbulbState,
67
+ Vt as LightbulbVisualFactory,
68
+ ea as Memoize,
69
+ s as MemoizeExpiring,
70
+ Ua as MultiSelectTool,
71
+ La as Nand4GateBehavior,
72
+ M as Nand4GateState,
73
+ ut as Nand4GateVisualFactory,
74
+ Ea as Nand8GateBehavior,
75
+ I as Nand8GateState,
76
+ Ct as Nand8GateVisualFactory,
77
+ X as NandGateBehavior,
78
+ h as NandGateState,
79
+ ct as NandGateVisualFactory,
80
+ q as Nor4GateBehavior,
81
+ D as Nor4GateState,
82
+ lt as Nor4GateVisualFactory,
83
+ K as Nor8GateBehavior,
84
+ r as Nor8GateState,
85
+ nt as Nor8GateVisualFactory,
86
+ b as NorGateBehavior,
87
+ y as NorGateState,
88
+ pt as NorGateVisualFactory,
89
+ Va as Position,
90
+ G as Position3D,
91
+ n as RectangleLEDBehavior,
92
+ _ as RectangleLEDState,
93
+ _a as RectangleLEDVisualFactory,
94
+ c as RelayBehavior,
95
+ O as RelayState,
96
+ Ja as RelayVisualFactory,
97
+ o as Rotation,
98
+ at as SCE_NS,
99
+ $ as SIMULATION_SPEED,
100
+ wa as SelectionManager,
101
+ la as SimulationState,
102
+ A as SmallLEDBehavior,
103
+ N as SmallLEDState,
104
+ Tt as SmallLEDVisualFactory,
105
+ f as StateManager,
106
+ va as SwitchBehavior,
107
+ R as SwitchState,
108
+ it as SwitchVisualFactory,
109
+ w as TRANSITION_DEFAULTS,
110
+ ha as Wire,
111
+ Ra as WireVisualManager,
112
+ Sa as Xor4GateBehavior,
113
+ v as Xor4GateState,
114
+ Bt as Xor4GateVisualFactory,
115
+ Y as Xor8GateBehavior,
116
+ d as Xor8GateState,
117
+ ot as Xor8GateVisualFactory,
118
+ ia as XorGateBehavior,
119
+ Da as XorGateState,
120
+ Nt as XorGateVisualFactory,
121
+ da as classifyGate,
122
+ U as computeGateDelay,
123
+ ra as computeTransitionSpan,
124
+ xa as controllerOptions,
125
+ qa as engineOptions,
126
+ L as findPositionBestIndex,
127
+ T as generateUUID,
128
+ e as getTransitionSpan,
129
+ Lt as mapControlsOptions,
130
+ pa as registerArithmeticComponentsBehaviors,
131
+ Et as registerArithmeticComponentsFactories,
132
+ na as registerBasicComponentsBehaviors,
133
+ mt as registerBasicComponentsFactories,
134
+ Ba as registerGatesComponentsBehaviors,
135
+ Ft as registerGatesComponentsFactories,
136
+ et as registerSceTranslations,
137
+ u as simplifyPositions,
138
+ Ca as unionElectricalStates
122
139
  };
@@ -102,6 +102,19 @@ export declare class CircuitEngine extends EventEmitter<CircuitEngineEventMap> {
102
102
  * Current operating mode
103
103
  */
104
104
  get mode(): EngineMode;
105
+ /**
106
+ * Refresh all scene widgets to display strings in the given language.
107
+ *
108
+ * Does NOT change the consumer's i18next instance — the caller must have
109
+ * already called `i18next.changeLanguage(lng)` before invoking this. This
110
+ * method only signals the scene to re-read translations for currently-open
111
+ * widgets (pin tooltip, component picker, config panel).
112
+ *
113
+ * Safe to call at any point in the engine lifecycle after `initialize()`.
114
+ *
115
+ * @param lng - Target language code (e.g., 'en', 'fr')
116
+ */
117
+ setLanguage(lng: string): void;
105
118
  /**
106
119
  * Switch between edit and simulation modes.
107
120
  *
@@ -40,4 +40,4 @@ export * from './shared/types';
40
40
  export { HitboxLayers } from './shared/utils/LayerConstants';
41
41
  export type { HitboxLayerValue } from './shared/utils/LayerConstants';
42
42
  export * from './shared/utils/Options';
43
- export { registerBasicComponentsFactories, registerGatesComponentsFactories } from './setup';
43
+ export { registerBasicComponentsFactories, registerGatesComponentsFactories, registerArithmeticComponentsFactories } from './setup';
@@ -1,47 +1,52 @@
1
- import { A as s, B as t, C as r, D as o, E as i, F as e, H as l, I as c, L as u, M as n, N as y, O as F, P as V, R as C, S as g, T as p, U as G, V as N, W as m, _ as M, a as L, b as R, c as S, d as T, f as d, g as E, h as b, i as h, j as B, k as I, l as D, m as O, n as P, o as w, p as A, r as H, s as W, t as _, u as f, v as k, w as v, x, y as X, z as j } from "../scene-CVsDdySt.js";
1
+ import { A as s, B as t, C as r, D as o, E as i, F as e, G as l, H as c, I as u, J as n, K as y, L as F, M as V, N as C, O as g, P as p, R as m, S as d, T as G, U as N, V as M, W as h, Y as E, _ as A, a as B, b as L, c as R, d as S, f as T, g as b, h as I, i as O, j as D, k as H, l as P, m as f, n as w, o as W, p as _, q as k, r as v, s as x, t as X, u as j, v as q, w as z, x as J, y as K, z as U } from "../scene-D4QcWeiq.js";
2
2
  export {
3
- G as BRANCHING_POINT_SENTINEL,
4
- x as BatteryVisualFactory,
5
- c as BranchingPointVisualFactory,
6
- l as BuildTool,
7
- p as CMP_MATERIALS,
8
- B as CircuitController,
9
- I as CircuitEngine,
10
- s as CircuitRunnerController,
11
- j as CircuitWriter,
12
- A as ClockVisualFactory,
13
- i as CmpMatCategory,
14
- o as CmpMatType,
15
- F as CmpMatVariant,
16
- m as ComponentPickerWidget,
17
- r as DefaultVisualFactory,
18
- O as DoubleThrowSwitchVisualFactory,
19
- v as FactoryRegistry,
20
- g as GroupedFactoryRegistry,
21
- C as HitboxLayers,
22
- u as HoverManager,
23
- d as InverterVisualFactory,
24
- R as LabelVisualFactory,
25
- X as LightbulbVisualFactory,
26
- N as MultiSelectTool,
27
- f as Nand4GateVisualFactory,
28
- D as Nand8GateVisualFactory,
29
- T as NandGateVisualFactory,
30
- W as Nor4GateVisualFactory,
31
- w as Nor8GateVisualFactory,
32
- S as NorGateVisualFactory,
33
- k as RectangleLEDVisualFactory,
34
- M as RelayVisualFactory,
35
- t as SelectionManager,
36
- E as SmallLEDVisualFactory,
37
- b as SwitchVisualFactory,
38
- e as WireVisualManager,
39
- h as Xor4GateVisualFactory,
40
- H as Xor8GateVisualFactory,
41
- L as XorGateVisualFactory,
42
- n as controllerOptions,
43
- y as engineOptions,
44
- V as mapControlsOptions,
45
- _ as registerBasicComponentsFactories,
46
- P as registerGatesComponentsFactories
3
+ W as AdderVisualFactory,
4
+ n as BRANCHING_POINT_SENTINEL,
5
+ i as BatteryVisualFactory,
6
+ M as BranchingPointVisualFactory,
7
+ k as BuildTool,
8
+ s as CMP_MATERIALS,
9
+ u as CircuitController,
10
+ p as CircuitEngine,
11
+ e as CircuitRunnerController,
12
+ h as CircuitWriter,
13
+ q as ClockVisualFactory,
14
+ D as CmpMatCategory,
15
+ V as CmpMatType,
16
+ C as CmpMatVariant,
17
+ E as ComponentPickerWidget,
18
+ g as DefaultVisualFactory,
19
+ K as DoubleThrowSwitchVisualFactory,
20
+ B as EightBitAdderVisualFactory,
21
+ O as EightBitOnesComplementVisualFactory,
22
+ H as FactoryRegistry,
23
+ o as GroupedFactoryRegistry,
24
+ x as HalfAdderVisualFactory,
25
+ N as HitboxLayers,
26
+ c as HoverManager,
27
+ A as InverterVisualFactory,
28
+ G as LabelVisualFactory,
29
+ z as LightbulbVisualFactory,
30
+ y as MultiSelectTool,
31
+ I as Nand4GateVisualFactory,
32
+ f as Nand8GateVisualFactory,
33
+ b as NandGateVisualFactory,
34
+ T as Nor4GateVisualFactory,
35
+ S as Nor8GateVisualFactory,
36
+ _ as NorGateVisualFactory,
37
+ r as RectangleLEDVisualFactory,
38
+ d as RelayVisualFactory,
39
+ l as SelectionManager,
40
+ J as SmallLEDVisualFactory,
41
+ L as SwitchVisualFactory,
42
+ t as WireVisualManager,
43
+ P as Xor4GateVisualFactory,
44
+ R as Xor8GateVisualFactory,
45
+ j as XorGateVisualFactory,
46
+ F as controllerOptions,
47
+ m as engineOptions,
48
+ U as mapControlsOptions,
49
+ X as registerArithmeticComponentsFactories,
50
+ w as registerBasicComponentsFactories,
51
+ v as registerGatesComponentsFactories
47
52
  };
@@ -16,3 +16,11 @@ export declare function registerBasicComponentsFactories(registry: IGroupedFacto
16
16
  * @returns The input registry for chaining
17
17
  */
18
18
  export declare function registerGatesComponentsFactories(registry: IGroupedFactoryRegistry): IGroupedFactoryRegistry;
19
+ /**
20
+ * Register all arithmetic components visual factories in the arithmetic group
21
+ * Arithmetic components are : HalfAdder
22
+ * @public
23
+ * @param registry - A grouped factory registry to populate
24
+ * @returns The input registry for chaining
25
+ */
26
+ export declare function registerArithmeticComponentsFactories(registry: IGroupedFactoryRegistry): IGroupedFactoryRegistry;
@@ -129,6 +129,12 @@ export declare abstract class AbstractCircuitController extends EventEmitter<Con
129
129
  * Get the current circuit being visualized
130
130
  */
131
131
  getCircuit(): Circuit | null;
132
+ /**
133
+ * Refresh any user-visible strings in owned widgets after the consumer has
134
+ * switched i18next to a new language. Default is a no-op for controllers
135
+ * that own no translated widgets.
136
+ */
137
+ setLanguage(_lng: string): void;
132
138
  protected abstract onSetCircuit(): void;
133
139
  /**
134
140
  * Loads a new circuit to visualize or null for clearing the scene
@@ -0,0 +1,54 @@
1
+ import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
2
+ import { Component, ComponentState } from '../../../../core/index.ts';
3
+ import { ConfigFormDefinition, VisualContext } from '../../types';
4
+ import * as THREE from 'three';
5
+ /**
6
+ * Visual factory for Adder components.
7
+ *
8
+ * Creates:
9
+ * - An `envelope` rectangular frame (EmptyRectangleGeometry)
10
+ * - A horizontal `separator` box dividing upper/lower chambers
11
+ * - A `sumFiller` (RectangleWithNailGeometry) in the upper chamber;
12
+ * its material is animated blue↔red following the sum output state
13
+ * - A `plus` box inside the sumFiller (visual cue)
14
+ * - A `carryFiller` (RectangleWithNailGeometry) box in the lower chamber; its material is animated
15
+ * blue↔red following the carry output state
16
+ * - pin groups for vcc, inputA, inputB, sum, carry, gnd
17
+ *
18
+ * Animation:
19
+ * - sumFiller ↔ blue/red based on sum output (current/next state)
20
+ * - carryFiller ↔ blue/red based on carry output (current/next state)
21
+ */
22
+ export declare class AdderVisualFactory extends ComponentVisualFactoryBase {
23
+ private readonly ENVELOPE_GEOM;
24
+ /** Horizontal separator splitting upper/lower chambers at Z=0 */
25
+ private readonly SEPARATOR_GEOM;
26
+ private readonly SEPARATOR_SIDE_GEOM;
27
+ private readonly CELL_FILLER_GEOM;
28
+ /** Small box inside sumFiller (visual cue for the XOR "+") */
29
+ private readonly PLUS_GEOM;
30
+ protected readonly FILLER_COLOR_HIGH: THREE.Color;
31
+ protected readonly FILLER_COLOR_LOW: THREE.Color;
32
+ protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
33
+ protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
34
+ constructor();
35
+ createVisual(component: Component, context: VisualContext): THREE.Object3D;
36
+ protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
37
+ getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
38
+ mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
39
+ mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
40
+ updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
41
+ private _setFillerColor;
42
+ private _ensureClonedFillerMaterial;
43
+ private _restoreSharedFillerMaterial;
44
+ private _cleanupMixer;
45
+ /**
46
+ * Animate sumFiller and carryFiller fill colors over the transition span.
47
+ * Builds a single AnimationClip with up to two target tracks per filler
48
+ * (color, emissive, emissiveIntensity) — only for fillers whose value changes.
49
+ */
50
+ private _animateFillers;
51
+ private _pushFillerTracks;
52
+ /** Find a child mesh by its userData.part name */
53
+ protected findPartMesh(object3D: THREE.Object3D, part: string): THREE.Mesh | null;
54
+ }
@@ -0,0 +1,45 @@
1
+ import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
2
+ import { Component, ComponentState } from '../../../../core/index.ts';
3
+ import { ConfigFormDefinition, VisualContext } from '../../types';
4
+ import * as THREE from 'three';
5
+ /**
6
+ * Visual factory for EightBitAdder components.
7
+ *
8
+ * Creates:
9
+ * - An `envelope` frame (KuKoGeometry)
10
+ * - A vertical `separator` dividing carry/sum cells
11
+ * - 7 horizontal separators dividing ith cells
12
+ * - 16 cells carry i / sum i representing state
13
+ * cells materials are animated blue↔red following the component state
14
+ * - pin groups for vcc, 2*8 inputs, 8*sums, carryIn, carryOut and gnd
15
+ *
16
+ */
17
+ export declare class EightBitAdderVisualFactory extends ComponentVisualFactoryBase {
18
+ private readonly ENVELOPE_GEOM;
19
+ private readonly VERTICAL_SEPARATOR_GEOM;
20
+ private readonly HORIZONTAL_SEPARATOR_GEOM;
21
+ private readonly CELL_FILLER_GEOM;
22
+ protected readonly FILLER_COLOR_HIGH: THREE.Color;
23
+ protected readonly FILLER_COLOR_LOW: THREE.Color;
24
+ protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
25
+ protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
26
+ constructor();
27
+ createVisual(component: Component, context: VisualContext): THREE.Object3D;
28
+ protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
29
+ getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
30
+ mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
31
+ mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
32
+ updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
33
+ private _setCellColor;
34
+ private _ensureClonedMaterial;
35
+ private _restoreSharedMaterial;
36
+ private _cleanupMixer;
37
+ /** Collect all 16 cell meshes with their state bit position. */
38
+ private _findCellMeshes;
39
+ /**
40
+ * Animate the 16 cells over the transition span.
41
+ * Builds a single AnimationClip with tracks only for cells whose bit changes.
42
+ */
43
+ private _animateCells;
44
+ private _pushCellTracks;
45
+ }
@@ -0,0 +1,63 @@
1
+ import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
2
+ import { Component, ComponentState } from '../../../../core/index.ts';
3
+ import { ConfigFormDefinition, VisualContext } from '../../types';
4
+ import * as THREE from 'three';
5
+ /**
6
+ * Visual factory for EightBitOnesComplement components.
7
+ *
8
+ * Creates:
9
+ * - An `envelope` frame (EmptyRectangleGeometry)
10
+ * - A vertical `separator` dividing flag area / outputs cells
11
+ * - 7 horizontal separators dividing ith cells
12
+ * - 2 rectangles with nail filler, 3 animated box geometry and 2 filler boxes for flag area
13
+ * - 8 cells outputs i representing output state
14
+ * cells materials are animated blue↔red following the component state
15
+ * - pin groups for vcc, 8 inputs, 8*outputs and gnd
16
+ *
17
+ */
18
+ export declare class EightBitOnesComplementVisualFactory extends ComponentVisualFactoryBase {
19
+ private readonly ENVELOPE_GEOM;
20
+ private readonly VERTICAL_SEPARATOR_GEOM;
21
+ private readonly HORIZONTAL_SEPARATOR_GEOM;
22
+ private readonly CELL_FILLER_GEOM;
23
+ private readonly INDICATOR_MINUS_GEOM;
24
+ private readonly INDICATOR_PLUS_GEOM;
25
+ private readonly INDICATOR_FILLER_GEOM;
26
+ protected readonly FILLER_COLOR_HIGH: THREE.Color;
27
+ protected readonly FILLER_COLOR_LOW: THREE.Color;
28
+ protected readonly FILLER_COLOR_NEUTRAL: THREE.Color;
29
+ protected readonly FILLER_EMISSIVE_BLACK: THREE.Color;
30
+ protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
31
+ protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
32
+ protected readonly FILLER_EMISSIVE_NEUTRAL_INTENSITY = 0;
33
+ constructor();
34
+ createVisual(component: Component, context: VisualContext): THREE.Object3D;
35
+ protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
36
+ getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
37
+ mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
38
+ mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
39
+ updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
40
+ /**
41
+ * Resolve the target color state for a cell given its kind and the bit value:
42
+ * - `output`: high→red, low→blue
43
+ * - `minus`: high→blue, low→red (inverted vs output — blue minus = complement active)
44
+ * - `plus`: high→white (blends with envelope, hiding the +), low→red
45
+ */
46
+ private _cellTarget;
47
+ private _setCellColor;
48
+ private _ensureClonedMaterial;
49
+ private _restoreSharedMaterial;
50
+ private _cleanupMixer;
51
+ /**
52
+ * Collect all animated cells (8 outputs + minus + 2 plus parts).
53
+ * Output cells read bits 0–7; the three indicator cells all read bit 8
54
+ * (the invert flag) but render it with different color rules.
55
+ */
56
+ private _findCellMeshes;
57
+ /**
58
+ * Animate all cells over the transition span.
59
+ * Builds a single AnimationClip with tracks only for cells whose bit changes.
60
+ */
61
+ private _animateCells;
62
+ private _pushCellTracks;
63
+ }
@@ -0,0 +1,55 @@
1
+ import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
2
+ import { Component, ComponentState } from '../../../../core/index.ts';
3
+ import { ConfigFormDefinition, VisualContext } from '../../types';
4
+ import * as THREE from 'three';
5
+ /**
6
+ * Visual factory for Half Adder components.
7
+ *
8
+ * Creates:
9
+ * - An `envelope` rectangular frame (EmptyRectangleGeometry)
10
+ * - A horizontal `separator` box dividing upper/lower chambers
11
+ * - A `sumFiller` (RectangleWithNailGeometry) in the upper chamber;
12
+ * its material is animated blue↔red following the sum output state
13
+ * - A `halfPlus` small box inside the sumFiller (visual cue)
14
+ * - A `carryFiller` box in the lower chamber; its material is animated
15
+ * blue↔red following the carry output state
16
+ * - pin groups for vcc, inputA, inputB, sum, carry, gnd
17
+ *
18
+ * Animation:
19
+ * - sumFiller ↔ blue/red based on sum output (current/next state)
20
+ * - carryFiller ↔ blue/red based on carry output (current/next state)
21
+ */
22
+ export declare class HalfAdderVisualFactory extends ComponentVisualFactoryBase {
23
+ private readonly ENVELOPE_GEOM;
24
+ /** Horizontal separator splitting upper/lower chambers at Z=0 */
25
+ private readonly SEPARATOR_GEOM;
26
+ private readonly SEPARATOR_SIDE_GEOM;
27
+ private readonly SUM_FILLER_GEOM;
28
+ /** Small box inside sumFiller (visual cue for the XOR "+") */
29
+ private readonly HALF_PLUS_GEOM;
30
+ private readonly CARRY_FILLER_GEOM;
31
+ protected readonly FILLER_COLOR_HIGH: THREE.Color;
32
+ protected readonly FILLER_COLOR_LOW: THREE.Color;
33
+ protected readonly FILLER_EMISSIVE_HIGH_INTENSITY = 0.5;
34
+ protected readonly FILLER_EMISSIVE_LOW_INTENSITY = 0.2;
35
+ constructor();
36
+ createVisual(component: Component, context: VisualContext): THREE.Object3D;
37
+ protected createPinsVisual(component: Component, context: VisualContext, group: THREE.Group): void;
38
+ getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
39
+ mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
40
+ mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
41
+ updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
42
+ private _setFillerColor;
43
+ private _ensureClonedFillerMaterial;
44
+ private _restoreSharedFillerMaterial;
45
+ private _cleanupMixer;
46
+ /**
47
+ * Animate sumFiller and carryFiller fill colors over the transition span.
48
+ * Builds a single AnimationClip with up to two target tracks per filler
49
+ * (color, emissive, emissiveIntensity) — only for fillers whose value changes.
50
+ */
51
+ private _animateFillers;
52
+ private _pushFillerTracks;
53
+ /** Find a child mesh by its userData.part name */
54
+ protected findPartMesh(object3D: THREE.Object3D, part: string): THREE.Mesh | null;
55
+ }
@@ -0,0 +1,4 @@
1
+ export { AdderVisualFactory } from './AdderVisualFactory';
2
+ export { HalfAdderVisualFactory } from './HalfAdderVisualFactory';
3
+ export { EightBitAdderVisualFactory } from './EightBitAdderVisualFactory';
4
+ export { EightBitOnesComplementVisualFactory } from './EightBitOnesComplementVisualFactory';