@motion-proto/live-tokens 0.96.0 → 0.98.2

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.
Files changed (206) hide show
  1. package/.claude/skills/live-tokens-check-compliance/SKILL.md +5 -0
  2. package/.claude/skills/live-tokens-create-component/SKILL.md +4 -3
  3. package/.claude/skills/live-tokens-create-component/references/contract-tests.md +71 -11
  4. package/CHANGELOG.md +309 -0
  5. package/README.md +2 -2
  6. package/bin/check-component.mjs +8 -0
  7. package/bin/check-page.mjs +6 -0
  8. package/bin/cli.mjs +36 -6
  9. package/bin/contractRunner.mjs +142 -17
  10. package/bin/lib/findings.mjs +20 -4
  11. package/bin/rules/a11y.mjs +53 -0
  12. package/bin/set-colors.mjs +1 -0
  13. package/bin/setup-claude.mjs +2 -2
  14. package/dist-plugin/{chunk-A4TBP4MM.js → chunk-SLICH4IH.js} +2 -2
  15. package/dist-plugin/index.cjs +148 -3
  16. package/dist-plugin/index.js +250 -105
  17. package/dist-plugin/setColors/index.cjs +7 -1
  18. package/dist-plugin/setColors/index.d.cts +9 -4
  19. package/dist-plugin/setColors/index.d.ts +9 -4
  20. package/dist-plugin/setColors/index.js +8 -2
  21. package/dist-plugin/setGeometry/index.d.cts +1 -1
  22. package/dist-plugin/setGeometry/index.d.ts +1 -1
  23. package/dist-plugin/setType/index.d.cts +1 -1
  24. package/dist-plugin/setType/index.d.ts +1 -1
  25. package/dist-plugin/{themeTypes-B8_Idrp4.d.cts → themeTypes-BaTQUyac.d.cts} +10 -1
  26. package/dist-plugin/{themeTypes-B8_Idrp4.d.ts → themeTypes-BaTQUyac.d.ts} +10 -1
  27. package/package.json +49 -2
  28. package/src/demo/LabeledSelect.svelte +1 -1
  29. package/src/editor/bootstrap.ts +3 -1
  30. package/src/editor/component-editor/BadgeEditor.svelte +13 -0
  31. package/src/editor/component-editor/ButtonEditor.svelte +33 -2
  32. package/src/editor/component-editor/CalloutEditor.svelte +13 -0
  33. package/src/editor/component-editor/CardEditor.svelte +12 -2
  34. package/src/editor/component-editor/CodeSnippetEditor.svelte +11 -1
  35. package/src/editor/component-editor/CollapsibleSectionEditor.svelte +18 -1
  36. package/src/editor/component-editor/CornerBadgeEditor.svelte +13 -0
  37. package/src/editor/component-editor/DialogEditor.svelte +15 -0
  38. package/src/editor/component-editor/IconButtonEditor.svelte +29 -1
  39. package/src/editor/component-editor/ImageEditor.svelte +20 -9
  40. package/src/editor/component-editor/ImageLightboxEditor.svelte +44 -0
  41. package/src/editor/component-editor/InlineEditActionsEditor.svelte +13 -1
  42. package/src/editor/component-editor/InputEditor.svelte +23 -0
  43. package/src/editor/component-editor/MenuSelectEditor.svelte +27 -1
  44. package/src/editor/component-editor/NotificationEditor.svelte +15 -0
  45. package/src/editor/component-editor/PanelEditor.svelte +1 -1
  46. package/src/editor/component-editor/ProgressBarEditor.svelte +13 -0
  47. package/src/editor/component-editor/RadioButtonEditor.svelte +20 -1
  48. package/src/editor/component-editor/SectionDividerEditor.svelte +41 -13
  49. package/src/editor/component-editor/SegmentedControlEditor.svelte +29 -1
  50. package/src/editor/component-editor/SideNavigationEditor.svelte +40 -1
  51. package/src/editor/component-editor/SlidePagerEditor.svelte +20 -0
  52. package/src/editor/component-editor/SliderEditor.svelte +33 -0
  53. package/src/editor/component-editor/TabBarEditor.svelte +23 -2
  54. package/src/editor/component-editor/TableEditor.svelte +14 -0
  55. package/src/editor/component-editor/ToggleEditor.svelte +17 -0
  56. package/src/editor/component-editor/TooltipEditor.svelte +11 -2
  57. package/src/editor/component-editor/VideoFrameEditor.svelte +8 -0
  58. package/src/editor/component-editor/VideoLightboxEditor.svelte +10 -0
  59. package/src/editor/component-editor/registration.ts +2 -1
  60. package/src/editor/component-editor/registry.ts +69 -27
  61. package/src/editor/component-editor/scaffolding/DemoHeader.svelte +2 -0
  62. package/src/editor/component-editor/scaffolding/StateBlock.svelte +19 -8
  63. package/src/editor/component-editor/scaffolding/TokenLayout.svelte +3 -0
  64. package/src/editor/component-editor/scaffolding/VariantGroup.svelte +70 -10
  65. package/src/editor/component-editor/scaffolding/editorContext.ts +7 -0
  66. package/src/editor/core/a11y/a11yReport.ts +101 -0
  67. package/src/editor/core/a11y/a11yReportTypes.ts +69 -0
  68. package/src/editor/core/a11y/contrastFailures.ts +22 -0
  69. package/src/editor/core/components/contrastPairRegistry.ts +18 -0
  70. package/src/editor/core/palettes/contrast.ts +44 -0
  71. package/src/editor/core/palettes/contrastPairs.ts +79 -0
  72. package/src/editor/core/palettes/resolveColor.ts +77 -0
  73. package/src/editor/core/store/editorPersistence.ts +9 -1
  74. package/src/editor/core/store/editorRenderer.ts +2 -0
  75. package/src/editor/core/store/editorStore.ts +29 -0
  76. package/src/editor/core/store/editorTypes.ts +9 -0
  77. package/src/editor/core/store/editorViewStore.ts +2 -2
  78. package/src/editor/core/store/unsavedEdits.ts +10 -0
  79. package/src/editor/core/themes/buildColors.ts +16 -5
  80. package/src/editor/core/themes/liveStateStream.ts +7 -1
  81. package/src/editor/core/themes/parsers/gradient.ts +5 -2
  82. package/src/editor/core/themes/slices/customColors.ts +226 -0
  83. package/src/editor/core/themes/themeTypes.ts +10 -0
  84. package/src/editor/docs/chapters.ts +1 -0
  85. package/src/editor/docs/content/accessibility.md +362 -0
  86. package/src/editor/docs/content/editing-tokens.md +56 -1
  87. package/src/editor/docs/content.generated.ts +2 -1
  88. package/src/editor/pages/ComponentEditorPage.svelte +10 -1
  89. package/src/editor/pages/EditorShell.svelte +97 -10
  90. package/src/editor/skill-atlas/skillSources.generated.ts +3 -3
  91. package/src/editor/skill-atlas/trees/check-compliance.ts +3 -3
  92. package/src/editor/skill-atlas/trees/create-component.ts +12 -12
  93. package/src/editor/ui/CustomColorReplaceStep.svelte +118 -0
  94. package/src/editor/ui/EditorViewSwitcher.svelte +15 -2
  95. package/src/editor/ui/GradientEditor.svelte +9 -1
  96. package/src/editor/ui/ThemePanel.svelte +4 -4
  97. package/src/editor/ui/UIContrastReadout.svelte +186 -0
  98. package/src/editor/ui/UIInfoPopover.svelte +16 -2
  99. package/src/editor/ui/UIPaletteSelector.svelte +347 -15
  100. package/src/editor/ui/UITokenSelector.svelte +33 -14
  101. package/src/editor/ui/VariablesTab.svelte +3 -0
  102. package/src/editor/ui/a11y/A11yComponentIssues.svelte +103 -0
  103. package/src/editor/ui/a11y/A11yFindingRow.svelte +57 -0
  104. package/src/editor/ui/a11y/A11yIssueRow.svelte +121 -0
  105. package/src/editor/ui/a11y/A11yOverview.svelte +242 -0
  106. package/src/editor/ui/a11y/A11yPanel.svelte +128 -0
  107. package/src/editor/ui/a11y/A11yPropertyMark.svelte +84 -0
  108. package/src/editor/ui/a11y/A11yRailMark.svelte +34 -0
  109. package/src/editor/ui/a11y/AccessibilityTab.svelte +334 -0
  110. package/src/editor/ui/a11y/a11yView.ts +218 -0
  111. package/src/editor/ui/anchorToTrigger.ts +63 -0
  112. package/src/editor/ui/contrastReadout.ts +45 -0
  113. package/src/editor/ui/sections/CustomColorsSection.svelte +254 -0
  114. package/src/live-tokens/data/themes/autumn.json +20 -20
  115. package/src/live-tokens/data/themes/halloween.json +20 -20
  116. package/src/live-tokens/data/themes/midnight-study.json +20 -20
  117. package/src/live-tokens/data/themes/ocean.json +20 -20
  118. package/src/live-tokens/data/themes/royal-velvet.json +20 -20
  119. package/src/live-tokens/data/themes/sketchy.json +20 -20
  120. package/src/live-tokens/data/themes/spring-meadow.json +20 -20
  121. package/src/live-tokens/data/themes/sunset.json +20 -20
  122. package/src/system/components/Badge.svelte +3 -3
  123. package/src/system/components/Button.svelte +9 -3
  124. package/src/system/components/CodeSnippet.svelte +8 -1
  125. package/src/system/components/CornerBadge.svelte +3 -3
  126. package/src/system/components/Dialog.svelte +43 -14
  127. package/src/system/components/IconButton.svelte +1 -1
  128. package/src/system/components/Image.svelte +7 -0
  129. package/src/system/components/ImageLightbox.svelte +26 -26
  130. package/src/system/components/Input.svelte +8 -1
  131. package/src/system/components/MenuSelect.svelte +30 -2
  132. package/src/system/components/Notification.svelte +1 -1
  133. package/src/system/components/ProgressBar.svelte +6 -0
  134. package/src/system/components/RadioButton.svelte +36 -3
  135. package/src/system/components/SegmentedControl.svelte +36 -2
  136. package/src/system/components/SlidePager.svelte +2 -2
  137. package/src/system/components/Slider.svelte +13 -9
  138. package/src/system/components/TabBar.svelte +33 -3
  139. package/src/system/components/Toggle.svelte +2 -2
  140. package/src/system/components/VideoFrame.svelte +1 -1
  141. package/src/system/components/VideoLightbox.svelte +2 -2
  142. package/src/system/internal/focusTrap.ts +35 -0
  143. package/src/testing-js/__aria__/badge.yml +40 -0
  144. package/src/testing-js/__aria__/button.yml +88 -0
  145. package/src/testing-js/__aria__/callout.yml +12 -0
  146. package/src/testing-js/__aria__/card.yml +8 -0
  147. package/src/testing-js/__aria__/codesnippet.yml +21 -0
  148. package/src/testing-js/__aria__/collapsiblesection.yml +23 -0
  149. package/src/testing-js/__aria__/cornerbadge.yml +24 -0
  150. package/src/testing-js/__aria__/dialog.yml +42 -0
  151. package/src/testing-js/__aria__/iconbutton.yml +57 -0
  152. package/src/testing-js/__aria__/image.yml +10 -0
  153. package/src/testing-js/__aria__/imagelightbox.yml +50 -0
  154. package/src/testing-js/__aria__/inlineeditactions.yml +16 -0
  155. package/src/testing-js/__aria__/input.yml +61 -0
  156. package/src/testing-js/__aria__/menuselect.yml +30 -0
  157. package/src/testing-js/__aria__/notification.yml +30 -0
  158. package/src/testing-js/__aria__/panel.yml +2 -0
  159. package/src/testing-js/__aria__/progressbar.yml +2 -0
  160. package/src/testing-js/__aria__/radiobutton.yml +20 -0
  161. package/src/testing-js/__aria__/sectiondivider.yml +9 -0
  162. package/src/testing-js/__aria__/segmentedcontrol.yml +35 -0
  163. package/src/testing-js/__aria__/sidenavigation.yml +304 -0
  164. package/src/testing-js/__aria__/slidepager.yml +72 -0
  165. package/src/testing-js/__aria__/slider.yml +28 -0
  166. package/src/testing-js/__aria__/tabbar.yml +35 -0
  167. package/src/testing-js/__aria__/table.yml +144 -0
  168. package/src/testing-js/__aria__/toggle.yml +12 -0
  169. package/src/testing-js/__aria__/tooltip.yml +2 -0
  170. package/src/testing-js/__aria__/videoframe.yml +6 -0
  171. package/src/testing-js/__aria__/videolightbox.yml +12 -0
  172. package/src/testing-js/{chunk-WIZ6W7UT.js → chunk-3WCLMOM7.js} +2 -2
  173. package/src/testing-js/{chunk-SHBYZUPD.js → chunk-5HNZHIHG.js} +211 -14
  174. package/src/testing-js/chunk-5HNZHIHG.js.map +1 -0
  175. package/src/testing-js/{chunk-NB3NZRBM.js → chunk-7CM5D7PF.js} +5 -1
  176. package/src/testing-js/chunk-7CM5D7PF.js.map +1 -0
  177. package/src/testing-js/chunk-EWSGE27V.js +168 -0
  178. package/src/testing-js/chunk-EWSGE27V.js.map +1 -0
  179. package/src/testing-js/{chunk-GKO27NGN.js → chunk-R54I7YL6.js} +2 -2
  180. package/src/testing-js/{chunk-X6KHEVIG.js → chunk-RWH46IU5.js} +97 -29
  181. package/src/testing-js/chunk-RWH46IU5.js.map +1 -0
  182. package/src/testing-js/chunk-SHLPDNAQ.js +658 -0
  183. package/src/testing-js/chunk-SHLPDNAQ.js.map +1 -0
  184. package/src/testing-js/{chunk-3UKGXCDL.js → chunk-YVVR3GJZ.js} +1 -1
  185. package/src/testing-js/chunk-YVVR3GJZ.js.map +1 -0
  186. package/src/testing-js/component-a11y.contract.js +283 -0
  187. package/src/testing-js/component-a11y.contract.js.map +1 -0
  188. package/src/testing-js/component-alias.contract.js +2 -2
  189. package/src/testing-js/component-behavior.contract.js +2 -2
  190. package/src/testing-js/component-editor.contract.js +6 -5
  191. package/src/testing-js/component-editor.contract.js.map +1 -1
  192. package/src/testing-js/component-render.contract.js +10 -6
  193. package/src/testing-js/component-render.contract.js.map +1 -1
  194. package/src/testing-js/index.d.ts +44 -16
  195. package/src/testing-js/index.js +9 -9
  196. package/src/testing-js/page-compliance.contract.js +163 -18
  197. package/src/testing-js/page-compliance.contract.js.map +1 -1
  198. package/src/testing-js/vitest.js +3 -3
  199. package/template/package.json +9 -0
  200. package/src/editor/ui/keepInViewport.ts +0 -84
  201. package/src/testing-js/chunk-3UKGXCDL.js.map +0 -1
  202. package/src/testing-js/chunk-NB3NZRBM.js.map +0 -1
  203. package/src/testing-js/chunk-SHBYZUPD.js.map +0 -1
  204. package/src/testing-js/chunk-X6KHEVIG.js.map +0 -1
  205. /package/src/testing-js/{chunk-WIZ6W7UT.js.map → chunk-3WCLMOM7.js.map} +0 -0
  206. /package/src/testing-js/{chunk-GKO27NGN.js.map → chunk-R54I7YL6.js.map} +0 -0
