@vibingbase/react-router 0.12.0 → 0.12.1

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