@rebasepro/cms 0.33.1 → 0.34.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 (52) hide show
  1. package/dist/components/BrandLogo.d.ts +16 -0
  2. package/dist/components/BrandLogo.js +34 -0
  3. package/dist/components/BrandLogo.js.map +1 -0
  4. package/dist/components/CollectionViewBinding/BoardCardBinding.js +3 -3
  5. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
  6. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +2 -2
  7. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
  8. package/dist/components/CollectionViewBinding/EntityCardBinding.js +3 -3
  9. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
  10. package/dist/components/CollectionViewBinding/SlotValue.js +2 -2
  11. package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -1
  12. package/dist/components/DefaultAppBar.d.ts +3 -1
  13. package/dist/components/DefaultAppBar.js +11 -6
  14. package/dist/components/DefaultAppBar.js.map +1 -1
  15. package/dist/components/DefaultDrawer.d.ts +5 -2
  16. package/dist/components/DefaultDrawer.js +9 -6
  17. package/dist/components/DefaultDrawer.js.map +1 -1
  18. package/dist/components/EntityIdentityBar.js +1 -1
  19. package/dist/components/EntityIdentityBar.js.map +1 -1
  20. package/dist/components/PropertyKeyHint.js +1 -1
  21. package/dist/components/PropertyKeyHint.js.map +1 -1
  22. package/dist/components/RebaseAuthGate.d.ts +5 -1
  23. package/dist/components/RebaseAuthGate.js +6 -2
  24. package/dist/components/RebaseAuthGate.js.map +1 -1
  25. package/dist/components/RebaseLayout.d.ts +2 -0
  26. package/dist/components/RebaseLayout.js +4 -2
  27. package/dist/components/RebaseLayout.js.map +1 -1
  28. package/dist/components/RebaseShell.d.ts +6 -1
  29. package/dist/components/RebaseShell.js +21 -16
  30. package/dist/components/RebaseShell.js.map +1 -1
  31. package/dist/components/RelationSelector.js +1 -1
  32. package/dist/components/RelationSelector.js.map +1 -1
  33. package/dist/components/app/Drawer.d.ts +2 -1
  34. package/dist/components/app/Drawer.js +2 -1
  35. package/dist/components/app/Drawer.js.map +1 -1
  36. package/dist/components/app/Scaffold.d.ts +5 -0
  37. package/dist/components/app/Scaffold.js +5 -3
  38. package/dist/components/app/Scaffold.js.map +1 -1
  39. package/dist/components/app/useApp.d.ts +1 -0
  40. package/dist/components/app/useApp.js.map +1 -1
  41. package/dist/editor/components/SlashCommandMenu.js +1 -1
  42. package/dist/editor/components/SlashCommandMenu.js.map +1 -1
  43. package/dist/editor/selectors/link-selector.js +1 -1
  44. package/dist/editor/selectors/link-selector.js.map +1 -1
  45. package/dist/editor/selectors/text-buttons.js +1 -1
  46. package/dist/editor/selectors/text-buttons.js.map +1 -1
  47. package/dist/form/field_bindings/VectorFieldBinding.js +1 -1
  48. package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
  49. package/dist/hooks/navigation/compose_collections.d.ts +3 -2
  50. package/dist/hooks/navigation/compose_collections.js +27 -3
  51. package/dist/hooks/navigation/compose_collections.js.map +1 -1
  52. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"EntityIdentityBar.js","names":[],"sources":["../../src/components/EntityIdentityBar.tsx"],"sourcesContent":["import type { AdminCollection } from \"@rebasepro/cms-types\";\nimport type { EntityStatus } from \"@rebasepro/types\";\nimport React, { useLayoutEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { Link } from \"react-router\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport {\n Button,\n CheckIcon,\n CircularProgress,\n ChevronDownIcon,\n cls,\n CodeIcon,\n CopyIcon,\n ExternalLinkIcon,\n HistoryIcon,\n IconButton,\n iconSize,\n LoadingButton,\n ArrowLeftIcon,\n Menu,\n MenuItem,\n MoreVerticalIcon,\n Separator,\n Tooltip,\n Typography,\n XIcon\n} from \"@rebasepro/ui\";\nimport type { PlacedEntityActions } from \"../util/entity_actions\";\nimport { fitInlineActions, type InlineActionsFit } from \"../util/fit_inline_actions\";\nimport { ActionMenuLabel } from \"./common/ActionMenuLabel\";\n\n/**\n * One of the record's own actions, resolved and ready to run — what the bar\n * needs to draw it as a button or as a menu item.\n */\nexport interface RecordActionItem {\n key: string;\n name: string;\n icon?: React.ReactNode;\n enabled: boolean;\n /** Why it is disabled, when it is and its action says. */\n disabledReason?: string;\n /**\n * Runs the action, reporting its own failure. Returns a promise only when\n * the action is asynchronous, which is what keeps a button's spinner up.\n */\n run: () => Promise<void> | undefined;\n}\n\nexport interface EntityIdentityBarProps {\n /** Plural collection name, shown as the breadcrumb ahead of the title. */\n collection: AdminCollection;\n /**\n * Where the breadcrumb points. Without it the collection name is inert text\n * that still reads as a breadcrumb — worse than no breadcrumb at all, and\n * the only way back once a layout drops its back arrow.\n *\n * Left unset by the overlays (side panel, dialog), where the collection is\n * already underneath and navigating would dismiss the record instead.\n */\n collectionUrl?: string;\n /** Resolved record title, already guarded against showing a field default. */\n title: string;\n entityId?: string | number;\n status: EntityStatus;\n\n dirty: boolean;\n saving: boolean;\n /** Undefined hides the Save button — read-only views, or a custom form. */\n onSave?: () => void;\n onDiscard?: () => void;\n saveDisabled?: boolean;\n hasErrors?: boolean;\n\n /**\n * Save and dismiss, for the side panel and the dialog where the dominant\n * action is \"done with this record\" rather than \"keep editing\".\n */\n onSaveAndClose?: () => void;\n\n /**\n * Where {@link onSaveAndClose} is offered.\n *\n * `\"button\"` — its own filled button, and Save demotes to text. For the\n * overlays, where you opened the record to do one thing to it and closing is\n * the dominant intent.\n *\n * `\"menu\"` — a `▾` welded to the Save button. For the split, where the list\n * is right there and `j`/`k` walk from record to record: there, saving and\n * *staying* is the common case, so it keeps the filled button and dismissing\n * is one step further in. The gesture still exists, so muscle memory carried\n * over from the side panel finds it.\n */\n saveAndClosePlacement?: \"button\" | \"menu\";\n\n /**\n * Dismiss this record, from the ✕ at the bar's trailing edge.\n *\n * Fenced off from Save by a separator: it is chrome, not the last item in\n * the action row. The panel that supplies it decides what dismissing means —\n * in the split it is a navigation, which the layout's unsaved-changes\n * blocker already guards, so the ✕ cannot drop an edit without asking.\n */\n onClose?: () => void;\n\n onBack?: () => void;\n onInspect?: () => void;\n /** Opens the inspector straight on its history tab. */\n onViewHistory?: () => void;\n\n /**\n * Where this record appears on the live site, from `entityLinkBuilder`.\n *\n * Here rather than above the record, where it used to be a single unlabelled\n * icon alone on its own right-aligned row — the only thing between the bar\n * and the first field, and the only control in the view that did not say\n * what it was. It is a thing you do *to* a record, so it belongs with the\n * others.\n */\n externalLink?: string;\n\n /**\n * Actions performed *on* the record — copy, delete, whatever the collection\n * adds — already placed: `inline` ones are buttons ahead of Save, folding\n * into the overflow menu when the bar runs short of room, and the rest are\n * menu groups. They live here rather than in a footer, which is what let\n * the footer go away entirely.\n */\n recordActions?: PlacedEntityActions<RecordActionItem>;\n\n /**\n * The read-only view's Edit: its main button, drawn where Save stands on\n * the edit view — after the record's own buttons, ahead of the menu.\n */\n primaryAction?: React.ReactNode;\n\n /** Plugin-contributed actions, rendered inline before Save. */\n pluginActions?: React.ReactNode;\n\n /** Close / full-screen buttons supplied by the panel that owns this view. */\n trailing?: React.ReactNode;\n\n /**\n * Controls the owning panel puts at the bar's leading edge, ahead of the\n * breadcrumb — where the side panel's close button lives.\n */\n leading?: React.ReactNode;\n}\n\n/**\n * The persistent header of an entity view: who this record is, and what you can\n * do to it.\n *\n * The title and the id used to live inside the scrolling form, above 72px of\n * empty space — 219px of chrome that carried nothing and scrolled away the\n * moment you touched the wheel, leaving no indication of which record you were\n * editing. They live here instead, and the left half of a bar that was\n * previously empty now does the work.\n */\nexport function EntityIdentityBar({\n collection,\n collectionUrl,\n title,\n entityId,\n status,\n dirty,\n saving,\n onSave,\n onDiscard,\n saveDisabled,\n hasErrors,\n onSaveAndClose,\n saveAndClosePlacement = \"button\",\n onClose,\n onBack,\n onInspect,\n onViewHistory,\n externalLink,\n recordActions,\n primaryAction,\n pluginActions,\n trailing,\n leading\n}: EntityIdentityBarProps) {\n\n const { t } = useTranslation();\n\n const inline = recordActions?.inline ?? NO_ACTIONS;\n const inlineRef = useRef<HTMLDivElement>(null);\n const labelledRef = useRef<HTMLDivElement>(null);\n const compactRef = useRef<HTMLDivElement>(null);\n const fit = useInlineActionsFit(inlineRef, labelledRef, compactRef, inline);\n\n // What did not fit leads the menu, ahead of the actions that were always\n // there: it is what the developer ranked highest.\n const ownActions = [...inline.slice(fit.count), ...(recordActions?.own ?? NO_ACTIONS)];\n const genericActions = recordActions?.generic ?? NO_ACTIONS;\n const destructiveActions = recordActions?.destructive ?? NO_ACTIONS;\n const hasUtilities = genericActions.length > 0 || Boolean(externalLink) || Boolean(onViewHistory) || Boolean(onInspect);\n const menuGroups = [ownActions.length > 0, hasUtilities, destructiveActions.length > 0];\n const hasMenu = menuGroups.some(Boolean);\n // A rule between two groups that are both there, never at an edge.\n const ruleBefore = (group: number) => menuGroups[group] && menuGroups.slice(0, group).some(Boolean);\n\n return (\n <div className={cls(\n // No line under it: the bar and the tab strip below are one band on\n // the sheet, and the strip already carries the edge the folder tab\n // sits on. Regions meet with a step, not a rule.\n \"h-[52px] shrink-0 flex items-center gap-2 pl-1.5 pr-2\",\n \"bg-surface-sheet\"\n )}>\n {leading}\n\n {onBack && (\n <Tooltip title={t(\"back\")}>\n <IconButton size={\"small\"} onClick={onBack} aria-label={t(\"back\")}>\n <ArrowLeftIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n )}\n\n {collectionUrl\n ? <Link to={collectionUrl}\n className={\"visited:text-inherit dark:visited:text-inherit hidden sm:block\"}>\n <Typography variant={\"caption\"}\n className={cls(\n \"text-text-disabled dark:text-text-disabled-dark whitespace-nowrap\",\n \"hover:text-text-primary dark:hover:text-text-primary-dark transition-colors\"\n )}>\n {collection.name}&nbsp;/\n </Typography>\n </Link>\n : <Typography variant={\"caption\"}\n className={\"text-text-disabled dark:text-text-disabled-dark whitespace-nowrap hidden sm:block\"}>\n {collection.name}&nbsp;/\n </Typography>}\n\n <span className={cls(\n \"font-headers font-semibold text-[15px] tracking-tight truncate min-w-0\",\n // The title takes the room it needs and the actions get what is\n // left, so a long one would fold every action away. Capped, it\n // truncates first — only where there are actions to make room for.\n inline.length > 0 && \"max-w-[40%]\"\n )}\n title={title}>\n {title}\n </span>\n\n {entityId !== undefined && <IdChip value={String(entityId)}/>}\n\n {/* The bar's free space, and the actions that fit in it. Always\n rendered: it is the spacer, and the observer measures it. */}\n <div ref={inlineRef}\n className={\"flex-1 min-w-0 flex items-center justify-end gap-1\"}>\n {inline.slice(0, fit.count).map(action =>\n <RecordActionButton key={action.key} action={action} compact={fit.compact}/>)}\n {inline.length > 0 && (\n // Every action in both of its forms, laid out at its natural\n // width and never seen, so a fit can be decided without\n // first drawing the bar wrong. A zero-size clipping box: it\n // takes no room and cannot widen anything it sits in.\n <div aria-hidden={true}\n className={\"absolute w-0 h-0 overflow-hidden invisible pointer-events-none\"}>\n <div ref={labelledRef} className={\"flex w-max\"}>\n {inline.map(action =>\n <RecordActionButton key={action.key} action={action} compact={false}/>)}\n </div>\n <div ref={compactRef} className={\"flex w-max\"}>\n {inline.map(action =>\n <RecordActionButton key={action.key} action={action} compact={true}/>)}\n </div>\n </div>\n )}\n </div>\n\n {pluginActions}\n\n <EntitySaveActions status={status}\n dirty={dirty}\n saving={saving}\n onSave={onSave}\n onDiscard={onDiscard}\n saveDisabled={saveDisabled}\n hasErrors={hasErrors}\n onSaveAndClose={onSaveAndClose}\n saveAndClosePlacement={saveAndClosePlacement}/>\n\n {primaryAction}\n\n {hasMenu && (\n <Menu align={\"end\"}\n trigger={\n <IconButton size={\"small\"} aria-label={t(\"more_actions\") ?? \"More actions\"}>\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }>\n {/* The collection's own operations first — the reason\n someone opened this record — then the ones every record\n has, then Delete, last and apart. */}\n {ownActions.map(action => <RecordActionMenuItem key={action.key} action={action}/>)}\n {ruleBefore(1) && <Separator orientation={\"horizontal\"}/>}\n {genericActions.map(action => <RecordActionMenuItem key={action.key} action={action}/>)}\n {externalLink && (\n <MenuItem onClick={() => window.open(externalLink, \"_blank\", \"noopener,noreferrer\")}>\n <ExternalLinkIcon size={iconSize.smallest}/>\n {t(\"open_in_live_site\") ?? \"Open in the live site\"}\n </MenuItem>\n )}\n {onViewHistory && (\n <MenuItem onClick={onViewHistory}>\n <HistoryIcon size={iconSize.smallest}/>\n {t(\"record_history\") ?? \"History\"}\n </MenuItem>\n )}\n {onInspect && (\n <MenuItem onClick={onInspect}>\n <CodeIcon size={iconSize.smallest}/>\n {t(\"inspect_record\") ?? \"Inspect record\"}\n </MenuItem>\n )}\n {ruleBefore(2) && <Separator orientation={\"horizontal\"}/>}\n {destructiveActions.map(action => <RecordActionMenuItem key={action.key} action={action}/>)}\n </Menu>\n )}\n\n {trailing}\n\n {/* Last, and set apart by space rather than a rule. A ✕ flush against\n Save reads as the next item in the action row, and the two\n adjacent controls are then \"commit this edit\" and \"abandon it\";\n the vertical separator that used to fence it off was the one\n line on the bar, and a line marks an object, not a gap. */}\n {onClose && (\n <Tooltip title={`${t(\"close\")} · Esc`}>\n <IconButton size={\"small\"} onClick={onClose} aria-label={t(\"close\")} className={\"ml-2\"}>\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n}\n\nconst NO_ACTIONS: RecordActionItem[] = [];\n\n/** `gap-1`, between the inline actions. */\nconst INLINE_ACTIONS_GAP = 4;\n\n/**\n * Which of the inline actions fit in the bar's free space, and whether they\n * keep their labels — decided from the measuring copies before the bar is\n * painted, and again whenever the space or the buttons change size: a resize,\n * Discard appearing beside Save, a web font arriving, a language switch.\n */\nfunction useInlineActionsFit(\n containerRef: React.RefObject<HTMLDivElement | null>,\n labelledRef: React.RefObject<HTMLDivElement | null>,\n compactRef: React.RefObject<HTMLDivElement | null>,\n actions: RecordActionItem[]\n): InlineActionsFit {\n\n const [fit, setFit] = useState<InlineActionsFit>({ count: actions.length, compact: false });\n const actionKeys = actions.map(action => action.key).join(\"\\u0000\");\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n const labelled = labelledRef.current;\n const compact = compactRef.current;\n if (!container || !labelled || !compact) {\n setFit(previous => previous.count === 0 && !previous.compact ? previous : { count: 0, compact: false });\n return;\n }\n const widths = (row: HTMLElement) =>\n Array.from(row.children).map(child => child.getBoundingClientRect().width);\n const measure = () => {\n const next = fitInlineActions(container.clientWidth, widths(labelled), widths(compact), INLINE_ACTIONS_GAP);\n setFit(previous => previous.count === next.count && previous.compact === next.compact ? previous : next);\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n // Synchronously: the observer reports after layout and before paint,\n // and an ordinary update would render after that paint — one frame\n // with the old buttons drawn over the title whenever Discard appeared.\n const observer = new ResizeObserver(() => flushSync(measure));\n observer.observe(container);\n observer.observe(labelled);\n observer.observe(compact);\n return () => observer.disconnect();\n }, [containerRef, labelledRef, compactRef, actionKeys]);\n\n return fit;\n}\n\n/**\n * An action promoted out of the menu: a text button with its icon, as the\n * collection toolbar draws Filter and Sort, or the icon alone with its name in\n * a tooltip where the bar is short of room. It shows a spinner while the work\n * it started is running, and cannot be pressed twice meanwhile. Disabled, its\n * tooltip says why, where the action gives a reason.\n */\nfunction RecordActionButton({ action, compact }: { action: RecordActionItem, compact: boolean }) {\n\n const [running, setRunning] = useState(false);\n const reason = action.enabled ? undefined : action.disabledReason;\n\n const onClick = () => {\n const pending = action.run();\n if (!pending) return;\n setRunning(true);\n pending.finally(() => setRunning(false));\n };\n\n if (compact && action.icon) {\n return (\n <Tooltip title={reason ? `${action.name}: ${reason}` : action.name}>\n <IconButton size={\"small\"}\n aria-label={action.name}\n disabled={!action.enabled || running}\n onClick={onClick}>\n {running ? <CircularProgress size={\"smallest\"}/> : action.icon}\n </IconButton>\n </Tooltip>\n );\n }\n\n // The tooltip's wrapper takes the hover: a disabled button receives no\n // pointer events of its own, so the button lets them through to it.\n return (\n <Tooltip title={reason}>\n <LoadingButton variant={\"text\"}\n size={\"small\"}\n startIcon={action.icon}\n loading={running}\n disabled={!action.enabled}\n className={reason ? \"pointer-events-none\" : undefined}\n onClick={onClick}>\n {action.name}\n </LoadingButton>\n </Tooltip>\n );\n}\n\nfunction RecordActionMenuItem({ action }: { action: RecordActionItem }) {\n return (\n <MenuItem disabled={!action.enabled} onClick={() => void action.run()}>\n {action.icon}\n <ActionMenuLabel name={action.name} disabledReason={action.enabled ? undefined : action.disabledReason}/>\n </MenuItem>\n );\n}\n\nexport type EntitySaveActionsProps = Pick<EntityIdentityBarProps,\n \"status\" | \"dirty\" | \"saving\" | \"onSave\" | \"onDiscard\" | \"saveDisabled\" | \"hasErrors\"\n | \"onSaveAndClose\" | \"saveAndClosePlacement\">;\n\n/**\n * Save, \"save and close\", Discard, and the words saying where the edit stands.\n *\n * Its own component because it has two homes. On a page and in the side panel\n * it sits in the identity bar, where it stays in view while the form scrolls. In\n * the dialog it sits in a footer under the form: a dialog is read top to bottom\n * and finished at the bottom, where every other dialog in the app keeps its\n * buttons, and the bar at its top is left to say what the record is.\n */\nexport function EntitySaveActions({\n status,\n dirty,\n saving,\n onSave,\n onDiscard,\n saveDisabled,\n hasErrors,\n onSaveAndClose,\n saveAndClosePlacement = \"button\"\n}: EntitySaveActionsProps) {\n\n const { t } = useTranslation();\n\n const saveLabel = status === \"existing\"\n ? t(\"save\")\n : status === \"copy\" ? t(\"create_copy\") : t(\"create\");\n const closeLabel = status === \"existing\"\n ? t(\"save_and_close\")\n : status === \"copy\" ? t(\"create_copy_and_close\") : t(\"create_and_close\");\n\n // The two shapes \"save and close\" takes, so the Save button next to it knows\n // whether it is still the primary action.\n const saveAndCloseButton = Boolean(onSaveAndClose) && saveAndClosePlacement === \"button\";\n const saveAndCloseMenu = Boolean(onSaveAndClose) && saveAndClosePlacement === \"menu\";\n\n const saveTooltip = hasErrors\n ? (t(\"fix_errors_before_saving\") ?? \"Fix highlighted errors before saving\")\n : undefined;\n\n return <>\n {/* Only where there is something to save. The read-only detail\n view has no Save button, and reporting \"Saved\" there implies an\n editing session the user never started. */}\n {onSave && <SaveState dirty={dirty} saving={saving} status={status} t={t}/>}\n\n {onDiscard && dirty && !saving && (\n <Button variant={\"text\"} size={\"small\"} onClick={onDiscard}>\n {status === \"existing\" ? t(\"discard\") : t(\"clear\")}\n </Button>\n )}\n\n {onSave && (\n // `rounded-lg overflow-hidden`: the two halves of the split\n // button are square inside and the group carries the radius, so\n // there is one control with a seam rather than two buttons that\n // happen to touch. Their borders match their own fill, so the\n // seam has to be drawn — see the `▾` half for where and in what.\n <div className={\"flex items-stretch rounded-lg overflow-hidden\"}>\n <Tooltip title={saveTooltip}>\n <LoadingButton\n // Where a separate close button carries it, closing\n // is the dominant intent and takes the filled\n // treatment. Under the `▾` the record is staying\n // open, so Save keeps it.\n variant={saveAndCloseButton ? \"text\" : \"filled\"}\n color={\"primary\"}\n size={\"small\"}\n loading={saving && !saveAndCloseButton}\n disabled={saveDisabled}\n onClick={onSave}\n className={saveAndCloseMenu ? \"rounded-none\" : undefined}>\n {saveLabel}\n </LoadingButton>\n </Tooltip>\n\n {saveAndCloseMenu && <>\n <Menu align={\"end\"}\n trigger={\n <Button variant={\"filled\"}\n color={\"primary\"}\n size={\"small\"}\n disabled={saveDisabled}\n aria-label={closeLabel}\n // The seam is this half's own left border,\n // tinted from `currentColor` — the ink the\n // label is drawn in — so it holds on any\n // button colour and dims with the control\n // rather than needing a case per state. It\n // was a `bg-white/25` span between the\n // halves: a bright hairline scratched over a\n // saturated blue, and, being a sibling of\n // the buttons rather than part of one, it\n // stayed at full strength while `disabled`\n // dropped both halves to `opacity-40` — a\n // rule brighter than the button it bisected.\n // Inline because it has to beat the\n // variant's `border-<color>` on one edge.\n style={{ borderLeftColor: \"color-mix(in oklab, currentColor 15%, transparent)\" }}\n className={\"rounded-none px-1.5\"}>\n <ChevronDownIcon size={iconSize.smallest}/>\n </Button>\n }>\n <MenuItem onClick={onSaveAndClose}>\n <CheckIcon size={iconSize.smallest}/>\n {closeLabel}\n </MenuItem>\n </Menu>\n </>}\n </div>\n )}\n\n {saveAndCloseButton && (\n <LoadingButton variant={\"filled\"}\n color={\"primary\"}\n size={\"small\"}\n loading={saving}\n disabled={saveDisabled}\n onClick={onSaveAndClose}>\n {closeLabel}\n </LoadingButton>\n )}\n </>;\n}\n\n/**\n * The words the unlabelled floating circle never said.\n *\n * That indicator was a ✓ / pencil / spinner chip stuck to the top-right of the\n * scroll area in an `h-0 overflow-visible` container, so it drifted across\n * field values as you scrolled — and it duplicated what the Save button was\n * already able to tell you.\n */\nfunction SaveState({\n dirty,\n saving,\n status,\n t\n}: {\n dirty: boolean;\n saving: boolean;\n status: EntityStatus;\n t: (key: string) => string;\n}) {\n if (saving) {\n return <StateText>{t(\"saving\")}</StateText>;\n }\n if (dirty) {\n return <StateText>{t(\"unsaved_changes_title\")}</StateText>;\n }\n if (status === \"existing\") {\n return <StateText>{t(\"entity_saved\") ?? \"Saved\"}</StateText>;\n }\n return null;\n}\n\nfunction StateText({ children }: { children: React.ReactNode }) {\n return (\n <span className={\"text-xs text-text-disabled dark:text-text-disabled-dark whitespace-nowrap hidden md:inline\"}>\n {children}\n </span>\n );\n}\n\n/**\n * The id, as a chip you can copy rather than a full-width alert holding a UUID.\n */\nfunction IdChip({ value }: { value: string }) {\n\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n\n const truncated = value.length > 14\n ? `${value.slice(0, 8)}…${value.slice(-4)}`\n : value;\n\n const copy = () => {\n navigator.clipboard?.writeText(value).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1600);\n }, () => undefined);\n };\n\n return (\n <Tooltip title={copied ? t(\"copied\") : value}>\n <button type={\"button\"}\n onClick={copy}\n aria-label={`${t(\"copy_id\")} ${value}`}\n className={cls(\n // `whitespace-nowrap`: the middle of the id is elided with a\n // `…`, and a line break is allowed after one. In the dialog,\n // where the bar is narrow and every button is on it, the\n // chip broke across two lines inside a 52px row.\n \"hidden md:inline-flex items-center gap-1.5 shrink-0 whitespace-nowrap px-2 py-0.5 rounded-md\",\n \"font-mono text-[11px] text-text-secondary dark:text-text-secondary-dark\",\n \"bg-surface-field\",\n \"hover:bg-surface-field-hover transition-colors\"\n )}>\n {truncated}\n {copied ? <CheckIcon size={iconSize.smallest}/> : <CopyIcon size={iconSize.smallest}/>}\n </button>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgKA,SAAgB,kBAAkB,EAC9B,YACA,eACA,OACA,UACA,QACA,OACA,QACA,QACA,WACA,cACA,WACA,gBACA,wBAAwB,UACxB,SACA,QACA,WACA,eACA,cACA,eACA,eACA,eACA,UACA,WACuB;CAEvB,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,SAAS,eAAe,UAAU;CACxC,MAAM,YAAY,OAAuB,IAAI;CAC7C,MAAM,cAAc,OAAuB,IAAI;CAC/C,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,MAAM,oBAAoB,WAAW,aAAa,YAAY,MAAM;CAI1E,MAAM,aAAa,CAAC,GAAG,OAAO,MAAM,IAAI,KAAK,GAAG,GAAI,eAAe,OAAO,UAAW;CACrF,MAAM,iBAAiB,eAAe,WAAW;CACjD,MAAM,qBAAqB,eAAe,eAAe;CACzD,MAAM,eAAe,eAAe,SAAS,KAAK,QAAQ,YAAY,KAAK,QAAQ,aAAa,KAAK,QAAQ,SAAS;CACtH,MAAM,aAAa;EAAC,WAAW,SAAS;EAAG;EAAc,mBAAmB,SAAS;CAAC;CACtF,MAAM,UAAU,WAAW,KAAK,OAAO;CAEvC,MAAM,cAAc,UAAkB,WAAW,UAAU,WAAW,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,OAAO;CAElG,OACI,qBAAC,OAAD;EAAK,WAAW,IAIZ,yDACA,kBACJ;YANA;GAOK;GAEA,UACG,oBAAC,SAAD;IAAS,OAAO,EAAE,MAAM;cACpB,oBAAC,YAAD;KAAY,MAAM;KAAS,SAAS;KAAQ,cAAY,EAAE,MAAM;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EAAE,YAA2C;CAC5D,OACI,oBAAC,QAAD;EAAM,WAAW;EACZ;CACC,CAAA;AAEd;;;;AAKA,SAAS,OAAO,EAAE,SAA4B;CAE1C,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,YAAY,MAAM,SAAS,KAC3B,GAAG,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,MAAM,MAAM,EAAE,MACtC;CAEN,MAAM,aAAa;EACf,UAAU,WAAW,UAAU,KAAK,CAAC,CAAC,WAAW;GAC7C,UAAU,IAAI;GACd,iBAAiB,UAAU,KAAK,GAAG,IAAI;EAC3C,SAAS,KAAA,CAAS;CACtB;CAEA,OACI,oBAAC,SAAD;EAAS,OAAO,SAAS,EAAE,QAAQ,IAAI;YACnC,qBAAC,UAAD;GAAQ,MAAM;GACV,SAAS;GACT,cAAY,GAAG,EAAE,SAAS,EAAE,GAAG;GAC/B,WAAW,IAKP,gGACA,2EACA,oBACA,gDACJ;aAZJ,CAaK,WACA,SAAS,oBAAC,WAAD,EAAW,MAAM,SAAS,SAAU,CAAA,IAAI,oBAAC,UAAD,EAAU,MAAM,SAAS,SAAU,CAAA,CACjF;;CACH,CAAA;AAEjB"}
