@kerf-js/veneer 0.0.0-stage → 0.1.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.
Files changed (389) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +1338 -2
  3. package/package.json +56 -3
  4. package/plugin.d.mts +187 -0
  5. package/plugin.mjs +399 -0
  6. package/src/Accordion.tsx +98 -0
  7. package/src/Alert.tsx +55 -0
  8. package/src/Badge.tsx +39 -0
  9. package/src/Button.tsx +175 -0
  10. package/src/Calendar-month.tsx +140 -0
  11. package/src/Calendar.tsx +335 -0
  12. package/src/Canvas.tsx +221 -0
  13. package/src/Card.tsx +85 -0
  14. package/src/Chart.tsx +278 -0
  15. package/src/Charts.tsx +158 -0
  16. package/src/Chip.tsx +61 -0
  17. package/src/Choice-checkbox.tsx +53 -0
  18. package/src/Choice-parts.tsx +7 -0
  19. package/src/Choice-radio.tsx +78 -0
  20. package/src/Choice-segmented.tsx +76 -0
  21. package/src/Choice-switch.tsx +51 -0
  22. package/src/Choice.tsx +4 -0
  23. package/src/CloseX.tsx +14 -0
  24. package/src/CodeBlock.tsx +81 -0
  25. package/src/CodeInput.tsx +256 -0
  26. package/src/Combobox.tsx +281 -0
  27. package/src/CommandPalette-controller.ts +314 -0
  28. package/src/CommandPalette-rows.tsx +137 -0
  29. package/src/CommandPalette.tsx +196 -0
  30. package/src/DataGrid-actions.ts +119 -0
  31. package/src/DataGrid-body.tsx +58 -0
  32. package/src/DataGrid-controller.ts +145 -0
  33. package/src/DataGrid-header.tsx +108 -0
  34. package/src/DataGrid-model.ts +248 -0
  35. package/src/DataGrid-pivot.tsx +108 -0
  36. package/src/DataGrid-rows.tsx +296 -0
  37. package/src/DataGrid-toolbar.tsx +127 -0
  38. package/src/DataGrid-tree.ts +149 -0
  39. package/src/DataGrid-viewport.tsx +37 -0
  40. package/src/DataGrid.tsx +145 -0
  41. package/src/DateField-presets.tsx +27 -0
  42. package/src/DateField-range.tsx +370 -0
  43. package/src/DateField.tsx +295 -0
  44. package/src/Dither.tsx +313 -0
  45. package/src/Drawer.tsx +123 -0
  46. package/src/DurationField.tsx +227 -0
  47. package/src/Feed.tsx +78 -0
  48. package/src/Field/view.tsx +147 -0
  49. package/src/Field.tsx +238 -0
  50. package/src/HamburgerMenu.tsx +119 -0
  51. package/src/Icon.tsx +15 -0
  52. package/src/Kbd.tsx +6 -0
  53. package/src/KeyValueEditor/actions.ts +75 -0
  54. package/src/KeyValueEditor/rows.tsx +104 -0
  55. package/src/KeyValueEditor.tsx +112 -0
  56. package/src/Layout.tsx +221 -0
  57. package/src/Markdown.tsx +127 -0
  58. package/src/MentionsInput/actions.ts +161 -0
  59. package/src/MentionsInput/end.tsx +82 -0
  60. package/src/MentionsInput.tsx +103 -0
  61. package/src/Menu.tsx +221 -0
  62. package/src/Modal.tsx +109 -0
  63. package/src/MonthPicker/month.tsx +117 -0
  64. package/src/MonthPicker/period.tsx +197 -0
  65. package/src/MonthPicker/shared.tsx +272 -0
  66. package/src/MonthPicker/week.tsx +103 -0
  67. package/src/MonthPicker.tsx +11 -0
  68. package/src/MultiSelect.tsx +139 -0
  69. package/src/Nav.tsx +36 -0
  70. package/src/NumberField.tsx +156 -0
  71. package/src/Pagination.tsx +335 -0
  72. package/src/PaymentCard.tsx +111 -0
  73. package/src/Picker.tsx +228 -0
  74. package/src/PlaceField.tsx +285 -0
  75. package/src/Popover.tsx +88 -0
  76. package/src/Presence.tsx +37 -0
  77. package/src/Progress.tsx +71 -0
  78. package/src/RecurrenceField.tsx +372 -0
  79. package/src/RichSelect/codes.tsx +94 -0
  80. package/src/RichSelect/list.tsx +380 -0
  81. package/src/RichSelect/phone-view.tsx +114 -0
  82. package/src/RichSelect/phone.tsx +305 -0
  83. package/src/RichSelect/search-keys.ts +28 -0
  84. package/src/RichSelect/timezone.tsx +53 -0
  85. package/src/RichSelect.tsx +13 -0
  86. package/src/RichTextEditor/controller.tsx +305 -0
  87. package/src/RichTextEditor/editor.tsx +61 -0
  88. package/src/RichTextEditor/tools.tsx +132 -0
  89. package/src/RichTextEditor/view.tsx +210 -0
  90. package/src/RichTextEditor.tsx +9 -0
  91. package/src/ScrollGrid/measure.ts +39 -0
  92. package/src/ScrollGrid/parts.tsx +112 -0
  93. package/src/ScrollGrid.tsx +375 -0
  94. package/src/ScrollRail.tsx +114 -0
  95. package/src/ScrollView.tsx +57 -0
  96. package/src/Segments/controller.tsx +148 -0
  97. package/src/Segments/events.ts +99 -0
  98. package/src/Segments/view.tsx +77 -0
  99. package/src/Segments.tsx +2 -0
  100. package/src/Select.tsx +343 -0
  101. package/src/Shape.tsx +41 -0
  102. package/src/Shell/branches.tsx +108 -0
  103. package/src/Shell/button.tsx +33 -0
  104. package/src/Shell/shared.tsx +220 -0
  105. package/src/Shell/shell.tsx +25 -0
  106. package/src/Shell/state.ts +138 -0
  107. package/src/Shell/view.tsx +280 -0
  108. package/src/Shell.tsx +17 -0
  109. package/src/SideNav/sections.tsx +50 -0
  110. package/src/SideNav/state.ts +140 -0
  111. package/src/SideNav.tsx +130 -0
  112. package/src/SideNavTitle.tsx +25 -0
  113. package/src/SignaturePad/state.ts +172 -0
  114. package/src/SignaturePad/view.tsx +69 -0
  115. package/src/SignaturePad.tsx +76 -0
  116. package/src/Skeleton.tsx +46 -0
  117. package/src/Slider.tsx +81 -0
  118. package/src/Spinner.tsx +21 -0
  119. package/src/Stage-director.ts +361 -0
  120. package/src/Stage-look.ts +75 -0
  121. package/src/Stage-poster.tsx +62 -0
  122. package/src/Stage-types.ts +206 -0
  123. package/src/Stage.tsx +147 -0
  124. package/src/TabBar.tsx +114 -0
  125. package/src/Table-actions.tsx +51 -0
  126. package/src/Table-base.ts +70 -0
  127. package/src/Table-body.tsx +84 -0
  128. package/src/Table-columns.tsx +58 -0
  129. package/src/Table-details.tsx +66 -0
  130. package/src/Table-editor.tsx +66 -0
  131. package/src/Table-head.tsx +52 -0
  132. package/src/Table-model.ts +82 -0
  133. package/src/Table-notice.ts +39 -0
  134. package/src/Table-paging.ts +50 -0
  135. package/src/Table-rows.tsx +308 -0
  136. package/src/Table-selection.ts +63 -0
  137. package/src/Table-sortbar.tsx +41 -0
  138. package/src/Table-source.ts +66 -0
  139. package/src/Table-toolbar.tsx +71 -0
  140. package/src/Table-types.ts +115 -0
  141. package/src/Table-view.tsx +87 -0
  142. package/src/Table.tsx +31 -0
  143. package/src/Tabs.tsx +129 -0
  144. package/src/Tag.tsx +40 -0
  145. package/src/Ticker.tsx +42 -0
  146. package/src/TimeField-date-model.ts +77 -0
  147. package/src/TimeField-date-view.tsx +152 -0
  148. package/src/TimeField-model.ts +80 -0
  149. package/src/TimeField-options.tsx +224 -0
  150. package/src/TimeField-slots.tsx +32 -0
  151. package/src/TimeField-types.ts +33 -0
  152. package/src/TimeField-view.tsx +124 -0
  153. package/src/TimeField.tsx +126 -0
  154. package/src/Toast.tsx +143 -0
  155. package/src/Toggle.tsx +75 -0
  156. package/src/Tooltip.tsx +69 -0
  157. package/src/Type.tsx +136 -0
  158. package/src/VirtualList-controls.ts +105 -0
  159. package/src/VirtualList-data.ts +43 -0
  160. package/src/VirtualList-measure.ts +169 -0
  161. package/src/VirtualList-metrics.ts +41 -0
  162. package/src/VirtualList-mount.ts +145 -0
  163. package/src/VirtualList-rows.tsx +91 -0
  164. package/src/VirtualList-types.ts +76 -0
  165. package/src/VirtualList-view.tsx +123 -0
  166. package/src/VirtualList.tsx +81 -0
  167. package/src/admin/ApiKeys-actions.ts +124 -0
  168. package/src/admin/ApiKeys-form.tsx +64 -0
  169. package/src/admin/ApiKeys-view.tsx +101 -0
  170. package/src/admin/ApiKeys.tsx +224 -0
  171. package/src/admin/Audit.tsx +246 -0
  172. package/src/admin/Billing.tsx +307 -0
  173. package/src/admin/Cart.tsx +177 -0
  174. package/src/admin/Checkout-address.tsx +125 -0
  175. package/src/admin/Checkout-cart.tsx +78 -0
  176. package/src/admin/Checkout-coupon.ts +34 -0
  177. package/src/admin/Checkout-done.tsx +31 -0
  178. package/src/admin/Checkout-model.ts +33 -0
  179. package/src/admin/Checkout-navigation.ts +76 -0
  180. package/src/admin/Checkout-payment-view.tsx +49 -0
  181. package/src/admin/Checkout-payment.ts +80 -0
  182. package/src/admin/Checkout-review.tsx +60 -0
  183. package/src/admin/Checkout-shipping.tsx +47 -0
  184. package/src/admin/Checkout-state.ts +122 -0
  185. package/src/admin/Checkout-steps.ts +10 -0
  186. package/src/admin/Checkout-summary.tsx +97 -0
  187. package/src/admin/Checkout-types.ts +60 -0
  188. package/src/admin/Checkout-view.tsx +51 -0
  189. package/src/admin/Checkout.tsx +72 -0
  190. package/src/admin/CsvImport-actions.ts +131 -0
  191. package/src/admin/CsvImport.tsx +379 -0
  192. package/src/admin/Danger.tsx +240 -0
  193. package/src/admin/Integrations/Card.tsx +82 -0
  194. package/src/admin/Integrations/Webhooks.tsx +341 -0
  195. package/src/admin/Integrations.tsx +169 -0
  196. package/src/admin/InviteDialog.tsx +153 -0
  197. package/src/admin/Members/columns.tsx +181 -0
  198. package/src/admin/Members.tsx +316 -0
  199. package/src/admin/Order.tsx +115 -0
  200. package/src/admin/PlainTable.tsx +34 -0
  201. package/src/admin/Plans.tsx +375 -0
  202. package/src/admin/SaveBar/actions.ts +86 -0
  203. package/src/admin/SaveBar.tsx +153 -0
  204. package/src/admin/Secret.tsx +74 -0
  205. package/src/admin/Settings.tsx +145 -0
  206. package/src/admin/StepBar.tsx +66 -0
  207. package/src/admin/TagsInput/actions.ts +60 -0
  208. package/src/admin/TagsInput.tsx +95 -0
  209. package/src/admin/atoms.tsx +73 -0
  210. package/src/admin/index.ts +67 -0
  211. package/src/agent/Actions/reasons.tsx +38 -0
  212. package/src/agent/Actions.tsx +166 -0
  213. package/src/agent/AgentPlan.tsx +86 -0
  214. package/src/agent/ArtifactPanel.tsx +299 -0
  215. package/src/agent/Assistant.tsx +168 -0
  216. package/src/agent/Checkpoint.tsx +19 -0
  217. package/src/agent/Cite.tsx +70 -0
  218. package/src/agent/ContextMeter.tsx +70 -0
  219. package/src/agent/Conversation.tsx +70 -0
  220. package/src/agent/Message.tsx +92 -0
  221. package/src/agent/ModelPicker.tsx +167 -0
  222. package/src/agent/Prompt-model.ts +118 -0
  223. package/src/agent/Prompt-view.tsx +246 -0
  224. package/src/agent/Prompt.tsx +128 -0
  225. package/src/agent/Prose.tsx +118 -0
  226. package/src/agent/Question.tsx +137 -0
  227. package/src/agent/Reasoning.tsx +31 -0
  228. package/src/agent/Shimmer.tsx +11 -0
  229. package/src/agent/Sources.tsx +23 -0
  230. package/src/agent/SpeechInput.tsx +243 -0
  231. package/src/agent/Suggestions.tsx +36 -0
  232. package/src/agent/ToolCall.tsx +219 -0
  233. package/src/agent/TraceViewer.tsx +96 -0
  234. package/src/agent/bits.tsx +88 -0
  235. package/src/agent/index.ts +38 -0
  236. package/src/bind.ts +57 -0
  237. package/src/collab/AutoTrack.tsx +91 -0
  238. package/src/collab/Comments.tsx +204 -0
  239. package/src/collab/Composer/state.ts +125 -0
  240. package/src/collab/Composer/view.tsx +155 -0
  241. package/src/collab/Composer.tsx +141 -0
  242. package/src/collab/ConversationList.tsx +120 -0
  243. package/src/collab/Cursors.tsx +71 -0
  244. package/src/collab/DataIntegrity.tsx +103 -0
  245. package/src/collab/Kanban-card.ts +74 -0
  246. package/src/collab/Kanban.tsx +368 -0
  247. package/src/collab/Lock.tsx +36 -0
  248. package/src/collab/PresenceStack.tsx +176 -0
  249. package/src/collab/ShareDialog.tsx +273 -0
  250. package/src/collab/Status.tsx +101 -0
  251. package/src/collab/SyncedForm.tsx +42 -0
  252. package/src/collab/Thread/Message.tsx +265 -0
  253. package/src/collab/Thread/rows.tsx +56 -0
  254. package/src/collab/Thread.tsx +323 -0
  255. package/src/collab/VersionHistory.tsx +173 -0
  256. package/src/collab/ViewportRail.tsx +73 -0
  257. package/src/collab/index.ts +37 -0
  258. package/src/collab/peer.tsx +42 -0
  259. package/src/fields.ts +5 -0
  260. package/src/flow/AuthScreen.tsx +81 -0
  261. package/src/flow/AuthSteps.tsx +296 -0
  262. package/src/flow/Checklist.tsx +211 -0
  263. package/src/flow/ConnBanner.tsx +304 -0
  264. package/src/flow/Flow.tsx +97 -0
  265. package/src/flow/MfaSetup.tsx +244 -0
  266. package/src/flow/Otp.tsx +243 -0
  267. package/src/flow/ReauthDialog.tsx +79 -0
  268. package/src/flow/ShortcutsOverlay.tsx +121 -0
  269. package/src/flow/SignGate.tsx +184 -0
  270. package/src/flow/SignIn.tsx +136 -0
  271. package/src/flow/SignUp.tsx +149 -0
  272. package/src/flow/Sso.tsx +96 -0
  273. package/src/flow/SystemPage/accounts.tsx +74 -0
  274. package/src/flow/SystemPage/art.tsx +113 -0
  275. package/src/flow/SystemPage.tsx +395 -0
  276. package/src/flow/Tour.tsx +207 -0
  277. package/src/flow/index.ts +29 -0
  278. package/src/flow/kit.tsx +334 -0
  279. package/src/index.ts +237 -0
  280. package/src/layout.css +4 -0
  281. package/src/links.css +4 -0
  282. package/src/live/ActivityFeed.tsx +88 -0
  283. package/src/live/Bell.tsx +108 -0
  284. package/src/live/Connection.tsx +113 -0
  285. package/src/live/Inbox.tsx +113 -0
  286. package/src/live/InboxFeed.tsx +67 -0
  287. package/src/live/InboxGestures.ts +41 -0
  288. package/src/live/InboxHandlers.ts +102 -0
  289. package/src/live/InboxHeader.tsx +81 -0
  290. package/src/live/InboxModel.ts +81 -0
  291. package/src/live/InboxRow.tsx +125 -0
  292. package/src/live/MeetingRoom.tsx +22 -0
  293. package/src/live/MeetingRoomControlBar.tsx +197 -0
  294. package/src/live/MeetingRoomHandlers.ts +53 -0
  295. package/src/live/MeetingRoomLayout.tsx +27 -0
  296. package/src/live/MeetingRoomModel.ts +49 -0
  297. package/src/live/MeetingRoomMount.ts +49 -0
  298. package/src/live/MeetingRoomParts.tsx +178 -0
  299. package/src/live/MeetingRoomPerson.tsx +21 -0
  300. package/src/live/MeetingRoomState.ts +88 -0
  301. package/src/live/MeetingRoomTile.tsx +84 -0
  302. package/src/live/MeetingRoomTypes.ts +68 -0
  303. package/src/live/MeetingRoomView.tsx +36 -0
  304. package/src/live/NotificationPreferences.tsx +99 -0
  305. package/src/live/NotificationPreferencesActions.ts +55 -0
  306. package/src/live/NotificationPreferencesCell.tsx +26 -0
  307. package/src/live/NotificationPreferencesCells.tsx +59 -0
  308. package/src/live/NotificationPreferencesGrid.tsx +129 -0
  309. package/src/live/NotificationPreferencesModel.tsx +91 -0
  310. package/src/live/NotificationPreferencesSave.ts +85 -0
  311. package/src/live/NotificationPreferencesWatch.ts +31 -0
  312. package/src/live/Prejoin.tsx +238 -0
  313. package/src/live/PrejoinMeter.tsx +26 -0
  314. package/src/live/PrejoinPreview.tsx +53 -0
  315. package/src/live/PushSoftAsk.tsx +63 -0
  316. package/src/live/TransportPicker.tsx +341 -0
  317. package/src/live/TransportPickerDetails.tsx +130 -0
  318. package/src/live/index.ts +31 -0
  319. package/src/live/notify.tsx +22 -0
  320. package/src/live/shared.tsx +110 -0
  321. package/src/parts.tsx +199 -0
  322. package/src/plugin/catalog.mjs +129 -0
  323. package/src/plugin/dtcg.mjs +79 -0
  324. package/src/plugin/icons.mjs +7 -0
  325. package/src/plugin/seed.mjs +40 -0
  326. package/src/plugin/theme-context.mjs +44 -0
  327. package/src/plugin/theme-css.mjs +143 -0
  328. package/src/plugin/theme-motion.mjs +43 -0
  329. package/src/plugin/theme-parts.d.mts +41 -0
  330. package/src/plugin/theme-parts.mjs +224 -0
  331. package/src/plugin/theme-text.mjs +93 -0
  332. package/src/plugin/theme-values.mjs +15 -0
  333. package/src/plugin/theme.d.mts +82 -0
  334. package/src/plugin/theme.mjs +316 -0
  335. package/src/schedule/Agenda.tsx +124 -0
  336. package/src/schedule/AgendaActions.ts +31 -0
  337. package/src/schedule/AgendaDay.tsx +124 -0
  338. package/src/schedule/AgendaGestures.ts +27 -0
  339. package/src/schedule/AgendaKeys.ts +52 -0
  340. package/src/schedule/AgendaModel.ts +82 -0
  341. package/src/schedule/AgendaNavigation.ts +38 -0
  342. package/src/schedule/AgendaPage.tsx +39 -0
  343. package/src/schedule/AgendaStrip.tsx +55 -0
  344. package/src/schedule/AvailabilityEditor-actions.ts +146 -0
  345. package/src/schedule/AvailabilityEditor-day.tsx +119 -0
  346. package/src/schedule/AvailabilityEditor-view.tsx +205 -0
  347. package/src/schedule/AvailabilityEditor.tsx +113 -0
  348. package/src/schedule/BookingCalendar.tsx +121 -0
  349. package/src/schedule/BookingCalendarActions.ts +85 -0
  350. package/src/schedule/BookingCalendarModel.ts +86 -0
  351. package/src/schedule/BookingCalendarParts.tsx +87 -0
  352. package/src/schedule/Calendar/AgendaView.tsx +45 -0
  353. package/src/schedule/Calendar/CalendarDialogs.tsx +105 -0
  354. package/src/schedule/Calendar/CalendarMain.tsx +47 -0
  355. package/src/schedule/Calendar/CalendarToolbar.tsx +106 -0
  356. package/src/schedule/Calendar/Column.tsx +129 -0
  357. package/src/schedule/Calendar/EventBlock.tsx +71 -0
  358. package/src/schedule/Calendar/MiniMonth.tsx +169 -0
  359. package/src/schedule/Calendar/MonthGrid.tsx +296 -0
  360. package/src/schedule/Calendar/TimeGrid.tsx +252 -0
  361. package/src/schedule/Calendar/Timeline.tsx +287 -0
  362. package/src/schedule/Calendar/ZoneChip.tsx +73 -0
  363. package/src/schedule/Calendar/calendar-shell.ts +160 -0
  364. package/src/schedule/Calendar/calendar-state.ts +30 -0
  365. package/src/schedule/Calendar/now-spans.tsx +33 -0
  366. package/src/schedule/Calendar/shared.ts +3 -0
  367. package/src/schedule/Calendar/state-actions.ts +189 -0
  368. package/src/schedule/Calendar/state-base.ts +143 -0
  369. package/src/schedule/Calendar/state-keys.ts +128 -0
  370. package/src/schedule/Calendar/time-fit.ts +84 -0
  371. package/src/schedule/Calendar.tsx +182 -0
  372. package/src/schedule/EventEditor.tsx +267 -0
  373. package/src/schedule/EventPopover.tsx +190 -0
  374. package/src/schedule/MeetingPlanner-model.ts +222 -0
  375. package/src/schedule/MeetingPlanner-view.tsx +310 -0
  376. package/src/schedule/MeetingPlanner.tsx +122 -0
  377. package/src/schedule/MoveSheet.tsx +168 -0
  378. package/src/schedule/YearView-model.ts +164 -0
  379. package/src/schedule/YearView-parts.tsx +147 -0
  380. package/src/schedule/YearView.tsx +100 -0
  381. package/src/schedule/bits.tsx +65 -0
  382. package/src/schedule/index.ts +25 -0
  383. package/src/skeleton-css.ts +4 -0
  384. package/src/styles.ts +13 -0
  385. package/src/type.css +15 -0
  386. package/src/ui.ts +41 -0
  387. package/src/use-ui.ts +10 -0
  388. package/tailwind.css +38 -0
  389. package/tokens/color.mjs +87 -0
