@legionworks/facet 1.10.2 → 1.10.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.
@@ -5603,7 +5603,11 @@ async function startGallery(runtime = browserGalleryRuntime()) {
5603
5603
  badge.dataset.interactionError = "true";
5604
5604
  updateGalleryStatus("displayed · runtime error during interaction");
5605
5605
  };
5606
- frameWindow.addEventListener("error", markFailure, true);
5606
+ const markScriptFailure = (event) => {
5607
+ if (event.target === frameWindow)
5608
+ markFailure();
5609
+ };
5610
+ frameWindow.addEventListener("error", markScriptFailure, true);
5607
5611
  frameWindow.addEventListener("unhandledrejection", markFailure, true);
5608
5612
  const frameDocument = frame.element.raw.contentDocument;
5609
5613
  const observer = frameDocument == null || typeof MutationObserver !== "function" ? null : new MutationObserver(() => {
@@ -5613,7 +5617,7 @@ async function startGallery(runtime = browserGalleryRuntime()) {
5613
5617
  if (frameDocument !== null)
5614
5618
  observer?.observe(frameDocument, { childList: true, subtree: true });
5615
5619
  removeInteractionListener = () => {
5616
- frameWindow.removeEventListener("error", markFailure, true);
5620
+ frameWindow.removeEventListener("error", markScriptFailure, true);
5617
5621
  frameWindow.removeEventListener("unhandledrejection", markFailure, true);
5618
5622
  observer?.disconnect();
5619
5623
  };
@@ -33,9 +33,14 @@ async function renderTsx(ctx, bytes, renderer, execution = "static") {
33
33
  root.setAttribute("data-facet-renderer-root", "true");
34
34
  ctx.container.replaceChildren(root);
35
35
  const frameWindow = ctx.container.ownerDocument.defaultView;
36
- const report = (event) => appendRuntimeError(ctx.container, event);
37
- frameWindow?.addEventListener("error", report, true);
38
- frameWindow?.addEventListener("unhandledrejection", report, true);
36
+ const reportRuntimeError = (event) => {
37
+ if (event.target !== frameWindow)
38
+ return;
39
+ appendRuntimeError(ctx.container, event);
40
+ };
41
+ const reportRejection = (event) => appendRuntimeError(ctx.container, event);
42
+ frameWindow?.addEventListener("error", reportRuntimeError, true);
43
+ frameWindow?.addEventListener("unhandledrejection", reportRejection, true);
39
44
  const moduleUrl = tsxModuleRuntime.createObjectURL(new Blob([bytes], { type: "text/javascript" }));
40
45
  try {
41
46
  await tsxModuleRuntime.importModule(moduleUrl);
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- <link rel="stylesheet" crossorigin href="./chunk-2dge4gwb.css"><script type="module" crossorigin src="./chunk-0by8qn4x.js"></script></head>
11
+ <link rel="stylesheet" crossorigin href="./chunk-2dge4gwb.css"><script type="module" crossorigin src="./chunk-56h5c4qv.js"></script></head>
12
12
  <body>
13
13
  <div id="facet-shell">
14
14
  <header id="facet-status">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legionworks/facet",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "artifacts",
@@ -1126,7 +1126,10 @@ export async function startGallery(runtime = browserGalleryRuntime()): Promise<v
1126
1126
  if (badge !== null) badge.dataset.interactionError = "true";
1127
1127
  updateGalleryStatus("displayed · runtime error during interaction");
1128
1128
  };
1129
- frameWindow.addEventListener("error", markFailure, true);
1129
+ const markScriptFailure = (event: Event): void => {
1130
+ if (event.target === frameWindow) markFailure();
1131
+ };
1132
+ frameWindow.addEventListener("error", markScriptFailure, true);
1130
1133
  frameWindow.addEventListener("unhandledrejection", markFailure, true);
1131
1134
  const frameDocument = (frame.element.raw as HTMLIFrameElement).contentDocument;
1132
1135
  const observer =
@@ -1138,7 +1141,7 @@ export async function startGallery(runtime = browserGalleryRuntime()): Promise<v
1138
1141
  if (frameDocument !== null)
1139
1142
  observer?.observe(frameDocument, { childList: true, subtree: true });
1140
1143
  removeInteractionListener = (): void => {
1141
- frameWindow.removeEventListener("error", markFailure, true);
1144
+ frameWindow.removeEventListener("error", markScriptFailure, true);
1142
1145
  frameWindow.removeEventListener("unhandledrejection", markFailure, true);
1143
1146
  observer?.disconnect();
1144
1147
  };
@@ -44,9 +44,13 @@ export async function renderTsx(
44
44
  root.setAttribute("data-facet-renderer-root", "true");
45
45
  ctx.container.replaceChildren(root);
46
46
  const frameWindow = ctx.container.ownerDocument.defaultView;
47
- const report = (event: Event): void => appendRuntimeError(ctx.container, event);
48
- frameWindow?.addEventListener("error", report, true);
49
- frameWindow?.addEventListener("unhandledrejection", report, true);
47
+ const reportRuntimeError = (event: Event): void => {
48
+ if (event.target !== frameWindow) return;
49
+ appendRuntimeError(ctx.container, event);
50
+ };
51
+ const reportRejection = (event: Event): void => appendRuntimeError(ctx.container, event);
52
+ frameWindow?.addEventListener("error", reportRuntimeError, true);
53
+ frameWindow?.addEventListener("unhandledrejection", reportRejection, true);
50
54
  const moduleUrl = tsxModuleRuntime.createObjectURL(
51
55
  new Blob([bytes], { type: "text/javascript" }),
52
56
  );