@ni/nimble-components 20.0.1 → 20.0.3

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.
Files changed (45) hide show
  1. package/dist/all-components-bundle.js +290 -112
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1501 -1500
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/anchor-tabs/index.d.ts +1 -0
  6. package/dist/esm/anchor-tabs/index.js +5 -2
  7. package/dist/esm/anchor-tabs/index.js.map +1 -1
  8. package/dist/esm/src/anchor-tabs/index.d.ts +1 -0
  9. package/dist/esm/src/wafer-map/index.d.ts +16 -9
  10. package/dist/esm/src/wafer-map/modules/computations.d.ts +19 -8
  11. package/dist/esm/src/wafer-map/modules/data-manager.d.ts +8 -1
  12. package/dist/esm/src/wafer-map/modules/event-coordinator.d.ts +1 -1
  13. package/dist/esm/src/wafer-map/modules/hover-handler.d.ts +1 -1
  14. package/dist/esm/src/wafer-map/modules/prerendering.d.ts +13 -6
  15. package/dist/esm/src/wafer-map/modules/rendering.d.ts +3 -3
  16. package/dist/esm/src/wafer-map/modules/wafer-map-update-tracker.d.ts +24 -0
  17. package/dist/esm/src/wafer-map/modules/zoom-handler.d.ts +2 -2
  18. package/dist/esm/wafer-map/index.d.ts +16 -9
  19. package/dist/esm/wafer-map/index.js +67 -41
  20. package/dist/esm/wafer-map/index.js.map +1 -1
  21. package/dist/esm/wafer-map/modules/computations.d.ts +19 -8
  22. package/dist/esm/wafer-map/modules/computations.js +44 -12
  23. package/dist/esm/wafer-map/modules/computations.js.map +1 -1
  24. package/dist/esm/wafer-map/modules/data-manager.d.ts +8 -1
  25. package/dist/esm/wafer-map/modules/data-manager.js +24 -2
  26. package/dist/esm/wafer-map/modules/data-manager.js.map +1 -1
  27. package/dist/esm/wafer-map/modules/event-coordinator.d.ts +1 -1
  28. package/dist/esm/wafer-map/modules/event-coordinator.js +8 -8
  29. package/dist/esm/wafer-map/modules/event-coordinator.js.map +1 -1
  30. package/dist/esm/wafer-map/modules/hover-handler.d.ts +1 -1
  31. package/dist/esm/wafer-map/modules/hover-handler.js +9 -9
  32. package/dist/esm/wafer-map/modules/hover-handler.js.map +1 -1
  33. package/dist/esm/wafer-map/modules/prerendering.d.ts +13 -6
  34. package/dist/esm/wafer-map/modules/prerendering.js +29 -8
  35. package/dist/esm/wafer-map/modules/prerendering.js.map +1 -1
  36. package/dist/esm/wafer-map/modules/rendering.d.ts +3 -3
  37. package/dist/esm/wafer-map/modules/rendering.js +15 -13
  38. package/dist/esm/wafer-map/modules/rendering.js.map +1 -1
  39. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.d.ts +24 -0
  40. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js +77 -0
  41. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js.map +1 -0
  42. package/dist/esm/wafer-map/modules/zoom-handler.d.ts +2 -2
  43. package/dist/esm/wafer-map/modules/zoom-handler.js +13 -15
  44. package/dist/esm/wafer-map/modules/zoom-handler.js.map +1 -1
  45. package/package.json +1 -1
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Wed, 26 Jul 2023 20:58:13 GMT
16291
+ * Generated on Tue, 01 Aug 2023 16:23:07 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -17978,8 +17978,11 @@
17978
17978
  this.isDisabledElement = (el) => {
17979
17979
  return el.getAttribute('aria-disabled') === 'true';
17980
17980
  };
17981
+ this.isHiddenElement = (el) => {
17982
+ return el.hasAttribute('hidden');
17983
+ };
17981
17984
  this.isFocusableElement = (el) => {
17982
- return !this.isDisabledElement(el);
17985
+ return !this.isDisabledElement(el) && !this.isHiddenElement(el);
17983
17986
  };
17984
17987
  this.setTabs = () => {
17985
17988
  const gridHorizontalProperty = 'gridColumn';
@@ -18137,7 +18140,7 @@
18137
18140
  });
18138
18141
  }
18139
18142
  focusFirstOrLast(focusLast) {
18140
- const focusableTabs = this.tabs.filter(t => !this.isDisabledElement(t));
18143
+ const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
18141
18144
  const focusableIndex = focusLast ? focusableTabs.length - 1 : 0;
18142
18145
  const index = this.tabs.indexOf(focusableTabs[focusableIndex]);
18143
18146
  if (index > -1) {
@@ -46782,7 +46785,7 @@
46782
46785
  }
46783
46786
  return false;
46784
46787
  };
