@symbo.ls/link 3.6.4 → 3.6.6

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.
Files changed (2) hide show
  1. package/index.js +16 -1
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -59,9 +59,24 @@ export const RouterLink = {
59
59
  if (href && !linkIsExternal) {
60
60
  event.preventDefault()
61
61
  try {
62
+ let targetEl = root
63
+ if (routerOptions && routerOptions.customRouterElement) {
64
+ const parts = Array.isArray(routerOptions.customRouterElement)
65
+ ? routerOptions.customRouterElement
66
+ : routerOptions.customRouterElement.split('.')
67
+ let resolved = root
68
+ for (const part of parts) {
69
+ if (!resolved || !resolved[part]) { resolved = null; break }
70
+ resolved = resolved[part]
71
+ }
72
+ if (resolved) {
73
+ targetEl = resolved
74
+ if (root.routes) targetEl.routes = root.routes
75
+ }
76
+ }
62
77
  ;(functions.router || snippets.router || utils.router || defaultRouter)(
63
78
  href,
64
- root,
79
+ targetEl,
65
80
  {},
66
81
  {
67
82
  scrollToOptions: { behaviour: 'instant' },
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@symbo.ls/link",
3
- "version": "3.6.4",
3
+ "version": "3.6.6",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
7
7
  "dependencies": {
8
- "@domql/router": "^3.6.4",
9
- "@symbo.ls/atoms": "^3.6.4"
8
+ "@domql/router": "^3.6.6",
9
+ "@symbo.ls/atoms": "^3.6.6"
10
10
  },
11
11
  "source": "index.js",
12
12
  "type": "module",