@ni/nimble-components 18.3.5 → 18.3.7

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.
@@ -26717,6 +26717,7 @@
26717
26717
  width: 100%;
26718
26718
  height: 100%;
26719
26719
  position: absolute;
26720
+ pointer-events: none;
26720
26721
  }
26721
26722
 
26722
26723
  .row:hover::before {
@@ -26729,6 +26730,7 @@
26729
26730
  height: 100%;
26730
26731
  position: absolute;
26731
26732
  background: ${fillHoverColor};
26733
+ pointer-events: none;
26732
26734
  }
26733
26735
 
26734
26736
  .row::before {
@@ -32431,11 +32433,7 @@ Instead styling against the role which is more general and likely a better appro
32431
32433
  const template = html `
32432
32434
  <div class="wafer-map-container">
32433
32435
  <svg class="svg-root">
32434
- <g
32435
- class="zoom-container"
32436
- ${ref('zoomContainer')}
32437
- transform=${x => x.transform.toString()}
32438
- >
32436
+ <g ${ref('zoomContainer')} transform=${x => x.transform.toString()}>
32439
32437
  <g class="notch ${x => x.orientation}">
32440
32438
  <svg
32441
32439
  class="circle-base"
@@ -32452,9 +32450,7 @@ Instead styling against the role which is more general and likely a better appro
32452
32450
  </g>
32453
32451
  </g>
32454
32452
  </svg>
32455
- <div class="wafer-map-area">
32456
- <canvas class="wafer-map-canvas" ${ref('canvas')}></canvas>
32457
- </div>
32453
+ <canvas class="wafer-map-canvas" ${ref('canvas')}></canvas>
32458
32454
  </div>
32459
32455
  `;
32460
32456
 
@@ -32467,7 +32463,7 @@ Instead styling against the role which is more general and likely a better appro
32467
32463
 
32468
32464
  .wafer-map-container {
32469
32465
  width: 100%;
32470
- padding-bottom: 100%;
32466
+ height: 100%;
32471
32467
  position: relative;
32472
32468
  display: inline-block;
32473
32469
  justify-content: center;
@@ -32500,16 +32496,7 @@ Instead styling against the role which is more general and likely a better appro
32500
32496
  transform: rotate(90deg);
32501
32497
  }
32502
32498
 
32503
- .zoom-container {
32504
- width: 100%;
32505
- height: 100%;
32506
- position: absolute;
32507
- }
32508
-
32509
32499
  .circle-base {
32510
- width: 100%;
32511
- height: 100%;
32512
- position: absolute;
32513
32500
  fill: white;
32514
32501
  }
32515
32502
 
@@ -32520,18 +32507,9 @@ Instead styling against the role which is more general and likely a better appro
32520
32507
  stroke: ${borderColor};
32521
32508
  }
32522
32509
 
32523
- .wafer-map-area {
32524
- position: absolute;
32525
- justify-content: center;
32526
- align-items: center;
32527
- width: 100%;
32528
- height: 100%;
32529
- }
32530
-
32531
32510
  .wafer-map-canvas {
32532
32511
  display: inline-block;
32533
- width: 100%;
32534
- height: 100%;
32512
+ position: absolute;
32535
32513
  }
