@djangocfg/layouts 2.1.541 → 2.1.543
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/README.md +1 -1
- package/package.json +17 -17
- package/src/components/core/JsonLd.tsx +1 -1
- package/src/components/errors/ErrorsTracker/components/ErrorButtons.tsx +4 -7
- package/src/components/errors/ErrorsTracker/components/ErrorToast.tsx +3 -41
- package/src/components/errors/ErrorsTracker/index.ts +1 -4
- package/src/components/errors/ErrorsTracker/providers/ErrorTrackingProvider.tsx +40 -59
- package/src/components/errors/ErrorsTracker/types.ts +2 -53
- package/src/components/errors/ErrorsTracker/utils/curl-generator.ts +2 -2
- package/src/components/errors/ErrorsTracker/utils/formatters.ts +2 -29
- package/src/components/errors/README.md +1 -1
- package/src/configurator/auth/schema.ts +1 -1
- package/src/configurator/index.ts +1 -1
- package/src/configurator/private/schema.ts +1 -1
- package/src/layouts/AppLayout/BaseApp.tsx +25 -43
- package/src/layouts/AppLayout/README.md +1 -2
- package/src/layouts/AuthLayout/AuthLayout.tsx +6 -6
- package/src/layouts/AuthLayout/components/oauth/OAuthCallback.tsx +2 -1
- package/src/layouts/AuthLayout/context.tsx +0 -1
- package/src/layouts/AuthLayout/types.ts +6 -3
- package/src/layouts/PrivateLayout/PrivateLayout.tsx +2 -7
- package/src/layouts/PrivateLayout/components/PrivateSidebarAccount.tsx +1 -1
- package/src/layouts/PrivateLayout/components/SidebarBrand.tsx +3 -8
- package/src/layouts/PrivateLayout/components/SidebarFeatured.tsx +10 -6
- package/src/layouts/PrivateLayout/components/SidebarNavGroup.tsx +7 -7
- package/src/layouts/PublicLayout/components/UserMenu.tsx +0 -1
- package/src/layouts/PublicLayout/footers/DefaultFooter/DefaultFooter.tsx +1 -1
- package/src/layouts/PublicLayout/hooks/useResponsiveOverflow.ts +13 -10
- package/src/layouts/PublicLayout/primitives/NavActions.tsx +7 -9
- package/src/layouts/PublicLayout/primitives/NavDesktopItems.tsx +1 -22
- package/src/layouts/PublicLayout/shared/MobileDrawerShell.tsx +5 -1
- package/src/layouts/PublicLayout/shared/NavbarShell.tsx +7 -25
- package/src/layouts/types/index.ts +0 -1
- package/src/layouts/types/layout.types.ts +1 -4
- package/src/layouts/types/providers.types.ts +1 -14
- package/src/snippets/Breadcrumbs.tsx +3 -3
- package/src/testing/MockAuthFormProvider.tsx +0 -1
- package/src/utils/navItemsShallowEqual.ts +34 -0
- package/src/utils/shallowEqualBy.ts +29 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider Configuration Types
|
|
3
3
|
*
|
|
4
|
-
* Configuration types for layout providers (theme, SWR, MCP chat
|
|
4
|
+
* Configuration types for layout providers (theme, SWR, MCP chat)
|
|
5
5
|
* Note: Analytics, PWA, Push, and Error types are defined in their respective modules
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -25,16 +25,3 @@ export interface SWRConfigOptions {
|
|
|
25
25
|
revalidateOnReconnect?: boolean;
|
|
26
26
|
dedupingInterval?: number;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
// ============================================================================
|
|
30
|
-
// Centrifugo Configuration
|
|
31
|
-
// ============================================================================
|
|
32
|
-
|
|
33
|
-
export interface CentrifugoConfig {
|
|
34
|
-
/** Enable Centrifugo (default: true) */
|
|
35
|
-
enabled?: boolean;
|
|
36
|
-
/** Auto-connect on mount (default: false) */
|
|
37
|
-
autoConnect?: boolean;
|
|
38
|
-
/** Centrifugo server URL */
|
|
39
|
-
url?: string;
|
|
40
|
-
}
|
|
@@ -42,18 +42,18 @@ const Breadcrumbs: React.FC<BreadcrumbsProps> = ({ items, className = "" }) => {
|
|
|
42
42
|
{breadcrumbs.map((item: BreadcrumbItem, index: number) => (
|
|
43
43
|
<li key={item.path} className="flex items-center">
|
|
44
44
|
{index > 0 && (
|
|
45
|
-
<ChevronRight className="w-4 h-4 text-
|
|
45
|
+
<ChevronRight className="w-4 h-4 text-muted-foreground mx-2" />
|
|
46
46
|
)}
|
|
47
47
|
|
|
48
48
|
{item.isActive ? (
|
|
49
|
-
<span className="text-
|
|
49
|
+
<span className="text-foreground font-medium flex items-center gap-1">
|
|
50
50
|
{index === 0 && <Home className="w-4 h-4" />}
|
|
51
51
|
{item.label}
|
|
52
52
|
</span>
|
|
53
53
|
) : (
|
|
54
54
|
<Link
|
|
55
55
|
href={item.path}
|
|
56
|
-
className="text-
|
|
56
|
+
className="text-muted-foreground hover:text-foreground
|
|
57
57
|
transition-colors duration-200 flex items-center gap-1 hover:underline"
|
|
58
58
|
>
|
|
59
59
|
{index === 0 && <Home className="w-4 h-4" />}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NavigationItem } from '../layouts/types/ui.types';
|
|
2
|
+
import { shallowEqualBy } from './shallowEqualBy';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shallow equality for NavigationItem arrays. Compares href, label, external
|
|
6
|
+
* and one-level-deep sub-items so that nav label/badge changes re-render,
|
|
7
|
+
* but object-reference churn from parent is ignored.
|
|
8
|
+
*
|
|
9
|
+
* Lived as two byte-identical copies in NavbarShell and NavDesktopItems.
|
|
10
|
+
* The sub-item pass used `bi.items![j]`, an assertion resting on the length
|
|
11
|
+
* comparison two lines above it; `shallowEqualBy` makes that structural
|
|
12
|
+
* instead, so the non-null assertion is gone rather than relocated.
|
|
13
|
+
*/
|
|
14
|
+
export function navItemsShallowEqual(
|
|
15
|
+
a: NavigationItem[],
|
|
16
|
+
b: NavigationItem[],
|
|
17
|
+
): boolean {
|
|
18
|
+
return shallowEqualBy(
|
|
19
|
+
a,
|
|
20
|
+
b,
|
|
21
|
+
(ai, bi) =>
|
|
22
|
+
ai.href === bi.href &&
|
|
23
|
+
ai.label === bi.label &&
|
|
24
|
+
ai.external === bi.external &&
|
|
25
|
+
shallowEqualBy(
|
|
26
|
+
ai.items,
|
|
27
|
+
bi.items,
|
|
28
|
+
(sub, bsub) =>
|
|
29
|
+
sub.href === bsub.href &&
|
|
30
|
+
sub.label === bsub.label &&
|
|
31
|
+
sub.external === bsub.external,
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pairwise array comparison for `React.memo` props.
|
|
3
|
+
*
|
|
4
|
+
* Four hand-rolled copies of this existed across the nav layouts — two of them
|
|
5
|
+
* (`navItemsShallowEqual` in NavbarShell and NavDesktopItems) byte-identical.
|
|
6
|
+
* Each wrote `const bi = b[i]` inside `a.every`, which is safe only because the
|
|
7
|
+
* length was compared on the line above; under `strict` that produced 26 of the
|
|
8
|
+
* package's 28 errors, all asking the same question about the same missing
|
|
9
|
+
* connection between the guard and the index.
|
|
10
|
+
*
|
|
11
|
+
* `entries()` carries the pair, so an element and its counterpart are produced
|
|
12
|
+
* together and neither can be `undefined`. The guard is not restated — it is
|
|
13
|
+
* expressed once, in the shape of the loop.
|
|
14
|
+
*/
|
|
15
|
+
export function shallowEqualBy<T>(
|
|
16
|
+
a: readonly T[] | undefined,
|
|
17
|
+
b: readonly T[] | undefined,
|
|
18
|
+
equal: (x: T, y: T) => boolean,
|
|
19
|
+
): boolean {
|
|
20
|
+
if (a === b) return true;
|
|
21
|
+
if (!a || !b || a.length !== b.length) return false;
|
|
22
|
+
for (const [index, left] of a.entries()) {
|
|
23
|
+
const right = b[index];
|
|
24
|
+
// `index` comes from `a.entries()` and the lengths matched, so `right`
|
|
25
|
+
// exists. The check is what proves it to the compiler; it is not reachable.
|
|
26
|
+
if (right === undefined || !equal(left, right)) return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|