@donotdev/ui 0.0.16 → 0.0.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AppRoutes.d.ts","sourceRoot":"","sources":["../../src/vite-routing/AppRoutes.tsx"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAM7D,OAAO,KAAK,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAGhE,yEAAyE;AACzE,KAAK,oBAAoB,GACrB,CAAC,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC,GAC3C,MAAM,CAAC;AA6FX;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CAChC;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,oBAAoB,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,UAAU,sBAAsB;IAC9B,4CAA4C;IAC5C,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,e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from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // packages/ui/src/vite-routing/AppRoutes.tsx
3
3
  /**
4
4
  * @fileoverview AppRoutes - Professional Route Configuration System
@@ -46,8 +46,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
46
46
  * <RouterProvider router={router} />
47
47
  * ```
48
48
  */
49
- import { lazy, Suspense } from 'react';
49
+ import { lazy, Suspense, useLayoutEffect } from 'react';
50
50
  import { createBrowserRouter } from 'react-router-dom';
51
+ import { useLayout } from '@donotdev/core';
51
52
  import { RootLayout } from './RootLayout';
52
53
  import Loader from '../components/common/Loader';
53
54
  import { AuthGuard } from '../routing/AuthGuard';
@@ -88,6 +89,32 @@ const LazyRoute = ({ component, path, }) => {
88
89
  const Component = lazyComponentCache.get(path);
89
90
  return (_jsx(Suspense, { fallback: _jsx(Loader, {}), children: _jsx(Component, {}) }));
90
91
  };
92
+ /** Extract preset from route meta (meta is unknown at the interface level) */
93
+ function getRoutePreset(meta) {
94
+ if (meta && typeof meta === 'object' && 'preset' in meta) {
95
+ const preset = meta.preset;
96
+ return typeof preset === 'string' ? preset : undefined;
97
+ }
98
+ return undefined;
99
+ }
100
+ /**
101
+ * LayoutRoute - Per-route preset switcher
102
+ *
103
+ * Wraps route elements to apply the route's `meta.preset` override.
104
+ * On mount, sets the route preset override in the theme store.
105
+ * On unmount (navigation away), the next route's LayoutRoute sets its own value.
106
+ * Routes without a preset pass null, falling back to the app's default.
107
+ *
108
+ * Uses useLayoutEffect to apply before paint, avoiding visual flash.
109
+ */
110
+ const LayoutRoute = ({ preset, children, }) => {
111
+ const setRoutePresetOverride = useLayout('setRoutePresetOverride');
112
+ useLayoutEffect(() => {
113
+ // Set route override (or null to clear and use app default)
114
+ setRoutePresetOverride(preset ?? null);
115
+ }, [preset, setRoutePresetOverride]);
116
+ return _jsx(_Fragment, { children: children });
117
+ };
91
118
  /**
92
119
  * Parse auth configuration to PageAuth | false for AuthGuard
93
120
  *
@@ -175,14 +202,14 @@ export function createAppRouter(options) {
175
202
  {
176
203
  /** HomePage route - lazy loaded, public (no AuthGuard) */
177
204
  index: true,
178
- element: (_jsx(LazyRoute, { component: homePageRoute.component, path: homePageRoute.path })),
205
+ element: (_jsx(LayoutRoute, { preset: getRoutePreset(homePageRoute.meta), children: _jsx(LazyRoute, { component: homePageRoute.component, path: homePageRoute.path }) })),
179
206
  },
180
207
  /** All other routes are discovered and rendered here */
181
208
  ...routesWithParsedAuth
182
209
  .filter((route) => route.path !== '/')
183
210
  .map((route) => ({
184
211
  path: route.path.startsWith('/') ? route.path.slice(1) : route.path,
185
- element: route.parsedAuth === false ? (_jsx(LazyRoute, { component: route.component, path: route.path })) : (_jsx(AuthGuard, { auth: route.parsedAuth, children: _jsx(LazyRoute, { component: route.component, path: route.path }) })),
212
+ element: route.parsedAuth === false ? (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), children: _jsx(LazyRoute, { component: route.component, path: route.path }) })) : (_jsx(LayoutRoute, { preset: getRoutePreset(route.meta), children: _jsx(AuthGuard, { auth: route.parsedAuth, children: _jsx(LazyRoute, { component: route.component, path: route.path }) }) })),
186
213
  })),
187
214
  // 404 catch-all route (must be last)
188
215
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/ui",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -49,21 +49,21 @@
49
49
  "dependencies": {
50
50
  "@fontsource/inter": "^5.2.8",
51
51
  "@fontsource/playfair-display": "^5.2.8",
52
- "@fontsource/roboto": "^5.2.9",
52
+ "@fontsource/press-start-2p": "^5.2.5",
53
+ "@fontsource/roboto": "^5.2.10",
53
54
  "@fontsource/space-grotesk": "^5.2.10",
54
55
  "@hookform/resolvers": "^5.2.2",
55
56
  "react-helmet-async": "^2.0.5",
56
- "react-hook-form": "^7.71.1"
57
+ "react-hook-form": "^7.71.2"
57
58
  },
58
59
  "peerDependencies": {
59
- "@donotdev/adv-comps": "^0.0.13",
60
- "@donotdev/auth": "^0.0.9",
61
- "@donotdev/billing": "^0.0.8",
62
- "@donotdev/components": "^0.0.19",
63
- "@donotdev/core": "^0.0.25",
64
- "@donotdev/crud": "^0.0.16",
65
- "@donotdev/firebase": "^0.0.12",
66
- "@donotdev/oauth": "^0.0.8",
60
+ "@donotdev/auth": "^0.0.11",
61
+ "@donotdev/billing": "^0.0.10",
62
+ "@donotdev/components": "^0.0.21",
63
+ "@donotdev/core": "^0.0.27",
64
+ "@donotdev/crud": "^0.0.18",
65
+ "@donotdev/firebase": "^0.0.14",
66
+ "@donotdev/oauth": "^0.0.10",
67
67
  "firebase": "^12.9.0",
68
68
  "lucide-react": "^0.574.0",
69
69
  "react": "^19.2.4",