@burojs/ui-shadcn 0.8.0 → 0.9.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 (115) hide show
  1. package/dist/{candidates-relation-picker-CGXItMN0.js → candidates-relation-picker-QvoY2bOQ.js} +3 -3
  2. package/dist/{candidates-relation-picker-CGXItMN0.js.map → candidates-relation-picker-QvoY2bOQ.js.map} +1 -1
  3. package/dist/{candidates-relation-picker-C47mF260.cjs → candidates-relation-picker-pEAWKQEY.cjs} +3 -3
  4. package/dist/{candidates-relation-picker-C47mF260.cjs.map → candidates-relation-picker-pEAWKQEY.cjs.map} +1 -1
  5. package/dist/{check-confirm-dialog-CtiRzOAt.js → check-confirm-dialog-B-CbJTln.js} +59 -6
  6. package/dist/{check-confirm-dialog-CtiRzOAt.js.map → check-confirm-dialog-B-CbJTln.js.map} +1 -1
  7. package/dist/{check-confirm-dialog-BT04Mieo.cjs → check-confirm-dialog-W-8WOmGh.cjs} +64 -5
  8. package/dist/{check-confirm-dialog-BT04Mieo.cjs.map → check-confirm-dialog-W-8WOmGh.cjs.map} +1 -1
  9. package/dist/{filter-builder-z3Axzf9Y.js → filter-builder-04nas3eq.js} +14 -6
  10. package/dist/filter-builder-04nas3eq.js.map +1 -0
  11. package/dist/{filter-builder-ByGhxLf_.cjs → filter-builder-DQX-TMFh.cjs} +14 -6
  12. package/dist/filter-builder-DQX-TMFh.cjs.map +1 -0
  13. package/dist/{flow-runtime-DrUWyTS0.js → flow-runtime-BEIyym7d.js} +3 -3
  14. package/dist/{flow-runtime-DrUWyTS0.js.map → flow-runtime-BEIyym7d.js.map} +1 -1
  15. package/dist/{flow-runtime-BVFjMU5-.cjs → flow-runtime-DyNIYfUP.cjs} +3 -3
  16. package/dist/{flow-runtime-BVFjMU5-.cjs.map → flow-runtime-DyNIYfUP.cjs.map} +1 -1
  17. package/dist/{flow-screen-3fk6J33y.js → flow-screen-DY1Z9PbG.js} +53 -14
  18. package/dist/flow-screen-DY1Z9PbG.js.map +1 -0
  19. package/dist/{flow-screen-6y5E_HT6.cjs → flow-screen-FE5Xhb3t.cjs} +52 -13
  20. package/dist/flow-screen-FE5Xhb3t.cjs.map +1 -0
  21. package/dist/index.cjs +54 -71
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +49 -10
  24. package/dist/index.d.ts +49 -10
  25. package/dist/index.js +54 -72
  26. package/dist/index.js.map +1 -1
  27. package/dist/{inline-flow-host-YnnvWjdU.js → inline-flow-host-D6u-RlsV.js} +3 -3
  28. package/dist/{inline-flow-host-YnnvWjdU.js.map → inline-flow-host-D6u-RlsV.js.map} +1 -1
  29. package/dist/{inline-flow-host-C4KmZIYE.cjs → inline-flow-host-yVLo6-sM.cjs} +3 -3
  30. package/dist/{inline-flow-host-C4KmZIYE.cjs.map → inline-flow-host-yVLo6-sM.cjs.map} +1 -1
  31. package/dist/{lazy-relation-picker-dialog-DN4bvQfg.js → lazy-relation-picker-dialog-BaORufxQ.js} +2 -2
  32. package/dist/{lazy-relation-picker-dialog-DN4bvQfg.js.map → lazy-relation-picker-dialog-BaORufxQ.js.map} +1 -1
  33. package/dist/{lazy-relation-picker-dialog-BAKBRn3V.cjs → lazy-relation-picker-dialog-C_VlGlDz.cjs} +2 -2
  34. package/dist/{lazy-relation-picker-dialog-BAKBRn3V.cjs.map → lazy-relation-picker-dialog-C_VlGlDz.cjs.map} +1 -1
  35. package/dist/{page-flow-route-CtEfqAvU.js → page-flow-route-CyMzUidK.js} +7 -7
  36. package/dist/page-flow-route-CyMzUidK.js.map +1 -0
  37. package/dist/{page-flow-route-DEjAxHe3.cjs → page-flow-route-OFx7h7Ja.cjs} +6 -6
  38. package/dist/page-flow-route-OFx7h7Ja.cjs.map +1 -0
  39. package/dist/{place-node-Bhl8B3fF.cjs → place-node-BZF5Af6x.cjs} +67 -23
  40. package/dist/place-node-BZF5Af6x.cjs.map +1 -0
  41. package/dist/{place-node-BdxT-30h.js → place-node-DRjmJGQ_.js} +69 -25
  42. package/dist/place-node-DRjmJGQ_.js.map +1 -0
  43. package/dist/{related-list-cards-BvkD5OcC.js → related-list-cards-2hLitVkg.js} +3 -3
  44. package/dist/{related-list-cards-BvkD5OcC.js.map → related-list-cards-2hLitVkg.js.map} +1 -1
  45. package/dist/{related-list-cards-Bc_vfCE_.cjs → related-list-cards-xVvgSlu-.cjs} +3 -3
  46. package/dist/{related-list-cards-Bc_vfCE_.cjs.map → related-list-cards-xVvgSlu-.cjs.map} +1 -1
  47. package/dist/{related-list-timeline-DCrwN9oO.js → related-list-timeline-CxJqe6eK.js} +4 -4
  48. package/dist/related-list-timeline-CxJqe6eK.js.map +1 -0
  49. package/dist/{related-list-timeline-k0DtnxTs.cjs → related-list-timeline-Dsf5WewG.cjs} +4 -4
  50. package/dist/related-list-timeline-Dsf5WewG.cjs.map +1 -0
  51. package/dist/{related-rows-BW9Jr07T.cjs → related-rows-DDhp9axl.cjs} +4 -4
  52. package/dist/{related-rows-BW9Jr07T.cjs.map → related-rows-DDhp9axl.cjs.map} +1 -1
  53. package/dist/{related-rows-CPE-9FFr.js → related-rows-DL6CWsrj.js} +4 -4
  54. package/dist/{related-rows-CPE-9FFr.js.map → related-rows-DL6CWsrj.js.map} +1 -1
  55. package/dist/{relation-create-C43cdPQt.js → relation-create-6WicROWA.js} +33 -5
  56. package/dist/relation-create-6WicROWA.js.map +1 -0
  57. package/dist/{relation-create-DDEYcKfw.cjs → relation-create-_SFuPQGM.cjs} +37 -3
  58. package/dist/relation-create-_SFuPQGM.cjs.map +1 -0
  59. package/dist/{relation-many-picker-Br-zBHxT.cjs → relation-many-picker-BBNsmkaX.cjs} +12 -10
  60. package/dist/relation-many-picker-BBNsmkaX.cjs.map +1 -0
  61. package/dist/{relation-many-picker-BlrGRwMV.js → relation-many-picker-mGEQDWo2.js} +12 -10
  62. package/dist/relation-many-picker-mGEQDWo2.js.map +1 -0
  63. package/dist/{relation-picker-x7P5HKie.js → relation-picker-BbO41cFV.js} +13 -10
  64. package/dist/relation-picker-BbO41cFV.js.map +1 -0
  65. package/dist/{relation-picker-dialog-CyKliBkN.js → relation-picker-dialog-BgSG_8bU.js} +5 -5
  66. package/dist/relation-picker-dialog-BgSG_8bU.js.map +1 -0
  67. package/dist/{relation-picker-dialog-DimVQF9Y.cjs → relation-picker-dialog-Duqy2r0n.cjs} +5 -5
  68. package/dist/relation-picker-dialog-Duqy2r0n.cjs.map +1 -0
  69. package/dist/{relation-picker-ADjxI_TI.cjs → relation-picker-jk9D_uwn.cjs} +13 -10
  70. package/dist/relation-picker-jk9D_uwn.cjs.map +1 -0
  71. package/dist/{relation-select-Cr3CfNLy.cjs → relation-select-C3aV18kT.cjs} +2 -2
  72. package/dist/{relation-select-Cr3CfNLy.cjs.map → relation-select-C3aV18kT.cjs.map} +1 -1
  73. package/dist/{relation-select-B8Fq4o-t.js → relation-select-CjQT9LpS.js} +2 -2
  74. package/dist/{relation-select-B8Fq4o-t.js.map → relation-select-CjQT9LpS.js.map} +1 -1
  75. package/dist/{resource-page-router-BRpUnhay.js → resource-page-router-CzaNATSp.js} +71 -19
  76. package/dist/resource-page-router-CzaNATSp.js.map +1 -0
  77. package/dist/{resource-page-router-qEd2xb55.cjs → resource-page-router-dmVIeu5s.cjs} +81 -17
  78. package/dist/resource-page-router-dmVIeu5s.cjs.map +1 -0
  79. package/dist/{success-notices-Dl3M1fZP.cjs → success-notices-Cl4b6MLQ.cjs} +3 -2
  80. package/dist/success-notices-Cl4b6MLQ.cjs.map +1 -0
  81. package/dist/{success-notices-LDEgEkc4.js → success-notices-CrcWOGSo.js} +3 -2
  82. package/dist/success-notices-CrcWOGSo.js.map +1 -0
  83. package/dist/{use-dialog-filter-state-B_MqzHaT.js → use-dialog-filter-state-CJoeY-1j.js} +2 -2
  84. package/dist/{use-dialog-filter-state-B_MqzHaT.js.map → use-dialog-filter-state-CJoeY-1j.js.map} +1 -1
  85. package/dist/{use-dialog-filter-state-tNvqAAjh.cjs → use-dialog-filter-state-lsTJxrB4.cjs} +2 -2
  86. package/dist/{use-dialog-filter-state-tNvqAAjh.cjs.map → use-dialog-filter-state-lsTJxrB4.cjs.map} +1 -1
  87. package/dist/{use-record-subtitle-bfwIoUme.cjs → use-record-subtitle-BJ9rnj6F.cjs} +5 -8
  88. package/dist/use-record-subtitle-BJ9rnj6F.cjs.map +1 -0
  89. package/dist/{use-record-subtitle-gIaCGgbI.js → use-record-subtitle-w3ZhXNlf.js} +5 -8
  90. package/dist/use-record-subtitle-w3ZhXNlf.js.map +1 -0
  91. package/package.json +9 -9
  92. package/dist/filter-builder-ByGhxLf_.cjs.map +0 -1
  93. package/dist/filter-builder-z3Axzf9Y.js.map +0 -1
  94. package/dist/flow-screen-3fk6J33y.js.map +0 -1
  95. package/dist/flow-screen-6y5E_HT6.cjs.map +0 -1
  96. package/dist/page-flow-route-CtEfqAvU.js.map +0 -1
  97. package/dist/page-flow-route-DEjAxHe3.cjs.map +0 -1
  98. package/dist/place-node-BdxT-30h.js.map +0 -1
  99. package/dist/place-node-Bhl8B3fF.cjs.map +0 -1
  100. package/dist/related-list-timeline-DCrwN9oO.js.map +0 -1
  101. package/dist/related-list-timeline-k0DtnxTs.cjs.map +0 -1
  102. package/dist/relation-create-C43cdPQt.js.map +0 -1
  103. package/dist/relation-create-DDEYcKfw.cjs.map +0 -1
  104. package/dist/relation-many-picker-BlrGRwMV.js.map +0 -1
  105. package/dist/relation-many-picker-Br-zBHxT.cjs.map +0 -1
  106. package/dist/relation-picker-ADjxI_TI.cjs.map +0 -1
  107. package/dist/relation-picker-dialog-CyKliBkN.js.map +0 -1
  108. package/dist/relation-picker-dialog-DimVQF9Y.cjs.map +0 -1
  109. package/dist/relation-picker-x7P5HKie.js.map +0 -1
  110. package/dist/resource-page-router-BRpUnhay.js.map +0 -1
  111. package/dist/resource-page-router-qEd2xb55.cjs.map +0 -1
  112. package/dist/success-notices-Dl3M1fZP.cjs.map +0 -1
  113. package/dist/success-notices-LDEgEkc4.js.map +0 -1
  114. package/dist/use-record-subtitle-bfwIoUme.cjs.map +0 -1
  115. package/dist/use-record-subtitle-gIaCGgbI.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-page-router-dmVIeu5s.cjs","names":["canonicalEntityNodeKey","navHrefFor","matchPath","nodeKind","resolveNavLabel","declaredText","resolveResourceNavLabel","useLinkComponent","cn","useI18nCaps","resolveNavLabel","declaredText","useLinkComponent","useI18nCaps","resolveNavLabel","declaredText","cn","useComponent","useContext","ComponentsContext","useApp","useVisibilityCtx","useCallback","evaluateVisible","isCustomPageDef","usePermissions","pageAccessFor","useApp","hrefFor","useOptionalRouterAdapter","matchPath","createContext","useContext","useOptionalT","useChromeT","useLoaded","loadPageFlowRoute","loadFailedText","Button","RecordState","FlowBoundary","routeResourceKey","useRouteListImplementation","selectImplementation","viewOf","useTranslate","useMemo","normalizeEntityRef","RouteListContext","Suspense","useVisibilityCtx","usePageAccess","evaluateVisible","RecordState","useOptionalRouterAdapter","pageParamNames","useMemo","parsePageParams","RouteSourceContext","useApplicationSnapshot","compilePageScreen","snapshotBlockLookup","snapshotFrameLookup","snapshotAppFrames","isScreenFailure","useI18nCaps","resolveNavLabel","declaredText","useTabsUrlState","RouteScreenClaimContext","RouteScreenContext","ScreenStateProvider","usePageScreen","useContext","useFrameImplementations","formatEntityRef","resolveFrameView","useFrameT","ScreenTree","ActionRouteContext","DeepLinkScope","Suspense","createContext","useContext","useId","useRef","useMemo","FrameCheckContext","useRecordFrame","useOptionalT","useTestIds","Button","recordKeyOf","useFrameChrome","useApp","FORM_SLOT","ScreenTree","fieldSensitivity","useRecordFrame","useMemo","useRef","formatEntityRef","builtinFrames","FORM_SLOT","useFrameChrome","useQuickEntry","useApp","useFrameImplementations","resolveFrameView","useFrameT","useFieldAccess","policyRecordOf","useShownItemActions","isBuiltinRecordView","HeaderTypeNotice","ChangeTypeButton","TypeChromeDrawnContext","Suspense","RecordState","useApp","useRowTitle","useList","useMemo","recordKeyOf","useApp","useScope","useChromeT","useMemo","scopeColumnOf","Button","humanizeKey","useApp","useOptionalT","useTestIds","Skeleton","FieldDisplay","useState","useMemo","routeServerIssues","useRef","useFormController","useTestIds","useId","useNoticeSink","useIsRouteScreen","useCallback","successNoticesOf","normalizeIssueInputs","issueOfInput","useOptionalRouterAdapter","useNavigationGuardText","useApp","useFormControlOf","useContext","RouteSourceContext","RecordScopeProvider","ActionRouteContext","RecordFrameContext","FrameChromeContext","FormControlProvider","DeepLinkScope","RecordState","FormActions","UndeclaredTypeNotice","CheckConfirmDialog","RouteScreenClaimContext","QuickScreenClaimContext","resourceKey","useTabsUrlState","useRouteNavigate","RouteScreenContext","ResourceContext","ScreenStateProvider","useApp","useCallback","useSyncExternalStore","recordRouteAvailable","useApp","useI18nCaps","useT","resolveNavLabel","declaredText","ORIGIN_DEPTH","matchPath","hasListPage","hrefFor","resolveRoute","resolveResourceLabel","recordRouteAvailable","maybeThen","settle","useCurrentUserId","usePlatformStorage","useApp","recordKeyOf","fieldSensitivity","addressesCapability","canonicalResourceName","useRef","useRecordTitle","PageHeader","useRouteNavigate","useReturnTarget","useApp","useOptionalRouterAdapter","RouteScreenClaimContext","useMemo","dtoFields","useOne","retryRecordRead","useProjectedRecord","useAvailabilityResolver","useCtx","addressesCapability","permissionsUndecided","RecordState","RouteSourceContext","LoadError","useRouteRecordId","InvalidRouteId","useOptionalDataRuntime","routeResourceKey","useT","useApp","hasListPage","recordRouteAvailable","useOptionalRouterAdapter","Suspense"],"sources":["../src/resource-key.ts","../src/layout/build-nav-items.ts","../src/layout/layouts/secondary-sidebar-layout.tsx","../src/layout/layouts/tabs-layout.tsx","../src/layout/nav-slots.ts","../src/layout/use-nav-routing.ts","../src/layout/nav-chrome-mounted.ts","../src/flows/page-flow-loader.tsx","../src/list-kit/resource-list-page.tsx","../src/layout/page-host.tsx","../src/frames/obligations.tsx","../src/frames/slot-wrapper.tsx","../src/frames/record-frame-host.tsx","../src/layout/use-dimension-options.ts","../src/record/scope-mismatch-banner.tsx","../src/record/type-offer.tsx","../src/record/record-screen.tsx","../src/layout/record-trail-store.ts","../src/layout/record-targets.ts","../src/layout/route-trail.ts","../src/layout/recent-records.ts","../src/layout/use-record-visit.ts","../src/layout/record-page.tsx","../src/layout/resource-page-router.tsx"],"sourcesContent":["import { canonicalEntityNodeKey, type CanonicalEntityNode, type ResourceDef } from '@burojs/core';\n\nexport type CanonicalNodeShape = CanonicalEntityNode;\n\n/** Canonical identity for any registry node or route ref. */\nexport function canonicalNavKey(node: CanonicalNodeShape): string {\n return canonicalEntityNodeKey(node);\n}\n\n/** Canonical UI/query identity; default resources retain their legacy short key. */\nexport function canonicalResourceKey(def: ResourceDef): string {\n return canonicalNavKey(def);\n}\n","import {\n type AppRuntime,\n type I18nCaps,\n type NavNode,\n type ResourceLabels,\n type RouteMatch,\n matchPath,\n navHrefFor,\n nodeKind,\n resolveNavLabel,\n resolveResourceNavLabel,\n declaredText,\n} from '@burojs/core';\nimport type { ReactNode } from 'react';\nimport type { NavItem } from './nav-slots.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nexport interface BuildNavItemsArgs {\n registry: AppRuntime['registry'];\n caps: I18nCaps;\n groupName: string;\n match: RouteMatch | null;\n isVisible: (node: NavNode) => boolean;\n entryFilter?: (node: NavNode) => boolean;\n icons?: {\n resource?: (name: string) => ReactNode;\n page?: (name: string) => ReactNode;\n group?: (name: string) => ReactNode;\n };\n}\n\n/**\n * A group's link: its first reachable member's URL, or `undefined` when no\n * member is reachable under `isVisible`. A pathless group's `navHrefFor` throws\n * then, and a pathed one's resolves to a root `matchPath` refuses; either way\n * the group has nowhere to link to. The one rule for every surface that links\n * a group — the sidebar and an area's chrome drop such a group, the palette\n * offers no jump to it, a breadcrumb renders it as text — so a participant\n * denied every member of a group never takes the navigation down with it.\n */\nexport function groupNavHref(\n registry: AppRuntime['registry'],\n group: string,\n isVisible: (node: NavNode) => boolean,\n): string | undefined {\n let href: string;\n try {\n href = navHrefFor(registry, group, { isVisible });\n } catch {\n return undefined;\n }\n return matchPath(registry, href, { isVisible }) === null ? undefined : href;\n}\n\n/**\n * Resolve a group's direct children into NavItems: href via `navHrefFor`\n * (nesting-independent; resolves a sub-group directly to its visible target,\n * skipping the group-root redirect hop so React reconciles the nested chrome\n * instead of remounting it), label via the i18n resolvers (reactive on locale),\n * and `active` via the spec §8.2 rule — a leaf is active when it IS the\n * current match; a sub-group is active when it is an ANCESTOR of the match\n * (on `match.groupChain`). Children failing `isVisible`/`entryFilter` drop,\n * and so does a sub-group with no reachable member (`groupNavHref`).\n */\nexport function buildNavItems(args: BuildNavItemsArgs): NavItem[] {\n const { registry, caps, groupName, match, isVisible, entryFilter, icons } = args;\n const chain = match?.groupChain ?? [];\n // On a group-index match, match.name is the GROUP; the shown page is match.target\n // (the index page, or the first-visible-descendant leaf). Highlight THAT.\n const qualifiedMatch = match as\n | (RouteMatch & {\n readonly ref?: Readonly<{ namespace: string; id: string }>;\n readonly targetRef?: Readonly<{ namespace: string; id: string }>;\n })\n | null;\n const activeLeaf =\n qualifiedMatch == null\n ? undefined\n : qualifiedMatch.kind === 'group-index'\n ? canonicalNavKey({\n name: qualifiedMatch.target ?? qualifiedMatch.name,\n ref: qualifiedMatch.targetRef,\n })\n : canonicalNavKey(qualifiedMatch);\n const isEligible = (node: NavNode): boolean =>\n isVisible(node) && (entryFilter ? entryFilter(node) : true);\n const out: NavItem[] = [];\n for (const child of registry.groups.childrenOf(groupName)) {\n if (!isEligible(child as NavNode)) continue;\n const kind = nodeKind(child);\n const childKey = canonicalNavKey(child);\n if (kind === 'group') {\n const href = groupNavHref(registry, childKey, isEligible);\n if (href === undefined) continue;\n const label = resolveNavLabel(\n caps,\n `groups.${childKey}`,\n declaredText('chrome', child, 'label'),\n );\n const active = chain.some((g) => canonicalNavKey(g) === childKey);\n out.push({\n kind: 'group',\n name: childKey,\n label,\n href,\n icon: icons?.group?.(childKey),\n active,\n });\n continue;\n }\n const href = navHrefFor(registry, childKey, { isVisible: isEligible });\n if (kind === 'custom-page') {\n out.push({\n kind: 'custom-page',\n name: childKey,\n label: resolveNavLabel(caps, `pages.${childKey}`, declaredText('chrome', child, 'label')),\n href,\n icon: icons?.page?.(childKey),\n active: activeLeaf === childKey,\n });\n } else {\n out.push({\n kind: 'resource',\n name: childKey,\n /*\n `navLabel` first, the plural label otherwise.\n\n A sidebar entry and a page title are not always the same phrase. Under\n a «Documents» section the entry wants to read «All documents» — it\n sits beside the individual kinds and has to say which one it is —\n while the breadcrumb still wants «Documents › wo:2921», because «All\n documents › wo:2921» is not a sentence anyone would write.\n\n A LEAF string, deliberately: a `nav` object with a `.label` inside\n would put an object node in the lookup path, and i18next answers\n `exists()` true for those while `t()` returns the literal\n \"key '…' returned an object instead of string.\" — the exact trap this\n codebase has already been bitten by.\n */\n label: resolveResourceNavLabel(caps, childKey, child as ResourceLabels),\n href,\n icon: icons?.resource?.(childKey),\n active: activeLeaf === childKey,\n });\n }\n }\n return out;\n}\n","'use client';\nimport { resolveNavLabel, declaredText } from '@burojs/core';\nimport { useI18nCaps } from '@burojs/react';\nimport type { NavItem, NavLayoutProps } from '../nav-slots.js';\nimport { useLinkComponent } from '../link-component.js';\nimport { cn } from '../../lib/cn.js';\n\n/**\n * A single clickable rail row — icon + label: active fills with\n * `bg-secondary`, inactive is muted with a subtle hover. No chevron, no\n * indicator bar — the fill itself IS the active state.\n */\nfunction Row({ it }: { it: NavItem }): React.ReactElement {\n const RouterLink = useLinkComponent();\n return (\n <li>\n <RouterLink\n href={it.href}\n data-testid={`nav-secondary-item:${it.name}`}\n aria-current={it.active ? 'page' : undefined}\n className={cn(\n 'flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium outline-hidden ring-offset-background transition-colors',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',\n it.active\n ? 'bg-secondary text-secondary-foreground'\n : 'text-muted-foreground hover:bg-secondary/50 hover:text-foreground',\n )}\n >\n {it.icon != null && (\n <span\n className=\"inline-flex h-4 w-4 shrink-0 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {it.icon}\n </span>\n )}\n {/* `title` reveals the full label on hover when a long RU label\n truncates against the rail's fixed width. */}\n <span className=\"truncate\" title={it.label}>\n {it.label}\n </span>\n </RouterLink>\n </li>\n );\n}\n\n/**\n * Content-wrapping layout: a secondary navigation rail beside the page\n * content — FLUSH to the left edge,\n * FULL-HEIGHT, a `border-r` divider on `bg-background` (not a detached\n * rounded card). The outer wrapper breaks out of AppLayout's `md:p-6`\n * content padding at `md+` via negative margins, then restores it on the\n * content pane so only the rail itself goes flush. On `< md` the rail\n * flattens into a horizontally-scrollable pill row (scroll-snapped,\n * edge-faded) so it never crowds the content. Tokens only → automatically\n * light/dark aware.\n */\nexport function SecondarySidebarLayout({\n group,\n groupKey,\n items,\n children,\n}: NavLayoutProps): React.ReactElement {\n const RouterLink = useLinkComponent();\n const caps = useI18nCaps();\n const id = groupKey ?? group.name;\n const label = resolveNavLabel(caps, `groups.${id}`, declaredText('chrome', group, 'label'));\n\n return (\n <div className=\"md:-m-6 md:flex md:min-h-[calc(100%+3rem)]\" data-testid={`nav-secondary:${id}`}>\n {/* Rail (md+) — flush, full-height. */}\n <aside className=\"hidden w-64 shrink-0 border-r bg-background text-foreground md:block\">\n <div className=\"space-y-4 p-4\">\n <p className=\"px-3 text-base font-semibold tracking-tight\">{label}</p>\n <nav aria-label={label}>\n <ul className=\"space-y-0.5\">\n {items.map((it) => (\n <Row key={it.name} it={it} />\n ))}\n </ul>\n </nav>\n </div>\n </aside>\n\n {/* Mobile: scroll-snapped pill row (< md) */}\n <nav\n aria-label={label}\n data-testid={`nav-secondary-select:${id}`}\n className=\"-mx-1 mb-4 flex snap-x snap-proximity gap-1.5 overflow-x-auto scroll-smooth px-1 pb-1 [-ms-overflow-style:none] [mask-image:linear-gradient(to_right,transparent,black_8px,black_calc(100%-8px),transparent)] [scrollbar-width:none] md:hidden [&::-webkit-scrollbar]:hidden\"\n >\n {items.map((it) => (\n <RouterLink\n key={it.name}\n href={it.href}\n aria-current={it.active ? 'page' : undefined}\n className={cn(\n 'snap-start whitespace-nowrap rounded-full border px-3 py-1.5 text-sm outline-hidden ring-offset-background transition-colors duration-150',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',\n it.active\n ? 'border-primary/40 bg-primary/10 font-medium text-foreground'\n : 'border-border text-muted-foreground hover:bg-accent/60 hover:text-accent-foreground',\n )}\n >\n {it.label}\n </RouterLink>\n ))}\n </nav>\n\n {/* Content pane — restores the padding the breakout cancelled. */}\n <div className=\"min-w-0 flex-1 md:overflow-x-hidden md:p-6\">{children}</div>\n </div>\n );\n}\n\nexport default SecondarySidebarLayout;\n","'use client';\nimport { resolveNavLabel, declaredText } from '@burojs/core';\nimport { useI18nCaps } from '@burojs/react';\nimport type { NavLayoutProps } from '../nav-slots.js';\nimport { useLinkComponent } from '../link-component.js';\nimport { cn } from '../../lib/cn.js';\n\n/**\n * Content-wrapping layout: a horizontal tab strip of navigation LINKS with a\n * smooth sliding underline indicator, above the page content. Each tab is a\n * route — `aria-current=\"page\"` marks the active link, this is not a\n * roving-tabindex widget. Scrolls horizontally with an edge fade on narrow\n * screens. Tokens only → automatically light/dark aware.\n */\nexport function TabsLayout({\n group,\n groupKey,\n items,\n children,\n}: NavLayoutProps): React.ReactElement {\n const RouterLink = useLinkComponent();\n const caps = useI18nCaps();\n const id = groupKey ?? group.name;\n const label = resolveNavLabel(caps, `groups.${id}`, declaredText('chrome', group, 'label'));\n\n return (\n <div className=\"flex flex-col gap-4\" data-testid={`nav-tabs:${id}`}>\n <nav\n aria-label={label}\n className=\"flex gap-1 overflow-x-auto scroll-smooth border-b border-border [-ms-overflow-style:none] [mask-image:linear-gradient(to_right,transparent,black_8px,black_calc(100%-8px),transparent)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\"\n >\n {items.map((it) => (\n <RouterLink\n key={it.name}\n href={it.href}\n aria-current={it.active ? 'page' : undefined}\n data-testid={`nav-tab:${it.name}`}\n className={cn(\n 'group/tab relative flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-t-sm px-3 py-2.5 text-sm outline-hidden ring-offset-background transition-colors duration-150',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',\n it.active\n ? 'font-medium text-foreground'\n : 'text-muted-foreground hover:text-foreground',\n )}\n >\n {it.icon != null && (\n <span\n className=\"inline-flex h-4 w-4 shrink-0 items-center justify-center\"\n aria-hidden=\"true\"\n >\n {it.icon}\n </span>\n )}\n {it.label}\n {/* Underline indicator — scales in from its own center; a faint\n preview ghosts in on hover for inactive tabs so the strip\n reads as responsive before the route ever changes. */}\n <span\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute inset-x-2 -bottom-px h-0.5 origin-center scale-x-0 rounded-full bg-primary opacity-0 transition-all duration-300 ease-out',\n it.active\n ? 'scale-x-100 opacity-100'\n : 'group-hover/tab:scale-x-100 group-hover/tab:opacity-30',\n )}\n />\n </RouterLink>\n ))}\n </nav>\n <div className=\"min-w-0\">{children}</div>\n </div>\n );\n}\n\nexport default TabsLayout;\n","'use client';\nimport type { NavGroupDef } from '@burojs/core';\nimport { ComponentsContext, useApp, useComponent } from '@burojs/react';\nimport type { ComponentType, ReactNode } from 'react';\nimport { useContext, useEffect } from 'react';\nimport { canonicalNavKey } from '../resource-key.js';\nimport { SecondarySidebarLayout } from './layouts/secondary-sidebar-layout.js';\nimport { TabsLayout } from './layouts/tabs-layout.js';\n\n/** A resolved child entry a layout renderer draws (spec §8.2). */\nexport interface NavItem {\n kind: 'resource' | 'custom-page' | 'group';\n name: string;\n label: string;\n href: string;\n icon?: ReactNode;\n active: boolean;\n}\n\n/** Props every layout renderer receives. `children` = the active leaf's content. */\nexport interface NavLayoutProps {\n group: NavGroupDef;\n /** Canonical group identity. Default-namespace groups keep their short name. */\n groupKey?: string;\n items: NavItem[];\n children: ReactNode;\n}\n\nexport type NavLayout = ComponentType<NavLayoutProps>;\n\n/** Components-registry slot key for a layout renderer: `layout.<key>`. */\nexport function layoutSlot(key: string): string {\n return `layout.${key}`;\n}\n\n/** Resolve the registered layout renderer for a `layout` slot key, or undefined. */\nexport function useLayout(key: string): NavLayout | undefined {\n return useComponent<NavLayout>(layoutSlot(key));\n}\n\n/**\n * The built-in content-wrapping layouts, keyed by Components-registry slot.\n * `useLayoutResolver` falls back to this table; `defaultNavLayouts` exports it.\n */\nexport const BUILTIN_LAYOUTS: Readonly<Record<string, NavLayout>> = {\n [layoutSlot('secondary-sidebar')]: SecondarySidebarLayout,\n [layoutSlot('tabs')]: TabsLayout,\n};\n\n/**\n * Non-hook-in-loop layout lookup: read the Components registry once, return a\n * resolver `(key) => NavLayout | undefined`. Lets `NavChrome` resolve a\n * variable-length group chain without violating Rules of Hooks. The registry\n * (`layout.<key>`) wins; the built-ins (`secondary-sidebar`, `tabs`) are the\n * fallback, so they work without registration. `flat` and `collapsible` resolve\n * to nothing: they are main-sidebar-only groupings.\n */\nexport function useLayoutResolver(): (key: string) => NavLayout | undefined {\n const components = useContext(ComponentsContext);\n return (key: string) =>\n (components[layoutSlot(key)] as NavLayout | undefined) ?? BUILTIN_LAYOUTS[layoutSlot(key)];\n}\n\n/**\n * The groups already reported, per app, so a group is named once however many\n * consumers resolve it and however often StrictMode re-runs the effect.\n */\nconst unresolvedLayoutReported = new WeakMap<object, Set<string>>();\n\n/**\n * Development diagnostic: a group whose `layout` is neither `flat` nor\n * `collapsible` and resolves to no renderer (an unregistered custom key, a typo)\n * degrades to a flat group silently. Say so once per group per app.\n */\nexport function useReportUnresolvedLayouts(\n groups: readonly NavGroupDef[],\n resolve: (key: string) => NavLayout | undefined,\n): void {\n const app = useApp();\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n for (const group of groups) {\n const layout = group.layout;\n if (layout === 'flat' || layout === 'collapsible' || resolve(layout)) continue;\n const key = canonicalNavKey(group);\n let seen = unresolvedLayoutReported.get(app);\n if (!seen) {\n seen = new Set();\n unresolvedLayoutReported.set(app, seen);\n }\n if (seen.has(key)) continue;\n seen.add(key);\n console.error(\n `[burojs] Nav group \"${key}\" declares layout \"${layout}\", and no renderer is registered for it. Register one as components[\"layout.${layout}\"] on <BuroProvider>, or use a built-in layout: \"secondary-sidebar\", \"tabs\", \"flat\", \"collapsible\".`,\n );\n }\n });\n}\n","'use client';\nimport {\n type HrefOpts,\n type NavNode,\n type RouteMatch,\n type CustomPageDef,\n evaluateVisible,\n isCustomPageDef,\n hrefFor,\n matchPath,\n} from '@burojs/core';\nimport {\n pageAccessFor,\n useApp,\n useOptionalRouterAdapter,\n usePermissions,\n useVisibilityCtx,\n} from '@burojs/react';\nimport { useCallback } from 'react';\n\n/**\n * The app-scoped visibility predicate passed to the pure core resolvers so\n * that group-index → first-visible-child resolution and (later) chrome item\n * lists honor `visible(ctx)`. Resources, groups and custom pages consult\n * `evaluateVisible` against the current visibility context; a node without a\n * predicate is visible. The custom-page route gates on it too (`<PageHost>`).\n */\nexport function useNavVisible(): (node: NavNode) => boolean {\n const ctx = useVisibilityCtx();\n const allowed = usePageAllowed();\n return useCallback(\n (node: NavNode) =>\n evaluateVisible((node as { visible?: unknown }).visible as never, ctx) &&\n (!isCustomPageDef(node) || allowed(node)),\n [ctx, allowed],\n );\n}\n\n/**\n * Whether a resource is reachable from the app's navigation surfaces: its `visible(ctx)` against\n * the current visibility context (a resource without one is visible). The one predicate the\n * sidebar, the command palette's groups (navigation, create, recent, records) and the nav tree\n * ask, so a resource the sidebar hides is never offered elsewhere. Its routes still resolve:\n * `visible` gates discovery, not the URL (`ResourceConfig.visible`).\n */\nexport function useResourceVisible(): (def: { readonly visible?: unknown }) => boolean {\n const ctx = useVisibilityCtx();\n return useCallback((def) => evaluateVisible(def.visible as never, ctx), [ctx]);\n}\n\n/**\n * Whether a custom page's `requires` is decided in the user's favour (P7 3.13): a page without\n * one is allowed; one whose permission decision is still pending is not (the entry is absent, the\n * group index passes it over), so nothing about a page is drawn before it is decided.\n */\nexport function usePageAllowed(): (page: CustomPageDef) => boolean {\n const permissions = usePermissions();\n return useCallback((page) => pageAccessFor(page, permissions) === 'allowed', [permissions]);\n}\n\n/** Canonical href for a resource / custom page / group. Nesting-independent. */\nexport function useHref(name: string, opts?: Omit<HrefOpts, 'isVisible'>): string {\n const app = useApp();\n const isVisible = useNavVisible();\n return hrefFor(app.registry, name, { ...opts, isVisible });\n}\n\n/**\n * Resolve the active route from the router adapter's pathname, or null. The\n * router adapter is the framework's only source of the location; without one\n * there is no location, so there is no match.\n */\nexport function useMatch(): RouteMatch | null {\n const app = useApp();\n const isVisible = useNavVisible();\n const path = useOptionalRouterAdapter()?.pathname;\n return path === undefined ? null : matchPath(app.registry, path, { isVisible });\n}\n","'use client';\nimport { createContext, useContext } from 'react';\n\n/**\n * Module-internal marker: `true` below a mounted `<NavChrome>`. Lets\n * `<NavAreaPage>` tell, in development, that a host forgot to mount the chrome.\n * Deliberately not exported from the package index.\n */\nconst NavChromeMountedContext = createContext(false);\n\nexport const NavChromeMountedProvider = NavChromeMountedContext.Provider;\n\nexport function useNavChromeMounted(): boolean {\n return useContext(NavChromeMountedContext);\n}\n","'use client';\nimport type { RouteMatch } from '@burojs/core';\nimport { useChromeT, useOptionalT } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { RecordState } from '../record/record-state.js';\nimport { Button } from '../primitives/button.js';\nimport { FlowBoundary, loadFailedText, loadPageFlowRoute, useLoaded } from './load-runtime.js';\n\n/**\n * A page-hosted flow's route, once its chunk arrived (P6): the flow machine and the flow host\n * load with the first visit to such a route, never with the first screen. While the chunk loads\n * the record route's loading state shows; a chunk that failed to arrive says so with Retry.\n */\nexport function PageFlowRouteLoader({ match }: { readonly match: RouteMatch }): ReactElement {\n const t = useOptionalT();\n const chromeT = useChromeT();\n const loaded = useLoaded(loadPageFlowRoute);\n const failed = (retry: () => void) => (\n <div role=\"alert\" data-buro-flow-load=\"failed\" className=\"flex flex-col gap-3 p-6 text-sm\">\n <p>{loadFailedText(t)}</p>\n <div>\n <Button type=\"button\" onClick={retry}>\n {chromeT('actions.retry', { defaultValue: 'Retry' })}\n </Button>\n </div>\n </div>\n );\n if (loaded.error !== undefined) return failed(loaded.retry);\n if (loaded.module === undefined) return <RecordState state=\"loading\" />;\n const Route = loaded.module.PageFlowRoute;\n return (\n <FlowBoundary fallback={(_error, reset) => failed(reset)}>\n <Route match={match} />\n </FlowBoundary>\n );\n}\n","'use client';\nimport { routeResourceKey } from '@burojs/core';\nimport type { ResourceNameOrRef } from '@burojs/core';\nimport { normalizeEntityRef } from '@burojs/core';\nimport { type RowRecord, useRouteListImplementation, useTranslate } from '@burojs/react';\nimport { type ReactNode, Suspense, useMemo } from 'react';\nimport { selectImplementation, viewOf } from '../blocks/place-node.js';\nimport { RouteListContext } from '../blocks/route-list-context.js';\n\n/**\n * Props of {@link ResourceListPage}.\n */\nexport interface ResourceListPageProps<N extends string = string> {\n /**\n * Registry name of the resource to list.\n *\n * ⚠️ **Precondition: it MUST be registered.** `useResourceList` resolves\n * `routing.createHref` through `hrefFor`, which throws `unknown node\n * '<resource>'` for a name the registry doesn't know. Route-level code\n * should 404 before mounting this component (the playground's\n * `app/(admin)/[resource]/page.tsx` does exactly that).\n */\n resource: ResourceNameOrRef<N>;\n /**\n * Extra `meta` merged into the underlying `useList` call — and therefore\n * into the react-query cache key. This is the seam for app-level query\n * scope the framework cannot know about: a sidebar product-group /\n * location picker, a tenant id, anything a data provider turns into a\n * server-side `where`.\n *\n * ⚠️ **The caller MUST memoize this object.** It flows into the query key\n * AND into the controller's own memo chain; an inline object literal\n * mints a fresh key on every render, which busts that chain and can\n * produce a refetch loop. The playground memoizes on\n * `[scope.productGroup, scope.locationId]`:\n *\n * ```tsx\n * const scope = useScope();\n * const listMeta = useMemo(\n * () => ({ scope: { pg: scope.productGroup, location_id: scope.locationId } }),\n * [scope.productGroup, scope.locationId],\n * );\n * return <ResourceListPage resource={resource} meta={listMeta} />;\n * ```\n */\n meta?: Record<string, unknown>;\n /**\n * App-level per-cell renderer, consulted AFTER a typed resource's\n * discriminator badge and BEFORE the declared-`enum` badge and\n * `<ResourceList>`'s default field-type display. Return `undefined` to\n * fall through, exactly like `<ResourceList renderCell>`.\n *\n * The built-ins cover what the registry can describe on its own; this\n * prop is for the rest — the playground uses it for a legacy hardcoded\n * `status` badge and a `is_active` Yes/No badge, neither of which the\n * framework can derive from a field def.\n *\n * ⚠️ Wins over a registered `list.cell.<resource>` slot (level 1 —\n * {@link ../list-kit/list-slots.js | listSlot}). A host that mounted this\n * page by hand and passed its own `renderCell` knows more than the\n * registry does; the slot exists for the standard router, which mounts\n * `<ResourceListPage resource={...}>` with no props at all.\n *\n * ⚠️ Same purity requirement as `<ResourceList renderCell>`: it runs\n * inside a memoized cell, so anything depending on external reactive\n * state (locale, flags) must be delegated to a component that\n * subscribes to that state itself.\n */\n renderCell?: (col: string, value: unknown, row: RowRecord) => ReactNode | undefined;\n /**\n * Replacement for the table's empty state, forwarded to\n * `<ResourceList emptyState>` and from there to `<DataTable emptyState>`.\n *\n * ⚠️ Supplying this changes the SHAPE of the empty list, not just its\n * copy: the default is a standalone panel rendered INSTEAD of the table\n * (dashed border, icon, heading, and a \"Clear filter\" / \"+ Create\" /\n * \"back to page 1\" CTA), whereas a supplied node renders inside the\n * table body, so the header row survives and the CTAs do not. Pass one\n * when a slot wants the table chrome to stay put; omit it for the\n * standard panel.\n */\n emptyState?: ReactNode;\n}\n\n/**\n * The assembled, data-connected list page (core flexibility program, Task\n * B3.1) — the piece that makes `<ResourceList>` actually useful. Given a\n * resource name it renders the whole standard list surface:\n *\n * - page header,\n * - the filter region — search box + pinned controls + the filter-builder\n * popover + applied-filter badges + \"Clear all\" (via {@link FilterRegion}),\n * - saved-views dropdown and its two dialogs (save-current / manage),\n * - the columns toggle and the create button,\n * - `<ResourceList>` itself (table, empty/error/loading states,\n * pagination),\n * - the floating bulk-action bar.\n *\n * Everything beneath is already framework-owned: the controller\n * (`useResourceList`, `@burojs/react`) and the filter-builder region\n * (`FilterRegion`, this package's `list-kit/filter-builder`). This\n * component contributes only the JSX assembly — it was lifted VERBATIM out\n * of the playground's `_list-body.tsx` (`ResourceListBody`), so every\n * `list-*` testid it emits is byte-identical to the pre-move markup (Task 7\n * — the filter region's OWN testids moved to the builder's `list-filter:*`\n * convention; everything else is unchanged).\n *\n * It renders through the built-in `related-list` block (spec 8.4, decision 63): the view is\n * `buro:related-list`'s, inside a `[data-buro-node=\"place\"]` wrapper, and an app that registers\n * its own `buro:related-list` view (`<BuroProvider blockImplementations>`) replaces this list\n * everywhere, a development notice saying so. The body itself lives in `ResourceListSurface`.\n *\n * The whole subtree is wrapped in `<ResourceListProvider>`, so any nested\n * component can read the live controller with `useResourceListContext()`\n * instead of receiving a hand-threaded prop chain. That is the seam the\n * list slots plug into.\n *\n * ## Override ladder (Task B3.2; level 1 added by SP0 Task 5)\n *\n * Three optional slots, resolved from the Components registry by resource\n * name — see {@link listSlot}. Registering none (level 0) is what every\n * resource in the playground does today, and what every existing e2e spec\n * covers:\n *\n * - **`list.cell.<resource>`** (level 1) is consulted for every cell, AFTER\n * a typed resource's discriminator badge and BEFORE the declared-`enum`\n * badge and `<ResourceList>`'s default field-type display (a field with\n * its own `ui.display` skips the enum badge) — the same position the\n * `renderCell` prop occupies, and the\n * explicit prop wins when both are present. Everything else — filters,\n * saved views, the columns menu, the table, pagination — stays standard.\n * - **`list.filters.<resource>`** (level 2) replaces the filter region —\n * the search box, the pinned controls, the filter-builder popover and its\n * applied-filter badges. Saved views, the columns toggle, the create\n * button, the table, the footer and pagination all stay standard.\n * - A whole-body override is a list frame (`views.list.frame`, P7-34), which arranges the\n * framework's pieces and keeps the page header, the controller, the URL state, the saved-view\n * dialogs, the export watcher and the bulk bar. `list.body.<resource>` is gone (P7-37).\n *\n * ⚠️ The `<PageHeader>` stays framework-owned. It is what writes `document.title` (via\n * `useDocumentTitle`, defended against Next's metadata re-application) and what renders the\n * page's accessible `<h1>` and its breadcrumb slot; the header's `h1` is `sr-only`.\n *\n * Both slots take no props and read the controller from\n * `useResourceListContext()`, so each is unit-testable against a\n * hand-written stub controller with no Next mocking.\n *\n * @see docs/superpowers/plans/2026-07-26-cfb3-assembled-page-slots.md — Tasks B3.1, B3.2\n */\nexport function ResourceListPage<const N extends string = string>({\n resource: resourceInput,\n meta,\n renderCell,\n emptyState,\n}: ResourceListPageProps<N>) {\n const resource = routeResourceKey(resourceInput);\n const app = useRouteListImplementation();\n const implementation = selectImplementation('buro:related-list', app);\n const View = implementation === undefined ? undefined : viewOf(implementation);\n const translate = useTranslate();\n const route = useMemo(() => ({ meta, renderCell, emptyState }), [meta, renderCell, emptyState]);\n const viewProps = useMemo(\n () => ({\n props: { resource: normalizeEntityRef(resource) },\n data: {},\n t: (key: string, options?: { params?: Record<string, unknown>; count?: number }) =>\n translate(`blocks.buro:related-list.${key}`, options),\n }),\n [resource, translate],\n );\n return (\n <div data-buro-node=\"place\" data-buro-size=\"full\" className=\"min-w-0\">\n <RouteListContext.Provider value={route}>\n <Suspense fallback={null}>{View === undefined ? null : <View {...viewProps} />}</Suspense>\n </RouteListContext.Provider>\n </div>\n );\n}\n","'use client';\nimport {\n type CustomPageDef,\n compilePageScreen,\n evaluateVisible,\n formatEntityRef,\n isScreenFailure,\n type NavNode,\n pageParamNames,\n parsePageParams,\n type RouteMatch,\n resolveNavLabel,\n snapshotAppFrames,\n snapshotBlockLookup,\n snapshotFrameLookup,\n declaredText,\n} from '@burojs/core';\nimport {\n type PageFrameViewProps,\n ActionRouteContext,\n RouteSourceContext,\n ScreenStateProvider,\n useApplicationSnapshot,\n useFrameImplementations,\n useFrameT,\n useI18nCaps,\n useOptionalRouterAdapter,\n usePageAccess,\n usePageScreen,\n useVisibilityCtx,\n} from '@burojs/react';\nimport { type ReactElement, type ReactNode, Suspense, useContext, useEffect, useMemo } from 'react';\nimport { resolveFrameView } from '../frames/resolve.js';\nimport { RecordState } from '../record/record-state.js';\nimport { RouteScreenClaimContext, RouteScreenContext } from '../record/route-screen-context.js';\nimport { canonicalNavKey } from '../resource-key.js';\nimport { DeepLinkScope } from '../quick/use-deep-link.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { useTabsUrlState } from '../screen/use-tabs-url-state.js';\nimport { useNavVisible } from './use-nav-routing.js';\n\nexport interface PageHostProps {\n readonly page: CustomPageDef;\n readonly match: RouteMatch;\n /** The router's not-found panel, rendered when the nav gate rejects the page. */\n readonly notFound: ReactElement;\n}\n\n/**\n * The route of a custom page with a `body` (P1b+P1c decision 52). The nav gate comes first: when\n * the page's own `visible` or any group on its chain rejects it, the route renders not-found and\n * mounts nothing else — no compile, no resolver, no block (a hidden page is not reachable by\n * URL). Otherwise it renders the page label as the `<h1>` and the planned body, placements\n * resolved through the page's own resolver (`usePageScreen`), in a `page-body` region.\n */\nexport function PageHost({ page, match, notFound }: PageHostProps): ReactElement {\n const isVisible = useNavVisible();\n const ctx = useVisibilityCtx();\n const access = usePageAccess(page);\n const visible =\n evaluateVisible(page.visible as never, ctx) &&\n match.groupChain.every((group) => isVisible(group as NavNode));\n if (!visible) return notFound;\n // The page's `requires` decides before anything of the page mounts (P7 3.13): undecided is the\n // loading state, denied is the not-found a missing page renders, and neither reads a thing.\n if (access === 'pending') return <RecordState state=\"loading\" />;\n if (access === 'denied') return notFound;\n return <PageParams page={page} notFound={notFound} />;\n}\n\nconst NO_SEARCH = new URLSearchParams();\n\n/**\n * The page's declared params, read from the query string (P2 4.5): a missing required param or\n * a value its schema rejects renders not-found and mounts nothing — no compile, no resolver, no\n * block (fail closed). Otherwise the body reads them as `route`.\n */\nfunction PageParams({\n page,\n notFound,\n}: {\n readonly page: CustomPageDef;\n readonly notFound: ReactElement;\n}): ReactElement {\n const router = useOptionalRouterAdapter();\n const search =\n router?.searchParams ??\n (typeof window === 'undefined' ? NO_SEARCH : new URLSearchParams(window.location.search));\n // Keyed by the declared params' raw values: another query parameter changing re-parses nothing.\n const raw = JSON.stringify(pageParamNames(page.params).map((name) => search.get(name)));\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the declared params' raw values\n const parsed = useMemo(() => parsePageParams(page, search), [page, raw]);\n if (!parsed.ok) return notFound;\n return (\n <RouteSourceContext.Provider value={parsed.route}>\n <PageBody page={page} />\n </RouteSourceContext.Provider>\n );\n}\n\nfunction PageBody({ page }: { readonly page: CustomPageDef }): ReactElement {\n const snapshot = useApplicationSnapshot();\n const compiled = useMemo(\n () =>\n compilePageScreen(page, {\n blocks: snapshotBlockLookup(snapshot),\n frames: snapshotFrameLookup(snapshot),\n appFrames: snapshotAppFrames(snapshot),\n }),\n [page, snapshot],\n );\n const failure = isScreenFailure(compiled) ? compiled : null;\n const screen = failure === null && !isScreenFailure(compiled) ? compiled : null;\n const caps = useI18nCaps();\n const name = canonicalNavKey(page);\n const label = resolveNavLabel(caps, `pages.${name}`, declaredText('chrome', page, 'label'));\n useEffect(() => {\n if (failure === null || process.env.NODE_ENV === 'production') return;\n console.error(\n `[burojs] The page \"${name}\" cannot render its body: ${failure.code} at ${failure.path.join('.')}: ${failure.message}.`,\n );\n }, [failure, name]);\n return (\n // No padding of its own: `AppLayout` pads the content area, and a second `p-6` here started\n // app pages 48px from the edge against a resource page's 24px.\n <div className=\"flex flex-col gap-4\">\n <h1 className=\"text-2xl font-semibold tracking-tight\">{label}</h1>\n {screen === null ? (\n <RecordState state=\"error\" />\n ) : (\n <PageRouteScreen>\n <PlannedBody screen={screen} name={name} label={label} />\n </PageRouteScreen>\n )}\n </div>\n );\n}\n\n/**\n * The page is its route's screen (P2 4.6): its keyed tabs open from `?<tabsKey>=` and a top-level\n * `state: 'url'` placement writes `?<key>.<param>`, as on a record route; a screen nested inside\n * it (a dialog's record screen) is not one.\n */\nfunction PageRouteScreen({ children }: { readonly children: ReactNode }): ReactElement {\n const tabs = useTabsUrlState('show', true);\n return (\n <RouteScreenClaimContext.Provider value={false}>\n <RouteScreenContext.Provider value={true}>\n <ScreenStateProvider open={tabs.open} onOpenChange={tabs.onOpenChange}>\n {children}\n </ScreenStateProvider>\n </RouteScreenContext.Provider>\n </RouteScreenClaimContext.Provider>\n );\n}\n\n/**\n * The planned body of a compiled page screen, drawn through its frame (P7 3.14). The page route\n * draws it under the heading; a modal action's block screen (P7 3.16) draws it alone.\n * @internal\n */\nexport function PlannedBody({\n screen,\n name,\n label,\n record,\n}: {\n readonly screen: NonNullable<Parameters<typeof usePageScreen>[0]>;\n readonly name: string;\n readonly label: string;\n /** The row `record` reads, projected: a modal action's clicked row. Absent on a page. */\n readonly record?: Readonly<Record<string, unknown>>;\n}): ReactElement {\n const pageOptions = useMemo(() => (record === undefined ? {} : { record }), [record]);\n const page = usePageScreen(screen, pageOptions);\n const { PlacementScope } = page;\n const route = useContext(RouteSourceContext);\n const catalog = useFrameImplementations();\n const id = formatEntityRef(screen.frame);\n const resolved = useMemo(\n () => resolveFrameView(screen.frame, catalog, 'page'),\n [screen.frame, catalog],\n );\n const t = useFrameT(id);\n // Each slot of the effective frame as a rendered tree; one with nothing to show is `null`.\n const slots: Record<string, ReactElement | null> = {};\n for (const slot of Object.keys(screen.slots)) {\n const roots = page.plan.slots[slot] ?? [];\n slots[slot] = roots.every((node) => node.state === 'absent') ? null : (\n <ScreenTree\n key={slot}\n region={slot === 'body' ? 'page-body' : 'record'}\n slot={slot}\n resource={name}\n mode=\"show\"\n compiled={screen}\n page={page}\n />\n );\n }\n const View = resolved.view;\n const viewProps: PageFrameViewProps = { slots: slots as never, label, params: route ?? {}, t };\n // The page's params are its screen's alone (spec 4.5): a block below that mounts its own form\n // controller reads `{}`.\n // The page's own actions (its lists' rows and toolbars) read its params in their `when`\n // (read-scope 7c.6); a screen nested below provides its own.\n return (\n <RouteSourceContext.Provider value={null}>\n <ActionRouteContext.Provider value={route}>\n <PlacementScope>\n <DeepLinkScope plan={page.plan} enabled>\n <div data-buro-region=\"page-body\">\n <Suspense fallback={null}>\n <View {...viewProps} />\n </Suspense>\n </div>\n </DeepLinkScope>\n </PlacementScope>\n </ActionRouteContext.Provider>\n </RouteSourceContext.Provider>\n );\n}\n","'use client';\nimport { FrameCheckContext, type FrameCheckValue, type FramePiece } from '@burojs/react';\nimport {\n createContext,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from 'react';\n\n/** One screen instance's slot mounts: a slot renders at most once (P6-15). */\ninterface SlotMounts {\n /** Takes the slot for `token` when it is free; whether `token` holds it. */\n claim(slot: string, token: string): boolean;\n release(slot: string, token: string): void;\n /** A second concurrent mount of `slot`: logged once per slot. */\n twice(slot: string): void;\n}\n\nconst SlotMountsContext = createContext<SlotMounts | null>(null);\n\n/**\n * Whether this mount of `slot` is its screen's first: a second concurrent mount renders nothing,\n * so the form keeps one value per field, and logs `frame.slot-twice` once.\n */\nexport function useSlotOnce(slot: string): boolean {\n const mounts = useContext(SlotMountsContext);\n const token = useId();\n const first = mounts === null || mounts.claim(slot, token);\n useEffect(() => {\n if (mounts === null) return;\n mounts.claim(slot, token);\n return () => mounts.release(slot, token);\n }, [mounts, slot, token]);\n useEffect(() => {\n if (!first) mounts?.twice(slot);\n }, [first, mounts, slot]);\n return first;\n}\n\n/**\n * The runtime obligations of a record frame (spec 3.3, P6-15), checked in development after the\n * view mounted, once per screen instance each: `body` and every slot at most once, `<FormActions/>`\n * in edit and create, `<RecordActions/>` in show when the resource has item actions there, no\n * `h1` (the route draws the screen's one).\n */\nexport function FrameObligations({\n id,\n mode,\n showActions,\n root,\n children,\n}: {\n readonly id: string;\n readonly mode: 'show' | 'edit' | 'create';\n /** The record is read and the resource has item actions on the show surface. */\n readonly showActions: boolean;\n /** The screen's root element: an `h1` inside it is the frame's. */\n readonly root: RefObject<HTMLElement | null>;\n readonly children: ReactNode;\n}): ReactElement {\n const told = useRef(new Set<string>());\n const counts = useRef(new Map<FramePiece, number>());\n const owners = useRef(new Map<string, string>());\n const tell = (key: string, write: () => void) => {\n if (told.current.has(key) || process.env.NODE_ENV === 'production') return;\n told.current.add(key);\n write();\n };\n const latestId = useRef(id);\n latestId.current = id;\n // biome-ignore lint/correctness/useExhaustiveDependencies: one registry per screen instance\n const slotMounts = useMemo<SlotMounts>(\n () => ({\n claim(slot, token) {\n const owner = owners.current.get(slot);\n if (owner === undefined) {\n owners.current.set(slot, token);\n return true;\n }\n return owner === token;\n },\n release(slot, token) {\n if (owners.current.get(slot) === token) owners.current.delete(slot);\n },\n twice(slot) {\n tell(`slot-twice:${slot}`, () =>\n console.error(\n `[burojs] frame.slot-twice: ${latestId.current} renders slots.${slot} twice; a slot renders at most once (body twice would mount every field twice under one form).`,\n ),\n );\n },\n }),\n [],\n );\n const pieces = useMemo<FrameCheckValue>(\n () => ({\n stub: false,\n mount(piece) {\n counts.current.set(piece, (counts.current.get(piece) ?? 0) + 1);\n return () => counts.current.set(piece, (counts.current.get(piece) ?? 1) - 1);\n },\n }),\n [],\n );\n return (\n <SlotMountsContext.Provider value={slotMounts}>\n <FrameCheckContext.Provider value={pieces}>\n {children}\n <ObligationCheck\n check={() => {\n const mounted = (piece: FramePiece) => (counts.current.get(piece) ?? 0) > 0;\n if (mode !== 'show' && !mounted('FormActions'))\n tell('no-form-actions', () =>\n console.error(\n `[burojs] frame.no-form-actions: ${id} renders no <FormActions/> in ${mode}; nothing can submit or cancel the form.`,\n ),\n );\n if (mode === 'show' && showActions && !mounted('RecordActions'))\n tell('no-actions', () =>\n console.warn(\n `[burojs] screen.no-actions: ${id} renders no <RecordActions/> in show, and the resource has item actions there.`,\n ),\n );\n if (root.current?.querySelector('h1') != null)\n tell('h1', () =>\n console.error(`[burojs] ${id} renders an h1; the route draws the screen's one h1.`),\n );\n }}\n />\n </FrameCheckContext.Provider>\n </SlotMountsContext.Provider>\n );\n}\n\n/** Runs `check` after every commit of the view before it (its effects ran first). */\nfunction ObligationCheck({ check }: { readonly check: () => void }): null {\n useEffect(() => {\n check();\n });\n return null;\n}\n","'use client';\nimport { FORM_SLOT } from '@burojs/core';\nimport {\n type RecordFrameValue,\n recordKeyOf,\n useApp,\n useOptionalT,\n useRecordFrame,\n useTestIds,\n} from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { Button } from '../primitives/button.js';\nimport { useFrameChrome } from '../record/frame-context.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { useSlotOnce } from './obligations.js';\n\n/** The draft-found banner: restore or discard; an edit draft over a changed record offers discard only. */\nfunction DraftBanner(): ReactElement | null {\n const { resource, mode, controller } = useRecordFrame();\n const t = useOptionalT();\n const tid = useTestIds();\n const { draft } = controller;\n if (mode === 'show' || draft.pending === null) return null;\n return (\n <div\n data-testid={tid.formDraftBanner(resource, mode)}\n role=\"status\"\n aria-live=\"polite\"\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-warning/50 bg-warning/10 px-3 py-2 text-sm\"\n >\n <span className=\"font-medium\">\n {draft.recordChanged\n ? t('draft.recordChanged')\n : t('draft.found', { params: { time: timeAgo(draft.pending.savedAt, t) } })}\n </span>\n {draft.recordChanged ? null : (\n <span className=\"text-muted-foreground\">{t('draft.restorePrompt')}</span>\n )}\n <div className=\"ml-auto flex gap-2\">\n {draft.recordChanged ? null : (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n data-testid={tid.formDraftRestore(resource, mode)}\n onClick={draft.restore}\n >\n {t('draft.restore')}\n </Button>\n )}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n data-testid={tid.formDraftDiscard(resource, mode)}\n onClick={draft.discard}\n >\n {t('draft.discard')}\n </Button>\n </div>\n </div>\n );\n}\n\n/** A draft's age as the banner says it. */\nfunction timeAgo(savedAt: string, t: ReturnType<typeof useOptionalT>): string {\n const then = new Date(savedAt).getTime();\n if (!Number.isFinite(then)) return t('draft.timeAgoRecently');\n const diff = Date.now() - then;\n if (diff < 60_000) return t('draft.timeAgoMoment');\n if (diff < 3_600_000) return t('draft.timeAgoMinutes', { count: Math.round(diff / 60_000) });\n if (diff < 86_400_000) return t('draft.timeAgoHours', { count: Math.round(diff / 3_600_000) });\n return t('draft.timeAgoDays', { count: Math.round(diff / 86_400_000) });\n}\n\n/**\n * The record's id as the frame knows it: the `recordId`, else the record's key for `def`, the\n * frame resource's definition (`data.idField`, else `id`).\n */\nexport function frameRecordId(\n frame: RecordFrameValue,\n def: { readonly data?: unknown } | undefined,\n): string | undefined {\n if (frame.recordId !== undefined) return frame.recordId;\n const id = recordKeyOf(def, frame.record);\n return typeof id === 'string' || typeof id === 'number' ? String(id) : undefined;\n}\n\n/**\n * The `body` slot, the framework's: the planned `body` tree in its\n * `<div data-buro-region=\"record-body\" data-buro-slot=\"body\">`, inside the screen's `<form>` (with\n * the draft banner and the submit wiring) in edit and create. A frame places it; it cannot omit\n * or replace the form (P6-70).\n */\nfunction BodySlot(): ReactElement {\n const frame = useRecordFrame();\n const { resource, mode, controller } = frame;\n const chrome = useFrameChrome();\n const tid = useTestIds();\n const id = frameRecordId(frame, useApp().registry.get(resource));\n const tree = (\n <div data-buro-region=\"record-body\" data-buro-slot={FORM_SLOT}>\n <ScreenTree\n region=\"record\"\n slot={FORM_SLOT}\n resource={resource}\n mode={mode}\n compiled={controller.screen}\n controller={controller}\n />\n </div>\n );\n if (mode === 'show') return tree;\n return (\n <form\n id={chrome.formId}\n noValidate\n data-testid={tid.form(resource, mode, id)}\n onSubmit={(event) => {\n event.preventDefault();\n // Enter inside a wizard step before the last one moves on, as Next does.\n const steps = controller.steps;\n if (\n steps !== null &&\n steps.current !== undefined &&\n steps.current !== steps.ids[steps.ids.length - 1]\n )\n void steps.next();\n else void chrome.submit();\n }}\n className=\"flex flex-col gap-4\"\n >\n <DraftBanner />\n {tree}\n </form>\n );\n}\n\n/** A display slot: its planned tree, the stack carrying `data-buro-slot` (no region). */\nfunction DisplaySlot({ name }: { readonly name: string }): ReactElement {\n const { resource, mode, controller } = useRecordFrame();\n return (\n <ScreenTree\n region=\"record\"\n slot={name}\n resource={resource}\n mode={mode}\n compiled={controller.screen}\n controller={controller}\n />\n );\n}\n\n/**\n * One slot of a record frame, as the frame receives it (spec 3.3): `body` the form slot, every\n * other slot display-only. A slot mounted twice at once renders once (`frame.slot-twice`).\n */\nexport function SlotWrapper({ name }: { readonly name: string }): ReactElement | null {\n const first = useSlotOnce(name);\n if (!first) return null;\n return name === FORM_SLOT ? <BodySlot /> : <DisplaySlot name={name} />;\n}\n","'use client';\nimport {\n type AnyFrameHandle,\n builtinFrames,\n type CompiledScreen,\n type EntityRef,\n FORM_SLOT,\n fieldSensitivity,\n formatEntityRef,\n type PlanNode,\n} from '@burojs/core';\nimport {\n type RecordFrameViewProps,\n policyRecordOf,\n useApp,\n useFieldAccess,\n useFrameImplementations,\n useFrameT,\n useQuickEntry,\n useRecordFrame,\n} from '@burojs/react';\nimport { type ReactElement, Suspense, useEffect, useMemo, useRef } from 'react';\nimport { useShownItemActions } from '../actions/action-overflow.js';\nimport { useFrameChrome } from '../record/frame-context.js';\nimport { RecordState } from '../record/record-state.js';\nimport { ChangeTypeButton, HeaderTypeNotice, TypeChromeDrawnContext } from './builtin-record.js';\nimport { isBuiltinRecordView, resolveFrameView } from './resolve.js';\nimport { FrameObligations } from './obligations.js';\nimport { SlotWrapper } from './slot-wrapper.js';\n\nconst NO_ROOT = { current: null };\n\ntype Row = Readonly<Record<string, unknown>>;\n\n/**\n * The field names the plan draws with a value (a `ready` field leaf), in any slot. A `pending` or\n * `failed` leaf (access still undecided, or its read failed) draws no value, so its field is not\n * drawn: the record never carries what the screen has not yet been allowed to show.\n */\nfunction drawnFields(roots: readonly PlanNode[], compiled: CompiledScreen, out: Set<string>): void {\n for (const node of roots) {\n if (node.state === 'absent') continue;\n const field = node.field ?? compiled.nodes[node.index]?.field;\n if (node.kind === 'field' && field !== undefined && node.state === 'ready') out.add(field);\n drawnFields(node.children, compiled, out);\n }\n}\n\n/**\n * The record a frame view receives as its `record` prop (P6-66, spec 3.3): the id field, and the\n * fields the plan draws with a value (`ready`) in some slot that are not `sensitive` (Known\n * finding 11). The prop never holds an unplaced, sensitive, rule-hidden or undecided field.\n *\n * `visible` is P5's field view (spec 3.6.4): a field the user may not view, or whose access is\n * still undecided, is dropped even when the plan drew it. That guarantee covers the prop only.\n * `useRecordFrame().record` and `.controller` are trusted-frame APIs; a frame is trusted code.\n */\nexport function frameRecord(\n record: Row | undefined,\n compiled: CompiledScreen | null,\n slots: Readonly<Record<string, readonly PlanNode[]>> | undefined,\n idField: string,\n visible: (name: string) => boolean = () => true,\n): Row | undefined {\n if (record === undefined || compiled === null || slots === undefined) return undefined;\n const drawn = new Set<string>();\n for (const roots of Object.values(slots)) drawnFields(roots, compiled, drawn);\n const declarations = new Map(compiled.fields.map((entry) => [entry.name, entry.declaration]));\n const out: Record<string, unknown> = {};\n if (Object.hasOwn(record, idField)) out[idField] = record[idField];\n for (const name of drawn) {\n if (!Object.hasOwn(record, name) || !visible(name)) continue;\n if (fieldSensitivity(declarations.get(name)) !== undefined) continue;\n out[name] = record[name];\n }\n return Object.freeze(out);\n}\n\n/** The slots the screen fills: every compiled slot with planned roots. */\nfunction declaredSlots(compiled: CompiledScreen | null): readonly string[] {\n if (compiled === null) return [];\n return Object.entries(compiled.slots)\n .filter(([, nodes]) => nodes.length > 0)\n .map(([name]) => name);\n}\n\n/**\n * The frame this instance draws: `<RecordScreen frame>` when its slots cover every slot the\n * screen fills (else one development error and the screen's own), else the compiled screen's\n * effective frame (screen ← app ← `buro:record`).\n */\nfunction useEffectiveFrame(instance: AnyFrameHandle | undefined): {\n readonly ref: EntityRef;\n readonly slotNames: readonly string[];\n} {\n const { resource, mode, controller } = useRecordFrame();\n const compiled = controller.screen;\n const missing = useMemo(() => {\n if (instance === undefined || instance.for !== 'record') return undefined;\n const own = new Set(Object.keys(instance.slots));\n return declaredSlots(compiled).find((slot) => !own.has(slot));\n }, [instance, compiled]);\n const told = useRef(false);\n const instanceId = instance === undefined ? undefined : formatEntityRef(instance.ref);\n useEffect(() => {\n if (missing === undefined || told.current || process.env.NODE_ENV === 'production') return;\n told.current = true;\n console.error(\n `[burojs] <RecordScreen frame={${instanceId}}> lacks the slot ${missing} that ${resource}'s ${mode} screen fills; the screen's own frame draws it.`,\n );\n }, [missing, instanceId, resource, mode]);\n if (\n instance !== undefined &&\n instance.for === 'record' &&\n missing === undefined &&\n compiled !== null\n )\n return { ref: instance.ref, slotNames: Object.keys(instance.slots) };\n const ref = compiled?.frame ?? builtinFrames.record.ref;\n return {\n ref,\n slotNames: compiled === null ? ['header', FORM_SLOT] : Object.keys(compiled.slots),\n };\n}\n\n/**\n * Draws the record screen's frame (spec 3.3): the view resolved from the frame reference, its\n * slots each inside the framework's wrapper (`body` holding the form), `null` for a slot that is\n * absent in this mode, omitted or planned empty. Under a custom frame the framework draws the\n * undeclared-type notice and Change type above the frame (P6-70).\n */\nexport function RecordFrameView({\n frame: instance,\n}: {\n readonly frame?: AnyFrameHandle;\n}): ReactElement {\n const { resource, mode, controller, record } = useRecordFrame();\n const chrome = useFrameChrome();\n const quick = useQuickEntry();\n const app = useApp();\n const catalog = useFrameImplementations();\n const { ref, slotNames } = useEffectiveFrame(instance);\n const id = formatEntityRef(ref);\n const resolved = useMemo(() => resolveFrameView(ref, catalog, 'record'), [ref, catalog]);\n const t = useFrameT(id);\n const compiled = controller.screen;\n const plan = controller.plan;\n const slots: Record<string, ReactElement | null> = {};\n for (const name of slotNames) {\n if (name === FORM_SLOT) {\n slots[name] = <SlotWrapper key={name} name={name} />;\n continue;\n }\n const roots = plan?.slots[name] ?? [];\n slots[name] = roots.every((node) => node.state === 'absent') ? null : (\n <SlotWrapper key={name} name={name} />\n );\n }\n slots[FORM_SLOT] ??= <SlotWrapper name={FORM_SLOT} />;\n const idField =\n (app.registry.get(resource) as { readonly data?: { readonly idField?: string } } | undefined)\n ?.data?.idField ?? 'id';\n // P5 field view in record reach, decided over the row as read; pending is not visible.\n const access = useFieldAccess(\n resource,\n 'record',\n record === undefined ? undefined : policyRecordOf(controller, record),\n );\n const projected = useMemo(\n () =>\n frameRecord(\n record,\n compiled,\n plan?.slots,\n idField,\n (name) => access[name]?.view === 'visible',\n ),\n [record, compiled, plan, idField, access],\n );\n const quickHost = chrome.hostTitle === true && quick !== null;\n const props: RecordFrameViewProps = {\n slots: slots as RecordFrameViewProps['slots'],\n host: quickHost ? quick.host : 'page',\n mode,\n screen: { resource, entry: quickHost ? 'quick' : 'route' },\n record: mode === 'create' ? undefined : projected,\n t,\n };\n // Item actions on the show surface (the runtime check of `<RecordActions/>`, P6-15).\n // Item actions are policy (P5 decision 12): their gates read the row as read.\n const policyRecord = policyRecordOf(controller, record);\n const rowId = record?.[idField];\n const actionRow = useMemo(\n () => ({\n ...(policyRecord ?? {}),\n id: typeof rowId === 'string' || typeof rowId === 'number' ? String(rowId) : '',\n }),\n [policyRecord, rowId],\n );\n // The screen's sources too, as `<RecordActions/>` reads them (T4 D9 part 4): the two agree.\n const showItemActions = useShownItemActions(\n resource,\n actionRow,\n 'show',\n undefined,\n controller.sources,\n );\n const showActions = mode === 'show' && record !== undefined && showItemActions.length > 0;\n const View = resolved.view;\n const builtin = isBuiltinRecordView(resolved);\n return (\n <>\n {builtin ? null : (\n <>\n <HeaderTypeNotice resource={resource} />\n <ChangeTypeButton />\n </>\n )}\n <TypeChromeDrawnContext.Provider value={!builtin}>\n <Suspense fallback={<RecordState state=\"loading\" />}>\n <FrameObligations\n id={id}\n mode={mode}\n showActions={showActions}\n root={chrome.root ?? NO_ROOT}\n >\n <View {...props} />\n </FrameObligations>\n </Suspense>\n </TypeChromeDrawnContext.Provider>\n </>\n );\n}\n","'use client';\nimport type { ReadScopeValue } from '@burojs/core';\nimport { recordKeyOf, useApp, useList } from '@burojs/react';\nimport { useMemo } from 'react';\nimport { useRowTitle } from '../resource/use-row-title.js';\n\nexport interface DimensionOption {\n readonly value: ReadScopeValue;\n readonly label: string;\n}\n\n/** The most values a resource-backed dimension lists; a longer set needs a search-backed control. */\nexport const MAX_DIMENSION_VALUES = 100;\n\n/**\n * The values of a resource-backed scope dimension and their labels: a `'session'` read that leaves\n * out the dimension's own key (rule 4), titled by `labelField` or the resource's display field.\n * The selector and the out-of-scope banner both read the dimension's values through this.\n */\nexport function useResourceDimensionOptions(\n dimension: string,\n resource: string,\n labelField?: string,\n): readonly DimensionOption[] {\n const app = useApp();\n const def = app.registry.get(resource);\n const rowTitle = useRowTitle(resource, labelField ?? def?.displayField);\n const query = useList(resource, {\n pagination: { kind: 'offset', page: 1, pageSize: MAX_DIMENSION_VALUES },\n total: false,\n scope: { default: 'session', dimensions: { [dimension]: 'none' } },\n });\n const rows = query.data?.data;\n return useMemo(\n () =>\n ((rows ?? []) as readonly Record<string, unknown>[]).flatMap((row) => {\n const key = recordKeyOf(def, row);\n return key === null || key === undefined\n ? []\n : [{ value: key as ReadScopeValue, label: rowTitle(row) }];\n }),\n [rows, def, rowTitle],\n );\n}\n","'use client';\nimport {\n humanizeKey,\n type ReadScopeValue,\n type ResourceScopeMapping,\n type ScopeDimensionDefinition,\n type ScopeSelectionValue,\n scopeColumnOf,\n} from '@burojs/core';\nimport { useApp, useChromeT, useScope } from '@burojs/react';\nimport { type ReactElement, useMemo } from 'react';\nimport {\n type DimensionOption,\n useResourceDimensionOptions,\n} from '../layout/use-dimension-options.js';\nimport { Button } from '../primitives/button.js';\n\nexport interface ScopeMismatchBannerProps {\n /** The canonical name of the record's resource. */\n readonly resource: string;\n /** The record (or, for `kind: 'created'`, the create's trusted seeds); `undefined` draws nothing. */\n readonly record: Readonly<Record<string, unknown>> | undefined;\n /**\n * `'record'` (default): a record opened outside the selection (S8). `'created'`: a create whose\n * trusted seeds start outside the selection (the duplicate notice).\n */\n readonly kind?: 'record' | 'created';\n}\n\ninterface Difference {\n readonly dimension: string;\n /** The record's value; `null` when it holds none. */\n readonly value: ReadScopeValue | null;\n readonly selected: readonly ReadScopeValue[];\n readonly select: 'single' | 'multiple';\n}\n\nconst asList = (value: ScopeSelectionValue): readonly ReadScopeValue[] =>\n value === null ? [] : Array.isArray(value) ? value : [value as ReadScopeValue];\n\nconst isScalar = (value: unknown): value is ReadScopeValue =>\n typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';\n\n/**\n * The out-of-scope banner (read-scope spec 3, rule 1, S8): a record outside the selection but\n * inside the allowed set, shown with each differing dimension named — \"Trade Group: Water\n * (selected: Milk)\" — and one Switch that selects them all. A selection change, never a\n * transition. Renders nothing when every mapped dimension's record value is selected, when a\n * dimension has nothing selected, or when the app declares no scope. With `kind: 'created'` it is\n * the duplicate notice of a create seeded outside the selection.\n */\nexport function ScopeMismatchBanner(props: ScopeMismatchBannerProps): ReactElement | null {\n const app = useApp();\n const mapping = (\n app.registry.get(props.resource) as\n | { readonly data?: { readonly scope?: ResourceScopeMapping } }\n | undefined\n )?.data?.scope;\n if (app.scope === undefined || mapping === undefined || props.record === undefined) return null;\n return <Banner {...props} record={props.record} mapping={mapping} />;\n}\n\nfunction Banner({\n record,\n mapping,\n kind = 'record',\n}: ScopeMismatchBannerProps & {\n readonly record: Readonly<Record<string, unknown>>;\n readonly mapping: ResourceScopeMapping;\n}): ReactElement | null {\n const scope = useScope();\n const chromeT = useChromeT();\n const differences = useMemo((): readonly Difference[] => {\n const out: Difference[] = [];\n for (const [dimension, target] of Object.entries(mapping)) {\n const definition = scope.definition?.dimensions[dimension];\n if (definition === undefined || definition.select === 'none') continue;\n const selected = asList(scope.selection[dimension] ?? null);\n // Nothing selected means everything allowed: no difference to name.\n if (selected.length === 0) continue;\n const column = scopeColumnOf(target);\n // A record that does not carry the column cannot be told apart from the selection.\n if (!Object.hasOwn(record, column)) continue;\n const held = record[column];\n if (held === null || held === undefined || held === '') {\n // A seed that holds nothing starts nowhere; a stored row with no value differs, unless\n // the resource shares such rows under every selection.\n if (kind === 'created' || ('field' in target && target.empty === 'shared')) continue;\n out.push({ dimension, value: null, selected, select: definition.select });\n continue;\n }\n if (!isScalar(held)) continue;\n if (selected.some((value) => String(value) === String(held))) continue;\n out.push({ dimension, value: held, selected, select: definition.select });\n }\n return out;\n }, [mapping, record, scope.definition, scope.selection, kind]);\n if (differences.length === 0) return null;\n const apply = () => {\n for (const difference of differences) {\n scope.select(\n difference.dimension,\n difference.value === null\n ? null\n : difference.select === 'multiple'\n ? [difference.value]\n : difference.value,\n );\n }\n };\n return (\n <div\n role=\"status\"\n data-testid=\"scope-mismatch:banner\"\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-md border bg-muted/50 px-3 py-2 text-sm\"\n >\n <div className=\"space-y-1\">\n <p className=\"font-medium\">\n {kind === 'created'\n ? chromeT('scope.mismatch.createdOutside', {\n defaultValue: 'Created outside the current scope',\n })\n : chromeT('scope.mismatch.title', {\n defaultValue: 'This record is outside the current scope',\n })}\n </p>\n <ul className=\"text-muted-foreground\">\n {differences.map((difference) => (\n <DifferenceLine\n key={difference.dimension}\n difference={difference}\n definition={scope.definition!.dimensions[difference.dimension]!}\n />\n ))}\n </ul>\n </div>\n <Button type=\"button\" size=\"sm\" data-testid=\"scope-mismatch:switch\" onClick={apply}>\n {chromeT('scope.mismatch.switch', { defaultValue: 'Switch' })}\n </Button>\n </div>\n );\n}\n\n/** One dimension's line, labelled from the dimension's own values (the selector's read). */\nfunction DifferenceLine(props: {\n readonly difference: Difference;\n readonly definition: ScopeDimensionDefinition;\n}): ReactElement {\n const source = props.definition.values;\n if (source !== undefined && !Array.isArray(source)) {\n const { resource, label } = source as { resource: string; label?: string };\n return (\n <ResourceLine {...props} resource={resource} {...(label ? { labelField: label } : {})} />\n );\n }\n return (\n <LineText\n difference={props.difference}\n options={(source ?? []) as readonly DimensionOption[]}\n />\n );\n}\n\nfunction ResourceLine({\n difference,\n resource,\n labelField,\n}: {\n readonly difference: Difference;\n readonly resource: string;\n readonly labelField?: string;\n}): ReactElement {\n const options = useResourceDimensionOptions(difference.dimension, resource, labelField);\n return <LineText difference={difference} options={options} />;\n}\n\nfunction LineText({\n difference,\n options,\n}: {\n readonly difference: Difference;\n readonly options: readonly DimensionOption[];\n}): ReactElement {\n const chromeT = useChromeT();\n // A value the list does not hold (still loading, or past its first page) reads as itself.\n const labelOf = (value: ReadScopeValue): string =>\n options.find((option) => String(option.value) === String(value))?.label ?? String(value);\n const field = humanizeKey(difference.dimension);\n const item =\n difference.value === null\n ? chromeT('scope.mismatch.empty', { defaultValue: 'not set' })\n : labelOf(difference.value);\n const items = difference.selected.map(labelOf).join(', ');\n return (\n <li data-testid={`scope-mismatch:line:${difference.dimension}`}>\n {chromeT('scope.mismatch.line', {\n params: { field, item, items },\n defaultValue: `${field}: ${item} (selected: ${items})`,\n })}\n </li>\n );\n}\n","'use client';\nimport type { TypeOfferState } from '@burojs/core';\nimport { useApp, useOptionalT, useTestIds } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { FieldDisplay } from '../forms/field.js';\nimport { Skeleton } from '../primitives/skeleton.js';\n\nexport interface TypeOfferProps {\n /** The resource's canonical name. */\n readonly resource: string;\n readonly offer: TypeOfferState;\n readonly onChoose: (type: string) => void;\n}\n\n/**\n * The built-in type offer of a typed create (P1b+P1c decision 24): one option\n * per offered type, in declaration order, each shown as the discriminator's\n * value (its label and icon, through the field's display). Pending while the\n * offer's `scope` is; an empty offer says so.\n */\nexport function TypeOffer({ resource, offer, onChoose }: TypeOfferProps): ReactElement {\n const app = useApp();\n const t = useOptionalT();\n const tid = useTestIds();\n const def = app.registry.get(resource);\n const by = def?.types?.by;\n const field = by === undefined ? undefined : def?.fields[by];\n const ref = def?.ref ?? { namespace: 'default', id: resource };\n return (\n <section aria-labelledby=\"type-offer-title\" className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col gap-1\">\n <h2 id=\"type-offer-title\" className=\"text-base font-semibold\">\n {t('create.typeOffer.title', { defaultValue: 'Choose a type' })}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('create.typeOffer.hint', {\n defaultValue: 'The type decides which fields the record has.',\n })}\n </p>\n </div>\n {offer.status === 'pending' ? (\n <div aria-busy=\"true\" className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-10 w-full\" />\n <Skeleton className=\"h-10 w-full\" />\n </div>\n ) : offer.types.length === 0 ? (\n <p role=\"status\" className=\"text-sm text-muted-foreground\">\n {t('create.typeOffer.empty', { defaultValue: 'No type can be created here.' })}\n </p>\n ) : (\n <ul className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {offer.types.map((type) => (\n <li key={type}>\n <button\n type=\"button\"\n data-testid={tid.typeOffer(resource, type)}\n onClick={() => onChoose(type)}\n className=\"flex w-full items-center gap-2 rounded-md border px-3 py-2 text-left text-sm hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {by === undefined || field === undefined ? (\n type\n ) : (\n <FieldDisplay\n resource={ref}\n name={by}\n field={field as never}\n value={type}\n fallback={<span>{type}</span>}\n />\n )}\n </button>\n </li>\n ))}\n </ul>\n )}\n </section>\n );\n}\n","'use client';\nimport {\n type AnyFrameHandle,\n type Applied,\n type FrameHandle,\n type RecordId,\n type ResourceHandle,\n type ValidationIssue,\n type ValidationIssues,\n issueOfInput,\n normalizeEntityRef,\n normalizeIssueInputs,\n routeServerIssues,\n successNoticesOf,\n type EntityRef,\n type ResourceNameArg,\n resourceKey,\n} from '@burojs/core';\nimport {\n type FormController,\n type FormSubmitContext,\n RecordFrameContext,\n type RecordFrameValue,\n RecordScopeProvider,\n ResourceContext,\n ActionRouteContext,\n RouteSourceContext,\n ScreenStateProvider,\n useApp,\n useFormController,\n useNavigationGuardText,\n useOptionalRouterAdapter,\n usePublishDocVariant,\n useRouteNavigate,\n useTestIds,\n} from '@burojs/react';\nimport {\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useNoticeSink } from '../forms/success-notices.js';\nimport { CheckConfirmDialog } from '../checks/check-confirm-dialog.js';\nimport { DeepLinkScope } from '../quick/use-deep-link.js';\nimport { FormControlProvider, useFormControlOf } from '../resource/form-context.js';\nimport { UndeclaredTypeNotice } from '../frames/builtin-record.js';\nimport { RecordFrameView } from '../frames/record-frame-host.js';\nimport { frameRecordId } from '../frames/slot-wrapper.js';\nimport { useTabsUrlState } from '../screen/use-tabs-url-state.js';\nimport { type FrameChrome, FrameChromeContext } from './frame-context.js';\nimport { FormActions } from './frame-pieces.js';\nimport { RecordState } from './record-state.js';\nimport { ScopeMismatchBanner } from './scope-mismatch-banner.js';\nimport {\n QuickScreenClaimContext,\n RouteScreenClaimContext,\n RouteScreenContext,\n useIsRouteScreen,\n} from './route-screen-context.js';\nimport { TypeOffer } from './type-offer.js';\n\n// biome-ignore lint/suspicious/noExplicitAny: any resource handle\ntype AnyResourceHandle = ResourceHandle<any, any, any, any>;\n\nexport interface RecordScreenProps<N extends string = string> {\n /**\n * The resource: its name (checked against the registered resources), its handle or its entity\n * ref `{ namespace, id }`.\n */\n readonly resource: ResourceNameArg<N> | AnyResourceHandle | EntityRef;\n readonly mode: 'show' | 'edit' | 'create';\n /**\n * The record to read and write (show, edit), as its id field types it: a number for a numeric id\n * field. Not needed when `record` is given.\n */\n readonly recordId?: RecordId;\n /**\n * The accepted type of a typed create. Without a router, changing it remounts the form for the\n * new type and discards unsaved input without asking for confirmation.\n */\n readonly type?: string;\n /** A row the caller already holds: nothing is read. */\n readonly record?: Readonly<Record<string, unknown>>;\n /** The caller's starting values of a create, above the field defaults. */\n readonly defaults?: Readonly<Record<string, unknown>>;\n /**\n * User input for a create (a search text typed into a relation select): after the first settled\n * plan each key whose field the plan holds `active` is set once, as the user typing it would\n * (the form is dirty); any other key is dropped. Not a default, never trusted.\n */\n readonly input?: Readonly<Record<string, unknown>>;\n /**\n * Replaces the built-in update or create; receives the payload (the record's columns) and, as\n * `context.links`, each inline link field's keys to add and remove; `context.idempotencyKey` and\n * `context.resend` name the attempt (a resend of an unknown write keeps its key).\n */\n readonly onSubmit?: (\n payload: Record<string, unknown>,\n context: FormSubmitContext,\n ) => Promise<unknown>;\n /** Called after a successful submit with what the write returned. */\n readonly onSuccess?: (result: unknown) => void;\n /** Replaces Cancel's default back navigation. */\n readonly onCancel?: () => void;\n /** The submit button's label. */\n readonly submitLabel?: string;\n /** Rendered after the record's actions in show. */\n readonly extraActions?: ReactNode;\n /**\n * This instance's record frame (code only): used when its slots cover every slot the screen\n * fills, else a development error and the screen's own frame (spec 3.3).\n */\n readonly frame?: FrameHandle<'record'> | AnyFrameHandle;\n}\n\n/** An `AbortError` by name, from any realm. */\nfunction isAbort(error: unknown): boolean {\n if (error === null || (typeof error !== 'object' && typeof error !== 'function')) return false;\n try {\n return (error as { readonly name?: unknown }).name === 'AbortError';\n } catch {\n return false;\n }\n}\n\nconst NO_ISSUES: ValidationIssues = Object.freeze([]);\n\n/** The notice of a write that was applied but whose answer could not be read (spec 13 item 7). */\nconst APPLIED_UNREADABLE: ValidationIssue = Object.freeze({\n code: 'applied-unreadable',\n message: Object.freeze({\n key: 'errors.appliedUnreadable',\n default:\n \"Saved. The server's answer could not be read, so the screen may not show the latest values.\",\n }),\n path: Object.freeze([]),\n source: 'server',\n severity: 'info',\n});\n\n/** A thrown value's own `issues` data property (never a getter); `undefined` for anything else. */\nfunction issuesOf(error: unknown): unknown {\n if (error === null || typeof error !== 'object') return undefined;\n try {\n const descriptor = Object.getOwnPropertyDescriptor(error, 'issues');\n return descriptor !== undefined && 'value' in descriptor ? descriptor.value : undefined;\n } catch {\n return undefined;\n }\n}\n\nconst NO_EDITED: ReadonlySet<string> = new Set();\n\n/** Whether two field values are the same value (structurally, for the portable ones). */\nfunction sameValue(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\ninterface FrameHostProps extends Omit<RecordScreenProps, 'resource'> {\n readonly resource: string;\n /** A typed create: sets (or, with `undefined`, clears) the chosen type. */\n readonly chooseType: (type: string | undefined) => void;\n /** A quick entry's own screen: the host draws the title. */\n readonly hostTitle: boolean;\n}\n\n/** Mounts the controller inside the screen state, provides the frame, renders it. */\nfunction RecordFrameHost(props: FrameHostProps): ReactElement {\n const { resource, mode } = props;\n // The last failed write's issues (spec 4.14), in the answer's order. They are routed at render\n // against the live plan: the controller shows the ones on fields it holds active, the frame's\n // alert the rest, so a field hidden after the failure hands its issue to the alert (4.6 rule 5).\n // A new submit starts without them.\n const [failed, setFailed] = useState<ValidationIssues>(NO_ISSUES);\n const named = useMemo(\n () =>\n failed.length === 0\n ? NO_ISSUES\n : routeServerIssues(\n { issues: failed },\n (segment) => segment,\n // `_form` is the form's own, like a pathless issue: the alert's, once.\n (field) => field !== '_form',\n ).fields,\n [failed],\n );\n // What each named field held when the write failed, and the fields the user has since edited\n // while the form drew them: the controller dismissed those issues at the field, so the alert\n // must not bring them back if the field is later hidden.\n const atFailure = useRef<Readonly<Record<string, unknown>>>({});\n const [edited, setEdited] = useState<ReadonlySet<string>>(NO_EDITED);\n const controller: FormController = useFormController({\n resource,\n mode,\n ...(props.recordId === undefined ? {} : { recordId: props.recordId }),\n ...(props.type === undefined ? {} : { type: props.type }),\n ...(props.record === undefined ? {} : { record: props.record as Record<string, unknown> }),\n ...(props.defaults === undefined\n ? {}\n : { defaults: props.defaults as Record<string, unknown> }),\n ...(props.onSubmit === undefined ? {} : { onSubmit: props.onSubmit }),\n // A quick entry's own screen plans the entry's body: its declared one, else the route's.\n ...(props.hostTitle ? { entry: 'quick' as const } : {}),\n serverIssues: named,\n });\n // The caller's input, once, after the plan settles: only to fields the plan holds active\n // (P5's `field/edit` and `system` decide), through the same `setValue` the user's typing uses.\n const inputApplied = useRef(false);\n const { input } = props;\n const plan = controller.plan;\n useEffect(() => {\n if (inputApplied.current || input === undefined || mode !== 'create' || plan === null) return;\n inputApplied.current = true;\n for (const [key, value] of Object.entries(input))\n if (plan.fields[key] === 'active') controller.setValue(key, value);\n }, [input, mode, plan, controller]);\n const tid = useTestIds();\n const formId = `record-form-${useId()}`;\n const root = useRef<HTMLDivElement>(null);\n const [submitError, setSubmitError] = useState<unknown>(undefined);\n // The failure's settled `applied`, as the controller settled it for the attempt's key.\n const [submitApplied, setSubmitApplied] = useState<Applied | undefined>(undefined);\n useEffect(() => {\n if (plan === null) return;\n const now = Object.keys(atFailure.current).filter(\n (name) =>\n !edited.has(name) &&\n plan.fields[name] === 'active' &&\n !sameValue(controller.field(name).value, atFailure.current[name]),\n );\n if (now.length > 0) setEdited((previous) => new Set([...previous, ...now]));\n }, [plan, controller, edited]);\n const notify = useNoticeSink(resource);\n // The route's create leaves the page on success (its `onSuccess` navigates). Until it has left,\n // the record is written and the form still shows its values: Create stays disabled, and a\n // submit (a click, Enter in a field) writes nothing, so a navigation still in flight cannot\n // be overtaken by a second record. Any other create screen stays the host's to reset or close.\n const routeScreen = useIsRouteScreen();\n const leavesOnCreate = mode === 'create' && routeScreen;\n const [created, setCreated] = useState(false);\n const createdRef = useRef(false);\n const latest = useRef({ controller, onSuccess: props.onSuccess, notify, leavesOnCreate });\n latest.current = { controller, onSuccess: props.onSuccess, notify, leavesOnCreate };\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const submit = useCallback(async () => {\n if (createdRef.current) return;\n setSubmitError(undefined);\n setSubmitApplied(undefined);\n setFailed(NO_ISSUES);\n setEdited(NO_EDITED);\n atFailure.current = {};\n const outcome = await latest.current.controller.submit();\n if (!mounted.current) return;\n if (\n latest.current.leavesOnCreate &&\n (outcome.status === 'submitted' || (outcome.status === 'failed' && outcome.applied === 'yes'))\n ) {\n createdRef.current = true;\n setCreated(true);\n }\n if (outcome.status === 'submitted') {\n // The write's own notices (spec 4.7), shown once; the form stays on its success path.\n const notices = successNoticesOf(outcome.result);\n if (notices.length > 0) latest.current.notify(notices);\n latest.current.onSuccess?.(outcome.result);\n }\n // Applied, with an answer the runtime could not read (spec 13 item 7): the form has taken its\n // success side, so the screen takes its success path too, with no result, and says so once.\n else if (outcome.status === 'failed' && outcome.applied === 'yes') {\n latest.current.notify([APPLIED_UNREADABLE]);\n latest.current.onSuccess?.(undefined);\n }\n // An aborted write saved nothing and failed nothing the user must read about.\n else if (outcome.status === 'failed' && !isAbort(outcome.error)) {\n setSubmitError(outcome.error ?? null);\n setSubmitApplied(outcome.applied);\n const issues = normalizeIssueInputs(issuesOf(outcome.error)).issues;\n const next = issues.length === 0 ? NO_ISSUES : Object.freeze(issues.map(issueOfInput));\n const held: Record<string, unknown> = {};\n const now = latest.current.controller;\n for (const issue of next) {\n const head = issue.path[0];\n if (typeof head === 'string' && head !== '_form' && now.plan?.fields[head] === 'active')\n held[head] = now.field(head).value;\n }\n atFailure.current = held;\n setFailed(next);\n }\n }, []);\n const record = controller.record;\n // The id as text, for what names the record rather than reads it (the frame, the scope chain).\n const recordText = props.recordId === undefined ? undefined : String(props.recordId);\n const frame = useMemo<RecordFrameValue>(\n () => ({ resource, recordId: recordText, mode, record, controller }),\n [resource, recordText, mode, record, controller],\n );\n // A typed create whose type was accepted can go back to the offer.\n const { chooseType } = props;\n const typedAndAccepted =\n mode === 'create' && controller.typeOffer !== null && controller.failure === null;\n // Change type remounts the form under a new key. A route screen asks the unsaved-changes\n // guard (it navigates); anywhere else nothing would, so a dirty form asks here first, with the\n // guard's own text and the same `window.confirm` fallback (final review I2).\n const adapter = useOptionalRouterAdapter();\n const hostRouter = routeScreen ? adapter : null;\n const guardText = useNavigationGuardText();\n const changeType = useMemo(\n () =>\n typedAndAccepted\n ? () => {\n if (\n hostRouter === null &&\n latest.current.controller.isDirty &&\n !window.confirm(`${guardText.title}\\n\\n${guardText.body}`)\n )\n return;\n chooseType(undefined);\n }\n : undefined,\n [typedAndAccepted, chooseType, hostRouter, guardText.title, guardText.body],\n );\n // A typed resource's record whose discriminator names no declared type (decision 64): show\n // renders the base tree with a notice, edit refuses (fail closed).\n const app = useApp();\n const typesDecl = (\n app.registry.get(resource) as\n | { readonly types?: { readonly by: string; readonly items: readonly { name: string }[] } }\n | undefined\n )?.types;\n const loaded = controller.record;\n const unsupportedType = useMemo<string | null | undefined>(() => {\n if (mode === 'create' || typesDecl === undefined || loaded === undefined) return undefined;\n const value = loaded[typesDecl.by];\n const name = typeof value === 'string' && value !== '' ? value : null;\n return name !== null && typesDecl.items.some((item) => item.name === name) ? undefined : name;\n }, [mode, typesDecl, loaded]);\n // The alert's source: the failed issues, less the ones whose field the user edited since.\n const shownFailed = useMemo(\n () =>\n edited.size === 0\n ? failed\n : Object.freeze(\n failed.filter((issue) => {\n const head = issue.path[0];\n return typeof head !== 'string' || !edited.has(head);\n }),\n ),\n [failed, edited],\n );\n const chrome = useMemo<FrameChrome>(\n () => ({\n ...(props.onCancel === undefined ? {} : { onCancel: props.onCancel }),\n ...(props.submitLabel === undefined ? {} : { submitLabel: props.submitLabel }),\n ...(props.extraActions === undefined ? {} : { extraActions: props.extraActions }),\n ...(changeType === undefined ? {} : { changeType }),\n ...(unsupportedType === undefined ? {} : { unsupportedType }),\n ...(props.hostTitle ? { hostTitle: true as const } : {}),\n formId,\n submitError,\n ...(submitApplied === undefined ? {} : { submitApplied }),\n serverIssues: shownFailed,\n ...(created ? { created: true as const } : {}),\n submit,\n root,\n }),\n [\n props.onCancel,\n props.submitLabel,\n props.extraActions,\n changeType,\n unsupportedType,\n props.hostTitle,\n formId,\n submitError,\n submitApplied,\n shownFailed,\n created,\n submit,\n ],\n );\n usePublishDocVariant(mode === 'show' ? resource : undefined, record as Record<string, unknown>);\n const failure = controller.failure;\n // A typed create without an accepted type shows the offer: the normal path, not a failure.\n const offering = failure?.kind === 'type-required' && controller.typeOffer !== null;\n useEffect(() => {\n if (failure === null || offering || process.env.NODE_ENV === 'production') return;\n console.error(\n `[burojs] <RecordScreen resource=\"${resource}\" mode=\"${mode}\"> cannot render its screen: ${\n failure.kind === 'screen'\n ? `${failure.failure.code} at ${failure.failure.path.join('.')}: ${failure.failure.message}`\n : 'a typed create needs an accepted type'\n }.`,\n );\n }, [failure, offering, resource, mode]);\n const formControl = useFormControlOf(controller);\n const id = frameRecordId(frame, app.registry.get(frame.resource));\n const rootId =\n mode === 'show'\n ? tid.pageShow(resource, id ?? '')\n : mode === 'edit'\n ? tid.pageEdit(resource, id ?? '')\n : tid.pageCreate(resource);\n // The route source is this screen's controller's alone (spec 4.5): anything below it — a\n // block that mounts its own form controller — reads `{}`.\n // The record's scope frame (read-scope spec §4 rule 1): show narrows the reads below it by the\n // read record, edit and create by the live form values, so a changed scope field re-scopes them.\n // A create's frame is marked: what it does not carry reads the selection, not an enclosing record.\n // The route this screen claimed (its route screen's, a quick entry's; `null` for a nested\n // screen): the reset below hides it from forms and blocks, but this screen's own actions read it\n // in their `when` (read-scope 7c.6).\n const claimedRoute = useContext(RouteSourceContext);\n const scopeValues = mode === 'show' ? controller.record : controller.values;\n return (\n <RecordScopeProvider\n resource={resource}\n {...(recordText === undefined ? {} : { recordId: recordText })}\n values={scopeValues}\n create={mode === 'create'}\n >\n <RouteSourceContext.Provider value={null}>\n <ActionRouteContext.Provider value={claimedRoute}>\n <RecordFrameContext.Provider value={frame}>\n <FrameChromeContext.Provider value={chrome}>\n <FormControlProvider value={formControl}>\n <DeepLinkScope plan={controller.plan} enabled={routeScreen && mode !== 'create'}>\n <div\n ref={root}\n data-testid={rootId}\n className=\"flex flex-col gap-[var(--buro-section-gap)]\"\n >\n {offering && controller.typeOffer !== null ? (\n <TypeOffer\n resource={resource}\n offer={controller.typeOffer}\n onChoose={(type) => chooseType(type)}\n />\n ) : failure !== null ? (\n <>\n <RecordState state=\"error\" />\n <FormActions />\n </>\n ) : mode === 'edit' && unsupportedType !== undefined ? (\n <UndeclaredTypeNotice resource={resource} typeValue={unsupportedType} />\n ) : (\n <>\n {/* S8 (read-scope spec 3): a record outside the selection, or a create seeded outside it. */}\n <ScopeMismatchBanner\n resource={resource}\n record={mode === 'create' ? controller.trustedSeeds : controller.record}\n kind={mode === 'create' ? 'created' : 'record'}\n />\n <RecordFrameView\n {...(props.frame === undefined ? {} : { frame: props.frame })}\n />\n </>\n )}\n </div>\n </DeepLinkScope>\n {controller.checkGate === null ? null : (\n <CheckConfirmDialog\n state={controller.checkGate}\n testid={`${tid.form(resource, mode, id)}:checks`}\n />\n )}\n </FormControlProvider>\n </FrameChromeContext.Provider>\n </RecordFrameContext.Provider>\n </ActionRouteContext.Provider>\n </RouteSourceContext.Provider>\n </RecordScopeProvider>\n );\n}\n\n/**\n * A record's show, edit or create screen outside a route (P1b+P1c decision\n * 20): the planned screen in its frame (the screen's, the app's, the built-in\n * one, or this instance's `frame`). Reads the record by `recordId` unless\n * `record` is given; writes with the resource's update or create unless\n * `onSubmit` is given. A resource the app does not know renders not-found.\n */\nexport function RecordScreen<const N extends string = string>(\n props: RecordScreenProps<N>,\n): ReactElement {\n const app = useApp();\n // The route's own screen claims the route (a screen nested in it is not one).\n const routeScreen = useContext(RouteScreenClaimContext);\n // A quick entry's own screen (P3-14): not a route screen, but it reads the entry's `route`.\n const quickScreen = useContext(QuickScreenClaimContext);\n // Only the route's (or the quick entry's) own screen reads `route`; a nested one reads `{}`.\n const route = useContext(RouteSourceContext);\n // The canonical name of the prop: a name, a handle or an entity ref.\n const resourceInput: RecordScreenProps['resource'] = props.resource;\n const resource = resourceKey(resourceInput);\n // Above the screen state, which it controls: the URL's keyed tabs reach the plan.\n const tabs = useTabsUrlState(props.mode, routeScreen);\n // A typed create's type (decision 24): on a route screen under a router, the URL's `?type=`\n // (a choice navigates, guarded, keeping the other parameters); anywhere else — no router, or\n // a screen beside the page's own such as a quick entry — this component's own state, so the\n // page's URL is left alone (P3-35). Either way the controller re-checks it against the offer.\n const adapter = useOptionalRouterAdapter();\n const router = routeScreen ? adapter : null;\n const navigate = useRouteNavigate();\n const [local, setLocal] = useState(props.type);\n // A new `type` prop replaces the local choice (a host following its own state remounts the\n // form for the new type, and the payload follows it).\n const [typeProp, setTypeProp] = useState(props.type);\n if (props.type !== typeProp) {\n setTypeProp(props.type);\n setLocal(props.type);\n }\n // Under a router a `type` prop is the starting choice; once the user picks or changes the\n // type through the offer, the URL's `?type=` decides (final review M1).\n const [chose, setChose] = useState(false);\n const fromUrl = router?.searchParams.get('type') ?? undefined;\n const type =\n props.mode !== 'create'\n ? props.type\n : router === null\n ? local\n : chose\n ? fromUrl\n : (props.type ?? fromUrl);\n const chooseType = useCallback(\n (next: string | undefined) => {\n if (router === null) {\n setLocal(next);\n return;\n }\n setChose(true);\n const params = new URLSearchParams(router.searchParams);\n if (next === undefined) params.delete('type');\n else params.set('type', next);\n const query = params.toString();\n navigate(query === '' ? router.pathname : `${router.pathname}?${query}`);\n },\n [router, navigate],\n );\n if (app.registry.get(resource) === undefined) return <RecordState state=\"not-found\" />;\n const { type: _declared, ...rest } = props;\n return (\n <RouteScreenClaimContext.Provider value={false}>\n <QuickScreenClaimContext.Provider value={false}>\n <RouteSourceContext.Provider value={routeScreen || quickScreen ? route : null}>\n <RouteScreenContext.Provider value={routeScreen}>\n <ResourceContext.Provider value={{ resource }}>\n <ScreenStateProvider open={tabs.open} onOpenChange={tabs.onOpenChange}>\n <RecordFrameHost\n key={type ?? ''}\n {...rest}\n {...(type === undefined ? {} : { type })}\n resource={resource}\n chooseType={chooseType}\n hostTitle={quickScreen}\n />\n </ScreenStateProvider>\n </ResourceContext.Provider>\n </RouteScreenContext.Provider>\n </RouteSourceContext.Provider>\n </QuickScreenClaimContext.Provider>\n </RouteScreenClaimContext.Provider>\n );\n}\n","'use client';\nimport { useApp } from '@burojs/react';\nimport { useCallback, useEffect, useSyncExternalStore } from 'react';\n\n/**\n * What a record or page-flow route tells the header's trail once it has\n * decided what to show: the record's title, and a page-hosted flow's label.\n * The page publishes it only from the states that display the record — a\n * loaded show or edit page, a flow's form or its \"not available\" notice — so a\n * loading, not-found or forbidden route publishes nothing, and the header's\n * trail ends at the id there. The header never reads the record itself: the\n * page's gates (permissions, row rules, projection) decide what it may name.\n */\nexport interface PublishedRecordTrail {\n /** The route the entry belongs to, from `recordTrailKey`. */\n readonly key: string;\n /** The record's display title; `''` when it has none and the id stands in. */\n readonly title: string;\n /** A page-hosted flow's label: the trail's current crumb on the flow's route. */\n readonly flowLabel?: string;\n}\n\ninterface Store {\n current: PublishedRecordTrail | null;\n readonly listeners: Set<() => void>;\n}\n\n/** One store per app: two apps on one page never read each other's trail. */\nconst stores = new WeakMap<object, Store>();\n\nfunction storeOf(app: object): Store {\n let store = stores.get(app);\n if (store === undefined) {\n store = { current: null, listeners: new Set() };\n stores.set(app, store);\n }\n return store;\n}\n\nfunction set(store: Store, value: PublishedRecordTrail | null): void {\n store.current = value;\n for (const listener of store.listeners) listener();\n}\n\n/** The key of a record route (`show`/`edit`/`create`) or of a page-hosted flow's route. */\nexport function recordTrailKey(resource: string, id: string, route: string): string {\n return JSON.stringify([resource, id, route]);\n}\n\n/**\n * Publishes `entry` for as long as the calling component is mounted with it;\n * `null` publishes nothing. Unmounting, or a new entry, withdraws the old one.\n *\n * The store holds ONE entry per app, and the last writer wins: when two\n * mounted components publish at once, the later effect replaces the earlier\n * entry, and the earlier one's cleanup no longer clears it (it only clears an\n * entry that is still its own). The header reads the entry only for its own\n * route key, so the one page that owns the route should be the only publisher.\n */\nexport function usePublishRecordTrail(entry: PublishedRecordTrail | null): void {\n const app = useApp();\n const key = entry?.key;\n const title = entry?.title;\n const flowLabel = entry?.flowLabel;\n useEffect(() => {\n if (key === undefined || title === undefined) return;\n const store = storeOf(app);\n const value: PublishedRecordTrail = {\n key,\n title,\n ...(flowLabel === undefined ? {} : { flowLabel }),\n };\n set(store, value);\n return () => {\n if (store.current === value) set(store, null);\n };\n }, [app, key, title, flowLabel]);\n}\n\n/** The entry the route `key` published, or `null` while it has published none. */\nexport function usePublishedRecordTrail(key: string): PublishedRecordTrail | null {\n const store = storeOf(useApp());\n const subscribe = useCallback(\n (listener: () => void) => {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n },\n [store],\n );\n const current = useSyncExternalStore(\n subscribe,\n () => store.current,\n () => null,\n );\n return current !== null && current.key === key ? current : null;\n}\n","import type { AppRuntime, RouteDescriptor } from '@burojs/core';\nimport { recordRouteAvailable } from '@burojs/react';\n\ntype Registry = AppRuntime['registry'];\n\n/** Whether the resource has a show page. */\nexport function isShowAvailable(registry: Registry, resource: string): boolean {\n return recordRouteAvailable(registry, resource, 'show');\n}\n\nexport function showTarget(resource: string, id: string): RouteDescriptor {\n return { resource, action: 'show', params: { id } };\n}\n\nexport function listTarget(resource: string): RouteDescriptor {\n return { resource, action: 'list' };\n}\n","'use client';\nimport {\n type AppRuntime,\n type I18nCaps,\n type NavGroupDef,\n type NavNode,\n type RouteMatch,\n type ScreenMode,\n declaredText,\n hasListPage,\n hrefFor,\n matchPath,\n resolveNavLabel,\n resolveResourceLabel,\n} from '@burojs/core';\nimport {\n type NavigationOrigin,\n ORIGIN_DEPTH,\n recordRouteAvailable,\n resolveRoute,\n useApp,\n useI18nCaps,\n useT,\n} from '@burojs/react';\nimport { canonicalNavKey } from '../resource-key.js';\nimport { groupNavHref } from './build-nav-items.js';\nimport type { BreadcrumbsProps } from './breadcrumbs.js';\nimport { isShowAvailable, showTarget } from './record-targets.js';\nimport { useNavVisible } from './use-nav-routing.js';\n\n/**\n * The one trail builder. The header draws the only trail of a page\n * (`<HeaderBreadcrumbs>`), record and flow routes included; every shape comes\n * from here and renders through `<Breadcrumbs>`, so a group crumb follows one\n * rule everywhere: a link to the group's first reachable member, or text when\n * it has none.\n */\nexport interface Crumb {\n label: string;\n href?: string;\n /** A click starts a fresh trail (navigation origin): a group crumb, which jumps to a section. */\n jump?: boolean;\n}\n\nexport interface TrailContext {\n readonly registry: AppRuntime['registry'];\n readonly caps: I18nCaps;\n readonly isVisible: (node: NavNode) => boolean;\n readonly t: (key: string) => string;\n}\n\n/** What every trail reads: the registry, the i18n caps, the nav visibility predicate and `t`. */\nexport function useTrailContext(): TrailContext {\n const app = useApp();\n const caps = useI18nCaps();\n const isVisible = useNavVisible();\n const t = useT();\n return { registry: app.registry, caps, isVisible, t };\n}\n\nexport function groupCrumbs(ctx: TrailContext, chain: readonly NavGroupDef[]): Crumb[] {\n return chain.map((group) => {\n const key = canonicalNavKey(group);\n return {\n label: resolveNavLabel(ctx.caps, `groups.${key}`, declaredText('chrome', group, 'label')),\n href: groupNavHref(ctx.registry, key, ctx.isVisible),\n jump: true,\n };\n });\n}\n\n/** The crumbs, or `undefined` when there are none — `<Breadcrumbs>` then renders no leading run. */\nexport function nonEmpty(crumbs: Crumb[]): Crumb[] | undefined {\n return crumbs.length > 0 ? crumbs : undefined;\n}\n\n/** The record action a route match addresses, or `undefined`. */\nexport function recordActionOf(match: RouteMatch | null): ScreenMode | undefined {\n if (match === null || match.kind !== 'resource') return undefined;\n switch (match.action) {\n case 'show':\n case 'edit':\n case 'create':\n return match.action;\n default:\n return undefined;\n }\n}\n\n/** The pathname of an app-space href. */\nfunction pathOf(href: string): string {\n const path = href.split(/[?#]/, 1)[0] ?? '';\n return path.length > 1 && path.endsWith('/') ? path.slice(0, -1) : path;\n}\n\n/**\n * The trail of the page a record page was reached from (navigation-origin spec §4.6), as the\n * pieces `<Breadcrumbs>` draws: the leading run (a group chain), the resource whose list it\n * passes through — with the address the user had it at — and the crumbs after it, the last one\n * linking to the origin's full address. `undefined` for an origin the registry cannot match.\n */\nexport interface OriginTrail {\n readonly leading: readonly Crumb[];\n /** The resource crumb's resource; absent for a custom page's or a group's trail. */\n readonly resource?: string;\n /** Where the resource crumb links: the list as the user had it, else its canonical address. */\n readonly resourceHref?: string;\n readonly segments: readonly Crumb[];\n}\n\n/**\n * Walks the origin chain at most `depth` links deep: a record page's crumb follows its own\n * origin's trail; the last link walked starts from its canonical leading part.\n */\nexport function originTrail(\n ctx: TrailContext,\n origin: NavigationOrigin,\n depth: number = ORIGIN_DEPTH,\n): OriginTrail | undefined {\n const match = matchPath(ctx.registry, pathOf(origin.href), { isVisible: ctx.isVisible });\n if (match === null) return undefined;\n switch (match.kind) {\n case 'resource': {\n const key = canonicalNavKey(match);\n if (match.action === 'list')\n return {\n leading: groupCrumbs(ctx, match.groupChain),\n resource: key,\n resourceHref: origin.href,\n segments: [],\n };\n const def = ctx.registry.get(key);\n const label =\n match.action === 'create'\n ? ctx.t('breadcrumbs.create')\n : origin.title || (match.id === undefined ? '' : `#${match.id}`);\n const crumb: Crumb = { label, href: origin.href };\n const parent =\n depth > 1 && origin.origin !== undefined\n ? originTrail(ctx, origin.origin, depth - 1)\n : undefined;\n if (parent !== undefined) return { ...parent, segments: [...parent.segments, crumb] };\n return {\n leading: groupCrumbs(ctx, match.groupChain),\n resource: key,\n ...(def !== undefined && hasListPage(def)\n ? { resourceHref: hrefFor(ctx.registry, key) }\n : {}),\n segments: [crumb],\n };\n }\n case 'custom-page': {\n const trail = headerTrail(ctx, match);\n if (trail === null || trail.pageLabel === undefined) return undefined;\n return {\n leading: trail.leadingSegments ?? [],\n segments: [{ label: trail.pageLabel, href: origin.href }],\n };\n }\n case 'group-index': {\n const crumbs = groupCrumbs(ctx, match.groupChain);\n const own = crumbs[crumbs.length - 1];\n if (own === undefined) return undefined;\n return { leading: crumbs.slice(0, -1), segments: [{ label: own.label, href: origin.href }] };\n }\n default:\n return undefined;\n }\n}\n\nexport interface RecordTrailInput {\n readonly resource: string;\n readonly action: ScreenMode;\n /** The record id as the URL carries it; `''` on create or when none is known. */\n readonly id: string;\n /** The record's display title; `''` when none is known, and the id stands in. */\n readonly title: string;\n readonly groupChain: readonly NavGroupDef[];\n /**\n * The trail of the page the user came from (`originTrail`): the trail roots there instead of\n * at the record's own resource (navigation-origin spec §4.6).\n */\n readonly origin?: OriginTrail;\n}\n\n/**\n * A record route's trail, the one `<RecordBreadcrumbs>` draws in the header: the group chain, the resource, then the record\n * (show), the record linking to show when show is available plus \"Edit\"\n * (edit), or \"Create\" (create). With no id at all it ends at the resource.\n *\n * With an `origin` the trail roots where the user came from: the origin's trail, then the\n * record's own part. An origin through the record's own resource keeps the resource crumb,\n * linking to the list as the user had it; any other origin replaces the group chain and the\n * resource crumb (`rootSegments`). A crumb of the record's own part that the origin already\n * draws (the show page edit was opened from) is drawn once, at the origin's address.\n */\nexport function recordTrail(ctx: TrailContext, input: RecordTrailInput): BreadcrumbsProps {\n const { resource, action, id, origin } = input;\n if (origin !== undefined && (action === 'create' || id !== ''))\n return originRooted(ctx, input, origin);\n const leadingSegments = nonEmpty(groupCrumbs(ctx, input.groupChain));\n if (action !== 'create' && id === '') return { resource, leadingSegments };\n const recordLabel = input.title || id;\n const middleSegments =\n action === 'edit'\n ? [\n isShowAvailable(ctx.registry, resource)\n ? { label: recordLabel, href: resolveRoute(showTarget(resource, id), ctx.registry) }\n : { label: recordLabel },\n ]\n : undefined;\n const pageLabel =\n action === 'create'\n ? ctx.t('breadcrumbs.create')\n : action === 'edit'\n ? ctx.t('breadcrumbs.edit')\n : recordLabel;\n return {\n resource,\n recordId: action === 'create' ? undefined : id,\n pageLabel,\n leadingSegments,\n middleSegments,\n };\n}\n\n/** `recordTrail` with an origin. */\nfunction originRooted(\n ctx: TrailContext,\n input: RecordTrailInput,\n origin: OriginTrail,\n): BreadcrumbsProps {\n const { resource, action, id } = input;\n const recordLabel = input.title || id;\n const drawn = new Set(\n origin.segments.flatMap((crumb) => (crumb.href === undefined ? [] : [pathOf(crumb.href)])),\n );\n const own: Crumb[] =\n action === 'edit'\n ? [\n isShowAvailable(ctx.registry, resource)\n ? { label: recordLabel, href: resolveRoute(showTarget(resource, id), ctx.registry) }\n : { label: recordLabel },\n ].filter((crumb) => crumb.href === undefined || !drawn.has(pathOf(crumb.href)))\n : [];\n const pageLabel =\n action === 'create'\n ? ctx.t('breadcrumbs.create')\n : action === 'edit'\n ? ctx.t('breadcrumbs.edit')\n : recordLabel;\n const recordId = action === 'create' ? undefined : id;\n const middleSegments = nonEmpty([...origin.segments, ...own]);\n if (\n origin.resource !== undefined &&\n ctx.registry.get(origin.resource) === ctx.registry.get(resource)\n )\n return {\n resource,\n recordId,\n pageLabel,\n leadingSegments: nonEmpty([...origin.leading]),\n ...(origin.resourceHref === undefined ? {} : { resourceHref: origin.resourceHref }),\n middleSegments,\n };\n const def = origin.resource === undefined ? undefined : ctx.registry.get(origin.resource);\n const resourceCrumb: Crumb[] =\n origin.resource === undefined\n ? []\n : [\n {\n label: resolveResourceLabel(ctx.caps, origin.resource, 'plural', def),\n ...(origin.resourceHref === undefined ? {} : { href: origin.resourceHref }),\n },\n ];\n return {\n resource,\n recordId,\n pageLabel,\n rootSegments: [...origin.leading, ...resourceCrumb, ...origin.segments, ...own],\n };\n}\n\n/**\n * The route the record trail (`<RecordBreadcrumbs>`) is drawn for: a record\n * route whose operation is available — decided with `recordRouteAvailable`,\n * the router's own gate, so the trail and the router cannot disagree — or a\n * page-hosted flow's route (`flow` is its name). `id` is `''` on create.\n * `null` on every other match.\n */\nexport interface RecordTrailRoute {\n readonly resource: string;\n readonly action: ScreenMode;\n readonly id: string;\n readonly flow?: string;\n readonly groupChain: readonly NavGroupDef[];\n}\n\nexport function recordTrailRoute(\n registry: AppRuntime['registry'],\n match: RouteMatch | null,\n): RecordTrailRoute | null {\n if (match === null || match.kind !== 'resource') return null;\n const resource = canonicalNavKey(match);\n const { groupChain } = match;\n if (match.action === 'flow') {\n return { resource, action: 'show', id: match.id ?? '', flow: match.flow ?? '', groupChain };\n }\n const action = recordActionOf(match);\n if (action === undefined || !recordRouteAvailable(registry, resource, action)) return null;\n return { resource, action, id: action === 'create' ? '' : (match.id ?? ''), groupChain };\n}\n\n/**\n * The header's trail for the current match, the record trail aside:\n * - a resource list: the group chain, then the resource as the current crumb;\n * - a custom page: the group chain, then the page;\n * - a group index: the chain, its last entry (the matched group) current;\n * - a record route whose operation is available, or a page-hosted flow's\n * route: nothing here — `<HeaderBreadcrumbs>` draws the record trail\n * (`<RecordBreadcrumbs>`, see `recordTrailRoute`) for those;\n * - a record route whose operation is off (the router renders not-found):\n * the group chain, the resource linking to its list, and the page's title;\n * - no match: nothing.\n */\nexport function headerTrail(ctx: TrailContext, match: RouteMatch | null): BreadcrumbsProps | null {\n if (match === null) return null;\n const key = canonicalNavKey(match);\n switch (match.kind) {\n case 'resource': {\n const leadingSegments = nonEmpty(groupCrumbs(ctx, match.groupChain));\n const action = recordActionOf(match);\n // The record trail's routes: `<RecordBreadcrumbs>` draws those.\n if (recordTrailRoute(ctx.registry, match) !== null) return null;\n if (action === undefined) return { resource: key, leadingSegments };\n return {\n resource: key,\n recordId: match.id,\n pageLabel: ctx.t('router.notFoundTitle'),\n leadingSegments,\n };\n }\n case 'custom-page': {\n const page = ctx.registry.customPages.get(match.name);\n // A page the user may not open is the route's not-found, and the header says nothing of it:\n // the same trail a missing page gets. `isVisible` is the page's `visible` and its `requires`\n // decision (the check `PageHost` makes); undecided is denied, so no label shows early.\n if (page === undefined || !ctx.isVisible(page as NavNode)) return null;\n return {\n name: key,\n pageLabel: resolveNavLabel(ctx.caps, `pages.${key}`, declaredText('chrome', page, 'label')),\n leadingSegments: nonEmpty(groupCrumbs(ctx, match.groupChain)),\n };\n }\n case 'group-index': {\n const own = match.groupChain[match.groupChain.length - 1];\n if (own === undefined) return null;\n const crumbs = groupCrumbs(ctx, match.groupChain);\n const current = crumbs[crumbs.length - 1] as Crumb;\n return {\n name: canonicalNavKey(own),\n pageLabel: current.label,\n leadingSegments: nonEmpty(crumbs.slice(0, -1)),\n };\n }\n default:\n return null;\n }\n}\n","/*\n * The recently visited records the command palette offers (internal). `<RecordPage>` writes a\n * visit as it reads a record (`./use-record-visit.ts`); the palette's Recent group reads them\n * back. Stored per signed-in user under `buro:recent:v2:<userId>`; nothing is stored without one,\n * and `@burojs/react`'s `BuroProvider` removes the list when that user signs out.\n */\n\nimport { type KeyValueStore, maybeThen, settle } from '@burojs/react';\n\n/** One visited record: the resource's canonical ref, the record id, its label then, and when. */\nexport interface RecentRecord {\n readonly canonicalRef: string;\n readonly id: string;\n /** Resolved when visited (alias → name → title → label → id), so a deleted record still reads. */\n readonly label: string;\n /**\n * The field the label was read from, absent when it is the id. The palette shows the label only\n * while that field is still visible to the signed-in user (P5 spec 3.8).\n */\n readonly labelField?: string;\n /** ISO time of the latest visit. */\n readonly at: string;\n}\n\ninterface RecentEnvelope {\n readonly version: 2;\n readonly items: readonly RecentRecord[];\n}\n\n/** The number of entries kept: the newest first, the oldest dropped. */\nexport const RECENT_LIMIT = 5;\n\n/** The storage key of a user's list. */\nexport function recentStorageKey(userId: string): string {\n return `buro:recent:v2:${userId}`;\n}\n\nfunction isRecent(value: unknown): value is RecentRecord {\n if (typeof value !== 'object' || value === null) return false;\n const entry = value as Record<string, unknown>;\n return (\n typeof entry.canonicalRef === 'string' &&\n typeof entry.id === 'string' &&\n typeof entry.label === 'string' &&\n (entry.labelField === undefined || typeof entry.labelField === 'string') &&\n typeof entry.at === 'string'\n );\n}\n\n/** The stored list; malformed JSON, another version or a malformed entry reads as nothing. */\nfunction parse(raw: string | null): RecentRecord[] {\n if (raw === null) return [];\n try {\n const parsed: unknown = JSON.parse(raw);\n if (typeof parsed !== 'object' || parsed === null) return [];\n const envelope = parsed as { readonly version?: unknown; readonly items?: unknown };\n if (envelope.version !== 2 || !Array.isArray(envelope.items)) return [];\n return envelope.items.filter(isRecent);\n } catch {\n return [];\n }\n}\n\n/** The user's visited records, newest first. A store that fails reads as nothing. */\nexport function readRecentRecords(\n store: KeyValueStore,\n userId: string,\n): RecentRecord[] | Promise<RecentRecord[]> {\n return maybeThen(\n settle<string | null>(() => store.get(recentStorageKey(userId)), null),\n parse,\n );\n}\n\n/**\n * Moves `entry` to the front of the user's list (one entry per `(canonicalRef, id)`), keeping\n * `RECENT_LIMIT`. A store that refuses the write (quota, private mode, a backend down) is\n * dropped: the palette keeps what the last successful write left. Synchronous over a\n * synchronous store; a promise over an asynchronous one.\n */\nexport function writeRecentRecord(\n store: KeyValueStore,\n userId: string,\n entry: RecentRecord,\n): void | Promise<void> {\n const key = recentStorageKey(userId);\n const written = maybeThen(\n settle<string | null>(() => store.get(key), null),\n (raw) => {\n const others = parse(raw).filter(\n (item) => !(item.canonicalRef === entry.canonicalRef && item.id === entry.id),\n );\n const envelope: RecentEnvelope = {\n version: 2,\n items: [entry, ...others].slice(0, RECENT_LIMIT),\n };\n return settle<void>(() => store.set(key, JSON.stringify(envelope)), undefined);\n },\n );\n return written as void | Promise<void>;\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nexport const RECENT_LABEL_KEYS: readonly string[] = ['alias', 'name', 'title', 'label'];\n\n/**\n * A record's label as the palette shows it: alias, name, title, label, else its id. A field the\n * resource guards (`isGuarded`: `sensitive`, or addressed by a `field/view` rule or `requires`) is\n * never stored (it is skipped, as drafts skip it). `field` names the field the label came from.\n */\nexport function recentLabel(\n record: Readonly<Record<string, unknown>>,\n id: string,\n isGuarded: (field: string) => boolean = () => false,\n): { readonly label: string; readonly field?: string } {\n for (const key of RECENT_LABEL_KEYS) {\n if (isGuarded(key)) continue;\n const value = text(record[key]);\n if (value !== undefined) return { label: value, field: key };\n }\n return { label: id };\n}\n","'use client';\nimport { addressesCapability, fieldSensitivity } from '@burojs/core';\nimport { recordKeyOf, useApp, useCurrentUserId, usePlatformStorage } from '@burojs/react';\nimport { useEffect } from 'react';\nimport { recentLabel, writeRecentRecord } from './recent-records.js';\nimport { canonicalResourceName } from '../list-kit/list-slots.js';\n\n/**\n * Records a visit of `record` of `resource` for the signed-in user (internal; `<RecordPage>`\n * calls it with the record it read). Nothing is written without a user id, while the record is\n * placeholder data, or when the record has no string or number key (`data.idField`, else `id`).\n * A `sensitive` field is never stored as the label. Writes again when the record, its label or\n * the user changes.\n */\nexport function useRecordVisit(\n resource: string,\n record: Readonly<Record<string, unknown>> | null | undefined,\n opts: { readonly isCurrentData: boolean },\n): void {\n const userId = useCurrentUserId();\n const store = usePlatformStorage().local;\n const app = useApp();\n const def = app.registry.get(resource);\n const raw = recordKeyOf(def, record);\n const id = typeof raw === 'string' || typeof raw === 'number' ? String(raw) : undefined;\n const fields = (def as { readonly fields?: Record<string, unknown> } | undefined)?.fields;\n // A bare hook host has no rule source: nothing is addressed there.\n const rules = app.ruleSource?.rules(resource) ?? [];\n // A label never comes from a field the resource guards: `sensitive`, or addressed by a view\n // rule (an authored `field/view` rule or a lowered `requires.view`), whatever its `when` says.\n const isGuarded = (field: string) =>\n (fields !== undefined &&\n Object.hasOwn(fields, field) &&\n fieldSensitivity(fields[field]) !== undefined) ||\n addressesCapability(rules, 'view', { kind: 'field', name: field });\n const picked =\n record != null && id !== undefined ? recentLabel(record, id, isGuarded) : undefined;\n const label = picked?.label;\n const labelField = picked?.field;\n const canonicalRef = canonicalResourceName(resource);\n const { isCurrentData } = opts;\n useEffect(() => {\n if (userId === null || !isCurrentData || id === undefined || id === '') return;\n if (label === undefined) return;\n void writeRecentRecord(store, userId, {\n canonicalRef,\n id,\n label,\n ...(labelField === undefined ? {} : { labelField }),\n at: new Date().toISOString(),\n });\n }, [store, userId, isCurrentData, canonicalRef, id, label, labelField]);\n}\n","'use client';\nimport {\n type AppContext,\n type RecordId,\n type ScreenMode,\n addressesCapability,\n permissionsUndecided,\n dtoFields,\n routeResourceKey,\n type ResourceNameOrRef,\n} from '@burojs/core';\nimport {\n RouteSourceContext,\n useApp,\n useOne,\n useProjectedRecord,\n useOptionalDataRuntime,\n useOptionalRouterAdapter,\n useRecordTitle,\n retryRecordRead,\n useAvailabilityResolver,\n useCtx,\n useReturnTarget,\n useRouteNavigate,\n useRouteRecordId,\n} from '@burojs/react';\nimport { type ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { RecordScreen } from '../record/record-screen.js';\nimport { RouteScreenClaimContext } from '../record/route-screen-context.js';\nimport { InvalidRouteId, LoadError } from '../load-error/load-error-view.js';\nimport { RecordState } from '../record/record-state.js';\nimport { PageHeader } from '../resource/page-header.js';\nimport { recordTrailKey, usePublishRecordTrail } from './record-trail-store.js';\nimport { isShowAvailable, listTarget, showTarget } from './record-targets.js';\nimport { recordActionOf } from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\nimport { useRecordVisit } from './use-record-visit.js';\n\n/**\n * A record page's resource and action. Inside a record slot both default to\n * the route (`<RecordPage defaults={{ type }} />`); outside one both are\n * required, and a missing one renders not-found with a development error.\n * `defaults` exists on `create` only: show and edit render the record as it\n * is, so the type refuses it there rather than ignoring it.\n */\nexport type RecordPageProps<N extends string = string> =\n | {\n /** A name checked against the registered resources, or the entity ref. */\n readonly resource?: ResourceNameOrRef<N>;\n readonly action: Exclude<ScreenMode, 'create'>;\n readonly defaults?: never;\n }\n | {\n readonly resource?: ResourceNameOrRef<N>;\n readonly action?: Extract<ScreenMode, 'create'>;\n /**\n * The caller's tier of starting values, above each field's declared\n * default, the matched type's `defaults` and URL prefill.\n */\n readonly defaults?: Record<string, unknown>;\n };\n\ntype RecordTarget =\n | {\n readonly resource: string;\n readonly action: Exclude<ScreenMode, 'create'>;\n readonly defaults?: never;\n }\n | {\n readonly resource: string;\n readonly action: Extract<ScreenMode, 'create'>;\n readonly defaults?: Record<string, unknown>;\n };\n\nexport type RecordRouteProps = RecordTarget & {\n /** The record id as the URL carries it, read as the id field's declared type (a number for a numeric id field). An invalid id, and `''`, render not-found without a request. */\n readonly id: string;\n};\n\ntype RecordReadProps = RecordRouteProps & { readonly action: Exclude<ScreenMode, 'create'> };\ntype RecordCreateProps = RecordRouteProps & { readonly action: Extract<ScreenMode, 'create'> };\n\ntype LoadedRecord = { id: string } & Record<string, unknown>;\n\ninterface LoadedRecordProps {\n readonly resource: string;\n /** The id as the URL spells it: the header, the trail and the way back. */\n readonly id: string;\n /** The same id as the id field types it: what the screen reads and writes with. */\n readonly recordId: RecordId;\n /** The row as read: the screen projects it itself and keeps it for policy (gates, flows). */\n readonly record: LoadedRecord;\n /** The projected row: what the header and the header's trail read. */\n readonly shown: LoadedRecord;\n}\n\n/**\n * Whether the calling component is still mounted — read after an `await`.\n * Set in the effect as well as cleared in its cleanup, so a StrictMode\n * remount reads true again.\n */\nfunction useMountedRef(): { readonly current: boolean } {\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n return mounted;\n}\n\n/**\n * The route's heading above the frame: an `sr-only` h1 that titles the page. The\n * trail is the header's (`<HeaderBreadcrumbs>`); the heading tells it the record's\n * title, which it shows in place of the id once the record is loaded.\n */\nfunction RecordRouteHeader({\n resource,\n action,\n id,\n record,\n}: {\n readonly resource: string;\n readonly action: ScreenMode;\n readonly id: string;\n readonly record?: LoadedRecord;\n}): ReactElement {\n const recordName = useRecordTitle(resource, action === 'create' ? undefined : id, record);\n usePublishRecordTrail(\n action === 'create' ? null : { key: recordTrailKey(resource, id, action), title: recordName },\n );\n return (\n <PageHeader\n resource={resource}\n mode={action}\n {...(action === 'create' ? {} : { recordName })}\n />\n );\n}\n\nfunction RecordShow({ resource, id, recordId, record, shown }: LoadedRecordProps): ReactElement {\n return (\n <div>\n <RecordRouteHeader resource={resource} action=\"show\" id={id} record={shown} />\n <RecordScreen resource={resource} mode=\"show\" recordId={recordId} record={record} />\n </div>\n );\n}\n\nfunction RecordEdit({ resource, id, recordId, record, shown }: LoadedRecordProps): ReactElement {\n const navigate = useRouteNavigate();\n const mounted = useMountedRef();\n // Where the user came from, by default (`views.edit.returnTo`); the form is no place to come\n // back to, so the destination inherits the trail.\n const back = useReturnTarget(resource, 'edit', id);\n return (\n <div>\n <RecordRouteHeader resource={resource} action=\"edit\" id={id} record={shown} />\n <RecordScreen\n resource={resource}\n mode=\"edit\"\n recordId={recordId}\n record={record}\n onCancel={() => navigate(back, { origin: 'inherit' })}\n onSuccess={() => {\n // The controller has released the unsaved-changes guard before resolving; a save\n // that settles after the user left navigates nowhere.\n if (mounted.current) navigate(back, { origin: 'inherit' });\n }}\n />\n </div>\n );\n}\n\n/** The id a create returned, as the route reads it. */\nfunction createdId(result: unknown): string | undefined {\n const id = (result as { readonly id?: unknown } | null | undefined)?.id;\n return typeof id === 'string' || typeof id === 'number' ? String(id) : undefined;\n}\n\nfunction RecordCreate({ resource, defaults }: RecordCreateProps): ReactElement {\n const app = useApp();\n const navigate = useRouteNavigate();\n const mounted = useMountedRef();\n const adapter = useOptionalRouterAdapter();\n const list = listTarget(resource);\n const back = useReturnTarget(resource, 'create');\n // The accepted type of a typed create comes from the route (decision 24).\n const type = adapter?.searchParams.get('type') ?? undefined;\n return (\n <div>\n <RecordRouteHeader resource={resource} action=\"create\" id=\"\" />\n {/* The route's own screen: its typed create's `?type=` is the URL's (P3-35). */}\n <RouteScreenClaimContext.Provider value={true}>\n <RecordScreen\n resource={resource}\n mode=\"create\"\n {...(type === undefined ? {} : { type })}\n {...(defaults === undefined ? {} : { defaults })}\n onCancel={() => navigate(back, { origin: 'inherit' })}\n onSuccess={(result) => {\n if (!mounted.current) return;\n const id = createdId(result);\n // The new record: its show page, else the list. It roots where the create started.\n navigate(\n id !== undefined && isShowAvailable(app.registry, resource)\n ? showTarget(resource, id)\n : list,\n { origin: 'inherit' },\n );\n }}\n />\n </RouteScreenClaimContext.Provider>\n </div>\n );\n}\n\nfunction RecordRead({\n resource,\n action,\n id,\n recordId,\n}: RecordReadProps & { readonly recordId: RecordId }): ReactElement {\n const app = useApp();\n const def = app.registry.get(resource);\n // The record DTO (decision 41): the same projection the screen's source resolver reads with,\n // so the two share one request.\n const projection = useMemo(\n () => (def === undefined ? undefined : dtoFields(def, 'record')),\n [def],\n );\n const query = useOne(resource, {\n id: recordId,\n retry: retryRecordRead,\n ...(projection === undefined ? {} : { projection }),\n });\n const result = query.data as { readonly data?: unknown } | undefined;\n const read = result?.data;\n // The route row, projected once (P5 spec 3.6): the title, the breadcrumbs and the screen read\n // this and never the row as read. Placeholder data of the previous record never decides.\n const projected = useProjectedRecord(resource, read, { placeholder: query.isPlaceholderData });\n const showAvailability = useAvailabilityResolver(resource, 'show');\n const permissions = useCtx((c: AppContext) => c.permissions);\n // Only a resource with a rule on `show` is re-checked against the row it read.\n const showRuled = addressesCapability(app.ruleSource.rules(resource), 'run', {\n kind: 'action',\n name: 'show',\n });\n // A row the `show` rule does not make available (hidden, absent or disabled) is neither shown\n // nor recorded as a visit.\n const showHidden =\n showRuled &&\n read !== null &&\n typeof read === 'object' &&\n showAvailability('show', read).state !== 'available';\n // The visit waits for the re-check to settle: a loading or failed map, or placeholder data of\n // the previous record, decides nothing yet.\n const showSettled =\n !showRuled ||\n (!query.isPlaceholderData &&\n !permissionsUndecided(permissions) &&\n permissions?.status !== 'error');\n // The visit is recorded from the record this route read, show and edit alike (decision 54).\n useRecordVisit(\n resource,\n projected.status === 'ready' && showSettled && !showHidden ? projected.value : null,\n { isCurrentData: !query.isPlaceholderData },\n );\n const route = useMemo(() => Object.freeze({ id }), [id]);\n const availability = useAvailabilityResolver(resource, 'edit');\n\n if (result !== undefined) {\n const record = result.data;\n if (record === null || typeof record !== 'object') {\n return <RecordState state=\"not-found\" />;\n }\n const loaded = record as LoadedRecord;\n // The route re-checks the row-level `show` rule against the row it read (P5 spec 3.16): a\n // row the rule hides is not-found in place — no navigation, no screen, no `with` reads.\n // Placeholder data of the previous record or an undecided map never decides.\n if (showRuled) {\n if (query.isPlaceholderData || permissionsUndecided(permissions))\n return <RecordState state=\"loading\" />;\n if (permissions?.status === 'error') return <RecordState state=\"not-found\" />;\n if (showHidden) return <RecordState state=\"not-found\" />;\n }\n if (projected.status === 'pending' || projected.value === null)\n return <RecordState state=\"loading\" />;\n const shown = projected.value as LoadedRecord;\n // The edit route of a record whose `edit` a rule hides for this user (or that the resource\n // turned off) is not-found, as the hidden Edit control is absent: typing the URL opens no\n // form. A `disable` fallback keeps the page, read-only, with Save disabled.\n if (action === 'edit') {\n const edit = availability('edit', loaded).state;\n if (edit === 'hidden' || edit === 'absent') {\n return <RecordState state=\"not-found\" />;\n }\n // A rule on `edit` the loading map can still change decides nothing yet: no form mounts\n // (it would be drawn editable, then taken away, or not found).\n if (edit === 'undecided') return <RecordState state=\"loading\" />;\n }\n // The route's own screen: `state: 'url'` placements write the URL only there, and its\n // `route` source holds the URL's id (spec 4.5). The header, the breadcrumbs and the screen\n // read the projected row; the row as read decided `edit` above and nothing else.\n return (\n <RouteSourceContext.Provider value={route}>\n <RouteScreenClaimContext.Provider value={true}>\n {action === 'edit' ? (\n <RecordEdit\n resource={resource}\n id={id}\n recordId={recordId}\n record={loaded}\n shown={shown}\n />\n ) : (\n <RecordShow\n resource={resource}\n id={id}\n recordId={recordId}\n record={loaded}\n shown={shown}\n />\n )}\n </RouteScreenClaimContext.Provider>\n </RouteSourceContext.Provider>\n );\n }\n if (query.error != null) {\n return (\n <LoadError\n surface=\"record\"\n resource={resource}\n error={query.error}\n retry={() => void query.refetch()}\n />\n );\n }\n return <RecordState state=\"loading\" />;\n}\n\nfunction RecordRouteBody(props: RecordRouteProps): ReactElement {\n if (props.action === 'create') return <RecordCreate {...props} />;\n // Not-found without a request: `useOne` is never called for an empty id.\n if (props.id === '') {\n return <RecordState state=\"not-found\" />;\n }\n return <RecordReadRoute {...props} />;\n}\n\n/**\n * The id the URL carries, read as the resource's id field declares it. A text that is no valid id\n * of that type (`/orders/abc` for a numeric id) is not-found without a request.\n */\nfunction RecordReadRoute(props: RecordReadProps): ReactElement {\n const recordId = useRouteRecordId(props.resource, props.id);\n if (recordId === undefined) return <InvalidRouteId resource={props.resource} />;\n return <RecordRead {...props} recordId={recordId} />;\n}\n\n/**\n * A record route for an id the caller already resolved — what\n * `<ResourcePageRouter>` renders for its `show`, `edit` and `create` matches.\n *\n * Keyed by `${resource}:${id}`, so moving from one record to another remounts\n * the page and its form (which seeds its values once, on mount). Without a\n * data runtime it renders the error state instead of throwing: every data hook\n * throws without one, and `BuroProvider.dataRuntime` is optional. In\n * development it also logs a `console.error` naming the missing prop — the\n * user's generic error is a configuration error to the developer.\n */\nexport function RecordRoute(props: RecordRouteProps): ReactElement {\n const runtime = useOptionalDataRuntime();\n const missingRuntime = runtime === null;\n useEffect(() => {\n if (!missingRuntime || process.env.NODE_ENV === 'production') return;\n console.error(\n `[burojs] The '${props.resource}' record page has no data runtime to read or write ` +\n 'with: BuroProvider.dataRuntime is not set. Pass <BuroProvider dataRuntime={…}> ' +\n '(createDataRuntime from @burojs/react); until then record routes render the error state.',\n );\n }, [missingRuntime, props.resource]);\n if (missingRuntime) {\n return <RecordState state=\"error\" />;\n }\n return <RecordRouteBody key={`${props.resource}:${props.id}`} {...props} />;\n}\n\n/** What is wrong with a `<RecordPage>`'s inputs, as a development message, or null. */\nfunction recordPageProblem(input: {\n readonly props: RecordPageProps;\n readonly resource: string | undefined;\n readonly action: ScreenMode | undefined;\n readonly onRecordRoute: boolean;\n}): string | null {\n const { props, resource, action } = input;\n if (resource === undefined || action === undefined) {\n return (\n '[burojs] <RecordPage> needs both `resource` and `action`. Pass them; until then it ' +\n 'renders not-found.'\n );\n }\n if (!input.onRecordRoute) {\n return (\n `[burojs] <RecordPage resource=\"${resource}\" action=\"${action}\"> is not on a record ` +\n 'route (show, edit or create), so it has no record to read: render it on one, under a ' +\n 'RouterAdapterProvider. Until then it renders not-found.'\n );\n }\n if (props.defaults !== undefined && action !== 'create') {\n return `[burojs] <RecordPage defaults> applies to create only; on this '${action}' route it is ignored.`;\n }\n return null;\n}\n\n/**\n * The development messages already logged, per app: each distinct problem is\n * logged once, also under StrictMode, whose double effect run would log it twice.\n */\nconst recordPageProblemsLogged = new WeakMap<object, Set<string>>();\n\n/**\n * The record page — show, edit or create — wired to data. It reads the id\n * and the group chain from the current route match, reads with `useOne`,\n * renders the record through `<RecordScreen>` (which writes with the\n * resource's update or create), navigates after a write (show when the\n * resource has one, else the list), and renders translated loading,\n * not-found, session-expired and error states. It draws no breadcrumb trail:\n * the header's `<HeaderBreadcrumbs>` does, and shows the record's title once\n * this page has loaded it (the id until then). The open panel of a keyed tabs node lives in the URL as `?<tabsKey>=<panelKey>`.\n *\n * `<ResourcePageRouter>` renders the record route itself; a different layout is a frame on the\n * screen (`views.<mode>.frame`), never a replaced route (P6-56).\n */\nexport function RecordPage<const N extends string = string>(\n props: RecordPageProps<N>,\n): ReactElement {\n const app = useApp();\n const match = useMatch();\n const id = match === null ? null : (match.id ?? '');\n const { action } = props;\n const resource = props.resource === undefined ? undefined : routeResourceKey(props.resource);\n const onRecordRoute = recordActionOf(match) !== undefined;\n const problem = recordPageProblem({ props, resource, action, onRecordRoute });\n useEffect(() => {\n if (problem === null || process.env.NODE_ENV === 'production') return;\n let logged = recordPageProblemsLogged.get(app);\n if (logged === undefined) {\n logged = new Set();\n recordPageProblemsLogged.set(app, logged);\n }\n if (logged.has(problem)) return;\n logged.add(problem);\n console.error(problem);\n }, [app, problem]);\n if (resource === undefined || action === undefined || id === null || !onRecordRoute) {\n return <RecordState state=\"not-found\" />;\n }\n const route: RecordTarget =\n action === 'create' ? { resource, action, defaults: props.defaults } : { resource, action };\n return <RecordRoute {...route} id={id} />;\n}\n","'use client';\nimport { type RouteMatch, hasListPage } from '@burojs/core';\nimport { recordRouteAvailable, useApp, useOptionalRouterAdapter, useT } from '@burojs/react';\nimport { Suspense, type ReactElement, useEffect } from 'react';\nimport { PageFlowRouteLoader } from '../flows/page-flow-loader.js';\nimport { ResourceListPage } from '../list-kit/resource-list-page.js';\nimport { PageHost } from './page-host.js';\nimport { RecordRoute } from './record-page.js';\nimport { recordActionOf } from './route-trail.js';\nimport { useNavChromeMounted } from './nav-chrome-mounted.js';\nimport { useLayoutResolver } from './nav-slots.js';\nimport { useMatch } from './use-nav-routing.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nexport interface ResourcePageRouterProps {\n match: RouteMatch;\n}\n\n/** Small \"nothing here\" panel — used for a match this router cannot dispatch. */\nfunction ResourcePageRouterEmpty(): ReactElement {\n const t = useT();\n return (\n <div\n data-testid=\"resource-page-router-empty\"\n className=\"flex flex-col items-center justify-center gap-1 px-6 py-24 text-center\"\n >\n <h2 className=\"text-base font-semibold tracking-tight\">{t('router.emptyTitle')}</h2>\n <p className=\"max-w-sm text-sm text-muted-foreground\">{t('router.emptyBody')}</p>\n </div>\n );\n}\n\n/**\n * Dispatch a resolved `RouteMatch` (from `matchPath`/`useMatch`) to the\n * framework component that renders it. Every branch is data-connected:\n *\n * - `{ kind: 'resource', action: 'list' }` → `<ResourceListPage>`, which\n * self-fetches through `useResourceList`;\n * - `show`, `edit` and `create` → `<RecordRoute>` (the\n * component `<RecordPage>` renders), which reads with `useOne`, writes with\n * `useUpdateOne`/`useCreateOne`, navigates after a write and renders the\n * record states, breadcrumbs and `?tab=`. A record route whose operation\n * the resource turned off (`operations.show: false`, …) renders the\n * not-found panel;\n * - `{ kind: 'group-index' }` → the group's index page when it has a\n * `body`, else that target's list when it is a resource;\n * - `custom-page` → the page's `body` behind the nav gate (`<PageHost>`: a\n * page whose `visible` or whose group's `visible` rejects it renders\n * not-found and mounts nothing); a page without `body` renders not-found,\n * because the host owns that route.\n *\n * A record route always renders the framework's record page: a different layout is a frame on\n * the screen (`views.<mode>.frame`), never a replaced route (P6-56).\n */\nexport function ResourcePageRouter({ match }: ResourcePageRouterProps): ReactElement {\n const app = useApp();\n const qualifiedMatch = match as RouteMatch & {\n readonly ref?: Readonly<{ namespace: string; id: string }>;\n readonly targetRef?: Readonly<{ namespace: string; id: string }>;\n };\n const resource = canonicalNavKey(qualifiedMatch);\n const target = canonicalNavKey({\n name: match.target ?? match.name,\n ref: qualifiedMatch.targetRef,\n });\n const recordAction = recordActionOf(match);\n\n switch (match.kind) {\n case 'resource': {\n if (match.action === 'list') {\n // `views.list.page: false` removes the list route (decision 50).\n const def = app.registry.get(resource);\n return def !== undefined && !hasListPage(def) ? (\n <NavAreaNotFound />\n ) : (\n <ResourceListPage resource={resource} />\n );\n }\n // A page-hosted flow's route (P6): it answers its own gate, in order, behind its chunk.\n if (match.action === 'flow') return <PageFlowRouteLoader match={match} />;\n if (recordAction === undefined) return <ResourcePageRouterEmpty />;\n // Record routes are gated by `operations` and `views.show.page` through\n // `recordRouteAvailable`: a route for an operation the resource turned off, or of a\n // resource without record pages, matches and renders nothing but not-found.\n if (!recordRouteAvailable(app.registry, resource, recordAction)) {\n return <NavAreaNotFound />;\n }\n return <RecordRoute resource={resource} action={recordAction} id={match.id ?? ''} />;\n }\n case 'custom-page': {\n const page = app.registry.customPages.get(resource);\n if (page === undefined) return <ResourcePageRouterEmpty />;\n // A page without a body is a nav entry over a route the host owns.\n if (!page.body?.length) return <NavAreaNotFound />;\n return <PageHost key={resource} page={page} match={match} notFound={<NavAreaNotFound />} />;\n }\n case 'group-index': {\n const indexPage = app.registry.customPages.get(target);\n if (indexPage?.body?.length)\n return (\n <PageHost key={target} page={indexPage} match={match} notFound={<NavAreaNotFound />} />\n );\n // First-descendant fallback: when the group's index target is itself a\n // registered resource (not a page), render its list — a group with no\n // custom landing page still lands somewhere useful.\n const targetDef = app.registry.get(target);\n if (targetDef !== undefined)\n return hasListPage(targetDef) ? (\n <ResourceListPage resource={target} />\n ) : (\n <NavAreaNotFound />\n );\n return <ResourcePageRouterEmpty />;\n }\n default:\n return <ResourcePageRouterEmpty />;\n }\n}\n\nfunction NavAreaPageSkeleton(): ReactElement {\n return (\n <div\n className=\"space-y-3 p-6\"\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n data-testid=\"nav-area-skeleton\"\n >\n <span className=\"sr-only\">Loading…</span>\n <div className=\"h-6 w-48 animate-pulse rounded bg-muted/60\" />\n <div className=\"h-4 w-full animate-pulse rounded bg-muted/40\" />\n <div className=\"h-4 w-5/6 animate-pulse rounded bg-muted/40\" />\n <div className=\"h-4 w-2/3 animate-pulse rounded bg-muted/40\" />\n </div>\n );\n}\n\n/**\n * The framework's 404 panel, inside the shell: a route that names nothing the app declares. Exported\n * so an app's own catch-all route can draw the same panel (`data-testid=\"nav-area-not-found\"`).\n */\nexport function NavAreaNotFound(): ReactElement {\n const t = useT();\n return (\n <div\n data-testid=\"nav-area-not-found\"\n className=\"flex flex-col items-center justify-center gap-1 px-6 py-24 text-center\"\n >\n <h2 className=\"text-base font-semibold tracking-tight\">{t('router.notFoundTitle')}</h2>\n <p className=\"max-w-sm text-sm text-muted-foreground\">{t('router.notFoundBody')}</p>\n </div>\n );\n}\n\n/**\n * The apps that have already been told about a missing router adapter. Keyed\n * by the app a `BuroProvider` serves, so the notice is once per app rather than\n * per provider or per mount (StrictMode runs the effect twice).\n */\nconst adapterNoticeGiven = new WeakSet<object>();\n\n/** The apps already told that `<NavAreaPage>` runs inside a chrome-drawing group with no `<NavChrome>`. */\nconst chromeNoticeGiven = new WeakSet<object>();\n\n/**\n * The page a host mounts: resolves the active route (`useMatch`, from the\n * router adapter) and dispatches to the right framework component via\n * `ResourcePageRouter`. Content only — the group-chain chrome (`NavChrome`)\n * lives in the persistent layout around it (`AppShell` mounts it), so it\n * survives navigation while this page remounts. No match → a not-found panel;\n * no router adapter at all → the same panel, and in development one\n * `console.error` naming `RouterAdapterProvider` (once per app), because\n * then EVERY route is not-found. Wrapped in a `Suspense` boundary so a\n * lazily-loaded custom page (`React.lazy`) degrades to a skeleton inside the\n * chrome.\n */\nexport function NavAreaPage(): ReactElement {\n const match = useMatch();\n const app = useApp();\n const noAdapter = useOptionalRouterAdapter() === null;\n const chromeMounted = useNavChromeMounted();\n const resolveLayout = useLayoutResolver();\n // First group in the chain whose layout draws area chrome (null when none).\n const chromeGroup = match?.groupChain.find((g) => resolveLayout(g.layout)) ?? null;\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n if (chromeMounted || !chromeGroup || chromeNoticeGiven.has(app)) return;\n chromeNoticeGiven.add(app);\n console.error(\n `[burojs] <NavAreaPage> is inside the nav group \"${canonicalNavKey(chromeGroup)}\" whose layout \"${chromeGroup.layout}\" draws area chrome, and no <NavChrome> is mounted above it. ` +\n '<AppShell> mounts one by default; with your own frame, wrap your routes in <NavChrome>.',\n );\n }, [app, chromeMounted, chromeGroup]);\n useEffect(() => {\n if (!noAdapter || process.env.NODE_ENV === 'production') return;\n if (adapterNoticeGiven.has(app)) return;\n adapterNoticeGiven.add(app);\n console.error(\n '[burojs] <NavAreaPage> has no location to match: no RouterAdapterProvider is mounted. ' +\n 'Mount your router’s adapter (RouterAdapterProvider from @burojs/react) above ' +\n '<BuroProvider>; until then every route renders not-found.',\n );\n }, [app, noAdapter]);\n return (\n <Suspense fallback={<NavAreaPageSkeleton />}>\n {match ? <ResourcePageRouter match={match} /> : <NavAreaNotFound />}\n </Suspense>\n );\n}\n"],"mappings":";;;;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AAD,EAA2B,MAAQ,CAAA,KAAI,GAAA,kBAAA,IAAA,CAAC,iBAAD,CAAkB,CAAA;CAC1D,CAAA;AAEd"}
@@ -1,3 +1,4 @@
1
+ let _burojs_core = require("@burojs/core");
1
2
  let _burojs_react = require("@burojs/react");
2
3
  let react = require("react");
3
4
  //#region src/forms/success-notices.ts
@@ -29,7 +30,7 @@ function useNoticeSink(resource) {
29
30
  }, {
30
31
  has: current.has,
31
32
  t: current.t,
32
- ...name === void 0 || typeof head !== "string" ? {} : { fieldKey: `resources.${name}.fields.${head}` }
33
+ ...name === void 0 || typeof head !== "string" ? {} : { fieldKey: `resources.${name}.${(0, _burojs_core.propertyTextKey)(issue.path)}` }
33
34
  })
