@ni/nimble-components 20.1.4 → 20.1.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.
@@ -5394,15 +5394,6 @@
5394
5394
  * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
5395
5395
  * the maximum will be returned. Otherwise, the value is returned un-changed.
5396
5396
  */
5397
- function wrapInBounds(min, max, value) {
5398
- if (value < min) {
5399
- return max;
5400
- }
5401
- else if (value > max) {
5402
- return min;
5403
- }
5404
- return value;
5405
- }
5406
5397
  /**
5407
5398
  * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
5408
5399
  * If value is greater than max, max will be returned.
@@ -13268,8 +13259,11 @@
13268
13259
  this.isDisabledElement = (el) => {
13269
13260
  return el.getAttribute("aria-disabled") === "true";
13270
13261
  };
13262
+ this.isHiddenElement = (el) => {
13263
+ return el.hasAttribute("hidden");
13264
+ };
13271
13265
  this.isFocusableElement = (el) => {
13272
- return !this.isDisabledElement(el);
13266
+ return !this.isDisabledElement(el) && !this.isHiddenElement(el);
13273
13267
  };
13274
13268
  this.setTabs = () => {
13275
13269
  const gridHorizontalProperty = "gridColumn";
@@ -13295,6 +13289,7 @@
13295
13289
  tab.setAttribute("tabindex", isActiveTab ? "0" : "-1");
13296
13290
  if (isActiveTab) {
13297
13291
  this.activetab = tab;
13292
+ this.activeid = tabId;
13298
13293
  }
13299
13294
  }
13300
13295
  // If the original property isn't emptied out,
@@ -13535,9 +13530,14 @@
13535
13530
  * This method allows the active index to be adjusted by numerical increments
13536
13531
  */
13537
13532
  adjust(adjustment) {
13538
- this.prevActiveTabIndex = this.activeTabIndex;
13539
- this.activeTabIndex = wrapInBounds(0, this.tabs.length - 1, this.activeTabIndex + adjustment);
13540
- this.setComponent();
13533
+ const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
13534
+ const currentActiveTabIndex = focusableTabs.indexOf(this.activetab);
13535
+ const nextTabIndex = limit(0, focusableTabs.length - 1, currentActiveTabIndex + adjustment);
13536
+ // the index of the next focusable tab within the context of all available tabs
13537
+ const nextIndex = this.tabs.indexOf(focusableTabs[nextTabIndex]);
13538
+ if (nextIndex > -1) {
13539
+ this.moveToTabByIndex(this.tabs, nextIndex);
13540
+ }
13541
13541
  }
13542
13542
  focusTab() {
13543
13543
  this.tabs[this.activeTabIndex].focus();
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Fri, 11 Aug 2023 15:03:51 GMT
16291
+ * Generated on Sat, 12 Aug 2023 08:17:41 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -55044,11 +55044,22 @@
55044
55044
  this.wafermap = wafermap;
55045
55045
  this.minDieDim = 50;
55046
55046
  }
55047
+ updateSortedDiesAndDrawWafer() {
55048
+ this.dies = this.wafermap.dataManager.diesRenderInfo.sort((a, b) => {
55049
+ if (a.fillStyle > b.fillStyle) {
55050
+ return 1;
55051
+ }
55052
+ if (b.fillStyle > a.fillStyle) {
55053
+ return -1;
55054
+ }
55055
+ return 0;
55056
+ });
55057
+ this.drawWafer();
55058
+ }
55047
55059
  drawWafer() {
55048
55060
  this.wafermap.canvasContext.save();
55049
55061
  this.clearCanvas();
55050
55062
  this.scaleCanvas();
55051
- this.sortDies();
55052
55063
  this.renderDies();
55053
55064
  this.renderText();
55054
55065
  this.wafermap.canvasContext.restore();
@@ -55076,56 +55087,70 @@
55076
55087
  }
55077
55088
  return '';
55078
55089
  }
