@ni/nimble-components 24.0.0 → 24.0.1

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.
@@ -16301,7 +16301,7 @@
16301
16301
 
16302
16302
  /**
16303
16303
  * Do not edit directly
16304
- * Generated on Tue, 26 Mar 2024 20:29:30 GMT
16304
+ * Generated on Wed, 27 Mar 2024 11:47:50 GMT
16305
16305
  */
16306
16306
 
16307
16307
  const Information100DarkUi = "#a46eff";
@@ -75088,7 +75088,7 @@ img.ProseMirror-separator {
75088
75088
  /**
75089
75089
  * Computations calculates and stores different measures which are used in the Wafermap
75090
75090
  */
75091
- class Computations {
75091
+ let Computations$1 = class Computations {
75092
75092
  get containerDimensions() {
75093
75093
  return this._containerDimensions;
75094
75094
  }
@@ -75265,7 +75265,7 @@ img.ProseMirror-separator {
75265
75265
  left: baseMargin.left + addedMargin.left
75266
75266
  };
75267
75267
  }
75268
- }
75268
+ };
75269
75269
 
75270
75270
  /**
75271
75271
  * Prerendering prepares render-ready dies data to be used by the rendering module
@@ -75331,7 +75331,7 @@ img.ProseMirror-separator {
75331
75331
  return '';
75332
75332
  }
75333
75333
  const label = `${value}${dieLabelsSuffix}`;
75334
- if (label.length > maxCharacters) {
75334
+ if (label.length >= maxCharacters) {
75335
75335
  return `${label.substring(0, maxCharacters)}…`;
75336
75336
  }
75337
75337
  return label;
@@ -75380,7 +75380,7 @@ img.ProseMirror-separator {
75380
75380
  /**
75381
75381
  * Data Manager uses Computations and Prerendering modules in order and exposes the results
75382
75382
  */
