@dao42/d42paas-front 0.6.20 → 0.6.25

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.
@@ -44094,7 +44094,8 @@ const CmdKey = () => {
44094
44094
  hotkey: "a",
44095
44095
  mdIcon: "input",
44096
44096
  handler: () => {
44097
- io == null ? void 0 : io.emit("active");
44097
+ var _a2, _b2;
44098
+ (_b2 = (_a2 = useOT.getState()) == null ? void 0 : _a2.socket) == null ? void 0 : _b2.emit("active");
44098
44099
  }
44099
44100
  }, {
44100
44101
  id: "clearCache",
@@ -44153,7 +44154,6 @@ const CmdKey = () => {
44153
44154
  }];
44154
44155
  const [drawerOpen, setDrawerOpen] = react.exports.useState(false);
44155
44156
  const [replayList, setReplayList] = react.exports.useState(null);
44156
- const io = useOT.getState().socket;
44157
44157
  const [hotkeys2, setHotkeys] = react.exports.useState(actions);
44158
44158
  react.exports.useEffect(() => {
44159
44159
  console.log("leva init");
@@ -44240,7 +44240,7 @@ const GuiComponent = () => {
44240
44240
  const LazyTreeComponent = lazy$2(async () => (await Promise.resolve().then(function() {
44241
44241
  return index$5;
44242
44242
  })).FileTree);
44243
- const LazyEditorComponent = lazy$2(async () => (await Promise.resolve().then(function() {
44243
+ const LazyEditorComponent$1 = lazy$2(async () => (await Promise.resolve().then(function() {
44244
44244
  return index$4;
44245
44245
  })).Editor);
44246
44246
  const LazyConsoleComponent = lazy$2(async () => (await Promise.resolve().then(function() {
@@ -44521,7 +44521,7 @@ class DaoPaaS {
44521
44521
  this.editorDOM = container ? isHTMLElement$1(container) : this.editorDOM;
44522
44522
  reactDom.exports.render(/* @__PURE__ */ jsx(react.exports.Suspense, {
44523
44523
  fallback: /* @__PURE__ */ jsx(Loading, {}),
44524
- children: /* @__PURE__ */ jsx(LazyEditorComponent, __spreadProps(__spreadValues({}, props2), {
44524
+ children: /* @__PURE__ */ jsx(LazyEditorComponent$1, __spreadProps(__spreadValues({}, props2), {
44525
44525
  serviceWorkerOrigin: this.serviceWorkerOrigin
44526
44526
  }))
44527
44527
  }), this.editorDOM);
@@ -44543,7 +44543,9 @@ class DaoPaaS {
44543
44543
  this.editorDOM = container ? isHTMLElement$1(container) : this.editorDOM;
44544
44544
  reactDom.exports.render(/* @__PURE__ */ jsx(react.exports.Suspense, {
44545
44545
  fallback: /* @__PURE__ */ jsx(Loading, {}),
44546
- children: /* @__PURE__ */ jsx(LazyTreeComponent, __spreadValues({}, props2))
44546
+ children: /* @__PURE__ */ jsx(LazyTreeComponent, __spreadProps(__spreadValues({}, props2), {
44547
+ ref: myTree
44548
+ }))
44547
44549
  }), this.editorDOM);
44548
44550
  }
44549
44551
  Console({
@@ -174319,6 +174321,9 @@ const EditorLayout = newStyled.div`
174319
174321
  padding: 2px 10px;
174320
174322
  transform: scale(0.8);
174321
174323
  word-break: keep-all;
174324
+ font-weight: bolder;
174325
+ font-size: 14px;
174326
+ color: #666;
174322
174327
  }
174323
174328
 
174324
174329
  .stack-list {
@@ -189430,6 +189435,34 @@ function lineAndColumnToIndex(lines, lineNumber, column2) {
189430
189435
  index2 += column2 - 1;
189431
189436
  return index2;
189432
189437
  }
189438
+ function operationFromMonacoChanges(changeEvent, liveOperationCode) {
189439
+ let operation;
189440
+ let composedCode = liveOperationCode;
189441
+ for (const change of [...changeEvent.changes]) {
189442
+ const newOt = new TextOperation();
189443
+ const cursorStartOffset = lineAndColumnToIndex(composedCode.split(/\n/), change.range.startLineNumber, change.range.startColumn);
189444
+ const retain = cursorStartOffset - newOt.targetLength;
189445
+ if (retain !== 0) {
189446
+ newOt.retain(retain);
189447
+ }
189448
+ if (change.rangeLength > 0) {
189449
+ newOt.delete(change.rangeLength);
189450
+ }
189451
+ if (change.text) {
189452
+ newOt.insert(change.text);
189453
+ }
189454
+ const remaining = composedCode.length - newOt.baseLength;
189455
+ if (remaining > 0) {
189456
+ newOt.retain(remaining);
189457
+ }
189458
+ operation = operation ? operation.compose(newOt) : newOt;
189459
+ composedCode = operation.apply(liveOperationCode);
189460
+ }
189461
+ return {
189462
+ operation,
189463
+ liveOperationCode: composedCode
189464
+ };
189465
+ }
189433
189466
  new IoClient(0);
189434
189467
  class MonacoAdapter {
189435
189468
  constructor(monacoIns, serviceWorkerOrigin) {
@@ -189520,11 +189553,17 @@ class MonacoAdapter {
189520
189553
  } = evt;
189521
189554
  if (!isFlush) {
189522
189555
  try {
189523
- const pair = this.operationFromMonacoChanges(evt);
189524
- this.trigger("change", pair);
189556
+ const {
189557
+ operation,
189558
+ liveOperationCode
189559
+ } = operationFromMonacoChanges(evt, this.liveOperationCode);
189560
+ this.liveOperationCode = liveOperationCode;
189561
+ this.trigger("change", operation);
189525
189562
  } catch (err) {
189526
189563
  console.log(err);
189527
189564
  }
189565
+ } else {
189566
+ this.trigger("cursorActivity", evt);
189528
189567
  }
189529
189568
  }
189530
189569
  this.ignoreNextChange = false;
@@ -189588,34 +189627,6 @@ class MonacoAdapter {
189588
189627
  });
189589
189628
  }, "save");
189590
189629
  }
189591
- operationFromMonacoChanges(evt) {
189592
- let composedCode = this.liveOperationCode;
189593
- let operation;
189594
- for (let i2 = 0; i2 < evt.changes.length; i2++) {
189595
- const change = evt.changes[i2];
189596
- const cursorStartOffset = lineAndColumnToIndex(composedCode.split(/\n/), change.range.startLineNumber, change.range.startColumn);
189597
- const {
189598
- rangeLength,
189599
- text: text2
189600
- } = change;
189601
- const newOt = new TextOperation();
189602
- newOt.retain(cursorStartOffset);
189603
- if (rangeLength > 0) {
189604
- newOt.delete(rangeLength);
189605
- }
189606
- if (text2) {
189607
- newOt.insert(text2);
189608
- }
189609
- const remaining = composedCode.length - newOt.baseLength;
189610
- if (remaining > 0) {
189611
- newOt.retain(remaining);
189612
- }
189613
- operation = operation ? operation.compose(newOt) : newOt;
189614
- composedCode = operation.apply(this.liveOperationCode);
189615
- }
189616
- this.liveOperationCode = composedCode;
189617
- return operation;
189618
- }
189619
189630
  lspServerInject(_lan, useLsp = true) {
189620
189631
  languages.register({
189621
189632
  id: "ruby",
@@ -189646,7 +189657,7 @@ class MonacoAdapter {
189646
189657
  lspUrl,
189647
189658
  ticket
189648
189659
  } = oTStore.getState().dockerInfo;
189649
- if (!useLsp || !lspUrl || this.lspInited)
189660
+ if (!lspUrl || this.lspInited)
189650
189661
  return;
189651
189662
  this.lspInited = true;
189652
189663
  lib.MonacoServices.install(monaco);
@@ -189701,16 +189712,20 @@ class MonacoAdapter {
189701
189712
  globalAPI: true,
189702
189713
  getWorkerUrl(_moduleId, label) {
189703
189714
  if (label === "json") {
189704
- return "./json.worker.bundle.js";
189715
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189716
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.66c12891.js');`)}`;
189705
189717
  }
189706
189718
  if (label === "css" || label === "scss" || label === "less") {
189707
- return "./css.worker.bundle.js";
189719
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189720
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.5157db2f.js');`)}`;
189708
189721
  }
189709
189722
  if (label === "html" || label === "handlebars" || label === "razor") {
189710
- return "./html.worker.bundle.js";
189723
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189724
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.3f2697f1.js');`)}`;
189711
189725
  }
189712
189726
  if (label === "typescript" || label === "javascript") {
189713
- return "./ts.worker.bundle.js";
189727
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189728
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.d75e32f4.js');`)}`;
189714
189729
  }
189715
189730
  return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189716
189731
  importScripts('${serviceWorkerOrigin}/assets/editor.worker.43309ac9.js');`)}`;
@@ -190073,7 +190088,7 @@ const Editor = ({
190073
190088
  path
190074
190089
  }
190075
190090
  };
190076
- io.emit("editFile", JSON.stringify(crdt));
190091
+ io == null ? void 0 : io.emit("editFile", JSON.stringify(crdt));
190077
190092
  };
190078
190093
  client.applyOperation = (operation) => {
190079
190094
  clientEditor.applyOperation(operation);
@@ -190106,7 +190121,7 @@ const Editor = ({
190106
190121
  },
190107
190122
  userInfo: lodash$2.exports.pick(userInfo, "uuid", "role")
190108
190123
  };
190109
- io.emit("cursor", JSON.stringify(crdt));
190124
+ io == null ? void 0 : io.emit("cursor", JSON.stringify(crdt));
190110
190125
  };
190111
190126
  const onBlur = (operation) => {
190112
190127
  };
@@ -190197,7 +190212,7 @@ const Editor = ({
190197
190212
  "editor.background": "#000000"
190198
190213
  }
190199
190214
  });
190200
- setClientEditor(new MonacoAdapter(editor, ""));
190215
+ setClientEditor(new MonacoAdapter(editor, serviceWorkerOrigin));
190201
190216
  setOtherClients(new ClientMeta(editor, userList.filter((x2) => !IsMe(x2))));
190202
190217
  serviceBinder();
190203
190218
  return () => {
@@ -190216,7 +190231,7 @@ const Editor = ({
190216
190231
  clientEditor == null ? void 0 : clientEditor.onCursorActivity();
190217
190232
  }, [clientEditor]);
190218
190233
  react.exports.useEffect(() => {
190219
- io.on("editFile", (d2) => {
190234
+ io == null ? void 0 : io.on("editFile", (d2) => {
190220
190235
  var _a2, _b2, _c2, _d3;
190221
190236
  const _d2 = JSON.parse(d2);
190222
190237
  const path = (_a2 = oTStore.getState().doc) == null ? void 0 : _a2.path;
@@ -190232,7 +190247,7 @@ const Editor = ({
190232
190247
  }
190233
190248
  }
190234
190249
  });
190235
- io.on("serverAck", async (d2) => {
190250
+ io == null ? void 0 : io.on("serverAck", async (d2) => {
190236
190251
  var _a2, _b2;
190237
190252
  const _d2 = JSON.parse(d2);
190238
190253
  client.serverAck();
@@ -190242,7 +190257,7 @@ const Editor = ({
190242
190257
  operation: client.operation
190243
190258
  }));
190244
190259
  });
190245
- io.on("selection", async (d2) => {
190260
+ io == null ? void 0 : io.on("selection", async (d2) => {
190246
190261
  var _a2, _b2;
190247
190262
  const _d2 = JSON.parse(d2);
190248
190263
  const path = (_a2 = oTStore.getState().doc) == null ? void 0 : _a2.path;
@@ -190255,7 +190270,7 @@ const Editor = ({
190255
190270
  }
190256
190271
  }
190257
190272
  });
190258
- io.on("cursor", async (d2) => {
190273
+ io == null ? void 0 : io.on("cursor", async (d2) => {
190259
190274
  var _a2, _b2;
190260
190275
  const _d2 = JSON.parse(d2);
190261
190276
  const path = (_a2 = oTStore.getState().doc) == null ? void 0 : _a2.path;
@@ -190269,10 +190284,10 @@ const Editor = ({
190269
190284
  }
190270
190285
  });
190271
190286
  return () => {
190272
- io.off("editFile");
190273
- io.off("serverAck");
190274
- io.off("selection");
190275
- io.off("cursor");
190287
+ io == null ? void 0 : io.off("editFile");
190288
+ io == null ? void 0 : io.off("serverAck");
190289
+ io == null ? void 0 : io.off("selection");
190290
+ io == null ? void 0 : io.off("cursor");
190276
190291
  };
190277
190292
  }, [clientEditor]);
190278
190293
  react.exports.useEffect(() => {
@@ -198444,6 +198459,9 @@ const useIndexState = create$3((set2) => ({
198444
198459
  isFolded: arg
198445
198460
  })
198446
198461
  }));
198462
+ const LazyEditorComponent = lazy$2(async () => (await Promise.resolve().then(function() {
198463
+ return index$4;
198464
+ })).Editor);
198447
198465
  const MainLayout = newStyled.div`
198448
198466
  width: 100vw;
198449
198467
  height: 100vh;
@@ -198557,7 +198575,7 @@ const Index = (props2) => {
198557
198575
  fallback: /* @__PURE__ */ jsx(Skeleton, {
198558
198576
  count: 10
198559
198577
  }),
198560
- children: /* @__PURE__ */ jsx(Editor, {
198578
+ children: /* @__PURE__ */ jsx(LazyEditorComponent, {
198561
198579
  useLsp: true
198562
198580
  })
198563
198581
  }) : null