simple-circuit-engine 0.0.13 → 0.0.14

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 (77) hide show
  1. package/AGENTS.md +7 -5
  2. package/README.md +8 -8
  3. package/dist/core/index.js +110 -85
  4. package/dist/core/setup.d.ts +10 -0
  5. package/dist/core/simulation/behaviors/index.d.ts +10 -0
  6. package/dist/core/simulation/behaviors/interface/EightInputBehavior.d.ts +9 -0
  7. package/dist/core/simulation/behaviors/interface/EightLightBehavior.d.ts +9 -0
  8. package/dist/core/simulation/behaviors/interface/FourInputBehavior.d.ts +9 -0
  9. package/dist/core/simulation/behaviors/interface/FourLightBehavior.d.ts +9 -0
  10. package/dist/core/simulation/behaviors/interface/InputBehaviorMixin.d.ts +37 -0
  11. package/dist/core/simulation/behaviors/interface/LightBehaviorMixin.d.ts +60 -0
  12. package/dist/core/simulation/behaviors/interface/OneInputBehavior.d.ts +9 -0
  13. package/dist/core/simulation/behaviors/interface/OneLightBehavior.d.ts +9 -0
  14. package/dist/core/simulation/behaviors/interface/TwoInputBehavior.d.ts +9 -0
  15. package/dist/core/simulation/behaviors/interface/TwoLightBehavior.d.ts +9 -0
  16. package/dist/core/simulation/behaviors/interface/index.d.ts +0 -0
  17. package/dist/core/simulation/states/index.d.ts +10 -0
  18. package/dist/core/simulation/states/interface/EightInputState.d.ts +6 -0
  19. package/dist/core/simulation/states/interface/EightLightState.d.ts +6 -0
  20. package/dist/core/simulation/states/interface/FourInputState.d.ts +6 -0
  21. package/dist/core/simulation/states/interface/FourLightState.d.ts +6 -0
  22. package/dist/core/simulation/states/interface/InputState.d.ts +45 -0
  23. package/dist/core/simulation/states/interface/LightState.d.ts +54 -0
  24. package/dist/core/simulation/states/interface/OneInputState.d.ts +6 -0
  25. package/dist/core/simulation/states/interface/OneLightState.d.ts +6 -0
  26. package/dist/core/simulation/states/interface/TwoInputState.d.ts +6 -0
  27. package/dist/core/simulation/states/interface/TwoLightState.d.ts +6 -0
  28. package/dist/core/simulation/types.d.ts +9 -1
  29. package/dist/core/topology/Component.d.ts +4 -0
  30. package/dist/core/topology/ENode.d.ts +7 -2
  31. package/dist/core/topology/index.d.ts +2 -0
  32. package/dist/core/topology/networkTraversal.d.ts +50 -0
  33. package/dist/core/topology/types.d.ts +13 -2
  34. package/dist/{core-b6Q8w2sn.js → core-HH6iRWtB.js} +1850 -739
  35. package/dist/core-HH6iRWtB.js.map +1 -0
  36. package/dist/i18n/index.d.ts +276 -0
  37. package/dist/i18n/locales/en.json.d.ts +98 -0
  38. package/dist/i18n/locales/fr.json.d.ts +98 -0
  39. package/dist/index.js +172 -135
  40. package/dist/scene/CircuitEngine.d.ts +36 -4
  41. package/dist/scene/index.d.ts +6 -2
  42. package/dist/scene/index.js +62 -50
  43. package/dist/scene/setup.d.ts +10 -0
  44. package/dist/scene/shared/AbstractCircuitController.d.ts +5 -3
  45. package/dist/scene/shared/HoverManager.d.ts +15 -0
  46. package/dist/scene/shared/components/index.d.ts +10 -0
  47. package/dist/scene/shared/components/interface/EightInputVisualFactory.d.ts +15 -0
  48. package/dist/scene/shared/components/interface/EightLightVisualFactory.d.ts +15 -0
  49. package/dist/scene/shared/components/interface/FourInputVisualFactory.d.ts +15 -0
  50. package/dist/scene/shared/components/interface/FourLightVisualFactory.d.ts +15 -0
  51. package/dist/scene/shared/components/interface/InputVisualFactoryBase.d.ts +50 -0
  52. package/dist/scene/shared/components/interface/LightVisualFactoryBase.d.ts +46 -0
  53. package/dist/scene/shared/components/interface/OneInputVisualFactory.d.ts +15 -0
  54. package/dist/scene/shared/components/interface/OneLightVisualFactory.d.ts +15 -0
  55. package/dist/scene/shared/components/interface/TwoInputVisualFactory.d.ts +15 -0
  56. package/dist/scene/shared/components/interface/TwoLightVisualFactory.d.ts +15 -0
  57. package/dist/scene/shared/types.d.ts +34 -2
  58. package/dist/scene/shared/utils/ControlsUtils.d.ts +1 -1
  59. package/dist/scene/shared/utils/GeometryUtils.d.ts +35 -0
  60. package/dist/scene/static/CircuitController.d.ts +12 -1
  61. package/dist/scene/static/tools/BuildTool.d.ts +77 -0
  62. package/dist/scene/static/tools/MultiWiringPlacement.d.ts +40 -0
  63. package/dist/scene/widgets/HelpWidget.d.ts +13 -0
  64. package/dist/scene/widgets/ModeWidget.d.ts +16 -0
  65. package/dist/scene/widgets/MultiWiringWidget.d.ts +21 -0
  66. package/dist/scene/{static → widgets}/PinTooltipWidget.d.ts +2 -1
  67. package/dist/scene/widgets/SimulationPlayerWidget.d.ts +62 -0
  68. package/dist/scene/widgets/ToolsWidget.d.ts +18 -0
  69. package/dist/scene/widgets/WidgetsManager.d.ts +65 -0
  70. package/dist/scene/widgets/assets/icons.d.ts +20 -0
  71. package/dist/scene/widgets/index.d.ts +9 -0
  72. package/dist/scene/widgets/styles.d.ts +33 -0
  73. package/dist/{scene-D4QcWeiq.js → scene-C1xhdw_B.js} +3311 -1478
  74. package/dist/scene-C1xhdw_B.js.map +1 -0
  75. package/package.json +2 -2
  76. package/dist/core-b6Q8w2sn.js.map +0 -1
  77. package/dist/scene-D4QcWeiq.js.map +0 -1
