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