@tellegen/svelte 0.3.0 → 0.4.1

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 (71) hide show
  1. package/README.md +233 -0
  2. package/dist/Sparkline.svelte +2 -2
  3. package/dist/TellegenMap.svelte +239 -66
  4. package/dist/TellegenMap.svelte.d.ts +45 -0
  5. package/dist/TellegenProvider.svelte +36 -4
  6. package/dist/TellegenShell.svelte +14 -42
  7. package/dist/TellegenViewer.svelte +12 -2
  8. package/dist/api.d.ts +10 -2
  9. package/dist/api.js +2 -0
  10. package/dist/basemap.d.ts +192 -0
  11. package/dist/basemap.js +259 -0
  12. package/dist/colors.d.ts +55 -1
  13. package/dist/colors.js +89 -0
  14. package/dist/components/AppFooter.svelte +3 -2
  15. package/dist/components/AppHeader.svelte +21 -8
  16. package/dist/components/BindingLines.svelte +1 -1
  17. package/dist/components/BusPicker.svelte +3 -3
  18. package/dist/components/ControlPanel.svelte +4 -2
  19. package/dist/components/DemandSlider.svelte +16 -7
  20. package/dist/components/DiagramCanvas.svelte +17 -5
  21. package/dist/components/DisplayControls.svelte +5 -1
  22. package/dist/components/DropZone.svelte +1 -1
  23. package/dist/components/FormulationSelector.svelte +1 -1
  24. package/dist/components/LocalCaseDetails.svelte +6 -3
  25. package/dist/components/McResults.svelte +98 -35
  26. package/dist/components/McResults.svelte.d.ts +8 -2
  27. package/dist/components/ModelDetails.svelte +5 -5
  28. package/dist/components/MulticonductorDetails.svelte +9 -9
  29. package/dist/components/NotificationCenter.svelte +4 -2
  30. package/dist/components/PanelCard.svelte +72 -7
  31. package/dist/components/PanelHost.svelte +59 -34
  32. package/dist/components/PanelHost.svelte.d.ts +4 -1
  33. package/dist/components/PlacementCue.svelte +1 -1
  34. package/dist/components/PowerFlowDetails.svelte +1 -1
  35. package/dist/components/RatingSlider.svelte +14 -5
  36. package/dist/components/RestoreDefaultsButton.svelte +1 -1
  37. package/dist/components/SavedNetworkDetails.svelte +3 -3
  38. package/dist/components/SensitivityReadout.svelte +2 -2
  39. package/dist/components/ShellEnvironment.svelte +51 -0
  40. package/dist/components/ShellEnvironment.svelte.d.ts +18 -0
  41. package/dist/components/SizeLegend.svelte +2 -2
  42. package/dist/components/SolveCard.svelte +3 -3
  43. package/dist/components/TopMovers.svelte +1 -1
  44. package/dist/components.d.ts +3 -0
  45. package/dist/components.js +3 -0
  46. package/dist/context.svelte.d.ts +8 -1
  47. package/dist/context.svelte.js +8 -3
  48. package/dist/controller.svelte.d.ts +65 -5
  49. package/dist/controller.svelte.js +266 -78
  50. package/dist/display.d.ts +3 -2
  51. package/dist/display.js +22 -4
  52. package/dist/format.d.ts +9 -0
  53. package/dist/format.js +13 -1
  54. package/dist/index.d.ts +6 -2
  55. package/dist/index.js +2 -0
  56. package/dist/map.d.ts +4 -2
  57. package/dist/map.js +2 -1
  58. package/dist/maplibre-worker.d.ts +5 -0
  59. package/dist/maplibre-worker.dev.d.ts +11 -0
  60. package/dist/maplibre-worker.dev.js +15 -0
  61. package/dist/maplibre-worker.js +8 -0
  62. package/dist/notices.svelte.js +5 -1
  63. package/dist/panels.svelte.d.ts +6 -0
  64. package/dist/panels.svelte.js +31 -1
  65. package/dist/slider.d.ts +12 -0
  66. package/dist/slider.js +31 -0
  67. package/dist/state.svelte.d.ts +25 -3
  68. package/dist/state.svelte.js +13 -0
  69. package/dist/styles.css +59 -6
  70. package/dist/types.d.ts +1 -1
  71. package/package.json +13 -8
