vis-core 0.23.0 → 0.23.2

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.
@@ -90,7 +90,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
90
90
  ).toString(CryptoJS.enc.Utf8), qe = JSON.parse($e), st = Date.now();
91
91
  return !qe.s || qe.s > st ? (this.token = void 0, "") : qe.e && qe.e < st ? (this.token = void 0, "") : (qe.isValid = Qe, qe);
92
92
  }
93
- }, version = "0.23.0";
93
+ }, version = "0.23.2";
94
94
  /**
95
95
  * @license
96
96
  * Copyright 2010-2024 Three.js Authors
@@ -49434,7 +49434,7 @@ class Viewport {
49434
49434
  if (this.vis = this.options.visFactories, this.vis.visName !== e)
49435
49435
  throw new Error(`visName is not match, import {${e}}`);
49436
49436
  const T = this.editor.scripts.events.beforeSetVisOptions.length ? this.editor.scripts.dispatch("beforeSetVisOptions", s) : s;
49437
- this.vis.setOptions(ai(ai({}, T), this.extendsOptions)), this.delLoadObj && (this.vis.delLoadArr = this.delLoadObj), this.vis.playing = this.editor.playing, this.vis.on("loaderProgress", (Ke, Je) => {
49437
+ this.vis.setOptions(ai(ai({}, T), this.extendsOptions)), this.delLoadObj && (this.vis.delLoadArr = this.delLoadObj), this.vis.playing = this.editor.playing, this.vis._baseObjectByUuid = this.editor.baseObjectByUuid.bind(this.editor), this.vis.on("loaderProgress", (Ke, Je) => {
49438
49438
  this.editor.emit("progress", {
49439
49439
  type: "下载资源",
49440
49440
  value: Ke / Je * 100 | 0
@@ -49601,17 +49601,13 @@ const compareVersion = (c, e) => {
49601
49601
  }
49602
49602
  compareVersion(c.c.version, "0.13.0") === -1 && c.h.u[0].visOptions.adcode === 0 && (c.h.u[0].visType = "world");
49603
49603
  }
49604
- if (compareVersion(c.c.version, "0.13.0") === -1 && c.h.u[0] && c.h.u[0].visType === "world" && (c.h.u[0].visType = "map", c.h.u[0].visOptions = {
49604
+ return compareVersion(c.c.version, "0.13.0") === -1 && c.h.u[0] && c.h.u[0].visType === "world" && (c.h.u[0].visType = "map", c.h.u[0].visOptions = {
49605
49605
  adcode: 0,
49606
49606
  mapDepth: 5,
49607
49607
  lineWidth: 2,
49608
49608
  worldPacificCentre: !0,
49609
49609
  extrudeLine: !1
49610
- }), c.h.u[0] && c.h.u[0].visType === "FJ" && (c.h.u[0].visType = "map2"), c.h.u[0] && c.h.u[0].visType === "map2") {
49611
- const { adcode: de } = c.h.u[0].visOptions;
49612
- de === 35e4 && (c.h.u[0].visOptions.drillDownHideParent = !0);
49613
- }
49614
- return compareVersion(c.c.version, "0.18.1") === -1 && c.h.u[0] && c.h.u[0].visType === "earth3" && (c.h.u[0].visType = "earth", c.h.u[0].visOptions.style = "countryPlate"), compareVersion(c.c.version, "0.18.14") === -1 && c.h.u[0] && c.h.u[0].visType === "map" && c.h.u.forEach((de) => {
49610
+ }), c.h.u[0] && c.h.u[0].visType === "FJ" && (c.h.u[0].visType = "map2"), compareVersion(c.c.version, "0.18.1") === -1 && c.h.u[0] && c.h.u[0].visType === "earth3" && (c.h.u[0].visType = "earth", c.h.u[0].visOptions.style = "countryPlate"), compareVersion(c.c.version, "0.18.14") === -1 && c.h.u[0] && c.h.u[0].visType === "map" && c.h.u.forEach((de) => {
49615
49611
  if (de.type === "SetSetting" && de.attributeName.startsWith("测试") && typeof de.newValue == "string" && de.newValue.includes(":::")) {
49616
49612
  const Xe = de.newValue.split(":::")[1];
49617
49613
  de.attributeName += ":::" + Xe, de.newValue = de.newValue.split(":::")[0], de.oldValue && typeof de.oldValue == "string" && (de.oldValue = de.oldValue.split(":::")[0]);
@@ -49621,7 +49617,7 @@ const compareVersion = (c, e) => {
49621
49617
  const Xe = de.attributeName.split(":::")[1];
49622
49618
  de.attributeName = de.attributeName.replace(Xe, `caId.${Xe}`);
49623
49619
  }
49624
- }), compareVersion(c.c.version, "0.21.24") === -1 && c.h.u[0] && c.h.u[0].visType === "map" && (T = (r = c.v) == null ? void 0 : r.eo) != null && T.parentBgCurvatureResolution && (delete c.v.eo.parentBgCurvatureResolution, c.v.eo.parentBgTopSegments = 400), c;
49620
+ }), compareVersion(c.c.version, "0.21.24") === -1 && c.h.u[0] && c.h.u[0].visType === "map" && (T = (r = c.v) == null ? void 0 : r.eo) != null && T.parentBgCurvatureResolution && (delete c.v.eo.parentBgCurvatureResolution, c.v.eo.parentBgTopSegments = 400), compareVersion(c.c.version, "0.23.1") === -1 && c.h.u[0] && c.h.u[0].visType === "map2" && !c.h.u[0].visOptions.cityOnMap && (c.h.u[0].visOptions.clickHandleDrillDown = !0), c;
49625
49621
  };
49626
49622
  class Scripts {
49627
49623
  constructor(e) {
@@ -49636,19 +49632,21 @@ class Scripts {
49636
49632
  H0(this, "source", "");
49637
49633
  this.editor = e;
49638
49634
  }
49639
- add(e) {
49635
+ addEvents(e) {
49640
49636
  for (const s in e) {
49641
49637
  const r = s;
49642
49638
  this.events[r] && this.events[r].push(e[r].bind(e));
49643
49639
  }
49644
49640
  }
49641
+ addStaticEvents(e) {
49642
+ this.addEvents(e());
49643
+ const s = e.toString().replace(/^\s+/gm, "").replace(/(\r\n|\n|\r)/gm, "");
49644
+ this.source !== s && (this.source = s, this.editor.emit("scriptsChanged"));
49645
+ }
49645
49646
  fromJSON(e) {
49646
49647
  try {
49647
- e = `
49648
- return ${e}(vis);
49649
- `;
49650
- const s = new Function(e)();
49651
- this.add(s), this.source = e;
49648
+ const s = new Function(`return ${e}()`)();
49649
+ this.addEvents(s), this.source = e;
49652
49650
  } catch (s) {
49653
49651
  console.error(s);
49654
49652
  }
@@ -49846,7 +49844,7 @@ class Editor {
49846
49844
  try {
49847
49845
  s && !n$1(s) ? console.warn(
49848
49846
  "fromJSON 第二个参数已修改,{beforeSetVisOptions:(r)=>r} 替代"
49849
- ) : s && this.scripts.add(s), window.postMessage({ type: "vis-core.fromJSON.start" }), console.time("vis-core:time.fromJSON");
49847
+ ) : s && this.scripts.addEvents(s), window.postMessage({ type: "vis-core.fromJSON.start" }), console.time("vis-core:time.fromJSON");
49850
49848
  let Ke;
49851
49849
  if (typeof e == "string") {
49852
49850
  const Je = this.options.assetsPrefix + e, { res: Qe } = yield jsonFetch(Je);
@@ -50382,6 +50380,7 @@ class Base extends Event {
50382
50380
  H0(this, "visName");
50383
50381
  H0(this, "editor");
50384
50382
  H0(this, "tier0", !1);
50383
+ H0(this, "_baseObjectByUuid");
50385
50384
  H0(this, "initSettingsObj");
50386
50385
  H0(this, "mouseButtonsActiveStore", null);
50387
50386
  if (this.container = s.container, this.options = ai({
@@ -50435,7 +50434,8 @@ class Base extends Event {
50435
50434
  return this.editor.fromJSON.bind(this.editor);
50436
50435
  }
50437
50436
  get baseObjectByUuid() {
50438
- return this.editor.baseObjectByUuid.bind(this.editor);
50437
+ var s;
50438
+ return ((s = this.editor) == null ? void 0 : s.baseObjectByUuid.bind(this.editor)) || this._baseObjectByUuid;
50439
50439
  }
50440
50440
  get objectByUuid() {
50441
50441
  return this.editor.objectByUuid.bind(this.editor);
@@ -132323,7 +132323,7 @@ class Map$1 extends Map$2 {
132323
132323
  polarAngle: 0.6690037180091797,
132324
132324
  mapDepth: [1, 0.3, 0.12],
132325
132325
  clickOusideBack: !0,
132326
- clickHandleDrillDown: !0,
132326
+ clickHandleDrillDown: !1,
132327
132327
  bottomPlane: !0,
132328
132328
  bottomPlaneWater: !1,
132329
132329
  parentBg: !0,
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.23.0";
1
+ declare const _default: "0.23.2";
2
2
  export default _default;
@@ -74,6 +74,7 @@ export default class Base extends Event {
74
74
  tier0: boolean;
75
75
  constructor(options: BaseOptions);
76
76
  setOptions(options: Record<string, any>): void;
77
+ _baseObjectByUuid: Editor['baseObjectByUuid'];
77
78
  get fromJSON(): (jsonOrUrl: Record<string, any> | string, scripts?: Record<string, any>) => Promise<Record<string, any>>;
78
79
  get baseObjectByUuid(): {
79
80
  (uuid: `arc${string}`, flag?: boolean): Arc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && bundler",