@vibingbase/react-router 0.12.14 → 0.12.15
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 +4 -0
- package/dist/index.js +3 -3
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -21,8 +21,12 @@ export declare function isColorScheme(value: unknown): value is ColorScheme;
|
|
|
21
21
|
|
|
22
22
|
export declare const isLive: boolean;
|
|
23
23
|
|
|
24
|
+
export declare const isMac: boolean;
|
|
25
|
+
|
|
24
26
|
export declare function isTheme(value: unknown): value is Theme;
|
|
25
27
|
|
|
28
|
+
export declare const isWindows: boolean;
|
|
29
|
+
|
|
26
30
|
export declare function Provider({ children }: PropsWithChildren): JSX.Element;
|
|
27
31
|
|
|
28
32
|
export declare type Theme = ColorScheme | "auto";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
1
|
+
function V(){let t="vibingbase-template";try{let e=import.meta.env.VITE_VIBINGBASE_APP_ID;return typeof e=="string"&&e||t}catch{return t}}var r=V();function C(){let t="1.0.0";try{let e=import.meta.env.VITE_VIBINGBASE_APP_VERSION;return typeof e=="string"&&e||t}catch{return t}}var xt=C();import{getDefaultStore as Y}from"jotai";import{isTauri as J}from"@tauri-apps/api/core";import{atomWithWriteOnly as j,hydrationAtom as K,isInitializedAtom as A}from"@vibingbase/common-client";import{atom as Q}from"jotai";import{replace as X}from"react-router";import{getCurrentWindow as _}from"@tauri-apps/api/window";import{getCurrent as M,onOpenUrl as O}from"@tauri-apps/plugin-deep-link";import{relaunch as R}from"@tauri-apps/plugin-process";import{check as $}from"@tauri-apps/plugin-updater";import{atomWithWriteOnly as h,generateEventType as B,isSSR as U,normalizeCallback as N,tauriInitializationAtom as m}from"@vibingbase/common-client";function D(t){return t==="local-preview"||t==="development-preview"||t==="production-preview"||t==="development-release"||t==="production-release"}function W(){let t="local-preview";try{let e=import.meta.env.VITE_VIBINGBASE_APP_ENV;return D(e)?e:t}catch{return t}}var a=W();var p=a==="development-release"||a==="production-release";var I=p?r:`app-${r}`;var d=`${I}://localhost`;async function G(){try{return await $()??void 0}catch(t){let e="";if(typeof t=="string"?e=t:t instanceof Error&&(e=t.message),!e.includes("error sending request for url"))throw t}}function f(t){return t===d||t.startsWith(`${d}/`)}var F=h((t,e,o)=>{for(let s of o)if(f(s))break});async function k(){let e=(await M())?.find(s=>f(s));if(e)return e;let o=localStorage.getItem(`${r}/vibingbase-deep-link`);if(o&&f(o))return o}var q=h(async(t,e)=>{e(m,{status:"initializing"});let o;if(p){await _().setFocus(),e(m,{status:"checking-for-updates"});let i=await G();if(i){await i.downloadAndInstall(u=>{switch(u.event){case"Started":{e(m,n=>n?.status==="checking-for-updates"?{status:"downloading-updates",totalLength:u.data.contentLength??0,currentLength:0}:n);break}case"Progress":{e(m,n=>n?.status==="downloading-updates"?{...n,currentLength:n.currentLength+u.data.chunkLength}:n);break}case"Finished":{e(m,n=>n?.status==="downloading-updates"?{status:"relaunching"}:n);break}}});let v=await k();v?localStorage.setItem(`${r}/vibingbase-deep-link`,v):localStorage.removeItem(`${r}/vibingbase-deep-link`),await R();return}e(m,{status:"initializing"}),await O(t(F));let w=await k();w&&(localStorage.removeItem(`${r}/vibingbase-deep-link`),o=N(w))}return e(m,{status:"initialized"}),o}),c=class t extends CustomEvent{static type=B();constructor(e){super(t.type,{detail:e})}},H=new Promise((t,e)=>{U||addEventListener(c.type,o=>{if(o instanceof c)switch(o.detail.status){case"fulfilled":{t(o.detail.value);break}case"rejected":{e(o.detail.reason);break}}},{once:!0})}),S=h(async(t,e)=>{if(t(m))return H;try{let o=await e(q);return dispatchEvent(new c({status:"fulfilled",value:o})),o}catch(o){throw dispatchEvent(new c({status:"rejected",reason:o})),o}});var y=Q(!1),T=j(async(t,e)=>{let o=t(y);if(o||e(y,!0),await t(K),J()){let i=await e(S);if(!o&&i)throw X(i)}t(A)||e(A,!0)});async function Yt(t,e){await Y().set(T),await e()}import{shallowEqual as Z}from"@mantine/hooks";import{memo as tt}from"react";import{jsx as et}from"react/jsx-runtime";var re=tt(()=>et("script",{dangerouslySetInnerHTML:{__html:`
|
|
2
2
|
(function() {
|
|
3
3
|
let colorScheme = 'light';
|
|
4
|
-
const theme = localStorage.getItem('${
|
|
4
|
+
const theme = localStorage.getItem('${r}/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()}}),
|
|
13
|
+
`.trim()}}),Z);import{isAppTarget as nt}from"@vibingbase/common-client";import{isSSR as ot}from"@vibingbase/common-client";import{connect as rt,WindowMessenger as it}from"penpal";var x=a==="development-preview"||a==="production-preview";var E=a==="production-preview"||a==="production-release";var g=x&&!ot?await rt({messenger:new it({remoteWindow:parent,allowedOrigins:[E?"https://app.vibingbase.com":"http://localhost:1420","tauri://localhost","http://tauri.localhost","https://tauri.localhost"]})}).promise:void 0;function at(){try{if(g)return g.getAppTarget();let t=import.meta.env.VITE_VIBINGBASE_APP_TARGET;return nt(t)?t:void 0}catch{}}var l=await at();var Ie=l==="macOS";var Ae=l==="Windows";import{isTauri as ut}from"@tauri-apps/api/core";import{JotaiConnector as dt,TauriColorScheme as ft}from"@vibingbase/common-client";import{useEffect as ht}from"react";import{useColorScheme as st}from"@mantine/hooks";import{isSSR as mt}from"@vibingbase/common-client";import{useAtom as ct}from"jotai";import{atomWithStorage as pt}from"jotai/utils";function L(t){return t==="light"||t==="dark"}function b(t){return L(t)||t==="auto"}var lt=pt(`${r}/vibingbase-theme`,"auto",{getItem:(t,e)=>{if(mt)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 s=i=>{i.storageArea===localStorage&&i.key===t&&e(b(i.newValue)?i.newValue:o)};return addEventListener("storage",s),()=>{removeEventListener("storage",s)}}},{getOnInit:!0});function z(){let[t,e]=ct(lt),o=st("light",{getInitialValueInEffect:!1});return{theme:t,setTheme:e,colorScheme:L(t)?t:o}}import{Fragment as gt,jsx as P,jsxs as wt}from"react/jsx-runtime";function We({children:t}){let{colorScheme:e}=z();return ht(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(e),document.documentElement.style.colorScheme=e},[e]),wt(gt,{children:[P(dt,{}),ut()&&P(ft,{colorScheme:e}),t]})}import{isTauri as vt}from"@tauri-apps/api/core";import{isInitializedAtom as It,tauriInitializationAtom as kt}from"@vibingbase/common-client";import{atom as St,useAtomValue as At}from"jotai";var yt=St(t=>vt()?t(kt)??{status:"initializing"}:{status:t(It)?"initialized":"initializing"});function Be(){return At(yt)}export{re as Config,We as Provider,r as appId,xt as appVersion,Yt as clientMiddlewareFunction,L as isColorScheme,p as isLive,Ie as isMac,b as isTheme,Ae as isWindows,Be as useInitialization,z 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.15",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"vibingbase",
|
|
6
6
|
"vibe-coding",
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
"@tauri-apps/plugin-process": "^2.3.1",
|
|
39
39
|
"@tauri-apps/plugin-updater": "^2.9.0",
|
|
40
40
|
"jotai": "^2.15.1",
|
|
41
|
+
"penpal": "^7.0.4",
|
|
41
42
|
"react": "^19.2.0",
|
|
42
43
|
"react-router": "^7.9.6",
|
|
43
|
-
"@vibingbase/common-client": "^0.12.
|
|
44
|
-
"@vibingbase/common-util": "^0.12.
|
|
44
|
+
"@vibingbase/common-client": "^0.12.15",
|
|
45
|
+
"@vibingbase/common-util": "^0.12.15"
|
|
45
46
|
},
|
|
46
47
|
"files": [
|
|
47
48
|
"dist"
|