@hiver/connector-agent 4.9.0-splitApps-beta.1 → 4.9.0-splitApps-beta.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.
package/index.es.js CHANGED
@@ -22066,59 +22066,52 @@ const KT = ({ observer: e, ...t }) => /* @__PURE__ */ u.jsx(Zl, { children: /* @
22066
22066
  return e > 2 ? (console.error("Failed to get connectors list after 3 tries", t), []) : Mp(e + 1);
22067
22067
  }
22068
22068
  }, eS = (e) => {
22069
- const { connectorTabSelector: t } = e, n = { pending: !1 };
22069
+ const { connectorTabSelector: t, sideBarDropdownSize: n } = e, r = { connectorApiPending: !1, sideBarTabs: 0 };
22070
22070
  if (!an())
22071
22071
  throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");
22072
- const o = k6({
22072
+ const i = k6({
22073
22073
  name: "app-store",
22074
22074
  initialState: {}
22075
- }), i = () => {
22076
- n.pending || (n.pending = !0, Mp().then((l) => {
22077
- n.pending = !1, Yo("setConnectors", l), !(!Array.isArray(l) || !l.length) && o.setData(l, "connectors");
22075
+ }), s = () => {
22076
+ r.connectorApiPending || (r.connectorApiPending = !0, Mp().then((d) => {
22077
+ r.connectorApiPending = !1, Yo("setConnectors", d), !(!Array.isArray(d) || !d.length) && i.setData(d, "connectors");
22078
22078
  }));
22079
- }, s = (l) => [...l].sort((d, g) => {
22080
- const b = d.lastAccessed ?? 0, y = g.lastAccessed ?? 0;
22081
- return b === y ? 0 : b > y ? -1 : 1;
22082
- }), a = () => {
22083
- const l = o.getData("connectors"), d = o.getData("tabElement");
22084
- if (Yo("setConnectorTabs", l, d), !Array.isArray(l) || !l.length) return i();
22085
- if (!d) return;
22086
- const g = d.querySelector(`:scope > ${t}`);
22087
- if (!g) {
22088
- let x = null;
22089
- x = new MutationObserver(() => {
22090
- x == null || x.disconnect(), a();
22091
- }), x.observe(d, { childList: !0, subtree: !0 });
22079
+ }, a = (d) => [...d].sort((g, b) => {
22080
+ const y = g.lastAccessed ?? 0, m = b.lastAccessed ?? 0;
22081
+ return y === m ? 0 : y > m ? -1 : 1;
22082
+ }).map((g, b) => ({ ...g, sidebarView: b < r.sideBarTabs })), c = () => {
22083
+ const d = i.getData("connectors"), g = i.getData("tabElement");
22084
+ if (Yo("setConnectorTabs", d, g), !Array.isArray(d) || !d.length) return s();
22085
+ if (!g) return;
22086
+ const b = g.querySelector(`:scope > ${t}`);
22087
+ if (!b) {
22088
+ let I = null;
22089
+ I = new MutationObserver(() => {
22090
+ I == null || I.disconnect(), c();
22091
+ }), I.observe(g, { childList: !0, subtree: !0 });
22092
22092
  return;
22093
22093
  }
22094
- const b = g.previousElementSibling;
22095
- if (!b) return;
22096
- const y = g.getBoundingClientRect().left, m = b.getBoundingClientRect().right, p = d.getBoundingClientRect().right, f = y - m, h = f + g.clientWidth, v = p - m, C = Math.floor(v / h);
22097
- Yo("calculations", {
22098
- connectorTabLeft: y,
22099
- nonConnectorRight: m,
22100
- tabElementRight: p,
22101
- gap: f,
22102
- tabSpace: h,
22103
- spaceAvailable: v,
22104
- tabsAvailable: C
22105
- });
22106
- const E = l.map((x, I) => {
22107
- const _ = I < C;
22108
- return {
22109
- ...x,
22110
- sidebarView: _
22111
- };
22112
- });
22113
- o.setData(s(E), "connectorTabs");
22114
- }, c = (l) => {
22115
- if (!l) return;
22116
- const d = o.getData("connectorTabs"), g = d == null ? void 0 : d.find((y) => y.id === l);
22117
- if (!g || g.sidebarView) return;
22118
- const b = (/* @__PURE__ */ new Date()).getTime();
22119
- g.lastAccessed = b, o.setData(s(d), "connectorTabs");
22094
+ const y = b.previousElementSibling;
22095
+ if (!y) return;
22096
+ const m = b.getBoundingClientRect().left, p = y.getBoundingClientRect().right, f = g.getBoundingClientRect().right, h = m - p, v = h + b.clientWidth, C = f - p, E = Math.floor(C / v), x = Math.floor((C - n) / v);
22097
+ d.length > E ? r.sideBarTabs = x : r.sideBarTabs = E, Yo("calculations", {
22098
+ connectorTabLeft: m,
22099
+ nonConnectorRight: p,
22100
+ tabElementRight: f,
22101
+ gap: h,
22102
+ tabSpace: v,
22103
+ spaceAvailable: C,
22104
+ tabsAvailable: E,
22105
+ tabsAvailableWithDropdown: x
22106
+ }), i.setData(a(d), "connectorTabs");
22107
+ }, l = (d) => {
22108
+ if (!d) return;
22109
+ const g = i.getData("connectorTabs"), b = g == null ? void 0 : g.find((m) => m.id === d);
22110
+ if (!b || b.sidebarView) return;
22111
+ const y = (/* @__PURE__ */ new Date()).getTime();
22112
+ b.lastAccessed = y, i.setData(a(g), "connectorTabs");
22120
22113
  };
22121
- return o.subscribe(a, "connectors"), o.subscribe(a, "tabElement", !1), o.subscribe(c, "connectorId", !1), Yo("appStore created", o), o;
22114
+ return i.subscribe(c, "connectors"), i.subscribe(c, "tabElement", !1), i.subscribe(l, "connectorId", !1), Yo("appStore created", i), i;
22122
22115
  };
22123
22116
  export {
22124
22117
  JT as ActionQueue,