@vibingbase/react-router 0.12.0 → 0.12.2
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.js +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function x(){let t="vibingbase-template";try{let e=import.meta.env.VITE_VIBINGBASE_APP_ID;return typeof e=="string"&&e||t}catch{return t}}var m=x();import{getDefaultStore as H}from"jotai";import{isTauri as B}from"@tauri-apps/api/core";import{atomWithWriteOnly as F,hydrationAtom as N,isInitializedAtom as S}from"@vibingbase/common-client";import{atom as G}from"jotai";import{replace as q}from"react-router";import{getCurrentWindow as C}from"@tauri-apps/api/window";import{getCurrent as D,onOpenUrl as P}from"@tauri-apps/plugin-deep-link";import{relaunch as V}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 a}from"@vibingbase/common-client";function T(t){return t==="template-preview"||t==="development-preview"||t==="production-preview"||t==="development-release"||t==="production-release"}function z(){let t="template-preview";try{let e=import.meta.env.VITE_VIBINGBASE_APP_ENV;return T(e)?e:t}catch{return t}}var p=z();var c=p==="development-release"||p==="production-release";var w=c?m:`app-${m}`;var u=`${w}://localhost`;function d(t){return t===u||t.startsWith(`${u}/`)}var U=f((t,e,o)=>{for(let n of o)if(d(n))break});async function k(){let e=(await D())?.find(n=>d(n));if(e)return e;let o=localStorage.getItem("vibingbase-deep-link");if(o&&d(o))return o}var M=f(async(t,e)=>{e(a,{status:"initializing"});let o;if(c){await C().setFocus(),e(a,{status:"checking-for-updates"});let i=await W();if(i){await i.downloadAndInstall(l=>{switch(l.event){case"Started":{e(a,r=>r?.status==="checking-for-updates"?{status:"downloading-updates",totalLength:l.data.contentLength??0,currentLength:0}:r);break}case"Progress":{e(a,r=>r?.status==="downloading-updates"?{...r,currentLength:r.currentLength+l.data.chunkLength}:r);break}case"Finished":{e(a,r=>r?.status==="downloading-updates"?{status:"relaunching"}:r);break}}});let g=await k();g?localStorage.setItem("vibingbase-deep-link",g):localStorage.removeItem("vibingbase-deep-link"),await V();return}e(a,{status:"initializing"}),await P(t(U));let h=await k();h&&(localStorage.removeItem("vibingbase-deep-link"),o=R(h))}return e(a,{status:"initialized"}),o}),s=class t extends CustomEvent{static type=_();constructor(e){super(t.type,{detail:e})}},$=new Promise((t,e)=>{O||addEventListener(s.type,o=>{if(o instanceof s)switch(o.detail.status){case"fulfilled":{t(o.detail.value);break}case"rejected":{e(o.detail.reason);break}}},{once:!0})}),I=f(async(t,e)=>{if(t(a))return $;try{let o=await e(M);return dispatchEvent(new s({status:"fulfilled",value:o})),o}catch(o){throw dispatchEvent(new s({status:"rejected",reason:o})),o}});var v=G(!1),y=F(async(t,e)=>{let o=t(v);if(o||e(v,!0),await t(N),B()){let i=await e(I);if(!o&&i)throw q(i)}t(S)||e(S,!0)});async function Ut(t,e){await H().set(y),await e()}import{shallowEqual as J}from"@mantine/hooks";import{memo as j}from"react";import{jsx as K}from"react/jsx-runtime";var Nt=j(()=>K("script",{dangerouslySetInnerHTML:{__html:`
|
|
2
2
|
(function() {
|
|
3
3
|
let colorScheme = 'light';
|
|
4
4
|
const theme = localStorage.getItem('${m}/vibingbase-theme');
|
|
@@ -10,4 +10,4 @@ var m=import.meta.env.VITE_VIBINGBASE_APP_ID||"vibingbase-template";import{getDe
|
|
|
10
10
|
document.documentElement.classList.add(colorScheme);
|
|
11
11
|
document.documentElement.style.colorScheme = colorScheme;
|
|
12
12
|
})();
|
|
13
|
-
`.trim()}}),
|
|
13
|
+
`.trim()}}),J);import{isTauri as et}from"@tauri-apps/api/core";import{JotaiConnector as ot,TauriColorScheme as it}from"@vibingbase/common-client";import{useEffect as rt}from"react";import{useColorScheme as Q}from"@mantine/hooks";import{isSSR as X}from"@vibingbase/common-client";import{useAtom as Y}from"jotai";import{atomWithStorage as Z}from"jotai/utils";function A(t){return t==="light"||t==="dark"}function b(t){return A(t)||t==="auto"}var tt=Z(`${m}/vibingbase-theme`,"auto",{getItem:(t,e)=>{if(X)return e;let o=localStorage.getItem(t);return b(o)?o:e},setItem:(t,e)=>{localStorage.setItem(t,e)},removeItem:t=>{localStorage.removeItem(t)},subscribe:(t,e,o)=>{let n=i=>{i.storageArea===localStorage&&i.key===t&&e(b(i.newValue)?i.newValue:o)};return addEventListener("storage",n),()=>{removeEventListener("storage",n)}}},{getOnInit:!0});function L(){let[t,e]=Y(tt),o=Q("light",{getInitialValueInEffect:!1});return{theme:t,setTheme:e,colorScheme:A(t)?t:o}}import{Fragment as nt,jsx as E,jsxs as at}from"react/jsx-runtime";function oe({children:t}){let{colorScheme:e}=L();return rt(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(e),document.documentElement.style.colorScheme=e},[e]),at(nt,{children:[E(ot,{}),et()&&E(it,{colorScheme:e}),t]})}import{isTauri as mt}from"@tauri-apps/api/core";import{isInitializedAtom as st,tauriInitializationAtom as ct}from"@vibingbase/common-client";import{atom as lt,useAtomValue as pt}from"jotai";var ut=lt(t=>mt()?t(ct)??{status:"initializing"}:{status:t(st)?"initialized":"initializing"});function se(){return pt(ut)}export{Nt as Config,oe as Provider,m as appId,Ut as clientMiddlewareFunction,A as isColorScheme,b as isTheme,u as tauriURL,se as useInitialization,L 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.2",
|
|
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.2",
|
|
44
|
+
"@vibingbase/common-util": "^0.12.2"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"dist"
|