55079
- sortDies() {
55080
- this.dies = this.wafermap.dataManager.diesRenderInfo.sort((a, b) => {
55081
- if (a.fillStyle > b.fillStyle) {
55082
- return 1;
55083
- }
55084
- if (b.fillStyle > a.fillStyle) {
55085
- return -1;
55086
- }
55087
- return 0;
55088
- });
55089
- }
55090
55090
  renderDies() {
55091
- let prev;
55091
+ const context = this.wafermap.canvasContext;
55092
+ const dieWidth = this.wafermap.dataManager.dieDimensions.width;
55093
+ const dieHeight = this.wafermap.dataManager.dieDimensions.height;
55094
+ const transformedCanvasMinPoint = this.wafermap.transform.invert([
55095
+ 0, 0
55096
+ ]);
55097
+ const transformedCanvasMaxPoint = this.wafermap.transform.invert([
55098
+ this.wafermap.canvas.width,
55099
+ this.wafermap.canvas.height
55100
+ ]);
55101
+ transformedCanvasMinPoint[0] -= dieWidth;
55102
+ transformedCanvasMinPoint[1] -= dieHeight;
55092
55103
  for (const die of this.dies) {
55093
- if (!prev) {
55094
- this.wafermap.canvasContext.fillStyle = die.fillStyle;
55095
- }
55096
- if (prev && die.fillStyle !== prev.fillStyle && die.fillStyle) {
55097
- this.wafermap.canvasContext.fillStyle = die.fillStyle;
55104
+ if (this.isDieVisible(die, transformedCanvasMinPoint, transformedCanvasMaxPoint)) {
55105
+ context.fillStyle = die.fillStyle;
55106
+ context.fillRect(die.x, die.y, dieWidth, dieHeight);
55098
55107
  }
55099
- this.wafermap.canvasContext.fillRect(die.x, die.y, this.wafermap.dataManager.dieDimensions.width, this.wafermap.dataManager.dieDimensions.height);
55100
- prev = die;
55101
55108
  }
55102
55109
  }
55103
55110
  renderText() {
55104
- const dieSize = this.wafermap.dataManager.dieDimensions.width
55105
- * this.wafermap.dataManager.dieDimensions.height
55106
- * (this.wafermap.transform.k || 1);
55107
- const fontsize = this.wafermap.dataManager.labelsFontSize;
55108
- this.wafermap.canvasContext.font = `${fontsize.toString()}px sans-serif`;
55109
- this.wafermap.canvasContext.fillStyle = '#ffffff';
55110
- this.wafermap.canvasContext.textAlign = 'center';
55111
- this.wafermap.canvasContext.lineCap = 'butt';
55112
- const approxTextHeight = this.wafermap.canvasContext.measureText('M');
55113
- const dieDimensions = this.wafermap.dataManager.dieDimensions;
55111
+ if (this.wafermap.dieLabelsHidden) {
55112
+ return;
55113
+ }
55114
+ const dieWidth = this.wafermap.dataManager.dieDimensions.width;
55115
+ const dieHeight = this.wafermap.dataManager.dieDimensions.height;
55116
+ const dieSize = dieWidth * dieHeight * (this.wafermap.transform.k || 1);
55114
55117
  if (dieSize >= this.minDieDim) {
55118
+ const fontsize = this.wafermap.dataManager.labelsFontSize;
55119
+ const context = this.wafermap.canvasContext;
55120
+ context.font = `${fontsize.toString()}px sans-serif`;
55121
+ context.fillStyle = '#ffffff';
55122
+ context.textAlign = 'center';
55123
+ context.lineCap = 'butt';
55124
+ const approximateTextHeight = context.measureText('M');
55125
+ const transformedCanvasMinPoint = this.wafermap.transform.invert([
55126
+ 0, 0
55127
+ ]);
55128
+ const transformedCanvasMaxPoint = this.wafermap.transform.invert([
55129
+ this.wafermap.canvas.width,
55130
+ this.wafermap.canvas.height
55131
+ ]);
55132
+ transformedCanvasMinPoint[0] -= dieWidth;
55133
+ transformedCanvasMinPoint[1] -= dieHeight;
55115
55134
  for (const die of this.dies) {
55116
- this.wafermap.canvasContext.fillText(die.text, die.x + dieDimensions.width / 2, die.y
55117
- + dieDimensions.height / 2
55118
- + approxTextHeight.width / 2, dieDimensions.width - (dieDimensions.width / 100) * 20);
55135
+ if (this.isDieVisible(die, transformedCanvasMinPoint, transformedCanvasMaxPoint)) {
55136
+ context.fillText(die.text, die.x + dieWidth / 2, die.y + dieHeight / 2 + approximateTextHeight.width / 2, dieWidth - (dieWidth / 100) * 20);
55137
+ }
55119
55138
  }
55120
55139
  }
55121
55140
  }
55122
55141
  clearCanvas() {
55123
- this.wafermap.canvasContext.clearRect(0, 0, this.wafermap.canvasWidth * this.wafermap.transform.k, this.wafermap.canvasHeight * this.wafermap.transform.k);
55142
+ this.wafermap.canvasContext.clearRect(0, 0, this.wafermap.canvas.width, this.wafermap.canvas.height);
55124
55143
  }
55125
55144
  scaleCanvas() {
55126
55145
  this.wafermap.canvasContext.translate(this.wafermap.transform.x, this.wafermap.transform.y);
55127
55146
  this.wafermap.canvasContext.scale(this.wafermap.transform.k, this.wafermap.transform.k);
55128
55147
  }
55148
+ isDieVisible(die, minPoint, maxPoint) {
55149
+ return (die.x >= minPoint[0]
55150
+ && die.x < maxPoint[0]
55151
+ && die.y >= minPoint[1]
55152
+ && die.y < maxPoint[1]);
55153
+ }
55129
55154
  }
