@dao42/d42paas-front 0.6.21 → 0.7.1

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);
@@ -174319,6 +174319,9 @@ const EditorLayout = newStyled.div`
174319
174319
  padding: 2px 10px;
174320
174320
  transform: scale(0.8);
174321
174321
  word-break: keep-all;
174322
+ font-weight: bolder;
174323
+ font-size: 14px;
174324
+ color: #666;
174322
174325
  }
174323
174326
 
174324
174327
  .stack-list {
@@ -189430,6 +189433,34 @@ function lineAndColumnToIndex(lines, lineNumber, column2) {
189430
189433
  index2 += column2 - 1;
189431
189434
  return index2;
189432
189435
  }
189436
+ function operationFromMonacoChanges(changeEvent, liveOperationCode) {
189437
+ let operation;
189438
+ let composedCode = liveOperationCode;
189439
+ for (const change of [...changeEvent.changes]) {
189440
+ const newOt = new TextOperation();
189441
+ const cursorStartOffset = lineAndColumnToIndex(composedCode.split(/\n/), change.range.startLineNumber, change.range.startColumn);
189442
+ const retain = cursorStartOffset - newOt.targetLength;
189443
+ if (retain !== 0) {
189444
+ newOt.retain(retain);
189445
+ }
189446
+ if (change.rangeLength > 0) {
189447
+ newOt.delete(change.rangeLength);
189448
+ }
189449
+ if (change.text) {
189450
+ newOt.insert(change.text);
189451
+ }
189452
+ const remaining = composedCode.length - newOt.baseLength;
189453
+ if (remaining > 0) {
189454
+ newOt.retain(remaining);
189455
+ }
189456
+ operation = operation ? operation.compose(newOt) : newOt;
189457
+ composedCode = operation.apply(liveOperationCode);
189458
+ }
189459
+ return {
189460
+ operation,
189461
+ liveOperationCode: composedCode
189462
+ };
189463
+ }
189433
189464
  new IoClient(0);
189434
189465
  class MonacoAdapter {
189435
189466
  constructor(monacoIns, serviceWorkerOrigin) {
@@ -189520,11 +189551,17 @@ class MonacoAdapter {
189520
189551
  } = evt;
189521
189552
  if (!isFlush) {
189522
189553
  try {
189523
- const pair = this.operationFromMonacoChanges(evt);
189524
- this.trigger("change", pair);
189554
+ const {
189555
+ operation,
189556
+ liveOperationCode
189557
+ } = operationFromMonacoChanges(evt, this.liveOperationCode);
189558
+ this.liveOperationCode = liveOperationCode;
189559
+ this.trigger("change", operation);
189525
189560
  } catch (err) {
189526
189561
  console.log(err);
189527
189562
  }
189563
+ } else {
189564
+ this.trigger("cursorActivity", evt);
189528
189565
  }
189529
189566
  }
189530
189567
  this.ignoreNextChange = false;
@@ -189588,34 +189625,6 @@ class MonacoAdapter {
189588
189625
  });
189589
189626
  }, "save");
189590
189627
  }
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
189628
  lspServerInject(_lan, useLsp = true) {
189620
189629
  languages.register({
189621
189630
  id: "ruby",
@@ -189646,7 +189655,7 @@ class MonacoAdapter {
189646
189655
  lspUrl,
189647
189656
  ticket
189648
189657
  } = oTStore.getState().dockerInfo;
189649
- if (!useLsp || !lspUrl || this.lspInited)
189658
+ if (!lspUrl || this.lspInited)
189650
189659
  return;
189651
189660
  this.lspInited = true;
189652
189661
  lib.MonacoServices.install(monaco);
@@ -189701,16 +189710,20 @@ class MonacoAdapter {
189701
189710
  globalAPI: true,
189702
189711
  getWorkerUrl(_moduleId, label) {
189703
189712
  if (label === "json") {
189704
- return "./json.worker.bundle.js";
189713
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189714
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.66c12891.js');`)}`;
189705
189715
  }
189706
189716
  if (label === "css" || label === "scss" || label === "less") {
189707
- return "./css.worker.bundle.js";
189717
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189718
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.5157db2f.js');`)}`;
189708
189719
  }
189709
189720
  if (label === "html" || label === "handlebars" || label === "razor") {
189710
- return "./html.worker.bundle.js";
189721
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189722
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.3f2697f1.js');`)}`;
189711
189723
  }
189712
189724
  if (label === "typescript" || label === "javascript") {
189713
- return "./ts.worker.bundle.js";
189725
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189726
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.d75e32f4.js');`)}`;
189714
189727
  }
189715
189728
  return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189716
189729
  importScripts('${serviceWorkerOrigin}/assets/editor.worker.43309ac9.js');`)}`;
@@ -190073,7 +190086,7 @@ const Editor = ({
190073
190086
  path
190074
190087
  }
190075
190088
  };
190076
- io.emit("editFile", JSON.stringify(crdt));
190089
+ io == null ? void 0 : io.emit("editFile", JSON.stringify(crdt));
190077
190090
  };
190078
190091
  client.applyOperation = (operation) => {
190079
190092
  clientEditor.applyOperation(operation);
@@ -190106,7 +190119,7 @@ const Editor = ({
190106
190119
  },
190107
190120
  userInfo: lodash$2.exports.pick(userInfo, "uuid", "role")
190108
190121
  };
190109
- io.emit("cursor", JSON.stringify(crdt));
190122
+ io == null ? void 0 : io.emit("cursor", JSON.stringify(crdt));
190110
190123
  };
190111
190124
  const onBlur = (operation) => {
190112
190125
  };
@@ -190197,7 +190210,7 @@ const Editor = ({
190197
190210
  "editor.background": "#000000"
190198
190211
  }
190199
190212
  });
190200
- setClientEditor(new MonacoAdapter(editor, ""));
190213
+ setClientEditor(new MonacoAdapter(editor, serviceWorkerOrigin));
190201
190214
  setOtherClients(new ClientMeta(editor, userList.filter((x2) => !IsMe(x2))));
190202
190215
  serviceBinder();
190203
190216
  return () => {
@@ -190269,10 +190282,10 @@ const Editor = ({
190269
190282
  }
190270
190283
  });
190271
190284
  return () => {
190272
- io.off("editFile");
190273
- io.off("serverAck");
190274
- io.off("selection");
190275
- io.off("cursor");
190285
+ io == null ? void 0 : io.off("editFile");
190286
+ io == null ? void 0 : io.off("serverAck");
190287
+ io == null ? void 0 : io.off("selection");
190288
+ io == null ? void 0 : io.off("cursor");
190276
190289
  };
190277
190290
  }, [clientEditor]);
190278
190291
  react.exports.useEffect(() => {
@@ -198444,6 +198457,9 @@ const useIndexState = create$3((set2) => ({
198444
198457
  isFolded: arg
198445
198458
  })
198446
198459
  }));
198460
+ const LazyEditorComponent = lazy$2(async () => (await Promise.resolve().then(function() {
198461
+ return index$4;
198462
+ })).Editor);
198447
198463
  const MainLayout = newStyled.div`
198448
198464
  width: 100vw;
198449
198465
  height: 100vh;
@@ -198557,7 +198573,7 @@ const Index = (props2) => {
198557
198573
  fallback: /* @__PURE__ */ jsx(Skeleton, {
198558
198574
  count: 10
198559
198575
  }),
198560
- children: /* @__PURE__ */ jsx(Editor, {
198576
+ children: /* @__PURE__ */ jsx(LazyEditorComponent, {
198561
198577
  useLsp: true
198562
198578
  })
198563
198579
  }) : null