@dao42/d42paas-front 0.6.13 → 0.6.17

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.
@@ -187822,10 +187822,11 @@ const Editor = ({
187822
187822
  serviceWorkerOrigin,
187823
187823
  useLsp
187824
187824
  }) => {
187825
+ const [lspInited, setlspInited] = react.exports.useState(false);
187826
+ const [client2, setClient] = react.exports.useState(new IoClient(0));
187825
187827
  const divEl = react.exports.useRef(null);
187826
187828
  const file = oTStore((state) => state.doc);
187827
187829
  const setFromServer = oTStore((state) => state.setFromServer);
187828
- const [client2, setClient] = react.exports.useState(new IoClient(0));
187829
187830
  const OTSTATE = oTStore((state) => state);
187830
187831
  const USERLISTSTORE = userListStore((state) => state);
187831
187832
  const setPosition = useValue((state) => state.setPosition);
@@ -187835,6 +187836,23 @@ const Editor = ({
187835
187836
  const debounced = lodash$2.exports.debounce((callback) => {
187836
187837
  callback();
187837
187838
  }, 300);
187839
+ const cursorTool = (evt) => {
187840
+ var _a2, _b2, _c2, _d2;
187841
+ const {
187842
+ userInfo
187843
+ } = userStore.getState();
187844
+ 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])];
187845
+ const crdt = {
187846
+ timestamp: Date.now(),
187847
+ selection: selection2,
187848
+ file: {
187849
+ action: "Update",
187850
+ path: (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.doc) == null ? void 0 : _b2.path
187851
+ },
187852
+ userInfo: lodash$2.exports.pick(userInfo, "uuid", "role")
187853
+ };
187854
+ (_d2 = (_c2 = useOT.getState()) == null ? void 0 : _c2.socket) == null ? void 0 : _d2.emit("selection", JSON.stringify(crdt));
187855
+ };
187838
187856
  const receiveOperation = (revision, operation, _path) => {
187839
187857
  client2.receiveOperation = operation;
187840
187858
  return {
@@ -187849,8 +187867,21 @@ const Editor = ({
187849
187867
  }
187850
187868
  });
187851
187869
  editor.onDidChangeCursorSelection((evt) => {
187852
- oTStore.getState();
187853
- return;
187870
+ const {
187871
+ appStatus
187872
+ } = oTStore.getState();
187873
+ if (appStatus === "replay")
187874
+ return;
187875
+ if (evt.source === "api") {
187876
+ debounced(() => {
187877
+ cursorTool(evt);
187878
+ });
187879
+ }
187880
+ if (evt.reason === 0 || evt.source === "model")
187881
+ return;
187882
+ debounced(() => {
187883
+ cursorTool(evt);
187884
+ });
187854
187885
  });
187855
187886
  editor.onDidChangeModelContent((evt) => {
187856
187887
  const {
@@ -188007,13 +188038,14 @@ const Editor = ({
188007
188038
  extensions: [".ts"],
188008
188039
  aliases: ["TypeScript", "ts", "TS", "typescript"]
188009
188040
  });
188010
- if (!useLsp2)
188011
- return;
188012
- lib.MonacoServices.install(monaco);
188013
188041
  const {
188014
188042
  lspUrl,
188015
188043
  ticket
188016
188044
  } = oTStore.getState().dockerInfo;
188045
+ if (!useLsp2 || !lspUrl || lspInited)
188046
+ return;
188047
+ setlspInited(true);
188048
+ lib.MonacoServices.install(monaco);
188017
188049
  if (!lspUrl)
188018
188050
  return;
188019
188051
  const webSocket = new ReconnectingWebSocket(`wss://${lspUrl}/${ticket}`, [], {
@@ -188094,7 +188126,7 @@ const Editor = ({
188094
188126
  }
188095
188127
  });
188096
188128
  editorEventBinder();
188097
- lspServerInject(INIT_LANGUAGE, useLsp);
188129
+ lspServerInject(INIT_LANGUAGE, false);
188098
188130
  const editorService = editor._codeEditorService;
188099
188131
  const openEditorBase = editorService.openCodeEditor.bind(editorService);
188100
188132
  editorService.openCodeEditor = async (input, source, workspacePath) => {
@@ -188341,7 +188373,7 @@ const Editor = ({
188341
188373
  }, [file == null ? void 0 : file.path]);
188342
188374
  react.exports.useEffect(() => {
188343
188375
  lspServerInject("", useLsp);
188344
- }, [useLsp]);
188376
+ }, [useLsp, OTSTATE.dockerInfo, lspInited]);
188345
188377
  react.exports.useEffect(() => {
188346
188378
  const {
188347
188379
  usersDelta,
@@ -195678,22 +195710,19 @@ const StopMask = newStyled.div`
195678
195710
  opacity: 0.6;
195679
195711
  `;
195680
195712
  const OutputBrowser = (_g2) => {
195681
- var _h2 = _g2, {
195682
- url: url2
195683
- } = _h2, props2 = __objRest(_h2, [
195684
- "url"
195685
- ]);
195713
+ var props2 = __objRest(_g2, []);
195714
+ var _a2;
195686
195715
  const pStatus = oTStore((state) => state.playgroundStatus);
195687
195716
  const dStatus = oTStore((state) => state.dockerStatus);
195688
195717
  const [playgroundStatus, setPlaygroundStatus] = react.exports.useState("EMPTY");
195689
195718
  const [dockerStatus, setDockerStatus] = react.exports.useState("STOP");
195690
- const urlWithProtocol = (url22) => {
195691
- if (!url22)
195719
+ const urlWithProtocol = (url2) => {
195720
+ if (!url2)
195692
195721
  return `${PROTOCOL}showmebug.com`;
195693
- if (url22.indexOf("http://") !== 0 && url22.indexOf("https://") !== 0) {
195694
- url22 = `${PROTOCOL}${url22}`;
195722
+ if (url2.indexOf("http://") !== 0 && url2.indexOf("https://") !== 0) {
195723
+ url2 = `${PROTOCOL}${url2}`;
195695
195724
  }
195696
- return url22;
195725
+ return url2;
195697
195726
  };
195698
195727
  react.exports.useEffect(() => {
195699
195728
  setPlaygroundStatus(pStatus);
@@ -195705,34 +195734,32 @@ const OutputBrowser = (_g2) => {
195705
195734
  }, 800);
195706
195735
  }, [dStatus]);
195707
195736
  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]);
195737
+ const [iframeSrc, setIframeSrc] = react.exports.useState(urlWithProtocol((_a2 = oTStore.getState().dockerInfo) == null ? void 0 : _a2.url));
195712
195738
  react.exports.useEffect(() => {
195713
195739
  }, [iframeRef]);
195714
195740
  const onEnterKey = (e2) => {
195715
- var _a2, _b2;
195741
+ var _a3, _b2;
195716
195742
  if (e2.keyCode !== 13)
195717
195743
  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);
195744
+ const url2 = urlWithProtocol(e2.target.value);
195745
+ setIframeSrc(url2);
195746
+ (_b2 = (_a3 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a3.contentWindow) == null ? void 0 : _b2.location.replace(url2);
195721
195747
  };
195722
195748
  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);
195749
+ var _a3, _b2;
195750
+ (_b2 = (_a3 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _a3.contentWindow) == null ? void 0 : _b2.location.replace(iframeSrc);
195725
195751
  };
195726
195752
  const onOpenInNewTab = () => {
195727
195753
  window.open(iframeSrc);
195728
195754
  };
195729
195755
  react.exports.useEffect(() => {
195730
- var _a2, _b2;
195756
+ var _a3, _b2, _c2;
195731
195757
  if (playgroundStatus === "EMPTY")
195732
195758
  return;
195759
+ setIframeSrc(urlWithProtocol((_a3 = oTStore.getState().dockerInfo) == null ? void 0 : _a3.url));
195733
195760
  if (playgroundStatus === "ACTIVE" && dockerStatus === "RUNNING") {
195734
195761
  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);
195762
+ (_c2 = (_b2 = iframeRef == null ? void 0 : iframeRef.current) == null ? void 0 : _b2.contentWindow) == null ? void 0 : _c2.location.replace(iframeSrc);
195736
195763
  }
195737
195764
  }
195738
195765
  }, [playgroundStatus, dockerStatus]);
@@ -195770,10 +195797,10 @@ var index$2 = /* @__PURE__ */ Object.freeze({
195770
195797
  [Symbol.toStringTag]: "Module",
195771
195798
  "default": OutputBrowser
195772
195799
  });
195773
- const TerminalComponent = (_i) => {
195774
- var _j = _i, {
195800
+ const TerminalComponent = (_h2) => {
195801
+ var _i = _h2, {
195775
195802
  options
195776
- } = _j, props2 = __objRest(_j, [
195803
+ } = _i, props2 = __objRest(_i, [
195777
195804
  "options"
195778
195805
  ]);
195779
195806
  const defaultOptions2 = __spreadValues({}, options);
@@ -195886,12 +195913,12 @@ var index$1 = /* @__PURE__ */ Object.freeze({
195886
195913
  [Symbol.toStringTag]: "Module",
195887
195914
  "default": TerminalComponent
195888
195915
  });
195889
- const Tabs = (_k) => {
195890
- var _l = _k, {
195916
+ const Tabs = (_j) => {
195917
+ var _k = _j, {
195891
195918
  activeKey,
195892
195919
  onSelect,
195893
195920
  tabItems
195894
- } = _l, props2 = __objRest(_l, [
195921
+ } = _k, props2 = __objRest(_k, [
195895
195922
  "activeKey",
195896
195923
  "onSelect",
195897
195924
  "tabItems"
@@ -196209,10 +196236,10 @@ const AvatarLayout = newStyled.div`
196209
196236
  border-color: ${(props2) => props2.user.color};
196210
196237
  background-image: ${(props2) => 'url("' + props2.user.avatar + '")'};
196211
196238
  `;
196212
- const Avatar = (_m) => {
196213
- var _n = _m, {
196239
+ const Avatar = (_l) => {
196240
+ var _m = _l, {
196214
196241
  user
196215
- } = _n, props2 = __objRest(_n, [
196242
+ } = _m, props2 = __objRest(_m, [
196216
196243
  "user"
196217
196244
  ]);
196218
196245
  return /* @__PURE__ */ jsx(AvatarLayout, __spreadValues({
@@ -196221,8 +196248,8 @@ const Avatar = (_m) => {
196221
196248
  }, props2));
196222
196249
  };
196223
196250
  const SkeletonThemeContext = React.createContext({});
196224
- function SkeletonTheme(_o) {
196225
- var _p = _o, { children } = _p, styleOptions = __objRest(_p, ["children"]);
196251
+ function SkeletonTheme(_n) {
196252
+ var _o = _n, { children } = _o, styleOptions = __objRest(_o, ["children"]);
196226
196253
  return React.createElement(SkeletonThemeContext.Provider, { value: styleOptions }, children);
196227
196254
  }
196228
196255
  const defaultEnableAnimation = true;
@@ -196248,8 +196275,8 @@ function styleOptionsToCssProperties({ baseColor, highlightColor, width: width2,
196248
196275
  style["--highlight-color"] = highlightColor;
196249
196276
  return style;
196250
196277
  }
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"]);
196278
+ function Skeleton$1(_p) {
196279
+ 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
196280
  var _a2, _b2;
196254
196281
  const contextStyleOptions = React.useContext(SkeletonThemeContext);
196255
196282
  const styleOptions = __spreadProps(__spreadValues(__spreadValues({}, contextStyleOptions), propsStyleOptions), {
@@ -196372,8 +196399,8 @@ const ButtonContent = ({
196372
196399
  })()
196373
196400
  });
196374
196401
  };
196375
- const ToolBar = (_s) => {
196376
- var props2 = __objRest(_s, []);
196402
+ const ToolBar = (_r) => {
196403
+ var props2 = __objRest(_r, []);
196377
196404
  const io = useOT.getState().socket;
196378
196405
  const pStatus = oTStore((state) => state.playgroundStatus);
196379
196406
  const dStatus = oTStore((state) => state.dockerStatus);