@@ -73,7 +73,7 @@
73
73
  h3 span {
74
74
  display: block;
75
75
  margin-top: 3px;
76
- font-size: 11px;
76
+ font-size: 13px;
77
77
  font-weight: 400;
78
78
  color: var(--text-secondary);
79
79
  }
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getController } from '../context.svelte.js';
3
3
  import { fmt, signed } from '../format.js';
4
+ import { sliderKeyValue } from '../slider.js';
4
5
 
5
6
  const ctrl = getController();
6
7
 
@@ -64,7 +65,15 @@
64
65
  bind:value={ctrl.ratingSliderCurrent, ctrl.setRatingPreview}
65
66
  aria-label="rating delta at selected line"
66
67
  onpointerdown={() => ctrl.setRatingPreview(ctrl.ratingSliderValue)}
67
- onkeydown={() => ctrl.setRatingPreview(ctrl.ratingSliderValue)}
68
+ onkeydown={(e) => {
69
+ const next = sliderKeyValue(e.key, ctrl.ratingSliderValue, bounds.min, bounds.max);
70
+ if (next === null) {
71
+ ctrl.setRatingPreview(ctrl.ratingSliderValue);
72
+ return;
73
+ }
74
+ e.preventDefault();
75
+ ctrl.setRatingPreview(next);
76
+ }}
68
77
  onpointerup={(e) => ctrl.finishRatingInput(Number(e.currentTarget.value))}
69
78
  onkeyup={(e) => ctrl.finishRatingInput(Number(e.currentTarget.value))}
70
79
  onchange={(e) => ctrl.finishRatingInput(Number(e.currentTarget.value))}
@@ -105,7 +114,7 @@
105
114
  .slider-head {
106
115
  display: flex;
107
116
  justify-content: space-between;
108
- font-size: 11.5px;
117
+ font-size: 13.5px;
109
118
  color: var(--text-secondary);
110
119
  margin-bottom: 4px;
111
120
  }
@@ -120,7 +129,7 @@
120
129
  justify-content: space-between;
121
130
  gap: 8px;
122
131
  margin: 6px 0 7px;
123
- font-size: 10.5px;
132
+ font-size: 12.5px;
124
133
  }
125
134
 
126
135
  .slider-track {
@@ -236,13 +245,13 @@
236
245
 
237
246
  .pred {
238
247
  margin: 2px 0 0;
239
- font-size: 11px;
248
+ font-size: 13px;
240
249
  min-height: 16px;
241
250
  }
242
251
 
243
252
  .score {
244
253
  margin: 8px 0 0;
245
- font-size: 11px;
254
+ font-size: 13px;
246
255
  color: var(--ink);
247
256
  min-height: 16px;
248
257
  }
@@ -24,7 +24,7 @@
24
24
  color: var(--text-secondary);
25
25
  font-size: 11px;
26
26
  cursor: pointer;
27
- box-shadow: 0 2px 10px rgba(32, 36, 43, 0.1);
27
+ box-shadow: var(--elev-1);
28
28
  }
29
29
 
