@qontinui/ui-bridge 0.8.4 → 0.8.5

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.
@@ -24925,7 +24925,7 @@ function exposeProviderOnWindow(internals) {
24925
24925
  if (typeof window === "undefined") return;
24926
24926
  const w = window;
24927
24927
  const root = w.__UI_BRIDGE__ ?? (w.__UI_BRIDGE__ = {});
24928
- root.version = "0.8.4";
24928
+ root.version = "0.8.5";
24929
24929
  root.specs = { getGlobalSpecStore };
24930
24930
  root.registry = internals.registry;
24931
24931
  root.browserCapture = internals.browserCapture;
@@ -29362,6 +29362,64 @@ async function awaitDOMSettledRelay(timeout = 500) {
29362
29362
  } catch {
29363
29363
  }
29364
29364
  }
29365
+ function dispatchRealClick(el) {
29366
+ try {
29367
+ el.focus?.();
29368
+ } catch {
29369
+ }
29370
+ const rect = (() => {
29371
+ try {
29372
+ return el.getBoundingClientRect();
29373
+ } catch {
29374
+ return { left: 0, top: 0, width: 0, height: 0 };
29375
+ }
29376
+ })();
29377
+ const clientX = rect.left + rect.width / 2;
29378
+ const clientY = rect.top + rect.height / 2;
29379
+ const pointerInit = {
29380
+ bubbles: true,
29381
+ cancelable: true,
29382
+ composed: true,
29383
+ pointerId: 1,
29384
+ button: 0,
29385
+ buttons: 1,
29386
+ isPrimary: true,
29387
+ pointerType: "mouse",
29388
+ clientX,
29389
+ clientY
29390
+ };
29391
+ const mouseInit = {
29392
+ bubbles: true,
29393
+ cancelable: true,
29394
+ composed: true,
29395
+ button: 0,
29396
+ buttons: 1,
29397
+ clientX,
29398
+ clientY
29399
+ };
29400
+ const makePointer = (type) => {
29401
+ try {
29402
+ if (typeof PointerEvent === "function") {
29403
+ return new PointerEvent(type, pointerInit);
29404
+ }
29405
+ } catch {
29406
+ }
29407
+ return new MouseEvent(type, mouseInit);
29408
+ };
29409
+ const makeMouse = (type) => new MouseEvent(type, mouseInit);
29410
+ try {
29411
+ el.dispatchEvent(makePointer("pointerdown"));
29412
+ el.dispatchEvent(makeMouse("mousedown"));
29413
+ el.dispatchEvent(makePointer("pointerup"));
29414
+ el.dispatchEvent(makeMouse("mouseup"));
29415
+ el.dispatchEvent(makeMouse("click"));
29416
+ } catch {
29417
+ }
29418
+ try {
29419
+ el.click();
29420
+ } catch {
29421
+ }
29422
+ }
29365
29423
  async function getAnnotationStore() {
29366
29424
  try {
29367
29425
  const { getGlobalAnnotationStore: getGlobalAnnotationStore2 } = await Promise.resolve().then(() => (init_store(), store_exports));
@@ -29657,7 +29715,7 @@ async function executeCommand(action, payload, bridge) {
29657
29715
  try {
29658
29716
  switch (request.action) {
29659
29717
  case "click":
29660
- dom.click();
29718
+ dispatchRealClick(dom);
29661
29719
  break;
29662
29720
  case "focus":
29663
29721
  dom.focus();
@@ -29758,9 +29816,9 @@ async function executeCommand(action, payload, bridge) {
29758
29816
  dom.checked = !dom.checked;
29759
29817
  dom.dispatchEvent(new Event("change", { bubbles: true }));
29760
29818
  } else if (dom.getAttribute("role") === "switch") {
29761
- dom.click();
29819
+ dispatchRealClick(dom);
29762
29820
  } else {
29763
- dom.click();
29821
+ dispatchRealClick(dom);
29764
29822
  }
29765
29823
  break;
29766
29824
  }
@@ -29929,7 +29987,7 @@ async function executeCommand(action, payload, bridge) {
29929
29987
  case "submit": {
29930
29988
  const form = dom.closest("form");
29931
29989
  if (form) form.requestSubmit();
29932
- else dom.click();
29990
+ else dispatchRealClick(dom);
29933
29991
  break;
29934
29992
  }
29935
29993
  case "reset": {
@@ -30150,7 +30208,7 @@ async function executeCommand(action, payload, bridge) {
30150
30208
  return { success: false, error: `No element found with text "${text}"` };
30151
30209
  }
30152
30210
  const el = matches[0];
30153
- el.click();
30211
+ dispatchRealClick(el);
30154
30212
  return {
30155
30213
  clicked: true,
30156
30214
  element: {
@@ -30169,7 +30227,7 @@ async function executeCommand(action, payload, bridge) {
30169
30227
  if (!el) {
30170
30228
  return { success: false, error: `No element found for selector "${selector}"` };
30171
30229
  }
30172
- el.click();
30230
+ dispatchRealClick(el);
30173
30231
  return {
30174
30232
  clicked: true,
30175
30233
  element: {
@@ -30590,7 +30648,7 @@ async function executeCommand(action, payload, bridge) {
30590
30648
  try {
30591
30649
  switch (parsed.action) {
30592
30650
  case "click":
30593
- dom.click();
30651
+ dispatchRealClick(dom);
30594
30652
  break;
30595
30653
  case "type":
30596
30654
  if (dom instanceof HTMLInputElement || dom instanceof HTMLTextAreaElement) {