55130
55155
 
55131
55156
  /**
@@ -55322,6 +55347,9 @@
55322
55347
  || this.isTracked('dieLabelsHidden')
55323
55348
  || this.isTracked('dieLabelsSuffix'));
55324
55349
  }
55350
+ get requiresDrawnWaferUpdate() {
55351
+ return this.isTracked('transform');
55352
+ }
55325
55353
  get requiresRenderHoverUpdate() {
55326
55354
  return this.isTracked('hoverDie');
55327
55355
  }
@@ -55427,17 +55455,23 @@
55427
55455
  this.eventCoordinator.detachEvents();
55428
55456
  if (this.waferMapUpdateTracker.requiresContainerDimensionsUpdate) {
55429
55457
  this.dataManager.updateContainerDimensions();
55458
+ this.renderer.updateSortedDiesAndDrawWafer();
55430
55459
  }
55431
55460
  else if (this.waferMapUpdateTracker.requiresScalesUpdate) {
55432
55461
  this.dataManager.updateScales();
55462
+ this.renderer.updateSortedDiesAndDrawWafer();
55433
55463
  }
55434
55464
  else if (this.waferMapUpdateTracker.requiresLabelsFontSizeUpdate) {
55435
55465
  this.dataManager.updateLabelsFontSize();
55466
+ this.renderer.updateSortedDiesAndDrawWafer();
55436
55467
  }
55437
55468
  else if (this.waferMapUpdateTracker.requiresDiesRenderInfoUpdate) {
55438
55469
  this.dataManager.updateDiesRenderInfo();
55470
+ this.renderer.updateSortedDiesAndDrawWafer();
55471
+ }
55472
+ else if (this.waferMapUpdateTracker.requiresDrawnWaferUpdate) {
55473
+ this.renderer.drawWafer();
55439
55474
  }
55440
- this.renderer.drawWafer();
55441
55475
  this.eventCoordinator.attachEvents();
55442
55476
  }
55443
55477
  else if (this.waferMapUpdateTracker.requiresRenderHoverUpdate) {