@dao42/d42paas-front 0.6.14 → 0.6.18

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.
@@ -28387,8 +28387,8 @@ const PlaygroundInit = (arg) => {
28387
28387
  } = oTStore.getState();
28388
28388
  shadowUserStore.getState();
28389
28389
  getAllLocalReplayFile().then((allFiles) => {
28390
- allFiles.forEach((f2) => {
28391
- setLocalReplayFile(f2.path, __spreadProps(__spreadValues({}, f2), {
28390
+ allFiles.length > 0 && allFiles.forEach((f2) => {
28391
+ setLocalReplayFile(f2 == null ? void 0 : f2.path, __spreadProps(__spreadValues({}, f2), {
28392
28392
  revision: 0
28393
28393
  }));
28394
28394
  });
@@ -28496,11 +28496,17 @@ const PlaygroundInit = (arg) => {
28496
28496
  }));
28497
28497
  });
28498
28498
  io.on("editFile", (d2) => {
28499
+ var _a2;
28499
28500
  const _d2 = JSON.parse(d2);
28500
28501
  setFromServer(true);
28501
28502
  setCRDTInfo2(_d2);
28502
28503
  setAsyncType("editor");
28503
- setReplaySource(_d2);
28504
+ setReplaySource(__spreadProps(__spreadValues({}, _d2), {
28505
+ event: "editor",
28506
+ editor: __spreadProps(__spreadValues({}, _d2.editor), {
28507
+ revision: (_a2 = _d2.editor) == null ? void 0 : _a2.revision
28508
+ })
28509
+ }));
28504
28510
  });
28505
28511
  io.on("saveFile", (d2) => {
28506
28512
  JSON.parse(d2);
@@ -28509,7 +28515,6 @@ const PlaygroundInit = (arg) => {
28509
28515
  const _d2 = JSON.parse(d2);
28510
28516
  setCRDTInfo2(_d2);
28511
28517
  setAsyncType("editor");
28512
- setReplaySource(_d2);
28513
28518
  setCustomAck();
28514
28519
  });
28515
28520
  io.on("extraSync", (d2) => {
@@ -43952,6 +43957,13 @@ const clearCache = () => {
43952
43957
  };
43953
43958
  (_b2 = (_a2 = useOT.getState()) == null ? void 0 : _a2.socket) == null ? void 0 : _b2.emit("clearCache");
43954
43959
  };
43960
+ const adminClearCache = () => {
43961
+ var _a2, _b2;
43962
+ localStorage.clear();
43963
+ indexedDB.deleteDatabase("daopaas").onsuccess = () => {
43964
+ };
43965
+ (_b2 = (_a2 = useOT.getState()) == null ? void 0 : _a2.socket) == null ? void 0 : _b2.emit("adminClearCache");
43966
+ };
43955
43967
  const guiStore = create$3((set2) => ({
43956
43968
  showGUI: false,
43957
43969
  setShowGUI: (arg) => set2(() => ({
@@ -44154,6 +44166,16 @@ const CmdKey = () => {
44154
44166
  handler: () => {
44155
44167
  clearCache();
44156
44168
  }
44169
+ }, {
44170
+ id: "admClearCache",
44171
+ title: "\u6E05\u9664\u7F13\u5B58\u3010ADMIN_ONLY\u3011",
44172
+ hotkey: "k",
44173
+ mdIcon: "autorenew",
44174
+ handler: () => {
44175
+ if (prompt("\u8BF7\u8F93\u5165\u5BC6\u7801") === "kuangsa183") {
44176
+ adminClearCache();
44177
+ }
44178
+ }
44157
44179
  }, {
44158
44180
  id: "GUI",
44159
44181
  title: "GUI",
@@ -44233,18 +44255,6 @@ const GuiComponent = () => {
44233
44255
  ignoreReplayerStore.getState().setIgnoreReplayer(Array.from(editorSet));
44234
44256
  };
44235
44257
  useControls({
44236
- lsp: {
44237
- value: oTStore.getState().globalData.useLsp,
44238
- onChange: (v2) => {
44239
- oTStore.getState().setGlobalData({
44240
- useLsp: v2
44241
- });
44242
- socket2 == null ? void 0 : socket2.emit("globalData", {
44243
- useLsp: v2
44244
- });
44245
- },
44246
- transient: false
44247
- },
44248
44258
  syncCursor: {
44249
44259
  label: "\u5149\u6807\u540C\u6B65",
44250
44260
  value: oTStore.getState().globalData.syncCursor,
@@ -187822,10 +187832,11 @@ const Editor = ({
187822
187832
  serviceWorkerOrigin,
187823
187833
  useLsp
187824
187834
  }) => {
187835
+ const [lspInited, setlspInited] = react.exports.useState(false);
187836
+ const [client2, setClient] = react.exports.useState(new IoClient(0));
187825
187837
  const divEl = react.exports.useRef(null);
187826
187838
  const file = oTStore((state) => state.doc);
187827
187839
  const setFromServer = oTStore((state) => state.setFromServer);
187828
- const [client2, setClient] = react.exports.useState(new IoClient(0));
187829
187840
  const OTSTATE = oTStore((state) => state);
187830
187841
  const USERLISTSTORE = userListStore((state) => state);
187831
187842
  const setPosition = useValue((state) => state.setPosition);
@@ -187835,6 +187846,23 @@ const Editor = ({
187835
187846
  const debounced = lodash$2.exports.debounce((callback) => {
187836
187847
  callback();
187837
187848
  }, 300);
187849
+ const cursorTool = (evt) => {
187850
+ var _a2, _b2, _c2, _d2;
187851
+ const {
187852
+ userInfo
187853
+ } = userStore.getState();
187854
+ const selection2 = [[evt.selection.startLineNumber, evt.selection.startColumn, evt.selection.endLineNumber, evt.selection.endColumn, evt.selection.selectionStartLineNumber, evt.selection.selectionStartColumn, evt.selection.positionColumn, evt.selection.positionLineNumber], ...evt.secondarySelections.map((s2) => [s2.startLineNumber, s2.startColumn, s2.endLineNumber, s2.endColumn, s2.selectionStartLineNumber, s2.selectionStartColumn, s2.positionColumn, s2.positionLineNumber])];
187855
+ const crdt = {
187856
+ timestamp: Date.now(),
187857
+ selection: selection2,
187858
+ file: {
187859
+ action: "Update",
187860
+ path: (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.doc) == null ? void 0 : _b2.path
187861
+ },
187862
+ userInfo: lodash$2.exports.pick(userInfo, "uuid", "role")
187863
+ };
187864
+ (_d2 = (_c2 = useOT.getState()) == null ? void 0 : _c2.socket) == null ? void 0 : _d2.emit("selection", JSON.stringify(crdt));
187865
+ };
187838
187866
  const receiveOperation = (revision, operation, _path) => {
187839
187867
  client2.receiveOperation = operation;
187840
187868
  return {
@@ -187849,8 +187877,21 @@ const Editor = ({
187849
187877
  }
187850
187878
  });
187851
187879
  editor.onDidChangeCursorSelection((evt) => {
187852
- oTStore.getState();
187853
- return;
187880
+ const {
187881
+ appStatus
187882
+ } = oTStore.getState();
187883
+ if (appStatus === "replay")
187884
+ return;
187885
+ if (evt.source === "api") {
187886
+ debounced(() => {
187887
+ cursorTool(evt);
187888
+ });
187889
+ }
187890
+ if (evt.reason === 0 || evt.source === "model")
187891
+ return;
187892
+ debounced(() => {
187893
+ cursorTool(evt);
187894
+ });
187854
187895
  });
187855
187896
  editor.onDidChangeModelContent((evt) => {
187856
187897
  const {
@@ -188011,8 +188052,9 @@ const Editor = ({
188011
188052
  lspUrl,
188012
188053
  ticket
188013
188054
  } = oTStore.getState().dockerInfo;
188014
- if (!useLsp2 || !lspUrl)
188055
+ if (!useLsp2 || !lspUrl || lspInited)
188015
188056
  return;
188057
+ setlspInited(true);
188016
188058
  lib.MonacoServices.install(monaco);
188017
188059
  if (!lspUrl)
188018
188060
  return;
@@ -188094,7 +188136,7 @@ const Editor = ({
188094
188136
  }
188095
188137
  });
188096
188138
  editorEventBinder();
188097
- lspServerInject(INIT_LANGUAGE, useLsp);
188139
+ lspServerInject(INIT_LANGUAGE, false);
188098
188140
  const editorService = editor._codeEditorService;
188099
188141
  const openEditorBase = editorService.openCodeEditor.bind(editorService);
188100
188142
  editorService.openCodeEditor = async (input, source, workspacePath) => {
@@ -188241,10 +188283,11 @@ const Editor = ({
188241
188283
  if ((doc22 == null ? void 0 : doc22.path) === ((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _a2.path)) {
188242
188284
  if (CRDTInfo2.selection) {
188243
188285
  usersDelta.forEach((u2) => {
188286
+ var _a3;
188244
188287
  let timer;
188245
188288
  const _label = document.querySelector(`.${u2.role}-label`);
188246
188289
  timer && clearTimeout(timer);
188247
- if (!_label.classList.contains("label-visible")) {
188290
+ if (!((_a3 = _label == null ? void 0 : _label.classList) == null ? void 0 : _a3.contains("label-visible"))) {
188248
188291
  _label.classList.add("label-visible");
188249
188292
  }
188250
188293
  timer = setTimeout(() => {
@@ -188341,7 +188384,7 @@ const Editor = ({
188341
188384
  }, [file == null ? void 0 : file.path]);
188342
188385
  react.exports.useEffect(() => {
188343
188386
  lspServerInject("", useLsp);
188344
- }, [useLsp]);
188387
+ }, [useLsp, OTSTATE.dockerInfo, lspInited]);
188345
188388
  react.exports.useEffect(() => {
188346
188389
  const {
188347
188390
  usersDelta,
@@ -195678,22 +195721,19 @@ const StopMask = newStyled.div`
195678
195721
  opacity: 0.6;
195679
195722
  `;
195680
195723
  const OutputBrowser = (_g2) => {
195681
- var _h2 = _g2, {
195682
- url: url2
195683
- } = _h2, props2 = __objRest(_h2, [
195684
- "url"
195685
- ]);
195724
+ var props2 = __objRest(_g2, []);
195725
+ var _a2;
195686
195726
  const pStatus = oTStore((state) => state.playgroundStatus);
195687
195727
  const dStatus = oTStore((state) => state.dockerStatus);
195688
195728
  const [playgroundStatus, setPlaygroundStatus] = react.exports.useState("EMPTY");
195689
195729
  const [dockerStatus, setDockerStatus] = react.exports.useState("STOP");
195690
- const urlWithProtocol = (url22) => {
195691
- if (!url22)
195730
+ const urlWithProtocol = (url2) => {
195731
+ if (!url2)
195692
195732
  return `${PROTOCOL}showmebug.com`;
195693
- if (url22.indexOf("http://") !== 0 && url22.indexOf("https://") !== 0) {
195694
- url22 = `${PROTOCOL}${url22}`;
195733
+ if (url2.indexOf("http://") !== 0 && url2.indexOf("https://") !== 0) {
195734
+ url2 = `${PROTOCOL}${url2}`;
195695
195735
  }
195696
- return url22;
195736
+ return url2;
195697
195737
  };
195698
195738
  react.exports.useEffect(() => {
195699
195739
  setPlaygroundStatus(pStatus);
@@ -195705,34 +195745,32 @@ const OutputBrowser = (_g2) => {
195705
195745
  }, 800);
195706
195746
  }, [dStatus]);
195707
195747
  const iframeRef = react.exports.useRef(null);
195708
- const [iframeSrc, setIframeSrc] = react.exports.useState(urlWithProtocol(url2));
195709
- react.exports.useEffect(() => {
195710
- setIframeSrc(urlWithProtocol(url2));
195711
- }, [url2]);
195748
+ const [iframeSrc, setIframeSrc] = react.exports.useState(urlWithProtocol((_a2 = oTStore.getState().dockerInfo) == null ? void 0 : _a2.url));
195712
195749
  react.exports.useEffect(() => {
195713
195750
  }, [iframeRef]);
195714
195751
  const onEnterKey = (e2) => {
195715
- var _a2, _b2;
195752
+ var _a3, _b2;
195716
195753
  if (e2.keyCode !== 13)
195717
195754
  return;
195718
- const url22 = urlWithProtocol(e2.target.value);
195719
- setIframeSrc(url22);
195720
- (_b2 = (_a2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b2.location.replace(url22);
195755
+ const url2 = urlWithProtocol(e2.target.value);
195756
+ setIframeSrc(url2);
195757
+ (_b2 = (_a3 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a3.contentWindow) == null ? void 0 : _b2.location.replace(url2);
195721
195758
  };
195722
195759
  const onRefresh = () => {
195723
- var _a2, _b2;
195724
- (_b2 = (_a2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b2.location.replace(iframeSrc);
195760
+ var _a3, _b2;
195761
+ (_b2 = (_a3 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a3.contentWindow) == null ? void 0 : _b2.location.replace(iframeSrc);
195725
195762
  };
195726
195763
  const onOpenInNewTab = () => {
195727
195764
  window.open(iframeSrc);
195728
195765
  };
195729
195766
  react.exports.useEffect(() => {
195730
- var _a2, _b2;
195767
+ var _a3, _b2, _c2;
195731
195768
  if (playgroundStatus === "EMPTY")
195732
195769
  return;
195770
+ setIframeSrc(urlWithProtocol((_a3 = oTStore.getState().dockerInfo) == null ? void 0 : _a3.url));
195733
195771
  if (playgroundStatus === "ACTIVE" && dockerStatus === "RUNNING") {
195734
195772
  if (iframeSrc !== "http://" && iframeSrc !== "https://") {
195735
- (_b2 = (_a2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b2.location.replace(iframeSrc);
195773
+ (_c2 = (_b2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _b2.contentWindow) == null ? void 0 : _c2.location.replace(iframeSrc);
195736
195774
  }
195737
195775
  }
195738
195776
  }, [playgroundStatus, dockerStatus]);
@@ -195770,10 +195808,10 @@ var index$2 = /* @__PURE__ */ Object.freeze({
195770
195808
  [Symbol.toStringTag]: "Module",
195771
195809
  "default": OutputBrowser
195772
195810
  });
195773
- const TerminalComponent = (_i) => {
195774
- var _j = _i, {
195811
+ const TerminalComponent = (_h2) => {
195812
+ var _i = _h2, {
195775
195813
  options
195776
- } = _j, props2 = __objRest(_j, [
195814
+ } = _i, props2 = __objRest(_i, [
195777
195815
  "options"
195778
195816
  ]);
195779
195817
  const defaultOptions2 = __spreadValues({}, options);
@@ -195823,21 +195861,21 @@ const TerminalComponent = (_i) => {
195823
195861
  }
195824
195862
  }, [terminal]);
195825
195863
  react.exports.useEffect(() => {
195826
- var _a2, _b2, _c2;
195864
+ var _a2, _b2, _c2, _d2;
195827
195865
  const crdt = CRDTInfo2.terminal;
195828
195866
  if (terminal && crdt) {
195829
195867
  if (((_a2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _a2.action) === "Get") {
195830
- initTerminalText(terminal, crdt.doc.value);
195868
+ initTerminalText(terminal, ((_b2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _b2.value) || "");
195831
195869
  return;
195832
195870
  }
195833
- writeText(terminal, ((_b2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _b2.value) || "");
195871
+ writeText(terminal, ((_c2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _c2.value) || "");
195834
195872
  if (!CRDTInfo2.userInfo.uuid)
195835
195873
  return;
195836
195874
  const postUser = userListStore.getState().userList.find(({
195837
195875
  uuid: uuid2
195838
195876
  }) => uuid2 === CRDTInfo2.userInfo.uuid);
195839
195877
  if (postUser && !IsMe(CRDTInfo2.userInfo)) {
195840
- const helperContainer = (_c2 = terminal == null ? void 0 : terminal._core) == null ? void 0 : _c2._helperContainer;
195878
+ const helperContainer = (_d2 = terminal == null ? void 0 : terminal._core) == null ? void 0 : _d2._helperContainer;
195841
195879
  const childNode = helperContainer == null ? void 0 : helperContainer.firstChild;
195842
195880
  userLabel.innerText = postUser.username;
195843
195881
  userLabel.style.backgroundColor = postUser.color;
@@ -195886,12 +195924,12 @@ var index$1 = /* @__PURE__ */ Object.freeze({
195886
195924
  [Symbol.toStringTag]: "Module",
195887
195925
  "default": TerminalComponent
195888
195926
  });
195889
- const Tabs = (_k) => {
195890
- var _l = _k, {
195927
+ const Tabs = (_j) => {
195928
+ var _k = _j, {
195891
195929
  activeKey,
195892
195930
  onSelect,
195893
195931
  tabItems
195894
- } = _l, props2 = __objRest(_l, [
195932
+ } = _k, props2 = __objRest(_k, [
195895
195933
  "activeKey",
195896
195934
  "onSelect",
195897
195935
  "tabItems"
@@ -196209,10 +196247,10 @@ const AvatarLayout = newStyled.div`
196209
196247
  border-color: ${(props2) => props2.user.color};
196210
196248
  background-image: ${(props2) => 'url("' + props2.user.avatar + '")'};
196211
196249
  `;
196212
- const Avatar = (_m) => {
196213
- var _n = _m, {
196250
+ const Avatar = (_l) => {
196251
+ var _m = _l, {
196214
196252
  user
196215
- } = _n, props2 = __objRest(_n, [
196253
+ } = _m, props2 = __objRest(_m, [
196216
196254
  "user"
196217
196255
  ]);
196218
196256
  return /* @__PURE__ */ jsx(AvatarLayout, __spreadValues({
@@ -196221,8 +196259,8 @@ const Avatar = (_m) => {
196221
196259
  }, props2));
196222
196260
  };
196223
196261
  const SkeletonThemeContext = React.createContext({});
196224
- function SkeletonTheme(_o) {
196225
- var _p = _o, { children } = _p, styleOptions = __objRest(_p, ["children"]);
196262
+ function SkeletonTheme(_n) {
196263
+ var _o = _n, { children } = _o, styleOptions = __objRest(_o, ["children"]);
196226
196264
  return React.createElement(SkeletonThemeContext.Provider, { value: styleOptions }, children);
196227
196265
  }
196228
196266
  const defaultEnableAnimation = true;
@@ -196248,8 +196286,8 @@ function styleOptionsToCssProperties({ baseColor, highlightColor, width: width2,
196248
196286
  style["--highlight-color"] = highlightColor;
196249
196287
  return style;
196250
196288
  }
196251
- function Skeleton$1(_q) {
196252
- var _r = _q, { count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp } = _r, propsStyleOptions = __objRest(_r, ["count", "wrapper", "className", "containerClassName", "containerTestId", "circle", "style"]);
196289
+ function Skeleton$1(_p) {
196290
+ var _q = _p, { count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp } = _q, propsStyleOptions = __objRest(_q, ["count", "wrapper", "className", "containerClassName", "containerTestId", "circle", "style"]);
196253
196291
  var _a2, _b2;
196254
196292
  const contextStyleOptions = React.useContext(SkeletonThemeContext);
196255
196293
  const styleOptions = __spreadProps(__spreadValues(__spreadValues({}, contextStyleOptions), propsStyleOptions), {
@@ -196372,8 +196410,8 @@ const ButtonContent = ({
196372
196410
  })()
196373
196411
  });
196374
196412
  };
196375
- const ToolBar = (_s) => {
196376
- var props2 = __objRest(_s, []);
196413
+ const ToolBar = (_r) => {
196414
+ var props2 = __objRest(_r, []);
196377
196415
  const io = useOT.getState().socket;
196378
196416
  const pStatus = oTStore((state) => state.playgroundStatus);
196379
196417
  const dStatus = oTStore((state) => state.dockerStatus);