@ankhorage/zora 28.11.2 → 28.12.1

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 (232) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +9 -1
  4. package/dist/capabilities/index.js.map +3 -3
  5. package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -1
  6. package/dist/features/button/adapters/inbound/Button.js +4 -2
  7. package/dist/features/button/adapters/inbound/Button.js.map +1 -1
  8. package/dist/features/data-table/adapters/inbound/DataTable.d.ts.map +1 -1
  9. package/dist/features/data-table/adapters/inbound/DataTable.js +32 -20
  10. package/dist/features/data-table/adapters/inbound/DataTable.js.map +1 -1
  11. package/dist/features/data-table/dataTableMeta.d.ts +14 -0
  12. package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
  13. package/dist/features/data-table/dataTableMeta.js +8 -0
  14. package/dist/features/data-table/dataTableMeta.js.map +1 -1
  15. package/dist/features/layout/adapters/inbound/Screen.d.ts.map +1 -1
  16. package/dist/features/layout/adapters/inbound/Screen.js +2 -2
  17. package/dist/features/layout/adapters/inbound/Screen.js.map +1 -1
  18. package/dist/features/master-detail/adapters/inbound/MasterDetail.js +14 -11
  19. package/dist/features/master-detail/adapters/inbound/MasterDetail.js.map +1 -1
  20. package/dist/features/registry/bindableComponentMeta.d.ts +14 -0
  21. package/dist/features/registry/bindableComponentMeta.d.ts.map +1 -1
  22. package/dist/features/registry/bindableComponentMeta.js +8 -0
  23. package/dist/features/registry/bindableComponentMeta.js.map +1 -1
  24. package/dist/features/selection/adapters/inbound/RuntimeAuthoringOverlay.d.ts.map +1 -1
  25. package/dist/features/selection/adapters/inbound/RuntimeAuthoringOverlay.js +8 -19
  26. package/dist/features/selection/adapters/inbound/RuntimeAuthoringOverlay.js.map +1 -1
  27. package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -1
  28. package/dist/features/typography/adapters/inbound/Heading.js +4 -2
  29. package/dist/features/typography/adapters/inbound/Heading.js.map +1 -1
  30. package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -1
  31. package/dist/features/typography/adapters/inbound/Text.js +4 -2
  32. package/dist/features/typography/adapters/inbound/Text.js.map +1 -1
  33. package/dist/types/data-table.d.ts +2 -0
  34. package/dist/types/data-table.d.ts.map +1 -1
  35. package/dist/types/data-table.js.map +1 -1
  36. package/dist/types/heading.d.ts +3 -0
  37. package/dist/types/heading.d.ts.map +1 -1
  38. package/dist/types/heading.js.map +1 -1
  39. package/dist/types/layout.d.ts +2 -0
  40. package/dist/types/layout.d.ts.map +1 -1
  41. package/dist/types/layout.js.map +1 -1
  42. package/dist/types/master-detail.d.ts +3 -0
  43. package/dist/types/master-detail.d.ts.map +1 -1
  44. package/dist/types/master-detail.js.map +1 -1
  45. package/dist/types/text.d.ts +3 -0
  46. package/dist/types/text.d.ts.map +1 -1
  47. package/dist/types/text.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/features/button/adapters/inbound/Button.tsx +9 -1
  50. package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +54 -15
  51. package/src/features/data-table/adapters/inbound/DataTable.test.tsx +52 -5
  52. package/src/features/data-table/adapters/inbound/DataTable.tsx +79 -64
  53. package/src/features/data-table/dataTableMeta.ts +9 -0
  54. package/src/features/layout/adapters/inbound/Screen.tsx +2 -0
  55. package/src/features/list/adapters/inbound/virtualizedLists.test.tsx +1 -0
  56. package/src/features/master-detail/adapters/inbound/MasterDetail.runtime.test.tsx +29 -1
  57. package/src/features/master-detail/adapters/inbound/MasterDetail.tsx +62 -10
  58. package/src/features/matrix-grid/adapters/inbound/MatrixGrid.protected-focus.test.tsx +47 -12
  59. package/src/features/matrix-grid/adapters/inbound/MatrixGrid.test.tsx +58 -1
  60. package/src/features/registry/bindableComponentMeta.ts +9 -0
  61. package/src/features/selection/adapters/inbound/RuntimeAuthoringOverlay.test.tsx +24 -10
  62. package/src/features/selection/adapters/inbound/RuntimeAuthoringOverlay.tsx +10 -32
  63. package/src/features/typography/adapters/inbound/Heading.tsx +9 -1
  64. package/src/features/typography/adapters/inbound/Text.tsx +9 -1
  65. package/src/types/data-table.ts +2 -0
  66. package/src/types/heading.ts +3 -0
  67. package/src/types/layout.ts +2 -0
  68. package/src/types/master-detail.ts +3 -0
  69. package/src/types/text.ts +3 -0
  70. package/src/webPackageExports.test.ts +35 -5
  71. package/web-dist/authoring/index.d.ts +2 -2
  72. package/web-dist/authoring/index.js +5 -5
  73. package/web-dist/chunks/{Accordion-cah5j61y.js → Accordion-0khxr0bc.js} +1 -1
  74. package/web-dist/chunks/{Accordion-zagrbkq1.js → Accordion-0zg7bp65.js} +1 -1
  75. package/web-dist/chunks/{Accordion-h2rnzgyv.js → Accordion-13qdzpsw.js} +2 -2
  76. package/web-dist/chunks/{Accordion-gy3bx3xa.js → Accordion-1dv9qy83.js} +1 -1
  77. package/web-dist/chunks/{Accordion-7eysykr1.js → Accordion-215f8pzb.js} +6 -4
  78. package/web-dist/chunks/{Accordion-b1tqkxx6.js → Accordion-2khy77a4.js} +2 -2
  79. package/web-dist/chunks/{Accordion-5x4cv0kv.js → Accordion-31xdsdbt.js} +15 -2
  80. package/web-dist/chunks/{Accordion-qz6ddnmv.js → Accordion-451n4t9y.js} +2 -2
  81. package/web-dist/chunks/{Accordion-a8b6g53f.js → Accordion-4e5wzq5h.js} +5 -3
  82. package/web-dist/chunks/{Accordion-w4zh2nws.js → Accordion-5hs2x3mg.js} +8 -6
  83. package/web-dist/chunks/{Accordion-ajqj6ymg.js → Accordion-5ry809w9.js} +2 -2
  84. package/web-dist/chunks/Accordion-63x9gd07.js +21 -0
  85. package/web-dist/chunks/{Accordion-a0hbjxg9.js → Accordion-87rb2j42.js} +2 -2
  86. package/web-dist/chunks/{Accordion-nhf8zjt4.js → Accordion-8y0zdc9b.js} +1 -1
  87. package/web-dist/chunks/{Accordion-eysfka31.js → Accordion-9brxrdt0.js} +9 -7
  88. package/web-dist/chunks/{Accordion-et7xzm6k.js → Accordion-a3p5s8r5.js} +9 -7
  89. package/web-dist/chunks/{Accordion-vbh3xqv6.js → Accordion-b32cj447.js} +9 -4
  90. package/web-dist/chunks/{Accordion-afxbyvwp.js → Accordion-cx1wpv5h.js} +2 -2
  91. package/web-dist/chunks/{Accordion-p84h11ek.js → Accordion-e8e1qanc.js} +2 -2
  92. package/web-dist/chunks/{Accordion-ak6dvant.js → Accordion-fkdxf4za.js} +2 -2
  93. package/web-dist/chunks/{Accordion-mkd3k28h.js → Accordion-fx6h9j9b.js} +2 -2
  94. package/web-dist/chunks/{Accordion-dy1j2a7p.js → Accordion-hj2c784w.js} +4 -4
  95. package/web-dist/chunks/{Accordion-wkqemqjw.js → Accordion-j41dzcsm.js} +11 -10
  96. package/web-dist/chunks/{Accordion-e9jwetg7.js → Accordion-jf05jg7c.js} +2 -2
  97. package/web-dist/chunks/{Accordion-yannd7r3.js → Accordion-mb7bvv02.js} +2 -2
  98. package/web-dist/chunks/{Accordion-2b3sd76b.js → Accordion-n4pb4fxf.js} +1 -1
  99. package/web-dist/chunks/{Accordion-2kv6p7by.js → Accordion-ngp3wrcj.js} +22 -32
  100. package/web-dist/chunks/{Accordion-rv90tjqr.js → Accordion-r3s4hat8.js} +1 -1
  101. package/web-dist/chunks/{Accordion-x9sb23p3.js → Accordion-s6gkg1x4.js} +1 -1
  102. package/web-dist/chunks/{Accordion-95003ycq.js → Accordion-t3307xtr.js} +5 -5
  103. package/web-dist/chunks/{Accordion-th7yhwhf.js → Accordion-tchser6z.js} +6 -6
  104. package/web-dist/chunks/{Accordion-a49s4ywn.js → Accordion-tjdjcft9.js} +3 -3
  105. package/web-dist/chunks/{Accordion-ek0hh2nx.js → Accordion-v8296kpx.js} +5 -5
  106. package/web-dist/chunks/{Accordion-kxjjp03t.js → Accordion-xmstkrsz.js} +3 -3
  107. package/web-dist/chunks/{Accordion-zays65re.js → Accordion-y2vzyy2q.js} +4 -4
  108. package/web-dist/chunks/{Accordion-064hgrct.js → Accordion-znrwa5dy.js} +2 -2
  109. package/web-dist/chunks/{Accordion-dnfgtbq3.js → Accordion-zyjtbb0x.js} +8 -6
  110. package/web-dist/chunks/{RichTextClient-qd6gmm0x.js → RichTextClient-vvh5mm40.js} +12 -11
  111. package/web-dist/chunks/{Video.native-7zsbp5vg.js → Video.native-tth5fevy.js} +8 -7
  112. package/web-dist/components/accordion/Accordion.js +4 -3
  113. package/web-dist/components/accordion-item/AccordionItem.js +4 -3
  114. package/web-dist/components/app-bar/AppBar.js +7 -6
  115. package/web-dist/components/app-header/AppHeader.js +7 -6
  116. package/web-dist/components/app-shell/AppShell.js +2 -1
  117. package/web-dist/components/audio/Audio.js +8 -7
  118. package/web-dist/components/auth-screen/AuthScreen.js +8 -7
  119. package/web-dist/components/avatar/Avatar.js +4 -3
  120. package/web-dist/components/avatar-group/AvatarGroup.js +4 -3
  121. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +8 -7
  122. package/web-dist/components/bottom-sheet/BottomSheet.js +3 -2
  123. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +3 -2
  124. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +3 -2
  125. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +3 -2
  126. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +3 -2
  127. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +3 -2
  128. package/web-dist/components/breadcrumbs/Breadcrumbs.js +7 -6
  129. package/web-dist/components/button/Button.js +4 -3
  130. package/web-dist/components/button-group/ButtonGroup.js +4 -3
  131. package/web-dist/components/calendar/Calendar.js +6 -5
  132. package/web-dist/components/camera-permission-view/CameraPermissionView.js +8 -7
  133. package/web-dist/components/card/Card.js +7 -6
  134. package/web-dist/components/chat-list-item/ChatListItem.js +5 -4
  135. package/web-dist/components/checkbox/Checkbox.js +4 -3
  136. package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -3
  137. package/web-dist/components/chip/Chip.js +4 -3
  138. package/web-dist/components/chip-group/ChipGroup.js +4 -3
  139. package/web-dist/components/collection-editor/CollectionEditor.js +10 -9
  140. package/web-dist/components/color-hue-scale/ColorHueScale.js +12 -11
  141. package/web-dist/components/color-picker/ColorPicker.js +12 -11
  142. package/web-dist/components/color-tone/ColorTone.js +12 -11
  143. package/web-dist/components/color-wheel/ColorWheel.js +12 -11
  144. package/web-dist/components/content-rail/ContentRail.js +7 -6
  145. package/web-dist/components/data-table/DataTable.js +91 -74
  146. package/web-dist/components/data-table/DataTable.types-0.d.ts +2 -0
  147. package/web-dist/components/date-picker/DatePicker.js +9 -8
  148. package/web-dist/components/dialog/Dialog.js +4 -3
  149. package/web-dist/components/divider/Divider.js +2 -1
  150. package/web-dist/components/empty-state/EmptyState.js +9 -8
  151. package/web-dist/components/explorer/Explorer.js +5 -4
  152. package/web-dist/components/field/Field.js +4 -3
  153. package/web-dist/components/file-explorer/FileExplorer.js +5 -4
  154. package/web-dist/components/flat-list/FlatList.js +5 -4
  155. package/web-dist/components/flow-canvas/FlowCanvas.js +8 -7
  156. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +8 -7
  157. package/web-dist/components/form/Form.js +6 -5
  158. package/web-dist/components/form-actions/FormActions.js +6 -5
  159. package/web-dist/components/form-error/FormError.js +6 -5
  160. package/web-dist/components/game/Game.js +3 -2
  161. package/web-dist/components/game-entity/GameEntity.js +3 -2
  162. package/web-dist/components/game-field/GameField.js +3 -2
  163. package/web-dist/components/game-input-zone/GameInputZone.js +3 -2
  164. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +3 -2
  165. package/web-dist/components/game-overlay/GameOverlay.js +3 -2
  166. package/web-dist/components/gradient/Gradient.js +3 -2
  167. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +3 -2
  168. package/web-dist/components/graph-node/GraphNode.js +8 -7
  169. package/web-dist/components/grid/Grid.js +2 -1
  170. package/web-dist/components/heading/Heading.js +2 -1
  171. package/web-dist/components/heading/Heading.types-0.d.ts +4 -0
  172. package/web-dist/components/hero/Hero.js +12 -10
  173. package/web-dist/components/icon-button/IconButton.js +4 -3
  174. package/web-dist/components/image/Image.js +3 -2
  175. package/web-dist/components/link/Link.js +2 -1
  176. package/web-dist/components/list/List.js +5 -4
  177. package/web-dist/components/list-item/ListItem.js +5 -4
  178. package/web-dist/components/list-section/ListSection.js +5 -4
  179. package/web-dist/components/master-detail/MasterDetail.js +21 -3
  180. package/web-dist/components/master-detail/MasterDetail.types-0.d.ts +4 -0
  181. package/web-dist/components/matrix-grid/MatrixGrid.js +1 -2
  182. package/web-dist/components/media-card/MediaCard.js +7 -6
  183. package/web-dist/components/media-explorer/MediaExplorer.js +5 -4
  184. package/web-dist/components/message-bubble/MessageBubble.js +5 -4
  185. package/web-dist/components/metric-card/MetricCard.js +7 -6
  186. package/web-dist/components/missing-element/MissingElement.js +3 -2
  187. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +8 -7
  188. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +8 -7
  189. package/web-dist/components/otp-form/OtpForm.js +8 -7
  190. package/web-dist/components/pagination/Pagination.js +7 -6
  191. package/web-dist/components/palette-item/PaletteItem.js +7 -6
  192. package/web-dist/components/popover-menu/PopoverMenu.js +3 -2
  193. package/web-dist/components/post-card/PostCard.js +7 -6
  194. package/web-dist/components/product-card/ProductCard.js +7 -6
  195. package/web-dist/components/progress/Progress.js +4 -3
  196. package/web-dist/components/progress-ring/ProgressRing.js +4 -3
  197. package/web-dist/components/radio/Radio.js +4 -3
  198. package/web-dist/components/radio-group/RadioGroup.js +4 -3
  199. package/web-dist/components/rating/Rating.js +2 -1
  200. package/web-dist/components/reader/Reader.js +11 -10
  201. package/web-dist/components/rich-text/RichText.js +2 -2
  202. package/web-dist/components/runtime-authoring-overlay/RuntimeAuthoringOverlay.js +3 -6
  203. package/web-dist/components/scan-overlay/ScanOverlay.js +8 -7
  204. package/web-dist/components/screen/Screen.js +2 -1
  205. package/web-dist/components/screen/Screen.types-0.d.ts +4 -0
  206. package/web-dist/components/screen-section/ScreenSection.js +4 -3
  207. package/web-dist/components/scroll-view/ScrollView.js +2 -1
  208. package/web-dist/components/search-input/SearchInput.js +6 -5
  209. package/web-dist/components/section-header/SectionHeader.js +4 -3
  210. package/web-dist/components/section-list/SectionList.js +5 -4
  211. package/web-dist/components/select/Select.js +8 -7
  212. package/web-dist/components/selectable-item/SelectableItem.js +3 -6
  213. package/web-dist/components/selection-provider/SelectionProvider.js +3 -6
  214. package/web-dist/components/sign-in-form/SignInForm.js +8 -7
  215. package/web-dist/components/sign-up-form/SignUpForm.js +8 -7
  216. package/web-dist/components/skeleton/Skeleton.js +10 -9
  217. package/web-dist/components/skeleton-card/SkeletonCard.js +10 -9
  218. package/web-dist/components/skeleton-list/SkeletonList.js +10 -9
  219. package/web-dist/components/skeleton-text/SkeletonText.js +10 -9
  220. package/web-dist/components/text/Text.js +2 -1
  221. package/web-dist/components/text/Text.types-0.d.ts +4 -0
  222. package/web-dist/components/text-input/TextInput.js +5 -4
  223. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +4 -3
  224. package/web-dist/components/time-picker/TimePicker.js +8 -7
  225. package/web-dist/components/timeline/Timeline.js +4 -3
  226. package/web-dist/components/toolbar/Toolbar.js +8 -7
  227. package/web-dist/components/tree-item/TreeItem.js +10 -9
  228. package/web-dist/components/uploader/Uploader.js +13 -12
  229. package/web-dist/components/video/Video.js +5 -4
  230. package/web-dist/components/view/View.js +2 -1
  231. package/web-dist/components/zora-web-style-sheet/ZoraWebStyleSheet.js +2 -1
  232. package/web-dist/manifest.json +626 -525
