@vibingbase/react-router 0.12.10 → 0.12.11

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 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,4 +1,4 @@
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:`
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:`
2
2
  (function() {
3
3
  let colorScheme = 'light';
4
4
  const theme = localStorage.getItem('${s}/vibingbase-theme');
@@ -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()}}),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};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibingbase/react-router",
3
- "version": "0.12.10",
3
+ "version": "0.12.11",
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.10",
44
- "@vibingbase/common-util": "^0.12.10"
43
+ "@vibingbase/common-client": "^0.12.11",
44
+ "@vibingbase/common-util": "^0.12.11"
45
45
  },
46
46
  "files": [
47
47
  "dist"