@react-remote-state/client 0.0.1
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.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +88 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +37 -0
package/dist/index.d.mts
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Game } from '@react-remote-state/types';
|
2
|
+
|
3
|
+
declare function getPlayer<GameCustom, PlayerCustom>(playerId?: string, game?: Game<GameCustom, PlayerCustom>): {
|
4
|
+
id: string;
|
5
|
+
host: boolean;
|
6
|
+
custom: PlayerCustom | undefined;
|
7
|
+
} | undefined;
|
8
|
+
declare function isHost<GameCustom, PlayerCustom>(playerId?: string, game?: Game<GameCustom, PlayerCustom>): boolean | undefined;
|
9
|
+
type Reducer<GameCustom, PlayerCustom, Action> = (game: Game<GameCustom, PlayerCustom>, action: Action, playerId: string) => Game<GameCustom, PlayerCustom>;
|
10
|
+
declare function useRemoteReducer<GameCustom, PlayerCustom, Action>(uri: string, reducer: Reducer<GameCustom, PlayerCustom, Action>, gameId?: string): [
|
11
|
+
Game<GameCustom, PlayerCustom> | undefined,
|
12
|
+
string | undefined,
|
13
|
+
(action: Action) => void
|
14
|
+
];
|
15
|
+
|
16
|
+
export { getPlayer, isHost, useRemoteReducer };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Game } from '@react-remote-state/types';
|
2
|
+
|
3
|
+
declare function getPlayer<GameCustom, PlayerCustom>(playerId?: string, game?: Game<GameCustom, PlayerCustom>): {
|
4
|
+
id: string;
|
5
|
+
host: boolean;
|
6
|
+
custom: PlayerCustom | undefined;
|
7
|
+
} | undefined;
|
8
|
+
declare function isHost<GameCustom, PlayerCustom>(playerId?: string, game?: Game<GameCustom, PlayerCustom>): boolean | undefined;
|
9
|
+
type Reducer<GameCustom, PlayerCustom, Action> = (game: Game<GameCustom, PlayerCustom>, action: Action, playerId: string) => Game<GameCustom, PlayerCustom>;
|
10
|
+
declare function useRemoteReducer<GameCustom, PlayerCustom, Action>(uri: string, reducer: Reducer<GameCustom, PlayerCustom, Action>, gameId?: string): [
|
11
|
+
Game<GameCustom, PlayerCustom> | undefined,
|
12
|
+
string | undefined,
|
13
|
+
(action: Action) => void
|
14
|
+
];
|
15
|
+
|
16
|
+
export { getPlayer, isHost, useRemoteReducer };
|
package/dist/index.js
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __defProps = Object.defineProperties;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
11
|
+
var __spreadValues = (a, b) => {
|
12
|
+
for (var prop in b || (b = {}))
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
15
|
+
if (__getOwnPropSymbols)
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
17
|
+
if (__propIsEnum.call(b, prop))
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
19
|
+
}
|
20
|
+
return a;
|
21
|
+
};
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
23
|
+
var __export = (target, all) => {
|
24
|
+
for (var name in all)
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
26
|
+
};
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
29
|
+
for (let key of __getOwnPropNames(from))
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
32
|
+
}
|
33
|
+
return to;
|
34
|
+
};
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
36
|
+
|
37
|
+
// src/index.ts
|
38
|
+
var src_exports = {};
|
39
|
+
__export(src_exports, {
|
40
|
+
getPlayer: () => getPlayer,
|
41
|
+
isHost: () => isHost,
|
42
|
+
useRemoteReducer: () => useRemoteReducer
|
43
|
+
});
|
44
|
+
module.exports = __toCommonJS(src_exports);
|
45
|
+
var import_react = require("react");
|
46
|
+
var import_socket = require("socket.io-client");
|
47
|
+
function getPlayer(playerId, game) {
|
48
|
+
if (!game || !playerId) {
|
49
|
+
return void 0;
|
50
|
+
}
|
51
|
+
return game.players.find((player) => player.id == playerId);
|
52
|
+
}
|
53
|
+
function isHost(playerId, game) {
|
54
|
+
let player = getPlayer(playerId, game);
|
55
|
+
return player == null ? void 0 : player.host;
|
56
|
+
}
|
57
|
+
function useRemoteReducer(uri, reducer, gameId) {
|
58
|
+
let [meta, setMeta] = (0, import_react.useState)({
|
59
|
+
isHostReady: false
|
60
|
+
});
|
61
|
+
let [game, setGame] = (0, import_react.useState)();
|
62
|
+
let dispatch = (action) => {
|
63
|
+
if (!!meta.client && !!game) {
|
64
|
+
meta.client.emit("notify", { gameId: game.id, action });
|
65
|
+
}
|
66
|
+
};
|
67
|
+
(0, import_react.useEffect)(() => {
|
68
|
+
if (!meta.client) {
|
69
|
+
meta.client = (0, import_socket.connect)(uri);
|
70
|
+
meta.client.on("error", console.error);
|
71
|
+
meta.client.on("connect", () => {
|
72
|
+
var _a, _b;
|
73
|
+
if (gameId == void 0) {
|
74
|
+
(_a = meta.client) == null ? void 0 : _a.emit("create");
|
75
|
+
} else {
|
76
|
+
(_b = meta.client) == null ? void 0 : _b.emit("join", { gameId });
|
77
|
+
}
|
78
|
+
});
|
79
|
+
meta.client.on("update", (update) => {
|
80
|
+
if (!meta.localPlayerId && !!update.playerId) {
|
81
|
+
setMeta(__spreadProps(__spreadValues({}, meta), { localPlayerId: update.playerId }));
|
82
|
+
}
|
83
|
+
setGame(update.game);
|
84
|
+
});
|
85
|
+
} else if (isHost(meta.localPlayerId, game) && !meta.isHostReady) {
|
86
|
+
meta.client.on("join", (join) => {
|
87
|
+
var _a;
|
88
|
+
(_a = meta.client) == null ? void 0 : _a.emit("accept", {
|
89
|
+
gameId: game == null ? void 0 : game.id,
|
90
|
+
playerId: join.playerId
|
91
|
+
});
|
92
|
+
});
|
93
|
+
meta.client.on("notify", (notify) => {
|
94
|
+
var _a;
|
95
|
+
if (!!game) {
|
96
|
+
(_a = meta.client) == null ? void 0 : _a.emit("update", {
|
97
|
+
game: reducer(game, notify.action, notify.playerId)
|
98
|
+
});
|
99
|
+
}
|
100
|
+
});
|
101
|
+
setMeta(__spreadProps(__spreadValues({}, meta), { isHostReady: true }));
|
102
|
+
}
|
103
|
+
});
|
104
|
+
return [game, meta.localPlayerId, dispatch];
|
105
|
+
}
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
107
|
+
0 && (module.exports = {
|
108
|
+
getPlayer,
|
109
|
+
isHost,
|
110
|
+
useRemoteReducer
|
111
|
+
});
|
112
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Game } from \"@react-remote-state/types\";\nimport { useEffect, useState } from \"react\";\nimport { connect, Socket as Client } from \"socket.io-client\";\n\ntype Meta = {\n client?: Client;\n isHostReady: boolean;\n localPlayerId?: string;\n};\n\nexport function getPlayer<GameCustom, PlayerCustom>(\n playerId?: string,\n game?: Game<GameCustom, PlayerCustom>\n) {\n if (!game || !playerId) {\n return undefined;\n }\n\n return game.players.find((player) => player.id == playerId);\n}\n\nexport function isHost<GameCustom, PlayerCustom>(\n playerId?: string,\n game?: Game<GameCustom, PlayerCustom>\n) {\n let player = getPlayer(playerId, game);\n\n return player?.host;\n}\n\ntype Reducer<GameCustom, PlayerCustom, Action> = (\n game: Game<GameCustom, PlayerCustom>,\n action: Action,\n playerId: string\n) => Game<GameCustom, PlayerCustom>;\n\nexport function useRemoteReducer<GameCustom, PlayerCustom, Action>(\n uri: string,\n reducer: Reducer<GameCustom, PlayerCustom, Action>,\n gameId?: string\n): [\n Game<GameCustom, PlayerCustom> | undefined,\n string | undefined,\n (action: Action) => void\n] {\n let [meta, setMeta] = useState<Meta>({\n isHostReady: false,\n });\n\n let [game, setGame] = useState<Game<GameCustom, PlayerCustom>>();\n\n let dispatch = (action: Action) => {\n if (!!meta.client && !!game) {\n meta.client.emit(\"notify\", { gameId: game.id, action });\n }\n };\n\n useEffect(() => {\n if (!meta.client) {\n meta.client = connect(uri);\n meta.client.on(\"error\", console.error);\n meta.client.on(\"connect\", () => {\n if (gameId == undefined) {\n meta.client?.emit(\"create\");\n } else {\n meta.client?.emit(\"join\", { gameId });\n }\n });\n\n meta.client.on(\"update\", (update) => {\n if (!meta.localPlayerId && !!update.playerId) {\n setMeta({ ...meta, localPlayerId: update.playerId });\n }\n\n setGame(update.game);\n });\n } else if (isHost(meta.localPlayerId, game) && !meta.isHostReady) {\n meta.client.on(\"join\", (join) => {\n meta.client?.emit(\"accept\", {\n gameId: game?.id,\n playerId: join.playerId,\n });\n });\n\n meta.client.on(\"notify\", (notify) => {\n if (!!game) {\n meta.client?.emit(\"update\", {\n game: reducer(game, notify.action, notify.playerId),\n });\n }\n });\n\n setMeta({ ...meta, isHostReady: true });\n }\n });\n\n return [game, meta.localPlayerId, dispatch];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAoC;AACpC,oBAA0C;AAQnC,SAAS,UACd,UACA,MACA;AACA,MAAI,CAAC,QAAQ,CAAC,UAAU;AACtB,WAAO;AAAA,EACT;AAEA,SAAO,KAAK,QAAQ,KAAK,CAAC,WAAW,OAAO,MAAM,QAAQ;AAC5D;AAEO,SAAS,OACd,UACA,MACA;AACA,MAAI,SAAS,UAAU,UAAU,IAAI;AAErC,SAAO,iCAAQ;AACjB;AAQO,SAAS,iBACd,KACA,SACA,QAKA;AACA,MAAI,CAAC,MAAM,OAAO,QAAI,uBAAe;AAAA,IACnC,aAAa;AAAA,EACf,CAAC;AAED,MAAI,CAAC,MAAM,OAAO,QAAI,uBAAyC;AAE/D,MAAI,WAAW,CAAC,WAAmB;AACjC,QAAI,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,MAAM;AAC3B,WAAK,OAAO,KAAK,UAAU,EAAE,QAAQ,KAAK,IAAI,OAAO,CAAC;AAAA,IACxD;AAAA,EACF;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,KAAK,QAAQ;AAChB,WAAK,aAAS,uBAAQ,GAAG;AACzB,WAAK,OAAO,GAAG,SAAS,QAAQ,KAAK;AACrC,WAAK,OAAO,GAAG,WAAW,MAAM;AA7DtC;AA8DQ,YAAI,UAAU,QAAW;AACvB,qBAAK,WAAL,mBAAa,KAAK;AAAA,QACpB,OAAO;AACL,qBAAK,WAAL,mBAAa,KAAK,QAAQ,EAAE,OAAO;AAAA,QACrC;AAAA,MACF,CAAC;AAED,WAAK,OAAO,GAAG,UAAU,CAAC,WAAW;AACnC,YAAI,CAAC,KAAK,iBAAiB,CAAC,CAAC,OAAO,UAAU;AAC5C,kBAAQ,iCAAK,OAAL,EAAW,eAAe,OAAO,SAAS,EAAC;AAAA,QACrD;AAEA,gBAAQ,OAAO,IAAI;AAAA,MACrB,CAAC;AAAA,IACH,WAAW,OAAO,KAAK,eAAe,IAAI,KAAK,CAAC,KAAK,aAAa;AAChE,WAAK,OAAO,GAAG,QAAQ,CAAC,SAAS;AA7EvC;AA8EQ,mBAAK,WAAL,mBAAa,KAAK,UAAU;AAAA,UAC1B,QAAQ,6BAAM;AAAA,UACd,UAAU,KAAK;AAAA,QACjB;AAAA,MACF,CAAC;AAED,WAAK,OAAO,GAAG,UAAU,CAAC,WAAW;AApF3C;AAqFQ,YAAI,CAAC,CAAC,MAAM;AACV,qBAAK,WAAL,mBAAa,KAAK,UAAU;AAAA,YAC1B,MAAM,QAAQ,MAAM,OAAO,QAAQ,OAAO,QAAQ;AAAA,UACpD;AAAA,QACF;AAAA,MACF,CAAC;AAED,cAAQ,iCAAK,OAAL,EAAW,aAAa,KAAK,EAAC;AAAA,IACxC;AAAA,EACF,CAAC;AAED,SAAO,CAAC,MAAM,KAAK,eAAe,QAAQ;AAC5C;","names":[]}
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
|
21
|
+
// src/index.ts
|
22
|
+
import { useEffect, useState } from "react";
|
23
|
+
import { connect } from "socket.io-client";
|
24
|
+
function getPlayer(playerId, game) {
|
25
|
+
if (!game || !playerId) {
|
26
|
+
return void 0;
|
27
|
+
}
|
28
|
+
return game.players.find((player) => player.id == playerId);
|
29
|
+
}
|
30
|
+
function isHost(playerId, game) {
|
31
|
+
let player = getPlayer(playerId, game);
|
32
|
+
return player == null ? void 0 : player.host;
|
33
|
+
}
|
34
|
+
function useRemoteReducer(uri, reducer, gameId) {
|
35
|
+
let [meta, setMeta] = useState({
|
36
|
+
isHostReady: false
|
37
|
+
});
|
38
|
+
let [game, setGame] = useState();
|
39
|
+
let dispatch = (action) => {
|
40
|
+
if (!!meta.client && !!game) {
|
41
|
+
meta.client.emit("notify", { gameId: game.id, action });
|
42
|
+
}
|
43
|
+
};
|
44
|
+
useEffect(() => {
|
45
|
+
if (!meta.client) {
|
46
|
+
meta.client = connect(uri);
|
47
|
+
meta.client.on("error", console.error);
|
48
|
+
meta.client.on("connect", () => {
|
49
|
+
var _a, _b;
|
50
|
+
if (gameId == void 0) {
|
51
|
+
(_a = meta.client) == null ? void 0 : _a.emit("create");
|
52
|
+
} else {
|
53
|
+
(_b = meta.client) == null ? void 0 : _b.emit("join", { gameId });
|
54
|
+
}
|
55
|
+
});
|
56
|
+
meta.client.on("update", (update) => {
|
57
|
+
if (!meta.localPlayerId && !!update.playerId) {
|
58
|
+
setMeta(__spreadProps(__spreadValues({}, meta), { localPlayerId: update.playerId }));
|
59
|
+
}
|
60
|
+
setGame(update.game);
|
61
|
+
});
|
62
|
+
} else if (isHost(meta.localPlayerId, game) && !meta.isHostReady) {
|
63
|
+
meta.client.on("join", (join) => {
|
64
|
+
var _a;
|
65
|
+
(_a = meta.client) == null ? void 0 : _a.emit("accept", {
|
66
|
+
gameId: game == null ? void 0 : game.id,
|
67
|
+
playerId: join.playerId
|
68
|
+
});
|
69
|
+
});
|
70
|
+
meta.client.on("notify", (notify) => {
|
71
|
+
var _a;
|
72
|
+
if (!!game) {
|
73
|
+
(_a = meta.client) == null ? void 0 : _a.emit("update", {
|
74
|
+
game: reducer(game, notify.action, notify.playerId)
|
75
|
+
});
|
76
|
+
}
|
77
|
+
});
|
78
|
+
setMeta(__spreadProps(__spreadValues({}, meta), { isHostReady: true }));
|
79
|
+
}
|
80
|
+
});
|
81
|
+
return [game, meta.localPlayerId, dispatch];
|
82
|
+
}
|
83
|
+
export {
|
84
|
+
getPlayer,
|
85
|
+
isHost,
|
86
|
+
useRemoteReducer
|
87
|
+
};
|
88
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Game } from \"@react-remote-state/types\";\nimport { useEffect, useState } from \"react\";\nimport { connect, Socket as Client } from \"socket.io-client\";\n\ntype Meta = {\n client?: Client;\n isHostReady: boolean;\n localPlayerId?: string;\n};\n\nexport function getPlayer<GameCustom, PlayerCustom>(\n playerId?: string,\n game?: Game<GameCustom, PlayerCustom>\n) {\n if (!game || !playerId) {\n return undefined;\n }\n\n return game.players.find((player) => player.id == playerId);\n}\n\nexport function isHost<GameCustom, PlayerCustom>(\n playerId?: string,\n game?: Game<GameCustom, PlayerCustom>\n) {\n let player = getPlayer(playerId, game);\n\n return player?.host;\n}\n\ntype Reducer<GameCustom, PlayerCustom, Action> = (\n game: Game<GameCustom, PlayerCustom>,\n action: Action,\n playerId: string\n) => Game<GameCustom, PlayerCustom>;\n\nexport function useRemoteReducer<GameCustom, PlayerCustom, Action>(\n uri: string,\n reducer: Reducer<GameCustom, PlayerCustom, Action>,\n gameId?: string\n): [\n Game<GameCustom, PlayerCustom> | undefined,\n string | undefined,\n (action: Action) => void\n] {\n let [meta, setMeta] = useState<Meta>({\n isHostReady: false,\n });\n\n let [game, setGame] = useState<Game<GameCustom, PlayerCustom>>();\n\n let dispatch = (action: Action) => {\n if (!!meta.client && !!game) {\n meta.client.emit(\"notify\", { gameId: game.id, action });\n }\n };\n\n useEffect(() => {\n if (!meta.client) {\n meta.client = connect(uri);\n meta.client.on(\"error\", console.error);\n meta.client.on(\"connect\", () => {\n if (gameId == undefined) {\n meta.client?.emit(\"create\");\n } else {\n meta.client?.emit(\"join\", { gameId });\n }\n });\n\n meta.client.on(\"update\", (update) => {\n if (!meta.localPlayerId && !!update.playerId) {\n setMeta({ ...meta, localPlayerId: update.playerId });\n }\n\n setGame(update.game);\n });\n } else if (isHost(meta.localPlayerId, game) && !meta.isHostReady) {\n meta.client.on(\"join\", (join) => {\n meta.client?.emit(\"accept\", {\n gameId: game?.id,\n playerId: join.playerId,\n });\n });\n\n meta.client.on(\"notify\", (notify) => {\n if (!!game) {\n meta.client?.emit(\"update\", {\n game: reducer(game, notify.action, notify.playerId),\n });\n }\n });\n\n setMeta({ ...meta, isHostReady: true });\n }\n });\n\n return [game, meta.localPlayerId, dispatch];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,SAAS,WAAW,gBAAgB;AACpC,SAAS,eAAiC;AAQnC,SAAS,UACd,UACA,MACA;AACA,MAAI,CAAC,QAAQ,CAAC,UAAU;AACtB,WAAO;AAAA,EACT;AAEA,SAAO,KAAK,QAAQ,KAAK,CAAC,WAAW,OAAO,MAAM,QAAQ;AAC5D;AAEO,SAAS,OACd,UACA,MACA;AACA,MAAI,SAAS,UAAU,UAAU,IAAI;AAErC,SAAO,iCAAQ;AACjB;AAQO,SAAS,iBACd,KACA,SACA,QAKA;AACA,MAAI,CAAC,MAAM,OAAO,IAAI,SAAe;AAAA,IACnC,aAAa;AAAA,EACf,CAAC;AAED,MAAI,CAAC,MAAM,OAAO,IAAI,SAAyC;AAE/D,MAAI,WAAW,CAAC,WAAmB;AACjC,QAAI,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,MAAM;AAC3B,WAAK,OAAO,KAAK,UAAU,EAAE,QAAQ,KAAK,IAAI,OAAO,CAAC;AAAA,IACxD;AAAA,EACF;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,KAAK,QAAQ;AAChB,WAAK,SAAS,QAAQ,GAAG;AACzB,WAAK,OAAO,GAAG,SAAS,QAAQ,KAAK;AACrC,WAAK,OAAO,GAAG,WAAW,MAAM;AA7DtC;AA8DQ,YAAI,UAAU,QAAW;AACvB,qBAAK,WAAL,mBAAa,KAAK;AAAA,QACpB,OAAO;AACL,qBAAK,WAAL,mBAAa,KAAK,QAAQ,EAAE,OAAO;AAAA,QACrC;AAAA,MACF,CAAC;AAED,WAAK,OAAO,GAAG,UAAU,CAAC,WAAW;AACnC,YAAI,CAAC,KAAK,iBAAiB,CAAC,CAAC,OAAO,UAAU;AAC5C,kBAAQ,iCAAK,OAAL,EAAW,eAAe,OAAO,SAAS,EAAC;AAAA,QACrD;AAEA,gBAAQ,OAAO,IAAI;AAAA,MACrB,CAAC;AAAA,IACH,WAAW,OAAO,KAAK,eAAe,IAAI,KAAK,CAAC,KAAK,aAAa;AAChE,WAAK,OAAO,GAAG,QAAQ,CAAC,SAAS;AA7EvC;AA8EQ,mBAAK,WAAL,mBAAa,KAAK,UAAU;AAAA,UAC1B,QAAQ,6BAAM;AAAA,UACd,UAAU,KAAK;AAAA,QACjB;AAAA,MACF,CAAC;AAED,WAAK,OAAO,GAAG,UAAU,CAAC,WAAW;AApF3C;AAqFQ,YAAI,CAAC,CAAC,MAAM;AACV,qBAAK,WAAL,mBAAa,KAAK,UAAU;AAAA,YAC1B,MAAM,QAAQ,MAAM,OAAO,QAAQ,OAAO,QAAQ;AAAA,UACpD;AAAA,QACF;AAAA,MACF,CAAC;AAED,cAAQ,iCAAK,OAAL,EAAW,aAAa,KAAK,EAAC;AAAA,IACxC;AAAA,EACF,CAAC;AAED,SAAO,CAAC,MAAM,KAAK,eAAe,QAAQ;AAC5C;","names":[]}
|
package/package.json
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"name": "@react-remote-state/client",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "Client for React Remote State applications",
|
5
|
+
"main": "./dist/index.js",
|
6
|
+
"module": "./dist/index.mjs",
|
7
|
+
"types": "./dist/index.d.ts",
|
8
|
+
"files": [
|
9
|
+
"dist"
|
10
|
+
],
|
11
|
+
"scripts": {
|
12
|
+
"build": "tsup",
|
13
|
+
"test": "vitest"
|
14
|
+
},
|
15
|
+
"author": "",
|
16
|
+
"license": "ISC",
|
17
|
+
"devDependencies": {
|
18
|
+
"@react-remote-state/server": "^0.0.1",
|
19
|
+
"@sheerun/mutationobserver-shim": "^0.3.3",
|
20
|
+
"@testing-library/react": "^16.0.1",
|
21
|
+
"@types/lodash": "^4.17.12",
|
22
|
+
"@vitejs/plugin-react-swc": "^3.7.1",
|
23
|
+
"lodash": "^4.17.21",
|
24
|
+
"socket.io-client": "^4.8.1",
|
25
|
+
"ts-node": "^10.9.2",
|
26
|
+
"tsup": "^8.3.5",
|
27
|
+
"typescript": "^4.9.5",
|
28
|
+
"vitest": "^2.1.3"
|
29
|
+
},
|
30
|
+
"peerDependencies": {
|
31
|
+
"react": "^18.3.1"
|
32
|
+
},
|
33
|
+
"dependencies": {
|
34
|
+
"@react-remote-state/types": "^1.0.0",
|
35
|
+
"socket.io-client": "^4.8.1"
|
36
|
+
}
|
37
|
+
}
|