@dashadmin/dash-boilerplate 1.3.24 → 1.3.26

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/package.json CHANGED
@@ -1,58 +1,56 @@
1
1
  {
2
- "name": "@dashadmin/dash-boilerplate",
3
- "version": "1.3.24",
4
- "private": false,
5
- "main": "dist/index.js",
6
- "type": "module",
7
- "dependencies": {
8
- "@emotion/react": "latest",
9
- "@emotion/styled": "latest",
10
- "@mui/material": "^7.3.10",
11
- "numeral": "^2.0.6",
12
- "react": "latest",
13
- "react-admin": "5.14.7",
14
- "react-dom": "latest",
15
- "react-error-boundary": "^4.0.0",
16
- "react-redux": "latest",
17
- "@dashadmin/dash-admin-state": "1.3.24",
18
- "@dashadmin/dash-constants": "1.3.24",
19
- "@dashadmin/dash-auto-admin": "1.3.24",
20
- "@dashadmin/dash-utils": "1.3.24",
21
- "@dashadmin/dash-auth": "1.3.24",
22
- "@dashadmin/dash-admin": "1.3.24",
23
- "@dashadmin/dash-axios-hook": "1.3.24"
24
- },
25
- "devDependencies": {
26
- "@types/node": "latest",
27
- "@types/numeral": "^2.0.5",
28
- "@types/react": "latest",
29
- "@types/react-dom": "latest",
30
- "typescript": "latest",
31
- "vite": "^5.2.0",
32
- "rollup": "^4.0.0",
33
- "@dashadmin/dash-eslint": "1.3.24",
34
- "@dashadmin/dash-tsconfig": "1.3.24",
35
- "@dashadmin/dash-prettier": "1.3.24"
36
- },
37
- "publishConfig": {
38
- "name": "@dashadmin/dash-boilerplate",
39
- "access": "public"
40
- },
41
- "files": [
42
- "dist"
43
- ],
44
- "exports": {
45
- ".": {
46
- "import": "./dist/index.js"
47
- },
48
- "./src/*": {
49
- "import": "./dist/*.js"
50
- }
51
- },
52
- "scripts": {
53
- "lint": "eslint --ext .ts,.tsx .",
54
- "format": "pnpm prettier --write .",
55
- "typecheck": "tsc --noEmit",
56
- "build": "rm -rf dist && node ../dash-build/compile.mjs && vite build"
57
- }
58
- }
2
+ "name": "@dashadmin/dash-boilerplate",
3
+ "version": "1.3.26",
4
+ "main": "dist/index.cjs",
5
+ "type": "module",
6
+ "scripts": {
7
+ "lint": "eslint --ext .ts,.tsx .",
8
+ "format": "pnpm prettier --write .",
9
+ "typecheck": "tsc --noEmit",
10
+ "build": "tsup"
11
+ },
12
+ "dependencies": {
13
+ "@emotion/react": "latest",
14
+ "@emotion/styled": "latest",
15
+ "@mui/material": "^7.3.10",
16
+ "numeral": "^2.0.6",
17
+ "react": "latest",
18
+ "react-admin": "5.14.6",
19
+ "react-dom": "latest",
20
+ "react-error-boundary": "^4.0.0",
21
+ "react-redux": "latest",
22
+ "@dashadmin/dash-admin": "workspace:*",
23
+ "@dashadmin/dash-admin-state": "workspace:*",
24
+ "@dashadmin/dash-auth": "workspace:*",
25
+ "@dashadmin/dash-auto-admin": "workspace:*",
26
+ "@dashadmin/dash-axios-hook": "workspace:*",
27
+ "@dashadmin/dash-constants": "workspace:*",
28
+ "@dashadmin/dash-utils": "workspace:*"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "latest",
32
+ "@types/numeral": "^2.0.5",
33
+ "@types/react": "latest",
34
+ "@types/react-dom": "latest",
35
+ "typescript": "latest",
36
+ "@dashadmin/dash-eslint": "workspace:*",
37
+ "@dashadmin/dash-prettier": "workspace:*",
38
+ "@dashadmin/dash-tsconfig": "workspace:*"
39
+ },
40
+ "module": "dist/index.js",
41
+ "types": "dist/index.d.ts",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist/index.d.ts",
45
+ "import": "./dist/index.js",
46
+ "require": "./dist/index.cjs"
47
+ }
48
+ },
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "registry": "https://registry.npmjs.org"
52
+ },
53
+ "files": [
54
+ "dist"
55
+ ]
56
+ }
@@ -1,5 +0,0 @@
1
- import{Fragment as b,jsx as r,jsxs as t}from"react/jsx-runtime";import p,{Suspense as d,useState as c,useTransition as h}from"react";import{ErrorBoundary as g}from"react-error-boundary";const y=({error:o,resetErrorBoundary:e})=>t("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",gap:"16px",color:"var(--text-color)",backgroundColor:"var(--bodybg-primary)"},children:[r("h1",{style:{margin:0,fontSize:"1.5rem"},children:"Something went wrong"}),r("p",{style:{margin:0,opacity:.8},children:o?.message||"Unknown error"}),r("button",{onClick:e,style:{padding:"8px 24px",backgroundColor:"var(--primary-color)",color:"var(--primary-contrast)",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px",fontWeight:500},children:"Try Again"})]}),m=()=>t("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",backgroundColor:"var(--bodybg-primary)"},children:[r("div",{className:"loading-spinner",style:{width:"40px",height:"40px",border:"3px solid rgba(255,255,255,0.1)",borderTopColor:"var(--primary-color)",borderRadius:"50%",animation:"spin 1s linear infinite"}}),r("style",{children:`
2
- @keyframes spin {
3
- to { transform: rotate(360deg); }
4
- }
5
- `})]}),u=({children:o,onReset:e,showSplash:a=!0})=>{const[n,i]=h(),[s,l]=c(!0);return p.useEffect(()=>{i(()=>{l(!1)})},[]),t(b,{children:[r(g,{FallbackComponent:y,onReset:()=>{e?e():window.location.reload()},children:r(d,{fallback:r(m,{}),children:o})}),a&&r("div",{className:!n&&!s?"dash-splash fade-out":"dash-splash"})]})};var R=u;export{u as AppWrapperLight,R as default};
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var i=(t,o,r)=>o in t?s(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r;var n=(t,o,r)=>i(t,typeof o!="symbol"?o+"":o,r);import{jsx as e,jsxs as l}from"react/jsx-runtime";import d from"react";class c extends d.Component{constructor(r){super(r);n(this,"handleReload",()=>{window.location.reload()});this.state={hasError:!1}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,a){console.error("CustomErrorBoundary caught error:",r,a),this.props.onError?.(r,a)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:l("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",backgroundColor:"var(--bodybg-primary, #121212)",color:"var(--text-color, #ffffff)",flexDirection:"column",gap:"20px"},children:[e("h2",{children:"Something went wrong"}),e("p",{style:{opacity:.8},children:this.state.error?.message}),e("button",{onClick:this.handleReload,style:{padding:"10px 20px",backgroundColor:"var(--primary-color, #007bff)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px",fontWeight:500},children:"Reload Page"})]}):this.props.children}}var h=c;export{c as CustomErrorBoundary,h as default};
@@ -1 +0,0 @@
1
- import{jsx as l,jsxs as s}from"react/jsx-runtime";import d from"react";const u={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"100vh",gap:"16px",color:"var(--text-color, #333)",backgroundColor:"var(--background-color, #fff)"},f={margin:0,fontSize:"1.25rem",fontWeight:500,color:"#f44336"},y={marginTop:"16px",padding:"8px 16px",backgroundColor:"#1976d2",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px",fontWeight:500},g=({error:t,message:r="Failed to initialize application",onRetry:a=()=>window.location.reload(),retryLabel:n="Retry",containerStyle:o,messageStyle:e,buttonStyle:i})=>{const c=t instanceof Error?t.message:t||r;return s("div",{style:{...u,...o},children:[l("h6",{style:{...f,...e},children:c}),l("button",{onClick:a,style:{...y,...i},children:n})]})},p=({message:t="Failed to load application",onRetry:r=()=>window.location.reload(),retryLabel:a="Retry",containerStyle:n,messageStyle:o,buttonStyle:e})=>{const i={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100vh",color:"#000000",gap:"12px"},c={padding:"8px 24px",backgroundColor:"#57005aff",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer"};return s("div",{style:{...i,...n},children:[l("h1",{style:o,children:t}),l("button",{onClick:r,style:{...c,...e},children:a})]})},S=({importFn:t,delay:r=100,ErrorFallback:a=p,errorMessage:n="Failed to load application"})=>d.lazy(()=>new Promise(o=>{setTimeout(()=>{t().then(e=>{o({default:e.default})}).catch(e=>{console.error("Failed to load application:",e),o({default:()=>l(a,{error:e,message:n})})})},r)}));var m={DefaultInitializationErrorFallback:g,DefaultAppLoadErrorFallback:p,createLazyAppLoader:S};export{p as DefaultAppLoadErrorFallback,g as DefaultInitializationErrorFallback,S as createLazyAppLoader,m as default};
@@ -1,55 +0,0 @@
1
- import{jsx as i,jsxs as a}from"react/jsx-runtime";const t='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32px" height="32px" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" viewBox="0 0 16 16"><g><path style="opacity:1" fill="#FFFFFF" d="M11.506 12.388q0.306 0.011 0.617 0.008v1.281h-0.89a2 2 0 0 1 -0.898 -0.215 1.24 1.24 0 0 1 -0.629 -0.761 2.5 2.5 0 0 1 -0.094 -0.554q-0.006 -1.082 -0.004 -2.163h-0.609q0.002 -0.398 -0.004 -0.796a616 616 0 0 0 -1.676 2.023 657 657 0 0 0 2.069 2.46q-0.935 0.012 -1.874 0.008L6.003 11.61q-0.006 1.035 -0.004 2.069H4.485q0.004 -2.983 -0.008 -5.966 -0.661 -0.21 -0.863 -0.875a2 2 0 0 1 -0.039 -0.258q-0.008 -2.108 0 -4.217 0.12 -0.356 0.48 -0.246 0.153 0.079 0.191 0.246l0.008 3.272q0.05 0.116 0.168 0.066 0.035 -0.027 0.051 -0.066l0.008 -3.264q0.095 -0.329 0.433 -0.269 0.191 0.059 0.238 0.254l0.008 3.272q0.065 0.14 0.195 0.055l0.023 -0.039 0.008 -3.264q0.086 -0.321 0.418 -0.285 0.197 0.057 0.254 0.254a352 352 0 0 1 0.016 3.295q0.062 0.109 0.176 0.051 0.029 -0.028 0.043 -0.066l0.008 -3.28q0.045 -0.17 0.207 -0.238 0.25 -0.074 0.41 0.129a0.5 0.5 0 0 1 0.047 0.109q0.014 1.063 0.012 2.128 0.002 1.088 -0.012 2.175 -0.137 0.844 -0.96 1.078a301 301 0 0 0 0 3.006q0.753 -1.005 1.503 -2.011 1.05 -0.006 2.101 -0.004 0.002 -0.519 -0.004 -1.039a1.82 1.82 0 0 1 -1.281 -1.101q-0.197 -0.504 -0.211 -1.046a4.7 4.7 0 0 1 0.383 -2.03q0.242 -0.547 0.668 -0.964 0.395 -0.364 0.929 -0.445 0.695 -0.056 1.218 0.398 0.476 0.438 0.73 1.035 0.513 1.212 0.32 2.514a2.26 2.26 0 0 1 -0.484 1.07 1.75 1.75 0 0 1 -0.754 0.5v1.109h0.992v1.265h-0.992q-0.002 1.042 0.004 2.085 0.05 0.323 0.379 0.32"/></g></svg>',l=()=>i("span",{dangerouslySetInnerHTML:{__html:t}}),n=({message:e,showMessage:o=!1})=>a("div",{children:[a("div",{className:"initial-loader",children:[i("div",{className:"initial-loader-spinner"}),i("span",{className:"initial-loader-icon",children:i(l,{})})]}),o&&e&&i("div",{className:"initial-loader-text",children:e})]}),d=`<div class="initial-loader">
2
- <div class="initial-loader-spinner">
3
- <span class="initial-loader-icon">
4
- ${t}
5
- </span>
6
- </div>
7
- <div class="initial-loader-text"></div>
8
- </div>`,c=()=>{if(typeof document>"u"||document.getElementById("critical-loading-styles"))return;const e=document.createElement("style");e.id="critical-loading-styles",e.textContent=`
9
- .initial-loader {
10
- position: fixed;
11
- top: 0;
12
- left: 0;
13
- right: 0;
14
- bottom: 0;
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: center;
18
- align-items: center;
19
- color: var(--text-color, #fff);
20
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
21
- z-index: 9999;
22
- }
23
- .initial-loader-spinner {
24
- width: 40px;
25
- height: 40px;
26
- border: 3px solid rgba(255,255,255,0.1);
27
- border-top-color: var(--primary-color, #3f51b5);
28
- border-radius: 50%;
29
- animation: spin 1s linear infinite;
30
- position: relative;
31
- display: flex;
32
- justify-content: center;
33
- align-items: center;
34
- }
35
- .initial-loader-icon {
36
- position: absolute;
37
- top: 50%;
38
- left: 50%;
39
- width: 16px;
40
- height: 16px;
41
- transform: translate(-50%, -50%);
42
- display: flex;
43
- align-items: center;
44
- justify-content: center;
45
- pointer-events: none;
46
- }
47
- .initial-loader-text {
48
- margin-top: 16px;
49
- font-size: 14px;
50
- opacity: 0.7;
51
- }
52
- @keyframes spin {
53
- to { transform: rotate(360deg); }
54
- }
55
- `,document.head.appendChild(e)};var p=n;export{d as GlobalLoaderHtmlMarkup,n as GlobalSmallLoader,p as default,c as injectCriticalStyles};
@@ -1 +0,0 @@
1
- import{GlobalSmallLoader as a,GlobalLoaderHtmlMarkup as p,injectCriticalStyles as l}from"./GlobalSmallLoader";import{CustomErrorBoundary as t}from"./CustomErrorBoundary";import{AppWrapperLight as f}from"./AppWrapperLight";import{DefaultInitializationErrorFallback as i,DefaultAppLoadErrorFallback as u,createLazyAppLoader as d}from"./DefaultFallbacks";export{f as AppWrapperLight,t as CustomErrorBoundary,u as DefaultAppLoadErrorFallback,i as DefaultInitializationErrorFallback,p as GlobalLoaderHtmlMarkup,a as GlobalSmallLoader,d as createLazyAppLoader,l as injectCriticalStyles};
@@ -1 +0,0 @@
1
- import{jsx as w}from"react/jsx-runtime";import{createContext as x,useContext as p,useState as v,useCallback as d,useMemo as h,useEffect as B}from"react";const P="dash:locale-change",C={i18nProvider:null,locale:"es",setI18nProvider:()=>{},setLocale:()=>{}},g=x(C),m=({children:e,defaultLocale:n="es"})=>{const[r,i]=v(null),[t,s]=v(()=>typeof window<"u"&&localStorage.getItem("dash-user-locale")||n),L=d(async o=>{console.log("\u{1F310} I18nBridgeProviderLight: Setting bridged i18nProvider",{providerLocale:o?.getLocale?.(),desiredLocale:t}),i(o);const c=o?.getLocale?.();if(c&&c!==t&&o?.changeLocale){console.log(`\u{1F310} I18nBridgeProviderLight: Provider locale (${c}) differs from desired (${t}), switching...`);try{await o.changeLocale(t),console.log(`\u{1F310} I18nBridgeProviderLight: Successfully switched provider to ${t}`)}catch(u){console.warn("\u{1F310} I18nBridgeProviderLight: Failed to switch provider locale:",u)}}else o?.getLocale&&s(o.getLocale())},[t]);B(()=>{const o=async c=>{const a=c.detail?.locale;if(a&&a!==t){if(console.log("\u{1F310} I18nBridgeProviderLight: Received locale change event:",a),r?.changeLocale)try{await r.changeLocale(a)}catch(f){console.warn("Failed to change provider locale:",f)}s(a)}};return window.addEventListener(P,o),()=>{window.removeEventListener(P,o)}},[r,t]);const I=h(()=>({i18nProvider:r,locale:t,setI18nProvider:L,setLocale:s}),[r,t,L]);return w(g.Provider,{value:I,children:e})},l=()=>p(g),R=()=>{const{i18nProvider:e}=l();return h(()=>e?.getLocales?e.getLocales():[],[e])},F=()=>{const{i18nProvider:e,setLocale:n}=l();return d(async i=>{e?.changeLocale&&(await e.changeLocale(i),n(i))},[e,n])},N=()=>{const{locale:e}=l();return e},$=()=>{const{i18nProvider:e}=l();return d((r,i)=>e?.translate?e.translate(r,i):r,[e])};var b=m;export{g as I18nBridgeContext,m as I18nBridgeProviderLight,P as LOCALE_CHANGE_EVENT,b as default,F as useBridgedChangeLocaleLight,N as useBridgedLocaleLight,R as useBridgedLocalesLight,l as useI18nBridgeLight,$ as useTranslateLight};
@@ -1 +0,0 @@
1
- const c=(r,e)=>e.split(".").reduce((a,t)=>a?a[t]:null,r),g=(r,e)=>!e||!r?r:Object.keys(e).reduce((a,t)=>a.replace(new RegExp(`%\\{${t}\\}`,"g"),String(e[t])),r),L=[{locale:"en",name:"English"},{locale:"es",name:"Espa\xF1ol"}],m=r=>{const{translations:e,initialLocale:a="es",fallbackLocale:t="en",locales:f=L,onLocaleChange:u}=r;let s=a;return{translate:(n,o)=>{const d=e[s]||e[t]||{},i=c(d,n);if(typeof i=="string")return g(i,o);if(s!==t){const p=e[t]||{},l=c(p,n);if(typeof l=="string")return g(l,o)}return n},changeLocale:async n=>e[n]?(s=n,localStorage.setItem("dash-user-locale",n),u?.(n),Promise.resolve()):Promise.reject(new Error(`Locale '${n}' not found`)),getLocale:()=>s,getLocales:()=>f,getMessages:n=>e[n]||{}}};var x=m;export{m as createSimpleI18nProvider,x as default};
@@ -1 +0,0 @@
1
- export*from"./types";import{createSimpleI18nProvider as o}from"./createSimpleI18nProvider";import{I18nBridgeProviderLight as d,useI18nBridgeLight as g,useBridgedLocalesLight as n,useBridgedChangeLocaleLight as p,useBridgedLocaleLight as L,useTranslateLight as a,I18nBridgeContext as h}from"./I18nBridgeProviderLight";export{h as I18nBridgeContext,d as I18nBridgeProviderLight,o as createSimpleI18nProvider,p as useBridgedChangeLocaleLight,L as useBridgedLocaleLight,n as useBridgedLocalesLight,g as useI18nBridgeLight,a as useTranslateLight};
File without changes
@@ -1 +0,0 @@
1
- import{jsx as k,jsxs as R}from"react/jsx-runtime";import{createContext as P,useContext as D,useState as b,useEffect as y,useMemo as x}from"react";import M from"@mui/material/CssBaseline";import{createTheme as B,ThemeProvider as S}from"@mui/material";import{updateDomCssVariables as T}from"@dashadmin/dash-utils";const v=(n,t)=>{if(typeof document>"u")return t;const e=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),r=parseInt(e,10);return isNaN(r)?t:r},s=n=>typeof document>"u"?null:getComputedStyle(document.documentElement).getPropertyValue(n).trim()||null,E=n=>{const t={},e=`--${n}`,r=s(`--primary-color${e}`);r&&(t.primaryColor=r);const a=s(`--primary-contrast${e}`);a&&(t.primaryContrast=a);const c=s(`--secondary-color${e}`);c&&(t.secondaryColor=c);const m=s(`--bodybg-primary${e}`);m&&(t.bodyBgPrimary=m);const i=s(`--bodybg-secondary${e}`);i&&(t.bodyBgSecondary=i);const d=s(`--component-bg${e}`);d&&(t.componentBg=d);const u=s(`--text-color${e}`);u&&(t.textColor=u);const l=s(`--text-contrast${e}`);l&&(t.textContrast=l);const h=s(`--heading-color${e}`);h&&(t.headingColor=h);const o=s(`--link-color${e}`);o&&(t.linkColor=o);const f=s(`--border-color${e}`);return f&&(t.borderColor=f),t},$=(n,t)=>{const e=E(n),r=v("--font-size-base",14),a=v("--border-radius-base",6),{palette:c,colorSchemes:m,defaultColorScheme:i,...d}=t||{};return B({breakpoints:{keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536}},palette:{mode:n,primary:{main:e.primaryColor,contrastText:e.primaryContrast},secondary:{main:e.secondaryColor},background:{default:e.bodyBgPrimary,paper:e.componentBg},text:{primary:e.textColor,secondary:e.textContrast},divider:e.borderColor},typography:{fontFamily:'"Montserrat", "Roboto", "Helvetica", "Arial", sans-serif',fontSize:r},shape:{borderRadius:a},components:{MuiButton:{styleOverrides:{root:{transition:"all 0.2s ease-in-out",textTransform:"none"}}},MuiCssBaseline:{styleOverrides:{body:{backgroundColor:e.bodyBgPrimary,color:e.textColor}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}}},...d})},p=P(null),F=()=>{const n=D(p);if(!n)throw new Error("useDashThemeContextLight must be used within a DashThemeProviderLight");return n},w=({children:n,extendedOptions:t,defaultMode:e})=>{const[r,a]=b(()=>{if(typeof document>"u")return e||"dark";const o=document.documentElement.getAttribute("data-theme");return o==="light"||o==="dark"?o:e||"dark"}),[c,m]=b(0),i=x(()=>$(r,t),[r,t,c]),d=o=>{a(o),typeof document<"u"&&(document.documentElement.setAttribute("data-theme",o),localStorage.setItem("theme",o),T(o))},u=()=>{d(r==="dark"?"light":"dark")},l=()=>{m(o=>o+1)};y(()=>{if(typeof document>"u")return;const o=new MutationObserver(f=>{f.forEach(C=>{if(C.type==="attributes"&&C.attributeName==="data-theme"){const g=document.documentElement.getAttribute("data-theme");(g==="light"||g==="dark")&&g!==r&&a(g)}})});return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>o.disconnect()},[r]),y(()=>{typeof document>"u"||T(r)},[r]),y(()=>{if(typeof window>"u")return;const o=()=>{console.log("DashThemeProviderLight: Refreshing theme from CSS variables"),l()};return window.addEventListener("DASHTRefreshTheme",o),()=>window.removeEventListener("DASHTRefreshTheme",o)},[]);const h=x(()=>({theme:i,currentMode:r,setMode:d,toggleMode:u,refreshTheme:l}),[i,r]);return R(S,{theme:i,children:[k(M,{}),k(p.Provider,{value:h,children:n})]})};var H=w;export{p as DashThemeContext,w as DashThemeProviderLight,H as default,F as useDashThemeContextLight};
@@ -1 +0,0 @@
1
- import{DashThemeProviderLight as t,useDashThemeContextLight as o,DashThemeContext as r}from"./DashThemeProviderLight";export{r as DashThemeContext,t as DashThemeProviderLight,o as useDashThemeContextLight};
@@ -1 +0,0 @@
1
- import{useEffect as d,useState as g}from"react";import{useDispatch as h}from"react-redux";import{AuthPersistenceService as l,syncDeviceStoreToLocalStorage as A,syncLocalStorageToDeviceStore as f}from"@dashadmin/dash-auth";import{DASH_REDUX_ACTIONS as u}from"@dashadmin/dash-admin-state";import{ACTION_UPDATE_AUTH as p}from"@dashadmin/dash-admin-state/src/redux/reducers/Auth";import m from"@dashadmin/dash-admin/src/contexts/auth/DASHAuthenticationService";import{dashStorage as v,updateDomCssVariables as E}from"@dashadmin/dash-utils";const k=e=>{const t=h();d(()=>{(()=>{console.log("\u{1F50D} Bootstrap: Checking for persisted auth data...");const i=l.getUser(),a=l.getToken(),s=JSON.parse(v.getItem("authenticated")||"false"),o=l.getAuth();if(console.log("\u{1F50D} Bootstrap: Persisted data check:",{hasStoredUser:!!i,hasStoredToken:!!a,isAuthenticated:s,hasPersistedAuth:!!o,currentReduxAuth:e}),s&&i&&a&&!e){console.log("\u{1F504} Bootstrap: Restoring auth session to Redux from localStorage");let c=i;if(typeof i=="string"){console.error("\u274C Bootstrap: Stored user is string, this should not happen");try{c=JSON.parse(i)}catch{console.error("\u274C Bootstrap: Cannot parse user string, clearing auth data"),l.clearAuth();return}}t(u.updateAuth(p,{user:c,authenticated:!0,auth:o?.auth||null})),console.log("\u2705 Bootstrap: Redux state restored from persisted data")}})()},[t,e])},x=()=>{const e=h();d(()=>{const t=n=>{console.log("\u{1F510} Bootstrap: Received logout event",n.detail),e(u.updateAuth(p,{user:null,authenticated:!1,auth:null})),l.clearAuth(),localStorage.clear()};return window.addEventListener("auth:logout",t),()=>{window.removeEventListener("auth:logout",t)}},[e])},C=()=>{const[e,t]=g(!0),[n,i]=g(null),a=h();return d(()=>{e&&(async()=>{try{console.log("\u{1F680} Bootstrap: Starting app initialization..."),await A();const o=await m.initializeApp(!0);if(console.log("\u{1F50D} Bootstrap: Initialization result:",o),o.success){if(console.log("\u2705 Bootstrap: Auto-login successful"),a(u.updateAuth(p,{user:o.user,authenticated:!0,auth:o.auth||null})),window.DashIPCService?.speak(`${o.user?.name}, Bienvenido!`),await f(),i(null),o.redirectAfterLogin){console.log("\u{1F504} Bootstrap: Emitting auth:redirect event",o.redirectAfterLogin);const c=new CustomEvent("auth:redirect",{detail:{to:o.redirectAfterLogin}});window.dispatchEvent(c)}}else{console.log("\u2139\uFE0F Bootstrap: No valid authentication found");const c=l.getAuth();if(c&&c.auth){console.log("\u{1F504} Bootstrap: Found persisted auth data, attempting token initialization...");try{const r=await m.initializeFromToken();if(r.success){if(console.log("\u2705 Bootstrap: Token initialization successful"),a(u.updateAuth(p,{user:r.user,authenticated:!0,auth:r.auth||null})),await f(),i(null),r.redirectAfterLogin){console.log("\u{1F504} Bootstrap: Emitting auth:redirect event",r.redirectAfterLogin);const w=new CustomEvent("auth:redirect",{detail:{to:r.redirectAfterLogin}});window.dispatchEvent(w)}}else console.log("\u274C Bootstrap: Token initialization failed:",r.error),i(null),l.clearAuth()}catch(r){console.error("\u274C Bootstrap: Token initialization error:",r),i(null),l.clearAuth()}}else console.log("\u2139\uFE0F Bootstrap: No persisted auth data found"),l.clearAuth()}}catch(o){console.error("\u274C Bootstrap: App initialization failed:",o),i("Failed to initialize application")}finally{t(!1)}})()},[a,e]),{isLoading:e,initializationError:n}},D=()=>{d(()=>{const t=new URLSearchParams(window.location.search).get("redirect");t&&t!=="/login"&&(console.log("\u2139\uFE0F RedirectTO: Setting redirect to by searchParams to:",t),m.setPendingRedirect(t))},[])},S="dash:locale-change",N=(e=["es","en"],t="es")=>{const n=h();d(()=>{if(typeof window>"u")return;const a=new URLSearchParams(window.location.search).get("lang"),s=localStorage.getItem("dash-user-locale");let o=t;a&&e.includes(a)?o=a:s&&e.includes(s)&&(o=s),s!==o?(console.log(`\u{1F310} Bootstrap: Locale change detected: ${s} -> ${o}`),localStorage.setItem("dash-user-locale",o)):console.log(`\u{1F310} Bootstrap: Initializing locale from storage: ${o}`),console.log(`\u{1F310} Bootstrap: Dispatching locale to Redux: ${o}`),n(u.switchLanguage(o)),console.log(`\u{1F310} Bootstrap: Emitting locale change event: ${o}`),window.dispatchEvent(new CustomEvent(S,{detail:{locale:o}}))},[n,e,t])},U=()=>{const[e,t]=g(typeof window<"u"?window.location.pathname:"/");return d(()=>{if(typeof window>"u")return;const n=()=>{const i=window.location.pathname;i!==e&&(console.log("\u{1F50D} Bootstrap: URL changed from",e,"to",i),t(i))};return window.addEventListener("popstate",n),()=>window.removeEventListener("popstate",n)},[e]),e},b=(e="dark")=>{d(()=>{if(typeof document>"u")return;const t=localStorage.getItem("theme"),n=t==="light"||t==="dark"?t:e;document.documentElement.setAttribute("data-theme",n),t||localStorage.setItem("theme",n)},[e])},O=e=>{if(typeof document>"u"||typeof localStorage>"u")return;const t=localStorage.getItem("theme"),n=t==="light"||t==="dark"?t:e;document.documentElement.setAttribute("data-theme",n),t||localStorage.setItem("theme",n);try{E(n),console.log("\u{1F3A8} Bootstrap: Initialized theme variables for:",n)}catch(i){console.warn("Failed to initialize theme variables:",i)}},F=async()=>{if(typeof window>"u")return;const e=window.electronStore;if(e){const t=await e.syncToLocalStorage();Object.entries(t).forEach(([n,i])=>{window.localStorage.setItem(n,JSON.stringify(i))})}};export{S as LOCALE_CHANGE_EVENT,O as initializeThemeEarly,F as syncElectronStore,C as useAppInitialization,b as useEarlyThemeInit,k as useInitializeReduxFromPersisted,x as useLogoutEventListener,U as usePathnameTracker,D as usePendingRedirect,N as useUrlLocaleDetection};
@@ -1 +0,0 @@
1
- const i=(t,e)=>{if(typeof document>"u")return e;const a=getComputedStyle(document.documentElement).getPropertyValue(t).trim(),r=parseInt(a,10);return isNaN(r)?e:r},l=(t,e="")=>typeof document>"u"?e:getComputedStyle(document.documentElement).getPropertyValue(t).trim()||e,o={sidebarLargeWidth:255,sidebarSmallWidth:64,sidebarHorizontalHeight:120,logoVerticalMaxWidth:130,logoVerticalMaxHeight:130,logoHorizontalMaxWidth:200,logoHorizontalMaxHeight:60},n=()=>({sidebarLargeWidth:i("--sidebar-large-width",o.sidebarLargeWidth),sidebarSmallWidth:i("--sidebar-small-width",o.sidebarSmallWidth),sidebarHorizontalHeight:i("--sidebar-horizontal-height",o.sidebarHorizontalHeight),logoVerticalMaxWidth:i("--logo-vertical-max-width",o.logoVerticalMaxWidth),logoVerticalMaxHeight:i("--logo-vertical-max-height",o.logoVerticalMaxHeight),logoHorizontalMaxWidth:i("--logo-horizontal-max-width",o.logoHorizontalMaxWidth),logoHorizontalMaxHeight:i("--logo-horizontal-max-height",o.logoHorizontalMaxHeight)}),g=(t={})=>{const e={...o,...n(),...t.layoutDimensions};return{appName:t.appName||"Dash App",horizontalLogo:t.horizontalLogo,squaredLogo:t.squaredLogo,loginBackground:t.loginBackground,sidebarPosition:t.sidebarPosition||"left",...e,paddingHorizontal:e.sidebarLargeWidth,paddingVertical:e.sidebarHorizontalHeight}};export{o as DEFAULT_LAYOUT_DIMENSIONS,g as createDefaultPanelSettings,i as getCssVariableNumber,l as getCssVariableString,n as getLayoutDimensionsFromCss};
@@ -1 +0,0 @@
1
- const r=async()=>{if(!(typeof window>"u")&&window.electronStore)try{const e=await window.electronStore.syncToLocalStorage();Object.entries(e).forEach(([o,t])=>{window.localStorage.setItem(o,JSON.stringify(t))}),console.log("\u2705 Electron store synced to localStorage")}catch(e){console.error("\u274C Failed to sync Electron store:",e)}},n=()=>typeof window<"u"&&!!window.electronStore,c=async(e,o)=>{if(typeof window>"u")return o;if(window.electronStore)try{return await window.electronStore.get(e)}catch{return o}const t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{return t}return o},i=async(e,o)=>{if(!(typeof window>"u")){if(window.electronStore)try{await window.electronStore.set(e,o)}catch(t){console.error("Failed to set Electron store value:",t)}localStorage.setItem(e,JSON.stringify(o))}};export{c as getElectronStoreValue,n as isElectron,i as setElectronStoreValue,r as syncElectronStoreToLocalStorage};
@@ -1 +0,0 @@
1
- import{useInitializeReduxFromPersisted as o,useLogoutEventListener as r,useAppInitialization as i,usePendingRedirect as s,useUrlLocaleDetection as a,usePathnameTracker as n,useEarlyThemeInit as l,initializeThemeEarly as u,syncElectronStore as c}from"./DashBootstrapUtils";import{syncElectronStoreToLocalStorage as p,isElectron as g,getElectronStoreValue as E,setElectronStoreValue as S}from"./electronStore";import{getCssVariableNumber as L,getCssVariableString as D,getLayoutDimensionsFromCss as f,createDefaultPanelSettings as x,DEFAULT_LAYOUT_DIMENSIONS as I}from"./cssVariables";export{I as DEFAULT_LAYOUT_DIMENSIONS,x as createDefaultPanelSettings,L as getCssVariableNumber,D as getCssVariableString,E as getElectronStoreValue,f as getLayoutDimensionsFromCss,u as initializeThemeEarly,g as isElectron,S as setElectronStoreValue,c as syncElectronStore,p as syncElectronStoreToLocalStorage,i as useAppInitialization,l as useEarlyThemeInit,o as useInitializeReduxFromPersisted,r as useLogoutEventListener,n as usePathnameTracker,s as usePendingRedirect,a as useUrlLocaleDetection};