@@ -211,6 +211,18 @@ var buttonContract = {
211
211
  action: { kind: "click", part: "root" },
212
212
  expect: { kind: "focused", part: "root", value: true }
213
213
  },
214
+ {
215
+ name: "Enter activates a button",
216
+ rule: "a11y-keyboard",
217
+ action: { kind: "press", part: "root", key: "Enter" },
218
+ expect: { kind: "activated", part: "root" }
219
+ },
220
+ {
221
+ name: "Space activates a button",
222
+ rule: "a11y-keyboard",
223
+ action: { kind: "press", part: "root", key: "Space" },
224
+ expect: { kind: "activated", part: "root" }
225
+ },
214
226
  {
215
227
  name: "a disabled button refuses focus",
216
228
  state: "disabled",
@@ -628,15 +640,27 @@ var collapsibleSectionContract = {
628
640
  interaction: {
629
641
  part: "toggleButton",
630
642
  role: "button",
631
- // No activation case: CollapsibleSectionEditor's preview drives `open`
632
- // off the active state tab and never wires `ontoggle` back to it, so
633
- // clicking the real button here can't move `aria-expanded` (same
643
+ // Activation reads as a click on the button: CollapsibleSectionEditor's
644
+ // preview drives `open` off the active state tab and never wires
645
+ // `ontoggle` back to it, so `aria-expanded` never moves here (same
634
646
  // constraint documented on ToggleEditor in toggle.ts).
635
647
  cases: [
636
648
  {
637
649
  name: "clicking the toggle button focuses it",
638
650
  action: { kind: "click", part: "toggleButton" },
639
651
  expect: { kind: "focused", part: "toggleButton", value: true }
652
+ },
653
+ {
654
+ name: "Enter activates the toggle button",
655
+ rule: "a11y-keyboard",
656
+ action: { kind: "press", part: "toggleButton", key: "Enter" },
657
+ expect: { kind: "activated", part: "toggleButton" }
658
+ },
659
+ {
660
+ name: "Space activates the toggle button",
661
+ rule: "a11y-keyboard",
662
+ action: { kind: "press", part: "toggleButton", key: "Space" },
663
+ expect: { kind: "activated", part: "toggleButton" }
640
664
  }
641
665
  ]
642
666
  },
@@ -877,6 +901,12 @@ var dialogContract = {
877
901
  name: "clicking the close icon focuses it",
878
902
  action: { kind: "click", part: "closeButton" },
879
903
  expect: { kind: "focused", part: "closeButton", value: true }
904
+ },
905
+ {
906
+ name: "Enter activates the close icon",
907
+ rule: "a11y-keyboard",
908
+ action: { kind: "press", part: "closeButton", key: "Enter" },
909
+ expect: { kind: "activated", part: "closeButton" }
880
910
  }
881
911
  ]
882
912
  },
