@rpgjs/vite 5.0.0-beta.5 → 5.0.0-beta.6

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/index.js CHANGED
@@ -6801,7 +6801,7 @@ function replaceConfigImport() {
6801
6801
  };
6802
6802
  }
6803
6803
  //#endregion
6804
- //#region ../server/dist/module-BmvXIvlE.js
6804
+ //#region ../server/dist/module-Dy124Jyk.js
6805
6805
  var __defProp$2 = Object.defineProperty;
6806
6806
  var __name$2 = (target, value) => __defProp$2(target, "name", {
6807
6807
  value,
@@ -9042,6 +9042,24 @@ __decorate([id(), __decorateMetadata("design:type", Object)], Skill.prototype, "
9042
9042
  __decorate([sync(), __decorateMetadata("design:type", Object)], Skill.prototype, "name", void 0);
9043
9043
  __decorate([sync(), __decorateMetadata("design:type", Object)], Skill.prototype, "spCost", void 0);
9044
9044
  __decorate([sync(), __decorateMetadata("design:type", Object)], Skill.prototype, "icon", void 0);
9045
+ var readReactiveValue = (value) => {
9046
+ if (typeof value === "function" && value.observable) return value();
9047
+ return value;
9048
+ };
9049
+ var toCloneableSyncValue = (value, seen = /* @__PURE__ */ new WeakSet()) => {
9050
+ const resolved = readReactiveValue(value);
9051
+ if (resolved == null || typeof resolved !== "object") return typeof resolved === "function" ? void 0 : resolved;
9052
+ if (seen.has(resolved)) return;
9053
+ seen.add(resolved);
9054
+ if (Array.isArray(resolved)) return resolved.map((item) => toCloneableSyncValue(item, seen)).filter((item) => item !== void 0);
9055
+ const output = {};
9056
+ for (const [key, child] of Object.entries(resolved)) {
9057
+ if (key.startsWith("$") || key === "_itemInstance" || key === "_subject" || key === "observable" || key === "options") continue;
9058
+ const childValue = toCloneableSyncValue(child, seen);
9059
+ if (childValue !== void 0) output[key.startsWith("__") ? key.slice(2) : key] = childValue;
9060
+ }
9061
+ return output;
9062
+ };
9045
9063
  var Direction = /* @__PURE__ */ function(Direction) {
9046
9064
  Direction["Up"] = "up";
9047
9065
  Direction["Down"] = "down";
@@ -9225,8 +9243,11 @@ __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.
9225
9243
  __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_exp", void 0);
9226
9244
  __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_level", void 0);
9227
9245
  __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_class", void 0);
9228
- __decorate([sync(Item), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "items", void 0);
9229
- __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "equipments", void 0);
9246
+ __decorate([sync({
9247
+ classType: Item,
9248
+ transform: toCloneableSyncValue
9249
+ }), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "items", void 0);
9250
+ __decorate([sync({ transform: toCloneableSyncValue }), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "equipments", void 0);
9230
9251
  __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "states", void 0);
9231
9252
  __decorate([sync(Skill), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "skills", void 0);
9232
9253
  __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_effects", void 0);