@jnrs/lingshu-smart 3.1.11 → 3.1.12

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.
@@ -20,6 +20,22 @@ export interface PreviewActions {
20
20
  * @returns 设备信息
21
21
  */
22
22
  onDragEnd?: (layer: ILayer, data: InteractiveUi) => void;
23
+ /**
24
+ * 画布级左键点击事件(监听整个画布任意位置,含空白区域;命中设备时会与 onTap 同时触发)
25
+ * @param point 画布内坐标
26
+ */
27
+ onCanvasTap?: (point: {
28
+ x: number;
29
+ y: number;
30
+ }) => void;
31
+ /**
32
+ * 画布级右键点击事件(监听整个画布任意位置;引擎已阻止浏览器默认右键菜单)
33
+ * @param point 画布内坐标
34
+ */
35
+ onCanvasMenuTap?: (point: {
36
+ x: number;
37
+ y: number;
38
+ }) => void;
23
39
  }
24
40
  type __VLS_Props = {
25
41
  actions?: PreviewActions;
@@ -16083,7 +16099,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
16083
16099
  })[];
16084
16100
  } | null>;
16085
16101
  operating: (data: ILayerOperating) => void;
16086
- feedSocketMessage: (msg: unknown) => void;
16102
+ feedSocketMessage: (msg: unknown, source?: unknown) => void;
16087
16103
  setSocketHandlers: (handlers: Pick<import('../../controller/SocketDispatcher').SocketDispatcherOptions, "onAck" | "onRaw">) => void;
16088
16104
  resetModels: () => void;
