@rind-ui/testing 0.2.0 → 0.4.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/dist/{adapter-UPhu17S6.d.mts → adapter-C3LQTPFi.d.mts} +20 -1
- package/dist/{compose-DPLnCCnJ.mjs → compose-m76ER6GL.mjs} +34 -2
- package/dist/{dom-BxnIjEBk.d.mts → dom-BH8CVBb2.d.mts} +12 -3
- package/dist/{dom-DZtl6G1E.mjs → dom-DjurZVd0.mjs} +411 -18
- package/dist/dom.d.mts +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/index.d.mts +12533 -1552
- package/dist/index.mjs +2943 -53
- package/dist/inpage.iife.js +7 -4
- package/dist/{playwright-C2LKzGS_.mjs → playwright-BbVj53fU.mjs} +308 -8
- package/dist/{playwright-CtIxjMKr.d.mts → playwright-D2coDhsT.d.mts} +6 -3
- package/dist/playwright.d.mts +1 -1
- package/dist/playwright.mjs +1 -1
- package/dist/setup.mjs +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as navigationLog, i as interceptNativeNavigation, n as installErrorLog, o as installAnnouncementLog, r as fakeRouter, s as recordingAnnouncer, t as domEnv } from "./dom-
|
|
3
|
-
import { n as playwrightEnv, r as watchPageErrors, t as isPage } from "./playwright-
|
|
4
|
-
import { accordionContract, buttonContract, checkboxContract, checkboxGroupContract, collapsibleContract, createService, fieldContract, fieldsetContract, formContract, headingContract, labelContract, linkContract, platforms, platforms as platforms$1, quirkActive, radioGroupContract, segmentedControlContract, separatorContract, separatorContractFor, switchContract, tabsContract, textFieldContract, toggleContract, toggleGroupContract, toolbarContract, withEngine, withEngine as withEngine$1 } from "@rind-ui/core";
|
|
1
|
+
import { a as isEnvFactory, i as hostedPartName, n as UntilTimeout, o as mirror } from "./compose-m76ER6GL.mjs";
|
|
2
|
+
import { a as navigationLog, i as interceptNativeNavigation, n as installErrorLog, o as installAnnouncementLog, r as fakeRouter, s as recordingAnnouncer, t as domEnv } from "./dom-DjurZVd0.mjs";
|
|
3
|
+
import { n as playwrightEnv, r as watchPageErrors, t as isPage } from "./playwright-BbVj53fU.mjs";
|
|
4
|
+
import { accordionContract, alertContract, alertDialogRoleContract, avatarContract, badgeContract, breadcrumbsContract, buttonContract, calendarContract, checkboxContract, checkboxGroupContract, codeBlockContract, collapsibleContract, colorPickerContract, comboboxContract, contextMenuContract, createService, dateFieldContract, dateRangeFieldContract, dialogContract, drawerContract, fieldContract, fieldsetContract, formContract, gridListContract, headingContract, hoverCardContract, imageContract, inlineComboboxContract, labelContract, linkContract, listboxContract, menuContract, menubarContract, menubarMenuContract, meterContract, modalPopoverContract, modalTourContract, navigationMenuContract, nonModalContextMenuContract, nonModalDialogContract, nonModalDrawerContract, nonModalMenuContract, nonModalMenubarMenuContract, numberInputContract, paginationContract, pinInputContract, platforms, platforms as platforms$1, popoverContract, progressContract, promptInputContract, qrCodeContractWith, quirkActive, radioGroupContract, ratingContract, scrollAreaContract, segmentedControlContract, selectContract, separatorContract, separatorContractFor, skeletonContract, sliderContract, splitterContract, switchContract, tabsContract, tagGroupContract, tagsInputContract, textFieldContract, toastContract, toasterContract, toggleContract, toggleGroupContract, toolbarContract, tooltipContract, tourContract, treeViewContract, withEngine, withEngine as withEngine$1 } from "@rind-ui/core";
|
|
5
|
+
import { parseQrPath } from "@rind-ui/core/qr";
|
|
6
|
+
import { colorAreaContract, colorChannelFieldContract, colorFieldContract, colorSliderContract, colorSwatchContract, colorSwatchPickerContract, pickSwatch } from "@rind-ui/core/internal";
|
|
5
7
|
//#region src/accordion-invariants.ts
|
|
6
8
|
const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
7
9
|
"ArrowUp",
|
|
@@ -186,7 +188,7 @@ async function runAction(contract, env, name, args, checkDone = true) {
|
|
|
186
188
|
} catch (e) {
|
|
187
189
|
const seen = await observe(contract, env);
|
|
188
190
|
const expected = typeof done === "function" ? "its postcondition" : JSON.stringify(done);
|
|
189
|
-
throw new Error(`${contract.scope}.${name} [${modality}]: expected ${expected}, observed ${JSON.stringify(seen)}${e instanceof UntilTimeout ? "" : ` (${e instanceof Error ? e.message : String(e)})`}`);
|
|
191
|
+
throw new Error(`${contract.scope}.${name} [${modality}]: expected ${expected}, observed ${JSON.stringify(seen)}; focus on ${await describeFocus(env)}${e instanceof UntilTimeout ? "" : ` (${e instanceof Error ? e.message : String(e)})`}`);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
const PREFERENCE = [
|
|
@@ -194,6 +196,19 @@ const PREFERENCE = [
|
|
|
194
196
|
"keyboard",
|
|
195
197
|
"touch"
|
|
196
198
|
];
|
|
199
|
+
/** Where focus is, for a failed postcondition: a tag, its rind-ui part and its name. */
|
|
200
|
+
async function describeFocus(env) {
|
|
201
|
+
try {
|
|
202
|
+
const f = env.focused();
|
|
203
|
+
if (!await f.exists()) return "nothing (body)";
|
|
204
|
+
const scope = await f.attr("data-scope");
|
|
205
|
+
const part = await f.attr("data-part");
|
|
206
|
+
const where = scope && part ? ` ${scope}.${part}` : "";
|
|
207
|
+
return `<${await f.tagName()}>${where} "${await f.accessibleName()}"`;
|
|
208
|
+
} catch {
|
|
209
|
+
return "unknown";
|
|
210
|
+
}
|
|
211
|
+
}
|
|
197
212
|
function make(contract, factory, anchor, options) {
|
|
198
213
|
const direction = options.direction ?? "ltr";
|
|
199
214
|
const envs = /* @__PURE__ */ new Map();
|
|
@@ -202,6 +217,7 @@ function make(contract, factory, anchor, options) {
|
|
|
202
217
|
if (!env) {
|
|
203
218
|
env = directed(factory.create({
|
|
204
219
|
scope: contract.scope,
|
|
220
|
+
...hostedPartName(contract),
|
|
205
221
|
anchor,
|
|
206
222
|
modality,
|
|
207
223
|
...options.platform ? { platform: options.platform } : {}
|
|
@@ -249,12 +265,58 @@ function getAccordion(target, anchor, options) {
|
|
|
249
265
|
return createDriverWith(accordionContract, target, [anchor], options);
|
|
250
266
|
}
|
|
251
267
|
//#endregion
|
|
268
|
+
//#region src/components/alert.ts
|
|
269
|
+
/**
|
|
270
|
+
* A driver for an Alert: the one whose Title's text is `title`, or the one alert inside
|
|
271
|
+
* `within` (a container element or a Playwright locator; default the target).
|
|
272
|
+
* `announcements()` lists what it announced since the driver was created.
|
|
273
|
+
*/
|
|
274
|
+
function getAlert(target, anchor = {}, options) {
|
|
275
|
+
const { within, title } = anchor;
|
|
276
|
+
return createDriverWith(alertContract, within ?? target, [title === void 0 ? {} : { title }], options);
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/components/avatar.ts
|
|
280
|
+
/**
|
|
281
|
+
* A driver for an Avatar: the one named `name` (role `img`), or, for a decorative avatar,
|
|
282
|
+
* the one avatar root inside `within` (a container element or a Playwright locator).
|
|
283
|
+
*/
|
|
284
|
+
function getAvatar(target, anchor = {}, options) {
|
|
285
|
+
const { within, name } = anchor;
|
|
286
|
+
return createDriverWith(avatarContract, within ?? target, [name === void 0 ? {} : { name }], options);
|
|
287
|
+
}
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/components/badge.ts
|
|
290
|
+
/**
|
|
291
|
+
* A driver for a Badge: the one badge inside `within` (a container element or a Playwright
|
|
292
|
+
* locator; default the target). A badge has no role and no name; several matches fail
|
|
293
|
+
* listing every match.
|
|
294
|
+
*/
|
|
295
|
+
function getBadge(target, anchor = {}, options) {
|
|
296
|
+
return createDriverWith(badgeContract, anchor.within ?? target, [], options);
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/components/breadcrumbs.ts
|
|
300
|
+
/**
|
|
301
|
+
* A driver for the Breadcrumbs landmark named `name`: `follow`, `openCollapsed`,
|
|
302
|
+
* `followCollapsed`, and the queries `items`, `current`, `collapsedCount`, `href`.
|
|
303
|
+
*/
|
|
304
|
+
function getBreadcrumbs(target, anchor, options) {
|
|
305
|
+
return createDriverWith(breadcrumbsContract, target, [anchor], options);
|
|
306
|
+
}
|
|
307
|
+
//#endregion
|
|
252
308
|
//#region src/components/button.ts
|
|
253
309
|
/** A driver for the Button named `name` (role `link` when rendered as a link). */
|
|
254
310
|
function getButton(target, anchor, options) {
|
|
255
311
|
return createDriverWith(buttonContract, target, [anchor], options);
|
|
256
312
|
}
|
|
257
313
|
//#endregion
|
|
314
|
+
//#region src/components/calendar.ts
|
|
315
|
+
/** A driver for the Calendar named `name`: select, focusDate, paging, queries. */
|
|
316
|
+
function getCalendar(target, anchor, options) {
|
|
317
|
+
return createDriverWith(calendarContract, target, [anchor], options);
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
258
320
|
//#region src/components/checkbox.ts
|
|
259
321
|
/** A driver for the Checkbox named `name`. */
|
|
260
322
|
function getCheckbox(target, anchor, options) {
|
|
@@ -267,12 +329,143 @@ function getCheckboxGroup(target, anchor, options) {
|
|
|
267
329
|
return createDriverWith(checkboxGroupContract, target, [anchor], options);
|
|
268
330
|
}
|
|
269
331
|
//#endregion
|
|
332
|
+
//#region src/components/code-block.ts
|
|
333
|
+
/** A driver for the Code Block titled `title`, or the only one in `target`. */
|
|
334
|
+
function getCodeBlock(target, anchor, options) {
|
|
335
|
+
return createDriverWith(codeBlockContract, target, anchor ? [anchor] : [], options);
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
270
338
|
//#region src/components/collapsible.ts
|
|
271
339
|
/** A driver for the Collapsible whose trigger is named `name`. */
|
|
272
340
|
function getCollapsible(target, anchor, options) {
|
|
273
341
|
return createDriverWith(collapsibleContract, target, [anchor], options);
|
|
274
342
|
}
|
|
275
343
|
//#endregion
|
|
344
|
+
//#region src/components/color-area.ts
|
|
345
|
+
/** A driver for the Color Area named `name` (its group). */
|
|
346
|
+
function getColorArea(target, anchor, options) {
|
|
347
|
+
return createDriverWith(colorAreaContract, target, [anchor], options);
|
|
348
|
+
}
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/components/color-field.ts
|
|
351
|
+
/** A driver for the Color Field whose text input is named `name`. */
|
|
352
|
+
function getColorField(target, anchor, options) {
|
|
353
|
+
return createDriverWith(colorFieldContract, target, [anchor], options);
|
|
354
|
+
}
|
|
355
|
+
/** A driver for a Color Channel Field: Number Input's, plus `channel()` and `color()`. */
|
|
356
|
+
function getColorChannelField(target, anchor, options) {
|
|
357
|
+
return createDriverWith(colorChannelFieldContract, target, [anchor], options);
|
|
358
|
+
}
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/components/color-slider.ts
|
|
361
|
+
/**
|
|
362
|
+
* A driver for the Color Slider whose group is `name` (its Label; an unlabelled slider's
|
|
363
|
+
* group has no name, so `name` matches its thumb's channel name): the Slider's driver plus the
|
|
364
|
+
* colour queries and `setChannel(value)` (`setValue(0, value)`).
|
|
365
|
+
*/
|
|
366
|
+
function getColorSlider(target, anchor, options) {
|
|
367
|
+
const driver = createDriverWith(colorSliderContract, target, [anchor], options);
|
|
368
|
+
return Object.assign(driver, {
|
|
369
|
+
/** Keyboard steps to the value (the pointer form is `setValue` in browser modes). */
|
|
370
|
+
setChannel: (value) => driver.via("keyboard").setValue(0, value) });
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/components/color-swatch-picker.ts
|
|
374
|
+
/**
|
|
375
|
+
* A driver for the Color Swatch Picker named `name`: Radio Group's driver plus the colour
|
|
376
|
+
* queries, `pick(key | name | index)` and `move("next" | "previous")`.
|
|
377
|
+
*/
|
|
378
|
+
function getColorSwatchPicker(target, anchor, options) {
|
|
379
|
+
const driver = createDriverWith(colorSwatchPickerContract, target, [anchor], options);
|
|
380
|
+
return Object.assign(driver, {
|
|
381
|
+
pick: (swatch) => pickSwatch(driver.env, swatch),
|
|
382
|
+
move: async (direction) => {
|
|
383
|
+
await driver.env.focused().press(direction === "next" ? "ArrowRight" : "ArrowLeft");
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/components/color-picker.ts
|
|
389
|
+
/** A swatch inside the picker: the swatch's contract under the picker's scope (`swatch`). */
|
|
390
|
+
const pickerSwatch = {
|
|
391
|
+
...colorSwatchContract,
|
|
392
|
+
scope: "color-picker",
|
|
393
|
+
partName: (part) => part === "root" ? "swatch" : part
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* A driver for the Color Picker named `name` (its Control, or its content when inline), with
|
|
397
|
+
* its parts' drivers (`area()`, `slider(channel)`, `input(channel)`, `swatches()`, `swatch(name)`) and
|
|
398
|
+
* `eyeDropper(result | "abort")`, which installs a fake `EyeDropper` on the page's window.
|
|
399
|
+
*/
|
|
400
|
+
function getColorPicker(target, anchor, options) {
|
|
401
|
+
const driver = createDriverWith(colorPickerContract, target, [anchor], options);
|
|
402
|
+
const names = (channel) => channel === "hex" ? "HEX" : channel === "css" ? "CSS" : channel[0]?.toUpperCase() + channel.slice(1);
|
|
403
|
+
return Object.assign(driver, {
|
|
404
|
+
area: (name = "Color area") => getColorArea(target, { name }, options),
|
|
405
|
+
slider: (channel) => getColorSlider(target, { name: names(channel) }, options),
|
|
406
|
+
input: (channel) => channel === "hex" || channel === "css" ? getColorField(target, { name: names(channel) }, options) : getColorChannelField(target, { name: names(channel) }, options),
|
|
407
|
+
swatches: (name = "Color swatches") => getColorSwatchPicker(target, { name }, options),
|
|
408
|
+
/** A `ColorPicker.Swatch`, by its colour name (or label). */
|
|
409
|
+
swatch: (name) => createDriverWith(pickerSwatch, target, [{ name }], options),
|
|
410
|
+
/** Installs a fake EyeDropper that resolves `result` (or rejects as dismissed). */
|
|
411
|
+
eyeDropper: (result, win = globalThis.window) => {
|
|
412
|
+
class FakeEyeDropper {
|
|
413
|
+
open() {
|
|
414
|
+
return result === "abort" ? Promise.reject(new DOMException("dismissed", "AbortError")) : Promise.resolve({ sRGBHex: result });
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
Object.assign(win, { EyeDropper: FakeEyeDropper });
|
|
418
|
+
return () => {
|
|
419
|
+
Reflect.deleteProperty(win, "EyeDropper");
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/components/combobox.ts
|
|
426
|
+
function getCombobox(target, anchor, options) {
|
|
427
|
+
const { inline, ...rest } = options ?? {};
|
|
428
|
+
return inline ? createDriverWith(inlineComboboxContract, target, [anchor], rest) : createDriverWith(comboboxContract, target, [anchor], rest);
|
|
429
|
+
}
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/components/context-menu.ts
|
|
432
|
+
/**
|
|
433
|
+
* A driver for the Context Menu whose region contains `text` (a closed menu has no content
|
|
434
|
+
* to find). `modal: false` for a non-modal one.
|
|
435
|
+
*/
|
|
436
|
+
function getContextMenu(target, anchor, options) {
|
|
437
|
+
const { modal, ...locate } = anchor;
|
|
438
|
+
return createDriverWith(modal === false ? nonModalContextMenuContract : contextMenuContract, target, [locate], options);
|
|
439
|
+
}
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/components/date-field.ts
|
|
442
|
+
function getDateField(target, anchor, options) {
|
|
443
|
+
const { selectionMode, ...locate } = anchor;
|
|
444
|
+
return selectionMode === "range" ? createDriverWith(dateRangeFieldContract, target, [locate], options) : createDriverWith(dateFieldContract, target, [locate], options);
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/components/dialog.ts
|
|
448
|
+
/**
|
|
449
|
+
* A driver for the Dialog named `name`, located through its trigger (`trigger`, default
|
|
450
|
+
* `name`: a closed dialog has no content to find). `modal: false` for a non-modal dialog;
|
|
451
|
+
* `role: "alertdialog"` for a confirmation (an outside press leaves it open; `cancel()` and
|
|
452
|
+
* `confirm(name?)` press its buttons).
|
|
453
|
+
*/
|
|
454
|
+
function getDialog(target, anchor, options) {
|
|
455
|
+
const { modal, role, ...locate } = anchor;
|
|
456
|
+
return createDriverWith(role === "alertdialog" ? alertDialogRoleContract : modal === false ? nonModalDialogContract : dialogContract, target, [locate], options);
|
|
457
|
+
}
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/components/drawer.ts
|
|
460
|
+
/**
|
|
461
|
+
* A driver for the Drawer opened by the trigger named `trigger` (default: `name`): open,
|
|
462
|
+
* close, swipe, pressHandle, pressEscape, queries.
|
|
463
|
+
*/
|
|
464
|
+
function getDrawer(target, anchor, options) {
|
|
465
|
+
const { modal, ...locate } = anchor;
|
|
466
|
+
return createDriverWith(modal === false ? nonModalDrawerContract : drawerContract, target, [locate], options);
|
|
467
|
+
}
|
|
468
|
+
//#endregion
|
|
276
469
|
//#region src/components/field.ts
|
|
277
470
|
/**
|
|
278
471
|
* A driver for the Field labelled `label`. `.control(getX)` builds the control's driver,
|
|
@@ -297,12 +490,35 @@ function getForm(target, anchor, options) {
|
|
|
297
490
|
return createDriverWith(formContract, target, [anchor], options);
|
|
298
491
|
}
|
|
299
492
|
//#endregion
|
|
493
|
+
//#region src/components/grid-list.ts
|
|
494
|
+
/** A driver for the Grid List named `name`: act, check, controls, choose, typeahead, queries. */
|
|
495
|
+
function getGridList(target, anchor, options) {
|
|
496
|
+
return createDriverWith(gridListContract, target, [anchor], options);
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
300
499
|
//#region src/components/heading.ts
|
|
301
500
|
/** A driver for the heading named `name`: `level()`. */
|
|
302
501
|
function getHeading(target, anchor, options) {
|
|
303
502
|
return createDriverWith(headingContract, target, [anchor], options);
|
|
304
503
|
}
|
|
305
504
|
//#endregion
|
|
505
|
+
//#region src/components/hover-card.ts
|
|
506
|
+
/** A driver for the Hover Card previewed by the link (or `role`) named `name`. */
|
|
507
|
+
function getHoverCard(target, anchor, options) {
|
|
508
|
+
return createDriverWith(hoverCardContract, target, [anchor], options);
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/components/image.ts
|
|
512
|
+
/**
|
|
513
|
+
* A driver for an Image: the one named `name` (role `img`: the `<img>` while it loads, Root
|
|
514
|
+
* when there is no image to show; the same driver in every status), or, for a decorative
|
|
515
|
+
* image, the one image root inside `within` (a container element or a Playwright locator).
|
|
516
|
+
*/
|
|
517
|
+
function getImage(target, anchor = {}, options) {
|
|
518
|
+
const { within, name } = anchor;
|
|
519
|
+
return createDriverWith(imageContract, within ?? target, [name === void 0 ? {} : { name }], options);
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
306
522
|
//#region src/components/label.ts
|
|
307
523
|
/** A driver for the Label with exactly this text: `click`, `doubleClick` and queries. */
|
|
308
524
|
function getLabel(target, anchor, options) {
|
|
@@ -315,18 +531,2017 @@ function getLink(target, anchor, options) {
|
|
|
315
531
|
return createDriverWith(linkContract, target, [anchor], options);
|
|
316
532
|
}
|
|
317
533
|
//#endregion
|
|
534
|
+
//#region src/components/listbox.ts
|
|
535
|
+
/** A driver for the Listbox named `name`: choose, toggle, ranges, typeahead, act, queries. */
|
|
536
|
+
function getListbox(target, anchor, options) {
|
|
537
|
+
return createDriverWith(listboxContract, target, [anchor], options);
|
|
538
|
+
}
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region src/components/menu.ts
|
|
541
|
+
/**
|
|
542
|
+
* A driver for the Menu opened by the trigger named `name` (a closed menu has no content
|
|
543
|
+
* to find). `modal: false` for a non-modal menu.
|
|
544
|
+
*/
|
|
545
|
+
function getMenu(target, anchor, options) {
|
|
546
|
+
const { modal, ...locate } = anchor;
|
|
547
|
+
return createDriverWith(modal === false ? nonModalMenuContract : menuContract, target, [locate], options);
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/components/menubar.ts
|
|
551
|
+
/**
|
|
552
|
+
* A driver for the Menubar named `name`; `menu(item)` drives the menu of the bar item named
|
|
553
|
+
* `item` with the Menu driver's actions and queries. `modal: false` for a non-modal bar.
|
|
554
|
+
*/
|
|
555
|
+
function getMenubar(target, anchor, options) {
|
|
556
|
+
const { modal, ...locate } = anchor;
|
|
557
|
+
const bar = createDriverWith(menubarContract, target, [locate], options);
|
|
558
|
+
const menus = modal === false ? nonModalMenubarMenuContract : menubarMenuContract;
|
|
559
|
+
return Object.assign(bar, { menu: (item) => createDriverWith(menus, target, [{ name: item }], options) });
|
|
560
|
+
}
|
|
561
|
+
//#endregion
|
|
562
|
+
//#region src/components/meter.ts
|
|
563
|
+
/** A driver for the Meter named `name` (role `meter`). */
|
|
564
|
+
function getMeter(target, anchor, options) {
|
|
565
|
+
return createDriverWith(meterContract, target, [anchor], options);
|
|
566
|
+
}
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/components/navigation-menu.ts
|
|
569
|
+
/** A driver for the Navigation Menu landmark named `name` ("Main" by default). */
|
|
570
|
+
function getNavigationMenu(target, anchor = { name: "Main" }, options) {
|
|
571
|
+
return createDriverWith(navigationMenuContract, target, [anchor], options);
|
|
572
|
+
}
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/components/number-input.ts
|
|
575
|
+
/** A driver for the Number Input named `name` (`role: "textbox"` under the iOS quirk). */
|
|
576
|
+
function getNumberInput(target, anchor, options) {
|
|
577
|
+
return createDriverWith(numberInputContract, target, [anchor], options);
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/components/pagination.ts
|
|
581
|
+
/** A driver for the Pagination landmark named `name` (default name: "Pagination"). */
|
|
582
|
+
function getPagination(target, anchor, options) {
|
|
583
|
+
return createDriverWith(paginationContract, target, [anchor], options);
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/components/pin-input.ts
|
|
587
|
+
/** A driver for the Pin Input named `name`: type, paste, fill, autofill, slots, queries. */
|
|
588
|
+
function getPinInput(target, anchor, options) {
|
|
589
|
+
return createDriverWith(pinInputContract, target, [anchor], options);
|
|
590
|
+
}
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/components/popover.ts
|
|
593
|
+
/**
|
|
594
|
+
* A driver for the Popover opened by the trigger named `name` (a closed popover has no
|
|
595
|
+
* content to find). `modal: true` for a modal popover.
|
|
596
|
+
*/
|
|
597
|
+
function getPopover(target, anchor, options) {
|
|
598
|
+
const { modal, ...locate } = anchor;
|
|
599
|
+
return createDriverWith(modal === true ? modalPopoverContract : popoverContract, target, [locate], options);
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/components/progress.ts
|
|
603
|
+
/**
|
|
604
|
+
* A driver for the Progress named `name` (role `progressbar`). `announcements()` lists what
|
|
605
|
+
* it announced since creation (the completion announcement).
|
|
606
|
+
*/
|
|
607
|
+
function getProgress(target, anchor, options) {
|
|
608
|
+
return createDriverWith(progressContract, target, [anchor], options);
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region src/components/prompt-input.ts
|
|
612
|
+
/** A driver for the Prompt Input whose Textarea is named `name`: type, submit, stop, attach, recall, queries. */
|
|
613
|
+
function getPromptInput(target, anchor, options) {
|
|
614
|
+
return createDriverWith(promptInputContract, target, [anchor], options);
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/qr/decode.ts
|
|
618
|
+
var QrDecodeError = class extends Error {
|
|
619
|
+
name = "QrDecodeError";
|
|
620
|
+
};
|
|
621
|
+
const ALIGNMENT = [
|
|
622
|
+
[],
|
|
623
|
+
[],
|
|
624
|
+
[6, 18],
|
|
625
|
+
[6, 22],
|
|
626
|
+
[6, 26],
|
|
627
|
+
[6, 30],
|
|
628
|
+
[6, 34],
|
|
629
|
+
[
|
|
630
|
+
6,
|
|
631
|
+
22,
|
|
632
|
+
38
|
|
633
|
+
],
|
|
634
|
+
[
|
|
635
|
+
6,
|
|
636
|
+
24,
|
|
637
|
+
42
|
|
638
|
+
],
|
|
639
|
+
[
|
|
640
|
+
6,
|
|
641
|
+
26,
|
|
642
|
+
46
|
|
643
|
+
],
|
|
644
|
+
[
|
|
645
|
+
6,
|
|
646
|
+
28,
|
|
647
|
+
50
|
|
648
|
+
],
|
|
649
|
+
[
|
|
650
|
+
6,
|
|
651
|
+
30,
|
|
652
|
+
54
|
|
653
|
+
],
|
|
654
|
+
[
|
|
655
|
+
6,
|
|
656
|
+
32,
|
|
657
|
+
58
|
|
658
|
+
],
|
|
659
|
+
[
|
|
660
|
+
6,
|
|
661
|
+
34,
|
|
662
|
+
62
|
|
663
|
+
],
|
|
664
|
+
[
|
|
665
|
+
6,
|
|
666
|
+
26,
|
|
667
|
+
46,
|
|
668
|
+
66
|
|
669
|
+
],
|
|
670
|
+
[
|
|
671
|
+
6,
|
|
672
|
+
26,
|
|
673
|
+
48,
|
|
674
|
+
70
|
|
675
|
+
],
|
|
676
|
+
[
|
|
677
|
+
6,
|
|
678
|
+
26,
|
|
679
|
+
50,
|
|
680
|
+
74
|
|
681
|
+
],
|
|
682
|
+
[
|
|
683
|
+
6,
|
|
684
|
+
30,
|
|
685
|
+
54,
|
|
686
|
+
78
|
|
687
|
+
],
|
|
688
|
+
[
|
|
689
|
+
6,
|
|
690
|
+
30,
|
|
691
|
+
56,
|
|
692
|
+
82
|
|
693
|
+
],
|
|
694
|
+
[
|
|
695
|
+
6,
|
|
696
|
+
30,
|
|
697
|
+
58,
|
|
698
|
+
86
|
|
699
|
+
],
|
|
700
|
+
[
|
|
701
|
+
6,
|
|
702
|
+
34,
|
|
703
|
+
62,
|
|
704
|
+
90
|
|
705
|
+
],
|
|
706
|
+
[
|
|
707
|
+
6,
|
|
708
|
+
28,
|
|
709
|
+
50,
|
|
710
|
+
72,
|
|
711
|
+
94
|
|
712
|
+
],
|
|
713
|
+
[
|
|
714
|
+
6,
|
|
715
|
+
26,
|
|
716
|
+
50,
|
|
717
|
+
74,
|
|
718
|
+
98
|
|
719
|
+
],
|
|
720
|
+
[
|
|
721
|
+
6,
|
|
722
|
+
30,
|
|
723
|
+
54,
|
|
724
|
+
78,
|
|
725
|
+
102
|
|
726
|
+
],
|
|
727
|
+
[
|
|
728
|
+
6,
|
|
729
|
+
28,
|
|
730
|
+
54,
|
|
731
|
+
80,
|
|
732
|
+
106
|
|
733
|
+
],
|
|
734
|
+
[
|
|
735
|
+
6,
|
|
736
|
+
32,
|
|
737
|
+
58,
|
|
738
|
+
84,
|
|
739
|
+
110
|
|
740
|
+
],
|
|
741
|
+
[
|
|
742
|
+
6,
|
|
743
|
+
30,
|
|
744
|
+
58,
|
|
745
|
+
86,
|
|
746
|
+
114
|
|
747
|
+
],
|
|
748
|
+
[
|
|
749
|
+
6,
|
|
750
|
+
34,
|
|
751
|
+
62,
|
|
752
|
+
90,
|
|
753
|
+
118
|
|
754
|
+
],
|
|
755
|
+
[
|
|
756
|
+
6,
|
|
757
|
+
26,
|
|
758
|
+
50,
|
|
759
|
+
74,
|
|
760
|
+
98,
|
|
761
|
+
122
|
|
762
|
+
],
|
|
763
|
+
[
|
|
764
|
+
6,
|
|
765
|
+
30,
|
|
766
|
+
54,
|
|
767
|
+
78,
|
|
768
|
+
102,
|
|
769
|
+
126
|
|
770
|
+
],
|
|
771
|
+
[
|
|
772
|
+
6,
|
|
773
|
+
26,
|
|
774
|
+
52,
|
|
775
|
+
78,
|
|
776
|
+
104,
|
|
777
|
+
130
|
|
778
|
+
],
|
|
779
|
+
[
|
|
780
|
+
6,
|
|
781
|
+
30,
|
|
782
|
+
56,
|
|
783
|
+
82,
|
|
784
|
+
108,
|
|
785
|
+
134
|
|
786
|
+
],
|
|
787
|
+
[
|
|
788
|
+
6,
|
|
789
|
+
34,
|
|
790
|
+
60,
|
|
791
|
+
86,
|
|
792
|
+
112,
|
|
793
|
+
138
|
|
794
|
+
],
|
|
795
|
+
[
|
|
796
|
+
6,
|
|
797
|
+
30,
|
|
798
|
+
58,
|
|
799
|
+
86,
|
|
800
|
+
114,
|
|
801
|
+
142
|
|
802
|
+
],
|
|
803
|
+
[
|
|
804
|
+
6,
|
|
805
|
+
34,
|
|
806
|
+
62,
|
|
807
|
+
90,
|
|
808
|
+
118,
|
|
809
|
+
146
|
|
810
|
+
],
|
|
811
|
+
[
|
|
812
|
+
6,
|
|
813
|
+
30,
|
|
814
|
+
54,
|
|
815
|
+
78,
|
|
816
|
+
102,
|
|
817
|
+
126,
|
|
818
|
+
150
|
|
819
|
+
],
|
|
820
|
+
[
|
|
821
|
+
6,
|
|
822
|
+
24,
|
|
823
|
+
50,
|
|
824
|
+
76,
|
|
825
|
+
102,
|
|
826
|
+
128,
|
|
827
|
+
154
|
|
828
|
+
],
|
|
829
|
+
[
|
|
830
|
+
6,
|
|
831
|
+
28,
|
|
832
|
+
54,
|
|
833
|
+
80,
|
|
834
|
+
106,
|
|
835
|
+
132,
|
|
836
|
+
158
|
|
837
|
+
],
|
|
838
|
+
[
|
|
839
|
+
6,
|
|
840
|
+
32,
|
|
841
|
+
58,
|
|
842
|
+
84,
|
|
843
|
+
110,
|
|
844
|
+
136,
|
|
845
|
+
162
|
|
846
|
+
],
|
|
847
|
+
[
|
|
848
|
+
6,
|
|
849
|
+
26,
|
|
850
|
+
54,
|
|
851
|
+
82,
|
|
852
|
+
110,
|
|
853
|
+
138,
|
|
854
|
+
166
|
|
855
|
+
],
|
|
856
|
+
[
|
|
857
|
+
6,
|
|
858
|
+
30,
|
|
859
|
+
58,
|
|
860
|
+
86,
|
|
861
|
+
114,
|
|
862
|
+
142,
|
|
863
|
+
170
|
|
864
|
+
]
|
|
865
|
+
];
|
|
866
|
+
/** The standard's alignment centres for a version. */
|
|
867
|
+
const alignmentTable = (version) => ALIGNMENT[version] ?? [];
|
|
868
|
+
const BLOCKS = {
|
|
869
|
+
L: [
|
|
870
|
+
[],
|
|
871
|
+
[
|
|
872
|
+
7,
|
|
873
|
+
1,
|
|
874
|
+
26,
|
|
875
|
+
19
|
|
876
|
+
],
|
|
877
|
+
[
|
|
878
|
+
10,
|
|
879
|
+
1,
|
|
880
|
+
44,
|
|
881
|
+
34
|
|
882
|
+
],
|
|
883
|
+
[
|
|
884
|
+
15,
|
|
885
|
+
1,
|
|
886
|
+
70,
|
|
887
|
+
55
|
|
888
|
+
],
|
|
889
|
+
[
|
|
890
|
+
20,
|
|
891
|
+
1,
|
|
892
|
+
100,
|
|
893
|
+
80
|
|
894
|
+
],
|
|
895
|
+
[
|
|
896
|
+
26,
|
|
897
|
+
1,
|
|
898
|
+
134,
|
|
899
|
+
108
|
|
900
|
+
],
|
|
901
|
+
[
|
|
902
|
+
18,
|
|
903
|
+
2,
|
|
904
|
+
86,
|
|
905
|
+
68
|
|
906
|
+
],
|
|
907
|
+
[
|
|
908
|
+
20,
|
|
909
|
+
2,
|
|
910
|
+
98,
|
|
911
|
+
78
|
|
912
|
+
],
|
|
913
|
+
[
|
|
914
|
+
24,
|
|
915
|
+
2,
|
|
916
|
+
121,
|
|
917
|
+
97
|
|
918
|
+
],
|
|
919
|
+
[
|
|
920
|
+
30,
|
|
921
|
+
2,
|
|
922
|
+
146,
|
|
923
|
+
116
|
|
924
|
+
],
|
|
925
|
+
[
|
|
926
|
+
18,
|
|
927
|
+
2,
|
|
928
|
+
86,
|
|
929
|
+
68,
|
|
930
|
+
2,
|
|
931
|
+
87,
|
|
932
|
+
69
|
|
933
|
+
],
|
|
934
|
+
[
|
|
935
|
+
20,
|
|
936
|
+
4,
|
|
937
|
+
101,
|
|
938
|
+
81
|
|
939
|
+
],
|
|
940
|
+
[
|
|
941
|
+
24,
|
|
942
|
+
2,
|
|
943
|
+
116,
|
|
944
|
+
92,
|
|
945
|
+
2,
|
|
946
|
+
117,
|
|
947
|
+
93
|
|
948
|
+
],
|
|
949
|
+
[
|
|
950
|
+
26,
|
|
951
|
+
4,
|
|
952
|
+
133,
|
|
953
|
+
107
|
|
954
|
+
],
|
|
955
|
+
[
|
|
956
|
+
30,
|
|
957
|
+
3,
|
|
958
|
+
145,
|
|
959
|
+
115,
|
|
960
|
+
1,
|
|
961
|
+
146,
|
|
962
|
+
116
|
|
963
|
+
],
|
|
964
|
+
[
|
|
965
|
+
22,
|
|
966
|
+
5,
|
|
967
|
+
109,
|
|
968
|
+
87,
|
|
969
|
+
1,
|
|
970
|
+
110,
|
|
971
|
+
88
|
|
972
|
+
],
|
|
973
|
+
[
|
|
974
|
+
24,
|
|
975
|
+
5,
|
|
976
|
+
122,
|
|
977
|
+
98,
|
|
978
|
+
1,
|
|
979
|
+
123,
|
|
980
|
+
99
|
|
981
|
+
],
|
|
982
|
+
[
|
|
983
|
+
28,
|
|
984
|
+
1,
|
|
985
|
+
135,
|
|
986
|
+
107,
|
|
987
|
+
5,
|
|
988
|
+
136,
|
|
989
|
+
108
|
|
990
|
+
],
|
|
991
|
+
[
|
|
992
|
+
30,
|
|
993
|
+
5,
|
|
994
|
+
150,
|
|
995
|
+
120,
|
|
996
|
+
1,
|
|
997
|
+
151,
|
|
998
|
+
121
|
|
999
|
+
],
|
|
1000
|
+
[
|
|
1001
|
+
28,
|
|
1002
|
+
3,
|
|
1003
|
+
141,
|
|
1004
|
+
113,
|
|
1005
|
+
4,
|
|
1006
|
+
142,
|
|
1007
|
+
114
|
|
1008
|
+
],
|
|
1009
|
+
[
|
|
1010
|
+
28,
|
|
1011
|
+
3,
|
|
1012
|
+
135,
|
|
1013
|
+
107,
|
|
1014
|
+
5,
|
|
1015
|
+
136,
|
|
1016
|
+
108
|
|
1017
|
+
],
|
|
1018
|
+
[
|
|
1019
|
+
28,
|
|
1020
|
+
4,
|
|
1021
|
+
144,
|
|
1022
|
+
116,
|
|
1023
|
+
4,
|
|
1024
|
+
145,
|
|
1025
|
+
117
|
|
1026
|
+
],
|
|
1027
|
+
[
|
|
1028
|
+
28,
|
|
1029
|
+
2,
|
|
1030
|
+
139,
|
|
1031
|
+
111,
|
|
1032
|
+
7,
|
|
1033
|
+
140,
|
|
1034
|
+
112
|
|
1035
|
+
],
|
|
1036
|
+
[
|
|
1037
|
+
30,
|
|
1038
|
+
4,
|
|
1039
|
+
151,
|
|
1040
|
+
121,
|
|
1041
|
+
5,
|
|
1042
|
+
152,
|
|
1043
|
+
122
|
|
1044
|
+
],
|
|
1045
|
+
[
|
|
1046
|
+
30,
|
|
1047
|
+
6,
|
|
1048
|
+
147,
|
|
1049
|
+
117,
|
|
1050
|
+
4,
|
|
1051
|
+
148,
|
|
1052
|
+
118
|
|
1053
|
+
],
|
|
1054
|
+
[
|
|
1055
|
+
26,
|
|
1056
|
+
8,
|
|
1057
|
+
132,
|
|
1058
|
+
106,
|
|
1059
|
+
4,
|
|
1060
|
+
133,
|
|
1061
|
+
107
|
|
1062
|
+
],
|
|
1063
|
+
[
|
|
1064
|
+
28,
|
|
1065
|
+
10,
|
|
1066
|
+
142,
|
|
1067
|
+
114,
|
|
1068
|
+
2,
|
|
1069
|
+
143,
|
|
1070
|
+
115
|
|
1071
|
+
],
|
|
1072
|
+
[
|
|
1073
|
+
30,
|
|
1074
|
+
8,
|
|
1075
|
+
152,
|
|
1076
|
+
122,
|
|
1077
|
+
4,
|
|
1078
|
+
153,
|
|
1079
|
+
123
|
|
1080
|
+
],
|
|
1081
|
+
[
|
|
1082
|
+
30,
|
|
1083
|
+
3,
|
|
1084
|
+
147,
|
|
1085
|
+
117,
|
|
1086
|
+
10,
|
|
1087
|
+
148,
|
|
1088
|
+
118
|
|
1089
|
+
],
|
|
1090
|
+
[
|
|
1091
|
+
30,
|
|
1092
|
+
7,
|
|
1093
|
+
146,
|
|
1094
|
+
116,
|
|
1095
|
+
7,
|
|
1096
|
+
147,
|
|
1097
|
+
117
|
|
1098
|
+
],
|
|
1099
|
+
[
|
|
1100
|
+
30,
|
|
1101
|
+
5,
|
|
1102
|
+
145,
|
|
1103
|
+
115,
|
|
1104
|
+
10,
|
|
1105
|
+
146,
|
|
1106
|
+
116
|
|
1107
|
+
],
|
|
1108
|
+
[
|
|
1109
|
+
30,
|
|
1110
|
+
13,
|
|
1111
|
+
145,
|
|
1112
|
+
115,
|
|
1113
|
+
3,
|
|
1114
|
+
146,
|
|
1115
|
+
116
|
|
1116
|
+
],
|
|
1117
|
+
[
|
|
1118
|
+
30,
|
|
1119
|
+
17,
|
|
1120
|
+
145,
|
|
1121
|
+
115
|
|
1122
|
+
],
|
|
1123
|
+
[
|
|
1124
|
+
30,
|
|
1125
|
+
17,
|
|
1126
|
+
145,
|
|
1127
|
+
115,
|
|
1128
|
+
1,
|
|
1129
|
+
146,
|
|
1130
|
+
116
|
|
1131
|
+
],
|
|
1132
|
+
[
|
|
1133
|
+
30,
|
|
1134
|
+
13,
|
|
1135
|
+
145,
|
|
1136
|
+
115,
|
|
1137
|
+
6,
|
|
1138
|
+
146,
|
|
1139
|
+
116
|
|
1140
|
+
],
|
|
1141
|
+
[
|
|
1142
|
+
30,
|
|
1143
|
+
12,
|
|
1144
|
+
151,
|
|
1145
|
+
121,
|
|
1146
|
+
7,
|
|
1147
|
+
152,
|
|
1148
|
+
122
|
|
1149
|
+
],
|
|
1150
|
+
[
|
|
1151
|
+
30,
|
|
1152
|
+
6,
|
|
1153
|
+
151,
|
|
1154
|
+
121,
|
|
1155
|
+
14,
|
|
1156
|
+
152,
|
|
1157
|
+
122
|
|
1158
|
+
],
|
|
1159
|
+
[
|
|
1160
|
+
30,
|
|
1161
|
+
17,
|
|
1162
|
+
152,
|
|
1163
|
+
122,
|
|
1164
|
+
4,
|
|
1165
|
+
153,
|
|
1166
|
+
123
|
|
1167
|
+
],
|
|
1168
|
+
[
|
|
1169
|
+
30,
|
|
1170
|
+
4,
|
|
1171
|
+
152,
|
|
1172
|
+
122,
|
|
1173
|
+
18,
|
|
1174
|
+
153,
|
|
1175
|
+
123
|
|
1176
|
+
],
|
|
1177
|
+
[
|
|
1178
|
+
30,
|
|
1179
|
+
20,
|
|
1180
|
+
147,
|
|
1181
|
+
117,
|
|
1182
|
+
4,
|
|
1183
|
+
148,
|
|
1184
|
+
118
|
|
1185
|
+
],
|
|
1186
|
+
[
|
|
1187
|
+
30,
|
|
1188
|
+
19,
|
|
1189
|
+
148,
|
|
1190
|
+
118,
|
|
1191
|
+
6,
|
|
1192
|
+
149,
|
|
1193
|
+
119
|
|
1194
|
+
]
|
|
1195
|
+
],
|
|
1196
|
+
M: [
|
|
1197
|
+
[],
|
|
1198
|
+
[
|
|
1199
|
+
10,
|
|
1200
|
+
1,
|
|
1201
|
+
26,
|
|
1202
|
+
16
|
|
1203
|
+
],
|
|
1204
|
+
[
|
|
1205
|
+
16,
|
|
1206
|
+
1,
|
|
1207
|
+
44,
|
|
1208
|
+
28
|
|
1209
|
+
],
|
|
1210
|
+
[
|
|
1211
|
+
26,
|
|
1212
|
+
1,
|
|
1213
|
+
70,
|
|
1214
|
+
44
|
|
1215
|
+
],
|
|
1216
|
+
[
|
|
1217
|
+
18,
|
|
1218
|
+
2,
|
|
1219
|
+
50,
|
|
1220
|
+
32
|
|
1221
|
+
],
|
|
1222
|
+
[
|
|
1223
|
+
24,
|
|
1224
|
+
2,
|
|
1225
|
+
67,
|
|
1226
|
+
43
|
|
1227
|
+
],
|
|
1228
|
+
[
|
|
1229
|
+
16,
|
|
1230
|
+
4,
|
|
1231
|
+
43,
|
|
1232
|
+
27
|
|
1233
|
+
],
|
|
1234
|
+
[
|
|
1235
|
+
18,
|
|
1236
|
+
4,
|
|
1237
|
+
49,
|
|
1238
|
+
31
|
|
1239
|
+
],
|
|
1240
|
+
[
|
|
1241
|
+
22,
|
|
1242
|
+
2,
|
|
1243
|
+
60,
|
|
1244
|
+
38,
|
|
1245
|
+
2,
|
|
1246
|
+
61,
|
|
1247
|
+
39
|
|
1248
|
+
],
|
|
1249
|
+
[
|
|
1250
|
+
22,
|
|
1251
|
+
3,
|
|
1252
|
+
58,
|
|
1253
|
+
36,
|
|
1254
|
+
2,
|
|
1255
|
+
59,
|
|
1256
|
+
37
|
|
1257
|
+
],
|
|
1258
|
+
[
|
|
1259
|
+
26,
|
|
1260
|
+
4,
|
|
1261
|
+
69,
|
|
1262
|
+
43,
|
|
1263
|
+
1,
|
|
1264
|
+
70,
|
|
1265
|
+
44
|
|
1266
|
+
],
|
|
1267
|
+
[
|
|
1268
|
+
30,
|
|
1269
|
+
1,
|
|
1270
|
+
80,
|
|
1271
|
+
50,
|
|
1272
|
+
4,
|
|
1273
|
+
81,
|
|
1274
|
+
51
|
|
1275
|
+
],
|
|
1276
|
+
[
|
|
1277
|
+
22,
|
|
1278
|
+
6,
|
|
1279
|
+
58,
|
|
1280
|
+
36,
|
|
1281
|
+
2,
|
|
1282
|
+
59,
|
|
1283
|
+
37
|
|
1284
|
+
],
|
|
1285
|
+
[
|
|
1286
|
+
22,
|
|
1287
|
+
8,
|
|
1288
|
+
59,
|
|
1289
|
+
37,
|
|
1290
|
+
1,
|
|
1291
|
+
60,
|
|
1292
|
+
38
|
|
1293
|
+
],
|
|
1294
|
+
[
|
|
1295
|
+
24,
|
|
1296
|
+
4,
|
|
1297
|
+
64,
|
|
1298
|
+
40,
|
|
1299
|
+
5,
|
|
1300
|
+
65,
|
|
1301
|
+
41
|
|
1302
|
+
],
|
|
1303
|
+
[
|
|
1304
|
+
24,
|
|
1305
|
+
5,
|
|
1306
|
+
65,
|
|
1307
|
+
41,
|
|
1308
|
+
5,
|
|
1309
|
+
66,
|
|
1310
|
+
42
|
|
1311
|
+
],
|
|
1312
|
+
[
|
|
1313
|
+
28,
|
|
1314
|
+
7,
|
|
1315
|
+
73,
|
|
1316
|
+
45,
|
|
1317
|
+
3,
|
|
1318
|
+
74,
|
|
1319
|
+
46
|
|
1320
|
+
],
|
|
1321
|
+
[
|
|
1322
|
+
28,
|
|
1323
|
+
10,
|
|
1324
|
+
74,
|
|
1325
|
+
46,
|
|
1326
|
+
1,
|
|
1327
|
+
75,
|
|
1328
|
+
47
|
|
1329
|
+
],
|
|
1330
|
+
[
|
|
1331
|
+
26,
|
|
1332
|
+
9,
|
|
1333
|
+
69,
|
|
1334
|
+
43,
|
|
1335
|
+
4,
|
|
1336
|
+
70,
|
|
1337
|
+
44
|
|
1338
|
+
],
|
|
1339
|
+
[
|
|
1340
|
+
26,
|
|
1341
|
+
3,
|
|
1342
|
+
70,
|
|
1343
|
+
44,
|
|
1344
|
+
11,
|
|
1345
|
+
71,
|
|
1346
|
+
45
|
|
1347
|
+
],
|
|
1348
|
+
[
|
|
1349
|
+
26,
|
|
1350
|
+
3,
|
|
1351
|
+
67,
|
|
1352
|
+
41,
|
|
1353
|
+
13,
|
|
1354
|
+
68,
|
|
1355
|
+
42
|
|
1356
|
+
],
|
|
1357
|
+
[
|
|
1358
|
+
26,
|
|
1359
|
+
17,
|
|
1360
|
+
68,
|
|
1361
|
+
42
|
|
1362
|
+
],
|
|
1363
|
+
[
|
|
1364
|
+
28,
|
|
1365
|
+
17,
|
|
1366
|
+
74,
|
|
1367
|
+
46
|
|
1368
|
+
],
|
|
1369
|
+
[
|
|
1370
|
+
28,
|
|
1371
|
+
4,
|
|
1372
|
+
75,
|
|
1373
|
+
47,
|
|
1374
|
+
14,
|
|
1375
|
+
76,
|
|
1376
|
+
48
|
|
1377
|
+
],
|
|
1378
|
+
[
|
|
1379
|
+
28,
|
|
1380
|
+
6,
|
|
1381
|
+
73,
|
|
1382
|
+
45,
|
|
1383
|
+
14,
|
|
1384
|
+
74,
|
|
1385
|
+
46
|
|
1386
|
+
],
|
|
1387
|
+
[
|
|
1388
|
+
28,
|
|
1389
|
+
8,
|
|
1390
|
+
75,
|
|
1391
|
+
47,
|
|
1392
|
+
13,
|
|
1393
|
+
76,
|
|
1394
|
+
48
|
|
1395
|
+
],
|
|
1396
|
+
[
|
|
1397
|
+
28,
|
|
1398
|
+
19,
|
|
1399
|
+
74,
|
|
1400
|
+
46,
|
|
1401
|
+
4,
|
|
1402
|
+
75,
|
|
1403
|
+
47
|
|
1404
|
+
],
|
|
1405
|
+
[
|
|
1406
|
+
28,
|
|
1407
|
+
22,
|
|
1408
|
+
73,
|
|
1409
|
+
45,
|
|
1410
|
+
3,
|
|
1411
|
+
74,
|
|
1412
|
+
46
|
|
1413
|
+
],
|
|
1414
|
+
[
|
|
1415
|
+
28,
|
|
1416
|
+
3,
|
|
1417
|
+
73,
|
|
1418
|
+
45,
|
|
1419
|
+
23,
|
|
1420
|
+
74,
|
|
1421
|
+
46
|
|
1422
|
+
],
|
|
1423
|
+
[
|
|
1424
|
+
28,
|
|
1425
|
+
21,
|
|
1426
|
+
73,
|
|
1427
|
+
45,
|
|
1428
|
+
7,
|
|
1429
|
+
74,
|
|
1430
|
+
46
|
|
1431
|
+
],
|
|
1432
|
+
[
|
|
1433
|
+
28,
|
|
1434
|
+
19,
|
|
1435
|
+
75,
|
|
1436
|
+
47,
|
|
1437
|
+
10,
|
|
1438
|
+
76,
|
|
1439
|
+
48
|
|
1440
|
+
],
|
|
1441
|
+
[
|
|
1442
|
+
28,
|
|
1443
|
+
2,
|
|
1444
|
+
74,
|
|
1445
|
+
46,
|
|
1446
|
+
29,
|
|
1447
|
+
75,
|
|
1448
|
+
47
|
|
1449
|
+
],
|
|
1450
|
+
[
|
|
1451
|
+
28,
|
|
1452
|
+
10,
|
|
1453
|
+
74,
|
|
1454
|
+
46,
|
|
1455
|
+
23,
|
|
1456
|
+
75,
|
|
1457
|
+
47
|
|
1458
|
+
],
|
|
1459
|
+
[
|
|
1460
|
+
28,
|
|
1461
|
+
14,
|
|
1462
|
+
74,
|
|
1463
|
+
46,
|
|
1464
|
+
21,
|
|
1465
|
+
75,
|
|
1466
|
+
47
|
|
1467
|
+
],
|
|
1468
|
+
[
|
|
1469
|
+
28,
|
|
1470
|
+
14,
|
|
1471
|
+
74,
|
|
1472
|
+
46,
|
|
1473
|
+
23,
|
|
1474
|
+
75,
|
|
1475
|
+
47
|
|
1476
|
+
],
|
|
1477
|
+
[
|
|
1478
|
+
28,
|
|
1479
|
+
12,
|
|
1480
|
+
75,
|
|
1481
|
+
47,
|
|
1482
|
+
26,
|
|
1483
|
+
76,
|
|
1484
|
+
48
|
|
1485
|
+
],
|
|
1486
|
+
[
|
|
1487
|
+
28,
|
|
1488
|
+
6,
|
|
1489
|
+
75,
|
|
1490
|
+
47,
|
|
1491
|
+
34,
|
|
1492
|
+
76,
|
|
1493
|
+
48
|
|
1494
|
+
],
|
|
1495
|
+
[
|
|
1496
|
+
28,
|
|
1497
|
+
29,
|
|
1498
|
+
74,
|
|
1499
|
+
46,
|
|
1500
|
+
14,
|
|
1501
|
+
75,
|
|
1502
|
+
47
|
|
1503
|
+
],
|
|
1504
|
+
[
|
|
1505
|
+
28,
|
|
1506
|
+
13,
|
|
1507
|
+
74,
|
|
1508
|
+
46,
|
|
1509
|
+
32,
|
|
1510
|
+
75,
|
|
1511
|
+
47
|
|
1512
|
+
],
|
|
1513
|
+
[
|
|
1514
|
+
28,
|
|
1515
|
+
40,
|
|
1516
|
+
75,
|
|
1517
|
+
47,
|
|
1518
|
+
7,
|
|
1519
|
+
76,
|
|
1520
|
+
48
|
|
1521
|
+
],
|
|
1522
|
+
[
|
|
1523
|
+
28,
|
|
1524
|
+
18,
|
|
1525
|
+
75,
|
|
1526
|
+
47,
|
|
1527
|
+
31,
|
|
1528
|
+
76,
|
|
1529
|
+
48
|
|
1530
|
+
]
|
|
1531
|
+
],
|
|
1532
|
+
Q: [
|
|
1533
|
+
[],
|
|
1534
|
+
[
|
|
1535
|
+
13,
|
|
1536
|
+
1,
|
|
1537
|
+
26,
|
|
1538
|
+
13
|
|
1539
|
+
],
|
|
1540
|
+
[
|
|
1541
|
+
22,
|
|
1542
|
+
1,
|
|
1543
|
+
44,
|
|
1544
|
+
22
|
|
1545
|
+
],
|
|
1546
|
+
[
|
|
1547
|
+
18,
|
|
1548
|
+
2,
|
|
1549
|
+
35,
|
|
1550
|
+
17
|
|
1551
|
+
],
|
|
1552
|
+
[
|
|
1553
|
+
26,
|
|
1554
|
+
2,
|
|
1555
|
+
50,
|
|
1556
|
+
24
|
|
1557
|
+
],
|
|
1558
|
+
[
|
|
1559
|
+
18,
|
|
1560
|
+
2,
|
|
1561
|
+
33,
|
|
1562
|
+
15,
|
|
1563
|
+
2,
|
|
1564
|
+
34,
|
|
1565
|
+
16
|
|
1566
|
+
],
|
|
1567
|
+
[
|
|
1568
|
+
24,
|
|
1569
|
+
4,
|
|
1570
|
+
43,
|
|
1571
|
+
19
|
|
1572
|
+
],
|
|
1573
|
+
[
|
|
1574
|
+
18,
|
|
1575
|
+
2,
|
|
1576
|
+
32,
|
|
1577
|
+
14,
|
|
1578
|
+
4,
|
|
1579
|
+
33,
|
|
1580
|
+
15
|
|
1581
|
+
],
|
|
1582
|
+
[
|
|
1583
|
+
22,
|
|
1584
|
+
4,
|
|
1585
|
+
40,
|
|
1586
|
+
18,
|
|
1587
|
+
2,
|
|
1588
|
+
41,
|
|
1589
|
+
19
|
|
1590
|
+
],
|
|
1591
|
+
[
|
|
1592
|
+
20,
|
|
1593
|
+
4,
|
|
1594
|
+
36,
|
|
1595
|
+
16,
|
|
1596
|
+
4,
|
|
1597
|
+
37,
|
|
1598
|
+
17
|
|
1599
|
+
],
|
|
1600
|
+
[
|
|
1601
|
+
24,
|
|
1602
|
+
6,
|
|
1603
|
+
43,
|
|
1604
|
+
19,
|
|
1605
|
+
2,
|
|
1606
|
+
44,
|
|
1607
|
+
20
|
|
1608
|
+
],
|
|
1609
|
+
[
|
|
1610
|
+
28,
|
|
1611
|
+
4,
|
|
1612
|
+
50,
|
|
1613
|
+
22,
|
|
1614
|
+
4,
|
|
1615
|
+
51,
|
|
1616
|
+
23
|
|
1617
|
+
],
|
|
1618
|
+
[
|
|
1619
|
+
26,
|
|
1620
|
+
4,
|
|
1621
|
+
46,
|
|
1622
|
+
20,
|
|
1623
|
+
6,
|
|
1624
|
+
47,
|
|
1625
|
+
21
|
|
1626
|
+
],
|
|
1627
|
+
[
|
|
1628
|
+
24,
|
|
1629
|
+
8,
|
|
1630
|
+
44,
|
|
1631
|
+
20,
|
|
1632
|
+
4,
|
|
1633
|
+
45,
|
|
1634
|
+
21
|
|
1635
|
+
],
|
|
1636
|
+
[
|
|
1637
|
+
20,
|
|
1638
|
+
11,
|
|
1639
|
+
36,
|
|
1640
|
+
16,
|
|
1641
|
+
5,
|
|
1642
|
+
37,
|
|
1643
|
+
17
|
|
1644
|
+
],
|
|
1645
|
+
[
|
|
1646
|
+
30,
|
|
1647
|
+
5,
|
|
1648
|
+
54,
|
|
1649
|
+
24,
|
|
1650
|
+
7,
|
|
1651
|
+
55,
|
|
1652
|
+
25
|
|
1653
|
+
],
|
|
1654
|
+
[
|
|
1655
|
+
24,
|
|
1656
|
+
15,
|
|
1657
|
+
43,
|
|
1658
|
+
19,
|
|
1659
|
+
2,
|
|
1660
|
+
44,
|
|
1661
|
+
20
|
|
1662
|
+
],
|
|
1663
|
+
[
|
|
1664
|
+
28,
|
|
1665
|
+
1,
|
|
1666
|
+
50,
|
|
1667
|
+
22,
|
|
1668
|
+
15,
|
|
1669
|
+
51,
|
|
1670
|
+
23
|
|
1671
|
+
],
|
|
1672
|
+
[
|
|
1673
|
+
28,
|
|
1674
|
+
17,
|
|
1675
|
+
50,
|
|
1676
|
+
22,
|
|
1677
|
+
1,
|
|
1678
|
+
51,
|
|
1679
|
+
23
|
|
1680
|
+
],
|
|
1681
|
+
[
|
|
1682
|
+
26,
|
|
1683
|
+
17,
|
|
1684
|
+
47,
|
|
1685
|
+
21,
|
|
1686
|
+
4,
|
|
1687
|
+
48,
|
|
1688
|
+
22
|
|
1689
|
+
],
|
|
1690
|
+
[
|
|
1691
|
+
30,
|
|
1692
|
+
15,
|
|
1693
|
+
54,
|
|
1694
|
+
24,
|
|
1695
|
+
5,
|
|
1696
|
+
55,
|
|
1697
|
+
25
|
|
1698
|
+
],
|
|
1699
|
+
[
|
|
1700
|
+
28,
|
|
1701
|
+
17,
|
|
1702
|
+
50,
|
|
1703
|
+
22,
|
|
1704
|
+
6,
|
|
1705
|
+
51,
|
|
1706
|
+
23
|
|
1707
|
+
],
|
|
1708
|
+
[
|
|
1709
|
+
30,
|
|
1710
|
+
7,
|
|
1711
|
+
54,
|
|
1712
|
+
24,
|
|
1713
|
+
16,
|
|
1714
|
+
55,
|
|
1715
|
+
25
|
|
1716
|
+
],
|
|
1717
|
+
[
|
|
1718
|
+
30,
|
|
1719
|
+
11,
|
|
1720
|
+
54,
|
|
1721
|
+
24,
|
|
1722
|
+
14,
|
|
1723
|
+
55,
|
|
1724
|
+
25
|
|
1725
|
+
],
|
|
1726
|
+
[
|
|
1727
|
+
30,
|
|
1728
|
+
11,
|
|
1729
|
+
54,
|
|
1730
|
+
24,
|
|
1731
|
+
16,
|
|
1732
|
+
55,
|
|
1733
|
+
25
|
|
1734
|
+
],
|
|
1735
|
+
[
|
|
1736
|
+
30,
|
|
1737
|
+
7,
|
|
1738
|
+
54,
|
|
1739
|
+
24,
|
|
1740
|
+
22,
|
|
1741
|
+
55,
|
|
1742
|
+
25
|
|
1743
|
+
],
|
|
1744
|
+
[
|
|
1745
|
+
28,
|
|
1746
|
+
28,
|
|
1747
|
+
50,
|
|
1748
|
+
22,
|
|
1749
|
+
6,
|
|
1750
|
+
51,
|
|
1751
|
+
23
|
|
1752
|
+
],
|
|
1753
|
+
[
|
|
1754
|
+
30,
|
|
1755
|
+
8,
|
|
1756
|
+
53,
|
|
1757
|
+
23,
|
|
1758
|
+
26,
|
|
1759
|
+
54,
|
|
1760
|
+
24
|
|
1761
|
+
],
|
|
1762
|
+
[
|
|
1763
|
+
30,
|
|
1764
|
+
4,
|
|
1765
|
+
54,
|
|
1766
|
+
24,
|
|
1767
|
+
31,
|
|
1768
|
+
55,
|
|
1769
|
+
25
|
|
1770
|
+
],
|
|
1771
|
+
[
|
|
1772
|
+
30,
|
|
1773
|
+
1,
|
|
1774
|
+
53,
|
|
1775
|
+
23,
|
|
1776
|
+
37,
|
|
1777
|
+
54,
|
|
1778
|
+
24
|
|
1779
|
+
],
|
|
1780
|
+
[
|
|
1781
|
+
30,
|
|
1782
|
+
15,
|
|
1783
|
+
54,
|
|
1784
|
+
24,
|
|
1785
|
+
25,
|
|
1786
|
+
55,
|
|
1787
|
+
25
|
|
1788
|
+
],
|
|
1789
|
+
[
|
|
1790
|
+
30,
|
|
1791
|
+
42,
|
|
1792
|
+
54,
|
|
1793
|
+
24,
|
|
1794
|
+
1,
|
|
1795
|
+
55,
|
|
1796
|
+
25
|
|
1797
|
+
],
|
|
1798
|
+
[
|
|
1799
|
+
30,
|
|
1800
|
+
10,
|
|
1801
|
+
54,
|
|
1802
|
+
24,
|
|
1803
|
+
35,
|
|
1804
|
+
55,
|
|
1805
|
+
25
|
|
1806
|
+
],
|
|
1807
|
+
[
|
|
1808
|
+
30,
|
|
1809
|
+
29,
|
|
1810
|
+
54,
|
|
1811
|
+
24,
|
|
1812
|
+
19,
|
|
1813
|
+
55,
|
|
1814
|
+
25
|
|
1815
|
+
],
|
|
1816
|
+
[
|
|
1817
|
+
30,
|
|
1818
|
+
44,
|
|
1819
|
+
54,
|
|
1820
|
+
24,
|
|
1821
|
+
7,
|
|
1822
|
+
55,
|
|
1823
|
+
25
|
|
1824
|
+
],
|
|
1825
|
+
[
|
|
1826
|
+
30,
|
|
1827
|
+
39,
|
|
1828
|
+
54,
|
|
1829
|
+
24,
|
|
1830
|
+
14,
|
|
1831
|
+
55,
|
|
1832
|
+
25
|
|
1833
|
+
],
|
|
1834
|
+
[
|
|
1835
|
+
30,
|
|
1836
|
+
46,
|
|
1837
|
+
54,
|
|
1838
|
+
24,
|
|
1839
|
+
10,
|
|
1840
|
+
55,
|
|
1841
|
+
25
|
|
1842
|
+
],
|
|
1843
|
+
[
|
|
1844
|
+
30,
|
|
1845
|
+
49,
|
|
1846
|
+
54,
|
|
1847
|
+
24,
|
|
1848
|
+
10,
|
|
1849
|
+
55,
|
|
1850
|
+
25
|
|
1851
|
+
],
|
|
1852
|
+
[
|
|
1853
|
+
30,
|
|
1854
|
+
48,
|
|
1855
|
+
54,
|
|
1856
|
+
24,
|
|
1857
|
+
14,
|
|
1858
|
+
55,
|
|
1859
|
+
25
|
|
1860
|
+
],
|
|
1861
|
+
[
|
|
1862
|
+
30,
|
|
1863
|
+
43,
|
|
1864
|
+
54,
|
|
1865
|
+
24,
|
|
1866
|
+
22,
|
|
1867
|
+
55,
|
|
1868
|
+
25
|
|
1869
|
+
],
|
|
1870
|
+
[
|
|
1871
|
+
30,
|
|
1872
|
+
34,
|
|
1873
|
+
54,
|
|
1874
|
+
24,
|
|
1875
|
+
34,
|
|
1876
|
+
55,
|
|
1877
|
+
25
|
|
1878
|
+
]
|
|
1879
|
+
],
|
|
1880
|
+
H: [
|
|
1881
|
+
[],
|
|
1882
|
+
[
|
|
1883
|
+
17,
|
|
1884
|
+
1,
|
|
1885
|
+
26,
|
|
1886
|
+
9
|
|
1887
|
+
],
|
|
1888
|
+
[
|
|
1889
|
+
28,
|
|
1890
|
+
1,
|
|
1891
|
+
44,
|
|
1892
|
+
16
|
|
1893
|
+
],
|
|
1894
|
+
[
|
|
1895
|
+
22,
|
|
1896
|
+
2,
|
|
1897
|
+
35,
|
|
1898
|
+
13
|
|
1899
|
+
],
|
|
1900
|
+
[
|
|
1901
|
+
16,
|
|
1902
|
+
4,
|
|
1903
|
+
25,
|
|
1904
|
+
9
|
|
1905
|
+
],
|
|
1906
|
+
[
|
|
1907
|
+
22,
|
|
1908
|
+
2,
|
|
1909
|
+
33,
|
|
1910
|
+
11,
|
|
1911
|
+
2,
|
|
1912
|
+
34,
|
|
1913
|
+
12
|
|
1914
|
+
],
|
|
1915
|
+
[
|
|
1916
|
+
28,
|
|
1917
|
+
4,
|
|
1918
|
+
43,
|
|
1919
|
+
15
|
|
1920
|
+
],
|
|
1921
|
+
[
|
|
1922
|
+
26,
|
|
1923
|
+
4,
|
|
1924
|
+
39,
|
|
1925
|
+
13,
|
|
1926
|
+
1,
|
|
1927
|
+
40,
|
|
1928
|
+
14
|
|
1929
|
+
],
|
|
1930
|
+
[
|
|
1931
|
+
26,
|
|
1932
|
+
4,
|
|
1933
|
+
40,
|
|
1934
|
+
14,
|
|
1935
|
+
2,
|
|
1936
|
+
41,
|
|
1937
|
+
15
|
|
1938
|
+
],
|
|
1939
|
+
[
|
|
1940
|
+
24,
|
|
1941
|
+
4,
|
|
1942
|
+
36,
|
|
1943
|
+
12,
|
|
1944
|
+
4,
|
|
1945
|
+
37,
|
|
1946
|
+
13
|
|
1947
|
+
],
|
|
1948
|
+
[
|
|
1949
|
+
28,
|
|
1950
|
+
6,
|
|
1951
|
+
43,
|
|
1952
|
+
15,
|
|
1953
|
+
2,
|
|
1954
|
+
44,
|
|
1955
|
+
16
|
|
1956
|
+
],
|
|
1957
|
+
[
|
|
1958
|
+
24,
|
|
1959
|
+
3,
|
|
1960
|
+
36,
|
|
1961
|
+
12,
|
|
1962
|
+
8,
|
|
1963
|
+
37,
|
|
1964
|
+
13
|
|
1965
|
+
],
|
|
1966
|
+
[
|
|
1967
|
+
28,
|
|
1968
|
+
7,
|
|
1969
|
+
42,
|
|
1970
|
+
14,
|
|
1971
|
+
4,
|
|
1972
|
+
43,
|
|
1973
|
+
15
|
|
1974
|
+
],
|
|
1975
|
+
[
|
|
1976
|
+
22,
|
|
1977
|
+
12,
|
|
1978
|
+
33,
|
|
1979
|
+
11,
|
|
1980
|
+
4,
|
|
1981
|
+
34,
|
|
1982
|
+
12
|
|
1983
|
+
],
|
|
1984
|
+
[
|
|
1985
|
+
24,
|
|
1986
|
+
11,
|
|
1987
|
+
36,
|
|
1988
|
+
12,
|
|
1989
|
+
5,
|
|
1990
|
+
37,
|
|
1991
|
+
13
|
|
1992
|
+
],
|
|
1993
|
+
[
|
|
1994
|
+
24,
|
|
1995
|
+
11,
|
|
1996
|
+
36,
|
|
1997
|
+
12,
|
|
1998
|
+
7,
|
|
1999
|
+
37,
|
|
2000
|
+
13
|
|
2001
|
+
],
|
|
2002
|
+
[
|
|
2003
|
+
30,
|
|
2004
|
+
3,
|
|
2005
|
+
45,
|
|
2006
|
+
15,
|
|
2007
|
+
13,
|
|
2008
|
+
46,
|
|
2009
|
+
16
|
|
2010
|
+
],
|
|
2011
|
+
[
|
|
2012
|
+
28,
|
|
2013
|
+
2,
|
|
2014
|
+
42,
|
|
2015
|
+
14,
|
|
2016
|
+
17,
|
|
2017
|
+
43,
|
|
2018
|
+
15
|
|
2019
|
+
],
|
|
2020
|
+
[
|
|
2021
|
+
28,
|
|
2022
|
+
2,
|
|
2023
|
+
42,
|
|
2024
|
+
14,
|
|
2025
|
+
19,
|
|
2026
|
+
43,
|
|
2027
|
+
15
|
|
2028
|
+
],
|
|
2029
|
+
[
|
|
2030
|
+
26,
|
|
2031
|
+
9,
|
|
2032
|
+
39,
|
|
2033
|
+
13,
|
|
2034
|
+
16,
|
|
2035
|
+
40,
|
|
2036
|
+
14
|
|
2037
|
+
],
|
|
2038
|
+
[
|
|
2039
|
+
28,
|
|
2040
|
+
15,
|
|
2041
|
+
43,
|
|
2042
|
+
15,
|
|
2043
|
+
10,
|
|
2044
|
+
44,
|
|
2045
|
+
16
|
|
2046
|
+
],
|
|
2047
|
+
[
|
|
2048
|
+
30,
|
|
2049
|
+
19,
|
|
2050
|
+
46,
|
|
2051
|
+
16,
|
|
2052
|
+
6,
|
|
2053
|
+
47,
|
|
2054
|
+
17
|
|
2055
|
+
],
|
|
2056
|
+
[
|
|
2057
|
+
24,
|
|
2058
|
+
34,
|
|
2059
|
+
37,
|
|
2060
|
+
13
|
|
2061
|
+
],
|
|
2062
|
+
[
|
|
2063
|
+
30,
|
|
2064
|
+
16,
|
|
2065
|
+
45,
|
|
2066
|
+
15,
|
|
2067
|
+
14,
|
|
2068
|
+
46,
|
|
2069
|
+
16
|
|
2070
|
+
],
|
|
2071
|
+
[
|
|
2072
|
+
30,
|
|
2073
|
+
30,
|
|
2074
|
+
46,
|
|
2075
|
+
16,
|
|
2076
|
+
2,
|
|
2077
|
+
47,
|
|
2078
|
+
17
|
|
2079
|
+
],
|
|
2080
|
+
[
|
|
2081
|
+
30,
|
|
2082
|
+
22,
|
|
2083
|
+
45,
|
|
2084
|
+
15,
|
|
2085
|
+
13,
|
|
2086
|
+
46,
|
|
2087
|
+
16
|
|
2088
|
+
],
|
|
2089
|
+
[
|
|
2090
|
+
30,
|
|
2091
|
+
33,
|
|
2092
|
+
46,
|
|
2093
|
+
16,
|
|
2094
|
+
4,
|
|
2095
|
+
47,
|
|
2096
|
+
17
|
|
2097
|
+
],
|
|
2098
|
+
[
|
|
2099
|
+
30,
|
|
2100
|
+
12,
|
|
2101
|
+
45,
|
|
2102
|
+
15,
|
|
2103
|
+
28,
|
|
2104
|
+
46,
|
|
2105
|
+
16
|
|
2106
|
+
],
|
|
2107
|
+
[
|
|
2108
|
+
30,
|
|
2109
|
+
11,
|
|
2110
|
+
45,
|
|
2111
|
+
15,
|
|
2112
|
+
31,
|
|
2113
|
+
46,
|
|
2114
|
+
16
|
|
2115
|
+
],
|
|
2116
|
+
[
|
|
2117
|
+
30,
|
|
2118
|
+
19,
|
|
2119
|
+
45,
|
|
2120
|
+
15,
|
|
2121
|
+
26,
|
|
2122
|
+
46,
|
|
2123
|
+
16
|
|
2124
|
+
],
|
|
2125
|
+
[
|
|
2126
|
+
30,
|
|
2127
|
+
23,
|
|
2128
|
+
45,
|
|
2129
|
+
15,
|
|
2130
|
+
25,
|
|
2131
|
+
46,
|
|
2132
|
+
16
|
|
2133
|
+
],
|
|
2134
|
+
[
|
|
2135
|
+
30,
|
|
2136
|
+
23,
|
|
2137
|
+
45,
|
|
2138
|
+
15,
|
|
2139
|
+
28,
|
|
2140
|
+
46,
|
|
2141
|
+
16
|
|
2142
|
+
],
|
|
2143
|
+
[
|
|
2144
|
+
30,
|
|
2145
|
+
19,
|
|
2146
|
+
45,
|
|
2147
|
+
15,
|
|
2148
|
+
35,
|
|
2149
|
+
46,
|
|
2150
|
+
16
|
|
2151
|
+
],
|
|
2152
|
+
[
|
|
2153
|
+
30,
|
|
2154
|
+
11,
|
|
2155
|
+
45,
|
|
2156
|
+
15,
|
|
2157
|
+
46,
|
|
2158
|
+
46,
|
|
2159
|
+
16
|
|
2160
|
+
],
|
|
2161
|
+
[
|
|
2162
|
+
30,
|
|
2163
|
+
59,
|
|
2164
|
+
46,
|
|
2165
|
+
16,
|
|
2166
|
+
1,
|
|
2167
|
+
47,
|
|
2168
|
+
17
|
|
2169
|
+
],
|
|
2170
|
+
[
|
|
2171
|
+
30,
|
|
2172
|
+
22,
|
|
2173
|
+
45,
|
|
2174
|
+
15,
|
|
2175
|
+
41,
|
|
2176
|
+
46,
|
|
2177
|
+
16
|
|
2178
|
+
],
|
|
2179
|
+
[
|
|
2180
|
+
30,
|
|
2181
|
+
2,
|
|
2182
|
+
45,
|
|
2183
|
+
15,
|
|
2184
|
+
64,
|
|
2185
|
+
46,
|
|
2186
|
+
16
|
|
2187
|
+
],
|
|
2188
|
+
[
|
|
2189
|
+
30,
|
|
2190
|
+
24,
|
|
2191
|
+
45,
|
|
2192
|
+
15,
|
|
2193
|
+
46,
|
|
2194
|
+
46,
|
|
2195
|
+
16
|
|
2196
|
+
],
|
|
2197
|
+
[
|
|
2198
|
+
30,
|
|
2199
|
+
42,
|
|
2200
|
+
45,
|
|
2201
|
+
15,
|
|
2202
|
+
32,
|
|
2203
|
+
46,
|
|
2204
|
+
16
|
|
2205
|
+
],
|
|
2206
|
+
[
|
|
2207
|
+
30,
|
|
2208
|
+
10,
|
|
2209
|
+
45,
|
|
2210
|
+
15,
|
|
2211
|
+
67,
|
|
2212
|
+
46,
|
|
2213
|
+
16
|
|
2214
|
+
],
|
|
2215
|
+
[
|
|
2216
|
+
30,
|
|
2217
|
+
20,
|
|
2218
|
+
45,
|
|
2219
|
+
15,
|
|
2220
|
+
61,
|
|
2221
|
+
46,
|
|
2222
|
+
16
|
|
2223
|
+
]
|
|
2224
|
+
]
|
|
2225
|
+
};
|
|
2226
|
+
const EXP = /* @__PURE__ */ new Uint8Array(512);
|
|
2227
|
+
const LOG = /* @__PURE__ */ new Uint8Array(256);
|
|
2228
|
+
{
|
|
2229
|
+
let x = 1;
|
|
2230
|
+
for (let i = 0; i < 255; i++) {
|
|
2231
|
+
EXP[i] = x;
|
|
2232
|
+
LOG[x] = i;
|
|
2233
|
+
x = x & 128 ? (x << 1 ^ 285) & 255 : x << 1;
|
|
2234
|
+
}
|
|
2235
|
+
for (let i = 255; i < 512; i++) EXP[i] = EXP[i - 255] ?? 0;
|
|
2236
|
+
}
|
|
2237
|
+
const mul = (a, b) => a && b ? EXP[(LOG[a] ?? 0) + (LOG[b] ?? 0)] ?? 0 : 0;
|
|
2238
|
+
const div = (a, b) => a ? EXP[(LOG[a] ?? 0) + 255 - (LOG[b] ?? 0)] ?? 0 : 0;
|
|
2239
|
+
const pow = (i) => EXP[(i % 255 + 255) % 255] ?? 0;
|
|
2240
|
+
/**
|
|
2241
|
+
* Corrects a block (data then ECC codewords, generator roots α⁰…α^(n−1)) in place.
|
|
2242
|
+
* Returns the number of corrected codewords; throws when the block is beyond repair.
|
|
2243
|
+
*/
|
|
2244
|
+
function correctBlock(block, eccLength) {
|
|
2245
|
+
const n = block.length;
|
|
2246
|
+
const evalAt = (x) => {
|
|
2247
|
+
let y = 0;
|
|
2248
|
+
for (const c of block) y = mul(y, x) ^ c;
|
|
2249
|
+
return y;
|
|
2250
|
+
};
|
|
2251
|
+
const syndromes = Array.from({ length: eccLength }, (_, i) => evalAt(pow(i)));
|
|
2252
|
+
if (syndromes.every((s) => s === 0)) return 0;
|
|
2253
|
+
let lambda = [1];
|
|
2254
|
+
let prev = [1];
|
|
2255
|
+
let l = 0;
|
|
2256
|
+
let m = 1;
|
|
2257
|
+
let b = 1;
|
|
2258
|
+
for (let r = 0; r < eccLength; r++) {
|
|
2259
|
+
let delta = syndromes[r] ?? 0;
|
|
2260
|
+
for (let i = 1; i <= l; i++) delta ^= mul(lambda[i] ?? 0, syndromes[r - i] ?? 0);
|
|
2261
|
+
if (delta === 0) {
|
|
2262
|
+
m++;
|
|
2263
|
+
continue;
|
|
2264
|
+
}
|
|
2265
|
+
const scale = div(delta, b);
|
|
2266
|
+
const next = lambda.slice();
|
|
2267
|
+
for (let i = 0; i < prev.length; i++) next[i + m] = (next[i + m] ?? 0) ^ mul(scale, prev[i] ?? 0);
|
|
2268
|
+
if (2 * l <= r) {
|
|
2269
|
+
prev = lambda;
|
|
2270
|
+
l = r + 1 - l;
|
|
2271
|
+
b = delta;
|
|
2272
|
+
m = 1;
|
|
2273
|
+
} else m++;
|
|
2274
|
+
lambda = next;
|
|
2275
|
+
}
|
|
2276
|
+
const positions = [];
|
|
2277
|
+
for (let p = 0; p < n; p++) {
|
|
2278
|
+
const x = pow(-p);
|
|
2279
|
+
let y = 0;
|
|
2280
|
+
for (let i = lambda.length - 1; i >= 0; i--) y = mul(y, x) ^ (lambda[i] ?? 0);
|
|
2281
|
+
if (y === 0) positions.push(p);
|
|
2282
|
+
}
|
|
2283
|
+
if (positions.length !== l || l * 2 > eccLength) throw new QrDecodeError("uncorrectable block");
|
|
2284
|
+
const omega = [];
|
|
2285
|
+
for (let i = 0; i < eccLength; i++) {
|
|
2286
|
+
let v = 0;
|
|
2287
|
+
for (let j = 0; j <= i; j++) v ^= mul(syndromes[j] ?? 0, lambda[i - j] ?? 0);
|
|
2288
|
+
omega.push(v);
|
|
2289
|
+
}
|
|
2290
|
+
for (const p of positions) {
|
|
2291
|
+
const xInv = pow(-p);
|
|
2292
|
+
let num = 0;
|
|
2293
|
+
for (let i = omega.length - 1; i >= 0; i--) num = mul(num, xInv) ^ (omega[i] ?? 0);
|
|
2294
|
+
let den = 0;
|
|
2295
|
+
for (let i = 1; i < lambda.length; i += 2) den ^= mul(lambda[i] ?? 0, pow(-p * (i - 1)));
|
|
2296
|
+
if (den === 0) throw new QrDecodeError("uncorrectable block");
|
|
2297
|
+
const magnitude = mul(pow(p), div(num, den));
|
|
2298
|
+
const k = n - 1 - p;
|
|
2299
|
+
block[k] = (block[k] ?? 0) ^ magnitude;
|
|
2300
|
+
}
|
|
2301
|
+
if (Array.from({ length: eccLength }, (_, i) => evalAt(pow(i))).some((s) => s !== 0)) throw new QrDecodeError("uncorrectable block");
|
|
2302
|
+
return positions.length;
|
|
2303
|
+
}
|
|
2304
|
+
const FORMAT_LEVELS = [
|
|
2305
|
+
"M",
|
|
2306
|
+
"L",
|
|
2307
|
+
"H",
|
|
2308
|
+
"Q"
|
|
2309
|
+
];
|
|
2310
|
+
function formatWord(data) {
|
|
2311
|
+
let rem = data;
|
|
2312
|
+
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
2313
|
+
return (data << 10 | rem) ^ 21522;
|
|
2314
|
+
}
|
|
2315
|
+
const popcount = (v) => {
|
|
2316
|
+
let n = 0;
|
|
2317
|
+
for (let x = v; x; x &= x - 1) n++;
|
|
2318
|
+
return n;
|
|
2319
|
+
};
|
|
2320
|
+
/** Reads a format copy and returns the nearest valid word's level and mask. */
|
|
2321
|
+
function readFormat(bits) {
|
|
2322
|
+
let best = {
|
|
2323
|
+
ecc: "M",
|
|
2324
|
+
mask: 0,
|
|
2325
|
+
distance: 99
|
|
2326
|
+
};
|
|
2327
|
+
for (let data = 0; data < 32; data++) {
|
|
2328
|
+
const distance = popcount(formatWord(data) ^ bits);
|
|
2329
|
+
if (distance < best.distance) best = {
|
|
2330
|
+
ecc: FORMAT_LEVELS[data >> 3] ?? "M",
|
|
2331
|
+
mask: data & 7,
|
|
2332
|
+
distance
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
return best;
|
|
2336
|
+
}
|
|
2337
|
+
const MASKS = [
|
|
2338
|
+
(x, y) => (x + y) % 2 === 0,
|
|
2339
|
+
(_, y) => y % 2 === 0,
|
|
2340
|
+
(x) => x % 3 === 0,
|
|
2341
|
+
(x, y) => (x + y) % 3 === 0,
|
|
2342
|
+
(x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,
|
|
2343
|
+
(x, y) => x * y % 2 + x * y % 3 === 0,
|
|
2344
|
+
(x, y) => (x * y % 2 + x * y % 3) % 2 === 0,
|
|
2345
|
+
(x, y) => ((x + y) % 2 + x * y % 3) % 2 === 0
|
|
2346
|
+
];
|
|
2347
|
+
/** Which modules are function patterns, built from the standard's geometry. */
|
|
2348
|
+
function functionMap(version) {
|
|
2349
|
+
const size = version * 4 + 17;
|
|
2350
|
+
const f = Array.from({ length: size }, () => new Array(size).fill(false));
|
|
2351
|
+
const mark = (x0, y0, w, h) => {
|
|
2352
|
+
for (let y = Math.max(0, y0); y < Math.min(size, y0 + h); y++) for (let x = Math.max(0, x0); x < Math.min(size, x0 + w); x++) {
|
|
2353
|
+
const row = f[y];
|
|
2354
|
+
if (row) row[x] = true;
|
|
2355
|
+
}
|
|
2356
|
+
};
|
|
2357
|
+
mark(0, 0, 9, 9);
|
|
2358
|
+
mark(size - 8, 0, 8, 9);
|
|
2359
|
+
mark(0, size - 8, 9, 8);
|
|
2360
|
+
mark(6, 0, 1, size);
|
|
2361
|
+
mark(0, 6, size, 1);
|
|
2362
|
+
const centres = alignmentTable(version);
|
|
2363
|
+
for (const cy of centres) for (const cx of centres) if (!(cx === 6 && cy === 6 || cx === 6 && cy === size - 7 || cx === size - 7 && cy === 6)) mark(cx - 2, cy - 2, 5, 5);
|
|
2364
|
+
if (version >= 7) {
|
|
2365
|
+
mark(size - 11, 0, 3, 6);
|
|
2366
|
+
mark(0, size - 11, 6, 3);
|
|
2367
|
+
}
|
|
2368
|
+
return f;
|
|
2369
|
+
}
|
|
2370
|
+
/** Decodes a module matrix (row-major, `true` = dark, no quiet zone). Throws `QrDecodeError`. */
|
|
2371
|
+
function decodeQr(matrix) {
|
|
2372
|
+
const size = matrix.length;
|
|
2373
|
+
const version = (size - 17) / 4;
|
|
2374
|
+
if (!Number.isInteger(version) || version < 1 || version > 40) throw new QrDecodeError(`a ${size}-module side is no QR version`);
|
|
2375
|
+
const at = (x, y) => matrix[y]?.[x] === true ? 1 : 0;
|
|
2376
|
+
let copy1 = 0;
|
|
2377
|
+
for (let i = 0; i <= 5; i++) copy1 |= at(8, i) << i;
|
|
2378
|
+
copy1 |= at(8, 7) << 6;
|
|
2379
|
+
copy1 |= at(8, 8) << 7;
|
|
2380
|
+
copy1 |= at(7, 8) << 8;
|
|
2381
|
+
for (let i = 9; i < 15; i++) copy1 |= at(14 - i, 8) << i;
|
|
2382
|
+
let copy2 = 0;
|
|
2383
|
+
for (let i = 0; i < 8; i++) copy2 |= at(size - 1 - i, 8) << i;
|
|
2384
|
+
for (let i = 8; i < 15; i++) copy2 |= at(8, size - 15 + i) << i;
|
|
2385
|
+
const a = readFormat(copy1);
|
|
2386
|
+
const b = readFormat(copy2);
|
|
2387
|
+
const format = a.distance <= b.distance ? a : b;
|
|
2388
|
+
if (format.distance > 3) throw new QrDecodeError("unreadable format information");
|
|
2389
|
+
const fixed = functionMap(version);
|
|
2390
|
+
const unmask = MASKS[format.mask] ?? (() => false);
|
|
2391
|
+
const bits = [];
|
|
2392
|
+
for (let right = size - 1; right >= 1; right -= 2) {
|
|
2393
|
+
if (right === 6) right = 5;
|
|
2394
|
+
for (let vert = 0; vert < size; vert++) for (let j = 0; j < 2; j++) {
|
|
2395
|
+
const x = right - j;
|
|
2396
|
+
const y = (right + 1 & 2) === 0 ? size - 1 - vert : vert;
|
|
2397
|
+
if (fixed[y]?.[x]) continue;
|
|
2398
|
+
bits.push(at(x, y) ^ (unmask(x, y) ? 1 : 0));
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
const codewords = new Uint8Array(Math.floor(bits.length / 8));
|
|
2402
|
+
for (let i = 0; i < codewords.length; i++) {
|
|
2403
|
+
let v = 0;
|
|
2404
|
+
for (let k = 0; k < 8; k++) v = v << 1 | (bits[i * 8 + k] ?? 0);
|
|
2405
|
+
codewords[i] = v;
|
|
2406
|
+
}
|
|
2407
|
+
const spec = BLOCKS[format.ecc][version] ?? [];
|
|
2408
|
+
const eccLength = spec[0] ?? 0;
|
|
2409
|
+
const groups = [];
|
|
2410
|
+
for (let i = 1; i < spec.length; i += 3) groups.push({
|
|
2411
|
+
count: spec[i] ?? 0,
|
|
2412
|
+
data: spec[i + 2] ?? 0
|
|
2413
|
+
});
|
|
2414
|
+
const blocks = [];
|
|
2415
|
+
for (const g of groups) for (let i = 0; i < g.count; i++) blocks.push({
|
|
2416
|
+
data: g.data,
|
|
2417
|
+
bytes: []
|
|
2418
|
+
});
|
|
2419
|
+
const maxData = Math.max(...blocks.map((bl) => bl.data));
|
|
2420
|
+
let k = 0;
|
|
2421
|
+
for (let i = 0; i < maxData; i++) for (const bl of blocks) if (i < bl.data) bl.bytes.push(codewords[k++] ?? 0);
|
|
2422
|
+
for (let i = 0; i < eccLength; i++) for (const bl of blocks) bl.bytes.push(codewords[k++] ?? 0);
|
|
2423
|
+
let corrected = 0;
|
|
2424
|
+
const data = [];
|
|
2425
|
+
for (const bl of blocks) {
|
|
2426
|
+
const block = Uint8Array.from(bl.bytes);
|
|
2427
|
+
corrected += correctBlock(block, eccLength);
|
|
2428
|
+
data.push(...block.subarray(0, bl.data));
|
|
2429
|
+
}
|
|
2430
|
+
return {
|
|
2431
|
+
version,
|
|
2432
|
+
ecc: format.ecc,
|
|
2433
|
+
mask: format.mask,
|
|
2434
|
+
corrected,
|
|
2435
|
+
...parseSegments(data, version)
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
const ALPHANUMERIC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
2439
|
+
function parseSegments(data, version) {
|
|
2440
|
+
let pos = 0;
|
|
2441
|
+
const total = data.length * 8;
|
|
2442
|
+
const read = (n) => {
|
|
2443
|
+
let v = 0;
|
|
2444
|
+
for (let i = 0; i < n; i++, pos++) v = v << 1 | (data[pos >> 3] ?? 0) >> 7 - (pos & 7) & 1;
|
|
2445
|
+
return v;
|
|
2446
|
+
};
|
|
2447
|
+
const width = (narrow, mid, wide) => version <= 9 ? narrow : version <= 26 ? mid : wide;
|
|
2448
|
+
const out = [];
|
|
2449
|
+
const segments = [];
|
|
2450
|
+
while (pos + 4 <= total) {
|
|
2451
|
+
const mode = read(4);
|
|
2452
|
+
if (mode === 0) break;
|
|
2453
|
+
if (mode === 7) {
|
|
2454
|
+
const first = read(8);
|
|
2455
|
+
const assignment = first & 128 ? first & 64 ? (first & 31) << 16 | read(16) : (first & 63) << 8 | read(8) : first;
|
|
2456
|
+
segments.push({
|
|
2457
|
+
mode: "eci",
|
|
2458
|
+
assignment
|
|
2459
|
+
});
|
|
2460
|
+
} else if (mode === 1) {
|
|
2461
|
+
let count = read(width(10, 12, 14));
|
|
2462
|
+
segments.push({
|
|
2463
|
+
mode: "numeric",
|
|
2464
|
+
chars: count
|
|
2465
|
+
});
|
|
2466
|
+
for (; count >= 3; count -= 3) out.push(...String(read(10)).padStart(3, "0").split("").map((c) => c.charCodeAt(0)));
|
|
2467
|
+
if (count === 2) out.push(...String(read(7)).padStart(2, "0").split("").map((c) => c.charCodeAt(0)));
|
|
2468
|
+
if (count === 1) out.push(...String(read(4)).split("").map((c) => c.charCodeAt(0)));
|
|
2469
|
+
} else if (mode === 2) {
|
|
2470
|
+
let count = read(width(9, 11, 13));
|
|
2471
|
+
segments.push({
|
|
2472
|
+
mode: "alphanumeric",
|
|
2473
|
+
chars: count
|
|
2474
|
+
});
|
|
2475
|
+
for (; count >= 2; count -= 2) {
|
|
2476
|
+
const v = read(11);
|
|
2477
|
+
out.push(ALPHANUMERIC.charCodeAt(Math.floor(v / 45)), ALPHANUMERIC.charCodeAt(v % 45));
|
|
2478
|
+
}
|
|
2479
|
+
if (count === 1) out.push(ALPHANUMERIC.charCodeAt(read(6)));
|
|
2480
|
+
} else if (mode === 4) {
|
|
2481
|
+
const count = read(width(8, 16, 16));
|
|
2482
|
+
segments.push({
|
|
2483
|
+
mode: "byte",
|
|
2484
|
+
chars: count
|
|
2485
|
+
});
|
|
2486
|
+
for (let i = 0; i < count; i++) out.push(read(8));
|
|
2487
|
+
} else throw new QrDecodeError(`unsupported mode ${mode.toString(2)}`);
|
|
2488
|
+
}
|
|
2489
|
+
const bytes = Uint8Array.from(out);
|
|
2490
|
+
return {
|
|
2491
|
+
bytes,
|
|
2492
|
+
text: new TextDecoder("utf-8").decode(bytes),
|
|
2493
|
+
segments
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
//#endregion
|
|
2497
|
+
//#region src/components/qr-code.ts
|
|
2498
|
+
/**
|
|
2499
|
+
* The QR Code contract with the testing decoder: `decoded()` reads the rendered symbol back
|
|
2500
|
+
* and the decode invariant checks it against the value text.
|
|
2501
|
+
*/
|
|
2502
|
+
const qrCodeDecodingContract = qrCodeContractWith((modules) => decodeQr(modules).text);
|
|
2503
|
+
/**
|
|
2504
|
+
* A driver for the QR code whose frame is named `name` (default "QR code"), inside `within`
|
|
2505
|
+
* (a container element or a Playwright locator; default the target).
|
|
2506
|
+
*/
|
|
2507
|
+
function getQrCode(target, anchor = {}, options) {
|
|
2508
|
+
const { within, name } = anchor;
|
|
2509
|
+
return createDriverWith(qrCodeDecodingContract, within ?? target, [name === void 0 ? {} : { name }], options);
|
|
2510
|
+
}
|
|
2511
|
+
//#endregion
|
|
318
2512
|
//#region src/components/radio-group.ts
|
|
319
2513
|
/** A driver for the Radio Group named `name`. */
|
|
320
2514
|
function getRadioGroup(target, anchor, options) {
|
|
321
2515
|
return createDriverWith(radioGroupContract, target, [anchor], options);
|
|
322
2516
|
}
|
|
323
2517
|
//#endregion
|
|
2518
|
+
//#region src/components/rating.ts
|
|
2519
|
+
/** A driver for the Rating whose accessible name (its Label) is `name`. */
|
|
2520
|
+
function getRating(target, anchor, options) {
|
|
2521
|
+
return createDriverWith(ratingContract, target, [anchor], options);
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/components/scroll-area.ts
|
|
2525
|
+
/**
|
|
2526
|
+
* A driver for a Scroll Area: the one whose Viewport is the region named `name`, or the one
|
|
2527
|
+
* whose Content holds `text`.
|
|
2528
|
+
*/
|
|
2529
|
+
function getScrollArea(target, anchor, options) {
|
|
2530
|
+
return createDriverWith(scrollAreaContract, target, [anchor], options);
|
|
2531
|
+
}
|
|
2532
|
+
//#endregion
|
|
324
2533
|
//#region src/components/segmented-control.ts
|
|
325
2534
|
/** A driver for the Segmented Control named `name`. */
|
|
326
2535
|
function getSegmentedControl(target, anchor, options) {
|
|
327
2536
|
return createDriverWith(segmentedControlContract, target, [anchor], options);
|
|
328
2537
|
}
|
|
329
2538
|
//#endregion
|
|
2539
|
+
//#region src/components/select.ts
|
|
2540
|
+
/** A driver for the Select named `name`: open, choose, typeahead, form and value queries. */
|
|
2541
|
+
function getSelect(target, anchor, options) {
|
|
2542
|
+
return createDriverWith(selectContract, target, [anchor], options);
|
|
2543
|
+
}
|
|
2544
|
+
//#endregion
|
|
330
2545
|
//#region src/components/separator.ts
|
|
331
2546
|
/**
|
|
332
2547
|
* A driver for a Separator: the one named `name`, or the one separator part inside
|
|
@@ -338,6 +2553,27 @@ function getSeparator(target, anchor = {}, options) {
|
|
|
338
2553
|
return createDriverWith(host === void 0 ? separatorContract : separatorContractFor(host), within ?? target, [name === void 0 ? {} : { name }], options);
|
|
339
2554
|
}
|
|
340
2555
|
//#endregion
|
|
2556
|
+
//#region src/components/skeleton.ts
|
|
2557
|
+
/**
|
|
2558
|
+
* A driver for the one Skeleton inside `within` (a container element or a Playwright
|
|
2559
|
+
* locator; default the target). `announcements()` lists what it announced since creation.
|
|
2560
|
+
*/
|
|
2561
|
+
function getSkeleton(target, anchor = {}, options) {
|
|
2562
|
+
return createDriverWith(skeletonContract, anchor.within ?? target, [], options);
|
|
2563
|
+
}
|
|
2564
|
+
//#endregion
|
|
2565
|
+
//#region src/components/slider.ts
|
|
2566
|
+
/** A driver for the Slider whose Label is `name`. */
|
|
2567
|
+
function getSlider(target, anchor, options) {
|
|
2568
|
+
return createDriverWith(sliderContract, target, [anchor], options);
|
|
2569
|
+
}
|
|
2570
|
+
//#endregion
|
|
2571
|
+
//#region src/components/splitter.ts
|
|
2572
|
+
/** A driver for the Splitter one of whose handles is named `name`. */
|
|
2573
|
+
function getSplitter(target, anchor, options) {
|
|
2574
|
+
return createDriverWith(splitterContract, target, [anchor], options);
|
|
2575
|
+
}
|
|
2576
|
+
//#endregion
|
|
341
2577
|
//#region src/components/switch.ts
|
|
342
2578
|
/** A driver for the Switch named `name`. */
|
|
343
2579
|
function getSwitch(target, anchor, options) {
|
|
@@ -350,12 +2586,34 @@ function getTabs(target, anchor, options) {
|
|
|
350
2586
|
return createDriverWith(tabsContract, target, [anchor], options);
|
|
351
2587
|
}
|
|
352
2588
|
//#endregion
|
|
2589
|
+
//#region src/components/tag-group.ts
|
|
2590
|
+
/** A driver for the Tag Group named `name`: remove, act, choose, typeahead, queries. */
|
|
2591
|
+
function getTagGroup(target, anchor, options) {
|
|
2592
|
+
return createDriverWith(tagGroupContract, target, [anchor], options);
|
|
2593
|
+
}
|
|
2594
|
+
//#endregion
|
|
2595
|
+
//#region src/components/tags-input.ts
|
|
2596
|
+
/** A driver for the Tags Input named `name`: type, addTag, paste, editTag, removeTag, queries. */
|
|
2597
|
+
function getTagsInput(target, anchor, options) {
|
|
2598
|
+
return createDriverWith(tagsInputContract, target, [anchor], options);
|
|
2599
|
+
}
|
|
2600
|
+
//#endregion
|
|
353
2601
|
//#region src/components/text-field.ts
|
|
354
2602
|
/** A driver for the Text Field named `name`: type, fill, clear, compose, blur, queries. */
|
|
355
2603
|
function getTextField(target, anchor, options) {
|
|
356
2604
|
return createDriverWith(textFieldContract, target, [anchor], options);
|
|
357
2605
|
}
|
|
358
2606
|
//#endregion
|
|
2607
|
+
//#region src/components/toast.ts
|
|
2608
|
+
/** A driver for the toaster region named `name` ("Notifications (F6)"): enter, leave, queries. */
|
|
2609
|
+
function getToaster(target, anchor, options) {
|
|
2610
|
+
return createDriverWith(toasterContract, target, [anchor], options);
|
|
2611
|
+
}
|
|
2612
|
+
/** A driver for the toast titled `name`: dismiss, swipe, act, hover, waitForTimeout, queries. */
|
|
2613
|
+
function getToast(target, anchor, options) {
|
|
2614
|
+
return createDriverWith(toastContract, target, [anchor], options);
|
|
2615
|
+
}
|
|
2616
|
+
//#endregion
|
|
359
2617
|
//#region src/components/toggle.ts
|
|
360
2618
|
/** A driver for the Toggle named `name`. */
|
|
361
2619
|
function getToggle(target, anchor, options) {
|
|
@@ -374,6 +2632,219 @@ function getToolbar(target, anchor, options) {
|
|
|
374
2632
|
return createDriverWith(toolbarContract, target, [anchor], options);
|
|
375
2633
|
}
|
|
376
2634
|
//#endregion
|
|
2635
|
+
//#region src/components/tooltip.ts
|
|
2636
|
+
/**
|
|
2637
|
+
* A driver for the Tooltip of the trigger named `name` (role `button` unless `role` says
|
|
2638
|
+
* otherwise). With fake timers, pass `advanceTimers` to the adapter: `show()` and `hide()`
|
|
2639
|
+
* advance through the delays.
|
|
2640
|
+
*/
|
|
2641
|
+
function getTooltip(target, anchor, options) {
|
|
2642
|
+
return createDriverWith(tooltipContract, target, [anchor], options);
|
|
2643
|
+
}
|
|
2644
|
+
//#endregion
|
|
2645
|
+
//#region src/components/tour.ts
|
|
2646
|
+
/**
|
|
2647
|
+
* A driver for the Tour started by the trigger named `name` (an idle tour has no card to
|
|
2648
|
+
* find). `modal: true` for a tour with `modal`. `announcements()` lists what it announced
|
|
2649
|
+
* since the driver was created.
|
|
2650
|
+
*/
|
|
2651
|
+
function getTour(target, anchor, options) {
|
|
2652
|
+
const { modal, ...locate } = anchor;
|
|
2653
|
+
return createDriverWith(modal === true ? modalTourContract : tourContract, target, [locate], options);
|
|
2654
|
+
}
|
|
2655
|
+
//#endregion
|
|
2656
|
+
//#region src/components/tree-view.ts
|
|
2657
|
+
/**
|
|
2658
|
+
* A driver for the Tree View named `name`: expand, collapse, toggle, check, act, expand
|
|
2659
|
+
* siblings and all; items by accessible name or by a name path (`["src", "index.ts"]`).
|
|
2660
|
+
*/
|
|
2661
|
+
function getTreeView(target, anchor, options) {
|
|
2662
|
+
return createDriverWith(treeViewContract, target, [anchor], options);
|
|
2663
|
+
}
|
|
2664
|
+
//#endregion
|
|
2665
|
+
//#region src/date-clock.ts
|
|
2666
|
+
/** A clock frozen at `instant` (ISO, or epoch ms) in `timeZone` (default UTC). */
|
|
2667
|
+
function fixedDateClock(instant, timeZone = "UTC") {
|
|
2668
|
+
const ms = typeof instant === "number" ? instant : Date.parse(instant);
|
|
2669
|
+
return {
|
|
2670
|
+
now: () => ms,
|
|
2671
|
+
timeZone: () => timeZone
|
|
2672
|
+
};
|
|
2673
|
+
}
|
|
2674
|
+
//#endregion
|
|
2675
|
+
//#region src/date-field-invariants.ts
|
|
2676
|
+
const ROOT$1 = "[data-scope=\"date-field\"][data-part=\"root\"]";
|
|
2677
|
+
const TABBABLE$1 = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]";
|
|
2678
|
+
/**
|
|
2679
|
+
* `changes` reads how often the page's `onValueChange` ran, `expectedChanges` the oracle's
|
|
2680
|
+
* (pass a counting `onValueChange` in the oracle's props).
|
|
2681
|
+
*/
|
|
2682
|
+
function dateFieldStepInvariants(options = {}) {
|
|
2683
|
+
return { invariants: [{
|
|
2684
|
+
name: "date-field-tab-stops-are-segments",
|
|
2685
|
+
check: async () => {
|
|
2686
|
+
const doc = globalThis.document;
|
|
2687
|
+
if (!doc) return void 0;
|
|
2688
|
+
for (const root of Array.from(doc.querySelectorAll(ROOT$1))) {
|
|
2689
|
+
const extra = Array.from(root.querySelectorAll(TABBABLE$1)).filter((el) => el.tabIndex >= 0 && !el.disabled).filter((el) => !el.hasAttribute("data-editable") && !["trigger", "clear-trigger"].includes(el.getAttribute("data-part") ?? ""));
|
|
2690
|
+
if (extra.length > 0) return `tab stops besides the segments: ${extra.map((el) => el.getAttribute("data-part") ?? el.tagName).join(", ")}`;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
}, {
|
|
2694
|
+
name: "date-field-change-count",
|
|
2695
|
+
check: async () => {
|
|
2696
|
+
if (!options.changes || !options.expectedChanges) return void 0;
|
|
2697
|
+
const [have, want] = [options.changes(), options.expectedChanges()];
|
|
2698
|
+
return have === want ? void 0 : `onValueChange ran ${have} times, the oracle ${want}`;
|
|
2699
|
+
}
|
|
2700
|
+
}] };
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* The range Date Field's change count (spec "Range Mode — Pair Invariants"): `onValueChange`
|
|
2704
|
+
* runs exactly as often as the derived value changed, read as the pair of hidden inputs
|
|
2705
|
+
* changing between steps. Call `reset()` in the model's setup.
|
|
2706
|
+
*/
|
|
2707
|
+
function dateRangeStepInvariants(options) {
|
|
2708
|
+
let last = "";
|
|
2709
|
+
let expected = 0;
|
|
2710
|
+
const pair = () => {
|
|
2711
|
+
const hidden = globalThis.document?.querySelectorAll("[data-scope=\"date-field\"][data-part=\"hidden-input\"]");
|
|
2712
|
+
return Array.from(hidden ?? [], (h) => h.value).join("|");
|
|
2713
|
+
};
|
|
2714
|
+
return {
|
|
2715
|
+
/** After the render: the pair it starts with is not a change. */
|
|
2716
|
+
reset: () => {
|
|
2717
|
+
last = pair();
|
|
2718
|
+
expected = 0;
|
|
2719
|
+
},
|
|
2720
|
+
invariants: [{
|
|
2721
|
+
name: "date-range-change-count",
|
|
2722
|
+
check: async () => {
|
|
2723
|
+
const now = pair();
|
|
2724
|
+
if (now !== last) expected++;
|
|
2725
|
+
last = now;
|
|
2726
|
+
const have = options.changes();
|
|
2727
|
+
return have === expected ? void 0 : `onValueChange ran ${have} times, the derived value changed ${expected} times`;
|
|
2728
|
+
}
|
|
2729
|
+
}]
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
//#endregion
|
|
2733
|
+
//#region src/delay-group.ts
|
|
2734
|
+
/** A delay group without timers: warm while a member is open or after `setWarm(true)`. */
|
|
2735
|
+
function fakeDelayGroup() {
|
|
2736
|
+
const members = /* @__PURE__ */ new Map();
|
|
2737
|
+
let open = null;
|
|
2738
|
+
let warm = false;
|
|
2739
|
+
return {
|
|
2740
|
+
get members() {
|
|
2741
|
+
return members;
|
|
2742
|
+
},
|
|
2743
|
+
get open() {
|
|
2744
|
+
return open;
|
|
2745
|
+
},
|
|
2746
|
+
setWarm: (w) => {
|
|
2747
|
+
warm = w;
|
|
2748
|
+
},
|
|
2749
|
+
join(id, member) {
|
|
2750
|
+
members.set(id, member);
|
|
2751
|
+
return () => {
|
|
2752
|
+
if (open === id) open = null;
|
|
2753
|
+
members.delete(id);
|
|
2754
|
+
};
|
|
2755
|
+
},
|
|
2756
|
+
isWarm: () => open !== null || warm,
|
|
2757
|
+
opened(id) {
|
|
2758
|
+
const previous = open;
|
|
2759
|
+
open = id;
|
|
2760
|
+
if (previous !== null && previous !== id) members.get(previous)?.replace();
|
|
2761
|
+
},
|
|
2762
|
+
closed(id, skipDelay) {
|
|
2763
|
+
if (open !== id) return;
|
|
2764
|
+
open = null;
|
|
2765
|
+
warm = skipDelay > 0;
|
|
2766
|
+
}
|
|
2767
|
+
};
|
|
2768
|
+
}
|
|
2769
|
+
function fakeHoverIntent() {
|
|
2770
|
+
const live = /* @__PURE__ */ new Set();
|
|
2771
|
+
return {
|
|
2772
|
+
inTransit: false,
|
|
2773
|
+
get tracked() {
|
|
2774
|
+
return [...live];
|
|
2775
|
+
},
|
|
2776
|
+
track(options) {
|
|
2777
|
+
live.add(options);
|
|
2778
|
+
return () => live.delete(options);
|
|
2779
|
+
},
|
|
2780
|
+
isInTransit() {
|
|
2781
|
+
return this.inTransit;
|
|
2782
|
+
},
|
|
2783
|
+
leave: () => {
|
|
2784
|
+
for (const o of [...live]) o.onLeave();
|
|
2785
|
+
},
|
|
2786
|
+
enter: () => {
|
|
2787
|
+
for (const o of [...live]) o.onEnter();
|
|
2788
|
+
},
|
|
2789
|
+
triggerProps: (send) => ({
|
|
2790
|
+
onPointerMove: (e) => {
|
|
2791
|
+
if (e.pointerType === "mouse" || e.pointerType === "pen") send({ type: "HOVER.START" });
|
|
2792
|
+
},
|
|
2793
|
+
onPointerLeave: (e) => {
|
|
2794
|
+
if (e.pointerType === "mouse" || e.pointerType === "pen") send({ type: "HOVER.END" });
|
|
2795
|
+
}
|
|
2796
|
+
})
|
|
2797
|
+
};
|
|
2798
|
+
}
|
|
2799
|
+
//#endregion
|
|
2800
|
+
//#region src/fake-clipboard.ts
|
|
2801
|
+
function fakeClipboard(options = {}) {
|
|
2802
|
+
let mode = options.mode ?? "succeed";
|
|
2803
|
+
const log = [];
|
|
2804
|
+
const copied = [];
|
|
2805
|
+
const settle = (text, m) => {
|
|
2806
|
+
if (m === "succeed") {
|
|
2807
|
+
copied.push(text);
|
|
2808
|
+
return Promise.resolve();
|
|
2809
|
+
}
|
|
2810
|
+
return Promise.reject(/* @__PURE__ */ new Error(m === "absent" ? "No clipboard" : "Write rejected"));
|
|
2811
|
+
};
|
|
2812
|
+
return {
|
|
2813
|
+
log,
|
|
2814
|
+
copied,
|
|
2815
|
+
set: (next) => {
|
|
2816
|
+
mode = next;
|
|
2817
|
+
},
|
|
2818
|
+
writeText(text) {
|
|
2819
|
+
log.push(text);
|
|
2820
|
+
const m = mode;
|
|
2821
|
+
const { scheduler } = options;
|
|
2822
|
+
if (!scheduler) return settle(text, m);
|
|
2823
|
+
return new Promise((resolve, reject) => {
|
|
2824
|
+
scheduler.setTimeout(() => settle(text, m).then(resolve, reject), options.latency ?? 10);
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
//#endregion
|
|
2830
|
+
//#region src/fake-visibility.ts
|
|
2831
|
+
function fakeVisibility(initiallyHidden = false) {
|
|
2832
|
+
let hidden = initiallyHidden;
|
|
2833
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
2834
|
+
return {
|
|
2835
|
+
hidden: () => hidden,
|
|
2836
|
+
subscribe(listener) {
|
|
2837
|
+
listeners.add(listener);
|
|
2838
|
+
return () => listeners.delete(listener);
|
|
2839
|
+
},
|
|
2840
|
+
set(next) {
|
|
2841
|
+
if (next === hidden) return;
|
|
2842
|
+
hidden = next;
|
|
2843
|
+
for (const l of listeners) l(hidden);
|
|
2844
|
+
}
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
//#endregion
|
|
377
2848
|
//#region src/form-invariants.ts
|
|
378
2849
|
/**
|
|
379
2850
|
* - `form-focus-only-on-attempt`: a step that is not a submit attempt (Validate, Reset)
|
|
@@ -450,10 +2921,13 @@ function toGraph(machine) {
|
|
|
450
2921
|
for (const [delay, t] of Object.entries(sd.after ?? {})) add(state, `after:${delay}`, t);
|
|
451
2922
|
for (const [key, ctl] of Object.entries(def.values ?? {})) for (const target of Object.keys(ctl.states ?? {})) if (target !== state) add(state, `$sync:${key}`, target);
|
|
452
2923
|
}
|
|
453
|
-
for (const [prop,
|
|
454
|
-
|
|
455
|
-
event
|
|
456
|
-
|
|
2924
|
+
for (const [prop, entry] of Object.entries(def.onProps ?? {})) {
|
|
2925
|
+
const event = typeof entry === "string" ? entry : entry.event;
|
|
2926
|
+
for (const edge of edges.filter((e) => e.event === event)) edges.push({
|
|
2927
|
+
...edge,
|
|
2928
|
+
event: `$props:${prop}`
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
457
2931
|
return {
|
|
458
2932
|
id: def.id,
|
|
459
2933
|
initial: def.initial,
|
|
@@ -487,6 +2961,13 @@ function uncovered(graph, found) {
|
|
|
487
2961
|
}
|
|
488
2962
|
//#endregion
|
|
489
2963
|
//#region src/invariants.ts
|
|
2964
|
+
/** Roles that carry a value (`valued`): one element each. */
|
|
2965
|
+
const VALUED_ROLES = /* @__PURE__ */ new Set([
|
|
2966
|
+
"slider",
|
|
2967
|
+
"progressbar",
|
|
2968
|
+
"meter",
|
|
2969
|
+
"spinbutton"
|
|
2970
|
+
]);
|
|
490
2971
|
const NAME_REQUIRED = /* @__PURE__ */ new Set([
|
|
491
2972
|
"button",
|
|
492
2973
|
"link",
|
|
@@ -549,7 +3030,7 @@ function highlightChecks(f) {
|
|
|
549
3030
|
}
|
|
550
3031
|
return out;
|
|
551
3032
|
}
|
|
552
|
-
const anchor = (f) => f.anchorCount === 1 ? [] : [`exactly one element must match the anchor; found ${f.anchorCount}`];
|
|
3033
|
+
const anchor = (f) => f.absent ? f.anchorCount === 0 ? [] : [`no element may match the anchor in ${f.state} (absentIn); found ${f.anchorCount}`] : f.anchorCount === 1 ? [] : [`exactly one element must match the anchor; found ${f.anchorCount}`];
|
|
553
3034
|
const noErrors = (f) => f.errors.map((e) => `error during the step: ${e}`);
|
|
554
3035
|
/** Every part (items included) carries the data-state the contract declares for it. */
|
|
555
3036
|
const dataState = (f) => {
|
|
@@ -614,7 +3095,7 @@ const stateAttrs = (f) => {
|
|
|
614
3095
|
for (const [aria, data] of pairs) {
|
|
615
3096
|
if (el.attrs[aria] === void 0 && el.attrs[data] === void 0) continue;
|
|
616
3097
|
const on = isTrue(el.attrs[aria]) || aria === "aria-disabled" && el.attrs["disabled"] !== void 0;
|
|
617
|
-
const flagged = el.attrs[data] !== void 0;
|
|
3098
|
+
const flagged = el.attrs[data] !== void 0 || aria === "aria-disabled" && el.attrs["data-unavailable"] !== void 0;
|
|
618
3099
|
if (flagged && !on && !el.focusable) continue;
|
|
619
3100
|
if (aria === "aria-selected" && !SELECTABLE_ROLES.has(el.role ?? "")) continue;
|
|
620
3101
|
if (flagged && !on && aria === "aria-invalid" && el.role === "radio" && f.after.elements.some((g) => g.role === "radiogroup" && isTrue(g.attrs["aria-invalid"]) && g.id !== null && el.within.includes(g.id))) continue;
|
|
@@ -647,7 +3128,9 @@ const hiddenFocus = (f) => {
|
|
|
647
3128
|
* another element is leaving (Tab out) when the machine took a transition to another state
|
|
648
3129
|
* (focused → idle); without one, the component lost focus.
|
|
649
3130
|
*/
|
|
650
|
-
|
|
3131
|
+
/** A layer with no restore target part: focus returns to what had it when it opened. */
|
|
3132
|
+
const restoresToPrevious = (f) => f.semantics["finalFocus"] === void 0 && f.semantics["trigger"] === void 0;
|
|
3133
|
+
const focusKept = (f) => !(restoresToPrevious(f) && f.atInitial && f.baseline.focus.onBody && f.after.focus.onBody) && f.before?.focus.inInstance && !f.after.focus.inInstance && (f.after.focus.onBody || f.from === null || f.from === f.state) ? [`focus left the component (now ${f.after.focus.onBody ? "<body>" : f.after.focus.element?.describe})`] : [];
|
|
651
3134
|
/** (23) No live region of its own unless the contract declares `live-region`. */
|
|
652
3135
|
const liveRegions = (f) => f.traits.includes("live-region") ? [] : f.after.liveRegions.map((r) => `${r} is a live region; announce through the Announcer`);
|
|
653
3136
|
/**
|
|
@@ -728,16 +3211,21 @@ const traitInvariants = {
|
|
|
728
3211
|
const multiple = f.formInput.multiple === true;
|
|
729
3212
|
const inputs = f.after.formInputs.filter((i) => !i.inParent);
|
|
730
3213
|
if (!multiple && inputs.length !== 1) return [`${inputs.length} hidden inputs rendered; expected exactly one`];
|
|
731
|
-
for (const input of inputs) {
|
|
732
|
-
const want = f.formInput.expected(
|
|
3214
|
+
for (const [index, input] of inputs.entries()) {
|
|
3215
|
+
const want = f.formInput.expected({
|
|
3216
|
+
value: input.value,
|
|
3217
|
+
index
|
|
3218
|
+
});
|
|
733
3219
|
for (const key of [
|
|
734
3220
|
"checked",
|
|
735
3221
|
"indeterminate",
|
|
736
3222
|
"value"
|
|
737
3223
|
]) if (want[key] !== void 0 && input[key] !== want[key]) out.push(`${input.describe} ${key} is ${String(input[key])}, expected ${String(want[key])}`);
|
|
738
|
-
if (
|
|
739
|
-
|
|
740
|
-
|
|
3224
|
+
if (!f.formInput.accessible) {
|
|
3225
|
+
if (input.ariaHidden !== "true") out.push(`${input.describe} is not aria-hidden`);
|
|
3226
|
+
if (input.tabIndex !== -1) out.push(`${input.describe} has tabIndex ${input.tabIndex}`);
|
|
3227
|
+
if (input.focused) out.push(`${input.describe} has focus`);
|
|
3228
|
+
}
|
|
741
3229
|
if (input.clicks > 0) out.push(`${input.describe} received ${input.clicks} click events (a synthetic click reaches ancestors)`);
|
|
742
3230
|
}
|
|
743
3231
|
const sum = (list) => list.filter((i) => !i.inParent).reduce((n, i) => n + i.changes, 0);
|
|
@@ -800,12 +3288,18 @@ const traitInvariants = {
|
|
|
800
3288
|
}
|
|
801
3289
|
return out;
|
|
802
3290
|
},
|
|
803
|
-
/**
|
|
804
|
-
|
|
3291
|
+
/**
|
|
3292
|
+
* Focus is never lost to body while a layer is open. A layer that never takes focus (a
|
|
3293
|
+
* tooltip opened by hover while nothing had focus) leaves it where it was.
|
|
3294
|
+
*/
|
|
3295
|
+
layer: (f) => isOpen(f) && f.after.focus.onBody && f.before?.focus.onBody !== true ? ["focus is on <body> while the layer is open"] : [],
|
|
805
3296
|
/** (13) After closing, focus is on the trigger or the declared final-focus part. */
|
|
806
3297
|
"restores-focus": (f) => {
|
|
807
3298
|
const target = f.semantics["finalFocus"] ?? f.semantics["trigger"];
|
|
808
|
-
|
|
3299
|
+
const closed = f.from !== null && f.from !== f.state && !isOpen(f) && f.fromInitial !== true;
|
|
3300
|
+
if (restoresToPrevious(f)) return closed && f.after.focus.onBody && !f.baseline.focus.onBody ? ["after closing, focus is on <body>, though something had focus when it opened"] : [];
|
|
3301
|
+
if (f.context?.["closeReason"] === "tab-key") return [];
|
|
3302
|
+
return closed && f.after.focus.part !== target ? [`after closing, focus is on ${f.after.focus.element?.describe ?? "<body>"}, expected the ${target} part`] : [];
|
|
809
3303
|
},
|
|
810
3304
|
/**
|
|
811
3305
|
* While open: everything outside the layer that existed before (and is not kept visible by
|
|
@@ -915,6 +3409,7 @@ const traitInvariants = {
|
|
|
915
3409
|
const stops = list.filter((el) => el.attrs["tabindex"] === "0").length;
|
|
916
3410
|
const container = f.after.parts.some((p) => p.part !== itemPart(f) && p.attrs["tabindex"] === "0");
|
|
917
3411
|
const out = list.length > 0 && stops !== 1 && !(stops === 0 && container) ? [`${stops} items have tabindex="0"; expected exactly 1`] : [];
|
|
3412
|
+
for (const el of list) if (el.focusableInside) out.push(`${el.describe} contains a focusable descendant; the roving tab stop is the cell`);
|
|
918
3413
|
if (f.before?.focus.inInstance && f.after.focus.onBody) out.push("focus fell to <body> after the step (the focused item was removed?)");
|
|
919
3414
|
return [...out, ...highlightChecks(f)];
|
|
920
3415
|
},
|
|
@@ -954,7 +3449,11 @@ const traitInvariants = {
|
|
|
954
3449
|
const value = f.values["value"];
|
|
955
3450
|
if (value !== void 0 && value !== "all" && list.every((el) => itemValue(el) !== void 0)) {
|
|
956
3451
|
const rendered = new Set(list.map((el) => itemValue(el)));
|
|
957
|
-
const
|
|
3452
|
+
const range = value !== null && typeof value === "object" && "start" in value && "end" in value ? {
|
|
3453
|
+
lo: String(value.start),
|
|
3454
|
+
hi: String(value.end)
|
|
3455
|
+
} : null;
|
|
3456
|
+
const want = range ? new Set(list.filter((el) => !isTrue(el.attrs["aria-disabled"])).map((el) => itemValue(el) ?? "").filter((v) => v >= range.lo.slice(0, v.length) && v <= range.hi.slice(0, v.length))) : new Set((Array.isArray(value) ? value : [value]).map(String).filter((v) => rendered.has(v)));
|
|
958
3457
|
const have = new Set(selected.map((el) => itemValue(el) ?? ""));
|
|
959
3458
|
if (want.size !== have.size || [...want].some((v) => !have.has(v))) out.push(`selected items [${[...have].join(", ")}] differ from the machine's value [${[...want].join(", ")}]`);
|
|
960
3459
|
}
|
|
@@ -988,25 +3487,45 @@ const traitInvariants = {
|
|
|
988
3487
|
return out;
|
|
989
3488
|
},
|
|
990
3489
|
/**
|
|
991
|
-
* aria-valuenow equals the
|
|
992
|
-
*
|
|
3490
|
+
* aria-valuenow equals the expected value in the same step, element by element in DOM order
|
|
3491
|
+
* (one per thumb); a `null` value carries neither aria-valuenow nor aria-valuetext; the
|
|
3492
|
+
* declared aria-valuetext, or else a plain-number one equals the value (a locale's "1.200"
|
|
3493
|
+
* is never read as 1.2); a single value's `value-text` part shows its aria-valuetext.
|
|
993
3494
|
*/
|
|
994
3495
|
valued: (f) => {
|
|
995
|
-
const
|
|
996
|
-
|
|
3496
|
+
const raw = f.values["value"];
|
|
3497
|
+
const expected = f.valued?.values ?? (typeof raw === "number" ? [raw] : Array.isArray(raw) && raw.every((v) => typeof v === "number" || v === null) ? raw : void 0);
|
|
3498
|
+
if (!expected) return [];
|
|
997
3499
|
const out = [];
|
|
998
|
-
|
|
999
|
-
|
|
3500
|
+
const valuedEls = f.after.elements.filter((el) => !el.inAriaHidden && (el.attrs["aria-valuenow"] !== void 0 || el.role !== null && VALUED_ROLES.has(el.role)));
|
|
3501
|
+
if (valuedEls.length !== expected.length) out.push(`${valuedEls.length} valued elements rendered, expected ${expected.length}`);
|
|
3502
|
+
const texts = [];
|
|
3503
|
+
for (const [i, el] of valuedEls.entries()) {
|
|
3504
|
+
const want = expected[i];
|
|
3505
|
+
if (want === void 0) continue;
|
|
1000
3506
|
const now = el.attrs["aria-valuenow"];
|
|
1001
|
-
if (now !== void 0 && Number(now) !== value) out.push(`${el.describe} aria-valuenow="${now}", machine value ${value}`);
|
|
1002
3507
|
const text = el.attrs["aria-valuetext"];
|
|
3508
|
+
if (want === null) {
|
|
3509
|
+
if (now !== void 0) out.push(`${el.describe} has aria-valuenow="${now}", expected none`);
|
|
3510
|
+
const declared = f.valued?.valueText?.(i);
|
|
3511
|
+
if (declared === void 0 && text !== void 0) out.push(`${el.describe} has aria-valuetext="${text}", expected none`);
|
|
3512
|
+
else if (declared !== void 0 && text !== declared) out.push(`${el.describe} aria-valuetext="${text}", expected "${declared}"`);
|
|
3513
|
+
continue;
|
|
3514
|
+
}
|
|
3515
|
+
if (now !== void 0 && Number(now) !== want) out.push(`${el.describe} aria-valuenow="${now}", machine value ${want}`);
|
|
1003
3516
|
if (text === void 0) continue;
|
|
1004
|
-
|
|
3517
|
+
texts.push(text);
|
|
3518
|
+
const declared = f.valued?.valueText?.(i);
|
|
1005
3519
|
if (text.trim() === "") out.push(`${el.describe} has an empty aria-valuetext`);
|
|
1006
|
-
else if (
|
|
3520
|
+
else if (declared !== void 0) {
|
|
3521
|
+
if (text !== declared) out.push(`${el.describe} aria-valuetext="${text}", expected "${declared}"`);
|
|
3522
|
+
} else if (/^-?\d+(\.\d+)?$/.test(text.trim()) && String(Number(text)) === text.trim()) {
|
|
3523
|
+
if (Number(text) !== want) out.push(`${el.describe} aria-valuetext="${text}", machine value ${want}`);
|
|
3524
|
+
}
|
|
1007
3525
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
3526
|
+
const single = expected.length === 1 ? expected[0] : void 0;
|
|
3527
|
+
if (typeof single === "number") for (const p of f.after.parts.filter((x) => x.part === "value-text" && exposed(x))) {
|
|
3528
|
+
const want = texts[0] ?? String(single);
|
|
1010
3529
|
if (!p.text.includes(want)) out.push(`${p.describe} shows "${p.text}", expected "${want}"`);
|
|
1011
3530
|
}
|
|
1012
3531
|
return out;
|
|
@@ -1180,7 +3699,10 @@ function expectations(contract, state, view) {
|
|
|
1180
3699
|
/** The event type the oracle processes for an edge (`$props:x` → the declared event). */
|
|
1181
3700
|
function stepEvent(machine, edge) {
|
|
1182
3701
|
if (edge.event.startsWith("$sync:")) return "$sync";
|
|
1183
|
-
if (edge.event.startsWith("$props:"))
|
|
3702
|
+
if (edge.event.startsWith("$props:")) {
|
|
3703
|
+
const entry = machine.def.onProps?.[edge.event.slice(7)];
|
|
3704
|
+
return entry === void 0 ? edge.event : typeof entry === "string" ? entry : entry.event;
|
|
3705
|
+
}
|
|
1184
3706
|
return edge.event;
|
|
1185
3707
|
}
|
|
1186
3708
|
/** Whether the oracle's step log shows that this edge was taken. */
|
|
@@ -1222,6 +3744,33 @@ const oracleEnv = {
|
|
|
1222
3744
|
prepare: () => () => {},
|
|
1223
3745
|
cancel: () => {}
|
|
1224
3746
|
},
|
|
3747
|
+
position: {
|
|
3748
|
+
track: () => ({ stop: () => {} }),
|
|
3749
|
+
reposition: () => {}
|
|
3750
|
+
},
|
|
3751
|
+
hoverIntent: {
|
|
3752
|
+
isInTransit: () => false,
|
|
3753
|
+
track: () => () => {},
|
|
3754
|
+
triggerProps: () => ({})
|
|
3755
|
+
},
|
|
3756
|
+
menuTree: {
|
|
3757
|
+
register: () => () => {},
|
|
3758
|
+
openChild: () => {},
|
|
3759
|
+
childClosed: () => {},
|
|
3760
|
+
closeTree: () => {},
|
|
3761
|
+
openPath: () => [],
|
|
3762
|
+
rootTrigger: () => null,
|
|
3763
|
+
parentKind: () => null,
|
|
3764
|
+
parentElements: () => [],
|
|
3765
|
+
parentNavigate: () => {},
|
|
3766
|
+
parentPress: () => {}
|
|
3767
|
+
},
|
|
3768
|
+
delayGroup: {
|
|
3769
|
+
join: () => () => {},
|
|
3770
|
+
isWarm: () => false,
|
|
3771
|
+
opened: () => {},
|
|
3772
|
+
closed: () => {}
|
|
3773
|
+
},
|
|
1225
3774
|
modality: {
|
|
1226
3775
|
modality: () => "keyboard",
|
|
1227
3776
|
subscribe: () => () => {},
|
|
@@ -1366,6 +3915,10 @@ function testMachine(contract, options) {
|
|
|
1366
3915
|
if (missingProps.length > 0) options.test(`${contract.scope}: props read by guards`, async (..._) => {
|
|
1367
3916
|
throw new Error(missingProps.map((key) => `a guard reads prop "${key}": pass it in testMachine({ props })`).join("\n"));
|
|
1368
3917
|
});
|
|
3918
|
+
const reopenStats = {
|
|
3919
|
+
exercised: 0,
|
|
3920
|
+
skipped: 0
|
|
3921
|
+
};
|
|
1369
3922
|
const covered = /* @__PURE__ */ new Set();
|
|
1370
3923
|
/** Edges cut as not taken in some modality (reported only if no modality covers them). */
|
|
1371
3924
|
const notTaken = /* @__PURE__ */ new Set();
|
|
@@ -1394,12 +3947,17 @@ function testMachine(contract, options) {
|
|
|
1394
3947
|
platform,
|
|
1395
3948
|
locale: options.locale ?? "en",
|
|
1396
3949
|
direction,
|
|
1397
|
-
modality
|
|
3950
|
+
modality,
|
|
3951
|
+
reopen: reopenStats
|
|
1398
3952
|
};
|
|
1399
3953
|
options.test(name, (...args) => runPath(contract, graph, plannedPath, ctx, options, args, name));
|
|
1400
3954
|
}
|
|
1401
3955
|
}
|
|
1402
3956
|
});
|
|
3957
|
+
if (contract.traits.includes("presence")) options.test(`${contract.scope}: presence — reopen during exit exercised`, async (..._) => {
|
|
3958
|
+
console.info(`[rind-ui] ${contract.scope} presence: reopen during exit exercised ${reopenStats.exercised}, exit over before the hold ${reopenStats.skipped}`);
|
|
3959
|
+
if (reopenStats.exercised === 0 && reopenStats.skipped > 0) throw new Error(`${contract.scope}: reopen-during-exit never exercised: exit ended before hold (${reopenStats.skipped} closing steps)`);
|
|
3960
|
+
});
|
|
1403
3961
|
const failing = [];
|
|
1404
3962
|
const info = [];
|
|
1405
3963
|
for (const edge of graph.edges) {
|
|
@@ -1458,6 +4016,7 @@ function replayEnv(base, snapshot, mode) {
|
|
|
1458
4016
|
click: async () => {},
|
|
1459
4017
|
tap: async () => {},
|
|
1460
4018
|
focus: async () => {},
|
|
4019
|
+
focusWithTab: async () => {},
|
|
1461
4020
|
type: async (text) => {
|
|
1462
4021
|
if (mode !== "composing" || !isText(name) || text === "") return;
|
|
1463
4022
|
state.used = true;
|
|
@@ -1468,6 +4027,9 @@ function replayEnv(base, snapshot, mode) {
|
|
|
1468
4027
|
},
|
|
1469
4028
|
compose: async () => {},
|
|
1470
4029
|
pressAtPosition: async () => {},
|
|
4030
|
+
pointer: async () => {},
|
|
4031
|
+
drag: async () => {},
|
|
4032
|
+
fill: async () => {},
|
|
1471
4033
|
hover: async () => {
|
|
1472
4034
|
if (mode !== "touch-hover") return;
|
|
1473
4035
|
state.used = true;
|
|
@@ -1502,7 +4064,8 @@ function replayEnv(base, snapshot, mode) {
|
|
|
1502
4064
|
composing: true
|
|
1503
4065
|
});
|
|
1504
4066
|
},
|
|
1505
|
-
pointerOutside: async () => {}
|
|
4067
|
+
pointerOutside: async () => {},
|
|
4068
|
+
pointerAway: async () => {}
|
|
1506
4069
|
},
|
|
1507
4070
|
state
|
|
1508
4071
|
};
|
|
@@ -1522,6 +4085,7 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1522
4085
|
if (!env) {
|
|
1523
4086
|
env = directed(factory.create({
|
|
1524
4087
|
scope: contract.scope,
|
|
4088
|
+
...hostedPartName(contract),
|
|
1525
4089
|
anchor,
|
|
1526
4090
|
modality: m,
|
|
1527
4091
|
platform
|
|
@@ -1531,7 +4095,20 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1531
4095
|
return env;
|
|
1532
4096
|
};
|
|
1533
4097
|
const base = envFor(modality);
|
|
4098
|
+
/** The machines' delays: the virtual clock when the test gave one, else the adapter's time. */
|
|
4099
|
+
const elapse = async (ms) => {
|
|
4100
|
+
if (!options.clock) return base.advance(ms);
|
|
4101
|
+
options.clock.advance(ms);
|
|
4102
|
+
await base.advance(0);
|
|
4103
|
+
};
|
|
1534
4104
|
if (direction === "rtl") await base.setDirection("rtl");
|
|
4105
|
+
/** States the contract declares the component unmounted in (`absentIn`). */
|
|
4106
|
+
const absentIn = new Set(contract.absentIn ?? []);
|
|
4107
|
+
/**
|
|
4108
|
+
* The instance's snapshot. A contract with `absentIn` may have no anchor left (unmounted):
|
|
4109
|
+
* then only the document-wide fields. Without `absentIn`, unchanged (a missing anchor throws).
|
|
4110
|
+
*/
|
|
4111
|
+
const collect = async () => absentIn.size > 0 && await base.anchorCount() === 0 ? base.collectDocument() : base.collect();
|
|
1535
4112
|
const props = options.props ?? {};
|
|
1536
4113
|
const oracle = createOracle(contract, props);
|
|
1537
4114
|
/** Everything sent to the oracle, to replay "what if" events on a copy. */
|
|
@@ -1589,11 +4166,14 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1589
4166
|
return out;
|
|
1590
4167
|
};
|
|
1591
4168
|
const expectedFor = (state) => contract.states[state] ?? {};
|
|
1592
|
-
const matchesState = (state) => (seen) => Object.entries(expectedFor(state)).every(([k, v]) => Object.is(seen[k], v));
|
|
4169
|
+
const matchesState = (state) => (seen) => absentIn.has(state) || Object.entries(expectedFor(state)).every(([k, v]) => Object.is(seen[k], v));
|
|
1593
4170
|
/** The longest delay the machine can schedule under the current props. */
|
|
1594
4171
|
const longestDelay = () => Math.max(0, ...Object.values(impl.delays ?? {}).map((d) => {
|
|
1595
4172
|
try {
|
|
1596
|
-
return Number(d({
|
|
4173
|
+
return Number(d({
|
|
4174
|
+
props: oracle.props,
|
|
4175
|
+
context: oracle.service.getSnapshot().context
|
|
4176
|
+
})) || 0;
|
|
1597
4177
|
} catch {
|
|
1598
4178
|
return 0;
|
|
1599
4179
|
}
|
|
@@ -1604,7 +4184,7 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1604
4184
|
* delayed reaction (a tooltip's open delay) is seen.
|
|
1605
4185
|
*/
|
|
1606
4186
|
const unchanged = async (state, previous, wait = 16) => {
|
|
1607
|
-
await
|
|
4187
|
+
await elapse(wait);
|
|
1608
4188
|
const seen = await observe();
|
|
1609
4189
|
const changed = Object.keys(seen).filter((k) => JSON.stringify(seen[k]) !== JSON.stringify(previous[k]));
|
|
1610
4190
|
return {
|
|
@@ -1613,23 +4193,37 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1613
4193
|
changed
|
|
1614
4194
|
};
|
|
1615
4195
|
};
|
|
1616
|
-
const hoveredParts = async () => new Set((await
|
|
4196
|
+
const hoveredParts = async () => new Set((await collect()).parts.filter((p) => p.attrs["data-hover"] !== void 0).map((p) => p.describe));
|
|
1617
4197
|
/** The last step's facts: the base of the unmount-while-open check. */
|
|
1618
4198
|
/** Steps whose user action changed the value (form-associated: one `change` each). */
|
|
1619
4199
|
let userChanges = 0;
|
|
4200
|
+
/** The values the form carries, serialised (a user change compares them). */
|
|
4201
|
+
const formValues = () => {
|
|
4202
|
+
const values = oracle.service.view().values;
|
|
4203
|
+
const keys = contract.formInput?.values;
|
|
4204
|
+
return JSON.stringify(keys ? keys.map((k) => values[k]) : values);
|
|
4205
|
+
};
|
|
1620
4206
|
let lastFacts = null;
|
|
1621
4207
|
const verify = async (step, edge, before, from, baseline, stepModality, announcedBefore) => {
|
|
1622
4208
|
const state = oracle.service.getSnapshot().state;
|
|
1623
4209
|
const expected = expectedFor(state);
|
|
1624
4210
|
const matches = matchesState(state);
|
|
1625
|
-
const
|
|
4211
|
+
const absent = absentIn.has(state);
|
|
4212
|
+
const seen = absent ? await base.until(() => base.anchorCount(), (n) => n === 0).then(() => ({}), () => ({})) : await base.until(observe, matches).catch(async () => observe());
|
|
1626
4213
|
if (!matches(seen)) fail(step, edge, `${stepModality === "virtual" ? "virtual-parity: " : ""}expected ${state}: ${JSON.stringify(expected)}\n observed: ${JSON.stringify(seen)}`);
|
|
4214
|
+
if (contract.traits.includes("timed") && seen["isOpen"] === true) {
|
|
4215
|
+
const held = (await collect()).parts.filter((p) => p.attrs["data-hover"] !== void 0 || p.attrs["data-focus"] !== void 0);
|
|
4216
|
+
if (held.length > 0) {
|
|
4217
|
+
await elapse(longestDelay() + 16);
|
|
4218
|
+
if ((await observe())["isOpen"] !== true) fail(step, edge, `timed: closed by a timer while ${held.map((p) => p.describe).join(", ")} ${held.length === 1 ? "is" : "are"} hovered or focused (waited ${longestDelay() + 16} ms)`);
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
1627
4221
|
if (contract.traits.includes("presence")) {
|
|
1628
4222
|
const content = contract.semantics?.["content"];
|
|
1629
|
-
await base.until(async () => (await
|
|
4223
|
+
await base.until(async () => (await collect()).parts.filter((p) => p.part === content && p.animations > 0).length, (n) => n === 0).catch(() => {});
|
|
1630
4224
|
await base.advance(16);
|
|
1631
4225
|
}
|
|
1632
|
-
const after = await
|
|
4226
|
+
const after = await collect();
|
|
1633
4227
|
const facts = {
|
|
1634
4228
|
before,
|
|
1635
4229
|
after,
|
|
@@ -1637,8 +4231,10 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1637
4231
|
from,
|
|
1638
4232
|
state,
|
|
1639
4233
|
...expectations(contract, state, oracle.service.view()),
|
|
4234
|
+
fromInitial: from === graph.initial,
|
|
1640
4235
|
atInitial: state === graph.initial,
|
|
1641
4236
|
anchorCount: await base.anchorCount(),
|
|
4237
|
+
...absent ? { absent: true } : {},
|
|
1642
4238
|
errors: await base.takeErrors(),
|
|
1643
4239
|
traits: contract.traits,
|
|
1644
4240
|
semantics: { ...contract.semantics },
|
|
@@ -1650,8 +4246,13 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1650
4246
|
stepAnnouncements: (await base.announcements()).slice(announcedBefore),
|
|
1651
4247
|
observed: seen,
|
|
1652
4248
|
...contract.announcements ? { announcements: contract.announcements } : {},
|
|
4249
|
+
...contract.valued ? { valued: {
|
|
4250
|
+
values: contract.valued.values(oracle.service.view(), oracle.props),
|
|
4251
|
+
...contract.valued.valueText ? { valueText: (i) => contract.valued?.valueText?.(oracle.service.view(), i, oracle.props) ?? "" } : {}
|
|
4252
|
+
} } : {},
|
|
1653
4253
|
...contract.formInput ? { formInput: {
|
|
1654
4254
|
...contract.formInput.multiple ? { multiple: true } : {},
|
|
4255
|
+
...contract.formInput.accessible ? { accessible: true } : {},
|
|
1655
4256
|
expected: (input) => contract.formInput?.expected(oracle.service.view().values, input) ?? {},
|
|
1656
4257
|
userChanges
|
|
1657
4258
|
} } : {},
|
|
@@ -1666,12 +4267,13 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1666
4267
|
console.info(`[rind-ui] ${contract.scope}: Chromium accessibility-tree checks skipped (unavailable here)`);
|
|
1667
4268
|
}
|
|
1668
4269
|
} else if (chromium) problems.push(...chromium.map((p) => `chromium-tree: ${p}`));
|
|
1669
|
-
const own = [...contract.invariants ?? [], ...options.invariants ?? []];
|
|
4270
|
+
const own = [...absent ? [] : contract.invariants ?? [], ...options.invariants ?? []];
|
|
1670
4271
|
for (const inv of own) {
|
|
1671
4272
|
const result = await inv.check({
|
|
1672
4273
|
env: base,
|
|
1673
4274
|
state,
|
|
1674
4275
|
modality,
|
|
4276
|
+
stepModality,
|
|
1675
4277
|
props: oracle.props,
|
|
1676
4278
|
values: oracle.service.view().values
|
|
1677
4279
|
}).catch((e) => e instanceof Error ? e.message : String(e));
|
|
@@ -1708,15 +4310,24 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1708
4310
|
* reopened — the exiting element must come back, not a new one — and closed again by the
|
|
1709
4311
|
* same action, so the path goes on from the state it reached.
|
|
1710
4312
|
*/
|
|
1711
|
-
const reopenDuringExit = async (step, edge, close) => {
|
|
4313
|
+
const reopenDuringExit = async (step, edge, close, held) => {
|
|
4314
|
+
const { resume } = held;
|
|
1712
4315
|
const content = contract.semantics?.["content"];
|
|
1713
|
-
const exiting = (await
|
|
1714
|
-
if (!exiting)
|
|
4316
|
+
const exiting = (await collect()).parts.find((p) => p.part === content && p.animations > 0);
|
|
4317
|
+
if (!exiting) {
|
|
4318
|
+
if (held.animatedBefore && ctx.reopen) ctx.reopen.skipped += 1;
|
|
4319
|
+
await resume();
|
|
4320
|
+
return;
|
|
4321
|
+
}
|
|
4322
|
+
if (ctx.reopen) ctx.reopen.exercised += 1;
|
|
1715
4323
|
if (exiting.attrs["data-state"] !== "closed") fail(step, edge, `presence: ${exiting.describe} is exiting (running animations: ${exiting.animations}) without data-state="closed"`);
|
|
1716
4324
|
const state = oracle.service.getSnapshot().state;
|
|
1717
4325
|
const reopen = graph.edges.find((e) => e.source === state && e.target !== null && expectations(contract, e.target, null).open && mappingOf(contract, e)?.kind === "action");
|
|
1718
4326
|
const m = reopen ? mappingOf(contract, reopen) : void 0;
|
|
1719
|
-
if (!reopen || m?.kind !== "action")
|
|
4327
|
+
if (!reopen || m?.kind !== "action") {
|
|
4328
|
+
await resume();
|
|
4329
|
+
return;
|
|
4330
|
+
}
|
|
1720
4331
|
const action = contract.actions[m.action] ?? {};
|
|
1721
4332
|
const mod = stepModality(action, "keyboard");
|
|
1722
4333
|
const act = async (name, args, m) => {
|
|
@@ -1728,7 +4339,8 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1728
4339
|
};
|
|
1729
4340
|
send(reopen.event, { modality: mod });
|
|
1730
4341
|
await act(m.action, m.args?.(oracle.service.view()) ?? [], mod);
|
|
1731
|
-
const back = (await
|
|
4342
|
+
const back = (await collect()).parts.find((p) => p.part === content);
|
|
4343
|
+
await resume();
|
|
1732
4344
|
if (back?.node !== exiting.node) fail(step, edge, `presence: reopening during the exit (running animations: ${exiting.animations}) ${back ? `mounted a new ${back.describe}` : "left no content"}; the exiting element must be kept`);
|
|
1733
4345
|
send(edge.event, { modality: close.mod });
|
|
1734
4346
|
await act(close.action, close.args, close.mod);
|
|
@@ -1743,9 +4355,16 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1743
4355
|
const announcedBefore = (await base.announcements()).length;
|
|
1744
4356
|
let stepMod = null;
|
|
1745
4357
|
if (mapping?.kind === "delay") {
|
|
1746
|
-
const ms = impl.delays?.[edge.event.slice(6)]?.({
|
|
4358
|
+
const ms = impl.delays?.[edge.event.slice(6)]?.({
|
|
4359
|
+
props: oracle.props,
|
|
4360
|
+
context: oracle.service.getSnapshot().context
|
|
4361
|
+
}) ?? 0;
|
|
4362
|
+
const valuesBefore = formValues();
|
|
1747
4363
|
send(edge.event);
|
|
1748
|
-
|
|
4364
|
+
if (contract.formInput && formValues() !== valuesBefore && !contract.formInput.silentEvents?.includes(edge.event)) userChanges += 1;
|
|
4365
|
+
const firedBefore = options.clock?.fired() ?? 0;
|
|
4366
|
+
await elapse(ms);
|
|
4367
|
+
if (options.clock && options.clock.fired() === firedBefore) throw new Error(`${edge.event}: no timer fired on the virtual clock; pass clock.scheduler as RindProvider environment={{ scheduler }}`);
|
|
1749
4368
|
} else if (mapping?.kind === "props") {
|
|
1750
4369
|
const next = {
|
|
1751
4370
|
...oracle.props,
|
|
@@ -1767,17 +4386,26 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1767
4386
|
if (stepMod === "keyboard" && typeof keyboardImpl === "function") await replay(i + 1, edge, "composing", keyboardImpl, actionArgs, before, from);
|
|
1768
4387
|
const ownImpl = action[stepMod === "virtual" ? "pointer" : stepMod];
|
|
1769
4388
|
if (typeof ownImpl === "function") await replay(i + 1, edge, "touch-hover", ownImpl, actionArgs, before, from);
|
|
1770
|
-
const valuesBefore =
|
|
4389
|
+
const valuesBefore = formValues();
|
|
1771
4390
|
send(edge.event, {
|
|
1772
4391
|
...mapping.event?.(oracle.service.view()),
|
|
1773
4392
|
modality: stepMod
|
|
1774
4393
|
});
|
|
1775
|
-
if (
|
|
4394
|
+
if (contract.formInput?.nativeEvents?.includes(edge.event)) userChanges += 1;
|
|
4395
|
+
else if (formValues() !== valuesBefore && !contract.formInput?.silentEvents?.includes(edge.event)) userChanges += 1;
|
|
4396
|
+
const willClose = edge !== notTaken && edge.target !== null && expectations(contract, from, null).open && !expectations(contract, edge.target, null).open;
|
|
4397
|
+
if (contract.traits.includes("presence") && willClose) await base.armHold?.();
|
|
1776
4398
|
try {
|
|
1777
4399
|
await runAction(contract, envFor(stepMod), mapping.action, actionArgs, edge !== notTaken);
|
|
1778
4400
|
} catch (e) {
|
|
1779
4401
|
fail(i + 1, edge, e instanceof Error ? e.message : String(e));
|
|
1780
4402
|
}
|
|
4403
|
+
const closesNow = edge !== notTaken && edge.target !== null && expectations(contract, from, null).open && !expectations(contract, edge.target, null).open;
|
|
4404
|
+
const animatedBefore = before?.parts.some((p) => p.part === contract.semantics?.["content"] && p.motion) === true;
|
|
4405
|
+
const held = contract.traits.includes("presence") && closesNow && base.holdAnimations ? {
|
|
4406
|
+
resume: await base.holdAnimations(),
|
|
4407
|
+
animatedBefore
|
|
4408
|
+
} : void 0;
|
|
1781
4409
|
const closes = edge !== notTaken && edge.target !== null && expectations(contract, from, null).open && !expectations(contract, edge.target, null).open;
|
|
1782
4410
|
if (options.activations) {
|
|
1783
4411
|
const { action: name, count } = options.activations;
|
|
@@ -1792,7 +4420,11 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1792
4420
|
action: mapping.action,
|
|
1793
4421
|
args: actionArgs,
|
|
1794
4422
|
mod: stepMod
|
|
4423
|
+
}, held ?? {
|
|
4424
|
+
resume: async () => {},
|
|
4425
|
+
animatedBefore: false
|
|
1795
4426
|
});
|
|
4427
|
+
else await held?.resume();
|
|
1796
4428
|
} else fail(i + 1, edge, `no contract mapping for ${edge.event}`);
|
|
1797
4429
|
done.push(`${edge.event}→${oracle.service.getSnapshot().state}`);
|
|
1798
4430
|
before = await verify(i + 1, edge, before, from, baseline, stepMod, announcedBefore);
|
|
@@ -1837,6 +4469,63 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
1837
4469
|
});
|
|
1838
4470
|
}
|
|
1839
4471
|
//#endregion
|
|
4472
|
+
//#region src/number-input-invariants.ts
|
|
4473
|
+
const ROOT = "[data-scope=\"number-input\"][data-part=\"root\"]";
|
|
4474
|
+
const TABBABLE = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]";
|
|
4475
|
+
/**
|
|
4476
|
+
* `changes` reads how often the page's `onValueChange` ran, `expectedChanges` the oracle's
|
|
4477
|
+
* (pass a counting `onValueChange` in the oracle's props).
|
|
4478
|
+
*/
|
|
4479
|
+
function numberInputStepInvariants(options = {}) {
|
|
4480
|
+
let lastActive;
|
|
4481
|
+
let pointerPressed = false;
|
|
4482
|
+
globalThis.document?.addEventListener("pointerdown", () => {
|
|
4483
|
+
pointerPressed = true;
|
|
4484
|
+
}, true);
|
|
4485
|
+
return {
|
|
4486
|
+
invariants: [
|
|
4487
|
+
{
|
|
4488
|
+
name: "number-input-one-tab-stop",
|
|
4489
|
+
check: async () => {
|
|
4490
|
+
const doc = globalThis.document;
|
|
4491
|
+
if (!doc) return void 0;
|
|
4492
|
+
for (const root of Array.from(doc.querySelectorAll(ROOT))) {
|
|
4493
|
+
const extra = Array.from(root.querySelectorAll(TABBABLE)).filter((el) => el.tabIndex >= 0 && !el.disabled).filter((el) => el.getAttribute("data-part") !== "input");
|
|
4494
|
+
if (extra.length > 0) return `parts in the tab order besides the input: ${extra.map((el) => el.getAttribute("data-part") ?? el.tagName).join(", ")}`;
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
},
|
|
4498
|
+
{
|
|
4499
|
+
name: "number-input-touch-keeps-focus",
|
|
4500
|
+
check: async ({ stepModality: modality }) => {
|
|
4501
|
+
const active = globalThis.document?.activeElement ?? null;
|
|
4502
|
+
const before = lastActive;
|
|
4503
|
+
lastActive = active;
|
|
4504
|
+
const pressed = pointerPressed;
|
|
4505
|
+
pointerPressed = false;
|
|
4506
|
+
if (pressed && modality === "virtual") return void 0;
|
|
4507
|
+
if (before === void 0 || modality !== "touch" && modality !== "virtual") return void 0;
|
|
4508
|
+
if (active === before) return void 0;
|
|
4509
|
+
const moved = active?.closest?.(ROOT) ? active.getAttribute("data-part") : null;
|
|
4510
|
+
return moved ? `a ${modality} step moved focus to the ${moved}` : void 0;
|
|
4511
|
+
}
|
|
4512
|
+
},
|
|
4513
|
+
{
|
|
4514
|
+
name: "number-input-change-count",
|
|
4515
|
+
check: async () => {
|
|
4516
|
+
if (!options.changes || !options.expectedChanges) return void 0;
|
|
4517
|
+
const [have, want] = [options.changes(), options.expectedChanges()];
|
|
4518
|
+
return have === want ? void 0 : `onValueChange ran ${have} times, the oracle ${want}`;
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
],
|
|
4522
|
+
reset() {
|
|
4523
|
+
lastActive = void 0;
|
|
4524
|
+
pointerPressed = false;
|
|
4525
|
+
}
|
|
4526
|
+
};
|
|
4527
|
+
}
|
|
4528
|
+
//#endregion
|
|
1840
4529
|
//#region src/positioning.ts
|
|
1841
4530
|
function fakePositioning() {
|
|
1842
4531
|
const live = /* @__PURE__ */ new Set();
|
|
@@ -1911,6 +4600,71 @@ function englishLeaks(defaults, texts) {
|
|
|
1911
4600
|
return Object.values(defaults).filter((v) => typeof v === "string").filter((e) => texts.some((t) => t.includes(e)));
|
|
1912
4601
|
}
|
|
1913
4602
|
//#endregion
|
|
4603
|
+
//#region src/slider-invariants.ts
|
|
4604
|
+
const FOCUSABLE = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"], [role=\"slider\"]";
|
|
4605
|
+
/**
|
|
4606
|
+
* `commits` reads how often the page's `onValueCommit` ran; `expectedCommits` how often the
|
|
4607
|
+
* oracle's did (pass a spy as the oracle's `onValueCommit` prop).
|
|
4608
|
+
*/
|
|
4609
|
+
function sliderStepInvariants(options = {}) {
|
|
4610
|
+
const scope = options.naming?.scope ?? "slider";
|
|
4611
|
+
const name = (part) => options.naming?.part(part) ?? part;
|
|
4612
|
+
const THUMB_INPUT = `[data-scope="${scope}"][data-part="${name("hidden-input")}"]`;
|
|
4613
|
+
const ROOT = `[data-scope="${scope}"][data-part="${name("root")}"]`;
|
|
4614
|
+
let refocused = [];
|
|
4615
|
+
let inKey = false;
|
|
4616
|
+
const doc = globalThis.document;
|
|
4617
|
+
const onKeyDown = () => {
|
|
4618
|
+
inKey = true;
|
|
4619
|
+
setTimeout(() => {
|
|
4620
|
+
inKey = false;
|
|
4621
|
+
}, 0);
|
|
4622
|
+
};
|
|
4623
|
+
const onFocusChange = (e) => {
|
|
4624
|
+
const target = e.target;
|
|
4625
|
+
if (inKey && target?.matches?.(THUMB_INPUT)) refocused.push(`${e.type} on thumb input ${target.getAttribute("data-index")}`);
|
|
4626
|
+
};
|
|
4627
|
+
if (doc) {
|
|
4628
|
+
doc.addEventListener("keydown", onKeyDown, true);
|
|
4629
|
+
doc.addEventListener("focusin", onFocusChange, true);
|
|
4630
|
+
doc.addEventListener("focusout", onFocusChange, true);
|
|
4631
|
+
}
|
|
4632
|
+
return {
|
|
4633
|
+
invariants: [
|
|
4634
|
+
{
|
|
4635
|
+
name: "slider-no-refocus-on-key",
|
|
4636
|
+
check: async () => {
|
|
4637
|
+
const out = refocused;
|
|
4638
|
+
refocused = [];
|
|
4639
|
+
return out.length > 0 ? `focus moved during a key step: ${out.join(", ")}` : void 0;
|
|
4640
|
+
}
|
|
4641
|
+
},
|
|
4642
|
+
{
|
|
4643
|
+
name: "slider-only-thumb-inputs-focusable",
|
|
4644
|
+
check: async () => {
|
|
4645
|
+
if (!doc) return void 0;
|
|
4646
|
+
for (const root of Array.from(doc.querySelectorAll(ROOT))) {
|
|
4647
|
+
const extra = Array.from(root.querySelectorAll(FOCUSABLE)).filter((el) => !el.matches(THUMB_INPUT));
|
|
4648
|
+
if (extra.length > 0) return `elements other than the thumb inputs are focusable or sliders: ${extra.map((el) => el.outerHTML.slice(0, 80)).join(", ")}`;
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
},
|
|
4652
|
+
{
|
|
4653
|
+
name: "slider-commit-count",
|
|
4654
|
+
check: async () => {
|
|
4655
|
+
if (!options.commits || !options.expectedCommits) return void 0;
|
|
4656
|
+
const [have, want] = [options.commits(), options.expectedCommits()];
|
|
4657
|
+
return have === want ? void 0 : `onValueCommit ran ${have} times, the oracle ${want}`;
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
],
|
|
4661
|
+
reset() {
|
|
4662
|
+
refocused = [];
|
|
4663
|
+
inKey = false;
|
|
4664
|
+
}
|
|
4665
|
+
};
|
|
4666
|
+
}
|
|
4667
|
+
//#endregion
|
|
1914
4668
|
//#region src/state-stories.ts
|
|
1915
4669
|
/** States of `contract` with no state story (empty when covered). */
|
|
1916
4670
|
function missingStateStories(contract, stories, storyExports) {
|
|
@@ -1978,6 +4732,116 @@ function textFieldStepInvariants(options = {}) {
|
|
|
1978
4732
|
};
|
|
1979
4733
|
}
|
|
1980
4734
|
//#endregion
|
|
4735
|
+
//#region src/text-field-key-invariants.ts
|
|
4736
|
+
/**
|
|
4737
|
+
* - `text-field-escape-consumed`: an Escape on a non-empty editable field left focus in the
|
|
4738
|
+
* input and was prevented; on an empty one (or read-only, disabled) it was not, so an
|
|
4739
|
+
* enclosing layer gets it (react-spectrum#5480);
|
|
4740
|
+
* - `text-field-ime-keys`: an Escape or Enter marked composing neither cleared the value nor
|
|
4741
|
+
* searched (react-spectrum#10249, #6421). `submits` counts the story's `onSubmit` calls.
|
|
4742
|
+
*/
|
|
4743
|
+
function textFieldKeyStepInvariants(options = {}) {
|
|
4744
|
+
let keys = [];
|
|
4745
|
+
const submits = options.submits ?? (() => 0);
|
|
4746
|
+
const close = (k) => {
|
|
4747
|
+
if (k && !k.after) k.after = {
|
|
4748
|
+
value: k.input.value,
|
|
4749
|
+
submits: submits()
|
|
4750
|
+
};
|
|
4751
|
+
};
|
|
4752
|
+
const take = () => {
|
|
4753
|
+
close(keys.at(-1));
|
|
4754
|
+
const out = keys;
|
|
4755
|
+
keys = [];
|
|
4756
|
+
return out;
|
|
4757
|
+
};
|
|
4758
|
+
return {
|
|
4759
|
+
invariants: [{
|
|
4760
|
+
name: "text-field-escape-consumed",
|
|
4761
|
+
check: async () => {
|
|
4762
|
+
for (const k of keys) {
|
|
4763
|
+
if (k.event.key !== "Escape" || k.composing) continue;
|
|
4764
|
+
const handles = k.value !== "" && k.editable;
|
|
4765
|
+
if (handles && !k.event.defaultPrevented) return `Escape on "${k.value}" was not prevented (an enclosing layer would also close)`;
|
|
4766
|
+
if (handles && k.input.ownerDocument.activeElement !== k.input) return "Escape cleared the field but focus left the input";
|
|
4767
|
+
if (!handles && k.event.defaultPrevented) return `Escape on ${k.value === "" ? "an empty" : "a non-editable"} field was prevented (it belongs to the enclosing layer)`;
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
}, {
|
|
4771
|
+
name: "text-field-ime-keys",
|
|
4772
|
+
check: async () => {
|
|
4773
|
+
for (const k of take()) {
|
|
4774
|
+
if (!k.composing) continue;
|
|
4775
|
+
if (k.event.key === "Escape" && k.value !== "" && k.after?.value === "") return "an Escape during a composition cleared the value";
|
|
4776
|
+
if (k.event.key === "Enter" && (k.after?.submits ?? 0) > k.submitsBefore) return "an Enter during a composition searched (onSubmit was called)";
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
}],
|
|
4780
|
+
reset() {
|
|
4781
|
+
keys = [];
|
|
4782
|
+
const onKey = (event) => {
|
|
4783
|
+
const input = event.target;
|
|
4784
|
+
if (!(input instanceof HTMLInputElement) || input.type !== "search") return;
|
|
4785
|
+
if (event.key !== "Escape" && event.key !== "Enter") return;
|
|
4786
|
+
close(keys.at(-1));
|
|
4787
|
+
keys.push({
|
|
4788
|
+
event,
|
|
4789
|
+
input,
|
|
4790
|
+
value: input.value,
|
|
4791
|
+
editable: !input.disabled && !input.readOnly,
|
|
4792
|
+
composing: event.isComposing || event.keyCode === 229 || input.hasAttribute("data-composing"),
|
|
4793
|
+
submitsBefore: submits()
|
|
4794
|
+
});
|
|
4795
|
+
};
|
|
4796
|
+
window.addEventListener("keydown", onKey, true);
|
|
4797
|
+
return () => window.removeEventListener("keydown", onKey, true);
|
|
4798
|
+
}
|
|
4799
|
+
};
|
|
4800
|
+
}
|
|
4801
|
+
//#endregion
|
|
4802
|
+
//#region src/virtual-clock.ts
|
|
4803
|
+
function virtualClock() {
|
|
4804
|
+
let now = 0;
|
|
4805
|
+
let seq = 0;
|
|
4806
|
+
let fired = 0;
|
|
4807
|
+
const timers = /* @__PURE__ */ new Map();
|
|
4808
|
+
return {
|
|
4809
|
+
scheduler: {
|
|
4810
|
+
setTimeout: (callback, ms) => {
|
|
4811
|
+
const id = ++seq;
|
|
4812
|
+
timers.set(id, {
|
|
4813
|
+
at: now + Math.max(0, ms),
|
|
4814
|
+
callback
|
|
4815
|
+
});
|
|
4816
|
+
return id;
|
|
4817
|
+
},
|
|
4818
|
+
clearTimeout: (handle) => {
|
|
4819
|
+
timers.delete(handle);
|
|
4820
|
+
},
|
|
4821
|
+
requestAnimationFrame: (callback) => globalThis.requestAnimationFrame(() => callback()),
|
|
4822
|
+
cancelAnimationFrame: (handle) => globalThis.cancelAnimationFrame(handle)
|
|
4823
|
+
},
|
|
4824
|
+
advance(ms) {
|
|
4825
|
+
const end = now + ms;
|
|
4826
|
+
for (;;) {
|
|
4827
|
+
let next;
|
|
4828
|
+
for (const entry of timers) {
|
|
4829
|
+
if (entry[1].at > end) continue;
|
|
4830
|
+
if (!next || entry[1].at < next[1].at) next = entry;
|
|
4831
|
+
}
|
|
4832
|
+
if (!next) break;
|
|
4833
|
+
timers.delete(next[0]);
|
|
4834
|
+
now = next[1].at;
|
|
4835
|
+
fired += 1;
|
|
4836
|
+
next[1].callback();
|
|
4837
|
+
}
|
|
4838
|
+
now = end;
|
|
4839
|
+
},
|
|
4840
|
+
pending: () => timers.size,
|
|
4841
|
+
fired: () => fired
|
|
4842
|
+
};
|
|
4843
|
+
}
|
|
4844
|
+
//#endregion
|
|
1981
4845
|
//#region src/virtual-sr.ts
|
|
1982
4846
|
/**
|
|
1983
4847
|
* Starts the virtual screen reader on `container`, runs `run(virtual)` (move with
|
|
@@ -2004,4 +4868,30 @@ function liveAnnouncements(log) {
|
|
|
2004
4868
|
});
|
|
2005
4869
|
}
|
|
2006
4870
|
//#endregion
|
|
2007
|
-
|
|
4871
|
+
//#region src/warning-guard.ts
|
|
4872
|
+
const KEY = Symbol.for("rind-ui.warning-guard");
|
|
4873
|
+
function state() {
|
|
4874
|
+
const g = globalThis;
|
|
4875
|
+
g[KEY] ??= {
|
|
4876
|
+
seen: [],
|
|
4877
|
+
expected: [],
|
|
4878
|
+
allowed: []
|
|
4879
|
+
};
|
|
4880
|
+
return g[KEY];
|
|
4881
|
+
}
|
|
4882
|
+
/**
|
|
4883
|
+
* Declares that the current test logs a `[rind-ui]` warning or error matching `pattern`:
|
|
4884
|
+
* the guard does not fail the test for it, and fails it if no such message was logged.
|
|
4885
|
+
*/
|
|
4886
|
+
function expectRindWarning(pattern) {
|
|
4887
|
+
state().expected.push(pattern);
|
|
4888
|
+
}
|
|
4889
|
+
/**
|
|
4890
|
+
* Lets the current test log a `[rind-ui]` message matching `pattern` without requiring it: for
|
|
4891
|
+
* a file whose shared fixture logs it in some tests (call it in `beforeEach`).
|
|
4892
|
+
*/
|
|
4893
|
+
function allowRindWarning(pattern) {
|
|
4894
|
+
state().allowed.push(pattern);
|
|
4895
|
+
}
|
|
4896
|
+
//#endregion
|
|
4897
|
+
export { QrDecodeError, accordionStepInvariants, allowRindWarning, checkGeneric, checkboxStepInvariants, correctBlock, createDriver, createDriverWith, currentRun, dateFieldStepInvariants, dateRangeStepInvariants, decodeQr, domEnv, englishLeaks, expectRindWarning, fakeClipboard, fakeDelayGroup, fakeHoverIntent, fakePositioning, fakeRouter, fakeVisibility, fixedDateClock, formStepInvariants, genericInvariants, getAccordion, getAlert, getAvatar, getBadge, getBreadcrumbs, getButton, getCalendar, getCheckbox, getCheckboxGroup, getCodeBlock, getCollapsible, getColorPicker, getCombobox, getContextMenu, getDateField, getDialog, getDrawer, getField, getFieldset, getForm, getGridList, getHeading, getHoverCard, getImage, getLabel, getLink, getListbox, getMenu, getMenubar, getMeter, getNavigationMenu, getNumberInput, getPagination, getPinInput, getPopover, getProgress, getPromptInput, getQrCode, getRadioGroup, getRating, getScrollArea, getSegmentedControl, getSelect, getSeparator, getSkeleton, getSlider, getSplitter, getSwitch, getTabs, getTagGroup, getTagsInput, getTextField, getToast, getToaster, getToggle, getToggleGroup, getToolbar, getTooltip, getTour, getTreeView, installAnnouncementLog, interceptNativeNavigation, layoutInvariant, liveAnnouncements, machinePaths, missingAriaLines, missingStateStories, navigationLog, numberInputStepInvariants, parseQrPath, paths, platforms, playwrightEnv, pseudo, pseudoMessages, qrCodeDecodingContract, recordingAnnouncer, runAction, sliderStepInvariants, spokenLog, switchStepInvariants, testMachine, textFieldKeyStepInvariants, textFieldStepInvariants, toGraph, traitInvariants, uncovered, virtualClock, withEngine };
|