@ni/nimble-components 27.0.0 → 27.0.2

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 (29) hide show
  1. package/dist/all-components-bundle.js +465 -33
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +6698 -6624
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/src/wafer-map/index.d.ts +9 -1
  6. package/dist/esm/src/wafer-map/modules/experimental/worker-renderer.d.ts +3 -1
  7. package/dist/esm/src/wafer-map/modules/zoom-handler.d.ts +2 -0
  8. package/dist/esm/src/wafer-map/workers/matrix-renderer.d.ts +1 -1
  9. package/dist/esm/wafer-map/index.d.ts +9 -1
  10. package/dist/esm/wafer-map/index.js +6 -11
  11. package/dist/esm/wafer-map/index.js.map +1 -1
  12. package/dist/esm/wafer-map/modules/experimental/worker-renderer.d.ts +3 -1
  13. package/dist/esm/wafer-map/modules/experimental/worker-renderer.js +52 -2
  14. package/dist/esm/wafer-map/modules/experimental/worker-renderer.js.map +1 -1
  15. package/dist/esm/wafer-map/modules/prerendering.js +5 -3
  16. package/dist/esm/wafer-map/modules/prerendering.js.map +1 -1
  17. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js +14 -3
  18. package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js.map +1 -1
  19. package/dist/esm/wafer-map/modules/zoom-handler.d.ts +2 -0
  20. package/dist/esm/wafer-map/modules/zoom-handler.js +10 -0
  21. package/dist/esm/wafer-map/modules/zoom-handler.js.map +1 -1
  22. package/dist/esm/wafer-map/styles.js +10 -5
  23. package/dist/esm/wafer-map/styles.js.map +1 -1
  24. package/dist/esm/wafer-map/template.js +2 -1
  25. package/dist/esm/wafer-map/template.js.map +1 -1
  26. package/dist/esm/wafer-map/workers/matrix-renderer.d.ts +1 -1
  27. package/dist/esm/wafer-map/workers/matrix-renderer.js +1 -1
  28. package/dist/esm/wafer-map/workers/matrix-renderer.js.map +1 -1
  29. package/package.json +3 -2
@@ -4532,7 +4532,7 @@
4532
4532
  const context = this.context;
