@westonkd/sprint 0.4.0 → 0.5.0
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/agent-manifest.json +108 -1
- package/dist/index.cjs +67 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +123 -0
- package/dist/index.js +1540 -1210
- package/dist/index.js.map +1 -1
- package/dist/sprint.css +1 -1
- package/package.json +1 -1
package/agent-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"library": "sprint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"conventions": {
|
|
5
5
|
"componentAttribute": "data-sprint",
|
|
6
6
|
"partAttribute": "data-sprint-part",
|
|
@@ -1079,6 +1079,113 @@
|
|
|
1079
1079
|
}
|
|
1080
1080
|
]
|
|
1081
1081
|
},
|
|
1082
|
+
{
|
|
1083
|
+
"name": "NavBar",
|
|
1084
|
+
"category": "navigation",
|
|
1085
|
+
"summary": "A navigation landmark that renders as one line: where you are, written as a coordinate you can edit. Every destination stays in the page as an addressable part; the coordinate decides which of them a person is shown.",
|
|
1086
|
+
"whenToUse": "Use it as an application's primary navigation when the catalogue is larger than a rail can hold, or when the layout needs its full width. Each segment of the coordinate opens its own level and filters as you type, so what a person chooses from is one level rather than the whole set. It takes destinations as data because it counts, filters and orders them.",
|
|
1087
|
+
"whenNotToUse": "Do not use it for a handful of links that fit in a sidebar; that is Nav with NavGroup, which keeps every destination visible at once. Do not use it for links inside prose, and do not pass components in groups: each destination is a label and an href, not a node.",
|
|
1088
|
+
"status": "experimental",
|
|
1089
|
+
"props": {
|
|
1090
|
+
"label": {
|
|
1091
|
+
"kind": "string",
|
|
1092
|
+
"description": "What this navigation is for. Rendered as the landmark's accessible name and as the root of the coordinate.",
|
|
1093
|
+
"required": true
|
|
1094
|
+
},
|
|
1095
|
+
"groups": {
|
|
1096
|
+
"kind": "array",
|
|
1097
|
+
"description": "The destinations, as groups of { label, items }, each item { href, label, active?, external? }. Order is the order a person travels them.",
|
|
1098
|
+
"required": true
|
|
1099
|
+
},
|
|
1100
|
+
"emptyLabel": {
|
|
1101
|
+
"kind": "string",
|
|
1102
|
+
"description": "What the bar says when a filter matches no destination.",
|
|
1103
|
+
"default": "No match"
|
|
1104
|
+
},
|
|
1105
|
+
"trailEmptyLabel": {
|
|
1106
|
+
"kind": "string",
|
|
1107
|
+
"description": "What the bar says when nothing has been visited through it yet.",
|
|
1108
|
+
"default": "Nothing visited yet"
|
|
1109
|
+
},
|
|
1110
|
+
"open": {
|
|
1111
|
+
"kind": "enum",
|
|
1112
|
+
"description": "Which segment is open, or 'closed'. Pass it to drive the bar from outside, such as from an application-level shortcut; leave it off and the bar keeps its own state.",
|
|
1113
|
+
"values": [
|
|
1114
|
+
"trail",
|
|
1115
|
+
"group",
|
|
1116
|
+
"leaf",
|
|
1117
|
+
"closed"
|
|
1118
|
+
]
|
|
1119
|
+
},
|
|
1120
|
+
"onOpenChange": {
|
|
1121
|
+
"kind": "handler",
|
|
1122
|
+
"description": "Called with the segment the bar wants open, or 'closed'. Required when open is controlled, so the bar can still close itself."
|
|
1123
|
+
},
|
|
1124
|
+
"onNavigate": {
|
|
1125
|
+
"kind": "handler",
|
|
1126
|
+
"description": "Called with the destination when one is chosen, before the browser follows the href. Use it to record the visit somewhere that outlives this component."
|
|
1127
|
+
}
|
|
1128
|
+
},
|
|
1129
|
+
"state": {
|
|
1130
|
+
"destinations": {
|
|
1131
|
+
"description": "How many destinations the bar holds.",
|
|
1132
|
+
"attribute": "data-sprint-destinations"
|
|
1133
|
+
},
|
|
1134
|
+
"open": {
|
|
1135
|
+
"description": "Which segment of the coordinate is open: trail, group, or leaf. Absent when the bar is closed to its one line.",
|
|
1136
|
+
"attribute": "data-sprint-open"
|
|
1137
|
+
},
|
|
1138
|
+
"depth": {
|
|
1139
|
+
"description": "How many destinations have been visited through this bar.",
|
|
1140
|
+
"attribute": "data-sprint-depth"
|
|
1141
|
+
},
|
|
1142
|
+
"matches": {
|
|
1143
|
+
"description": "How many destinations the open segment is showing.",
|
|
1144
|
+
"attribute": "data-sprint-matches"
|
|
1145
|
+
},
|
|
1146
|
+
"shown": {
|
|
1147
|
+
"description": "On a destination: present when the open segment is currently showing it to a person. Every destination stays in the page either way.",
|
|
1148
|
+
"attribute": "data-sprint-shown"
|
|
1149
|
+
},
|
|
1150
|
+
"group": {
|
|
1151
|
+
"description": "On a destination: the group it belongs to.",
|
|
1152
|
+
"attribute": "data-sprint-group"
|
|
1153
|
+
},
|
|
1154
|
+
"href": {
|
|
1155
|
+
"description": "On a destination: where it goes.",
|
|
1156
|
+
"attribute": "data-sprint-href"
|
|
1157
|
+
},
|
|
1158
|
+
"active": {
|
|
1159
|
+
"description": "On a destination: present when it is the current page.",
|
|
1160
|
+
"attribute": "data-sprint-active"
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
"agentView": {
|
|
1164
|
+
"example": "- **NavBar** \"Workbench\" [destinations=2, depth=0]\n - part `destination` \"Button\" [group=action, href=#/Button]\n - part `destination` \"Table\" [group=display, href=#/Table, active, shown]"
|
|
1165
|
+
},
|
|
1166
|
+
"a11y": {
|
|
1167
|
+
"role": "navigation",
|
|
1168
|
+
"notes": "The label is the landmark's accessible name. The current destination carries aria-current=page. Destinations the coordinate is not showing are hidden from the accessibility tree by CSS, so a screen reader travels one level at a time exactly as a sighted reader does, while the page itself keeps all of them. From the field, ArrowDown enters the results and ArrowUp at the top returns to it; typing anywhere in the results goes back to the field and keeps the character. Escape closes the bar, as does a press outside it, and the match count is a polite live region. ArrowUp in an empty field recalls the trail, the way a console recalls history."
|
|
1169
|
+
},
|
|
1170
|
+
"relatedComponents": [
|
|
1171
|
+
"Nav",
|
|
1172
|
+
"NavGroup",
|
|
1173
|
+
"Link",
|
|
1174
|
+
"Shell"
|
|
1175
|
+
],
|
|
1176
|
+
"examples": [
|
|
1177
|
+
{
|
|
1178
|
+
"title": "A coordinate bar",
|
|
1179
|
+
"description": "One line of chrome over a grouped catalogue. Clicking a segment opens that level and filters it as you type.",
|
|
1180
|
+
"code": "<NavBar\n label=\"Workbench\"\n groups={[\n { label: \"action\", items: [{ href: \"#/Button\", label: \"Button\" }] },\n { label: \"display\", items: [{ href: \"#/Table\", label: \"Table\", active: true }] },\n ]}\n/>"
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
"title": "Recording where a person has been",
|
|
1184
|
+
"description": "The bar keeps a trail of the destinations chosen through it, reachable from the depth count at its head. onNavigate is how that outlives the component.",
|
|
1185
|
+
"code": "<NavBar\n label=\"Docs\"\n groups={[{ label: \"guides\", items: [{ href: \"#/guide/webmcp\", label: \"WebMCP\" }] }]}\n onNavigate={(destination) => console.log(destination.href)}\n/>"
|
|
1186
|
+
}
|
|
1187
|
+
]
|
|
1188
|
+
},
|
|
1082
1189
|
{
|
|
1083
1190
|
"name": "NavGroup",
|
|
1084
1191
|
"category": "navigation",
|