smithkit 0.2.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.
Files changed (48) hide show
  1. package/README.md +318 -25
  2. package/dist/lib/OptionsValidation.d.ts +16 -0
  3. package/dist/lib/OptionsValidation.js +168 -0
  4. package/dist/lib/Smith.d.ts +24 -39
  5. package/dist/lib/Smith.js +175 -287
  6. package/dist/lib/appearance/SvgTheme.d.ts +6 -0
  7. package/dist/lib/appearance/SvgTheme.js +21 -0
  8. package/dist/lib/appearance/Theme.d.ts +8 -0
  9. package/dist/lib/appearance/Theme.js +125 -0
  10. package/dist/lib/appearance/types.d.ts +55 -0
  11. package/dist/lib/appearance/types.js +1 -0
  12. package/dist/lib/grid/CircleLayerControl.d.ts +1 -1
  13. package/dist/lib/grid/CircleLayerControl.js +10 -8
  14. package/dist/lib/grid/ConstCircles.d.ts +0 -3
  15. package/dist/lib/grid/ConstCircles.js +6 -20
  16. package/dist/lib/grid/ConstQCircles.d.ts +1 -0
  17. package/dist/lib/grid/ConstQCircles.js +6 -1
  18. package/dist/lib/grid/ConstSwrCircles.d.ts +1 -0
  19. package/dist/lib/grid/ConstSwrCircles.js +6 -1
  20. package/dist/lib/grid/GridDefinitions.d.ts +7 -1
  21. package/dist/lib/grid/GridDefinitions.js +29 -0
  22. package/dist/lib/grid/GridLayerControl.d.ts +5 -4
  23. package/dist/lib/grid/GridLayerControl.js +13 -3
  24. package/dist/lib/grid/LayerControl.d.ts +1 -2
  25. package/dist/lib/grid/LayerControl.js +1 -10
  26. package/dist/lib/grid/SmithGridLayer.d.ts +7 -1
  27. package/dist/lib/grid/SmithGridLayer.js +35 -5
  28. package/dist/lib/index.d.ts +4 -1
  29. package/dist/lib/interaction/SmithCursor.d.ts +0 -17
  30. package/dist/lib/interaction/SmithCursor.js +6 -14
  31. package/dist/lib/layers.d.ts +7 -1
  32. package/dist/lib/options.d.ts +54 -0
  33. package/dist/lib/options.js +1 -0
  34. package/dist/lib/rendering/SvgChartRenderer.d.ts +69 -0
  35. package/dist/lib/rendering/SvgChartRenderer.js +364 -0
  36. package/dist/lib/scales/SmithPeripheralScales.js +11 -11
  37. package/dist/lib/scales/SmithScales.d.ts +10 -3
  38. package/dist/lib/scales/SmithScales.js +73 -39
  39. package/dist/lib/svg/ImageExporter.d.ts +18 -0
  40. package/dist/lib/svg/ImageExporter.js +211 -0
  41. package/dist/lib/svg/MarkerLegend.d.ts +12 -0
  42. package/dist/lib/svg/MarkerLegend.js +63 -0
  43. package/dist/lib/svg/SvgExporter.d.ts +6 -1
  44. package/dist/lib/svg/SvgExporter.js +50 -5
  45. package/dist/lib/svg/export.d.ts +36 -0
  46. package/dist/lib/svg/export.js +1 -0
  47. package/dist/lib/traces/SmithMarker.js +8 -5
  48. package/package.json +1 -1
@@ -1,5 +1,8 @@
1
- import { TraceSamples } from './samples.js';
2
- import type { ChartLayers, PeripheralScales } from './layers.js';
1
+ import type { SmithOptions } from './options.js';
2
+ import type { SmithImageExportOptions } from './svg/export.js';
3
+ import type { SmithAppearance } from './appearance/types.js';
4
+ import type { TraceSamples } from './samples.js';
5
+ import type { ChartLayers, GridDetail, PeripheralScales } from './layers.js';
3
6
  import type { SmithReading } from './rf/RfCalculations.js';
