vira 22.1.2 → 22.1.3
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.
|
@@ -18,6 +18,4 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
18
18
|
router: Pick<SpaRouter<any, any, any>, 'createRouteUrl' | 'setRouteOnDirectNavigation'>;
|
|
19
19
|
scrollToTop?: boolean;
|
|
20
20
|
};
|
|
21
|
-
}>, {}, {
|
|
22
|
-
routeChange: import("element-vir").DefinedTypedEventNameDefinition<FullRoute>;
|
|
23
|
-
}, `vira-link-${string}`, "vira-link-hover-color", readonly string[]>;
|
|
21
|
+
}>, {}, {}, `vira-link-${string}`, "vira-link-hover-color", readonly string[]>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { css,
|
|
2
|
-
import { shouldClickEventTriggerRouteChange } from 'spa-router-vir';
|
|
1
|
+
import { css, html, listen } from 'element-vir';
|
|
3
2
|
import { defineViraElement } from './define-vira-element';
|
|
4
3
|
export const ViraLink = defineViraElement()({
|
|
5
4
|
tagName: 'vira-link',
|
|
@@ -29,20 +28,14 @@ export const ViraLink = defineViraElement()({
|
|
|
29
28
|
color: ${cssVars['vira-link-hover-color'].value};
|
|
30
29
|
}
|
|
31
30
|
`,
|
|
32
|
-
|
|
33
|
-
routeChange: defineElementEvent(),
|
|
34
|
-
},
|
|
35
|
-
renderCallback({ inputs, dispatch, events }) {
|
|
31
|
+
renderCallback({ inputs }) {
|
|
36
32
|
function clickCallback(event) {
|
|
37
33
|
if (!inputs.route) {
|
|
38
34
|
return;
|
|
39
35
|
}
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
window.scrollTo(0, 0);
|
|
44
|
-
}
|
|
45
|
-
dispatch(new events.routeChange(inputs.route.route));
|
|
36
|
+
if (inputs.route.router.setRouteOnDirectNavigation(inputs.route.route, event) &&
|
|
37
|
+
inputs.route.scrollToTop) {
|
|
38
|
+
window.scrollTo(0, 0);
|
|
46
39
|
}
|
|
47
40
|
}
|
|
48
41
|
if (inputs.link?.newTab) {
|