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