@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.
package/dist/index.js CHANGED
@@ -25780,7 +25780,7 @@ function exposeProviderOnWindow(internals) {
25780
25780
  if (typeof window === "undefined") return;
25781
25781
  const w = window;
25782
25782
  const root = w.__UI_BRIDGE__ ?? (w.__UI_BRIDGE__ = {});
25783
- root.version = "0.8.4";
25783
+ root.version = "0.8.5";
25784
25784
  root.specs = { getGlobalSpecStore };
25785
25785
  root.registry = internals.registry;
25786
25786
  root.browserCapture = internals.browserCapture;
@@ -33974,6 +33974,64 @@ async function awaitDOMSettledRelay(timeout = 500) {
33974
33974
  } catch {
33975
33975
  }
33976
33976
  }
33977
+ function dispatchRealClick(el) {
33978
+ try {
33979
+ el.focus?.();
33980
+ } catch {
33981
+ }
33982
+ const rect = (() => {
33983
+ try {
33984
+ return el.getBoundingClientRect();
33985
+ } catch {
33986
+ return { left: 0, top: 0, width: 0, height: 0 };
33987
+ }
33988
+ })();
33989
+ const clientX = rect.left + rect.width / 2;
33990
+ const clientY = rect.top + rect.height / 2;
33991
+ const pointerInit = {
33992
+ bubbles: true,
33993
+ cancelable: true,
33994
+ composed: true,
33995
+ pointerId: 1,
33996
+ button: 0,
33997
+ buttons: 1,
33998
+ isPrimary: true,
33999
+ pointerType: "mouse",
34000
+ clientX,
34001
+ clientY
34002
+ };
34003
+ const mouseInit = {
34004
+ bubbles: true,
34005
+ cancelable: true,
34006
+ composed: true,
34007
+ button: 0,
34008
+ buttons: 1,
34009
+ clientX,
34010
+ clientY
34011
+ };
34012
+ const makePointer = (type) => {
34013
+ try {
34014
+ if (typeof PointerEvent === "function") {
34015
+ return new PointerEvent(type, pointerInit);
34016
+ }
34017
+ } catch {
34018
+ }
34019
+ return new MouseEvent(type, mouseInit);
34020
+ };
34021
+ const makeMouse = (type) => new MouseEvent(type, mouseInit);
34022
+ try {
34023
+ el.dispatchEvent(makePointer("pointerdown"));
34024
+ el.dispatchEvent(makeMouse("mousedown"));
34025
+ el.dispatchEvent(makePointer("pointerup"));
34026
+ el.dispatchEvent(makeMouse("mouseup"));
34027
+ el.dispatchEvent(makeMouse("click"));
34028
+ } catch {
34029
+ }
34030
+ try {
34031
+ el.click();
34032
+ } catch {
34033
+ }
34034
+ }
33977
34035
  async function getAnnotationStore() {
33978
34036
  try {
33979
34037
  const { getGlobalAnnotationStore: getGlobalAnnotationStore2 } = await Promise.resolve().then(() => (init_store(), store_exports));
@@ -34269,7 +34327,7 @@ async function executeCommand(action, payload, bridge) {
34269
34327
  try {
34270
34328
  switch (request.action) {
34271
34329
  case "click":
34272
- dom.click();
34330
+ dispatchRealClick(dom);
34273
34331
  break;
34274
34332
  case "focus":
34275
34333
  dom.focus();
@@ -34370,9 +34428,9 @@ async function executeCommand(action, payload, bridge) {
34370
34428
  dom.checked = !dom.checked;
34371
34429
  dom.dispatchEvent(new Event("change", { bubbles: true }));
34372
34430
  } else if (dom.getAttribute("role") === "switch") {
34373
- dom.click();
34431
+ dispatchRealClick(dom);
34374
34432
  } else {
34375
- dom.click();
34433
+ dispatchRealClick(dom);
34376
34434
  }
34377
34435
  break;
34378
34436
  }
@@ -34541,7 +34599,7 @@ async function executeCommand(action, payload, bridge) {
34541
34599
  case "submit": {
34542
34600
  const form = dom.closest("form");
34543
34601
  if (form) form.requestSubmit();
34544
- else dom.click();
34602
+ else dispatchRealClick(dom);
34545
34603
  break;
34546
34604
  }
34547
34605
  case "reset": {
@@ -34762,7 +34820,7 @@ async function executeCommand(action, payload, bridge) {
34762
34820
  return { success: false, error: `No element found with text "${text}"` };
34763
34821
  }
34764
34822
  const el = matches[0];
34765
- el.click();
34823
+ dispatchRealClick(el);
34766
34824
  return {
34767
34825
  clicked: true,
34768
34826
  element: {
@@ -34781,7 +34839,7 @@ async function executeCommand(action, payload, bridge) {
34781
34839
  if (!el) {
34782
34840
  return { success: false, error: `No element found for selector "${selector}"` };
34783
34841
  }
34784
- el.click();
34842
+ dispatchRealClick(el);
34785
34843
  return {
34786
34844
  clicked: true,
34787
34845
  element: {
@@ -35202,7 +35260,7 @@ async function executeCommand(action, payload, bridge) {
35202
35260
  try {
35203
35261
  switch (parsed.action) {
35204
35262
  case "click":
35205
- dom.click();
35263
+ dispatchRealClick(dom);
35206
35264
  break;
35207
35265
  case "type":
35208
35266
  if (dom instanceof HTMLInputElement || dom instanceof HTMLTextAreaElement) {