@askrjs/askr 0.0.14 → 0.0.15
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/dist/router/index.d.ts +35 -3
- package/dist/router/index.js +1 -1
- package/package.json +1 -1
package/dist/router/index.d.ts
CHANGED
|
@@ -35,23 +35,55 @@ declare function navigate(path: string): void;
|
|
|
35
35
|
*/
|
|
36
36
|
interface LinkProps {
|
|
37
37
|
href: string;
|
|
38
|
+
class?: string;
|
|
38
39
|
children?: unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Optional rel attribute for link relationships.
|
|
42
|
+
* Common values: "noopener", "noreferrer", "nofollow"
|
|
43
|
+
*/
|
|
44
|
+
rel?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional target attribute.
|
|
47
|
+
* Use "_blank" for new tab/window.
|
|
48
|
+
*/
|
|
49
|
+
target?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional aria-current attribute for indicating current page/location.
|
|
52
|
+
* Use "page" for the current page in navigation.
|
|
53
|
+
*/
|
|
54
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
55
|
+
/**
|
|
56
|
+
* Optional aria-label for accessibility when link text isn't descriptive enough.
|
|
57
|
+
*/
|
|
58
|
+
'aria-label'?: string;
|
|
39
59
|
}
|
|
40
60
|
/**
|
|
41
61
|
* Link component that prevents default navigation and uses navigate()
|
|
42
62
|
* Provides declarative way to navigate between routes
|
|
43
63
|
*
|
|
44
|
-
*
|
|
64
|
+
* Accessibility features:
|
|
65
|
+
* - Proper semantic <a> element (not a button)
|
|
66
|
+
* - Supports aria-current for indicating active page
|
|
67
|
+
* - Supports aria-label for descriptive labels
|
|
68
|
+
* - Keyboard accessible (Enter key handled by native <a> element)
|
|
69
|
+
*
|
|
70
|
+
* Respects native browser behaviors:
|
|
45
71
|
* - Middle-click (opens in new tab)
|
|
46
72
|
* - Ctrl/Cmd+click (opens in new tab)
|
|
47
73
|
* - Shift+click (opens in new window)
|
|
74
|
+
* - Alt+click (downloads link)
|
|
48
75
|
* - Right-click context menu
|
|
49
76
|
*
|
|
77
|
+
* Best practices:
|
|
78
|
+
* - Use target="_blank" with rel="noopener noreferrer" for external links
|
|
79
|
+
* - Use aria-current="page" for the current page in navigation
|
|
80
|
+
* - Provide descriptive link text or aria-label
|
|
81
|
+
*
|
|
50
82
|
* Uses applyInteractionPolicy to enforce pit-of-success principles:
|
|
51
83
|
* - Interaction behavior centralized in foundations
|
|
52
|
-
* - Keyboard handling
|
|
84
|
+
* - Keyboard handling automatic
|
|
53
85
|
* - Composable via mergeProps
|
|
54
86
|
*/
|
|
55
|
-
declare function Link({ href, children }: LinkProps):
|
|
87
|
+
declare function Link({ href, class: className, children, rel, target, 'aria-current': ariaCurrent, 'aria-label': ariaLabel, }: LinkProps): JSX.Element;
|
|
56
88
|
|
|
57
89
|
export { Link, type LinkProps, Route, RouteHandler, RouteSnapshot, clearRoutes, getRoutes, navigate, route };
|
package/dist/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'../chunk-OD6C42QU.js';export{b as navigate}from'../chunk-OD6C42QU.js';import {i,b as b$
|
|
1
|
+
import {b}from'../chunk-OD6C42QU.js';export{b as navigate}from'../chunk-OD6C42QU.js';import {i,b as b$2}from'../chunk-HZKAD5DE.js';export{k as layout}from'../chunk-HZKAD5DE.js';export{i as clearRoutes,f as getRoutes,e as route}from'../chunk-7DNGQWPJ.js';import'../chunk-D2JSJKCW.js';import'../chunk-LW2VF6A3.js';import'../chunk-HGMOQ3I7.js';import {b as b$1}from'../chunk-BP2CKUO6.js';import'../chunk-37RC6ZT3.js';import'../chunk-62D2TNHX.js';function k({href:r,class:s,children:u,rel:l,target:o,"aria-current":p,"aria-label":c}){let m=i({isNative:true,disabled:false,onPress:f=>{let t=f;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||o||(t.preventDefault(),b(r));}});return b$1("a",b$2(m,{href:r,class:s,rel:l,target:o,"aria-current":p,"aria-label":c,children:u}))}export{k as Link};
|