@vibingbase/react-router 0.12.10 → 0.12.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/index.d.ts +4 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type { UseColorSchemeValue } from '@mantine/hooks';
|
|
|
7
7
|
|
|
8
8
|
export declare const appId: string;
|
|
9
9
|
|
|
10
|
+
export declare const appVersion: string;
|
|
11
|
+
|
|
10
12
|
export declare function clientMiddlewareFunction(context: unknown, next: () => Promise<unknown>): Promise<void>;
|
|
11
13
|
|
|
12
14
|
export declare type ColorScheme = UseColorSchemeValue;
|
|
@@ -17,12 +19,12 @@ export declare type Initialization = TauriInitialization;
|
|
|
17
19
|
|
|
18
20
|
export declare function isColorScheme(value: unknown): value is ColorScheme;
|
|
19
21
|
|
|
22
|
+
export declare const isLive: boolean;
|
|
23
|
+
|
|
20
24
|
export declare function isTheme(value: unknown): value is Theme;
|
|
21
25
|
|
|
22
26
|
export declare function Provider({ children }: PropsWithChildren): JSX.Element;
|
|
23
27
|
|
|
24
|
-
export declare const tauriURL: string;
|
|
25
|
-
|
|
26
28
|
export declare type Theme = ColorScheme | "auto";
|
|
27
29
|
|
|
28
30
|
export declare function useInitialization(): TauriInitialization;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
1
|
+
function L(){let e="vibingbase-template";try{let t=import.meta.env.VITE_VIBINGBASE_APP_ID;return typeof t=="string"&&t||e}catch{return e}}var i=L();function T(){let e="1.0.0";try{let t=import.meta.env.VITE_VIBINGBASE_APP_VERSION;return typeof t=="string"&&t||e}catch{return e}}var ge=T();import{getDefaultStore as j}from"jotai";import{isTauri as F}from"@tauri-apps/api/core";import{atomWithWriteOnly as G,hydrationAtom as q,isInitializedAtom as v}from"@vibingbase/common-client";import{atom as H}from"jotai";import{replace as J}from"react-router";import{getCurrentWindow as V}from"@tauri-apps/api/window";import{getCurrent as P,onOpenUrl as D}from"@tauri-apps/plugin-deep-link";import{relaunch as _}from"@tauri-apps/plugin-process";import{check as W}from"@tauri-apps/plugin-updater";import{atomWithWriteOnly as f,generateEventType as $,isSSR as O,normalizeCallback as R,tauriInitializationAtom as s}from"@vibingbase/common-client";function z(e){return e==="local-preview"||e==="development-preview"||e==="production-preview"||e==="development-release"||e==="production-release"}function C(){let e="local-preview";try{let t=import.meta.env.VITE_VIBINGBASE_APP_ENV;return z(t)?t:e}catch{return e}}var p=C();var c=p==="development-release"||p==="production-release";var w=c?i:`app-${i}`;var u=`${w}://localhost`;async function U(){try{return await W()??void 0}catch(e){let t="";if(typeof e=="string"?t=e:e instanceof Error&&(t=e.message),!t.includes("error sending request for url"))throw e}}function d(e){return e===u||e.startsWith(`${u}/`)}var B=f((e,t,o)=>{for(let a of o)if(d(a))break});async function I(){let t=(await P())?.find(a=>d(a));if(t)return t;let o=localStorage.getItem(`${i}/vibingbase-deep-link`);if(o&&d(o))return o}var M=f(async(e,t)=>{t(s,{status:"initializing"});let o;if(c){await V().setFocus(),t(s,{status:"checking-for-updates"});let r=await U();if(r){await r.downloadAndInstall(l=>{switch(l.event){case"Started":{t(s,n=>n?.status==="checking-for-updates"?{status:"downloading-updates",totalLength:l.data.contentLength??0,currentLength:0}:n);break}case"Progress":{t(s,n=>n?.status==="downloading-updates"?{...n,currentLength:n.currentLength+l.data.chunkLength}:n);break}case"Finished":{t(s,n=>n?.status==="downloading-updates"?{status:"relaunching"}:n);break}}});let g=await I();g?localStorage.setItem(`${i}/vibingbase-deep-link`,g):localStorage.removeItem(`${i}/vibingbase-deep-link`),await _();return}t(s,{status:"initializing"}),await D(e(B));let h=await I();h&&(localStorage.removeItem(`${i}/vibingbase-deep-link`),o=R(h))}return t(s,{status:"initialized"}),o}),m=class e extends CustomEvent{static type=$();constructor(t){super(e.type,{detail:t})}},N=new Promise((e,t)=>{O||addEventListener(m.type,o=>{if(o instanceof m)switch(o.detail.status){case"fulfilled":{e(o.detail.value);break}case"rejected":{t(o.detail.reason);break}}},{once:!0})}),k=f(async(e,t)=>{if(e(s))return N;try{let o=await t(M);return dispatchEvent(new m({status:"fulfilled",value:o})),o}catch(o){throw dispatchEvent(new m({status:"rejected",reason:o})),o}});var S=H(!1),y=G(async(e,t)=>{let o=e(S);if(o||t(S,!0),await e(q),F()){let r=await t(k);if(!o&&r)throw J(r)}e(v)||t(v,!0)});async function Fe(e,t){await j().set(y),await t()}import{shallowEqual as K}from"@mantine/hooks";import{memo as Q}from"react";import{jsx as X}from"react/jsx-runtime";var je=Q(()=>X("script",{dangerouslySetInnerHTML:{__html:`
|
|
2
2
|
(function() {
|
|
3
3
|
let colorScheme = 'light';
|
|
4
|
-
const theme = localStorage.getItem('${
|
|
4
|
+
const theme = localStorage.getItem('${i}/vibingbase-theme');
|
|
5
5
|
if (theme === 'light' || theme === 'dark')
|
|
6
6
|
colorScheme = theme;
|
|
7
7
|
else if (matchMedia('(prefers-color-scheme: dark)').matches)
|
|
@@ -10,4 +10,4 @@ function x(){let e="vibingbase-template";try{let t=import.meta.env.VITE_VIBINGBA
|
|
|
10
10
|
document.documentElement.classList.add(colorScheme);
|
|
11
11
|
document.documentElement.style.colorScheme = colorScheme;
|
|
12
12
|
})();
|
|
13
|
-
`.trim()}}),
|
|
13
|
+
`.trim()}}),K);import{isTauri as ie}from"@tauri-apps/api/core";import{JotaiConnector as re,TauriColorScheme as ne}from"@vibingbase/common-client";import{useEffect as ae}from"react";import{useColorScheme as Y}from"@mantine/hooks";import{isSSR as Z}from"@vibingbase/common-client";import{useAtom as ee}from"jotai";import{atomWithStorage as te}from"jotai/utils";function b(e){return e==="light"||e==="dark"}function A(e){return b(e)||e==="auto"}var oe=te(`${i}/vibingbase-theme`,"auto",{getItem:(e,t)=>{if(Z)return t;let o=localStorage.getItem(e);return A(o)?o:t},setItem:(e,t)=>{localStorage.setItem(e,t)},removeItem:e=>{localStorage.removeItem(e)},subscribe:(e,t,o)=>{let a=r=>{r.storageArea===localStorage&&r.key===e&&t(A(r.newValue)?r.newValue:o)};return addEventListener("storage",a),()=>{removeEventListener("storage",a)}}},{getOnInit:!0});function E(){let[e,t]=ee(oe),o=Y("light",{getInitialValueInEffect:!1});return{theme:e,setTheme:t,colorScheme:b(e)?e:o}}import{Fragment as se,jsx as x,jsxs as me}from"react/jsx-runtime";function st({children:e}){let{colorScheme:t}=E();return ae(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(t),document.documentElement.style.colorScheme=t},[t]),me(se,{children:[x(re,{}),ie()&&x(ne,{colorScheme:t}),e]})}import{isTauri as ce}from"@tauri-apps/api/core";import{isInitializedAtom as le,tauriInitializationAtom as pe}from"@vibingbase/common-client";import{atom as ue,useAtomValue as de}from"jotai";var fe=ue(e=>ce()?e(pe)??{status:"initializing"}:{status:e(le)?"initialized":"initializing"});function dt(){return de(fe)}export{je as Config,st as Provider,i as appId,ge as appVersion,Fe as clientMiddlewareFunction,b as isColorScheme,c as isLive,A as isTheme,dt as useInitialization,E as useTheme};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibingbase/react-router",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.12",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"vibingbase",
|
|
6
6
|
"vibe-coding",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"jotai": "^2.15.1",
|
|
41
41
|
"react": "^19.2.0",
|
|
42
42
|
"react-router": "^7.9.6",
|
|
43
|
-
"@vibingbase/common-client": "^0.12.
|
|
44
|
-
"@vibingbase/common-util": "^0.12.
|
|
43
|
+
"@vibingbase/common-client": "^0.12.12",
|
|
44
|
+
"@vibingbase/common-util": "^0.12.12"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"dist"
|