web3dlink 2.1.8 → 2.1.10

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.
package/dist/web3dlink.js CHANGED
@@ -1,8 +1,38 @@
1
1
  //#region \0rolldown/runtime.js
2
- var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
2
+ var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.10", description = "LarkSR / ZS 推流 GameAPI SDK", type = "module", main = "./dist/web3dlink.js", module$1 = "./dist/web3dlink.js", exports$1 = { ".": {
3
+ import: "./dist/web3dlink.js",
4
+ default: "./dist/web3dlink.js"
5
+ } }, files = ["dist"], scripts = {
6
+ build: "vite build",
7
+ prepublishOnly: "npm run build"
8
+ }, keywords = [
9
+ "larksr",
10
+ "zs-stream",
11
+ "game-api",
12
+ "streaming",
13
+ "web3dlink"
14
+ ], license = "MIT", sideEffects = [
15
+ "./dist/web3dlink.js",
16
+ "./index.js",
17
+ "./version.js",
18
+ "./zs-stream-parent.js"
19
+ ], package_default = {
20
+ name,
21
+ version: version$1,
22
+ description,
23
+ type,
24
+ main,
25
+ module: module$1,
26
+ exports: exports$1,
27
+ files,
28
+ scripts,
29
+ keywords,
30
+ license: "MIT",
31
+ sideEffects
32
+ }, version = package_default.version;
3
33
  //#endregion
4
34
  //#region zs-stream-parent.js
