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
@@ -27,3 +27,7 @@ export { Nor8GateVisualFactory } from './gates/Nor8GateVisualFactory';
27
27
  export { XorGateVisualFactory } from './gates/XorGateVisualFactory';
28
28
  export { Xor4GateVisualFactory } from './gates/Xor4GateVisualFactory';
29
29
  export { Xor8GateVisualFactory } from './gates/Xor8GateVisualFactory';
30
+ export { HalfAdderVisualFactory } from './arithmetic/HalfAdderVisualFactory';
31
+ export { AdderVisualFactory } from './arithmetic/AdderVisualFactory';
32
+ export { EightBitAdderVisualFactory } from './arithmetic/EightBitAdderVisualFactory';
33
+ export { EightBitOnesComplementVisualFactory } from './arithmetic/EightBitOnesComplementVisualFactory';
@@ -452,8 +452,6 @@ export type ConfigControlType = 'dropdown' | 'color' | 'number' | 'text' | 'bool
452
452
  export interface ConfigFieldDefinition {
453
453
  /** Config map key (e.g., "activeColor", "initialState") */
454
454
  key: string;
455
- /** Human-readable label for the form field */
456
- label: string;
457
455
  /** Control type to render */
458
456
  type: ConfigControlType;
459
457
  /** Options for dropdown type (array or label-value object) */
@@ -247,6 +247,36 @@ export declare function XorGateTailGeometry(orWidth: number, orHeight: number, t
247
247
  */
248
248
  export declare function LGeometry(width: number, height: number, thickness: number, angle: number, invert: boolean, junctionRadius: number, depth: number, steps?: number): ExtrudeGeometry;
249
249
  export declare function CyclicTrapezoidGeometry(width: number, tailHeight: number, headHeight: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
250
+ /**
251
+ * Create an ExtrudeGeometry shaped like an empty rectangle (frame/border).
252
+ * Shape is centered at origin. The inner hole is a smaller rectangle inset
253
+ * by `thickness` on all four sides.
254
+ *
255
+ * @param width - Total width of the outer rectangle
256
+ * @param height - Total height of the outer rectangle
257
+ * @param thickness - Wall thickness of the frame (inset on each side)
258
+ * @param depth - Extrusion depth
259
+ * @param steps - Number of extrusion steps
260
+ * @constructor
261
+ */
262
+ export declare function EmptyRectangleGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
263
+ /**
264
+ * Create an ExtrudeGeometry shaped like a rectangle with a rectangular "nail"
265
+ * (intrusion or protrusion)
266
+ * The main rectangle is centered at origin; the nail hangs inside or outside it.
267
+ *
268
+ * @param width - Total width of the rectangle
269
+ * @param height - Height of the main rectangle body
270
+ * @param nailWidth - Width of the nail intrusion
271
+ * @param nailHeight - Height of the nail
272
+ * @param nailX - Horizontal center of the nail, measured from the rectangle's left edge
273
+ * @param protusion - if false nail will enter inside the rectangle (intrusion), else outside (protusion)
274
+ * @param depth - Extrusion depth
275
+ * @param steps - Number of extrusion steps
276
+ * @throws Error if nail dimensions or position are geometrically invalid
277
+ * @constructor
278
+ */
279
+ export declare function RectangleWithNailGeometry(width: number, height: number, nailWidth: number, nailHeight: number, nailX: number, protusion: boolean, depth: number, steps?: number): ExtrudeGeometry;
250
280
  /**
251
281
  * Create an ExtrudeGeometry for the inner hole of a cyclic trapezoid.
252
282
  * Returns null when the geometry should be solid (no hole).
@@ -259,3 +289,49 @@ export declare function CyclicTrapezoidGeometry(width: number, tailHeight: numbe
259
289
  * @param steps - Number of extrusion steps
260
290
  */
261
291
  export declare function CyclicTrapezoidHoleGeometry(width: number, tailHeight: number, headHeight: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry | null;
292
+ /**
293
+ * Create an ExtrudeGeometry for a drip (teardrop) shape.
294
+ * The shape has a sharp pointed tip at the top and a rounded bottom.
295
+ * Shape is centered at origin.
296
+ *
297
+ * Construction: the rounded bottom is a circle of radius width/2 centered at
298
+ * y = -height/2 + width/2. Two straight tangent lines connect the circle to the
299
+ * tip at (0, +height/2). This requires height > width so the tip sits above the
300
+ * circle and the tangent lines exist.
301
+ *
302
+ * @param width - Total width
303
+ * @param height - Total height (must be > width)
304
+ * @param thickness - Wall thickness of the shell
305
+ * @param depth - Extrusion depth
306
+ * @param steps - Number of extrusion steps
307
+ * @throws Error if height <= width (tip too low for tangent construction)
308
+ * @constructor
309
+ */
310
+ export declare function DripGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry;
311
+ /**
312
+ * Create an ExtrudeGeometry for the inner hole of a drip shape.
313
+ * Returns null when thickness is large enough that the drip has no hole.
314
+ *
315
+ * @param width - Total width
316
+ * @param height - Total height (must be > width)
317
+ * @param thickness - Wall thickness
318
+ * @param depth - Extrusion depth
319
+ * @param steps - Number of extrusion steps
320
+ * @throws Error if height <= width
321
+ */
322
+ export declare function DripHoleGeometry(width: number, height: number, thickness: number, depth: number, steps?: number): ExtrudeGeometry | null;
323
+ /**
324
+ * Create an ExtrudeGeometry shaped like japanese hiragana Ku and katakana Ko (くコ)
325
+ * Shape is centered horizontally at the junction between the two and vertically at the middle height
326
+ * by `kuThickness` on all four sides.
327
+ *
328
+ * @param kuWidth - width of the left ku part (outer)
329
+ * @param koWidth - width of the right ko part (outer)
330
+ * @param height - Total height of the outer geometry
331
+ * @param kuThickness - Wall kuThickness of the frame (inset on ku side)
332
+ * @param koThickness - Wall koThickness of the frame (inset on ko side)
333
+ * @param depth - Extrusion depth
334
+ * @param steps - Number of extrusion steps
335
+ * @constructor
336
+ */
337
+ export declare function KuKoGeometry(kuWidth: number, koWidth: number, height: number, kuThickness: number, koThickness: number, depth: number, steps?: number): ExtrudeGeometry;
@@ -41,6 +41,7 @@ export declare class CircuitController extends AbstractCircuitController {
41
41
  * @throws {TypeError} factoryRegistry is null/undefined
42
42
  */
43
43
  constructor(factoryRegistry: IFactoryRegistry, sharedResources?: SharedResources);
44
+ setLanguage(lng: string): void;
44
45
  /**
45
46
  * Specific Initialization logic, performed after AbstractCircuitController initialization
46
47
  * @private
@@ -21,6 +21,11 @@ export declare class PinTooltipWidget {
21
21
  /** Update cursor position without recreating the tooltip */
22
22
  updatePosition(clientX: number, clientY: number): void;
23
23
  get isVisible(): boolean;
24
+ /**
25
+ * Signal a language change — hides any open tooltip so the next hover
26
+ * recreates it with updated translations.
27
+ */
28
+ setLanguage(_lng: string): void;
24
29
  dispose(): void;
25
30
  private _position;
26
31
  }
@@ -49,6 +49,10 @@ export declare class BuildTool implements IEditingTool {
49
49
  * Cancels any active operations and removes all event handlers
50
50
  */
51
51
  onDeactivate(): void;
52
+ /**
53
+ * Forward a language change to the component picker.
54
+ */
55
+ setLanguage(lng: string): void;
52
56
  /**
53
57
  * Cancel current ongoing operation : can be called from outside if needed
54
58
  */
@@ -31,6 +31,7 @@ export interface ComponentPickerState {
31
31
  export declare class ComponentPickerWidget {
32
32
  private readonly registry;
33
33
  private container;
34
+ private titleEl;
34
35
  private groupDropdown;
35
36
  private itemList;
36
37
  private state;
@@ -69,6 +70,12 @@ export declare class ComponentPickerWidget {
69
70
  * Full cleanup including state reset.
70
71
  */
71
72
  dispose(): void;
73
+ /**
74
+ * Refresh all user-visible text in place after a language change.
75
+ * No-op if the widget is not currently open.
76
+ * Preserves drag position, scroll, resize dimensions, and current selection.
77
+ */
78
+ setLanguage(_lng: string): void;
72
79
  private createDOM;
73
80
  private renderItemList;
74
81
  private createItemElement;
@@ -16,6 +16,8 @@ export declare class ConfigPanelWidget {
16
16
  private readonly editComponentConfig;
17
17
  private _isOpen;
18
18
  private _currentComponentId;
19
+ private _currentComponent;
20
+ private _currentFactory;
19
21
  private gui;
20
22
  private container;
21
23
  private formDataObject;
@@ -77,6 +79,18 @@ export declare class ConfigPanelWidget {
77
79
  * @param factory - Visual factory for the component
78
80
  */
79
81
  private onValueChange;
82
+ /**
83
+ * Resolve a form field label via i18n, falling back to a humanised form
84
+ * of the field key when no translation is available (e.g. "transitionSpan" →
85
+ * "Transition Span"). The fallback covers two cases: (a) the consumer never
86
+ * called registerSceTranslations, (b) the key is not yet in the locale file.
87
+ */
88
+ private _resolveFieldLabel;
89
+ /**
90
+ * Refresh the panel to display strings in the current language.
91
+ * No-op if the panel is not open.
92
+ */
93
+ setLanguage(_lng: string): void;
80
94
  /**
81
95
  * Rebuild the GUI in place, re-reading the updated component config.
82
96
  * Used after interdependent field changes (defaultLogicFamily, activationLogic).