@symbo.ls/link 2.29.49 → 2.29.51

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 +21 -10
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -15,14 +15,16 @@ export const Link = {
15
15
  attr: {
16
16
  href: (el, s, ctx) => {
17
17
  const props = el.props
18
- const href = el.call('exec', props.href, el) || el.call('exec', el.call('exec', props, el).href, el)
18
+ const href =
19
+ el.call('exec', props.href, el) ||
20
+ el.call('exec', el.call('exec', props, el).href, el)
19
21
  if (el.call('isString', href) && href.includes('{{')) {
20
22
  return el.call('replaceLiteralsWithObjectFields', href)
21
23
  }
22
24
  return href
23
25
  },
24
26
  target: ({ props }) => props.target,
25
- 'aria-label': ({ props }) => props.aria ? props.aria.label : props.text,
27
+ 'aria-label': ({ props }) => (props.aria ? props.aria.label : props.text),
26
28
  draggable: ({ props }) => props.draggable
27
29
  }
28
30
  }
@@ -40,20 +42,29 @@ export const RouterLink = {
40
42
 
41
43
  if (stopPropagation) event.stopPropagation()
42
44
  if (!href) return
43
- const { utils, snippets, functions, routerOptions } = ctx
45
+ const { routerOptions } = ctx
44
46
  const root = el.__ref.root
45
- const linkIsExternal = href.includes('http://') ||
47
+ const linkIsExternal =
48
+ href.includes('http://') ||
46
49
  href.includes('https://') ||
47
50
  href.includes('mailto:') ||
48
51
  href.includes('tel:')
49
52
  if (href && !linkIsExternal) {
50
53
  try {
51
- (functions.router || snippets.router || utils.router || defaultRouter)(href, root, {}, {
52
- scrollToOptions: { behaviour: 'instant' },
53
- scrollToTop: el.call('isDefined', scrollToTop) ? scrollToTop : true,
54
- ...routerOptions,
55
- ...props.routerOptions
56
- })
54
+ el.call(
55
+ 'router',
56
+ href,
57
+ root,
58
+ {},
59
+ {
60
+ scrollToOptions: { behaviour: 'instant' },
61
+ scrollToTop: el.call('isDefined', scrollToTop)
62
+ ? scrollToTop
63
+ : true,
64
+ ...routerOptions,
65
+ ...props.routerOptions
66
+ }
67
+ )
57
68
  event.preventDefault()
58
69
  } catch (e) {
59
70
  console.warn(e)
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@symbo.ls/link",
3
- "version": "2.29.49",
3
+ "version": "2.29.51",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "ebfe2d43195e0283db9fd66131d860751c093711",
6
+ "gitHead": "afbffe9a2317d2d0929447ab49251d83296bf546",
7
7
  "dependencies": {
8
- "@domql/router": "^2.29.49",
9
- "@symbo.ls/atoms": "^2.29.49"
8
+ "@domql/router": "^2.29.51",
9
+ "@symbo.ls/atoms": "^2.29.51"
10
10
  },
11
11
  "source": "src/index.js"
12
12
  }