@tellegen/svelte 0.4.3 → 0.4.5
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 +45 -0
- package/dist/TellegenMap.svelte +63 -22
- package/dist/TellegenProvider.svelte +7 -4
- package/dist/TellegenShell.svelte +12 -1
- package/dist/TellegenViewer.svelte +2 -0
- package/dist/basemap.d.ts +14 -0
- package/dist/basemap.js +27 -0
- package/dist/colors.d.ts +6 -1
- package/dist/colors.js +11 -4
- package/dist/components/DiagnosticLogView.svelte +176 -0
- package/dist/components/DiagnosticLogView.svelte.d.ts +11 -0
- package/dist/components/FormulationSelector.svelte +1 -1
- package/dist/components/LocalCaseDetails.svelte +18 -3
- package/dist/components/LogEntryView.svelte +188 -0
- package/dist/components/LogEntryView.svelte.d.ts +11 -0
- package/dist/components/LogPanel.svelte +25 -0
- package/dist/components/LogPanel.svelte.d.ts +3 -0
- package/dist/components/McResults.svelte +18 -3
- package/dist/components/McWorkbench.svelte +688 -0
- package/dist/components/McWorkbench.svelte.d.ts +38 -0
- package/dist/components/MultiWire.svelte +136 -0
- package/dist/components/MultiWire.svelte.d.ts +7 -0
- package/dist/components/MulticonductorDetails.svelte +7 -0
- package/dist/components/NotificationCenter.svelte +37 -6
- package/dist/components/OmniSearch.svelte +163 -0
- package/dist/components/OmniSearch.svelte.d.ts +14 -0
- package/dist/components/ResultsTable.svelte +259 -0
- package/dist/components/ResultsTable.svelte.d.ts +13 -0
- package/dist/components/SchematicCanvas.svelte +1896 -0
- package/dist/components/SchematicCanvas.svelte.d.ts +13 -0
- package/dist/components/SolveCard.svelte +6 -0
- package/dist/components/schematic/PickCard.svelte +126 -0
- package/dist/components/schematic/PickCard.svelte.d.ts +56 -0
- package/dist/components/schematic/export.d.ts +21 -0
- package/dist/components/schematic/export.js +110 -0
- package/dist/components/schematic/layers.d.ts +161 -0
- package/dist/components/schematic/layers.js +756 -0
- package/dist/components/schematic/paint.d.ts +28 -0
- package/dist/components/schematic/paint.js +69 -0
- package/dist/components/schematic/palette.d.ts +34 -0
- package/dist/components/schematic/palette.js +54 -0
- package/dist/components/schematic/text.d.ts +83 -0
- package/dist/components/schematic/text.js +190 -0
- package/dist/components/schematic/view-prefs.svelte.d.ts +30 -0
- package/dist/components/schematic/view-prefs.svelte.js +77 -0
- package/dist/components.d.ts +4 -0
- package/dist/components.js +4 -0
- package/dist/context.svelte.d.ts +2 -0
- package/dist/context.svelte.js +2 -0
- package/dist/controller.svelte.d.ts +40 -5
- package/dist/controller.svelte.js +230 -25
- package/dist/diagram/basemap.d.ts +28 -0
- package/dist/diagram/basemap.js +39 -0
- package/dist/diagram/bus-stacks.d.ts +19 -0
- package/dist/diagram/bus-stacks.js +99 -0
- package/dist/diagram/colour-modes.d.ts +18 -0
- package/dist/diagram/colour-modes.js +33 -0
- package/dist/diagram/connections.d.ts +30 -0
- package/dist/diagram/connections.js +129 -0
- package/dist/diagram/display-tree.d.ts +21 -0
- package/dist/diagram/display-tree.js +65 -0
- package/dist/diagram/energisation.d.ts +10 -0
- package/dist/diagram/energisation.js +31 -0
- package/dist/diagram/feeders.d.ts +30 -0
- package/dist/diagram/feeders.js +57 -0
- package/dist/diagram/galvanic-zones.d.ts +60 -0
- package/dist/diagram/galvanic-zones.js +210 -0
- package/dist/diagram/graph-inputs.d.ts +18 -0
- package/dist/diagram/graph-inputs.js +103 -0
- package/dist/diagram/index.d.ts +28 -0
- package/dist/diagram/index.js +28 -0
- package/dist/diagram/landmarks.d.ts +50 -0
- package/dist/diagram/landmarks.js +153 -0
- package/dist/diagram/layout-morph.d.ts +15 -0
- package/dist/diagram/layout-morph.js +32 -0
- package/dist/diagram/multi-wire.d.ts +44 -0
- package/dist/diagram/multi-wire.js +65 -0
- package/dist/diagram/phase-bars.d.ts +35 -0
- package/dist/diagram/phase-bars.js +44 -0
- package/dist/diagram/results-table.d.ts +47 -0
- package/dist/diagram/results-table.js +173 -0
- package/dist/diagram/schematic-equipment.d.ts +133 -0
- package/dist/diagram/schematic-equipment.js +645 -0
- package/dist/diagram/schematic-layout.d.ts +51 -0
- package/dist/diagram/schematic-layout.js +240 -0
- package/dist/diagram/search.d.ts +36 -0
- package/dist/diagram/search.js +48 -0
- package/dist/diagram/shared-routes.d.ts +21 -0
- package/dist/diagram/shared-routes.js +40 -0
- package/dist/diagram/short-names.d.ts +11 -0
- package/dist/diagram/short-names.js +54 -0
- package/dist/diagram/snapshot.d.ts +115 -0
- package/dist/diagram/snapshot.js +242 -0
- package/dist/diagram/summary.d.ts +65 -0
- package/dist/diagram/summary.js +144 -0
- package/dist/diagram/svg-export.d.ts +80 -0
- package/dist/diagram/svg-export.js +108 -0
- package/dist/diagram/tree-walk.d.ts +13 -0
- package/dist/diagram/tree-walk.js +83 -0
- package/dist/diagram/value-labels.d.ts +24 -0
- package/dist/diagram/value-labels.js +69 -0
- package/dist/diagram/view-state.d.ts +12 -0
- package/dist/diagram/view-state.js +22 -0
- package/dist/diagram/voltage-levels.d.ts +14 -0
- package/dist/diagram/voltage-levels.js +20 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/log.svelte.d.ts +77 -0
- package/dist/log.svelte.js +149 -0
- package/dist/notices.svelte.d.ts +3 -0
- package/dist/state.svelte.d.ts +42 -5
- package/dist/state.svelte.js +56 -4
- package/dist/transformer-icon.d.ts +22 -13
- package/dist/transformer-icon.js +23 -13
- package/package.json +2 -2
package/dist/state.svelte.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { DEFAULT_FORMULATION } from '@tellegen/engine';
|
|
2
|
+
import { DiagnosticLog, errorEntry } from './log.svelte.js';
|
|
3
|
+
import { graphInputs } from './diagram/graph-inputs.js';
|
|
4
|
+
import { buildSearchIndex } from './diagram/search.js';
|
|
5
|
+
import { snapshotFromMcPf } from './diagram/snapshot.js';
|
|
2
6
|
/** A case is perturbed when any committed demand or rating delta is nonzero. Shared
|
|
3
7
|
* by both solvable case classes so the "perturbed" rule stays single-sourced. */
|
|
4
8
|
const hasPerturbation = (edits) => Object.values(edits).some((mw) => mw !== 0);
|
|
@@ -40,6 +44,8 @@ export class LocalCase {
|
|
|
40
44
|
solving = $state(false);
|
|
41
45
|
solveMs = $state(null);
|
|
42
46
|
solveBackend = $state(null);
|
|
47
|
+
/** Short solver-specific diagnostic shown beside the elapsed time. */
|
|
48
|
+
solveDetail = $state(null);
|
|
43
49
|
solveFallbackReason = $state(null);
|
|
44
50
|
/** Monotone token: only the latest solve may write this case. */
|
|
45
51
|
solveSeq = 0;
|
|
@@ -92,6 +98,8 @@ export class CaseState {
|
|
|
92
98
|
solving = $state(false);
|
|
93
99
|
solveMs = $state(null);
|
|
94
100
|
solveBackend = $state(null);
|
|
101
|
+
/** Short solver-specific diagnostic shown beside the elapsed time. */
|
|
102
|
+
solveDetail = $state(null);
|
|
95
103
|
solveFallbackReason = $state(null);
|
|
96
104
|
/** Monotone token: only the latest solve may write this case. */
|
|
97
105
|
solveSeq = 0;
|
|
@@ -158,6 +166,31 @@ export class MulticonductorCase {
|
|
|
158
166
|
/** The selected edge id, whose conductor pairing expands in the panel;
|
|
159
167
|
* mutually exclusive with selectedBusId. */
|
|
160
168
|
selectedEdgeId = $state(null);
|
|
169
|
+
/** What the pointer is over in any linked view (schematic, profile, tables); highlighted in
|
|
170
|
+
* the others. Transient: never saved or put in links. */
|
|
171
|
+
hovered = $state(null);
|
|
172
|
+
/** Bumped to ask the views to bring the current selection into view again (an issue clicked
|
|
173
|
+
* that is already selected). */
|
|
174
|
+
revealSeq = $state(0);
|
|
175
|
+
/** The full operating point read for whole-network views (overview, schematic); null until read,
|
|
176
|
+
* and cleared when a large case's operating point changes. */
|
|
177
|
+
overviewResult = $state.raw(null);
|
|
178
|
+
overviewLoading = $state(false);
|
|
179
|
+
/** The graph's buses and branches as the overview and the diagram read them: rebuilt when the
|
|
180
|
+
* graph is replaced, never after a solve. Both views read this one copy. */
|
|
181
|
+
overviewInputs = $derived(this.graph ? graphInputs(this.graph) : null);
|
|
182
|
+
/** Search over the graph's buses and branches, rebuilt with `overviewInputs`. */
|
|
183
|
+
overviewSearch = $derived(this.overviewInputs ? buildSearchIndex(this.overviewInputs.entities) : null);
|
|
184
|
+
/** `overviewResult` projected onto the graph, built once per operating point and shared by the
|
|
185
|
+
* overview and the diagram; null while there is none. */
|
|
186
|
+
overviewSnapshot = $derived(this.overviewResult && this.overviewInputs
|
|
187
|
+
? snapshotFromMcPf(this.overviewResult, this.overviewInputs.buses, this.overviewInputs.branches)
|
|
188
|
+
: null);
|
|
189
|
+
/** Show this case as a schematic instead of the map. */
|
|
190
|
+
schematic = $state(false);
|
|
191
|
+
/** The diagram's last geographic view as a map camera, for the map to continue from when the
|
|
192
|
+
* diagram closes. Plain, not reactive: it is read once, on close. */
|
|
193
|
+
lastGeoView = null;
|
|
161
194
|
constructor(init) {
|
|
162
195
|
this.id = init.id;
|
|
163
196
|
this.label = init.label;
|
|
@@ -200,6 +233,9 @@ export class MulticonductorCase {
|
|
|
200
233
|
}
|
|
201
234
|
export class AppState {
|
|
202
235
|
camera = $state.raw(null);
|
|
236
|
+
/** Set when a view hands its camera to the map it returns to (the diagram closing from
|
|
237
|
+
* geographic positions): the re-created map starts at `camera` instead of framing the case. */
|
|
238
|
+
cameraHandoff = false;
|
|
203
239
|
cameraRequest = $state.raw(null);
|
|
204
240
|
cameraSeq = $state(0);
|
|
205
241
|
diagramCamera = $state.raw(null);
|
|
@@ -213,7 +249,11 @@ export class AppState {
|
|
|
213
249
|
throw new Error('Invalid saved drawing view');
|
|
214
250
|
}
|
|
215
251
|
this.settleFrame();
|
|
216
|
-
this.diagramCameraRequest = {
|
|
252
|
+
this.diagramCameraRequest = {
|
|
253
|
+
caseId,
|
|
254
|
+
center: [...snapshot.center],
|
|
255
|
+
scale: snapshot.scale
|
|
256
|
+
};
|
|
217
257
|
this.diagramCameraSeq++;
|
|
218
258
|
}
|
|
219
259
|
requestCamera(snapshot) {
|
|
@@ -262,16 +302,28 @@ export class AppState {
|
|
|
262
302
|
/** Technical detail behind the current `error`, when the message itself is
|
|
263
303
|
* written for people; notices keep it in their disclosure. Every write to
|
|
264
304
|
* `error` clears it, as it clears `errorRetry`. */
|
|
265
|
-
errorDetail = $state(null);
|
|
305
|
+
#errorDetail = $state(null);
|
|
306
|
+
/** Every error and engine finding of this session, structured; see `DiagnosticLog`. */
|
|
307
|
+
log = new DiagnosticLog();
|
|
266
308
|
get error() {
|
|
267
309
|
return this.#error;
|
|
268
310
|
}
|
|
269
311
|
set error(message) {
|
|
270
312
|
this.#error = message;
|
|
271
|
-
if (message)
|
|
313
|
+
if (message) {
|
|
272
314
|
this.errorRevision++;
|
|
315
|
+
this.log.record(errorEntry(message));
|
|
316
|
+
}
|
|
273
317
|
this.errorRetry = null;
|
|
274
|
-
this
|
|
318
|
+
this.#errorDetail = null;
|
|
319
|
+
}
|
|
320
|
+
get errorDetail() {
|
|
321
|
+
return this.#errorDetail;
|
|
322
|
+
}
|
|
323
|
+
set errorDetail(detail) {
|
|
324
|
+
this.#errorDetail = detail;
|
|
325
|
+
if (detail && this.#error)
|
|
326
|
+
this.log.record(errorEntry(this.#error, detail), { repeat: false });
|
|
275
327
|
}
|
|
276
328
|
/** Case files parsed in the browser via the powerio wasm module. */
|
|
277
329
|
localCases = $state.raw([]);
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
/** The IEC two-winding transformer symbol as a deck.gl icon:
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/** The IEC two-winding transformer symbol as a prepacked deck.gl icon atlas:
|
|
2
|
+
* two overlapping circles on a canvas that deck.gl uploads as a texture.
|
|
3
|
+
* Nothing is fetched, so the symbol needs no `data:` in a CSP's connect-src.
|
|
4
|
+
* Drawn white on transparent with `mask: true`, so the layer's getColor tints
|
|
5
|
+
* it. */
|
|
6
|
+
/** The icon name for the layer's getIcon. */
|
|
7
|
+
export declare const TRANSFORMER_ICON = "transformer";
|
|
8
|
+
/** The atlas holds the one symbol, anchored at its center. */
|
|
9
|
+
export declare const transformerIconMapping: {
|
|
10
|
+
transformer: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
anchorX: number;
|
|
16
|
+
anchorY: number;
|
|
17
|
+
mask: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
12
20
|
/** Rasterize the glyph lazily; layers only build client-side, after the map
|
|
13
21
|
* modules load, so document is always available here. The 128 px backing keeps
|
|
14
|
-
* a ~16 px on-screen symbol crisp on 2x/3x displays.
|
|
15
|
-
|
|
22
|
+
* a ~16 px on-screen symbol crisp on 2x/3x displays. Every call returns the
|
|
23
|
+
* same canvas, so deck.gl's prop diff keeps the texture it made from it. */
|
|
24
|
+
export declare function transformerIconAtlas(): HTMLCanvasElement;
|
package/dist/transformer-icon.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
/** The IEC two-winding transformer symbol as a deck.gl icon:
|
|
2
|
-
*
|
|
3
|
-
*
|
|
1
|
+
/** The IEC two-winding transformer symbol as a prepacked deck.gl icon atlas:
|
|
2
|
+
* two overlapping circles on a canvas that deck.gl uploads as a texture.
|
|
3
|
+
* Nothing is fetched, so the symbol needs no `data:` in a CSP's connect-src.
|
|
4
|
+
* Drawn white on transparent with `mask: true`, so the layer's getColor tints
|
|
5
|
+
* it. */
|
|
4
6
|
const SIZE = 128;
|
|
5
7
|
const RADIUS = 34;
|
|
6
8
|
const OFFSET = 17;
|
|
7
9
|
const STROKE = 9;
|
|
10
|
+
/** The icon name for the layer's getIcon. */
|
|
11
|
+
export const TRANSFORMER_ICON = 'transformer';
|
|
12
|
+
/** The atlas holds the one symbol, anchored at its center. */
|
|
13
|
+
export const transformerIconMapping = {
|
|
14
|
+
[TRANSFORMER_ICON]: {
|
|
15
|
+
x: 0,
|
|
16
|
+
y: 0,
|
|
17
|
+
width: SIZE,
|
|
18
|
+
height: SIZE,
|
|
19
|
+
anchorX: SIZE / 2,
|
|
20
|
+
anchorY: SIZE / 2,
|
|
21
|
+
mask: true
|
|
22
|
+
}
|
|
23
|
+
};
|
|
8
24
|
let cached = null;
|
|
9
25
|
/** Rasterize the glyph lazily; layers only build client-side, after the map
|
|
10
26
|
* modules load, so document is always available here. The 128 px backing keeps
|
|
11
|
-
* a ~16 px on-screen symbol crisp on 2x/3x displays.
|
|
12
|
-
|
|
27
|
+
* a ~16 px on-screen symbol crisp on 2x/3x displays. Every call returns the
|
|
28
|
+
* same canvas, so deck.gl's prop diff keeps the texture it made from it. */
|
|
29
|
+
export function transformerIconAtlas() {
|
|
13
30
|
if (cached)
|
|
14
31
|
return cached;
|
|
15
32
|
const canvas = document.createElement('canvas');
|
|
@@ -23,13 +40,6 @@ export function transformerIcon() {
|
|
|
23
40
|
ctx.arc(SIZE / 2 + dx, SIZE / 2, RADIUS, 0, 2 * Math.PI);
|
|
24
41
|
ctx.stroke();
|
|
25
42
|
}
|
|
26
|
-
cached =
|
|
27
|
-
url: canvas.toDataURL(),
|
|
28
|
-
width: SIZE,
|
|
29
|
-
height: SIZE,
|
|
30
|
-
anchorX: SIZE / 2,
|
|
31
|
-
anchorY: SIZE / 2,
|
|
32
|
-
mask: true
|
|
33
|
-
};
|
|
43
|
+
cached = canvas;
|
|
34
44
|
return cached;
|
|
35
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellegen/svelte",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Svelte components for tellegen power system maps, local case files, and browser solves.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"pack:dry-run": "npm pack --dry-run --cache ../../node_modules/.cache/npm-pack"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@tellegen/engine": "^0.4.
|
|
70
|
+
"@tellegen/engine": "^0.4.6"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"@deck.gl/core": "^9.4.0",
|