@revojs/client 0.2.8 → 0.2.9
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.ts +8 -0
- package/dist/index.js +16 -0
- package/dist/package.js +2 -1
- package/package.json +2 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function createClientScope(variables?: object, states?: Record<string, unknown>): Promise<{
|
|
2
|
+
hooks?: {
|
|
3
|
+
[x: string]: ArrayLike<import("revojs").Hook> | undefined;
|
|
4
|
+
} | undefined;
|
|
5
|
+
context?: {
|
|
6
|
+
[x: string]: {} | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
} & import("revojs").Scope>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { STATE_CONTEXT, VARIABLE_CONTEXT, createScope } from "revojs";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
function createClientScope(variables = {}, states) {
|
|
4
|
+
if (states === void 0) {
|
|
5
|
+
const content = globalThis.document?.getElementById("states")?.textContent?.trim();
|
|
6
|
+
const value = content ? JSON.parse(content) : {};
|
|
7
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("Client hydration state must be an object");
|
|
8
|
+
states = value;
|
|
9
|
+
}
|
|
10
|
+
return createScope({ context: {
|
|
11
|
+
[VARIABLE_CONTEXT]: variables,
|
|
12
|
+
[STATE_CONTEXT]: states
|
|
13
|
+
} });
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { createClientScope };
|
package/dist/package.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
var name = "@revojs/client";
|
|
3
|
-
var version = "0.2.
|
|
3
|
+
var version = "0.2.9";
|
|
4
4
|
var repository = {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/tellua/revojs.git"
|
|
@@ -22,6 +22,7 @@ var exports = {
|
|
|
22
22
|
};
|
|
23
23
|
var scripts = {
|
|
24
24
|
"build": "vite build",
|
|
25
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
25
26
|
"watch": "vite build --watch"
|
|
26
27
|
};
|
|
27
28
|
var dependencies = { "revojs": "*" };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revojs/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "vite build",
|
|
28
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
28
29
|
"watch": "vite build --watch"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|