@@ -0,0 +1,18 @@
1
+ import { ToolType } from '../shared/types';
2
+ export declare class ToolsWidget {
3
+ private readonly _root;
4
+ private readonly _buildBtn;
5
+ private readonly _multiSelectBtn;
6
+ private readonly _onSelect;
7
+ private _activeTool;
8
+ constructor(initialTool: ToolType | null, onSelect: (tool: ToolType) => void);
9
+ mount(parent: HTMLElement): void;
10
+ setVisible(visible: boolean): void;
11
+ setActiveTool(tool: ToolType | null): void;
12
+ setLanguage(_lng: string): void;
13
+ dispose(): void;
14
+ /** Test/debug accessor. */
15
+ get element(): HTMLDivElement;
16
+ private _makeButton;
17
+ private _render;
18
+ }
@@ -0,0 +1,65 @@
1
+ import { EngineMode, ToolType } from '../shared/types';
2
+ import { HelpWidget } from './HelpWidget';
3
+ import { SimulationPlayerWidget } from './SimulationPlayerWidget';
4
+ /**
5
+ * Minimal slice of CircuitEngine the manager depends on. Defined as an
6
+ * interface (rather than importing `CircuitEngine` directly) to keep widgets
7
+ * unit-testable with a small mock.
8
+ */
9
+ export interface IEngineForWidgets {
10
+ readonly mode: EngineMode;
11
+ readonly multiWiring: boolean;
12
+ readonly simulationSpeed: number;
13
+ readonly minSimulationSpeed: number;
14
+ readonly maxSimulationSpeed: number;
15
+ readonly isPlaying: boolean;
16
+ setMode(mode: EngineMode): void;
17
+ setActiveTool(toolType: ToolType): void;
18
+ getActiveTool(): ToolType | null;
19
+ setEditModeEnabled(enabled: boolean): void;
20
+ setMultiWiring(value: boolean): void;
21
+ play(): void;
22
+ pause(): void;
23
+ step(): void;
24
+ stop(): void;
25
+ requestHelp(): void;
26
+ on(event: any, callback: (payload: any) => void): void;
27
+ off(event: any, callback: (payload: any) => void): void;
28
+ }
29
+ export declare class WidgetsManager {
30
+ private readonly _engine;
31
+ private readonly _container;
32
+ private readonly _root;
33
+ private readonly _modeWidget;
34
+ private readonly _toolsWidget;
35
+ private readonly _multiWiringWidget;
36
+ private readonly _playerWidget;
37
+ private readonly _helpWidget;
38
+ private readonly _subscriptions;
39
+ private _disposed;
40
+ private _resizeObserver;
41
+ constructor(engine: IEngineForWidgets, container: HTMLElement);
42
+ /**
43
+ * Re-render translated labels after the consumer changed i18next language.
44
+ */
45
+ setLanguage(lng: string): void;
46
+ dispose(): void;
47
+ /** Test/debug accessor. */
48
+ get root(): HTMLDivElement;
49
+ /** Test/debug accessor. */
50
+ get container(): HTMLElement;
51
+ /** Test/debug accessor. */
52
+ get helpWidget(): HelpWidget;
53
+ /** Test/debug accessor. */
54
+ get playerWidget(): SimulationPlayerWidget;
55
+ private _subscribeToEngine;
56
+ private _listen;
57
+ private _applyModeVisibility;
58
+ private _handleModeToggle;
59
+ private _handleToolSelect;
60
+ private _handleMultiWiringToggle;
61
+ private _handleHelpRequested;
62
+ private _applyResponsivePlayerLayout;
63
+ private _observeContainerResize;
64
+ private _safeCall;
65
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Embedded heroicon SVGs (24x24 outline) used by the integrated widgets.
3
+ *
4
+ * Sources: https://heroicons.com/ (MIT). Inlined as raw markup so the library
5
+ * ships no external icon dependency and CSS `currentColor` drives the stroke.
6
+ */
7
+ export declare const wrenchScrewdriverIcon: string;
8
+ export declare const cubeTransparentIcon: string;
9
+ export declare const barsArrowDownIcon: string;
10
+ export declare const playIcon: string;
11
+ export declare const pauseIcon: string;
12
+ export declare const stepIcon: string;
13
+ export declare const stopIcon: string;
14
+ export declare const questionMarkIcon: string;
15
+ /**
16
+ * Wrap an inline SVG string into a `<span>` so it can be appended to any
17
+ * widget DOM. The SVG inherits `color` from the parent button so styling stays
18
+ * declarative.
19
+ */
20
+ export declare function iconElement(svg: string, sizePx?: number): HTMLElement;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Integrated overlay widgets shipped with the scene module.
3
+ *
4
+ * Public surface kept minimal: only `WidgetsManager` is exported so consumers
5
+ * who opt out of the bundled wiring can still mount it manually. Individual
6
+ * widgets are implementation detail.
7
+ */
8
+ export { WidgetsManager } from './WidgetsManager';
9
+ export type { IEngineForWidgets } from './WidgetsManager';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared inline-style helpers for the integrated widgets.
3
+ *
4
+ * Library convention is to avoid bundling a stylesheet — every widget styles
5
+ * its DOM via `Object.assign(el.style, ...)`. These helpers centralise the
6
+ * shared tokens (button base, active state, container) so the four widgets
7
+ * stay visually consistent without an external CSS file.
8
+ */
9
+ export declare const WIDGET_Z_INDEX = 1500;
10
+ /** Base background and border for square icon buttons (inactive state). */
11
+ export declare function applyIconButtonBase(button: HTMLButtonElement): void;
12
+ /** Toggle the active visual variant on an icon button. */
13
+ export declare function setIconButtonActive(button: HTMLButtonElement, active: boolean): void;
14
+ /** Position a widget root absolutely inside the engine container. */
15
+ export declare function applyWidgetRoot(el: HTMLElement, top: number, left: number): void;
16
+ /** Vertical layout offsets (px) for the left-edge widget stack. */
17
+ export declare const LAYOUT: {
18
+ readonly GUTTER: 12;
19
+ readonly BUTTON: 36;
20
+ readonly MODE_TOP: 12;
21
+ readonly TOOLS_TOP: 60;
22
+ readonly MULTI_WIRING_TOP: 60;
23
+ readonly MULTI_WIRING_LEFT: 53;
24
+ readonly PLAYER_TOP: 8;
25
+ readonly PLAYER_LEFT: 170;
26
+ readonly PLAYER_RESPONSIVE_TOP: 60;
27
+ readonly PLAYER_RESPONSIVE_LEFT: 12;
28
+ readonly HELP_TOP_EDIT: 10;
29
+ readonly HELP_LEFT_EDIT: 100;
30
+ readonly HELP_TOP_SIM: 10;
31
+ readonly HELP_LEFT_SIM: 130;
32
+ readonly LEFT: 12;
33
+ };