rc-lib-ui 1.2.15 → 1.2.16-beta.0

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.
Files changed (2) hide show
  1. package/dist/socket.js +151 -146
  2. package/package.json +3 -2
package/dist/socket.js CHANGED
@@ -1,14 +1,14 @@
1
- import './socket.css';var J = Object.defineProperty;
2
- var z = (n, e, t) => e in n ? J(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var r = (n, e, t) => z(n, typeof e != "symbol" ? e + "" : e, t);
1
+ import './socket.css';var z = Object.defineProperty;
2
+ var F = (n, e, t) => e in n ? z(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var r = (n, e, t) => F(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { jsx as D } from "react/jsx-runtime";
5
- import q, { useState as F, useRef as x, useCallback as E, useEffect as I } from "react";
5
+ import N, { useState as B, useRef as x, useCallback as E, useEffect as I } from "react";
6
6
  import { c as U } from "./react-CLnE01WS.js";
7
7
  import { styled as M, Collapse as G } from "@mui/material";
8
- import B from "classnames";
8
+ import L from "classnames";
9
9
  import { u as W } from "./browser-DJTk47DY.js";
10
10
  import { N as $ } from "./index-80JSxasr.js";
11
- const L = {
11
+ const T = {
12
12
  statusConnect: "disconnect",
13
13
  isOfflineSocket: !1,
14
14
  //Текущее состояние сокета. Зависит от события timeOffReConnect и если задаёться isDisableConnectSocket: true
@@ -20,29 +20,29 @@ const L = {
20
20
  isSelectOffline: !1
21
21
  //Для того что бы 2й раз окно не показывать
22
22
  }
23
- }, j = JSON.parse(JSON.stringify(L)), R = U(() => L), h = {
24
- resetState: () => R.setState(j),
25
- setStatusConnectSocket: ({ statusConnect: n }) => R.setState({ statusConnect: n }),
26
- setStatusIsReConnectSocket: ({ isReConnectSocket: n }) => R.setState({ isReConnectSocket: n }),
27
- setStatusReady: ({ isReadySocket: n }) => R.setState({ isReadySocket: n }),
28
- setIsOfflineSocket: ({ isOfflineSocket: n }) => R.setState({ isOfflineSocket: n }),
29
- setInfoNoConnectServer: (n) => R.setState((e) => ({ infoNoConnectServer: { ...e.infoNoConnectServer, ...n } })),
30
- setIsDisableConnectSocket: ({ isDisableConnectSocket: n }) => R.setState({ isDisableConnectSocket: n })
31
- }, b = {
23
+ }, j = JSON.parse(JSON.stringify(T)), b = U(() => T), R = {
24
+ resetState: () => b.setState(j),
25
+ setStatusConnectSocket: ({ statusConnect: n }) => b.setState({ statusConnect: n }),
26
+ setStatusIsReConnectSocket: ({ isReConnectSocket: n }) => b.setState({ isReConnectSocket: n }),
27
+ setStatusReady: ({ isReadySocket: n }) => b.setState({ isReadySocket: n }),
28
+ setIsOfflineSocket: ({ isOfflineSocket: n }) => b.setState({ isOfflineSocket: n }),
29
+ setInfoNoConnectServer: (n) => b.setState((e) => ({ infoNoConnectServer: { ...e.infoNoConnectServer, ...n } })),
30
+ setIsDisableConnectSocket: ({ isDisableConnectSocket: n }) => b.setState({ isDisableConnectSocket: n })
31
+ }, g = {
32
32
  getStatusConnectSocket: (n) => n.statusConnect,
33
33
  getStatusIsReConnectSocket: (n) => n.isReConnectSocket,
34
34
  getStatusReady: (n) => n.isReadySocket,
35
35
  getIsOfflineSocket: (n) => n.isOfflineSocket,
36
36
  getInfoNoConnectServer: (n) => n.infoNoConnectServer,
37
37
  getIsDisableConnectSocket: (n) => n.isDisableConnectSocket
38
- }, g = (n) => R(n), K = M("span")({
38
+ }, k = (n) => b(n), K = M("span")({
39
39
  backgroundColor: "rgba(0,0,0,0.3)",
40
40
  color: "#fff",
41
41
  display: "flex",
42
42
  alignItems: "center",
43
43
  padding: "1px 10px",
44
44
  borderRadius: "3px 3px 3px 3px"
45
- }), T = M(
45
+ }), P = M(
46
46
  ({ children: n, ...e }) => /* @__PURE__ */ D(G, { ...e, unmountOnExit: !0, children: /* @__PURE__ */ D(K, { children: n }) })
47
47
  )(({ theme: n }) => ({
48
48
  fontSize: 10,
@@ -65,7 +65,7 @@ const L = {
65
65
  connectServerAnim: Q,
66
66
  "loading-stripes": "_loading-stripes_1lp7f_1",
67
67
  loadingStripes: V
68
- }, Y = M(T, {
68
+ }, Y = M(P, {
69
69
  shouldForwardProp: (n) => ![""].includes(n)
70
70
  })(({ theme: n }) => ({
71
71
  top: "100%",
@@ -76,54 +76,54 @@ const L = {
76
76
  height: "100%"
77
77
  }
78
78
  })), Z = ({ text: n = "Происходит подключение к серверу", className: e, ...t }) => {
79
- const o = g(b.getStatusConnectSocket), i = g(b.getStatusIsReConnectSocket);
79
+ const o = k(g.getStatusConnectSocket), i = k(g.getStatusIsReConnectSocket);
80
80
  return /* @__PURE__ */ D(
81
81
  Y,
82
82
  {
83
83
  in: o === "pending" || i,
84
84
  collapsedSize: "1px",
85
- className: B(X["connect-server-anim"], e),
85
+ className: L(X["connect-server-anim"], e),
86
86
  unmountOnExit: !0,
87
87
  ...t,
88
88
  children: n
89
89
  }
90
90
  );
91
- }, _ = q.memo(Z);
91
+ }, _ = N.memo(Z);
92
92
  class ee {
93
93
  constructor() {
94
94
  r(this, "defaultProps", {
95
95
  interval: 5e3
96
96
  });
97
97
  r(this, "startActionEvery", (e, t = this.defaultProps) => {
98
- const o = (u) => {
99
- t != null && t.watchIdInterval && (t == null || t.watchIdInterval(u));
100
- }, i = (u) => {
101
- t != null && t.controlAction && (t == null || t.controlAction(u));
98
+ const o = (S) => {
99
+ t != null && t.watchIdInterval && (t == null || t.watchIdInterval(S));
100
+ }, i = (S) => {
101
+ t != null && t.controlAction && (t == null || t.controlAction(S));
102
102
  };
103
- let c = !0, a, l, S;
104
- const f = (u = !0) => {
105
- const C = "Ручное завершение startActionEvery";
106
- c = !1, clearInterval(a), o(null), u ? l && l({ status: u, msg: C + ": (true)" }) : S && S({ status: u, msg: C + ": (false)" });
103
+ let c = !0, a, u, p;
104
+ const l = (S = !0) => {
105
+ const d = "Ручное завершение startActionEvery";
106
+ c = !1, clearInterval(a), o(null), S ? u && u({ status: S, msg: d + ": (true)" }) : p && p({ status: S, msg: d + ": (false)" });
107
107
  };
108
108
  return {
109
- promise: new Promise((u, C) => {
110
- l = u, S = C;
111
- let O = 0, d = 0;
109
+ promise: new Promise((S, d) => {
110
+ u = S, p = d;
111
+ let m = 0, f = 0;
112
112
  a = setInterval(
113
113
  () => {
114
- if (O += t.interval, d += 1, t != null && t.cutoffTime && O > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < d) {
115
- c = !1, clearInterval(a), o(null), C({ status: !1, msg: Error("Время загрузки истекло") });
114
+ if (m += t.interval, f += 1, t != null && t.cutoffTime && m > t.cutoffTime || t != null && t.countAction && (t == null ? void 0 : t.countAction) < f) {
115
+ c = !1, clearInterval(a), o(null), d({ status: !1, msg: Error("Время загрузки истекло") });
116
116
  return;
117
117
  }
118
- e() && (c = !1, clearInterval(a), o(null), u({ status: !0, msg: "cb вернул true" }));
118
+ e() && (c = !1, clearInterval(a), o(null), S({ status: !0, msg: "cb вернул true" }));
119
119
  },
120
120
  t.interval < 200 ? 200 : t.interval
121
121
  ), o(a), i({
122
122
  getIsActiveEvent: () => c,
123
- stop: f
123
+ stop: l
124
124
  });
125
125
  }),
126
- stop: f
126
+ stop: l
127
127
  };
128
128
  });
129
129
  r(this, "oneOf", (e, t, { second: o }) => {
@@ -136,26 +136,26 @@ class ee {
136
136
  }, o * 1e3);
137
137
  });
138
138
  r(this, "oneOfPromise", (e, t, { second: o }) => new Promise((i, c) => {
139
- let a = 1, l = { status: !1, msg: "" };
140
- e().then((f) => {
141
- a === 1 && (a = 0, i(f));
142
- }).catch((f) => {
143
- a === 1 && (a = 0, l.msg = f, c(f));
139
+ let a = 1, u = { status: !1, msg: "" };
140
+ e().then((l) => {
141
+ a === 1 && (a = 0, i(l));
142
+ }).catch((l) => {
143
+ a === 1 && (a = 0, u.msg = l, c(l));
144
144
  });
145
- let S = setInterval(() => {
145
+ let p = setInterval(() => {
146
146
  if (a === 1) {
147
147
  if (a = 0, typeof t == "function") {
148
- c({ status: !1, msg: "", ...t(l) });
148
+ c({ status: !1, msg: "", ...t(u) });
149
149
  return;
150
150
  }
151
151
  c({ status: !1, msg: "oneOfPromise reject" });
152
152
  }
153
- clearInterval(S);
153
+ clearInterval(p);
154
154
  }, o * 1e3);
155
155
  }));
156
156
  }
157
157
  }
158
- class P {
158
+ class H {
159
159
  constructor(e) {
160
160
  r(this, "subscribersEvents", {});
161
161
  r(this, "getListNameEvents", () => Object.keys(this.subscribersEvents));
@@ -197,7 +197,7 @@ class te {
197
197
  arrSaveReq: []
198
198
  });
199
199
  r(this, "initOptions", !1);
200
- r(this, "events", new P(["status", "msg", "error"]));
200
+ r(this, "events", new H(["status", "msg", "error"]));
201
201
  r(this, "stateDefault", this.copyState(this.state));
202
202
  r(this, "eventListener", (e) => {
203
203
  var o, i;
@@ -208,8 +208,8 @@ class te {
208
208
  ["error", this.errHandler]
209
209
  ];
210
210
  for (let c = 0; c < t.length; c++) {
211
- const [a, l] = t[c];
212
- e === "add" ? (o = this.state.ws) == null || o.addEventListener(a, l) : (i = this.state.ws) == null || i.removeEventListener(a, l);
211
+ const [a, u] = t[c];
212
+ e === "add" ? (o = this.state.ws) == null || o.addEventListener(a, u) : (i = this.state.ws) == null || i.removeEventListener(a, u);
213
213
  }
214
214
  });
215
215
  r(this, "openHandler", () => {
@@ -223,8 +223,8 @@ class te {
223
223
  try {
224
224
  const { action: o } = t, i = this.findDataRequestByAction(o);
225
225
  if (i) {
226
- const { cb: c, ...a } = i, { payload: l, ...S } = a;
227
- this.events.publish("msg", { ...t, request: { ...S, ...l } });
226
+ const { cb: c, ...a } = i, { payload: u, ...p } = a;
227
+ this.events.publish("msg", { ...t, request: { ...p, ...u } });
228
228
  } else
229
229
  this.events.publish("msg", t);
230
230
  o && this.filterSaveItemsByResponse(t);
@@ -342,8 +342,8 @@ const s = class s {
342
342
  payload: { action: o, ...i },
343
343
  cb: t
344
344
  });
345
- const l = s.wsApi.getSocket();
346
- if (!l || l.readyState !== 1) {
345
+ const u = s.wsApi.getSocket();
346
+ if (!u || u.readyState !== 1) {
347
347
  console.log("Нет подключения к сокету. Запрос сохранён в setRequestSave");
348
348
  return;
349
349
  }
@@ -354,40 +354,40 @@ const s = class s {
354
354
  }
355
355
  static async request(e, t = {}) {
356
356
  return new Promise((o, i) => {
357
- var d, k;
358
- if ((d = t == null ? void 0 : t.signal) != null && d.aborted) {
357
+ var f, w;
358
+ if ((f = t == null ? void 0 : t.signal) != null && f.aborted) {
359
359
  i(new DOMException("Aborted", "AbortError"));
360
360
  return;
361
361
  }
362
- const c = e.action, a = e.request_id ? e.request_id : W(), l = Date.now();
362
+ const c = e.action, a = e.request_id ? e.request_id : W(), u = Date.now();
363
363
  s.wsApi.setRequestSave({
364
364
  requestAction: c,
365
365
  request_id: a,
366
- requestTime: l,
366
+ requestTime: u,
367
367
  payload: e,
368
368
  cb: void 0
369
369
  });
370
- let S;
371
- t != null && t.timeout && (S = setTimeout(() => {
372
- C(), i(new Error("Request timeout"));
370
+ let p;
371
+ t != null && t.timeout && (p = setTimeout(() => {
372
+ d(), i(new Error("Request timeout"));
373
373
  }, t.timeout));
374
- const f = (v) => {
375
- C(), i(v);
376
- }, p = (v) => {
374
+ const l = (v) => {
375
+ d(), i(v);
376
+ }, h = (v) => {
377
377
  var A;
378
- const y = this.wsApi.findDataRequestByAction(c);
379
- !y || ((A = v == null ? void 0 : v.request) == null ? void 0 : A.requestAction) !== y.requestAction || (C(), o({ ...v }));
380
- }, u = () => {
381
- C(), i(new DOMException("Aborted", "AbortError"));
382
- }, C = () => {
378
+ const O = this.wsApi.findDataRequestByAction(c);
379
+ !O || ((A = v == null ? void 0 : v.request) == null ? void 0 : A.requestAction) !== O.requestAction || (d(), o({ ...v }));
380
+ }, S = () => {
381
+ d(), i(new DOMException("Aborted", "AbortError"));
382
+ }, d = () => {
383
383
  var v;
384
- s.off("msg", p), s.off("error", f), S && clearTimeout(S), (v = t == null ? void 0 : t.signal) == null || v.removeEventListener("abort", u);
384
+ s.off("msg", h), s.off("error", l), p && clearTimeout(p), (v = t == null ? void 0 : t.signal) == null || v.removeEventListener("abort", S);
385
385
  };
386
- s.on("msg", p), s.on("error", f), (k = t == null ? void 0 : t.signal) == null || k.addEventListener("abort", u);
387
- const O = s.wsApi.getSocket();
388
- if (!O || O.readyState !== 1) {
386
+ s.on("msg", h), s.on("error", l), (w = t == null ? void 0 : t.signal) == null || w.addEventListener("abort", S);
387
+ const m = s.wsApi.getSocket();
388
+ if (!m || m.readyState !== 1) {
389
389
  const v = "Нет подключения к сокету";
390
- console.error(v), C(), i(new Error(v));
390
+ console.error(v), d(), i(new Error(v));
391
391
  return;
392
392
  }
393
393
  s.wsApi.send(e);
@@ -404,7 +404,7 @@ r(s, "state", {
404
404
  }), r(s, "options", {
405
405
  isReConnectNetworkOnline: !1,
406
406
  listUrlsCheckConnectNetwork: ["https://jsonplaceholder.typicode.com/posts/1"]
407
- }), r(s, "wsApi", new te()), r(s, "delay", new ee()), r(s, "networkTicker", null), r(s, "events", new P(["timeOffReConnect", "reConnect", "network"])), r(s, "saveID", {
407
+ }), r(s, "wsApi", new te()), r(s, "delay", new ee()), r(s, "networkTicker", null), r(s, "events", new H(["timeOffReConnect", "reConnect", "network"])), r(s, "saveID", {
408
408
  idReConnect: null,
409
409
  checkConnect: null
410
410
  }), r(s, "stateDefault", s.copyState(s.state)), r(s, "setInfoConnect", (e) => {
@@ -453,7 +453,7 @@ r(s, "socketReConnect", () => {
453
453
  watchIdInterval: (a) => {
454
454
  s.saveID.idReConnect = a;
455
455
  },
456
- controlAction: ({ stop: a, getIsActiveEvent: l }) => {
456
+ controlAction: ({ stop: a, getIsActiveEvent: u }) => {
457
457
  s.stopReConnect = a;
458
458
  }
459
459
  }
@@ -468,98 +468,103 @@ r(s, "socketReConnect", () => {
468
468
  });
469
469
  }
470
470
  });
471
- let m = s;
471
+ let C = s;
472
472
  const se = (n, e = {}) => {
473
- const t = n.action, { skip: o = !1, timeout: i = 5e3 } = e, [c, a] = F({
473
+ const t = n.action, { skip: o = !1, timeout: i = 5e3 } = e, [c, a] = B({
474
474
  data: null,
475
475
  error: "",
476
476
  isLoading: !1,
477
477
  isError: !1,
478
478
  isSuccess: !1
479
- }), l = g(b.getStatusReady), S = g(b.getStatusConnectSocket), f = x(null), p = x(e);
480
- p.current = e;
481
- const u = E(async () => {
482
- var k, v, y, A;
479
+ }), u = k(g.getStatusReady), p = k(g.getStatusConnectSocket), l = x(null), h = x(e);
480
+ h.current = e;
481
+ const S = E(async () => {
482
+ var w, v, O, A;
483
483
  if (o) return;
484
- a((w) => ({
485
- ...w,
484
+ a((y) => ({
485
+ ...y,
486
486
  isLoading: !0,
487
487
  isError: !1,
488
488
  isSuccess: !1,
489
489
  error: "",
490
490
  data: null
491
- })), f.current = new AbortController();
492
- const d = f.current.signal;
491
+ })), l.current = new AbortController();
492
+ const f = l.current.signal;
493
493
  try {
494
- const w = await m.request(n, { timeout: i, signal: d });
495
- if (d.aborted) return;
496
- a((N) => ({
497
- ...N,
498
- data: w,
494
+ const y = await C.request(n, { timeout: i, signal: f });
495
+ if (f.aborted) return;
496
+ a((q) => ({
497
+ ...q,
498
+ data: y,
499
499
  isSuccess: !0,
500
500
  isLoading: !1
501
- })), (v = (k = p.current).onSuccess) == null || v.call(k, w);
502
- } catch (w) {
503
- if (d.aborted) return;
504
- const N = w instanceof Error ? w.message : String(w);
505
- a((H) => ({
506
- ...H,
507
- error: N,
501
+ })), (v = (w = h.current).onSuccess) == null || v.call(w, y);
502
+ } catch (y) {
503
+ if (f.aborted) return;
504
+ const q = y instanceof Error ? y.message : String(y);
505
+ a((J) => ({
506
+ ...J,
507
+ error: q,
508
508
  isError: !0,
509
509
  isLoading: !1
510
- })), (A = (y = p.current).onError) == null || A.call(y, N);
510
+ })), (A = (O = h.current).onError) == null || A.call(O, q);
511
511
  }
512
512
  }, [o, t, n, i]);
513
- I(() => (!o && l && u(), () => {
514
- var d;
515
- (d = f.current) == null || d.abort();
516
- }), [u, o, l]), I(() => {
517
- !l && S === "pending" && a((d) => ({
518
- ...d,
513
+ I(() => (!o && u && S(), () => {
514
+ var f;
515
+ (f = l.current) == null || f.abort();
516
+ }), [S, o, u]), I(() => {
517
+ !u && p === "pending" && a((f) => ({
518
+ ...f,
519
519
  isError: !1,
520
520
  isSuccess: !1,
521
521
  error: "Потеряно соединение с сервером"
522
522
  }));
523
- }, [l, S]);
524
- const C = E(() => {
525
- var d;
526
- return (d = f.current) == null || d.abort(), u();
527
- }, [u]), O = E(() => {
528
- var d;
529
- (d = f.current) == null || d.abort(), a((k) => ({ ...k, isLoading: !1 }));
523
+ }, [u, p]);
524
+ const d = E(() => {
525
+ var f;
526
+ return (f = l.current) == null || f.abort(), S();
527
+ }, [S]), m = E(() => {
528
+ var f;
529
+ (f = l.current) == null || f.abort(), a((w) => ({ ...w, isLoading: !1 }));
530
530
  }, []);
531
531
  return {
532
532
  ...c,
533
- refetch: C,
534
- abort: O
533
+ refetch: d,
534
+ abort: m
535
535
  };
536
536
  }, be = (n, e) => se(n, e), ne = (n) => {
537
- const { isNetwork: e, typeNetwork: t } = n, { isModal: o } = g(b.getInfoNoConnectServer), i = g(b.getStatusIsReConnectSocket), c = g(b.getIsDisableConnectSocket), a = g(b.getStatusConnectSocket);
538
- return I(() => (m.init(n.init), typeof n.onMount == "function" && n.onMount(), m.on("status", (l) => {
539
- const S = R.getState(), { isReadySocket: f, infoNoConnectServer: { isModal: p }, isOfflineSocket: u } = S;
540
- l !== "ready" && f && h.setStatusReady({ isReadySocket: !1 }), !f && l === "ready" && (h.setStatusReady({ isReadySocket: !0 }), p && u && (console.log("Вырубаем модалку т.к. сокет законектился после окончания timeOffReConnect"), h.setInfoNoConnectServer({ isModal: !1 }), h.setIsOfflineSocket({ isOfflineSocket: !1 }))), h.setStatusConnectSocket({ statusConnect: l });
541
- }), m.on("error", (l) => {
537
+ const { isNetwork: e, typeNetwork: t } = n, { isModal: o } = k(g.getInfoNoConnectServer), i = k(g.getStatusIsReConnectSocket), c = k(g.getIsDisableConnectSocket), a = k(g.getStatusConnectSocket), [u, p] = B({
538
+ isNetwork: !1,
539
+ typeNetwork: ""
540
+ });
541
+ return console.group("InitializationSocket (Проверка внутреннего и внешнего статуса network)"), console.log("props:>>", n), console.log("networkState:>>", u), console.groupEnd(), I(() => (C.init(n.init), typeof n.onMount == "function" && n.onMount(), C.on("network", (l) => {
542
+ console.log("network: ", l), p({ isNetwork: l.isNetwork, typeNetwork: l.typeNetwork });
543
+ }), C.on("status", (l) => {
544
+ const h = b.getState(), { isReadySocket: S, infoNoConnectServer: { isModal: d }, isOfflineSocket: m } = h;
545
+ l !== "ready" && S && R.setStatusReady({ isReadySocket: !1 }), !S && l === "ready" && (R.setStatusReady({ isReadySocket: !0 }), d && m && (console.log("Вырубаем модалку т.к. сокет законектился после окончания timeOffReConnect"), R.setInfoNoConnectServer({ isModal: !1 }), R.setIsOfflineSocket({ isOfflineSocket: !1 }))), R.setStatusConnectSocket({ statusConnect: l });
546
+ }), C.on("error", (l) => {
542
547
  console.log("error: ", l);
543
- }), m.on("reConnect", (l) => {
548
+ }), C.on("reConnect", (l) => {
544
549
  console.log('on"reConnect" (status): ', l);
545
- const S = R.getState(), { isReConnectSocket: f, infoNoConnectServer: { isModal: p } } = S;
546
- f !== l && h.setStatusIsReConnectSocket({ isReConnectSocket: l }), p && l && h.setInfoNoConnectServer({ isModal: !1 });
547
- }), m.on("timeOffReConnect", (l) => {
548
- if (console.log("timeOffReConnect: ", l), h.setIsOfflineSocket({ isOfflineSocket: !l.status }), !l.status) {
549
- const S = R.getState(), { infoNoConnectServer: { isModal: f, isSelectOffline: p } } = S;
550
- let u = !1;
551
- !f && !p && (u = !0), u && h.setInfoNoConnectServer({ isModal: u });
550
+ const h = b.getState(), { isReConnectSocket: S, infoNoConnectServer: { isModal: d } } = h;
551
+ S !== l && R.setStatusIsReConnectSocket({ isReConnectSocket: l }), d && l && R.setInfoNoConnectServer({ isModal: !1 });
552
+ }), C.on("timeOffReConnect", (l) => {
553
+ if (console.log("timeOffReConnect: ", l), R.setIsOfflineSocket({ isOfflineSocket: !l.status }), !l.status) {
554
+ const h = b.getState(), { infoNoConnectServer: { isModal: S, isSelectOffline: d } } = h;
555
+ let m = !1;
556
+ !S && !d && (m = !0), m && R.setInfoNoConnectServer({ isModal: m });
552
557
  }
553
- }), m.connect(), () => {
554
- typeof n.onUnmount == "function" && n.onUnmount(), console.dir("disconnect"), m.disconnect();
558
+ }), C.connect(), () => {
559
+ typeof n.onUnmount == "function" && n.onUnmount(), console.dir("disconnect"), C.disconnect();
555
560
  }), []), I(() => {
556
- e && !c && !o && !i && ["close"].includes(a) && t !== "none" && (console.log("Запущен socketReConnect"), m.socketReConnect());
561
+ e && !c && !o && !i && ["close"].includes(a) && t !== "none" && (console.log("Запущен socketReConnect"), C.socketReConnect());
557
562
  }, [c, o, i, a, t, e]), I(() => {
558
- i && (!e || a === "ready") && (console.log("Запущен stopReConnect"), m.stopReConnect());
563
+ i && (!e || a === "ready") && (console.log("Запущен stopReConnect"), C.stopReConnect());
559
564
  }, [i, e, a]), I(() => {
560
- c && (console.log("isDisableConnectSocket: ", c), h.setIsOfflineSocket({ isOfflineSocket: !0 }), m.close());
565
+ c && (console.log("isDisableConnectSocket: ", c), R.setIsOfflineSocket({ isOfflineSocket: !0 }), C.close());
561
566
  }, [c]), null;
562
- }, oe = q.memo(ne), ie = M(T, {
567
+ }, oe = N.memo(ne), ie = M(P, {
563
568
  shouldForwardProp: (n) => ![""].includes(n)
564
569
  })(({ theme: n }) => ({
565
570
  bottom: "100%",
@@ -570,42 +575,42 @@ const se = (n, e = {}) => {
570
575
  padding: "1px 10px"
571
576
  }
572
577
  })), re = ({ children: n, className: e, isNetwork: t, ...o }) => {
573
- const i = g(b.getIsOfflineSocket), c = g(b.getIsDisableConnectSocket), a = i || !t, l = "Оффлайн";
578
+ const i = k(g.getIsOfflineSocket), c = k(g.getIsDisableConnectSocket), a = i || !t, u = "Оффлайн";
574
579
  return /* @__PURE__ */ D(
575
580
  ie,
576
581
  {
577
582
  in: a,
578
- className: B("socket-offline", e),
583
+ className: L("socket-offline", e),
579
584
  ...o,
580
- children: typeof n == "function" ? n({ isDisableConnectSocket: c }) : c ? `Режим ${l}` : l
585
+ children: typeof n == "function" ? n({ isDisableConnectSocket: c }) : c ? `Режим ${u}` : u
581
586
  }
582
587
  );
583
- }, ce = q.memo(re), ae = ({ children: n }) => {
588
+ }, ce = N.memo(re), ae = ({ children: n }) => {
584
589
  const e = E(() => {
585
- h.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !1 });
590
+ R.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !1 });
586
591
  }, []);
587
592
  return n({ reConnect: e });
588
- }, le = q.memo(ae), ue = ({ children: n }) => {
593
+ }, le = N.memo(ae), ue = ({ children: n }) => {
589
594
  const e = E(() => {
590
- h.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !0 }), h.setIsDisableConnectSocket({ isDisableConnectSocket: !0 });
595
+ R.setInfoNoConnectServer({ isModal: !1, isSelectOffline: !0 }), R.setIsDisableConnectSocket({ isDisableConnectSocket: !0 });
591
596
  }, []);
592
597
  return n({ offlineActive: e });
593
- }, fe = q.memo(ue), ge = {
598
+ }, Se = N.memo(ue), ge = {
594
599
  ConnectDetection: _,
595
600
  OfflineDetection: ce,
596
601
  Buttons: {
597
- OfflineActive: fe,
602
+ OfflineActive: Se,
598
603
  ReConnect: le
599
604
  },
600
605
  Initialization: oe
601
606
  };
602
607
  export {
603
608
  ge as Socket,
604
- m as SocketApi,
609
+ C as SocketApi,
605
610
  be as createRequestSocketApi,
606
- h as socketActions,
607
- b as socketSelectors,
608
- R as socketStore,
611
+ R as socketActions,
612
+ g as socketSelectors,
613
+ b as socketStore,
609
614
  se as useRequestSocketApi,
610
- g as useSocketSelector
615
+ k as useSocketSelector
611
616
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rc-lib-ui",
3
3
  "private": false,
4
- "version": "1.2.15",
4
+ "version": "1.2.16-beta.0",
5
5
  "author": "SinGlEBW",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -55,7 +55,8 @@
55
55
  "build": "tsc --project tsconfig.prod.json && vite build",
56
56
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
57
57
  "preview": "vite preview",
58
- "send": "node publishVersion.js"
58
+ "send": "node publishVersion.js",
59
+ "build:dev": "node buildEditVersion.js"
59
60
  },
60
61
  "dependencies": {
61
62
  "dev-classes": "^1.5.2",