@rpgjs/server 5.0.0-beta.2 → 5.0.0-beta.4
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/Player/SkillManager.d.ts +13 -4
- package/dist/RpgServer.d.ts +8 -0
- package/dist/index.js +337 -885
- package/dist/index.js.map +1 -1
- package/dist/{module-CaCW1SDh.js → module-BmvXIvlE.js} +97 -69
- package/dist/{module-CaCW1SDh.js.map → module-BmvXIvlE.js.map} +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +6 -6
- package/src/Gui/MenuGui.ts +30 -20
- package/src/Player/ParameterManager.ts +4 -1
- package/src/Player/Player.ts +2 -0
- package/src/Player/SkillManager.ts +42 -5
- package/src/RpgServer.ts +9 -0
- package/src/rooms/lobby.ts +6 -1
- package/src/rooms/map.ts +17 -0
- package/tests/gui.spec.ts +76 -0
- package/tests/skill.spec.ts +48 -0
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,
|
|
@@ -8610,6 +7826,13 @@ function provideAutoSave(strategy) {
|
|
|
8610
7826
|
}
|
|
8611
7827
|
//#endregion
|
|
8612
7828
|
//#region src/Gui/MenuGui.ts
|
|
7829
|
+
function readReactiveValue(value, context) {
|
|
7830
|
+
return typeof value === "function" ? value.call(context) : value;
|
|
7831
|
+
}
|
|
7832
|
+
function readField(source, key, fallback) {
|
|
7833
|
+
const value = source?.[key];
|
|
7834
|
+
return readReactiveValue(value, source) ?? fallback;
|
|
7835
|
+
}
|
|
8613
7836
|
var MenuGui = class extends Gui {
|
|
8614
7837
|
constructor(player) {
|
|
8615
7838
|
super(PrebuiltGui.MainMenu, player);
|
|
@@ -8666,7 +7889,7 @@ var MenuGui = class extends Gui {
|
|
|
8666
7889
|
}));
|
|
8667
7890
|
const player = this.player;
|
|
8668
7891
|
const databaseById = player.databaseById?.bind(player);
|
|
8669
|
-
const equippedIds = new Set((player.equipments?.() || []).map((it) => it
|
|
7892
|
+
const equippedIds = new Set((player.equipments?.() || []).map((it) => readField(it, "id", readField(it, "name"))));
|
|
8670
7893
|
const buildStats = () => {
|
|
8671
7894
|
const params = player.param || {};
|
|
8672
7895
|
const statKeys = [
|
|
@@ -8679,29 +7902,29 @@ var MenuGui = class extends Gui {
|
|
|
8679
7902
|
];
|
|
8680
7903
|
const stats = {};
|
|
8681
7904
|
statKeys.forEach((key) => {
|
|
8682
|
-
stats[key] = params[key] ?? 0;
|
|
7905
|
+
stats[key] = readReactiveValue(params[key]) ?? 0;
|
|
8683
7906
|
});
|
|
8684
|
-
stats.pdef = player.pdef ?? params.pdef ?? 0;
|
|
8685
|
-
stats.sdef = player.sdef ?? params.sdef ?? 0;
|
|
8686
|
-
stats.atk = player.atk ?? params.atk ?? 0;
|
|
7907
|
+
stats.pdef = readReactiveValue(player.pdef ?? params.pdef) ?? 0;
|
|
7908
|
+
stats.sdef = readReactiveValue(player.sdef ?? params.sdef) ?? 0;
|
|
7909
|
+
stats.atk = readReactiveValue(player.atk ?? params.atk) ?? 0;
|
|
8687
7910
|
return stats;
|
|
8688
7911
|
};
|
|
8689
7912
|
const items = (player.items?.() || []).map((item) => {
|
|
8690
|
-
const id = item
|
|
7913
|
+
const id = readField(item, "id");
|
|
8691
7914
|
const data = databaseById ? databaseById(id) : {};
|
|
8692
|
-
const type = data
|
|
8693
|
-
const consumable = data
|
|
7915
|
+
const type = readField(data, "_type", "item");
|
|
7916
|
+
const consumable = readField(data, "consumable");
|
|
8694
7917
|
const isConsumable = consumable !== void 0 ? consumable : type === "item";
|
|
8695
7918
|
const usable = isConsumable === false ? false : consumable === void 0 && type !== "item" ? false : true;
|
|
8696
7919
|
return {
|
|
8697
7920
|
id,
|
|
8698
|
-
name: item
|
|
8699
|
-
description: item
|
|
8700
|
-
quantity: item
|
|
8701
|
-
icon: data
|
|
8702
|
-
atk: item
|
|
8703
|
-
pdef: item
|
|
8704
|
-
sdef: item
|
|
7921
|
+
name: readField(item, "name"),
|
|
7922
|
+
description: readField(item, "description"),
|
|
7923
|
+
quantity: readField(item, "quantity"),
|
|
7924
|
+
icon: readField(data, "icon", readField(item, "icon")),
|
|
7925
|
+
atk: readField(item, "atk"),
|
|
7926
|
+
pdef: readField(item, "pdef"),
|
|
7927
|
+
sdef: readField(item, "sdef"),
|
|
8705
7928
|
consumable: isConsumable,
|
|
8706
7929
|
type,
|
|
8707
7930
|
usable,
|
|
@@ -8713,14 +7936,14 @@ var MenuGui = class extends Gui {
|
|
|
8713
7936
|
items,
|
|
8714
7937
|
equips: items.filter((item) => item.type === "weapon" || item.type === "armor"),
|
|
8715
7938
|
skills: (player.skills?.() || []).map((skill) => ({
|
|
8716
|
-
id: skill
|
|
8717
|
-
name: skill
|
|
8718
|
-
description: skill
|
|
8719
|
-
spCost: skill
|
|
7939
|
+
id: readField(skill, "id", readField(skill, "name")),
|
|
7940
|
+
name: readField(skill, "name", readField(skill, "id", "Skill")),
|
|
7941
|
+
description: readField(skill, "description", ""),
|
|
7942
|
+
spCost: readField(skill, "spCost", 0)
|
|
8720
7943
|
})),
|
|
8721
7944
|
saveLoad: this.buildSaveLoad(options),
|
|
8722
7945
|
playerStats: buildStats(),
|
|
8723
|
-
expForNextlevel: player.expForNextlevel
|
|
7946
|
+
expForNextlevel: readReactiveValue(player.expForNextlevel)
|
|
8724
7947
|
};
|
|
8725
7948
|
}
|
|
8726
7949
|
refreshMenu(clientActionId) {
|
|
@@ -9492,7 +8715,10 @@ function WithParameterManager(Base) {
|
|
|
9492
8715
|
if (this.finalLevel && val > this.finalLevel) val = this.finalLevel;
|
|
9493
8716
|
const currentClass = this._class && this._class();
|
|
9494
8717
|
if (currentClass && "skillsToLearn" in currentClass && Array.isArray(currentClass.skillsToLearn)) {
|
|
9495
|
-
for (let i = this._level(); i <= val; i++) for (let skill of currentClass.skillsToLearn) if (skill.level == i) this["learnSkill"](skill.skill
|
|
8718
|
+
for (let i = this._level(); i <= val; i++) for (let skill of currentClass.skillsToLearn) if (skill.level == i) this["learnSkill"](skill.skill, {
|
|
8719
|
+
source: skill.source ?? "level",
|
|
8720
|
+
level: i
|
|
8721
|
+
});
|
|
9496
8722
|
}
|
|
9497
8723
|
const hasNewLevel = val - lastLevel;
|
|
9498
8724
|
if (hasNewLevel > 0) this["execMethod"]("onLevelUp", [hasNewLevel]);
|
|
@@ -10547,7 +9773,7 @@ function WithSkillManager(Base) {
|
|
|
10547
9773
|
* });
|
|
10548
9774
|
* ```
|
|
10549
9775
|
*/
|
|
10550
|
-
learnSkill(skillInput) {
|
|
9776
|
+
learnSkill(skillInput, options = {}) {
|
|
10551
9777
|
const map = this._getSkillMap();
|
|
10552
9778
|
const { skillId, skillData, skillInstance } = this._resolveSkillInput(skillInput, map);
|
|
10553
9779
|
if (this._getLearnedSkillEntry(skillId)) throw SkillLog.alreadyLearned(skillData);
|
|
@@ -10555,6 +9781,13 @@ function WithSkillManager(Base) {
|
|
|
10555
9781
|
this.skills().push(instance);
|
|
10556
9782
|
const hookTarget = instance._skillInstance || instance;
|
|
10557
9783
|
this["execMethod"]("onLearn", [this], hookTarget);
|
|
9784
|
+
this["execMethod"]("onSkillChange", [{
|
|
9785
|
+
action: "learn",
|
|
9786
|
+
skill: skillData,
|
|
9787
|
+
skillId,
|
|
9788
|
+
source: options.source ?? "manual",
|
|
9789
|
+
level: options.level
|
|
9790
|
+
}]);
|
|
10558
9791
|
return skillData;
|
|
10559
9792
|
}
|
|
10560
9793
|
/**
|
|
@@ -10573,7 +9806,7 @@ function WithSkillManager(Base) {
|
|
|
10573
9806
|
* player.forgetSkill(FireSkill);
|
|
10574
9807
|
* ```
|
|
10575
9808
|
*/
|
|
10576
|
-
forgetSkill(skillInput) {
|
|
9809
|
+
forgetSkill(skillInput, options = {}) {
|
|
10577
9810
|
const index = this._getSkillIndex(skillInput);
|
|
10578
9811
|
if (index === -1) {
|
|
10579
9812
|
let skillData = skillInput;
|
|
@@ -10596,6 +9829,13 @@ function WithSkillManager(Base) {
|
|
|
10596
9829
|
this.skills().splice(index, 1);
|
|
10597
9830
|
const hookTarget = skillEntry?._skillInstance || skillEntry?._skillData || skillData;
|
|
10598
9831
|
this["execMethod"]("onForget", [this], hookTarget);
|
|
9832
|
+
this["execMethod"]("onSkillChange", [{
|
|
9833
|
+
action: "forget",
|
|
9834
|
+
skill: skillData,
|
|
9835
|
+
skillId: skillData?.id ?? String(skillInput),
|
|
9836
|
+
source: options.source ?? "manual",
|
|
9837
|
+
level: options.level
|
|
9838
|
+
}]);
|
|
10599
9839
|
return skillData;
|
|
10600
9840
|
}
|
|
10601
9841
|
/**
|
|
@@ -11514,7 +10754,9 @@ var RpgPlayer = class extends BasicPlayerMixins(RpgCommonPlayer) {
|
|
|
11514
10754
|
animationName,
|
|
11515
10755
|
graphic,
|
|
11516
10756
|
nbTimes: finalNbTimes,
|
|
11517
|
-
object: this.id
|
|
10757
|
+
object: this.id,
|
|
10758
|
+
restoreAnimationName: this.animationName(),
|
|
10759
|
+
restoreGraphics: [...this.graphics()]
|
|
11518
10760
|
}
|
|
11519
10761
|
});
|
|
11520
10762
|
}
|
|
@@ -13534,13 +12776,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
13534
12776
|
}
|
|
13535
12777
|
return propValues;
|
|
13536
12778
|
});
|
|
13537
|
-
const isObject$
|
|
12779
|
+
const isObject$3 = isObject;
|
|
13538
12780
|
const catchall = def.catchall;
|
|
13539
12781
|
let value;
|
|
13540
12782
|
inst._zod.parse = (payload, ctx) => {
|
|
13541
12783
|
value ?? (value = _normalized.value);
|
|
13542
12784
|
const input = payload.value;
|
|
13543
|
-
if (!isObject$
|
|
12785
|
+
if (!isObject$3(input)) {
|
|
13544
12786
|
payload.issues.push({
|
|
13545
12787
|
expected: "object",
|
|
13546
12788
|
code: "invalid_type",
|
|
@@ -13634,7 +12876,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13634
12876
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
13635
12877
|
};
|
|
13636
12878
|
let fastpass;
|
|
13637
|
-
const isObject$
|
|
12879
|
+
const isObject$2 = isObject;
|
|
13638
12880
|
const jit = !globalConfig.jitless;
|
|
13639
12881
|
const fastEnabled = jit && allowsEval.value;
|
|
13640
12882
|
const catchall = def.catchall;
|
|
@@ -13642,7 +12884,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13642
12884
|
inst._zod.parse = (payload, ctx) => {
|
|
13643
12885
|
value ?? (value = _normalized.value);
|
|
13644
12886
|
const input = payload.value;
|
|
13645
|
-
if (!isObject$
|
|
12887
|
+
if (!isObject$2(input)) {
|
|
13646
12888
|
payload.issues.push({
|
|
13647
12889
|
expected: "object",
|
|
13648
12890
|
code: "invalid_type",
|
|
@@ -14618,7 +13860,7 @@ function initializeContext(params) {
|
|
|
14618
13860
|
external: params?.external ?? void 0
|
|
14619
13861
|
};
|
|
14620
13862
|
}
|
|
14621
|
-
function process
|
|
13863
|
+
function process(schema, ctx, _params = {
|
|
14622
13864
|
path: [],
|
|
14623
13865
|
schemaPath: []
|
|
14624
13866
|
}) {
|
|
@@ -14655,7 +13897,7 @@ function process$1(schema, ctx, _params = {
|
|
|
14655
13897
|
const parent = schema._zod.parent;
|
|
14656
13898
|
if (parent) {
|
|
14657
13899
|
if (!result.ref) result.ref = parent;
|
|
14658
|
-
process
|
|
13900
|
+
process(parent, ctx, params);
|
|
14659
13901
|
ctx.seen.get(parent).isParent = true;
|
|
14660
13902
|
}
|
|
14661
13903
|
}
|
|
@@ -14867,7 +14109,7 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
14867
14109
|
...params,
|
|
14868
14110
|
processors
|
|
14869
14111
|
});
|
|
14870
|
-
process
|
|
14112
|
+
process(schema, ctx);
|
|
14871
14113
|
extractDefs(ctx, schema);
|
|
14872
14114
|
return finalize(ctx, schema);
|
|
14873
14115
|
};
|
|
@@ -14879,7 +14121,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
|
|
|
14879
14121
|
io,
|
|
14880
14122
|
processors
|
|
14881
14123
|
});
|
|
14882
|
-
process
|
|
14124
|
+
process(schema, ctx);
|
|
14883
14125
|
extractDefs(ctx, schema);
|
|
14884
14126
|
return finalize(ctx, schema);
|
|
14885
14127
|
};
|
|
@@ -14963,7 +14205,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
14963
14205
|
if (typeof minimum === "number") json.minItems = minimum;
|
|
14964
14206
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
14965
14207
|
json.type = "array";
|
|
14966
|
-
json.items = process
|
|
14208
|
+
json.items = process(def.element, ctx, {
|
|
14967
14209
|
...params,
|
|
14968
14210
|
path: [...params.path, "items"]
|
|
14969
14211
|
});
|
|
@@ -14974,7 +14216,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
14974
14216
|
json.type = "object";
|
|
14975
14217
|
json.properties = {};
|
|
14976
14218
|
const shape = def.shape;
|
|
14977
|
-
for (const key in shape) json.properties[key] = process
|
|
14219
|
+
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
14978
14220
|
...params,
|
|
14979
14221
|
path: [
|
|
14980
14222
|
...params.path,
|
|
@@ -14992,7 +14234,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
14992
14234
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
14993
14235
|
else if (!def.catchall) {
|
|
14994
14236
|
if (ctx.io === "output") json.additionalProperties = false;
|
|
14995
|
-
} else if (def.catchall) json.additionalProperties = process
|
|
14237
|
+
} else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
|
|
14996
14238
|
...params,
|
|
14997
14239
|
path: [...params.path, "additionalProperties"]
|
|
14998
14240
|
});
|
|
@@ -15000,7 +14242,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
15000
14242
|
var unionProcessor = (schema, ctx, json, params) => {
|
|
15001
14243
|
const def = schema._zod.def;
|
|
15002
14244
|
const isExclusive = def.inclusive === false;
|
|
15003
|
-
const options = def.options.map((x, i) => process
|
|
14245
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
15004
14246
|
...params,
|
|
15005
14247
|
path: [
|
|
15006
14248
|
...params.path,
|
|
@@ -15013,7 +14255,7 @@ var unionProcessor = (schema, ctx, json, params) => {
|
|
|
15013
14255
|
};
|
|
15014
14256
|
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
15015
14257
|
const def = schema._zod.def;
|
|
15016
|
-
const a = process
|
|
14258
|
+
const a = process(def.left, ctx, {
|
|
15017
14259
|
...params,
|
|
15018
14260
|
path: [
|
|
15019
14261
|
...params.path,
|
|
@@ -15021,7 +14263,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
15021
14263
|
0
|
|
15022
14264
|
]
|
|
15023
14265
|
});
|
|
15024
|
-
const b = process
|
|
14266
|
+
const b = process(def.right, ctx, {
|
|
15025
14267
|
...params,
|
|
15026
14268
|
path: [
|
|
15027
14269
|
...params.path,
|
|
@@ -15034,7 +14276,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
15034
14276
|
};
|
|
15035
14277
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
15036
14278
|
const def = schema._zod.def;
|
|
15037
|
-
const inner = process
|
|
14279
|
+
const inner = process(def.innerType, ctx, params);
|
|
15038
14280
|
const seen = ctx.seen.get(schema);
|
|
15039
14281
|
if (ctx.target === "openapi-3.0") {
|
|
15040
14282
|
seen.ref = def.innerType;
|
|
@@ -15043,27 +14285,27 @@ var nullableProcessor = (schema, ctx, json, params) => {
|
|
|
15043
14285
|
};
|
|
15044
14286
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
15045
14287
|
const def = schema._zod.def;
|
|
15046
|
-
process
|
|
14288
|
+
process(def.innerType, ctx, params);
|
|
15047
14289
|
const seen = ctx.seen.get(schema);
|
|
15048
14290
|
seen.ref = def.innerType;
|
|
15049
14291
|
};
|
|
15050
14292
|
var defaultProcessor = (schema, ctx, json, params) => {
|
|
15051
14293
|
const def = schema._zod.def;
|
|
15052
|
-
process
|
|
14294
|
+
process(def.innerType, ctx, params);
|
|
15053
14295
|
const seen = ctx.seen.get(schema);
|
|
15054
14296
|
seen.ref = def.innerType;
|
|
15055
14297
|
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
15056
14298
|
};
|
|
15057
14299
|
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
15058
14300
|
const def = schema._zod.def;
|
|
15059
|
-
process
|
|
14301
|
+
process(def.innerType, ctx, params);
|
|
15060
14302
|
const seen = ctx.seen.get(schema);
|
|
15061
14303
|
seen.ref = def.innerType;
|
|
15062
14304
|
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
15063
14305
|
};
|
|
15064
14306
|
var catchProcessor = (schema, ctx, json, params) => {
|
|
15065
14307
|
const def = schema._zod.def;
|
|
15066
|
-
process
|
|
14308
|
+
process(def.innerType, ctx, params);
|
|
15067
14309
|
const seen = ctx.seen.get(schema);
|
|
15068
14310
|
seen.ref = def.innerType;
|
|
15069
14311
|
let catchValue;
|
|
@@ -15077,20 +14319,20 @@ var catchProcessor = (schema, ctx, json, params) => {
|
|
|
15077
14319
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
15078
14320
|
const def = schema._zod.def;
|
|
15079
14321
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
15080
|
-
process
|
|
14322
|
+
process(innerType, ctx, params);
|
|
15081
14323
|
const seen = ctx.seen.get(schema);
|
|
15082
14324
|
seen.ref = innerType;
|
|
15083
14325
|
};
|
|
15084
14326
|
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
15085
14327
|
const def = schema._zod.def;
|
|
15086
|
-
process
|
|
14328
|
+
process(def.innerType, ctx, params);
|
|
15087
14329
|
const seen = ctx.seen.get(schema);
|
|
15088
14330
|
seen.ref = def.innerType;
|
|
15089
14331
|
json.readOnly = true;
|
|
15090
14332
|
};
|
|
15091
14333
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
15092
14334
|
const def = schema._zod.def;
|
|
15093
|
-
process
|
|
14335
|
+
process(def.innerType, ctx, params);
|
|
15094
14336
|
const seen = ctx.seen.get(schema);
|
|
15095
14337
|
seen.ref = def.innerType;
|
|
15096
14338
|
};
|
|
@@ -15956,15 +15198,25 @@ function isRpgLog(error) {
|
|
|
15956
15198
|
* when updating a map configuration.
|
|
15957
15199
|
*/
|
|
15958
15200
|
var MapUpdateSchema = object({
|
|
15201
|
+
/** Configuration object for the map (optional) */
|
|
15959
15202
|
config: any().optional(),
|
|
15203
|
+
/** Damage formulas configuration (optional) */
|
|
15960
15204
|
damageFormulas: any().optional(),
|
|
15205
|
+
/** Unique identifier for the map (required) */
|
|
15961
15206
|
id: string(),
|
|
15207
|
+
/** Width of the map in pixels (required) */
|
|
15962
15208
|
width: number(),
|
|
15209
|
+
/** Height of the map in pixels (required) */
|
|
15963
15210
|
height: number(),
|
|
15211
|
+
/** Map events to spawn (optional) */
|
|
15964
15212
|
events: array(any()).optional(),
|
|
15213
|
+
/** Optional static hitboxes (custom maps) */
|
|
15965
15214
|
hitboxes: array(any()).optional(),
|
|
15215
|
+
/** Parsed tiled map payload (optional) */
|
|
15966
15216
|
parsedMap: any().optional(),
|
|
15217
|
+
/** Raw map source payload (optional) */
|
|
15967
15218
|
data: any().optional(),
|
|
15219
|
+
/** Optional map params payload */
|
|
15968
15220
|
params: any().optional()
|
|
15969
15221
|
});
|
|
15970
15222
|
var SAFE_MAP_WIDTH = 1e3;
|
|
@@ -16520,6 +15772,12 @@ var RpgMap = class RpgMap extends RpgCommonMap {
|
|
|
16520
15772
|
* ```
|
|
16521
15773
|
*/
|
|
16522
15774
|
async onInput(player, input) {
|
|
15775
|
+
if (typeof player.canMove === "function" && !player.canMove()) {
|
|
15776
|
+
player.pendingInputs = [];
|
|
15777
|
+
player.lastProcessedInputTs = 0;
|
|
15778
|
+
this.stopMovement(player);
|
|
15779
|
+
return;
|
|
15780
|
+
}
|
|
16523
15781
|
const lastAckedFrame = player._lastFramePositions?.frame ?? 0;
|
|
16524
15782
|
const now = Date.now();
|
|
16525
15783
|
const candidates = [];
|
|
@@ -16822,6 +16080,15 @@ var RpgMap = class RpgMap extends RpgCommonMap {
|
|
|
16822
16080
|
inputs: []
|
|
16823
16081
|
};
|
|
16824
16082
|
}
|
|
16083
|
+
if (typeof player.canMove === "function" && !player.canMove()) {
|
|
16084
|
+
player.pendingInputs = [];
|
|
16085
|
+
player.lastProcessedInputTs = 0;
|
|
16086
|
+
this.stopMovement(player);
|
|
16087
|
+
return {
|
|
16088
|
+
player,
|
|
16089
|
+
inputs: []
|
|
16090
|
+
};
|
|
16091
|
+
}
|
|
16825
16092
|
const processedInputs = [];
|
|
16826
16093
|
const config = {
|
|
16827
16094
|
maxTimeDelta: 1e3,
|
|
@@ -17532,10 +16799,14 @@ var RpgMap = class RpgMap extends RpgCommonMap {
|
|
|
17532
16799
|
* ```
|
|
17533
16800
|
*/
|
|
17534
16801
|
setSync(schema) {
|
|
17535
|
-
for (let key in schema)
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
16802
|
+
for (let key in schema) {
|
|
16803
|
+
const initial = typeof schema[key]?.$initial !== "undefined" ? schema[key].$initial : null;
|
|
16804
|
+
const holder = {};
|
|
16805
|
+
this[key] = type(signal(initial), key, {
|
|
16806
|
+
syncToClient: schema[key]?.$syncWithClient,
|
|
16807
|
+
persist: schema[key]?.$permanent
|
|
16808
|
+
}, holder);
|
|
16809
|
+
}
|
|
17539
16810
|
}
|
|
17540
16811
|
/**
|
|
17541
16812
|
* Apply sync to the client
|
|
@@ -17986,7 +17257,11 @@ var LobbyRoom = class LobbyRoom extends BaseRoom {
|
|
|
17986
17257
|
async guiInteraction(player, value) {
|
|
17987
17258
|
if (value.data.id === "start") {
|
|
17988
17259
|
player.initializeDefaultStats();
|
|
17989
|
-
|
|
17260
|
+
try {
|
|
17261
|
+
await lastValueFrom(this.hooks.callHooks("server-player-onStart", player));
|
|
17262
|
+
} catch (error) {
|
|
17263
|
+
console.error("[RPGJS] Error during player onStart hooks:", error);
|
|
17264
|
+
}
|
|
17990
17265
|
}
|
|
17991
17266
|
}
|
|
17992
17267
|
};
|
|
@@ -18044,6 +17319,38 @@ function createServer(options) {
|
|
|
18044
17319
|
* ```
|
|
18045
17320
|
*/
|
|
18046
17321
|
var Components = {
|
|
17322
|
+
/**
|
|
17323
|
+
* Create a text component
|
|
17324
|
+
*
|
|
17325
|
+
* Creates a text component that displays text with optional styling.
|
|
17326
|
+
* Supports template strings with placeholders like {name}, {hp}, etc.
|
|
17327
|
+
* that are replaced with actual player property values.
|
|
17328
|
+
*
|
|
17329
|
+
* ## Design
|
|
17330
|
+
*
|
|
17331
|
+
* Text components use template strings to allow dynamic content without
|
|
17332
|
+
* resending the entire component structure when values change. Only the
|
|
17333
|
+
* property values are synchronized, reducing bandwidth usage.
|
|
17334
|
+
*
|
|
17335
|
+
* @param text - Text to display, can include placeholders like {name}, {hp}
|
|
17336
|
+
* @param options - Text styling options
|
|
17337
|
+
* @returns Component definition for text
|
|
17338
|
+
*
|
|
17339
|
+
* @example
|
|
17340
|
+
* ```ts
|
|
17341
|
+
* // Simple text
|
|
17342
|
+
* Components.text('Player Name');
|
|
17343
|
+
*
|
|
17344
|
+
* // Text with placeholder
|
|
17345
|
+
* Components.text('{name}');
|
|
17346
|
+
*
|
|
17347
|
+
* // Text with styling
|
|
17348
|
+
* Components.text('{name}', {
|
|
17349
|
+
* fill: '#000000',
|
|
17350
|
+
* fontSize: 20
|
|
17351
|
+
* });
|
|
17352
|
+
* ```
|
|
17353
|
+
*/
|
|
18047
17354
|
text(value, style) {
|
|
18048
17355
|
return {
|
|
18049
17356
|
type: "text",
|
|
@@ -18051,6 +17358,42 @@ var Components = {
|
|
|
18051
17358
|
style
|
|
18052
17359
|
};
|
|
18053
17360
|
},
|
|
17361
|
+
/**
|
|
17362
|
+
* Create an HP bar component
|
|
17363
|
+
*
|
|
17364
|
+
* Creates a health point bar that automatically displays the player's
|
|
17365
|
+
* current HP relative to their maximum HP. The bar updates automatically
|
|
17366
|
+
* as HP changes.
|
|
17367
|
+
*
|
|
17368
|
+
* ## Design
|
|
17369
|
+
*
|
|
17370
|
+
* HP bars read from the player's hp and param.maxHp properties. The
|
|
17371
|
+
* bar can optionally display text above it showing current, max, or
|
|
17372
|
+
* percentage values.
|
|
17373
|
+
*
|
|
17374
|
+
* @param options - Bar styling options
|
|
17375
|
+
* @param text - Optional text to display above the bar. Can use placeholders:
|
|
17376
|
+
* - {$current} - Current HP value
|
|
17377
|
+
* - {$max} - Maximum HP value
|
|
17378
|
+
* - {$percent} - Percentage value
|
|
17379
|
+
* Set to null to hide text
|
|
17380
|
+
* @returns Component definition for HP bar
|
|
17381
|
+
*
|
|
17382
|
+
* @example
|
|
17383
|
+
* ```ts
|
|
17384
|
+
* // Simple HP bar
|
|
17385
|
+
* Components.hpBar();
|
|
17386
|
+
*
|
|
17387
|
+
* // HP bar with percentage text
|
|
17388
|
+
* Components.hpBar({}, '{$percent}%');
|
|
17389
|
+
*
|
|
17390
|
+
* // HP bar with custom styling
|
|
17391
|
+
* Components.hpBar({
|
|
17392
|
+
* fillColor: '#ff0000',
|
|
17393
|
+
* height: 8
|
|
17394
|
+
* });
|
|
17395
|
+
* ```
|
|
17396
|
+
*/
|
|
18054
17397
|
hpBar(style, text) {
|
|
18055
17398
|
return {
|
|
18056
17399
|
type: "hpBar",
|
|
@@ -18058,6 +17401,30 @@ var Components = {
|
|
|
18058
17401
|
text: text ?? void 0
|
|
18059
17402
|
};
|
|
18060
17403
|
},
|
|
17404
|
+
/**
|
|
17405
|
+
* Create an SP bar component
|
|
17406
|
+
*
|
|
17407
|
+
* Creates a skill point bar that automatically displays the player's
|
|
17408
|
+
* current SP relative to their maximum SP. The bar updates automatically
|
|
17409
|
+
* as SP changes.
|
|
17410
|
+
*
|
|
17411
|
+
* @param style - Bar styling options
|
|
17412
|
+
* @param text - Optional text to display above the bar. Can use placeholders:
|
|
17413
|
+
* - {$current} - Current SP value
|
|
17414
|
+
* - {$max} - Maximum SP value
|
|
17415
|
+
* - {$percent} - Percentage value
|
|
17416
|
+
* Set to null to hide text
|
|
17417
|
+
* @returns Component definition for SP bar
|
|
17418
|
+
*
|
|
17419
|
+
* @example
|
|
17420
|
+
* ```ts
|
|
17421
|
+
* // Simple SP bar
|
|
17422
|
+
* Components.spBar();
|
|
17423
|
+
*
|
|
17424
|
+
* // SP bar with text
|
|
17425
|
+
* Components.spBar({}, 'SP: {$current}/{$max}');
|
|
17426
|
+
* ```
|
|
17427
|
+
*/
|
|
18061
17428
|
spBar(style, text) {
|
|
18062
17429
|
return {
|
|
18063
17430
|
type: "spBar",
|
|
@@ -18065,6 +17432,31 @@ var Components = {
|
|
|
18065
17432
|
text: text ?? void 0
|
|
18066
17433
|
};
|
|
18067
17434
|
},
|
|
17435
|
+
/**
|
|
17436
|
+
* Create a custom bar component
|
|
17437
|
+
*
|
|
17438
|
+
* Creates a bar that displays a custom property value relative to a maximum.
|
|
17439
|
+
* Useful for displaying custom resources like wood, mana, energy, etc.
|
|
17440
|
+
*
|
|
17441
|
+
* @param current - Property path for current value (e.g., 'wood', 'mana')
|
|
17442
|
+
* @param max - Property path for maximum value (e.g., 'param.maxWood', 'param.maxMana')
|
|
17443
|
+
* @param style - Bar styling options
|
|
17444
|
+
* @param text - Optional text to display above the bar. Can use placeholders:
|
|
17445
|
+
* - {$current} - Current value
|
|
17446
|
+
* - {$max} - Maximum value
|
|
17447
|
+
* - {$percent} - Percentage value
|
|
17448
|
+
* Set to null to hide text
|
|
17449
|
+
* @returns Component definition for custom bar
|
|
17450
|
+
*
|
|
17451
|
+
* @example
|
|
17452
|
+
* ```ts
|
|
17453
|
+
* // Bar for custom property
|
|
17454
|
+
* Components.bar('wood', 'param.maxWood');
|
|
17455
|
+
*
|
|
17456
|
+
* // Bar with text
|
|
17457
|
+
* Components.bar('mana', 'param.maxMana', {}, 'Mana: {$current}/{$max}');
|
|
17458
|
+
* ```
|
|
17459
|
+
*/
|
|
18068
17460
|
bar(current, max, style, text) {
|
|
18069
17461
|
return {
|
|
18070
17462
|
type: "bar",
|
|
@@ -18074,18 +17466,78 @@ var Components = {
|
|
|
18074
17466
|
text: text ?? void 0
|
|
18075
17467
|
};
|
|
18076
17468
|
},
|
|
17469
|
+
/**
|
|
17470
|
+
* Create a shape component
|
|
17471
|
+
*
|
|
17472
|
+
* Creates a geometric shape that can be displayed above or below the player.
|
|
17473
|
+
* Useful for visual indicators, backgrounds, or decorative elements.
|
|
17474
|
+
*
|
|
17475
|
+
* @param value - Shape configuration options
|
|
17476
|
+
* @returns Component definition for shape
|
|
17477
|
+
*
|
|
17478
|
+
* @example
|
|
17479
|
+
* ```ts
|
|
17480
|
+
* // Circle shape
|
|
17481
|
+
* Components.shape({
|
|
17482
|
+
* fill: '#ffffff',
|
|
17483
|
+
* type: 'circle',
|
|
17484
|
+
* radius: 10
|
|
17485
|
+
* });
|
|
17486
|
+
*
|
|
17487
|
+
* // Rectangle shape
|
|
17488
|
+
* Components.shape({
|
|
17489
|
+
* fill: '#ff0000',
|
|
17490
|
+
* type: 'rectangle',
|
|
17491
|
+
* width: 32,
|
|
17492
|
+
* height: 32
|
|
17493
|
+
* });
|
|
17494
|
+
*
|
|
17495
|
+
* // Using parameters
|
|
17496
|
+
* Components.shape({
|
|
17497
|
+
* fill: '#ffffff',
|
|
17498
|
+
* type: 'circle',
|
|
17499
|
+
* radius: 'hp' // radius will be the same as hp value
|
|
17500
|
+
* });
|
|
17501
|
+
* ```
|
|
17502
|
+
*/
|
|
18077
17503
|
shape(value) {
|
|
18078
17504
|
return {
|
|
18079
17505
|
type: "shape",
|
|
18080
17506
|
value
|
|
18081
17507
|
};
|
|
18082
17508
|
},
|
|
17509
|
+
/**
|
|
17510
|
+
* Create an image component
|
|
17511
|
+
*
|
|
17512
|
+
* Displays an image from a URL or spritesheet identifier.
|
|
17513
|
+
*
|
|
17514
|
+
* @param value - Image source URL or spritesheet identifier
|
|
17515
|
+
* @returns Component definition for image
|
|
17516
|
+
*
|
|
17517
|
+
* @example
|
|
17518
|
+
* ```ts
|
|
17519
|
+
* Components.image('mygraphic.png');
|
|
17520
|
+
* ```
|
|
17521
|
+
*/
|
|
18083
17522
|
image(value) {
|
|
18084
17523
|
return {
|
|
18085
17524
|
type: "image",
|
|
18086
17525
|
value
|
|
18087
17526
|
};
|
|
18088
17527
|
},
|
|
17528
|
+
/**
|
|
17529
|
+
* Create a tile component
|
|
17530
|
+
*
|
|
17531
|
+
* Displays a tile from a tileset by ID.
|
|
17532
|
+
*
|
|
17533
|
+
* @param value - Tile ID in the tileset
|
|
17534
|
+
* @returns Component definition for tile
|
|
17535
|
+
*
|
|
17536
|
+
* @example
|
|
17537
|
+
* ```ts
|
|
17538
|
+
* Components.tile(3); // Use tile #3
|
|
17539
|
+
* ```
|
|
17540
|
+
*/
|
|
18089
17541
|
tile(value) {
|
|
18090
17542
|
return {
|
|
18091
17543
|
type: "tile",
|