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