34
35
  });
35
36
  }
@@ -43,4 +44,4 @@ Object.defineProperty(exports, "useNoticeSink", {
43
44
  }
44
45
  });
45
46
 
46
- //# sourceMappingURL=success-notices-Dl3M1fZP.cjs.map
47
+ //# sourceMappingURL=success-notices-Cl4b6MLQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success-notices-Cl4b6MLQ.cjs","names":["useI18nCaps","useDispatcherEffects","useRef","useCallback","resolveValidationMessage","propertyTextKey"],"sources":["../src/forms/success-notices.ts"],"sourcesContent":["import { type DispatcherEffects, propertyTextKey, type ValidationIssue } from '@burojs/core';\nimport { resolveValidationMessage, useDispatcherEffects, useI18nCaps } from '@burojs/react';\nimport { useCallback, useRef } from 'react';\n\n/**\n * Shows success notices through the dispatcher's `notify`, one per issue. The sink takes plain\n * text, so each message is resolved when it is shown, in the language active at that moment.\n */\nexport function useNoticeSink(\n resource: string | undefined,\n): (notices: readonly ValidationIssue[]) => void {\n const caps = useI18nCaps(resource);\n const effects = useDispatcherEffects();\n const latest = useRef({ caps, effects, resource });\n latest.current = { caps, effects, resource };\n return useCallback((notices) => {\n const { caps: current, effects: read, resource: name } = latest.current;\n const notify: DispatcherEffects['notify'] = read().notify;\n if (notify === undefined) return;\n for (const issue of notices) {\n const head = issue.path[0];\n const message = resolveValidationMessage(\n {\n code: issue.code,\n message: issue.message,\n ...(issue.check === undefined ? {} : { check: issue.check }),\n },\n {\n has: current.has,\n t: current.t,\n ...(name === undefined || typeof head !== 'string'\n ? {}\n : { fieldKey: `resources.${name}.${propertyTextKey(issue.path)}` }),\n },\n );\n notify({ type: 'info', message });\n }\n }, []);\n}\n"],"mappings":";;;;AAQA,SAAgB,cACd,UAC+C;CAC/C,MAAM,QAAA,GAAOA,cAAAA,YAAAA,CAAY,QAAQ;CACjC,MAAM,WAAA,GAAUC,cAAAA,qBAAAA,CAAqB;CACrC,MAAM,UAAA,GAASC,MAAAA,OAAAA,CAAO;EAAE;EAAM;EAAS;CAAS,CAAC;CACjD,OAAO,UAAU;EAAE;EAAM;EAAS;CAAS;CAC3C,QAAA,GAAOC,MAAAA,YAAAA,EAAa,YAAY;EAC9B,MAAM,EAAE,MAAM,SAAS,SAAS,MAAM,UAAU,SAAS,OAAO;EAChE,MAAM,SAAsC,KAAK,CAAC,CAAC;EACnD,IAAI,WAAW,KAAA,GAAW;EAC1B,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,OAAO,MAAM,KAAK;GAexB,OAAO;IAAE,MAAM;IAAQ,UAAA,GAdPC,cAAAA,yBAAAA,CACd;KACE,MAAM,MAAM;KACZ,SAAS,MAAM;KACf,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;IAC5D,GACA;KACE,KAAK,QAAQ;KACb,GAAG,QAAQ;KACX,GAAI,SAAS,KAAA,KAAa,OAAO,SAAS,WACtC,CAAC,IACD,EAAE,UAAU,aAAa,KAAK,IAAA,GAAGC,aAAAA,gBAAAA,CAAgB,MAAM,IAAI,IAAI;IACrE,CAE2B;GAAE,CAAC;EAClC;CACF,GAAG,CAAC,CAAC;AACP"}
@@ -1,3 +1,4 @@
1
+ import { propertyTextKey } from "@burojs/core";
1
2
  import { resolveValidationMessage, useDispatcherEffects, useI18nCaps } from "@burojs/react";
