@mlightcad/cad-viewer 1.1.2 → 1.1.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAA;AACpC,OAAO,oBAAoB,CAAA;AAC3B,OAAO,qBAAqB,CAAA;AAM5B,eAAO,MAAM,mBAAmB,GAAI,QAAQ,iBAAiB,SAI5D,CAAA"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAA;AACpC,OAAO,oBAAoB,CAAA;AAC3B,OAAO,qBAAqB,CAAA;AAM5B,eAAO,MAAM,mBAAmB,GAAI,QAAQ,iBAAiB,SAK5D,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./index.css";
2
- import { AcEdCommandStack as W, AcApDocManager as T, eventBus as Y, AcApSettingManager as K, AcApConvertToSvgCmd as Ae, AcApQNewCmd as Fe, AcApOpenCmd as Ie, registerWorkers as Re, AcEdCommand as re } from "@mlightcad/cad-simple-viewer";
2
+ import { AcEdCommandStack as W, AcApDocManager as B, eventBus as Y, AcApSettingManager as K, AcApConvertToSvgCmd as Ae, AcApQNewCmd as Fe, AcApOpenCmd as Ie, registerWorkers as Re, AcEdCommand as re } from "@mlightcad/cad-simple-viewer";
3
3
  import "element-plus/dist/index.css";
4
4
  import { reactive as U, computed as k, defineComponent as L, onMounted as H, resolveComponent as M, createBlock as C, openBlock as c, unref as g, withCtx as p, renderSlot as ie, createVNode as v, createTextVNode as F, toDisplayString as D, createElementVNode as u, ref as x, onUnmounted as te, watch as E, createElementBlock as y, Fragment as j, renderList as X, resolveDynamicComponent as ve, mergeProps as Ne, mergeModels as J, useCssVars as Se, useModel as ge, createCommentVNode as q, normalizeStyle as pe, normalizeClass as Ce, pushScopeId as Le, popScopeId as ze, onBeforeUnmount as De, withKeys as Pe, isRef as Oe, markRaw as he } from "vue";
5
5
  import { AcDbDatabaseConverterManager as He, acdbHostApplicationServices as Be, AcCmPerformanceCollector as Ge } from "@mlightcad/data-model";
@@ -889,7 +889,7 @@ function Ee(t) {
889
889
  }
890
890
  function $e() {
891
891
  const t = U(/* @__PURE__ */ new Map()), e = U(/* @__PURE__ */ new Map()), n = () => {
892
- const i = T.instance.curView.missedData, l = K.instance.fontMapping;
892
+ const i = B.instance.curView.missedData, l = K.instance.fontMapping;
893
893
  t.clear(), Object.keys(i.fonts).forEach((o) => {
894
894
  const a = l[o];
895
895
  t.set(o, a || "");
@@ -901,7 +901,7 @@ function $e() {
901
901
  });
902
902
  });
903
903
  };