@@ -28,14 +28,22 @@ await mock.module('@ankhorage/surface', () => ({
28
28
  flex,
29
29
  minHeight,
30
30
  minWidth,
31
+ selectionDecoration,
31
32
  testID,
32
33
  }: React.PropsWithChildren<{
33
34
  readonly flex?: number;
34
35
  readonly minHeight?: number;
35
36
  readonly minWidth?: number;
37
+ readonly selectionDecoration?: { readonly selected: boolean };
36
38
  readonly testID?: string;
37
39
  }>) => (
38
- <div data-flex={flex} data-min-height={minHeight} data-min-width={minWidth} data-view={testID}>
40
+ <div
41
+ data-flex={flex}
42
+ data-min-height={minHeight}
43
+ data-min-width={minWidth}
44
+ data-selection={selectionDecoration?.selected ? 'selected' : undefined}
45
+ data-view={testID}
46
+ >
39
47
  {children}
40
48
  </div>
41
49
  ),
@@ -158,3 +166,23 @@ test('keeps the compact detail pane bounded without scrolling', () => {
158
166
  expect(markup).toContain('data-view="workspace-detail"');
159
167
  expect(markup).not.toContain('data-scroll="workspace-detail"');
160
168
  });
169
+
170
+ test('attaches selection to Screen content and the bounded MasterDetail host without changing panes', () => {
171
+ runtimeEnvironment.breakpoint = 'md';
172
+ const selectionDecoration = { onPress: () => undefined, selected: true };
173
+ const markup = renderToStaticMarkup(
174
+ <Screen scroll={false} selectionDecoration={selectionDecoration} testID="screen">
175
+ <MasterDetail selectionDecoration={selectionDecoration} testID="workspace">
176
+ <span>Master content</span>
177
+ <span>Detail content</span>
178
+ </MasterDetail>
179
+ </Screen>,
180
+ );
181
+
182
+ expect(markup).toContain('data-selection="selected" data-view="screen"');
183
+ expect(markup).toContain('data-selection="selected" data-view="workspace"');
184
+ expect(markup.match(/data-selection="selected"/gu)).toHaveLength(2);
185
+ expect(markup).toContain('data-min-height="0"');
186
+ expect(markup).toContain('data-scroll="workspace-master"');
187
+ expect(markup).toContain('data-scroll="workspace-detail"');
188
+ });
@@ -19,19 +19,42 @@ function MasterDetailInner({
19
19
  children,
20
20
  masterWidth = 30,
21
21
  masterScroll = true,
22
+ selectionDecoration,
22
23
  detailScroll = true,
23
24
  testID,
24
25
  }: MasterDetailProps) {
25
26
  const presentation = resolveMasterDetailPresentation(useBreakpoint(), activePane, desktopMode);
26
27
  const [master, detail] = React.Children.toArray(children);
27
- const masterPane = <MasterPane master={master} scroll={masterScroll} testID={testID} />;
28
- const detailPane = <DetailPane detail={detail} scroll={detailScroll} testID={testID} />;
28
+ const paneSelectionDecoration = presentation === 'split' ? undefined : selectionDecoration;
29
+ const masterPane = (
30
+ <MasterPane
31
+ master={master}
32
+ scroll={masterScroll}
33
+ selectionDecoration={paneSelectionDecoration}
34
+ testID={testID}
35
+ />
36
+ );
37
+ const detailPane = (
38
+ <DetailPane
39
+ detail={detail}
40
+ scroll={detailScroll}
41
+ selectionDecoration={paneSelectionDecoration}
42
+ testID={testID}
43
+ />
44
+ );
29
45
 
30
46
  if (presentation === 'master') return masterPane;
31
47
  if (presentation === 'detail') return detailPane;
32
48
 
33
49
  return (
34
- <View direction="row" flex={1} minHeight={0} minWidth={0} testID={testID}>
50
+ <View
51
+ direction="row"
52
+ flex={1}
53
+ minHeight={0}
54
+ minWidth={0}
55
+ selectionDecoration={selectionDecoration}
56
+ testID={testID}
57
+ >
35
58
  <View flex={masterWidth} minHeight={0} minWidth={0}>
36
59
  {masterPane}
37
60
  </View>
@@ -46,10 +69,18 @@ function MasterDetailInner({
46
69
  function MasterPane({
47
70
  master,
48
71
  scroll,
72
+ selectionDecoration,
49
73
  testID,
50
- }: Pick<MasterDetailProps, 'testID'> & { master?: React.ReactNode; scroll: boolean }) {
74
+ }: Pick<MasterDetailProps, 'selectionDecoration' | 'testID'> & {
75
+ master?: React.ReactNode;
76
+ scroll: boolean;
77
+ }) {
51
78
  return (
52
- <PaneRegion scroll={scroll} testID={testID ? `${testID}-master` : undefined}>
79
+ <PaneRegion
80
+ scroll={scroll}
81
+ selectionDecoration={selectionDecoration}
82
+ testID={testID ? `${testID}-master` : undefined}
83
+ >
53
84
  {master}
54
85
  </PaneRegion>
55
86
  );
@@ -59,10 +90,18 @@ function MasterPane({
59
90
  function DetailPane({
60
91
  detail,
61
92
  scroll,
93
+ selectionDecoration,
62
94
  testID,
63
- }: Pick<MasterDetailProps, 'testID'> & { detail?: React.ReactNode; scroll: boolean }) {
95
+ }: Pick<MasterDetailProps, 'selectionDecoration' | 'testID'> & {
96
+ detail?: React.ReactNode;
97
+ scroll: boolean;
98
+ }) {
64
99
  return (
65
- <PaneRegion scroll={scroll} testID={testID ? `${testID}-detail` : undefined}>
100
+ <PaneRegion
101
+ scroll={scroll}
102
+ selectionDecoration={selectionDecoration}
103
+ testID={testID ? `${testID}-detail` : undefined}
104
+ >
66
105
  {detail}
67
106
  </PaneRegion>
68
107
  );
@@ -72,11 +111,22 @@ function DetailPane({
72
111
  function PaneRegion({
73
112
  children,
74
113
  scroll,
114
+ selectionDecoration,
75
115
  testID,
76
- }: React.PropsWithChildren<{ scroll: boolean; testID?: string }>) {
116
+ }: React.PropsWithChildren<{
117
+ scroll: boolean;
118
+ selectionDecoration?: MasterDetailProps['selectionDecoration'];
119
+ testID?: string;
120
+ }>) {
77
121
  if (!scroll) {
78
122
  return (
79
- <View flex={1} minHeight={0} minWidth={0} testID={testID}>
123
+ <View
124
+ flex={1}
125
+ minHeight={0}
126
+ minWidth={0}
127
+ selectionDecoration={selectionDecoration}
128
+ testID={testID}
129
+ >
80
130
  {children}
81
131
  </View>
82
132
  );
@@ -84,7 +134,9 @@ function PaneRegion({
84
134
 
85
135
  return (
86
136
  <ScrollView flex={1} minHeight={0} minWidth={0} testID={testID}>
87
- {children}
137
+ <View minHeight={0} minWidth={0} selectionDecoration={selectionDecoration}>
138
+ {children}
139
+ </View>
88
140
  </ScrollView>
89
141
  );
90
142
  }
@@ -15,7 +15,12 @@ const browserKeys = [
15
15
  'IS_REACT_ACT_ENVIRONMENT',
16
16
  ] as const;
17
17
  const webDistRoot = join(import.meta.dir, '../../../../../web-dist');
18
- const load = (path: string) => import(pathToFileURL(join(webDistRoot, path)).href);
18
+ let browserArtifact: Promise<BrowserArtifact> | undefined;
19
+
20
+ interface BrowserArtifact {
21
+ readonly MatrixGrid: MatrixGridComponent;
22
+ readonly ZoraProvider: ZoraProviderComponent;
23
+ }
19
24
 
20
25
  interface MatrixCell {
21
26
  readonly columnId: string;
@@ -38,6 +43,47 @@ type MatrixGridComponent = React.ComponentType<{
38
43
  }>;
39
44
  type ZoraProviderComponent = React.ComponentType<{ readonly children: React.ReactNode }>;
40
45
 
46
+ /*** Load the generated MatrixGrid and provider through one browser-conditioned module graph. */
47
+ async function loadMatrixGrid() {
48
+ browserArtifact ??= buildBrowserArtifact();
49
+ return browserArtifact;
50
+ }
51
+
52
+ /*** Bundle existing generated artifacts with browser dependency resolution for Bun's DOM assertions. */
53
+ async function buildBrowserArtifact(): Promise<BrowserArtifact> {
54
+ const entryPath = join(webDistRoot, '.matrix-grid-protected-focus-entry.mjs');
55
+ const outputPath = join(webDistRoot, '.matrix-grid-protected-focus-test.mjs');
56
+ await Bun.write(
57
+ entryPath,
58
+ "export { MatrixGrid } from './components/matrix-grid/MatrixGrid.js';\nexport { ZoraProvider } from './runtime/ZoraProvider.js';\n",
59
+ );
60
+ const build = await Bun.build({
61
+ entrypoints: [entryPath],
62
+ conditions: ['browser', 'import', 'default'],
63
+ external: ['react', 'react/*', 'react-dom', 'react-dom/*', 'react-native-web'],
64
+ format: 'esm',
65
+ minifyWhitespace: true,
66
+ outfile: outputPath,
67
+ plugins: [
68
+ {
69
+ name: 'matrix-grid-protected-focus-browser-react-native-alias',
70
+ setup(builder) {
71
+ builder.onResolve({ filter: /^react-native$/u }, () => ({
72
+ external: true,
73
+ path: 'react-native-web',
74
+ }));
75
+ },
76
+ },
77
+ ],
78
+ target: 'browser',
79
+ write: true,
80
+ });
81
+ if (!build.success || !build.outputs[0])
82
+ throw new Error(build.logs.map((log) => log.message).join('\n'));
83
+ await Bun.write(outputPath, build.outputs[0]);
84
+ return (await import(pathToFileURL(outputPath).href)) as BrowserArtifact;
85
+ }
86
+
41
87
  /*** Mount MatrixGrid through React Native Web and restore the ambient DOM after each assertion. */
42
88
  async function withMatrixDom(assertion: (host: HTMLElement, browser: Window) => Promise<void>) {
43
89
  const browser = new Window();
@@ -65,17 +111,6 @@ async function withMatrixDom(assertion: (host: HTMLElement, browser: Window) =>
65
111
  }
66
112
  }
67
113
 
68
- /*** Load the compiled MatrixGrid and provider used by React Native Web interaction tests. */
69
- async function loadMatrixGrid() {
70
- const { MatrixGrid } = (await load('components/matrix-grid/MatrixGrid.js')) as {
71
- MatrixGrid: MatrixGridComponent;
72
- };
73
- const { ZoraProvider } = (await load('runtime/ZoraProvider.js')) as {
74
- ZoraProvider: ZoraProviderComponent;
75
- };
76
- return { MatrixGrid, ZoraProvider };
77
- }
78
-
79
114
  test('retains focus when protected terminal cells block all four arrow directions', async () => {
80
115
  await withMatrixDom(async (host, browser) => {
81
116
  const root = createRoot(host);
@@ -15,7 +15,64 @@ const browserKeys = [
15
15
  'IS_REACT_ACT_ENVIRONMENT',
16
16
  ] as const;
17
17
  const webDistRoot = join(import.meta.dir, '../../../../../web-dist');
18
- const load = (path: string) => import(pathToFileURL(join(webDistRoot, path)).href);
18
+ const load = async (path: string) => {
19
+ const artifact = await loadBrowserArtifact();
20
+ return path === 'components/matrix-grid/MatrixGrid.js'
21
+ ? {
22
+ MatrixGrid: artifact.MatrixGrid,
23
+ }
24
+ : {
25
+ ZoraProvider: artifact.ZoraProvider,
26
+ };
27
+ };
28
+
29
+ interface BrowserArtifact {
30
+ readonly MatrixGrid: React.ComponentType<unknown>;
31
+ readonly ZoraProvider: React.ComponentType<{ readonly children: React.ReactNode }>;
32
+ }
33
+
34
+ /*** Load the generated MatrixGrid and provider through the same browser-conditioned module graph. */
35
+ let browserArtifact: Promise<BrowserArtifact> | undefined;
36
+
37
+ function loadBrowserArtifact() {
38
+ browserArtifact ??= buildBrowserArtifact();
39
+ return browserArtifact;
40
+ }
41
+
42
+ /*** Bundle existing generated artifacts with browser dependency resolution for Bun's DOM assertions. */
43
+ async function buildBrowserArtifact() {
44
+ const entryPath = join(webDistRoot, '.matrix-grid-browser-entry.mjs');
45
+ const outputPath = join(webDistRoot, '.matrix-grid-browser-test.mjs');
46
+ await Bun.write(
47
+ entryPath,
48
+ "export { MatrixGrid } from './components/matrix-grid/MatrixGrid.js';\nexport { ZoraProvider } from './runtime/ZoraProvider.js';\n",
49
+ );
50
+ const build = await Bun.build({
51
+ entrypoints: [entryPath],
52
+ conditions: ['browser', 'import', 'default'],
53
+ external: ['react', 'react/*', 'react-dom', 'react-dom/*', 'react-native-web'],
54
+ format: 'esm',
55
+ minifyWhitespace: true,
56
+ outfile: outputPath,
57
+ plugins: [
58
+ {
59
+ name: 'matrix-grid-browser-react-native-alias',
60
+ setup(builder) {
61
+ builder.onResolve({ filter: /^react-native$/u }, () => ({
62
+ external: true,
63
+ path: 'react-native-web',
64
+ }));
65
+ },
66
+ },
67
+ ],
68
+ target: 'browser',
69
+ write: true,
70
+ });
71
+ if (!build.success || !build.outputs[0])
72
+ throw new Error(build.logs.map((log) => log.message).join('\n'));
73
+ await Bun.write(outputPath, build.outputs[0]);
74
+ return (await import(pathToFileURL(outputPath).href)) as BrowserArtifact;
75
+ }
19
76
 
20
77
  /*** Mount MatrixGrid through React Native Web and restore the ambient DOM after each assertion. */
21
78
  async function withMatrixDom(assertion: (host: HTMLElement, browser: Window) => Promise<void>) {
@@ -407,6 +407,14 @@ export const ZORA_BINDABLE_COMPONENT_META = {
407
407
  acceptsFallback: true,
408
408
  acceptsTransforms: true,
409
409
  },
410
+ activeRowId: {
411
+ label: 'Active row ID',
412
+ description:
413
+ 'Controlled stable row identity visibly activated independently of checkbox selection.',
414
+ value: { type: 'string' },
415
+ acceptsFallback: true,
416
+ acceptsTransforms: true,
417
+ },
410
418
  },
411
419
  events: {
412
420
  selectionChange: {
@@ -429,6 +437,7 @@ export const ZORA_BINDABLE_COMPONENT_META = {
429
437
  inverted: INVERTED_POLARITY_PROP,
430
438
  rows: { type: 'array', category: 'Data', label: 'Rows' },
431
439
  selectedRowIds: { type: 'array', category: 'Selection', label: 'Selected row IDs' },
440
+ activeRowId: { type: 'string', category: 'Selection', label: 'Active row ID' },
432
441
  },
433
442
  },
434
443
  Reader: {
@@ -48,7 +48,7 @@ describe('RuntimeAuthoringOverlay', () => {
48
48
  expect(selected).toEqual(['replacement']);
49
49
  });
50
50
 
51
- test('uses Runtime identity and a nonsemantic selection wrapper in both modes', async () => {
51
+ test('uses Runtime identity and decorates the rendered target in both modes', async () => {
52
52
  const { createRuntimeAuthoringOverlayAdapter } = await loadOverlay();
53
53
  const edit = createRuntimeAuthoringOverlayAdapter({ mode: 'edit' });
54
54
  const preview = createRuntimeAuthoringOverlayAdapter({ mode: 'preview' });
@@ -62,8 +62,20 @@ describe('RuntimeAuthoringOverlay', () => {
62
62
  expect(isValidElement(editNode) && isValidElement(previewNode) && editNode.type).toBe(
63
63
  previewNode.type,
64
64
  );
65
- expect(readWrappedNode(editNode).props.accessibilityRole).toBe('none');
66
- expect(readWrappedNode(previewNode).props.accessibilityRole).toBe('none');
65
+ expect(readDecoration(editNode).type).toBe('SelectionDecoration');
66
+ expect(readDecoration(previewNode).type).toBe('SelectionDecoration');
67
+ expect(readDecoration(editNode).props.interactionPolicy).toBe('enabled');
68
+ expect(readDecoration(previewNode).props.interactionPolicy).toBe('passive');
69
+ });
70
+
71
+ test('keeps the rendered target as the direct decoration child', async () => {
72
+ const { createRuntimeAuthoringOverlayAdapter } = await loadOverlay();
73
+ const args = { isRoot: false, node, rendered: <target /> };
74
+ const editNode = createRuntimeAuthoringOverlayAdapter({ mode: 'edit' }).wrapNode(args);
75
+ const previewNode = createRuntimeAuthoringOverlayAdapter({ mode: 'preview' }).wrapNode(args);
76
+
77
+ expect(readDecoration(editNode).props.children).toBe(args.rendered);
78
+ expect(readDecoration(previewNode).props.children).toBe(args.rendered);
67
79
  });
68
80
 
69
81
  test('selects the hit target only in edit mode', async () => {
@@ -76,8 +88,8 @@ describe('RuntimeAuthoringOverlay', () => {
76
88
  const editNode = createRuntimeAuthoringOverlayAdapter({ mode: 'edit' }).wrapNode(args);
77
89
  const previewNode = createRuntimeAuthoringOverlayAdapter({ mode: 'preview' }).wrapNode(args);
78
90
 
79
- readWrappedNode(editNode).props.onPress({});
80
- readWrappedNode(previewNode).props.onPress({});
91
+ readDecoration(editNode).props.onPress({});
92
+ readDecoration(previewNode).props.onPress({});
81
93
 
82
94
  expect(selected.runtimeAuthoringOverlaySelections).toEqual(['target-button']);
83
95
  delete selected.runtimeAuthoringOverlaySelections;
@@ -99,9 +111,10 @@ function readProvider(element: ReactElement): ReactElement<{
99
111
  }>;
100
112
  }
101
113
 
102
- /*** Renders the stable wrapper with inert controls so its semantic role can be asserted without mounting. */
103
- function readWrappedNode(element: ReactElement): ReactElement<{
104
- readonly accessibilityRole: string;
114
+ /*** Renders the direct decoration with inert controls so selection behavior can be asserted without mounting. */
115
+ function readDecoration(element: ReactElement): ReactElement<{
116
+ readonly children: ReactElement;
117
+ readonly interactionPolicy: 'enabled' | 'passive';
105
118
  readonly onPress: (event: unknown) => void;
106
119
  }> {
107
120
  if (typeof element.type !== 'function') {
@@ -112,7 +125,8 @@ function readWrappedNode(element: ReactElement): ReactElement<{
112
125
  component: { componentId: node.id, node },
113
126
  select: () => true,
114
127
  }) as ReactElement<{
115
- readonly accessibilityRole: string;
128
+ readonly children: ReactElement;
129
+ readonly interactionPolicy: 'enabled' | 'passive';
116
130
  readonly onPress: (event: unknown) => void;
117
131
  }>;
118
132
  }
@@ -136,7 +150,7 @@ async function loadOverlay(): Promise<LoadedOverlay> {
136
150
  { filter: /.*/u, namespace: 'inert-runtime-authoring-overlay-controls' },
137
151
  () => ({
138
152
  loader: 'js',
139
- contents: `export const Pressable='Pressable', View='View', SelectionProvider='SelectionProvider',
153
+ contents: `export const SelectionDecoration='SelectionDecoration', SelectionProvider='SelectionProvider',
140
154
  useSelection=()=>({isSelected:()=>false,select:(id)=>globalThis.runtimeAuthoringOverlaySelections?.push(id)}),
141
155
  useZoraTheme=()=>({theme:{semantics:{highlight:'highlight'}}});`,
142
156
  }),
@@ -2,15 +2,14 @@ import type {
2
2
  RuntimeAuthoringOverlayAdapter,
3
3
  RuntimeAuthoringOverlayNodeArgs,
4
4
  } from '@ankhorage/runtime';
5
- import { Pressable } from '@ankhorage/surface';
5
+ import type { ViewProps as SurfaceViewProps } from '@ankhorage/surface';
6
+ import { SelectionDecoration } from '@ankhorage/surface/authoring-controls';
6
7
  import React from 'react';
7
8
 
8
9
  import type {
9
10
  CreateRuntimeAuthoringOverlayAdapterOptions,
10
11
  RuntimeAuthoringOverlayProps,
11
12
  } from '../../../../types/selection';
12
- import { View } from '../../../layout/public';
13
- import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
14
13
  import { SelectionProvider, useSelection } from './SelectionProvider';
15
14
 
16
15
  /*** Provides controlled, single-node selection to Runtime-rendered content without creating a second renderer tree. */
@@ -44,14 +43,13 @@ export function createRuntimeAuthoringOverlayAdapter({
44
43
  };
45
44
  }
46
45
 
47
- /*** Wraps one rendered target node with edit-mode selection input while retaining its subtree across modes. */
46
+ /*** Attaches selection directly to the rendered node's ZORA-owned host boundary without a layout wrapper. */
48
47
  function RuntimeAuthoringOverlayNode({
49
48
  component,
50
49
  mode,
51
50
  rendered,
52
51
  select,
53
52
  }: RuntimeAuthoringOverlayNodeArgs & { readonly mode: 'edit' | 'preview' }) {
54
- const { theme } = useZoraTheme();
55
53
  const selection = useSelection();
56
54
  const selected = selection.isSelected(component.componentId);
57
55
  const handlePress = (event: unknown) => {
@@ -59,36 +57,16 @@ function RuntimeAuthoringOverlayNode({
59
57
  selection.select(component.componentId);
60
58
  };
61
59
 
60
+ if (!React.isValidElement(rendered)) return rendered;
61
+ const target = rendered as React.ReactElement<Pick<SurfaceViewProps, 'selectionDecoration'>>;
62
+
62
63
  return (
63
- <Pressable
64
- accessibilityLabel={`Select ${component.node.type}`}
65
- accessibilityRole="none"
66
- accessibilityState={{ selected }}
64
+ <SelectionDecoration
67
65
  interactionPolicy={mode === 'edit' ? 'enabled' : 'passive'}
68
66
  onPress={handlePress}
69
- style={styles.wrapper}
70
- testID={`runtime-authoring-node-${component.componentId}`}
67
+ selected={selected}
71
68
  >
72
- {rendered}
73
- {selected ? (
74
- <View
75
- borderColor={theme.semantics.highlight}
76
- borderWidth={2}
77
- pointerEvents="none"
78
- style={styles.highlight}
79
- />
80
- ) : null}
81
- </Pressable>
69
+ {target}
70
+ </SelectionDecoration>
82
71
  );
83
72
  }
84
-
85
- const styles = {
86
- highlight: {
87
- bottom: 0,
88
- left: 0,
89
- position: 'absolute' as const,
90
- right: 0,
91
- top: 0,
92
- },
93
- wrapper: { position: 'relative' as const },
94
- };
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { Platform, Text as ReactNativeText, type TextStyle } from 'react-native';
4
4
 
5
5
  import type { HeadingProps } from '../../../../types/heading';
6
+ import { View } from '../../../layout/adapters/inbound/View';
6
7
  import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
7
8
  import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
8
9
  import { useZoraThemeRecipe } from '../../../theme/composition/useZoraThemeRecipe';
@@ -64,6 +65,7 @@ function HeadingInner({
64
65
  accessibilityHint,
65
66
  accessibilityRole,
66
67
  nativeID,
68
+ selectionDecoration,
67
69
  testID,
68
70
  interactionPolicy: _interactionPolicy,
69
71
  }: HeadingProps) {
@@ -81,7 +83,7 @@ function HeadingInner({
81
83
 
82
84
  if (content === null) return null;
83
85
 
84
- return (
86
+ const rendered = (
85
87
  <ReactNativeText
86
88
  accessibilityHint={accessibilityHint}
87
89
  accessibilityLabel={accessibilityLabel}
@@ -108,4 +110,10 @@ function HeadingInner({
108
110
  {content}
109
111
  </ReactNativeText>
110
112
  );
113
+
114
+ return selectionDecoration === undefined ? (
115
+ rendered
116
+ ) : (
117
+ <View selectionDecoration={selectionDecoration}>{rendered}</View>
118
+ );
111
119
  }
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { Platform, Text as ReactNativeText, type TextStyle } from 'react-native';
4
4
 
5
5
  import type { TextProps } from '../../../../types/text';
6
+ import { View } from '../../../layout/adapters/inbound/View';
6
7
  import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
7
8
  import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
8
9
  import { useZoraThemeRecipe } from '../../../theme/composition/useZoraThemeRecipe';
@@ -67,6 +68,7 @@ function TextInner({
67
68
  accessibilityRole,
68
69
  accessibilityLiveRegion,
69
70
  nativeID,
71
+ selectionDecoration,
70
72
  testID,
71
73
  interactionPolicy: _interactionPolicy,
72
74
  }: TextProps) {
@@ -88,7 +90,7 @@ function TextInner({
88
90
 
89
91
  if (content === null || content === undefined) return null;
90
92
 
91
- return (
93
+ const rendered = (
92
94
  <ReactNativeText
93
95
  accessibilityHint={accessibilityHint}
94
96
  accessibilityLabel={accessibilityLabel}
@@ -104,4 +106,10 @@ function TextInner({
104
106
  {content}
105
107
  </ReactNativeText>
106
108
  );
109
+
110
+ return selectionDecoration === undefined ? (
111
+ rendered
112
+ ) : (
113
+ <View selectionDecoration={selectionDecoration}>{rendered}</View>
114
+ );
107
115
  }
@@ -89,6 +89,8 @@ export interface DataTableProps<TRow extends object> extends ZoraBaseProps {
89
89
  rowKey?: keyof TRow;
90
90
  /** Controlled identifiers for rows selected with the optional checkbox column. */
91
91
  selectedRowIds?: readonly string[];
92
+ /** Controlled stable row identity whose activation state is visibly presented. */
93
+ activeRowId?: string;
92
94
  /** Receives the next controlled selection after a row or visible-row toggle. */
93
95
  onSelectedRowIdsChange?: (selectedRowIds: readonly string[]) => void;
94
96
  /** Emits the serializable controlled selection payload used by AppManifest events. */
@@ -1,4 +1,5 @@
1
1
  import type { Responsive } from '@ankhorage/surface';
2
+ import type { ViewProps as SurfaceViewProps } from '@ankhorage/surface';
2
3
  import type React from 'react';
3
4
  import type { AccessibilityRole, StyleProp, TextStyle } from 'react-native';
4
5
 
@@ -35,4 +36,6 @@ export interface HeadingProps extends ZoraBaseProps {
35
36
  accessibilityHint?: string;
36
37
  accessibilityRole?: AccessibilityRole;
37
38
  nativeID?: string;
39
+ /** Internal authoring selection decoration applied to the heading host. */
40
+ selectionDecoration?: SurfaceViewProps['selectionDecoration'];
38
41
  }
@@ -28,6 +28,8 @@ export interface ScreenProps extends ZoraBaseProps {
28
28
  children?: React.ReactNode;
29
29
  footer?: React.ReactNode;
30
30
  scroll?: boolean;
31
+ /** Internal authoring selection decoration applied to the bounded screen content host. */
32
+ selectionDecoration?: SurfaceViewProps['selectionDecoration'];
31
33
  width?: ZoraContentWidth;
32
34
  }
33
35
 
@@ -1,3 +1,4 @@
1
+ import type { ViewProps as SurfaceViewProps } from '@ankhorage/surface';
1
2
  import type React from 'react';
2
3
 
3
4
  import type { ZoraBaseProps } from './base';
@@ -26,4 +27,6 @@ export interface MasterDetailProps extends ZoraBaseProps {
26
27
  masterScroll?: boolean;
27
28
  /** Scrolls the detail pane. Set false for bounded content, such as a nested app, that owns its own scrolling. */
28
29
  detailScroll?: boolean;
30
+ /** Internal authoring selection decoration applied to the active workspace host. */
31
+ selectionDecoration?: SurfaceViewProps['selectionDecoration'];
29
32
  }
package/src/types/text.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Responsive } from '@ankhorage/surface';
2
+ import type { ViewProps as SurfaceViewProps } from '@ankhorage/surface';
2
3
  import type React from 'react';
3
4
  import type {
4
5
  AccessibilityRole,
@@ -38,4 +39,6 @@ export interface TextProps extends ZoraBaseProps {
38
39
  accessibilityRole?: AccessibilityRole;
39
40
  accessibilityLiveRegion?: ReactNativeTextProps['accessibilityLiveRegion'];
40
41
  nativeID?: string;
42
+ /** Internal authoring selection decoration applied to the text host. */
43
+ selectionDecoration?: SurfaceViewProps['selectionDecoration'];
41
44
  }