@alepha/ui 0.35.0 → 0.36.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 (264) hide show
  1. package/README.md +54 -1
  2. package/dist/account/AccountBrand.d.ts +10 -3
  3. package/dist/account/AccountBrand.d.ts.map +1 -1
  4. package/dist/account/AccountBrand.js +12 -6
  5. package/dist/account/AccountBrand.js.map +1 -1
  6. package/dist/account/AccountLayout.d.ts.map +1 -1
  7. package/dist/account/AccountLayout.js +1 -1
  8. package/dist/account/AccountLayout.js.map +1 -1
  9. package/dist/admin/AdminUserDetail.d.ts +3 -3
  10. package/dist/admin/AdminUserDetail.js +3 -3
  11. package/dist/admin/AdminUserDetail.js.map +1 -1
  12. package/dist/ai/AiChat.d.ts +36 -6
  13. package/dist/ai/AiChat.d.ts.map +1 -1
  14. package/dist/ai/AiChat.js +101 -63
  15. package/dist/ai/AiChat.js.map +1 -1
  16. package/dist/ai/AiChatComposer.d.ts +22 -0
  17. package/dist/ai/AiChatComposer.d.ts.map +1 -0
  18. package/dist/ai/AiChatComposer.js +75 -0
  19. package/dist/ai/AiChatComposer.js.map +1 -0
  20. package/dist/ai/AiChatConfirmCard.d.ts +5 -2
  21. package/dist/ai/AiChatConfirmCard.d.ts.map +1 -1
  22. package/dist/ai/AiChatConfirmCard.js +7 -6
  23. package/dist/ai/AiChatConfirmCard.js.map +1 -1
  24. package/dist/ai/AiChatConfirmFields.d.ts +9 -0
  25. package/dist/ai/AiChatConfirmFields.d.ts.map +1 -0
  26. package/dist/ai/AiChatConfirmFields.js +45 -0
  27. package/dist/ai/AiChatConfirmFields.js.map +1 -0
  28. package/dist/ai/AiChatEmpty.d.ts +26 -0
  29. package/dist/ai/AiChatEmpty.d.ts.map +1 -0
  30. package/dist/ai/AiChatEmpty.js +47 -0
  31. package/dist/ai/AiChatEmpty.js.map +1 -0
  32. package/dist/ai/AiChatHistory.d.ts +3 -2
  33. package/dist/ai/AiChatHistory.d.ts.map +1 -1
  34. package/dist/ai/AiChatHistory.js +51 -22
  35. package/dist/ai/AiChatHistory.js.map +1 -1
  36. package/dist/ai/AiChatMessage.d.ts +14 -0
  37. package/dist/ai/AiChatMessage.d.ts.map +1 -1
  38. package/dist/ai/AiChatMessage.js +20 -12
  39. package/dist/ai/AiChatMessage.js.map +1 -1
  40. package/dist/ai/index.d.ts +3 -0
  41. package/dist/ai/index.d.ts.map +1 -1
  42. package/dist/ai/index.js +4 -1
  43. package/dist/ai/useAiChat.d.ts +4 -0
  44. package/dist/ai/useAiChat.d.ts.map +1 -1
  45. package/dist/ai/useAiChat.js +15 -1
  46. package/dist/ai/useAiChat.js.map +1 -1
  47. package/dist/core/Sidebar.js +2 -2
  48. package/dist/core/Sidebar.js.map +1 -1
  49. package/dist/core/index.d.ts +1 -0
  50. package/dist/core/index.d.ts.map +1 -1
  51. package/dist/core/index.js +2 -1
  52. package/dist/core/useToast.d.ts +22 -1
  53. package/dist/core/useToast.d.ts.map +1 -1
  54. package/dist/core/useToast.js +4 -1
  55. package/dist/core/useToast.js.map +1 -1
  56. package/dist/core/useUndoable.d.ts +93 -0
  57. package/dist/core/useUndoable.d.ts.map +1 -0
  58. package/dist/core/useUndoable.js +172 -0
  59. package/dist/core/useUndoable.js.map +1 -0
  60. package/dist/i18n/fr/uiFr.d.ts.map +1 -1
  61. package/dist/i18n/fr/uiFr.js +50 -1
  62. package/dist/i18n/fr/uiFr.js.map +1 -1
  63. package/dist/markdown/MarkdownView.d.ts +15 -0
  64. package/dist/markdown/MarkdownView.d.ts.map +1 -1
  65. package/dist/markdown/MarkdownView.js +4 -1
  66. package/dist/markdown/MarkdownView.js.map +1 -1
  67. package/dist/organizations/useInviteOrganizationMember.d.ts +2 -2
  68. package/dist/organizations/useInviteOrganizationMember.js.map +1 -1
  69. package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
  70. package/dist/shell/AppShellSidebarNavItem.js +25 -2
  71. package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
  72. package/dist/shell/PlateTabBar.d.ts.map +1 -1
  73. package/dist/shell/PlateTabBar.js +2 -2
  74. package/dist/shell/PlateTabBar.js.map +1 -1
  75. package/dist/shell/SidebarBackHeader.d.ts +35 -0
  76. package/dist/shell/SidebarBackHeader.d.ts.map +1 -0
  77. package/dist/shell/SidebarBackHeader.js +34 -0
  78. package/dist/shell/SidebarBackHeader.js.map +1 -0
  79. package/dist/shell/appShellNav.d.ts +30 -0
  80. package/dist/shell/appShellNav.d.ts.map +1 -1
  81. package/dist/shell/appShellNav.js.map +1 -1
  82. package/dist/shell/index.d.ts +2 -1
  83. package/dist/shell/index.d.ts.map +1 -1
  84. package/dist/shell/index.js +2 -1
  85. package/dist/swagger/$uiSwagger.d.ts +75 -0
  86. package/dist/swagger/$uiSwagger.d.ts.map +1 -0
  87. package/dist/swagger/$uiSwagger.js +51 -0
  88. package/dist/swagger/$uiSwagger.js.map +1 -0
  89. package/dist/swagger/OpenApiSpec.d.ts +113 -0
  90. package/dist/swagger/OpenApiSpec.d.ts.map +1 -0
  91. package/dist/swagger/OpenApiSpec.js +186 -0
  92. package/dist/swagger/OpenApiSpec.js.map +1 -0
  93. package/dist/swagger/SwaggerAccessBadge.d.ts +16 -0
  94. package/dist/swagger/SwaggerAccessBadge.d.ts.map +1 -0
  95. package/dist/swagger/SwaggerAccessBadge.js +40 -0
  96. package/dist/swagger/SwaggerAccessBadge.js.map +1 -0
  97. package/dist/swagger/SwaggerAlephaMeta.d.ts +11 -0
  98. package/dist/swagger/SwaggerAlephaMeta.d.ts.map +1 -0
  99. package/dist/swagger/SwaggerAlephaMeta.js +103 -0
  100. package/dist/swagger/SwaggerAlephaMeta.js.map +1 -0
  101. package/dist/swagger/SwaggerCredentials.d.ts +11 -0
  102. package/dist/swagger/SwaggerCredentials.d.ts.map +1 -0
  103. package/dist/swagger/SwaggerCredentials.js +35 -0
  104. package/dist/swagger/SwaggerCredentials.js.map +1 -0
  105. package/dist/swagger/SwaggerExplorer.d.ts +31 -0
  106. package/dist/swagger/SwaggerExplorer.d.ts.map +1 -0
  107. package/dist/swagger/SwaggerExplorer.js +156 -0
  108. package/dist/swagger/SwaggerExplorer.js.map +1 -0
  109. package/dist/swagger/SwaggerMethodBadge.d.ts +10 -0
  110. package/dist/swagger/SwaggerMethodBadge.d.ts.map +1 -0
  111. package/dist/swagger/SwaggerMethodBadge.js +27 -0
  112. package/dist/swagger/SwaggerMethodBadge.js.map +1 -0
  113. package/dist/swagger/SwaggerNav.d.ts +16 -0
  114. package/dist/swagger/SwaggerNav.d.ts.map +1 -0
  115. package/dist/swagger/SwaggerNav.js +63 -0
  116. package/dist/swagger/SwaggerNav.js.map +1 -0
  117. package/dist/swagger/SwaggerOperationView.d.ts +22 -0
  118. package/dist/swagger/SwaggerOperationView.d.ts.map +1 -0
  119. package/dist/swagger/SwaggerOperationView.js +89 -0
  120. package/dist/swagger/SwaggerOperationView.js.map +1 -0
  121. package/dist/swagger/SwaggerParameters.d.ts +11 -0
  122. package/dist/swagger/SwaggerParameters.d.ts.map +1 -0
  123. package/dist/swagger/SwaggerParameters.js +80 -0
  124. package/dist/swagger/SwaggerParameters.js.map +1 -0
  125. package/dist/swagger/SwaggerRequestBuilder.d.ts +83 -0
  126. package/dist/swagger/SwaggerRequestBuilder.d.ts.map +1 -0
  127. package/dist/swagger/SwaggerRequestBuilder.js +231 -0
  128. package/dist/swagger/SwaggerRequestBuilder.js.map +1 -0
  129. package/dist/swagger/SwaggerResponseView.d.ts +25 -0
  130. package/dist/swagger/SwaggerResponseView.d.ts.map +1 -0
  131. package/dist/swagger/SwaggerResponseView.js +94 -0
  132. package/dist/swagger/SwaggerResponseView.js.map +1 -0
  133. package/dist/swagger/SwaggerResponses.d.ts +12 -0
  134. package/dist/swagger/SwaggerResponses.d.ts.map +1 -0
  135. package/dist/swagger/SwaggerResponses.js +75 -0
  136. package/dist/swagger/SwaggerResponses.js.map +1 -0
  137. package/dist/swagger/SwaggerSchemaView.d.ts +19 -0
  138. package/dist/swagger/SwaggerSchemaView.d.ts.map +1 -0
  139. package/dist/swagger/SwaggerSchemaView.js +98 -0
  140. package/dist/swagger/SwaggerSchemaView.js.map +1 -0
  141. package/dist/swagger/SwaggerSection.d.ts +14 -0
  142. package/dist/swagger/SwaggerSection.d.ts.map +1 -0
  143. package/dist/swagger/SwaggerSection.js +23 -0
  144. package/dist/swagger/SwaggerSection.js.map +1 -0
  145. package/dist/swagger/SwaggerTryIt.d.ts +31 -0
  146. package/dist/swagger/SwaggerTryIt.d.ts.map +1 -0
  147. package/dist/swagger/SwaggerTryIt.js +68 -0
  148. package/dist/swagger/SwaggerTryIt.js.map +1 -0
  149. package/dist/swagger/SwaggerTryItForm.d.ts +20 -0
  150. package/dist/swagger/SwaggerTryItForm.d.ts.map +1 -0
  151. package/dist/swagger/SwaggerTryItForm.js +52 -0
  152. package/dist/swagger/SwaggerTryItForm.js.map +1 -0
  153. package/dist/swagger/index.d.ts +29 -0
  154. package/dist/swagger/index.d.ts.map +1 -0
  155. package/dist/swagger/index.js +18 -0
  156. package/dist/swagger/useSwaggerAccess.d.ts +24 -0
  157. package/dist/swagger/useSwaggerAccess.d.ts.map +1 -0
  158. package/dist/swagger/useSwaggerAccess.js +33 -0
  159. package/dist/swagger/useSwaggerAccess.js.map +1 -0
  160. package/dist/table/DataTable.d.ts.map +1 -1
  161. package/dist/table/DataTable.js +50 -13
  162. package/dist/table/DataTable.js.map +1 -1
  163. package/dist/table/DataTableBody.d.ts +18 -1
  164. package/dist/table/DataTableBody.d.ts.map +1 -1
  165. package/dist/table/DataTableBody.js +83 -58
  166. package/dist/table/DataTableBody.js.map +1 -1
  167. package/dist/table/DataTableRowActionsInline.d.ts +17 -0
  168. package/dist/table/DataTableRowActionsInline.d.ts.map +1 -0
  169. package/dist/table/DataTableRowActionsInline.js +45 -0
  170. package/dist/table/DataTableRowActionsInline.js.map +1 -0
  171. package/dist/table/PermissionMatrix.d.ts +4 -4
  172. package/dist/table/PermissionMatrix.js +2 -2
  173. package/dist/table/PermissionMatrix.js.map +1 -1
  174. package/dist/table/dataTableBaseProps.d.ts +31 -0
  175. package/dist/table/dataTableBaseProps.d.ts.map +1 -1
  176. package/dist/table/dataTableTypes.d.ts +16 -2
  177. package/dist/table/dataTableTypes.d.ts.map +1 -1
  178. package/dist/table/useDataTableData.d.ts +3 -0
  179. package/dist/table/useDataTableData.d.ts.map +1 -1
  180. package/dist/table/useDataTableData.js +9 -2
  181. package/dist/table/useDataTableData.js.map +1 -1
  182. package/dist/table/useDataTableRefresh.d.ts +1 -0
  183. package/dist/table/useDataTableRefresh.d.ts.map +1 -1
  184. package/dist/table/useDataTableRefresh.js +13 -1
  185. package/dist/table/useDataTableRefresh.js.map +1 -1
  186. package/dist/table/useOptimisticRows.d.ts +64 -0
  187. package/dist/table/useOptimisticRows.d.ts.map +1 -0
  188. package/dist/table/useOptimisticRows.js +185 -0
  189. package/dist/table/useOptimisticRows.js.map +1 -0
  190. package/dist/table/useRowMotion.d.ts +27 -0
  191. package/dist/table/useRowMotion.d.ts.map +1 -0
  192. package/dist/table/useRowMotion.js +112 -0
  193. package/dist/table/useRowMotion.js.map +1 -0
  194. package/docs/packages-alepha-ui-core.md +1 -0
  195. package/docs/packages-alepha-ui-overview.md +53 -1
  196. package/docs/packages-alepha-ui-swagger.md +35 -0
  197. package/package.json +11 -3
  198. package/src/account/AccountBrand.tsx +25 -6
  199. package/src/account/AccountLayout.tsx +5 -1
  200. package/src/admin/AdminUserDetail.tsx +3 -3
  201. package/src/admin/__tests__/AdminUserDetail.spec.ts +2 -2
  202. package/src/ai/AiChat.tsx +160 -82
  203. package/src/ai/AiChatComposer.tsx +117 -0
  204. package/src/ai/AiChatConfirmCard.tsx +7 -5
  205. package/src/ai/AiChatConfirmFields.tsx +65 -0
  206. package/src/ai/AiChatEmpty.tsx +73 -0
  207. package/src/ai/AiChatHistory.tsx +64 -28
  208. package/src/ai/AiChatMessage.tsx +41 -14
  209. package/src/ai/__tests__/AiChat.browser.spec.tsx +146 -5
  210. package/src/ai/index.ts +3 -0
  211. package/src/ai/useAiChat.ts +18 -0
  212. package/src/core/Sidebar.tsx +2 -2
  213. package/src/core/__tests__/useUndoable.browser.spec.tsx +201 -0
  214. package/src/core/index.ts +7 -0
  215. package/src/core/useToast.tsx +30 -2
  216. package/src/core/useUndoable.tsx +285 -0
  217. package/src/form/__tests__/ControlChoices.browser.spec.tsx +2 -1
  218. package/src/i18n/fr/uiFr.ts +52 -0
  219. package/src/markdown/MarkdownView.tsx +27 -9
  220. package/src/organizations/useInviteOrganizationMember.ts +2 -2
  221. package/src/shell/AppShellSidebarNavItem.tsx +51 -1
  222. package/src/shell/PlateTabBar.tsx +8 -2
  223. package/src/shell/SidebarBackHeader.tsx +58 -0
  224. package/src/shell/appShellNav.tsx +31 -0
  225. package/src/shell/index.ts +5 -1
  226. package/src/swagger/$uiSwagger.tsx +95 -0
  227. package/src/swagger/OpenApiSpec.ts +300 -0
  228. package/src/swagger/SwaggerAccessBadge.tsx +64 -0
  229. package/src/swagger/SwaggerAlephaMeta.tsx +141 -0
  230. package/src/swagger/SwaggerCredentials.tsx +44 -0
  231. package/src/swagger/SwaggerExplorer.tsx +208 -0
  232. package/src/swagger/SwaggerMethodBadge.tsx +32 -0
  233. package/src/swagger/SwaggerNav.tsx +92 -0
  234. package/src/swagger/SwaggerOperationView.tsx +102 -0
  235. package/src/swagger/SwaggerParameters.tsx +74 -0
  236. package/src/swagger/SwaggerRequestBuilder.ts +331 -0
  237. package/src/swagger/SwaggerResponseView.tsx +107 -0
  238. package/src/swagger/SwaggerResponses.tsx +83 -0
  239. package/src/swagger/SwaggerSchemaView.tsx +134 -0
  240. package/src/swagger/SwaggerSection.tsx +29 -0
  241. package/src/swagger/SwaggerTryIt.tsx +95 -0
  242. package/src/swagger/SwaggerTryItForm.tsx +87 -0
  243. package/src/swagger/__tests__/$uiSwagger.spec.ts +52 -0
  244. package/src/swagger/__tests__/OpenApiSpec.spec.ts +139 -0
  245. package/src/swagger/__tests__/SwaggerAccess.browser.spec.tsx +124 -0
  246. package/src/swagger/__tests__/SwaggerOperationView.browser.spec.tsx +194 -0
  247. package/src/swagger/__tests__/SwaggerRequestBuilder.spec.ts +250 -0
  248. package/src/swagger/index.ts +75 -0
  249. package/src/swagger/useSwaggerAccess.ts +59 -0
  250. package/src/table/DataTable.tsx +85 -34
  251. package/src/table/DataTableBody.tsx +51 -7
  252. package/src/table/DataTableRowActionsInline.tsx +80 -0
  253. package/src/table/PermissionMatrix.tsx +4 -4
  254. package/src/table/__tests__/DataTableEmptyState.browser.spec.tsx +1 -1
  255. package/src/table/__tests__/DataTableListMode.browser.spec.tsx +174 -0
  256. package/src/table/__tests__/DataTableOptimistic.browser.spec.tsx +173 -0
  257. package/src/table/__tests__/PermissionMatrix.browser.spec.tsx +2 -2
  258. package/src/table/__tests__/queryFilters.spec.ts +10 -12
  259. package/src/table/dataTableBaseProps.ts +31 -0
  260. package/src/table/dataTableTypes.ts +16 -2
  261. package/src/table/useDataTableData.ts +18 -2
  262. package/src/table/useDataTableRefresh.ts +26 -2
  263. package/src/table/useOptimisticRows.ts +265 -0
  264. package/src/table/useRowMotion.ts +152 -0
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownView.js","names":["pre"],"sources":["../../src/markdown/MarkdownView.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport \"./MarkdownView.css\";\nimport { lazy, Suspense } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { DiagramErrorBoundary } from \"./diagram/DiagramErrorBoundary.tsx\";\nimport { rehypeHighlight } from \"./rehypeHighlight.ts\";\nimport { remarkSpoiler } from \"./remarkSpoiler.ts\";\nimport { SpoilerSpan } from \"./SpoilerSpan.tsx\";\n\n/**\n * Both parsers, both layouts (`graphre` for the flowchart, arithmetic for\n * the sequence diagram) and both emitters, pulled in ONLY when a document\n * actually contains a mermaid fence.\n *\n * This is the constraint the whole diagram layer exists under: a document\n * with no diagram must pay nothing at all. One with a diagram pays one\n * chunk once, then it is cached. Measured on 2026-08-28 with both diagram\n * types in it: 64.5 kB raw, **22.2 kB gzip**, 19.4 kB brotli - against\n * 17.95 kB gzip when it drew flowcharts only. If it ever passes ~26 kB,\n * split the two pipelines into two chunks so a flowchart-only document\n * stops paying for the sequence one.\n *\n * ⚠️ A lazy import a bundler decides to inline fails silently: the feature\n * still works and the cost moves into the entry chunk. After changing this,\n * build an app that renders a `MarkdownView` (Lore does, in\n * github.com/alepha-dev/lore) and confirm, from its directory, that the\n * diagram code is in a chunk of its own and the entry has none of it:\n *\n * yarn alepha build\n * grep -rl 'addBorderSegments\\|sequenceDiagram' dist/public/\n */\nconst MermaidFence = lazy(() => import(\"./diagram/MermaidFence.tsx\"));\n\nexport interface MarkdownViewProps {\n content: string;\n /**\n * Extra classes for the prose root, merged after the defaults so a caller\n * can set its own reading face or measure. The defaults it overrides are\n * `text-sm leading-relaxed` — a surface that sets prose in a display serif\n * needs both, and no parent wrapper can supply them, since they sit on\n * this element rather than being inherited.\n */\n className?: string;\n}\n\n/**\n * Renders markdown as formatted prose.\n *\n * ## Diagrams\n *\n * A ` ```mermaid ` fence containing a **`flowchart`** or a\n * **`sequenceDiagram`** is drawn as an SVG diagram instead of a code block,\n * themed from the app's own CSS variables so dark mode needs no second\n * palette. The renderer is in-house: only flowchart layout is imported\n * (`graphre`, dagre in TypeScript, ~15.5 kB gzip), and the whole thing is\n * one lazy chunk pulled in only when a document actually contains a fence,\n * so a document with no diagram pays nothing.\n *\n * The flowchart subset is `flowchart TD|TB|LR|RL|BT`; the four node shapes\n * `[rect]` `(rounded)` `{diamond}` `((circle))`, with every other mermaid\n * bracket pair consumed and mapped onto them; edges `-->` `---` `-.->`\n * `==>` `<-->` with labels in both the `-->|text|` and `-- text -->` forms;\n * chains, `&` fans, `<br/>` line breaks and nested `subgraph`.\n *\n * The sequence subset is participants and actors, the eight arrow forms,\n * notes, `autonumber`, self-messages and the `alt` / `else` / `opt` /\n * `loop` fragment boxes. Activation bars are ignored. A wide sequence\n * diagram keeps its natural size in a scroll frame rather than shrinking\n * into the prose column.\n *\n * **Everything else degrades to the code block, silently.**\n * `classDiagram`, `gantt` and mindmaps are not drawn, `style` / `classDef`\n * are ignored, and a parse failure, a refused construct or a diagram past\n * its cap renders the plain fence rather than an error. Agents write\n * invalid mermaid, and a red box in the middle of a document is worse than\n * a grey fence. See `packages/@alepha/ui/DOC.md` for the full table.\n *\n * ## Spoilers\n *\n * `||text||` renders as a covered box that reveals on click, on Enter or on\n * Space, Discord's syntax and Discord's behaviour. Inline markdown inside it\n * survives, a code span or a fence keeps its pipes literally, and an\n * unterminated `||` renders as the two characters the author typed rather\n * than swallowing the rest of the paragraph.\n *\n * ⚠️ **It is not a security feature.** The text is in the DOM from the first\n * paint, in the raw markdown, in an export, over MCP and in any search\n * snippet. It hides a plot point from a reader's eye and nothing more.\n *\n * ## Raw HTML\n *\n * No raw HTML is ever rendered as markup: react-markdown's default is to\n * escape a raw node to text, and this component deliberately mounts no\n * plugin that changes that. A narrow `rehypeSafeImg` plugin used to promote\n * a lone `<img …>` — the one thing MDXEditor emitted for a *resized* image —\n * and was deleted along with the editor that produced it, since nothing\n * writes that markup anymore.\n *\n * Do not reach for `rehype-raw` to bring the capability back: this renders\n * content authored by one user to another, so every raw tag becoming live\n * markup turns every markdown surface in every app into an injection point.\n */\nexport const MarkdownView = (props: MarkdownViewProps) => {\n return (\n <div\n // `data-slot`, matching every other block here, so a host page can\n // reach the prose root without a wrapper class. Lore's folio\n // document uses it to make this inherit the reading size instead\n // of the `text-sm` default below.\n data-slot=\"markdown-view\"\n className={`max-w-none text-sm leading-relaxed ${props.className ?? \"\"}`}\n >\n <ReactMarkdown\n // ⚠️ `remarkSpoiler` runs AFTER `remarkGfm`, and the order is\n // load-bearing: by then a `| a | b |` row is a table with cells, so\n // the pipes are structure and the spoiler walk never sees them as\n // text. Reversed, every two-column table would be a spoiler.\n remarkPlugins={[remarkGfm, remarkSpoiler]}\n rehypePlugins={[\n // `plainText` claims the fence BEFORE highlighting runs: hljs would\n // otherwise tokenise the diagram source, and the fallback would be a\n // soup of spans instead of the text the author wrote.\n //\n // The plugin is the markdown module's own, over lowlight with the\n // fifteen grammars in `HIGHLIGHT_LANGUAGES`: `rehype-highlight`\n // kept all 37 of lowlight's `common` set in the chunk whatever it\n // was given. A fence in any other language renders plain.\n [rehypeHighlight, { detect: true, plainText: [\"mermaid\"] }],\n ]}\n components={{\n h1: ({ children }) => (\n <h1 className=\"mt-6 mb-3 text-2xl font-semibold tracking-tight\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"mt-6 mb-2 text-xl font-semibold tracking-tight\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"mt-4 mb-2 text-base font-semibold\">{children}</h3>\n ),\n p: ({ children }) => <p className=\"my-3\">{children}</p>,\n ul: ({ children }) => (\n <ul className=\"my-3 list-disc space-y-1 pl-5\">{children}</ul>\n ),\n ol: ({ children }) => (\n <ol className=\"my-3 list-decimal space-y-1 pl-5\">{children}</ol>\n ),\n li: ({ children }) => <li className=\"pl-1\">{children}</li>,\n a: ({ href, children }) => (\n <a\n href={href}\n className=\"text-primary decoration-primary/50 hover:decoration-primary underline underline-offset-4\"\n >\n {children}\n </a>\n ),\n code: ({ children, className }) => {\n const isBlock =\n className?.includes(\"language-\") || className?.includes(\"hljs\");\n if (isBlock) {\n return <code className={`${className} text-xs`}>{children}</code>;\n }\n return (\n <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-[0.85em]\">\n {children}\n </code>\n );\n },\n pre: ({ children, node }) => {\n const block = (\n <pre className=\"border-border my-4 overflow-auto rounded-md border bg-transparent p-3 text-xs\">\n {children}\n </pre>\n );\n const source = mermaidSource(node);\n if (!source) return block;\n return (\n <DiagramErrorBoundary fallback={block}>\n {/*\n The loading state IS the code block: the fence is already on\n screen, and swapping it for the diagram when the chunk lands\n costs no spinner and no second layout.\n */}\n <Suspense fallback={block}>\n <MermaidFence source={source} fallback={block} />\n </Suspense>\n </DiagramErrorBoundary>\n );\n },\n // The only `<span>` this renderer ever produces is a spoiler's, and\n // the only thing that marks one is the `data-spoiler` property\n // `remarkSpoiler` puts there.\n //\n // ⚠️ The cast is not laziness: react-markdown types a span's props\n // as `HTMLAttributes<HTMLSpanElement>`, which PERMITS writing a\n // `data-*` attribute in JSX and does not declare one for reading.\n // The alternative - a custom `hName` with its own `components` key -\n // needs a cast into `components`, whose type is keyed on intrinsic\n // elements, so it buys nothing (the same note `mermaidSource`\n // already carries).\n span: ({ children, ...rest }) => {\n const marked = (rest as { \"data-spoiler\"?: unknown })[\n \"data-spoiler\"\n ];\n if (marked) return <SpoilerSpan>{children}</SpoilerSpan>;\n return <span {...rest}>{children}</span>;\n },\n blockquote: ({ children }) => (\n <blockquote className=\"border-muted-foreground/30 my-3 border-l-2 pl-4 italic\">\n {children}\n </blockquote>\n ),\n hr: () => <hr className=\"border-border my-6\" />,\n table: ({ children }) => (\n <table className=\"my-4 border-collapse text-xs\">{children}</table>\n ),\n th: ({ children }) => (\n <th className=\"border-border border px-2 py-1 text-left font-medium\">\n {children}\n </th>\n ),\n td: ({ children }) => (\n <td className=\"border-border border px-2 py-1\">{children}</td>\n ),\n }}\n >\n {props.content}\n </ReactMarkdown>\n </div>\n );\n};\n\n/**\n * The text of a ` ```mermaid ` fence, or `undefined` for every other `<pre>`.\n *\n * Reads the hast node rather than the rendered children because the source\n * has to arrive at the parser exactly as the author typed it, and walking React\n * children would mean reassembling it from whatever the renderer produced.\n *\n * The alternative wiring, a remark plugin, is more code for the same result:\n * `mdast-util-to-hast` applies `data.hName` to the `<code>` element BEFORE\n * wrapping it in `<pre>`, so renaming the code node still leaves the diagram\n * inside this bordered box. Going that way needs a custom node type and a\n * cast into `components`, whose type is keyed on intrinsic elements.\n */\nconst mermaidSource = (node: unknown): string | undefined => {\n const pre = node as\n | {\n children?: Array<{\n type?: string;\n tagName?: string;\n properties?: { className?: unknown };\n children?: Array<{ type?: string; value?: string }>;\n }>;\n }\n | undefined;\n const code = pre?.children?.[0];\n if (code?.type !== \"element\" || code.tagName !== \"code\") return undefined;\n\n const className = code.properties?.className;\n const names = Array.isArray(className)\n ? className.map(String)\n : typeof className === \"string\"\n ? className.split(/\\s+/)\n : [];\n if (!names.includes(\"language-mermaid\")) return undefined;\n\n const text = code.children\n ?.filter((child) => child.type === \"text\")\n .map((child) => child.value ?? \"\")\n .join(\"\");\n return text?.trim() ? text : undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,eAAe,WAAW,OAAO,4BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEpE,MAAa,gBAAgB,UAA6B;CACxD,OACE,oBAAC,OAAD;EAKE,aAAU;EACV,WAAW,sCAAsC,MAAM,aAAa;EAEpE,UAAA,oBAAC,eAAD;GAKE,eAAe,CAAC,WAAW,aAAa;GACxC,eAAe,CASb,CAAC,iBAAiB;IAAE,QAAQ;IAAM,WAAW,CAAC,SAAS;GAAE,CAAC,CAC5D;GACA,YAAY;IACV,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAqC;IAAa,CAAA;IAElE,IAAI,EAAE,eAAe,oBAAC,KAAD;KAAG,WAAU;KAAQ;IAAY,CAAA;IACtD,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAiC;IAAa,CAAA;IAE9D,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAoC;IAAa,CAAA;IAEjE,KAAK,EAAE,eAAe,oBAAC,MAAD;KAAI,WAAU;KAAQ;IAAa,CAAA;IACzD,IAAI,EAAE,MAAM,eACV,oBAAC,KA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,KAAA;CAEhE,MAAM,YAAY,KAAK,YAAY;CAMnC,IAAI,EALU,MAAM,QAAQ,SAAS,IACjC,UAAU,IAAI,MAAM,IACpB,OAAO,cAAc,WACnB,UAAU,MAAM,KAAK,IACrB,CAAC,EAAA,CACI,SAAS,kBAAkB,GAAG,OAAO,KAAA;CAEhD,MAAM,OAAO,KAAK,UACd,QAAQ,UAAU,MAAM,SAAS,MAAM,CAAC,CACzC,KAAK,UAAU,MAAM,SAAS,EAAE,CAAC,CACjC,KAAK,EAAE;CACV,OAAO,MAAM,KAAK,IAAI,OAAO,KAAA;AAC/B"}
1
+ {"version":3,"file":"MarkdownView.js","names":["pre"],"sources":["../../src/markdown/MarkdownView.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport \"./MarkdownView.css\";\nimport { lazy, type ReactNode, Suspense } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { DiagramErrorBoundary } from \"./diagram/DiagramErrorBoundary.tsx\";\nimport { rehypeHighlight } from \"./rehypeHighlight.ts\";\nimport { remarkSpoiler } from \"./remarkSpoiler.ts\";\nimport { SpoilerSpan } from \"./SpoilerSpan.tsx\";\n\n/**\n * Both parsers, both layouts (`graphre` for the flowchart, arithmetic for\n * the sequence diagram) and both emitters, pulled in ONLY when a document\n * actually contains a mermaid fence.\n *\n * This is the constraint the whole diagram layer exists under: a document\n * with no diagram must pay nothing at all. One with a diagram pays one\n * chunk once, then it is cached. Measured on 2026-08-28 with both diagram\n * types in it: 64.5 kB raw, **22.2 kB gzip**, 19.4 kB brotli - against\n * 17.95 kB gzip when it drew flowcharts only. If it ever passes ~26 kB,\n * split the two pipelines into two chunks so a flowchart-only document\n * stops paying for the sequence one.\n *\n * ⚠️ A lazy import a bundler decides to inline fails silently: the feature\n * still works and the cost moves into the entry chunk. After changing this,\n * build an app that renders a `MarkdownView` (Lore does, in\n * github.com/alepha-dev/lore) and confirm, from its directory, that the\n * diagram code is in a chunk of its own and the entry has none of it:\n *\n * yarn alepha build\n * grep -rl 'addBorderSegments\\|sequenceDiagram' dist/public/\n */\nconst MermaidFence = lazy(() => import(\"./diagram/MermaidFence.tsx\"));\n\nexport interface MarkdownViewProps {\n content: string;\n /**\n * Extra classes for the prose root, merged after the defaults so a caller\n * can set its own reading face or measure. The defaults it overrides are\n * `text-sm leading-relaxed` — a surface that sets prose in a display serif\n * needs both, and no parent wrapper can supply them, since they sit on\n * this element rather than being inherited.\n */\n className?: string;\n /**\n * Renders every link instead of the default `<a href>`: an app routes an\n * internal path through its own router link, or leaves a link it does not\n * trust as plain text (an assistant's reply may carry a path that does not\n * exist). Return `children` alone to drop the link.\n */\n renderLink?: MarkdownLinkRenderer;\n}\n\n/**\n * See {@link MarkdownViewProps.renderLink}.\n */\nexport type MarkdownLinkRenderer = (link: {\n href?: string;\n children: ReactNode;\n}) => ReactNode;\n\n/**\n * Renders markdown as formatted prose.\n *\n * ## Diagrams\n *\n * A ` ```mermaid ` fence containing a **`flowchart`** or a\n * **`sequenceDiagram`** is drawn as an SVG diagram instead of a code block,\n * themed from the app's own CSS variables so dark mode needs no second\n * palette. The renderer is in-house: only flowchart layout is imported\n * (`graphre`, dagre in TypeScript, ~15.5 kB gzip), and the whole thing is\n * one lazy chunk pulled in only when a document actually contains a fence,\n * so a document with no diagram pays nothing.\n *\n * The flowchart subset is `flowchart TD|TB|LR|RL|BT`; the four node shapes\n * `[rect]` `(rounded)` `{diamond}` `((circle))`, with every other mermaid\n * bracket pair consumed and mapped onto them; edges `-->` `---` `-.->`\n * `==>` `<-->` with labels in both the `-->|text|` and `-- text -->` forms;\n * chains, `&` fans, `<br/>` line breaks and nested `subgraph`.\n *\n * The sequence subset is participants and actors, the eight arrow forms,\n * notes, `autonumber`, self-messages and the `alt` / `else` / `opt` /\n * `loop` fragment boxes. Activation bars are ignored. A wide sequence\n * diagram keeps its natural size in a scroll frame rather than shrinking\n * into the prose column.\n *\n * **Everything else degrades to the code block, silently.**\n * `classDiagram`, `gantt` and mindmaps are not drawn, `style` / `classDef`\n * are ignored, and a parse failure, a refused construct or a diagram past\n * its cap renders the plain fence rather than an error. Agents write\n * invalid mermaid, and a red box in the middle of a document is worse than\n * a grey fence. See `packages/@alepha/ui/DOC.md` for the full table.\n *\n * ## Spoilers\n *\n * `||text||` renders as a covered box that reveals on click, on Enter or on\n * Space, Discord's syntax and Discord's behaviour. Inline markdown inside it\n * survives, a code span or a fence keeps its pipes literally, and an\n * unterminated `||` renders as the two characters the author typed rather\n * than swallowing the rest of the paragraph.\n *\n * ⚠️ **It is not a security feature.** The text is in the DOM from the first\n * paint, in the raw markdown, in an export, over MCP and in any search\n * snippet. It hides a plot point from a reader's eye and nothing more.\n *\n * ## Raw HTML\n *\n * No raw HTML is ever rendered as markup: react-markdown's default is to\n * escape a raw node to text, and this component deliberately mounts no\n * plugin that changes that. A narrow `rehypeSafeImg` plugin used to promote\n * a lone `<img …>` — the one thing MDXEditor emitted for a *resized* image —\n * and was deleted along with the editor that produced it, since nothing\n * writes that markup anymore.\n *\n * Do not reach for `rehype-raw` to bring the capability back: this renders\n * content authored by one user to another, so every raw tag becoming live\n * markup turns every markdown surface in every app into an injection point.\n */\nexport const MarkdownView = (props: MarkdownViewProps) => {\n return (\n <div\n // `data-slot`, matching every other block here, so a host page can\n // reach the prose root without a wrapper class. Lore's folio\n // document uses it to make this inherit the reading size instead\n // of the `text-sm` default below.\n data-slot=\"markdown-view\"\n className={`max-w-none text-sm leading-relaxed ${props.className ?? \"\"}`}\n >\n <ReactMarkdown\n // ⚠️ `remarkSpoiler` runs AFTER `remarkGfm`, and the order is\n // load-bearing: by then a `| a | b |` row is a table with cells, so\n // the pipes are structure and the spoiler walk never sees them as\n // text. Reversed, every two-column table would be a spoiler.\n remarkPlugins={[remarkGfm, remarkSpoiler]}\n rehypePlugins={[\n // `plainText` claims the fence BEFORE highlighting runs: hljs would\n // otherwise tokenise the diagram source, and the fallback would be a\n // soup of spans instead of the text the author wrote.\n //\n // The plugin is the markdown module's own, over lowlight with the\n // fifteen grammars in `HIGHLIGHT_LANGUAGES`: `rehype-highlight`\n // kept all 37 of lowlight's `common` set in the chunk whatever it\n // was given. A fence in any other language renders plain.\n [rehypeHighlight, { detect: true, plainText: [\"mermaid\"] }],\n ]}\n components={{\n h1: ({ children }) => (\n <h1 className=\"mt-6 mb-3 text-2xl font-semibold tracking-tight\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"mt-6 mb-2 text-xl font-semibold tracking-tight\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"mt-4 mb-2 text-base font-semibold\">{children}</h3>\n ),\n p: ({ children }) => <p className=\"my-3\">{children}</p>,\n ul: ({ children }) => (\n <ul className=\"my-3 list-disc space-y-1 pl-5\">{children}</ul>\n ),\n ol: ({ children }) => (\n <ol className=\"my-3 list-decimal space-y-1 pl-5\">{children}</ol>\n ),\n li: ({ children }) => <li className=\"pl-1\">{children}</li>,\n a: ({ href, children }) =>\n props.renderLink ? (\n props.renderLink({ href, children })\n ) : (\n <a\n href={href}\n className=\"text-primary decoration-primary/50 hover:decoration-primary underline underline-offset-4\"\n >\n {children}\n </a>\n ),\n code: ({ children, className }) => {\n const isBlock =\n className?.includes(\"language-\") || className?.includes(\"hljs\");\n if (isBlock) {\n return <code className={`${className} text-xs`}>{children}</code>;\n }\n return (\n <code className=\"bg-muted rounded px-1.5 py-0.5 font-mono text-[0.85em]\">\n {children}\n </code>\n );\n },\n pre: ({ children, node }) => {\n const block = (\n <pre className=\"border-border my-4 overflow-auto rounded-md border bg-transparent p-3 text-xs\">\n {children}\n </pre>\n );\n const source = mermaidSource(node);\n if (!source) return block;\n return (\n <DiagramErrorBoundary fallback={block}>\n {/*\n The loading state IS the code block: the fence is already on\n screen, and swapping it for the diagram when the chunk lands\n costs no spinner and no second layout.\n */}\n <Suspense fallback={block}>\n <MermaidFence source={source} fallback={block} />\n </Suspense>\n </DiagramErrorBoundary>\n );\n },\n // The only `<span>` this renderer ever produces is a spoiler's, and\n // the only thing that marks one is the `data-spoiler` property\n // `remarkSpoiler` puts there.\n //\n // ⚠️ The cast is not laziness: react-markdown types a span's props\n // as `HTMLAttributes<HTMLSpanElement>`, which PERMITS writing a\n // `data-*` attribute in JSX and does not declare one for reading.\n // The alternative - a custom `hName` with its own `components` key -\n // needs a cast into `components`, whose type is keyed on intrinsic\n // elements, so it buys nothing (the same note `mermaidSource`\n // already carries).\n span: ({ children, ...rest }) => {\n const marked = (rest as { \"data-spoiler\"?: unknown })[\n \"data-spoiler\"\n ];\n if (marked) return <SpoilerSpan>{children}</SpoilerSpan>;\n return <span {...rest}>{children}</span>;\n },\n blockquote: ({ children }) => (\n <blockquote className=\"border-muted-foreground/30 my-3 border-l-2 pl-4 italic\">\n {children}\n </blockquote>\n ),\n hr: () => <hr className=\"border-border my-6\" />,\n table: ({ children }) => (\n <table className=\"my-4 border-collapse text-xs\">{children}</table>\n ),\n th: ({ children }) => (\n <th className=\"border-border border px-2 py-1 text-left font-medium\">\n {children}\n </th>\n ),\n td: ({ children }) => (\n <td className=\"border-border border px-2 py-1\">{children}</td>\n ),\n }}\n >\n {props.content}\n </ReactMarkdown>\n </div>\n );\n};\n\n/**\n * The text of a ` ```mermaid ` fence, or `undefined` for every other `<pre>`.\n *\n * Reads the hast node rather than the rendered children because the source\n * has to arrive at the parser exactly as the author typed it, and walking React\n * children would mean reassembling it from whatever the renderer produced.\n *\n * The alternative wiring, a remark plugin, is more code for the same result:\n * `mdast-util-to-hast` applies `data.hName` to the `<code>` element BEFORE\n * wrapping it in `<pre>`, so renaming the code node still leaves the diagram\n * inside this bordered box. Going that way needs a custom node type and a\n * cast into `components`, whose type is keyed on intrinsic elements.\n */\nconst mermaidSource = (node: unknown): string | undefined => {\n const pre = node as\n | {\n children?: Array<{\n type?: string;\n tagName?: string;\n properties?: { className?: unknown };\n children?: Array<{ type?: string; value?: string }>;\n }>;\n }\n | undefined;\n const code = pre?.children?.[0];\n if (code?.type !== \"element\" || code.tagName !== \"code\") return undefined;\n\n const className = code.properties?.className;\n const names = Array.isArray(className)\n ? className.map(String)\n : typeof className === \"string\"\n ? className.split(/\\s+/)\n : [];\n if (!names.includes(\"language-mermaid\")) return undefined;\n\n const text = code.children\n ?.filter((child) => child.type === \"text\")\n .map((child) => child.value ?? \"\")\n .join(\"\");\n return text?.trim() ? text : undefined;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,eAAe,WAAW,OAAO,4BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFpE,MAAa,gBAAgB,UAA6B;CACxD,OACE,oBAAC,OAAD;EAKE,aAAU;EACV,WAAW,sCAAsC,MAAM,aAAa;EAEpE,UAAA,oBAAC,eAAD;GAKE,eAAe,CAAC,WAAW,aAAa;GACxC,eAAe,CASb,CAAC,iBAAiB;IAAE,QAAQ;IAAM,WAAW,CAAC,SAAS;GAAE,CAAC,CAC5D;GACA,YAAY;IACV,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KACX;IACC,CAAA;IAEN,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAqC;IAAa,CAAA;IAElE,IAAI,EAAE,eAAe,oBAAC,KAAD;KAAG,WAAU;KAAQ;IAAY,CAAA;IACtD,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAiC;IAAa,CAAA;IAE9D,KAAK,EAAE,eACL,oBAAC,MAAD;KAAI,WAAU;KAAoC;IAAa,CAAA;IAEjE,KAAK,EAAE,eAAe,oBAAC,MAAD;KAAI,WAAU;KAAQ;IAAa,CAAA;IACzD,IAAI,EAAE,MAAM,eACV,MAAM,aACJ,MAAM,WAAW;KAAE;KAAM;IAAS,CAAC,IAEnC,oBAAC,KAAD;KACQ;KACN,WAAU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,YAAY,KAAK,YAAY;CAMnC,IAAI,EALU,MAAM,QAAQ,SAAS,IACjC,UAAU,IAAI,MAAM,IACpB,OAAO,cAAc,WACnB,UAAU,MAAM,KAAK,IACrB,CAAC,EAAA,CACI,SAAS,kBAAkB,GAAG,OAAO,KAAA;CAEhD,MAAM,OAAO,KAAK,UACd,QAAQ,UAAU,MAAM,SAAS,MAAM,CAAC,CACzC,KAAK,UAAU,MAAM,SAAS,EAAE,CAAC,CACjC,KAAK,EAAE;CACV,OAAO,MAAM,KAAK,IAAI,OAAO,KAAA;AAC/B"}
@@ -6,9 +6,9 @@ export interface InviteOrganizationMember {
6
6
  * `metadata` is the application's own, stored on the invitation row and
7
7
  * handed back on `organization:invitation:accepted`. The framework never
8
8
  * reads it: it is how an application carries a fact of its own alongside the
9
- * rank - Alepha Club puts the club ROLES it is inviting somebody as there,
9
+ * rank - a sports app may put the ROLES it is inviting somebody as there,
10
10
  * because a rank says what you may do as staff and a role says whether you
11
- * are a coach, and the framework has no business knowing that club has
11
+ * are a coach, and the framework has no business knowing that the app has
12
12
  * coaches.
13
13
  *
14
14
  * Resolves `{ ok: true }` once sent, `{ ok: false, reason: "cancelled" }`
@@ -1 +1 @@
1
- {"version":3,"file":"useInviteOrganizationMember.js","names":[],"sources":["../../src/organizations/useInviteOrganizationMember.ts"],"sourcesContent":["import type { OrganizationInvitationController } from \"alepha/api/organizations\";\nimport { type RunResult, useAction, useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback } from \"react\";\n\nimport { useToast } from \"../core/useToast.tsx\";\n\nexport interface InviteOrganizationMember {\n /**\n * Send an invitation.\n *\n * `metadata` is the application's own, stored on the invitation row and\n * handed back on `organization:invitation:accepted`. The framework never\n * reads it: it is how an application carries a fact of its own alongside the\n * rank - Alepha Club puts the club ROLES it is inviting somebody as there,\n * because a rank says what you may do as staff and a role says whether you\n * are a coach, and the framework has no business knowing that club has\n * coaches.\n *\n * Resolves `{ ok: true }` once sent, `{ ok: false, reason: \"cancelled\" }`\n * when a local check refused it (an empty address, toasted here), and\n * `useAction`'s other results otherwise.\n */\n invite: (\n organizationId: string,\n email: string,\n rank: string | undefined,\n metadata?: Record<string, unknown>,\n ) => Promise<RunResult<void>>;\n loading: boolean;\n can: boolean;\n}\n\nexport const useInviteOrganizationMember = (): InviteOrganizationMember => {\n const api = useClient<OrganizationInvitationController>();\n const toaster = useToast();\n const { tr } = useI18n();\n const action = useAction<\n [\n organizationId: string,\n email: string,\n rank: string | undefined,\n metadata?: Record<string, unknown>,\n ],\n boolean\n >(\n {\n handler: async (_ctx, organizationId, email, rank, metadata) => {\n const trimmed = email.trim();\n if (!trimmed) {\n toaster.error(\n tr(\"organizations.invitations.emailRequired\", {\n default: \"Enter an email address\",\n }),\n );\n return false;\n }\n await api.createOrganizationInvitation({\n params: { organizationId },\n body: {\n email: trimmed,\n ...(rank ? { rank } : {}),\n ...(metadata ? { metadata } : {}),\n },\n });\n toaster.success(\n tr(\"organizations.invitations.sent\", {\n default: \"Invitation sent to $1\",\n args: [trimmed],\n }),\n );\n return true;\n },\n },\n [api, toaster, tr],\n );\n\n const invite = useCallback(\n async (\n ...args: Parameters<typeof action.run>\n ): Promise<RunResult<void>> => {\n const result = await action.run(...args);\n if (!result.ok) return result;\n return result.value\n ? { ok: true, value: undefined }\n : { ok: false, reason: \"cancelled\" };\n },\n [action.run],\n );\n\n return {\n invite,\n loading: action.loading,\n can: api.createOrganizationInvitation.can(),\n };\n};\n"],"mappings":";;;;;AAiCA,MAAa,oCAA8D;CACzE,MAAM,MAAM,UAA4C;CACxD,MAAM,UAAU,SAAS;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,SAAS,UASb,EACE,SAAS,OAAO,MAAM,gBAAgB,OAAO,MAAM,aAAa;EAC9D,MAAM,UAAU,MAAM,KAAK;EAC3B,IAAI,CAAC,SAAS;GACZ,QAAQ,MACN,GAAG,2CAA2C,EAC5C,SAAS,yBACX,CAAC,CACH;GACA,OAAO;EACT;EACA,MAAM,IAAI,6BAA6B;GACrC,QAAQ,EAAE,eAAe;GACzB,MAAM;IACJ,OAAO;IACP,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;IACvB,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;GACjC;EACF,CAAC;EACD,QAAQ,QACN,GAAG,kCAAkC;GACnC,SAAS;GACT,MAAM,CAAC,OAAO;EAChB,CAAC,CACH;EACA,OAAO;CACT,EACF,GACA;EAAC;EAAK;EAAS;CAAE,CACnB;CAeA,OAAO;EACL,QAda,YACb,OACE,GAAG,SAC0B;GAC7B,MAAM,SAAS,MAAM,OAAO,IAAI,GAAG,IAAI;GACvC,IAAI,CAAC,OAAO,IAAI,OAAO;GACvB,OAAO,OAAO,QACV;IAAE,IAAI;IAAM,OAAO,KAAA;GAAU,IAC7B;IAAE,IAAI;IAAO,QAAQ;GAAY;EACvC,GACA,CAAC,OAAO,GAAG,CAIN;EACL,SAAS,OAAO;EAChB,KAAK,IAAI,6BAA6B,IAAI;CAC5C;AACF"}
1
+ {"version":3,"file":"useInviteOrganizationMember.js","names":[],"sources":["../../src/organizations/useInviteOrganizationMember.ts"],"sourcesContent":["import type { OrganizationInvitationController } from \"alepha/api/organizations\";\nimport { type RunResult, useAction, useClient } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback } from \"react\";\n\nimport { useToast } from \"../core/useToast.tsx\";\n\nexport interface InviteOrganizationMember {\n /**\n * Send an invitation.\n *\n * `metadata` is the application's own, stored on the invitation row and\n * handed back on `organization:invitation:accepted`. The framework never\n * reads it: it is how an application carries a fact of its own alongside the\n * rank - a sports app may put the ROLES it is inviting somebody as there,\n * because a rank says what you may do as staff and a role says whether you\n * are a coach, and the framework has no business knowing that the app has\n * coaches.\n *\n * Resolves `{ ok: true }` once sent, `{ ok: false, reason: \"cancelled\" }`\n * when a local check refused it (an empty address, toasted here), and\n * `useAction`'s other results otherwise.\n */\n invite: (\n organizationId: string,\n email: string,\n rank: string | undefined,\n metadata?: Record<string, unknown>,\n ) => Promise<RunResult<void>>;\n loading: boolean;\n can: boolean;\n}\n\nexport const useInviteOrganizationMember = (): InviteOrganizationMember => {\n const api = useClient<OrganizationInvitationController>();\n const toaster = useToast();\n const { tr } = useI18n();\n const action = useAction<\n [\n organizationId: string,\n email: string,\n rank: string | undefined,\n metadata?: Record<string, unknown>,\n ],\n boolean\n >(\n {\n handler: async (_ctx, organizationId, email, rank, metadata) => {\n const trimmed = email.trim();\n if (!trimmed) {\n toaster.error(\n tr(\"organizations.invitations.emailRequired\", {\n default: \"Enter an email address\",\n }),\n );\n return false;\n }\n await api.createOrganizationInvitation({\n params: { organizationId },\n body: {\n email: trimmed,\n ...(rank ? { rank } : {}),\n ...(metadata ? { metadata } : {}),\n },\n });\n toaster.success(\n tr(\"organizations.invitations.sent\", {\n default: \"Invitation sent to $1\",\n args: [trimmed],\n }),\n );\n return true;\n },\n },\n [api, toaster, tr],\n );\n\n const invite = useCallback(\n async (\n ...args: Parameters<typeof action.run>\n ): Promise<RunResult<void>> => {\n const result = await action.run(...args);\n if (!result.ok) return result;\n return result.value\n ? { ok: true, value: undefined }\n : { ok: false, reason: \"cancelled\" };\n },\n [action.run],\n );\n\n return {\n invite,\n loading: action.loading,\n can: api.createOrganizationInvitation.can(),\n };\n};\n"],"mappings":";;;;;AAiCA,MAAa,oCAA8D;CACzE,MAAM,MAAM,UAA4C;CACxD,MAAM,UAAU,SAAS;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,SAAS,UASb,EACE,SAAS,OAAO,MAAM,gBAAgB,OAAO,MAAM,aAAa;EAC9D,MAAM,UAAU,MAAM,KAAK;EAC3B,IAAI,CAAC,SAAS;GACZ,QAAQ,MACN,GAAG,2CAA2C,EAC5C,SAAS,yBACX,CAAC,CACH;GACA,OAAO;EACT;EACA,MAAM,IAAI,6BAA6B;GACrC,QAAQ,EAAE,eAAe;GACzB,MAAM;IACJ,OAAO;IACP,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;IACvB,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;GACjC;EACF,CAAC;EACD,QAAQ,QACN,GAAG,kCAAkC;GACnC,SAAS;GACT,MAAM,CAAC,OAAO;EAChB,CAAC,CACH;EACA,OAAO;CACT,EACF,GACA;EAAC;EAAK;EAAS;CAAE,CACnB;CAeA,OAAO;EACL,QAda,YACb,OACE,GAAG,SAC0B;GAC7B,MAAM,SAAS,MAAM,OAAO,IAAI,GAAG,IAAI;GACvC,IAAI,CAAC,OAAO,IAAI,OAAO;GACvB,OAAO,OAAO,QACV;IAAE,IAAI;IAAM,OAAO,KAAA;GAAU,IAC7B;IAAE,IAAI;IAAO,QAAQ;GAAY;EACvC,GACA,CAAC,OAAO,GAAG,CAIN;EACL,SAAS,OAAO;EAChB,KAAK,IAAI,6BAA6B,IAAI;CAC5C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppShellSidebarNavItem.d.ts","sourceRoot":"","sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,OAAO,EAEb,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,OAAO,GAAG,WAAW,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,UAAW,2BAA2B,sBAmPxE,CAAC"}
1
+ {"version":3,"file":"AppShellSidebarNavItem.d.ts","sourceRoot":"","sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,OAAO,EAEb,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,OAAO,GAAG,WAAW,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,UAAW,2BAA2B,sBAoSxE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuTrigger } from "../core/DropdownMenu.js";
2
2
  import { HoverCard, HoverCardContent, HoverCardTrigger } from "../core/HoverCard.js";
3
- import { SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar } from "../core/Sidebar.js";
3
+ import { SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, useSidebar } from "../core/Sidebar.js";
4
4
  import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.js";
5
5
  import { hasActiveDescendant, isOpenPathPrefix, renderNavIcon } from "./appShellNav.js";
6
6
  import { AppShellNavCollapse } from "./AppShellNavCollapse.js";
@@ -53,6 +53,7 @@ const AppShellSidebarNavItem = (props) => {
53
53
  const link = /* @__PURE__ */ jsxs(SidebarMenuButton, {
54
54
  isActive: item.active,
55
55
  tooltip: typeof item.label === "string" ? item.label : void 0,
56
+ className: item.action ? "group-hover/menu-item:bg-hover" : void 0,
56
57
  render: /* @__PURE__ */ jsx(Link, {
57
58
  href: item.href ?? "#",
58
59
  prefetch: item.prefetch === false ? void 0 : item.prefetch ?? "hover",
@@ -64,7 +65,29 @@ const AppShellSidebarNavItem = (props) => {
64
65
  side: "inline-end",
65
66
  children: item.tooltip
66
67
  })] }) : link;
67
- return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [row, item.badge != null && item.badge !== false && /* @__PURE__ */ jsx(SidebarMenuBadge, { children: item.badge })] });
68
+ const action = item.action;
69
+ return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [
70
+ row,
71
+ item.badge != null && item.badge !== false && /* @__PURE__ */ jsx(SidebarMenuBadge, {
72
+ className: action ? "max-md:hidden md:group-hover/menu-item:opacity-0 md:group-has-[:focus-visible]/menu-item:opacity-0" : void 0,
73
+ children: item.badge
74
+ }),
75
+ action && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
76
+ render: /* @__PURE__ */ jsx(SidebarMenuAction, {
77
+ showOnHover: true,
78
+ "aria-label": action.label,
79
+ onClick: (event) => {
80
+ if (event.detail > 0) event.currentTarget.blur();
81
+ action.onClick?.();
82
+ },
83
+ render: !action.onClick && action.href ? /* @__PURE__ */ jsx(Link, { href: action.href }) : void 0
84
+ }),
85
+ children: renderNavIcon(action.icon ?? Plus, "size-4")
86
+ }), /* @__PURE__ */ jsx(TooltipContent, {
87
+ side: "inline-end",
88
+ children: action.label
89
+ })] })
90
+ ] });
68
91
  }