4
7
  import type { TraceOptions, TraceUpdateOptions, TraceInfo, MarkerSnapshot, MarkerComparison } from './measurements.js';
5
8
  export declare enum SmithEventType {
@@ -17,65 +20,47 @@ export type SmithEvent = {
17
20
  data: MarkerSnapshot;
18
21
  };
19
22
  export declare class Smith {
23
+ private theme;
20
24
  private referenceOhms;
21
- private calcs;
22
- private scalers;
23
- private readonly defaultTransform;
24
- private transform;
25
- private zoomEnabled;
26
- private applyingView;
27
- private zoomBehavior;
28
- private svg;
29
- private resizeObserver;
30
- private readonly labelLayout;
31
- private container;
32
- private dataContainer;
33
- private markerContainer;
34
- private reactanceAxis;
35
- private constResistance;
36
- private constReactance;
37
- private constConductance;
38
- private constSusceptance;
39
- private constSwrCircles;
40
- private constQCircles;
41
- private cursor;
42
- private peripheralScaleRenderer;
25
+ private readonly renderer;
43
26
  private data;
44
27
  private destroyed;
45
- private mouseGesture;
46
28
  private nextDatasetColor;
47
29
  private nextTraceId;
48
30
  private nextMarkerId;
49
31
  private traceMetadata;
50
32
  private markerIds;
51
33
  private draggedMarkers;
52
- private cursorBeforeMarkerDrag;
53
34
  private listeners;
54
35
  readonly layers: ChartLayers;
55
36
  readonly peripheralScales: PeripheralScales;
56
- constructor(referenceOhms?: number);
37
+ constructor(options?: SmithOptions);
38
+ /** Apply a validated patch. Omitted fields retain their current settings. */
39
+ setOptions(options: SmithOptions): void;
40
+ private applyOptions;
41
+ /** Replace the appearance while retaining explicit layer styles and trace colors. */
42
+ setAppearance(appearance: SmithAppearance): void;
57
43
  draw(target: string | HTMLElement): void;
58
- /** Export the current mounted view as standalone SVG with a transparent background. */
59
- toSvg(): string;
44
+ /** Set the same detail level on all impedance and admittance grid layers. */
45
+ setGridDetail(detail: GridDetail): void;
46
+ /** Export the current mounted view as standalone SVG with its configured background. */
47
+ toSvg(options?: SmithImageExportOptions): string;
48
+ private validateExportOptions;
49
+ private exportLegend;
50
+ /** Export the mounted view as PNG, optionally with radial scales and a trace legend. */
51
+ toPng(options?: SmithImageExportOptions): Promise<Blob>;
60
52
  /** Remove this chart and release its event handlers. Safe to call more than once. */
61
53
  destroy(): void;
62
- private updateViewportScale;
63
54
  private assertAlive;
64
- private createScalers;
65
- private cursorMove;
66
55
  private markerDragChanged;
67
- private initCursor;
68
56
  /** Last cursor position. Use cursor events to detect pointer leave. */
69
57
  get cursorReading(): SmithReading;
70
- private initializeZoom;
71
58
  /** Enable or disable wheel, double-click, and mouse/touch zoom/pan. Keeps the current view. */
72
59
  setZoomEnabled(enabled: boolean): void;
73
- private applyView;
60
+ /** Enable or disable the cursor overlay and readings independently of zoom and markers. */
61
+ setCursorEnabled(enabled: boolean): void;
74
62
  resetView(): void;
75
- private onZoom;
76
- private cursorContainer;
77
- private drawReactanceAxis;
78
- /** Add a named trace with one initial marker. Returns a chart-local, stable ID. */
63
+ /** Add a named trace without markers. Use addMarker to create markers explicitly. Returns a chart-local, stable ID. */
79
64
  addTrace(values: TraceSamples, options?: TraceOptions): string;
80
65
  /** Detached metadata snapshots; IDs and marker display numbers survive removals. */
81
66
  getTraces(): TraceInfo[];