32536
32514
  `;
32537
32515
 
@@ -33430,43 +33408,47 @@ Instead styling against the role which is more general and likely a better appro
33430
33408
  * Computations calculates and stores different measures which are used in the Wafermap
33431
33409
  */
33432
33410
  class Computations {
33433
- constructor(dies, axisLocation, canvasDimensions) {
33411
+ constructor(wafermap) {
33434
33412
  this.baseMargin = {
33435
- top: 20,
33436
- right: 20,
33437
- bottom: 20,
33438
- left: 20
33413
+ top: 0,
33414
+ right: 0,
33415
+ bottom: 0,
33416
+ left: 0
33439
33417
  };
33440
- this.dieSizeFactor = 1.5;
33441
33418
  this.defaultAlign = 0.5;
33442
- this.margin = this.baseMargin;
33443
- const gridMapDimensions = this.calculateMapDimensions(dies);
33444
- this.containerDimensions = this.calculateContainerDimensions(canvasDimensions, this.margin);
33445
- this.horizontalScale = this.createHorizontalScale(axisLocation, gridMapDimensions, this.containerDimensions.width);
33446
- this.dieDimensions = {
33447
- width: this.calculateGridWidth(gridMapDimensions.cols, this.containerDimensions.width),
33448
- height: 0
33419
+ this.baseMarginPercentage = 0.04;
33420
+ const canvasDimensions = {
33421
+ width: wafermap.canvasWidth,
33422
+ height: wafermap.canvasHeight
33449
33423
  };
33450
- this.radius = this.containerDimensions.width / 2
33451
- + this.dieDimensions.width * this.dieSizeFactor;
33452
- if (this.radius > canvasDimensions.width / 2) {
33453
- this.margin = this.calculateMarginWithAddition(this.radius - canvasDimensions.width / 2);
33454
- this.containerDimensions = this.calculateContainerDimensions(canvasDimensions, this.margin);
33455
- this.horizontalScale = this.createHorizontalScale(axisLocation, gridMapDimensions, this.containerDimensions.width);
33456
- this.dieDimensions = {
33457
- width: this.calculateGridWidth(gridMapDimensions.cols, this.containerDimensions.width),
33458
- height: 0
33459
- };
33460
- this.radius = this.containerDimensions.width / 2
33461
- + this.dieDimensions.width * this.dieSizeFactor;
33462
- }
33463
- this.verticalScale = this.createVerticalScale(axisLocation, gridMapDimensions, this.containerDimensions.height);
33424
+ const gridDimensions = this.calculateGridDimensions(wafermap.dies);
33425
+ const canvasDiameter = Math.min(canvasDimensions.width, canvasDimensions.height);
33426
+ const canvasMargin = {
33427
+ top: (canvasDimensions.height - canvasDiameter) / 2,
33428
+ right: (canvasDimensions.width - canvasDiameter) / 2,
33429
+ bottom: (canvasDimensions.height - canvasDiameter) / 2,
33430
+ left: (canvasDimensions.width - canvasDiameter) / 2
33431
+ };
33432
+ const baseMargin = {
33433
+ top: canvasDiameter * this.baseMarginPercentage,
33434
+ right: canvasDiameter * this.baseMarginPercentage,
33435
+ bottom: canvasDiameter * this.baseMarginPercentage,
33436
+ left: canvasDiameter * this.baseMarginPercentage
33437
+ };
33438
+ this.margin = this.calculateMarginAddition(baseMargin, canvasMargin);
33439
+ this.containerDimensions = this.calculateContainerDimensions(canvasDimensions, this.margin);
33440
+ const containerDiameter = Math.min(this.containerDimensions.width, this.containerDimensions.height);
33441
+ // this scale is used for positioning the dies on the canvas
33442
+ this.horizontalScale = this.createHorizontalScale(wafermap.quadrant, gridDimensions, containerDiameter);
33443
+ // this scale is used for positioning the dies on the canvas
33444
+ this.verticalScale = this.createVerticalScale(wafermap.quadrant, gridDimensions, containerDiameter);
33464
33445
  this.dieDimensions = {
33465
- width: this.dieDimensions.width,
33466
- height: this.calculateGridHeight(gridMapDimensions.rows, this.containerDimensions.height)
33446
+ width: this.calculateGridWidth(gridDimensions.cols, this.containerDimensions.width),
33447
+ height: this.calculateGridHeight(gridDimensions.rows, this.containerDimensions.height)
33467
33448
  };
33449
+ this.radius = containerDiameter / 2;
33468
33450
  }
33469
- calculateMapDimensions(dies) {
33451
+ calculateGridDimensions(dies) {
33470
33452
  if (dies.length === 0 || dies[0] === undefined) {
33471
33453
  return { origin: { x: 0, y: 0 }, rows: 0, cols: 0 };
33472
33454
  }
@@ -33536,12 +33518,12 @@ Instead styling against the role which is more general and likely a better appro
33536
33518
  .range([0, containerHeight])
33537
33519
  .bandwidth();
33538
33520
  }
33539
- calculateMarginWithAddition(baseAddition = 0) {
33521
+ calculateMarginAddition(baseMargin, addedMargin) {
33540
33522
  return {
33541
- top: this.baseMargin.top + baseAddition,
33542
- right: this.baseMargin.right + baseAddition,
33543
- bottom: this.baseMargin.bottom + baseAddition,
33544
- left: this.baseMargin.top + baseAddition
33523
+ top: baseMargin.top + addedMargin.top,
33524
+ right: baseMargin.right + addedMargin.right,
33525
+ bottom: baseMargin.bottom + addedMargin.bottom,
33526
+ left: baseMargin.left + addedMargin.left
33545
33527
  };
33546
33528
  }
33547
33529
  }
@@ -33550,20 +33532,20 @@ Instead styling against the role which is more general and likely a better appro
33550
33532
  * Prerendering prepares render-ready dies data to be used by the rendering module
33551
33533
  */
33552
33534
  class Prerendering {
33553
- constructor(dies, colorScale, highlightedValues, horizontalScale, verticalScale, colorScaleMode, dieLabelsHidden, dieLabelsSuffix, maxCharacters, dieDimensions, margin) {
33535
+ constructor(wafermap, horizontalScale, verticalScale, dieDimensions, margin) {
33554
33536
  this.fontSizeFactor = 0.8;
33555
33537
  this.nonHighlightedOpacity = 0.3;
33556
33538
  this.emptyDieColor = 'rgba(218,223,236,1)';
33557
33539
  this.nanDieColor = 'rgba(122,122,122,1)';
33558
- this.d3ColorScale = this.createD3ColorScale(colorScale, colorScaleMode);
33559
- this.labelsFontSize = this.calculateLabelsFontSize(dieDimensions, maxCharacters);
33540
+ this.d3ColorScale = this.createD3ColorScale(wafermap.colorScale, wafermap.colorScaleMode);
33541
+ this.labelsFontSize = this.calculateLabelsFontSize(dieDimensions, wafermap.maxCharacters);
33560
33542
  this.diesRenderInfo = [];
33561
- for (const die of dies) {
33543
+ for (const die of wafermap.dies) {
33562
33544
  this.diesRenderInfo.push({
33563
33545
  x: horizontalScale(die.x) + margin.right,
33564
33546
  y: verticalScale(die.y) + margin.top,
33565
- fillStyle: this.calculateFillStyle(die.value, colorScaleMode, highlightedValues),
33566
- text: this.buildLabel(die.value, maxCharacters, dieLabelsHidden, dieLabelsSuffix)
33547
+ fillStyle: this.calculateFillStyle(die.value, wafermap.colorScaleMode, wafermap.highlightedValues),
33548
+ text: this.buildLabel(die.value, wafermap.maxCharacters, wafermap.dieLabelsHidden, wafermap.dieLabelsSuffix)
33567
33549
  });
33568
33550
  }
33569
33551
  }
@@ -33636,11 +33618,8 @@ Instead styling against the role which is more general and likely a better appro
33636
33618
  */
33637
33619
  class DataManager {
33638
33620
  constructor(wafermap) {
33639
- this.computations = new Computations(wafermap.dies, wafermap.quadrant, {
33640
- width: wafermap.canvasSideLength,
33641
- height: wafermap.canvasSideLength
33642
- });
33643
- this.prerendering = new Prerendering(wafermap.dies, wafermap.colorScale, wafermap.highlightedValues, this.computations.horizontalScale, this.computations.verticalScale, wafermap.colorScaleMode, wafermap.dieLabelsHidden, wafermap.dieLabelsSuffix, wafermap.maxCharacters, this.computations.dieDimensions, this.computations.margin);
33621
+ this.computations = new Computations(wafermap);
33622
+ this.prerendering = new Prerendering(wafermap, this.horizontalScale, this.verticalScale, this.dieDimensions, this.margin);
33644
33623
  }
33645
33624
  get containerDimensions() {
33646
33625
  return this.computations.containerDimensions;
@@ -33666,12 +33645,6 @@ Instead styling against the role which is more general and likely a better appro
33666
33645
  get diesRenderInfo() {
33667
33646
  return this.prerendering.diesRenderInfo;
33668
33647
  }
33669
- get mainCircleLocation() {
33670
- return {
33671
- x: this.computations.containerDimensions.width / 2,
33672
- y: this.computations.containerDimensions.height / 2
33673
- };
33674
- }
33675
33648
  }
33676
33649
 
33677
33650
  /**
@@ -33716,7 +33689,7 @@ Instead styling against the role which is more general and likely a better appro
33716
33689
  }
33717
33690
  }
33718
33691
  renderText() {
33719
- this.dieSize = this.dimensions.width
33692
+ const dieSize = this.dimensions.width
33720
33693
  * this.dimensions.height
33721
33694
  * (this.wafermap.transform.k || 1);
33722
33695
  const fontsize = this.labelFontSize;
@@ -33724,17 +33697,17 @@ Instead styling against the role which is more general and likely a better appro
33724
33697
  this.context.fillStyle = '#ffffff';
33725
33698
  this.context.textAlign = 'center';
33726
33699
  this.context.lineCap = 'butt';
33727
- const aproxTextHeight = this.context.measureText('M');
33728
- if (this.dieSize >= 50) {
33700
+ const approxTextHeight = this.context.measureText('M');
33701
+ if (dieSize >= 50) {
33729
33702
  for (const die of this.dies) {
33730
33703
  this.context.fillText(die.text, die.x + this.dimensions.width / 2, die.y
33731
33704
  + this.dimensions.height / 2
33732
- + aproxTextHeight.width / 2, this.dimensions.width - (this.dimensions.width / 100) * 20);
33705
+ + approxTextHeight.width / 2, this.dimensions.width - (this.dimensions.width / 100) * 20);
33733
33706
  }
33734
33707
  }
33735
33708
  }
33736
33709
  clearCanvas() {
33737
- this.context.clearRect(0, 0, this.wafermap.canvasSideLength * this.wafermap.transform.k, this.wafermap.canvasSideLength * this.wafermap.transform.k);
33710
+ this.context.clearRect(0, 0, this.wafermap.canvasWidth * this.wafermap.transform.k, this.wafermap.canvasHeight * this.wafermap.transform.k);
33738
33711
  }
33739
33712
  scaleCanvas() {
33740
33713
  this.context.translate(this.wafermap.transform.x, this.wafermap.transform.y);
@@ -33770,15 +33743,14 @@ Instead styling against the role which is more general and likely a better appro
33770
33743
  const zoomBehavior = zoom()
33771
33744
  .scaleExtent([
33772
33745
  1.1,
33773
- this.getZoomMax(this.wafermap.canvasSideLength
33774
- * this.wafermap.canvasSideLength, this.wafermap.dataManager.containerDimensions.width
33746
+ this.getZoomMax(this.wafermap.canvasWidth * this.wafermap.canvasHeight, this.wafermap.dataManager.containerDimensions.width
33775
33747
  * this.wafermap.dataManager.containerDimensions.height)
33776
33748
  ])
33777
33749
  .translateExtent([
33778
33750
  this.minExtentPoint,
33779
33751
  [
33780
- this.wafermap.canvasSideLength + this.extentPadding,
33781
- this.wafermap.canvasSideLength + this.extentPadding
33752
+ this.wafermap.canvasWidth + this.extentPadding,
33753
+ this.wafermap.canvasHeight + this.extentPadding
33782
33754
  ]
33783
33755
  ])
33784
33756
  .filter((event) => {
@@ -33854,10 +33826,6 @@ Instead styling against the role which is more general and likely a better appro
33854
33826
  * @internal
33855
33827
  */
33856
33828
  this.renderQueued = false;
33857
- /**
33858
- * @internal
33859
- */
33860
- this.canvasSideLength = 0;
33861
33829
  /**
33862
33830
  * @internal
33863
33831
  */
@@ -33885,7 +33853,7 @@ Instead styling against the role which is more general and likely a better appro
33885
33853
  */
33886
33854
  render() {
33887
33855
  this.renderQueued = false;
33888
- this.initalizeInternalModules();
33856
+ this.initializeInternalModules();
33889
33857
  this.renderer?.drawWafer();
33890
33858
  }
33891
33859
  queueRender() {
@@ -33897,7 +33865,7 @@ Instead styling against the role which is more general and likely a better appro
33897
33865
  DOM.queueUpdate(() => this.render());
33898
33866
  }
33899
33867
  }
33900
- initalizeInternalModules() {
33868
+ initializeInternalModules() {
33901
33869
  this.eventCoordinator?.detachEvents();
33902
33870
  this.dataManager = new DataManager(this);
33903
33871
  this.renderer = new RenderingModule(this);
@@ -33910,7 +33878,12 @@ Instead styling against the role which is more general and likely a better appro
33910
33878
  return;
33911
33879
  }
33912
33880
  const { height, width } = entry.contentRect;
33913
- this.canvasSideLength = Math.min(height, width);
33881
+ // Updating the canvas size clears its contents so update it explicitly instead of
33882
+ // via template bindings so we can confirm that it happens before render
33883
+ this.canvas.width = width;
33884
+ this.canvas.height = height;
33885
+ this.canvasWidth = width;
33886
+ this.canvasHeight = height;
33914
33887
  });
33915
33888
  resizeObserver.observe(this);
33916
33889
  return resizeObserver;
@@ -33945,13 +33918,11 @@ Instead styling against the role which is more general and likely a better appro
33945
33918
  transformChanged() {
33946
33919
  this.queueRender();
33947
33920
  }
33948
- canvasSideLengthChanged() {
33949
- if (this.canvasSideLength !== undefined
33950
- && this.canvasSideLength !== 0) {
33951
- this.canvas.width = this.canvasSideLength;
33952
- this.canvas.height = this.canvasSideLength;
33953
- this.queueRender();
33954
- }
33921
+ canvasWidthChanged() {
33922
+ this.queueRender();
33923
+ }
33924
+ canvasHeightChanged() {
33925
+ this.queueRender();
33955
33926
  }
33956
33927
  }
33957
33928
  __decorate$1([
@@ -33984,7 +33955,10 @@ Instead styling against the role which is more general and likely a better appro
33984
33955
  ], WaferMap.prototype, "colorScaleMode", void 0);
33985
33956
  __decorate$1([
33986
33957
  observable
33987
- ], WaferMap.prototype, "canvasSideLength", void 0);
33958
+ ], WaferMap.prototype, "canvasWidth", void 0);
33959
+ __decorate$1([
33960
+ observable
33961
+ ], WaferMap.prototype, "canvasHeight", void 0);
33988
33962
  __decorate$1([
33989
33963
  observable
33990
33964
  ], WaferMap.prototype, "transform", void 0);