@rpgjs/server 5.0.0-beta.2 → 5.0.0-beta.3
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as RpgCommonPlayer, A as isArray, B as ProjectileMovement, C as SDEF, D as arrayFlat, E as PrebuiltGui, F as ModulesToken, G as Knockback, H as PathFollow, I as RpgModule, J as Entity, K as IceMovement, L as WorldMapsManager, M as isInstanceOf, N as isString, O as arrayUniq, P as random, Q as Direction, R as RpgCommonMap, S as PDEF, T as PerlinNoise2D, U as Oscillate, V as ProjectileType, W as LinearRepulsion, X as Vector2, Y as EntityState, Z as RpgShape, _ as ATK, a as isMapUpdateAuthorized, at as
|
|
1
|
+
import { $ as RpgCommonPlayer, A as isArray, At as createErrorClass, B as ProjectileMovement, C as SDEF, Ct as isSignal, D as arrayFlat, Dt as finalize$1, E as PrebuiltGui, Et as untracked, F as ModulesToken, G as Knockback, H as PathFollow, I as RpgModule, J as Entity, K as IceMovement, L as WorldMapsManager, M as isInstanceOf, N as isString, O as arrayUniq, Ot as combineLatest, P as random, Q as Direction, R as RpgCommonMap, S as PDEF, St as isObjectSubject, T as PerlinNoise2D, Tt as signal, U as Oscillate, V as ProjectileType, W as LinearRepulsion, X as Vector2, Y as EntityState, Z as RpgShape, _ as ATK, _t as ObjectSubject, a as isMapUpdateAuthorized, at as createStatesSnapshot, b as MAXHP, bt as isArraySubject, ct as getByPath, d as context, dt as persist, et as Skill, f as inject, ft as sync, g as AGI, gt as ArraySubject, h as injector, ht as users, j as isFunction, k as capitalize, kt as BehaviorSubject, l as context$1, lt as id, m as inject$1, mt as type, n as MAP_UPDATE_TOKEN_ENV, nt as __decorate, ot as createStatesSnapshotDeep, p as setInject, pt as syncClass, q as Dash, r as MAP_UPDATE_TOKEN_HEADER, rt as __decorateMetadata, st as generateShortUUID$1, t as provideServerModules, tt as Item, u as clearInject, ut as load, v as DEX, vt as computed, w as STR, wt as linkedSignal, x as MAXSP, xt as isComputed, y as INT, yt as effect, z as SeekAvoid } from "./module-BmvXIvlE.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.mjs
|
|
3
3
|
function dset(obj, keys, val) {
|
|
4
4
|
keys.split && (keys = keys.split("."));
|
|
@@ -444,7 +444,8 @@ var handleResult = (ctx, result) => {
|
|
|
444
444
|
success: false,
|
|
445
445
|
get error() {
|
|
446
446
|
if (this._error) return this._error;
|
|
447
|
-
|
|
447
|
+
const error = new ZodError$1(ctx.common.issues);
|
|
448
|
+
this._error = error;
|
|
448
449
|
return this._error;
|
|
449
450
|
}
|
|
450
451
|
};
|
|
@@ -2134,9 +2135,10 @@ var ZodObject$1 = class ZodObject$1 extends ZodType$1 {
|
|
|
2134
2135
|
_getCached() {
|
|
2135
2136
|
if (this._cached !== null) return this._cached;
|
|
2136
2137
|
const shape = this._def.shape();
|
|
2138
|
+
const keys = util.objectKeys(shape);
|
|
2137
2139
|
return this._cached = {
|
|
2138
2140
|
shape,
|
|
2139
|
-
keys
|
|
2141
|
+
keys
|
|
2140
2142
|
};
|
|
2141
2143
|
}
|
|
2142
2144
|
_parse(input) {
|
|
@@ -3623,29 +3625,6 @@ var pipelineType = ZodPipeline.create;
|
|
|
3623
3625
|
var ostring = () => stringType().optional();
|
|
3624
3626
|
var onumber = () => numberType().optional();
|
|
3625
3627
|
var oboolean = () => booleanType().optional();
|
|
3626
|
-
var coerce = {
|
|
3627
|
-
string: ((arg) => ZodString$1.create({
|
|
3628
|
-
...arg,
|
|
3629
|
-
coerce: true
|
|
3630
|
-
})),
|
|
3631
|
-
number: ((arg) => ZodNumber$1.create({
|
|
3632
|
-
...arg,
|
|
3633
|
-
coerce: true
|
|
3634
|
-
})),
|
|
3635
|
-
boolean: ((arg) => ZodBoolean.create({
|
|
3636
|
-
...arg,
|
|
3637
|
-
coerce: true
|
|
3638
|
-
})),
|
|
3639
|
-
bigint: ((arg) => ZodBigInt.create({
|
|
3640
|
-
...arg,
|
|
3641
|
-
coerce: true
|
|
3642
|
-
})),
|
|
3643
|
-
date: ((arg) => ZodDate.create({
|
|
3644
|
-
...arg,
|
|
3645
|
-
coerce: true
|
|
3646
|
-
}))
|
|
3647
|
-
};
|
|
3648
|
-
var NEVER$1 = INVALID;
|
|
3649
3628
|
var z = /* @__PURE__ */ Object.freeze({
|
|
3650
3629
|
__proto__: null,
|
|
3651
3630
|
defaultErrorMap: errorMap,
|
|
@@ -3717,7 +3696,28 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3717
3696
|
get ZodFirstPartyTypeKind() {
|
|
3718
3697
|
return ZodFirstPartyTypeKind;
|
|
3719
3698
|
},
|
|
3720
|
-
coerce
|
|
3699
|
+
coerce: {
|
|
3700
|
+
string: ((arg) => ZodString$1.create({
|
|
3701
|
+
...arg,
|
|
3702
|
+
coerce: true
|
|
3703
|
+
})),
|
|
3704
|
+
number: ((arg) => ZodNumber$1.create({
|
|
3705
|
+
...arg,
|
|
3706
|
+
coerce: true
|
|
3707
|
+
})),
|
|
3708
|
+
boolean: ((arg) => ZodBoolean.create({
|
|
3709
|
+
...arg,
|
|
3710
|
+
coerce: true
|
|
3711
|
+
})),
|
|
3712
|
+
bigint: ((arg) => ZodBigInt.create({
|
|
3713
|
+
...arg,
|
|
3714
|
+
coerce: true
|
|
3715
|
+
})),
|
|
3716
|
+
date: ((arg) => ZodDate.create({
|
|
3717
|
+
...arg,
|
|
3718
|
+
coerce: true
|
|
3719
|
+
}))
|
|
3720
|
+
},
|
|
3721
3721
|
any: anyType,
|
|
3722
3722
|
array: arrayType,
|
|
3723
3723
|
bigint: bigIntType,
|
|
@@ -3757,19 +3757,12 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3757
3757
|
union: unionType,
|
|
3758
3758
|
unknown: unknownType,
|
|
3759
3759
|
"void": voidType,
|
|
3760
|
-
NEVER:
|
|
3760
|
+
NEVER: INVALID,
|
|
3761
3761
|
ZodIssueCode,
|
|
3762
3762
|
quotelessJson,
|
|
3763
3763
|
ZodError: ZodError$1
|
|
3764
3764
|
});
|
|
3765
3765
|
//#endregion
|
|
3766
|
-
//#region ../../node_modules/.pnpm/@signe+sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js
|
|
3767
|
-
var __defProp$2 = Object.defineProperty;
|
|
3768
|
-
var __name$2 = (target, value) => __defProp$2(target, "name", {
|
|
3769
|
-
value,
|
|
3770
|
-
configurable: true
|
|
3771
|
-
});
|
|
3772
|
-
//#endregion
|
|
3773
3766
|
//#region ../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
|
|
3774
3767
|
var EmptyError = createErrorClass(function(_super) {
|
|
3775
3768
|
return function EmptyErrorImpl() {
|
|
@@ -3800,785 +3793,6 @@ function lastValueFrom(source, config) {
|
|
|
3800
3793
|
});
|
|
3801
3794
|
}
|
|
3802
3795
|
//#endregion
|
|
3803
|
-
//#region ../../node_modules/.pnpm/@signe+reactive@2.9.0/node_modules/@signe/reactive/dist/index.js
|
|
3804
|
-
var __defProp$1 = Object.defineProperty;
|
|
3805
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", {
|
|
3806
|
-
value,
|
|
3807
|
-
configurable: true
|
|
3808
|
-
});
|
|
3809
|
-
var ArraySubject = class extends BehaviorSubject {
|
|
3810
|
-
static {
|
|
3811
|
-
__name$1(this, "ArraySubject");
|
|
3812
|
-
}
|
|
3813
|
-
_items = [];
|
|
3814
|
-
constructor(items = []) {
|
|
3815
|
-
super({
|
|
3816
|
-
type: "init",
|
|
3817
|
-
items
|
|
3818
|
-
});
|
|
3819
|
-
this.createProxy(items);
|
|
3820
|
-
}
|
|
3821
|
-
createProxy(items) {
|
|
3822
|
-
this._items = new Proxy(items, {
|
|
3823
|
-
get: /* @__PURE__ */ __name$1((target, prop, receiver) => {
|
|
3824
|
-
const origMethod = target[prop];
|
|
3825
|
-
if (typeof origMethod === "function") return (...args) => {
|
|
3826
|
-
let changeType = "update";
|
|
3827
|
-
let index = void 0;
|
|
3828
|
-
let isMutateFn = false;
|
|
3829
|
-
let itemsToEmit = [];
|
|
3830
|
-
let changeSplice = true;
|
|
3831
|
-
switch (prop) {
|
|
3832
|
-
case "push":
|
|
3833
|
-
index = target.length;
|
|
3834
|
-
changeType = "add";
|
|
3835
|
-
isMutateFn = true;
|
|
3836
|
-
break;
|
|
3837
|
-
case "pop":
|
|
3838
|
-
index = target.length - 1;
|
|
3839
|
-
changeType = "remove";
|
|
3840
|
-
isMutateFn = true;
|
|
3841
|
-
break;
|
|
3842
|
-
case "unshift":
|
|
3843
|
-
index = 0;
|
|
3844
|
-
changeType = "add";
|
|
3845
|
-
isMutateFn = true;
|
|
3846
|
-
break;
|
|
3847
|
-
case "shift":
|
|
3848
|
-
index = 0;
|
|
3849
|
-
changeType = "remove";
|
|
3850
|
-
isMutateFn = true;
|
|
3851
|
-
break;
|
|
3852
|
-
case "splice":
|
|
3853
|
-
index = args[0];
|
|
3854
|
-
const deleteCount = args[1];
|
|
3855
|
-
const newItems = args.slice(2);
|
|
3856
|
-
itemsToEmit = newItems;
|
|
3857
|
-
if (deleteCount > 0 && newItems.length === 0) changeType = "remove";
|
|
3858
|
-
else if (deleteCount === 0 && newItems.length > 0) changeType = "add";
|
|
3859
|
-
else if (deleteCount === 0 && newItems.length === 0) changeSplice = false;
|
|
3860
|
-
else changeType = "update";
|
|
3861
|
-
isMutateFn = true;
|
|
3862
|
-
break;
|
|
3863
|
-
}
|
|
3864
|
-
const result = origMethod.apply(target, args);
|
|
3865
|
-
if (isMutateFn && changeSplice) if (prop === "splice") this.next({
|
|
3866
|
-
type: changeType,
|
|
3867
|
-
index,
|
|
3868
|
-
items: itemsToEmit
|
|
3869
|
-
});
|
|
3870
|
-
else this.next({
|
|
3871
|
-
type: changeType,
|
|
3872
|
-
index,
|
|
3873
|
-
items: args
|
|
3874
|
-
});
|
|
3875
|
-
return result;
|
|
3876
|
-
};
|
|
3877
|
-
return Reflect.get(target, prop, receiver);
|
|
3878
|
-
}, "get"),
|
|
3879
|
-
set: /* @__PURE__ */ __name$1((target, prop, value) => {
|
|
3880
|
-
const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
|
|
3881
|
-
target[prop] = value;
|
|
3882
|
-
this.next({
|
|
3883
|
-
type: "update",
|
|
3884
|
-
index,
|
|
3885
|
-
items: [value]
|
|
3886
|
-
});
|
|
3887
|
-
return true;
|
|
3888
|
-
}, "set")
|
|
3889
|
-
});
|
|
3890
|
-
}
|
|
3891
|
-
get items() {
|
|
3892
|
-
return this._items;
|
|
3893
|
-
}
|
|
3894
|
-
set items(newItems) {
|
|
3895
|
-
this.createProxy(newItems);
|
|
3896
|
-
this.next({
|
|
3897
|
-
type: "reset",
|
|
3898
|
-
items: newItems
|
|
3899
|
-
});
|
|
3900
|
-
}
|
|
3901
|
-
};
|
|
3902
|
-
var isArraySubject = /* @__PURE__ */ __name$1((value) => {
|
|
3903
|
-
return "_items" in value;
|
|
3904
|
-
}, "isArraySubject");
|
|
3905
|
-
var ObjectSubject = class extends BehaviorSubject {
|
|
3906
|
-
static {
|
|
3907
|
-
__name$1(this, "ObjectSubject");
|
|
3908
|
-
}
|
|
3909
|
-
_obj;
|
|
3910
|
-
constructor(obj = {}) {
|
|
3911
|
-
super({
|
|
3912
|
-
type: "init",
|
|
3913
|
-
value: obj
|
|
3914
|
-
});
|
|
3915
|
-
this.createProxy(obj);
|
|
3916
|
-
}
|
|
3917
|
-
createProxy(obj) {
|
|
3918
|
-
this._obj = new Proxy(obj, {
|
|
3919
|
-
get: /* @__PURE__ */ __name$1((target, prop, receiver) => {
|
|
3920
|
-
return Reflect.get(target, prop, receiver);
|
|
3921
|
-
}, "get"),
|
|
3922
|
-
set: /* @__PURE__ */ __name$1((target, prop, value, receiver) => {
|
|
3923
|
-
const key = prop;
|
|
3924
|
-
const changeType = key in target ? "update" : "add";
|
|
3925
|
-
target[key] = value;
|
|
3926
|
-
this.next({
|
|
3927
|
-
type: changeType,
|
|
3928
|
-
key,
|
|
3929
|
-
value
|
|
3930
|
-
});
|
|
3931
|
-
return true;
|
|
3932
|
-
}, "set"),
|
|
3933
|
-
deleteProperty: /* @__PURE__ */ __name$1((target, prop) => {
|
|
3934
|
-
const key = prop;
|
|
3935
|
-
if (key in target) {
|
|
3936
|
-
const value = target[key];
|
|
3937
|
-
delete target[key];
|
|
3938
|
-
this.next({
|
|
3939
|
-
type: "remove",
|
|
3940
|
-
key,
|
|
3941
|
-
value
|
|
3942
|
-
});
|
|
3943
|
-
return true;
|
|
3944
|
-
}
|
|
3945
|
-
return false;
|
|
3946
|
-
}, "deleteProperty")
|
|
3947
|
-
});
|
|
3948
|
-
}
|
|
3949
|
-
get obj() {
|
|
3950
|
-
return this._obj;
|
|
3951
|
-
}
|
|
3952
|
-
set obj(newObj) {
|
|
3953
|
-
this.createProxy(newObj);
|
|
3954
|
-
this.next({
|
|
3955
|
-
type: "reset",
|
|
3956
|
-
value: newObj
|
|
3957
|
-
});
|
|
3958
|
-
}
|
|
3959
|
-
};
|
|
3960
|
-
var isObjectSubject = /* @__PURE__ */ __name$1((value) => {
|
|
3961
|
-
return "_obj" in value;
|
|
3962
|
-
}, "isObjectSubject");
|
|
3963
|
-
var reactiveStore = (/* @__PURE__ */ __name$1(() => {
|
|
3964
|
-
const globalKey = "__REACTIVE_STORE__";
|
|
3965
|
-
if (typeof globalThis !== "undefined") {
|
|
3966
|
-
if (!globalThis[globalKey]) globalThis[globalKey] = {
|
|
3967
|
-
currentDependencyTracker: null,
|
|
3968
|
-
currentSubscriptionsTracker: null
|
|
3969
|
-
};
|
|
3970
|
-
return globalThis[globalKey];
|
|
3971
|
-
}
|
|
3972
|
-
let globalObj;
|
|
3973
|
-
if (typeof window !== "undefined") globalObj = window;
|
|
3974
|
-
else if (typeof process !== "undefined" && process.versions && process.versions.node) globalObj = Function("return this")();
|
|
3975
|
-
else if (typeof self !== "undefined") globalObj = self;
|
|
3976
|
-
else {
|
|
3977
|
-
console.warn("Unable to find global object, using local instance");
|
|
3978
|
-
return {
|
|
3979
|
-
currentDependencyTracker: null,
|
|
3980
|
-
currentSubscriptionsTracker: null
|
|
3981
|
-
};
|
|
3982
|
-
}
|
|
3983
|
-
if (!globalObj[globalKey]) globalObj[globalKey] = {
|
|
3984
|
-
currentDependencyTracker: null,
|
|
3985
|
-
currentSubscriptionsTracker: null
|
|
3986
|
-
};
|
|
3987
|
-
return globalObj[globalKey];
|
|
3988
|
-
}, "getGlobalReactiveStore"))();
|
|
3989
|
-
var trackDependency = /* @__PURE__ */ __name$1((signal2) => {
|
|
3990
|
-
if (reactiveStore.currentDependencyTracker) reactiveStore.currentDependencyTracker(signal2);
|
|
3991
|
-
}, "trackDependency");
|
|
3992
|
-
function signal(defaultValue, options) {
|
|
3993
|
-
let subject;
|
|
3994
|
-
if (Array.isArray(defaultValue)) subject = new ArraySubject(defaultValue);
|
|
3995
|
-
else if (typeof defaultValue === "object" && defaultValue !== null) subject = new ObjectSubject(defaultValue);
|
|
3996
|
-
else subject = new BehaviorSubject(defaultValue);
|
|
3997
|
-
const getValue = /* @__PURE__ */ __name$1(() => {
|
|
3998
|
-
if (subject instanceof ArraySubject) return subject.items;
|
|
3999
|
-
else if (subject instanceof ObjectSubject) return subject.obj;
|
|
4000
|
-
return subject.value;
|
|
4001
|
-
}, "getValue");
|
|
4002
|
-
const fn = /* @__PURE__ */ __name$1(function() {
|
|
4003
|
-
trackDependency(fn);
|
|
4004
|
-
return getValue();
|
|
4005
|
-
}, "fn");
|
|
4006
|
-
fn.set = (value) => {
|
|
4007
|
-
const currentValue = getValue();
|
|
4008
|
-
let shouldEmit = true;
|
|
4009
|
-
if (options?.equal) shouldEmit = !options.equal(currentValue, value);
|
|
4010
|
-
else shouldEmit = currentValue !== value;
|
|
4011
|
-
if (shouldEmit) if (subject instanceof ArraySubject) subject.items = value;
|
|
4012
|
-
else if (subject instanceof ObjectSubject) subject.obj = value;
|
|
4013
|
-
else subject.next(value);
|
|
4014
|
-
};
|
|
4015
|
-
fn._isFrozen = false;
|
|
4016
|
-
fn.freeze = () => {
|
|
4017
|
-
fn._isFrozen = true;
|
|
4018
|
-
};
|
|
4019
|
-
fn.unfreeze = () => {
|
|
4020
|
-
fn._isFrozen = false;
|
|
4021
|
-
if (subject instanceof ArraySubject) subject.next({
|
|
4022
|
-
type: "init",
|
|
4023
|
-
items: subject.items
|
|
4024
|
-
});
|
|
4025
|
-
else if (subject instanceof ObjectSubject) subject.next({
|
|
4026
|
-
type: "init",
|
|
4027
|
-
value: subject.obj
|
|
4028
|
-
});
|
|
4029
|
-
else subject.next(subject.value);
|
|
4030
|
-
};
|
|
4031
|
-
fn.mutate = (mutateFn) => {
|
|
4032
|
-
mutateFn(getValue());
|
|
4033
|
-
};
|
|
4034
|
-
fn.update = (updateFn) => {
|
|
4035
|
-
const updatedValue = updateFn(getValue());
|
|
4036
|
-
fn.set(updatedValue);
|
|
4037
|
-
};
|
|
4038
|
-
fn.observable = subject.asObservable().pipe(filter(() => !fn._isFrozen));
|
|
4039
|
-
fn._subject = subject;
|
|
4040
|
-
return fn;
|
|
4041
|
-
}
|
|
4042
|
-
__name$1(signal, "signal");
|
|
4043
|
-
function isSignal(value) {
|
|
4044
|
-
return !!(value && value.observable);
|
|
4045
|
-
}
|
|
4046
|
-
__name$1(isSignal, "isSignal");
|
|
4047
|
-
function isComputed(value) {
|
|
4048
|
-
return isSignal(value) && !!value.dependencies;
|
|
4049
|
-
}
|
|
4050
|
-
__name$1(isComputed, "isComputed");
|
|
4051
|
-
function computed(computeFunction, disposableFn) {
|
|
4052
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
4053
|
-
let init = true;
|
|
4054
|
-
let lastComputedValue;
|
|
4055
|
-
const previousTracker = reactiveStore.currentDependencyTracker;
|
|
4056
|
-
reactiveStore.currentDependencyTracker = (signal2) => {
|
|
4057
|
-
dependencies.add(signal2);
|
|
4058
|
-
};
|
|
4059
|
-
lastComputedValue = computeFunction();
|
|
4060
|
-
if (computeFunction["isEffect"]) disposableFn = lastComputedValue;
|
|
4061
|
-
reactiveStore.currentDependencyTracker = previousTracker;
|
|
4062
|
-
const computedObservable = combineLatest([...dependencies].map((dep) => {
|
|
4063
|
-
if (isComputed(dep) && "dependencies" in dep) {
|
|
4064
|
-
const computedDep = dep;
|
|
4065
|
-
if (computedDep.dependencies.size === 0) return new BehaviorSubject(computedDep()).asObservable();
|
|
4066
|
-
}
|
|
4067
|
-
return dep.observable;
|
|
4068
|
-
})).pipe(filter(() => !init), map(() => computeFunction()), finalize$1(() => disposableFn?.()));
|
|
4069
|
-
const fn = /* @__PURE__ */ __name$1(function() {
|
|
4070
|
-
trackDependency(fn);
|
|
4071
|
-
return lastComputedValue;
|
|
4072
|
-
}, "fn");
|
|
4073
|
-
fn.observable = computedObservable;
|
|
4074
|
-
fn.subscription = computedObservable.subscribe((value) => {
|
|
4075
|
-
lastComputedValue = value;
|
|
4076
|
-
});
|
|
4077
|
-
fn.dependencies = dependencies;
|
|
4078
|
-
reactiveStore.currentSubscriptionsTracker?.(fn.subscription);
|
|
4079
|
-
init = false;
|
|
4080
|
-
return fn;
|
|
4081
|
-
}
|
|
4082
|
-
__name$1(computed, "computed");
|
|
4083
|
-
function linkedSignal(computationOrOptions, simpleOptions) {
|
|
4084
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
4085
|
-
let init = true;
|
|
4086
|
-
let lastComputedValue;
|
|
4087
|
-
let computeFunction;
|
|
4088
|
-
let sourceSignal;
|
|
4089
|
-
let computationFn;
|
|
4090
|
-
let equalFn;
|
|
4091
|
-
let previousValue;
|
|
4092
|
-
let isOverridden = false;
|
|
4093
|
-
let overriddenValue;
|
|
4094
|
-
let depVersion = 0;
|
|
4095
|
-
let overrideDepVersion = null;
|
|
4096
|
-
if (typeof computationOrOptions === "function") {
|
|
4097
|
-
computeFunction = computationOrOptions;
|
|
4098
|
-
equalFn = simpleOptions?.equal;
|
|
4099
|
-
} else {
|
|
4100
|
-
const options = computationOrOptions;
|
|
4101
|
-
sourceSignal = options.source;
|
|
4102
|
-
computationFn = options.computation;
|
|
4103
|
-
equalFn = options.equal;
|
|
4104
|
-
if (typeof sourceSignal === "function" && !isSignal(sourceSignal)) {
|
|
4105
|
-
const sourceFn = sourceSignal;
|
|
4106
|
-
computeFunction = /* @__PURE__ */ __name$1(() => {
|
|
4107
|
-
const sourceValue = sourceFn();
|
|
4108
|
-
if (computationFn.length > 1) {
|
|
4109
|
-
const result = computationFn(sourceValue, previousValue);
|
|
4110
|
-
previousValue = {
|
|
4111
|
-
source: sourceValue,
|
|
4112
|
-
value: result
|
|
4113
|
-
};
|
|
4114
|
-
return result;
|
|
4115
|
-
} else {
|
|
4116
|
-
const result = computationFn(sourceValue);
|
|
4117
|
-
previousValue = {
|
|
4118
|
-
source: sourceValue,
|
|
4119
|
-
value: result
|
|
4120
|
-
};
|
|
4121
|
-
return result;
|
|
4122
|
-
}
|
|
4123
|
-
}, "computeFunction");
|
|
4124
|
-
} else {
|
|
4125
|
-
const source = typeof sourceSignal === "function" ? sourceSignal : sourceSignal;
|
|
4126
|
-
computeFunction = /* @__PURE__ */ __name$1(() => {
|
|
4127
|
-
const sourceValue = source();
|
|
4128
|
-
if (computationFn.length > 1) {
|
|
4129
|
-
const result = computationFn(sourceValue, previousValue);
|
|
4130
|
-
previousValue = {
|
|
4131
|
-
source: sourceValue,
|
|
4132
|
-
value: result
|
|
4133
|
-
};
|
|
4134
|
-
return result;
|
|
4135
|
-
} else {
|
|
4136
|
-
const result = computationFn(sourceValue);
|
|
4137
|
-
previousValue = {
|
|
4138
|
-
source: sourceValue,
|
|
4139
|
-
value: result
|
|
4140
|
-
};
|
|
4141
|
-
return result;
|
|
4142
|
-
}
|
|
4143
|
-
}, "computeFunction");
|
|
4144
|
-
}
|
|
4145
|
-
}
|
|
4146
|
-
const previousTracker = reactiveStore.currentDependencyTracker;
|
|
4147
|
-
reactiveStore.currentDependencyTracker = (signal2) => {
|
|
4148
|
-
dependencies.add(signal2);
|
|
4149
|
-
};
|
|
4150
|
-
if (sourceSignal && typeof sourceSignal === "function" && !isSignal(sourceSignal)) lastComputedValue = computeFunction();
|
|
4151
|
-
else if (sourceSignal && isSignal(sourceSignal)) {
|
|
4152
|
-
dependencies.add(sourceSignal);
|
|
4153
|
-
lastComputedValue = computeFunction();
|
|
4154
|
-
} else lastComputedValue = computeFunction();
|
|
4155
|
-
reactiveStore.currentDependencyTracker = previousTracker;
|
|
4156
|
-
const subject = new BehaviorSubject(lastComputedValue);
|
|
4157
|
-
const observables = [...dependencies].map((dep) => {
|
|
4158
|
-
if (isComputed(dep) && "dependencies" in dep) {
|
|
4159
|
-
const computedDep = dep;
|
|
4160
|
-
if (computedDep.dependencies.size === 0) return new BehaviorSubject(computedDep()).asObservable();
|
|
4161
|
-
}
|
|
4162
|
-
return dep.observable;
|
|
4163
|
-
});
|
|
4164
|
-
let linkedObservable;
|
|
4165
|
-
if (observables.length > 0) linkedObservable = combineLatest(observables).pipe(filter(() => !init), map(() => {
|
|
4166
|
-
const computed2 = computeFunction();
|
|
4167
|
-
if (equalFn) {
|
|
4168
|
-
if (!equalFn(lastComputedValue, computed2)) {
|
|
4169
|
-
lastComputedValue = computed2;
|
|
4170
|
-
isOverridden = false;
|
|
4171
|
-
}
|
|
4172
|
-
} else if (lastComputedValue !== computed2) {
|
|
4173
|
-
lastComputedValue = computed2;
|
|
4174
|
-
isOverridden = false;
|
|
4175
|
-
}
|
|
4176
|
-
return lastComputedValue;
|
|
4177
|
-
}));
|
|
4178
|
-
else linkedObservable = subject.asObservable().pipe(filter(() => !init));
|
|
4179
|
-
const fn = /* @__PURE__ */ __name$1(function() {
|
|
4180
|
-
trackDependency(fn);
|
|
4181
|
-
if (isOverridden && dependencies.size > 0) {
|
|
4182
|
-
if (overrideDepVersion !== depVersion) {
|
|
4183
|
-
const computed2 = computeFunction();
|
|
4184
|
-
isOverridden = false;
|
|
4185
|
-
overriddenValue = void 0;
|
|
4186
|
-
lastComputedValue = computed2;
|
|
4187
|
-
overrideDepVersion = null;
|
|
4188
|
-
return computed2;
|
|
4189
|
-
}
|
|
4190
|
-
return overriddenValue;
|
|
4191
|
-
}
|
|
4192
|
-
if (isOverridden) return overriddenValue;
|
|
4193
|
-
if (dependencies.size === 0) lastComputedValue = computeFunction();
|
|
4194
|
-
return lastComputedValue;
|
|
4195
|
-
}, "fn");
|
|
4196
|
-
fn.observable = new Observable((observer) => {
|
|
4197
|
-
const depSubscription = linkedObservable.subscribe((value) => {
|
|
4198
|
-
if (dependencies.size > 0) {
|
|
4199
|
-
depVersion++;
|
|
4200
|
-
isOverridden = false;
|
|
4201
|
-
overrideDepVersion = null;
|
|
4202
|
-
lastComputedValue = value;
|
|
4203
|
-
} else lastComputedValue = value;
|
|
4204
|
-
observer.next(value);
|
|
4205
|
-
});
|
|
4206
|
-
let subjectSubscription;
|
|
4207
|
-
if (dependencies.size === 0) subjectSubscription = subject.pipe(filter(() => !init)).subscribe((value) => {
|
|
4208
|
-
observer.next(value);
|
|
4209
|
-
});
|
|
4210
|
-
observer.next(lastComputedValue);
|
|
4211
|
-
return () => {
|
|
4212
|
-
depSubscription.unsubscribe();
|
|
4213
|
-
if (subjectSubscription) subjectSubscription.unsubscribe();
|
|
4214
|
-
};
|
|
4215
|
-
});
|
|
4216
|
-
fn.subscription = fn.observable.subscribe(() => {});
|
|
4217
|
-
fn.dependencies = dependencies;
|
|
4218
|
-
fn._subject = subject;
|
|
4219
|
-
fn.set = (value) => {
|
|
4220
|
-
if (!isOverridden) {
|
|
4221
|
-
overrideDepVersion = depVersion;
|
|
4222
|
-
if (computationFn && sourceSignal) previousValue = {
|
|
4223
|
-
source: untracked(() => {
|
|
4224
|
-
if (typeof sourceSignal === "function") {
|
|
4225
|
-
const source = sourceSignal;
|
|
4226
|
-
return isSignal(source) ? source() : sourceSignal();
|
|
4227
|
-
}
|
|
4228
|
-
return sourceSignal();
|
|
4229
|
-
}),
|
|
4230
|
-
value
|
|
4231
|
-
};
|
|
4232
|
-
}
|
|
4233
|
-
isOverridden = true;
|
|
4234
|
-
overriddenValue = value;
|
|
4235
|
-
lastComputedValue = value;
|
|
4236
|
-
subject.next(value);
|
|
4237
|
-
};
|
|
4238
|
-
reactiveStore.currentSubscriptionsTracker?.(fn.subscription);
|
|
4239
|
-
init = false;
|
|
4240
|
-
return fn;
|
|
4241
|
-
}
|
|
4242
|
-
__name$1(linkedSignal, "linkedSignal");
|
|
4243
|
-
function untracked(fn) {
|
|
4244
|
-
const prevDepTracker = reactiveStore.currentDependencyTracker;
|
|
4245
|
-
const prevSubTracker = reactiveStore.currentSubscriptionsTracker;
|
|
4246
|
-
reactiveStore.currentDependencyTracker = null;
|
|
4247
|
-
reactiveStore.currentSubscriptionsTracker = null;
|
|
4248
|
-
try {
|
|
4249
|
-
return fn();
|
|
4250
|
-
} finally {
|
|
4251
|
-
reactiveStore.currentDependencyTracker = prevDepTracker;
|
|
4252
|
-
reactiveStore.currentSubscriptionsTracker = prevSubTracker;
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
__name$1(untracked, "untracked");
|
|
4256
|
-
function effect(fn) {
|
|
4257
|
-
fn["isEffect"] = true;
|
|
4258
|
-
return computed(fn);
|
|
4259
|
-
}
|
|
4260
|
-
__name$1(effect, "effect");
|
|
4261
|
-
//#endregion
|
|
4262
|
-
//#region ../../node_modules/.pnpm/@signe+sync@2.9.0/node_modules/@signe/sync/dist/index.js
|
|
4263
|
-
function isFunction(val) {
|
|
4264
|
-
return {}.toString.call(val) === "[object Function]";
|
|
4265
|
-
}
|
|
4266
|
-
__name$2(isFunction, "isFunction");
|
|
4267
|
-
function isClass$1(obj) {
|
|
4268
|
-
return typeof obj === "function" && obj.prototype && obj.prototype.constructor === obj;
|
|
4269
|
-
}
|
|
4270
|
-
__name$2(isClass$1, "isClass");
|
|
4271
|
-
var isObject$2 = /* @__PURE__ */ __name$2((item) => item && typeof item === "object" && !Array.isArray(item) && item !== null, "isObject");
|
|
4272
|
-
function isInstanceOfClass(value) {
|
|
4273
|
-
if (value === null || typeof value !== "object" || value === void 0 || Array.isArray(value)) return false;
|
|
4274
|
-
return Object.getPrototypeOf(value) !== Object.prototype;
|
|
4275
|
-
}
|
|
4276
|
-
__name$2(isInstanceOfClass, "isInstanceOfClass");
|
|
4277
|
-
function generateShortUUID$1() {
|
|
4278
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
4279
|
-
let uuid = "";
|
|
4280
|
-
for (let i = 0; i < 8; i++) {
|
|
4281
|
-
const randomIndex = Math.floor(Math.random() * 62);
|
|
4282
|
-
uuid += chars[randomIndex];
|
|
4283
|
-
}
|
|
4284
|
-
return uuid;
|
|
4285
|
-
}
|
|
4286
|
-
__name$2(generateShortUUID$1, "generateShortUUID");
|
|
4287
|
-
var DELETE_TOKEN = "$delete";
|
|
4288
|
-
var syncClass = /* @__PURE__ */ __name$2((instance, options = {}) => {
|
|
4289
|
-
const cacheSync = /* @__PURE__ */ new Map();
|
|
4290
|
-
const cachePersist = /* @__PURE__ */ new Map();
|
|
4291
|
-
instance.$valuesChanges = {
|
|
4292
|
-
set: /* @__PURE__ */ __name$2((path, value) => {
|
|
4293
|
-
cacheSync.set(path, value);
|
|
4294
|
-
options.onSync?.(cacheSync);
|
|
4295
|
-
}, "set"),
|
|
4296
|
-
setPersist: /* @__PURE__ */ __name$2((path, value) => {
|
|
4297
|
-
if (path == "") path = ".";
|
|
4298
|
-
cachePersist.set(path, value);
|
|
4299
|
-
options.onPersist?.(cachePersist);
|
|
4300
|
-
}, "setPersist"),
|
|
4301
|
-
has: /* @__PURE__ */ __name$2((path) => {
|
|
4302
|
-
return cacheSync.has(path);
|
|
4303
|
-
}, "has"),
|
|
4304
|
-
get: /* @__PURE__ */ __name$2((path) => {
|
|
4305
|
-
return cacheSync.get(path);
|
|
4306
|
-
}, "get")
|
|
4307
|
-
};
|
|
4308
|
-
createSyncClass(instance);
|
|
4309
|
-
}, "syncClass");
|
|
4310
|
-
function createStatesSnapshot(instance) {
|
|
4311
|
-
let persistObject = {};
|
|
4312
|
-
if (instance?.$snapshot) for (const key of instance.$snapshot.keys()) {
|
|
4313
|
-
const signal = instance.$snapshot.get(key);
|
|
4314
|
-
const persist2 = signal.options.persist ?? true;
|
|
4315
|
-
let value = signal();
|
|
4316
|
-
if (isObject$2(value) || Array.isArray(value)) continue;
|
|
4317
|
-
if (persist2) persistObject[key] = value;
|
|
4318
|
-
}
|
|
4319
|
-
return persistObject;
|
|
4320
|
-
}
|
|
4321
|
-
__name$2(createStatesSnapshot, "createStatesSnapshot");
|
|
4322
|
-
var SNAPSHOT_SKIP = Symbol("snapshot-skip");
|
|
4323
|
-
var serializeSnapshotDeep = /* @__PURE__ */ __name$2((value, path, options, seen) => {
|
|
4324
|
-
if (isSignal(value)) return serializeSnapshotDeep(value(), path, options, seen);
|
|
4325
|
-
if (value instanceof Map) return SNAPSHOT_SKIP;
|
|
4326
|
-
if (options.filter && !options.filter(value, path)) return SNAPSHOT_SKIP;
|
|
4327
|
-
if (value instanceof Date) return options.dateToString ? options.dateToString(value) : value.toISOString();
|
|
4328
|
-
if (value && typeof value === "object") {
|
|
4329
|
-
if (seen.has(value)) return SNAPSHOT_SKIP;
|
|
4330
|
-
seen.add(value);
|
|
4331
|
-
if (Array.isArray(value)) {
|
|
4332
|
-
const result2 = [];
|
|
4333
|
-
value.forEach((item, index) => {
|
|
4334
|
-
const serialized = serializeSnapshotDeep(item, path ? `${path}.${index}` : String(index), options, seen);
|
|
4335
|
-
if (serialized !== SNAPSHOT_SKIP) result2.push(serialized);
|
|
4336
|
-
});
|
|
4337
|
-
return result2;
|
|
4338
|
-
}
|
|
4339
|
-
const result = {};
|
|
4340
|
-
const idKey = isInstanceOfClass(value) ? value.constructor?._propertyMetadata?.get("id") : void 0;
|
|
4341
|
-
const entries = Object.entries(value).filter(([key]) => isInstanceOfClass(value) ? key.startsWith("__") || (idKey ? key === idKey : false) : true);
|
|
4342
|
-
for (const [key, childValue] of entries) {
|
|
4343
|
-
const normalizedKey = key.startsWith("__") ? key.slice(2) : key;
|
|
4344
|
-
const serialized = serializeSnapshotDeep(childValue, path ? `${path}.${normalizedKey}` : normalizedKey, options, seen);
|
|
4345
|
-
if (serialized !== SNAPSHOT_SKIP) result[normalizedKey] = serialized;
|
|
4346
|
-
}
|
|
4347
|
-
return result;
|
|
4348
|
-
}
|
|
4349
|
-
return value;
|
|
4350
|
-
}, "serializeSnapshotDeep");
|
|
4351
|
-
function createStatesSnapshotDeep(instance, options = {}) {
|
|
4352
|
-
const persistObject = {};
|
|
4353
|
-
if (instance?.$snapshot) for (const key of instance.$snapshot.keys()) {
|
|
4354
|
-
const signal = instance.$snapshot.get(key);
|
|
4355
|
-
if (!(signal.options.persist ?? true)) continue;
|
|
4356
|
-
const serialized = serializeSnapshotDeep(signal(), key, options, /* @__PURE__ */ new WeakSet());
|
|
4357
|
-
if (serialized !== SNAPSHOT_SKIP) persistObject[key] = serialized;
|
|
4358
|
-
}
|
|
4359
|
-
return persistObject;
|
|
4360
|
-
}
|
|
4361
|
-
__name$2(createStatesSnapshotDeep, "createStatesSnapshotDeep");
|
|
4362
|
-
function setMetadata(target, key, value) {
|
|
4363
|
-
const propId = target.constructor._propertyMetadata?.get(key);
|
|
4364
|
-
if (propId) if (isSignal(target[propId])) target[propId].set(value);
|
|
4365
|
-
else target[propId] = value;
|
|
4366
|
-
}
|
|
4367
|
-
__name$2(setMetadata, "setMetadata");
|
|
4368
|
-
var createSyncClass = /* @__PURE__ */ __name$2((currentClass, parentKey = null, parentClass = null, path = "") => {
|
|
4369
|
-
currentClass.$path = path;
|
|
4370
|
-
if (parentClass) currentClass.$valuesChanges = parentClass.$valuesChanges;
|
|
4371
|
-
if (parentKey) setMetadata(currentClass, "id", parentKey);
|
|
4372
|
-
if (currentClass.$snapshot) for (const key of currentClass.$snapshot.keys()) {
|
|
4373
|
-
const signal = currentClass.$snapshot.get(key);
|
|
4374
|
-
const syncToClient = signal.options?.syncToClient ?? true;
|
|
4375
|
-
const persist2 = signal.options?.persist ?? true;
|
|
4376
|
-
const transform = signal.options?.transform;
|
|
4377
|
-
let signalValue = signal();
|
|
4378
|
-
if (transform) signalValue = transform(signalValue);
|
|
4379
|
-
if (isObject$2(signalValue) || Array.isArray(signalValue)) signalValue = { ...signalValue };
|
|
4380
|
-
const transformedValue = signalValue;
|
|
4381
|
-
const newPath = (path ? path + "." : "") + key;
|
|
4382
|
-
if (syncToClient) currentClass.$valuesChanges.set(newPath, transformedValue);
|
|
4383
|
-
if (persist2) {
|
|
4384
|
-
if (parentClass) currentClass.$valuesChanges.setPersist(path, transformedValue);
|
|
4385
|
-
}
|
|
4386
|
-
if (isComputed(signal)) signal.observable.subscribe((newValue) => {
|
|
4387
|
-
if (syncToClient) {
|
|
4388
|
-
const transformedNewValue = transform ? transform(newValue) : newValue;
|
|
4389
|
-
currentClass.$valuesChanges.set(newPath, transformedNewValue);
|
|
4390
|
-
}
|
|
4391
|
-
});
|
|
4392
|
-
}
|
|
4393
|
-
}, "createSyncClass");
|
|
4394
|
-
var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstance) => {
|
|
4395
|
-
const { syncToClient = true, persist: persist2 = true, transform } = options;
|
|
4396
|
-
let init = true;
|
|
4397
|
-
const handleObjectSubject = /* @__PURE__ */ __name$2((value, propPath) => {
|
|
4398
|
-
const newPath = `${propPath}${value.key ? `.${value.key}` : ""}`;
|
|
4399
|
-
if ([
|
|
4400
|
-
"add",
|
|
4401
|
-
"reset",
|
|
4402
|
-
"update"
|
|
4403
|
-
].includes(value.type)) if (isInstanceOfClass(value.value)) createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
4404
|
-
else if (value.type === "update" && (isObject$2(value.value) || Array.isArray(value.value))) createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
4405
|
-
else savePath(newPath, value.value);
|
|
4406
|
-
else if (value.type === "remove") savePath(newPath, DELETE_TOKEN);
|
|
4407
|
-
}, "handleObjectSubject");
|
|
4408
|
-
const handleArraySubject = /* @__PURE__ */ __name$2((value, propPath) => {
|
|
4409
|
-
if (value.type === "reset" && Array.isArray(value.items)) {
|
|
4410
|
-
value.items.forEach((item, index) => {
|
|
4411
|
-
const newPath2 = `${propPath}.${index}`;
|
|
4412
|
-
if (isInstanceOfClass(item)) createSyncClass(item, value.key, currentInstance, newPath2);
|
|
4413
|
-
else savePath(newPath2, item);
|
|
4414
|
-
});
|
|
4415
|
-
return;
|
|
4416
|
-
}
|
|
4417
|
-
const newPath = `${propPath}.${value.index}`;
|
|
4418
|
-
const firstItem = value.items?.[0];
|
|
4419
|
-
if (["add", "update"].includes(value.type) && firstItem !== void 0) if (isInstanceOfClass(firstItem)) createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
4420
|
-
else if (value.type === "update" && (isObject$2(firstItem) || Array.isArray(firstItem))) createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
4421
|
-
else savePath(newPath, firstItem);
|
|
4422
|
-
else if (value.type === "remove") savePath(newPath, DELETE_TOKEN);
|
|
4423
|
-
}, "handleArraySubject");
|
|
4424
|
-
const savePath = /* @__PURE__ */ __name$2((propPath, value) => {
|
|
4425
|
-
const transformedValue = transform && value !== "$delete" ? transform(value) : value;
|
|
4426
|
-
if (syncToClient) currentInstance.$valuesChanges.set(propPath, transformedValue);
|
|
4427
|
-
if (persist2 && currentInstance.$path !== void 0) currentInstance.$valuesChanges.setPersist(transformedValue == "$delete" ? propPath : currentInstance.$path, transformedValue);
|
|
4428
|
-
}, "savePath");
|
|
4429
|
-
const setupSubscription = /* @__PURE__ */ __name$2((signal, signalPath) => {
|
|
4430
|
-
if (!isSignal(signal)) return;
|
|
4431
|
-
if (syncToClient && currentInstance.$valuesChanges) {
|
|
4432
|
-
const initialValue = signal();
|
|
4433
|
-
const transformedInitialValue = transform ? transform(initialValue) : initialValue;
|
|
4434
|
-
currentInstance.$valuesChanges.set(signalPath, transformedInitialValue);
|
|
4435
|
-
}
|
|
4436
|
-
signal.options = options;
|
|
4437
|
-
signal.observable.subscribe((value) => {
|
|
4438
|
-
if (init) return;
|
|
4439
|
-
if (currentInstance.$path !== void 0) {
|
|
4440
|
-
const fullPath = `${currentInstance.$path ? currentInstance.$path + "." : ""}${signalPath}`;
|
|
4441
|
-
if (isComputed(signal)) savePath(fullPath, value);
|
|
4442
|
-
else if (isObjectSubject(signal._subject)) handleObjectSubject(value, fullPath);
|
|
4443
|
-
else if (isArraySubject(signal._subject)) handleArraySubject(value, fullPath);
|
|
4444
|
-
else savePath(fullPath, value);
|
|
4445
|
-
}
|
|
4446
|
-
});
|
|
4447
|
-
if (!currentInstance.$snapshot) currentInstance.$snapshot = /* @__PURE__ */ new Map();
|
|
4448
|
-
currentInstance.$snapshot.set(path, signal);
|
|
4449
|
-
}, "setupSubscription");
|
|
4450
|
-
if (!isSignal(_signal)) {
|
|
4451
|
-
if (_signal && typeof _signal === "object" && !Array.isArray(_signal)) {
|
|
4452
|
-
for (const key in _signal) if (Object.prototype.hasOwnProperty.call(_signal, key)) {
|
|
4453
|
-
const value = _signal[key];
|
|
4454
|
-
const propertyPath = `${path}.${key}`;
|
|
4455
|
-
if (isSignal(value)) setupSubscription(value, propertyPath);
|
|
4456
|
-
else if (value && typeof value === "object" && !Array.isArray(value)) type(value, propertyPath, options, currentInstance);
|
|
4457
|
-
}
|
|
4458
|
-
init = false;
|
|
4459
|
-
}
|
|
4460
|
-
return _signal;
|
|
4461
|
-
}
|
|
4462
|
-
setupSubscription(_signal, path);
|
|
4463
|
-
init = false;
|
|
4464
|
-
return _signal;
|
|
4465
|
-
}, "type");
|
|
4466
|
-
function sync(options) {
|
|
4467
|
-
let classType;
|
|
4468
|
-
let persist2 = true;
|
|
4469
|
-
let syncToClient = true;
|
|
4470
|
-
let transform;
|
|
4471
|
-
if (typeof options === "function") classType = options;
|
|
4472
|
-
else if (typeof options === "object") {
|
|
4473
|
-
classType = options.classType;
|
|
4474
|
-
if (options.hasOwnProperty("persist")) persist2 = options.persist;
|
|
4475
|
-
if (options.hasOwnProperty("syncToClient")) syncToClient = options.syncToClient;
|
|
4476
|
-
if (options.hasOwnProperty("transform")) transform = options.transform;
|
|
4477
|
-
}
|
|
4478
|
-
return function(target, propertyKey) {
|
|
4479
|
-
const privatePropertyKey = `__${propertyKey}`;
|
|
4480
|
-
Object.defineProperty(target, propertyKey, {
|
|
4481
|
-
get: /* @__PURE__ */ __name$2(function() {
|
|
4482
|
-
return this[privatePropertyKey];
|
|
4483
|
-
}, "getter"),
|
|
4484
|
-
set: /* @__PURE__ */ __name$2(function(newVal) {
|
|
4485
|
-
this[privatePropertyKey] = type(newVal, propertyKey, {
|
|
4486
|
-
classType,
|
|
4487
|
-
persist: persist2,
|
|
4488
|
-
syncToClient,
|
|
4489
|
-
transform
|
|
4490
|
-
}, this);
|
|
4491
|
-
}, "setter"),
|
|
4492
|
-
enumerable: true,
|
|
4493
|
-
configurable: true
|
|
4494
|
-
});
|
|
4495
|
-
};
|
|
4496
|
-
}
|
|
4497
|
-
__name$2(sync, "sync");
|
|
4498
|
-
function id() {
|
|
4499
|
-
return function(target, propertyKey) {
|
|
4500
|
-
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
4501
|
-
target.constructor._propertyMetadata.set("id", propertyKey);
|
|
4502
|
-
};
|
|
4503
|
-
}
|
|
4504
|
-
__name$2(id, "id");
|
|
4505
|
-
function users(options) {
|
|
4506
|
-
return function(target, propertyKey) {
|
|
4507
|
-
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
4508
|
-
target.constructor._propertyMetadata.set("users", propertyKey);
|
|
4509
|
-
sync(options)(target, propertyKey);
|
|
4510
|
-
};
|
|
4511
|
-
}
|
|
4512
|
-
__name$2(users, "users");
|
|
4513
|
-
function persist() {
|
|
4514
|
-
return sync({
|
|
4515
|
-
persist: true,
|
|
4516
|
-
syncToClient: false
|
|
4517
|
-
});
|
|
4518
|
-
}
|
|
4519
|
-
__name$2(persist, "persist");
|
|
4520
|
-
function connected() {
|
|
4521
|
-
return function(target, propertyKey) {
|
|
4522
|
-
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
4523
|
-
target.constructor._propertyMetadata.set("connected", propertyKey);
|
|
4524
|
-
sync({ persist: false })(target, propertyKey);
|
|
4525
|
-
};
|
|
4526
|
-
}
|
|
4527
|
-
__name$2(connected, "connected");
|
|
4528
|
-
function load(rootInstance, values, valueIsObject) {
|
|
4529
|
-
if (valueIsObject) loadFromObject(rootInstance, values);
|
|
4530
|
-
else loadFromPaths(rootInstance, values);
|
|
4531
|
-
}
|
|
4532
|
-
__name$2(load, "load");
|
|
4533
|
-
function loadFromPaths(rootInstance, values) {
|
|
4534
|
-
for (const [path, value] of Object.entries(values)) loadValue(rootInstance, path.split("."), value);
|
|
4535
|
-
}
|
|
4536
|
-
__name$2(loadFromPaths, "loadFromPaths");
|
|
4537
|
-
function loadFromObject(rootInstance, values, currentPath = "") {
|
|
4538
|
-
for (let key in values) {
|
|
4539
|
-
const value = values[key];
|
|
4540
|
-
const newPath = currentPath ? `${currentPath}.${key}` : key;
|
|
4541
|
-
if (typeof value === "object" && !Array.isArray(value) && value !== null) loadFromObject(rootInstance, value, newPath);
|
|
4542
|
-
else loadValue(rootInstance, newPath.split("."), value);
|
|
4543
|
-
}
|
|
4544
|
-
}
|
|
4545
|
-
__name$2(loadFromObject, "loadFromObject");
|
|
4546
|
-
function loadValue(rootInstance, parts, value) {
|
|
4547
|
-
let current = rootInstance;
|
|
4548
|
-
for (let i = 0; i < parts.length; i++) {
|
|
4549
|
-
const part = parts[i];
|
|
4550
|
-
if (i === parts.length - 1) if (value == "$delete") {
|
|
4551
|
-
if (isSignal(current)) current = current();
|
|
4552
|
-
Reflect.deleteProperty(current, part);
|
|
4553
|
-
} else if (current[part]?._subject) current[part].set(value);
|
|
4554
|
-
else if (isSignal(current) && Array.isArray(current()) && !isNaN(Number(part))) current()[Number(part)] = value;
|
|
4555
|
-
else current[part] = value;
|
|
4556
|
-
else {
|
|
4557
|
-
if (isSignal(current)) current = current();
|
|
4558
|
-
if (current[part] === void 0) {
|
|
4559
|
-
const classType = getByPath(rootInstance, parts.slice(0, i).join("."))?.options?.classType;
|
|
4560
|
-
if (classType) {
|
|
4561
|
-
current[part] = !isClass$1(classType) ? classType(part) : new classType();
|
|
4562
|
-
setMetadata(current[part], "id", part);
|
|
4563
|
-
} else current[part] = {};
|
|
4564
|
-
}
|
|
4565
|
-
current = current[part];
|
|
4566
|
-
}
|
|
4567
|
-
}
|
|
4568
|
-
}
|
|
4569
|
-
__name$2(loadValue, "loadValue");
|
|
4570
|
-
function getByPath(root, path) {
|
|
4571
|
-
const parts = path.split(".");
|
|
4572
|
-
let current = root;
|
|
4573
|
-
for (const part of parts) {
|
|
4574
|
-
if (isSignal(current)) current = current();
|
|
4575
|
-
if (current[part]) current = current[part];
|
|
4576
|
-
else return;
|
|
4577
|
-
}
|
|
4578
|
-
return current;
|
|
4579
|
-
}
|
|
4580
|
-
__name$2(getByPath, "getByPath");
|
|
4581
|
-
//#endregion
|
|
4582
3796
|
//#region ../../node_modules/.pnpm/@signe+room@2.9.0/node_modules/@signe/room/dist/index.js
|
|
4583
3797
|
var __defProp = Object.defineProperty;
|
|
4584
3798
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -6469,12 +5683,12 @@ var RoomConfig = class RoomConfig2 {
|
|
|
6469
5683
|
__name(this, "RoomConfig");
|
|
6470
5684
|
}
|
|
6471
5685
|
id;
|
|
6472
|
-
name = signal
|
|
6473
|
-
balancingStrategy = signal
|
|
6474
|
-
public = signal
|
|
6475
|
-
maxPlayersPerShard = signal
|
|
6476
|
-
minShards = signal
|
|
6477
|
-
maxShards = signal
|
|
5686
|
+
name = signal("");
|
|
5687
|
+
balancingStrategy = signal("round-robin");
|
|
5688
|
+
public = signal(true);
|
|
5689
|
+
maxPlayersPerShard = signal(MAX_PLAYERS_PER_SHARD);
|
|
5690
|
+
minShards = signal(1);
|
|
5691
|
+
maxShards = signal(void 0);
|
|
6478
5692
|
};
|
|
6479
5693
|
_ts_decorate([id(), _ts_metadata("design:type", String)], RoomConfig.prototype, "id", void 0);
|
|
6480
5694
|
_ts_decorate([sync()], RoomConfig.prototype, "name", void 0);
|
|
@@ -6488,12 +5702,12 @@ var ShardInfo = class ShardInfo2 {
|
|
|
6488
5702
|
__name(this, "ShardInfo");
|
|
6489
5703
|
}
|
|
6490
5704
|
id;
|
|
6491
|
-
roomId = signal
|
|
6492
|
-
url = signal
|
|
6493
|
-
currentConnections = signal
|
|
6494
|
-
maxConnections = signal
|
|
6495
|
-
status = signal
|
|
6496
|
-
lastHeartbeat = signal
|
|
5705
|
+
roomId = signal("");
|
|
5706
|
+
url = signal("");
|
|
5707
|
+
currentConnections = signal(0);
|
|
5708
|
+
maxConnections = signal(MAX_PLAYERS_PER_SHARD);
|
|
5709
|
+
status = signal("active");
|
|
5710
|
+
lastHeartbeat = signal(0);
|
|
6497
5711
|
};
|
|
6498
5712
|
_ts_decorate([id(), _ts_metadata("design:type", String)], ShardInfo.prototype, "id", void 0);
|
|
6499
5713
|
_ts_decorate([sync()], ShardInfo.prototype, "roomId", void 0);
|
|
@@ -6514,11 +5728,11 @@ var WorldRoom = class {
|
|
|
6514
5728
|
defaultMaxConnectionsPerShard;
|
|
6515
5729
|
constructor(room) {
|
|
6516
5730
|
this.room = room;
|
|
6517
|
-
this.rooms = signal
|
|
6518
|
-
this.shards = signal
|
|
6519
|
-
this.rrCounters = signal
|
|
6520
|
-
this.defaultShardUrlTemplate = signal
|
|
6521
|
-
this.defaultMaxConnectionsPerShard = signal
|
|
5731
|
+
this.rooms = signal({});
|
|
5732
|
+
this.shards = signal({});
|
|
5733
|
+
this.rrCounters = signal({});
|
|
5734
|
+
this.defaultShardUrlTemplate = signal("{shardId}");
|
|
5735
|
+
this.defaultMaxConnectionsPerShard = signal(MAX_PLAYERS_PER_SHARD);
|
|
6522
5736
|
const { AUTH_JWT_SECRET, SHARD_SECRET } = this.room.env;
|
|
6523
5737
|
if (!AUTH_JWT_SECRET) throw new Error("AUTH_JWT_SECRET env variable is not set");
|
|
6524
5738
|
if (!SHARD_SECRET) throw new Error("SHARD_SECRET env variable is not set");
|
|
@@ -7362,7 +6576,7 @@ var MoveList = class MoveList {
|
|
|
7362
6576
|
break;
|
|
7363
6577
|
}
|
|
7364
6578
|
let direction = method(newDirection);
|
|
7365
|
-
if (isFunction
|
|
6579
|
+
if (isFunction(direction)) direction = direction(player, map);
|
|
7366
6580
|
return direction;
|
|
7367
6581
|
};
|
|
7368
6582
|
}
|
|
@@ -8343,9 +7557,11 @@ function WithMoveManager(Base) {
|
|
|
8343
7557
|
const hitbox = this.player.hitbox();
|
|
8344
7558
|
const hitboxWidth = hitbox?.w ?? 32;
|
|
8345
7559
|
const hitboxHeight = hitbox?.h ?? 32;
|
|
7560
|
+
const targetX = targetTopLeftX + hitboxWidth / 2;
|
|
7561
|
+
const targetY = targetTopLeftY + hitboxHeight / 2;
|
|
8346
7562
|
this.currentTarget = {
|
|
8347
|
-
x:
|
|
8348
|
-
y:
|
|
7563
|
+
x: targetX,
|
|
7564
|
+
y: targetY
|
|
8349
7565
|
};
|
|
8350
7566
|
this.currentTargetTopLeft = {
|
|
8351
7567
|
x: targetTopLeftX,
|
|
@@ -13534,13 +12750,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
13534
12750
|
}
|
|
13535
12751
|
return propValues;
|
|
13536
12752
|
});
|
|
13537
|
-
const isObject$
|
|
12753
|
+
const isObject$3 = isObject;
|
|
13538
12754
|
const catchall = def.catchall;
|
|
13539
12755
|
let value;
|
|
13540
12756
|
inst._zod.parse = (payload, ctx) => {
|
|
13541
12757
|
value ?? (value = _normalized.value);
|
|
13542
12758
|
const input = payload.value;
|
|
13543
|
-
if (!isObject$
|
|
12759
|
+
if (!isObject$3(input)) {
|
|
13544
12760
|
payload.issues.push({
|
|
13545
12761
|
expected: "object",
|
|
13546
12762
|
code: "invalid_type",
|
|
@@ -13634,7 +12850,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13634
12850
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
13635
12851
|
};
|
|
13636
12852
|
let fastpass;
|
|
13637
|
-
const isObject$
|
|
12853
|
+
const isObject$2 = isObject;
|
|
13638
12854
|
const jit = !globalConfig.jitless;
|
|
13639
12855
|
const fastEnabled = jit && allowsEval.value;
|
|
13640
12856
|
const catchall = def.catchall;
|
|
@@ -13642,7 +12858,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13642
12858
|
inst._zod.parse = (payload, ctx) => {
|
|
13643
12859
|
value ?? (value = _normalized.value);
|
|
13644
12860
|
const input = payload.value;
|
|
13645
|
-
if (!isObject$
|
|
12861
|
+
if (!isObject$2(input)) {
|
|
13646
12862
|
payload.issues.push({
|
|
13647
12863
|
expected: "object",
|
|
13648
12864
|
code: "invalid_type",
|
|
@@ -14618,7 +13834,7 @@ function initializeContext(params) {
|
|
|
14618
13834
|
external: params?.external ?? void 0
|
|
14619
13835
|
};
|
|
14620
13836
|
}
|
|
14621
|
-
function process
|
|
13837
|
+
function process(schema, ctx, _params = {
|
|
14622
13838
|
path: [],
|
|
14623
13839
|
schemaPath: []
|
|
14624
13840
|
}) {
|
|
@@ -14655,7 +13871,7 @@ function process$1(schema, ctx, _params = {
|
|
|
14655
13871
|
const parent = schema._zod.parent;
|
|
14656
13872
|
if (parent) {
|
|
14657
13873
|
if (!result.ref) result.ref = parent;
|
|
14658
|
-
process
|
|
13874
|
+
process(parent, ctx, params);
|
|
14659
13875
|
ctx.seen.get(parent).isParent = true;
|
|
14660
13876
|
}
|
|
14661
13877
|
}
|
|
@@ -14867,7 +14083,7 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
14867
14083
|
...params,
|
|
14868
14084
|
processors
|
|
14869
14085
|
});
|
|
14870
|
-
process
|
|
14086
|
+
process(schema, ctx);
|
|
14871
14087
|
extractDefs(ctx, schema);
|
|
14872
14088
|
return finalize(ctx, schema);
|
|
14873
14089
|
};
|
|
@@ -14879,7 +14095,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
|
|
|
14879
14095
|
io,
|
|
14880
14096
|
processors
|
|
14881
14097
|
});
|
|
14882
|
-
process
|
|
14098
|
+
process(schema, ctx);
|
|
14883
14099
|
extractDefs(ctx, schema);
|
|
14884
14100
|
return finalize(ctx, schema);
|
|
14885
14101
|
};
|
|
@@ -14963,7 +14179,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
14963
14179
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
14964
14180
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
14965
14181
|
json.type = "array";
|
|
14966
|
-
json.items = process
|
|
14182
|
+
json.items = process(def.element, ctx, {
|
|
14967
14183
|
...params,
|
|
14968
14184
|
path: [...params.path, "items"]
|
|
14969
14185
|
});
|
|
@@ -14974,7 +14190,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
14974
14190
|
json.type = "object";
|
|
14975
14191
|
json.properties = {};
|
|
14976
14192
|
const shape = def.shape;
|
|
14977
|
-
for (const key in shape) json.properties[key] = process
|
|
14193
|
+
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
14978
14194
|
...params,
|
|
14979
14195
|
path: [
|
|
14980
14196
|
...params.path,
|
|
@@ -14992,7 +14208,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
14992
14208
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
14993
14209
|
else if (!def.catchall) {
|
|
14994
14210
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
14995
|
-
} else if (def.catchall) json.additionalProperties = process
|
|
14211
|
+
} else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
|
|
14996
14212
|
...params,
|
|
14997
14213
|
path: [...params.path, "additionalProperties"]
|
|
14998
14214
|
});
|
|
@@ -15000,7 +14216,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
15000
14216
|
var unionProcessor = (schema, ctx, json, params) => {
|
|
15001
14217
|
const def = schema._zod.def;
|
|
15002
14218
|
const isExclusive = def.inclusive === false;
|
|
15003
|
-
const options = def.options.map((x, i) => process
|
|
14219
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
15004
14220
|
...params,
|
|
15005
14221
|
path: [
|
|
15006
14222
|
...params.path,
|
|
@@ -15013,7 +14229,7 @@ var unionProcessor = (schema, ctx, json, params) => {
|
|
|
15013
14229
|
};
|
|
15014
14230
|
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
15015
14231
|
const def = schema._zod.def;
|
|
15016
|
-
const a = process
|
|
14232
|
+
const a = process(def.left, ctx, {
|
|
15017
14233
|
...params,
|
|
15018
14234
|
path: [
|
|
15019
14235
|
...params.path,
|
|
@@ -15021,7 +14237,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
15021
14237
|
0
|
|
15022
14238
|
]
|
|
15023
14239
|
});
|
|
15024
|
-
const b = process
|
|
14240
|
+
const b = process(def.right, ctx, {
|
|
15025
14241
|
...params,
|
|
15026
14242
|
path: [
|
|
15027
14243
|
...params.path,
|
|
@@ -15034,7 +14250,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
15034
14250
|
};
|
|
15035
14251
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
15036
14252
|
const def = schema._zod.def;
|
|
15037
|
-
const inner = process
|
|
14253
|
+
const inner = process(def.innerType, ctx, params);
|
|
15038
14254
|
const seen = ctx.seen.get(schema);
|
|
15039
14255
|
if (ctx.target === "openapi-3.0") {
|
|
15040
14256
|
seen.ref = def.innerType;
|
|
@@ -15043,27 +14259,27 @@ var nullableProcessor = (schema, ctx, json, params) => {
|
|
|
15043
14259
|
};
|
|
15044
14260
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
15045
14261
|
const def = schema._zod.def;
|
|
15046
|
-
process
|
|
14262
|
+
process(def.innerType, ctx, params);
|
|
15047
14263
|
const seen = ctx.seen.get(schema);
|
|
15048
14264
|
seen.ref = def.innerType;
|
|
15049
14265
|
};
|
|
15050
14266
|
var defaultProcessor = (schema, ctx, json, params) => {
|
|
15051
14267
|
const def = schema._zod.def;
|
|
15052
|
-
process
|
|
14268
|
+
process(def.innerType, ctx, params);
|
|
15053
14269
|
const seen = ctx.seen.get(schema);
|
|
15054
14270
|
seen.ref = def.innerType;
|
|
15055
14271
|
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
15056
14272
|
};
|
|
15057
14273
|
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
15058
14274
|
const def = schema._zod.def;
|
|
15059
|
-
process
|
|
14275
|
+
process(def.innerType, ctx, params);
|
|
15060
14276
|
const seen = ctx.seen.get(schema);
|
|
15061
14277
|
seen.ref = def.innerType;
|
|
15062
14278
|
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
15063
14279
|
};
|
|
15064
14280
|
var catchProcessor = (schema, ctx, json, params) => {
|
|
15065
14281
|
const def = schema._zod.def;
|
|
15066
|
-
process
|
|
14282
|
+
process(def.innerType, ctx, params);
|
|
15067
14283
|
const seen = ctx.seen.get(schema);
|
|
15068
14284
|
seen.ref = def.innerType;
|
|
15069
14285
|
let catchValue;
|
|
@@ -15077,20 +14293,20 @@ var catchProcessor = (schema, ctx, json, params) => {
|
|
|
15077
14293
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
15078
14294
|
const def = schema._zod.def;
|
|
15079
14295
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
15080
|
-
process
|
|
14296
|
+
process(innerType, ctx, params);
|
|
15081
14297
|
const seen = ctx.seen.get(schema);
|
|
15082
14298
|
seen.ref = innerType;
|
|
15083
14299
|
};
|
|
15084
14300
|
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
15085
14301
|
const def = schema._zod.def;
|
|
15086
|
-
process
|
|
14302
|
+
process(def.innerType, ctx, params);
|
|
15087
14303
|
const seen = ctx.seen.get(schema);
|
|
15088
14304
|
seen.ref = def.innerType;
|
|
15089
14305
|
json.readOnly = true;
|
|
15090
14306
|
};
|
|
15091
14307
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
15092
14308
|
const def = schema._zod.def;
|
|
15093
|
-
process
|
|
14309
|
+
process(def.innerType, ctx, params);
|
|
15094
14310
|
const seen = ctx.seen.get(schema);
|
|
15095
14311
|
seen.ref = def.innerType;
|
|
15096
14312
|
};
|
|
@@ -15956,15 +15172,25 @@ function isRpgLog(error) {
|
|
|
15956
15172
|
* when updating a map configuration.
|
|
15957
15173
|
*/
|
|
15958
15174
|
var MapUpdateSchema = object({
|
|
15175
|
+
/** Configuration object for the map (optional) */
|
|
15959
15176
|
config: any().optional(),
|
|
15177
|
+
/** Damage formulas configuration (optional) */
|
|
15960
15178
|
damageFormulas: any().optional(),
|
|
15179
|
+
/** Unique identifier for the map (required) */
|
|
15961
15180
|
id: string(),
|
|
15181
|
+
/** Width of the map in pixels (required) */
|
|
15962
15182
|
width: number(),
|
|
15183
|
+
/** Height of the map in pixels (required) */
|
|
15963
15184
|
height: number(),
|
|
15185
|
+
/** Map events to spawn (optional) */
|
|
15964
15186
|
events: array(any()).optional(),
|
|
15187
|
+
/** Optional static hitboxes (custom maps) */
|
|
15965
15188
|
hitboxes: array(any()).optional(),
|
|
15189
|
+
/** Parsed tiled map payload (optional) */
|
|
15966
15190
|
parsedMap: any().optional(),
|
|
15191
|
+
/** Raw map source payload (optional) */
|
|
15967
15192
|
data: any().optional(),
|
|
15193
|
+
/** Optional map params payload */
|
|
15968
15194
|
params: any().optional()
|
|
15969
15195
|
});
|
|
15970
15196
|
var SAFE_MAP_WIDTH = 1e3;
|
|
@@ -17532,10 +16758,14 @@ var RpgMap = class RpgMap extends RpgCommonMap {
|
|
|
17532
16758
|
* ```
|
|
17533
16759
|
*/
|
|
17534
16760
|
setSync(schema) {
|
|
17535
|
-
for (let key in schema)
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
16761
|
+
for (let key in schema) {
|
|
16762
|
+
const initial = typeof schema[key]?.$initial !== "undefined" ? schema[key].$initial : null;
|
|
16763
|
+
const holder = {};
|
|
16764
|
+
this[key] = type(signal(initial), key, {
|
|
16765
|
+
syncToClient: schema[key]?.$syncWithClient,
|
|
16766
|
+
persist: schema[key]?.$permanent
|
|
16767
|
+
}, holder);
|
|
16768
|
+
}
|
|
17539
16769
|
}
|
|
17540
16770
|
/**
|
|
17541
16771
|
* Apply sync to the client
|
|
@@ -18044,6 +17274,38 @@ function createServer(options) {
|
|
|
18044
17274
|
* ```
|
|
18045
17275
|
*/
|
|
18046
17276
|
var Components = {
|
|
17277
|
+
/**
|
|
17278
|
+
* Create a text component
|
|
17279
|
+
*
|
|
17280
|
+
* Creates a text component that displays text with optional styling.
|
|
17281
|
+
* Supports template strings with placeholders like {name}, {hp}, etc.
|
|
17282
|
+
* that are replaced with actual player property values.
|
|
17283
|
+
*
|
|
17284
|
+
* ## Design
|
|
17285
|
+
*
|
|
17286
|
+
* Text components use template strings to allow dynamic content without
|
|
17287
|
+
* resending the entire component structure when values change. Only the
|
|
17288
|
+
* property values are synchronized, reducing bandwidth usage.
|
|
17289
|
+
*
|
|
17290
|
+
* @param text - Text to display, can include placeholders like {name}, {hp}
|
|
17291
|
+
* @param options - Text styling options
|
|
17292
|
+
* @returns Component definition for text
|
|
17293
|
+
*
|
|
17294
|
+
* @example
|
|
17295
|
+
* ```ts
|
|
17296
|
+
* // Simple text
|
|
17297
|
+
* Components.text('Player Name');
|
|
17298
|
+
*
|
|
17299
|
+
* // Text with placeholder
|
|
17300
|
+
* Components.text('{name}');
|
|
17301
|
+
*
|
|
17302
|
+
* // Text with styling
|
|
17303
|
+
* Components.text('{name}', {
|
|
17304
|
+
* fill: '#000000',
|
|
17305
|
+
* fontSize: 20
|
|
17306
|
+
* });
|
|
17307
|
+
* ```
|
|
17308
|
+
*/
|
|
18047
17309
|
text(value, style) {
|
|
18048
17310
|
return {
|
|
18049
17311
|
type: "text",
|
|
@@ -18051,6 +17313,42 @@ var Components = {
|
|
|
18051
17313
|
style
|
|
18052
17314
|
};
|
|
18053
17315
|
},
|
|
17316
|
+
/**
|
|
17317
|
+
* Create an HP bar component
|
|
17318
|
+
*
|
|
17319
|
+
* Creates a health point bar that automatically displays the player's
|
|
17320
|
+
* current HP relative to their maximum HP. The bar updates automatically
|
|
17321
|
+
* as HP changes.
|
|
17322
|
+
*
|
|
17323
|
+
* ## Design
|
|
17324
|
+
*
|
|
17325
|
+
* HP bars read from the player's hp and param.maxHp properties. The
|
|
17326
|
+
* bar can optionally display text above it showing current, max, or
|
|
17327
|
+
* percentage values.
|
|
17328
|
+
*
|
|
17329
|
+
* @param options - Bar styling options
|
|
17330
|
+
* @param text - Optional text to display above the bar. Can use placeholders:
|
|
17331
|
+
* - {$current} - Current HP value
|
|
17332
|
+
* - {$max} - Maximum HP value
|
|
17333
|
+
* - {$percent} - Percentage value
|
|
17334
|
+
* Set to null to hide text
|
|
17335
|
+
* @returns Component definition for HP bar
|
|
17336
|
+
*
|
|
17337
|
+
* @example
|
|
17338
|
+
* ```ts
|
|
17339
|
+
* // Simple HP bar
|
|
17340
|
+
* Components.hpBar();
|
|
17341
|
+
*
|
|
17342
|
+
* // HP bar with percentage text
|
|
17343
|
+
* Components.hpBar({}, '{$percent}%');
|
|
17344
|
+
*
|
|
17345
|
+
* // HP bar with custom styling
|
|
17346
|
+
* Components.hpBar({
|
|
17347
|
+
* fillColor: '#ff0000',
|
|
17348
|
+
* height: 8
|
|
17349
|
+
* });
|
|
17350
|
+
* ```
|
|
17351
|
+
*/
|
|
18054
17352
|
hpBar(style, text) {
|
|
18055
17353
|
return {
|
|
18056
17354
|
type: "hpBar",
|
|
@@ -18058,6 +17356,30 @@ var Components = {
|
|
|
18058
17356
|
text: text ?? void 0
|
|
18059
17357
|
};
|
|
18060
17358
|
},
|
|
17359
|
+
/**
|
|
17360
|
+
* Create an SP bar component
|
|
17361
|
+
*
|
|
17362
|
+
* Creates a skill point bar that automatically displays the player's
|
|
17363
|
+
* current SP relative to their maximum SP. The bar updates automatically
|
|
17364
|
+
* as SP changes.
|
|
17365
|
+
*
|
|
17366
|
+
* @param style - Bar styling options
|
|
17367
|
+
* @param text - Optional text to display above the bar. Can use placeholders:
|
|
17368
|
+
* - {$current} - Current SP value
|
|
17369
|
+
* - {$max} - Maximum SP value
|
|
17370
|
+
* - {$percent} - Percentage value
|
|
17371
|
+
* Set to null to hide text
|
|
17372
|
+
* @returns Component definition for SP bar
|
|
17373
|
+
*
|
|
17374
|
+
* @example
|
|
17375
|
+
* ```ts
|
|
17376
|
+
* // Simple SP bar
|
|
17377
|
+
* Components.spBar();
|
|
17378
|
+
*
|
|
17379
|
+
* // SP bar with text
|
|
17380
|
+
* Components.spBar({}, 'SP: {$current}/{$max}');
|
|
17381
|
+
* ```
|
|
17382
|
+
*/
|
|
18061
17383
|
spBar(style, text) {
|
|
18062
17384
|
return {
|
|
18063
17385
|
type: "spBar",
|
|
@@ -18065,6 +17387,31 @@ var Components = {
|
|
|
18065
17387
|
text: text ?? void 0
|
|
18066
17388
|
};
|
|
18067
17389
|
},
|
|
17390
|
+
/**
|
|
17391
|
+
* Create a custom bar component
|
|
17392
|
+
*
|
|
17393
|
+
* Creates a bar that displays a custom property value relative to a maximum.
|
|
17394
|
+
* Useful for displaying custom resources like wood, mana, energy, etc.
|
|
17395
|
+
*
|
|
17396
|
+
* @param current - Property path for current value (e.g., 'wood', 'mana')
|
|
17397
|
+
* @param max - Property path for maximum value (e.g., 'param.maxWood', 'param.maxMana')
|
|
17398
|
+
* @param style - Bar styling options
|
|
17399
|
+
* @param text - Optional text to display above the bar. Can use placeholders:
|
|
17400
|
+
* - {$current} - Current value
|
|
17401
|
+
* - {$max} - Maximum value
|
|
17402
|
+
* - {$percent} - Percentage value
|
|
17403
|
+
* Set to null to hide text
|
|
17404
|
+
* @returns Component definition for custom bar
|
|
17405
|
+
*
|
|
17406
|
+
* @example
|
|
17407
|
+
* ```ts
|
|
17408
|
+
* // Bar for custom property
|
|
17409
|
+
* Components.bar('wood', 'param.maxWood');
|
|
17410
|
+
*
|
|
17411
|
+
* // Bar with text
|
|
17412
|
+
* Components.bar('mana', 'param.maxMana', {}, 'Mana: {$current}/{$max}');
|
|
17413
|
+
* ```
|
|
17414
|
+
*/
|
|
18068
17415
|
bar(current, max, style, text) {
|
|
18069
17416
|
return {
|
|
18070
17417
|
type: "bar",
|
|
@@ -18074,18 +17421,78 @@ var Components = {
|
|
|
18074
17421
|
text: text ?? void 0
|
|
18075
17422
|
};
|
|
18076
17423
|
},
|
|
17424
|
+
/**
|
|
17425
|
+
* Create a shape component
|
|
17426
|
+
*
|
|
17427
|
+
* Creates a geometric shape that can be displayed above or below the player.
|
|
17428
|
+
* Useful for visual indicators, backgrounds, or decorative elements.
|
|
17429
|
+
*
|
|
17430
|
+
* @param value - Shape configuration options
|
|
17431
|
+
* @returns Component definition for shape
|
|
17432
|
+
*
|
|
17433
|
+
* @example
|
|
17434
|
+
* ```ts
|
|
17435
|
+
* // Circle shape
|
|
17436
|
+
* Components.shape({
|
|
17437
|
+
* fill: '#ffffff',
|
|
17438
|
+
* type: 'circle',
|
|
17439
|
+
* radius: 10
|
|
17440
|
+
* });
|
|
17441
|
+
*
|
|
17442
|
+
* // Rectangle shape
|
|
17443
|
+
* Components.shape({
|
|
17444
|
+
* fill: '#ff0000',
|
|
17445
|
+
* type: 'rectangle',
|
|
17446
|
+
* width: 32,
|
|
17447
|
+
* height: 32
|
|
17448
|
+
* });
|
|
17449
|
+
*
|
|
17450
|
+
* // Using parameters
|
|
17451
|
+
* Components.shape({
|
|
17452
|
+
* fill: '#ffffff',
|
|
17453
|
+
* type: 'circle',
|
|
17454
|
+
* radius: 'hp' // radius will be the same as hp value
|
|
17455
|
+
* });
|
|
17456
|
+
* ```
|
|
17457
|
+
*/
|
|
18077
17458
|
shape(value) {
|
|
18078
17459
|
return {
|
|
18079
17460
|
type: "shape",
|
|
18080
17461
|
value
|
|
18081
17462
|
};
|
|
18082
17463
|
},
|
|
17464
|
+
/**
|
|
17465
|
+
* Create an image component
|
|
17466
|
+
*
|
|
17467
|
+
* Displays an image from a URL or spritesheet identifier.
|
|
17468
|
+
*
|
|
17469
|
+
* @param value - Image source URL or spritesheet identifier
|
|
17470
|
+
* @returns Component definition for image
|
|
17471
|
+
*
|
|
17472
|
+
* @example
|
|
17473
|
+
* ```ts
|
|
17474
|
+
* Components.image('mygraphic.png');
|
|
17475
|
+
* ```
|
|
17476
|
+
*/
|
|
18083
17477
|
image(value) {
|
|
18084
17478
|
return {
|
|
18085
17479
|
type: "image",
|
|
18086
17480
|
value
|
|
18087
17481
|
};
|
|
18088
17482
|
},
|
|
17483
|
+
/**
|
|
17484
|
+
* Create a tile component
|
|
17485
|
+
*
|
|
17486
|
+
* Displays a tile from a tileset by ID.
|
|
17487
|
+
*
|
|
17488
|
+
* @param value - Tile ID in the tileset
|
|
17489
|
+
* @returns Component definition for tile
|
|
17490
|
+
*
|
|
17491
|
+
* @example
|
|
17492
|
+
* ```ts
|
|
17493
|
+
* Components.tile(3); // Use tile #3
|
|
17494
|
+
* ```
|
|
17495
|
+
*/
|
|
18089
17496
|
tile(value) {
|
|
18090
17497
|
return {
|
|
18091
17498
|
type: "tile",
|