@rpgjs/vite 5.0.0-beta.5 → 5.0.0-beta.7
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 +98 -661
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6801,12 +6801,7 @@ function replaceConfigImport() {
|
|
|
6801
6801
|
};
|
|
6802
6802
|
}
|
|
6803
6803
|
//#endregion
|
|
6804
|
-
//#region ../server/dist/module-
|
|
6805
|
-
var __defProp$2 = Object.defineProperty;
|
|
6806
|
-
var __name$2 = (target, value) => __defProp$2(target, "name", {
|
|
6807
|
-
value,
|
|
6808
|
-
configurable: true
|
|
6809
|
-
});
|
|
6804
|
+
//#region ../server/dist/module-5HOX9Ovu.js
|
|
6810
6805
|
/******************************************************************************
|
|
6811
6806
|
Copyright (c) Microsoft Corporation.
|
|
6812
6807
|
|
|
@@ -7053,7 +7048,7 @@ function __asyncValues(o) {
|
|
|
7053
7048
|
}, reject);
|
|
7054
7049
|
}
|
|
7055
7050
|
}
|
|
7056
|
-
function isFunction$
|
|
7051
|
+
function isFunction$1(value) {
|
|
7057
7052
|
return typeof value === "function";
|
|
7058
7053
|
}
|
|
7059
7054
|
function createErrorClass(createImpl) {
|
|
@@ -7111,7 +7106,7 @@ var Subscription = function() {
|
|
|
7111
7106
|
else _parentage.remove(this);
|
|
7112
7107
|
}
|
|
7113
7108
|
var initialFinalizer = this.initialTeardown;
|
|
7114
|
-
if (isFunction$
|
|
7109
|
+
if (isFunction$1(initialFinalizer)) try {
|
|
7115
7110
|
initialFinalizer();
|
|
7116
7111
|
} catch (e) {
|
|
7117
7112
|
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
@@ -7181,10 +7176,10 @@ var Subscription = function() {
|
|
|
7181
7176
|
}();
|
|
7182
7177
|
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
7183
7178
|
function isSubscription(value) {
|
|
7184
|
-
return value instanceof Subscription || value && "closed" in value && isFunction$
|
|
7179
|
+
return value instanceof Subscription || value && "closed" in value && isFunction$1(value.remove) && isFunction$1(value.add) && isFunction$1(value.unsubscribe);
|
|
7185
7180
|
}
|
|
7186
7181
|
function execFinalizer(finalizer) {
|
|
7187
|
-
if (isFunction$
|
|
7182
|
+
if (isFunction$1(finalizer)) finalizer();
|
|
7188
7183
|
else finalizer.unsubscribe();
|
|
7189
7184
|
}
|
|
7190
7185
|
var config = {
|
|
@@ -7352,7 +7347,7 @@ var SafeSubscriber = function(_super) {
|
|
|
7352
7347
|
function SafeSubscriber(observerOrNext, error, complete) {
|
|
7353
7348
|
var _this = _super.call(this) || this;
|
|
7354
7349
|
var partialObserver;
|
|
7355
|
-
if (isFunction$
|
|
7350
|
+
if (isFunction$1(observerOrNext) || !observerOrNext) partialObserver = {
|
|
7356
7351
|
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
|
|
7357
7352
|
error: error !== null && error !== void 0 ? error : void 0,
|
|
7358
7353
|
complete: complete !== null && complete !== void 0 ? complete : void 0
|
|
@@ -7491,13 +7486,13 @@ function getPromiseCtor(promiseCtor) {
|
|
|
7491
7486
|
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
7492
7487
|
}
|
|
7493
7488
|
function isObserver(value) {
|
|
7494
|
-
return value && isFunction$
|
|
7489
|
+
return value && isFunction$1(value.next) && isFunction$1(value.error) && isFunction$1(value.complete);
|
|
7495
7490
|
}
|
|
7496
7491
|
function isSubscriber(value) {
|
|
7497
7492
|
return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
|
|
7498
7493
|
}
|
|
7499
7494
|
function hasLift(source) {
|
|
7500
|
-
return isFunction$
|
|
7495
|
+
return isFunction$1(source === null || source === void 0 ? void 0 : source.lift);
|
|
7501
7496
|
}
|
|
7502
7497
|
function operate(init) {
|
|
7503
7498
|
return function(source) {
|
|
@@ -7731,29 +7726,17 @@ var BehaviorSubject = function(_super) {
|
|
|
7731
7726
|
};
|
|
7732
7727
|
return BehaviorSubject;
|
|
7733
7728
|
}(Subject);
|
|
7734
|
-
function isScheduler(value) {
|
|
7735
|
-
return value && isFunction$2(value.schedule);
|
|
7736
|
-
}
|
|
7737
|
-
function last(arr) {
|
|
7738
|
-
return arr[arr.length - 1];
|
|
7739
|
-
}
|
|
7740
|
-
function popResultSelector(args) {
|
|
7741
|
-
return isFunction$2(last(args)) ? args.pop() : void 0;
|
|
7742
|
-
}
|
|
7743
|
-
function popScheduler(args) {
|
|
7744
|
-
return isScheduler(last(args)) ? args.pop() : void 0;
|
|
7745
|
-
}
|
|
7746
7729
|
var isArrayLike = (function(x) {
|
|
7747
7730
|
return x && typeof x.length === "number" && typeof x !== "function";
|
|
7748
7731
|
});
|
|
7749
7732
|
function isPromise(value) {
|
|
7750
|
-
return isFunction$
|
|
7733
|
+
return isFunction$1(value === null || value === void 0 ? void 0 : value.then);
|
|
7751
7734
|
}
|
|
7752
7735
|
function isInteropObservable(input) {
|
|
7753
|
-
return isFunction$
|
|
7736
|
+
return isFunction$1(input[observable]);
|
|
7754
7737
|
}
|
|
7755
7738
|
function isAsyncIterable(obj) {
|
|
7756
|
-
return Symbol.asyncIterator && isFunction$
|
|
7739
|
+
return Symbol.asyncIterator && isFunction$1(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
7757
7740
|
}
|
|
7758
7741
|
function createInvalidObservableTypeError(input) {
|
|
7759
7742
|
return /* @__PURE__ */ new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
@@ -7764,7 +7747,7 @@ function getSymbolIterator() {
|
|
|
7764
7747
|
}
|
|
7765
7748
|
var iterator = getSymbolIterator();
|
|
7766
7749
|
function isIterable(input) {
|
|
7767
|
-
return isFunction$
|
|
7750
|
+
return isFunction$1(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
7768
7751
|
}
|
|
7769
7752
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
7770
7753
|
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
@@ -7803,7 +7786,7 @@ function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
|
7803
7786
|
});
|
|
7804
7787
|
}
|
|
7805
7788
|
function isReadableStreamLike(obj) {
|
|
7806
|
-
return isFunction$
|
|
7789
|
+
return isFunction$1(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
7807
7790
|
}
|
|
7808
7791
|
function innerFrom(input) {
|
|
7809
7792
|
if (input instanceof Observable) return input;
|
|
@@ -7820,7 +7803,7 @@ function innerFrom(input) {
|
|
|
7820
7803
|
function fromInteropObservable(obj) {
|
|
7821
7804
|
return new Observable(function(subscriber) {
|
|
7822
7805
|
var obs = obj[observable]();
|
|
7823
|
-
if (isFunction$
|
|
7806
|
+
if (isFunction$1(obs.subscribe)) return obs.subscribe(subscriber);
|
|
7824
7807
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
7825
7808
|
});
|
|
7826
7809
|
}
|
|
@@ -8001,7 +7984,7 @@ function scheduleIterable(input, scheduler) {
|
|
|
8001
7984
|
}, 0, true);
|
|
8002
7985
|
});
|
|
8003
7986
|
return function() {
|
|
8004
|
-
return isFunction$
|
|
7987
|
+
return isFunction$1(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
|
|
8005
7988
|
};
|
|
8006
7989
|
});
|
|
8007
7990
|
}
|
|
@@ -8044,91 +8027,6 @@ function map(project, thisArg) {
|
|
|
8044
8027
|
}));
|
|
8045
8028
|
});
|
|
8046
8029
|
}
|
|
8047
|
-
var isArray$2 = Array.isArray;
|
|
8048
|
-
function callOrApply(fn, args) {
|
|
8049
|
-
return isArray$2(args) ? fn.apply(void 0, __spreadArray([], __read(args))) : fn(args);
|
|
8050
|
-
}
|
|
8051
|
-
function mapOneOrManyArgs(fn) {
|
|
8052
|
-
return map(function(args) {
|
|
8053
|
-
return callOrApply(fn, args);
|
|
8054
|
-
});
|
|
8055
|
-
}
|
|
8056
|
-
var isArray$1 = Array.isArray;
|
|
8057
|
-
var getPrototypeOf = Object.getPrototypeOf, objectProto = Object.prototype, getKeys = Object.keys;
|
|
8058
|
-
function argsArgArrayOrObject(args) {
|
|
8059
|
-
if (args.length === 1) {
|
|
8060
|
-
var first_1 = args[0];
|
|
8061
|
-
if (isArray$1(first_1)) return {
|
|
8062
|
-
args: first_1,
|
|
8063
|
-
keys: null
|
|
8064
|
-
};
|
|
8065
|
-
if (isPOJO(first_1)) {
|
|
8066
|
-
var keys = getKeys(first_1);
|
|
8067
|
-
return {
|
|
8068
|
-
args: keys.map(function(key) {
|
|
8069
|
-
return first_1[key];
|
|
8070
|
-
}),
|
|
8071
|
-
keys
|
|
8072
|
-
};
|
|
8073
|
-
}
|
|
8074
|
-
}
|
|
8075
|
-
return {
|
|
8076
|
-
args,
|
|
8077
|
-
keys: null
|
|
8078
|
-
};
|
|
8079
|
-
}
|
|
8080
|
-
function isPOJO(obj) {
|
|
8081
|
-
return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto;
|
|
8082
|
-
}
|
|
8083
|
-
function createObject(keys, values) {
|
|
8084
|
-
return keys.reduce(function(result, key, i) {
|
|
8085
|
-
return result[key] = values[i], result;
|
|
8086
|
-
}, {});
|
|
8087
|
-
}
|
|
8088
|
-
function combineLatest() {
|
|
8089
|
-
var args = [];
|
|
8090
|
-
for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
|
|
8091
|
-
var scheduler = popScheduler(args);
|
|
8092
|
-
var resultSelector = popResultSelector(args);
|
|
8093
|
-
var _a = argsArgArrayOrObject(args), observables = _a.args, keys = _a.keys;
|
|
8094
|
-
if (observables.length === 0) return from([], scheduler);
|
|
8095
|
-
var result = new Observable(combineLatestInit(observables, scheduler, keys ? function(values) {
|
|
8096
|
-
return createObject(keys, values);
|
|
8097
|
-
} : identity));
|
|
8098
|
-
return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
|
|
8099
|
-
}
|
|
8100
|
-
function combineLatestInit(observables, scheduler, valueTransform) {
|
|
8101
|
-
if (valueTransform === void 0) valueTransform = identity;
|
|
8102
|
-
return function(subscriber) {
|
|
8103
|
-
maybeSchedule(scheduler, function() {
|
|
8104
|
-
var length = observables.length;
|
|
8105
|
-
var values = new Array(length);
|
|
8106
|
-
var active = length;
|
|
8107
|
-
var remainingFirstValues = length;
|
|
8108
|
-
var _loop_1 = function(i) {
|
|
8109
|
-
maybeSchedule(scheduler, function() {
|
|
8110
|
-
var source = from(observables[i], scheduler);
|
|
8111
|
-
var hasFirstValue = false;
|
|
8112
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
8113
|
-
values[i] = value;
|
|
8114
|
-
if (!hasFirstValue) {
|
|
8115
|
-
hasFirstValue = true;
|
|
8116
|
-
remainingFirstValues--;
|
|
8117
|
-
}
|
|
8118
|
-
if (!remainingFirstValues) subscriber.next(valueTransform(values.slice()));
|
|
8119
|
-
}, function() {
|
|
8120
|
-
if (!--active) subscriber.complete();
|
|
8121
|
-
}));
|
|
8122
|
-
}, subscriber);
|
|
8123
|
-
};
|
|
8124
|
-
for (var i = 0; i < length; i++) _loop_1(i);
|
|
8125
|
-
}, subscriber);
|
|
8126
|
-
};
|
|
8127
|
-
}
|
|
8128
|
-
function maybeSchedule(scheduler, execute, subscription) {
|
|
8129
|
-
if (scheduler) executeSchedule(subscription, scheduler, execute);
|
|
8130
|
-
else execute();
|
|
8131
|
-
}
|
|
8132
8030
|
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
8133
8031
|
var buffer = [];
|
|
8134
8032
|
var active = 0;
|
|
@@ -8177,7 +8075,7 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
|
|
|
8177
8075
|
}
|
|
8178
8076
|
function mergeMap(project, resultSelector, concurrent) {
|
|
8179
8077
|
if (concurrent === void 0) concurrent = Infinity;
|
|
8180
|
-
if (isFunction$
|
|
8078
|
+
if (isFunction$1(resultSelector)) return mergeMap(function(a, i) {
|
|
8181
8079
|
return map(function(b, ii) {
|
|
8182
8080
|
return resultSelector(a, b, i, ii);
|
|
8183
8081
|
})(innerFrom(project(a, i)));
|
|
@@ -8221,35 +8119,18 @@ function toArray() {
|
|
|
8221
8119
|
reduce(arrReducer, [])(source).subscribe(subscriber);
|
|
8222
8120
|
});
|
|
8223
8121
|
}
|
|
8224
|
-
function finalize(callback) {
|
|
8225
|
-
return operate(function(source, subscriber) {
|
|
8226
|
-
try {
|
|
8227
|
-
source.subscribe(subscriber);
|
|
8228
|
-
} finally {
|
|
8229
|
-
subscriber.add(callback);
|
|
8230
|
-
}
|
|
8231
|
-
});
|
|
8232
|
-
}
|
|
8233
|
-
var __defProp$1 = Object.defineProperty;
|
|
8234
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", {
|
|
8235
|
-
value,
|
|
8236
|
-
configurable: true
|
|
8237
|
-
});
|
|
8238
8122
|
var ArraySubject = class extends BehaviorSubject {
|
|
8239
|
-
static {
|
|
8240
|
-
__name$1(this, "ArraySubject");
|
|
8241
|
-
}
|
|
8242
|
-
_items = [];
|
|
8243
8123
|
constructor(items = []) {
|
|
8244
8124
|
super({
|
|
8245
8125
|
type: "init",
|
|
8246
8126
|
items
|
|
8247
8127
|
});
|
|
8128
|
+
this._items = [];
|
|
8248
8129
|
this.createProxy(items);
|
|
8249
8130
|
}
|
|
8250
8131
|
createProxy(items) {
|
|
8251
8132
|
this._items = new Proxy(items, {
|
|
8252
|
-
get:
|
|
8133
|
+
get: (target, prop, receiver) => {
|
|
8253
8134
|
const origMethod = target[prop];
|
|
8254
8135
|
if (typeof origMethod === "function") return (...args) => {
|
|
8255
8136
|
let changeType = "update";
|
|
@@ -8304,8 +8185,8 @@ var ArraySubject = class extends BehaviorSubject {
|
|
|
8304
8185
|
return result;
|
|
8305
8186
|
};
|
|
8306
8187
|
return Reflect.get(target, prop, receiver);
|
|
8307
|
-
},
|
|
8308
|
-
set:
|
|
8188
|
+
},
|
|
8189
|
+
set: (target, prop, value) => {
|
|
8309
8190
|
const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
|
|
8310
8191
|
target[prop] = value;
|
|
8311
8192
|
this.next({
|
|
@@ -8314,7 +8195,7 @@ var ArraySubject = class extends BehaviorSubject {
|
|
|
8314
8195
|
items: [value]
|
|
8315
8196
|
});
|
|
8316
8197
|
return true;
|
|
8317
|
-
}
|
|
8198
|
+
}
|
|
8318
8199
|
});
|
|
8319
8200
|
}
|
|
8320
8201
|
get items() {
|
|
@@ -8328,14 +8209,10 @@ var ArraySubject = class extends BehaviorSubject {
|
|
|
8328
8209
|
});
|
|
8329
8210
|
}
|
|
8330
8211
|
};
|
|
8331
|
-
var isArraySubject =
|
|
8212
|
+
var isArraySubject = (value) => {
|
|
8332
8213
|
return "_items" in value;
|
|
8333
|
-
}
|
|
8214
|
+
};
|
|
8334
8215
|
var ObjectSubject = class extends BehaviorSubject {
|
|
8335
|
-
static {
|
|
8336
|
-
__name$1(this, "ObjectSubject");
|
|
8337
|
-
}
|
|
8338
|
-
_obj;
|
|
8339
8216
|
constructor(obj = {}) {
|
|
8340
8217
|
super({
|
|
8341
8218
|
type: "init",
|
|
@@ -8345,10 +8222,10 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8345
8222
|
}
|
|
8346
8223
|
createProxy(obj) {
|
|
8347
8224
|
this._obj = new Proxy(obj, {
|
|
8348
|
-
get:
|
|
8225
|
+
get: (target, prop, receiver) => {
|
|
8349
8226
|
return Reflect.get(target, prop, receiver);
|
|
8350
|
-
},
|
|
8351
|
-
set:
|
|
8227
|
+
},
|
|
8228
|
+
set: (target, prop, value, receiver) => {
|
|
8352
8229
|
const key = prop;
|
|
8353
8230
|
const changeType = key in target ? "update" : "add";
|
|
8354
8231
|
target[key] = value;
|
|
@@ -8358,8 +8235,8 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8358
8235
|
value
|
|
8359
8236
|
});
|
|
8360
8237
|
return true;
|
|
8361
|
-
},
|
|
8362
|
-
deleteProperty:
|
|
8238
|
+
},
|
|
8239
|
+
deleteProperty: (target, prop) => {
|
|
8363
8240
|
const key = prop;
|
|
8364
8241
|
if (key in target) {
|
|
8365
8242
|
const value = target[key];
|
|
@@ -8372,7 +8249,7 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8372
8249
|
return true;
|
|
8373
8250
|
}
|
|
8374
8251
|
return false;
|
|
8375
|
-
}
|
|
8252
|
+
}
|
|
8376
8253
|
});
|
|
8377
8254
|
}
|
|
8378
8255
|
get obj() {
|
|
@@ -8386,10 +8263,10 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8386
8263
|
});
|
|
8387
8264
|
}
|
|
8388
8265
|
};
|
|
8389
|
-
var isObjectSubject =
|
|
8266
|
+
var isObjectSubject = (value) => {
|
|
8390
8267
|
return "_obj" in value;
|
|
8391
|
-
}
|
|
8392
|
-
var
|
|
8268
|
+
};
|
|
8269
|
+
var getGlobalReactiveStore = () => {
|
|
8393
8270
|
const globalKey = "__REACTIVE_STORE__";
|
|
8394
8271
|
if (typeof globalThis !== "undefined") {
|
|
8395
8272
|
if (!globalThis[globalKey]) globalThis[globalKey] = {
|
|
@@ -8400,8 +8277,8 @@ var reactiveStore = (/* @__PURE__ */ __name$1(() => {
|
|
|
8400
8277
|
}
|
|
8401
8278
|
let globalObj;
|
|
8402
8279
|
if (typeof window !== "undefined") globalObj = window;
|
|
8403
|
-
else if (typeof process !== "undefined" && process.versions && process.versions.node) globalObj = Function("return this")();
|
|
8404
8280
|
else if (typeof self !== "undefined") globalObj = self;
|
|
8281
|
+
else if (typeof Function !== "undefined") globalObj = Function("return this")();
|
|
8405
8282
|
else {
|
|
8406
8283
|
console.warn("Unable to find global object, using local instance");
|
|
8407
8284
|
return {
|
|
@@ -8414,24 +8291,25 @@ var reactiveStore = (/* @__PURE__ */ __name$1(() => {
|
|
|
8414
8291
|
currentSubscriptionsTracker: null
|
|
8415
8292
|
};
|
|
8416
8293
|
return globalObj[globalKey];
|
|
8417
|
-
}
|
|
8418
|
-
var
|
|
8294
|
+
};
|
|
8295
|
+
var reactiveStore = getGlobalReactiveStore();
|
|
8296
|
+
var trackDependency = (signal2) => {
|
|
8419
8297
|
if (reactiveStore.currentDependencyTracker) reactiveStore.currentDependencyTracker(signal2);
|
|
8420
|
-
}
|
|
8298
|
+
};
|
|
8421
8299
|
function signal(defaultValue, options) {
|
|
8422
8300
|
let subject;
|
|
8423
8301
|
if (Array.isArray(defaultValue)) subject = new ArraySubject(defaultValue);
|
|
8424
8302
|
else if (typeof defaultValue === "object" && defaultValue !== null) subject = new ObjectSubject(defaultValue);
|
|
8425
8303
|
else subject = new BehaviorSubject(defaultValue);
|
|
8426
|
-
const getValue =
|
|
8304
|
+
const getValue = () => {
|
|
8427
8305
|
if (subject instanceof ArraySubject) return subject.items;
|
|
8428
8306
|
else if (subject instanceof ObjectSubject) return subject.obj;
|
|
8429
8307
|
return subject.value;
|
|
8430
|
-
}
|
|
8431
|
-
const fn =
|
|
8308
|
+
};
|
|
8309
|
+
const fn = function() {
|
|
8432
8310
|
trackDependency(fn);
|
|
8433
8311
|
return getValue();
|
|
8434
|
-
}
|
|
8312
|
+
};
|
|
8435
8313
|
fn.set = (value) => {
|
|
8436
8314
|
const currentValue = getValue();
|
|
8437
8315
|
let shouldEmit = true;
|
|
@@ -8468,309 +8346,24 @@ function signal(defaultValue, options) {
|
|
|
8468
8346
|
fn._subject = subject;
|
|
8469
8347
|
return fn;
|
|
8470
8348
|
}
|
|
8471
|
-
__name$1(signal, "signal");
|
|
8472
8349
|
function isSignal(value) {
|
|
8473
8350
|
return !!(value && value.observable);
|
|
8474
8351
|
}
|
|
8475
|
-
__name$1(isSignal, "isSignal");
|
|
8476
8352
|
function isComputed(value) {
|
|
8477
8353
|
return isSignal(value) && !!value.dependencies;
|
|
8478
8354
|
}
|
|
8479
|
-
|
|
8480
|
-
function computed(computeFunction, disposableFn) {
|
|
8481
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
8482
|
-
let init = true;
|
|
8483
|
-
let lastComputedValue;
|
|
8484
|
-
const previousTracker = reactiveStore.currentDependencyTracker;
|
|
8485
|
-
reactiveStore.currentDependencyTracker = (signal2) => {
|
|
8486
|
-
dependencies.add(signal2);
|
|
8487
|
-
};
|
|
8488
|
-
lastComputedValue = computeFunction();
|
|
8489
|
-
if (computeFunction["isEffect"]) disposableFn = lastComputedValue;
|
|
8490
|
-
reactiveStore.currentDependencyTracker = previousTracker;
|
|
8491
|
-
const computedObservable = combineLatest([...dependencies].map((dep) => {
|
|
8492
|
-
if (isComputed(dep) && "dependencies" in dep) {
|
|
8493
|
-
const computedDep = dep;
|
|
8494
|
-
if (computedDep.dependencies.size === 0) return new BehaviorSubject(computedDep()).asObservable();
|
|
8495
|
-
}
|
|
8496
|
-
return dep.observable;
|
|
8497
|
-
})).pipe(filter(() => !init), map(() => computeFunction()), finalize(() => disposableFn?.()));
|
|
8498
|
-
const fn = /* @__PURE__ */ __name$1(function() {
|
|
8499
|
-
trackDependency(fn);
|
|
8500
|
-
return lastComputedValue;
|
|
8501
|
-
}, "fn");
|
|
8502
|
-
fn.observable = computedObservable;
|
|
8503
|
-
fn.subscription = computedObservable.subscribe((value) => {
|
|
8504
|
-
lastComputedValue = value;
|
|
8505
|
-
});
|
|
8506
|
-
fn.dependencies = dependencies;
|
|
8507
|
-
reactiveStore.currentSubscriptionsTracker?.(fn.subscription);
|
|
8508
|
-
init = false;
|
|
8509
|
-
return fn;
|
|
8510
|
-
}
|
|
8511
|
-
__name$1(computed, "computed");
|
|
8512
|
-
function linkedSignal(computationOrOptions, simpleOptions) {
|
|
8513
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
8514
|
-
let init = true;
|
|
8515
|
-
let lastComputedValue;
|
|
8516
|
-
let computeFunction;
|
|
8517
|
-
let sourceSignal;
|
|
8518
|
-
let computationFn;
|
|
8519
|
-
let equalFn;
|
|
8520
|
-
let previousValue;
|
|
8521
|
-
let isOverridden = false;
|
|
8522
|
-
let overriddenValue;
|
|
8523
|
-
let depVersion = 0;
|
|
8524
|
-
let overrideDepVersion = null;
|
|
8525
|
-
if (typeof computationOrOptions === "function") {
|
|
8526
|
-
computeFunction = computationOrOptions;
|
|
8527
|
-
equalFn = simpleOptions?.equal;
|
|
8528
|
-
} else {
|
|
8529
|
-
const options = computationOrOptions;
|
|
8530
|
-
sourceSignal = options.source;
|
|
8531
|
-
computationFn = options.computation;
|
|
8532
|
-
equalFn = options.equal;
|
|
8533
|
-
if (typeof sourceSignal === "function" && !isSignal(sourceSignal)) {
|
|
8534
|
-
const sourceFn = sourceSignal;
|
|
8535
|
-
computeFunction = /* @__PURE__ */ __name$1(() => {
|
|
8536
|
-
const sourceValue = sourceFn();
|
|
8537
|
-
if (computationFn.length > 1) {
|
|
8538
|
-
const result = computationFn(sourceValue, previousValue);
|
|
8539
|
-
previousValue = {
|
|
8540
|
-
source: sourceValue,
|
|
8541
|
-
value: result
|
|
8542
|
-
};
|
|
8543
|
-
return result;
|
|
8544
|
-
} else {
|
|
8545
|
-
const result = computationFn(sourceValue);
|
|
8546
|
-
previousValue = {
|
|
8547
|
-
source: sourceValue,
|
|
8548
|
-
value: result
|
|
8549
|
-
};
|
|
8550
|
-
return result;
|
|
8551
|
-
}
|
|
8552
|
-
}, "computeFunction");
|
|
8553
|
-
} else {
|
|
8554
|
-
const source = typeof sourceSignal === "function" ? sourceSignal : sourceSignal;
|
|
8555
|
-
computeFunction = /* @__PURE__ */ __name$1(() => {
|
|
8556
|
-
const sourceValue = source();
|
|
8557
|
-
if (computationFn.length > 1) {
|
|
8558
|
-
const result = computationFn(sourceValue, previousValue);
|
|
8559
|
-
previousValue = {
|
|
8560
|
-
source: sourceValue,
|
|
8561
|
-
value: result
|
|
8562
|
-
};
|
|
8563
|
-
return result;
|
|
8564
|
-
} else {
|
|
8565
|
-
const result = computationFn(sourceValue);
|
|
8566
|
-
previousValue = {
|
|
8567
|
-
source: sourceValue,
|
|
8568
|
-
value: result
|
|
8569
|
-
};
|
|
8570
|
-
return result;
|
|
8571
|
-
}
|
|
8572
|
-
}, "computeFunction");
|
|
8573
|
-
}
|
|
8574
|
-
}
|
|
8575
|
-
const previousTracker = reactiveStore.currentDependencyTracker;
|
|
8576
|
-
reactiveStore.currentDependencyTracker = (signal2) => {
|
|
8577
|
-
dependencies.add(signal2);
|
|
8578
|
-
};
|
|
8579
|
-
if (sourceSignal && typeof sourceSignal === "function" && !isSignal(sourceSignal)) lastComputedValue = computeFunction();
|
|
8580
|
-
else if (sourceSignal && isSignal(sourceSignal)) {
|
|
8581
|
-
dependencies.add(sourceSignal);
|
|
8582
|
-
lastComputedValue = computeFunction();
|
|
8583
|
-
} else lastComputedValue = computeFunction();
|
|
8584
|
-
reactiveStore.currentDependencyTracker = previousTracker;
|
|
8585
|
-
const subject = new BehaviorSubject(lastComputedValue);
|
|
8586
|
-
const observables = [...dependencies].map((dep) => {
|
|
8587
|
-
if (isComputed(dep) && "dependencies" in dep) {
|
|
8588
|
-
const computedDep = dep;
|
|
8589
|
-
if (computedDep.dependencies.size === 0) return new BehaviorSubject(computedDep()).asObservable();
|
|
8590
|
-
}
|
|
8591
|
-
return dep.observable;
|
|
8592
|
-
});
|
|
8593
|
-
let linkedObservable;
|
|
8594
|
-
if (observables.length > 0) linkedObservable = combineLatest(observables).pipe(filter(() => !init), map(() => {
|
|
8595
|
-
const computed2 = computeFunction();
|
|
8596
|
-
if (equalFn) {
|
|
8597
|
-
if (!equalFn(lastComputedValue, computed2)) {
|
|
8598
|
-
lastComputedValue = computed2;
|
|
8599
|
-
isOverridden = false;
|
|
8600
|
-
}
|
|
8601
|
-
} else if (lastComputedValue !== computed2) {
|
|
8602
|
-
lastComputedValue = computed2;
|
|
8603
|
-
isOverridden = false;
|
|
8604
|
-
}
|
|
8605
|
-
return lastComputedValue;
|
|
8606
|
-
}));
|
|
8607
|
-
else linkedObservable = subject.asObservable().pipe(filter(() => !init));
|
|
8608
|
-
const fn = /* @__PURE__ */ __name$1(function() {
|
|
8609
|
-
trackDependency(fn);
|
|
8610
|
-
if (isOverridden && dependencies.size > 0) {
|
|
8611
|
-
if (overrideDepVersion !== depVersion) {
|
|
8612
|
-
const computed2 = computeFunction();
|
|
8613
|
-
isOverridden = false;
|
|
8614
|
-
overriddenValue = void 0;
|
|
8615
|
-
lastComputedValue = computed2;
|
|
8616
|
-
overrideDepVersion = null;
|
|
8617
|
-
return computed2;
|
|
8618
|
-
}
|
|
8619
|
-
return overriddenValue;
|
|
8620
|
-
}
|
|
8621
|
-
if (isOverridden) return overriddenValue;
|
|
8622
|
-
if (dependencies.size === 0) lastComputedValue = computeFunction();
|
|
8623
|
-
return lastComputedValue;
|
|
8624
|
-
}, "fn");
|
|
8625
|
-
fn.observable = new Observable((observer) => {
|
|
8626
|
-
const depSubscription = linkedObservable.subscribe((value) => {
|
|
8627
|
-
if (dependencies.size > 0) {
|
|
8628
|
-
depVersion++;
|
|
8629
|
-
isOverridden = false;
|
|
8630
|
-
overrideDepVersion = null;
|
|
8631
|
-
lastComputedValue = value;
|
|
8632
|
-
} else lastComputedValue = value;
|
|
8633
|
-
observer.next(value);
|
|
8634
|
-
});
|
|
8635
|
-
let subjectSubscription;
|
|
8636
|
-
if (dependencies.size === 0) subjectSubscription = subject.pipe(filter(() => !init)).subscribe((value) => {
|
|
8637
|
-
observer.next(value);
|
|
8638
|
-
});
|
|
8639
|
-
observer.next(lastComputedValue);
|
|
8640
|
-
return () => {
|
|
8641
|
-
depSubscription.unsubscribe();
|
|
8642
|
-
if (subjectSubscription) subjectSubscription.unsubscribe();
|
|
8643
|
-
};
|
|
8644
|
-
});
|
|
8645
|
-
fn.subscription = fn.observable.subscribe(() => {});
|
|
8646
|
-
fn.dependencies = dependencies;
|
|
8647
|
-
fn._subject = subject;
|
|
8648
|
-
fn.set = (value) => {
|
|
8649
|
-
if (!isOverridden) {
|
|
8650
|
-
overrideDepVersion = depVersion;
|
|
8651
|
-
if (computationFn && sourceSignal) previousValue = {
|
|
8652
|
-
source: untracked(() => {
|
|
8653
|
-
if (typeof sourceSignal === "function") {
|
|
8654
|
-
const source = sourceSignal;
|
|
8655
|
-
return isSignal(source) ? source() : sourceSignal();
|
|
8656
|
-
}
|
|
8657
|
-
return sourceSignal();
|
|
8658
|
-
}),
|
|
8659
|
-
value
|
|
8660
|
-
};
|
|
8661
|
-
}
|
|
8662
|
-
isOverridden = true;
|
|
8663
|
-
overriddenValue = value;
|
|
8664
|
-
lastComputedValue = value;
|
|
8665
|
-
subject.next(value);
|
|
8666
|
-
};
|
|
8667
|
-
reactiveStore.currentSubscriptionsTracker?.(fn.subscription);
|
|
8668
|
-
init = false;
|
|
8669
|
-
return fn;
|
|
8670
|
-
}
|
|
8671
|
-
__name$1(linkedSignal, "linkedSignal");
|
|
8672
|
-
function untracked(fn) {
|
|
8673
|
-
const prevDepTracker = reactiveStore.currentDependencyTracker;
|
|
8674
|
-
const prevSubTracker = reactiveStore.currentSubscriptionsTracker;
|
|
8675
|
-
reactiveStore.currentDependencyTracker = null;
|
|
8676
|
-
reactiveStore.currentSubscriptionsTracker = null;
|
|
8677
|
-
try {
|
|
8678
|
-
return fn();
|
|
8679
|
-
} finally {
|
|
8680
|
-
reactiveStore.currentDependencyTracker = prevDepTracker;
|
|
8681
|
-
reactiveStore.currentSubscriptionsTracker = prevSubTracker;
|
|
8682
|
-
}
|
|
8683
|
-
}
|
|
8684
|
-
__name$1(untracked, "untracked");
|
|
8685
|
-
function effect(fn) {
|
|
8686
|
-
fn["isEffect"] = true;
|
|
8687
|
-
return computed(fn);
|
|
8688
|
-
}
|
|
8689
|
-
__name$1(effect, "effect");
|
|
8690
|
-
function isFunction$1(val) {
|
|
8691
|
-
return {}.toString.call(val) === "[object Function]";
|
|
8692
|
-
}
|
|
8693
|
-
__name$2(isFunction$1, "isFunction");
|
|
8694
|
-
function isClass(obj) {
|
|
8695
|
-
return typeof obj === "function" && obj.prototype && obj.prototype.constructor === obj;
|
|
8696
|
-
}
|
|
8697
|
-
__name$2(isClass, "isClass");
|
|
8698
|
-
var isObject = /* @__PURE__ */ __name$2((item) => item && typeof item === "object" && !Array.isArray(item) && item !== null, "isObject");
|
|
8355
|
+
var isObject = (item) => item && typeof item === "object" && !Array.isArray(item) && item !== null;
|
|
8699
8356
|
function isInstanceOfClass(value) {
|
|
8700
8357
|
if (value === null || typeof value !== "object" || value === void 0 || Array.isArray(value)) return false;
|
|
8701
8358
|
return Object.getPrototypeOf(value) !== Object.prototype;
|
|
8702
8359
|
}
|
|
8703
|
-
__name$2(isInstanceOfClass, "isInstanceOfClass");
|
|
8704
|
-
function generateShortUUID() {
|
|
8705
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
8706
|
-
let uuid = "";
|
|
8707
|
-
for (let i = 0; i < 8; i++) {
|
|
8708
|
-
const randomIndex = Math.floor(Math.random() * 62);
|
|
8709
|
-
uuid += chars[randomIndex];
|
|
8710
|
-
}
|
|
8711
|
-
return uuid;
|
|
8712
|
-
}
|
|
8713
|
-
__name$2(generateShortUUID, "generateShortUUID");
|
|
8714
8360
|
var DELETE_TOKEN = "$delete";
|
|
8715
|
-
function createStatesSnapshot(instance) {
|
|
8716
|
-
let persistObject = {};
|
|
8717
|
-
if (instance?.$snapshot) for (const key of instance.$snapshot.keys()) {
|
|
8718
|
-
const signal = instance.$snapshot.get(key);
|
|
8719
|
-
const persist2 = signal.options.persist ?? true;
|
|
8720
|
-
let value = signal();
|
|
8721
|
-
if (isObject(value) || Array.isArray(value)) continue;
|
|
8722
|
-
if (persist2) persistObject[key] = value;
|
|
8723
|
-
}
|
|
8724
|
-
return persistObject;
|
|
8725
|
-
}
|
|
8726
|
-
__name$2(createStatesSnapshot, "createStatesSnapshot");
|
|
8727
|
-
var SNAPSHOT_SKIP = Symbol("snapshot-skip");
|
|
8728
|
-
var serializeSnapshotDeep = /* @__PURE__ */ __name$2((value, path, options, seen) => {
|
|
8729
|
-
if (isSignal(value)) return serializeSnapshotDeep(value(), path, options, seen);
|
|
8730
|
-
if (value instanceof Map) return SNAPSHOT_SKIP;
|
|
8731
|
-
if (options.filter && !options.filter(value, path)) return SNAPSHOT_SKIP;
|
|
8732
|
-
if (value instanceof Date) return options.dateToString ? options.dateToString(value) : value.toISOString();
|
|
8733
|
-
if (value && typeof value === "object") {
|
|
8734
|
-
if (seen.has(value)) return SNAPSHOT_SKIP;
|
|
8735
|
-
seen.add(value);
|
|
8736
|
-
if (Array.isArray(value)) {
|
|
8737
|
-
const result2 = [];
|
|
8738
|
-
value.forEach((item, index) => {
|
|
8739
|
-
const serialized = serializeSnapshotDeep(item, path ? `${path}.${index}` : String(index), options, seen);
|
|
8740
|
-
if (serialized !== SNAPSHOT_SKIP) result2.push(serialized);
|
|
8741
|
-
});
|
|
8742
|
-
return result2;
|
|
8743
|
-
}
|
|
8744
|
-
const result = {};
|
|
8745
|
-
const idKey = isInstanceOfClass(value) ? value.constructor?._propertyMetadata?.get("id") : void 0;
|
|
8746
|
-
const entries = Object.entries(value).filter(([key]) => isInstanceOfClass(value) ? key.startsWith("__") || (idKey ? key === idKey : false) : true);
|
|
8747
|
-
for (const [key, childValue] of entries) {
|
|
8748
|
-
const normalizedKey = key.startsWith("__") ? key.slice(2) : key;
|
|
8749
|
-
const serialized = serializeSnapshotDeep(childValue, path ? `${path}.${normalizedKey}` : normalizedKey, options, seen);
|
|
8750
|
-
if (serialized !== SNAPSHOT_SKIP) result[normalizedKey] = serialized;
|
|
8751
|
-
}
|
|
8752
|
-
return result;
|
|
8753
|
-
}
|
|
8754
|
-
return value;
|
|
8755
|
-
}, "serializeSnapshotDeep");
|
|
8756
|
-
function createStatesSnapshotDeep(instance, options = {}) {
|
|
8757
|
-
const persistObject = {};
|
|
8758
|
-
if (instance?.$snapshot) for (const key of instance.$snapshot.keys()) {
|
|
8759
|
-
const signal = instance.$snapshot.get(key);
|
|
8760
|
-
if (!(signal.options.persist ?? true)) continue;
|
|
8761
|
-
const serialized = serializeSnapshotDeep(signal(), key, options, /* @__PURE__ */ new WeakSet());
|
|
8762
|
-
if (serialized !== SNAPSHOT_SKIP) persistObject[key] = serialized;
|
|
8763
|
-
}
|
|
8764
|
-
return persistObject;
|
|
8765
|
-
}
|
|
8766
|
-
__name$2(createStatesSnapshotDeep, "createStatesSnapshotDeep");
|
|
8767
8361
|
function setMetadata(target, key, value) {
|
|
8768
8362
|
const propId = target.constructor._propertyMetadata?.get(key);
|
|
8769
8363
|
if (propId) if (isSignal(target[propId])) target[propId].set(value);
|
|
8770
8364
|
else target[propId] = value;
|
|
8771
8365
|
}
|
|
8772
|
-
|
|
8773
|
-
var createSyncClass = /* @__PURE__ */ __name$2((currentClass, parentKey = null, parentClass = null, path = "") => {
|
|
8366
|
+
var createSyncClass = (currentClass, parentKey = null, parentClass = null, path = "") => {
|
|
8774
8367
|
currentClass.$path = path;
|
|
8775
8368
|
if (parentClass) currentClass.$valuesChanges = parentClass.$valuesChanges;
|
|
8776
8369
|
if (parentKey) setMetadata(currentClass, "id", parentKey);
|
|
@@ -8795,11 +8388,11 @@ var createSyncClass = /* @__PURE__ */ __name$2((currentClass, parentKey = null,
|
|
|
8795
8388
|
}
|
|
8796
8389
|
});
|
|
8797
8390
|
}
|
|
8798
|
-
}
|
|
8799
|
-
var type =
|
|
8391
|
+
};
|
|
8392
|
+
var type = (_signal, path, options = {}, currentInstance) => {
|
|
8800
8393
|
const { syncToClient = true, persist: persist2 = true, transform } = options;
|
|
8801
8394
|
let init = true;
|
|
8802
|
-
const handleObjectSubject =
|
|
8395
|
+
const handleObjectSubject = (value, propPath) => {
|
|
8803
8396
|
const newPath = `${propPath}${value.key ? `.${value.key}` : ""}`;
|
|
8804
8397
|
if ([
|
|
8805
8398
|
"add",
|
|
@@ -8809,8 +8402,8 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8809
8402
|
else if (value.type === "update" && (isObject(value.value) || Array.isArray(value.value))) createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
8810
8403
|
else savePath(newPath, value.value);
|
|
8811
8404
|
else if (value.type === "remove") savePath(newPath, DELETE_TOKEN);
|
|
8812
|
-
}
|
|
8813
|
-
const handleArraySubject =
|
|
8405
|
+
};
|
|
8406
|
+
const handleArraySubject = (value, propPath) => {
|
|
8814
8407
|
if (value.type === "reset" && Array.isArray(value.items)) {
|
|
8815
8408
|
value.items.forEach((item, index) => {
|
|
8816
8409
|
const newPath2 = `${propPath}.${index}`;
|
|
@@ -8825,13 +8418,13 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8825
8418
|
else if (value.type === "update" && (isObject(firstItem) || Array.isArray(firstItem))) createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
8826
8419
|
else savePath(newPath, firstItem);
|
|
8827
8420
|
else if (value.type === "remove") savePath(newPath, DELETE_TOKEN);
|
|
8828
|
-
}
|
|
8829
|
-
const savePath =
|
|
8421
|
+
};
|
|
8422
|
+
const savePath = (propPath, value) => {
|
|
8830
8423
|
const transformedValue = transform && value !== "$delete" ? transform(value) : value;
|
|
8831
8424
|
if (syncToClient) currentInstance.$valuesChanges.set(propPath, transformedValue);
|
|
8832
8425
|
if (persist2 && currentInstance.$path !== void 0) currentInstance.$valuesChanges.setPersist(transformedValue == "$delete" ? propPath : currentInstance.$path, transformedValue);
|
|
8833
|
-
}
|
|
8834
|
-
const setupSubscription =
|
|
8426
|
+
};
|
|
8427
|
+
const setupSubscription = (signal, signalPath) => {
|
|
8835
8428
|
if (!isSignal(signal)) return;
|
|
8836
8429
|
if (syncToClient && currentInstance.$valuesChanges) {
|
|
8837
8430
|
const initialValue = signal();
|
|
@@ -8851,7 +8444,7 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8851
8444
|
});
|
|
8852
8445
|
if (!currentInstance.$snapshot) currentInstance.$snapshot = /* @__PURE__ */ new Map();
|
|
8853
8446
|
currentInstance.$snapshot.set(path, signal);
|
|
8854
|
-
}
|
|
8447
|
+
};
|
|
8855
8448
|
if (!isSignal(_signal)) {
|
|
8856
8449
|
if (_signal && typeof _signal === "object" && !Array.isArray(_signal)) {
|
|
8857
8450
|
for (const key in _signal) if (Object.prototype.hasOwnProperty.call(_signal, key)) {
|
|
@@ -8867,7 +8460,7 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8867
8460
|
setupSubscription(_signal, path);
|
|
8868
8461
|
init = false;
|
|
8869
8462
|
return _signal;
|
|
8870
|
-
}
|
|
8463
|
+
};
|
|
8871
8464
|
function sync(options) {
|
|
8872
8465
|
let classType;
|
|
8873
8466
|
let persist2 = true;
|
|
@@ -8882,46 +8475,31 @@ function sync(options) {
|
|
|
8882
8475
|
}
|
|
8883
8476
|
return function(target, propertyKey) {
|
|
8884
8477
|
const privatePropertyKey = `__${propertyKey}`;
|
|
8478
|
+
const getter = function() {
|
|
8479
|
+
return this[privatePropertyKey];
|
|
8480
|
+
};
|
|
8481
|
+
const setter = function(newVal) {
|
|
8482
|
+
this[privatePropertyKey] = type(newVal, propertyKey, {
|
|
8483
|
+
classType,
|
|
8484
|
+
persist: persist2,
|
|
8485
|
+
syncToClient,
|
|
8486
|
+
transform
|
|
8487
|
+
}, this);
|
|
8488
|
+
};
|
|
8885
8489
|
Object.defineProperty(target, propertyKey, {
|
|
8886
|
-
get:
|
|
8887
|
-
|
|
8888
|
-
}, "getter"),
|
|
8889
|
-
set: /* @__PURE__ */ __name$2(function(newVal) {
|
|
8890
|
-
this[privatePropertyKey] = type(newVal, propertyKey, {
|
|
8891
|
-
classType,
|
|
8892
|
-
persist: persist2,
|
|
8893
|
-
syncToClient,
|
|
8894
|
-
transform
|
|
8895
|
-
}, this);
|
|
8896
|
-
}, "setter"),
|
|
8490
|
+
get: getter,
|
|
8491
|
+
set: setter,
|
|
8897
8492
|
enumerable: true,
|
|
8898
8493
|
configurable: true
|
|
8899
8494
|
});
|
|
8900
8495
|
};
|
|
8901
8496
|
}
|
|
8902
|
-
__name$2(sync, "sync");
|
|
8903
8497
|
function id() {
|
|
8904
8498
|
return function(target, propertyKey) {
|
|
8905
8499
|
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
8906
8500
|
target.constructor._propertyMetadata.set("id", propertyKey);
|
|
8907
8501
|
};
|
|
8908
8502
|
}
|
|
8909
|
-
__name$2(id, "id");
|
|
8910
|
-
function users(options) {
|
|
8911
|
-
return function(target, propertyKey) {
|
|
8912
|
-
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
8913
|
-
target.constructor._propertyMetadata.set("users", propertyKey);
|
|
8914
|
-
sync(options)(target, propertyKey);
|
|
8915
|
-
};
|
|
8916
|
-
}
|
|
8917
|
-
__name$2(users, "users");
|
|
8918
|
-
function persist() {
|
|
8919
|
-
return sync({
|
|
8920
|
-
persist: true,
|
|
8921
|
-
syncToClient: false
|
|
8922
|
-
});
|
|
8923
|
-
}
|
|
8924
|
-
__name$2(persist, "persist");
|
|
8925
8503
|
function connected() {
|
|
8926
8504
|
return function(target, propertyKey) {
|
|
8927
8505
|
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
@@ -8929,60 +8507,6 @@ function connected() {
|
|
|
8929
8507
|
sync({ persist: false })(target, propertyKey);
|
|
8930
8508
|
};
|
|
8931
8509
|
}
|
|
8932
|
-
__name$2(connected, "connected");
|
|
8933
|
-
function load(rootInstance, values, valueIsObject) {
|
|
8934
|
-
if (valueIsObject) loadFromObject(rootInstance, values);
|
|
8935
|
-
else loadFromPaths(rootInstance, values);
|
|
8936
|
-
}
|
|
8937
|
-
__name$2(load, "load");
|
|
8938
|
-
function loadFromPaths(rootInstance, values) {
|
|
8939
|
-
for (const [path, value] of Object.entries(values)) loadValue(rootInstance, path.split("."), value);
|
|
8940
|
-
}
|
|
8941
|
-
__name$2(loadFromPaths, "loadFromPaths");
|
|
8942
|
-
function loadFromObject(rootInstance, values, currentPath = "") {
|
|
8943
|
-
for (let key in values) {
|
|
8944
|
-
const value = values[key];
|
|
8945
|
-
const newPath = currentPath ? `${currentPath}.${key}` : key;
|
|
8946
|
-
if (typeof value === "object" && !Array.isArray(value) && value !== null) loadFromObject(rootInstance, value, newPath);
|
|
8947
|
-
else loadValue(rootInstance, newPath.split("."), value);
|
|
8948
|
-
}
|
|
8949
|
-
}
|
|
8950
|
-
__name$2(loadFromObject, "loadFromObject");
|
|
8951
|
-
function loadValue(rootInstance, parts, value) {
|
|
8952
|
-
let current = rootInstance;
|
|
8953
|
-
for (let i = 0; i < parts.length; i++) {
|
|
8954
|
-
const part = parts[i];
|
|
8955
|
-
if (i === parts.length - 1) if (value == "$delete") {
|
|
8956
|
-
if (isSignal(current)) current = current();
|
|
8957
|
-
Reflect.deleteProperty(current, part);
|
|
8958
|
-
} else if (current[part]?._subject) current[part].set(value);
|
|
8959
|
-
else if (isSignal(current) && Array.isArray(current()) && !isNaN(Number(part))) current()[Number(part)] = value;
|
|
8960
|
-
else current[part] = value;
|
|
8961
|
-
else {
|
|
8962
|
-
if (isSignal(current)) current = current();
|
|
8963
|
-
if (current[part] === void 0) {
|
|
8964
|
-
const classType = getByPath(rootInstance, parts.slice(0, i).join("."))?.options?.classType;
|
|
8965
|
-
if (classType) {
|
|
8966
|
-
current[part] = !isClass(classType) ? classType(part) : new classType();
|
|
8967
|
-
setMetadata(current[part], "id", part);
|
|
8968
|
-
} else current[part] = {};
|
|
8969
|
-
}
|
|
8970
|
-
current = current[part];
|
|
8971
|
-
}
|
|
8972
|
-
}
|
|
8973
|
-
}
|
|
8974
|
-
__name$2(loadValue, "loadValue");
|
|
8975
|
-
function getByPath(root, path) {
|
|
8976
|
-
const parts = path.split(".");
|
|
8977
|
-
let current = root;
|
|
8978
|
-
for (const part of parts) {
|
|
8979
|
-
if (isSignal(current)) current = current();
|
|
8980
|
-
if (current[part]) current = current[part];
|
|
8981
|
-
else return;
|
|
8982
|
-
}
|
|
8983
|
-
return current;
|
|
8984
|
-
}
|
|
8985
|
-
__name$2(getByPath, "getByPath");
|
|
8986
8510
|
function __decorateMetadata(k, v) {
|
|
8987
8511
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8988
8512
|
}
|
|
@@ -9042,6 +8566,24 @@ __decorate([id(), __decorateMetadata("design:type", Object)], Skill.prototype, "
|
|
|
9042
8566
|
__decorate([sync(), __decorateMetadata("design:type", Object)], Skill.prototype, "name", void 0);
|
|
9043
8567
|
__decorate([sync(), __decorateMetadata("design:type", Object)], Skill.prototype, "spCost", void 0);
|
|
9044
8568
|
__decorate([sync(), __decorateMetadata("design:type", Object)], Skill.prototype, "icon", void 0);
|
|
8569
|
+
var readReactiveValue = (value) => {
|
|
8570
|
+
if (typeof value === "function" && value.observable) return value();
|
|
8571
|
+
return value;
|
|
8572
|
+
};
|
|
8573
|
+
var toCloneableSyncValue = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
8574
|
+
const resolved = readReactiveValue(value);
|
|
8575
|
+
if (resolved == null || typeof resolved !== "object") return typeof resolved === "function" ? void 0 : resolved;
|
|
8576
|
+
if (seen.has(resolved)) return;
|
|
8577
|
+
seen.add(resolved);
|
|
8578
|
+
if (Array.isArray(resolved)) return resolved.map((item) => toCloneableSyncValue(item, seen)).filter((item) => item !== void 0);
|
|
8579
|
+
const output = {};
|
|
8580
|
+
for (const [key, child] of Object.entries(resolved)) {
|
|
8581
|
+
if (key.startsWith("$") || key === "_itemInstance" || key === "_subject" || key === "observable" || key === "options") continue;
|
|
8582
|
+
const childValue = toCloneableSyncValue(child, seen);
|
|
8583
|
+
if (childValue !== void 0) output[key.startsWith("__") ? key.slice(2) : key] = childValue;
|
|
8584
|
+
}
|
|
8585
|
+
return output;
|
|
8586
|
+
};
|
|
9045
8587
|
var Direction = /* @__PURE__ */ function(Direction) {
|
|
9046
8588
|
Direction["Up"] = "up";
|
|
9047
8589
|
Direction["Down"] = "down";
|
|
@@ -9087,6 +8629,7 @@ var RpgCommonPlayer = class {
|
|
|
9087
8629
|
this.componentsCenter = signal(null);
|
|
9088
8630
|
this.componentsLeft = signal(null);
|
|
9089
8631
|
this.componentsRight = signal(null);
|
|
8632
|
+
this._removeTransition = signal("");
|
|
9090
8633
|
this.isConnected = signal(false);
|
|
9091
8634
|
this._intendedDirection = null;
|
|
9092
8635
|
this._directionFixed = signal(false);
|
|
@@ -9225,8 +8768,11 @@ __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.
|
|
|
9225
8768
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_exp", void 0);
|
|
9226
8769
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_level", void 0);
|
|
9227
8770
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_class", void 0);
|
|
9228
|
-
__decorate([sync(
|
|
9229
|
-
|
|
8771
|
+
__decorate([sync({
|
|
8772
|
+
classType: Item,
|
|
8773
|
+
transform: toCloneableSyncValue
|
|
8774
|
+
}), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "items", void 0);
|
|
8775
|
+
__decorate([sync({ transform: toCloneableSyncValue }), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "equipments", void 0);
|
|
9230
8776
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "states", void 0);
|
|
9231
8777
|
__decorate([sync(Skill), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "skills", void 0);
|
|
9232
8778
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_effects", void 0);
|
|
@@ -9240,6 +8786,7 @@ __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.
|
|
|
9240
8786
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "componentsCenter", void 0);
|
|
9241
8787
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "componentsLeft", void 0);
|
|
9242
8788
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "componentsRight", void 0);
|
|
8789
|
+
__decorate([sync({ persist: false }), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_removeTransition", void 0);
|
|
9243
8790
|
__decorate([connected(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "isConnected", void 0);
|
|
9244
8791
|
(class Vector2 {
|
|
9245
8792
|
/**
|
|
@@ -9631,24 +9178,16 @@ function findModules(context, namespace) {
|
|
|
9631
9178
|
for (let key in context["values"]) if (key.endsWith("Module" + namespace)) modules.push(context["values"][key].values.get("__default__"));
|
|
9632
9179
|
return modules;
|
|
9633
9180
|
}
|
|
9634
|
-
var __defProp = Object.defineProperty;
|
|
9635
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
9636
|
-
value,
|
|
9637
|
-
configurable: true
|
|
9638
|
-
});
|
|
9639
9181
|
var DEFAULT_INSTANCE_KEY = "__default__";
|
|
9640
9182
|
function toTokenName(token) {
|
|
9641
9183
|
return typeof token === "function" ? token.name : token;
|
|
9642
9184
|
}
|
|
9643
|
-
__name(toTokenName, "toTokenName");
|
|
9644
9185
|
function toInstanceKey(name) {
|
|
9645
9186
|
return name ?? DEFAULT_INSTANCE_KEY;
|
|
9646
9187
|
}
|
|
9647
|
-
__name(toInstanceKey, "toInstanceKey");
|
|
9648
9188
|
function getRecord(context, token) {
|
|
9649
9189
|
return context.get("inject:" + toTokenName(token));
|
|
9650
9190
|
}
|
|
9651
|
-
__name(getRecord, "getRecord");
|
|
9652
9191
|
function ensureRecord(context, token) {
|
|
9653
9192
|
const key = "inject:" + toTokenName(token);
|
|
9654
9193
|
let record = context.get(key);
|
|
@@ -9660,7 +9199,6 @@ function ensureRecord(context, token) {
|
|
|
9660
9199
|
context.set(key, record);
|
|
9661
9200
|
return record;
|
|
9662
9201
|
}
|
|
9663
|
-
__name(ensureRecord, "ensureRecord");
|
|
9664
9202
|
function provide(context, token, value, options = {}) {
|
|
9665
9203
|
const record = ensureRecord(context, token);
|
|
9666
9204
|
const instanceKey = toInstanceKey(options.name);
|
|
@@ -9669,41 +9207,17 @@ function provide(context, token, value, options = {}) {
|
|
|
9669
9207
|
record.values.set(instanceKey, value);
|
|
9670
9208
|
return value;
|
|
9671
9209
|
}
|
|
9672
|
-
__name(provide, "provide");
|
|
9673
|
-
function isInjected(context, token, options = {}) {
|
|
9674
|
-
const record = getRecord(context, token);
|
|
9675
|
-
if (!record) return false;
|
|
9676
|
-
if (options.name) return record.injected.has(toInstanceKey(options.name));
|
|
9677
|
-
if (record.multi) return record.injected.size > 0;
|
|
9678
|
-
return record.injected.has(DEFAULT_INSTANCE_KEY);
|
|
9679
|
-
}
|
|
9680
|
-
__name(isInjected, "isInjected");
|
|
9681
|
-
function isProvided(context, token, options = {}) {
|
|
9682
|
-
const record = getRecord(context, token);
|
|
9683
|
-
if (!record) return false;
|
|
9684
|
-
if (options.name) return record.values.has(toInstanceKey(options.name));
|
|
9685
|
-
if (record.multi) return record.values.size > 0;
|
|
9686
|
-
return record.values.has(DEFAULT_INSTANCE_KEY);
|
|
9687
|
-
}
|
|
9688
|
-
__name(isProvided, "isProvided");
|
|
9689
|
-
function hasInstance(context, token, options = {}) {
|
|
9690
|
-
return isProvided(context, token, options);
|
|
9691
|
-
}
|
|
9692
|
-
__name(hasInstance, "hasInstance");
|
|
9693
9210
|
function handleMissingInjection(token, options) {
|
|
9694
9211
|
const name = toTokenName(token);
|
|
9695
9212
|
if (options.name) throw new Error(`Injection provider ${name} with name ${options.name} not found`);
|
|
9696
9213
|
throw new Error(`Injection provider ${name} not found`);
|
|
9697
9214
|
}
|
|
9698
|
-
__name(handleMissingInjection, "handleMissingInjection");
|
|
9699
9215
|
function markInjected(record, key) {
|
|
9700
9216
|
record.injected.add(key);
|
|
9701
9217
|
}
|
|
9702
|
-
__name(markInjected, "markInjected");
|
|
9703
9218
|
function markAllInjected(record) {
|
|
9704
9219
|
for (const key of record.values.keys()) record.injected.add(key);
|
|
9705
9220
|
}
|
|
9706
|
-
__name(markAllInjected, "markAllInjected");
|
|
9707
9221
|
function inject$1(context, token, options = {}) {
|
|
9708
9222
|
const record = getRecord(context, token);
|
|
9709
9223
|
if (!record) {
|
|
@@ -9736,78 +9250,6 @@ function inject$1(context, token, options = {}) {
|
|
|
9736
9250
|
markInjected(record, DEFAULT_INSTANCE_KEY);
|
|
9737
9251
|
return value;
|
|
9738
9252
|
}
|
|
9739
|
-
__name(inject$1, "inject");
|
|
9740
|
-
function override(providers, newProvider, options) {
|
|
9741
|
-
let { upsert = false, key } = options ?? {};
|
|
9742
|
-
if (!key) key = typeof newProvider === "function" ? newProvider.name : newProvider.provide;
|
|
9743
|
-
const flatProviders = providers.flat();
|
|
9744
|
-
const exists = flatProviders.some((provider) => {
|
|
9745
|
-
if (typeof provider === "function") return provider.name === key;
|
|
9746
|
-
else if (typeof provider === "object") return provider.provide === key;
|
|
9747
|
-
return false;
|
|
9748
|
-
});
|
|
9749
|
-
const mappedProviders = flatProviders.map((provider) => {
|
|
9750
|
-
if (typeof provider === "function" && provider.name === key) return newProvider;
|
|
9751
|
-
else if (typeof provider === "object" && provider.provide === key) return newProvider;
|
|
9752
|
-
return provider;
|
|
9753
|
-
});
|
|
9754
|
-
if (upsert && !exists) mappedProviders.push(newProvider);
|
|
9755
|
-
return mappedProviders;
|
|
9756
|
-
}
|
|
9757
|
-
__name(override, "override");
|
|
9758
|
-
function findProviders(providers, name) {
|
|
9759
|
-
const results = [];
|
|
9760
|
-
for (const provider of providers) if (Array.isArray(provider)) results.push(...findProviders(provider, name));
|
|
9761
|
-
else if (findProvider(provider, name)) results.push(provider);
|
|
9762
|
-
return results;
|
|
9763
|
-
}
|
|
9764
|
-
__name(findProviders, "findProviders");
|
|
9765
|
-
function findProvider(providers, name) {
|
|
9766
|
-
if (!Array.isArray(providers)) {
|
|
9767
|
-
if (typeof providers === "object" && "provide" in providers) {
|
|
9768
|
-
const provider = providers;
|
|
9769
|
-
const providerName = typeof provider.provide === "function" ? provider.provide.name : provider.provide;
|
|
9770
|
-
if (name instanceof RegExp) {
|
|
9771
|
-
if (name.test(providerName)) return providers;
|
|
9772
|
-
} else if (providerName === name) return providers;
|
|
9773
|
-
}
|
|
9774
|
-
return null;
|
|
9775
|
-
}
|
|
9776
|
-
for (const provider of providers) {
|
|
9777
|
-
if (Array.isArray(provider)) {
|
|
9778
|
-
const found = findProvider(provider, name);
|
|
9779
|
-
if (found) return found;
|
|
9780
|
-
continue;
|
|
9781
|
-
}
|
|
9782
|
-
if (typeof provider === "object" && "provide" in provider) {
|
|
9783
|
-
const providerName = typeof provider.provide === "function" ? provider.provide.name : provider.provide;
|
|
9784
|
-
if (name instanceof RegExp) {
|
|
9785
|
-
if (name.test(providerName)) return provider;
|
|
9786
|
-
} else if (providerName === name) return provider;
|
|
9787
|
-
}
|
|
9788
|
-
}
|
|
9789
|
-
return null;
|
|
9790
|
-
}
|
|
9791
|
-
__name(findProvider, "findProvider");
|
|
9792
|
-
function processProvider(mergedConfig, baseConfig, provider) {
|
|
9793
|
-
if (Array.isArray(provider)) {
|
|
9794
|
-
for (const nestedProvider of provider) processProvider(mergedConfig, baseConfig, nestedProvider);
|
|
9795
|
-
return;
|
|
9796
|
-
}
|
|
9797
|
-
if (findProvider(baseConfig.providers, provider.provide)) mergedConfig.providers = override(mergedConfig.providers, provider);
|
|
9798
|
-
else mergedConfig.providers.push(provider);
|
|
9799
|
-
}
|
|
9800
|
-
__name(processProvider, "processProvider");
|
|
9801
|
-
function mergeConfig(baseConfig, config) {
|
|
9802
|
-
const mergedConfig = {
|
|
9803
|
-
...baseConfig,
|
|
9804
|
-
...config,
|
|
9805
|
-
providers: [...baseConfig.providers]
|
|
9806
|
-
};
|
|
9807
|
-
for (const provider of config.providers) processProvider(mergedConfig, baseConfig, provider);
|
|
9808
|
-
return mergedConfig;
|
|
9809
|
-
}
|
|
9810
|
-
__name(mergeConfig, "mergeConfig");
|
|
9811
9253
|
function extractProvideOptions(source) {
|
|
9812
9254
|
if (!source) return;
|
|
9813
9255
|
const { multi, name } = source;
|
|
@@ -9817,14 +9259,12 @@ function extractProvideOptions(source) {
|
|
|
9817
9259
|
name
|
|
9818
9260
|
};
|
|
9819
9261
|
}
|
|
9820
|
-
__name(extractProvideOptions, "extractProvideOptions");
|
|
9821
9262
|
function getDeps(provider) {
|
|
9822
9263
|
if (typeof provider === "function") return provider.deps ?? [];
|
|
9823
9264
|
return provider.deps ?? [];
|
|
9824
9265
|
}
|
|
9825
|
-
__name(getDeps, "getDeps");
|
|
9826
9266
|
function sortProviders(providers) {
|
|
9827
|
-
const tokenName =
|
|
9267
|
+
const tokenName = (t) => typeof t === "function" ? t.name : t;
|
|
9828
9268
|
const map = /* @__PURE__ */ new Map();
|
|
9829
9269
|
for (const p of providers) {
|
|
9830
9270
|
const token = tokenName(typeof p === "function" ? p : p.provide);
|
|
@@ -9835,7 +9275,7 @@ function sortProviders(providers) {
|
|
|
9835
9275
|
const result = [];
|
|
9836
9276
|
const visited = /* @__PURE__ */ new Set();
|
|
9837
9277
|
const stack = /* @__PURE__ */ new Set();
|
|
9838
|
-
const visit =
|
|
9278
|
+
const visit = (token) => {
|
|
9839
9279
|
const name = tokenName(token);
|
|
9840
9280
|
if (visited.has(name)) return;
|
|
9841
9281
|
if (stack.has(name)) throw new Error(`Circular dependency detected for provider ${name}`);
|
|
@@ -9849,11 +9289,10 @@ function sortProviders(providers) {
|
|
|
9849
9289
|
visited.add(name);
|
|
9850
9290
|
}
|
|
9851
9291
|
stack.delete(name);
|
|
9852
|
-
}
|
|
9292
|
+
};
|
|
9853
9293
|
for (const p of providers) visit(typeof p === "function" ? p : p.provide);
|
|
9854
9294
|
return result;
|
|
9855
9295
|
}
|
|
9856
|
-
__name(sortProviders, "sortProviders");
|
|
9857
9296
|
async function injector(context, providers) {
|
|
9858
9297
|
providers = providers.flat();
|
|
9859
9298
|
providers = sortProviders(providers);
|
|
@@ -9879,13 +9318,11 @@ async function injector(context, providers) {
|
|
|
9879
9318
|
provide(context, token, instance, options);
|
|
9880
9319
|
}
|
|
9881
9320
|
}
|
|
9882
|
-
__name(injector, "injector");
|
|
9883
9321
|
var Context = class {
|
|
9884
|
-
|
|
9885
|
-
|
|
9322
|
+
constructor() {
|
|
9323
|
+
/** Internal storage for injected values */
|
|
9324
|
+
this.values = {};
|
|
9886
9325
|
}
|
|
9887
|
-
/** Internal storage for injected values */
|
|
9888
|
-
values = {};
|
|
9889
9326
|
/**
|
|
9890
9327
|
* Sets a value in the context
|
|
9891
9328
|
* @param key - Unique identifier for the value
|