1
+ {"version":3,"file":"EntityIdentityBar.js","names":[],"sources":["../../src/components/EntityIdentityBar.tsx"],"sourcesContent":["import type { AdminCollection } from \"@rebasepro/cms-types\";\nimport type { EntityStatus } from \"@rebasepro/types\";\nimport React, { useLayoutEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { Link } from \"react-router\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport {\n Button,\n CheckIcon,\n CircularProgress,\n ChevronDownIcon,\n cls,\n CodeIcon,\n CopyIcon,\n ExternalLinkIcon,\n HistoryIcon,\n IconButton,\n iconSize,\n LoadingButton,\n ArrowLeftIcon,\n Menu,\n MenuItem,\n MoreVerticalIcon,\n Separator,\n Tooltip,\n Typography,\n XIcon\n} from \"@rebasepro/ui\";\nimport type { PlacedEntityActions } from \"../util/entity_actions\";\nimport { fitInlineActions, type InlineActionsFit } from \"../util/fit_inline_actions\";\nimport { ActionMenuLabel } from \"./common/ActionMenuLabel\";\n\n/**\n * One of the record's own actions, resolved and ready to run — what the bar\n * needs to draw it as a button or as a menu item.\n */\nexport interface RecordActionItem {\n key: string;\n name: string;\n icon?: React.ReactNode;\n enabled: boolean;\n /** Why it is disabled, when it is and its action says. */\n disabledReason?: string;\n /**\n * Runs the action, reporting its own failure. Returns a promise only when\n * the action is asynchronous, which is what keeps a button's spinner up.\n */\n run: () => Promise<void> | undefined;\n}\n\nexport interface EntityIdentityBarProps {\n /** Plural collection name, shown as the breadcrumb ahead of the title. */\n collection: AdminCollection;\n /**\n * Where the breadcrumb points. Without it the collection name is inert text\n * that still reads as a breadcrumb — worse than no breadcrumb at all, and\n * the only way back once a layout drops its back arrow.\n *\n * Left unset by the overlays (side panel, dialog), where the collection is\n * already underneath and navigating would dismiss the record instead.\n */\n collectionUrl?: string;\n /** Resolved record title, already guarded against showing a field default. */\n title: string;\n entityId?: string | number;\n status: EntityStatus;\n\n dirty: boolean;\n saving: boolean;\n /** Undefined hides the Save button — read-only views, or a custom form. */\n onSave?: () => void;\n onDiscard?: () => void;\n saveDisabled?: boolean;\n hasErrors?: boolean;\n\n /**\n * Save and dismiss, for the side panel and the dialog where the dominant\n * action is \"done with this record\" rather than \"keep editing\".\n */\n onSaveAndClose?: () => void;\n\n /**\n * Where {@link onSaveAndClose} is offered.\n *\n * `\"button\"` — its own filled button, and Save demotes to text. For the\n * overlays, where you opened the record to do one thing to it and closing is\n * the dominant intent.\n *\n * `\"menu\"` — a `▾` welded to the Save button. For the split, where the list\n * is right there and `j`/`k` walk from record to record: there, saving and\n * *staying* is the common case, so it keeps the filled button and dismissing\n * is one step further in. The gesture still exists, so muscle memory carried\n * over from the side panel finds it.\n */\n saveAndClosePlacement?: \"button\" | \"menu\";\n\n /**\n * Dismiss this record, from the ✕ at the bar's trailing edge.\n *\n * Fenced off from Save by a separator: it is chrome, not the last item in\n * the action row. The panel that supplies it decides what dismissing means —\n * in the split it is a navigation, which the layout's unsaved-changes\n * blocker already guards, so the ✕ cannot drop an edit without asking.\n */\n onClose?: () => void;\n\n onBack?: () => void;\n onInspect?: () => void;\n /** Opens the inspector straight on its history tab. */\n onViewHistory?: () => void;\n\n /**\n * Where this record appears on the live site, from `entityLinkBuilder`.\n *\n * Here rather than above the record, where it used to be a single unlabelled\n * icon alone on its own right-aligned row — the only thing between the bar\n * and the first field, and the only control in the view that did not say\n * what it was. It is a thing you do *to* a record, so it belongs with the\n * others.\n */\n externalLink?: string;\n\n /**\n * Actions performed *on* the record — copy, delete, whatever the collection\n * adds — already placed: `inline` ones are buttons ahead of Save, folding\n * into the overflow menu when the bar runs short of room, and the rest are\n * menu groups. They live here rather than in a footer, which is what let\n * the footer go away entirely.\n */\n recordActions?: PlacedEntityActions<RecordActionItem>;\n\n /**\n * The read-only view's Edit: its main button, drawn where Save stands on\n * the edit view — after the record's own buttons, ahead of the menu.\n */\n primaryAction?: React.ReactNode;\n\n /** Plugin-contributed actions, rendered inline before Save. */\n pluginActions?: React.ReactNode;\n\n /** Close / full-screen buttons supplied by the panel that owns this view. */\n trailing?: React.ReactNode;\n\n /**\n * Controls the owning panel puts at the bar's leading edge, ahead of the\n * breadcrumb — where the side panel's close button lives.\n */\n leading?: React.ReactNode;\n}\n\n/**\n * The persistent header of an entity view: who this record is, and what you can\n * do to it.\n *\n * The title and the id used to live inside the scrolling form, above 72px of\n * empty space — 219px of chrome that carried nothing and scrolled away the\n * moment you touched the wheel, leaving no indication of which record you were\n * editing. They live here instead, and the left half of a bar that was\n * previously empty now does the work.\n */\nexport function EntityIdentityBar({\n collection,\n collectionUrl,\n title,\n entityId,\n status,\n dirty,\n saving,\n onSave,\n onDiscard,\n saveDisabled,\n hasErrors,\n onSaveAndClose,\n saveAndClosePlacement = \"button\",\n onClose,\n onBack,\n onInspect,\n onViewHistory,\n externalLink,\n recordActions,\n primaryAction,\n pluginActions,\n trailing,\n leading\n}: EntityIdentityBarProps) {\n\n const { t } = useTranslation();\n\n const inline = recordActions?.inline ?? NO_ACTIONS;\n const inlineRef = useRef<HTMLDivElement>(null);\n const labelledRef = useRef<HTMLDivElement>(null);\n const compactRef = useRef<HTMLDivElement>(null);\n const fit = useInlineActionsFit(inlineRef, labelledRef, compactRef, inline);\n\n // What did not fit leads the menu, ahead of the actions that were always\n // there: it is what the developer ranked highest.\n const ownActions = [...inline.slice(fit.count), ...(recordActions?.own ?? NO_ACTIONS)];\n const genericActions = recordActions?.generic ?? NO_ACTIONS;\n const destructiveActions = recordActions?.destructive ?? NO_ACTIONS;\n const hasUtilities = genericActions.length > 0 || Boolean(externalLink) || Boolean(onViewHistory) || Boolean(onInspect);\n const menuGroups = [ownActions.length > 0, hasUtilities, destructiveActions.length > 0];\n const hasMenu = menuGroups.some(Boolean);\n // A rule between two groups that are both there, never at an edge.\n const ruleBefore = (group: number) => menuGroups[group] && menuGroups.slice(0, group).some(Boolean);\n\n return (\n <div className={cls(\n // No line under it: the bar and the tab strip below are one band on\n // the sheet, and the strip already carries the edge the folder tab\n // sits on. Regions meet with a step, not a rule.\n \"h-[52px] shrink-0 flex items-center gap-2 pl-1.5 pr-2\",\n \"bg-surface-sheet\"\n )}>\n {leading}\n\n {onBack && (\n <Tooltip title={t(\"back\")}>\n <IconButton size={\"small\"} onClick={onBack} aria-label={t(\"back\")}>\n <ArrowLeftIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n )}\n\n {collectionUrl\n ? <Link to={collectionUrl}\n className={\"visited:text-inherit dark:visited:text-inherit hidden sm:block\"}>\n <Typography variant={\"caption\"}\n className={cls(\n \"text-text-disabled dark:text-text-disabled-dark whitespace-nowrap\",\n \"hover:text-text-primary dark:hover:text-text-primary-dark transition-colors\"\n )}>\n {collection.name}&nbsp;/\n </Typography>\n </Link>\n : <Typography variant={\"caption\"}\n className={\"text-text-disabled dark:text-text-disabled-dark whitespace-nowrap hidden sm:block\"}>\n {collection.name}&nbsp;/\n </Typography>}\n\n <span className={cls(\n \"font-headers font-semibold text-[15px] tracking-tight truncate min-w-0\",\n // The title takes the room it needs and the actions get what is\n // left, so a long one would fold every action away. Capped, it\n // truncates first — only where there are actions to make room for.\n inline.length > 0 && \"max-w-[40%]\"\n )}\n title={title}>\n {title}\n </span>\n\n {entityId !== undefined && <IdChip value={String(entityId)}/>}\n\n {/* The bar's free space, and the actions that fit in it. Always\n rendered: it is the spacer, and the observer measures it. */}\n <div ref={inlineRef}\n className={\"flex-1 min-w-0 flex items-center justify-end gap-1\"}>\n {inline.slice(0, fit.count).map(action =>\n <RecordActionButton key={action.key} action={action} compact={fit.compact}/>)}\n {inline.length > 0 && (\n // Every action in both of its forms, laid out at its natural\n // width and never seen, so a fit can be decided without\n // first drawing the bar wrong. A zero-size clipping box: it\n // takes no room and cannot widen anything it sits in.\n <div aria-hidden={true}\n className={\"absolute w-0 h-0 overflow-hidden invisible pointer-events-none\"}>\n <div ref={labelledRef} className={\"flex w-max\"}>\n {inline.map(action =>\n <RecordActionButton key={action.key} action={action} compact={false}/>)}\n </div>\n <div ref={compactRef} className={\"flex w-max\"}>\n {inline.map(action =>\n <RecordActionButton key={action.key} action={action} compact={true}/>)}\n </div>\n </div>\n )}\n </div>\n\n {pluginActions}\n\n <EntitySaveActions status={status}\n dirty={dirty}\n saving={saving}\n onSave={onSave}\n onDiscard={onDiscard}\n saveDisabled={saveDisabled}\n hasErrors={hasErrors}\n onSaveAndClose={onSaveAndClose}\n saveAndClosePlacement={saveAndClosePlacement}/>\n\n {primaryAction}\n\n {hasMenu && (\n <Menu align={\"end\"}\n trigger={\n <IconButton size={\"small\"} aria-label={t(\"more_actions\") ?? \"More actions\"}>\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }>\n {/* The collection's own operations first — the reason\n someone opened this record — then the ones every record\n has, then Delete, last and apart. */}\n {ownActions.map(action => <RecordActionMenuItem key={action.key} action={action}/>)}\n {ruleBefore(1) && <Separator orientation={\"horizontal\"}/>}\n {genericActions.map(action => <RecordActionMenuItem key={action.key} action={action}/>)}\n {externalLink && (\n <MenuItem onClick={() => window.open(externalLink, \"_blank\", \"noopener,noreferrer\")}>\n <ExternalLinkIcon size={iconSize.smallest}/>\n {t(\"open_in_live_site\") ?? \"Open in the live site\"}\n </MenuItem>\n )}\n {onViewHistory && (\n <MenuItem onClick={onViewHistory}>\n <HistoryIcon size={iconSize.smallest}/>\n {t(\"record_history\") ?? \"History\"}\n </MenuItem>\n )}\n {onInspect && (\n <MenuItem onClick={onInspect}>\n <CodeIcon size={iconSize.smallest}/>\n {t(\"inspect_record\") ?? \"Inspect record\"}\n </MenuItem>\n )}\n {ruleBefore(2) && <Separator orientation={\"horizontal\"}/>}\n {destructiveActions.map(action => <RecordActionMenuItem key={action.key} action={action}/>)}\n </Menu>\n )}\n\n {trailing}\n\n {/* Last, and set apart by space rather than a rule. A ✕ flush against\n Save reads as the next item in the action row, and the two\n adjacent controls are then \"commit this edit\" and \"abandon it\";\n the vertical separator that used to fence it off was the one\n line on the bar, and a line marks an object, not a gap. */}\n {onClose && (\n <Tooltip title={`${t(\"close\")} · Esc`}>\n <IconButton size={\"small\"} onClick={onClose} aria-label={t(\"close\")} className={\"ml-2\"}>\n <XIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n )}\n </div>\n );\n}\n\nconst NO_ACTIONS: RecordActionItem[] = [];\n\n/** `gap-1`, between the inline actions. */\nconst INLINE_ACTIONS_GAP = 4;\n\n/**\n * Which of the inline actions fit in the bar's free space, and whether they\n * keep their labels — decided from the measuring copies before the bar is\n * painted, and again whenever the space or the buttons change size: a resize,\n * Discard appearing beside Save, a web font arriving, a language switch.\n */\nfunction useInlineActionsFit(\n containerRef: React.RefObject<HTMLDivElement | null>,\n labelledRef: React.RefObject<HTMLDivElement | null>,\n compactRef: React.RefObject<HTMLDivElement | null>,\n actions: RecordActionItem[]\n): InlineActionsFit {\n\n const [fit, setFit] = useState<InlineActionsFit>({ count: actions.length, compact: false });\n const actionKeys = actions.map(action => action.key).join(\"\\u0000\");\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n const labelled = labelledRef.current;\n const compact = compactRef.current;\n if (!container || !labelled || !compact) {\n setFit(previous => previous.count === 0 && !previous.compact ? previous : { count: 0, compact: false });\n return;\n }\n const widths = (row: HTMLElement) =>\n Array.from(row.children).map(child => child.getBoundingClientRect().width);\n const measure = () => {\n const next = fitInlineActions(container.clientWidth, widths(labelled), widths(compact), INLINE_ACTIONS_GAP);\n setFit(previous => previous.count === next.count && previous.compact === next.compact ? previous : next);\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n // Synchronously: the observer reports after layout and before paint,\n // and an ordinary update would render after that paint — one frame\n // with the old buttons drawn over the title whenever Discard appeared.\n const observer = new ResizeObserver(() => flushSync(measure));\n observer.observe(container);\n observer.observe(labelled);\n observer.observe(compact);\n return () => observer.disconnect();\n }, [containerRef, labelledRef, compactRef, actionKeys]);\n\n return fit;\n}\n\n/**\n * An action promoted out of the menu: a text button with its icon, as the\n * collection toolbar draws Filter and Sort, or the icon alone with its name in\n * a tooltip where the bar is short of room. It shows a spinner while the work\n * it started is running, and cannot be pressed twice meanwhile. Disabled, its\n * tooltip says why, where the action gives a reason.\n */\nfunction RecordActionButton({ action, compact }: { action: RecordActionItem, compact: boolean }) {\n\n const [running, setRunning] = useState(false);\n const reason = action.enabled ? undefined : action.disabledReason;\n\n const onClick = () => {\n const pending = action.run();\n if (!pending) return;\n setRunning(true);\n pending.finally(() => setRunning(false));\n };\n\n if (compact && action.icon) {\n return (\n <Tooltip title={reason ? `${action.name}: ${reason}` : action.name}>\n <IconButton size={\"small\"}\n aria-label={action.name}\n disabled={!action.enabled || running}\n onClick={onClick}>\n {running ? <CircularProgress size={\"smallest\"}/> : action.icon}\n </IconButton>\n </Tooltip>\n );\n }\n\n // The tooltip's wrapper takes the hover: a disabled button receives no\n // pointer events of its own, so the button lets them through to it.\n return (\n <Tooltip title={reason}>\n <LoadingButton variant={\"text\"}\n size={\"small\"}\n startIcon={action.icon}\n loading={running}\n disabled={!action.enabled}\n className={reason ? \"pointer-events-none\" : undefined}\n onClick={onClick}>\n {action.name}\n </LoadingButton>\n </Tooltip>\n );\n}\n\nfunction RecordActionMenuItem({ action }: { action: RecordActionItem }) {\n return (\n <MenuItem disabled={!action.enabled} onClick={() => void action.run()}>\n {action.icon}\n <ActionMenuLabel name={action.name} disabledReason={action.enabled ? undefined : action.disabledReason}/>\n </MenuItem>\n );\n}\n\nexport type EntitySaveActionsProps = Pick<EntityIdentityBarProps,\n \"status\" | \"dirty\" | \"saving\" | \"onSave\" | \"onDiscard\" | \"saveDisabled\" | \"hasErrors\"\n | \"onSaveAndClose\" | \"saveAndClosePlacement\">;\n\n/**\n * Save, \"save and close\", Discard, and the words saying where the edit stands.\n *\n * Its own component because it has two homes. On a page and in the side panel\n * it sits in the identity bar, where it stays in view while the form scrolls. In\n * the dialog it sits in a footer under the form: a dialog is read top to bottom\n * and finished at the bottom, where every other dialog in the app keeps its\n * buttons, and the bar at its top is left to say what the record is.\n */\nexport function EntitySaveActions({\n status,\n dirty,\n saving,\n onSave,\n onDiscard,\n saveDisabled,\n hasErrors,\n onSaveAndClose,\n saveAndClosePlacement = \"button\"\n}: EntitySaveActionsProps) {\n\n const { t } = useTranslation();\n\n const saveLabel = status === \"existing\"\n ? t(\"save\")\n : status === \"copy\" ? t(\"create_copy\") : t(\"create\");\n const closeLabel = status === \"existing\"\n ? t(\"save_and_close\")\n : status === \"copy\" ? t(\"create_copy_and_close\") : t(\"create_and_close\");\n\n // The two shapes \"save and close\" takes, so the Save button next to it knows\n // whether it is still the primary action.\n const saveAndCloseButton = Boolean(onSaveAndClose) && saveAndClosePlacement === \"button\";\n const saveAndCloseMenu = Boolean(onSaveAndClose) && saveAndClosePlacement === \"menu\";\n\n const saveTooltip = hasErrors\n ? (t(\"fix_errors_before_saving\") ?? \"Fix highlighted errors before saving\")\n : undefined;\n\n return <>\n {/* Only where there is something to save. The read-only detail\n view has no Save button, and reporting \"Saved\" there implies an\n editing session the user never started. */}\n {onSave && <SaveState dirty={dirty} saving={saving} status={status} t={t}/>}\n\n {onDiscard && dirty && !saving && (\n <Button variant={\"text\"} size={\"small\"} onClick={onDiscard}>\n {status === \"existing\" ? t(\"discard\") : t(\"clear\")}\n </Button>\n )}\n\n {onSave && (\n // `rounded-lg overflow-hidden`: the two halves of the split\n // button are square inside and the group carries the radius, so\n // there is one control with a seam rather than two buttons that\n // happen to touch. Their borders match their own fill, so the\n // seam has to be drawn — see the `▾` half for where and in what.\n <div className={\"flex items-stretch rounded-lg overflow-hidden\"}>\n <Tooltip title={saveTooltip}>\n <LoadingButton\n // Where a separate close button carries it, closing\n // is the dominant intent and takes the filled\n // treatment. Under the `▾` the record is staying\n // open, so Save keeps it.\n variant={saveAndCloseButton ? \"text\" : \"filled\"}\n color={\"primary\"}\n size={\"small\"}\n loading={saving && !saveAndCloseButton}\n disabled={saveDisabled}\n onClick={onSave}\n className={saveAndCloseMenu ? \"rounded-none\" : undefined}>\n {saveLabel}\n </LoadingButton>\n </Tooltip>\n\n {saveAndCloseMenu && <>\n <Menu align={\"end\"}\n trigger={\n <Button variant={\"filled\"}\n color={\"primary\"}\n size={\"small\"}\n disabled={saveDisabled}\n aria-label={closeLabel}\n // The seam is this half's own left border,\n // tinted from `currentColor` — the ink the\n // label is drawn in — so it holds on any\n // button colour and dims with the control\n // rather than needing a case per state. It\n // was a `bg-white/25` span between the\n // halves: a bright hairline scratched over a\n // saturated blue, and, being a sibling of\n // the buttons rather than part of one, it\n // stayed at full strength while `disabled`\n // dropped both halves to `opacity-40` — a\n // rule brighter than the button it bisected.\n // Inline because it has to beat the\n // variant's `border-<color>` on one edge.\n style={{ borderLeftColor: \"color-mix(in oklab, currentColor 15%, transparent)\" }}\n className={\"rounded-none px-1.5\"}>\n <ChevronDownIcon size={iconSize.smallest}/>\n </Button>\n }>\n <MenuItem onClick={onSaveAndClose}>\n <CheckIcon size={iconSize.smallest}/>\n {closeLabel}\n </MenuItem>\n </Menu>\n </>}\n </div>\n )}\n\n {saveAndCloseButton && (\n <LoadingButton variant={\"filled\"}\n color={\"primary\"}\n size={\"small\"}\n loading={saving}\n disabled={saveDisabled}\n onClick={onSaveAndClose}>\n {closeLabel}\n </LoadingButton>\n )}\n </>;\n}\n\n/**\n * The words the unlabelled floating circle never said.\n *\n * That indicator was a ✓ / pencil / spinner chip stuck to the top-right of the\n * scroll area in an `h-0 overflow-visible` container, so it drifted across\n * field values as you scrolled — and it duplicated what the Save button was\n * already able to tell you.\n */\nfunction SaveState({\n dirty,\n saving,\n status,\n t\n}: {\n dirty: boolean;\n saving: boolean;\n status: EntityStatus;\n t: (key: string) => string;\n}) {\n if (saving) {\n return <StateText>{t(\"saving\")}</StateText>;\n }\n if (dirty) {\n return <StateText>{t(\"unsaved_changes_title\")}</StateText>;\n }\n if (status === \"existing\") {\n return <StateText>{t(\"entity_saved\") ?? \"Saved\"}</StateText>;\n }\n return null;\n}\n\nfunction StateText({ children }: { children: React.ReactNode }) {\n return (\n <span className={\"text-xs text-text-disabled dark:text-text-disabled-dark whitespace-nowrap hidden md:inline\"}>\n {children}\n </span>\n );\n}\n\n/**\n * The id, as a chip you can copy rather than a full-width alert holding a UUID.\n */\nfunction IdChip({ value }: { value: string }) {\n\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n\n const truncated = value.length > 14\n ? `${value.slice(0, 8)}…${value.slice(-4)}`\n : value;\n\n const copy = () => {\n navigator.clipboard?.writeText(value).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1600);\n }, () => undefined);\n };\n\n return (\n <Tooltip title={copied ? t(\"copied\") : value}>\n <button type={\"button\"}\n onClick={copy}\n aria-label={`${t(\"copy_id\")} ${value}`}\n className={cls(\n // `whitespace-nowrap`: the middle of the id is elided with a\n // `…`, and a line break is allowed after one. In the dialog,\n // where the bar is narrow and every button is on it, the\n // chip broke across two lines inside a 52px row.\n \"hidden md:inline-flex items-center gap-1.5 shrink-0 whitespace-nowrap px-2 py-0.5 rounded-md\",\n \"font-mono text-xs text-text-secondary dark:text-text-secondary-dark\",\n \"bg-surface-field\",\n \"hover:bg-surface-field-hover transition-colors\"\n )}>\n {truncated}\n {copied ? <CheckIcon size={iconSize.smallest}/> : <CopyIcon size={iconSize.smallest}/>}\n </button>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgKA,SAAgB,kBAAkB,EAC9B,YACA,eACA,OACA,UACA,QACA,OACA,QACA,QACA,WACA,cACA,WACA,gBACA,wBAAwB,UACxB,SACA,QACA,WACA,eACA,cACA,eACA,eACA,eACA,UACA,WACuB;CAEvB,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,SAAS,eAAe,UAAU;CACxC,MAAM,YAAY,OAAuB,IAAI;CAC7C,MAAM,cAAc,OAAuB,IAAI;CAC/C,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,MAAM,oBAAoB,WAAW,aAAa,YAAY,MAAM;CAI1E,MAAM,aAAa,CAAC,GAAG,OAAO,MAAM,IAAI,KAAK,GAAG,GAAI,eAAe,OAAO,UAAW;CACrF,MAAM,iBAAiB,eAAe,WAAW;CACjD,MAAM,qBAAqB,eAAe,eAAe;CACzD,MAAM,eAAe,eAAe,SAAS,KAAK,QAAQ,YAAY,KAAK,QAAQ,aAAa,KAAK,QAAQ,SAAS;CACtH,MAAM,aAAa;EAAC,WAAW,SAAS;EAAG;EAAc,mBAAmB,SAAS;CAAC;CACtF,MAAM,UAAU,WAAW,KAAK,OAAO;CAEvC,MAAM,cAAc,UAAkB,WAAW,UAAU,WAAW,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,OAAO;CAElG,OACI,qBAAC,OAAD;EAAK,WAAW,IAIZ,yDACA,kBACJ;YANA;GAOK;GAEA,UACG,oBAAC,SAAD;IAAS,OAAO,EAAE,MAAM;cACpB,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,cAAc,KAAK,QAAmB,CAAA;CAE/D,OAAO;AACX;AAEA,SAAS,UAAU,EAAE,YAA2C;CAC5D,OACI,oBAAC,QAAD;EAAM,WAAW;EACZ;CACC,CAAA;AAEd;;;;AAKA,SAAS,OAAO,EAAE,SAA4B;CAE1C,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,YAAY,MAAM,SAAS,KAC3B,GAAG,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,MAAM,MAAM,EAAE,MACtC;CAEN,MAAM,aAAa;EACf,UAAU,WAAW,UAAU,KAAK,CAAC,CAAC,WAAW;GAC7C,UAAU,IAAI;GACd,iBAAiB,UAAU,KAAK,GAAG,IAAI;EAC3C,SAAS,KAAA,CAAS;CACtB;CAEA,OACI,oBAAC,SAAD;EAAS,OAAO,SAAS,EAAE,QAAQ,IAAI;YACnC,qBAAC,UAAD;GAAQ,MAAM;GACV,SAAS;GACT,cAAY,GAAG,EAAE,SAAS,EAAE,GAAG;GAC/B,WAAW,IAKP,gGACA,uEACA,oBACA,gDACJ;aAZJ,CAaK,WACA,SAAS,oBAAC,WAAD,EAAW,MAAM,SAAS,SAAU,CAAA,IAAI,oBAAC,UAAD,EAAU,MAAM,SAAS,SAAU,CAAA,CACjF;;CACH,CAAA;AAEjB"}
@@ -39,7 +39,7 @@ function PropertyKeyHint({ propertyKey, className }) {
39
39
  tabIndex: -1,
40
40
  onClick: copy,
41
41
  "aria-label": `${t("copy")} ${propertyKey}`,
42
- className: cls("inline-flex items-center gap-1 min-w-0 shrink-[999] px-1 -my-0.5 rounded-md", "font-mono text-[11px] font-normal leading-tight", "text-text-disabled dark:text-text-disabled-dark", "hover:text-text-secondary dark:hover:text-text-secondary-dark hover:bg-surface-hover", "opacity-0 transition-opacity duration-150 group-hover/label:opacity-100 group-hover/label:delay-500", className),
42
+ className: cls("inline-flex items-center gap-1 min-w-0 shrink-[999] px-1 -my-0.5 rounded-md", "font-mono text-xs font-normal leading-tight", "text-text-disabled dark:text-text-disabled-dark", "hover:text-text-secondary dark:hover:text-text-secondary-dark hover:bg-surface-hover", "opacity-0 transition-opacity duration-150 group-hover/label:opacity-100 group-hover/label:delay-500", className),
43
43
  children: [/* @__PURE__ */ jsx("span", {
44
44
  className: "truncate",
45
45
  children: propertyKey
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyKeyHint.js","names":[],"sources":["../../src/components/PropertyKeyHint.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport { CheckIcon, cls, CopyIcon } from \"@rebasepro/ui\";\n\n/**\n * A property's key, shown beside its label while the label is hovered, and\n * copied when clicked.\n *\n * Inline, in the label row's own empty space, rather than a tooltip. The tooltip\n * this replaces wrapped the field's control as well as its label, so it opened\n * the moment a field took focus and sat on top of the label of the very field\n * being filled in. Closing again on blur, it was also what threw Tab out of the\n * dialog (see `useRestoreInterruptedFocus` in `@rebasepro/ui`). A key a\n * developer copies now and then is not worth a layer over the form.\n *\n * Revealed by hovering the nearest `group/label` ancestor, after a pause, so a\n * pointer crossing the form does not flicker keys on and off; hidden again at\n * once. Out of the tab order: a stop per field would double the keystrokes it\n * takes to get through a form, for something only the pointer needs.\n *\n * Gives up its width before the label does (`shrink-[999]`), so a long field\n * name in a narrow column is never truncated to make room for a key that is not\n * even showing.\n */\nexport function PropertyKeyHint({\n propertyKey,\n className\n}: {\n propertyKey: string;\n className?: string;\n}) {\n\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n\n const copy = (event: React.MouseEvent) => {\n // Labels sit inside things that act on a click — an expandable\n // panel's header, above all. Copying a key must not also toggle it.\n event.preventDefault();\n event.stopPropagation();\n navigator.clipboard?.writeText(propertyKey).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1600);\n }, () => undefined);\n };\n\n return (\n <button type={\"button\"}\n tabIndex={-1}\n onClick={copy}\n aria-label={`${t(\"copy\")} ${propertyKey}`}\n className={cls(\n \"inline-flex items-center gap-1 min-w-0 shrink-[999] px-1 -my-0.5 rounded-md\",\n \"font-mono text-[11px] font-normal leading-tight\",\n \"text-text-disabled dark:text-text-disabled-dark\",\n \"hover:text-text-secondary dark:hover:text-text-secondary-dark hover:bg-surface-hover\",\n \"opacity-0 transition-opacity duration-150 group-hover/label:opacity-100 group-hover/label:delay-500\",\n className\n )}>\n <span className={\"truncate\"}>{propertyKey}</span>\n {copied\n ? <CheckIcon size={11} className={\"shrink-0\"}/>\n : <CopyIcon size={11} className={\"shrink-0\"}/>}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,gBAAgB,EAC5B,aACA,aAID;CAEC,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,QAAQ,UAA4B;EAGtC,MAAM,eAAe;EACrB,MAAM,gBAAgB;EACtB,UAAU,WAAW,UAAU,WAAW,CAAC,CAAC,WAAW;GACnD,UAAU,IAAI;GACd,iBAAiB,UAAU,KAAK,GAAG,IAAI;EAC3C,SAAS,KAAA,CAAS;CACtB;CAEA,OACI,qBAAC,UAAD;EAAQ,MAAM;EACV,UAAU;EACV,SAAS;EACT,cAAY,GAAG,EAAE,MAAM,EAAE,GAAG;EAC5B,WAAW,IACP,+EACA,mDACA,mDACA,wFACA,uGACA,SACJ;YAXJ,CAYI,oBAAC,QAAD;GAAM,WAAW;aAAa;EAAkB,CAAA,GAC/C,SACK,oBAAC,WAAD;GAAW,MAAM;GAAI,WAAW;EAAY,CAAA,IAC5C,oBAAC,UAAD;GAAU,MAAM;GAAI,WAAW;EAAY,CAAA,CAC7C;;AAEhB"}
1
+ {"version":3,"file":"PropertyKeyHint.js","names":[],"sources":["../../src/components/PropertyKeyHint.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { useTranslation } from \"@rebasepro/app\";\nimport { CheckIcon, cls, CopyIcon } from \"@rebasepro/ui\";\n\n/**\n * A property's key, shown beside its label while the label is hovered, and\n * copied when clicked.\n *\n * Inline, in the label row's own empty space, rather than a tooltip. The tooltip\n * this replaces wrapped the field's control as well as its label, so it opened\n * the moment a field took focus and sat on top of the label of the very field\n * being filled in. Closing again on blur, it was also what threw Tab out of the\n * dialog (see `useRestoreInterruptedFocus` in `@rebasepro/ui`). A key a\n * developer copies now and then is not worth a layer over the form.\n *\n * Revealed by hovering the nearest `group/label` ancestor, after a pause, so a\n * pointer crossing the form does not flicker keys on and off; hidden again at\n * once. Out of the tab order: a stop per field would double the keystrokes it\n * takes to get through a form, for something only the pointer needs.\n *\n * Gives up its width before the label does (`shrink-[999]`), so a long field\n * name in a narrow column is never truncated to make room for a key that is not\n * even showing.\n */\nexport function PropertyKeyHint({\n propertyKey,\n className\n}: {\n propertyKey: string;\n className?: string;\n}) {\n\n const { t } = useTranslation();\n const [copied, setCopied] = useState(false);\n\n const copy = (event: React.MouseEvent) => {\n // Labels sit inside things that act on a click — an expandable\n // panel's header, above all. Copying a key must not also toggle it.\n event.preventDefault();\n event.stopPropagation();\n navigator.clipboard?.writeText(propertyKey).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1600);\n }, () => undefined);\n };\n\n return (\n <button type={\"button\"}\n tabIndex={-1}\n onClick={copy}\n aria-label={`${t(\"copy\")} ${propertyKey}`}\n className={cls(\n \"inline-flex items-center gap-1 min-w-0 shrink-[999] px-1 -my-0.5 rounded-md\",\n \"font-mono text-xs font-normal leading-tight\",\n \"text-text-disabled dark:text-text-disabled-dark\",\n \"hover:text-text-secondary dark:hover:text-text-secondary-dark hover:bg-surface-hover\",\n \"opacity-0 transition-opacity duration-150 group-hover/label:opacity-100 group-hover/label:delay-500\",\n className\n )}>\n <span className={\"truncate\"}>{propertyKey}</span>\n {copied\n ? <CheckIcon size={11} className={\"shrink-0\"}/>\n : <CopyIcon size={11} className={\"shrink-0\"}/>}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,gBAAgB,EAC5B,aACA,aAID;CAEC,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,QAAQ,UAA4B;EAGtC,MAAM,eAAe;EACrB,MAAM,gBAAgB;EACtB,UAAU,WAAW,UAAU,WAAW,CAAC,CAAC,WAAW;GACnD,UAAU,IAAI;GACd,iBAAiB,UAAU,KAAK,GAAG,IAAI;EAC3C,SAAS,KAAA,CAAS;CACtB;CAEA,OACI,qBAAC,UAAD;EAAQ,MAAM;EACV,UAAU;EACV,SAAS;EACT,cAAY,GAAG,EAAE,MAAM,EAAE,GAAG;EAC5B,WAAW,IACP,+EACA,+CACA,mDACA,wFACA,uGACA,SACJ;YAXJ,CAYI,oBAAC,QAAD;GAAM,WAAW;aAAa;EAAkB,CAAA,GAC/C,SACK,oBAAC,WAAD;GAAW,MAAM;GAAI,WAAW;EAAY,CAAA,IAC5C,oBAAC,UAAD;GAAU,MAAM;GAAI,WAAW;EAAY,CAAA,CAC7C;;AAEhB"}
@@ -16,6 +16,10 @@ import React from "react";
16
16
  * </RebaseAuthGate>
17
17
  * ```
18
18
  */
19
- export declare function RebaseAuthGate({ children }: {
19
+ export declare function RebaseAuthGate({ children, logo, logoDark }: {
20
20
  children: React.ReactNode;
21
+ /** The logo the built-in sign-in screen shows. `<RebaseShell logo>` passes its own. */
22
+ logo?: string;
23
+ /** The sign-in screen's logo in the dark theme. Falls back to `logo`. */
24
+ logoDark?: string;
21
25
  }): React.JSX.Element;
@@ -20,14 +20,18 @@ import { LoginView, readEmailLinkAction, useAuthController, useComponentOverride
20
20
  * </RebaseAuthGate>
21
21
  * ```
22
22
  */
23
- function RebaseAuthGate({ children }) {
23
+ function RebaseAuthGate({ children, logo, logoDark }) {
24
24
  const registry = useRebaseRegistry();
25
25
  const authController = useAuthController();
26
26
  const ResolvedLoginView = useComponentOverride("Auth.LoginView", LoginView);
27
27
  if (authController?.initialLoading) return /* @__PURE__ */ jsx(CircularProgressCenter, { size: "large" });
28
28
  const openedLink = typeof window !== "undefined" ? readEmailLinkAction(window.location)?.kind : void 0;
29
29
  const linkOpensOverSession = openedLink === "verify-email" || openedLink === "confirm-email-change" || openedLink === "magic-link";
30
- if (!authController?.user || linkOpensOverSession) return /* @__PURE__ */ jsx(Fragment, { children: registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(ResolvedLoginView, { authController }) });
30
+ if (!authController?.user || linkOpensOverSession) return /* @__PURE__ */ jsx(Fragment, { children: registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(ResolvedLoginView, {
31
+ authController,
32
+ logo,
33
+ logoDark
34
+ }) });
31
35
  return /* @__PURE__ */ jsx(Fragment, { children });
32
36
  }
33
37
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseAuthGate.js","names":[],"sources":["../../src/components/RebaseAuthGate.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n useRebaseRegistry,\n useAuthController,\n useComponentOverride\n} from \"@rebasepro/app\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\nimport { LoginView, readEmailLinkAction } from \"@rebasepro/app\";\nimport type { AuthControllerExtended } from \"@rebasepro/cms-types\";\n\n/**\n * Auth gate component that handles the authentication flow.\n *\n * - Shows a loading spinner while `authController.initialLoading` is true.\n * - Shows the login view when no user is authenticated.\n * - Renders `children` when a user is authenticated.\n *\n * **Independently usable**: Use this alone when you want auth gating\n * without the full admin layout or navigation.\n *\n * @example\n * ```tsx\n * <RebaseAuthGate>\n * <MyCustomApp />\n * </RebaseAuthGate>\n * ```\n */\nexport function RebaseAuthGate({ children }: { children: React.ReactNode }) {\n const registry = useRebaseRegistry();\n const authController = useAuthController();\n // `<RebaseAuth loginView>` is an element and wins; `\"Auth.LoginView\"` in\n // `<Rebase components>` replaces or wraps the built-in screen.\n const ResolvedLoginView = useComponentOverride(\"Auth.LoginView\", LoginView);\n\n if (authController?.initialLoading) {\n return <CircularProgressCenter size={\"large\"}/>;\n }\n\n // A verification link opened while signed in is verified by the session\n // itself — which keeps everything on the account — on the screen that\n // knows the link, and an address-change link is usually followed in the\n // tab that asked for the change. A magic link opened while signed in is\n // sent on to the app by that screen, without being spent. Left to the\n // app's router each was a page that does not exist.\n const openedLink = typeof window !== \"undefined\" ? readEmailLinkAction(window.location)?.kind : undefined;\n const linkOpensOverSession = openedLink === \"verify-email\"\n || openedLink === \"confirm-email-change\"\n || openedLink === \"magic-link\";\n\n if (!authController?.user || linkOpensOverSession) {\n const ActiveLoginView = registry.authConfig?.loginView ?? (\n <ResolvedLoginView authController={authController as AuthControllerExtended}/>\n );\n return <>{ActiveLoginView}</>;\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,eAAe,EAAE,YAA2C;CACxE,MAAM,WAAW,kBAAkB;CACnC,MAAM,iBAAiB,kBAAkB;CAGzC,MAAM,oBAAoB,qBAAqB,kBAAkB,SAAS;CAE1E,IAAI,gBAAgB,gBAChB,OAAO,oBAAC,wBAAD,EAAwB,MAAM,QAAS,CAAA;CASlD,MAAM,aAAa,OAAO,WAAW,cAAc,oBAAoB,OAAO,QAAQ,CAAC,EAAE,OAAO,KAAA;CAChG,MAAM,uBAAuB,eAAe,kBACrC,eAAe,0BACf,eAAe;CAEtB,IAAI,CAAC,gBAAgB,QAAQ,sBAIzB,OAAO,oBAAA,UAAA,EAAA,UAHiB,SAAS,YAAY,aACzC,oBAAC,mBAAD,EAAmC,eAA0C,CAAA,EAErD,CAAA;CAGhC,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACzB"}
1
+ {"version":3,"file":"RebaseAuthGate.js","names":[],"sources":["../../src/components/RebaseAuthGate.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n useRebaseRegistry,\n useAuthController,\n useComponentOverride\n} from \"@rebasepro/app\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\nimport { LoginView, readEmailLinkAction } from \"@rebasepro/app\";\nimport type { AuthControllerExtended } from \"@rebasepro/cms-types\";\n\n/**\n * Auth gate component that handles the authentication flow.\n *\n * - Shows a loading spinner while `authController.initialLoading` is true.\n * - Shows the login view when no user is authenticated.\n * - Renders `children` when a user is authenticated.\n *\n * **Independently usable**: Use this alone when you want auth gating\n * without the full admin layout or navigation.\n *\n * @example\n * ```tsx\n * <RebaseAuthGate>\n * <MyCustomApp />\n * </RebaseAuthGate>\n * ```\n */\nexport function RebaseAuthGate({\n children,\n logo,\n logoDark\n}: {\n children: React.ReactNode;\n /** The logo the built-in sign-in screen shows. `<RebaseShell logo>` passes its own. */\n logo?: string;\n /** The sign-in screen's logo in the dark theme. Falls back to `logo`. */\n logoDark?: string;\n}) {\n const registry = useRebaseRegistry();\n const authController = useAuthController();\n // `<RebaseAuth loginView>` is an element and wins; `\"Auth.LoginView\"` in\n // `<Rebase components>` replaces or wraps the built-in screen.\n const ResolvedLoginView = useComponentOverride(\"Auth.LoginView\", LoginView);\n\n if (authController?.initialLoading) {\n return <CircularProgressCenter size={\"large\"}/>;\n }\n\n // A verification link opened while signed in is verified by the session\n // itself — which keeps everything on the account — on the screen that\n // knows the link, and an address-change link is usually followed in the\n // tab that asked for the change. A magic link opened while signed in is\n // sent on to the app by that screen, without being spent. Left to the\n // app's router each was a page that does not exist.\n const openedLink = typeof window !== \"undefined\" ? readEmailLinkAction(window.location)?.kind : undefined;\n const linkOpensOverSession = openedLink === \"verify-email\"\n || openedLink === \"confirm-email-change\"\n || openedLink === \"magic-link\";\n\n if (!authController?.user || linkOpensOverSession) {\n const ActiveLoginView = registry.authConfig?.loginView ?? (\n <ResolvedLoginView authController={authController as AuthControllerExtended}\n logo={logo}\n logoDark={logoDark}/>\n );\n return <>{ActiveLoginView}</>;\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,eAAe,EAC3B,UACA,MACA,YAOD;CACC,MAAM,WAAW,kBAAkB;CACnC,MAAM,iBAAiB,kBAAkB;CAGzC,MAAM,oBAAoB,qBAAqB,kBAAkB,SAAS;CAE1E,IAAI,gBAAgB,gBAChB,OAAO,oBAAC,wBAAD,EAAwB,MAAM,QAAS,CAAA;CASlD,MAAM,aAAa,OAAO,WAAW,cAAc,oBAAoB,OAAO,QAAQ,CAAC,EAAE,OAAO,KAAA;CAChG,MAAM,uBAAuB,eAAe,kBACrC,eAAe,0BACf,eAAe;CAEtB,IAAI,CAAC,gBAAgB,QAAQ,sBAMzB,OAAO,oBAAA,UAAA,EAAA,UALiB,SAAS,YAAY,aACzC,oBAAC,mBAAD;EAAmC;EACzB;EACI;CAAU,CAAA,EAEA,CAAA;CAGhC,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACzB"}
@@ -16,6 +16,8 @@ export interface RebaseLayoutProps {
16
16
  defaultDrawerOpen?: boolean;
17
17
  /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */
18
18
  logo?: string;
19
+ /** The logo for the dark theme, when `logo` would not read on a dark background. Falls back to `logo`. */
20
+ logoDark?: string;
19
21
  /** Dev views passed to AdminModeSyncer (resolved from RebaseNavigation). */
20
22
  devViews?: AppView[];
21
23
  }
@@ -34,13 +34,14 @@ import { Outlet } from "react-router";
34
34
  * ```
35
35
  */
36
36
  function RebaseLayout(props) {
37
- const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, devViews = [] } = props;
37
+ const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, logoDark, devViews = [] } = props;
38
38
  const adminModeController = useAdminModeController();
39
39
  const ResolvedDrawer = useComponentOverride("Shell.Drawer", Drawer);
40
40
  const ResolvedAppBar = useComponentOverride("Shell.AppBar", DefaultAppBar);
41
41
  const ActiveAppBar = appBar ?? (ResolvedAppBar !== DefaultAppBar ? /* @__PURE__ */ jsx(ResolvedAppBar, {
42
42
  title,
43
- logo
43
+ logo,
44
+ logoDark
44
45
  }) : null);
45
46
  const ActiveDrawer = drawer ?? /* @__PURE__ */ jsx(ResolvedDrawer, {
46
47
  title,
@@ -50,6 +51,7 @@ function RebaseLayout(props) {
50
51
  autoOpenDrawer,
51
52
  defaultDrawerOpen,
52
53
  logo,
54
+ logoDark,
53
55
  children: [
54
56
  /* @__PURE__ */ jsx(AdminModeSyncer, { devViews }),
55
57
  ActiveAppBar,
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseLayout.js","names":[],"sources":["../../src/components/RebaseLayout.tsx"],"sourcesContent":["import React from \"react\";\nimport { Outlet } from \"react-router\";\nimport {\n useAdminModeController,\n useComponentOverride,\n useRebaseRegistry\n} from \"@rebasepro/app\";\n\nimport { Scaffold } from \"./app/Scaffold\";\nimport { Drawer } from \"./app/Drawer\";\nimport { DefaultAppBar } from \"./DefaultAppBar\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { AdminModeSyncer } from \"./AdminModeSyncer\";\nimport type { AppView } from \"@rebasepro/cms-types\";\n\nexport interface RebaseLayoutProps {\n /** Title shown in the drawer. */\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n /** Custom Drawer to override the default. */\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n /** Dev views passed to AdminModeSyncer (resolved from RebaseNavigation). */\n devViews?: AppView[];\n}\n\n/**\n * Layout layer — provides the Scaffold, Drawer, and SideDialogs.\n *\n * Wraps the route outlet with the standard Rebase admin layout.\n * Override the drawer via props; pass `appBar` to add a top bar (there is\n * none by default — the drawer owns navigation and user actions).\n *\n * **Independently usable**: Use this when you want the Rebase layout\n * without its default route definitions.\n *\n * It takes no children: the routed view arrives through react-router's\n * `<Outlet/>`. This example used to pass `<Route>` elements, which is neither\n * what the component renders nor something `RebaseLayoutProps` accepts — a\n * reader following it wrote a type error whose message was about `children`,\n * not about routes.\n *\n * Hand it to `<RebaseRouteDefs layout>`, which renders the routes inside it:\n *\n * @example\n * ```tsx\n * <RebaseRouteDefs layout={<RebaseLayout title=\"My Admin\" appBar={<AppBar/>}/>}>\n * <Route path=\"/custom\" element={<CustomView/>}/>\n * </RebaseRouteDefs>\n * ```\n */\nexport function RebaseLayout(props: RebaseLayoutProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n devViews = []\n } = props;\n\n const adminModeController = useAdminModeController();\n const ResolvedDrawer = useComponentOverride(\"Shell.Drawer\", Drawer);\n const ResolvedAppBar = useComponentOverride(\"Shell.AppBar\", DefaultAppBar);\n\n // There is no top bar by default, so an override of it is also the ask\n // for one: a replacement renders on its own, and a wrapper is handed the\n // default bar as `OriginalComponent`. An `appBar` element still wins, the\n // way a `drawer` element wins over a `\"Shell.Drawer\"` override.\n const ActiveAppBar = appBar ?? (ResolvedAppBar !== DefaultAppBar\n ? <ResolvedAppBar title={title} logo={logo}/>\n : null);\n\n const ActiveDrawer = drawer ?? (\n <ResolvedDrawer\n title={title}\n logoDestination={adminModeController.mode === \"studio\" ? \"/s\" : \"/\"}\n />\n );\n\n return (\n <Scaffold autoOpenDrawer={autoOpenDrawer} defaultDrawerOpen={defaultDrawerOpen} logo={logo}>\n <AdminModeSyncer devViews={devViews}/>\n {ActiveAppBar}\n {ActiveDrawer}\n <Outlet/>\n <SideDialogs/>\n </Scaffold>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,aAAa,OAA0B;CACnD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,WAAW,CAAC,MACZ;CAEJ,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,iBAAiB,qBAAqB,gBAAgB,MAAM;CAClE,MAAM,iBAAiB,qBAAqB,gBAAgB,aAAa;CAMzE,MAAM,eAAe,WAAW,mBAAmB,gBAC7C,oBAAC,gBAAD;EAAuB;EAAa;CAAM,CAAA,IAC1C;CAEN,MAAM,eAAe,UACjB,oBAAC,gBAAD;EACW;EACP,iBAAiB,oBAAoB,SAAS,WAAW,OAAO;CACnE,CAAA;CAGL,OACI,qBAAC,UAAD;EAA0B;EAAmC;EAAyB;YAAtF;GACI,oBAAC,iBAAD,EAA2B,SAAU,CAAA;GACpC;GACA;GACD,oBAAC,QAAD,CAAQ,CAAA;GACR,oBAAC,aAAD,CAAa,CAAA;EACP;;AAElB"}
1
+ {"version":3,"file":"RebaseLayout.js","names":[],"sources":["../../src/components/RebaseLayout.tsx"],"sourcesContent":["import React from \"react\";\nimport { Outlet } from \"react-router\";\nimport {\n useAdminModeController,\n useComponentOverride,\n useRebaseRegistry\n} from \"@rebasepro/app\";\n\nimport { Scaffold } from \"./app/Scaffold\";\nimport { Drawer } from \"./app/Drawer\";\nimport { DefaultAppBar } from \"./DefaultAppBar\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { AdminModeSyncer } from \"./AdminModeSyncer\";\nimport type { AppView } from \"@rebasepro/cms-types\";\n\nexport interface RebaseLayoutProps {\n /** Title shown in the drawer. */\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n /** Custom Drawer to override the default. */\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n /** The logo for the dark theme, when `logo` would not read on a dark background. Falls back to `logo`. */\n logoDark?: string;\n /** Dev views passed to AdminModeSyncer (resolved from RebaseNavigation). */\n devViews?: AppView[];\n}\n\n/**\n * Layout layer — provides the Scaffold, Drawer, and SideDialogs.\n *\n * Wraps the route outlet with the standard Rebase admin layout.\n * Override the drawer via props; pass `appBar` to add a top bar (there is\n * none by default — the drawer owns navigation and user actions).\n *\n * **Independently usable**: Use this when you want the Rebase layout\n * without its default route definitions.\n *\n * It takes no children: the routed view arrives through react-router's\n * `<Outlet/>`. This example used to pass `<Route>` elements, which is neither\n * what the component renders nor something `RebaseLayoutProps` accepts — a\n * reader following it wrote a type error whose message was about `children`,\n * not about routes.\n *\n * Hand it to `<RebaseRouteDefs layout>`, which renders the routes inside it:\n *\n * @example\n * ```tsx\n * <RebaseRouteDefs layout={<RebaseLayout title=\"My Admin\" appBar={<AppBar/>}/>}>\n * <Route path=\"/custom\" element={<CustomView/>}/>\n * </RebaseRouteDefs>\n * ```\n */\nexport function RebaseLayout(props: RebaseLayoutProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n logoDark,\n devViews = []\n } = props;\n\n const adminModeController = useAdminModeController();\n const ResolvedDrawer = useComponentOverride(\"Shell.Drawer\", Drawer);\n const ResolvedAppBar = useComponentOverride(\"Shell.AppBar\", DefaultAppBar);\n\n // There is no top bar by default, so an override of it is also the ask\n // for one: a replacement renders on its own, and a wrapper is handed the\n // default bar as `OriginalComponent`. An `appBar` element still wins, the\n // way a `drawer` element wins over a `\"Shell.Drawer\"` override.\n const ActiveAppBar = appBar ?? (ResolvedAppBar !== DefaultAppBar\n ? <ResolvedAppBar title={title} logo={logo} logoDark={logoDark}/>\n : null);\n\n const ActiveDrawer = drawer ?? (\n <ResolvedDrawer\n title={title}\n logoDestination={adminModeController.mode === \"studio\" ? \"/s\" : \"/\"}\n />\n );\n\n return (\n <Scaffold autoOpenDrawer={autoOpenDrawer} defaultDrawerOpen={defaultDrawerOpen} logo={logo} logoDark={logoDark}>\n <AdminModeSyncer devViews={devViews}/>\n {ActiveAppBar}\n {ActiveDrawer}\n <Outlet/>\n <SideDialogs/>\n </Scaffold>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,aAAa,OAA0B;CACnD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,UACA,WAAW,CAAC,MACZ;CAEJ,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,iBAAiB,qBAAqB,gBAAgB,MAAM;CAClE,MAAM,iBAAiB,qBAAqB,gBAAgB,aAAa;CAMzE,MAAM,eAAe,WAAW,mBAAmB,gBAC7C,oBAAC,gBAAD;EAAuB;EAAa;EAAgB;CAAU,CAAA,IAC9D;CAEN,MAAM,eAAe,UACjB,oBAAC,gBAAD;EACW;EACP,iBAAiB,oBAAoB,SAAS,WAAW,OAAO;CACnE,CAAA;CAGL,OACI,qBAAC,UAAD;EAA0B;EAAmC;EAAyB;EAAgB;YAAtG;GACI,oBAAC,iBAAD,EAA2B,SAAU,CAAA;GACpC;GACA;GACD,oBAAC,QAAD,CAAQ,CAAA;GACR,oBAAC,aAAD,CAAa,CAAA;EACP;;AAElB"}
@@ -11,8 +11,13 @@ export interface RebaseShellProps {
11
11
  autoOpenDrawer?: boolean;
12
12
  /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */
13
13
  defaultDrawerOpen?: boolean;
14
- /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */
14
+ /** Path to the logo shown in the drawer, the top bar and the sign-in screen. Falls back to the Rebase mark. */
15
15
  logo?: string;
16
+ /**
17
+ * The logo for the dark theme, for a logo drawn in dark ink that would
18
+ * disappear on the dark admin. Falls back to `logo`.
19
+ */
20
+ logoDark?: string;
16
21
  children?: React.ReactNode;
17
22
  }
18
23
  /**
@@ -26,28 +26,33 @@ import { MemoryRouter } from "react-router";
26
26
  * RebaseShell is sugar that composes them all with sensible defaults.
27
27
  */
28
28
  function RebaseShell(props) {
29
- const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, children } = props;
29
+ const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, logoDark, children } = props;
30
30
  const registry = useRebaseRegistry();
31
31
  const embed = useRebaseEmbedHost();
32
32
  const devViews = useMemo(() => {
33
33
  return registry.studioConfig?.devViews ?? [];
34
34
  }, [registry.studioConfig?.devViews]);
35
35
  if (embed) return /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsxs(RebaseNavigation, { children: [/* @__PURE__ */ jsx(ErrorBoundary, { children: embed.renderCms() }), /* @__PURE__ */ jsx(SideDialogs, {})] }) });
36
- return /* @__PURE__ */ jsx(RebaseAuthGate, { children: /* @__PURE__ */ jsx(RebaseNavigation, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
37
- fullPage: true,
38
- children: /* @__PURE__ */ jsx(RebaseRouteDefs, {
39
- layout: /* @__PURE__ */ jsx(RebaseLayout, {
40
- title,
41
- appBar,
42
- drawer,
43
- autoOpenDrawer,
44
- defaultDrawerOpen,
45
- logo,
46
- devViews
47
- }),
48
- children
49
- })
50
- }) }) });
36
+ return /* @__PURE__ */ jsx(RebaseAuthGate, {
37
+ logo,
38
+ logoDark,
39
+ children: /* @__PURE__ */ jsx(RebaseNavigation, { children: /* @__PURE__ */ jsx(ErrorBoundary, {
40
+ fullPage: true,
41
+ children: /* @__PURE__ */ jsx(RebaseRouteDefs, {
42
+ layout: /* @__PURE__ */ jsx(RebaseLayout, {
43
+ title,
44
+ appBar,
45
+ drawer,
46
+ autoOpenDrawer,
47
+ defaultDrawerOpen,
48
+ logo,
49
+ logoDark,
50
+ devViews
51
+ }),
52
+ children
53
+ })
54
+ }) })
55
+ });
51
56
  }
