@tellegen/svelte 0.1.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.
Files changed (121) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +70 -0
  3. package/dist/Sparkline.svelte +100 -0
  4. package/dist/Sparkline.svelte.d.ts +8 -0
  5. package/dist/Sparkline.svelte.d.ts.map +1 -0
  6. package/dist/TellegenMap.svelte +1430 -0
  7. package/dist/TellegenMap.svelte.d.ts +14 -0
  8. package/dist/TellegenMap.svelte.d.ts.map +1 -0
  9. package/dist/TellegenProvider.svelte +38 -0
  10. package/dist/TellegenProvider.svelte.d.ts +9 -0
  11. package/dist/TellegenProvider.svelte.d.ts.map +1 -0
  12. package/dist/TellegenShell.svelte +126 -0
  13. package/dist/TellegenShell.svelte.d.ts +4 -0
  14. package/dist/TellegenShell.svelte.d.ts.map +1 -0
  15. package/dist/TellegenViewer.svelte +19 -0
  16. package/dist/TellegenViewer.svelte.d.ts +4 -0
  17. package/dist/TellegenViewer.svelte.d.ts.map +1 -0
  18. package/dist/api.d.ts +44 -0
  19. package/dist/api.d.ts.map +1 -0
  20. package/dist/api.js +137 -0
  21. package/dist/colors.d.ts +51 -0
  22. package/dist/colors.d.ts.map +1 -0
  23. package/dist/colors.js +140 -0
  24. package/dist/components/AppFooter.svelte +73 -0
  25. package/dist/components/AppFooter.svelte.d.ts +19 -0
  26. package/dist/components/AppFooter.svelte.d.ts.map +1 -0
  27. package/dist/components/AppHeader.svelte +405 -0
  28. package/dist/components/AppHeader.svelte.d.ts +4 -0
  29. package/dist/components/AppHeader.svelte.d.ts.map +1 -0
  30. package/dist/components/BindingLines.svelte +101 -0
  31. package/dist/components/BindingLines.svelte.d.ts +4 -0
  32. package/dist/components/BindingLines.svelte.d.ts.map +1 -0
  33. package/dist/components/BusPicker.svelte +227 -0
  34. package/dist/components/BusPicker.svelte.d.ts +4 -0
  35. package/dist/components/BusPicker.svelte.d.ts.map +1 -0
  36. package/dist/components/ControlPanel.svelte +154 -0
  37. package/dist/components/ControlPanel.svelte.d.ts +19 -0
  38. package/dist/components/ControlPanel.svelte.d.ts.map +1 -0
  39. package/dist/components/DemandSlider.svelte +271 -0
  40. package/dist/components/DemandSlider.svelte.d.ts +4 -0
  41. package/dist/components/DemandSlider.svelte.d.ts.map +1 -0
  42. package/dist/components/DisplayControls.svelte +81 -0
  43. package/dist/components/DisplayControls.svelte.d.ts +19 -0
  44. package/dist/components/DisplayControls.svelte.d.ts.map +1 -0
  45. package/dist/components/DropZone.svelte +46 -0
  46. package/dist/components/DropZone.svelte.d.ts +19 -0
  47. package/dist/components/DropZone.svelte.d.ts.map +1 -0
  48. package/dist/components/FormulationSelector.svelte +82 -0
  49. package/dist/components/FormulationSelector.svelte.d.ts +19 -0
  50. package/dist/components/FormulationSelector.svelte.d.ts.map +1 -0
  51. package/dist/components/LocalCaseDetails.svelte +253 -0
  52. package/dist/components/LocalCaseDetails.svelte.d.ts +4 -0
  53. package/dist/components/LocalCaseDetails.svelte.d.ts.map +1 -0
  54. package/dist/components/MulticonductorDetails.svelte +280 -0
  55. package/dist/components/MulticonductorDetails.svelte.d.ts +19 -0
  56. package/dist/components/MulticonductorDetails.svelte.d.ts.map +1 -0
  57. package/dist/components/NetworkStats.svelte +75 -0
  58. package/dist/components/NetworkStats.svelte.d.ts +19 -0
  59. package/dist/components/NetworkStats.svelte.d.ts.map +1 -0
  60. package/dist/components/PlacementCue.svelte +35 -0
  61. package/dist/components/PlacementCue.svelte.d.ts +19 -0
  62. package/dist/components/PlacementCue.svelte.d.ts.map +1 -0
  63. package/dist/components/RatingSlider.svelte +273 -0
  64. package/dist/components/RatingSlider.svelte.d.ts +4 -0
  65. package/dist/components/RatingSlider.svelte.d.ts.map +1 -0
  66. package/dist/components/RestoreDefaultsButton.svelte +34 -0
  67. package/dist/components/RestoreDefaultsButton.svelte.d.ts +19 -0
  68. package/dist/components/RestoreDefaultsButton.svelte.d.ts.map +1 -0
  69. package/dist/components/SensitivityReadout.svelte +126 -0
  70. package/dist/components/SensitivityReadout.svelte.d.ts +4 -0
  71. package/dist/components/SensitivityReadout.svelte.d.ts.map +1 -0
  72. package/dist/components/SizeLegend.svelte +55 -0
  73. package/dist/components/SizeLegend.svelte.d.ts +19 -0
  74. package/dist/components/SizeLegend.svelte.d.ts.map +1 -0
  75. package/dist/components/SolveCard.svelte +84 -0
  76. package/dist/components/SolveCard.svelte.d.ts +4 -0
  77. package/dist/components/SolveCard.svelte.d.ts.map +1 -0
  78. package/dist/components/TopMovers.svelte +68 -0
  79. package/dist/components/TopMovers.svelte.d.ts +19 -0
  80. package/dist/components/TopMovers.svelte.d.ts.map +1 -0
  81. package/dist/components.d.ts +19 -0
  82. package/dist/components.d.ts.map +1 -0
  83. package/dist/components.js +18 -0
  84. package/dist/context.svelte.d.ts +20 -0
  85. package/dist/context.svelte.d.ts.map +1 -0
  86. package/dist/context.svelte.js +43 -0
  87. package/dist/controller.svelte.d.ts +334 -0
  88. package/dist/controller.svelte.d.ts.map +1 -0
  89. package/dist/controller.svelte.js +2026 -0
  90. package/dist/display.d.ts +31 -0
  91. package/dist/display.d.ts.map +1 -0
  92. package/dist/display.js +63 -0
  93. package/dist/drop-classify.d.ts +48 -0
  94. package/dist/drop-classify.d.ts.map +1 -0
  95. package/dist/drop-classify.js +92 -0
  96. package/dist/format.d.ts +30 -0
  97. package/dist/format.d.ts.map +1 -0
  98. package/dist/format.js +49 -0
  99. package/dist/index.d.ts +21 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +12 -0
  102. package/dist/map.d.ts +9 -0
  103. package/dist/map.d.ts.map +1 -0
  104. package/dist/map.js +4 -0
  105. package/dist/multiconductor.d.ts +63 -0
  106. package/dist/multiconductor.d.ts.map +1 -0
  107. package/dist/multiconductor.js +255 -0
  108. package/dist/state.svelte.d.ts +258 -0
  109. package/dist/state.svelte.d.ts.map +1 -0
  110. package/dist/state.svelte.js +323 -0
  111. package/dist/study-package.d.ts +9 -0
  112. package/dist/study-package.d.ts.map +1 -0
  113. package/dist/study-package.js +17 -0
  114. package/dist/styles.css +393 -0
  115. package/dist/synthetic-layout.d.ts +12 -0
  116. package/dist/synthetic-layout.d.ts.map +1 -0
  117. package/dist/synthetic-layout.js +271 -0
  118. package/dist/types.d.ts +6 -0
  119. package/dist/types.d.ts.map +1 -0
  120. package/dist/types.js +1 -0
  121. package/package.json +67 -0
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Samuel Talkington and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @tellegen/svelte
2
+
3
+ Svelte components for tellegen maps, case panels, local case files, and browser solves.
4
+
5
+ ```sh
6
+ npm install @tellegen/svelte
7
+ ```
8
+
9
+ Import the component and stylesheet in your app:
10
+
11
+ ```svelte
12
+ <script lang="ts">
13
+ import { TellegenViewer } from "@tellegen/svelte";
14
+ import "@tellegen/svelte/styles.css";
15
+ </script>
16
+
17
+ <TellegenViewer />
18
+ ```
19
+
20
+ Use local files only by disabling bundled case loading:
21
+
22
+ ```svelte
23
+ <script lang="ts">
24
+ import { TellegenViewer } from "@tellegen/svelte";
25
+ import "@tellegen/svelte/styles.css";
26
+ </script>
27
+
28
+ <TellegenViewer loadDefaultCases={false} showFooter={false} />
29
+ ```
30
+
31
+ `TellegenViewer` accepts:
32
+
33
+ - `apiBase`, default `/api`
34
+ - `loadDefaultCases`, default `true`
35
+ - `docsHref`
36
+ - `orgHref`
37
+ - `orgLabel`
38
+ - `showFooter`, default `true`
39
+
40
+ Use `TellegenProvider` and `TellegenShell` when state should survive route changes:
41
+
42
+ ```svelte
43
+ <script lang="ts">
44
+ import { TellegenProvider, TellegenShell } from "@tellegen/svelte";
45
+ import "@tellegen/svelte/styles.css";
46
+ </script>
47
+
48
+ <TellegenProvider>
49
+ <TellegenShell />
50
+ </TellegenProvider>
51
+ ```
52
+
53
+ ## Release
54
+
55
+ Build and inspect the package from the repository root:
56
+
57
+ ```sh
58
+ npm ci
59
+ npm run wasm
60
+ npm run build:engine
61
+ npm run build:svelte
62
+ npm run pack:svelte
63
+ npm run test:svelte-packed
64
+ ```
65
+
66
+ `@tellegen/svelte` is published with `@tellegen/engine` in the first framework
67
+ release. The package ships only `dist`, the README, the MIT license text, and
68
+ package metadata. The packed smoke test installs the generated tarballs into a
69
+ temporary Svelte consumer and builds it so missing exports, styles, or wasm
70
+ assets fail before publish.
@@ -0,0 +1,100 @@
1
+ <script lang="ts">
2
+ import type { SolveIteration } from './api.js';
3
+
4
+ let { iterations }: { iterations: SolveIteration[] } = $props();
5
+
6
+ const W = 300;
7
+ const H = 86;
8
+ const T = 6;
9
+ const R = 4;
10
+ const B = 22;
11
+ const L = 38;
12
+ const PLOT_W = W - L - R;
13
+ const PLOT_H = H - T - B;
14
+ const Y_TOP = 0; // log10(1e0)
15
+ const Y_BOT = -9; // log10(tol_feas)
16
+
17
+ const points = $derived.by(() => {
18
+ if (iterations.length < 2) return '';
19
+ const span = Y_TOP - Y_BOT;
20
+ return iterations
21
+ .map((it, k) => {
22
+ const v = Number(it.inf_pr);
23
+ const logv = Number.isFinite(v) && v > 0 ? Math.log10(v) : Y_BOT;
24
+ const clamped = Math.min(Y_TOP, Math.max(Y_BOT, logv));
25
+ const x = (L + (k / (iterations.length - 1)) * PLOT_W).toFixed(1);
26
+ const y = (T + ((Y_TOP - clamped) / span) * PLOT_H).toFixed(1);
27
+ return `${x},${y}`;
28
+ })
29
+ .join(' ');
30
+ });
31
+ </script>
32
+
33
+ {#if points}
34
+ <svg
35
+ viewBox="0 0 {W} {H}"
36
+ preserveAspectRatio="none"
37
+ role="img"
38
+ aria-label="residual by solver iteration"
39
+ >
40
+ <line class="axis" x1={L} y1={T} x2={L} y2={H - B} />
41
+ <line class="axis" x1={L} y1={H - B} x2={W - R} y2={H - B} />
42
+ <text
43
+ class="axis-label y-label"
44
+ x={-(T + PLOT_H / 2)}
45
+ y="8"
46
+ text-anchor="middle"
47
+ transform="rotate(-90)"
48
+ >
49
+ residual
50
+ </text>
51
+ <text class="axis-label x-label" x={W - R} y={H - 4} text-anchor="end">iterations</text>
52
+ <polyline {points} pathLength="1" />
53
+ </svg>
54
+ {/if}
55
+
56
+ <style>
57
+ svg {
58
+ display: block;
59
+ width: 100%;
60
+ height: 86px;
61
+ overflow: visible;
62
+ }
63
+
64
+ .axis {
65
+ stroke: var(--line);
66
+ stroke-width: 1;
67
+ vector-effect: non-scaling-stroke;
68
+ }
69
+
70
+ .axis-label {
71
+ fill: var(--text-tertiary);
72
+ font-family: var(--font-mono);
73
+ font-size: 9px;
74
+ letter-spacing: 0;
75
+ }
76
+
77
+ polyline {
78
+ fill: none;
79
+ stroke: var(--accent);
80
+ stroke-width: 1.8;
81
+ stroke-linejoin: round;
82
+ vector-effect: non-scaling-stroke;
83
+ stroke-dasharray: 1;
84
+ stroke-dashoffset: 1;
85
+ animation: sparkline-draw var(--dur-slow) var(--ease-out) forwards;
86
+ }
87
+
88
+ @keyframes sparkline-draw {
89
+ to {
90
+ stroke-dashoffset: 0;
91
+ }
92
+ }
93
+
94
+ @media (prefers-reduced-motion: reduce) {
95
+ polyline {
96
+ animation: none;
97
+ stroke-dashoffset: 0;
98
+ }
99
+ }
100
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { SolveIteration } from './api.js';
2
+ type $$ComponentProps = {
3
+ iterations: SolveIteration[];
4
+ };
5
+ declare const Sparkline: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type Sparkline = ReturnType<typeof Sparkline>;
7
+ export default Sparkline;
8
+ //# sourceMappingURL=Sparkline.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sparkline.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Sparkline.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE9C,KAAK,gBAAgB,GAAI;IAAE,UAAU,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC;AAiD3D,QAAA,MAAM,SAAS,sDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}