smithkit 0.5.0 → 0.7.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 +47 -938
- package/dist/lib/OptionsValidation.d.ts +3 -3
- package/dist/lib/OptionsValidation.js +17 -13
- package/dist/lib/Smith.d.ts +3 -0
- package/dist/lib/Smith.js +42 -14
- package/dist/lib/appearance/SvgTheme.d.ts +1 -0
- package/dist/lib/appearance/SvgTheme.js +8 -7
- package/dist/lib/appearance/Theme.js +49 -52
- package/dist/lib/appearance/types.d.ts +75 -31
- package/dist/lib/grid/CircleLayerControl.d.ts +2 -2
- package/dist/lib/grid/CircleLayerControl.js +4 -4
- package/dist/lib/grid/ConstCircles.js +6 -6
- package/dist/lib/grid/ConstQCircles.js +4 -1
- package/dist/lib/grid/ConstSwrCircles.js +4 -1
- package/dist/lib/grid/GridLayerControl.d.ts +2 -2
- package/dist/lib/grid/GridLayerControl.js +10 -11
- package/dist/lib/grid/SmithGridLayer.js +3 -1
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/interaction/SmithCursor.js +6 -6
- package/dist/lib/layers.d.ts +28 -14
- package/dist/lib/math/Complex.d.ts +1 -1
- package/dist/lib/math/Complex.js +2 -2
- package/dist/lib/measurements.d.ts +20 -8
- package/dist/lib/options.d.ts +4 -4
- package/dist/lib/rendering/ChartHost.d.ts +5 -0
- package/dist/lib/rendering/ChartHost.js +14 -0
- package/dist/lib/rendering/SvgChartRenderer.d.ts +2 -2
- package/dist/lib/rendering/SvgChartRenderer.js +2 -2
- package/dist/lib/scales/SmithPeripheralScales.js +11 -11
- package/dist/lib/scales/SmithScales.d.ts +3 -0
- package/dist/lib/scales/SmithScales.js +39 -18
- package/dist/lib/svg/LabelLayout.js +9 -2
- package/dist/lib/traces/SmithData.d.ts +3 -3
- package/dist/lib/traces/SmithMarker.js +6 -5
- package/dist/lib/traces/TraceRenderer.d.ts +3 -3
- package/dist/lib/traces/TraceRenderer.js +19 -18
- package/package.json +24 -6
|
@@ -21,9 +21,8 @@ export class TraceRenderer {
|
|
|
21
21
|
this.scaler = scaler;
|
|
22
22
|
this.style = {
|
|
23
23
|
mode: style.mode ?? 'points',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
lineTolerancePx: style.lineTolerancePx ?? 0,
|
|
24
|
+
line: { width: style.line?.width ?? 2, tolerancePx: style.line?.tolerancePx ?? 0 },
|
|
25
|
+
point: { radius: style.point?.radius ?? 2 },
|
|
27
26
|
};
|
|
28
27
|
this.group = this.drawTrace(data).attr('pointer-events', 'none');
|
|
29
28
|
container.append(this.group);
|
|
@@ -43,7 +42,7 @@ export class TraceRenderer {
|
|
|
43
42
|
.attr('d', this.linePath(this.lineIndices))
|
|
44
43
|
.attr('fill', 'none')
|
|
45
44
|
.attr('stroke', this.color)
|
|
46
|
-
.attr('stroke-width', this.style.
|
|
45
|
+
.attr('stroke-width', this.style.line.width)
|
|
47
46
|
.attr('vector-effect', 'non-scaling-stroke')
|
|
48
47
|
.attr('stroke-linejoin', 'round')
|
|
49
48
|
.attr('stroke-linecap', 'round');
|
|
@@ -54,14 +53,14 @@ export class TraceRenderer {
|
|
|
54
53
|
return group;
|
|
55
54
|
}
|
|
56
55
|
selectLineIndices() {
|
|
57
|
-
if (this.style.
|
|
56
|
+
if (this.style.line.tolerancePx === 0) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
this.lineDetail ??= new TraceLineDetail(this.data);
|
|
61
60
|
const unitsToPixels = Math.max(Math.abs(this.scaler.x(1) - this.scaler.x(0)), Math.abs(this.scaler.y(1) - this.scaler.y(0))) *
|
|
62
61
|
this.transform.k *
|
|
63
62
|
this.viewportScale;
|
|
64
|
-
return this.lineDetail.select(this.style.
|
|
63
|
+
return this.lineDetail.select(this.style.line.tolerancePx / unitsToPixels);
|
|
65
64
|
}
|
|
66
65
|
linePath(indices) {
|
|
67
66
|
// Simplified paths retain numeric precision even at high zoom. Full paths keep
|
|
@@ -105,9 +104,9 @@ export class TraceRenderer {
|
|
|
105
104
|
renderPoints(group, data) {
|
|
106
105
|
const visible = [];
|
|
107
106
|
const cells = new Set();
|
|
108
|
-
const cellSize = Math.max(0.5, this.style.
|
|
107
|
+
const cellSize = Math.max(0.5, this.style.point.radius) / this.viewportScale;
|
|
109
108
|
const extent = this.scaler.x(1);
|
|
110
|
-
const margin = this.style.
|
|
109
|
+
const margin = this.style.point.radius / this.viewportScale;
|
|
111
110
|
const firstCell = Math.floor(-margin / cellSize);
|
|
112
111
|
const columns = Math.floor((extent + margin) / cellSize) - firstCell + 1;
|
|
113
112
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -130,7 +129,7 @@ export class TraceRenderer {
|
|
|
130
129
|
.join('circle')
|
|
131
130
|
.attr('cx', (index) => this.scaler.x(data.real(index)))
|
|
132
131
|
.attr('cy', (index) => this.scaler.y(data.imaginary(index)))
|
|
133
|
-
.attr('r', this.style.
|
|
132
|
+
.attr('r', this.style.point.radius / (this.transform.k * this.viewportScale));
|
|
134
133
|
}
|
|
135
134
|
setViewportScale(scale) {
|
|
136
135
|
if (scale === this.viewportScale || !Number.isFinite(scale) || scale <= 0) {
|
|
@@ -153,7 +152,7 @@ export class TraceRenderer {
|
|
|
153
152
|
this.renderPoints(this.group, this.data);
|
|
154
153
|
}
|
|
155
154
|
else {
|
|
156
|
-
this.group.Element.selectAll('circle').attr('r', this.style.
|
|
155
|
+
this.group.Element.selectAll('circle').attr('r', this.style.point.radius / (k * this.viewportScale));
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
setColor(color) {
|
|
@@ -162,19 +161,21 @@ export class TraceRenderer {
|
|
|
162
161
|
this.group.Element.select('.trace-line').attr('stroke', color);
|
|
163
162
|
}
|
|
164
163
|
get Style() {
|
|
165
|
-
return { ...this.style };
|
|
164
|
+
return { ...this.style, line: { ...this.style.line }, point: { ...this.style.point } };
|
|
166
165
|
}
|
|
167
166
|
setStyle(options) {
|
|
168
167
|
const next = {
|
|
169
168
|
mode: options.mode ?? this.style.mode,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
line: {
|
|
170
|
+
width: options.line?.width ?? this.style.line.width,
|
|
171
|
+
tolerancePx: options.line?.tolerancePx ?? this.style.line.tolerancePx,
|
|
172
|
+
},
|
|
173
|
+
point: { radius: options.point?.radius ?? this.style.point.radius },
|
|
173
174
|
};
|
|
174
175
|
if (next.mode === this.style.mode &&
|
|
175
|
-
next.
|
|
176
|
-
next.
|
|
177
|
-
next.
|
|
176
|
+
next.line.width === this.style.line.width &&
|
|
177
|
+
next.point.radius === this.style.point.radius &&
|
|
178
|
+
next.line.tolerancePx === this.style.line.tolerancePx) {
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
180
181
|
const modeChanged = next.mode !== this.style.mode;
|
|
@@ -183,7 +184,7 @@ export class TraceRenderer {
|
|
|
183
184
|
this.redraw();
|
|
184
185
|
}
|
|
185
186
|
else {
|
|
186
|
-
this.group.Element.select('.trace-line').attr('stroke-width', next.
|
|
187
|
+
this.group.Element.select('.trace-line').attr('stroke-width', next.line.width);
|
|
187
188
|
this.zoomDataPoints();
|
|
188
189
|
}
|
|
189
190
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smithkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Framework-independent, interactive Smith chart library for JavaScript and TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev": "vite --open",
|
|
8
|
-
"typecheck": "tsc --noEmit",
|
|
7
|
+
"dev": "npm run build:docs && vite --open",
|
|
8
|
+
"typecheck": "node node_modules/@typescript/native/bin/tsc --noEmit && ngc -p tsconfig.angular.json",
|
|
9
9
|
"build": "npm run typecheck && node scripts/build-library.mjs",
|
|
10
10
|
"preview": "vite preview",
|
|
11
11
|
"test": "vitest run",
|
|
12
12
|
"test:watch": "vitest",
|
|
13
13
|
"test:e2e": "playwright test",
|
|
14
14
|
"test:e2e:webkit": "playwright test --browser=webkit",
|
|
15
|
-
"check": "npm run format:check && npm run lint && npm run typecheck && npm test && npm run
|
|
16
|
-
"build:demo": "npm run typecheck && vite build",
|
|
15
|
+
"check": "npm run format:check && npm run lint && npm run typecheck && npm test && npm run api:check && npm run build:demo",
|
|
16
|
+
"build:demo": "npm run typecheck && npm run build:docs && vite build",
|
|
17
|
+
"build:docs": "node scripts/build-docs.mjs",
|
|
17
18
|
"prepack": "npm run build",
|
|
18
19
|
"lint": "eslint . --max-warnings=0",
|
|
19
20
|
"lint:fix": "eslint . --fix --max-warnings=0",
|
|
@@ -21,19 +22,31 @@
|
|
|
21
22
|
"format:check": "prettier . --check",
|
|
22
23
|
"check:package": "node scripts/check-package.mjs",
|
|
23
24
|
"check:example": "node scripts/check-example.mjs",
|
|
25
|
+
"check:browser": "node scripts/check-browser.mjs",
|
|
24
26
|
"prepare:release": "node scripts/prepare-release.mjs",
|
|
25
27
|
"benchmark:traces": "node scripts/benchmark-traces.mjs",
|
|
26
|
-
"benchmark:workloads": "node scripts/benchmark-workloads.mjs"
|
|
28
|
+
"benchmark:workloads": "node scripts/benchmark-workloads.mjs",
|
|
29
|
+
"test:e2e:firefox": "playwright test --browser=firefox",
|
|
30
|
+
"api:update": "node scripts/build-library.mjs && api-extractor run --local",
|
|
31
|
+
"api:check": "node scripts/build-library.mjs && api-extractor run"
|
|
27
32
|
},
|
|
28
33
|
"dependencies": {
|
|
29
34
|
"@types/d3": "^7.4.3",
|
|
30
35
|
"d3": "^7.9.0"
|
|
31
36
|
},
|
|
32
37
|
"devDependencies": {
|
|
38
|
+
"@angular/common": "22.2.2",
|
|
39
|
+
"@angular/compiler": "22.2.2",
|
|
40
|
+
"@angular/compiler-cli": "22.2.2",
|
|
41
|
+
"@angular/core": "22.2.2",
|
|
42
|
+
"@angular/platform-browser": "22.2.2",
|
|
33
43
|
"@eslint/js": "^10.0.1",
|
|
44
|
+
"@microsoft/api-extractor": "7.59.4",
|
|
34
45
|
"@playwright/test": "^1.63.0",
|
|
35
46
|
"@types/node": "^24.0.0",
|
|
36
47
|
"@types/pngjs": "^6.0.5",
|
|
48
|
+
"@types/react": "19.3.0",
|
|
49
|
+
"@types/react-dom": "19.3.0",
|
|
37
50
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
38
51
|
"eslint": "^10.12.0",
|
|
39
52
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -41,6 +54,11 @@
|
|
|
41
54
|
"pixelmatch": "^8.0.0",
|
|
42
55
|
"pngjs": "^7.0.0",
|
|
43
56
|
"prettier": "3.9.9",
|
|
57
|
+
"react": "19.3.0",
|
|
58
|
+
"react-dom": "19.3.0",
|
|
59
|
+
"rxjs": "7.8.2",
|
|
60
|
+
"shiki": "4.5.0",
|
|
61
|
+
"typedoc": "0.28.20",
|
|
44
62
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
45
63
|
"typescript-eslint": "^8.71.0",
|
|
46
64
|
"vite": "^8.3.2",
|