@@ -888,6 +918,12 @@ var dialogContract = {
888
918
  action: { kind: "click", part: "closeButton" },
889
919
  expect: { kind: "callback", prop: "onclose", args: [] }
890
920
  },
921
+ {
922
+ name: "Escape asks to close",
923
+ props: { open: true, inline: true, title: "Confirm" },
924
+ action: { kind: "keydown", part: "closeButton", key: "Escape" },
925
+ expect: { kind: "callback", prop: "onclose", args: [] }
926
+ },
891
927
  {
892
928
  name: "title drives the heading",
893
929
  props: { open: true, inline: true, title: "Confirm" },
@@ -996,6 +1032,18 @@ var iconButtonContract = {
996
1032
  name: "clicking an icon button focuses it",
997
1033
  action: { kind: "click", part: "root" },
998
1034
  expect: { kind: "focused", part: "root", value: true }
1035
+ },
1036
+ {
1037
+ name: "Enter activates an icon button",
1038
+ rule: "a11y-keyboard",
1039
+ action: { kind: "press", part: "root", key: "Enter" },
1040
+ expect: { kind: "activated", part: "root" }
1041
+ },
1042
+ {
1043
+ name: "Space activates an icon button",
1044
+ rule: "a11y-keyboard",
1045
+ action: { kind: "press", part: "root", key: "Space" },
1046
+ expect: { kind: "activated", part: "root" }
999
1047
  }
1000
1048
  ]