2
3
  import { useCallback, useRef } from "react";
3
4
  //#region src/forms/success-notices.ts
@@ -29,7 +30,7 @@ function useNoticeSink(resource) {
29
30
  }, {
30
31
  has: current.has,
31
32
  t: current.t,
32
- ...name === void 0 || typeof head !== "string" ? {} : { fieldKey: `resources.${name}.fields.${head}` }
33
+ ...name === void 0 || typeof head !== "string" ? {} : { fieldKey: `resources.${name}.${propertyTextKey(issue.path)}` }
33
34
  })
34
35
  });
35
36
  }
@@ -38,4 +39,4 @@ function useNoticeSink(resource) {
38
39
  //#endregion
39
40
  export { useNoticeSink as t };
40
41
 
41
- //# sourceMappingURL=success-notices-LDEgEkc4.js.map
42
+ //# sourceMappingURL=success-notices-CrcWOGSo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success-notices-CrcWOGSo.js","names":[],"sources":["../src/forms/success-notices.ts"],"sourcesContent":["import { type DispatcherEffects, propertyTextKey, type ValidationIssue } from '@burojs/core';\nimport { resolveValidationMessage, useDispatcherEffects, useI18nCaps } from '@burojs/react';\nimport { useCallback, useRef } from 'react';\n\n/**\n * Shows success notices through the dispatcher's `notify`, one per issue. The sink takes plain\n * text, so each message is resolved when it is shown, in the language active at that moment.\n */\nexport function useNoticeSink(\n resource: string | undefined,\n): (notices: readonly ValidationIssue[]) => void {\n const caps = useI18nCaps(resource);\n const effects = useDispatcherEffects();\n const latest = useRef({ caps, effects, resource });\n latest.current = { caps, effects, resource };\n return useCallback((notices) => {\n const { caps: current, effects: read, resource: name } = latest.current;\n const notify: DispatcherEffects['notify'] = read().notify;\n if (notify === undefined) return;\n for (const issue of notices) {\n const head = issue.path[0];\n const message = resolveValidationMessage(\n {\n code: issue.code,\n message: issue.message,\n ...(issue.check === undefined ? {} : { check: issue.check }),\n },\n {\n has: current.has,\n t: current.t,\n ...(name === undefined || typeof head !== 'string'\n ? {}\n : { fieldKey: `resources.${name}.${propertyTextKey(issue.path)}` }),\n },\n );\n notify({ type: 'info', message });\n }\n }, []);\n}\n"],"mappings":";;;;AAQA,SAAgB,cACd,UAC+C;CAC/C,MAAM,OAAO,YAAY,QAAQ;CACjC,MAAM,UAAU,qBAAqB;CACrC,MAAM,SAAS,OAAO;EAAE;EAAM;EAAS;CAAS,CAAC;CACjD,OAAO,UAAU;EAAE;EAAM;EAAS;CAAS;CAC3C,OAAO,aAAa,YAAY;EAC9B,MAAM,EAAE,MAAM,SAAS,SAAS,MAAM,UAAU,SAAS,OAAO;EAChE,MAAM,SAAsC,KAAK,CAAC,CAAC;EACnD,IAAI,WAAW,KAAA,GAAW;EAC1B,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,OAAO,MAAM,KAAK;GAexB,OAAO;IAAE,MAAM;IAAQ,SAdP,yBACd;KACE,MAAM,MAAM;KACZ,SAAS,MAAM;KACf,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;IAC5D,GACA;KACE,KAAK,QAAQ;KACb,GAAG,QAAQ;KACX,GAAI,SAAS,KAAA,KAAa,OAAO,SAAS,WACtC,CAAC,IACD,EAAE,UAAU,aAAa,KAAK,GAAG,gBAAgB,MAAM,IAAI,IAAI;IACrE,CAE2B;GAAE,CAAC;EAClC;CACF,GAAG,CAAC,CAAC;AACP"}