@rpgjs/client 5.0.0-alpha.10 → 5.0.0-alpha.12
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/Game/Map.d.ts +4 -0
- package/dist/Gui/Gui.d.ts +128 -5
- package/dist/RpgClient.d.ts +35 -5
- package/dist/RpgClientEngine.d.ts +3 -0
- package/dist/components/gui/index.d.ts +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/index10.js +150 -4
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +20 -7
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +6 -8
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +11 -14
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +8 -100
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +141 -35
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +42 -0
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +48 -7
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +5 -383
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +384 -28
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +32 -13
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +31 -17
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +17 -2413
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +2587 -88
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +108 -103
- package/dist/index23.js.map +1 -1
- package/dist/index29.js +22 -3
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +1 -318
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +332 -24
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +24 -8
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +4 -4
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +8 -9
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +9 -4400
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +4394 -307
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +307 -165
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +162 -489
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +496 -56
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.js +67 -10
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +16 -78
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +96 -0
- package/dist/index42.js.map +1 -0
- package/dist/index9.js +228 -14
- package/dist/index9.js.map +1 -1
- package/dist/presets/faceset.d.ts +30 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/services/mmorpg.d.ts +1 -1
- package/dist/services/standalone.d.ts +1 -1
- package/package.json +7 -5
- package/src/Game/AnimationManager.ts +1 -0
- package/src/Game/Map.ts +9 -1
- package/src/Game/Object.ts +28 -6
- package/src/Gui/Gui.ts +300 -17
- package/src/RpgClient.ts +36 -5
- package/src/RpgClientEngine.ts +32 -9
- package/src/components/character.ce +11 -9
- package/src/components/gui/box.ce +17 -0
- package/src/components/gui/dialogbox/index.ce +74 -35
- package/src/components/gui/dialogbox/selection.ce +16 -1
- package/src/components/gui/index.ts +3 -4
- package/src/components/scenes/event-layer.ce +6 -0
- package/src/index.ts +3 -1
- package/src/presets/faceset.ts +60 -0
- package/src/presets/index.ts +3 -1
package/dist/index23.js
CHANGED
|
@@ -1,109 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { __name } from './index30.js';
|
|
2
|
+
import { load } from './index19.js';
|
|
3
|
+
import { PartySocket } from './index38.js';
|
|
4
|
+
import './index39.js';
|
|
5
5
|
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var texts = [message()];
|
|
15
|
-
var height = signal(250);
|
|
16
|
-
var isTextCompleted = signal(false);
|
|
17
|
-
var border = signal({ width: 5, color: "#595971" });
|
|
18
|
-
var shadow = signal({ color: "#000", blur: 10, offsetX: 10, offsetY: 10 });
|
|
19
|
-
var contentOpacity = animatedSignal(0, {
|
|
20
|
-
duration: 1000,
|
|
21
|
-
});
|
|
22
|
-
var scaleX = animatedSignal(0, {
|
|
23
|
-
duration: 500,
|
|
24
|
-
});
|
|
25
|
-
scaleX.set(1);
|
|
26
|
-
contentOpacity.set(1);
|
|
27
|
-
var currentTextIndex = signal(0);
|
|
28
|
-
var currentText = computed(function () { var _a; return (_a = texts === null || texts === void 0 ? void 0 : texts[currentTextIndex()]) !== null && _a !== void 0 ? _a : ''; });
|
|
29
|
-
var isChoiceDisplayed = signal(false);
|
|
30
|
-
var text = computed(function () {
|
|
31
|
-
var current = currentText();
|
|
32
|
-
return typeof current === "string" ? current : current.text;
|
|
33
|
-
});
|
|
34
|
-
var choices = computed(function () {
|
|
35
|
-
//const current = currentText();
|
|
36
|
-
//return typeof current === "string" ? null : current.choices;
|
|
37
|
-
return _choices;
|
|
38
|
-
});
|
|
39
|
-
var visibleSelection = computed(function () { return isChoiceDisplayed() && choices().length != 0; });
|
|
40
|
-
var triggerSkip = trigger();
|
|
41
|
-
var typewriter = {
|
|
42
|
-
speed: 0.3,
|
|
43
|
-
skip: triggerSkip,
|
|
44
|
-
onComplete: function () {
|
|
45
|
-
isTextCompleted.set(true);
|
|
6
|
+
function createConnection(options, roomInstance) {
|
|
7
|
+
const conn = new PartySocket(options);
|
|
8
|
+
conn.addEventListener("message", (event) => {
|
|
9
|
+
const object = JSON.parse(event.data);
|
|
10
|
+
switch (object.type) {
|
|
11
|
+
case "sync":
|
|
12
|
+
load(roomInstance, object.value, true);
|
|
13
|
+
break;
|
|
46
14
|
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
emit: /* @__PURE__ */ __name((key, value) => {
|
|
18
|
+
conn.send(JSON.stringify({
|
|
19
|
+
action: key,
|
|
20
|
+
value
|
|
21
|
+
}));
|
|
22
|
+
}, "emit"),
|
|
23
|
+
on: /* @__PURE__ */ __name((key, cb) => {
|
|
24
|
+
conn.addEventListener("message", (event) => {
|
|
25
|
+
const object = JSON.parse(event.data);
|
|
26
|
+
if (object.type === key) {
|
|
27
|
+
cb(object.value);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, "on"),
|
|
31
|
+
off: /* @__PURE__ */ __name((key, cb) => {
|
|
32
|
+
conn.removeEventListener("message", (event) => {
|
|
33
|
+
const object = JSON.parse(event.data);
|
|
34
|
+
if (object.type === key) {
|
|
35
|
+
cb(object.value);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}, "off"),
|
|
39
|
+
close: /* @__PURE__ */ __name(() => conn.close(), "close"),
|
|
40
|
+
conn
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
__name(createConnection, "createConnection");
|
|
44
|
+
async function connectionRoom(options, roomInstance) {
|
|
45
|
+
return createConnection(options, roomInstance);
|
|
46
|
+
}
|
|
47
|
+
__name(connectionRoom, "connectionRoom");
|
|
48
|
+
async function connectionWorld(options, roomInstance) {
|
|
49
|
+
const shardInfo = await getOptimalShard(options);
|
|
50
|
+
const result = createConnection({
|
|
51
|
+
...options,
|
|
52
|
+
party: "shard",
|
|
53
|
+
room: shardInfo.url
|
|
54
|
+
}, roomInstance);
|
|
55
|
+
return {
|
|
56
|
+
...result,
|
|
57
|
+
shardInfo
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
__name(connectionWorld, "connectionWorld");
|
|
61
|
+
async function getOptimalShard(worldOptions) {
|
|
62
|
+
const {
|
|
63
|
+
host,
|
|
64
|
+
room,
|
|
65
|
+
worldId = "world-default",
|
|
66
|
+
retryCount = 3,
|
|
67
|
+
retryDelay = 1e3,
|
|
68
|
+
autoCreate = true
|
|
69
|
+
// Default to true for auto-creation
|
|
70
|
+
} = worldOptions;
|
|
71
|
+
let attempts = 0;
|
|
72
|
+
const url = new URL(`${host}/parties/world/${encodeURIComponent(worldId)}/connect`);
|
|
73
|
+
const requestUrl = url.toString();
|
|
74
|
+
while (attempts < retryCount) {
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(requestUrl, {
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers: {
|
|
79
|
+
"Content-Type": "application/json"
|
|
93
80
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
|
|
81
|
+
body: JSON.stringify({
|
|
82
|
+
roomId: room,
|
|
83
|
+
autoCreate
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
const errorData = await response.json().catch(() => ({
|
|
88
|
+
error: "Unknown error"
|
|
89
|
+
}));
|
|
90
|
+
throw new Error(`World service returned ${response.status}: ${errorData.error || "Unknown error"}`);
|
|
91
|
+
}
|
|
92
|
+
const data = await response.json();
|
|
93
|
+
if (!data.url || !data.shardId) {
|
|
94
|
+
throw new Error("Invalid response from World service: missing url or shardId");
|
|
106
95
|
}
|
|
96
|
+
return {
|
|
97
|
+
shardId: data.shardId,
|
|
98
|
+
url: data.url
|
|
99
|
+
};
|
|
100
|
+
} catch (error) {
|
|
101
|
+
attempts++;
|
|
102
|
+
if (attempts >= retryCount) {
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
console.warn(`Failed to get shard (attempt ${attempts}/${retryCount}). Retrying in ${retryDelay}ms...`);
|
|
106
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
throw new Error("Failed to get shard after all retry attempts");
|
|
110
|
+
}
|
|
111
|
+
__name(getOptimalShard, "getOptimalShard");
|
|
107
112
|
|
|
108
|
-
export {
|
|
113
|
+
export { PartySocket, connectionRoom, connectionWorld };
|
|
109
114
|
//# sourceMappingURL=index23.js.map
|
package/dist/index23.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index23.js","sources":["
|
|
1
|
+
{"version":3,"file":"index23.js","sources":["../../../node_modules/.pnpm/@signe+sync@2.4.0/node_modules/@signe/sync/dist/client/index.js"],"sourcesContent":["import {\n __name\n} from \"../chunk-7QVYU63E.js\";\n\n// src/client/index.ts\nimport { load } from \"@signe/sync\";\nimport PartySocket from \"partysocket\";\nfunction createConnection(options, roomInstance) {\n const conn = new PartySocket(options);\n conn.addEventListener(\"message\", (event) => {\n const object = JSON.parse(event.data);\n switch (object.type) {\n case \"sync\":\n load(roomInstance, object.value, true);\n break;\n }\n });\n return {\n emit: /* @__PURE__ */ __name((key, value) => {\n conn.send(JSON.stringify({\n action: key,\n value\n }));\n }, \"emit\"),\n on: /* @__PURE__ */ __name((key, cb) => {\n conn.addEventListener(\"message\", (event) => {\n const object = JSON.parse(event.data);\n if (object.type === key) {\n cb(object.value);\n }\n });\n }, \"on\"),\n off: /* @__PURE__ */ __name((key, cb) => {\n conn.removeEventListener(\"message\", (event) => {\n const object = JSON.parse(event.data);\n if (object.type === key) {\n cb(object.value);\n }\n });\n }, \"off\"),\n close: /* @__PURE__ */ __name(() => conn.close(), \"close\"),\n conn\n };\n}\n__name(createConnection, \"createConnection\");\nasync function connectionRoom(options, roomInstance) {\n return createConnection(options, roomInstance);\n}\n__name(connectionRoom, \"connectionRoom\");\nasync function connectionWorld(options, roomInstance) {\n const shardInfo = await getOptimalShard(options);\n const result = createConnection({\n ...options,\n party: \"shard\",\n room: shardInfo.url\n }, roomInstance);\n return {\n ...result,\n shardInfo\n };\n}\n__name(connectionWorld, \"connectionWorld\");\nasync function getOptimalShard(worldOptions) {\n const {\n host,\n room,\n worldId = \"world-default\",\n retryCount = 3,\n retryDelay = 1e3,\n autoCreate = true\n // Default to true for auto-creation\n } = worldOptions;\n let attempts = 0;\n const url = new URL(`${host}/parties/world/${encodeURIComponent(worldId)}/connect`);\n const requestUrl = url.toString();\n while (attempts < retryCount) {\n try {\n const response = await fetch(requestUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n roomId: room,\n autoCreate\n })\n });\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({\n error: \"Unknown error\"\n }));\n throw new Error(`World service returned ${response.status}: ${errorData.error || \"Unknown error\"}`);\n }\n const data = await response.json();\n if (!data.url || !data.shardId) {\n throw new Error(\"Invalid response from World service: missing url or shardId\");\n }\n return {\n shardId: data.shardId,\n url: data.url\n };\n } catch (error) {\n attempts++;\n if (attempts >= retryCount) {\n throw error;\n }\n console.warn(`Failed to get shard (attempt ${attempts}/${retryCount}). Retrying in ${retryDelay}ms...`);\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n }\n }\n throw new Error(\"Failed to get shard after all retry attempts\");\n}\n__name(getOptimalShard, \"getOptimalShard\");\nexport {\n PartySocket,\n connectionRoom,\n connectionWorld\n};\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";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B;AACA,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;AAC7G,MAAM,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACrE;AACA;AACA,EAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;AACjE;AACA,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC;;;;","x_google_ignoreList":[0]}
|
package/dist/index29.js
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const FacesetPreset = (options, framesWidth, framesHeight, expressions) => {
|
|
2
|
+
const textures = {};
|
|
3
|
+
Object.keys(expressions).forEach((expressionName) => {
|
|
4
|
+
const [frameX, frameY] = expressions[expressionName];
|
|
5
|
+
textures[expressionName] = {
|
|
6
|
+
animations: () => [
|
|
7
|
+
[{
|
|
8
|
+
time: 0,
|
|
9
|
+
frameX,
|
|
10
|
+
frameY
|
|
11
|
+
}]
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
...options,
|
|
17
|
+
framesWidth,
|
|
18
|
+
framesHeight,
|
|
19
|
+
textures
|
|
20
|
+
};
|
|
21
|
+
};
|
|
3
22
|
|
|
4
|
-
export {
|
|
23
|
+
export { FacesetPreset };
|
|
5
24
|
//# sourceMappingURL=index29.js.map
|
package/dist/index29.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index29.js","sources":["
|
|
1
|
+
{"version":3,"file":"index29.js","sources":["../src/presets/faceset.ts"],"sourcesContent":["/**\n * Creates a faceset preset for character expressions\n * \n * This preset allows you to define multiple facial expressions for a character,\n * where each expression corresponds to a specific frame position (frameX, frameY)\n * within a single faceset texture. Each expression is defined by its position\n * in the faceset grid.\n * \n * @param options - Object containing the faceset configuration\n * @param framesWidth - Number of frames horizontally in the faceset texture\n * @param framesHeight - Number of frames vertically in the faceset texture\n * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]\n * @returns Faceset configuration with animations for each expression\n * \n * @example\n * ```typescript\n * const faceset = FacesetPreset({\n * id: \"facesetId\",\n * image: \"faceset.png\",\n * width: 1024,\n * height: 1024,\n * }, 4, 2, {\n * happy: [0, 0],\n * sad: [1, 0],\n * angry: [2, 0],\n * surprised: [3, 0]\n * });\n * ```\n */\nexport const FacesetPreset = (\n options: any,\n framesWidth: number, \n framesHeight: number,\n expressions: Record<string, [number, number]>,\n) => {\n \n const textures: Record<string, any> = {};\n \n // Create texture configuration for each expression\n Object.keys(expressions).forEach((expressionName) => {\n const [frameX, frameY] = expressions[expressionName];\n textures[expressionName] = {\n animations: () => [\n [{ \n time: 0, \n frameX: frameX, \n frameY: frameY \n }]\n ],\n };\n });\n \n return {\n ...options,\n framesWidth,\n framesHeight,\n textures\n };\n};\n "],"names":[],"mappings":"AA6BO,MAAM,aAAgB,GAAA,CACzB,OACA,EAAA,WAAA,EACA,cACA,WACC,KAAA;AAED,EAAA,MAAM,WAAgC,EAAC;AAGvC,EAAA,MAAA,CAAO,IAAK,CAAA,WAAW,CAAE,CAAA,OAAA,CAAQ,CAAC,cAAmB,KAAA;AACjD,IAAA,MAAM,CAAC,MAAA,EAAQ,MAAM,CAAA,GAAI,YAAY,cAAc,CAAA;AACnD,IAAA,QAAA,CAAS,cAAc,CAAI,GAAA;AAAA,MACvB,YAAY,MAAM;AAAA,QACd,CAAC;AAAA,UACG,IAAM,EAAA,CAAA;AAAA,UACN,MAAA;AAAA,UACA;AAAA,SACH;AAAA;AACL,KACJ;AAAA,GACH,CAAA;AAED,EAAO,OAAA;AAAA,IACH,GAAG,OAAA;AAAA,IACH,WAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
|
package/dist/index3.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebSocketToken, AbstractWebsocket } from './
|
|
2
|
-
import { ServerIo, ClientIo } from './
|
|
1
|
+
import { WebSocketToken, AbstractWebsocket } from './index18.js';
|
|
2
|
+
import { ServerIo, ClientIo } from './index22.js';
|
|
3
3
|
import { RpgClientEngine } from './index2.js';
|
|
4
4
|
import { UpdateMapToken, UpdateMapService } from '@rpgjs/common';
|
|
5
5
|
import { RpgGui } from './index9.js';
|
package/dist/index30.js
CHANGED
|
@@ -1,322 +1,5 @@
|
|
|
1
|
-
import { BehaviorSubject, filter, combineLatest, map, finalize } from 'rxjs';
|
|
2
|
-
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
var ArraySubject = class extends BehaviorSubject {
|
|
6
|
-
static {
|
|
7
|
-
__name(this, "ArraySubject");
|
|
8
|
-
}
|
|
9
|
-
_items = [];
|
|
10
|
-
constructor(items = []) {
|
|
11
|
-
super({
|
|
12
|
-
type: "init",
|
|
13
|
-
items
|
|
14
|
-
});
|
|
15
|
-
this.createProxy(items);
|
|
16
|
-
}
|
|
17
|
-
createProxy(items) {
|
|
18
|
-
this._items = new Proxy(items, {
|
|
19
|
-
get: /* @__PURE__ */ __name((target, prop, receiver) => {
|
|
20
|
-
const origMethod = target[prop];
|
|
21
|
-
if (typeof origMethod === "function") {
|
|
22
|
-
return (...args) => {
|
|
23
|
-
let changeType = "update";
|
|
24
|
-
let index = void 0;
|
|
25
|
-
let isMutateFn = false;
|
|
26
|
-
let itemsToEmit = [];
|
|
27
|
-
let changeSplice = true;
|
|
28
|
-
switch (prop) {
|
|
29
|
-
case "push":
|
|
30
|
-
index = target.length;
|
|
31
|
-
changeType = "add";
|
|
32
|
-
isMutateFn = true;
|
|
33
|
-
break;
|
|
34
|
-
case "pop":
|
|
35
|
-
index = target.length - 1;
|
|
36
|
-
changeType = "remove";
|
|
37
|
-
isMutateFn = true;
|
|
38
|
-
break;
|
|
39
|
-
case "unshift":
|
|
40
|
-
index = 0;
|
|
41
|
-
changeType = "add";
|
|
42
|
-
isMutateFn = true;
|
|
43
|
-
break;
|
|
44
|
-
case "shift":
|
|
45
|
-
index = 0;
|
|
46
|
-
changeType = "remove";
|
|
47
|
-
isMutateFn = true;
|
|
48
|
-
break;
|
|
49
|
-
case "splice":
|
|
50
|
-
index = args[0];
|
|
51
|
-
const deleteCount = args[1];
|
|
52
|
-
const newItems = args.slice(2);
|
|
53
|
-
itemsToEmit = newItems;
|
|
54
|
-
if (deleteCount > 0 && newItems.length === 0) {
|
|
55
|
-
changeType = "remove";
|
|
56
|
-
} else if (deleteCount === 0 && newItems.length > 0) {
|
|
57
|
-
changeType = "add";
|
|
58
|
-
} else if (deleteCount === 0 && newItems.length === 0) {
|
|
59
|
-
changeSplice = false;
|
|
60
|
-
} else {
|
|
61
|
-
changeType = "update";
|
|
62
|
-
}
|
|
63
|
-
isMutateFn = true;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
const result = origMethod.apply(target, args);
|
|
67
|
-
if (isMutateFn && changeSplice) {
|
|
68
|
-
if (prop === "splice") {
|
|
69
|
-
this.next({
|
|
70
|
-
type: changeType,
|
|
71
|
-
index,
|
|
72
|
-
items: itemsToEmit
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
this.next({
|
|
76
|
-
type: changeType,
|
|
77
|
-
index,
|
|
78
|
-
items: args
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return Reflect.get(target, prop, receiver);
|
|
86
|
-
}, "get"),
|
|
87
|
-
set: /* @__PURE__ */ __name((target, prop, value) => {
|
|
88
|
-
const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
|
|
89
|
-
target[prop] = value;
|
|
90
|
-
this.next({
|
|
91
|
-
type: "update",
|
|
92
|
-
index,
|
|
93
|
-
items: [
|
|
94
|
-
value
|
|
95
|
-
]
|
|
96
|
-
});
|
|
97
|
-
return true;
|
|
98
|
-
}, "set")
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
get items() {
|
|
102
|
-
return this._items;
|
|
103
|
-
}
|
|
104
|
-
set items(newItems) {
|
|
105
|
-
this.createProxy(newItems);
|
|
106
|
-
this.next({
|
|
107
|
-
type: "reset",
|
|
108
|
-
items: newItems
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
var isArraySubject = /* @__PURE__ */ __name((value) => {
|
|
113
|
-
return "_items" in value;
|
|
114
|
-
}, "isArraySubject");
|
|
115
|
-
var ObjectSubject = class extends BehaviorSubject {
|
|
116
|
-
static {
|
|
117
|
-
__name(this, "ObjectSubject");
|
|
118
|
-
}
|
|
119
|
-
_obj;
|
|
120
|
-
constructor(obj = {}) {
|
|
121
|
-
super({
|
|
122
|
-
type: "init",
|
|
123
|
-
value: obj
|
|
124
|
-
});
|
|
125
|
-
this.createProxy(obj);
|
|
126
|
-
}
|
|
127
|
-
createProxy(obj) {
|
|
128
|
-
this._obj = new Proxy(obj, {
|
|
129
|
-
get: /* @__PURE__ */ __name((target, prop, receiver) => {
|
|
130
|
-
return Reflect.get(target, prop, receiver);
|
|
131
|
-
}, "get"),
|
|
132
|
-
set: /* @__PURE__ */ __name((target, prop, value, receiver) => {
|
|
133
|
-
const key = prop;
|
|
134
|
-
const changeType = key in target ? "update" : "add";
|
|
135
|
-
target[key] = value;
|
|
136
|
-
this.next({
|
|
137
|
-
type: changeType,
|
|
138
|
-
key,
|
|
139
|
-
value
|
|
140
|
-
});
|
|
141
|
-
return true;
|
|
142
|
-
}, "set"),
|
|
143
|
-
deleteProperty: /* @__PURE__ */ __name((target, prop) => {
|
|
144
|
-
const key = prop;
|
|
145
|
-
if (key in target) {
|
|
146
|
-
const value = target[key];
|
|
147
|
-
delete target[key];
|
|
148
|
-
this.next({
|
|
149
|
-
type: "remove",
|
|
150
|
-
key,
|
|
151
|
-
value
|
|
152
|
-
});
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}, "deleteProperty")
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
get obj() {
|
|
160
|
-
return this._obj;
|
|
161
|
-
}
|
|
162
|
-
set obj(newObj) {
|
|
163
|
-
this.createProxy(newObj);
|
|
164
|
-
this.next({
|
|
165
|
-
type: "reset",
|
|
166
|
-
value: newObj
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
var isObjectSubject = /* @__PURE__ */ __name((value) => {
|
|
171
|
-
return "_obj" in value;
|
|
172
|
-
}, "isObjectSubject");
|
|
173
|
-
var getGlobalReactiveStore = /* @__PURE__ */ __name(() => {
|
|
174
|
-
const globalKey = "__REACTIVE_STORE__";
|
|
175
|
-
if (typeof globalThis !== "undefined") {
|
|
176
|
-
if (!globalThis[globalKey]) {
|
|
177
|
-
globalThis[globalKey] = {
|
|
178
|
-
currentDependencyTracker: null,
|
|
179
|
-
currentSubscriptionsTracker: null
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
return globalThis[globalKey];
|
|
183
|
-
}
|
|
184
|
-
let globalObj;
|
|
185
|
-
if (typeof window !== "undefined") {
|
|
186
|
-
globalObj = window;
|
|
187
|
-
} else if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
188
|
-
globalObj = Function("return this")();
|
|
189
|
-
} else if (typeof self !== "undefined") {
|
|
190
|
-
globalObj = self;
|
|
191
|
-
} else {
|
|
192
|
-
console.warn("Unable to find global object, using local instance");
|
|
193
|
-
return {
|
|
194
|
-
currentDependencyTracker: null,
|
|
195
|
-
currentSubscriptionsTracker: null
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (!globalObj[globalKey]) {
|
|
199
|
-
globalObj[globalKey] = {
|
|
200
|
-
currentDependencyTracker: null,
|
|
201
|
-
currentSubscriptionsTracker: null
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return globalObj[globalKey];
|
|
205
|
-
}, "getGlobalReactiveStore");
|
|
206
|
-
var reactiveStore = getGlobalReactiveStore();
|
|
207
|
-
var trackDependency = /* @__PURE__ */ __name((signal2) => {
|
|
208
|
-
if (reactiveStore.currentDependencyTracker) {
|
|
209
|
-
reactiveStore.currentDependencyTracker(signal2);
|
|
210
|
-
}
|
|
211
|
-
}, "trackDependency");
|
|
212
|
-
function signal(defaultValue) {
|
|
213
|
-
let subject;
|
|
214
|
-
if (Array.isArray(defaultValue)) {
|
|
215
|
-
subject = new ArraySubject(defaultValue);
|
|
216
|
-
} else if (typeof defaultValue === "object" && defaultValue !== null) {
|
|
217
|
-
subject = new ObjectSubject(defaultValue);
|
|
218
|
-
} else {
|
|
219
|
-
subject = new BehaviorSubject(defaultValue);
|
|
220
|
-
}
|
|
221
|
-
const getValue = /* @__PURE__ */ __name(() => {
|
|
222
|
-
if (subject instanceof ArraySubject) {
|
|
223
|
-
return subject.items;
|
|
224
|
-
} else if (subject instanceof ObjectSubject) {
|
|
225
|
-
return subject.obj;
|
|
226
|
-
}
|
|
227
|
-
return subject.value;
|
|
228
|
-
}, "getValue");
|
|
229
|
-
const fn = /* @__PURE__ */ __name(function() {
|
|
230
|
-
trackDependency(fn);
|
|
231
|
-
return getValue();
|
|
232
|
-
}, "fn");
|
|
233
|
-
fn.set = (value) => {
|
|
234
|
-
if (subject instanceof ArraySubject) {
|
|
235
|
-
subject.items = value;
|
|
236
|
-
} else if (subject instanceof ObjectSubject) {
|
|
237
|
-
subject.obj = value;
|
|
238
|
-
} else {
|
|
239
|
-
subject.next(value);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
fn._isFrozen = false;
|
|
243
|
-
fn.freeze = () => {
|
|
244
|
-
fn._isFrozen = true;
|
|
245
|
-
};
|
|
246
|
-
fn.unfreeze = () => {
|
|
247
|
-
fn._isFrozen = false;
|
|
248
|
-
if (subject instanceof ArraySubject) {
|
|
249
|
-
subject.next({
|
|
250
|
-
type: "init",
|
|
251
|
-
items: subject.items
|
|
252
|
-
});
|
|
253
|
-
} else if (subject instanceof ObjectSubject) {
|
|
254
|
-
subject.next({
|
|
255
|
-
type: "init",
|
|
256
|
-
value: subject.obj
|
|
257
|
-
});
|
|
258
|
-
} else {
|
|
259
|
-
subject.next(subject.value);
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
fn.mutate = (mutateFn) => {
|
|
263
|
-
const value = getValue();
|
|
264
|
-
mutateFn(value);
|
|
265
|
-
};
|
|
266
|
-
fn.update = (updateFn) => {
|
|
267
|
-
const updatedValue = updateFn(getValue());
|
|
268
|
-
fn.set(updatedValue);
|
|
269
|
-
};
|
|
270
|
-
fn.observable = subject.asObservable().pipe(filter(() => !fn._isFrozen));
|
|
271
|
-
fn._subject = subject;
|
|
272
|
-
return fn;
|
|
273
|
-
}
|
|
274
|
-
__name(signal, "signal");
|
|
275
|
-
function isSignal(value) {
|
|
276
|
-
return !!(value && value.observable);
|
|
277
|
-
}
|
|
278
|
-
__name(isSignal, "isSignal");
|
|
279
|
-
function isComputed(value) {
|
|
280
|
-
return isSignal(value) && !!value.dependencies;
|
|
281
|
-
}
|
|
282
|
-
__name(isComputed, "isComputed");
|
|
283
|
-
function computed(computeFunction, disposableFn) {
|
|
284
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
285
|
-
let init = true;
|
|
286
|
-
let lastComputedValue;
|
|
287
|
-
const previousTracker = reactiveStore.currentDependencyTracker;
|
|
288
|
-
reactiveStore.currentDependencyTracker = (signal2) => {
|
|
289
|
-
dependencies.add(signal2);
|
|
290
|
-
};
|
|
291
|
-
lastComputedValue = computeFunction();
|
|
292
|
-
if (computeFunction["isEffect"]) {
|
|
293
|
-
disposableFn = lastComputedValue;
|
|
294
|
-
}
|
|
295
|
-
reactiveStore.currentDependencyTracker = previousTracker;
|
|
296
|
-
const computedObservable = combineLatest([
|
|
297
|
-
...dependencies
|
|
298
|
-
].map((signal2) => signal2.observable)).pipe(filter(() => !init), map(() => computeFunction()), finalize(() => disposableFn?.()));
|
|
299
|
-
const fn = /* @__PURE__ */ __name(function() {
|
|
300
|
-
trackDependency(fn);
|
|
301
|
-
return lastComputedValue;
|
|
302
|
-
}, "fn");
|
|
303
|
-
fn.observable = computedObservable;
|
|
304
|
-
fn.subscription = computedObservable.subscribe((value) => {
|
|
305
|
-
lastComputedValue = value;
|
|
306
|
-
});
|
|
307
|
-
fn.dependencies = dependencies;
|
|
308
|
-
reactiveStore.currentSubscriptionsTracker?.(fn.subscription);
|
|
309
|
-
init = false;
|
|
310
|
-
return fn;
|
|
311
|
-
}
|
|
312
|
-
__name(computed, "computed");
|
|
313
|
-
|
|
314
|
-
// src/effect.ts
|
|
315
|
-
function effect(fn) {
|
|
316
|
-
fn["isEffect"] = true;
|
|
317
|
-
return computed(fn);
|
|
318
|
-
}
|
|
319
|
-
__name(effect, "effect");
|
|
320
3
|
|
|
321
|
-
export {
|
|
4
|
+
export { __name };
|
|
322
5
|
//# sourceMappingURL=index30.js.map
|