simple-circuit-engine 0.0.8 → 0.0.9
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/dist/index.d.ts
CHANGED
|
@@ -1244,7 +1244,7 @@ export declare class CircuitController extends AbstractCircuitController {
|
|
|
1244
1244
|
* Specific Initialization logic, performed after AbstractCircuitController initialization
|
|
1245
1245
|
* @private
|
|
1246
1246
|
*/
|
|
1247
|
-
protected onInitialize(
|
|
1247
|
+
protected onInitialize(_options?: ControllerOptions): void;
|
|
1248
1248
|
protected emitReady(): void;
|
|
1249
1249
|
/**
|
|
1250
1250
|
* Enable or disable edit mode (FR-006, FR-027)
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as e, C as s, j as o, i, a as r, D as n, E as l, d as c, m as u, P as y, h as S, R as g, l as p, S as C, k as T, T as m, f as h, e as B, g as E, c as D, s as F } from "./CircuitRunner-FXM_s5ll.js";
|
|
2
2
|
import { BatteryBehavior as R, BatteryState as d, BehaviorRegistry as v, Circuit as M, CircuitMetadata as V, ComponentState as b, ENode as A, LightbulbBehavior as P, LightbulbState as f, RectangleLEDBehavior as N, RectangleLEDState as O, RelayBehavior as I, RelayState as x, SmallLEDBehavior as U, SmallLEDState as W, SwitchBehavior as _, SwitchState as k, TransistorBehavior as w, TransistorState as H, Wire as j, registerBasicComponentsBehaviors as Q } from "./core/index.js";
|
|
3
|
-
import { A as q, f as z, d as G, B as J, a as K, C as X, b as Z, c as $, D as aa, F as ta, e as ea, H as sa, L as oa, g as ia, M as ra, R as na, h as la, S as ca, i as ua, j as ya, T as Sa, W as ga, k as pa, l as Ca, m as Ta, r as ma } from "./setup-
|
|
3
|
+
import { A as q, f as z, d as G, B as J, a as K, C as X, b as Z, c as $, D as aa, F as ta, e as ea, H as sa, L as oa, g as ia, M as ra, R as na, h as la, S as ca, i as ua, j as ya, T as Sa, W as ga, k as pa, l as Ca, m as Ta, r as ma } from "./setup-YQJVUHFM.js";
|
|
4
4
|
export {
|
|
5
5
|
q as AddComponentTool,
|
|
6
6
|
R as BatteryBehavior,
|
package/dist/scene/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as r, f as t, d as i, B as o, a as l, C as e, b as n, c, D as u, F as y, e as F, H as g, L as V, g as C, M as p, R as m, h as L, S as b, i as B, j as M, T as R, W as S, k as T, l as d, m as h, r as D } from "../setup-
|
|
1
|
+
import { A as r, f as t, d as i, B as o, a as l, C as e, b as n, c, D as u, F as y, e as F, H as g, L as V, g as C, M as p, R as m, h as L, S as b, i as B, j as M, T as R, W as S, k as T, l as d, m as h, r as D } from "../setup-YQJVUHFM.js";
|
|
2
2
|
export {
|
|
3
3
|
r as AddComponentTool,
|
|
4
4
|
t as BatteryVisualFactory,
|
|
@@ -3540,7 +3540,7 @@ function J(c = void 0) {
|
|
|
3540
3540
|
};
|
|
3541
3541
|
return c ? { ...e, ...c } : e;
|
|
3542
3542
|
}
|
|
3543
|
-
function
|
|
3543
|
+
function W(c = void 0) {
|
|
3544
3544
|
const e = {
|
|
3545
3545
|
backgroundColor: 2236976,
|
|
3546
3546
|
colorCenterLine: 14540202,
|
|
@@ -3555,10 +3555,10 @@ function L(c = void 0) {
|
|
|
3555
3555
|
function ce(c = void 0) {
|
|
3556
3556
|
const e = {
|
|
3557
3557
|
initialMode: "edit",
|
|
3558
|
-
controllerOptions:
|
|
3558
|
+
controllerOptions: W(),
|
|
3559
3559
|
runnerOptions: { enableHistory: !1, historyLimit: 1 }
|
|
3560
3560
|
};
|
|
3561
|
-
return c ? (c.controllerOptions =
|
|
3561
|
+
return c ? (c.controllerOptions = W(c.controllerOptions), { ...e, ...c }) : e;
|
|
3562
3562
|
}
|
|
3563
3563
|
function ye(c, e, t) {
|
|
3564
3564
|
const i = new Me(c, e);
|
|
@@ -3606,7 +3606,7 @@ class we extends ue {
|
|
|
3606
3606
|
constructor(e, t) {
|
|
3607
3607
|
if (super(), !e)
|
|
3608
3608
|
throw new TypeError("FactoryRegistry is required");
|
|
3609
|
-
this._options =
|
|
3609
|
+
this._options = W(), t ? (this._sharedResources = t, this._useSharedResources = !0, this.factoryRegistry = t.factoryRegistry, this.branchingPointVisualFactory = t.branchingPointVisualFactory, this.wireVisualManager = t.wireVisualManager) : (this._useSharedResources = !1, this.factoryRegistry = e, this.branchingPointVisualFactory = new M(), this.wireVisualManager = new _e(this._componentObject3Ds, this._wireObject3Ds));
|
|
3610
3610
|
}
|
|
3611
3611
|
get componentObject3Ds() {
|
|
3612
3612
|
return this._componentObject3Ds;
|
|
@@ -3640,7 +3640,7 @@ class we extends ue {
|
|
|
3640
3640
|
*/
|
|
3641
3641
|
initialize(e, t) {
|
|
3642
3642
|
if (!this._initialized) {
|
|
3643
|
-
if (t =
|
|
3643
|
+
if (t = W(t), this._options = t, !e || !(e instanceof HTMLElement)) {
|
|
3644
3644
|
const i = new TypeError("Container must be a valid HTMLElement");
|
|
3645
3645
|
throw this.emitError(i), i;
|
|
3646
3646
|
}
|
|
@@ -3721,7 +3721,7 @@ class we extends ue {
|
|
|
3721
3721
|
this._circuit = null, this.wireVisualManager.setCircuit(null), this.emit("circuitCleared", { name: t });
|
|
3722
3722
|
}
|
|
3723
3723
|
if (!this._useSharedResources && this._grid && (this._grid.geometry.dispose(), this._grid.dispose(), this._scene.remove(this._grid), this._grid = null), e !== null) {
|
|
3724
|
-
const t = this._options ||
|
|
3724
|
+
const t = this._options || W();
|
|
3725
3725
|
if (this._circuit = e, this._scene.name = this._circuit.metadata.name || "Circuit Scene", this.wireVisualManager.setCircuit(e), this._gridHalfSize = Math.ceil(e.metadata.size / 2), !this._useSharedResources && (this._grid = G(
|
|
3726
3726
|
e.metadata.size,
|
|
3727
3727
|
e.metadata.divisions,
|
|
@@ -5408,7 +5408,7 @@ class Ke extends we {
|
|
|
5408
5408
|
* @private
|
|
5409
5409
|
*/
|
|
5410
5410
|
onInitialize(e) {
|
|
5411
|
-
|
|
5411
|
+
this._initializeTools(), this._initializeSelectionManager(), this._initializeConfigPanelManager(), this._initialized = !0, this._sharedResources || this.setActive(!0);
|
|
5412
5412
|
}
|
|
5413
5413
|
emitReady() {
|
|
5414
5414
|
this.emit("ready", { controllerType: "static" });
|
|
@@ -5820,7 +5820,7 @@ class Ke extends we {
|
|
|
5820
5820
|
autoAdjustCircuitGridSize() {
|
|
5821
5821
|
if (this._checkInitialized(), !!this._circuit && this.circuitWriter.saveAutoAdjustCircuitSize()) {
|
|
5822
5822
|
this._gridHalfSize = Math.ceil(this._circuit.metadata.size / 2), this.grid && (this._scene.remove(this.grid), this.grid.geometry.dispose());
|
|
5823
|
-
const e = this._options ||
|
|
5823
|
+
const e = this._options || W();
|
|
5824
5824
|
this.grid = G(
|
|
5825
5825
|
this._circuit.metadata.size,
|
|
5826
5826
|
this._circuit.metadata.divisions,
|
|
@@ -5970,7 +5970,7 @@ class Ze extends we {
|
|
|
5970
5970
|
* @param options - Controller options passed to initialize()
|
|
5971
5971
|
*/
|
|
5972
5972
|
onInitialize(e) {
|
|
5973
|
-
e && (e.simulationSpeed && (this.simulationSpeed = e.simulationSpeed), typeof e.simulationAutoPlay == "boolean" && (this._autoPlay = e.simulationAutoPlay)), this._clickHandler = this._handleClick.bind(this), this._container.addEventListener("click", this._clickHandler);
|
|
5973
|
+
e && (e.simulationSpeed && (this.simulationSpeed = e.simulationSpeed), typeof e.simulationAutoPlay == "boolean" && (this._autoPlay = e.simulationAutoPlay)), this._clickHandler = this._handleClick.bind(this), this._container.addEventListener("click", this._clickHandler), this._sharedResources || this.setActive(!0);
|
|
5974
5974
|
}
|
|
5975
5975
|
emitReady() {
|
|
5976
5976
|
this.emit("ready", { controllerType: "simulation" });
|
|
@@ -8159,7 +8159,7 @@ class k extends b {
|
|
|
8159
8159
|
}
|
|
8160
8160
|
// Uses default hover implementation
|
|
8161
8161
|
}
|
|
8162
|
-
class
|
|
8162
|
+
class L extends b {
|
|
8163
8163
|
/** Transistor lit color (yellow glow) */
|
|
8164
8164
|
static TRANSISTOR_CLOSED_COLOR = 16777215;
|
|
8165
8165
|
/** Transistor lit emissive intensity */
|
|
@@ -8180,7 +8180,7 @@ class W extends b {
|
|
|
8180
8180
|
const i = this.createComponentHitbox(e.id, t.id, 1.3, 2, 1.3);
|
|
8181
8181
|
t.add(i);
|
|
8182
8182
|
const o = new a.MeshStandardMaterial({ color: 16777215 });
|
|
8183
|
-
o.emissive.setHex(
|
|
8183
|
+
o.emissive.setHex(L.TRANSISTOR_CLOSED_COLOR), o.emissiveIntensity = 0;
|
|
8184
8184
|
const n = new a.Mesh(this.openGeometry, o);
|
|
8185
8185
|
n.userData = {
|
|
8186
8186
|
type: "component",
|
|
@@ -8257,11 +8257,11 @@ class W extends b {
|
|
|
8257
8257
|
const i = this.findEnvelopeMesh(e);
|
|
8258
8258
|
if (!i) return;
|
|
8259
8259
|
if (!t) {
|
|
8260
|
-
i.userData.initialState === "closed" ? (i.geometry = this.closedGeometry, i.material.emissiveIntensity =
|
|
8260
|
+
i.userData.initialState === "closed" ? (i.geometry = this.closedGeometry, i.material.emissiveIntensity = L.TRANSISTOR_CLOSED_INTENSITY) : (i.geometry = this.openGeometry, i.material.emissiveIntensity = 0);
|
|
8261
8261
|
return;
|
|
8262
8262
|
}
|
|
8263
8263
|
const o = t;
|
|
8264
|
-
o.isClosed ? (i.geometry = this.closedGeometry, i.material.emissiveIntensity =
|
|
8264
|
+
o.isClosed ? (i.geometry = this.closedGeometry, i.material.emissiveIntensity = L.TRANSISTOR_CLOSED_INTENSITY) : o.isInTransition ? (i.geometry = this.transientGeometry, i.material.emissiveIntensity = 0.5 * L.TRANSISTOR_CLOSED_INTENSITY) : (i.geometry = this.openGeometry, i.material.emissiveIntensity = 0);
|
|
8265
8265
|
}
|
|
8266
8266
|
/**
|
|
8267
8267
|
* Find the envelope mesh within the component group
|
|
@@ -8280,7 +8280,7 @@ class W extends b {
|
|
|
8280
8280
|
}
|
|
8281
8281
|
}
|
|
8282
8282
|
function lt(c) {
|
|
8283
|
-
return c.register(S.Battery, new Qe()).register(S.Label, new C()).register(S.Lightbulb, new V()).register(S.RectangleLED, new j()).register(S.Relay, new O()).register(S.SmallLED, new B()).register(S.Switch, new k()).register(S.Transistor, new
|
|
8283
|
+
return c.register(S.Battery, new Qe()).register(S.Label, new C()).register(S.Lightbulb, new V()).register(S.RectangleLED, new j()).register(S.Relay, new O()).register(S.SmallLED, new B()).register(S.Switch, new k()).register(S.Transistor, new L()), c;
|
|
8284
8284
|
}
|
|
8285
8285
|
export {
|
|
8286
8286
|
Te as A,
|
|
@@ -8293,7 +8293,7 @@ export {
|
|
|
8293
8293
|
ke as M,
|
|
8294
8294
|
j as R,
|
|
8295
8295
|
Ae as S,
|
|
8296
|
-
|
|
8296
|
+
L as T,
|
|
8297
8297
|
_e as W,
|
|
8298
8298
|
Ke as a,
|
|
8299
8299
|
Ze as b,
|
|
@@ -8305,9 +8305,9 @@ export {
|
|
|
8305
8305
|
O as h,
|
|
8306
8306
|
B as i,
|
|
8307
8307
|
k as j,
|
|
8308
|
-
|
|
8308
|
+
W as k,
|
|
8309
8309
|
ce as l,
|
|
8310
8310
|
J as m,
|
|
8311
8311
|
lt as r
|
|
8312
8312
|
};
|
|
8313
|
-
//# sourceMappingURL=setup-
|
|
8313
|
+
//# sourceMappingURL=setup-YQJVUHFM.js.map
|