46785
- const trackedItems = [
46788
+ const trackedItems$1 = [
46786
46789
  'rowIds',
46787
46790
  'groupRows',
46788
46791
  'columnIds',
@@ -46798,7 +46801,7 @@
46798
46801
  */
46799
46802
  class TableUpdateTracker extends UpdateTracker {
46800
46803
  constructor(table) {
46801
- super(trackedItems);
46804
+ super(trackedItems$1);
46802
46805
  this.table = table;
46803
46806
  this.updateQueued = false;
46804
46807
  }
@@ -54212,13 +54215,39 @@
54212
54215
  */
54213
54216
  class Computations {
54214
54217
  constructor(wafermap) {
54218
+ this.wafermap = wafermap;
54215
54219
  this.defaultPadding = 0;
54216
54220
  this.baseMarginPercentage = 0.04;
54221
+ }
54222
+ get containerDimensions() {
54223
+ return this._containerDimensions;
54224
+ }
54225
+ get dieDimensions() {
54226
+ return this._dieDimensions;
54227
+ }
54228
+ get radius() {
54229
+ return this._radius;
54230
+ }
54231
+ get margin() {
54232
+ return this._margin;
54233
+ }
54234
+ get horizontalScale() {
54235
+ return this._horizontalScale;
54236
+ }
54237
+ get verticalScale() {
54238
+ return this._verticalScale;
54239
+ }
54240
+ get invertedHorizontalScale() {
54241
+ return this._invertedHorizontalScale;
54242
+ }
54243
+ get invertedVerticalScale() {
54244
+ return this._invertedVerticalScale;
54245
+ }
54246
+ updateContainerDimensions() {
54217
54247
  const canvasDimensions = {
54218
- width: wafermap.canvasWidth,
54219
- height: wafermap.canvasHeight
54248
+ width: this.wafermap.canvasWidth,
54249
+ height: this.wafermap.canvasHeight
54220
54250
  };
54221
- const gridDimensions = this.calculateGridDimensions(wafermap.dies);
54222
54251
  const canvasDiameter = Math.min(canvasDimensions.width, canvasDimensions.height);
54223
54252
  const canvasMargin = {
54224
54253
  top: (canvasDimensions.height - canvasDiameter) / 2,
@@ -54232,20 +54261,26 @@
54232
54261
  bottom: canvasDiameter * this.baseMarginPercentage,
54233
54262
  left: canvasDiameter * this.baseMarginPercentage
54234
54263
  };
54235
- this.margin = this.calculateMarginAddition(baseMargin, canvasMargin);
54236
- this.containerDimensions = this.calculateContainerDimensions(canvasDimensions, this.margin);
54237
- const containerDiameter = Math.min(this.containerDimensions.width, this.containerDimensions.height);
54264
+ this._margin = this.calculateMarginAddition(baseMargin, canvasMargin);
54265
+ this._containerDimensions = this.calculateContainerDimensions(canvasDimensions, this._margin);
54266
+ const containerDiameter = Math.min(this._containerDimensions.width, this._containerDimensions.height);
54267
+ this._radius = containerDiameter / 2;
54268
+ this.updateScales();
54269
+ }
54270
+ updateScales() {
54271
+ const containerDiameter = Math.min(this._containerDimensions.width, this._containerDimensions.height);
54272
+ const gridDimensions = this.calculateGridDimensions(this.wafermap.dies);
54238
54273
  // this scale is used for positioning the dies on the canvas
54239
- this.horizontalScale = this.createHorizontalScale(wafermap.quadrant, gridDimensions, containerDiameter);
54240
- this.invertedHorizontalScale = this.createInvertedHorizontalScale(wafermap.quadrant, gridDimensions, containerDiameter);
54274
+ const quadrant = this.wafermap.quadrant;
54275
+ this._horizontalScale = this.createHorizontalScale(quadrant, gridDimensions, containerDiameter);
54276
+ this._invertedHorizontalScale = this.createInvertedHorizontalScale(quadrant, gridDimensions, containerDiameter);
54241
54277
  // this scale is used for positioning the dies on the canvas
54242
- this.verticalScale = this.createVerticalScale(wafermap.quadrant, gridDimensions, containerDiameter);
54243
- this.invertedVerticalScale = this.createInvertedVerticalScale(wafermap.quadrant, gridDimensions, containerDiameter);
54244
- this.dieDimensions = {
54278
+ this._verticalScale = this.createVerticalScale(quadrant, gridDimensions, containerDiameter);
54279
+ this._invertedVerticalScale = this.createInvertedVerticalScale(quadrant, gridDimensions, containerDiameter);
54280
+ this._dieDimensions = {
54245
54281
  width: this.horizontalScale.bandwidth(),
54246
54282
  height: this.verticalScale.bandwidth()
54247
54283
  };
54248
- this.radius = containerDiameter / 2;
54249
54284
  }
54250
54285
  calculateGridDimensions(dies) {
54251
54286
  if (dies.length === 0 || dies[0] === undefined) {
@@ -54335,22 +54370,43 @@
54335
54370
  * Prerendering prepares render-ready dies data to be used by the rendering module
54336
54371
  */
54337
54372
  class Prerendering {
54338
- constructor(wafermap, horizontalScale, verticalScale, dieDimensions, margin) {
54373
+ constructor(wafermap, dataManager) {
54374
+ this.wafermap = wafermap;
54375
+ this.dataManager = dataManager;
54339
54376
  this.fontSizeFactor = 0.8;
54340
54377
  this.nonHighlightedOpacity = 0.3;
54341
54378
  this.emptyDieColor = 'rgba(218,223,236,1)';
54342
54379
  this.nanDieColor = 'rgba(122,122,122,1)';
54343
- this.d3ColorScale = this.createD3ColorScale(wafermap.colorScale, wafermap.colorScaleMode);
54344
- this.labelsFontSize = this.calculateLabelsFontSize(dieDimensions, wafermap.maxCharacters);
54345
- this.diesRenderInfo = [];
54346
- for (const die of wafermap.dies) {
54380
+ }
54381
+ get labelsFontSize() {
54382
+ return this._labelsFontSize;
54383
+ }
54384
+ get diesRenderInfo() {
54385
+ return this._diesRenderInfo;
54386
+ }
54387
+ updateLabelsFontSize() {
54388
+ this._labelsFontSize = this.calculateLabelsFontSize(this.dataManager.dieDimensions, this.wafermap.maxCharacters);
54389
+ this.updateDiesRenderInfo();
54390
+ }
54391
+ updateDiesRenderInfo() {
54392
+ this.d3ColorScale = this.createD3ColorScale(this.wafermap.colorScale, this.wafermap.colorScaleMode);
54393
+ const margin = this.dataManager.margin;
54394
+ const horizontalScale = this.dataManager.horizontalScale;
54395
+ const verticalScale = this.dataManager.verticalScale;
54396
+ const colorScaleMode = this.wafermap.colorScaleMode;
54397
+ const highlightedValues = this.wafermap.highlightedValues;
54398
+ const maxCharacters = this.wafermap.maxCharacters;
54399
+ const dieLabelsHidden = this.wafermap.dieLabelsHidden;
54400
+ const dieLabelsSuffix = this.wafermap.dieLabelsSuffix;
54401
+ this._diesRenderInfo = [];
54402
+ for (const die of this.wafermap.dies) {
54347
54403
  const scaledX = horizontalScale(die.x) ?? 0;
54348
54404
  const scaledY = verticalScale(die.y) ?? 0;
54349
- this.diesRenderInfo.push({
54405
+ this._diesRenderInfo.push({
54350
54406
  x: scaledX + margin.right,
54351
54407
  y: scaledY + margin.top,
54352
- fillStyle: this.calculateFillStyle(die.value, wafermap.colorScaleMode, wafermap.highlightedValues),
54353
- text: this.buildLabel(die.value, wafermap.maxCharacters, wafermap.dieLabelsHidden, wafermap.dieLabelsSuffix)
54408
+ fillStyle: this.calculateFillStyle(die.value, colorScaleMode, highlightedValues),
54409
+ text: this.buildLabel(die.value, maxCharacters, dieLabelsHidden, dieLabelsSuffix)
54354
54410
  });
54355
54411
  }
54356
54412
  }
@@ -54423,9 +54479,9 @@
54423
54479
  */
54424
54480
  class DataManager {
54425
54481
  constructor(wafermap) {
54482
+ this.wafermap = wafermap;
54426
54483
  this.computations = new Computations(wafermap);
54427
- this.prerendering = new Prerendering(wafermap, this.horizontalScale, this.verticalScale, this.dieDimensions, this.margin);
54428
- this.dataMap = new Map(wafermap.dies.map(die => [`${die.x}_${die.y}`, die]));
54484
+ this.prerendering = new Prerendering(wafermap, this);
54429
54485
  }
54430
54486
  get containerDimensions() {
54431
54487
  return this.computations.containerDimensions;
@@ -54457,9 +54513,31 @@
54457
54513
  get diesRenderInfo() {
54458
54514
  return this.prerendering.diesRenderInfo;
54459
54515
  }
54516
+ get data() {
54517
+ return this.dataMap;
54518
+ }
54519
+ updateContainerDimensions() {
54520
+ this.computations.updateContainerDimensions();
54521
+ this.updateDataMap();
54522
+ this.updateLabelsFontSize();
54523
+ }
54524
+ updateScales() {
54525
+ this.computations.updateScales();
54526
+ this.updateDataMap();
54527
+ this.updateLabelsFontSize();
54528
+ }
54529
+ updateLabelsFontSize() {
54530
+ this.prerendering.updateLabelsFontSize();
54531
+ }
54532
+ updateDiesRenderInfo() {
54533
+ this.prerendering.updateDiesRenderInfo();
54534
+ }
54460
54535
  getWaferMapDie(point) {
54461
54536
  return this.dataMap.get(`${point.x}_${point.y}`);
54462
54537
  }
54538
+ updateDataMap() {
54539
+ this.dataMap = new Map(this.wafermap.dies.map(die => [`${die.x}_${die.y}`, die]));
54540
+ }
54463
54541
  }
54464
54542
 
54465
54543
  /**
@@ -54468,14 +54546,13 @@
54468
54546
  class RenderingModule {
54469
54547
  constructor(wafermap) {
54470
54548
  this.wafermap = wafermap;
54471
- this.dies = wafermap.dataManager.diesRenderInfo;
54472
- this.dimensions = wafermap.dataManager.dieDimensions;
54473
- this.labelFontSize = wafermap.dataManager.labelsFontSize;
54549
+ this.minDieDim = 50;
54474
54550
  }
54475
54551
  drawWafer() {
54476
54552
  this.wafermap.canvasContext.save();
54477
54553
  this.clearCanvas();
54478
54554
  this.scaleCanvas();
54555
+ this.sortDies();
54479
54556
  this.renderDies();
54480
54557
  this.renderText();
54481
54558
  this.wafermap.canvasContext.restore();
@@ -54503,8 +54580,8 @@
54503
54580
  }
54504
54581
  return '';
54505
54582
  }
54506
- renderDies() {
54507
- this.dies.sort((a, b) => {
54583
+ sortDies() {
54584
+ this.dies = this.wafermap.dataManager.diesRenderInfo.sort((a, b) => {
54508
54585
  if (a.fillStyle > b.fillStyle) {
54509
54586
  return 1;
54510
54587
  }
@@ -54513,6 +54590,8 @@
54513
54590
  }
54514
54591
  return 0;
54515
54592
  });
54593
+ }
54594
+ renderDies() {
54516
54595
  let prev;
54517
54596
  for (const die of this.dies) {
54518
54597
  if (!prev) {
@@ -54521,25 +54600,26 @@
54521
54600
  if (prev && die.fillStyle !== prev.fillStyle && die.fillStyle) {
54522
54601
  this.wafermap.canvasContext.fillStyle = die.fillStyle;
54523
54602
  }
54524
- this.wafermap.canvasContext.fillRect(die.x, die.y, this.dimensions.width, this.dimensions.height);
54603
+ this.wafermap.canvasContext.fillRect(die.x, die.y, this.wafermap.dataManager.dieDimensions.width, this.wafermap.dataManager.dieDimensions.height);
54525
54604
  prev = die;
54526
54605
  }
54527
54606
  }
54528
54607
  renderText() {
54529
- const dieSize = this.dimensions.width
54530
- * this.dimensions.height
54608
+ const dieSize = this.wafermap.dataManager.dieDimensions.width
54609
+ * this.wafermap.dataManager.dieDimensions.height
54531
54610
  * (this.wafermap.transform.k || 1);
54532
- const fontsize = this.labelFontSize;
54611
+ const fontsize = this.wafermap.dataManager.labelsFontSize;
54533
54612
  this.wafermap.canvasContext.font = `${fontsize.toString()}px sans-serif`;
54534
54613
  this.wafermap.canvasContext.fillStyle = '#ffffff';
54535
54614
  this.wafermap.canvasContext.textAlign = 'center';
54536
54615
  this.wafermap.canvasContext.lineCap = 'butt';
54537
54616
  const approxTextHeight = this.wafermap.canvasContext.measureText('M');
54538
- if (dieSize >= 50) {
54617
+ const dieDimensions = this.wafermap.dataManager.dieDimensions;
54618
+ if (dieSize >= this.minDieDim) {
54539
54619
  for (const die of this.dies) {
54540
- this.wafermap.canvasContext.fillText(die.text, die.x + this.dimensions.width / 2, die.y
54541
- + this.dimensions.height / 2
54542
- + approxTextHeight.width / 2, this.dimensions.width - (this.dimensions.width / 100) * 20);
54620
+ this.wafermap.canvasContext.fillText(die.text, die.x + dieDimensions.width / 2, die.y
54621
+ + dieDimensions.height / 2
54622
+ + approxTextHeight.width / 2, dieDimensions.width - (dieDimensions.width / 100) * 20);
54543
54623
  }
54544
54624
  }
54545
54625
  }
@@ -54562,22 +54642,9 @@
54562
54642
  this.minScale = 1.1;
54563
54643
  this.minExtentPoint = [-100, -100];
54564
54644
  this.extentPadding = 100;
54565
- this.zoomBehavior = this.createZoomBehavior();
54566
- this.zoomBehavior(select(this.wafermap.canvas));
54567
- }
54568
- rescale(event) {
54569
- const transform = event.transform;
54570
- if (transform.k === this.minScale) {
54571
- this.zoomTransform = identity$2;
54572
- this.zoomBehavior.transform(select(this.wafermap.canvas), identity$2);
54573
- }
54574
- else {
54575
- this.zoomTransform = transform;
54576
- }
54577
- this.wafermap.transform = this.zoomTransform;
54578
54645
  }
54579
54646
  createZoomBehavior() {
54580
- const zoomBehavior = zoom()
54647
+ this.zoomBehavior = zoom()
54581
54648
  .scaleExtent([
54582
54649
  1.1,
54583
54650
  this.getZoomMax(this.wafermap.canvasWidth * this.wafermap.canvasHeight, this.wafermap.dataManager.containerDimensions.width
@@ -54600,7 +54667,18 @@
54600
54667
  // See: https://github.com/d3/d3-zoom/blob/v3.0.0/README.md#zoom_on
54601
54668
  this.rescale(event);
54602
54669
  });
54603
- return zoomBehavior;
54670
+ this.zoomBehavior(select(this.wafermap.canvas));
54671
+ }
54672
+ rescale(event) {
54673
+ const transform = event.transform;
54674
+ if (transform.k === this.minScale) {
54675
+ this.zoomTransform = identity$2;
54676
+ this.zoomBehavior.transform(select(this.wafermap.canvas), identity$2);
54677
+ }
54678
+ else {
54679
+ this.zoomTransform = transform;
54680
+ }
54681
+ this.wafermap.transform = this.zoomTransform;
54604
54682
  }
54605
54683
  getZoomMax(canvasArea, dataArea) {
54606
54684
  return Math.ceil((dataArea / canvasArea) * 100);
@@ -54619,7 +54697,7 @@
54619
54697
  x: event.offsetX,
54620
54698
  y: event.offsetY
54621
54699
  };
54622
- if (!this.hoversOverDie(mousePosition)) {
54700
+ if (!this.hoversOverDie(this.wafermap, mousePosition)) {
54623
54701
  this.wafermap.hoverDie = undefined;
54624
54702
  return;
54625
54703
  }
@@ -54628,17 +54706,17 @@
54628
54706
  mousePosition.x,
54629
54707
  mousePosition.y
54630
54708
  ]);
54631
- const dieCoordinates = this.calculateDieCoordinates({
54709
+ const dieCoordinates = this.calculateDieCoordinates(this.wafermap, {
54632
54710
  x: invertedPoint[0],
54633
54711
  y: invertedPoint[1]
54634
54712
  });
54635
54713
  this.wafermap.hoverDie = this.wafermap.dataManager.getWaferMapDie(dieCoordinates);
54636
54714
  }
54637
- mouseout(_event) {
54715
+ mouseout() {
54638
54716
  this.wafermap.hoverDie = undefined;
54639
54717
  }
54640
- calculateDieCoordinates(mousePosition) {
54641
- const axisLocation = this.wafermap.quadrant;
54718
+ calculateDieCoordinates(wafermap, mousePosition) {
54719
+ const axisLocation = wafermap.quadrant;
54642
54720
  const xRoundFunction = axisLocation === WaferMapQuadrant.bottomLeft
54643
54721
  || axisLocation === WaferMapQuadrant.topLeft
54644
54722
  ? Math.floor
@@ -54648,12 +54726,12 @@
54648
54726
  ? Math.floor
54649
54727
  : Math.ceil;
54650
54728
  // go to x and y scale to get the x,y values of the die.
54651
- const x = xRoundFunction(this.wafermap.dataManager.invertedHorizontalScale(mousePosition.x - this.wafermap.dataManager.margin.left));
54652
- const y = yRoundFunction(this.wafermap.dataManager.invertedVerticalScale(mousePosition.y - this.wafermap.dataManager.margin.top));
54729
+ const x = xRoundFunction(wafermap.dataManager.invertedHorizontalScale(mousePosition.x - wafermap.dataManager.margin.left));
54730
+ const y = yRoundFunction(wafermap.dataManager.invertedVerticalScale(mousePosition.y - wafermap.dataManager.margin.top));
54653
54731
  return { x, y };
54654
54732
  }
54655
- hoversOverDie(mousePosition) {
54656
- const rgba = this.wafermap.canvasContext.getImageData(mousePosition.x, mousePosition.y, 1, 1).data;
54733
+ hoversOverDie(wafermap, mousePosition) {
54734
+ const rgba = wafermap.canvasContext.getImageData(mousePosition.x, mousePosition.y, 1, 1).data;
54657
54735
  let rgbaSum = 0;
54658
54736
  for (const color of rgba) {
54659
54737
  rgbaSum += color;
@@ -54674,25 +54752,100 @@
54674
54752
  this.onMouseMove = (event) => {
54675
54753
  this.hoverHandler.mousemove(event);
54676
54754
  };
54677
- this.onMouseOut = (event) => {
54678
- this.hoverHandler.mouseout(event);
54755
+ this.onMouseOut = () => {
54756
+ this.hoverHandler.mouseout();
54679
54757
  };
54680
54758
  this.zoomHandler = new ZoomHandler(wafermap);
54681
54759
  this.hoverHandler = new HoverHandler(wafermap);
54682
- this.attachEvents();
54683
- }
54684
- detachEvents() {
54685
- this.wafermap.removeEventListener('mousemove', this.onMouseMove);
54686
- this.wafermap.removeEventListener('mouseout', this.onMouseOut);
54687
- this.wafermap.canvas.removeEventListener('wheel', this.onWheelMove);
54688
54760
  }
54689
54761
  attachEvents() {
54762
+ this.zoomHandler.createZoomBehavior();
54690
54763
  this.wafermap.addEventListener('mousemove', this.onMouseMove);
54691
54764
  this.wafermap.addEventListener('mouseout', this.onMouseOut);
54692
54765
  this.wafermap.canvas.addEventListener('wheel', this.onWheelMove, {
54693
54766
  passive: false
54694
54767
  });
54695
54768
  }
54769
+ detachEvents() {
54770
+ this.wafermap.removeEventListener('mousemove', this.onMouseMove);
54771
+ this.wafermap.removeEventListener('mouseout', this.onMouseOut);
54772
+ this.wafermap.canvas.removeEventListener('wheel', this.onWheelMove);
54773
+ }
54774
+ }
54775
+
54776
+ const trackedItems = [
54777
+ 'canvasWidth',
54778
+ 'canvasHeight',
54779
+ 'quadrant',
54780
+ 'dies',
54781
+ 'maxCharacters',
54782
+ 'colorScale',
54783
+ 'colorScaleMode',
54784
+ 'highlightedValues',
54785
+ 'dieLabelsHidden',
54786
+ 'dieLabelsSuffix',
54787
+ 'transform',
54788
+ 'hoverDie'
54789
+ ];
54790
+ /**
54791
+ * Helper class to track what updates are needed to the wafer based on configuration
54792
+ * changes.
54793
+ */
54794
+ class WaferMapUpdateTracker extends UpdateTracker {
54795
+ constructor(wafermap) {
54796
+ super(trackedItems);
54797
+ this.wafermap = wafermap;
54798
+ this.updateQueued = false;
54799
+ }
54800
+ get requiresEventsUpdate() {
54801
+ return (this.isTracked('canvasWidth')
54802
+ || this.isTracked('canvasHeight')
54803
+ || this.isTracked('quadrant')
54804
+ || this.isTracked('dies')
54805
+ || this.isTracked('maxCharacters')
54806
+ || this.isTracked('colorScale')
54807
+ || this.isTracked('colorScaleMode')
54808
+ || this.isTracked('highlightedValues')
54809
+ || this.isTracked('dieLabelsHidden')
54810
+ || this.isTracked('dieLabelsSuffix')
54811
+ || this.isTracked('transform'));
54812
+ }
54813
+ get requiresContainerDimensionsUpdate() {
54814
+ return this.isTracked('canvasWidth') || this.isTracked('canvasHeight');
54815
+ }
54816
+ get requiresScalesUpdate() {
54817
+ return this.isTracked('quadrant') || this.isTracked('dies');
54818
+ }
54819
+ get requiresLabelsFontSizeUpdate() {
54820
+ return this.isTracked('maxCharacters');
54821
+ }
54822
+ get requiresDiesRenderInfoUpdate() {
54823
+ return (this.isTracked('colorScale')
54824
+ || this.isTracked('colorScaleMode')
54825
+ || this.isTracked('highlightedValues')
54826
+ || this.isTracked('dieLabelsHidden')
54827
+ || this.isTracked('dieLabelsSuffix'));
54828
+ }
54829
+ get requiresRenderHoverUpdate() {
54830
+ return this.isTracked('hoverDie');
54831
+ }
54832
+ /**
54833
+ * Queues an update using the DOM and until the update is run no other updates are queued.
54834
+ * After the update is finished, all the tracked items are reset.
54835
+ */
54836
+ queueUpdate() {
54837
+ if (!this.wafermap.$fastController.isConnected) {
54838
+ return;
54839
+ }
54840
+ if (!this.updateQueued) {
54841
+ this.updateQueued = true;
54842
+ DOM.queueUpdate(() => {
54843
+ this.wafermap.update();
54844
+ this.untrackAll();
54845
+ this.updateQueued = false;
54846
+ });
54847
+ }
54848
+ }
54696
54849
  }
54697
54850
 
54698
54851
  /**
@@ -54701,12 +54854,25 @@
54701
54854
  class WaferMap extends FoundationElement {
54702
54855
  constructor() {
54703
54856
  super(...arguments);
54857
+ /**
54858
+ * @internal
54859
+ * needs to be initialized before the properties trigger changes
54860
+ */
54861
+ this.waferMapUpdateTracker = new WaferMapUpdateTracker(this);
54704
54862
  this.quadrant = WaferMapQuadrant.topLeft;
54705
54863
  this.orientation = WaferMapOrientation.top;
54706
54864
  this.maxCharacters = 4;
54707
54865
  this.dieLabelsHidden = false;
54708
54866
  this.dieLabelsSuffix = '';
54709
54867
  this.colorScaleMode = WaferMapColorScaleMode.linear;
54868
+ /**
54869
+ * @internal
54870
+ */
54871
+ this.dataManager = new DataManager(this);
54872
+ /**
54873
+ * @internal
54874
+ */
54875
+ this.renderer = new RenderingModule(this);
54710
54876
  /**
54711
54877
  * @internal
54712
54878
  */
@@ -54737,13 +54903,16 @@
54737
54903
  colors: [],
54738
54904
  values: []
54739
54905
  };
54906
+ this.eventCoordinator = new EventCoordinator(this);
54907
+ this.resizeObserver = this.createResizeObserver();
54740
54908
  }
54741
54909
  connectedCallback() {
54742
54910
  super.connectedCallback();
54743
54911
  this.canvasContext = this.canvas.getContext('2d', {
54744
54912
  willReadFrequently: true
54745
54913
  });
54746
- this.resizeObserver = this.createResizeObserver();
54914
+ this.resizeObserver.observe(this);
54915
+ this.waferMapUpdateTracker.trackAll();
54747
54916
  }
54748
54917
  disconnectedCallback() {
54749
54918
  super.disconnectedCallback();
@@ -54751,33 +54920,34 @@
54751
54920
  }
54752
54921
  /**
54753
54922
  * @internal
54923
+ * Update function called when an update is queued.
54924
+ * It will check which updates are needed based on which properties have changed.
54925
+ * Each update represents a different starting point of the same sequential update flow.
54926
+ * The updates snowball one after the other, this function only choses the 'altitude'.
54927
+ * The hover does not require an event update, but it's also the last update in the sequence.
54754
54928
  */
54755
- render() {
54756
- this.renderQueued = false;
54757
- this.initializeInternalModules();
54758
- this.renderer?.drawWafer();
54759
- }
54760
- queueRender() {
54761
- if (!this.$fastController.isConnected) {
54762
- return;
54929
+ update() {
54930
+ if (this.waferMapUpdateTracker.requiresEventsUpdate) {
54931
+ this.eventCoordinator.detachEvents();
54932
+ if (this.waferMapUpdateTracker.requiresContainerDimensionsUpdate) {
54933
+ this.dataManager.updateContainerDimensions();
54934
+ }
54935
+ else if (this.waferMapUpdateTracker.requiresScalesUpdate) {
54936
+ this.dataManager.updateScales();
54937
+ }
54938
+ else if (this.waferMapUpdateTracker.requiresLabelsFontSizeUpdate) {
54939
+ this.dataManager.updateLabelsFontSize();
54940
+ }
54941
+ else if (this.waferMapUpdateTracker.requiresDiesRenderInfoUpdate) {
54942
+ this.dataManager.updateDiesRenderInfo();
54943
+ }
54944
+ this.renderer.drawWafer();
54945
+ this.eventCoordinator.attachEvents();
54763
54946
  }
54764
- if (!this.renderQueued) {
54765
- this.renderQueued = true;
54766
- DOM.queueUpdate(() => this.render());
54947
+ else if (this.waferMapUpdateTracker.requiresRenderHoverUpdate) {
54948
+ this.renderer.renderHover();
54767
54949
  }
54768
54950
  }
54769
- queueRenderHover() {
54770
- if (!this.$fastController.isConnected) {
54771
- return;
54772
- }
54773
- DOM.queueUpdate(() => this.renderer?.renderHover());
54774
- }
54775
- initializeInternalModules() {
54776
- this.eventCoordinator?.detachEvents();
54777
- this.dataManager = new DataManager(this);
54778
- this.renderer = new RenderingModule(this);
54779
- this.eventCoordinator = new EventCoordinator(this);
54780
- }
54781
54951
  createResizeObserver() {
54782
54952
  const resizeObserver = new ResizeObserver(entries => {
54783
54953
  const entry = entries[0];
@@ -54792,48 +54962,56 @@
54792
54962
  this.canvasWidth = width;
54793
54963
  this.canvasHeight = height;
54794
54964
  });
54795
- resizeObserver.observe(this);
54796
54965
  return resizeObserver;
54797
54966
  }
54798
54967
  quadrantChanged() {
54799
- this.queueRender();
54800
- }
54801
- orientationChanged() {
54802
- this.queueRender();
54968
+ this.waferMapUpdateTracker.track('quadrant');
54969
+ this.waferMapUpdateTracker.queueUpdate();
54803
54970
  }
54804
54971
  maxCharactersChanged() {
54805
- this.queueRender();
54972
+ this.waferMapUpdateTracker.track('maxCharacters');
54973
+ this.waferMapUpdateTracker.queueUpdate();
54806
54974
  }
54807
54975
  dieLabelsHiddenChanged() {
54808
- this.queueRender();
54976
+ this.waferMapUpdateTracker.track('dieLabelsHidden');
54977
+ this.waferMapUpdateTracker.queueUpdate();
54809
54978
  }
54810
54979
  dieLabelsSuffixChanged() {
54811
- this.queueRender();
54980
+ this.waferMapUpdateTracker.track('dieLabelsSuffix');
54981
+ this.waferMapUpdateTracker.queueUpdate();
54812
54982
  }
54813
54983
  colorScaleModeChanged() {
54814
- this.queueRender();
54984
+ this.waferMapUpdateTracker.track('colorScaleMode');
54985
+ this.waferMapUpdateTracker.queueUpdate();
54815
54986
  }
54816
54987
  highlightedValuesChanged() {
54817
- this.queueRender();
54988
+ this.waferMapUpdateTracker.track('highlightedValues');
54989
+ this.waferMapUpdateTracker.queueUpdate();
54818
54990
  }
54819
54991
  diesChanged() {
54820
- this.queueRender();
54992
+ this.waferMapUpdateTracker.track('dies');
54993
+ this.waferMapUpdateTracker.queueUpdate();
54821
54994
  }
54822
54995
  colorScaleChanged() {
54823
- this.queueRender();
54996
+ this.waferMapUpdateTracker.track('colorScale');
54997
+ this.waferMapUpdateTracker.queueUpdate();
54824
54998
  }
54825
54999
  transformChanged() {
54826
- this.queueRender();
55000
+ this.waferMapUpdateTracker.track('transform');
55001
+ this.waferMapUpdateTracker.queueUpdate();
54827
55002
  }
54828
55003
  canvasWidthChanged() {
54829
- this.queueRender();
55004
+ this.waferMapUpdateTracker.track('canvasWidth');
55005
+ this.waferMapUpdateTracker.queueUpdate();
54830
55006
  }
54831
55007
  canvasHeightChanged() {
54832
- this.queueRender();
55008
+ this.waferMapUpdateTracker.track('canvasHeight');
55009
+ this.waferMapUpdateTracker.queueUpdate();
54833
55010
  }
54834
55011
  hoverDieChanged() {
54835
55012
  this.$emit('die-hover', { currentDie: this.hoverDie });
54836
- this.queueRenderHover();
55013
+ this.waferMapUpdateTracker.track('hoverDie');
55014
+ this.waferMapUpdateTracker.queueUpdate();
54837
55015
  }
54838
55016
  }
54839
55017
  __decorate$1([