@symbo.ls/link 2.11.248 → 2.11.270

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 +8 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { router as defaultRouter } from '@domql/router'
4
+ import { isDefined } from '@domql/utils'
4
5
  import { Focusable } from '@symbo.ls/atoms'
5
6
 
6
7
  export const Link = {
@@ -29,20 +30,21 @@ export const RouterLink = {
29
30
  on: {
30
31
  click: (event, el) => {
31
32
  const { props, context: ctx } = el
32
- const { href } = props
33
+ const { href, scrollToTop } = props
33
34
  if (!href) return
34
- debugger
35
35
  const { utils, snippets, routerOptions } = ctx
36
36
  const root = el.__ref.__root
37
37
  const linkIsExternal = href.includes('http://') ||
38
38
  href.includes('https://') ||
39
39
  href.includes('mailto:') ||
40
40
  href.includes('tel:')
41
- const options = props.routerOptions || routerOptions || {
42
- scrollToOptions: { behaviour: 'instant' }
43
- }
44
41
  if (href && !linkIsExternal) {
45
- (snippets.router || utils.router || defaultRouter)(href, root, {}, options)
42
+ (snippets.router || utils.router || defaultRouter)(href, root, {}, {
43
+ scrollToOptions: { behaviour: 'instant' },
44
+ scrollToTop: isDefined(scrollToTop) ? scrollToTop : true,
45
+ ...routerOptions,
46
+ ...props.routerOptions
47
+ })
46
48
  event.preventDefault()
47
49
  }
48
50
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/link",
3
- "version": "2.11.248",
3
+ "version": "2.11.270",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "e7d1b63df87608e9cf336f712c1b2bd2879450bc",
6
+ "gitHead": "4694cb8cc07ed7dd10624ad23e3ea5de7f45881a",
7
7
  "dependencies": {
8
8
  "@domql/router": "latest",
9
9
  "@symbo.ls/atoms": "latest"