@rolder/kit 3.0.0-alpha.14 → 3.0.0-alpha.15
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createIsomorphicFn } from "@tanstack/react-start";
|
|
2
|
+
import { getCookie } from "@tanstack/react-start/server";
|
|
3
|
+
import js_cookie from "js-cookie";
|
|
4
|
+
const getCookieImpl = createIsomorphicFn().server((name, defaultValue)=>getCookie(name) || defaultValue).client((name, defaultValue)=>js_cookie.get(name) || defaultValue);
|
|
5
|
+
function getCookie_getCookie(name, defaultValue) {
|
|
6
|
+
return getCookieImpl(name, defaultValue);
|
|
7
|
+
}
|
|
8
|
+
export { getCookie_getCookie as getCookie };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createIsomorphicFn } from "@tanstack/react-start";
|
|
2
|
+
import { deleteCookie, setCookie } from "@tanstack/react-start/server";
|
|
3
|
+
import js_cookie from "js-cookie";
|
|
4
|
+
const setCookie_setCookie = createIsomorphicFn().server((name, value, expires)=>{
|
|
5
|
+
const expiresDate = new Date();
|
|
6
|
+
expiresDate.setDate(expiresDate.getDate() + (expires || 7));
|
|
7
|
+
if (value) setCookie(name, value, {
|
|
8
|
+
expires: expiresDate
|
|
9
|
+
});
|
|
10
|
+
else deleteCookie(name);
|
|
11
|
+
}).client((name, value, expires)=>{
|
|
12
|
+
const expiresDate = new Date();
|
|
13
|
+
expiresDate.setDate(expiresDate.getDate() + (expires || 7));
|
|
14
|
+
if (value) js_cookie.set(name, value, {
|
|
15
|
+
expires: expiresDate
|
|
16
|
+
});
|
|
17
|
+
else js_cookie.remove(name);
|
|
18
|
+
});
|
|
19
|
+
export { setCookie_setCookie as setCookie };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createClientOnlyFn } from "@tanstack/react-start";
|
|
2
|
+
import js_cookie from "js-cookie";
|
|
3
|
+
const setCookies = createClientOnlyFn((cookies)=>{
|
|
4
|
+
cookies.forEach(({ name, value, expires })=>{
|
|
5
|
+
const expiresDate = new Date();
|
|
6
|
+
expiresDate.setDate(expiresDate.getDate() + (expires || 7));
|
|
7
|
+
if (value) js_cookie.set(name, value, {
|
|
8
|
+
expires: expiresDate
|
|
9
|
+
});
|
|
10
|
+
else js_cookie.remove(name);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
export { setCookies };
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolder/kit",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
"./styles.css": "./dist/styles.css",
|
|
10
|
+
"./functions": {
|
|
11
|
+
"import": "./dist/functions/index.js"
|
|
12
|
+
},
|
|
10
13
|
"./conversation": {
|
|
11
14
|
"import": "./dist/ai/ui/conversation/index.js"
|
|
12
15
|
},
|