@owlmeans/client-panel 0.1.18-rc.23 → 0.1.18-rc.24
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/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-panel/SKILL.md +1 -1
- package/build/components/nav/helper.d.ts.map +1 -1
- package/build/components/nav/helper.js +7 -6
- package/build/components/nav/helper.js.map +1 -1
- package/build/components/nav/types.d.ts +3 -2
- package/build/components/nav/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/components/nav/helper.ts +8 -6
- package/src/components/nav/types.ts +3 -2
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
152
152
|
your project's skill store (`.agents/skills/`):
|
|
153
153
|
|
|
154
154
|
```sh
|
|
155
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
155
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.13
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-panel",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.24",
|
|
5
|
+
"generatedAt": "2026-09-10T18:54:42.504Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/components/nav/helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/components/nav/helper.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAgB,aAAa,EAAmB,MAAM,YAAY,CAAA;AAE5G,uFAAuF;AACvF,eAAO,MAAM,mBAAmB,EAAE,YAAmD,CAAA;AAErF;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,MAK/C,CAAA;AAED,eAAO,MAAM,eAAe,cACf,YAAY,SAAS,MAAM,GAAG,SAAS,OAAO,MAAM,UAAU,MAAM,KAC9E,MAAgE,CAAA;AAQnE;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,WAAY,cAAc,KAAG,aA6FpD,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { aliasOf } from '@owlmeans/entrypoint';
|
|
2
3
|
import { useContext, useNavigate } from '@owlmeans/client';
|
|
3
4
|
/** Default resolver: no i18n, the caller's fallback wins. See {@link NavTranslate}. */
|
|
4
5
|
export const defaultNavTranslate = (_key, defaultValue) => defaultValue;
|
|
@@ -34,9 +35,9 @@ export const usePanelNav = (config) => {
|
|
|
34
35
|
const sections = config.sections
|
|
35
36
|
.filter(section => section.hidden !== true)
|
|
36
37
|
.map(section => ({ ...section, items: visibleItems(section) }));
|
|
37
|
-
const pathOf = (
|
|
38
|
+
const pathOf = (target) => {
|
|
38
39
|
try {
|
|
39
|
-
return normalizePath(context.entrypoint(
|
|
40
|
+
return normalizePath(context.entrypoint(target).path());
|
|
40
41
|
}
|
|
41
42
|
catch {
|
|
42
43
|
// An alias the app never elevated addresses nothing — it cannot be the current screen,
|
|
@@ -50,7 +51,7 @@ export const usePanelNav = (config) => {
|
|
|
50
51
|
const here = normalizePath(pathname);
|
|
51
52
|
const exact = all.find(item => pathOf(item.alias) === here);
|
|
52
53
|
if (exact != null) {
|
|
53
|
-
current = exact.alias;
|
|
54
|
+
current = aliasOf(exact.alias);
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
57
|
// Longest prefix: a detail screen under a listed one still belongs to its section.
|
|
@@ -58,10 +59,10 @@ export const usePanelNav = (config) => {
|
|
|
58
59
|
.map(item => ({ item, path: pathOf(item.alias) }))
|
|
59
60
|
.filter((entry) => entry.path != null && entry.path !== '/' && here.startsWith(`${entry.path}/`))
|
|
60
61
|
.sort((a, b) => b.path.length - a.path.length)[0];
|
|
61
|
-
current = prefixed
|
|
62
|
+
current = prefixed == null ? null : aliasOf(prefixed.item.alias);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
const sectionOf = (alias) => alias == null ? null : sections.find(section => section.items.some(item => item.alias === alias)) ?? null;
|
|
65
|
+
const sectionOf = (alias) => alias == null ? null : sections.find(section => section.items.some(item => aliasOf(item.alias) === alias)) ?? null;
|
|
65
66
|
let active = sectionOf(current);
|
|
66
67
|
if (active == null && current != null) {
|
|
67
68
|
// The current screen is not listed anywhere — walk up to the ancestor that is, so a
|
|
@@ -83,7 +84,7 @@ export const usePanelNav = (config) => {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
const isItemActive = (item) => item.alias === current;
|
|
87
|
+
const isItemActive = (item) => aliasOf(item.alias) === current;
|
|
87
88
|
const isSectionActive = (section) => active != null && section.name === active.name;
|
|
88
89
|
return {
|
|
89
90
|
sections,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/components/nav/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/components/nav/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAG9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI1D,uFAAuF;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAiB,CAAC,IAAI,E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C;YACD,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;YACrC,MAAM,EAAE,MAAM,CAAC,EAAE;gBACf,MAAM,KAAK,GAAG,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAA;gBACvE,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;oBAClB,OAAO,SAAS,CAAA;gBAClB,CAAC;gBACD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;gBAE1B,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;YAC9D,CAAC;SACF,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AACpD,CAAC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
+
import type { EntrypointTarget } from '@owlmeans/client';
|
|
2
3
|
/**
|
|
3
4
|
* One screen in the navigation — the second menu level.
|
|
4
5
|
*
|
|
@@ -6,7 +7,7 @@ import type { ComponentType } from 'react';
|
|
|
6
7
|
* resolves it, and a path that changes shape stays correct everywhere it is rendered.
|
|
7
8
|
*/
|
|
8
9
|
export interface PanelNavItem {
|
|
9
|
-
alias:
|
|
10
|
+
alias: EntrypointTarget;
|
|
10
11
|
/** Literal label. Absent, the label is resolved through `translate` and falls back to a humanized alias. */
|
|
11
12
|
label?: string;
|
|
12
13
|
Icon?: ComponentType<{
|
|
@@ -31,7 +32,7 @@ export interface PanelNavConfig {
|
|
|
31
32
|
}
|
|
32
33
|
/** A footer link: exactly one of `alias` (an entrypoint) or `href` (anything else). */
|
|
33
34
|
export interface PanelNavLink {
|
|
34
|
-
alias?:
|
|
35
|
+
alias?: EntrypointTarget;
|
|
35
36
|
href?: string;
|
|
36
37
|
label?: string;
|
|
37
38
|
/** Open in a new tab. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/nav/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/nav/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,gBAAgB,CAAA;IACvB,4GAA4G;IAC5G,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+EAA+E;IAC/E,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B;AAED,uFAAuF;AACvF,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yBAAyB;IACzB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,yEAAyE;IACzE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,eAAe,GAAG,IAAI,CAAA;IAC9B;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAA;IACtD,YAAY,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAA;IAC7C,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,IAAI,CAAA;IACnD,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,IAAI,CAAA;IAC1C;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,KAAK,MAAM,GAAG,SAAS,CAAA;CACvE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/client-panel",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.24",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@hookform/resolvers": "^5.2.2",
|
|
39
|
-
"@owlmeans/client": "^0.1.18-rc.
|
|
40
|
-
"@owlmeans/client-i18n": "^0.1.18-rc.
|
|
41
|
-
"@owlmeans/client-entrypoint": "^0.1.18-rc.
|
|
42
|
-
"@owlmeans/client-route": "^0.1.18-rc.
|
|
43
|
-
"@owlmeans/error": "^0.1.18-rc.
|
|
44
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
39
|
+
"@owlmeans/client": "^0.1.18-rc.17",
|
|
40
|
+
"@owlmeans/client-i18n": "^0.1.18-rc.16",
|
|
41
|
+
"@owlmeans/client-entrypoint": "^0.1.18-rc.14",
|
|
42
|
+
"@owlmeans/client-route": "^0.1.18-rc.14",
|
|
43
|
+
"@owlmeans/error": "^0.1.18-rc.9",
|
|
44
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.12"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
48
|
-
"@owlmeans/client-auth": "^0.1.18-rc.
|
|
49
|
-
"@owlmeans/config": "^0.1.18-rc.
|
|
50
|
-
"@owlmeans/i18n": "^0.1.18-rc.
|
|
51
|
-
"@owlmeans/router": "^0.1.18-rc.
|
|
47
|
+
"@owlmeans/auth": "^0.1.18-rc.10",
|
|
48
|
+
"@owlmeans/client-auth": "^0.1.18-rc.21",
|
|
49
|
+
"@owlmeans/config": "^0.1.18-rc.13",
|
|
50
|
+
"@owlmeans/i18n": "^0.1.18-rc.9",
|
|
51
|
+
"@owlmeans/router": "^0.1.18-rc.9",
|
|
52
52
|
"ajv": "*",
|
|
53
53
|
"react": "*",
|
|
54
54
|
"react-hook-form": "*"
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@owlmeans/dep-config": "workspace:*",
|
|
66
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
67
|
-
"@owlmeans/client-auth": "^0.1.18-rc.
|
|
66
|
+
"@owlmeans/auth": "^0.1.18-rc.10",
|
|
67
|
+
"@owlmeans/client-auth": "^0.1.18-rc.21",
|
|
68
68
|
"@types/react": "^19.2.17",
|
|
69
69
|
"nodemon": "^3.1.14",
|
|
70
70
|
"react-hook-form": "^7.53.0",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
2
|
import type { ClientRoute } from '@owlmeans/client-route'
|
|
3
3
|
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
4
|
+
import { aliasOf } from '@owlmeans/entrypoint'
|
|
5
|
+
import type { EntrypointTarget } from '@owlmeans/client'
|
|
4
6
|
import type { Location } from '@owlmeans/router'
|
|
5
7
|
import { useContext, useNavigate } from '@owlmeans/client'
|
|
6
8
|
|
|
@@ -53,9 +55,9 @@ export const usePanelNav = (config: PanelNavConfig): PanelNavModel => {
|
|
|
53
55
|
.filter(section => section.hidden !== true)
|
|
54
56
|
.map(section => ({ ...section, items: visibleItems(section) }))
|
|
55
57
|
|
|
56
|
-
const pathOf = (
|
|
58
|
+
const pathOf = (target: EntrypointTarget): string | null => {
|
|
57
59
|
try {
|
|
58
|
-
return normalizePath(context.entrypoint<ClientEntrypoint<string>>(
|
|
60
|
+
return normalizePath(context.entrypoint<ClientEntrypoint<string>>(target).path())
|
|
59
61
|
} catch {
|
|
60
62
|
// An alias the app never elevated addresses nothing — it cannot be the current screen,
|
|
61
63
|
// and it must not take the menu down with it.
|
|
@@ -70,7 +72,7 @@ export const usePanelNav = (config: PanelNavConfig): PanelNavModel => {
|
|
|
70
72
|
const here = normalizePath(pathname)
|
|
71
73
|
const exact = all.find(item => pathOf(item.alias) === here)
|
|
72
74
|
if (exact != null) {
|
|
73
|
-
current = exact.alias
|
|
75
|
+
current = aliasOf(exact.alias)
|
|
74
76
|
} else {
|
|
75
77
|
// Longest prefix: a detail screen under a listed one still belongs to its section.
|
|
76
78
|
const prefixed = all
|
|
@@ -78,12 +80,12 @@ export const usePanelNav = (config: PanelNavConfig): PanelNavModel => {
|
|
|
78
80
|
.filter((entry): entry is { item: PanelNavItem, path: string } =>
|
|
79
81
|
entry.path != null && entry.path !== '/' && here.startsWith(`${entry.path}/`))
|
|
80
82
|
.sort((a, b) => b.path.length - a.path.length)[0]
|
|
81
|
-
current = prefixed
|
|
83
|
+
current = prefixed == null ? null : aliasOf(prefixed.item.alias)
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
const sectionOf = (alias: string | null): PanelNavSection | null =>
|
|
86
|
-
alias == null ? null : sections.find(section => section.items.some(item => item.alias === alias)) ?? null
|
|
88
|
+
alias == null ? null : sections.find(section => section.items.some(item => aliasOf(item.alias) === alias)) ?? null
|
|
87
89
|
|
|
88
90
|
let active = sectionOf(current)
|
|
89
91
|
if (active == null && current != null) {
|
|
@@ -106,7 +108,7 @@ export const usePanelNav = (config: PanelNavConfig): PanelNavModel => {
|
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
const isItemActive = (item: PanelNavItem): boolean => item.alias === current
|
|
111
|
+
const isItemActive = (item: PanelNavItem): boolean => aliasOf(item.alias) === current
|
|
110
112
|
const isSectionActive = (section: PanelNavSection): boolean =>
|
|
111
113
|
active != null && section.name === active.name
|
|
112
114
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
|
+
import type { EntrypointTarget } from '@owlmeans/client'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* One screen in the navigation — the second menu level.
|
|
@@ -7,7 +8,7 @@ import type { ComponentType } from 'react'
|
|
|
7
8
|
* resolves it, and a path that changes shape stays correct everywhere it is rendered.
|
|
8
9
|
*/
|
|
9
10
|
export interface PanelNavItem {
|
|
10
|
-
alias:
|
|
11
|
+
alias: EntrypointTarget
|
|
11
12
|
/** Literal label. Absent, the label is resolved through `translate` and falls back to a humanized alias. */
|
|
12
13
|
label?: string
|
|
13
14
|
Icon?: ComponentType<{ className?: string }>
|
|
@@ -33,7 +34,7 @@ export interface PanelNavConfig {
|
|
|
33
34
|
|
|
34
35
|
/** A footer link: exactly one of `alias` (an entrypoint) or `href` (anything else). */
|
|
35
36
|
export interface PanelNavLink {
|
|
36
|
-
alias?:
|
|
37
|
+
alias?: EntrypointTarget
|
|
37
38
|
href?: string
|
|
38
39
|
label?: string
|
|
39
40
|
/** Open in a new tab. */
|