@vibingbase/react-router 0.12.11 → 0.12.13

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 +3 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
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 s=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 O,isSSR as R,normalizeCallback as U,tauriInitializationAtom as a}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?s:`app-${s}`;var u=`${w}://localhost`;async function B(){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 I(){let t=(await P())?.find(n=>d(n));if(t)return t;let o=localStorage.getItem("vibingbase-deep-link");if(o&&d(o))return o}var N=f(async(e,t)=>{t(a,{status:"initializing"});let o;if(c){await V().setFocus(),t(a,{status:"checking-for-updates"});let i=await B();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 I();g?localStorage.setItem("vibingbase-deep-link",g):localStorage.removeItem("vibingbase-deep-link"),await _();return}t(a,{status:"initializing"}),await D(e(M));let h=await I();h&&(localStorage.removeItem("vibingbase-deep-link"),o=U(h))}return t(a,{status:"initialized"}),o}),m=class e extends CustomEvent{static type=O();constructor(t){super(e.type,{detail:t})}},$=new Promise((e,t)=>{R||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(a))return $;try{let o=await t(N);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 i=await t(k);if(!o&&i)throw J(i)}e(v)||t(v,!0)});async function $e(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:`
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('${s}/vibingbase-theme');
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 L(){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()}}),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(`${s}/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 n=i=>{i.storageArea===localStorage&&i.key===e&&t(A(i.newValue)?i.newValue:o)};return addEventListener("storage",n),()=>{removeEventListener("storage",n)}}},{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 at({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 ut(){return de(fe)}export{Je as Config,at as Provider,s as appId,ge as appVersion,$e as clientMiddlewareFunction,b as isColorScheme,c as isLive,A as isTheme,ut as useInitialization,E as useTheme};
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.11",
3
+ "version": "0.12.13",
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.11",
44
- "@vibingbase/common-util": "^0.12.11"
43
+ "@vibingbase/common-client": "^0.12.13",
44
+ "@vibingbase/common-util": "^0.12.13"
45
45
  },
46
46
  "files": [
47
47
  "dist"