75383
- class DataManager {
75383
+ let DataManager$1 = class DataManager {
75384
75384
  get containerDimensions() {
75385
75385
  return this.computations.containerDimensions;
75386
75386
  }
@@ -75414,6 +75414,219 @@ img.ProseMirror-separator {
75414
75414
  get data() {
75415
75415
  return this.dataMap;
75416
75416
  }
75417
+ constructor(wafermap) {
75418
+ this.wafermap = wafermap;
75419
+ this.computations = new Computations$1(wafermap);
75420
+ this.prerendering = new Prerendering(wafermap);
75421
+ }
75422
+ updateContainerDimensions() {
75423
+ this.computations.updateContainerDimensions();
75424
+ this.updateDataMap();
75425
+ this.updateLabelsFontSize();
75426
+ }
75427
+ updateScales() {
75428
+ this.computations.updateScales();
75429
+ this.updateDataMap();
75430
+ this.updateLabelsFontSize();
75431
+ }
75432
+ updateLabelsFontSize() {
75433
+ this.prerendering.updateLabelsFontSize();
75434
+ }
75435
+ updateDiesRenderInfo() {
75436
+ this.prerendering.updateDiesRenderInfo();
75437
+ }
75438
+ getWaferMapDie(point) {
75439
+ return this.dataMap.get(`${point.x}_${point.y}`);
75440
+ }
75441
+ updateDataMap() {
75442
+ this.dataMap = new Map(this.wafermap.dies.map(die => [`${die.x}_${die.y}`, die]));
75443
+ }
75444
+ };
75445
+
75446
+ /**
75447
+ * Computations calculates and stores different measures which are used in the Wafermap
75448
+ */
75449
+ class Computations {
75450
+ get containerDimensions() {
75451
+ return this._containerDimensions;
75452
+ }
75453
+ get dieDimensions() {
75454
+ return this._dieDimensions;
75455
+ }
75456
+ get margin() {
75457
+ return this._margin;
75458
+ }
75459
+ get horizontalScale() {
75460
+ return this._horizontalScale;
75461
+ }
75462
+ get verticalScale() {
75463
+ return this._verticalScale;
75464
+ }
75465
+ constructor(wafermap) {
75466
+ this.wafermap = wafermap;
75467
+ this.defaultPadding = 0;
75468
+ this.baseMarginPercentage = 0.04;
75469
+ }
75470
+ updateContainerDimensions() {
75471
+ const canvasDimensions = {
75472
+ width: this.wafermap.canvasWidth,
75473
+ height: this.wafermap.canvasHeight
75474
+ };
75475
+ const canvasDiameter = Math.min(canvasDimensions.width, canvasDimensions.height);
75476
+ const canvasMargin = {
75477
+ top: (canvasDimensions.height - canvasDiameter) / 2,
75478
+ right: (canvasDimensions.width - canvasDiameter) / 2,
75479
+ bottom: (canvasDimensions.height - canvasDiameter) / 2,
75480
+ left: (canvasDimensions.width - canvasDiameter) / 2
75481
+ };
75482
+ const baseMargin = {
75483
+ top: canvasDiameter * this.baseMarginPercentage,
75484
+ right: canvasDiameter * this.baseMarginPercentage,
75485
+ bottom: canvasDiameter * this.baseMarginPercentage,
75486
+ left: canvasDiameter * this.baseMarginPercentage
75487
+ };
75488
+ this._margin = this.calculateMarginAddition(baseMargin, canvasMargin);
75489
+ this._containerDimensions = this.calculateContainerDimensions(canvasDimensions, this._margin);
75490
+ this.updateScales();
75491
+ }
75492
+ updateScales() {
75493
+ const containerDiameter = Math.min(this._containerDimensions.width, this._containerDimensions.height);
75494
+ const gridDimensions = this.gridDimensionsValidAndDefined()
75495
+ ? this.calculateGridDimensionsFromBoundingBox()
75496
+ : this.calculateGridDimensionsFromDies();
75497
+ // this scale is used for positioning the dies on the canvas
75498
+ const originLocation = this.wafermap.originLocation;
75499
+ this._horizontalScale = this.createHorizontalScale(originLocation, gridDimensions, containerDiameter);
75500
+ // this scale is used for positioning the dies on the canvas
75501
+ this._verticalScale = this.createVerticalScale(originLocation, gridDimensions, containerDiameter);
75502
+ this._dieDimensions = {
75503
+ width: Math.abs(this._horizontalScale(0) - this._horizontalScale(1)),
75504
+ height: Math.abs(this._verticalScale(0) - this._verticalScale(1))
75505
+ };
75506
+ }
75507
+ gridDimensionsValidAndDefined() {
75508
+ return (!this.wafermap.validity.invalidGridDimensions
75509
+ && typeof this.wafermap.gridMinX === 'number'
75510
+ && typeof this.wafermap.gridMinY === 'number'
75511
+ && typeof this.wafermap.gridMaxX === 'number'
75512
+ && typeof this.wafermap.gridMinX === 'number');
75513
+ }
75514
+ calculateGridDimensionsFromBoundingBox() {
75515
+ const gridDimensions = { origin: { x: 0, y: 0 }, rows: 0, cols: 0 };
75516
+ if (typeof this.wafermap.gridMaxY === 'number'
75517
+ && typeof this.wafermap.gridMinY === 'number'
75518
+ && typeof this.wafermap.gridMaxX === 'number'
75519
+ && typeof this.wafermap.gridMinX === 'number') {
75520
+ gridDimensions.origin.x = this.wafermap.gridMinX;
75521
+ gridDimensions.origin.y = this.wafermap.gridMinY;
75522
+ gridDimensions.rows = this.wafermap.gridMaxY - this.wafermap.gridMinY + 1;
75523
+ gridDimensions.cols = this.wafermap.gridMaxX - this.wafermap.gridMinX + 1;
75524
+ }
75525
+ return gridDimensions;
75526
+ }
75527
+ calculateGridDimensionsFromDies() {
75528
+ if (this.wafermap.diesTable === undefined) {
75529
+ return { origin: { x: 0, y: 0 }, rows: 0, cols: 0 };
75530
+ }
75531
+ const colIndex = this.wafermap.diesTable
75532
+ .getChild('colIndex')
75533
+ .toArray();
75534
+ const rowIndex = this.wafermap.diesTable
75535
+ .getChild('rowIndex')
75536
+ .toArray();
75537
+ const minPoint = { x: colIndex[0], y: rowIndex[0] };
75538
+ const maxPoint = { x: colIndex[0], y: rowIndex[0] };
75539
+ // will replace iterating with arquero after fixing issues: https://github.com/uwdata/arquero/pull/346
75540
+ for (let i = 0; i < colIndex.length; i++) {
75541
+ if (colIndex[i] < minPoint.x) {
75542
+ minPoint.x = colIndex[i];
75543
+ }
75544
+ if (colIndex[i] > maxPoint.x) {
75545
+ maxPoint.x = colIndex[i];
75546
+ }
75547
+ if (rowIndex[i] < minPoint.y) {
75548
+ minPoint.y = rowIndex[i];
75549
+ }
75550
+ if (rowIndex[i] > maxPoint.y) {
75551
+ maxPoint.y = rowIndex[i];
75552
+ }
75553
+ }
75554
+ return {
75555
+ origin: minPoint,
75556
+ rows: maxPoint.y - minPoint.y + 1,
75557
+ cols: maxPoint.x - minPoint.x + 1
75558
+ };
75559
+ }
75560
+ calculateContainerDimensions(canvasDimensions, margin) {
75561
+ return {
75562
+ width: canvasDimensions.width - margin.left - margin.right,
75563
+ height: canvasDimensions.height - margin.top - margin.bottom
75564
+ };
75565
+ }
75566
+ createHorizontalScale(originLocation, grid, containerWidth) {
75567
+ const scale = linear();
75568
+ if (originLocation === WaferMapOriginLocation.bottomLeft
75569
+ || originLocation === WaferMapOriginLocation.topLeft) {
75570
+ return scale
75571
+ .domain([grid.origin.x, grid.origin.x + grid.cols])
75572
+ .range([0, containerWidth]);
75573
+ }
75574
+ return scale
75575
+ .domain([grid.origin.x - 1, grid.origin.x + grid.cols - 1])
75576
+ .range([containerWidth, 0]);
75577
+ }
75578
+ createVerticalScale(originLocation, grid, containerHeight) {
75579
+ const scale = linear();
75580
+ // html canvas has top-left origin https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes#the_grid
75581
+ // we need to flip the vertical scale
75582
+ if (originLocation === WaferMapOriginLocation.bottomLeft
75583
+ || originLocation === WaferMapOriginLocation.bottomRight) {
75584
+ return scale
75585
+ .domain([grid.origin.y - 1, grid.origin.y + grid.rows - 1])
75586
+ .range([containerHeight, 0]);
75587
+ }
75588
+ return scale
75589
+ .domain([grid.origin.y, grid.origin.y + grid.rows])
75590
+ .range([0, containerHeight]);
75591
+ }
75592
+ calculateMarginAddition(baseMargin, addedMargin) {
75593
+ return {
75594
+ top: baseMargin.top + addedMargin.top,
75595
+ right: baseMargin.right + addedMargin.right,
75596
+ bottom: baseMargin.bottom + addedMargin.bottom,
75597
+ left: baseMargin.left + addedMargin.left
75598
+ };
75599
+ }
75600
+ }
75601
+
75602
+ /**
75603
+ * Data Manager uses Computations and Prerendering modules in order and exposes the results
75604
+ */
75605
+ class DataManager {
75606
+ get containerDimensions() {
75607
+ return this.computations.containerDimensions;
75608
+ }
75609
+ get dieDimensions() {
75610
+ return this.computations.dieDimensions;
75611
+ }
75612
+ get margin() {
75613
+ return this.computations.margin;
75614
+ }
75615
+ get horizontalScale() {
75616
+ return this.computations.horizontalScale;
75617
+ }
75618
+ get verticalScale() {
75619
+ return this.computations.verticalScale;
75620
+ }
75621
+ get labelsFontSize() {
75622
+ return this.prerendering.labelsFontSize;
75623
+ }
75624
+ get diesRenderInfo() {
75625
+ return this.prerendering.diesRenderInfo;
75626
+ }
75627
+ get data() {
75628
+ return this.dataMap;
75629
+ }
75417
75630
  constructor(wafermap) {
75418
75631
  this.wafermap = wafermap;
75419
75632
  this.computations = new Computations(wafermap);
@@ -76385,6 +76598,10 @@ img.ProseMirror-separator {
76385
76598
  x: invertedPoint[0],
76386
76599
  y: invertedPoint[1]
76387
76600
  });
76601
+ if (dieCoordinates === undefined) {
76602
+ this.wafermap.hoverDie = undefined;
76603
+ return;
76604
+ }
76388
76605
  this.wafermap.hoverDie = this.wafermap.dataManager.getWaferMapDie(dieCoordinates);
76389
76606
  };
76390
76607
  this.onMouseOut = (_event) => {
@@ -76406,19 +76623,23 @@ img.ProseMirror-separator {
76406
76623
  this.wafermap.removeEventListener('mouseout', this.onMouseOut);
76407
76624
  }
76408
76625
  calculateDieCoordinates(mousePosition) {
76409
- const originLocation = this.wafermap.originLocation;
76410
- const xRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76411
- || originLocation === WaferMapOriginLocation.topLeft
76412
- ? Math.floor
76413
- : Math.ceil;
76414
- const yRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76415
- || originLocation === WaferMapOriginLocation.bottomRight
76416
- ? Math.floor
76417
- : Math.ceil;
76418
- // go to x and y scale to get the x,y values of the die.
76419
- const x = xRoundFunction(this.wafermap.dataManager.invertedHorizontalScale(mousePosition.x - this.wafermap.dataManager.margin.left));
76420
- const y = yRoundFunction(this.wafermap.dataManager.invertedVerticalScale(mousePosition.y - this.wafermap.dataManager.margin.top));
76421
- return { x, y };
76626
+ if (!this.wafermap.isExperimentalRenderer()
76627
+ && this.wafermap.dataManager instanceof DataManager$1) {
76628
+ const originLocation = this.wafermap.originLocation;
76629
+ const xRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76630
+ || originLocation === WaferMapOriginLocation.topLeft
76631
+ ? Math.floor
76632
+ : Math.ceil;
76633
+ const yRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76634
+ || originLocation === WaferMapOriginLocation.bottomRight
76635
+ ? Math.floor
76636
+ : Math.ceil;
76637
+ // go to x and y scale to get the x,y values of the die.
76638
+ const x = xRoundFunction(this.wafermap.dataManager.invertedHorizontalScale(mousePosition.x - this.wafermap.dataManager.margin.left));
76639
+ const y = yRoundFunction(this.wafermap.dataManager.invertedVerticalScale(mousePosition.y - this.wafermap.dataManager.margin.top));
76640
+ return { x, y };
76641
+ }
76642
+ return undefined;
76422
76643
  }
76423
76644
  hoversOverDie(mousePosition) {
76424
76645
  const rgba = this.wafermap.canvasContext.getImageData(mousePosition.x, mousePosition.y, 1, 1).data;
@@ -76449,11 +76670,14 @@ img.ProseMirror-separator {
76449
76670
  event.offsetX,
76450
76671
  event.offsetY
76451
76672
  ]);
76452
- // does not work yet until data manager will parse diesTable
76453
76673
  const dieCoordinates = this.calculateDieCoordinates({
76454
76674
  x: invertedPoint[0],
76455
76675
  y: invertedPoint[1]
76456
76676
  });
76677
+ if (dieCoordinates === undefined) {
76678
+ this.wafermap.hoverDie = undefined;
76679
+ return;
76680
+ }
76457
76681
  const colIndex = this.wafermap
76458
76682
  .diesTable.getChild('colIndex')
76459
76683
  .toArray();
@@ -76493,19 +76717,23 @@ img.ProseMirror-separator {
76493
76717
  this.wafermap.removeEventListener('mouseout', this.onMouseOut);
76494
76718
  }
76495
76719
  calculateDieCoordinates(mousePosition) {
76496
- const originLocation = this.wafermap.originLocation;
76497
- const xRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76498
- || originLocation === WaferMapOriginLocation.topLeft
76499
- ? Math.floor
76500
- : Math.ceil;
76501
- const yRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76502
- || originLocation === WaferMapOriginLocation.bottomRight
76503
- ? Math.floor
76504
- : Math.ceil;
76505
- // go to x and y scale to get the x,y values of the die.
76506
- const x = xRoundFunction(this.wafermap.dataManager.invertedHorizontalScale(mousePosition.x - this.wafermap.dataManager.margin.left));
76507
- const y = yRoundFunction(this.wafermap.dataManager.invertedVerticalScale(mousePosition.y - this.wafermap.dataManager.margin.top));
76508
- return { x, y };
76720
+ if (this.wafermap.isExperimentalRenderer()
76721
+ && this.wafermap.dataManager instanceof DataManager) {
76722
+ const originLocation = this.wafermap.originLocation;
76723
+ const xRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76724
+ || originLocation === WaferMapOriginLocation.topLeft
76725
+ ? Math.floor
76726
+ : Math.ceil;
76727
+ const yRoundFunction = originLocation === WaferMapOriginLocation.bottomLeft
76728
+ || originLocation === WaferMapOriginLocation.bottomRight
76729
+ ? Math.ceil
76730
+ : Math.floor;
76731
+ // go to x and y scale to get the x,y values of the die.
76732
+ const x = xRoundFunction(this.wafermap.dataManager.horizontalScale.invert(mousePosition.x - this.wafermap.dataManager.margin.left));
76733
+ const y = yRoundFunction(this.wafermap.dataManager.verticalScale.invert(mousePosition.y - this.wafermap.dataManager.margin.top));
76734
+ return { x, y };
76735
+ }
76736
+ return undefined;
76509
76737
  }
76510
76738
  }
76511
76739
 
@@ -76576,7 +76804,12 @@ img.ProseMirror-separator {
76576
76804
  /**
76577
76805
  * @internal
76578
76806
  */
76579
- this.dataManager = new DataManager(this.asRequiredFieldsWaferMap);
76807
+ this.stableDataManager = new DataManager$1(this.asRequiredFieldsWaferMap);
76808
+ /**
76809
+ * @internal
76810
+ */
76811
+ this.experimentalDataManager = new DataManager(this.asRequiredFieldsWaferMap);
76812
+ this.dataManager = this.stableDataManager;
76580
76813
  /**
76581
76814
  * @internal
76582
76815
  */
@@ -76662,6 +76895,9 @@ img.ProseMirror-separator {
76662
76895
  if (this.waferMapUpdateTracker.requiresEventsUpdate) {
76663
76896
  // zoom translateExtent needs to be recalculated when canvas size changes
76664
76897
  this.zoomHandler.disconnect();
76898
+ this.dataManager = this.isExperimentalRenderer()
76899
+ ? this.experimentalDataManager
76900
+ : this.stableDataManager;
76665
76901
  if (this.waferMapUpdateTracker.requiresContainerDimensionsUpdate) {
76666
76902
  this.dataManager.updateContainerDimensions();
76667
76903
  this.renderer.updateSortedDiesAndDrawWafer();