@tscircuit/cli 0.1.1681 → 0.1.1682

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/dist/cli/main.js CHANGED
@@ -77810,7 +77810,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
77810
77810
  layers: [renderLayer]
77811
77811
  });
77812
77812
  return ctx.pixels;
77813
- }, includePointInBounds = (bounds, point9, margin = 0) => mergeBounds2(bounds, {
77813
+ }, COPPER_POUR_PAINT_PRIORITY = 1, OTHER_COPPER_PAINT_PRIORITY = 2, includePointInBounds = (bounds, point9, margin = 0) => mergeBounds2(bounds, {
77814
77814
  minX: point9.x - margin,
77815
77815
  maxX: point9.x + margin,
77816
77816
  minY: point9.y - margin,
@@ -77964,6 +77964,58 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
77964
77964
  maxY: boardBounds.maxY - (rect.y - offsetY) / scale6,
77965
77965
  minY: boardBounds.maxY - (rect.y + rect.height - offsetY) / scale6
77966
77966
  };
77967
+ }, createBitmapMask = async ({
77968
+ elements,
77969
+ boardBounds,
77970
+ width,
77971
+ height,
77972
+ layer,
77973
+ mode
77974
+ }) => {
77975
+ const groupBounds = getGroupBounds({ elements, boardBounds });
77976
+ const rect = getPixelRectFromBounds({
77977
+ bounds: groupBounds,
77978
+ boardBounds,
77979
+ width,
77980
+ height
77981
+ });
77982
+ if (rect.width === 0 || rect.height === 0)
77983
+ return null;
77984
+ const maskBounds = getBoundsFromPixelRect({
77985
+ rect,
77986
+ boardBounds,
77987
+ width,
77988
+ height
77989
+ });
77990
+ const mask = await createGroupMask({
77991
+ elements,
77992
+ bounds: maskBounds,
77993
+ width: rect.width,
77994
+ height: rect.height,
77995
+ layer,
77996
+ mode
77997
+ });
77998
+ return { rect, mask };
77999
+ }, paintBitmapMask = ({
78000
+ bitmapMask,
78001
+ color,
78002
+ priority,
78003
+ width,
78004
+ rgba,
78005
+ paintPriorities
78006
+ }) => {
78007
+ const { mask, rect } = bitmapMask;
78008
+ for (let i4 = 0;i4 < mask.length; i4++) {
78009
+ if (mask[i4] === 0)
78010
+ continue;
78011
+ const localX = i4 % rect.width;
78012
+ const localY = Math.floor(i4 / rect.width);
78013
+ const pixelIndex = (rect.y + localY) * width + rect.x + localX;
78014
+ if (paintPriorities[pixelIndex] >= priority)
78015
+ continue;
78016
+ paintPriorities[pixelIndex] = priority;
78017
+ setRgbaPixel(rgba, pixelIndex, color);
78018
+ }
77967
78019
  }, createShortsFromPixelGroups = ({
77968
78020
  shortPixelGroups,
77969
78021
  bounds,
@@ -78041,6 +78093,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
78041
78093
  const pixelOwners = new Array(width * height);
78042
78094
  const shortPixelGroupMap = new Map;
78043
78095
  const rgba = new Uint8Array(width * height * 4);
78096
+ const paintPriorities = new Uint8Array(width * height);
78044
78097
  for (let i4 = 0;i4 < width * height; i4++) {
78045
78098
  setRgbaPixel(rgba, i4, [0, 0, 0]);
78046
78099
  }
@@ -78048,35 +78101,22 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
78048
78101
  const legend = buildBitmapLegend({ sortedConnectivityGroups, db: db2 });
78049
78102
  for (const [key, elements] of sortedConnectivityGroups) {
78050
78103
  const color = getDebugColorForConnectivityKey(key);
78051
- const groupBounds = getGroupBounds({ elements, boardBounds: bounds });
78052
- const rect = getPixelRectFromBounds({
78053
- bounds: groupBounds,
78054
- boardBounds: bounds,
78055
- width,
78056
- height
78057
- });
78058
- if (rect.width === 0 || rect.height === 0)
78059
- continue;
78060
- const maskBounds = getBoundsFromPixelRect({
78061
- rect,
78104
+ const bitmapMask = await createBitmapMask({
78105
+ elements,
78062
78106
  boardBounds: bounds,
78063
78107
  width,
78064
- height
78065
- });
78066
- const mask = await createGroupMask({
78067
- elements,
78068
- bounds: maskBounds,
78069
- width: rect.width,
78070
- height: rect.height,
78108
+ height,
78071
78109
  layer,
78072
78110
  mode
78073
78111
  });
78074
- for (let i4 = 0;i4 < mask.length; i4++) {
78075
- if (mask[i4] === 0)
78112
+ if (!bitmapMask)
78113
+ continue;
78114
+ for (let i4 = 0;i4 < bitmapMask.mask.length; i4++) {
78115
+ if (bitmapMask.mask[i4] === 0)
78076
78116
  continue;
78077
- const localX = i4 % rect.width;
78078
- const localY = Math.floor(i4 / rect.width);
78079
- const globalPixelIndex = (rect.y + localY) * width + rect.x + localX;
78117
+ const localX = i4 % bitmapMask.rect.width;
78118
+ const localY = Math.floor(i4 / bitmapMask.rect.width);
78119
+ const globalPixelIndex = (bitmapMask.rect.y + localY) * width + bitmapMask.rect.x + localX;
78080
78120
  const existingOwner = pixelOwners[globalPixelIndex];
78081
78121
  if (existingOwner && existingOwner !== key) {
78082
78122
  const [firstConnectivityKey, secondConnectivityKey] = [
@@ -78102,9 +78142,68 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
78102
78142
  }
78103
78143
  } else if (!existingOwner) {
78104
78144
  pixelOwners[globalPixelIndex] = key;
78105
- setRgbaPixel(rgba, globalPixelIndex, color);
78106
78145
  }
78107
78146
  }
78147
+ const copperPourElements = elements.filter((element) => element.type === "pcb_copper_pour");
78148
+ const nonPourElements = elements.filter((element) => element.type !== "pcb_copper_pour");
78149
+ if (copperPourElements.length === 0) {
78150
+ paintBitmapMask({
78151
+ bitmapMask,
78152
+ color,
78153
+ priority: OTHER_COPPER_PAINT_PRIORITY,
78154
+ width,
78155
+ rgba,
78156
+ paintPriorities
78157
+ });
78158
+ continue;
78159
+ }
78160
+ if (nonPourElements.length === 0) {
78161
+ paintBitmapMask({
78162
+ bitmapMask,
78163
+ color,
78164
+ priority: COPPER_POUR_PAINT_PRIORITY,
78165
+ width,
78166
+ rgba,
78167
+ paintPriorities
78168
+ });
78169
+ continue;
78170
+ }
78171
+ const copperPourMask = await createBitmapMask({
78172
+ elements: copperPourElements,
78173
+ boardBounds: bounds,
78174
+ width,
78175
+ height,
78176
+ layer,
78177
+ mode
78178
+ });
78179
+ if (copperPourMask) {
78180
+ paintBitmapMask({
78181
+ bitmapMask: copperPourMask,
78182
+ color,
78183
+ priority: COPPER_POUR_PAINT_PRIORITY,
78184
+ width,
78185
+ rgba,
78186
+ paintPriorities
78187
+ });
78188
+ }
78189
+ const nonPourMask = await createBitmapMask({
78190
+ elements: nonPourElements,
78191
+ boardBounds: bounds,
78192
+ width,
78193
+ height,
78194
+ layer,
78195
+ mode
78196
+ });
78197
+ if (nonPourMask) {
78198
+ paintBitmapMask({
78199
+ bitmapMask: nonPourMask,
78200
+ color,
78201
+ priority: OTHER_COPPER_PAINT_PRIORITY,
78202
+ width,
78203
+ rgba,
78204
+ paintPriorities
78205
+ });
78206
+ }
78108
78207
  }
78109
78208
  const shorts = createShortsFromPixelGroups({
78110
78209
  shortPixelGroups: [...shortPixelGroupMap.values()],
@@ -118348,7 +118447,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
118348
118447
  // lib/getVersion.ts
118349
118448
  import { createRequire as createRequire2 } from "node:module";
118350
118449
  // package.json
118351
- var version = "0.1.1680";
118450
+ var version = "0.1.1681";
118352
118451
  var package_default = {
118353
118452
  name: "@tscircuit/cli",
118354
118453
  version,
@@ -118360,7 +118459,7 @@ var package_default = {
118360
118459
  devDependencies: {
118361
118460
  "@babel/standalone": "^7.26.9",
118362
118461
  "@biomejs/biome": "^1.9.4",
118363
- "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.10.tgz",
118462
+ "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.12.tgz",
118364
118463
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
118365
118464
  "@tscircuit/circuit-json-routing-analysis": "^0.0.6",
118366
118465
  "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
package/dist/lib/index.js CHANGED
@@ -65812,7 +65812,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65812
65812
  }));
65813
65813
  };
65814
65814
  // package.json
65815
- var version = "0.1.1680";
65815
+ var version = "0.1.1681";
65816
65816
  var package_default = {
65817
65817
  name: "@tscircuit/cli",
65818
65818
  version,
@@ -65824,7 +65824,7 @@ var package_default = {
65824
65824
  devDependencies: {
65825
65825
  "@babel/standalone": "^7.26.9",
65826
65826
  "@biomejs/biome": "^1.9.4",
65827
- "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.10.tgz",
65827
+ "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.12.tgz",
65828
65828
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
65829
65829
  "@tscircuit/circuit-json-routing-analysis": "^0.0.6",
65830
65830
  "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1681",
3
+ "version": "0.1.1682",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -9,7 +9,7 @@
9
9
  "devDependencies": {
10
10
  "@babel/standalone": "^7.26.9",
11
11
  "@biomejs/biome": "^1.9.4",
12
- "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.10.tgz",
12
+ "@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.12.tgz",
13
13
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
14
14
  "@tscircuit/circuit-json-routing-analysis": "^0.0.6",
15
15
  "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#b6d5fe675adc26a2fc988aa081e6fb51e6bf696a",