4533
4533
  for (let i = 0, ii = params.length; i < ii; ++i) {
4534
4534
  current = params[i];
4535
- if (!isObject$1(current)) {
4535
+ if (!isObject$2(current)) {
4536
4536
  continue;
4537
4537
  }
4538
4538
  if (isRegistry(current)) {
@@ -4547,7 +4547,7 @@
4547
4547
  jj = keys.length;
4548
4548
  for (; j < jj; ++j) {
4549
4549
  value = current[keys[j]];
4550
- if (!isObject$1(value)) {
4550
+ if (!isObject$2(value)) {
4551
4551
  continue;
4552
4552
  }
4553
4553
  // note: we could remove this if-branch and call this.register directly
@@ -4882,7 +4882,7 @@
4882
4882
  return [resolver.resolve(handler, requestor)];
4883
4883
  }
4884
4884
  const defaultFriendlyName = "(anonymous)";
4885
- function isObject$1(value) {
4885
+ function isObject$2(value) {
4886
4886
  return (typeof value === "object" && value !== null) || typeof value === "function";
4887
4887
  }
4888
4888
  /**
@@ -16333,7 +16333,7 @@
16333
16333
 
16334
16334
  /**
16335
16335
  * Do not edit directly
16336
- * Generated on Wed, 24 Apr 2024 16:04:06 GMT
16336
+ * Generated on Fri, 26 Apr 2024 18:14:56 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -30485,7 +30485,7 @@
30485
30485
  return null;
30486
30486
  return inside;
30487
30487
  }
30488
- function wrap(tr, range, wrappers) {
30488
+ function wrap$1(tr, range, wrappers) {
30489
30489
  let content = Fragment.empty;
30490
30490
  for (let i = wrappers.length - 1; i >= 0; i--) {
30491
30491
  if (content.size) {
@@ -31403,7 +31403,7 @@
31403
31403
  probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
31404
31404
  */
31405
31405
  wrap(range, wrappers) {
31406
- wrap(this, range, wrappers);
31406
+ wrap$1(this, range, wrappers);
31407
31407
  return this;
31408
31408
  }
31409
31409
  /**
@@ -50640,7 +50640,7 @@ img.ProseMirror-separator {
50640
50640
 
50641
50641
  function _class (obj) { return Object.prototype.toString.call(obj) }
50642
50642
  function isString (obj) { return _class(obj) === '[object String]' }
50643
- function isObject (obj) { return _class(obj) === '[object Object]' }
50643
+ function isObject$1 (obj) { return _class(obj) === '[object Object]' }
50644
50644
  function isRegExp (obj) { return _class(obj) === '[object RegExp]' }
50645
50645
  function isFunction$1 (obj) { return _class(obj) === '[object Function]' }
50646
50646
 
@@ -50802,7 +50802,7 @@ img.ProseMirror-separator {
50802
50802
 
50803
50803
  self.__compiled__[name] = compiled;
50804
50804
 
50805
- if (isObject(val)) {
50805
+ if (isObject$1(val)) {
50806
50806
  if (isRegExp(val.validate)) {
50807
50807
  compiled.validate = createValidator(val.validate);
50808
50808
  } else if (isFunction$1(val.validate)) {
@@ -74747,7 +74747,8 @@ img.ProseMirror-separator {
74747
74747
  </g>
74748
74748
  </g>
74749
74749
  </svg>
74750
- <canvas class="wafer-map-canvas" ${ref('canvas')}></canvas>
74750
+ <canvas class="main-wafer" ${ref('canvas')}></canvas>
74751
+ <canvas class="worker-wafer" ${ref('workerCanvas')}></canvas>
74751
74752
  <svg class="hover-layer">
74752
74753
  <rect
74753
74754
  class="hover-rect ${x => x.hoverOpacity}"
@@ -74766,6 +74767,16 @@ img.ProseMirror-separator {
74766
74767
  height: 500px;
74767
74768
  }
74768
74769
 
74770
+ .main-wafer {
74771
+ display: inline-block;
74772
+ position: absolute;
74773
+ }
74774
+
74775
+ .worker-wafer {
74776
+ display: inline-block;
74777
+ position: absolute;
74778
+ }
74779
+
74769
74780
  .wafer-map-container {
74770
74781
  width: 100%;
74771
74782
  height: 100%;
@@ -74812,11 +74823,6 @@ img.ProseMirror-separator {
74812
74823
  stroke: ${borderColor};
74813
74824
  }
74814
74825
 
74815
- .wafer-map-canvas {
74816
- display: inline-block;
74817
- position: absolute;
74818
- }
74819
-
74820
74826
  .hover-layer {
74821
74827
  position: absolute;
74822
74828
  pointer-events: none;
@@ -76011,9 +76017,11 @@ img.ProseMirror-separator {
76011
76017
  updateDiesRenderInfo() {
76012
76018
  this.d3ColorScale = this.createD3ColorScale(this.wafermap.colorScale, this.wafermap.colorScaleMode);
76013
76019
  const isDieRenderInfo = (info) => info !== null;
76014
- this._diesRenderInfo = this.wafermap.dies
76015
- .map(die => this.computeDieRenderInfo(die))
76016
- .filter(isDieRenderInfo);
76020
+ if (this.wafermap.diesTable === undefined) {
76021
+ this._diesRenderInfo = this.wafermap.dies
76022
+ .map(die => this.computeDieRenderInfo(die))
76023
+ .filter(isDieRenderInfo);
76024
+ }
76017
76025
  }
76018
76026
  computeDieRenderInfo(die) {
76019
76027
  const margin = this.wafermap.dataManager.margin;
@@ -76615,17 +76623,28 @@ img.ProseMirror-separator {
76615
76623
  * After the update is finished, all the tracked items are reset.
76616
76624
  */
76617
76625
  queueUpdate() {
76618
- if (!this.wafermap.$fastController.isConnected) {
76626
+ if (!this.wafermap.$fastController.isConnected || this.updateQueued) {
76619
76627
  return;
76620
76628
  }
76621
- if (!this.updateQueued) {
76622
- this.updateQueued = true;
76629
+ this.updateQueued = true;
76630
+ if (this.wafermap.currentTask === undefined) {
76623
76631
  DOM.queueUpdate(() => {
76624
76632
  this.wafermap.update();
76625
76633
  this.untrackAll();
76626
76634
  this.updateQueued = false;
76627
76635
  });
76628
76636
  }
76637
+ else {
76638
+ void (async () => {
76639
+ await this.wafermap.currentTask;
76640
+ DOM.queueUpdate(() => {
76641
+ this.wafermap.update();
76642
+ this.untrackAll();
76643
+ this.updateQueued = false;
76644
+ this.wafermap.currentTask = undefined;
76645
+ });
76646
+ })();
76647
+ }
76629
76648
  }
76630
76649
  }
76631
76650
 
@@ -77285,6 +77304,367 @@ img.ProseMirror-separator {
77285
77304
  }
77286
77305
  }
77287
77306
 
77307
+ /**
77308
+ * @license
77309
+ * Copyright 2019 Google LLC
77310
+ * SPDX-License-Identifier: Apache-2.0
77311
+ */
77312
+ const proxyMarker = Symbol("Comlink.proxy");
77313
+ const createEndpoint = Symbol("Comlink.endpoint");
77314
+ const releaseProxy = Symbol("Comlink.releaseProxy");
77315
+ const finalizer = Symbol("Comlink.finalizer");
77316
+ const throwMarker = Symbol("Comlink.thrown");
77317
+ const isObject = (val) => (typeof val === "object" && val !== null) || typeof val === "function";
77318
+ /**
77319
+ * Internal transfer handle to handle objects marked to proxy.
77320
+ */
77321
+ const proxyTransferHandler = {
77322
+ canHandle: (val) => isObject(val) && val[proxyMarker],
77323
+ serialize(obj) {
77324
+ const { port1, port2 } = new MessageChannel();
77325
+ expose(obj, port1);
77326
+ return [port2, [port2]];
77327
+ },
77328
+ deserialize(port) {
77329
+ port.start();
77330
+ return wrap(port);
77331
+ },
77332
+ };
77333
+ /**
77334
+ * Internal transfer handler to handle thrown exceptions.
77335
+ */
77336
+ const throwTransferHandler = {
77337
+ canHandle: (value) => isObject(value) && throwMarker in value,
77338
+ serialize({ value }) {
77339
+ let serialized;
77340
+ if (value instanceof Error) {
77341
+ serialized = {
77342
+ isError: true,
77343
+ value: {
77344
+ message: value.message,
77345
+ name: value.name,
77346
+ stack: value.stack,
77347
+ },
77348
+ };
77349
+ }
77350
+ else {
77351
+ serialized = { isError: false, value };
77352
+ }
77353
+ return [serialized, []];
77354
+ },
77355
+ deserialize(serialized) {
77356
+ if (serialized.isError) {
77357
+ throw Object.assign(new Error(serialized.value.message), serialized.value);
77358
+ }
77359
+ throw serialized.value;
77360
+ },
77361
+ };
77362
+ /**
77363
+ * Allows customizing the serialization of certain values.
77364
+ */
77365
+ const transferHandlers = new Map([
77366
+ ["proxy", proxyTransferHandler],
77367
+ ["throw", throwTransferHandler],
77368
+ ]);
77369
+ function isAllowedOrigin(allowedOrigins, origin) {
77370
+ for (const allowedOrigin of allowedOrigins) {
77371
+ if (origin === allowedOrigin || allowedOrigin === "*") {
77372
+ return true;
77373
+ }
77374
+ if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {
77375
+ return true;
77376
+ }
77377
+ }
77378
+ return false;
77379
+ }
77380
+ function expose(obj, ep = globalThis, allowedOrigins = ["*"]) {
77381
+ ep.addEventListener("message", function callback(ev) {
77382
+ if (!ev || !ev.data) {
77383
+ return;
77384
+ }
77385
+ if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
77386
+ console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
77387
+ return;
77388
+ }
77389
+ const { id, type, path } = Object.assign({ path: [] }, ev.data);
77390
+ const argumentList = (ev.data.argumentList || []).map(fromWireValue);
77391
+ let returnValue;
77392
+ try {
77393
+ const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);
77394
+ const rawValue = path.reduce((obj, prop) => obj[prop], obj);
77395
+ switch (type) {
77396
+ case "GET" /* MessageType.GET */:
77397
+ {
77398
+ returnValue = rawValue;
77399
+ }
77400
+ break;
77401
+ case "SET" /* MessageType.SET */:
77402
+ {
77403
+ parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);
77404
+ returnValue = true;
77405
+ }
77406
+ break;
77407
+ case "APPLY" /* MessageType.APPLY */:
77408
+ {
77409
+ returnValue = rawValue.apply(parent, argumentList);
77410
+ }
77411
+ break;
77412
+ case "CONSTRUCT" /* MessageType.CONSTRUCT */:
77413
+ {
77414
+ const value = new rawValue(...argumentList);
77415
+ returnValue = proxy(value);
77416
+ }
77417
+ break;
77418
+ case "ENDPOINT" /* MessageType.ENDPOINT */:
77419
+ {
77420
+ const { port1, port2 } = new MessageChannel();
77421
+ expose(obj, port2);
77422
+ returnValue = transfer(port1, [port1]);
77423
+ }
77424
+ break;
77425
+ case "RELEASE" /* MessageType.RELEASE */:
77426
+ {
77427
+ returnValue = undefined;
77428
+ }
77429
+ break;
77430
+ default:
77431
+ return;
77432
+ }
77433
+ }
77434
+ catch (value) {
77435
+ returnValue = { value, [throwMarker]: 0 };
77436
+ }
77437
+ Promise.resolve(returnValue)
77438
+ .catch((value) => {
77439
+ return { value, [throwMarker]: 0 };
77440
+ })
77441
+ .then((returnValue) => {
77442
+ const [wireValue, transferables] = toWireValue(returnValue);
77443
+ ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
77444
+ if (type === "RELEASE" /* MessageType.RELEASE */) {
77445
+ // detach and deactive after sending release response above.
77446
+ ep.removeEventListener("message", callback);
77447
+ closeEndPoint(ep);
77448
+ if (finalizer in obj && typeof obj[finalizer] === "function") {
77449
+ obj[finalizer]();
77450
+ }
77451
+ }
77452
+ })
77453
+ .catch((error) => {
77454
+ // Send Serialization Error To Caller
77455
+ const [wireValue, transferables] = toWireValue({
77456
+ value: new TypeError("Unserializable return value"),
77457
+ [throwMarker]: 0,
77458
+ });
77459
+ ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
77460
+ });
77461
+ });
77462
+ if (ep.start) {
77463
+ ep.start();
77464
+ }
77465
+ }
77466
+ function isMessagePort(endpoint) {
77467
+ return endpoint.constructor.name === "MessagePort";
77468
+ }
77469
+ function closeEndPoint(endpoint) {
77470
+ if (isMessagePort(endpoint))
77471
+ endpoint.close();
77472
+ }
77473
+ function wrap(ep, target) {
77474
+ return createProxy(ep, [], target);
77475
+ }
77476
+ function throwIfProxyReleased(isReleased) {
77477
+ if (isReleased) {
77478
+ throw new Error("Proxy has been released and is not useable");
77479
+ }
77480
+ }
77481
+ function releaseEndpoint(ep) {
77482
+ return requestResponseMessage(ep, {
77483
+ type: "RELEASE" /* MessageType.RELEASE */,
77484
+ }).then(() => {
77485
+ closeEndPoint(ep);
77486
+ });
77487
+ }
77488
+ const proxyCounter = new WeakMap();
77489
+ const proxyFinalizers = "FinalizationRegistry" in globalThis &&
77490
+ new FinalizationRegistry((ep) => {
77491
+ const newCount = (proxyCounter.get(ep) || 0) - 1;
77492
+ proxyCounter.set(ep, newCount);
77493
+ if (newCount === 0) {
77494
+ releaseEndpoint(ep);
77495
+ }
77496
+ });
77497
+ function registerProxy(proxy, ep) {
77498
+ const newCount = (proxyCounter.get(ep) || 0) + 1;
77499
+ proxyCounter.set(ep, newCount);
77500
+ if (proxyFinalizers) {
77501
+ proxyFinalizers.register(proxy, ep, proxy);
77502
+ }
77503
+ }
77504
+ function unregisterProxy(proxy) {
77505
+ if (proxyFinalizers) {
77506
+ proxyFinalizers.unregister(proxy);
77507
+ }
77508
+ }
77509
+ function createProxy(ep, path = [], target = function () { }) {
77510
+ let isProxyReleased = false;
77511
+ const proxy = new Proxy(target, {
77512
+ get(_target, prop) {
77513
+ throwIfProxyReleased(isProxyReleased);
77514
+ if (prop === releaseProxy) {
77515
+ return () => {
77516
+ unregisterProxy(proxy);
77517
+ releaseEndpoint(ep);
77518
+ isProxyReleased = true;
77519
+ };
77520
+ }
77521
+ if (prop === "then") {
77522
+ if (path.length === 0) {
77523
+ return { then: () => proxy };
77524
+ }
77525
+ const r = requestResponseMessage(ep, {
77526
+ type: "GET" /* MessageType.GET */,
77527
+ path: path.map((p) => p.toString()),
77528
+ }).then(fromWireValue);
77529
+ return r.then.bind(r);
77530
+ }
77531
+ return createProxy(ep, [...path, prop]);
77532
+ },
77533
+ set(_target, prop, rawValue) {
77534
+ throwIfProxyReleased(isProxyReleased);
77535
+ // FIXME: ES6 Proxy Handler `set` methods are supposed to return a
77536
+ // boolean. To show good will, we return true asynchronously ¯\_(ツ)_/¯
77537
+ const [value, transferables] = toWireValue(rawValue);
77538
+ return requestResponseMessage(ep, {
77539
+ type: "SET" /* MessageType.SET */,
77540
+ path: [...path, prop].map((p) => p.toString()),
77541
+ value,
77542
+ }, transferables).then(fromWireValue);
77543
+ },
77544
+ apply(_target, _thisArg, rawArgumentList) {
77545
+ throwIfProxyReleased(isProxyReleased);
77546
+ const last = path[path.length - 1];
77547
+ if (last === createEndpoint) {
77548
+ return requestResponseMessage(ep, {
77549
+ type: "ENDPOINT" /* MessageType.ENDPOINT */,
77550
+ }).then(fromWireValue);
77551
+ }
77552
+ // We just pretend that `bind()` didn’t happen.
77553
+ if (last === "bind") {
77554
+ return createProxy(ep, path.slice(0, -1));
77555
+ }
77556
+ const [argumentList, transferables] = processArguments(rawArgumentList);
77557
+ return requestResponseMessage(ep, {
77558
+ type: "APPLY" /* MessageType.APPLY */,
77559
+ path: path.map((p) => p.toString()),
77560
+ argumentList,
77561
+ }, transferables).then(fromWireValue);
77562
+ },
77563
+ construct(_target, rawArgumentList) {
77564
+ throwIfProxyReleased(isProxyReleased);
77565
+ const [argumentList, transferables] = processArguments(rawArgumentList);
77566
+ return requestResponseMessage(ep, {
77567
+ type: "CONSTRUCT" /* MessageType.CONSTRUCT */,
77568
+ path: path.map((p) => p.toString()),
77569
+ argumentList,
77570
+ }, transferables).then(fromWireValue);
77571
+ },
77572
+ });
77573
+ registerProxy(proxy, ep);
77574
+ return proxy;
77575
+ }
77576
+ function myFlat(arr) {
77577
+ return Array.prototype.concat.apply([], arr);
77578
+ }
77579
+ function processArguments(argumentList) {
77580
+ const processed = argumentList.map(toWireValue);
77581
+ return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];
77582
+ }
77583
+ const transferCache = new WeakMap();
77584
+ function transfer(obj, transfers) {
77585
+ transferCache.set(obj, transfers);
77586
+ return obj;
77587
+ }
77588
+ function proxy(obj) {
77589
+ return Object.assign(obj, { [proxyMarker]: true });
77590
+ }
77591
+ function toWireValue(value) {
77592
+ for (const [name, handler] of transferHandlers) {
77593
+ if (handler.canHandle(value)) {
77594
+ const [serializedValue, transferables] = handler.serialize(value);
77595
+ return [
77596
+ {
77597
+ type: "HANDLER" /* WireValueType.HANDLER */,
77598
+ name,
77599
+ value: serializedValue,
77600
+ },
77601
+ transferables,
77602
+ ];
77603
+ }
77604
+ }
77605
+ return [
77606
+ {
77607
+ type: "RAW" /* WireValueType.RAW */,
77608
+ value,
77609
+ },
77610
+ transferCache.get(value) || [],
77611
+ ];
77612
+ }
77613
+ function fromWireValue(value) {
77614
+ switch (value.type) {
77615
+ case "HANDLER" /* WireValueType.HANDLER */:
77616
+ return transferHandlers.get(value.name).deserialize(value.value);
77617
+ case "RAW" /* WireValueType.RAW */:
77618
+ return value.value;
77619
+ }
77620
+ }
77621
+ function requestResponseMessage(ep, msg, transfers) {
77622
+ return new Promise((resolve) => {
77623
+ const id = generateUUID();
77624
+ ep.addEventListener("message", function l(ev) {
77625
+ if (!ev.data || !ev.data.id || ev.data.id !== id) {
77626
+ return;
77627
+ }
77628
+ ep.removeEventListener("message", l);
77629
+ resolve(ev.data);
77630
+ });
77631
+ if (ep.start) {
77632
+ ep.start();
77633
+ }
77634
+ ep.postMessage(Object.assign({ id }, msg), transfers);
77635
+ });
77636
+ }
77637
+ function generateUUID() {
77638
+ return new Array(4)
77639
+ .fill(0)
77640
+ .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))
77641
+ .join("-");
77642
+ }
77643
+
77644
+ // eslint-disable-next-line no-template-curly-in-string
77645
+ const workerCode = "var MatrixRenderer = (function (exports) {\n 'use strict';\n\n /**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n const proxyMarker = Symbol(\"Comlink.proxy\");\n const createEndpoint = Symbol(\"Comlink.endpoint\");\n const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n const finalizer = Symbol(\"Comlink.finalizer\");\n const throwMarker = Symbol(\"Comlink.thrown\");\n const isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n /**\n * Internal transfer handle to handle objects marked to proxy.\n */\n const proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n };\n /**\n * Internal transfer handler to handle thrown exceptions.\n */\n const throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n };\n /**\n * Allows customizing the serialization of certain values.\n */\n const transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n }\n function wrap(ep, target) {\n return createProxy(ep, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n }\n const proxyCounter = new WeakMap();\n const proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n }\n const transferCache = new WeakMap();\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n }\n function requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener(\"message\", function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener(\"message\", l);\n resolve(ev.data);\n });\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n }\n function generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n }\n\n /**\n * MatrixRenderer class is meant to be used within a Web Worker context,\n * using Comlink to facilitate communication between the main thread and the worker.\n * The MatrixRenderer class manages a matrix of dies, once an instance of MatrixRenderer is created,\n * it is exposed to the main thread using Comlink's `expose` method.\n * This setup is used in the wafer-map component to perform heavy computational duties\n */\n class MatrixRenderer {\n constructor() {\n this.columnIndexes = Int32Array.from([]);\n this.rowIndexes = Int32Array.from([]);\n this.values = Float64Array.from([]);\n this.scaledColumnIndex = Float64Array.from([]);\n this.scaledRowIndex = Float64Array.from([]);\n this.columnIndexPositions = Int32Array.from([]);\n this.scaleX = 1;\n this.scaleY = 1;\n this.baseX = 1;\n this.baseY = 1;\n this.dieDimensions = { width: 1, height: 1 };\n this.transform = { k: 1, x: 0, y: 0 };\n this.smallestMarginPossible = 20;\n this.margin = {\n top: this.smallestMarginPossible,\n right: this.smallestMarginPossible,\n bottom: this.smallestMarginPossible,\n left: this.smallestMarginPossible\n };\n }\n calculateXScaledIndex(columnIndex) {\n return this.scaleX * columnIndex + this.baseX + this.margin.left;\n }\n calculateYScaledIndex(rowIndex) {\n return this.scaleY * rowIndex + this.baseY + this.margin.top;\n }\n setColumnIndexes(columnIndexes) {\n this.columnIndexes = columnIndexes;\n if (columnIndexes.length === 0 || this.columnIndexes[0] === undefined) {\n return;\n }\n const scaledColumnIndex = [\n this.calculateXScaledIndex(this.columnIndexes[0])\n ];\n const columnPositions = [0];\n let prev = this.columnIndexes[0];\n for (let i = 1; i < this.columnIndexes.length; i++) {\n const xIndex = this.columnIndexes[i];\n if (xIndex && xIndex !== prev) {\n const scaledX = this.calculateXScaledIndex(this.columnIndexes[i]);\n scaledColumnIndex.push(scaledX);\n columnPositions.push(i);\n prev = xIndex;\n }\n }\n this.scaledColumnIndex = Float64Array.from(scaledColumnIndex);\n this.columnIndexPositions = Int32Array.from(columnPositions);\n }\n setRowIndexes(rowIndexesBuffer) {\n this.rowIndexes = rowIndexesBuffer;\n this.scaledRowIndex = new Float64Array(this.rowIndexes.length);\n for (let i = 0; i < this.rowIndexes.length; i++) {\n this.scaledRowIndex[i] = this.calculateYScaledIndex(this.rowIndexes[i]);\n }\n }\n setMargin(margin) {\n this.margin = margin;\n }\n setCanvasCorners(topLeft, bottomRight) {\n this.topLeftCanvasCorner = topLeft;\n this.bottomRightCanvasCorner = bottomRight;\n }\n setDiesDimensions(data) {\n this.dieDimensions = { width: data.width, height: data.height };\n }\n setScaling(scaleX, scaleY) {\n this.scaleX = scaleX;\n this.scaleY = scaleY;\n }\n setBases(baseX, baseY) {\n this.baseX = baseX;\n this.baseY = baseY;\n }\n setTransform(transform) {\n this.transform = transform;\n }\n setCanvas(canvas) {\n this.canvas = canvas;\n this.context = canvas.getContext('2d');\n }\n getMatrix() {\n return {\n columnIndexes: this.columnIndexes,\n rowIndexes: this.rowIndexes,\n values: this.values\n };\n }\n emptyMatrix() {\n this.columnIndexes = Int32Array.from([]);\n this.rowIndexes = Int32Array.from([]);\n this.values = Float64Array.from([]);\n }\n scaleCanvas() {\n this.context.translate(this.transform.x, this.transform.y);\n this.context.scale(this.transform.k, this.transform.k);\n }\n updateMatrix(data) {\n this.columnIndexes = Int32Array.from(data.columnIndexes);\n this.rowIndexes = Int32Array.from(data.rowIndexes);\n this.values = Float64Array.from(data.values);\n }\n setCanvasDimensions(data) {\n this.canvas.width = data.width;\n this.canvas.height = data.height;\n }\n getCanvasDimensions() {\n return {\n width: this.canvas.width,\n height: this.canvas.height\n };\n }\n clearCanvas() {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n drawWafer() {\n this.context.restore();\n this.context.save();\n this.clearCanvas();\n this.scaleCanvas();\n if (this.topLeftCanvasCorner === undefined\n || this.bottomRightCanvasCorner === undefined) {\n throw new Error('Canvas corners are not set');\n }\n for (let i = 0; i < this.scaledColumnIndex.length; i++) {\n const scaledX = this.scaledColumnIndex[i];\n if (!(scaledX >= this.topLeftCanvasCorner.x\n && scaledX < this.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndex is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndex is 13\n const columnEndIndex = this.columnIndexPositions[i + 1] !== undefined\n ? this.columnIndexPositions[i + 1]\n : this.scaledRowIndex.length;\n for (let columnStartIndex = this.columnIndexPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndex[columnStartIndex];\n if (!(scaledY >= this.topLeftCanvasCorner.y\n && scaledY < this.bottomRightCanvasCorner.y)) {\n continue;\n }\n // Fill style is temporary green for all dies, will be replaced with a color based on the value of the die in a future implementation\n this.context.fillStyle = 'Green';\n this.context.fillRect(scaledX, scaledY, this.dieDimensions.width, this.dieDimensions.height);\n }\n }\n }\n }\n expose(MatrixRenderer);\n\n exports.MatrixRenderer = MatrixRenderer;\n\n return exports;\n\n})({});\n";
77646
+
77647
+ let url;
77648
+ /**
77649
+ * Asynchronously creates and returns a Remote<MatrixRenderer> instance.
77650
+ * This function simplifies the process of creating and accessing MatrixRenderer instances.
77651
+ */
77652
+ const createMatrixRenderer = async () => {
77653
+ if (url === undefined) {
77654
+ const blob = new Blob([workerCode], { type: 'text/javascript' });
77655
+ url = URL.createObjectURL(blob);
77656
+ }
77657
+ const worker = new Worker(url);
77658
+ // eslint-disable-next-line @typescript-eslint/naming-convention
77659
+ const RemoteMatrixRenderer = wrap(worker);
77660
+ const matrixRenderer = await new RemoteMatrixRenderer();
77661
+ const terminate = () => worker.terminate();
77662
+ return {
77663
+ matrixRenderer,
77664
+ terminate
77665
+ };
77666
+ };
77667
+
77288
77668
  /**
77289
77669
  * Responsible for drawing the dies inside the wafer map, adding dieText and scaling the canvas
77290
77670
  */