16089
16105
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
@@ -26,8 +26,9 @@ export declare class SocketDispatcher {
26
26
  /**
27
27
  * 分发一条完整业务消息(envelope + payload)
28
28
  * @param msg 原始消息
29
+ * @param source 触发本消息的源 socket 消息(WsProxy 翻译前原始报文;仅用于资源实体 rawData 溯源,可缺省)
29
30
  */
30
- dispatch(msg: unknown): void;
31
+ dispatch(msg: unknown, source?: unknown): void;
31
32
  private handleDeviceCommand;
32
33
  /** 将 device_command payload 转换为内部 operating(position 比例值 → 像素) */
33
34
  private buildDeviceOperating;
@@ -1,4 +1,4 @@
1
- import { b as e } from "./index-CQO74KdA.js";
1
+ import { b as e } from "./index-CQbsL_m9.js";
2
2
  import { ref as c, onMounted as t, onUnmounted as N } from "vue";
3
3
  function O(s) {
4
4
  return s?.className === e.MACHINE_TOOL;
@@ -68,7 +68,7 @@ function et(t = "") {
68
68
  };
69
69
  }
70
70
  const fi = et("LingshuSmart");
71
- var Lt = typeof global == "object" && global && global.Object === Object && global, be = typeof self == "object" && self && self.Object === Object && self, b = Lt || be || Function("return this")(), S = b.Symbol, Nt = Object.prototype, _e = Nt.hasOwnProperty, ye = Nt.toString, I = S ? S.toStringTag : void 0;
71
+ var Lt = typeof global == "object" && global && global.Object === Object && global, be = typeof self == "object" && self && self.Object === Object && self, y = Lt || be || Function("return this")(), S = y.Symbol, Nt = Object.prototype, _e = Nt.hasOwnProperty, ye = Nt.toString, I = S ? S.toStringTag : void 0;
72
72
  function Te(t) {
73
73
  var e = _e.call(t, I), r = t[I];
74
74
  try {
@@ -102,7 +102,7 @@ function Pt(t) {
102
102
  var e = P(t);
103
103
  return e == je || e == xe || e == ve || e == Re;
104
104
  }
105
- var K = b["__core-js_shared__"], ft = (function() {
105
+ var K = y["__core-js_shared__"], ft = (function() {
106
106
  var t = /[^.]+$/.exec(K && K.keys && K.keys.IE_PROTO || "");
107
107
  return t ? "Symbol(src)_1." + t : "";
108
108
  })();
@@ -139,7 +139,7 @@ function m(t, e) {
139
139
  var r = ke(t, e);
140
140
  return De(r) ? r : void 0;
141
141
  }
142
- var Y = m(b, "WeakMap"), ht = Object.create, Be = /* @__PURE__ */ (function() {
142
+ var Y = m(y, "WeakMap"), ht = Object.create, Be = /* @__PURE__ */ (function() {
143
143
  function t() {
144
144
  }
145
145
  return function(e) {
@@ -213,7 +213,7 @@ var Dt = Object.prototype, er = Dt.hasOwnProperty, rr = Dt.propertyIsEnumerable,
213
213
  function or() {
214
214
  return !1;
215
215
  }
216
- var kt = typeof exports == "object" && exports && !exports.nodeType && exports, pt = kt && typeof module == "object" && module && !module.nodeType && module, ir = pt && pt.exports === kt, bt = ir ? b.Buffer : void 0, ar = bt ? bt.isBuffer : void 0, Bt = ar || or, sr = "[object Arguments]", cr = "[object Array]", ur = "[object Boolean]", lr = "[object Date]", fr = "[object Error]", hr = "[object Function]", dr = "[object Map]", gr = "[object Number]", pr = "[object Object]", br = "[object RegExp]", _r = "[object Set]", yr = "[object String]", Tr = "[object WeakMap]", wr = "[object ArrayBuffer]", Or = "[object DataView]", Ar = "[object Float32Array]", mr = "[object Float64Array]", Sr = "[object Int8Array]", vr = "[object Int16Array]", jr = "[object Int32Array]", xr = "[object Uint8Array]", Rr = "[object Uint8ClampedArray]", Ir = "[object Uint16Array]", Er = "[object Uint32Array]", c = {};
216
+ var kt = typeof exports == "object" && exports && !exports.nodeType && exports, pt = kt && typeof module == "object" && module && !module.nodeType && module, ir = pt && pt.exports === kt, bt = ir ? y.Buffer : void 0, ar = bt ? bt.isBuffer : void 0, Bt = ar || or, sr = "[object Arguments]", cr = "[object Array]", ur = "[object Boolean]", lr = "[object Date]", fr = "[object Error]", hr = "[object Function]", dr = "[object Map]", gr = "[object Number]", pr = "[object Object]", br = "[object RegExp]", _r = "[object Set]", yr = "[object String]", Tr = "[object WeakMap]", wr = "[object ArrayBuffer]", Or = "[object DataView]", Ar = "[object Float32Array]", mr = "[object Float64Array]", Sr = "[object Int8Array]", vr = "[object Int16Array]", jr = "[object Int32Array]", xr = "[object Uint8Array]", Rr = "[object Uint8ClampedArray]", Ir = "[object Uint16Array]", Er = "[object Uint32Array]", c = {};
217
217
  c[Ar] = c[mr] = c[Sr] = c[vr] = c[jr] = c[xr] = c[Rr] = c[Ir] = c[Er] = !0;
218
218
  c[sr] = c[cr] = c[wr] = c[ur] = c[Or] = c[lr] = c[fr] = c[hr] = c[dr] = c[gr] = c[pr] = c[br] = c[_r] = c[yr] = c[Tr] = !1;
219
219
  function Cr(t) {
@@ -337,7 +337,7 @@ w.prototype.delete = rn;
337
337
  w.prototype.get = nn;
338
338
  w.prototype.has = on;
339
339
  w.prototype.set = an;
340
- var N = m(b, "Map");
340
+ var N = m(y, "Map");
341
341
  function sn() {
342
342
  this.size = 0, this.__data__ = {
343
343
  hash: new O(),
@@ -418,7 +418,7 @@ x.prototype.delete = bn;
418
418
  x.prototype.get = _n;
419
419
  x.prototype.has = yn;
420
420
  x.prototype.set = wn;
421
- var Wt = typeof exports == "object" && exports && !exports.nodeType && exports, yt = Wt && typeof module == "object" && module && !module.nodeType && module, On = yt && yt.exports === Wt, Tt = On ? b.Buffer : void 0;
421
+ var Wt = typeof exports == "object" && exports && !exports.nodeType && exports, yt = Wt && typeof module == "object" && module && !module.nodeType && module, On = yt && yt.exports === Wt, Tt = On ? y.Buffer : void 0;
422
422
  Tt && Tt.allocUnsafe;
423
423
  function An(t, e) {
424
424
  return t.slice();
@@ -445,7 +445,7 @@ function Rn(t, e, r) {
445
445
  function In(t) {
446
446
  return Rn(t, Br, xn);
447
447
  }
448
- var X = m(b, "DataView"), q = m(b, "Promise"), Z = m(b, "Set"), Ot = "[object Map]", En = "[object Object]", At = "[object Promise]", mt = "[object Set]", St = "[object WeakMap]", vt = "[object DataView]", Cn = A(X), $n = A(N), Ln = A(q), Nn = A(Z), Pn = A(Y), T = P;
448
+ var X = m(y, "DataView"), q = m(y, "Promise"), Z = m(y, "Set"), Ot = "[object Map]", En = "[object Object]", At = "[object Promise]", mt = "[object Set]", St = "[object WeakMap]", vt = "[object DataView]", Cn = A(X), $n = A(N), Ln = A(q), Nn = A(Z), Pn = A(Y), T = P;
449
449
  (X && T(new X(new ArrayBuffer(1))) != vt || N && T(new N()) != Ot || q && T(q.resolve()) != At || Z && T(new Z()) != mt || Y && T(new Y()) != St) && (T = function(t) {
450
450
  var e = P(t), r = e == En ? t.constructor : void 0, n = r ? A(r) : "";
451
451
  if (n)
@@ -468,7 +468,7 @@ function Mn(t) {
468
468
  var e = t.length, r = new t.constructor(e);
469
469
  return e && typeof t[0] == "string" && Un.call(t, "index") && (r.index = t.index, r.input = t.input), r;
470
470
  }
471
- var jt = b.Uint8Array;
471
+ var jt = y.Uint8Array;
472
472
  function ot(t) {
473
473
  var e = new t.constructor(t.byteLength);
474
474
  return new jt(e).set(new jt(t)), e;
@@ -568,9 +568,9 @@ function D(t, e, r, n, i, o) {
568
568
  }) : go(t) && t.forEach(function(g, h) {
569
569
  a.set(h, D(g, e, r, h, t, o));
570
570
  });
571
- var _ = In, y = l ? void 0 : _(t);
572
- return ze(y || t, function(g, h) {
573
- y && (h = g, g = t[h]), Ye(a, h, D(g, e, r, h, t, o));
571
+ var b = In, _ = l ? void 0 : b(t);
572
+ return ze(_ || t, function(g, h) {
573
+ _ && (h = g, g = t[h]), Ye(a, h, D(g, e, r, h, t, o));
574
574
  }), a;
575
575
  }
576
576
  var Bo = 1, zo = 4;
@@ -662,9 +662,9 @@ function Yt(t) {
662
662
  } = t, u = String(e);
663
663
  if (!u)
664
664
  return new at({ text: "", width: r, height: n, visible: 0 });
665
- const d = u.length, _ = Math.min(n * 0.8, r * 0.5), y = 12, g = r / (d * 0.6);
666
- let h = Math.min(_, g);
667
- return h < y && (h = y), new at({
665
+ const d = u.length, b = Math.min(n * 0.8, r * 0.5), _ = 12, g = r / (d * 0.6);
666
+ let h = Math.min(b, g);
667
+ return h < _ && (h = _), new at({
668
668
  hittable: f,
669
669
  className: i,
670
670
  text: u,
@@ -723,8 +723,7 @@ class Zo extends Jt {
723
723
  super({ ...r, ...e });
724
724
  }
725
725
  createUi() {
726
- const { x: e, y: r, width: n, height: i, color: o, resourceType: a, resourceId: l, name: f, hittable: u } = this.config, d = Xt(a, n || 0);
727
- return new $t({
726
+ const { x: e, y: r, width: n, height: i, color: o, resourceType: a, resourceId: l, name: f, hittable: u } = this.config, d = Xt(a, n || 0), b = new $t({
728
727
  hittable: u,
729
728
  className: `Resource-${a}`,
730
729
  x: e,
@@ -751,16 +750,18 @@ class Zo extends Jt {
751
750
  { scale: 0.5, opacity: 0 }
752
751
  ],
753
752
  duration: 0.3
754
- },
755
- children: [
756
- Yt({
757
- name: f,
758
- width: n,
759
- height: i,
760
- fill: qo(o)
761
- })
762
- ]
753
+ }
763
754
  });
755
+ if (f) {
756
+ const _ = Yt({
757
+ name: f,
758
+ width: n,
759
+ height: i,
760
+ fill: qo(o)
761
+ });
762
+ b.add(_);
763
+ }
764
+ return b;
764
765
  }
765
766
  }
766
767
  function Qo(t) {
@@ -910,8 +911,8 @@ class bi extends Jt {
910
911
  disabled: f,
911
912
  visible: u,
912
913
  background: d = k,
913
- stroke: _ = "#999999",
914
- strokeWidth: y = 2,
914
+ stroke: b = "#999999",
915
+ strokeWidth: _ = 2,
915
916
  textColor: g = "#6F7177",
916
917
  showShadow: h = !0,
917
918
  showText: H = !0,
@@ -933,8 +934,8 @@ class bi extends Jt {
933
934
  rotation: this.autoFixRotation,
934
935
  fill: d,
935
936
  hitFill: "all",
936
- stroke: _,
937
- strokeWidth: U.strokeWidth ?? y,
937
+ stroke: b,
938
+ strokeWidth: U.strokeWidth ?? _,
938
939
  inFlow: ee,
939
940
  data: this.config
940
941
  });
@@ -1169,15 +1170,15 @@ function* Ti(t, e, r = !1) {
1169
1170
  const wi = (t = 0, e = 100, r = 3, n = 300, i) => i ? new Promise((o) => {
1170
1171
  const a = t, l = e, f = r * 1e3, u = performance.now();
1171
1172
  let d = 0;
1172
- const _ = (y) => {
1173
- const g = y - u, h = Math.min(g / f, 1), H = a + (l - a) * h;
1173
+ const b = (_) => {
1174
+ const g = _ - u, h = Math.min(g / f, 1), H = a + (l - a) * h;
1174
1175
  if (i(H.toFixed(2)), h >= 1) {
1175
1176
  cancelAnimationFrame(d), o();
1176
1177
  return;
1177
1178
  }
1178
- d = requestAnimationFrame(_);
1179
+ d = requestAnimationFrame(b);
1179
1180
  };
1180
- d = requestAnimationFrame(_);
1181
+ d = requestAnimationFrame(b);
1181
1182
  }) : !1;
1182
1183
  function Oi(t, e, r = 3, n) {
1183
1184
  return t === void 0 || e === void 0 ? 0 : n ? e > 0 ? Number((t / e).toFixed(3)) : 0 : Number((e * t).toFixed(r));
@@ -1254,6 +1255,6 @@ export {
1254
1255
  F as v,
1255
1256
  P as w,
1256
1257
  z as x,
1257
- b as y,
1258
+ y,
1258
1259
  it as z
1259
1260
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { D as s, d as o, c as t, b as n, f as r, e as i, E as l, a as p, g as u, M as c, R as E, e as m, p as T, q as g, m as S, r as L, u as P, k as R, l as h, o as x, n as y, s as C, h as d, t as D, j as _, i as M } from "./index-CQO74KdA.js";
2
- import { h as b, b as f, d as v, i as G, g as I, e as F, c as V, f as Y, a as j, u as k } from "./fullscreen-65kfHX9T.js";
1
+ import { D as s, d as o, c as t, b as n, f as r, e as i, E as l, a as p, g as u, M as c, R as E, e as m, p as T, q as g, m as S, r as L, u as P, k as R, l as h, o as x, n as y, s as C, h as d, t as D, j as _, i as M } from "./index-CQbsL_m9.js";
2
+ import { h as b, b as f, d as v, i as G, g as I, e as F, c as V, f as Y, a as j, u as k } from "./fullscreen-DhhBmMbU.js";
3
3
  export {
4
4
  s as DEVICE_TYPE_TO_MODEL,
5
5
  o as EnumComponent,
@@ -16045,7 +16045,7 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
16045
16045
  })[];
16046
16046
  } | null>;
16047
16047
  operating: (data: import('../types').ILayerOperating) => void;
16048
- feedSocketMessage: (msg: unknown) => void;
16048
+ feedSocketMessage: (msg: unknown, source?: unknown) => void;
16049
16049
  setSocketHandlers: (handlers: Pick<import('../controller/SocketDispatcher').SocketDispatcherOptions, "onAck" | "onRaw">) => void;
16050
16050
  resetModels: () => void;
16051
16051
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
@@ -32105,7 +32105,7 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
32105
32105
  })[];
32106
32106
  } | null>;
32107
32107
  operating: (data: import('../types').ILayerOperating) => void;
32108
- feedSocketMessage: (msg: unknown) => void;
32108
+ feedSocketMessage: (msg: unknown, source?: unknown) => void;
32109
32109
  setSocketHandlers: (handlers: Pick<import('../controller/SocketDispatcher').SocketDispatcherOptions, "onAck" | "onRaw">) => void;
32110
32110
  resetModels: () => void;
32111
32111
  }, {}, {}, {}, {
@@ -1,4 +1,4 @@
1
- import { b as a, u as o, c as r, a as t } from "../useAppStore-1b0Tv_2r.js";
1
+ import { b as a, u as o, c as r, a as t } from "../useAppStore-pFUKEFCZ.js";
2
2
  export {
3
3
  a as useAppStore,
4
4
  o as useDataStore,
@@ -16040,7 +16040,7 @@ export declare const useAppStore: import('pinia').StoreDefinition<"@jnrs/lingshu
16040
16040
  resizeContainer: () => void;
16041
16041
  destroyContainer: () => void;
16042
16042
  operating: (data: ILayerOperating) => void;
16043
- feedSocketMessage: (msg: unknown) => void;
16043
+ feedSocketMessage: (msg: unknown, source?: unknown) => void;
16044
16044
  setSocketHandlers: (handlers: Pick<SocketDispatcherOptions, "onAck" | "onRaw">) => void;
16045
16045
  resetModels: () => void;
16046
16046
  syncDeviceRegistry: (entries: Array<{
@@ -32087,7 +32087,7 @@ export declare const useAppStore: import('pinia').StoreDefinition<"@jnrs/lingshu
32087
32087
  resizeContainer: () => void;
32088
32088
  destroyContainer: () => void;
32089
32089
  operating: (data: ILayerOperating) => void;
32090
- feedSocketMessage: (msg: unknown) => void;
32090
+ feedSocketMessage: (msg: unknown, source?: unknown) => void;
32091
32091
  setSocketHandlers: (handlers: Pick<SocketDispatcherOptions, "onAck" | "onRaw">) => void;
32092
32092
  resetModels: () => void;
32093
32093
  syncDeviceRegistry: (entries: Array<{
@@ -48134,7 +48134,7 @@ export declare const useAppStore: import('pinia').StoreDefinition<"@jnrs/lingshu
48134
48134
  resizeContainer: () => void;
48135
48135
  destroyContainer: () => void;
48136
48136
  operating: (data: ILayerOperating) => void;
48137
- feedSocketMessage: (msg: unknown) => void;
48137
+ feedSocketMessage: (msg: unknown, source?: unknown) => void;
48138
48138
  setSocketHandlers: (handlers: Pick<SocketDispatcherOptions, "onAck" | "onRaw">) => void;
48139
48139
  resetModels: () => void;
48140
48140
  syncDeviceRegistry: (entries: Array<{
@@ -50,6 +50,14 @@ export interface IEventHandler {
50
50
  onTap?: (layer: ILayer, data: InteractiveUi) => void;
51
51
  onMenuTap?: (layer: ILayer, data: InteractiveUi) => void;
52
52
  onDragEnd?: (layer: ILayer, data: InteractiveUi) => void;
53
+ onCanvasTap?: (point: {
54
+ x: number;
55
+ y: number;
56
+ }) => void;
57
+ onCanvasMenuTap?: (point: {
58
+ x: number;
59
+ y: number;
60
+ }) => void;
53
61
  }
54
62
  /**
55
63
  * 工位槽资源放置模式