@@ -0,0 +1,33 @@
1
+ import type { IconComponent } from '@kerf-js/veneer-icons'
2
+
3
+ export const button = (
4
+ d: { label: string; href?: string; onClick?: (() => void) | undefined },
5
+ part: string | undefined,
6
+ icon: IconComponent,
7
+ ) =>
8
+ d.href ? (
9
+ <a
10
+ href={d.href}
11
+ data-scope="button"
12
+ data-emphasis="ghost"
13
+ data-tone="neutral"
14
+ data-icon-only=""
15
+ data-part={part}
16
+ aria-label={d.label}
17
+ >
18
+ {icon({})}
19
+ </a>
20
+ ) : (
21
+ <button
22
+ type="button"
23
+ data-scope="button"
24
+ data-emphasis="ghost"
25
+ data-tone="neutral"
26
+ data-icon-only=""
27
+ data-part={part}
28
+ aria-label={d.label}
29
+ onClick={d.onClick!}
30
+ >
31
+ {icon({})}
32
+ </button>
33
+ )
@@ -0,0 +1,220 @@
1
+ import type { IconRef } from '../Icon'
2
+ import type { State } from '@kerf-js/core'
3
+ import { Icon } from '../Icon'
4
+ import { untrack, derived } from '@kerf-js/core'
5
+
6
+ /** A nav glyph: an icon, or a function that draws one. */
7
+ export type NavIcon = IconRef | (() => unknown)
8
+
9
+ /** One line of the Shell's navigation. */
10
+ export interface NavItem {
11
+ id: string
12
+ label: string
13
+ icon?: NavIcon | undefined
14
+ href?: string | undefined
15
+ onSelect?: (() => void) | undefined
16
+ count?: number | undefined
17
+ /** Spoken after the count. Default " new". */
18
+ countLabel?: string | undefined
19
+ /** One of the phone bottom bar's tabs. Default the first group's first four. */
20
+ tab?: boolean | undefined
21
+ }
22
+
23
+ /** A run of nav items under an optional label. */
24
+ export type NavGroup = { label?: string | undefined; items: NavItem[] }
25
+
26
+ /** One step of the breadcrumb. */
27
+ export type Crumb = { label: string; href?: string }
28
+
29
+ /** One line of the account menu. */
30
+ export type MenuEntry =
31
+ | {
32
+ label: string
33
+ icon?: NavIcon | undefined
34
+ href?: string
35
+ onSelect?: () => void
36
+ shortcut?: string
37
+ keys?: string
38
+ tone?: 'critical' | undefined
39
+ }
40
+ | 'separator'
41
+
42
+ /** An entry in the workspace switcher. */
43
+ export type Workspace = { id: string; name: string; initials: string; meta?: string | undefined }
44
+
45
+ /** Props for Shell. */
46
+ export interface ShellProps {
47
+ /** app (default) · focus: a wizard or checkout, with no nav. */
48
+ variant?: 'app' | 'focus' | undefined
49
+ brand?: { name: string; href?: string; mark?: unknown } | undefined
50
+ /** The phone bar's title; always shown in focus. */
51
+ title?: unknown
52
+ /** The tablet and desktop header's path. The last is the current page. */
53
+ crumbs?: Crumb[]
54
+ /** `child` puts a back button in the brand's place on a phone, for a page under another. */
55
+ depth?: 'root' | 'child'
56
+ /** Phone, depth child: the back button in the brand's place. */
57
+ back?: { label: string; href?: string; onClick?: (() => void) | undefined }
58
+ /** Focus variant: Close at the start and the step count at the end. */
59
+ close?: { label: string; href?: string; onClick?: (() => void) | undefined }
60
+ step?: unknown
61
+ command?: { label?: string | undefined; hint?: string; shortcut?: string; onOpen: () => void }
62
+ /** Header actions, between the command field and the account button. */
63
+ actions?: unknown
64
+ account?: { name: string; email?: string; initials: string; items?: MenuEntry[] } | undefined
65
+ switcher?:
66
+ | { current: string; workspaces: Workspace[]; onSwitch: (id: string) => void }
67
+ | undefined
68
+ /** The first group is the main list; the rest are saved views and the like (sidebar only, the More sheet below). */
69
+ nav?: NavGroup[] | undefined
70
+ /** The nav's pinned items, above the collapse toggle. */
71
+ foot?: NavItem[]
72
+ current?: string
73
+ /** Names the navigation landmark for screen readers. */
74
+ navLabel?: string
75
+ /** false · true: the rail · 'hidden': no rail either, the edge tab opens the sidebar. A box, so the shell can write it. */
76
+ collapsed?: State<boolean | 'hidden'> | undefined
77
+ /** Names main when `island`, or the region around a preview. */
78
+ label?: string | undefined
79
+ /** A shell inside a page (a preview, a story): main becomes a named region, as a document has one main. */
80
+ island?: boolean | undefined
81
+ dock?: unknown
82
+ /** Dialogs, toasts and palettes: outside main, in the top layer or fixed, so nothing here takes up room. */
83
+ overlays?: unknown
84
+ children?: unknown
85
+ }
86
+
87
+ export const sweepParts = () => (
88
+ <>
89
+ <span data-part="sweep-base" aria-hidden="true"></span>
90
+ <span data-part="sweep" aria-hidden="true"></span>
91
+ </>
92
+ )
93
+
94
+ export const draw = (i: NavIcon | undefined) =>
95
+ typeof i === 'function' ? i({}) : i ? <Icon name={i} /> : null
96
+
97
+ export const TABS = 4
98
+
99
+ // `plain`, not `quiet`: kerf's purge keeps a dial tier whose name is a word in the build, and a prop named quiet
100
+ // shipped [data-expression=quiet]'s tokens to every app with a Shell.
101
+ export function Item({
102
+ item,
103
+ current,
104
+ plain,
105
+ onPick,
106
+ }: {
107
+ item: NavItem
108
+ current?: string | undefined
109
+ plain?: boolean | undefined
110
+ onPick: () => void
111
+ }) {
112
+ const it = untrack(() => item)
113
+ const press = (e: MouseEvent) => {
114
+ if (!it.href) e.preventDefault()
115
+ it.onSelect?.()
116
+ onPick()
117
+ }
118
+ return (
119
+ <a
120
+ href={it.href ?? '#'}
121
+ data-part="nav-item"
122
+ data-sweep=""
123
+ aria-current={current === it.id ? 'page' : undefined}
124
+ onClick={press}
125
+ >
126
+ <span data-part="icon">
127
+ {draw(it.icon)}
128
+ {sweepParts()}
129
+ </span>
130
+ <span data-part="nav-label">{it.label}</span>
131
+ {it.count !== undefined && (
132
+ <span
133
+ data-part="nav-count"
134
+ style={plain ? 'background:none;color:var(--veneer-color-text-subtle)' : undefined}
135
+ >
136
+ {it.count}
137
+ <span data-part="nav-count-label">{it.countLabel ?? ' new'}</span>
138
+ </span>
139
+ )}
140
+ </a>
141
+ )
142
+ }
143
+
144
+ export function Crumbs({ items }: { items: Crumb[] }) {
145
+ // the first and last two stay below 1000px; the ellipsis stands for the rest
146
+ const rows = derived(() =>
147
+ items.flatMap((c, n) => {
148
+ const row = {
149
+ key: c.label,
150
+ crumb: c,
151
+ collapse: n > 0 && n < items.length - 2,
152
+ last: n === items.length - 1,
153
+ }
154
+ return n === 1 && items.length > 3
155
+ ? [
156
+ {
157
+ key: '…',
158
+ crumb: items[items.length - 3],
159
+ collapse: false,
160
+ last: false,
161
+ hidden: items.length - 3,
162
+ },
163
+ row,
164
+ ]
165
+ : [row]
166
+ }),
167
+ )
168
+ return (
169
+ <nav data-part="crumbs" data-scope="breadcrumb" aria-label="Breadcrumb">
170
+ <ol>
171
+ {rows.value.map((r) => (
172
+ <li
173
+ key={r.key}
174
+ data-part={'hidden' in r ? 'ellipsis' : undefined}
175
+ data-collapse={r.collapse ? '' : undefined}
176
+ >
177
+ {'hidden' in r ? (
178
+ <a href={r.crumb!.href ?? '#'} aria-label={`Show ${r.hidden} more`}>
179
+ …
180
+ </a>
181
+ ) : r.last ? (
182
+ <span aria-current="page">{r.crumb.label}</span>
183
+ ) : (
184
+ <a href={r.crumb.href ?? '#'}>{r.crumb.label}</a>
185
+ )}
186
+ </li>
187
+ ))}
188
+ </ol>
189
+ </nav>
190
+ )
191
+ }
192
+
193
+ export function Entry({ entry, onPick }: { entry: MenuEntry; onPick: () => void }) {
194
+ const e = untrack(() => entry)
195
+ if (e === 'separator') return <div data-part="separator" role="separator"></div>
196
+ return (
197
+ <a
198
+ data-part="item"
199
+ role="menuitem"
200
+ tabindex="-1"
201
+ style="text-decoration:none"
202
+ href={e.href ?? '#'}
203
+ data-tone={e.tone}
204
+ aria-keyshortcuts={e.keys}
205
+ onClick={(ev: MouseEvent) => {
206
+ if (!e.href) ev.preventDefault()
207
+ e.onSelect?.()
208
+ onPick()
209
+ }}
210
+ >
211
+ {draw(e.icon)}
212
+ <span data-part="item-label">{e.label}</span>
213
+ {e.shortcut && (
214
+ <kbd data-part="shortcut" aria-hidden="true">
215
+ {e.shortcut}
216
+ </kbd>
217
+ )}
218
+ </a>
219
+ )
220
+ }
@@ -0,0 +1,25 @@
1
+ import '../styles'
2
+ import '@kerf-js/veneer-core/styles/components/avatar.css'
3
+ import '@kerf-js/veneer-core/styles/components/button.css'
4
+ import '@kerf-js/veneer-core/styles/components/menu.css'
5
+ import '@kerf-js/veneer-core/styles/layout/tokens.css'
6
+ import '@kerf-js/veneer-core/styles/layout/base.css'
7
+ import '@kerf-js/veneer-core/styles/layout/shell.css'
8
+ import '@kerf-js/veneer-core/styles/layout/breadcrumb.css'
9
+ import { untrack } from '@kerf-js/core'
10
+ import type { ShellProps } from './shared'
11
+ import { shellState } from './state'
12
+ import { shellFrame } from './view'
13
+
14
+ /**
15
+ * The app shell (02 §5-6; layout.html:874-906): one element tree, three presentations, chosen by the shell's own
16
+ * width: phone a top bar and bottom tabs, tablet a rail that opens as an overlay, desktop a sidebar that collapses to
17
+ * the rail (`[`). DOM order is the focus order: skip link, brand, back, crumbs, command, actions, account, nav items,
18
+ * foot, main, dock. Parts are props, not children, so that order and the overlays' place outside main hold whatever
19
+ * an app passes. The account menu is an APG menu button; the More sheet is modal on a native <dialog>.
20
+ */
21
+ export function Shell(props: ShellProps) {
22
+ const view = shellState(untrack(() => props))
23
+ const page = <div data-part="page">{props.children}</div>
24
+ return shellFrame(view, page)
25
+ }
@@ -0,0 +1,138 @@
1
+ import { uid, shell, menu, dialog } from '@kerf-js/veneer-core'
2
+ import { derived, state, untrack } from '@kerf-js/core'
3
+ import { use } from '@kerf-js/veneer-core/kerf'
4
+ import { TABS, type ShellProps } from './shared'
5
+
6
+ function shellData(props: ShellProps) {
7
+ const base = uid('shell')
8
+ const main = `${base}-main`,
9
+ navId = `${base}-nav`,
10
+ menuId = `${base}-menu`,
11
+ sheetId = `${base}-sheet`
12
+ const focus = derived(() => (props.variant === undefined ? 'app' : props.variant) === 'focus')
13
+ const folded = untrack(() => props.collapsed) ?? state<boolean | 'hidden'>(false)
14
+ const navOpen = state(false)
15
+ const wide = state(false)
16
+ const menuOpen = state(false)
17
+ const moreOpen = state(false)
18
+ const refs = {
19
+ from: null as HTMLElement | null,
20
+ at: 'first' as 'first' | 'last',
21
+ root: undefined as HTMLDivElement | undefined,
22
+ menuEl: undefined as HTMLDivElement | undefined,
23
+ sheetEl: undefined as HTMLDialogElement | undefined,
24
+ }
25
+ const groups = derived(() => props.nav ?? [])
26
+ const primary = derived(() => {
27
+ const items = groups.value[0]?.items ?? []
28
+ const marked = items.some((i) => i.tab)
29
+ return items.map((item, n) => ({ item, tab: marked ? !!item.tab : n < TABS }))
30
+ })
31
+ const extra = derived(() => groups.value.slice(1))
32
+ const more = derived(() => [
33
+ ...primary.value.filter((p) => !p.tab).map((p) => p.item),
34
+ ...extra.value.flatMap((g) => g.items),
35
+ ...(props.foot ?? []),
36
+ ])
37
+ const workspace = derived(() =>
38
+ props.switcher?.workspaces.find((w) => w.id === props.switcher!.current),
39
+ )
40
+ const entries = derived(() => (props.account?.items ?? []).map((entry, n) => ({ entry, at: n })))
41
+ const toggle = () => {
42
+ if (wide.value) folded.value = !folded.value
43
+ else navOpen.value = !navOpen.value
44
+ }
45
+ const closeNav = () => (navOpen.value = false)
46
+ const toggleExpanded = derived(() => (wide.value ? !folded.value : navOpen.value))
47
+ const toggleLabel = derived(() =>
48
+ wide.value
49
+ ? folded.value
50
+ ? 'Expand sidebar'
51
+ : 'Collapse sidebar'
52
+ : navOpen.value
53
+ ? 'Collapse navigation'
54
+ : 'Expand navigation',
55
+ )
56
+ return {
57
+ ...shellMenu(menuOpen, refs),
58
+ props,
59
+ get navLabel() {
60
+ return props.navLabel === undefined ? 'Main' : props.navLabel
61
+ },
62
+ main,
63
+ navId,
64
+ menuId,
65
+ sheetId,
66
+ focus,
67
+ folded,
68
+ navOpen,
69
+ wide,
70
+ menuOpen,
71
+ moreOpen,
72
+ refs,
73
+ groups,
74
+ primary,
75
+ extra,
76
+ more,
77
+ workspace,
78
+ entries,
79
+ toggle,
80
+ closeNav,
81
+ toggleExpanded,
82
+ toggleLabel,
83
+ }
84
+ }
85
+
86
+ function shellMenu(
87
+ menuOpen: ReturnType<typeof state<boolean>>,
88
+ refs: { from: HTMLElement | null; at: 'first' | 'last' },
89
+ ) {
90
+ const openMenu = (e: Event, where: 'first' | 'last' = 'first') => {
91
+ refs.from = e.currentTarget as HTMLElement
92
+ refs.at = where
93
+ menuOpen.value = !menuOpen.value
94
+ }
95
+ const menuKey = (e: KeyboardEvent) => {
96
+ if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return
97
+ e.preventDefault()
98
+ if (!menuOpen.value) openMenu(e, e.key === 'ArrowUp' ? 'last' : 'first')
99
+ }
100
+ const shut = () => (menuOpen.value = false)
101
+ return { openMenu, menuKey, shut }
102
+ }
103
+
104
+ type ShellData = ReturnType<typeof shellData>
105
+ function bindShell(props: ShellProps, d: ShellData) {
106
+ use(
107
+ shell,
108
+ () => d.refs.root,
109
+ () => ({
110
+ navOpen: d.navOpen.value,
111
+ current: props.current,
112
+ onToggle: d.toggle,
113
+ onCloseNav: d.closeNav,
114
+ onWide: (w: boolean) => {
115
+ d.wide.value = w
116
+ if (w) d.navOpen.value = d.folded.value === 'hidden' && d.navOpen.value
117
+ },
118
+ onCommand: props.command?.onOpen,
119
+ }),
120
+ )
121
+ use(
122
+ menu,
123
+ () => d.refs.menuEl,
124
+ () => ({ open: d.menuOpen.value, trigger: () => d.refs.from, at: d.refs.at, onClose: d.shut }),
125
+ )
126
+ use(
127
+ dialog,
128
+ () => d.refs.sheetEl,
129
+ () => ({ open: d.moreOpen.value, onClose: () => (d.moreOpen.value = false) }),
130
+ )
131
+ }
132
+
133
+ export function shellState(props: ShellProps) {
134
+ const d = shellData(props)
135
+ bindShell(props, d)
136
+ return d
137
+ }
138
+ export type ShellView = ReturnType<typeof shellState>
@@ -0,0 +1,280 @@
1
+ import { RightIcon, XIcon, LeftIcon, PanelIcon, CheckIcon } from '@kerf-js/veneer-icons'
2
+ import { Crumbs, Item, Entry, draw } from './shared'
3
+ import type { ShellView } from './state'
4
+ import { button } from './button'
5
+ import { brand, command, accountButton, switcherButton, navMore } from './branches'
6
+
7
+ /** Render the shell in its original owner. */
8
+ export function shellFrame(view: ShellView, page: unknown) {
9
+ return (
10
+ <div
11
+ ref={(n) => (view.refs.root = n)}
12
+ data-scope="shell"
13
+ data-part="root"
14
+ data-variant={view.focus.value ? 'focus' : undefined}
15
+ data-depth={view.props.depth}
16
+ data-collapsed={
17
+ view.folded.value === 'hidden' ? 'hidden' : view.folded.value ? '' : undefined
18
+ }
19
+ data-nav-open={view.navOpen.value ? '' : undefined}
20
+ >
21
+ <a data-part="skip" href={`#${view.main}`}>
22
+ Skip to content
23
+ </a>
24
+ {view.folded.value === 'hidden' && (
25
+ <button
26
+ type="button"
27
+ data-part="edge-tab"
28
+ aria-controls={view.navId}
29
+ aria-expanded={view.navOpen.value ? 'true' : 'false'}
30
+ aria-label={view.navOpen.value ? 'Hide navigation' : 'Show navigation'}
31
+ onClick={() => (view.navOpen.value = !view.navOpen.value)}
32
+ >
33
+ <RightIcon />
34
+ </button>
35
+ )}
36
+ <div data-part="layout">
37
+ <header data-part="header">
38
+ {view.focus.value && view.props.close && button(view.props.close, undefined, XIcon)}
39
+ {!view.focus.value && view.props.back && button(view.props.back, 'back', LeftIcon)}
40
+ {!view.focus.value && view.props.brand && brand(view)}
41
+ {view.props.title !== undefined && <p data-part="title">{view.props.title}</p>}
42
+ {!view.focus.value && view.props.crumbs && <Crumbs items={view.props.crumbs} />}
43
+ <div data-part="actions">
44
+ {view.focus.value && view.props.step !== undefined && (
45
+ <span style="white-space:nowrap;font-size:var(--veneer-text-caption-size);color:var(--veneer-color-text-subtle)">
46
+ {view.props.step}
47
+ </span>
48
+ )}
49
+ {!view.focus.value && view.props.command && command(view)}
50
+ {!view.focus.value && view.props.actions}
51
+ {!view.focus.value && view.props.account && accountButton(view)}
52
+ </div>
53
+ </header>
54
+ {!view.focus.value && shellNav(view)}
55
+ {view.props.island ? islandMain(view, page) : standardMain(view, page)}
56
+ </div>
57
+ <div
58
+ data-part="scrim"
59
+ data-for="nav"
60
+ hidden={!view.navOpen.value}
61
+ onClick={view.closeNav}
62
+ ></div>
63
+ {!view.focus.value && view.props.account && shellAccount(view)}
64
+ {!view.focus.value && shellMore(view)}
65
+ <div data-scope="announcer" role="status" aria-live="polite"></div>
66
+ {view.props.overlays}
67
+ </div>
68
+ )
69
+ }
70
+
71
+ function shellNav(view: ShellView) {
72
+ return (
73
+ <nav
74
+ data-part="nav"
75
+ aria-label={view.navLabel}
76
+ id={view.navId}
77
+ onClick={(e: MouseEvent) => {
78
+ if ((e.target as Element).closest?.('a')) view.closeNav()
79
+ }}
80
+ >
81
+ {view.groups.value[0]?.label !== undefined && (
82
+ <p data-part="nav-group" id={`${view.navId}-g`}>
83
+ {view.groups.value[0].label}
84
+ </p>
85
+ )}
86
+ {view.props.switcher && switcherButton(view)}
87
+ <ul
88
+ data-part="nav-list"
89
+ aria-labelledby={view.groups.value[0]?.label !== undefined ? `${view.navId}-g` : undefined}
90
+ >
91
+ {view.primary.value.map((p) => (
92
+ <li key={p.item.id} data-tab={p.tab ? '' : undefined}>
93
+ <Item item={p.item} current={view.props.current} onPick={view.closeNav} />
94
+ </li>
95
+ ))}
96
+ {view.more.value.length > 0 && navMore(view)}
97
+ </ul>
98
+ {view.extra.value.length > 0 && shellNavExtra(view)}
99
+ <div data-part="nav-foot">
100
+ {view.props.foot?.map((i) => (
101
+ <Item key={i.id} item={i} current={view.props.current} onPick={view.closeNav} />
102
+ ))}
103
+ <button
104
+ type="button"
105
+ data-part="nav-toggle"
106
+ aria-controls={view.navId}
107
+ aria-expanded={view.toggleExpanded.value ? 'true' : 'false'}
108
+ aria-label={view.toggleLabel.value}
109
+ aria-keyshortcuts="["
110
+ onClick={view.toggle}
111
+ >
112
+ <PanelIcon />
113
+ </button>
114
+ </div>
115
+ </nav>
116
+ )
117
+ }
118
+
119
+ function shellNavExtra(view: ShellView) {
120
+ return (
121
+ <div data-part="nav-extra">
122
+ {view.extra.value.map((g) => (
123
+ <div key={g.label}>
124
+ <p data-part="nav-group">{g.label}</p>
125
+ <ul data-part="nav-list" aria-label={g.label}>
126
+ {g.items.map((i) => (
127
+ <li key={i.id}>
128
+ <Item item={i} current={view.props.current} plain onPick={view.closeNav} />
129
+ </li>
130
+ ))}
131
+ </ul>
132
+ </div>
133
+ ))}
134
+ </div>
135
+ )
136
+ }
137
+
138
+ function shellAccount(view: ShellView) {
139
+ return (
140
+ <aside aria-label="Account" hidden={!view.menuOpen.value}>
141
+ <div
142
+ ref={(n) => (view.refs.menuEl = n)}
143
+ data-scope="menu"
144
+ data-part="menu"
145
+ role="menu"
146
+ id={view.menuId}
147
+ aria-label={`Account: ${view.props.account!.name}${view.props.account!.email ? `, ${view.props.account!.email}` : ''}`}
148
+ hidden={!view.menuOpen.value}
149
+ >
150
+ <div aria-hidden="true" style="display:flex;gap:10px;align-items:center;padding:10px">
151
+ <span data-scope="avatar">{view.props.account!.initials}</span>
152
+ <div>
153
+ <b style="display:block;font-weight:600">{view.props.account!.name}</b>
154
+ <span style="font-size:var(--veneer-text-caption-size);color:var(--veneer-color-text-subtle)">
155
+ {view.props.account!.email}
156
+ </span>
157
+ </div>
158
+ </div>
159
+ {view.props.switcher && (
160
+ <>
161
+ <div data-part="separator" role="separator"></div>
162
+ <div role="group" aria-label="Workspace">
163
+ <p data-part="group-label" aria-hidden="true" style="margin:0">
164
+ Workspace
165
+ </p>
166
+ {view.props.switcher.workspaces.map((w) => (
167
+ <button
168
+ key={w.id}
169
+ type="button"
170
+ data-part="item"
171
+ role="menuitemradio"
172
+ tabindex="-1"
173
+ aria-checked={w.id === view.props.switcher!.current ? 'true' : 'false'}
174
+ style="inline-size:100%;border:0;background:none;font:inherit;text-align:start"
175
+ onClick={() => {
176
+ view.props.switcher!.onSwitch(w.id)
177
+ view.shut()
178
+ view.refs.from?.focus()
179
+ }}
180
+ >
181
+ <span data-scope="avatar" data-shape="square" data-size="sm" aria-hidden="true">
182
+ {w.initials}
183
+ </span>
184
+ <span data-part="item-label">{w.name}</span>
185
+ <span data-part="indicator">
186
+ <CheckIcon />
187
+ </span>
188
+ </button>
189
+ ))}
190
+ </div>
191
+ </>
192
+ )}
193
+ {view.entries.value.map((x) => (
194
+ <Entry
195
+ key={x.at}
196
+ entry={x.entry}
197
+ onPick={() => {
198
+ view.shut()
199
+ view.refs.from?.focus()
200
+ }}
201
+ />
202
+ ))}
203
+ </div>
204
+ </aside>
205
+ )
206
+ }
207
+
208
+ function shellMore(view: ShellView) {
209
+ return (
210
+ <dialog
211
+ ref={(n) => (view.refs.sheetEl = n)}
212
+ data-part="sheet"
213
+ aria-labelledby={view.sheetId}
214
+ hidden={!view.moreOpen.value}
215
+ style="margin:0;max-inline-size:none"
216
+ >
217
+ <div style="display:flex;align-items:center;justify-content:space-between">
218
+ <p data-part="title" id={view.sheetId} style="margin:0;font-weight:600">
219
+ More
220
+ </p>
221
+ <button
222
+ type="button"
223
+ data-scope="button"
224
+ data-emphasis="ghost"
225
+ data-tone="neutral"
226
+ data-icon-only=""
227
+ aria-label="Close"
228
+ data-close=""
229
+ autofocus
230
+ >
231
+ <XIcon />
232
+ </button>
233
+ </div>
234
+ <div data-scope="menu">
235
+ {view.more.value.map((i) => (
236
+ <a
237
+ key={i.id}
238
+ data-part="item"
239
+ style="text-decoration:none"
240
+ href={i.href ?? '#'}
241
+ aria-current={view.props.current === i.id ? 'page' : undefined}
242
+ onClick={(e: MouseEvent) => {
243
+ if (!i.href) e.preventDefault()
244
+ i.onSelect?.()
245
+ view.moreOpen.value = false
246
+ }}
247
+ >
248
+ {draw(i.icon)}
249
+ <span data-part="item-label">{i.label}</span>
250
+ {i.count !== undefined && <span data-part="shortcut">{i.count}</span>}
251
+ </a>
252
+ ))}
253
+ </div>
254
+ </dialog>
255
+ )
256
+ }
257
+
258
+ function islandMain(view: ShellView, page: unknown) {
259
+ return (
260
+ <div
261
+ data-part="main"
262
+ id={view.main}
263
+ tabindex="-1"
264
+ role="region"
265
+ aria-label={view.props.label ?? 'Page content'}
266
+ >
267
+ {page}
268
+ {view.props.dock !== undefined && <div data-part="dock">{view.props.dock}</div>}
269
+ </div>
270
+ )
271
+ }
272
+
273
+ function standardMain(view: ShellView, page: unknown) {
274
+ return (
275
+ <main data-part="main" id={view.main} tabindex="-1">
276
+ {page}
277
+ {view.props.dock !== undefined && <div data-part="dock">{view.props.dock}</div>}
278
+ </main>
279
+ )
280
+ }