@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/dist/index.d.ts
CHANGED
|
@@ -1210,6 +1210,129 @@ export declare interface ModelContext {
|
|
|
1210
1210
|
|
|
1211
1211
|
export declare function Nav(props: NavProps): JSX.Element;
|
|
1212
1212
|
|
|
1213
|
+
export declare function NavBar(props: NavBarProps): JSX.Element;
|
|
1214
|
+
|
|
1215
|
+
export declare interface NavBarDestination {
|
|
1216
|
+
href: string;
|
|
1217
|
+
label: string;
|
|
1218
|
+
active?: boolean;
|
|
1219
|
+
external?: boolean;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
export declare interface NavBarGroup {
|
|
1223
|
+
label: string;
|
|
1224
|
+
items: readonly NavBarDestination[];
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
export declare const navBarMeta: {
|
|
1228
|
+
readonly name: "NavBar";
|
|
1229
|
+
readonly category: "navigation";
|
|
1230
|
+
readonly 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.";
|
|
1231
|
+
readonly 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.";
|
|
1232
|
+
readonly 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.";
|
|
1233
|
+
readonly status: "experimental";
|
|
1234
|
+
readonly props: {
|
|
1235
|
+
readonly label: {
|
|
1236
|
+
readonly kind: "string";
|
|
1237
|
+
readonly description: "What this navigation is for. Rendered as the landmark's accessible name and as the root of the coordinate.";
|
|
1238
|
+
readonly required: true;
|
|
1239
|
+
};
|
|
1240
|
+
readonly groups: {
|
|
1241
|
+
readonly kind: "array";
|
|
1242
|
+
readonly description: "The destinations, as groups of { label, items }, each item { href, label, active?, external? }. Order is the order a person travels them.";
|
|
1243
|
+
readonly required: true;
|
|
1244
|
+
};
|
|
1245
|
+
readonly emptyLabel: {
|
|
1246
|
+
readonly kind: "string";
|
|
1247
|
+
readonly description: "What the bar says when a filter matches no destination.";
|
|
1248
|
+
readonly default: "No match";
|
|
1249
|
+
};
|
|
1250
|
+
readonly trailEmptyLabel: {
|
|
1251
|
+
readonly kind: "string";
|
|
1252
|
+
readonly description: "What the bar says when nothing has been visited through it yet.";
|
|
1253
|
+
readonly default: "Nothing visited yet";
|
|
1254
|
+
};
|
|
1255
|
+
readonly open: {
|
|
1256
|
+
readonly kind: "enum";
|
|
1257
|
+
readonly 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.";
|
|
1258
|
+
readonly values: readonly ["trail", "group", "leaf", "closed"];
|
|
1259
|
+
};
|
|
1260
|
+
readonly onOpenChange: {
|
|
1261
|
+
readonly kind: "handler";
|
|
1262
|
+
readonly description: "Called with the segment the bar wants open, or 'closed'. Required when open is controlled, so the bar can still close itself.";
|
|
1263
|
+
};
|
|
1264
|
+
readonly onNavigate: {
|
|
1265
|
+
readonly kind: "handler";
|
|
1266
|
+
readonly 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.";
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1269
|
+
readonly state: {
|
|
1270
|
+
readonly destinations: {
|
|
1271
|
+
readonly description: "How many destinations the bar holds.";
|
|
1272
|
+
readonly attribute: "data-sprint-destinations";
|
|
1273
|
+
};
|
|
1274
|
+
readonly open: {
|
|
1275
|
+
readonly description: "Which segment of the coordinate is open: trail, group, or leaf. Absent when the bar is closed to its one line.";
|
|
1276
|
+
readonly attribute: "data-sprint-open";
|
|
1277
|
+
};
|
|
1278
|
+
readonly depth: {
|
|
1279
|
+
readonly description: "How many destinations have been visited through this bar.";
|
|
1280
|
+
readonly attribute: "data-sprint-depth";
|
|
1281
|
+
};
|
|
1282
|
+
readonly matches: {
|
|
1283
|
+
readonly description: "How many destinations the open segment is showing.";
|
|
1284
|
+
readonly attribute: "data-sprint-matches";
|
|
1285
|
+
};
|
|
1286
|
+
readonly shown: {
|
|
1287
|
+
readonly description: "On a destination: present when the open segment is currently showing it to a person. Every destination stays in the page either way.";
|
|
1288
|
+
readonly attribute: "data-sprint-shown";
|
|
1289
|
+
};
|
|
1290
|
+
readonly group: {
|
|
1291
|
+
readonly description: "On a destination: the group it belongs to.";
|
|
1292
|
+
readonly attribute: "data-sprint-group";
|
|
1293
|
+
};
|
|
1294
|
+
readonly href: {
|
|
1295
|
+
readonly description: "On a destination: where it goes.";
|
|
1296
|
+
readonly attribute: "data-sprint-href";
|
|
1297
|
+
};
|
|
1298
|
+
readonly active: {
|
|
1299
|
+
readonly description: "On a destination: present when it is the current page.";
|
|
1300
|
+
readonly attribute: "data-sprint-active";
|
|
1301
|
+
};
|
|
1302
|
+
};
|
|
1303
|
+
readonly agentView: {
|
|
1304
|
+
readonly 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]";
|
|
1305
|
+
};
|
|
1306
|
+
readonly a11y: {
|
|
1307
|
+
readonly role: "navigation";
|
|
1308
|
+
readonly 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.";
|
|
1309
|
+
};
|
|
1310
|
+
readonly relatedComponents: readonly ["Nav", "NavGroup", "Link", "Shell"];
|
|
1311
|
+
readonly examples: readonly [{
|
|
1312
|
+
readonly title: "A coordinate bar";
|
|
1313
|
+
readonly description: "One line of chrome over a grouped catalogue. Clicking a segment opens that level and filters it as you type.";
|
|
1314
|
+
readonly 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/>";
|
|
1315
|
+
}, {
|
|
1316
|
+
readonly title: "Recording where a person has been";
|
|
1317
|
+
readonly 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.";
|
|
1318
|
+
readonly code: "<NavBar\n label=\"Docs\"\n groups={[{ label: \"guides\", items: [{ href: \"#/guide/webmcp\", label: \"WebMCP\" }] }]}\n onNavigate={(destination) => console.log(destination.href)}\n/>";
|
|
1319
|
+
}];
|
|
1320
|
+
};
|
|
1321
|
+
|
|
1322
|
+
export declare type NavBarOpening = NavBarSegment | "closed";
|
|
1323
|
+
|
|
1324
|
+
export declare interface NavBarProps extends Omit<ComponentPropsWithRef<"nav">, "children"> {
|
|
1325
|
+
label: string;
|
|
1326
|
+
groups: readonly NavBarGroup[];
|
|
1327
|
+
emptyLabel?: string;
|
|
1328
|
+
trailEmptyLabel?: string;
|
|
1329
|
+
open?: NavBarOpening;
|
|
1330
|
+
onOpenChange?: (opening: NavBarOpening) => void;
|
|
1331
|
+
onNavigate?: (destination: NavBarDestination) => void;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
export declare type NavBarSegment = "trail" | "group" | "leaf";
|
|
1335
|
+
|
|
1213
1336
|
export declare function NavGroup(props: NavGroupProps): JSX.Element;
|
|
1214
1337
|
|
|
1215
1338
|
export declare const navGroupMeta: {
|