904
- return T.instance.events.documentActivated.addEventListener(() => {
904
+ return B.instance.events.documentActivated.addEventListener(() => {
905
905
  n();
906
906
  }), Y.on("font-not-found", (i) => {
907
907
  n();
@@ -1021,8 +1021,8 @@ const Bt = /* @__PURE__ */ L({
1021
1021
  }), Ve = /* @__PURE__ */ G($t, [["__scopeId", "data-v-48d6b055"]]), Vt = /* @__PURE__ */ L({
1022
1022
  __name: "MlReplacementDlg",
1023
1023
  setup(t) {
1024
- const { t: e } = N(), { fonts: n, images: i } = $e(), l = x(!0), o = k(() => n.size > 0 ? "font" : "image"), a = x(null), s = k(() => T.instance.avaiableFonts.map((h) => h.name[0])), r = () => {
1025
- const d = T.instance.curDocument.database;
1024
+ const { t: e } = N(), { fonts: n, images: i } = $e(), l = x(!0), o = k(() => n.size > 0 ? "font" : "image"), a = x(null), s = k(() => B.instance.avaiableFonts.map((h) => h.name[0])), r = () => {
1025
+ const d = B.instance.curDocument.database;
1026
1026
  i.forEach((_) => {
1027
1027
  _.file && _.ids.forEach((b) => {
1028
1028
  const S = d.tables.blockTable.modelSpace.getIdAt(
@@ -1047,7 +1047,7 @@ const Bt = /* @__PURE__ */ L({
1047
1047
  n.set(d, h);
1048
1048
  };
1049
1049
  return (d, h) => {
1050
- const _ = M("el-col"), b = M("el-row"), S = M("el-option"), $ = M("el-select"), I = M("el-tab-pane"), V = M("el-table-column"), B = M("el-button"), P = M("el-table"), R = M("el-tabs");
1050
+ const _ = M("el-col"), b = M("el-row"), S = M("el-option"), $ = M("el-select"), I = M("el-tab-pane"), V = M("el-table-column"), T = M("el-button"), P = M("el-table"), R = M("el-tabs");
1051
1051
  return c(), C(Te, {
1052
1052
  title: g(e)("dialog.replacementDlg.title"),
1053
1053
  modelValue: l.value,
@@ -1148,7 +1148,7 @@ const Bt = /* @__PURE__ */ L({
1148
1148
  width: "60"
1149
1149
  }, {
1150
1150
  default: p(({ row: z }) => [
1151
- v(B, {
1151
+ v(T, {
1152
1152
  link: "",
1153
1153
  type: "primary",
1154
1154
  size: "small",
@@ -1524,7 +1524,7 @@ function oo(t, e) {
1524
1524
  const lo = { render: oo }, ao = /* @__PURE__ */ L({
1525
1525
  __name: "MlPointStyleDlg",
1526
1526
  setup(t) {
1527
- const { t: e } = N(), n = Dt(T.instance), i = x(!0), l = x(0), o = [
1527
+ const { t: e } = N(), n = Dt(B.instance), i = x(!0), l = x(0), o = [
1528
1528
  [
1529
1529
  { id: 0, icon: en },
1530
1530
  { id: 1, icon: on },
@@ -1560,7 +1560,7 @@ const lo = { render: oo }, ao = /* @__PURE__ */ L({
1560
1560
  const s = (f, d) => o[f][d].id == l.value ? "primary" : null, r = (f, d) => {
1561
1561
  l.value = o[f][d].id;
1562
1562
  }, m = () => {
1563
- T.instance.curDocument.database.pdmode = l.value;
1563
+ B.instance.curDocument.database.pdmode = l.value;
1564
1564
  }, w = () => {
1565
1565
  a();
1566
1566
  };
@@ -1591,7 +1591,7 @@ const lo = { render: oo }, ao = /* @__PURE__ */ L({
1591
1591
  v(h, {
1592
1592
  icon: I.icon,
1593
1593
  type: s($, V),
1594
- onClick: (B) => r($, V),
1594
+ onClick: (T) => r($, V),
1595
1595
  style: { "font-size": "25px" }
1596
1596
  }, null, 8, ["icon", "type", "onClick"])
1597
1597
  ]),
@@ -1883,7 +1883,7 @@ function Eo(t, e, n) {
1883
1883
  }
1884
1884
  }, d = (_) => {
1885
1885
  if (i.value && o.value && l.value) {
1886
- const b = window.innerWidth, S = window.innerHeight, $ = t.value, I = $.getBoundingClientRect(), V = I.width, B = I.height, P = o.value.x + (_.clientX - a.x), R = o.value.y + (_.clientY - a.y);
1886
+ const b = window.innerWidth, S = window.innerHeight, $ = t.value, I = $.getBoundingClientRect(), V = I.width, T = I.height, P = o.value.x + (_.clientX - a.x), R = o.value.y + (_.clientY - a.y);
1887
1887
  l.value.x = Math.max(
1888
1888
  n ? n.value.offset.value.left : 0,
1889
1889
  P
@@ -1894,9 +1894,9 @@ function Eo(t, e, n) {
1894
1894
  l.value.x
1895
1895
  ), l.value.y = Math.max(
1896
1896
  n ? n.value.offset.value.top : 0,
1897
- Math.min(R, S - B)
1897
+ Math.min(R, S - T)
1898
1898
  );
1899
- const A = S - B;
1899
+ const A = S - T;
1900
1900
  l.value.y = Math.min(
1901
1901
  n ? A - n.value.offset.value.bottom : A,
1902
1902
  l.value.y
@@ -1985,13 +1985,13 @@ function Io(t, e = x(!1), n = x(!1), i = x({ left: 0, right: 0, top: 0, bottom:
1985
1985
  const d = 5, h = x(null), _ = (V) => {
1986
1986
  if (!(!t.value || e.value))
1987
1987
  if (a.value) {
1988
- const B = V.clientX - w, P = V.clientY - f;
1988
+ const T = V.clientX - w, P = V.clientY - f;
1989
1989
  if (h.value === "left" || h.value === "left-bottom-corner") {
1990
- const R = r - B;
1991
- R > l.width && (o.value.width = R, o.value.left = s + B, t.value.style.left = o.value.left + "px", t.value.style.width = o.value.width + "px");
1990
+ const R = r - T;
1991
+ R > l.width && (o.value.width = R, o.value.left = s + T, t.value.style.left = o.value.left + "px", t.value.style.width = o.value.width + "px");
1992
1992
  }
1993
1993
  if (h.value === "right" || h.value === "right-bottom-corner") {
1994
- const R = r + B;
1994
+ const R = r + T;
1995
1995
  R > l.width && (o.value.width = R, t.value.style.width = o.value.width + "px");
1996
1996
  }
1997
1997
  if (h.value === "bottom" || h.value === "left-bottom-corner" || h.value === "right-bottom-corner") {
@@ -1999,13 +1999,13 @@ function Io(t, e = x(!1), n = x(!1), i = x({ left: 0, right: 0, top: 0, bottom:
1999
1999
  R > l.height && (o.value.height = R, t.value.style.height = o.value.height + "px");
2000
2000
  }
2001
2001
  } else {
2002
- const B = t.value.getBoundingClientRect(), P = V.clientX - B.left, R = V.clientY - B.top, z = P <= d, A = P >= B.width - d, O = R >= B.height - d;
2002
+ const T = t.value.getBoundingClientRect(), P = V.clientX - T.left, R = V.clientY - T.top, z = P <= d, A = P >= T.width - d, O = R >= T.height - d;
2003
2003
  z && O && n.value ? (t.value.style.cursor = "nesw-resize", h.value = "left-bottom-corner") : A && O && !n.value ? (t.value.style.cursor = "nwse-resize", h.value = "right-bottom-corner") : z && n.value ? (t.value.style.cursor = "ew-resize", h.value = "left") : A && !n.value ? (t.value.style.cursor = "ew-resize", h.value = "right") : O ? (t.value.style.cursor = "ns-resize", h.value = "bottom") : (t.value.style.cursor = "", h.value = null);
2004
2004
  }
2005
2005
  }, b = (V) => {
2006
2006
  if (!t.value || !h.value) return;
2007
- const B = t.value.getBoundingClientRect();
2008
- w = V.clientX, f = V.clientY, r = B.width, m = B.height, s = B.left, o.value.width = r, o.value.height = m, o.value.left = B.left, o.value.top = B.top, a.value = !0, document.addEventListener("mousemove", _), document.addEventListener("mouseup", S);
2007
+ const T = t.value.getBoundingClientRect();
2008
+ w = V.clientX, f = V.clientY, r = T.width, m = T.height, s = T.left, o.value.width = r, o.value.height = m, o.value.left = T.left, o.value.top = T.top, a.value = !0, document.addEventListener("mousemove", _), document.addEventListener("mouseup", S);
2009
2009
  }, S = () => {
2010
2010
  a.value = !1, h.value = null, t.value && (t.value.style.cursor = ""), document.removeEventListener("mousemove", _), document.removeEventListener("mouseup", S);
2011
2011
  }, $ = () => {
@@ -2078,14 +2078,14 @@ function No(t, e, n, i) {
2078
2078
  } else
2079
2079
  A.left + A.width >= window.innerWidth && z < 0 && (d.value.left = Math.max(0, O));
2080
2080
  }
2081
- }, B = () => {
2081
+ }, T = () => {
2082
2082
  const z = window.innerWidth - l.value;
2083
2083
  l.value = window.innerWidth, o.value = window.innerHeight, V(z);
2084
2084
  };
2085
2085
  H(() => {
2086
- window.addEventListener("resize", B);
2086
+ window.addEventListener("resize", T);
2087
2087
  }), te(() => {
2088
- window.removeEventListener("resize", B);
2088
+ window.removeEventListener("resize", T);
2089
2089
  });
2090
2090
  const P = (z) => {
2091
2091
  z ? (d.value.width = Me, f.value && b.value && _.value && (d.value.left = b.value + _.value - Me)) : (d.value.width = _.value, f.value && b.value && _.value && (d.value.left = b.value));
@@ -2306,7 +2306,7 @@ const Po = (t) => (Le("data-v-11a64c54"), t = t(), ze(), t), Oo = /* @__PURE__ *
2306
2306
  ) : i;
2307
2307
  w(f);
2308
2308
  }, s = () => {
2309
- l.value && (T.instance.sendStringToExecute(l.value), o.value = l.value, l.value = "");
2309
+ l.value && (B.instance.sendStringToExecute(l.value), o.value = l.value, l.value = "");
2310
2310
  }, r = (m, w) => `${w}: ${fe(m, w)}`;
2311
2311
  return (m, w) => (c(), y("div", Zo, [
2312
2312
  g(n).isShowCommandLine ? (c(), C(g(Ze), {
@@ -2342,7 +2342,7 @@ const Po = (t) => (Le("data-v-11a64c54"), t = t(), ze(), t), Oo = /* @__PURE__ *
2342
2342
  "11fa7d7e": s.value
2343
2343
  }));
2344
2344
  const { t: e } = N(), n = x(!1), i = x(-1), l = x(-1), o = x(null), a = k(() => i.value + "px"), s = k(() => l.value + "px"), r = k(() => {
2345
- const d = T.instance.curDocument.database;
2345
+ const d = B.instance.curDocument.database;
2346
2346
  if (o.value) {
2347
2347
  const h = d.tables.blockTable.modelSpace.getIdAt(o.value);
2348
2348
  if (h)
@@ -2365,10 +2365,10 @@ const Po = (t) => (Le("data-v-11a64c54"), t = t(), ze(), t), Oo = /* @__PURE__ *
2365
2365
  n.value = !1;
2366
2366
  };
2367
2367
  return H(() => {
2368
- const d = T.instance.curView.events;
2368
+ const d = B.instance.curView.events;
2369
2369
  d.hover.addEventListener(w), d.unhover.addEventListener(f);
2370
2370
  }), te(() => {
2371
- const d = T.instance.curView.events;
2371
+ const d = B.instance.curView.events;
2372
2372
  d.hover.removeEventListener(w), d.unhover.removeEventListener(f);
2373
2373
  }), (d, h) => {
2374
2374
  const _ = M("el-text"), b = M("el-col"), S = M("el-row"), $ = M("el-card");
@@ -2612,7 +2612,7 @@ const _l = /* @__PURE__ */ L({
2612
2612
  __name: "MlMainMenu",
2613
2613
  setup(t) {
2614
2614
  const { t: e } = N(), n = (i) => {
2615
- i === "Convert" ? new Ae().tirgger(T.instance.context) : i === "QNew" ? new Fe().tirgger(T.instance.context) : i === "Open" && new Ie().tirgger(T.instance.context);
2615
+ i === "Convert" ? new Ae().tirgger(B.instance.context) : i === "QNew" ? new Fe().tirgger(B.instance.context) : i === "Open" && new Ie().tirgger(B.instance.context);
2616
2616
  };
2617
2617
  return (i, l) => {
2618
2618
  const o = M("el-icon"), a = M("el-dropdown-item"), s = M("el-dropdown-menu"), r = M("el-dropdown");
@@ -2693,7 +2693,7 @@ const _l = /* @__PURE__ */ L({
2693
2693
  description: e("main.verticalToolbar.layer.description")
2694
2694
  }
2695
2695
  ]), l = (o) => {
2696
- T.instance.sendStringToExecute(o);
2696
+ B.instance.sendStringToExecute(o);
2697
2697
  };
2698
2698
  return (o, a) => g(n).isShowToolbar ? (c(), y("div", yl, [
2699
2699
  v(g(Bo), {
@@ -2724,7 +2724,7 @@ const _l = /* @__PURE__ */ L({
2724
2724
  __name: "MlPointStyleButton",
2725
2725
  setup(t) {
2726
2726
  const { t: e } = N(), n = () => {
2727
- T.instance.sendStringToExecute("pttype");
2727
+ B.instance.sendStringToExecute("pttype");
2728
2728
  };
2729
2729
  return (i, l) => {
2730
2730
  const o = M("el-button"), a = M("el-tooltip");
@@ -2758,7 +2758,7 @@ const _l = /* @__PURE__ */ L({
2758
2758
  const r = zt(a.subStage);
2759
2759
  s.setText(r);
2760
2760
  }
2761
- n.value = a.percentage, n.value < 100 ? i.value = !0 : (i.value = !1, s.close(), T.instance.curView.zoomToFit());
2761
+ n.value = a.percentage, n.value < 100 ? i.value = !0 : (i.value = !1, s.close(), B.instance.curView.zoomToFit());
2762
2762
  } else if (a.stage === "FETCH_FILE") {
2763
2763
  const s = we.service({
2764
2764
  lock: !0
@@ -2872,7 +2872,7 @@ const _l = /* @__PURE__ */ L({
2872
2872
  __name: "MlWarningButton",
2873
2873
  setup(t) {
2874
2874
  const e = () => {
2875
- T.instance.sendStringToExecute("md");
2875
+ B.instance.sendStringToExecute("md");
2876
2876
  }, { fonts: n, images: i } = $e(), l = k(() => i.size > 0 || n.size > 0);
2877
2877
  return (o, a) => {
2878
2878
  const s = M("el-button");
@@ -2888,7 +2888,7 @@ const _l = /* @__PURE__ */ L({
2888
2888
  }), El = /* @__PURE__ */ G(Tl, [["__scopeId", "data-v-3411a3ec"]]), $l = /* @__PURE__ */ L({
2889
2889
  __name: "MlStatusBar",
2890
2890
  setup(t) {
2891
- const { text: e } = dt(T.instance.curView), n = gt(T.instance), i = ce(), l = (o) => {
2891
+ const { text: e } = dt(B.instance.curView), n = gt(B.instance), i = ce(), l = (o) => {
2892
2892
  Be().layoutManager.setCurrentLayoutBtrId(
2893
2893
  o.blockTableRecordId
2894
2894
  );
@@ -2954,11 +2954,11 @@ const _l = /* @__PURE__ */ L({
2954
2954
  setup(t) {
2955
2955
  const e = t, { t: n } = N(), { effectiveLocale: i, elementPlusLocale: l } = Ee(e.locale), o = x(), a = x(null), s = k(() => a.value), r = async (f, d) => {
2956
2956
  const h = { minimumChunkSize: 1e3 };
2957
- await T.instance.openDocument(f, d, h), Q.fileName = f;
2957
+ await B.instance.openDocument(f, d, h), Q.fileName = f;
2958
2958
  }, m = async (f) => {
2959
2959
  try {
2960
2960
  const d = { minimumChunkSize: 1e3 };
2961
- await T.instance.openUrl(f, d);
2961
+ await B.instance.openUrl(f, d);
2962
2962
  const h = f.split("/").pop();
2963
2963
  Q.fileName = h ?? "";
2964
2964
  } catch (d) {
@@ -2983,12 +2983,12 @@ const _l = /* @__PURE__ */ L({
2983
2983
  ($, I) => {
2984
2984
  _.onload = (V) => {
2985
2985
  var P;
2986
- const B = (P = V.target) == null ? void 0 : P.result;
2987
- B ? $(B) : I(new Error("Failed to read file content"));
2986
+ const T = (P = V.target) == null ? void 0 : P.result;
2987
+ T ? $(T) : I(new Error("Failed to read file content"));
2988
2988
  }, _.onerror = () => I(new Error("Failed to read file"));
2989
2989
  }
2990
2990
  ), S = { minimumChunkSize: 1e3 };
2991
- await T.instance.openDocument(f.name, b, S), Q.fileName = f.name;
2991
+ await B.instance.openDocument(f.name, b, S), Q.fileName = f.name;
2992
2992
  } catch (h) {
2993
2993
  console.error("Failed to open local file:", h), Z({
2994
2994
  message: n("main.message.failedToOpenFile", { fileName: f.name }),
@@ -3011,10 +3011,10 @@ const _l = /* @__PURE__ */ L({
3011
3011
  ), E(
3012
3012
  () => e.background,
3013
3013
  (f) => {
3014
- f != null && (T.instance.curView.backgroundColor = f);
3014
+ f != null && (B.instance.curView.backgroundColor = f);
3015
3015
  }
3016
3016
  ), H(async () => {
3017
- o.value && (Nl(o.value), Rl(), a.value = T.instance), e.url ? m(e.url) : e.localFile && w(e.localFile), e.background != null && (T.instance.curView.backgroundColor = e.background);
3017
+ o.value && (Nl(o.value), Rl(), a.value = B.instance), e.url ? m(e.url) : e.localFile && w(e.localFile), e.background != null && (B.instance.curView.backgroundColor = e.background);
3018
3018
  }), Y.on("message", (f) => {
3019
3019
  Z({
3020
3020
  message: f.message,
@@ -3114,7 +3114,7 @@ const _l = /* @__PURE__ */ L({
3114
3114
  props: {}
3115
3115
  });
3116
3116
  }, Nl = (t) => {
3117
- T.createInstance(t), Re(), Il();
3117
+ B.createInstance(t), Re(), Il(), B.instance.loadDefaultFonts();
3118
3118
  }, Q = U({
3119
3119
  fileName: "",
3120
3120
  dialogs: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/cad-viewer",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "vue-eslint-parser": "^9.4.3",
44
44
  "vue-tsc": "^2.1.6",
45
45
  "@mlightcad/svg-renderer": "0.0.17",
46
- "@mlightcad/three-renderer": "1.0.19"
46
+ "@mlightcad/three-renderer": "1.0.20"
47
47
  },
48
48
  "dependencies": {
49
49
  "@element-plus/icons-vue": "^2.3.1",
@@ -56,7 +56,7 @@
56
56
  "element-plus": "^2.9.1",
57
57
  "vue": "^3.4.21",
58
58
  "vue-i18n": "^10.0.1",
59
- "@mlightcad/cad-simple-viewer": "1.1.2"
59
+ "@mlightcad/cad-simple-viewer": "1.1.4"
60
60
  },
61
61
  "scripts": {
62
62
  "analyze": "vite build --mode analyze",