@tellegen/svelte 0.3.0 → 0.4.0
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/README.md +233 -0
- package/dist/Sparkline.svelte +2 -2
- package/dist/TellegenMap.svelte +201 -47
- package/dist/TellegenMap.svelte.d.ts +45 -0
- package/dist/TellegenProvider.svelte +36 -4
- package/dist/TellegenShell.svelte +14 -42
- package/dist/TellegenViewer.svelte +12 -2
- package/dist/api.d.ts +10 -2
- package/dist/api.js +2 -0
- package/dist/basemap.d.ts +192 -0
- package/dist/basemap.js +259 -0
- package/dist/colors.d.ts +18 -0
- package/dist/colors.js +26 -0
- package/dist/components/AppFooter.svelte +3 -2
- package/dist/components/AppHeader.svelte +21 -8
- package/dist/components/BindingLines.svelte +1 -1
- package/dist/components/BusPicker.svelte +3 -3
- package/dist/components/DemandSlider.svelte +16 -7
- package/dist/components/DiagramCanvas.svelte +1 -1
- package/dist/components/DisplayControls.svelte +5 -1
- package/dist/components/DropZone.svelte +1 -1
- package/dist/components/FormulationSelector.svelte +1 -1
- package/dist/components/LocalCaseDetails.svelte +6 -3
- package/dist/components/McResults.svelte +98 -35
- package/dist/components/McResults.svelte.d.ts +8 -2
- package/dist/components/ModelDetails.svelte +5 -5
- package/dist/components/MulticonductorDetails.svelte +9 -9
- package/dist/components/NotificationCenter.svelte +4 -2
- package/dist/components/PanelCard.svelte +72 -7
- package/dist/components/PanelHost.svelte +59 -34
- package/dist/components/PanelHost.svelte.d.ts +4 -1
- package/dist/components/PlacementCue.svelte +1 -1
- package/dist/components/PowerFlowDetails.svelte +1 -1
- package/dist/components/RatingSlider.svelte +14 -5
- package/dist/components/RestoreDefaultsButton.svelte +1 -1
- package/dist/components/SavedNetworkDetails.svelte +3 -3
- package/dist/components/SensitivityReadout.svelte +2 -2
- package/dist/components/ShellEnvironment.svelte +51 -0
- package/dist/components/ShellEnvironment.svelte.d.ts +18 -0
- package/dist/components/SizeLegend.svelte +2 -2
- package/dist/components/SolveCard.svelte +3 -3
- package/dist/components/TopMovers.svelte +1 -1
- package/dist/components.d.ts +3 -0
- package/dist/components.js +3 -0
- package/dist/context.svelte.d.ts +8 -1
- package/dist/context.svelte.js +8 -3
- package/dist/controller.svelte.d.ts +65 -5
- package/dist/controller.svelte.js +262 -76
- package/dist/format.d.ts +9 -0
- package/dist/format.js +12 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/map.d.ts +4 -2
- package/dist/map.js +2 -1
- package/dist/maplibre-worker.d.ts +5 -0
- package/dist/maplibre-worker.dev.d.ts +11 -0
- package/dist/maplibre-worker.dev.js +15 -0
- package/dist/maplibre-worker.js +8 -0
- package/dist/notices.svelte.js +5 -1
- package/dist/panels.svelte.d.ts +6 -0
- package/dist/panels.svelte.js +31 -1
- package/dist/slider.d.ts +12 -0
- package/dist/slider.js +31 -0
- package/dist/state.svelte.d.ts +19 -2
- package/dist/state.svelte.js +12 -0
- package/dist/styles.css +59 -6
- package/package.json +13 -8
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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<
|
|
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. */
|