69
92
  if (isGroup && state === "collapsed" && !isMobile) return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
70
93
  render: /* @__PURE__ */ jsx(SidebarMenuButton, { isActive: item.active || hasActive }),
@@ -1 +1 @@
1
- {"version":3,"file":"AppShellSidebarNavItem.js","names":[],"sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ChevronRight, Lock, Minus, Plus } from \"lucide-react\";\nimport { useId, useState } from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"../core/HoverCard.tsx\";\nimport {\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../core/Sidebar.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport {\n hasActiveDescendant,\n isOpenPathPrefix,\n type NavAccordion,\n type NavItem,\n renderNavIcon,\n} from \"./appShellNav.tsx\";\nimport { AppShellNavCollapse } from \"./AppShellNavCollapse.tsx\";\nimport { AppShellNavDropdownItems } from \"./AppShellNavDropdownItems.tsx\";\n\nexport interface AppShellSidebarNavItemProps {\n item: NavItem;\n /**\n * This item's position in `nav`, used only by the accordion. See\n * {@link NavAccordion}.\n */\n path: number[];\n /**\n * Present when `navAccordion` is on, and then it OWNS the open state: the\n * local `useState` below is still declared (hooks cannot be conditional) but\n * nothing reads it.\n */\n accordion?: NavAccordion;\n /**\n * `navAnimate`, threaded down so a nested group animates like its parent.\n */\n animate: boolean;\n /**\n * `navToggleIcon`, threaded down for the same reason.\n */\n toggleIcon: \"caret\" | \"plusMinus\";\n}\n\nexport const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {\n const { item, path, accordion, animate, toggleIcon } = props;\n const { state, isMobile } = useSidebar();\n const collapseId = useId();\n const children = item.children;\n const isGroup = !!children && children.length > 0;\n const hasActive = isGroup && hasActiveDescendant(item);\n const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);\n // Reveal a collapsed group when navigation makes one of its descendants\n // active — SPA nav, spotlight (⌘K), breadcrumb, or a deep-link that doesn't\n // remount this item (useState's initializer runs only at mount, so without\n // this the group stays stuck closed and the active page is hidden — petition\n // #4). Only OPENS; never auto-collapses, so a manual toggle is preserved.\n //\n // Accordion mode does the same job in `AppShell` instead, from the tree, and\n // skips this: the state lives there, and a child cannot write it mid-render.\n const [wasActive, setWasActive] = useState(hasActive);\n if (!accordion && hasActive !== wasActive) {\n setWasActive(hasActive);\n if (hasActive) setLocalOpen(true);\n }\n\n const open = accordion\n ? isOpenPathPrefix(path, accordion.openPath)\n : localOpen;\n\n // Closing means handing the branch back to this item's PARENT, not clearing\n // it: a nested group that closed itself by emptying the path would collapse\n // every ancestor along with it.\n const toggle = () => {\n if (accordion) {\n accordion.setOpenPath(open ? path.slice(0, -1) : path);\n } else {\n setLocalOpen((v) => !v);\n }\n };\n\n if (!isGroup) {\n // Disabled rows render with a muted, dashed-border treatment plus a\n // Lock affordance on the trailing edge. Clicks are swallowed. When a\n // `tooltip` is provided, the row opens a HoverCard dropdown on hover\n // so the explanation has space to breathe regardless of sidebar\n // state.\n if (item.disabled) {\n // Bypass SidebarMenuButton — it self-wraps in a Tooltip when given\n // a `tooltip` prop, which would swallow the HoverCard pointer\n // events. A plain styled <div> keeps cursor-not-allowed and lets\n // the row act as the HoverCard trigger.\n const row = (\n <div\n aria-disabled=\"true\"\n className=\"border-muted-foreground/40 bg-muted/40 text-muted-foreground flex h-8 w-full items-center gap-2 rounded-md border border-dashed px-2 text-sm\"\n style={{ cursor: \"not-allowed\" }}\n >\n {renderNavIcon(item.icon, \"size-4 shrink-0\")}\n <span className=\"flex-1 truncate text-start\">{item.label}</span>\n <Lock className=\"size-3.5 shrink-0 opacity-70\" />\n </div>\n );\n return (\n <SidebarMenuItem>\n {item.tooltip ? (\n <HoverCard>\n <HoverCardTrigger render={row} />\n <HoverCardContent\n side=\"inline-end\"\n align=\"start\"\n className=\"text-sm\"\n >\n {item.tooltip}\n </HoverCardContent>\n </HoverCard>\n ) : (\n row\n )}\n </SidebarMenuItem>\n );\n }\n\n const link = (\n <SidebarMenuButton\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n /*\n `aria-current` beside the styling's `data-active`, so a screen\n reader announces the page the reader is on, and a test can find the\n lit entry by role rather than by a styling hook.\n */\n render={\n <Link\n href={item.href ?? \"#\"}\n prefetch={\n item.prefetch === false ? undefined : (item.prefetch ?? \"hover\")\n }\n aria-current={item.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span>{item.label}</span>\n </SidebarMenuButton>\n );\n\n const row = item.tooltip ? (\n <Tooltip>\n <TooltipTrigger render={link} />\n <TooltipContent side=\"inline-end\">{item.tooltip}</TooltipContent>\n </Tooltip>\n ) : (\n link\n );\n\n return (\n <SidebarMenuItem>\n {row}\n {item.badge != null && item.badge !== false && (\n <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>\n )}\n </SidebarMenuItem>\n );\n }\n\n // Collapsed to icons, the expanded branch below is a dead button: it still\n // flips `open`, but what `open` reveals is a `SidebarMenuSub`, which carries\n // `group-data-[collapsible=icon]:hidden`. The group has no `href` either, so\n // there is no fallback — every child is simply unreachable. A dropdown is the\n // standard answer, and it belongs here rather than in any one app because\n // this hits EVERY `NavItem` with children.\n //\n // Mobile is excluded: it uses the sheet, not icon mode, so the sub renders\n // normally there.\n if (isGroup && state === \"collapsed\" && !isMobile) {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n // No `tooltip` here on purpose. `SidebarMenuButton` turns itself\n // into a `TooltipTrigger` when given one, and layering the\n // dropdown trigger on top makes hover and click fight over the\n // same element. The menu names itself with a label instead.\n //\n // `hasActive` joins `item.active` so the trigger still reads as\n // current when a descendant is — collapsed, it is the only clue\n // which group holds the open page.\n <SidebarMenuButton isActive={item.active || hasActive} />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-start\">{item.label}</span>\n <ChevronRight className=\"size-4 rtl:-scale-x-100\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n side=\"inline-end\"\n align=\"start\"\n className=\"min-w-48\"\n >\n {/*\n The group wrapper is required, not cosmetic: `DropdownMenuLabel`\n is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and\n THROWS outside a `Menu.Group`. Nothing types this — the label\n compiles fine, and the whole app-shell crashes at the first click\n on the trigger, because the throw happens when the menu opens\n rather than when it mounts.\n */}\n <DropdownMenuGroup>\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n <AppShellNavDropdownItems items={children} />\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n );\n }\n\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={toggle}\n // The group is a disclosure: its state and what it opens, for\n // assistive technology (and a test finding the open group by role).\n aria-expanded={open}\n aria-controls={collapseId}\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-start\">{item.label}</span>\n {/*\n Plus and minus are SWAPPED, never rotated: a plus turned 45° is a\n close button, which is a different promise. The caret is the one\n that turns, and it stays the default because it is what every app\n using this shell already had.\n */}\n {toggleIcon === \"plusMinus\" ? (\n open ? (\n <Minus className=\"size-4\" />\n ) : (\n <Plus className=\"size-4\" />\n )\n ) : (\n <ChevronRight\n className={`size-4 transition-transform rtl:-scale-x-100 ${open ? \"rotate-90\" : \"\"}`}\n />\n )}\n </SidebarMenuButton>\n <AppShellNavCollapse id={collapseId} open={open} animate={animate}>\n <SidebarMenuSub>\n {children.map((child, ci) => (\n <SidebarMenuSubItem key={child.href ?? ci}>\n {child.children && child.children.length > 0 ? (\n <AppShellSidebarNavItem\n item={child}\n path={[...path, ci]}\n accordion={accordion}\n animate={animate}\n toggleIcon={toggleIcon}\n />\n ) : (\n <SidebarMenuSubButton\n isActive={child.active}\n render={\n <Link\n href={child.href ?? \"#\"}\n prefetch={\n child.prefetch === false\n ? undefined\n : (child.prefetch ?? \"hover\")\n }\n aria-current={child.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(child.icon, \"size-4\")}\n <span>{child.label}</span>\n </SidebarMenuSubButton>\n )}\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </AppShellNavCollapse>\n </SidebarMenuItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA+DA,MAAa,0BAA0B,UAAuC;CAC5E,MAAM,EAAE,MAAM,MAAM,WAAW,SAAS,eAAe;CACvD,MAAM,EAAE,OAAO,aAAa,WAAW;CACvC,MAAM,aAAa,MAAM;CACzB,MAAM,WAAW,KAAK;CACtB,MAAM,UAAU,CAAC,CAAC,YAAY,SAAS,SAAS;CAChD,MAAM,YAAY,WAAW,oBAAoB,IAAI;CACrD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK,eAAe,SAAS;CASxE,MAAM,CAAC,WAAW,gBAAgB,SAAS,SAAS;CACpD,IAAI,CAAC,aAAa,cAAc,WAAW;EACzC,aAAa,SAAS;EACtB,IAAI,WAAW,aAAa,IAAI;CAClC;CAEA,MAAM,OAAO,YACT,iBAAiB,MAAM,UAAU,QAAQ,IACzC;CAKJ,MAAM,eAAe;EACnB,IAAI,WACF,UAAU,YAAY,OAAO,KAAK,MAAM,GAAG,EAAE,IAAI,IAAI;OAErD,cAAc,MAAM,CAAC,CAAC;CAE1B;CAEA,IAAI,CAAC,SAAS;EAMZ,IAAI,KAAK,UAAU;GAKjB,MAAM,MACJ,qBAAC,OAAD;IACE,iBAAc;IACd,WAAU;IACV,OAAO,EAAE,QAAQ,cAAc;IAHjC,UAAA;KAKG,cAAc,KAAK,MAAM,iBAAiB;KAC3C,oBAAC,QAAD;MAAM,WAAU;MAA8B,UAAA,KAAK;KAAY,CAAA;KAC/D,oBAAC,MAAD,EAAM,WAAU,+BAAgC,CAAA;IAC7C;;GAEP,OACE,oBAAC,iBAAD,EAAA,UACG,KAAK,UACJ,qBAAC,WAAD,EAAA,UAAA,CACE,oBAAC,kBAAD,EAAkB,QAAQ,IAAM,CAAA,GAChC,oBAAC,kBAAD;IAC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AA,CACN,EAAA,CAAA;AAErB"}
1
+ {"version":3,"file":"AppShellSidebarNavItem.js","names":[],"sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ChevronRight, Lock, Minus, Plus } from \"lucide-react\";\nimport { useId, useState } from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"../core/HoverCard.tsx\";\nimport {\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../core/Sidebar.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport {\n hasActiveDescendant,\n isOpenPathPrefix,\n type NavAccordion,\n type NavItem,\n renderNavIcon,\n} from \"./appShellNav.tsx\";\nimport { AppShellNavCollapse } from \"./AppShellNavCollapse.tsx\";\nimport { AppShellNavDropdownItems } from \"./AppShellNavDropdownItems.tsx\";\n\nexport interface AppShellSidebarNavItemProps {\n item: NavItem;\n /**\n * This item's position in `nav`, used only by the accordion. See\n * {@link NavAccordion}.\n */\n path: number[];\n /**\n * Present when `navAccordion` is on, and then it OWNS the open state: the\n * local `useState` below is still declared (hooks cannot be conditional) but\n * nothing reads it.\n */\n accordion?: NavAccordion;\n /**\n * `navAnimate`, threaded down so a nested group animates like its parent.\n */\n animate: boolean;\n /**\n * `navToggleIcon`, threaded down for the same reason.\n */\n toggleIcon: \"caret\" | \"plusMinus\";\n}\n\nexport const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {\n const { item, path, accordion, animate, toggleIcon } = props;\n const { state, isMobile } = useSidebar();\n const collapseId = useId();\n const children = item.children;\n const isGroup = !!children && children.length > 0;\n const hasActive = isGroup && hasActiveDescendant(item);\n const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);\n // Reveal a collapsed group when navigation makes one of its descendants\n // active — SPA nav, spotlight (⌘K), breadcrumb, or a deep-link that doesn't\n // remount this item (useState's initializer runs only at mount, so without\n // this the group stays stuck closed and the active page is hidden — petition\n // #4). Only OPENS; never auto-collapses, so a manual toggle is preserved.\n //\n // Accordion mode does the same job in `AppShell` instead, from the tree, and\n // skips this: the state lives there, and a child cannot write it mid-render.\n const [wasActive, setWasActive] = useState(hasActive);\n if (!accordion && hasActive !== wasActive) {\n setWasActive(hasActive);\n if (hasActive) setLocalOpen(true);\n }\n\n const open = accordion\n ? isOpenPathPrefix(path, accordion.openPath)\n : localOpen;\n\n // Closing means handing the branch back to this item's PARENT, not clearing\n // it: a nested group that closed itself by emptying the path would collapse\n // every ancestor along with it.\n const toggle = () => {\n if (accordion) {\n accordion.setOpenPath(open ? path.slice(0, -1) : path);\n } else {\n setLocalOpen((v) => !v);\n }\n };\n\n if (!isGroup) {\n // Disabled rows render with a muted, dashed-border treatment plus a\n // Lock affordance on the trailing edge. Clicks are swallowed. When a\n // `tooltip` is provided, the row opens a HoverCard dropdown on hover\n // so the explanation has space to breathe regardless of sidebar\n // state.\n if (item.disabled) {\n // Bypass SidebarMenuButton — it self-wraps in a Tooltip when given\n // a `tooltip` prop, which would swallow the HoverCard pointer\n // events. A plain styled <div> keeps cursor-not-allowed and lets\n // the row act as the HoverCard trigger.\n const row = (\n <div\n aria-disabled=\"true\"\n className=\"border-muted-foreground/40 bg-muted/40 text-muted-foreground flex h-8 w-full items-center gap-2 rounded-md border border-dashed px-2 text-sm\"\n style={{ cursor: \"not-allowed\" }}\n >\n {renderNavIcon(item.icon, \"size-4 shrink-0\")}\n <span className=\"flex-1 truncate text-start\">{item.label}</span>\n <Lock className=\"size-3.5 shrink-0 opacity-70\" />\n </div>\n );\n return (\n <SidebarMenuItem>\n {item.tooltip ? (\n <HoverCard>\n <HoverCardTrigger render={row} />\n <HoverCardContent\n side=\"inline-end\"\n align=\"start\"\n className=\"text-sm\"\n >\n {item.tooltip}\n </HoverCardContent>\n </HoverCard>\n ) : (\n row\n )}\n </SidebarMenuItem>\n );\n }\n\n const link = (\n <SidebarMenuButton\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n // The action is the button's SIBLING, so the pointer on the \"+\" has\n // left the button: lit from the item instead, the row keeps its fill\n // under the action's own, which composites a step darker on top.\n className={item.action ? \"group-hover/menu-item:bg-hover\" : undefined}\n /*\n `aria-current` beside the styling's `data-active`, so a screen\n reader announces the page the reader is on, and a test can find the\n lit entry by role rather than by a styling hook.\n */\n render={\n <Link\n href={item.href ?? \"#\"}\n prefetch={\n item.prefetch === false ? undefined : (item.prefetch ?? \"hover\")\n }\n aria-current={item.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span>{item.label}</span>\n </SidebarMenuButton>\n );\n\n const row = item.tooltip ? (\n <Tooltip>\n <TooltipTrigger render={link} />\n <TooltipContent side=\"inline-end\">{item.tooltip}</TooltipContent>\n </Tooltip>\n ) : (\n link\n );\n\n const action = item.action;\n\n return (\n <SidebarMenuItem>\n {row}\n {item.badge != null && item.badge !== false && (\n <SidebarMenuBadge\n className={\n // The action takes the badge's slot while it shows, so the two\n // never paint over each other: the count at rest, the \"+\" under\n // the pointer. The same breakpoint as `showOnHover`, which keeps\n // the action always visible below `md`, where there is no hover.\n action\n ? \"max-md:hidden md:group-hover/menu-item:opacity-0 md:group-has-[:focus-visible]/menu-item:opacity-0\"\n : undefined\n }\n >\n {item.badge}\n </SidebarMenuBadge>\n )}\n {action && (\n <Tooltip>\n <TooltipTrigger\n render={\n <SidebarMenuAction\n showOnHover\n aria-label={action.label}\n onClick={(event) => {\n // A POINTER click lets go of focus before the action\n // runs. The action usually opens a dialog, which hands\n // focus back to whatever held it on close: the \"+\", which\n // then reads as keyboard focus, stays revealed, hides the count\n // and draws a ring while the pointer is elsewhere. A\n // keyboard press (`detail` 0) keeps it, so a keyboard\n // reader lands back where they were.\n if (event.detail > 0) event.currentTarget.blur();\n action.onClick?.();\n }}\n render={\n !action.onClick && action.href ? (\n <Link href={action.href} />\n ) : undefined\n }\n />\n }\n >\n {renderNavIcon(action.icon ?? Plus, \"size-4\")}\n </TooltipTrigger>\n <TooltipContent side=\"inline-end\">{action.label}</TooltipContent>\n </Tooltip>\n )}\n </SidebarMenuItem>\n );\n }\n\n // Collapsed to icons, the expanded branch below is a dead button: it still\n // flips `open`, but what `open` reveals is a `SidebarMenuSub`, which carries\n // `group-data-[collapsible=icon]:hidden`. The group has no `href` either, so\n // there is no fallback — every child is simply unreachable. A dropdown is the\n // standard answer, and it belongs here rather than in any one app because\n // this hits EVERY `NavItem` with children.\n //\n // Mobile is excluded: it uses the sheet, not icon mode, so the sub renders\n // normally there.\n if (isGroup && state === \"collapsed\" && !isMobile) {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n // No `tooltip` here on purpose. `SidebarMenuButton` turns itself\n // into a `TooltipTrigger` when given one, and layering the\n // dropdown trigger on top makes hover and click fight over the\n // same element. The menu names itself with a label instead.\n //\n // `hasActive` joins `item.active` so the trigger still reads as\n // current when a descendant is — collapsed, it is the only clue\n // which group holds the open page.\n <SidebarMenuButton isActive={item.active || hasActive} />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-start\">{item.label}</span>\n <ChevronRight className=\"size-4 rtl:-scale-x-100\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n side=\"inline-end\"\n align=\"start\"\n className=\"min-w-48\"\n >\n {/*\n The group wrapper is required, not cosmetic: `DropdownMenuLabel`\n is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and\n THROWS outside a `Menu.Group`. Nothing types this — the label\n compiles fine, and the whole app-shell crashes at the first click\n on the trigger, because the throw happens when the menu opens\n rather than when it mounts.\n */}\n <DropdownMenuGroup>\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n <AppShellNavDropdownItems items={children} />\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n );\n }\n\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={toggle}\n // The group is a disclosure: its state and what it opens, for\n // assistive technology (and a test finding the open group by role).\n aria-expanded={open}\n aria-controls={collapseId}\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-start\">{item.label}</span>\n {/*\n Plus and minus are SWAPPED, never rotated: a plus turned 45° is a\n close button, which is a different promise. The caret is the one\n that turns, and it stays the default because it is what every app\n using this shell already had.\n */}\n {toggleIcon === \"plusMinus\" ? (\n open ? (\n <Minus className=\"size-4\" />\n ) : (\n <Plus className=\"size-4\" />\n )\n ) : (\n <ChevronRight\n className={`size-4 transition-transform rtl:-scale-x-100 ${open ? \"rotate-90\" : \"\"}`}\n />\n )}\n </SidebarMenuButton>\n <AppShellNavCollapse id={collapseId} open={open} animate={animate}>\n <SidebarMenuSub>\n {children.map((child, ci) => (\n <SidebarMenuSubItem key={child.href ?? ci}>\n {child.children && child.children.length > 0 ? (\n <AppShellSidebarNavItem\n item={child}\n path={[...path, ci]}\n accordion={accordion}\n animate={animate}\n toggleIcon={toggleIcon}\n />\n ) : (\n <SidebarMenuSubButton\n isActive={child.active}\n render={\n <Link\n href={child.href ?? \"#\"}\n prefetch={\n child.prefetch === false\n ? undefined\n : (child.prefetch ?? \"hover\")\n }\n aria-current={child.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(child.icon, \"size-4\")}\n <span>{child.label}</span>\n </SidebarMenuSubButton>\n )}\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </AppShellNavCollapse>\n </SidebarMenuItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgEA,MAAa,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AAA,IAED,qBAAC,sBAAD;GACE,UAAU,MAAM;GAChB,QACE,oBAAC,MAAD;IACE,MAAM,MAAM,QAAQ;IACpB,UACE,MAAM,aAAa,QACf,KAAA,IACC,MAAM,YAAY;IAEzB,gBAAc,MAAM,SAAS,SAAS,KAAA;GACvC,CAAA;GAXL,UAAA,CAcG,cAAc,MAAM,MAAM,QAAQ,GACnC,oBAAC,QAAD,EAAA,UAAO,MAAM,MAAY,CAAA,CACL;EAEN,CAAA,EAAA,GA5BK,MAAM,QAAQ,EA4BnB,CACrB,EACa,CAAA;CACG,CAAA,CACN,EAAA,CAAA;AAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"PlateTabBar.d.ts","sourceRoot":"","sources":["../../src/shell/PlateTabBar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,gCAkFlD,CAAC"}
1
+ {"version":3,"file":"PlateTabBar.d.ts","sourceRoot":"","sources":["../../src/shell/PlateTabBar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,gCAwFlD,CAAC"}
@@ -14,11 +14,11 @@ const PlateTabBar = (props) => {
14
14
  const navigates = props.tabs.every((tab) => tab.href !== void 0);
15
15
  return /* @__PURE__ */ jsx("div", {
16
16
  "data-testid": props.testId,
17
- className: cn("bg-muted border-border flex gap-5 overflow-x-auto px-6 shadow-[inset_0_1px_0_0_var(--bevel)]", props.divided !== false && "border-t"),
17
+ className: cn("bg-muted border-border flex gap-5 overflow-x-auto overflow-y-hidden px-6 shadow-[inset_0_1px_0_0_var(--bevel)]", props.divided !== false && "border-t"),
18
18
  role: navigates ? "navigation" : "tablist",
19
19
  children: props.tabs.map((tab) => {
20
20
  const active = tab.key === props.active;
21
- const className = cn("-mb-px inline-flex h-[42px] shrink-0 items-center gap-[7px] border-b-2 text-[13.5px] font-medium whitespace-nowrap transition-colors", active ? "border-primary text-foreground" : "text-muted-foreground hover:text-foreground border-transparent");
21
+ const className = cn("inline-flex h-[42px] shrink-0 items-center gap-[7px] border-b-2 text-[13.5px] font-medium whitespace-nowrap transition-colors", active ? "border-primary text-foreground" : "text-muted-foreground hover:text-foreground border-transparent");
22
22
  const body = /* @__PURE__ */ jsxs(Fragment, { children: [
23
23
  tab.icon && /* @__PURE__ */ jsx(tab.icon, {
24
24
  className: "size-[14px]",
@@ -1 +1 @@
1
- {"version":3,"file":"PlateTabBar.js","names":[],"sources":["../../src/shell/PlateTabBar.tsx"],"sourcesContent":["import { Link } from \"alepha/react/router\";\n\nimport { cn } from \"../core/utils.ts\";\nimport type { IconComponent } from \"../form/iconHint.tsx\";\n\nexport interface PlateTab {\n /**\n * Identifies the tab. Compared against {@link PlateTabBarProps.active}, and\n * handed back to {@link PlateTabBarProps.onSelect}. For a router-driven bar\n * this is the route name.\n */\n key: string;\n label: string;\n icon?: IconComponent;\n /**\n * A trailing count, in a pill of its own rather than folded into the label.\n * The pill's colour follows the tab's state - `text-foreground` active,\n * `text-muted-foreground` not - and a count written into the label would\n * carry one fixed class that is wrong on one of the two. Same reason\n * `Segmented` has a `count` prop.\n *\n * Show it only once its collection has resolved: `undefined` renders the\n * bare label rather than a confident \"0\".\n */\n count?: number;\n /**\n * Makes this tab a NAVIGATION rather than a state change. Present, the tab\n * is a router `Link` and `onSelect` is not called; absent, it is a button.\n *\n * Both shapes exist because both are real: a tab that swaps a panel inside\n * one route is state, and a tab that is its own route has to be a link -\n * middle-click, copy-link and the back button all depend on it.\n */\n href?: string;\n /**\n * When to fetch a tab that is a link ahead of the click. Loader data comes\n * with the code when the page's `prefetch` says it may.\n */\n prefetch?: \"hover\" | \"visible\";\n}\n\nexport interface PlateTabBarProps {\n tabs: PlateTab[];\n active: string;\n /**\n * Called for a tab with no `href`. A router-driven bar passes nothing.\n */\n onSelect?: (key: string) => void;\n /**\n * Marks the bar for tests. Worth setting: tab labels are ordinary words\n * (\"Overview\", \"Settings\") that a page-wide `getByRole` finds in the tab\n * BODIES too, and \"Settings\" is also a project-level nav entry.\n */\n testId?: string;\n /**\n * Whether to rule off the top edge. Default `true`.\n *\n * The line separates the tabs from the plate above them, so it is only\n * right when there IS one. `PlateLayout` derives this from its own `plate`\n * slot; a bar with no plate above it would otherwise draw a stray line\n * immediately under the container's top edge, which is what a caller\n * omitting the plate for the first time discovered (feedback #2095).\n */\n divided?: boolean;\n}\n\n/**\n * Underlined tabs along the bottom edge of a {@link PlateLayout}'s plate.\n *\n * Underlines rather than `Segmented`, which sits inside a toolbar as a\n * control. This bar IS the bottom edge of a full-width band, and a pill group\n * floating on that edge reads as a widget dropped onto the header rather than\n * as the header's own last row.\n */\nexport const PlateTabBar = (props: PlateTabBarProps) => {\n // A bar of links is a NAVIGATION, not a tablist, and its items are links\n // rather than tabs. `role=\"tab\"` on an anchor overrides the implicit link\n // role, which takes it out of `getByRole(\"link\")` and tells a screen reader\n // it swaps a panel when it actually leaves the page. `aria-current=\"page\"`\n // is what marks the current one in a set of navigation links.\n const navigates = props.tabs.every((tab) => tab.href !== undefined);\n\n return (\n <div\n data-testid={props.testId}\n className={cn(\n // The table header's surface, and for the same reason: this strip is\n // chrome, not body. `bg-muted` under a `--bevel` line laid just inside\n // the top edge - two adjacent lines of opposite polarity read as a\n // fold - so the band looks raised out of the page rather than painted\n // onto it. Opaque like the sticky table header, not the base header's\n // `bg-muted/50`: the plate above is already translucent over the page,\n // and stacking a second wash on it makes the two bands differ by a\n // couple of percent instead of reading as one raised object.\n //\n // The border above the bevel is whichever line closes the top edge:\n // the bar's own `border-t` when there is a plate, and the shell\n // header's bottom border when there is not. Both are `--border`, so\n // the fold reads the same either way.\n // `overflow-x-auto` so a bar wider than a phone scrolls sideways\n // instead of widening the page; the tabs never wrap or shrink.\n \"bg-muted border-border flex gap-5 overflow-x-auto px-6 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.divided !== false && \"border-t\",\n )}\n role={navigates ? \"navigation\" : \"tablist\"}\n >\n {props.tabs.map((tab) => {\n const active = tab.key === props.active;\n const className = cn(\n \"-mb-px inline-flex h-[42px] shrink-0 items-center gap-[7px] border-b-2 text-[13.5px] font-medium whitespace-nowrap transition-colors\",\n active\n ? \"border-primary text-foreground\"\n : \"text-muted-foreground hover:text-foreground border-transparent\",\n );\n const body = (\n <>\n {tab.icon && <tab.icon className=\"size-[14px]\" aria-hidden />}\n {tab.label}\n {tab.count !== undefined && (\n <span\n className={cn(\n \"bg-foreground/10 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-[5px] font-mono text-[10.5px]\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {tab.count}\n </span>\n )}\n </>\n );\n\n return tab.href !== undefined ? (\n <Link\n key={tab.key}\n href={tab.href}\n prefetch={tab.prefetch}\n aria-current={active ? \"page\" : undefined}\n className={className}\n >\n {body}\n </Link>\n ) : (\n <button\n key={tab.key}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => props.onSelect?.(tab.key)}\n className={className}\n >\n {body}\n </button>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA0EA,MAAa,eAAe,UAA4B;CAMtD,MAAM,YAAY,MAAM,KAAK,OAAO,QAAQ,IAAI,SAAS,KAAA,CAAS;CAElE,OACE,oBAAC,OAAD;EACE,eAAa,MAAM;EACnB,WAAW,GAgBT,gGACA,MAAM,YAAY,SAAS,UAC7B;EACA,MAAM,YAAY,eAAe;EAEhC,UAAA,MAAM,KAAK,KAAK,QAAQ;GACvB,MAAM,SAAS,IAAI,QAAQ,MAAM;GACjC,MAAM,YAAY,GAChB,wIACA,SACI,mCACA,gEACN;GACA,MAAM,OACJ,qBAAA,UAAA,EAAA,UAAA;IACG,IAAI,QAAQ,oBAAC,IAAI,MAAL;KAAU,WAAU;KAAc,eAAA;IAAa,CAAA;IAC3D,IAAI;IACJ,IAAI,UAAU,KAAA,KACb,oBAAC,QAAD;KACE,WAAW,GACT,gIACA,SAAS,oBAAoB,uBAC/B;KAEC,UAAA,IAAI;IACD,CAAA;GAER,EAAA,CAAA;GAGJ,OAAO,IAAI,SAAS,KAAA,IAClB,oBAAC,MAAD;IAEE,MAAM,IAAI;IACV,UAAU,IAAI;IACd,gBAAc,SAAS,SAAS,KAAA;IACrB;IAEV,UAAA;GACG,GAPC,IAAI,GAOL,IAEN,oBAAC,UAAD;IAEE,MAAK;IACL,MAAK;IACL,iBAAe;IACf,eAAe,MAAM,WAAW,IAAI,GAAG;IAC5B;IAEV,UAAA;GACK,GARD,IAAI,GAQH;EAEZ,CAAC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"PlateTabBar.js","names":[],"sources":["../../src/shell/PlateTabBar.tsx"],"sourcesContent":["import { Link } from \"alepha/react/router\";\n\nimport { cn } from \"../core/utils.ts\";\nimport type { IconComponent } from \"../form/iconHint.tsx\";\n\nexport interface PlateTab {\n /**\n * Identifies the tab. Compared against {@link PlateTabBarProps.active}, and\n * handed back to {@link PlateTabBarProps.onSelect}. For a router-driven bar\n * this is the route name.\n */\n key: string;\n label: string;\n icon?: IconComponent;\n /**\n * A trailing count, in a pill of its own rather than folded into the label.\n * The pill's colour follows the tab's state - `text-foreground` active,\n * `text-muted-foreground` not - and a count written into the label would\n * carry one fixed class that is wrong on one of the two. Same reason\n * `Segmented` has a `count` prop.\n *\n * Show it only once its collection has resolved: `undefined` renders the\n * bare label rather than a confident \"0\".\n */\n count?: number;\n /**\n * Makes this tab a NAVIGATION rather than a state change. Present, the tab\n * is a router `Link` and `onSelect` is not called; absent, it is a button.\n *\n * Both shapes exist because both are real: a tab that swaps a panel inside\n * one route is state, and a tab that is its own route has to be a link -\n * middle-click, copy-link and the back button all depend on it.\n */\n href?: string;\n /**\n * When to fetch a tab that is a link ahead of the click. Loader data comes\n * with the code when the page's `prefetch` says it may.\n */\n prefetch?: \"hover\" | \"visible\";\n}\n\nexport interface PlateTabBarProps {\n tabs: PlateTab[];\n active: string;\n /**\n * Called for a tab with no `href`. A router-driven bar passes nothing.\n */\n onSelect?: (key: string) => void;\n /**\n * Marks the bar for tests. Worth setting: tab labels are ordinary words\n * (\"Overview\", \"Settings\") that a page-wide `getByRole` finds in the tab\n * BODIES too, and \"Settings\" is also a project-level nav entry.\n */\n testId?: string;\n /**\n * Whether to rule off the top edge. Default `true`.\n *\n * The line separates the tabs from the plate above them, so it is only\n * right when there IS one. `PlateLayout` derives this from its own `plate`\n * slot; a bar with no plate above it would otherwise draw a stray line\n * immediately under the container's top edge, which is what a caller\n * omitting the plate for the first time discovered (feedback #2095).\n */\n divided?: boolean;\n}\n\n/**\n * Underlined tabs along the bottom edge of a {@link PlateLayout}'s plate.\n *\n * Underlines rather than `Segmented`, which sits inside a toolbar as a\n * control. This bar IS the bottom edge of a full-width band, and a pill group\n * floating on that edge reads as a widget dropped onto the header rather than\n * as the header's own last row.\n */\nexport const PlateTabBar = (props: PlateTabBarProps) => {\n // A bar of links is a NAVIGATION, not a tablist, and its items are links\n // rather than tabs. `role=\"tab\"` on an anchor overrides the implicit link\n // role, which takes it out of `getByRole(\"link\")` and tells a screen reader\n // it swaps a panel when it actually leaves the page. `aria-current=\"page\"`\n // is what marks the current one in a set of navigation links.\n const navigates = props.tabs.every((tab) => tab.href !== undefined);\n\n return (\n <div\n data-testid={props.testId}\n className={cn(\n // The table header's surface, and for the same reason: this strip is\n // chrome, not body. `bg-muted` under a `--bevel` line laid just inside\n // the top edge - two adjacent lines of opposite polarity read as a\n // fold - so the band looks raised out of the page rather than painted\n // onto it. Opaque like the sticky table header, not the base header's\n // `bg-muted/50`: the plate above is already translucent over the page,\n // and stacking a second wash on it makes the two bands differ by a\n // couple of percent instead of reading as one raised object.\n //\n // The border above the bevel is whichever line closes the top edge:\n // the bar's own `border-t` when there is a plate, and the shell\n // header's bottom border when there is not. Both are `--border`, so\n // the fold reads the same either way.\n // `overflow-x-auto` so a bar wider than a phone scrolls sideways\n // instead of widening the page; the tabs never wrap or shrink.\n // `overflow-x: auto` computes `overflow-y` as `auto` too, so the bar\n // is a vertical scroller as well: anything a pixel taller than it\n // shows a vertical scrollbar wherever scrollbars are always visible\n // (macOS \"always show\", Windows). `overflow-y-hidden` stops that, and\n // the tabs carry no negative bottom margin, which is what used to\n // overflow by one pixel and hide half of the active underline.\n \"bg-muted border-border flex gap-5 overflow-x-auto overflow-y-hidden px-6 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.divided !== false && \"border-t\",\n )}\n role={navigates ? \"navigation\" : \"tablist\"}\n >\n {props.tabs.map((tab) => {\n const active = tab.key === props.active;\n const className = cn(\n \"inline-flex h-[42px] shrink-0 items-center gap-[7px] border-b-2 text-[13.5px] font-medium whitespace-nowrap transition-colors\",\n active\n ? \"border-primary text-foreground\"\n : \"text-muted-foreground hover:text-foreground border-transparent\",\n );\n const body = (\n <>\n {tab.icon && <tab.icon className=\"size-[14px]\" aria-hidden />}\n {tab.label}\n {tab.count !== undefined && (\n <span\n className={cn(\n \"bg-foreground/10 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-[5px] font-mono text-[10.5px]\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {tab.count}\n </span>\n )}\n </>\n );\n\n return tab.href !== undefined ? (\n <Link\n key={tab.key}\n href={tab.href}\n prefetch={tab.prefetch}\n aria-current={active ? \"page\" : undefined}\n className={className}\n >\n {body}\n </Link>\n ) : (\n <button\n key={tab.key}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => props.onSelect?.(tab.key)}\n className={className}\n >\n {body}\n </button>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA0EA,MAAa,eAAe,UAA4B;CAMtD,MAAM,YAAY,MAAM,KAAK,OAAO,QAAQ,IAAI,SAAS,KAAA,CAAS;CAElE,OACE,oBAAC,OAAD;EACE,eAAa,MAAM;EACnB,WAAW,GAsBT,kHACA,MAAM,YAAY,SAAS,UAC7B;EACA,MAAM,YAAY,eAAe;EAEhC,UAAA,MAAM,KAAK,KAAK,QAAQ;GACvB,MAAM,SAAS,IAAI,QAAQ,MAAM;GACjC,MAAM,YAAY,GAChB,iIACA,SACI,mCACA,gEACN;GACA,MAAM,OACJ,qBAAA,UAAA,EAAA,UAAA;IACG,IAAI,QAAQ,oBAAC,IAAI,MAAL;KAAU,WAAU;KAAc,eAAA;IAAa,CAAA;IAC3D,IAAI;IACJ,IAAI,UAAU,KAAA,KACb,oBAAC,QAAD;KACE,WAAW,GACT,gIACA,SAAS,oBAAoB,uBAC/B;KAEC,UAAA,IAAI;IACD,CAAA;GAER,EAAA,CAAA;GAGJ,OAAO,IAAI,SAAS,KAAA,IAClB,oBAAC,MAAD;IAEE,MAAM,IAAI;IACV,UAAU,IAAI;IACd,gBAAc,SAAS,SAAS,KAAA;IACrB;IAEV,UAAA;GACG,GAPC,IAAI,GAOL,IAEN,oBAAC,UAAD;IAEE,MAAK;IACL,MAAK;IACL,iBAAe;IACf,eAAe,MAAM,WAAW,IAAI,GAAG;IAC5B;IAEV,UAAA;GACK,GARD,IAAI,GAQH;EAEZ,CAAC;CACE,CAAA;AAET"}
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import type { ReactNode } from "react";
3
+ export interface SidebarBackHeaderProps {
4
+ /**
5
+ * Where the arrow leads: the application's home, out of a root shell such
6
+ * as `/account` or `/admin` that is not drawn inside the application's own
7
+ * chrome. Absent, there is no arrow, for an application with nowhere to
8
+ * go back to.
9
+ */
10
+ href?: string;
11
+ /**
12
+ * Names the arrow for assistive technology, since it shows only an icon.
13
+ */
14
+ label: string;
15
+ /**
16
+ * What the header says beside the arrow: an icon and a title, or a whole
17
+ * identity block. Hidden when the sidebar folds to its icon rail, where
18
+ * the arrow alone stays.
19
+ */
20
+ children: ReactNode;
21
+ }
22
+ /**
23
+ * A root shell's sidebar header with a way out: a back arrow to the
24
+ * application's home, then what the area is.
25
+ *
26
+ * `/account` and `/admin` own the viewport, so the application's sidebar and
27
+ * its links are gone while they are open, and the only other way back is an
28
+ * item inside the account menu. The arrow is a real `Link`, so home can also
29
+ * be opened in a new tab.
30
+ *
31
+ * Collapsed to the icon rail, the words go and the arrow stays: it is the
32
+ * one part of the header a reader still needs there.
33
+ */
34
+ export declare const SidebarBackHeader: (props: SidebarBackHeaderProps) => React.JSX.Element;
35
+ //# sourceMappingURL=SidebarBackHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarBackHeader.d.ts","sourceRoot":"","sources":["../../src/shell/SidebarBackHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,UAAW,sBAAsB,sBAiB9D,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { Link } from "alepha/react/router";
2
+ import { ArrowLeft } from "lucide-react";
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/shell/SidebarBackHeader.tsx
6
+ /**
7
+ * A root shell's sidebar header with a way out: a back arrow to the
8
+ * application's home, then what the area is.
9
+ *
10
+ * `/account` and `/admin` own the viewport, so the application's sidebar and
11
+ * its links are gone while they are open, and the only other way back is an
12
+ * item inside the account menu. The arrow is a real `Link`, so home can also
13
+ * be opened in a new tab.
14
+ *
15
+ * Collapsed to the icon rail, the words go and the arrow stays: it is the
16
+ * one part of the header a reader still needs there.
17
+ */
18
+ const SidebarBackHeader = (props) => {
19
+ return /* @__PURE__ */ jsxs("div", {
20
+ className: "flex min-w-0 items-center gap-2 px-2 py-1.5 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:px-0",
21
+ children: [props.href && /* @__PURE__ */ jsx(Link, {
22
+ href: props.href,
23
+ "aria-label": props.label,
24
+ className: "text-muted-foreground hover:bg-hover hover:text-foreground flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",
25
+ children: /* @__PURE__ */ jsx(ArrowLeft, { className: "size-4 rtl:-scale-x-100" })
26
+ }), /* @__PURE__ */ jsx("div", {
27
+ className: "flex min-w-0 items-center gap-2 group-data-[collapsible=icon]:hidden",
28
+ children: props.children
29
+ })]
30
+ });
31
+ };
32
+ export { SidebarBackHeader };
33
+
34
+ //# sourceMappingURL=SidebarBackHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidebarBackHeader.js","names":[],"sources":["../../src/shell/SidebarBackHeader.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ArrowLeft } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface SidebarBackHeaderProps {\n /**\n * Where the arrow leads: the application's home, out of a root shell such\n * as `/account` or `/admin` that is not drawn inside the application's own\n * chrome. Absent, there is no arrow, for an application with nowhere to\n * go back to.\n */\n href?: string;\n /**\n * Names the arrow for assistive technology, since it shows only an icon.\n */\n label: string;\n /**\n * What the header says beside the arrow: an icon and a title, or a whole\n * identity block. Hidden when the sidebar folds to its icon rail, where\n * the arrow alone stays.\n */\n children: ReactNode;\n}\n\n/**\n * A root shell's sidebar header with a way out: a back arrow to the\n * application's home, then what the area is.\n *\n * `/account` and `/admin` own the viewport, so the application's sidebar and\n * its links are gone while they are open, and the only other way back is an\n * item inside the account menu. The arrow is a real `Link`, so home can also\n * be opened in a new tab.\n *\n * Collapsed to the icon rail, the words go and the arrow stays: it is the\n * one part of the header a reader still needs there.\n */\nexport const SidebarBackHeader = (props: SidebarBackHeaderProps) => {\n return (\n <div className=\"flex min-w-0 items-center gap-2 px-2 py-1.5 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:px-0\">\n {props.href && (\n <Link\n href={props.href}\n aria-label={props.label}\n className=\"text-muted-foreground hover:bg-hover hover:text-foreground flex size-7 shrink-0 items-center justify-center rounded-md transition-colors\"\n >\n <ArrowLeft className=\"size-4 rtl:-scale-x-100\" />\n </Link>\n )}\n <div className=\"flex min-w-0 items-center gap-2 group-data-[collapsible=icon]:hidden\">\n {props.children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,MAAa,qBAAqB,UAAkC;CAClE,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,MAAM,QACL,oBAAC,MAAD;GACE,MAAM,MAAM;GACZ,cAAY,MAAM;GAClB,WAAU;GAEV,UAAA,oBAAC,WAAD,EAAW,WAAU,0BAA2B,CAAA;EAC5C,CAAA,GAER,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,MAAM;EACJ,CAAA,CACF;;AAET"}
@@ -35,6 +35,14 @@ export interface NavItem {
35
35
  * Optional trailing badge (e.g. unread count). Hidden when the sidebar is collapsed to icons.
36
36
  */
37
37
  badge?: ReactNode;
38
+ /**
39
+ * A trailing button revealed while the row is hovered or focused, a "+"
40
+ * by default: the place to create one more of what the entry lists. It
41
+ * takes the badge's slot while it shows, so a row with a count reads the
42
+ * count at rest and offers the action under the pointer. Leaf items only,
43
+ * and hidden when the sidebar is collapsed to icons.
44
+ */
45
+ action?: NavItemAction;
38
46
  /**
39
47
  * When true the item is rendered muted, navigation is blocked, and the
40
48
  * `tooltip` (if any) explains why. Use for paywalled / unavailable entries.
@@ -48,6 +56,28 @@ export interface NavItem {
48
56
  */
49
57
  tooltip?: ReactNode;
50
58
  }
59
+ /**
60
+ * The hover action of a {@link NavItem}.
61
+ */
62
+ export interface NavItemAction {
63
+ /**
64
+ * Names the action for assistive technology and in its tooltip, since the
65
+ * button itself shows only an icon.
66
+ */
67
+ label: string;
68
+ /**
69
+ * Defaults to a plus.
70
+ */
71
+ icon?: IconType | ReactNode;
72
+ /**
73
+ * What a click does. Takes precedence over `href`.
74
+ */
75
+ onClick?: () => void;
76
+ /**
77
+ * Where a click goes, when the action is a page rather than a dialog.
78
+ */
79
+ href?: string;
80
+ }
51
81
  export interface NavGroup {
52
82
  label?: string;
53
83
  items: NavItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"appShellNav.d.ts","sourceRoot":"","sources":["../../src/shell/appShellNav.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,KAAK,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACvC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAG1D;AAED;;;;;;;;;;;GAW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.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ComponentType, ReactNode, SVGProps } from \"react\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface NavItem {\n label: ReactNode;\n /**\n * Required for leaf items. Ignored when `children` is provided (the parent becomes a toggle group).\n */\n href?: string;\n /**\n * When to fetch the page's code ahead of the click. `false` turns it off.\n *\n * @default \"hover\"\n */\n prefetch?: \"hover\" | \"visible\" | false;\n /**\n * Either an icon *component* (e.g. a lucide `Users`) which is instantiated\n * with the row's sizing className, or an already-rendered ReactNode element\n * (e.g. `<Users />`). The latter lets nav metadata declared on a `$page`\n * (which is pure React) carry its icon as a node — see `useNavTree`.\n */\n icon?: IconType | ReactNode;\n /**\n * When provided, renders as the active marker. Compare against current path.\n */\n active?: boolean;\n /**\n * Nested items. When set, the parent becomes a collapsible group.\n */\n children?: NavItem[];\n /**\n * Initial open state for groups. Defaults to true if any descendant is active.\n */\n defaultOpen?: boolean;\n /**\n * Optional trailing badge (e.g. unread count). Hidden when the sidebar is collapsed to icons.\n */\n badge?: ReactNode;\n /**\n * When true the item is rendered muted, navigation is blocked, and the\n * `tooltip` (if any) explains why. Use for paywalled / unavailable entries.\n */\n disabled?: boolean;\n /**\n * Hover tooltip shown on the row regardless of sidebar state. When the\n * item is `disabled`, this is the explanation surface (HoverCard, with\n * room to breathe). When the item is enabled, it surfaces as a regular\n * Tooltip on the trigger.\n */\n tooltip?: ReactNode;\n}\n\nexport interface NavGroup {\n label?: string;\n items: NavItem[];\n}\n\nexport function hasActiveDescendant(item: NavItem): boolean {\n if (item.active) return true;\n return (item.children ?? []).some(hasActiveDescendant);\n}\n\n/**\n * The one open branch of the nav tree, when `navAccordion` is on.\n *\n * A single path rather than a set of open ids, because \"one group open\" has to\n * mean one group open PER LEVEL: a nested group closing its own parent to open\n * itself would be a bug, not exclusivity. A path says both things at once - a\n * group is open exactly when its path is a prefix of this one, so opening a\n * sibling replaces the path (the sibling closes) while opening a child extends\n * it (the parent stays).\n *\n * Paths are indices into `nav`: `[groupIndex, itemIndex, ...childIndex]`.\n */\nexport interface NavAccordion {\n openPath: number[];\n setOpenPath: (path: number[]) => void;\n}\n\nexport function isOpenPathPrefix(path: number[], openPath: number[]): boolean {\n if (path.length === 0 || path.length > openPath.length) return false;\n return path.every((index, depth) => openPath[depth] === index);\n}\n\nexport function samePath(a: number[], b: number[]): boolean {\n return a.length === b.length && a.every((index, i) => b[i] === index);\n}\n\n/**\n * The path the accordion should be showing: the DEEPEST group holding the\n * active page, or failing that the first group asking for `defaultOpen`.\n *\n * Computed here, from the tree, rather than reported upwards by the item that\n * notices it is active. An item cannot set its parent's state during render\n * (React refuses to update another component mid-render), and doing it in an\n * effect costs a frame of the wrong group being open on every navigation.\n */\nexport function findOpenPath(nav: NavGroup[]): number[] {\n let fallback: number[] = [];\n\n const walk = (item: NavItem, path: number[]): number[] | undefined => {\n const children = item.children ?? [];\n if (children.length === 0) return undefined;\n for (let ci = 0; ci < children.length; ci++) {\n const deeper = walk(children[ci]!, [...path, ci]);\n if (deeper) return deeper;\n }\n if (hasActiveDescendant(item)) return path;\n if (fallback.length === 0 && item.defaultOpen) fallback = path;\n return undefined;\n };\n\n for (let gi = 0; gi < nav.length; gi++) {\n const items = nav[gi]?.items ?? [];\n for (let ii = 0; ii < items.length; ii++) {\n const found = walk(items[ii]!, [gi, ii]);\n if (found) return found;\n }\n }\n return fallback;\n}\n\n/**\n * Render a NavItem icon. An already-created element (e.g. `<Users />`, which\n * `React.isValidElement` recognises) is returned as-is; anything else is\n * treated as a component *type* — including lucide's `forwardRef` icons, which\n * are objects rather than plain functions — and instantiated with the row's\n * sizing className.\n */\nexport function renderNavIcon(\n icon: NavItem[\"icon\"],\n className: string,\n): ReactNode {\n if (icon == null || icon === false) return null;\n if (React.isValidElement(icon)) {\n // Already an element (e.g. `<Users />`): clone it to apply the row's sizing\n // className so element icons render at the same size as component icons,\n // merging with any className the caller already set.\n const existing = (icon.props as { className?: string })?.className;\n return React.cloneElement(\n icon as React.ReactElement<{ className?: string }>,\n {\n className: existing ? `${existing} ${className}` : className,\n },\n );\n }\n const Icon = icon as IconType;\n return <Icon className={className} />;\n}\n"],"mappings":";;;AA8DA,SAAgB,oBAAoB,MAAwB;CAC1D,IAAI,KAAK,QAAQ,OAAO;CACxB,QAAQ,KAAK,YAAY,CAAC,EAAA,CAAG,KAAK,mBAAmB;AACvD;AAmBA,SAAgB,iBAAiB,MAAgB,UAA6B;CAC5E,IAAI,KAAK,WAAW,KAAK,KAAK,SAAS,SAAS,QAAQ,OAAO;CAC/D,OAAO,KAAK,OAAO,OAAO,UAAU,SAAS,WAAW,KAAK;AAC/D;AAEA,SAAgB,SAAS,GAAa,GAAsB;CAC1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,OAAO,MAAM,EAAE,OAAO,KAAK;AACtE;;;;;;;;;;AAWA,SAAgB,aAAa,KAA2B;CACtD,IAAI,WAAqB,CAAC;CAE1B,MAAM,QAAQ,MAAe,SAAyC;EACpE,MAAM,WAAW,KAAK,YAAY,CAAC;EACnC,IAAI,SAAS,WAAW,GAAG,OAAO,KAAA;EAClC,KAAK,IAAI,KAAK,GAAG,KAAK,SAAS,QAAQ,MAAM;GAC3C,MAAM,SAAS,KAAK,SAAS,KAAM,CAAC,GAAG,MAAM,EAAE,CAAC;GAChD,IAAI,QAAQ,OAAO;EACrB;EACA,IAAI,oBAAoB,IAAI,GAAG,OAAO;EACtC,IAAI,SAAS,WAAW,KAAK,KAAK,aAAa,WAAW;CAE5D;CAEA,KAAK,IAAI,KAAK,GAAG,KAAK,IAAI,QAAQ,MAAM;EACtC,MAAM,QAAQ,IAAI,GAAG,EAAE,SAAS,CAAC;EACjC,KAAK,IAAI,KAAK,GAAG,KAAK,MAAM,QAAQ,MAAM;GACxC,MAAM,QAAQ,KAAK,MAAM,KAAM,CAAC,IAAI,EAAE,CAAC;GACvC,IAAI,OAAO,OAAO;EACpB;CACF;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,cACd,MACA,WACW;CACX,IAAI,QAAQ,QAAQ,SAAS,OAAO,OAAO;CAC3C,IAAI,MAAM,eAAe,IAAI,GAAG;EAI9B,MAAM,WAAY,KAAK,OAAkC;EACzD,OAAO,MAAM,aACX,MACA,EACE,WAAW,WAAW,GAAG,SAAS,GAAG,cAAc,UACrD,CACF;CACF;CAEA,OAAO,oBAACA,MAAD,EAAiB,UAAY,CAAA;AACtC"}
1
+ {"version":3,"file":"appShellNav.js","names":["Icon"],"sources":["../../src/shell/appShellNav.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ComponentType, ReactNode, SVGProps } from \"react\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface NavItem {\n label: ReactNode;\n /**\n * Required for leaf items. Ignored when `children` is provided (the parent becomes a toggle group).\n */\n href?: string;\n /**\n * When to fetch the page's code ahead of the click. `false` turns it off.\n *\n * @default \"hover\"\n */\n prefetch?: \"hover\" | \"visible\" | false;\n /**\n * Either an icon *component* (e.g. a lucide `Users`) which is instantiated\n * with the row's sizing className, or an already-rendered ReactNode element\n * (e.g. `<Users />`). The latter lets nav metadata declared on a `$page`\n * (which is pure React) carry its icon as a node — see `useNavTree`.\n */\n icon?: IconType | ReactNode;\n /**\n * When provided, renders as the active marker. Compare against current path.\n */\n active?: boolean;\n /**\n * Nested items. When set, the parent becomes a collapsible group.\n */\n children?: NavItem[];\n /**\n * Initial open state for groups. Defaults to true if any descendant is active.\n */\n defaultOpen?: boolean;\n /**\n * Optional trailing badge (e.g. unread count). Hidden when the sidebar is collapsed to icons.\n */\n badge?: ReactNode;\n /**\n * A trailing button revealed while the row is hovered or focused, a \"+\"\n * by default: the place to create one more of what the entry lists. It\n * takes the badge's slot while it shows, so a row with a count reads the\n * count at rest and offers the action under the pointer. Leaf items only,\n * and hidden when the sidebar is collapsed to icons.\n */\n action?: NavItemAction;\n /**\n * When true the item is rendered muted, navigation is blocked, and the\n * `tooltip` (if any) explains why. Use for paywalled / unavailable entries.\n */\n disabled?: boolean;\n /**\n * Hover tooltip shown on the row regardless of sidebar state. When the\n * item is `disabled`, this is the explanation surface (HoverCard, with\n * room to breathe). When the item is enabled, it surfaces as a regular\n * Tooltip on the trigger.\n */\n tooltip?: ReactNode;\n}\n\n/**\n * The hover action of a {@link NavItem}.\n */\nexport interface NavItemAction {\n /**\n * Names the action for assistive technology and in its tooltip, since the\n * button itself shows only an icon.\n */\n label: string;\n /**\n * Defaults to a plus.\n */\n icon?: IconType | ReactNode;\n /**\n * What a click does. Takes precedence over `href`.\n */\n onClick?: () => void;\n /**\n * Where a click goes, when the action is a page rather than a dialog.\n */\n href?: string;\n}\n\nexport interface NavGroup {\n label?: string;\n items: NavItem[];\n}\n\nexport function hasActiveDescendant(item: NavItem): boolean {\n if (item.active) return true;\n return (item.children ?? []).some(hasActiveDescendant);\n}\n\n/**\n * The one open branch of the nav tree, when `navAccordion` is on.\n *\n * A single path rather than a set of open ids, because \"one group open\" has to\n * mean one group open PER LEVEL: a nested group closing its own parent to open\n * itself would be a bug, not exclusivity. A path says both things at once - a\n * group is open exactly when its path is a prefix of this one, so opening a\n * sibling replaces the path (the sibling closes) while opening a child extends\n * it (the parent stays).\n *\n * Paths are indices into `nav`: `[groupIndex, itemIndex, ...childIndex]`.\n */\nexport interface NavAccordion {\n openPath: number[];\n setOpenPath: (path: number[]) => void;\n}\n\nexport function isOpenPathPrefix(path: number[], openPath: number[]): boolean {\n if (path.length === 0 || path.length > openPath.length) return false;\n return path.every((index, depth) => openPath[depth] === index);\n}\n\nexport function samePath(a: number[], b: number[]): boolean {\n return a.length === b.length && a.every((index, i) => b[i] === index);\n}\n\n/**\n * The path the accordion should be showing: the DEEPEST group holding the\n * active page, or failing that the first group asking for `defaultOpen`.\n *\n * Computed here, from the tree, rather than reported upwards by the item that\n * notices it is active. An item cannot set its parent's state during render\n * (React refuses to update another component mid-render), and doing it in an\n * effect costs a frame of the wrong group being open on every navigation.\n */\nexport function findOpenPath(nav: NavGroup[]): number[] {\n let fallback: number[] = [];\n\n const walk = (item: NavItem, path: number[]): number[] | undefined => {\n const children = item.children ?? [];\n if (children.length === 0) return undefined;\n for (let ci = 0; ci < children.length; ci++) {\n const deeper = walk(children[ci]!, [...path, ci]);\n if (deeper) return deeper;\n }\n if (hasActiveDescendant(item)) return path;\n if (fallback.length === 0 && item.defaultOpen) fallback = path;\n return undefined;\n };\n\n for (let gi = 0; gi < nav.length; gi++) {\n const items = nav[gi]?.items ?? [];\n for (let ii = 0; ii < items.length; ii++) {\n const found = walk(items[ii]!, [gi, ii]);\n if (found) return found;\n }\n }\n return fallback;\n}\n\n/**\n * Render a NavItem icon. An already-created element (e.g. `<Users />`, which\n * `React.isValidElement` recognises) is returned as-is; anything else is\n * treated as a component *type* — including lucide's `forwardRef` icons, which\n * are objects rather than plain functions — and instantiated with the row's\n * sizing className.\n */\nexport function renderNavIcon(\n icon: NavItem[\"icon\"],\n className: string,\n): ReactNode {\n if (icon == null || icon === false) return null;\n if (React.isValidElement(icon)) {\n // Already an element (e.g. `<Users />`): clone it to apply the row's sizing\n // className so element icons render at the same size as component icons,\n // merging with any className the caller already set.\n const existing = (icon.props as { className?: string })?.className;\n return React.cloneElement(\n icon as React.ReactElement<{ className?: string }>,\n {\n className: existing ? `${existing} ${className}` : className,\n },\n );\n }\n const Icon = icon as IconType;\n return <Icon className={className} />;\n}\n"],"mappings":";;;AA6FA,SAAgB,oBAAoB,MAAwB;CAC1D,IAAI,KAAK,QAAQ,OAAO;CACxB,QAAQ,KAAK,YAAY,CAAC,EAAA,CAAG,KAAK,mBAAmB;AACvD;AAmBA,SAAgB,iBAAiB,MAAgB,UAA6B;CAC5E,IAAI,KAAK,WAAW,KAAK,KAAK,SAAS,SAAS,QAAQ,OAAO;CAC/D,OAAO,KAAK,OAAO,OAAO,UAAU,SAAS,WAAW,KAAK;AAC/D;AAEA,SAAgB,SAAS,GAAa,GAAsB;CAC1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,OAAO,MAAM,EAAE,OAAO,KAAK;AACtE;;;;;;;;;;AAWA,SAAgB,aAAa,KAA2B;CACtD,IAAI,WAAqB,CAAC;CAE1B,MAAM,QAAQ,MAAe,SAAyC;EACpE,MAAM,WAAW,KAAK,YAAY,CAAC;EACnC,IAAI,SAAS,WAAW,GAAG,OAAO,KAAA;EAClC,KAAK,IAAI,KAAK,GAAG,KAAK,SAAS,QAAQ,MAAM;GAC3C,MAAM,SAAS,KAAK,SAAS,KAAM,CAAC,GAAG,MAAM,EAAE,CAAC;GAChD,IAAI,QAAQ,OAAO;EACrB;EACA,IAAI,oBAAoB,IAAI,GAAG,OAAO;EACtC,IAAI,SAAS,WAAW,KAAK,KAAK,aAAa,WAAW;CAE5D;CAEA,KAAK,IAAI,KAAK,GAAG,KAAK,IAAI,QAAQ,MAAM;EACtC,MAAM,QAAQ,IAAI,GAAG,EAAE,SAAS,CAAC;EACjC,KAAK,IAAI,KAAK,GAAG,KAAK,MAAM,QAAQ,MAAM;GACxC,MAAM,QAAQ,KAAK,MAAM,KAAM,CAAC,IAAI,EAAE,CAAC;GACvC,IAAI,OAAO,OAAO;EACpB;CACF;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,cACd,MACA,WACW;CACX,IAAI,QAAQ,QAAQ,SAAS,OAAO,OAAO;CAC3C,IAAI,MAAM,eAAe,IAAI,GAAG;EAI9B,MAAM,WAAY,KAAK,OAAkC;EACzD,OAAO,MAAM,aACX,MACA,EACE,WAAW,WAAW,GAAG,SAAS,GAAG,cAAc,UACrD,CACF;CACF;CAEA,OAAO,oBAACA,MAAD,EAAiB,UAAY,CAAA;AACtC"}
@@ -19,7 +19,7 @@ export { ActionErrorToaster, type ActionErrorToasterProps, } from "./ActionError
19
19
  export { $pageNav, type PageNavOptions } from "./$pageNav.tsx";
20
20
  export { AppActions, type AppActionsProps } from "./AppActions.tsx";
21
21
  export { AppShell, type AppShellProps, type NavigationProgressOptions, } from "./AppShell.tsx";
22
- export type { NavGroup, NavItem } from "./appShellNav.tsx";
22
+ export type { NavGroup, NavItem, NavItemAction } from "./appShellNav.tsx";
23
23
  export { ButtonDark, type ButtonDarkProps } from "./ButtonDark.tsx";
24
24
  export { ButtonInbox, type ButtonInboxProps } from "./ButtonInbox.tsx";
25
25
  export { ButtonLanguage, type ButtonLanguageProps } from "./ButtonLanguage.tsx";
@@ -40,6 +40,7 @@ export { NavigationProgress, type NavigationProgressProps, } from "./NavigationP
40
40
  export { NavShell, type NavShellProps } from "./NavShell.tsx";
41
41
  export { PlateLayout, type PlateLayoutProps } from "./PlateLayout.tsx";
42
42
  export type { PlateTab } from "./PlateTabBar.tsx";
43
+ export { SidebarBackHeader, type SidebarBackHeaderProps, } from "./SidebarBackHeader.tsx";
43
44
  export { SidebarNavAutoClose } from "./SidebarNavAutoClose.tsx";
44
45
  export { Spotlight, type SpotlightProps } from "./Spotlight.tsx";
45
46
  export { useDetailTab } from "./useDetailTab.tsx";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,yBAAyB,GAC/B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CA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AAY,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAClF,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,YAAY,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -14,7 +14,8 @@ import { inboxUnreadAtom } from "./inboxUnreadAtom.js";
14
14
  import { NavigationProgress } from "./NavigationProgress.js";
15
15
  import { NavShell } from "./NavShell.js";
16
16
  import { PlateLayout } from "./PlateLayout.js";
17
+ import { SidebarBackHeader } from "./SidebarBackHeader.js";
17
18
  import { SidebarNavAutoClose } from "./SidebarNavAutoClose.js";
18
19
  import { Spotlight } from "./Spotlight.js";
19
20
  import { useDetailTab } from "./useDetailTab.js";
20
- export { $pageNav, ActionErrorToaster, AppActions, AppShell, ButtonDark, ButtonInbox, ButtonLanguage, ButtonSettings, ButtonTheme, ButtonUser, DetailAside, DetailLayout, NavShell, NavigationProgress, PlateLayout, SidebarNavAutoClose, Spotlight, inboxUnreadAtom, useDetailTab };
21
+ export { $pageNav, ActionErrorToaster, AppActions, AppShell, ButtonDark, ButtonInbox, ButtonLanguage, ButtonSettings, ButtonTheme, ButtonUser, DetailAside, DetailLayout, NavShell, NavigationProgress, PlateLayout, SidebarBackHeader, SidebarNavAutoClose, Spotlight, inboxUnreadAtom, useDetailTab };