1001
1049
  },
@@ -1207,6 +1255,22 @@ var imageLightboxContract = {
1207
1255
  name: "clicking the next chevron focuses it",
1208
1256
  action: { kind: "click", part: "nextButton" },
1209
1257
  expect: { kind: "focused", part: "nextButton", value: true }
1258
+ },
1259
+ // `setup: []` replaces the view's thumb click, which would land on the
1260
+ // open overlay and close the lightbox before the key does.
1261
+ {
1262
+ name: "Escape closes the lightbox",
1263
+ rule: "a11y-keyboard",
1264
+ setup: [],
1265
+ action: { kind: "press", part: "closeButton", key: "Escape" },
1266
+ expect: { kind: "attribute", part: "thumb", name: "aria-expanded", value: "false" }
1267
+ },
1268
+ {
1269
+ name: "Enter on the tile opens the lightbox",
1270
+ rule: "a11y-keyboard",
1271
+ setup: [],
1272
+ action: { kind: "press", part: "thumb", key: "Enter" },
1273
+ expect: { kind: "attribute", part: "thumb", name: "aria-expanded", value: "true" }
1210
1274
  }
1211
1275
  ]
1212
1276
  },
@@ -1485,6 +1549,7 @@ var inputContract = {
1485
1549
  },
1486
1550
  observe: { part: "field", css: "borderTopWidth", variable: "--input-border-width" }