52
57
  //#endregion
53
58
  export { RebaseShell };
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseShell.js","names":[],"sources":["../../src/components/RebaseShell.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { MemoryRouter } from \"react-router\";\nimport {\n useRebaseEmbedHost,\n useRebaseRegistry\n} from \"@rebasepro/app\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\n\nimport { RebaseAuthGate } from \"./RebaseAuthGate\";\nimport { RebaseNavigation } from \"./RebaseNavigation\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { RebaseLayout } from \"./RebaseLayout\";\nimport { RebaseRouteDefs } from \"./RebaseRouteDefs\";\n\nexport interface RebaseShellProps {\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Convenience component that composes all four admin layers:\n *\n * ```\n * <RebaseAuthGate>\n * <RebaseNavigation>\n * <RebaseRouteDefs layout={<RebaseLayout>}>\n * {children}\n * </RebaseRouteDefs>\n * </RebaseNavigation>\n * </RebaseAuthGate>\n * ```\n *\n * Each layer is independently usable — see their individual docs.\n * RebaseShell is sugar that composes them all with sensible defaults.\n */\nexport function RebaseShell(props: RebaseShellProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n children\n } = props;\n\n const registry = useRebaseRegistry();\n const embed = useRebaseEmbedHost();\n\n // Compute devViews for the layout's AdminModeSyncer\n const devViews = useMemo(() => {\n return registry.studioConfig?.devViews ?? [];\n }, [registry.studioConfig?.devViews]);\n\n // In an embedding (an MCP App view, `embed_host.ts`) the person is signed\n // in by the host and there is no address bar: the providers stay, and the\n // host's screen takes the place of the gate, the routes and the layout.\n if (embed) {\n return (\n <MemoryRouter>\n <RebaseNavigation>\n <ErrorBoundary>{embed.renderCms()}</ErrorBoundary>\n {/* Where records open over the screen; the layout draws it otherwise. */}\n <SideDialogs/>\n </RebaseNavigation>\n </MemoryRouter>\n );\n }\n\n return (\n <RebaseAuthGate>\n <RebaseNavigation>\n <ErrorBoundary fullPage>\n <RebaseRouteDefs\n layout={\n <RebaseLayout\n title={title}\n appBar={appBar}\n drawer={drawer}\n autoOpenDrawer={autoOpenDrawer}\n defaultDrawerOpen={defaultDrawerOpen}\n logo={logo}\n devViews={devViews}\n />\n }\n >\n {children}\n </RebaseRouteDefs>\n </ErrorBoundary>\n </RebaseNavigation>\n </RebaseAuthGate>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,YAAY,OAAyB;CACjD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,aACA;CAEJ,MAAM,WAAW,kBAAkB;CACnC,MAAM,QAAQ,mBAAmB;CAGjC,MAAM,WAAW,cAAc;EAC3B,OAAO,SAAS,cAAc,YAAY,CAAC;CAC/C,GAAG,CAAC,SAAS,cAAc,QAAQ,CAAC;CAKpC,IAAI,OACA,OACI,oBAAC,cAAD,EAAA,UACI,qBAAC,kBAAD,EAAA,UAAA,CACI,oBAAC,eAAD,EAAA,UAAgB,MAAM,UAAU,EAAiB,CAAA,GAEjD,oBAAC,aAAD,CAAa,CAAA,CACC,EAAA,CAAA,EACR,CAAA;CAItB,OACI,oBAAC,gBAAD,EAAA,UACI,oBAAC,kBAAD,EAAA,UACI,oBAAC,eAAD;EAAe,UAAA;YACX,oBAAC,iBAAD;GACI,QACI,oBAAC,cAAD;IACW;IACC;IACA;IACQ;IACG;IACb;IACI;GACb,CAAA;GAGJ;EACY,CAAA;CACN,CAAA,EACD,CAAA,EACN,CAAA;AAExB"}
1
+ {"version":3,"file":"RebaseShell.js","names":[],"sources":["../../src/components/RebaseShell.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { MemoryRouter } from \"react-router\";\nimport {\n useRebaseEmbedHost,\n useRebaseRegistry\n} from \"@rebasepro/app\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\n\nimport { RebaseAuthGate } from \"./RebaseAuthGate\";\nimport { RebaseNavigation } from \"./RebaseNavigation\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { RebaseLayout } from \"./RebaseLayout\";\nimport { RebaseRouteDefs } from \"./RebaseRouteDefs\";\n\nexport interface RebaseShellProps {\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer, the top bar and the sign-in screen. Falls back to the Rebase mark. */\n logo?: string;\n /**\n * The logo for the dark theme, for a logo drawn in dark ink that would\n * disappear on the dark admin. Falls back to `logo`.\n */\n logoDark?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Convenience component that composes all four admin layers:\n *\n * ```\n * <RebaseAuthGate>\n * <RebaseNavigation>\n * <RebaseRouteDefs layout={<RebaseLayout>}>\n * {children}\n * </RebaseRouteDefs>\n * </RebaseNavigation>\n * </RebaseAuthGate>\n * ```\n *\n * Each layer is independently usable — see their individual docs.\n * RebaseShell is sugar that composes them all with sensible defaults.\n */\nexport function RebaseShell(props: RebaseShellProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n logoDark,\n children\n } = props;\n\n const registry = useRebaseRegistry();\n const embed = useRebaseEmbedHost();\n\n // Compute devViews for the layout's AdminModeSyncer\n const devViews = useMemo(() => {\n return registry.studioConfig?.devViews ?? [];\n }, [registry.studioConfig?.devViews]);\n\n // In an embedding (an MCP App view, `embed_host.ts`) the person is signed\n // in by the host and there is no address bar: the providers stay, and the\n // host's screen takes the place of the gate, the routes and the layout.\n if (embed) {\n return (\n <MemoryRouter>\n <RebaseNavigation>\n <ErrorBoundary>{embed.renderCms()}</ErrorBoundary>\n {/* Where records open over the screen; the layout draws it otherwise. */}\n <SideDialogs/>\n </RebaseNavigation>\n </MemoryRouter>\n );\n }\n\n return (\n <RebaseAuthGate logo={logo} logoDark={logoDark}>\n <RebaseNavigation>\n <ErrorBoundary fullPage>\n <RebaseRouteDefs\n layout={\n <RebaseLayout\n title={title}\n appBar={appBar}\n drawer={drawer}\n autoOpenDrawer={autoOpenDrawer}\n defaultDrawerOpen={defaultDrawerOpen}\n logo={logo}\n logoDark={logoDark}\n devViews={devViews}\n />\n }\n >\n {children}\n </RebaseRouteDefs>\n </ErrorBoundary>\n </RebaseNavigation>\n </RebaseAuthGate>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,YAAY,OAAyB;CACjD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,UACA,aACA;CAEJ,MAAM,WAAW,kBAAkB;CACnC,MAAM,QAAQ,mBAAmB;CAGjC,MAAM,WAAW,cAAc;EAC3B,OAAO,SAAS,cAAc,YAAY,CAAC;CAC/C,GAAG,CAAC,SAAS,cAAc,QAAQ,CAAC;CAKpC,IAAI,OACA,OACI,oBAAC,cAAD,EAAA,UACI,qBAAC,kBAAD,EAAA,UAAA,CACI,oBAAC,eAAD,EAAA,UAAgB,MAAM,UAAU,EAAiB,CAAA,GAEjD,oBAAC,aAAD,CAAa,CAAA,CACC,EAAA,CAAA,EACR,CAAA;CAItB,OACI,oBAAC,gBAAD;EAAsB;EAAgB;YAClC,oBAAC,kBAAD,EAAA,UACI,oBAAC,eAAD;GAAe,UAAA;aACX,oBAAC,iBAAD;IACI,QACI,oBAAC,cAAD;KACW;KACC;KACA;KACQ;KACG;KACb;KACI;KACA;IACb,CAAA;IAGJ;GACY,CAAA;EACN,CAAA,EACD,CAAA;CACN,CAAA;AAExB"}
@@ -610,7 +610,7 @@ function InnerCheckBox({ checked }) {
610
610
  return /* @__PURE__ */ jsx("div", {
611
611
  className: cls("p-2 w-8 h-8 inline-flex items-center justify-center text-sm font-medium focus:outline-hidden transition-colors ease-in-out duration-150"),
612
612
  children: /* @__PURE__ */ jsx("div", {
613
- className: cls("border-2 relative transition-colors ease-in-out duration-150 w-4 h-4 rounded-xs flex items-center justify-center", checked ? "bg-primary text-surface-accent-100 dark:text-surface-accent-900 border-transparent" : "bg-surface-card border-surface-accent-800 dark:border-surface-accent-500"),
613
+ className: cls("border-2 relative transition-colors ease-in-out duration-150 w-4 h-4 rounded-xs flex items-center justify-center", checked ? "bg-primary text-on-primary border-transparent" : "bg-surface-card border-surface-accent-800 dark:border-surface-accent-500"),
614
614
  children: checked && /* @__PURE__ */ jsx(CheckIcon, {
615
615
  size: iconSize.smallest,
616
616
  className: "absolute"