@djangocfg/layouts 2.1.154 → 2.1.155
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 +14 -14
- package/src/utils/pathMatcher.ts +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/layouts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.155",
|
|
4
4
|
"description": "Simple, straightforward layout components for Next.js - import and use with props",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"layouts",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"check": "tsc --noEmit"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@djangocfg/api": "^2.1.
|
|
78
|
-
"@djangocfg/centrifugo": "^2.1.
|
|
79
|
-
"@djangocfg/i18n": "^2.1.
|
|
80
|
-
"@djangocfg/ui-core": "^2.1.
|
|
81
|
-
"@djangocfg/ui-nextjs": "^2.1.
|
|
82
|
-
"@djangocfg/ui-tools": "^2.1.
|
|
77
|
+
"@djangocfg/api": "^2.1.155",
|
|
78
|
+
"@djangocfg/centrifugo": "^2.1.155",
|
|
79
|
+
"@djangocfg/i18n": "^2.1.155",
|
|
80
|
+
"@djangocfg/ui-core": "^2.1.155",
|
|
81
|
+
"@djangocfg/ui-nextjs": "^2.1.155",
|
|
82
|
+
"@djangocfg/ui-tools": "^2.1.155",
|
|
83
83
|
"@hookform/resolvers": "^5.2.2",
|
|
84
84
|
"consola": "^3.4.2",
|
|
85
85
|
"lucide-react": "^0.545.0",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
"uuid": "^11.1.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@djangocfg/api": "^2.1.
|
|
106
|
-
"@djangocfg/i18n": "^2.1.
|
|
107
|
-
"@djangocfg/centrifugo": "^2.1.
|
|
108
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
109
|
-
"@djangocfg/ui-core": "^2.1.
|
|
110
|
-
"@djangocfg/ui-nextjs": "^2.1.
|
|
111
|
-
"@djangocfg/ui-tools": "^2.1.
|
|
105
|
+
"@djangocfg/api": "^2.1.155",
|
|
106
|
+
"@djangocfg/i18n": "^2.1.155",
|
|
107
|
+
"@djangocfg/centrifugo": "^2.1.155",
|
|
108
|
+
"@djangocfg/typescript-config": "^2.1.155",
|
|
109
|
+
"@djangocfg/ui-core": "^2.1.155",
|
|
110
|
+
"@djangocfg/ui-nextjs": "^2.1.155",
|
|
111
|
+
"@djangocfg/ui-tools": "^2.1.155",
|
|
112
112
|
"@types/node": "^24.7.2",
|
|
113
113
|
"@types/react": "^19.1.0",
|
|
114
114
|
"@types/react-dom": "^19.1.0",
|
package/src/utils/pathMatcher.ts
CHANGED
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
* Match pathname against glob pattern
|
|
9
9
|
*
|
|
10
10
|
* @param pathname - The URL pathname to match (e.g., '/projects/123/edit')
|
|
11
|
-
* @param pattern - The pattern to match against (e.g., '/projects
|
|
11
|
+
* @param pattern - The pattern to match against (e.g., '/projects/*/edit')
|
|
12
12
|
* @returns true if pathname matches the pattern
|
|
13
13
|
*
|
|
14
14
|
* Glob patterns:
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
15
|
+
* - `*` matches any single path segment
|
|
16
|
+
* - `**` matches any number of path segments (zero or more)
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
*
|
|
20
|
-
* matchGlobPattern('/projects/
|
|
21
|
-
* matchGlobPattern('/
|
|
22
|
-
* matchGlobPattern('/
|
|
19
|
+
* ```ts
|
|
20
|
+
* matchGlobPattern('/projects/123/edit', '/projects/*/edit') // true
|
|
21
|
+
* matchGlobPattern('/projects/abc/edit', '/projects/*/edit') // true
|
|
22
|
+
* matchGlobPattern('/admin/users/1/settings', '/admin/**') // true
|
|
23
|
+
* matchGlobPattern('/projects/edit', '/projects/*/edit') // false
|
|
24
|
+
* ```
|
|
23
25
|
*/
|
|
24
26
|
export function matchGlobPattern(pathname: string, pattern: string): boolean {
|
|
25
27
|
// Normalize paths (remove trailing slashes)
|
|
@@ -89,13 +91,15 @@ export function matchGlobPattern(pathname: string, pattern: string): boolean {
|
|
|
89
91
|
* Supports:
|
|
90
92
|
* - Exact match: '/dashboard' matches '/dashboard'
|
|
91
93
|
* - Prefix match: '/dashboard' matches '/dashboard/settings'
|
|
92
|
-
* - Glob patterns: '/projects
|
|
94
|
+
* - Glob patterns: '/projects/*/edit' matches '/projects/123/edit'
|
|
93
95
|
*
|
|
94
96
|
* @example
|
|
97
|
+
* ```ts
|
|
95
98
|
* matchesPath('/dashboard', '/dashboard') // true
|
|
96
99
|
* matchesPath('/dashboard/settings', '/dashboard') // true
|
|
97
|
-
* matchesPath('/projects/123/edit', '/projects
|
|
100
|
+
* matchesPath('/projects/123/edit', '/projects/*/edit') // true
|
|
98
101
|
* matchesPath('/home', ['/dashboard', '/admin']) // false
|
|
102
|
+
* ```
|
|
99
103
|
*/
|
|
100
104
|
export function matchesPath(pathname: string, enabledPath?: string | string[]): boolean {
|
|
101
105
|
if (!enabledPath) return false;
|