30
30
  .restore-defaults:hover {
@@ -140,7 +140,7 @@
140
140
  .state-label span {
141
141
  flex: none;
142
142
  color: var(--text-secondary);
143
- font-size: 11px;
143
+ font-size: 13px;
144
144
  }
145
145
  dl {
146
146
  margin: 0;
@@ -163,7 +163,7 @@
163
163
  }
164
164
  small {
165
165
  display: block;
166
- font-size: 10px;
166
+ font-size: 12px;
167
167
  color: var(--text-secondary);
168
168
  }
169
169
  .live {
@@ -208,7 +208,7 @@
208
208
  display: block;
209
209
  margin-top: 3px;
210
210
  color: var(--text-secondary);
211
- font-size: 11px;
211
+ font-size: 13px;
212
212
  font-weight: 400;
213
213
  }
214
214
  </style>
@@ -111,7 +111,7 @@
111
111
  <style>
112
112
  .chip {
113
113
  font-family: var(--font-mono);
114
- font-size: 11px;
114
+ font-size: 13px;
115
115
  padding: 2px 8px;
116
116
  border: 1px solid var(--accent);
117
117
  color: var(--text-accent);
@@ -129,7 +129,7 @@
129
129
  }
130
130
 
131
131
  .sensitivity-copy {
132
- font-size: 11.5px;
132
+ font-size: 13.5px;
133
133
  line-height: 1.35;
134
134
  white-space: nowrap;
135
135
  }
@@ -0,0 +1,51 @@
1
+ <script lang="ts">
2
+ import { onMount } from 'svelte';
3
+ import { PANEL_COMPACT_QUERY } from '../panels.svelte.js';
4
+ import { getAppState, getController } from '../context.svelte.js';
5
+
6
+ // Renderless. Keeps the shared app state in step with the environment: the
7
+ // pointer that gates the file drop affordance, the compact-layout media
8
+ // query, and the viewport height panel and map framing both read. The
9
+ // default shell renders it; a custom shell on `PanelHost` must too.
10
+
11
+ // Gates the drag-and-drop affordance only. The upload button in the header
12
+ // is always rendered: a file picker works on every device, and the plain
13
+ // `hover`/`pointer` queries resolve false on a touchscreen laptop that also
14
+ // has a mouse, which hid the whole file flow there (#110). `any-*` match
15
+ // when at least one attached input can hover and point precisely.
16
+ const FILE_DROP_QUERY = '(any-hover: hover) and (any-pointer: fine)';
17
+
18
+ const app = getAppState();
19
+ const ctrl = getController();
20
+
21
+ onMount(() => {
22
+ const query = window.matchMedia(FILE_DROP_QUERY);
23
+ const syncFileDropUi = () => {
24
+ ctrl.showFileDropUi = query.matches;
25
+ if (!ctrl.showFileDropUi) app.dragOver = false;
26
+ };
27
+ syncFileDropUi();
28
+ query.addEventListener('change', syncFileDropUi);
29
+
30
+ const compact = window.matchMedia(PANEL_COMPACT_QUERY);
31
+ const syncCompact = () => {
32
+ app.compactLayout = compact.matches;
33
+ if (!compact.matches) app.sheetInset = 0;
34
+ };
35
+ syncCompact();
36
+ compact.addEventListener('change', syncCompact);
37
+
38
+ // Shared viewport measurements keep panel and map framing dimensions aligned.
39
+ const syncViewport = () => (app.viewportHeight = window.innerHeight);
40
+ syncViewport();
41
+ window.addEventListener('resize', syncViewport);
42
+ window.addEventListener('orientationchange', syncViewport);
43
+
44
+ return () => {
45
+ query.removeEventListener('change', syncFileDropUi);
46
+ compact.removeEventListener('change', syncCompact);
47
+ window.removeEventListener('resize', syncViewport);
48
+ window.removeEventListener('orientationchange', syncViewport);
49
+ };
50
+ });
51
+ </script>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const ShellEnvironment: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type ShellEnvironment = InstanceType<typeof ShellEnvironment>;
18
+ export default ShellEnvironment;
@@ -19,7 +19,7 @@
19
19
  display: flex;
20
20
  align-items: center;
21
21
  gap: 12px;
22
- font-size: 10px;
22
+ font-size: 12px;
23
23
  color: var(--text-secondary);
24
24
  }
25
25
 
@@ -38,7 +38,7 @@
38
38
 
39
39
  .caption {
40
40
  margin-left: auto;
41
- font-size: 9.5px;
41
+ font-size: 12px;
42
42
  }
43
43
 
