@rpgjs/vite 5.0.0-beta.6 → 5.0.0-beta.8
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/CHANGELOG.md +12 -0
- package/dist/index.js +89 -659
- 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-BrK6VWLE.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,8 @@ function map(project, thisArg) {
|
|
|
8044
8027
|
}));
|
|
8045
8028
|
});
|
|
8046
8029
|
}
|
|
8047
|
-
|
|
8048
|
-
|
|
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
|
-
}
|
|
8030
|
+
Array.isArray;
|
|
8031
|
+
Array.isArray;
|
|
8132
8032
|
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
8133
8033
|
var buffer = [];
|
|
8134
8034
|
var active = 0;
|
|
@@ -8177,7 +8077,7 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
|
|
|
8177
8077
|
}
|
|
8178
8078
|
function mergeMap(project, resultSelector, concurrent) {
|
|
8179
8079
|
if (concurrent === void 0) concurrent = Infinity;
|
|
8180
|
-
if (isFunction$
|
|
8080
|
+
if (isFunction$1(resultSelector)) return mergeMap(function(a, i) {
|
|
8181
8081
|
return map(function(b, ii) {
|
|
8182
8082
|
return resultSelector(a, b, i, ii);
|
|
8183
8083
|
})(innerFrom(project(a, i)));
|
|
@@ -8221,35 +8121,18 @@ function toArray() {
|
|
|
8221
8121
|
reduce(arrReducer, [])(source).subscribe(subscriber);
|
|
8222
8122
|
});
|
|
8223
8123
|
}
|
|
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
8124
|
var ArraySubject = class extends BehaviorSubject {
|
|
8239
|
-
static {
|
|
8240
|
-
__name$1(this, "ArraySubject");
|
|
8241
|
-
}
|
|
8242
|
-
_items = [];
|
|
8243
8125
|
constructor(items = []) {
|
|
8244
8126
|
super({
|
|
8245
8127
|
type: "init",
|
|
8246
8128
|
items
|
|
8247
8129
|
});
|
|
8130
|
+
this._items = [];
|
|
8248
8131
|
this.createProxy(items);
|
|
8249
8132
|
}
|
|
8250
8133
|
createProxy(items) {
|
|
8251
8134
|
this._items = new Proxy(items, {
|
|
8252
|
-
get:
|
|
8135
|
+
get: (target, prop, receiver) => {
|
|
8253
8136
|
const origMethod = target[prop];
|
|
8254
8137
|
if (typeof origMethod === "function") return (...args) => {
|
|
8255
8138
|
let changeType = "update";
|
|
@@ -8304,8 +8187,8 @@ var ArraySubject = class extends BehaviorSubject {
|
|
|
8304
8187
|
return result;
|
|
8305
8188
|
};
|
|
8306
8189
|
return Reflect.get(target, prop, receiver);
|
|
8307
|
-
},
|
|
8308
|
-
set:
|
|
8190
|
+
},
|
|
8191
|
+
set: (target, prop, value) => {
|
|
8309
8192
|
const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
|
|
8310
8193
|
target[prop] = value;
|
|
8311
8194
|
this.next({
|
|
@@ -8314,7 +8197,7 @@ var ArraySubject = class extends BehaviorSubject {
|
|
|
8314
8197
|
items: [value]
|
|
8315
8198
|
});
|
|
8316
8199
|
return true;
|
|
8317
|
-
}
|
|
8200
|
+
}
|
|
8318
8201
|
});
|
|
8319
8202
|
}
|
|
8320
8203
|
get items() {
|
|
@@ -8328,14 +8211,10 @@ var ArraySubject = class extends BehaviorSubject {
|
|
|
8328
8211
|
});
|
|
8329
8212
|
}
|
|
8330
8213
|
};
|
|
8331
|
-
var isArraySubject =
|
|
8214
|
+
var isArraySubject = (value) => {
|
|
8332
8215
|
return "_items" in value;
|
|
8333
|
-
}
|
|
8216
|
+
};
|
|
8334
8217
|
var ObjectSubject = class extends BehaviorSubject {
|
|
8335
|
-
static {
|
|
8336
|
-
__name$1(this, "ObjectSubject");
|
|
8337
|
-
}
|
|
8338
|
-
_obj;
|
|
8339
8218
|
constructor(obj = {}) {
|
|
8340
8219
|
super({
|
|
8341
8220
|
type: "init",
|
|
@@ -8345,10 +8224,10 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8345
8224
|
}
|
|
8346
8225
|
createProxy(obj) {
|
|
8347
8226
|
this._obj = new Proxy(obj, {
|
|
8348
|
-
get:
|
|
8227
|
+
get: (target, prop, receiver) => {
|
|
8349
8228
|
return Reflect.get(target, prop, receiver);
|
|
8350
|
-
},
|
|
8351
|
-
set:
|
|
8229
|
+
},
|
|
8230
|
+
set: (target, prop, value, receiver) => {
|
|
8352
8231
|
const key = prop;
|
|
8353
8232
|
const changeType = key in target ? "update" : "add";
|
|
8354
8233
|
target[key] = value;
|
|
@@ -8358,8 +8237,8 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8358
8237
|
value
|
|
8359
8238
|
});
|
|
8360
8239
|
return true;
|
|
8361
|
-
},
|
|
8362
|
-
deleteProperty:
|
|
8240
|
+
},
|
|
8241
|
+
deleteProperty: (target, prop) => {
|
|
8363
8242
|
const key = prop;
|
|
8364
8243
|
if (key in target) {
|
|
8365
8244
|
const value = target[key];
|
|
@@ -8372,7 +8251,7 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8372
8251
|
return true;
|
|
8373
8252
|
}
|
|
8374
8253
|
return false;
|
|
8375
|
-
}
|
|
8254
|
+
}
|
|
8376
8255
|
});
|
|
8377
8256
|
}
|
|
8378
8257
|
get obj() {
|
|
@@ -8386,10 +8265,10 @@ var ObjectSubject = class extends BehaviorSubject {
|
|
|
8386
8265
|
});
|
|
8387
8266
|
}
|
|
8388
8267
|
};
|
|
8389
|
-
var isObjectSubject =
|
|
8268
|
+
var isObjectSubject = (value) => {
|
|
8390
8269
|
return "_obj" in value;
|
|
8391
|
-
}
|
|
8392
|
-
var
|
|
8270
|
+
};
|
|
8271
|
+
var getGlobalReactiveStore = () => {
|
|
8393
8272
|
const globalKey = "__REACTIVE_STORE__";
|
|
8394
8273
|
if (typeof globalThis !== "undefined") {
|
|
8395
8274
|
if (!globalThis[globalKey]) globalThis[globalKey] = {
|
|
@@ -8414,24 +8293,25 @@ var reactiveStore = (/* @__PURE__ */ __name$1(() => {
|
|
|
8414
8293
|
currentSubscriptionsTracker: null
|
|
8415
8294
|
};
|
|
8416
8295
|
return globalObj[globalKey];
|
|
8417
|
-
}
|
|
8418
|
-
var
|
|
8296
|
+
};
|
|
8297
|
+
var reactiveStore = getGlobalReactiveStore();
|
|
8298
|
+
var trackDependency = (signal2) => {
|
|
8419
8299
|
if (reactiveStore.currentDependencyTracker) reactiveStore.currentDependencyTracker(signal2);
|
|
8420
|
-
}
|
|
8300
|
+
};
|
|
8421
8301
|
function signal(defaultValue, options) {
|
|
8422
8302
|
let subject;
|
|
8423
8303
|
if (Array.isArray(defaultValue)) subject = new ArraySubject(defaultValue);
|
|
8424
8304
|
else if (typeof defaultValue === "object" && defaultValue !== null) subject = new ObjectSubject(defaultValue);
|
|
8425
8305
|
else subject = new BehaviorSubject(defaultValue);
|
|
8426
|
-
const getValue =
|
|
8306
|
+
const getValue = () => {
|
|
8427
8307
|
if (subject instanceof ArraySubject) return subject.items;
|
|
8428
8308
|
else if (subject instanceof ObjectSubject) return subject.obj;
|
|
8429
8309
|
return subject.value;
|
|
8430
|
-
}
|
|
8431
|
-
const fn =
|
|
8310
|
+
};
|
|
8311
|
+
const fn = function() {
|
|
8432
8312
|
trackDependency(fn);
|
|
8433
8313
|
return getValue();
|
|
8434
|
-
}
|
|
8314
|
+
};
|
|
8435
8315
|
fn.set = (value) => {
|
|
8436
8316
|
const currentValue = getValue();
|
|
8437
8317
|
let shouldEmit = true;
|
|
@@ -8468,309 +8348,24 @@ function signal(defaultValue, options) {
|
|
|
8468
8348
|
fn._subject = subject;
|
|
8469
8349
|
return fn;
|
|
8470
8350
|
}
|
|
8471
|
-
__name$1(signal, "signal");
|
|
8472
8351
|
function isSignal(value) {
|
|
8473
8352
|
return !!(value && value.observable);
|
|
8474
8353
|
}
|
|
8475
|
-
__name$1(isSignal, "isSignal");
|
|
8476
8354
|
function isComputed(value) {
|
|
8477
8355
|
return isSignal(value) && !!value.dependencies;
|
|
8478
8356
|
}
|
|
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");
|
|
8357
|
+
var isObject = (item) => item && typeof item === "object" && !Array.isArray(item) && item !== null;
|
|
8699
8358
|
function isInstanceOfClass(value) {
|
|
8700
8359
|
if (value === null || typeof value !== "object" || value === void 0 || Array.isArray(value)) return false;
|
|
8701
8360
|
return Object.getPrototypeOf(value) !== Object.prototype;
|
|
8702
8361
|
}
|
|
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
8362
|
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
8363
|
function setMetadata(target, key, value) {
|
|
8768
8364
|
const propId = target.constructor._propertyMetadata?.get(key);
|
|
8769
8365
|
if (propId) if (isSignal(target[propId])) target[propId].set(value);
|
|
8770
8366
|
else target[propId] = value;
|
|
8771
8367
|
}
|
|
8772
|
-
|
|
8773
|
-
var createSyncClass = /* @__PURE__ */ __name$2((currentClass, parentKey = null, parentClass = null, path = "") => {
|
|
8368
|
+
var createSyncClass = (currentClass, parentKey = null, parentClass = null, path = "") => {
|
|
8774
8369
|
currentClass.$path = path;
|
|
8775
8370
|
if (parentClass) currentClass.$valuesChanges = parentClass.$valuesChanges;
|
|
8776
8371
|
if (parentKey) setMetadata(currentClass, "id", parentKey);
|
|
@@ -8795,11 +8390,11 @@ var createSyncClass = /* @__PURE__ */ __name$2((currentClass, parentKey = null,
|
|
|
8795
8390
|
}
|
|
8796
8391
|
});
|
|
8797
8392
|
}
|
|
8798
|
-
}
|
|
8799
|
-
var type =
|
|
8393
|
+
};
|
|
8394
|
+
var type = (_signal, path, options = {}, currentInstance) => {
|
|
8800
8395
|
const { syncToClient = true, persist: persist2 = true, transform } = options;
|
|
8801
8396
|
let init = true;
|
|
8802
|
-
const handleObjectSubject =
|
|
8397
|
+
const handleObjectSubject = (value, propPath) => {
|
|
8803
8398
|
const newPath = `${propPath}${value.key ? `.${value.key}` : ""}`;
|
|
8804
8399
|
if ([
|
|
8805
8400
|
"add",
|
|
@@ -8809,8 +8404,8 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8809
8404
|
else if (value.type === "update" && (isObject(value.value) || Array.isArray(value.value))) createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
8810
8405
|
else savePath(newPath, value.value);
|
|
8811
8406
|
else if (value.type === "remove") savePath(newPath, DELETE_TOKEN);
|
|
8812
|
-
}
|
|
8813
|
-
const handleArraySubject =
|
|
8407
|
+
};
|
|
8408
|
+
const handleArraySubject = (value, propPath) => {
|
|
8814
8409
|
if (value.type === "reset" && Array.isArray(value.items)) {
|
|
8815
8410
|
value.items.forEach((item, index) => {
|
|
8816
8411
|
const newPath2 = `${propPath}.${index}`;
|
|
@@ -8825,13 +8420,13 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8825
8420
|
else if (value.type === "update" && (isObject(firstItem) || Array.isArray(firstItem))) createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
8826
8421
|
else savePath(newPath, firstItem);
|
|
8827
8422
|
else if (value.type === "remove") savePath(newPath, DELETE_TOKEN);
|
|
8828
|
-
}
|
|
8829
|
-
const savePath =
|
|
8423
|
+
};
|
|
8424
|
+
const savePath = (propPath, value) => {
|
|
8830
8425
|
const transformedValue = transform && value !== "$delete" ? transform(value) : value;
|
|
8831
8426
|
if (syncToClient) currentInstance.$valuesChanges.set(propPath, transformedValue);
|
|
8832
8427
|
if (persist2 && currentInstance.$path !== void 0) currentInstance.$valuesChanges.setPersist(transformedValue == "$delete" ? propPath : currentInstance.$path, transformedValue);
|
|
8833
|
-
}
|
|
8834
|
-
const setupSubscription =
|
|
8428
|
+
};
|
|
8429
|
+
const setupSubscription = (signal, signalPath) => {
|
|
8835
8430
|
if (!isSignal(signal)) return;
|
|
8836
8431
|
if (syncToClient && currentInstance.$valuesChanges) {
|
|
8837
8432
|
const initialValue = signal();
|
|
@@ -8851,7 +8446,7 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8851
8446
|
});
|
|
8852
8447
|
if (!currentInstance.$snapshot) currentInstance.$snapshot = /* @__PURE__ */ new Map();
|
|
8853
8448
|
currentInstance.$snapshot.set(path, signal);
|
|
8854
|
-
}
|
|
8449
|
+
};
|
|
8855
8450
|
if (!isSignal(_signal)) {
|
|
8856
8451
|
if (_signal && typeof _signal === "object" && !Array.isArray(_signal)) {
|
|
8857
8452
|
for (const key in _signal) if (Object.prototype.hasOwnProperty.call(_signal, key)) {
|
|
@@ -8867,7 +8462,7 @@ var type = /* @__PURE__ */ __name$2((_signal, path, options = {}, currentInstanc
|
|
|
8867
8462
|
setupSubscription(_signal, path);
|
|
8868
8463
|
init = false;
|
|
8869
8464
|
return _signal;
|
|
8870
|
-
}
|
|
8465
|
+
};
|
|
8871
8466
|
function sync(options) {
|
|
8872
8467
|
let classType;
|
|
8873
8468
|
let persist2 = true;
|
|
@@ -8882,46 +8477,31 @@ function sync(options) {
|
|
|
8882
8477
|
}
|
|
8883
8478
|
return function(target, propertyKey) {
|
|
8884
8479
|
const privatePropertyKey = `__${propertyKey}`;
|
|
8480
|
+
const getter = function() {
|
|
8481
|
+
return this[privatePropertyKey];
|
|
8482
|
+
};
|
|
8483
|
+
const setter = function(newVal) {
|
|
8484
|
+
this[privatePropertyKey] = type(newVal, propertyKey, {
|
|
8485
|
+
classType,
|
|
8486
|
+
persist: persist2,
|
|
8487
|
+
syncToClient,
|
|
8488
|
+
transform
|
|
8489
|
+
}, this);
|
|
8490
|
+
};
|
|
8885
8491
|
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"),
|
|
8492
|
+
get: getter,
|
|
8493
|
+
set: setter,
|
|
8897
8494
|
enumerable: true,
|
|
8898
8495
|
configurable: true
|
|
8899
8496
|
});
|
|
8900
8497
|
};
|
|
8901
8498
|
}
|
|
8902
|
-
__name$2(sync, "sync");
|
|
8903
8499
|
function id() {
|
|
8904
8500
|
return function(target, propertyKey) {
|
|
8905
8501
|
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
8906
8502
|
target.constructor._propertyMetadata.set("id", propertyKey);
|
|
8907
8503
|
};
|
|
8908
8504
|
}
|
|
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
8505
|
function connected() {
|
|
8926
8506
|
return function(target, propertyKey) {
|
|
8927
8507
|
if (!target.constructor._propertyMetadata) target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
@@ -8929,60 +8509,6 @@ function connected() {
|
|
|
8929
8509
|
sync({ persist: false })(target, propertyKey);
|
|
8930
8510
|
};
|
|
8931
8511
|
}
|
|
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
8512
|
function __decorateMetadata(k, v) {
|
|
8987
8513
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8988
8514
|
}
|
|
@@ -9105,6 +8631,7 @@ var RpgCommonPlayer = class {
|
|
|
9105
8631
|
this.componentsCenter = signal(null);
|
|
9106
8632
|
this.componentsLeft = signal(null);
|
|
9107
8633
|
this.componentsRight = signal(null);
|
|
8634
|
+
this._removeTransition = signal("");
|
|
9108
8635
|
this.isConnected = signal(false);
|
|
9109
8636
|
this._intendedDirection = null;
|
|
9110
8637
|
this._directionFixed = signal(false);
|
|
@@ -9223,6 +8750,9 @@ var RpgCommonPlayer = class {
|
|
|
9223
8750
|
getDirection() {
|
|
9224
8751
|
return this.direction();
|
|
9225
8752
|
}
|
|
8753
|
+
isEvent() {
|
|
8754
|
+
return false;
|
|
8755
|
+
}
|
|
9226
8756
|
};
|
|
9227
8757
|
__decorate([id(), __decorateMetadata("design:type", String)], RpgCommonPlayer.prototype, "id", void 0);
|
|
9228
8758
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "name", void 0);
|
|
@@ -9261,6 +8791,7 @@ __decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.
|
|
|
9261
8791
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "componentsCenter", void 0);
|
|
9262
8792
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "componentsLeft", void 0);
|
|
9263
8793
|
__decorate([sync(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "componentsRight", void 0);
|
|
8794
|
+
__decorate([sync({ persist: false }), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "_removeTransition", void 0);
|
|
9264
8795
|
__decorate([connected(), __decorateMetadata("design:type", Object)], RpgCommonPlayer.prototype, "isConnected", void 0);
|
|
9265
8796
|
(class Vector2 {
|
|
9266
8797
|
/**
|
|
@@ -9652,24 +9183,16 @@ function findModules(context, namespace) {
|
|
|
9652
9183
|
for (let key in context["values"]) if (key.endsWith("Module" + namespace)) modules.push(context["values"][key].values.get("__default__"));
|
|
9653
9184
|
return modules;
|
|
9654
9185
|
}
|
|
9655
|
-
var __defProp = Object.defineProperty;
|
|
9656
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
9657
|
-
value,
|
|
9658
|
-
configurable: true
|
|
9659
|
-
});
|
|
9660
9186
|
var DEFAULT_INSTANCE_KEY = "__default__";
|
|
9661
9187
|
function toTokenName(token) {
|
|
9662
9188
|
return typeof token === "function" ? token.name : token;
|
|
9663
9189
|
}
|
|
9664
|
-
__name(toTokenName, "toTokenName");
|
|
9665
9190
|
function toInstanceKey(name) {
|
|
9666
9191
|
return name ?? DEFAULT_INSTANCE_KEY;
|
|
9667
9192
|
}
|
|
9668
|
-
__name(toInstanceKey, "toInstanceKey");
|
|
9669
9193
|
function getRecord(context, token) {
|
|
9670
9194
|
return context.get("inject:" + toTokenName(token));
|
|
9671
9195
|
}
|
|
9672
|
-
__name(getRecord, "getRecord");
|
|
9673
9196
|
function ensureRecord(context, token) {
|
|
9674
9197
|
const key = "inject:" + toTokenName(token);
|
|
9675
9198
|
let record = context.get(key);
|
|
@@ -9681,7 +9204,6 @@ function ensureRecord(context, token) {
|
|
|
9681
9204
|
context.set(key, record);
|
|
9682
9205
|
return record;
|
|
9683
9206
|
}
|
|
9684
|
-
__name(ensureRecord, "ensureRecord");
|
|
9685
9207
|
function provide(context, token, value, options = {}) {
|
|
9686
9208
|
const record = ensureRecord(context, token);
|
|
9687
9209
|
const instanceKey = toInstanceKey(options.name);
|
|
@@ -9690,41 +9212,17 @@ function provide(context, token, value, options = {}) {
|
|
|
9690
9212
|
record.values.set(instanceKey, value);
|
|
9691
9213
|
return value;
|
|
9692
9214
|
}
|
|
9693
|
-
__name(provide, "provide");
|
|
9694
|
-
function isInjected(context, token, options = {}) {
|
|
9695
|
-
const record = getRecord(context, token);
|
|
9696
|
-
if (!record) return false;
|
|
9697
|
-
if (options.name) return record.injected.has(toInstanceKey(options.name));
|
|
9698
|
-
if (record.multi) return record.injected.size > 0;
|
|
9699
|
-
return record.injected.has(DEFAULT_INSTANCE_KEY);
|
|
9700
|
-
}
|
|
9701
|
-
__name(isInjected, "isInjected");
|
|
9702
|
-
function isProvided(context, token, options = {}) {
|
|
9703
|
-
const record = getRecord(context, token);
|
|
9704
|
-
if (!record) return false;
|
|
9705
|
-
if (options.name) return record.values.has(toInstanceKey(options.name));
|
|
9706
|
-
if (record.multi) return record.values.size > 0;
|
|
9707
|
-
return record.values.has(DEFAULT_INSTANCE_KEY);
|
|
9708
|
-
}
|
|
9709
|
-
__name(isProvided, "isProvided");
|
|
9710
|
-
function hasInstance(context, token, options = {}) {
|
|
9711
|
-
return isProvided(context, token, options);
|
|
9712
|
-
}
|
|
9713
|
-
__name(hasInstance, "hasInstance");
|
|
9714
9215
|
function handleMissingInjection(token, options) {
|
|
9715
9216
|
const name = toTokenName(token);
|
|
9716
9217
|
if (options.name) throw new Error(`Injection provider ${name} with name ${options.name} not found`);
|
|
9717
9218
|
throw new Error(`Injection provider ${name} not found`);
|
|
9718
9219
|
}
|
|
9719
|
-
__name(handleMissingInjection, "handleMissingInjection");
|
|
9720
9220
|
function markInjected(record, key) {
|
|
9721
9221
|
record.injected.add(key);
|
|
9722
9222
|
}
|
|
9723
|
-
__name(markInjected, "markInjected");
|
|
9724
9223
|
function markAllInjected(record) {
|
|
9725
9224
|
for (const key of record.values.keys()) record.injected.add(key);
|
|
9726
9225
|
}
|
|
9727
|
-
__name(markAllInjected, "markAllInjected");
|
|
9728
9226
|
function inject$1(context, token, options = {}) {
|
|
9729
9227
|
const record = getRecord(context, token);
|
|
9730
9228
|
if (!record) {
|
|
@@ -9757,78 +9255,6 @@ function inject$1(context, token, options = {}) {
|
|
|
9757
9255
|
markInjected(record, DEFAULT_INSTANCE_KEY);
|
|
9758
9256
|
return value;
|
|
9759
9257
|
}
|
|
9760
|
-
__name(inject$1, "inject");
|
|
9761
|
-
function override(providers, newProvider, options) {
|
|
9762
|
-
let { upsert = false, key } = options ?? {};
|
|
9763
|
-
if (!key) key = typeof newProvider === "function" ? newProvider.name : newProvider.provide;
|
|
9764
|
-
const flatProviders = providers.flat();
|
|
9765
|
-
const exists = flatProviders.some((provider) => {
|
|
9766
|
-
if (typeof provider === "function") return provider.name === key;
|
|
9767
|
-
else if (typeof provider === "object") return provider.provide === key;
|
|
9768
|
-
return false;
|
|
9769
|
-
});
|
|
9770
|
-
const mappedProviders = flatProviders.map((provider) => {
|
|
9771
|
-
if (typeof provider === "function" && provider.name === key) return newProvider;
|
|
9772
|
-
else if (typeof provider === "object" && provider.provide === key) return newProvider;
|
|
9773
|
-
return provider;
|
|
9774
|
-
});
|
|
9775
|
-
if (upsert && !exists) mappedProviders.push(newProvider);
|
|
9776
|
-
return mappedProviders;
|
|
9777
|
-
}
|
|
9778
|
-
__name(override, "override");
|
|
9779
|
-
function findProviders(providers, name) {
|
|
9780
|
-
const results = [];
|
|
9781
|
-
for (const provider of providers) if (Array.isArray(provider)) results.push(...findProviders(provider, name));
|
|
9782
|
-
else if (findProvider(provider, name)) results.push(provider);
|
|
9783
|
-
return results;
|
|
9784
|
-
}
|
|
9785
|
-
__name(findProviders, "findProviders");
|
|
9786
|
-
function findProvider(providers, name) {
|
|
9787
|
-
if (!Array.isArray(providers)) {
|
|
9788
|
-
if (typeof providers === "object" && "provide" in providers) {
|
|
9789
|
-
const provider = providers;
|
|
9790
|
-
const providerName = typeof provider.provide === "function" ? provider.provide.name : provider.provide;
|
|
9791
|
-
if (name instanceof RegExp) {
|
|
9792
|
-
if (name.test(providerName)) return providers;
|
|
9793
|
-
} else if (providerName === name) return providers;
|
|
9794
|
-
}
|
|
9795
|
-
return null;
|
|
9796
|
-
}
|
|
9797
|
-
for (const provider of providers) {
|
|
9798
|
-
if (Array.isArray(provider)) {
|
|
9799
|
-
const found = findProvider(provider, name);
|
|
9800
|
-
if (found) return found;
|
|
9801
|
-
continue;
|
|
9802
|
-
}
|
|
9803
|
-
if (typeof provider === "object" && "provide" in provider) {
|
|
9804
|
-
const providerName = typeof provider.provide === "function" ? provider.provide.name : provider.provide;
|
|
9805
|
-
if (name instanceof RegExp) {
|
|
9806
|
-
if (name.test(providerName)) return provider;
|
|
9807
|
-
} else if (providerName === name) return provider;
|
|
9808
|
-
}
|
|
9809
|
-
}
|
|
9810
|
-
return null;
|
|
9811
|
-
}
|
|
9812
|
-
__name(findProvider, "findProvider");
|
|
9813
|
-
function processProvider(mergedConfig, baseConfig, provider) {
|
|
9814
|
-
if (Array.isArray(provider)) {
|
|
9815
|
-
for (const nestedProvider of provider) processProvider(mergedConfig, baseConfig, nestedProvider);
|
|
9816
|
-
return;
|
|
9817
|
-
}
|
|
9818
|
-
if (findProvider(baseConfig.providers, provider.provide)) mergedConfig.providers = override(mergedConfig.providers, provider);
|
|
9819
|
-
else mergedConfig.providers.push(provider);
|
|
9820
|
-
}
|
|
9821
|
-
__name(processProvider, "processProvider");
|
|
9822
|
-
function mergeConfig(baseConfig, config) {
|
|
9823
|
-
const mergedConfig = {
|
|
9824
|
-
...baseConfig,
|
|
9825
|
-
...config,
|
|
9826
|
-
providers: [...baseConfig.providers]
|
|
9827
|
-
};
|
|
9828
|
-
for (const provider of config.providers) processProvider(mergedConfig, baseConfig, provider);
|
|
9829
|
-
return mergedConfig;
|
|
9830
|
-
}
|
|
9831
|
-
__name(mergeConfig, "mergeConfig");
|
|
9832
9258
|
function extractProvideOptions(source) {
|
|
9833
9259
|
if (!source) return;
|
|
9834
9260
|
const { multi, name } = source;
|
|
@@ -9838,14 +9264,12 @@ function extractProvideOptions(source) {
|
|
|
9838
9264
|
name
|
|
9839
9265
|
};
|
|
9840
9266
|
}
|
|
9841
|
-
__name(extractProvideOptions, "extractProvideOptions");
|
|
9842
9267
|
function getDeps(provider) {
|
|
9843
9268
|
if (typeof provider === "function") return provider.deps ?? [];
|
|
9844
9269
|
return provider.deps ?? [];
|
|
9845
9270
|
}
|
|
9846
|
-
__name(getDeps, "getDeps");
|
|
9847
9271
|
function sortProviders(providers) {
|
|
9848
|
-
const tokenName =
|
|
9272
|
+
const tokenName = (t) => typeof t === "function" ? t.name : t;
|
|
9849
9273
|
const map = /* @__PURE__ */ new Map();
|
|
9850
9274
|
for (const p of providers) {
|
|
9851
9275
|
const token = tokenName(typeof p === "function" ? p : p.provide);
|
|
@@ -9856,7 +9280,7 @@ function sortProviders(providers) {
|
|
|
9856
9280
|
const result = [];
|
|
9857
9281
|
const visited = /* @__PURE__ */ new Set();
|
|
9858
9282
|
const stack = /* @__PURE__ */ new Set();
|
|
9859
|
-
const visit =
|
|
9283
|
+
const visit = (token) => {
|
|
9860
9284
|
const name = tokenName(token);
|
|
9861
9285
|
if (visited.has(name)) return;
|
|
9862
9286
|
if (stack.has(name)) throw new Error(`Circular dependency detected for provider ${name}`);
|
|
@@ -9870,11 +9294,10 @@ function sortProviders(providers) {
|
|
|
9870
9294
|
visited.add(name);
|
|
9871
9295
|
}
|
|
9872
9296
|
stack.delete(name);
|
|
9873
|
-
}
|
|
9297
|
+
};
|
|
9874
9298
|
for (const p of providers) visit(typeof p === "function" ? p : p.provide);
|
|
9875
9299
|
return result;
|
|
9876
9300
|
}
|
|
9877
|
-
__name(sortProviders, "sortProviders");
|
|
9878
9301
|
async function injector(context, providers) {
|
|
9879
9302
|
providers = providers.flat();
|
|
9880
9303
|
providers = sortProviders(providers);
|
|
@@ -9900,13 +9323,11 @@ async function injector(context, providers) {
|
|
|
9900
9323
|
provide(context, token, instance, options);
|
|
9901
9324
|
}
|
|
9902
9325
|
}
|
|
9903
|
-
__name(injector, "injector");
|
|
9904
9326
|
var Context = class {
|
|
9905
|
-
|
|
9906
|
-
|
|
9327
|
+
constructor() {
|
|
9328
|
+
/** Internal storage for injected values */
|
|
9329
|
+
this.values = {};
|
|
9907
9330
|
}
|
|
9908
|
-
/** Internal storage for injected values */
|
|
9909
|
-
values = {};
|
|
9910
9331
|
/**
|
|
9911
9332
|
* Sets a value in the context
|
|
9912
9333
|
* @param key - Unique identifier for the value
|
|
@@ -10006,8 +9427,17 @@ function getTiledBasePaths(paths) {
|
|
|
10006
9427
|
function resolveMapUpdateToken(explicitToken) {
|
|
10007
9428
|
return explicitToken ?? readEnvVariable$1("RPGJS_MAP_UPDATE_TOKEN") ?? "";
|
|
10008
9429
|
}
|
|
9430
|
+
function normalizeMapUpdateHeaders(init) {
|
|
9431
|
+
if (!init) return void 0;
|
|
9432
|
+
if (init instanceof Headers || Array.isArray(init)) return init;
|
|
9433
|
+
if (init instanceof Map) return Array.from(init.entries()).filter((entry) => entry[1] !== void 0);
|
|
9434
|
+
return Object.entries(init).flatMap(([key, value]) => {
|
|
9435
|
+
if (value === void 0) return [];
|
|
9436
|
+
return Array.isArray(value) ? value.map((item) => [key, item]) : [[key, value]];
|
|
9437
|
+
});
|
|
9438
|
+
}
|
|
10009
9439
|
function createMapUpdateHeaders(token, init) {
|
|
10010
|
-
const headers = new Headers(init);
|
|
9440
|
+
const headers = new Headers(normalizeMapUpdateHeaders(init));
|
|
10011
9441
|
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
10012
9442
|
const resolvedToken = resolveMapUpdateToken(token);
|
|
10013
9443
|
if (resolvedToken) headers.set(MAP_UPDATE_TOKEN_HEADER, resolvedToken);
|