@dao42/d42paas-front 0.5.40 → 0.5.48

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.
@@ -14918,13 +14918,6 @@ const oTStore = create$3((set2) => ({
14918
14918
  client: null,
14919
14919
  senders: [],
14920
14920
  doc: {},
14921
- fileTree: {
14922
- data: {
14923
- type: "DIRECTORY",
14924
- name: "/",
14925
- children: []
14926
- }
14927
- },
14928
14921
  isRecording: false,
14929
14922
  CRDTInfo: {
14930
14923
  operation: [],
@@ -14975,9 +14968,6 @@ const oTStore = create$3((set2) => ({
14975
14968
  switchDoc: (arg) => set2(() => ({
14976
14969
  doc: arg
14977
14970
  })),
14978
- switchDocTree: (arg) => set2(() => ({
14979
- fileTree: arg
14980
- })),
14981
14971
  setSenders: (arg) => set2(() => ({
14982
14972
  senders: arg
14983
14973
  })),
@@ -15031,6 +15021,15 @@ const oTStore = create$3((set2) => ({
15031
15021
  asyncType: arg
15032
15022
  }))
15033
15023
  }));
15024
+ const fileTreeStore = create$3(persist((set2) => ({
15025
+ fileTree: {},
15026
+ switchFileTree: (arg) => set2(() => ({
15027
+ fileTree: arg
15028
+ }))
15029
+ }), {
15030
+ name: "fileTree",
15031
+ getStorage: () => localStorage
15032
+ }));
15034
15033
  const userStore = create$3(persist((set2) => ({
15035
15034
  userInfo: {},
15036
15035
  setUserInfo: (arg) => set2(() => ({
@@ -27258,6 +27257,9 @@ const PlaygroundInit = (arg) => {
27258
27257
  reactDom.exports.unstable_batchedUpdates(() => {
27259
27258
  const setUserInfo = userStore.getState().setUserInfo;
27260
27259
  const setUserList = userListStore.getState().setUserList;
27260
+ const {
27261
+ switchFileTree
27262
+ } = fileTreeStore.getState();
27261
27263
  const {
27262
27264
  switchDoc,
27263
27265
  setSenders,
@@ -27265,7 +27267,6 @@ const PlaygroundInit = (arg) => {
27265
27267
  setAsyncType,
27266
27268
  setServerAck,
27267
27269
  setCustomAck,
27268
- switchDocTree,
27269
27270
  setPlaygroundInfo,
27270
27271
  setDockerInfo,
27271
27272
  setQueryObject,
@@ -27312,9 +27313,6 @@ const PlaygroundInit = (arg) => {
27312
27313
  avatar: avatarGenerator(lodash$2.exports.random(0, 6), userData.uuid)
27313
27314
  }), "coUsers");
27314
27315
  setUserInfo(originUser);
27315
- if (oTStore.getState().playgroundStatus === "INACTIVE") {
27316
- io == null ? void 0 : io.emit("active");
27317
- }
27318
27316
  }
27319
27317
  const userInfoList = [originUser, ...userData.coUsers.filter((f2) => f2.uuid !== originUser.uuid).map((user) => {
27320
27318
  return __spreadProps(__spreadValues({}, user), {
@@ -27332,7 +27330,7 @@ const PlaygroundInit = (arg) => {
27332
27330
  } = JSON.parse(data);
27333
27331
  setPlaygroundInfo(playgroundInfo);
27334
27332
  setDockerInfo(__spreadValues(__spreadValues({}, oTStore.getState().dockerInfo), dockerInfo));
27335
- dockerInfo.fileTree && switchDocTree({
27333
+ dockerInfo.fileTree && switchFileTree({
27336
27334
  data: dockerInfo.fileTree
27337
27335
  });
27338
27336
  setCRDTInfo(crdt);
@@ -27407,7 +27405,7 @@ const PlaygroundInit = (arg) => {
27407
27405
  });
27408
27406
  io.on("fileNode", (data) => {
27409
27407
  const res = JSON.parse(data);
27410
- switchDocTree({
27408
+ switchFileTree({
27411
27409
  data: res
27412
27410
  });
27413
27411
  });
@@ -29466,15 +29464,17 @@ const REPLAY_INTERVAL = 250;
29466
29464
  let timer;
29467
29465
  let timeOutT;
29468
29466
  const replayHandler = async () => {
29467
+ const {
29468
+ switchFileTree
29469
+ } = fileTreeStore.getState();
29469
29470
  const {
29470
29471
  setAppStatus,
29471
29472
  switchDoc,
29472
- switchDocTree,
29473
29473
  setCRDTInfo,
29474
29474
  dockerInfo,
29475
29475
  doc
29476
29476
  } = oTStore.getState();
29477
- switchDocTree == null ? void 0 : switchDocTree({
29477
+ switchFileTree == null ? void 0 : switchFileTree({
29478
29478
  data: dockerInfo.fileTree
29479
29479
  });
29480
29480
  const crdts = await getLocalCRDTs();
@@ -40733,14 +40733,23 @@ const CmdKey = () => {
40733
40733
  }
40734
40734
  },
40735
40735
  {
40736
- id: "doc",
40737
- title: "\u6587\u6863",
40736
+ id: "storybook",
40737
+ title: "storybook",
40738
40738
  hotkey: "d",
40739
40739
  mdIcon: "description",
40740
40740
  handler: () => {
40741
40741
  window.open("https://develop.1024paas.com/storybook");
40742
40742
  }
40743
40743
  },
40744
+ {
40745
+ id: "tsdoc",
40746
+ title: "TS\u6587\u6863",
40747
+ hotkey: "t",
40748
+ mdIcon: "highlight",
40749
+ handler: () => {
40750
+ window.open("https://develop.1024paas.com/tsdoc");
40751
+ }
40752
+ },
40744
40753
  {
40745
40754
  id: "clearCache",
40746
40755
  title: "\u6E05\u9664\u7F13\u5B58",
@@ -40864,13 +40873,14 @@ const LazyPageComponent = lazy$2(async () => await Promise.resolve().then(functi
40864
40873
  }));
40865
40874
  class DaoPaaS {
40866
40875
  constructor({
40876
+ mode,
40867
40877
  ticket,
40868
40878
  playgroundId,
40869
40879
  userId,
40870
40880
  tenantId,
40871
40881
  username,
40872
- env: env2 = "develop",
40873
- components
40882
+ components,
40883
+ env: env2 = "develop"
40874
40884
  }) {
40875
40885
  __publicField(this, "shellDOM");
40876
40886
  __publicField(this, "editorDOM");
@@ -40885,6 +40895,8 @@ class DaoPaaS {
40885
40895
  __publicField(this, "io");
40886
40896
  __publicField(this, "env");
40887
40897
  __publicField(this, "components");
40898
+ __publicField(this, "mode");
40899
+ this.mode = mode;
40888
40900
  this.ticket = ticket;
40889
40901
  this.playgroundId = playgroundId;
40890
40902
  this.userId = userId;
@@ -40901,10 +40913,18 @@ class DaoPaaS {
40901
40913
  get playgroundStatus() {
40902
40914
  return this.otstore.playgroundStatus;
40903
40915
  }
40916
+ get dockerStatus() {
40917
+ return this.otstore.dockerStatus;
40918
+ }
40904
40919
  get ignoreReplayers() {
40905
40920
  return ignoreReplayerStore.getState().ignoreReplayers;
40906
40921
  }
40922
+ get userList() {
40923
+ return userListStore.getState().userList;
40924
+ }
40907
40925
  async init() {
40926
+ if (this.mode === "tsdoc")
40927
+ return;
40908
40928
  const {
40909
40929
  setSocket,
40910
40930
  socket: socket2
@@ -41022,36 +41042,40 @@ class DaoPaaS {
41022
41042
  }
41023
41043
  }
41024
41044
  mapRender(components) {
41025
- components == null ? void 0 : components.forEach((comp, index2) => {
41026
- switch (comp.item) {
41045
+ components == null ? void 0 : components.forEach(({
41046
+ container,
41047
+ props: props2,
41048
+ item
41049
+ }, _index) => {
41050
+ switch (item) {
41027
41051
  case "Tree":
41028
41052
  this.Tree({
41029
- container: comp.item,
41030
- props: comp.props
41053
+ container,
41054
+ props: props2
41031
41055
  });
41032
41056
  break;
41033
41057
  case "Editor":
41034
41058
  this.Editor({
41035
- container: comp.item,
41036
- props: comp.props
41059
+ container,
41060
+ props: props2
41037
41061
  });
41038
41062
  break;
41039
41063
  case "Console":
41040
41064
  this.Console({
41041
- container: comp.item,
41042
- props: comp.props
41065
+ container,
41066
+ props: props2
41043
41067
  });
41044
41068
  break;
41045
41069
  case "Browser":
41046
41070
  this.Browser({
41047
- container: comp.item,
41048
- props: comp.props
41071
+ container,
41072
+ props: props2
41049
41073
  });
41050
41074
  break;
41051
41075
  case "Shell":
41052
41076
  this.Shell({
41053
- container: comp.item,
41054
- props: comp.props
41077
+ container,
41078
+ props: props2
41055
41079
  });
41056
41080
  break;
41057
41081
  }
@@ -41120,10 +41144,7 @@ class DaoPaaS {
41120
41144
  }
41121
41145
  }
41122
41146
  function isHTMLElement$1(arg) {
41123
- if (!/HTMLDivElement|HTMLElement/.test(Object.prototype.toString.call(arg))) {
41124
- arg = document.querySelector(arg);
41125
- }
41126
- return arg;
41147
+ return !/HTMLDivElement|HTMLElement/.test(Object.prototype.toString.call(arg)) ? document.querySelector(arg) : arg;
41127
41148
  }
41128
41149
  var __assign$a = globalThis && globalThis.__assign || function() {
41129
41150
  __assign$a = Object.assign || function(t2) {
@@ -43318,14 +43339,16 @@ const FileTree = ({
43318
43339
  } = oTStore((state) => state);
43319
43340
  const {
43320
43341
  fileTree
43321
- } = oTStore((state) => state);
43342
+ } = fileTreeStore((state) => state);
43322
43343
  const [treeData, setTreeData] = react.exports.useState({});
43323
43344
  react.exports.useEffect(() => {
43324
43345
  if (oTStore.getState().appStatus === "replay") {
43325
43346
  setSelectedItems([]);
43326
43347
  setExpandedItems([]);
43327
43348
  }
43328
- const newData = formatFileToTree(fileTree.data);
43349
+ if (!fileTree.data)
43350
+ return;
43351
+ const newData = formatFileToTree(fileTree == null ? void 0 : fileTree.data);
43329
43352
  setSelectedItems(selectedItems.filter((item) => newData[item]));
43330
43353
  setExpandedItems(expandedItems.filter((item) => newData[item]));
43331
43354
  setTreeData(newData);
@@ -186243,14 +186266,11 @@ const ContentLayout = newStyled.div`
186243
186266
  `;
186244
186267
  const Editor = ({
186245
186268
  doc,
186246
- docType,
186247
186269
  containerStyle,
186248
186270
  menuStyle,
186249
186271
  editorStyle
186250
186272
  }) => {
186251
186273
  const divEl = react.exports.useRef(null);
186252
- react.exports.useState(doc ? doc : "");
186253
- react.exports.useState(null);
186254
186274
  const file = oTStore((state) => state.doc);
186255
186275
  const setFromServer = oTStore((state) => state.setFromServer);
186256
186276
  const [client2, setClient] = react.exports.useState(new IoClient(0));
@@ -186573,7 +186593,9 @@ const Editor = ({
186573
186593
  useValue.getState();
186574
186594
  if (!CRDTInfo.editor || CRDTInfo.editor.evtType !== "Editor")
186575
186595
  return;
186576
- console.log(CRDTInfo);
186596
+ if (oTStore.getState().appStatus === "replay" && ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "editor")) {
186597
+ return;
186598
+ }
186577
186599
  if (editor && ((doc2 == null ? void 0 : doc2.path) === ((_a2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _a2.path) || ((_b2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _b2.path) === "singleFile")) {
186578
186600
  const server_operation = CRDTInfo.editor.operation;
186579
186601
  const CLIENT_OPERATION = receiveOperation(CRDTInfo.editor.revision, TextOperation.fromJSON(server_operation), (_c2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _c2.path);
@@ -186733,9 +186755,7 @@ const Editor = ({
186733
186755
  }
186734
186756
  }, [file == null ? void 0 : file.path]);
186735
186757
  react.exports.useEffect(() => {
186736
- }, [docType]);
186737
- react.exports.useEffect(() => {
186738
- }, [doc, docType]);
186758
+ }, [doc]);
186739
186759
  react.exports.useEffect(() => {
186740
186760
  const {
186741
186761
  usersDelta,