5
- (function(e) {
35
+ console.log(`[web3dlink] version: ${version}`), (function(e) {
6
36
  let t = "zs-stream-parent", n = "zs-stream-embed";
7
37
  function r(e) {
8
38
  return e ? typeof e == "string" ? document.querySelector(e) : e : null;
@@ -739,7 +769,7 @@ function verifyEnumerationValue(e) {
739
769
  }
740
770
  //#endregion
741
771
  //#region ../api/camera/validate.js
742
- function validateOptionalBoolean(e, t, n, r, i) {
772
+ function validateOptionalBoolean$1(e, t, n, r, i) {
743
773
  if (n == null || n === "") {
744
774
  e[t] = i;
745
775
  return;
@@ -996,7 +1026,7 @@ function aroundMode(e = {}) {
996
1026
  value: e.y_AnimSpeed,
997
1027
  defaultValue: 5,
998
1028
  min: 0
999
- })), validateOptionalBoolean(n, "isCheckCollision", e.isCheckCollision, t, !1), validateOptionalBoolean(n, "isIgnoreAttachedActors", e.isIgnoreAttachedActors, t, !0), t.push(...validateOptionalNumber({
1029
+ })), validateOptionalBoolean$1(n, "isCheckCollision", e.isCheckCollision, t, !1), validateOptionalBoolean$1(n, "isIgnoreAttachedActors", e.isIgnoreAttachedActors, t, !0), t.push(...validateOptionalNumber({
1000
1030
  normalized: n,
1001
1031
  field: "collisionOffset",
1002
1032
  value: e.collisionOffset,
@@ -1041,14 +1071,14 @@ function firstPersonMode(e = {}) {
1041
1071
  value: e.speed,
1042
1072
  defaultValue: 2,
1043
1073
  min: 0
1044
- })), validateOptionalBoolean(n, "collision", e.collision, t, !0), {
1074
+ })), validateOptionalBoolean$1(n, "collision", e.collision, t, !0), {
1045
1075
  errors: t,
1046
1076
  normalized: n
1047
1077
  };
1048
1078
  }
1049
1079
  function viewLock(e = {}) {
1050
1080
  let t = [], n = { ...e };
1051
- return validateOptionalBoolean(n, "state", e.state, t, !1), {
1081
+ return validateOptionalBoolean$1(n, "state", e.state, t, !1), {
1052
1082
  errors: t,
1053
1083
  normalized: n
1054
1084
  };
@@ -3402,6 +3432,157 @@ function offMouseClick(e = {}) {
3402
3432
  normalized: n
3403
3433
  };
3404
3434
  }
3435
+ function validateOptionalBoolean(e, t, n, r, i) {
3436
+ let a = e[t];
3437
+ if (a == null || a === "") {
3438
+ i[t] = n;
3439
+ return;
3440
+ }
3441
+ if (typeof a != "boolean") {
3442
+ r.push(`[${t}]必须是布尔类型`);
3443
+ return;
3444
+ }
3445
+ i[t] = a;
3446
+ }
3447
+ function validateOptionalCoordinates(e, t, n) {
3448
+ let r = e.coordinates;
3449
+ if (r == null || r === "" || Array.isArray(r) && r.length === 0) {
3450
+ n.coordinates = [];
3451
+ return;
3452
+ }
3453
+ t.push(...validateCoordinatesRequired(r)), Array.isArray(r) && r.length >= 3 && (n.coordinates = r.slice(0, 3).map(Number));
3454
+ }
3455
+ function playSequence(e = {}) {
3456
+ let t = [], n = { ...e };
3457
+ t.push(...validateRequiredString({
3458
+ normalized: n,
3459
+ field: "id",
3460
+ value: e.id
3461
+ })), t.push(...validateRequiredString({
3462
+ normalized: n,
3463
+ field: "fieldName",
3464
+ value: e.fieldName
3465
+ })), t.push(...validateOptionalString({
3466
+ normalized: n,
3467
+ field: "sequenceDirectory",
3468
+ value: e.sequenceDirectory,
3469
+ defaultValue: ""
3470
+ })), t.push(...validateOptionalArray({
3471
+ normalized: n,
3472
+ field: "sequenceFiles",
3473
+ value: e.sequenceFiles,
3474
+ defaultValue: []
3475
+ })), Array.isArray(n.sequenceFiles) && (n.sequenceFiles = n.sequenceFiles.map((e) => String(e ?? "").trim()).filter(Boolean));
3476
+ let r = typeof n.sequenceDirectory == "string" && n.sequenceDirectory.trim() !== "", i = Array.isArray(n.sequenceFiles) && n.sequenceFiles.length > 0;
3477
+ return i && r ? t.push("[sequenceFiles]与[sequenceDirectory]二选一,不能同时填写(设置 sequenceDirectory 时 sequenceFiles 必须为空)") : i ? n.sequenceDirectory = "" : r ? (n.sequenceDirectory = n.sequenceDirectory.trim(), n.sequenceFiles = []) : t.push("[sequenceFiles]与[sequenceDirectory]二选一,必须填写其中一个(设置 sequenceDirectory 时 sequenceFiles 必须为空)"), t.push(...validateOptionalNumber({
3478
+ normalized: n,
3479
+ field: "frameIndex",
3480
+ value: e.frameIndex,
3481
+ defaultValue: 0,
3482
+ min: 0
3483
+ })), t.push(...validateOptionalNumber({
3484
+ normalized: n,
3485
+ field: "playbackSpeed",
3486
+ value: e.playbackSpeed,
3487
+ defaultValue: 1,
3488
+ min: 0
3489
+ })), typeof n.playbackSpeed == "number" && n.playbackSpeed <= 0 && t.push("[playbackSpeed]取值必须大于0"), validateOptionalCoordinates(e, t, n), t.push(...validateOptionalVector3Array({
3490
+ normalized: n,
3491
+ field: "rotation",
3492
+ value: e.rotation,
3493
+ defaultValue: [
3494
+ 0,
3495
+ 0,
3496
+ 0
3497
+ ]
3498
+ })), t.push(...validateOptionalVector3Array({
3499
+ normalized: n,
3500
+ field: "scale",
3501
+ value: e.scale,
3502
+ defaultValue: [
3503
+ 1,
3504
+ 1,
3505
+ 1
3506
+ ]
3507
+ })), {
3508
+ errors: t,
3509
+ normalized: n
3510
+ };
3511
+ }
3512
+ function pauseSequence(e = {}) {
3513
+ let t = [], n = { ...e };
3514
+ return t.push(...validateRequiredString({
3515
+ normalized: n,
3516
+ field: "id",
3517
+ value: e.id
3518
+ })), {
3519
+ errors: t,
3520
+ normalized: n
3521
+ };
3522
+ }
3523
+ function stopSequence(e = {}) {
3524
+ let t = [], n = { ...e };
3525
+ return t.push(...validateRequiredString({
3526
+ normalized: n,
3527
+ field: "id",
3528
+ value: e.id
3529
+ })), {
3530
+ errors: t,
3531
+ normalized: n
3532
+ };
3533
+ }
3534
+ function setFrame(e = {}) {
3535
+ let t = [], n = { ...e };
3536
+ return t.push(...validateRequiredString({
3537
+ normalized: n,
3538
+ field: "id",
3539
+ value: e.id
3540
+ })), t.push(...validateOptionalNumber({
3541
+ normalized: n,
3542
+ field: "frameIndex",
3543
+ value: e.frameIndex,
3544
+ defaultValue: 0,
3545
+ min: 0
3546
+ })), {
3547
+ errors: t,
3548
+ normalized: n
3549
+ };
3550
+ }
3551
+ function setPlaybackSpeed(e = {}) {
3552
+ let t = [], n = { ...e };
3553
+ return t.push(...validateRequiredString({
3554
+ normalized: n,
3555
+ field: "id",
3556
+ value: e.id
3557
+ })), t.push(...validateOptionalNumber({
3558
+ normalized: n,
3559
+ field: "playbackSpeed",
3560
+ value: e.playbackSpeed,
3561
+ defaultValue: 4,
3562
+ min: 0
3563
+ })), typeof n.playbackSpeed == "number" && n.playbackSpeed <= 0 && t.push("[playbackSpeed]取值必须大于0"), {
3564
+ errors: t,
3565
+ normalized: n
3566
+ };
3567
+ }
3568
+ function clearSequence(e = {}) {
3569
+ let t = [], n = { ...e };
3570
+ return t.push(...validateRequiredString({
3571
+ normalized: n,
3572
+ field: "id",
3573
+ value: e.id
3574
+ })), validateOptionalBoolean(e, "isClearCache", !0, t, n), {
3575
+ errors: t,
3576
+ normalized: n
3577
+ };
3578
+ }
3579
+ function clearAllSequence(e = {}) {
3580
+ let t = [], n = { ...e };
3581
+ return validateOptionalBoolean(e, "isClearCache", !0, t, n), {
3582
+ errors: t,
3583
+ normalized: n
3584
+ };
3585
+ }
3405
3586
  //#endregion
3406
3587
  //#region ../api/vtk/vtkApi.js
3407
3588
  var validator = {
@@ -3417,7 +3598,14 @@ var validator = {
3417
3598
  setDisplacementScale,
3418
3599
  closeDisplacementScale,
3419
3600
  onMouseClick,
3420
- offMouseClick
3601
+ offMouseClick,
3602
+ playSequence,
3603
+ pauseSequence,
3604
+ stopSequence,
3605
+ setFrame,
3606
+ setPlaybackSpeed,
3607
+ clearSequence,
3608
+ clearAllSequence
3421
3609
  }, VtkApi = class {
3422
3610
  constructor(e) {
3423
3611
  this.commandManager = e;
@@ -9661,7 +9849,7 @@ var validator = {
9661
9849
  1724: function(e, t, n) {
9662
9850
  n(9656)("iterator");
9663
9851
  },
9664
- 1734: function(module$1) {
9852
+ 1734: function(module$2) {
9665
9853
  function inquire(moduleName) {
9666
9854
  try {
9667
9855
  var mod = eval("quire".replace(/^/, "re"))(moduleName);
@@ -9669,7 +9857,7 @@ var validator = {
9669
9857
  } catch {}
9670
9858
  return null;
9671
9859
  }
9672
- module$1.exports = inquire;
9860
+ module$2.exports = inquire;
9673
9861
  },
9674
9862
  1818: function(e) {
9675
9863
  e.exports = !1;
@@ -24188,7 +24376,7 @@ var LoadStream = class {
24188
24376
  init(e) {
24189
24377
  try {
24190
24378
  let t = new CommandManager(createLarkSRTransport(e));
24191
- return this._gameApi = new GameAPI(t), console.log("插件初始化成功"), this._gameApi;
24379
+ return this._gameApi = new GameAPI(t), console.log(`插件初始化成功 [web3dlink@${version}]`), this._gameApi;
24192
24380
  } catch (e) {
24193
24381
  throw console.error("插件初始化失败", e), e;
24194
24382
  }
@@ -24235,6 +24423,6 @@ function getLarkSR() {
24235
24423
  }
24236
24424
  var web3dlink_default = loadStream;
24237
24425
  //#endregion
24238
- export { CommandManager, GameAPI, ZsStreamDestroy, ZsStreamMount, closeGameApi, createAndInitLarkSR, createLarkSRTransport, createZsStreamTransport, web3dlink_default as default, getLarkSR };
24426
+ export { CommandManager, GameAPI, ZsStreamDestroy, ZsStreamMount, closeGameApi, createAndInitLarkSR, createLarkSRTransport, createZsStreamTransport, web3dlink_default as default, getLarkSR, version };
24239
24427
 
24240
24428
  //# sourceMappingURL=web3dlink.js.map