1487
1551
  },
1552
+ boundaries: [{ part: "field", label: "Field" }],
1488
1553
  interaction: {
1489
1554
  part: "field",
1490
1555
  role: "textbox",
@@ -1499,6 +1564,12 @@ var inputContract = {
1499
1564
  action: { kind: "click", part: "toggleButton" },
1500
1565
  expect: { kind: "attribute", part: "toggleButton", name: "aria-pressed", value: "true" }
1501
1566
  },
1567
+ {
1568
+ name: "Space activates the reveal toggle",
1569
+ rule: "a11y-keyboard",
1570
+ action: { kind: "press", part: "toggleButton", key: "Space" },
1571
+ expect: { kind: "activated", part: "toggleButton" }
1572
+ },
1502
1573
  {
1503
1574
  name: "a disabled field refuses focus",
1504
1575
  state: "disabled",
@@ -1551,6 +1622,7 @@ var menuSelectContract = {
1551
1622
  parts: {
1552
1623
  root: ".menuselect",
1553
1624
  item: ".menuselect-item",
1625
+ secondItem: ".menuselect > li:nth-of-type(2) > .menuselect-item",
1554
1626
  icon: ".menuselect-item .menuselect-icon",
1555
1627
  label: ".menuselect-item .menuselect-label",
1556
1628
  selectedItem: ".menuselect-item.selected",
@@ -1649,6 +1721,18 @@ var menuSelectContract = {
1649
1721
  name: "clicking an item selects it",
1650
1722
  action: { kind: "click", part: "item" },
1651
1723
  expect: { kind: "attribute", part: "item", name: "aria-selected", value: "true" }
1724
+ },
1725
+ {
1726
+ name: "Enter selects an item",
1727
+ rule: "a11y-keyboard",
1728
+ action: { kind: "press", part: "item", key: "Enter" },
1729
+ expect: { kind: "activated", part: "item" }
1730
+ },
1731
+ {
1732
+ name: "arrow down moves focus to the next item",
1733
+ rule: "a11y-keyboard",
1734
+ action: { kind: "press", part: "item", key: "ArrowDown" },
1735
+ expect: { kind: "focused", part: "secondItem", value: true }
1652
1736
  }
1653
1737
  ]
1654
1738
  },
@@ -1971,7 +2055,8 @@ var radioButtonContract = {
1971
2055
  root: ".radio-button",
1972
2056
  dot: ".radio-dot",
1973
2057
  dotFill: { selector: ".radio-dot-fill" },
1974
- label: ".radio-label"
2058
+ label: ".radio-label",
2059
+ secondOption: ".radio-button:nth-of-type(2)"
1975
2060
  },
1976
2061
  properties: [
1977
2062
  { paints: statePaints4("default", true) },
@@ -2014,14 +2099,27 @@ var radioButtonContract = {
2014
2099
  },
2015
2100
  observe: { part: "dot", css: "borderTopWidth", variable: "--radiobutton-default-dot-border-width" }
2016
2101
  },
2102
+ boundaries: [{ part: "dot", label: "Circle" }],
2017
2103
  interaction: {
2018
2104
  part: "root",
2019
- role: "button",
2105
+ role: "radio",
2020
2106
  cases: [
2021
2107
  {
2022
2108
  name: "clicking a radio option focuses it",
2023
2109
  action: { kind: "click", part: "root" },
2024
2110
  expect: { kind: "focused", part: "root", value: true }
2111
+ },
2112
+ {
2113
+ name: "Space selects a radio option",
2114
+ rule: "a11y-keyboard",
2115
+ action: { kind: "press", part: "root", key: "Space" },
2116
+ expect: { kind: "activated", part: "root" }
2117
+ },
2118
+ {
2119
+ name: "arrow down moves focus to the next radio option",
2120
+ rule: "a11y-keyboard",
2121
+ action: { kind: "press", part: "root", key: "ArrowDown" },
2122
+ expect: { kind: "focused", part: "secondOption", value: true }
2025
2123
  }
2026
2124
  ]
2027
2125
  },
@@ -2186,6 +2284,7 @@ var segmentedControlContract = {
2186
2284
  root: ".segmented-control",
2187
2285
  segment: ".segment",
2188
2286
  icon: ".segment i",
2287
+ secondSegment: ".segment:nth-of-type(2)",
2189
2288
  selectedSegment: ".segment.selected",
2190
2289
  selectedIcon: ".segment.selected i",
2191
2290
  hairline: ".segment-hairline"
@@ -2339,6 +2438,10 @@ var segmentedControlContract = {
2339
2438
  },
2340
2439
  observe: { part: "root", css: "borderTopWidth", variable: "--segmentedcontrol-bar-border-width" }
2341
2440
  },
2441
+ boundaries: [
2442
+ { part: "root", label: "Bar" },
2443
+ { part: "selectedSegment", label: "Selected option" }
2444
+ ],
2342
2445
  interaction: {
2343
2446
  part: "segment",
2344
2447
  role: "radio",
@@ -2348,6 +2451,18 @@ var segmentedControlContract = {
2348
2451
  action: { kind: "click", part: "segment" },
2349
2452
  expect: { kind: "attribute", part: "segment", name: "aria-checked", value: "true" }
2350
2453
  },
2454
+ {
2455
+ name: "Space checks a segment",
2456
+ rule: "a11y-keyboard",
2457
+ action: { kind: "press", part: "segment", key: "Space" },
2458
+ expect: { kind: "activated", part: "segment" }
2459
+ },
2460
+ {
2461
+ name: "arrow right moves focus to the next segment",
2462
+ rule: "a11y-keyboard",
2463
+ action: { kind: "press", part: "segment", key: "ArrowRight" },
2464
+ expect: { kind: "focused", part: "secondSegment", value: true }
2465
+ },
2351
2466
  {
2352
2467
  name: "a disabled control refuses focus",
2353
2468
  state: "disabled option",
@@ -2583,6 +2698,12 @@ var sideNavigationContract = {
2583
2698
  },
2584
2699
  observe: { part: "root", css: "borderRightWidth", variable: "--sidenavigation-panel-border-width" }
2585
2700
  },
2701
+ boundaries: [
2702
+ { part: "title", label: "Selected title", when: ".selected" },
2703
+ { part: "sectionSelected", label: "Selected section" },
2704
+ { part: "itemSelected", label: "Selected item" },
2705
+ { part: "footer", label: "Selected footer", when: ".selected, .force-footer-selected .sn-footer" }
2706
+ ],
2586
2707
  interaction: {
2587
2708
  part: "toggle",
2588
2709
  role: "button",
@@ -2591,6 +2712,12 @@ var sideNavigationContract = {
2591
2712
  name: "clicking the toggle collapses the rail",
2592
2713
  action: { kind: "click", part: "toggle" },
2593
2714
  expect: { kind: "attribute", part: "toggle", name: "aria-expanded", value: "false" }
2715
+ },
2716
+ {
2717
+ name: "Enter activates the toggle",
2718
+ rule: "a11y-keyboard",
2719
+ action: { kind: "press", part: "toggle", key: "Enter" },
2720
+ expect: { kind: "activated", part: "toggle" }
2594
2721
  }
2595
2722
  ]
2596
2723
  },
@@ -2752,6 +2879,10 @@ var sliderContract = {
2752
2879
  },
2753
2880
  observe: { part: "track", css: "backgroundColor", variable: "--slider-single-track-surface" }
2754
2881
  },
2882
+ boundaries: [
2883
+ { part: "track", label: "Track" },
2884
+ { part: "thumb", label: "Thumb" }
2885
+ ],
2755
2886
  interaction: {
2756
2887
  part: "input",
2757
2888
  role: "slider",
@@ -2781,6 +2912,18 @@ var sliderContract = {
2781
2912
  action: { kind: "dragTo", part: "thumb", along: "track", fraction: 0.5 },
2782
2913
  expect: { kind: "focused", part: "input", value: true }
2783
2914
  },
2915
+ {
2916
+ name: "Page Up raises the value",
2917
+ rule: "a11y-keyboard",
2918
+ action: { kind: "press", part: "input", key: "PageUp" },
2919
+ expect: { kind: "valueMoves", part: "input", direction: "up" }
2920
+ },
2921
+ {
2922
+ name: "End takes the value to the ceiling",
2923
+ rule: "a11y-keyboard",
2924
+ action: { kind: "press", part: "input", key: "End" },
2925
+ expect: { kind: "valueBecomes", part: "input", value: "100" }
2926
+ },
2784
2927
  {
2785
2928
  name: "a disabled slider ignores the arrow keys",
2786
2929
  state: "disabled",
@@ -2873,7 +3016,8 @@ var tabBarContract = {
2873
3016
  // Position-stable: clicking `tab` (".tab:not(.selected)") makes that very
2874
3017
  // tab selected, which would invalidate that selector out from under a
2875
3018
  // focus check re-resolved after the click.
2876
- secondTab: ".tab:nth-of-type(2)"
3019
+ secondTab: ".tab:nth-of-type(2)",
3020
+ firstTab: ".tab:nth-of-type(1)"
2877
3021
  },
2878
3022
  properties: [
2879
3023
  {
@@ -2939,15 +3083,28 @@ var tabBarContract = {
2939
3083
  },
2940
3084
  observe: { part: "tab", css: "borderTopWidth", variable: "--tabbar-default-tab-border-width" }
2941
3085
  },
3086
+ boundaries: [{ part: "tabSelected", label: "Selected tab" }],
2942
3087
  interaction: {
2943
3088
  part: "secondTab",
2944
- role: "button",
3089
+ role: "tab",
2945
3090
  cases: [
2946
3091
  {
2947
3092
  name: "clicking a tab focuses it",
2948
3093
  action: { kind: "click", part: "secondTab" },
2949
3094
  expect: { kind: "focused", part: "secondTab", value: true }
2950
3095
  },
3096
+ {
3097
+ name: "Enter activates a tab",
3098
+ rule: "a11y-keyboard",
3099
+ action: { kind: "press", part: "secondTab", key: "Enter" },
3100
+ expect: { kind: "activated", part: "secondTab" }
3101
+ },
3102
+ {
3103
+ name: "arrow right moves focus to the next tab",
3104
+ rule: "a11y-keyboard",
3105
+ action: { kind: "press", part: "firstTab", key: "ArrowRight" },
3106
+ expect: { kind: "focused", part: "secondTab", value: true }
3107
+ },
2951
3108
  {
2952
3109
  name: "a disabled tab refuses focus",
2953
3110
  state: "disabled tab",
@@ -2975,6 +3132,11 @@ var tabBarContract = {
2975
3132
  props: { tabs: [behaviorTabs[0], { ...behaviorTabs[1], disabled: true }], value: "one" },
2976
3133
  action: { kind: "click", part: "secondTab" },
2977
3134
  expect: { kind: "no-callback", prop: "onchange" }
3135
+ },
3136
+ {
3137
+ name: "an icon-only tab takes its label as its name",
3138
+ props: { tabs: behaviorTabs, value: "one", iconOnly: true },
3139
+ expect: { kind: "attribute", part: "secondTab", name: "aria-label", value: "Two" }
2978
3140
  }
2979
3141
  ]
2980
3142
  },
@@ -3176,21 +3338,30 @@ var toggleContract = {
3176
3338
  },
3177
3339
  observe: { part: "track", css: "borderTopWidth", variable: "--toggle-track-border-width" }
3178
3340
  },
3341
+ boundaries: [
3342
+ { part: "track", label: "Track" },
3343
+ { part: "thumb", label: "Thumb" }
3344
+ ],
3179
3345
  interaction: {
3180
3346
  part: "root",
3181
3347
  role: "switch",
3182
- // No activation case: Toggle.svelte is controlled (`onclick` only calls
3183
- // `onchange?.(!checked)`, it never flips `checked` itself), and
3184
- // ToggleEditor.svelte's preview drives `checked` off the state tab
3185
- // without wiring `onchange` back to it. Clicking the real control in this
3186
- // demo has no observable effect on `aria-checked`, so an activation case
3187
- // would assert a no-op rather than the switch's behavior.
3348
+ // Activation reads as a click on the switch: Toggle.svelte is controlled
3349
+ // (`onclick` only calls `onchange?.(!checked)`, it never flips `checked`
3350
+ // itself), and ToggleEditor.svelte's preview drives `checked` off the
3351
+ // state tab without wiring `onchange` back to it, so `aria-checked` never
3352
+ // moves in this demo.
3188
3353
  cases: [
3189
3354
  {
3190
3355
  name: "clicking a toggle focuses it",
3191
3356
  action: { kind: "click", part: "root" },
3192
3357
  expect: { kind: "focused", part: "root", value: true }
3193
3358
  },
3359
+ {
3360
+ name: "Space activates a toggle",
3361
+ rule: "a11y-keyboard",
3362
+ action: { kind: "press", part: "root", key: "Space" },
3363
+ expect: { kind: "activated", part: "root" }
3364
+ },
3194
3365
  {
3195
3366
  name: "a disabled toggle refuses focus",
3196
3367
  state: "disabled",
@@ -3418,6 +3589,19 @@ var videoLightboxContract = {
3418
3589
  name: "clicking the still opens the lightbox",
3419
3590
  action: { kind: "click", part: "trigger" },
3420
3591
  expect: { kind: "attribute", part: "trigger", name: "aria-expanded", value: "true" }
3592
+ },
3593
+ // The click case above leaves the lightbox open with focus inside it.
3594
+ {
3595
+ name: "Escape closes the lightbox",
3596
+ rule: "a11y-keyboard",
3597
+ action: { kind: "press", key: "Escape" },
3598
+ expect: { kind: "attribute", part: "trigger", name: "aria-expanded", value: "false" }
3599
+ },
3600
+ {
3601
+ name: "Enter on the still opens the lightbox",
3602
+ rule: "a11y-keyboard",
3603
+ action: { kind: "press", part: "trigger", key: "Enter" },
3604
+ expect: { kind: "attribute", part: "trigger", name: "aria-expanded", value: "true" }
3421
3605
  }
3422
3606
  ]
3423
3607
  },
@@ -3644,6 +3828,19 @@ var slidePagerContract = {
3644
3828
  name: "the next chevron moves the frame to the next slide",
3645
3829
  action: { kind: "click", part: "nextControl" },
3646
3830
  expect: { kind: "attribute", part: "stage", name: "aria-label", value: "Open slide 3 full screen" }
3831
+ },
3832
+ {
3833
+ name: "Escape closes the full-screen slide",
3834
+ rule: "a11y-keyboard",
3835
+ setup: [{ kind: "click", part: "stage" }],
3836
+ action: { kind: "press", key: "Escape" },
3837
+ expect: { kind: "attribute", part: "stage", name: "aria-expanded", value: "false" }
3838
+ },
3839
+ {
3840
+ name: "Enter on the frame opens the full-screen slide",
3841
+ rule: "a11y-keyboard",
3842
+ action: { kind: "press", part: "stage", key: "Enter" },
3843
+ expect: { kind: "attribute", part: "stage", name: "aria-expanded", value: "true" }
3647
3844
  }
3648
3845
  ]
3649
3846
  },
@@ -3735,4 +3932,4 @@ export {
3735
3932
  allContracts,
3736
3933
  selectedContracts
3737
3934
  };
3738
- //# sourceMappingURL=chunk-SHBYZUPD.js.map
3935
+ //# sourceMappingURL=chunk-5HNZHIHG.js.map