@ni/nimble-components 18.3.5 → 18.3.6

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