@molecule/app-top-nav-layout-svelte 1.1.1 → 1.2.0
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 +10 -3
- package/dist/TopNavLayout.svelte +12 -4
- package/dist/TopNavLayout.svelte.d.ts.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-22T17:17:44.615Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-top-nav-layout-svelte
|
|
@@ -86,7 +86,10 @@ interface TopNavLayoutProps {
|
|
|
86
86
|
navItems: ReadonlyArray<TopNavItem>
|
|
87
87
|
/** Snippet rendered at the right of the header (typically a user menu). */
|
|
88
88
|
userMenu?: Snippet
|
|
89
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Aria-label for the primary `<nav>`. Overrides the translated /
|
|
91
|
+
* `defaultValue` `'Primary navigation'` (prop > `t()` > default).
|
|
92
|
+
*/
|
|
90
93
|
navAriaLabel?: string
|
|
91
94
|
/** Extra classes on the outer wrapper. */
|
|
92
95
|
className?: string
|
|
@@ -114,7 +117,7 @@ const TopNavLayout: LegacyComponentType
|
|
|
114
117
|
|
|
115
118
|
Peer dependencies:
|
|
116
119
|
|
|
117
|
-
- `@molecule/app-svelte` ^3.
|
|
120
|
+
- `@molecule/app-svelte` ^3.11.0
|
|
118
121
|
- `@molecule/app-ui` ^1.3.11
|
|
119
122
|
- `@molecule/app-ui-svelte` ^1.1.0
|
|
120
123
|
- `svelte` ^5.0.0
|
|
@@ -134,3 +137,7 @@ render as Material Symbols ligatures and need the Material Symbols font
|
|
|
134
137
|
loaded by the host app. Styling comes from the bonded ClassMap, so a
|
|
135
138
|
theme/ClassMap bond is a prerequisite. `label` is rendered as-is: pass an
|
|
136
139
|
already-translated string.
|
|
140
|
+
|
|
141
|
+
## Translations
|
|
142
|
+
|
|
143
|
+
Translation strings are provided by `@molecule/app-locales-top-nav-layout`.
|
package/dist/TopNavLayout.svelte
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
its router's `<Outlet />` there). Same props, same DOM for the same input.
|
|
6
6
|
-->
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import { Link, useLocation } from '@molecule/app-svelte'
|
|
8
|
+
import { Link, RoutedView, useLocation, useTranslation } from '@molecule/app-svelte'
|
|
9
9
|
import { getClassMap } from '@molecule/app-ui'
|
|
10
10
|
|
|
11
11
|
import type { TopNavItem, TopNavLayoutProps } from './types.js'
|
|
@@ -15,15 +15,23 @@
|
|
|
15
15
|
logoTo = '/',
|
|
16
16
|
navItems,
|
|
17
17
|
userMenu,
|
|
18
|
-
navAriaLabel
|
|
18
|
+
navAriaLabel,
|
|
19
19
|
className,
|
|
20
20
|
dataMolId,
|
|
21
21
|
children,
|
|
22
22
|
}: TopNavLayoutProps = $props()
|
|
23
23
|
|
|
24
|
+
const { t } = useTranslation()
|
|
25
|
+
|
|
24
26
|
const cm = $derived(getClassMap())
|
|
25
27
|
const location = useLocation()
|
|
26
28
|
const pathname = $derived($location.pathname)
|
|
29
|
+
// The nav region's aria-label: prop > `t()` > default. A `$derived` over the
|
|
30
|
+
// locale-reactive `t`, so a locale switch re-renders it, as React's does.
|
|
31
|
+
const navLabel = $derived(
|
|
32
|
+
navAriaLabel ??
|
|
33
|
+
t('topNavLayout.aria.primaryNavigation', undefined, { defaultValue: 'Primary navigation' }),
|
|
34
|
+
)
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
37
|
* Whether react-router's `<NavLink>` would mark `to` active at `pathname`:
|
|
@@ -77,7 +85,7 @@
|
|
|
77
85
|
<Link to={logoTo} class={cm.cn(cm.textSize('2xl'), cm.fontWeight('bold'))}>
|
|
78
86
|
{appName}
|
|
79
87
|
</Link>
|
|
80
|
-
<nav class={cm.flex({ align: 'center', gap: 'md' })} aria-label={
|
|
88
|
+
<nav class={cm.flex({ align: 'center', gap: 'md' })} aria-label={navLabel}>
|
|
81
89
|
{#each navItems as item (item.key)}
|
|
82
90
|
<Link
|
|
83
91
|
to={item.to}
|
|
@@ -96,6 +104,6 @@
|
|
|
96
104
|
</div>
|
|
97
105
|
</header>
|
|
98
106
|
<main>
|
|
99
|
-
{#if children}{@render children()}{/if}
|
|
107
|
+
{#if children}{@render children()}{:else}<RoutedView />{/if}
|
|
100
108
|
</main>
|
|
101
109
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopNavLayout.svelte.d.ts","sourceRoot":"","sources":["../src/TopNavLayout.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"TopNavLayout.svelte.d.ts","sourceRoot":"","sources":["../src/TopNavLayout.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAsGhE,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -25,7 +25,10 @@ export interface TopNavLayoutProps {
|
|
|
25
25
|
navItems: ReadonlyArray<TopNavItem>;
|
|
26
26
|
/** Snippet rendered at the right of the header (typically a user menu). */
|
|
27
27
|
userMenu?: Snippet;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Aria-label for the primary `<nav>`. Overrides the translated /
|
|
30
|
+
* `defaultValue` `'Primary navigation'` (prop > `t()` > default).
|
|
31
|
+
*/
|
|
29
32
|
navAriaLabel?: string;
|
|
30
33
|
/** Extra classes on the outer wrapper. */
|
|
31
34
|
className?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,qFAAqF;IACrF,GAAG,EAAE,MAAM,CAAA;IACX,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,qFAAqF;IACrF,GAAG,EAAE,MAAM,CAAA;IACX,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-top-nav-layout-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Top navigation app shell: brand link + horizontal NavLinks + UserMenu slot, with a router outlet for nested routes",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-top-nav-layout-svelte",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@molecule/app-svelte": "^3.
|
|
52
|
+
"@molecule/app-svelte": "^3.11.0",
|
|
53
53
|
"@molecule/app-ui": "^1.3.11",
|
|
54
54
|
"@molecule/app-ui-svelte": "^1.1.0",
|
|
55
55
|
"svelte": "^5.0.0"
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
59
59
|
"@molecule/app-i18n": "1.2.2",
|
|
60
60
|
"@molecule/app-icons": "1.0.4",
|
|
61
|
-
"@molecule/app-svelte": "3.
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-svelte": "1.
|
|
61
|
+
"@molecule/app-svelte": "3.11.0",
|
|
62
|
+
"@molecule/app-ui": "1.5.0",
|
|
63
|
+
"@molecule/app-ui-svelte": "1.3.0",
|
|
64
64
|
"@sveltejs/package": "3.0.2",
|
|
65
65
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
66
66
|
"@types/node": "26.6.5",
|