@ws-ui/store 0.0.34 → 0.0.35

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.es.js CHANGED
@@ -11868,7 +11868,7 @@ const FI = re(
11868
11868
  }), a("failed to create folder");
11869
11869
  }
11870
11870
  }
11871
- ), Qi = async (e, r = !0) => {
11871
+ ), Qi = async (e, r = {}) => {
11872
11872
  try {
11873
11873
  const t = e.path.split(".").at(-1), a = await Qr({
11874
11874
  verb: dt.GET_INFO,
@@ -11880,7 +11880,7 @@ const FI = re(
11880
11880
  }, s = nh(e.path);
11881
11881
  s === V.METHOD && (i.attributes = Cc(a.content), a.content = oh(a.content, {}));
11882
11882
  const { content: c, date: f, ext: l } = a;
11883
- return {
11883
+ return r.confirmed === void 0 && (r.confirmed = !0), {
11884
11884
  date: f,
11885
11885
  view: {
11886
11886
  panel: {
@@ -11891,7 +11891,7 @@ const FI = re(
11891
11891
  },
11892
11892
  flags: {
11893
11893
  enabled: ["WebForm", "MForm"].includes(l),
11894
- confirmed: r
11894
+ confirmed: r.confirmed
11895
11895
  },
11896
11896
  extra: i,
11897
11897
  name: e.name,
@@ -11949,40 +11949,40 @@ const FI = re(
11949
11949
  }
11950
11950
  }, vi = re(
11951
11951
  "explorer/openFile",
11952
- async ({ file: e, inactive: r, flags: t = {} }, { getState: a, dispatch: i }) => {
11952
+ async ({ file: e, inactive: r, isNew: t, flags: a = {} }, { getState: i, dispatch: s }) => {
11953
11953
  const {
11954
- root: { tabs: s },
11955
- roles: c,
11956
- debugger: { sessions: f }
11957
- } = a(), l = s.find(({ path: y }) => e.path === y);
11958
- if (l) {
11959
- const y = {
11960
- ...l,
11954
+ root: { tabs: c },
11955
+ roles: f,
11956
+ debugger: { sessions: l }
11957
+ } = i(), p = c.find(({ path: _ }) => e.path === _);
11958
+ if (p) {
11959
+ const _ = {
11960
+ ...p,
11961
11961
  extra: {
11962
- ...l == null ? void 0 : l.extra,
11962
+ ...p == null ? void 0 : p.extra,
11963
11963
  editor: e.editor
11964
11964
  },
11965
11965
  flags: {
11966
- ...l == null ? void 0 : l.flags,
11967
- ...t
11966
+ ...p == null ? void 0 : p.flags,
11967
+ ...a
11968
11968
  }
11969
11969
  };
11970
- return i(Yt(y)), y;
11970
+ return s(Yt(_)), _;
11971
11971
  }
11972
11972
  if (e.path.startsWith("Debugger")) {
11973
- const y = f.find(
11974
- (_) => `Debugger/${_.threadId}` === e.path
11973
+ const _ = l.find(
11974
+ (w) => `Debugger/${w.threadId}` === e.path
11975
11975
  );
11976
- if (y) {
11976
+ if (_) {
11977
11977
  const {
11978
- source: { content: _ },
11979
- source: w
11980
- } = y.currentStackFrame, S = {
11978
+ source: { content: w },
11979
+ source: S
11980
+ } = _.currentStackFrame, x = {
11981
11981
  name: e.name,
11982
11982
  type: V.DEBUGGER,
11983
11983
  date: (/* @__PURE__ */ new Date()).toISOString(),
11984
11984
  path: e.path,
11985
- content: _,
11985
+ content: w,
11986
11986
  view: {
11987
11987
  panel: {
11988
11988
  isOpen: !1,
@@ -11990,28 +11990,28 @@ const FI = re(
11990
11990
  current: ""
11991
11991
  }
11992
11992
  },
11993
- initialContent: _,
11993
+ initialContent: w,
11994
11994
  flags: { confirmed: !0 },
11995
11995
  extra: {
11996
- source: w,
11996
+ source: S,
11997
11997
  editor: e.editor
11998
11998
  }
11999
11999
  };
12000
- return i(Yt(S)), S;
12000
+ return s(Yt(x)), x;
12001
12001
  }
12002
12002
  }
12003
- let p = null;
12003
+ let h = null;
12004
12004
  try {
12005
- p = await Qi(e, t.confirmed);
12006
- } catch (y) {
12007
- const { data: _ } = y;
12008
- if (_.__ERROR.find(
12009
- (w) => [
12005
+ h = await Qi(e, a);
12006
+ } catch (_) {
12007
+ const { data: w } = _;
12008
+ if (w.__ERROR.find(
12009
+ (S) => [
12010
12010
  Vu.JSON_MALFORMED,
12011
12011
  Vu.JSON_MALFORMED_AT_LINE
12012
- ].includes(w.errCode)
12012
+ ].includes(S.errCode)
12013
12013
  )) {
12014
- const { confirmed: w } = await i(
12014
+ const { confirmed: S } = await s(
12015
12015
  xr({
12016
12016
  title: "Corrupt file",
12017
12017
  type: nr.CONFIRM,
@@ -12019,15 +12019,15 @@ const FI = re(
12019
12019
  message: "Open in code editor ?"
12020
12020
  })
12021
12021
  ).unwrap();
12022
- if (w) {
12023
- const S = await Qr({
12022
+ if (S) {
12023
+ const x = await Qr({
12024
12024
  verb: dt.GET_INFO,
12025
12025
  path: e.path,
12026
12026
  content: !0,
12027
12027
  as: "text"
12028
- }), { content: x, date: I, ext: P } = S;
12029
- p = {
12030
- date: I,
12028
+ }), { content: I, date: P, ext: W } = x;
12029
+ h = {
12030
+ date: P,
12031
12031
  view: {
12032
12032
  panel: {
12033
12033
  isOpen: !1,
@@ -12036,7 +12036,7 @@ const FI = re(
12036
12036
  }
12037
12037
  },
12038
12038
  flags: {
12039
- enabled: ["WebForm", "MForm"].includes(P),
12039
+ enabled: ["WebForm", "MForm"].includes(W),
12040
12040
  confirmed: !0
12041
12041
  },
12042
12042
  extra: {
@@ -12045,23 +12045,28 @@ const FI = re(
12045
12045
  name: e.name,
12046
12046
  path: e.path,
12047
12047
  type: nh(e.path),
12048
- initialContent: x,
12049
- content: x
12048
+ initialContent: I,
12049
+ content: I
12050
12050
  };
12051
12051
  }
12052
12052
  }
12053
12053
  }
12054
- return p && (e.path === It && !c.flags.touched ? i(
12054
+ return h && (e.path === It && !f.flags.touched ? s(
12055
12055
  Ng({
12056
- content: p.content,
12057
- date: p.date
12056
+ content: h.content,
12057
+ date: h.date
12058
12058
  })
12059
- ) : e.path === Vn && i(
12059
+ ) : e.path === Vn && s(
12060
12060
  tf({
12061
12061
  path: "project",
12062
- value: p.content
12062
+ value: h.content
12063
12063
  })
12064
- ), i((r ? _P : Yt)(p)), p);
12064
+ ), s(
12065
+ (r ? _P : Yt)({
12066
+ ...h,
12067
+ isNew: t
12068
+ })
12069
+ ), h);
12065
12070
  }
12066
12071
  ), Wg = re("explorer/openFileAtLine", async ({ file: e }, { getState: r, dispatch: t }) => {
12067
12072
  const { tabs: a } = r().root, i = a.find(({ path: c }) => e.path === c);
@@ -14101,29 +14106,30 @@ const aP = {
14101
14106
  };
14102
14107
  },
14103
14108
  selectTabByReference(e, r) {
14104
- const t = [
14105
- V.DEBUGGER
14106
- ], a = r.payload;
14107
- let i = e.tabs.find(({ path: s }) => a.path === s);
14108
- if ((t.includes(a.type) || i != null && i.flags.confirmed) && (a.flags = {
14109
- ...a.flags,
14110
- confirmed: !0
14111
- }), !i) {
14112
- const s = e.tabs.findIndex(
14113
- ({ flags: { confirmed: c } }) => c === !1
14109
+ const t = [V.DEBUGGER], { isNew: a, ...i } = r.payload;
14110
+ let s = i, c = e.tabs.find(({ path: f }) => s.path === f);
14111
+ if ((t.includes(s.type) || c != null && c.flags.confirmed) && (s = {
14112
+ ...s,
14113
+ flags: {
14114
+ ...s.flags,
14115
+ confirmed: !0
14116
+ }
14117
+ }), !c) {
14118
+ const f = e.tabs.findIndex(
14119
+ ({ flags: { confirmed: l } }) => l === !1
14114
14120
  );
14115
- s !== -1 && !t.includes(a.type) ? e.activeTab === e.tabs[s].path ? (e.tabs[s] = a, i = e.tabs[s]) : (e.tabs.push(a), i = e.tabs[e.tabs.length - 1], e.tabs.splice(s, 1)) : (e.tabs.push(a), i = e.tabs[e.tabs.length - 1]);
14116
- }
14117
- if (e.activeTab !== a.path) {
14118
- const s = e.tabs.reduce((c, f) => (f == null ? void 0 : f.weight) > ((c == null ? void 0 : c.weight) || 0) ? f : c, null);
14119
- e.activeTab = a.path, i.weight = ((s == null ? void 0 : s.weight) || 0) + 1;
14120
- }
14121
- i.extra = {
14122
- ...i.extra,
14123
- ...a.extra
14124
- }, i.flags = {
14125
- ...i.flags || {},
14126
- ...a.flags || {}
14121
+ f !== -1 && !t.includes(s.type) && !a ? e.activeTab === e.tabs[f].path ? (e.tabs[f] = s, c = e.tabs[f]) : (e.tabs.push(s), c = e.tabs[e.tabs.length - 1], e.tabs.splice(f, 1)) : (e.tabs.push(s), c = e.tabs[e.tabs.length - 1]);
14122
+ }
14123
+ if (e.activeTab !== s.path) {
14124
+ const f = e.tabs.reduce((l, p) => (p == null ? void 0 : p.weight) > ((l == null ? void 0 : l.weight) || 0) ? p : l, null);
14125
+ e.activeTab = s.path, c.weight = ((f == null ? void 0 : f.weight) || 0) + 1;
14126
+ }
14127
+ c.extra = {
14128
+ ...c.extra,
14129
+ ...s.extra
14130
+ }, c.flags = {
14131
+ ...c.flags || {},
14132
+ ...s.flags || {}
14127
14133
  };
14128
14134
  },
14129
14135
  setContent(e, r) {
@@ -14617,7 +14623,7 @@ exposed Function ${t.meta.arg.name}()
14617
14623
  },
14618
14624
  reducers: {},
14619
14625
  extraReducers(e) {
14620
- e.addCase(ba.pending, (r) => ({
14626
+ e.addCase(ba.pending, () => ({
14621
14627
  state: "loading"
14622
14628
  })).addCase(ba.fulfilled, (r, { payload: t }) => ({
14623
14629
  state: "loaded",