44
44
  @media (max-width: 760px) {
@@ -53,7 +53,7 @@
53
53
 
54
54
  <style>
55
55
  .solve-label {
56
- font-size: 11px;
56
+ font-size: 13px;
57
57
  margin-bottom: 8px;
58
58
  }
59
59
  .solvecard {
@@ -65,7 +65,7 @@
65
65
  align-items: center;
66
66
  flex-wrap: wrap;
67
67
  gap: 10px 14px;
68
- font-size: 10px;
68
+ font-size: 12px;
69
69
  margin-top: 6px;
70
70
  }
71
71
 
@@ -75,7 +75,7 @@
75
75
 
76
76
  .fallback-reason {
77
77
  margin: 6px 0 0;
78
- font-size: 10px;
78
+ font-size: 12px;
79
79
  line-height: 1.35;
80
80
  overflow-wrap: anywhere;
81
81
  }
@@ -46,7 +46,7 @@
46
46
 
47
47
  caption {
48
48
  text-align: left;
49
- font-size: 10.5px;
49
+ font-size: 12.5px;
50
50
  margin-bottom: 4px;
51
51
  }
52
52
 
@@ -1,5 +1,8 @@
1
1
  export { default as ModelDetails } from './components/ModelDetails.svelte';
2
2
  export { default as AppFooter } from './components/AppFooter.svelte';
3
+ export { default as NotificationCenter } from './components/NotificationCenter.svelte';
4
+ export { default as PanelHost } from './components/PanelHost.svelte';
5
+ export { default as ShellEnvironment } from './components/ShellEnvironment.svelte';
3
6
  export { default as AppHeader } from './components/AppHeader.svelte';
4
7
  export { default as BusPicker } from './components/BusPicker.svelte';
5
8
  export { default as ControlPanel } from './components/ControlPanel.svelte';
@@ -1,5 +1,8 @@
1
1
  export { default as ModelDetails } from './components/ModelDetails.svelte';
2
2
  export { default as AppFooter } from './components/AppFooter.svelte';
3
+ export { default as NotificationCenter } from './components/NotificationCenter.svelte';
4
+ export { default as PanelHost } from './components/PanelHost.svelte';
5
+ export { default as ShellEnvironment } from './components/ShellEnvironment.svelte';
3
6
  export { default as AppHeader } from './components/AppHeader.svelte';
4
7
  export { default as BusPicker } from './components/BusPicker.svelte';
5
8
  export { default as ControlPanel } from './components/ControlPanel.svelte';
@@ -1,12 +1,19 @@
1
1
  import type { AppState } from './state.svelte.js';
2
2
  import type { Controller } from './controller.svelte.js';
3
3
  export interface TellegenUiConfig {
4
- apiBase: string;
4
+ /** Backend base path; `null` for a host with no backend at all. */
5
+ apiBase: string | null;
5
6
  loadDefaultCases: boolean;
6
7
  docsHref: string;
7
8
  orgHref: string;
8
9
  orgLabel: string;
9
10
  showFooter: boolean;
11
+ /** `'dark'` sets `data-theme="dark"` on the document root while the
12
+ * provider is mounted, which switches the `styles.css` tokens. */
13
+ theme: 'light' | 'dark';
14
+ /** CARTO basemap key for the default shell's map, trimmed; empty for
15
+ * none. See `TellegenMap`'s `cartoApiKey`. */
16
+ cartoApiKey: string;
10
17
  }
11
18
  export type TellegenUiOptions = Partial<TellegenUiConfig>;
12
19
  export declare const DEFAULT_TELLEGEN_UI_CONFIG: TellegenUiConfig;
@@ -1,4 +1,5 @@
1
1
  import { getContext, setContext } from 'svelte';
2
+ import { normalizeCartoApiKey } from './basemap.js';
2
3
  const APP = Symbol('tellegen.app');
3
4
  const CTRL = Symbol('tellegen.controller');
4
5
  const CONFIG = Symbol('tellegen.config');
@@ -8,16 +9,20 @@ export const DEFAULT_TELLEGEN_UI_CONFIG = {
8
9
  docsHref: 'https://eigenergy.github.io/tellegen/',
9
10
  orgHref: 'https://github.com/eigenergy',
10
11
  orgLabel: 'eigenergy group @ michigan ece',
11
- showFooter: true
12
+ showFooter: true,
13
+ theme: 'light',
14
+ cartoApiKey: ''
12
15
  };
13
16
  export function resolveTellegenUiConfig(options = {}) {
14
17
  return {
15
- apiBase: options.apiBase ?? DEFAULT_TELLEGEN_UI_CONFIG.apiBase,
18
+ apiBase: options.apiBase === undefined ? DEFAULT_TELLEGEN_UI_CONFIG.apiBase : options.apiBase,
16
19
  loadDefaultCases: options.loadDefaultCases ?? DEFAULT_TELLEGEN_UI_CONFIG.loadDefaultCases,
17
20
  docsHref: options.docsHref ?? DEFAULT_TELLEGEN_UI_CONFIG.docsHref,
18
21
  orgHref: options.orgHref ?? DEFAULT_TELLEGEN_UI_CONFIG.orgHref,
19
22
  orgLabel: options.orgLabel ?? DEFAULT_TELLEGEN_UI_CONFIG.orgLabel,
20
- showFooter: options.showFooter ?? DEFAULT_TELLEGEN_UI_CONFIG.showFooter
23
+ showFooter: options.showFooter ?? DEFAULT_TELLEGEN_UI_CONFIG.showFooter,
24
+ theme: options.theme ?? DEFAULT_TELLEGEN_UI_CONFIG.theme,
25
+ cartoApiKey: normalizeCartoApiKey(options.cartoApiKey) ?? DEFAULT_TELLEGEN_UI_CONFIG.cartoApiKey
21
26
  };
22
27
  }
23
28
  export const setAppState = (a) => setContext(APP, a);
@@ -1,7 +1,7 @@
1
1
  import { type TellegenApiClient } from './api.js';
2
2
  import type { BranchRatingDeltas, Network, NetworkBus, SensitivityColumn, Solution } from './api.js';
3
3
  import { CaseState, LocalCase, MulticonductorCase, type AppState, type DemandRangeMode, type SolvableCase } from './state.svelte.js';
4
- import { type EngineTransport, type McPfOptions, type McPfResult, type McStudySnapshot, type BrowserStudy, type Formulation, type PowerIoDiagnostic, type SensTarget } from '@tellegen/engine';
4
+ import { type EngineTransport, type McPfDetail, type McPfDetailQuery, type McPfOptions, type McPfSummary, type McStudySnapshot, type BrowserStudy, type Formulation, type IngestedCase, type PowerIoDiagnostic, type SensTarget } from '@tellegen/engine';
5
5
  /** A parsed geographic sidecar awaiting application: the canonical `.geo.json`
6
6
  * layer document from the engine's tolerant reader, its source file name, and
7
7
  * the reader's notes on records it could not use. */
@@ -28,12 +28,40 @@ type DemandRangeAnchor = {
28
28
  };
29
29
  export interface ControllerOptions {
30
30
  api?: TellegenApiClient;
31
- apiBase?: string;
31
+ /** Backend base path. `null` means there is no backend: no client is
32
+ * created and nothing is ever fetched. */
33
+ apiBase?: string | null;
34
+ /** Whether `load()` fetches the bundled cases. Default `true`. With
35
+ * `false`, `load()` only marks the shell loaded and frames the map. */
36
+ loadDefaultCases?: boolean;
32
37
  mcTransport?: Pick<EngineTransport, 'solveMcModule' | 'applyMcGeo'> & Partial<Pick<EngineTransport, 'solveMcStudy' | 'applyMcStudyGeo' | 'createMcPfSession'>>;
33
38
  }
39
+ /** Input to `Controller.openBalancedModule` and `replaceLocalCase`: a
40
+ * balanced (transmission) powerio module, either as its JSON text or as the
41
+ * payload the engine's `ingestCase` already produced for it. */
42
+ export interface OpenBalancedModuleInput {
43
+ /** Case label; also the stem of the `.pio.json` file name the shell shows. */
44
+ name: string;
45
+ /** Module JSON, ingested through the engine. Ignored when `payload` is set. */
46
+ moduleJson?: string;
47
+ /** An already ingested balanced payload; skips the engine round trip. */
48
+ payload?: IngestedCase;
49
+ /** A `.geo.json` layer document, for a module that carries no coordinates. */
50
+ geoLayer?: string;
51
+ /** Overrides the formulation the module declares. */
52
+ formulation?: Formulation;
53
+ /** Default `true`: add the case, make it active, and start its browser
54
+ * solve. With `false` the prepared case is returned and not added. */
55
+ activate?: boolean;
56
+ /** Default `true`: fly the map to the case when it is activated. */
57
+ frame?: boolean;
58
+ }
34
59
  export declare class Controller {
35
60
  app: AppState;
36
- api: TellegenApiClient;
61
+ /** `null` when the controller was created with `apiBase: null`; every
62
+ * server path then reports "compute off" instead of fetching. */
63
+ api: TellegenApiClient | null;
64
+ readonly loadDefaultCases: boolean;
37
65
  mcTransport: Pick<EngineTransport, 'solveMcModule' | 'applyMcGeo'> & Partial<Pick<EngineTransport, 'solveMcStudy' | 'applyMcStudyGeo' | 'createMcPfSession'>>;
38
66
  abort: AbortController | null;
39
67
  sensitivity429Until: number;
@@ -196,7 +224,11 @@ export declare class Controller {
196
224
  removeBackendCase: (c: CaseState, event?: MouseEvent) => Promise<void>;
197
225
  activateLocal: (c: LocalCase) => void;
198
226
  removeLocalCase: (c: LocalCase, event?: MouseEvent) => Promise<void>;
199
- addAndActivateLocal: (c: LocalCase) => void;
227
+ /** Add a prepared local case, make it active, frame it (unless `frame` is
228
+ * false) and start its browser solve. */
229
+ addAndActivateLocal: (c: LocalCase, options?: {
230
+ frame?: boolean;
231
+ }) => void;
200
232
  placeLocalCase: (lon: number, lat: number) => Promise<void>;
201
233
  /** Write the case's on-screen layout into its network payload
202
234
  * (`Bus.location` with `synthetic` provenance — the engine also accepts
@@ -291,6 +323,9 @@ export declare class Controller {
291
323
  * the first matching PowerWorld display. A failed geographic join keeps the
292
324
  * parsed case and returns the user-facing placement error. */
293
325
  private prepareDroppedLocal;
326
+ /** A case that still has no geometry gets a connectivity layout as its
327
+ * diagram, so it can render and solve without a placement step. */
328
+ private placeTopologyAsDiagram;
294
329
  /** Retain diagram geometry separately from the electrical case's geographic data. */
295
330
  private fillFromDisplaySibling;
296
331
  setCaseDisplayMode: (c: LocalCase, mode: "geographic" | "diagram") => void;
@@ -304,10 +339,21 @@ export declare class Controller {
304
339
  /** Retain parsed electrical inputs and draw each declared coordinate space directly. */
305
340
  private addMultiCase;
306
341
  /** Compute terminal quantities only for the retained input and current case revision. */
307
- solveMultiCase: (c: MulticonductorCase, options?: McPfOptions, signal?: AbortSignal) => Promise<McPfResult>;
342
+ solveMultiCase: (c: MulticonductorCase, options?: McPfOptions, signal?: AbortSignal) => Promise<McPfSummary>;
308
343
  /** Materialize the current retained operating point only when a portable
309
344
  * snapshot is actually needed (save/export/geography). */
310
345
  snapshotMultiCase: (c: MulticonductorCase) => Promise<McStudySnapshot>;
346
+ /** One bus's terminals and a page of equipment ports for the displayed
347
+ * operating point, from the live session or the stored full result. Null
348
+ * when the operating point changed before the page arrived. */
349
+ multiResultDetail: (c: MulticonductorCase, query: McPfDetailQuery) => Promise<McPfDetail | null>;
350
+ /** Every terminal's identity, voltage, and injected current, as numeric
351
+ * arrays of interleaved `[re, im]` values. */
352
+ multiTerminalTable: (c: MulticonductorCase) => Promise<{
353
+ ids: Array<[string, string]>;
354
+ voltages: Float64Array;
355
+ currents: Float64Array;
356
+ } | null>;
311
357
  /** Apply coordinates atomically to the explicitly selected conductor-resolved case. */
312
358
  applyMultiGeoLayers: (c: MulticonductorCase, layers: GeoLayerFile[]) => Promise<void>;
313
359
  /** Stage an absolute load-branch P/Q edit and coalesce rapid UI changes into
@@ -338,6 +384,20 @@ export declare class Controller {
338
384
  /** Build a local case from a balanced PowerIO ingest payload without activating
339
385
  * it yet; co-dropped placement data is applied before the first solve. */
340
386
  private localFromBalancedPayload;
387
+ /** Ingest module text through the engine and require a balanced network. */
388
+ private ingestBalancedModule;
389
+ /** Open a balanced powerio module from memory, the programmatic twin of
390
+ * dropping a `.pio.json` file: ingest (unless `payload` is given), apply an
391
+ * optional geographic layer, lay out a module without coordinates as a
392
+ * diagram, then add and activate it. Resolves to the new case; throws when
393
+ * the module is not a balanced network or the geographic layer matches
394
+ * nothing. */
395
+ openBalancedModule: (input: OpenBalancedModuleInput) => Promise<LocalCase>;
396
+ /** Swap a local case for a new module in place: same slot in the case list,
397
+ * same formulation unless `input.formulation` says otherwise, same display
398
+ * mode when the new case supports it, and the selected bus kept when the
399
+ * new case has it. The previous case's Study is freed. */
400
+ replaceLocalCase: (previous: LocalCase, input: OpenBalancedModuleInput) => Promise<LocalCase>;
341
401
  /** Build (or reuse) the case's Study and commit it at the current edit state, so a
342
402
  * save or export captures exactly what is on screen. Null (with an error set) when no
343
403
  * PowerIO module or Study is available. */