@@ -77292,8 +77672,56 @@ img.ProseMirror-separator {
77292
77672
  constructor(wafermap) {
77293
77673
  this.wafermap = wafermap;
77294
77674
  }
77295
- drawWafer() {
77296
- // rendering will be implemented in a future PR
77675
+ async setupWafer() {
77676
+ if (this.matrixRenderer === undefined) {
77677
+ const { matrixRenderer } = await createMatrixRenderer();
77678
+ this.matrixRenderer = matrixRenderer;
77679
+ const offscreenCanvas = this.wafermap.workerCanvas.transferControlToOffscreen();
77680
+ await this.matrixRenderer.setCanvas(transfer(offscreenCanvas, [offscreenCanvas]));
77681
+ }
77682
+ await this.matrixRenderer.setCanvasDimensions({
77683
+ width: this.wafermap.canvasWidth ?? 0,
77684
+ height: this.wafermap.canvasHeight ?? 0
77685
+ });
77686
+ await this.matrixRenderer.setDiesDimensions(this.wafermap.experimentalDataManager.dieDimensions);
77687
+ const scaleX = this.wafermap.experimentalDataManager.horizontalScale(1)
77688
+ - this.wafermap.experimentalDataManager.horizontalScale(0);
77689
+ const scaleY = this.wafermap.experimentalDataManager.verticalScale(1)
77690
+ - this.wafermap.experimentalDataManager.verticalScale(0);
77691
+ await this.matrixRenderer.setScaling(scaleX, scaleY);
77692
+ await this.matrixRenderer.setBases(this.wafermap.experimentalDataManager.horizontalScale(0), this.wafermap.experimentalDataManager.verticalScale(0));
77693
+ await this.matrixRenderer.setMargin(this.wafermap.experimentalDataManager.margin);
77694
+ if (this.wafermap.diesTable === undefined) {
77695
+ await this.matrixRenderer.setColumnIndexes(Int32Array.from([]));
77696
+ await this.matrixRenderer.setRowIndexes(Int32Array.from([]));
77697
+ return;
77698
+ }
77699
+ const columnIndexes = this.wafermap.diesTable
77700
+ .getChild('colIndex')
77701
+ .toArray();
77702
+ await this.matrixRenderer.setColumnIndexes(columnIndexes);
77703
+ const rowIndexes = this.wafermap.diesTable
77704
+ .getChild('rowIndex')
77705
+ .toArray();
77706
+ await this.matrixRenderer.setRowIndexes(rowIndexes);
77707
+ }
77708
+ async drawWafer() {
77709
+ await this.matrixRenderer.setTransform(this.wafermap.transform);
77710
+ const topLeftCanvasCorner = this.wafermap.transform.invert([0, 0]);
77711
+ const bottomRightCanvasCorner = this.wafermap.transform.invert([
77712
+ this.wafermap.canvasWidth,
77713
+ this.wafermap.canvasHeight
77714
+ ]);
77715
+ await this.matrixRenderer.setCanvasCorners({
77716
+ x: topLeftCanvasCorner[0]
77717
+ - this.wafermap.experimentalDataManager.dieDimensions.width,
77718
+ y: topLeftCanvasCorner[1]
77719
+ - this.wafermap.experimentalDataManager.dieDimensions.height
77720
+ }, {
77721
+ x: bottomRightCanvasCorner[0],
77722
+ y: bottomRightCanvasCorner[1]
77723
+ });
77724
+ await this.matrixRenderer.drawWafer();
77297
77725
  this.renderHover();
77298
77726
  }
77299
77727
  renderHover() {
@@ -77499,6 +77927,9 @@ img.ProseMirror-separator {
77499
77927
  this.onWheelMove = (event) => {
77500
77928
  event.preventDefault();
77501
77929
  };
77930
+ this.wafermapNotifier = Observable.getNotifier(this.wafermap);
77931
+ this.wafermapNotifier.subscribe(this, 'canvasWidth');
77932
+ this.wafermapNotifier.subscribe(this, 'canvasHeight');
77502
77933
  }
77503
77934
  /**
77504
77935
  * @internal
@@ -77516,6 +77947,12 @@ img.ProseMirror-separator {
77516
77947
  zoom().on('zoom', null)(select(this.wafermap));
77517
77948
  this.wafermap.removeEventListener('wheel', this.onWheelMove);
77518
77949
  }
77950
+ handleChange(source, propertyName) {
77951
+ if (source === this.wafermap
77952
+ && (propertyName === 'canvasWidth' || propertyName === 'canvasHeight')) {
77953
+ this.createZoomBehavior();
77954
+ }
77955
+ }
77519
77956
  createZoomBehavior() {
77520
77957
  zoom()
77521
77958
  .scaleExtent(this.scaleExtent)
@@ -77617,27 +78054,25 @@ img.ProseMirror-separator {
77617
78054
  * @internal
77618
78055
  * Experimental update function called when an update is queued.
77619
78056
  */
77620
- experimentalUpdate() {
78057
+ async experimentalUpdate() {
77621
78058
  if (this.validity.invalidDiesTableSchema) {
77622
78059
  return;
77623
78060
  }
77624
78061
  if (this.waferMapUpdateTracker.requiresEventsUpdate) {
77625
- // zoom translateExtent needs to be recalculated when canvas size changes
77626
- this.zoomHandler.disconnect();
77627
78062
  if (this.waferMapUpdateTracker.requiresContainerDimensionsUpdate
77628
78063
  || this.waferMapUpdateTracker.requiresScalesUpdate) {
77629
78064
  this.experimentalDataManager.updateComputations();
77630
- this.workerRenderer.drawWafer();
78065
+ await this.workerRenderer.setupWafer();
78066
+ await this.workerRenderer.drawWafer();
77631
78067
  }
77632
78068
  else if (this.waferMapUpdateTracker.requiresLabelsFontSizeUpdate
77633
78069
  || this.waferMapUpdateTracker.requiresDiesRenderInfoUpdate) {
77634
78070
  this.experimentalDataManager.updatePrerendering();
77635
- this.workerRenderer.drawWafer();
78071
+ await this.workerRenderer.drawWafer();
77636
78072
  }
77637
78073
  else if (this.waferMapUpdateTracker.requiresDrawnWaferUpdate) {
77638
- this.workerRenderer.drawWafer();
78074
+ await this.workerRenderer.drawWafer();
77639
78075
  }
77640
- this.zoomHandler.connect();
77641
78076
  }
77642
78077
  else if (this.waferMapUpdateTracker.requiresRenderHoverUpdate) {
77643
78078
  this.workerRenderer.renderHover();
@@ -77654,12 +78089,10 @@ img.ProseMirror-separator {
77654
78089
  update() {
77655
78090
  this.validate();
77656
78091
  if (this.isExperimentalUpdate()) {
77657
- this.experimentalUpdate();
78092
+ this.currentTask = this.experimentalUpdate();
77658
78093
  return;
77659
78094
  }
77660
78095
  if (this.waferMapUpdateTracker.requiresEventsUpdate) {
77661
- // zoom translateExtent needs to be recalculated when canvas size changes
77662
- this.zoomHandler.disconnect();
77663
78096
  if (this.waferMapUpdateTracker.requiresContainerDimensionsUpdate) {
77664
78097
  this.dataManager.updateContainerDimensions();
77665
78098
  this.renderer.updateSortedDiesAndDrawWafer();
@@ -77679,7 +78112,6 @@ img.ProseMirror-separator {
77679
78112
  else if (this.waferMapUpdateTracker.requiresDrawnWaferUpdate) {
77680
78113
  this.renderer.drawWafer();
77681
78114
  }
77682
- this.zoomHandler.connect();
77683
78115
  }
77684
78116
  else if (this.waferMapUpdateTracker.requiresRenderHoverUpdate) {
77685
78117
  this.renderer.renderHover();