@fluid-app/rep-core 0.1.15 → 0.1.17

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 (128) hide show
  1. package/dist/data-sources/DataAwareWidget.cjs.map +1 -1
  2. package/dist/data-sources/DataAwareWidget.d.cts +6 -20
  3. package/dist/data-sources/DataAwareWidget.d.cts.map +1 -1
  4. package/dist/data-sources/DataAwareWidget.d.mts +6 -20
  5. package/dist/data-sources/DataAwareWidget.d.mts.map +1 -1
  6. package/dist/data-sources/DataAwareWidget.mjs.map +1 -1
  7. package/dist/data-sources/ErrorState.cjs.map +1 -1
  8. package/dist/data-sources/ErrorState.d.cts +2 -2
  9. package/dist/data-sources/ErrorState.d.cts.map +1 -1
  10. package/dist/data-sources/ErrorState.d.mts +2 -2
  11. package/dist/data-sources/ErrorState.d.mts.map +1 -1
  12. package/dist/data-sources/ErrorState.mjs.map +1 -1
  13. package/dist/data-sources/context.cjs.map +1 -1
  14. package/dist/data-sources/context.d.cts +2 -3
  15. package/dist/data-sources/context.d.cts.map +1 -1
  16. package/dist/data-sources/context.d.mts +2 -3
  17. package/dist/data-sources/context.d.mts.map +1 -1
  18. package/dist/data-sources/context.mjs.map +1 -1
  19. package/dist/data-sources/fetchers/api.d.cts +3 -3
  20. package/dist/data-sources/fetchers/api.d.mts +3 -3
  21. package/dist/data-sources/fetchers/custom.d.cts +10 -10
  22. package/dist/data-sources/fetchers/custom.d.mts +10 -10
  23. package/dist/data-sources/fetchers/static.d.cts +20 -20
  24. package/dist/data-sources/fetchers/static.d.cts.map +1 -1
  25. package/dist/data-sources/fetchers/static.d.mts +20 -20
  26. package/dist/data-sources/fetchers/static.d.mts.map +1 -1
  27. package/dist/data-sources/preview-context.cjs.map +1 -1
  28. package/dist/data-sources/preview-context.d.cts +1 -3
  29. package/dist/data-sources/preview-context.d.cts.map +1 -1
  30. package/dist/data-sources/preview-context.d.mts +1 -3
  31. package/dist/data-sources/preview-context.d.mts.map +1 -1
  32. package/dist/data-sources/preview-context.mjs.map +1 -1
  33. package/dist/data-sources/registry-context.cjs.map +1 -1
  34. package/dist/data-sources/registry-context.d.cts +14 -15
  35. package/dist/data-sources/registry-context.d.cts.map +1 -1
  36. package/dist/data-sources/registry-context.d.mts +14 -15
  37. package/dist/data-sources/registry-context.d.mts.map +1 -1
  38. package/dist/data-sources/registry-context.mjs.map +1 -1
  39. package/dist/data-sources/registry.cjs.map +1 -1
  40. package/dist/data-sources/registry.d.cts +4 -4
  41. package/dist/data-sources/registry.d.cts.map +1 -1
  42. package/dist/data-sources/registry.d.mts +4 -4
  43. package/dist/data-sources/registry.d.mts.map +1 -1
  44. package/dist/data-sources/registry.mjs.map +1 -1
  45. package/dist/data-sources/transformers.d.cts +3 -3
  46. package/dist/data-sources/transformers.d.mts +3 -3
  47. package/dist/data-sources/types.d.cts +1 -1
  48. package/dist/data-sources/types.d.mts +1 -1
  49. package/dist/data-sources/use-widget-data.d.cts +4 -4
  50. package/dist/data-sources/use-widget-data.d.cts.map +1 -1
  51. package/dist/data-sources/use-widget-data.d.mts +4 -4
  52. package/dist/data-sources/use-widget-data.d.mts.map +1 -1
  53. package/dist/{index-Bxe_LIi8.d.cts → index-Bgv8HUpo.d.cts} +36 -77
  54. package/dist/index-Bgv8HUpo.d.cts.map +1 -0
  55. package/dist/{index-CCAu2n19.d.mts → index-Ka_HOwpb.d.mts} +36 -77
  56. package/dist/index-Ka_HOwpb.d.mts.map +1 -0
  57. package/dist/registries/index.cjs.map +1 -1
  58. package/dist/registries/index.d.cts +86 -86
  59. package/dist/registries/index.d.cts.map +1 -1
  60. package/dist/registries/index.d.mts +86 -86
  61. package/dist/registries/index.d.mts.map +1 -1
  62. package/dist/registries/index.mjs.map +1 -1
  63. package/dist/shell/AppShellLayout.cjs.map +1 -1
  64. package/dist/shell/AppShellLayout.d.cts +15 -16
  65. package/dist/shell/AppShellLayout.d.cts.map +1 -1
  66. package/dist/shell/AppShellLayout.d.mts +15 -16
  67. package/dist/shell/AppShellLayout.d.mts.map +1 -1
  68. package/dist/shell/AppShellLayout.mjs.map +1 -1
  69. package/dist/shell/ScreenHeader.cjs.map +1 -1
  70. package/dist/shell/ScreenHeader.d.cts +2 -2
  71. package/dist/shell/ScreenHeader.d.cts.map +1 -1
  72. package/dist/shell/ScreenHeader.d.mts +2 -2
  73. package/dist/shell/ScreenHeader.d.mts.map +1 -1
  74. package/dist/shell/ScreenHeader.mjs.map +1 -1
  75. package/dist/shell/ScreenHeaderContext.cjs.map +1 -1
  76. package/dist/shell/ScreenHeaderContext.d.cts +17 -18
  77. package/dist/shell/ScreenHeaderContext.d.cts.map +1 -1
  78. package/dist/shell/ScreenHeaderContext.d.mts +17 -18
  79. package/dist/shell/ScreenHeaderContext.d.mts.map +1 -1
  80. package/dist/shell/ScreenHeaderContext.mjs.map +1 -1
  81. package/dist/shell/ThemeModeContext.cjs.map +1 -1
  82. package/dist/shell/ThemeModeContext.d.cts +2 -3
  83. package/dist/shell/ThemeModeContext.d.cts.map +1 -1
  84. package/dist/shell/ThemeModeContext.d.mts +2 -3
  85. package/dist/shell/ThemeModeContext.d.mts.map +1 -1
  86. package/dist/shell/ThemeModeContext.mjs.map +1 -1
  87. package/dist/shell/sidebar.cjs.map +1 -1
  88. package/dist/shell/sidebar.d.cts +47 -37
  89. package/dist/shell/sidebar.d.cts.map +1 -1
  90. package/dist/shell/sidebar.d.mts +47 -37
  91. package/dist/shell/sidebar.d.mts.map +1 -1
  92. package/dist/shell/sidebar.mjs +32 -32
  93. package/dist/shell/sidebar.mjs.map +1 -1
  94. package/dist/shell/use-mobile.cjs.map +1 -1
  95. package/dist/shell/use-mobile.mjs.map +1 -1
  96. package/dist/theme/index.cjs +1 -0
  97. package/dist/theme/index.cjs.map +1 -1
  98. package/dist/theme/index.d.cts +54 -54
  99. package/dist/theme/index.d.cts.map +1 -1
  100. package/dist/theme/index.d.mts +54 -54
  101. package/dist/theme/index.d.mts.map +1 -1
  102. package/dist/theme/index.mjs +1 -0
  103. package/dist/theme/index.mjs.map +1 -1
  104. package/dist/types/index.d.cts +3 -3
  105. package/dist/types/index.d.mts +3 -3
  106. package/dist/{types-ByG6Xy3C.d.mts → types-27AHMek-.d.cts} +4 -4
  107. package/dist/{types-ByG6Xy3C.d.mts.map → types-27AHMek-.d.cts.map} +1 -1
  108. package/dist/types-BXFX9bXp.cjs.map +1 -1
  109. package/dist/types-Bjmd7Fdx.mjs.map +1 -1
  110. package/dist/{types-BIXtQlHB.d.cts → types-C5Zs5V3E.d.mts} +29 -29
  111. package/dist/types-C5Zs5V3E.d.mts.map +1 -0
  112. package/dist/{types-Ctu-Zio6.d.cts → types-CeCPKvOv.d.mts} +4 -4
  113. package/dist/{types-Ctu-Zio6.d.cts.map → types-CeCPKvOv.d.mts.map} +1 -1
  114. package/dist/{types-C5OFJy-O.d.mts → types-DrzvahW8.d.cts} +29 -29
  115. package/dist/types-DrzvahW8.d.cts.map +1 -0
  116. package/dist/{widget-schema--PY1uMWx.d.cts → widget-schema-BKZgsNG7.d.mts} +59 -59
  117. package/dist/widget-schema-BKZgsNG7.d.mts.map +1 -0
  118. package/dist/{widget-schema-YkD5p3v4.d.mts → widget-schema-BSX2fVhW.d.cts} +59 -59
  119. package/dist/widget-schema-BSX2fVhW.d.cts.map +1 -0
  120. package/dist/widget-utils/index.d.cts +20 -20
  121. package/dist/widget-utils/index.d.mts +20 -20
  122. package/package.json +1 -1
  123. package/dist/index-Bxe_LIi8.d.cts.map +0 -1
  124. package/dist/index-CCAu2n19.d.mts.map +0 -1
  125. package/dist/types-BIXtQlHB.d.cts.map +0 -1
  126. package/dist/types-C5OFJy-O.d.mts.map +0 -1
  127. package/dist/widget-schema--PY1uMWx.d.cts.map +0 -1
  128. package/dist/widget-schema-YkD5p3v4.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.mjs","names":[],"sources":["../../src/shell/sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nimport * as React from \"react\";\n\nimport { useIsMobile } from \"./use-mobile\";\n\n// ---------------------------------------------------------------------------\n// Inlined utilities (avoid importing from builder's UI kit)\n// ---------------------------------------------------------------------------\n\nfunction cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n ...props\n}: React.ComponentPropsWithRef<\"div\"> & {\n orientation?: \"horizontal\" | \"vertical\";\n decorative?: boolean;\n}) {\n return (\n <div\n role=\"separator\"\n aria-orientation={orientation}\n className={cn(\n \"bg-border shrink-0\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"bg-muted animate-pulse rounded-md\", className)}\n {...props}\n />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst SIDEBAR_WIDTH = \"13rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\n// ---------------------------------------------------------------------------\n// Sidebar Context\n// ---------------------------------------------------------------------------\n\ntype SidebarContextValue = {\n state: \"expanded\" | \"collapsed\";\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n isPreviewMode: boolean;\n useBottomNav: boolean;\n};\n\nexport const SidebarContext = React.createContext<SidebarContextValue | null>(\n null,\n);\n\nfunction useSidebar(): SidebarContextValue {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n }\n\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// SidebarProvider\n// ---------------------------------------------------------------------------\n\nconst SidebarProvider = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n viewportWidth?: number;\n previewMode?: boolean;\n useBottomNav?: boolean;\n }\n>(\n (\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n viewportWidth,\n previewMode,\n useBottomNav: useBottomNavProp = false,\n className,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const windowIsMobile = useIsMobile();\n // Use viewportWidth if provided, otherwise use actual window detection\n const isMobile =\n viewportWidth !== undefined ? viewportWidth < 768 : windowIsMobile;\n // Preview mode is active when viewportWidth is provided\n const isPreviewMode = viewportWidth !== undefined || !!previewMode;\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = React.useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open],\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = React.useCallback(() => {\n return isMobile\n ? setOpenMobile((open) => !open)\n : setOpen((open) => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n // check if composer is focused - if so, let the composer handle the shortcut\n const activeElement = document.activeElement;\n const isComposerFocused =\n activeElement?.closest(\".group\\\\/composer\") ||\n activeElement?.closest(\"[data-toolbar]\") ||\n activeElement?.classList.contains(\"ProseMirror\");\n\n if (isComposerFocused) {\n return; // let the composer handle the shortcut\n }\n\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? \"expanded\" : \"collapsed\";\n\n const contextValue = React.useMemo<SidebarContextValue>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n isPreviewMode,\n useBottomNav: useBottomNavProp,\n }),\n [\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n isPreviewMode,\n useBottomNavProp,\n ],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper flex min-h-0 w-full flex-1\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n );\n },\n);\nSidebarProvider.displayName = \"SidebarProvider\";\n\n// ---------------------------------------------------------------------------\n// Sidebar\n// ---------------------------------------------------------------------------\n\nconst Sidebar = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n }\n>(\n (\n {\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const {\n isMobile,\n state,\n openMobile,\n setOpenMobile,\n isPreviewMode,\n useBottomNav,\n } = useSidebar();\n\n // Define CSS variables for expanded and collapsed sidebar widths\n const sidebarWidth =\n state === \"expanded\" ? SIDEBAR_WIDTH : SIDEBAR_WIDTH_ICON;\n\n // When bottom nav is active on mobile, hide the sidebar entirely\n if (useBottomNav && isMobile) {\n return null;\n }\n\n if (collapsible === \"none\") {\n return (\n <div\n className={cn(\n \"bg-sidebar text-sidebar-foreground flex w-(--sidebar-width) flex-col rounded-tl-lg\",\n isPreviewMode ? \"h-full\" : \"h-[97vh]\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n // For mobile, render a slide-out sidebar with overlay\n // Use absolute positioning in preview mode so it stays within the preview container\n const positionClass = isPreviewMode ? \"absolute\" : \"fixed\";\n return (\n <>\n {/* Overlay - only visible when sidebar is open */}\n {openMobile && (\n <div\n className={cn(positionClass, \"inset-0 z-40 bg-black/50\")}\n onClick={() => setOpenMobile(false)}\n aria-hidden=\"true\"\n />\n )}\n\n {/* Sidebar - slides in from left */}\n <div\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className={cn(\n positionClass,\n \"bg-sidebar text-sidebar-foreground top-0 left-0 z-50 h-full w-[--sidebar-width] p-0 transition-transform duration-300 ease-in-out\",\n openMobile ? \"translate-x-0\" : \"-translate-x-full\",\n className,\n )}\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n ref={ref}\n {...props}\n >\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </div>\n </>\n );\n }\n\n return (\n <div\n ref={ref}\n className=\"group peer bg-sidebar text-sidebar-foreground hidden md:block\"\n data-state={state}\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n style={\n {\n \"--sidebar-width\": sidebarWidth,\n } as React.CSSProperties\n }\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n className={cn(\n \"relative bg-transparent transition-[width] duration-200 ease-linear\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n )}\n />\n <div\n className={cn(\n \"relative inset-y-0 z-[20] hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex\",\n isPreviewMode ? \"h-full\" : \"h-svh\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n // Adjust the padding for floating and inset variants.\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=right]:border-l\",\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n },\n);\nSidebar.displayName = \"Sidebar\";\n\n// ---------------------------------------------------------------------------\n// SidebarRail\n// ---------------------------------------------------------------------------\n\nconst SidebarRail = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\">\n>(({ className, ...props }, ref) => {\n const { toggleSidebar } = useSidebar();\n\n return (\n <button\n ref={ref}\n data-sidebar=\"rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"hover:after:bg-sidebar-border absolute inset-y-0 z-[10] hidden w-4 -translate-x-full transition-all ease-linear group-data-[side=left]:-right-[1.375rem] group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n \"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarRail.displayName = \"SidebarRail\";\n\n// ---------------------------------------------------------------------------\n// SidebarInset\n// ---------------------------------------------------------------------------\n\nconst SidebarInset = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"main\">\n>(({ className, ...props }, ref) => {\n const { isPreviewMode } = useSidebar();\n return (\n <main\n ref={ref}\n className={cn(\n \"relative flex flex-1 flex-col\",\n isPreviewMode\n ? \"max-h-[calc(100svh-(--spacing(13)))]\"\n : \"min-h-svh peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))]\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarInset.displayName = \"SidebarInset\";\n\n// ---------------------------------------------------------------------------\n// SidebarInput\n// ---------------------------------------------------------------------------\n\nconst SidebarInput = React.forwardRef<\n HTMLInputElement,\n React.ComponentProps<\"input\">\n>(({ className, ...props }, ref) => {\n return (\n <input\n ref={ref}\n data-sidebar=\"input\"\n className={cn(\n \"bg-background focus-visible:ring-sidebar-ring h-8 w-full rounded-md border px-3 text-sm shadow-none focus-visible:ring-2 focus-visible:outline-none\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarInput.displayName = \"SidebarInput\";\n\n// ---------------------------------------------------------------------------\n// SidebarHeader / Footer\n// ---------------------------------------------------------------------------\n\nconst SidebarHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"header\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n});\nSidebarHeader.displayName = \"SidebarHeader\";\n\nconst SidebarFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"footer\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n});\nSidebarFooter.displayName = \"SidebarFooter\";\n\n// ---------------------------------------------------------------------------\n// SidebarSeparator\n// ---------------------------------------------------------------------------\n\nconst SidebarSeparator = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n orientation?: \"horizontal\" | \"vertical\";\n }\n>(({ className, ...props }, ref) => {\n return (\n <Separator\n ref={ref}\n data-sidebar=\"separator\"\n className={cn(\"bg-sidebar-border mx-2 w-auto\", className)}\n {...props}\n />\n );\n});\nSidebarSeparator.displayName = \"SidebarSeparator\";\n\n// ---------------------------------------------------------------------------\n// SidebarContent\n// ---------------------------------------------------------------------------\n\nconst SidebarContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"content\"\n className={cn(\n \"scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-auto rounded group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:overflow-hidden group-data-[collapsible=icon]:pt-3\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarContent.displayName = \"SidebarContent\";\n\n// ---------------------------------------------------------------------------\n// SidebarGroup\n// ---------------------------------------------------------------------------\n\nconst SidebarGroup = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"group\"\n className={cn(\n \"relative flex w-full min-w-0 flex-col p-2 group-data-[collapsible=icon]:py-0 group-data-[collapsible=icon]:pt-4\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroup.displayName = \"SidebarGroup\";\n\nconst SidebarGroupLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-label\"\n className={cn(\n \"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupLabel.displayName = \"SidebarGroupLabel\";\n\nconst SidebarGroupAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-action\"\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupAction.displayName = \"SidebarGroupAction\";\n\nconst SidebarGroupContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"group-content\"\n className={cn(\"w-full text-sm\", className)}\n {...props}\n />\n));\nSidebarGroupContent.displayName = \"SidebarGroupContent\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenu\n// ---------------------------------------------------------------------------\n\nconst SidebarMenu = React.forwardRef<\n HTMLUListElement,\n React.ComponentProps<\"ul\">\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu\"\n className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n {...props}\n />\n));\nSidebarMenu.displayName = \"SidebarMenu\";\n\nconst SidebarMenuItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentProps<\"li\">\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n data-sidebar=\"menu-item\"\n className={cn(\"group/menu-item relative\", className)}\n {...props}\n />\n));\nSidebarMenuItem.displayName = \"SidebarMenuItem\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenuButton\n// ---------------------------------------------------------------------------\n\nconst sidebarMenuButtonVariants = cva(\n \"peer/menu-button ring-sidebar-ring hover:bg-sidebar-primary hover:text-sidebar-primary-foreground active:bg-sidebar-primary active:text-sidebar-primary-foreground data-[active=true]:bg-sidebar-primary data-[active=true]:text-sidebar-primary-foreground data-[state=open]:hover:bg-sidebar-primary data-[state=open]:hover:text-sidebar-primary-foreground flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"hover:bg-sidebar-primary hover:text-sidebar-primary-foreground\",\n outline:\n \"hover:bg-sidebar-primary hover:text-sidebar-primary-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-primary))]\",\n },\n size: {\n default: \"h-8 text-sm\",\n sm: \"h-7 text-xs\",\n lg: \"h-12 text-sm group-data-[collapsible=icon]:p-0!\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nconst SidebarMenuButton = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n } & VariantProps<typeof sidebarMenuButtonVariants>\n>(\n (\n {\n asChild = false,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n className,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n\n const button = (\n <Comp\n ref={ref}\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n return button;\n },\n);\nSidebarMenuButton.displayName = \"SidebarMenuButton\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenuAction / Badge / Skeleton\n// ---------------------------------------------------------------------------\n\nconst SidebarMenuAction = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n showOnHover?: boolean;\n }\n>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-action\"\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n showOnHover &&\n \"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarMenuAction.displayName = \"SidebarMenuAction\";\n\nconst SidebarMenuBadge = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"menu-badge\"\n className={cn(\n \"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none\",\n \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n));\nSidebarMenuBadge.displayName = \"SidebarMenuBadge\";\n\nconst SidebarMenuSkeleton = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n showIcon?: boolean;\n }\n>(({ className, showIcon = false, ...props }, ref) => {\n // Random width between 50 to 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n ref={ref}\n data-sidebar=\"menu-skeleton\"\n className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n {...props}\n >\n {showIcon && (\n <Skeleton\n className=\"size-4 rounded-md\"\n data-sidebar=\"menu-skeleton-icon\"\n />\n )}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n );\n});\nSidebarMenuSkeleton.displayName = \"SidebarMenuSkeleton\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenuSub\n// ---------------------------------------------------------------------------\n\nconst SidebarMenuSub = React.forwardRef<\n HTMLUListElement,\n React.ComponentProps<\"ul\">\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu-sub\"\n className={cn(\n \"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n));\nSidebarMenuSub.displayName = \"SidebarMenuSub\";\n\nconst SidebarMenuSubItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentProps<\"li\">\n>(({ ...props }, ref) => <li ref={ref} {...props} />);\nSidebarMenuSubItem.displayName = \"SidebarMenuSubItem\";\n\nconst SidebarMenuSubButton = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentProps<\"a\"> & {\n asChild?: boolean;\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n }\n>(({ asChild = false, size = \"md\", isActive, className, ...props }, ref) => {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n size === \"sm\" && \"text-xs\",\n size === \"md\" && \"text-sm\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarMenuSubButton.displayName = \"SidebarMenuSubButton\";\n\n// ---------------------------------------------------------------------------\n// Exports\n// ---------------------------------------------------------------------------\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n useSidebar,\n};\n"],"mappings":";;;;;;;;;AAcA,SAAS,GAAG,GAAG,QAAsB;AACnC,QAAO,QAAQ,KAAK,OAAO,CAAC;;AAG9B,SAAS,UAAU,EACjB,WACA,cAAc,cACd,GAAG,SAIF;AACD,QACE,oBAAC,OAAD;EACE,MAAK;EACL,oBAAkB;EAClB,WAAW,GACT,sBACA,gBAAgB,eAAe,gBAAgB,eAC/C,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,SAAS,EAChB,WACA,GAAG,SACoC;AACvC,QACE,oBAAC,OAAD;EACE,WAAW,GAAG,qCAAqC,UAAU;EAC7D,GAAI;EACJ,CAAA;;AAQN,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAC3B,MAAM,4BAA4B;AAkBlC,MAAa,iBAAiB,MAAM,cAClC,KACD;AAED,SAAS,aAAkC;CACzC,MAAM,UAAU,MAAM,WAAW,eAAe;AAChD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAoD;AAGtE,QAAO;;AAOT,MAAM,kBAAkB,MAAM,YAY1B,EACE,cAAc,MACd,MAAM,UACN,cAAc,aACd,eACA,aACA,cAAc,mBAAmB,OACjC,WACA,OACA,UACA,GAAG,SAEL,QACG;CACH,MAAM,iBAAiB,aAAa;CAEpC,MAAM,WACJ,kBAAkB,KAAA,IAAY,gBAAgB,MAAM;CAEtD,MAAM,gBAAgB,kBAAkB,KAAA,KAAa,CAAC,CAAC;CACvD,MAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS,MAAM;CAIzD,MAAM,CAAC,OAAO,YAAY,MA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MG,YACC,oBAAC,UAAD;GACE,WAAU;GACV,gBAAa;GACb,CAAA,EAEJ,oBAAC,UAAD;GACE,WAAU;GACV,gBAAa;GACb,OACE,EACE,oBAAoB,OACrB;GAEH,CAAA,CACE;;EAER;AACF,oBAAoB,cAAc;AAMlC,MAAM,iBAAiB,MAAM,YAG1B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CACO;CACL,gBAAa;CACb,WAAW,GACT,kGACA,wCACA,UACD;CACD,GAAI;CACJ,CAAA,CACF;AACF,eAAe,cAAc;AAE7B,MAAM,qBAAqB,MAAM,YAG9B,EAAE,GAAG,SAAS,QAAQ,oBAAC,MAAD;CAAS;CAAK,GAAI;CAAS,CAAA,CAAC;AACrD,mBAAmB,cAAc;AAEjC,MAAM,uBAAuB,MAAM,YAOhC,EAAE,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SAAS,QAAQ;AAG1E,QACE,oBAHW,UAAU,OAAO,KAG5B;EACO;EACL,gBAAa;EACb,aAAW;EACX,eAAa;EACb,WAAW,GACT,ifACA,0FACA,SAAS,QAAQ,WACjB,SAAS,QAAQ,WACjB,wCACA,UACD;EACD,GAAI;EACJ,CAAA;EAEJ;AACF,qBAAqB,cAAc"}
1
+ {"version":3,"file":"sidebar.mjs","names":["React"],"sources":["../../src/shell/sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nimport * as React from \"react\";\n\nimport { useIsMobile } from \"./use-mobile\";\n\n// ---------------------------------------------------------------------------\n// Inlined utilities (avoid importing from builder's UI kit)\n// ---------------------------------------------------------------------------\n\nfunction cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nfunction Separator({\n className,\n orientation = \"horizontal\",\n ...props\n}: React.ComponentPropsWithRef<\"div\"> & {\n orientation?: \"horizontal\" | \"vertical\";\n decorative?: boolean;\n}) {\n return (\n <div\n role=\"separator\"\n aria-orientation={orientation}\n className={cn(\n \"bg-border shrink-0\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"bg-muted animate-pulse rounded-md\", className)}\n {...props}\n />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nconst SIDEBAR_WIDTH = \"13rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\n// ---------------------------------------------------------------------------\n// Sidebar Context\n// ---------------------------------------------------------------------------\n\ntype SidebarContextValue = {\n state: \"expanded\" | \"collapsed\";\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n isPreviewMode: boolean;\n useBottomNav: boolean;\n};\n\nexport const SidebarContext: React.Context<SidebarContextValue | null> =\n React.createContext<SidebarContextValue | null>(null);\n\nfunction useSidebar(): SidebarContextValue {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n }\n\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// SidebarProvider\n// ---------------------------------------------------------------------------\n\nconst SidebarProvider: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n viewportWidth?: number;\n previewMode?: boolean;\n useBottomNav?: boolean;\n } & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n viewportWidth?: number;\n previewMode?: boolean;\n useBottomNav?: boolean;\n }\n>(\n (\n {\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n viewportWidth,\n previewMode,\n useBottomNav: useBottomNavProp = false,\n className,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const windowIsMobile = useIsMobile();\n // Use viewportWidth if provided, otherwise use actual window detection\n const isMobile =\n viewportWidth !== undefined ? viewportWidth < 768 : windowIsMobile;\n // Preview mode is active when viewportWidth is provided\n const isPreviewMode = viewportWidth !== undefined || !!previewMode;\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = React.useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open],\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = React.useCallback(() => {\n return isMobile\n ? setOpenMobile((open) => !open)\n : setOpen((open) => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n // check if composer is focused - if so, let the composer handle the shortcut\n const activeElement = document.activeElement;\n const isComposerFocused =\n activeElement?.closest(\".group\\\\/composer\") ||\n activeElement?.closest(\"[data-toolbar]\") ||\n activeElement?.classList.contains(\"ProseMirror\");\n\n if (isComposerFocused) {\n return; // let the composer handle the shortcut\n }\n\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? \"expanded\" : \"collapsed\";\n\n const contextValue = React.useMemo<SidebarContextValue>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n isPreviewMode,\n useBottomNav: useBottomNavProp,\n }),\n [\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n isPreviewMode,\n useBottomNavProp,\n ],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper flex min-h-0 w-full flex-1\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n );\n },\n);\nSidebarProvider.displayName = \"SidebarProvider\";\n\n// ---------------------------------------------------------------------------\n// Sidebar\n// ---------------------------------------------------------------------------\n\nconst Sidebar: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n } & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n }\n>(\n (\n {\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const {\n isMobile,\n state,\n openMobile,\n setOpenMobile,\n isPreviewMode,\n useBottomNav,\n } = useSidebar();\n\n // Define CSS variables for expanded and collapsed sidebar widths\n const sidebarWidth =\n state === \"expanded\" ? SIDEBAR_WIDTH : SIDEBAR_WIDTH_ICON;\n\n // When bottom nav is active on mobile, hide the sidebar entirely\n if (useBottomNav && isMobile) {\n return null;\n }\n\n if (collapsible === \"none\") {\n return (\n <div\n className={cn(\n \"bg-sidebar text-sidebar-foreground flex w-(--sidebar-width) flex-col rounded-tl-lg\",\n isPreviewMode ? \"h-full\" : \"h-[97vh]\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n // For mobile, render a slide-out sidebar with overlay\n // Use absolute positioning in preview mode so it stays within the preview container\n const positionClass = isPreviewMode ? \"absolute\" : \"fixed\";\n return (\n <>\n {/* Overlay - only visible when sidebar is open */}\n {openMobile && (\n <div\n className={cn(positionClass, \"inset-0 z-40 bg-black/50\")}\n onClick={() => setOpenMobile(false)}\n aria-hidden=\"true\"\n />\n )}\n\n {/* Sidebar - slides in from left */}\n <div\n data-sidebar=\"sidebar\"\n data-mobile=\"true\"\n className={cn(\n positionClass,\n \"bg-sidebar text-sidebar-foreground top-0 left-0 z-50 h-full w-[--sidebar-width] p-0 transition-transform duration-300 ease-in-out\",\n openMobile ? \"translate-x-0\" : \"-translate-x-full\",\n className,\n )}\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n ref={ref}\n {...props}\n >\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </div>\n </>\n );\n }\n\n return (\n <div\n ref={ref}\n className=\"group peer bg-sidebar text-sidebar-foreground hidden md:block\"\n data-state={state}\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n style={\n {\n \"--sidebar-width\": sidebarWidth,\n } as React.CSSProperties\n }\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n className={cn(\n \"relative bg-transparent transition-[width] duration-200 ease-linear\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n )}\n />\n <div\n className={cn(\n \"relative inset-y-0 z-[20] hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex\",\n isPreviewMode ? \"h-full\" : \"h-svh\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n // Adjust the padding for floating and inset variants.\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=right]:border-l\",\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n className=\"group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n },\n);\nSidebar.displayName = \"Sidebar\";\n\n// ---------------------------------------------------------------------------\n// SidebarRail\n// ---------------------------------------------------------------------------\n\nconst SidebarRail: React.ForwardRefExoticComponent<\n React.ComponentProps<\"button\"> & React.RefAttributes<HTMLButtonElement>\n> = React.forwardRef<HTMLButtonElement, React.ComponentProps<\"button\">>(\n ({ className, ...props }, ref) => {\n const { toggleSidebar } = useSidebar();\n\n return (\n <button\n ref={ref}\n data-sidebar=\"rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"hover:after:bg-sidebar-border absolute inset-y-0 z-[10] hidden w-4 -translate-x-full transition-all ease-linear group-data-[side=left]:-right-[1.375rem] group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n \"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarRail.displayName = \"SidebarRail\";\n\n// ---------------------------------------------------------------------------\n// SidebarInset\n// ---------------------------------------------------------------------------\n\nconst SidebarInset: React.ForwardRefExoticComponent<\n React.ComponentProps<\"main\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"main\">>(\n ({ className, ...props }, ref) => {\n const { isPreviewMode } = useSidebar();\n return (\n <main\n ref={ref}\n className={cn(\n \"relative flex flex-1 flex-col\",\n isPreviewMode\n ? \"max-h-[calc(100svh-(--spacing(13)))]\"\n : \"min-h-svh peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))]\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarInset.displayName = \"SidebarInset\";\n\n// ---------------------------------------------------------------------------\n// SidebarInput\n// ---------------------------------------------------------------------------\n\nconst SidebarInput: React.ForwardRefExoticComponent<\n React.ComponentProps<\"input\"> & React.RefAttributes<HTMLInputElement>\n> = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, ...props }, ref) => {\n return (\n <input\n ref={ref}\n data-sidebar=\"input\"\n className={cn(\n \"bg-background focus-visible:ring-sidebar-ring h-8 w-full rounded-md border px-3 text-sm shadow-none focus-visible:ring-2 focus-visible:outline-none\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarInput.displayName = \"SidebarInput\";\n\n// ---------------------------------------------------------------------------\n// SidebarHeader / Footer\n// ---------------------------------------------------------------------------\n\nconst SidebarHeader: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"header\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n },\n);\nSidebarHeader.displayName = \"SidebarHeader\";\n\nconst SidebarFooter: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"footer\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n },\n);\nSidebarFooter.displayName = \"SidebarFooter\";\n\n// ---------------------------------------------------------------------------\n// SidebarSeparator\n// ---------------------------------------------------------------------------\n\nconst SidebarSeparator: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & {\n orientation?: \"horizontal\" | \"vertical\";\n } & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n orientation?: \"horizontal\" | \"vertical\";\n }\n>(({ className, ...props }, ref) => {\n return (\n <Separator\n ref={ref}\n data-sidebar=\"separator\"\n className={cn(\"bg-sidebar-border mx-2 w-auto\", className)}\n {...props}\n />\n );\n});\nSidebarSeparator.displayName = \"SidebarSeparator\";\n\n// ---------------------------------------------------------------------------\n// SidebarContent\n// ---------------------------------------------------------------------------\n\nconst SidebarContent: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"content\"\n className={cn(\n \"scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-auto rounded group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:overflow-hidden group-data-[collapsible=icon]:pt-3\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarContent.displayName = \"SidebarContent\";\n\n// ---------------------------------------------------------------------------\n// SidebarGroup\n// ---------------------------------------------------------------------------\n\nconst SidebarGroup: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-sidebar=\"group\"\n className={cn(\n \"relative flex w-full min-w-0 flex-col p-2 group-data-[collapsible=icon]:py-0 group-data-[collapsible=icon]:pt-4\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nSidebarGroup.displayName = \"SidebarGroup\";\n\nconst SidebarGroupLabel: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & {\n asChild?: boolean;\n } & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-label\"\n className={cn(\n \"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupLabel.displayName = \"SidebarGroupLabel\";\n\nconst SidebarGroupAction: React.ForwardRefExoticComponent<\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n } & React.RefAttributes<HTMLButtonElement>\n> = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & { asChild?: boolean }\n>(({ className, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"group-action\"\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarGroupAction.displayName = \"SidebarGroupAction\";\n\nconst SidebarGroupContent: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"group-content\"\n className={cn(\"w-full text-sm\", className)}\n {...props}\n />\n ),\n);\nSidebarGroupContent.displayName = \"SidebarGroupContent\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenu\n// ---------------------------------------------------------------------------\n\nconst SidebarMenu: React.ForwardRefExoticComponent<\n React.ComponentProps<\"ul\"> & React.RefAttributes<HTMLUListElement>\n> = React.forwardRef<HTMLUListElement, React.ComponentProps<\"ul\">>(\n ({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu\"\n className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n {...props}\n />\n ),\n);\nSidebarMenu.displayName = \"SidebarMenu\";\n\nconst SidebarMenuItem: React.ForwardRefExoticComponent<\n React.ComponentProps<\"li\"> & React.RefAttributes<HTMLLIElement>\n> = React.forwardRef<HTMLLIElement, React.ComponentProps<\"li\">>(\n ({ className, ...props }, ref) => (\n <li\n ref={ref}\n data-sidebar=\"menu-item\"\n className={cn(\"group/menu-item relative\", className)}\n {...props}\n />\n ),\n);\nSidebarMenuItem.displayName = \"SidebarMenuItem\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenuButton\n// ---------------------------------------------------------------------------\n\nconst sidebarMenuButtonVariants: (\n props?:\n | ({\n variant?: \"default\" | \"outline\" | null | undefined;\n size?: \"default\" | \"sm\" | \"lg\" | null | undefined;\n } & (\n | {\n class: ClassValue;\n className?: never;\n }\n | {\n class?: never;\n className: ClassValue;\n }\n | {\n class?: never;\n className?: never;\n }\n ))\n | undefined,\n) => string = cva(\n \"peer/menu-button ring-sidebar-ring hover:bg-sidebar-primary hover:text-sidebar-primary-foreground active:bg-sidebar-primary active:text-sidebar-primary-foreground data-[active=true]:bg-sidebar-primary data-[active=true]:text-sidebar-primary-foreground data-[state=open]:hover:bg-sidebar-primary data-[state=open]:hover:text-sidebar-primary-foreground flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"hover:bg-sidebar-primary hover:text-sidebar-primary-foreground\",\n outline:\n \"hover:bg-sidebar-primary hover:text-sidebar-primary-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-primary))]\",\n },\n size: {\n default: \"h-8 text-sm\",\n sm: \"h-7 text-xs\",\n lg: \"h-12 text-sm group-data-[collapsible=icon]:p-0!\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nconst SidebarMenuButton: React.ForwardRefExoticComponent<\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n } & VariantProps<typeof sidebarMenuButtonVariants> &\n React.RefAttributes<HTMLButtonElement>\n> = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n } & VariantProps<typeof sidebarMenuButtonVariants>\n>(\n (\n {\n asChild = false,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n className,\n ...props\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n\n const button = (\n <Comp\n ref={ref}\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n return button;\n },\n);\nSidebarMenuButton.displayName = \"SidebarMenuButton\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenuAction / Badge / Skeleton\n// ---------------------------------------------------------------------------\n\nconst SidebarMenuAction: React.ForwardRefExoticComponent<\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n showOnHover?: boolean;\n } & React.RefAttributes<HTMLButtonElement>\n> = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n showOnHover?: boolean;\n }\n>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-action\"\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n showOnHover &&\n \"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarMenuAction.displayName = \"SidebarMenuAction\";\n\nconst SidebarMenuBadge: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-sidebar=\"menu-badge\"\n className={cn(\n \"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none\",\n \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n ),\n);\nSidebarMenuBadge.displayName = \"SidebarMenuBadge\";\n\nconst SidebarMenuSkeleton: React.ForwardRefExoticComponent<\n React.ComponentProps<\"div\"> & {\n showIcon?: boolean;\n } & React.RefAttributes<HTMLDivElement>\n> = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n showIcon?: boolean;\n }\n>(({ className, showIcon = false, ...props }, ref) => {\n // Random width between 50 to 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n ref={ref}\n data-sidebar=\"menu-skeleton\"\n className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n {...props}\n >\n {showIcon && (\n <Skeleton\n className=\"size-4 rounded-md\"\n data-sidebar=\"menu-skeleton-icon\"\n />\n )}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n );\n});\nSidebarMenuSkeleton.displayName = \"SidebarMenuSkeleton\";\n\n// ---------------------------------------------------------------------------\n// SidebarMenuSub\n// ---------------------------------------------------------------------------\n\nconst SidebarMenuSub: React.ForwardRefExoticComponent<\n React.ComponentProps<\"ul\"> & React.RefAttributes<HTMLUListElement>\n> = React.forwardRef<HTMLUListElement, React.ComponentProps<\"ul\">>(\n ({ className, ...props }, ref) => (\n <ul\n ref={ref}\n data-sidebar=\"menu-sub\"\n className={cn(\n \"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n ),\n);\nSidebarMenuSub.displayName = \"SidebarMenuSub\";\n\nconst SidebarMenuSubItem: React.ForwardRefExoticComponent<\n React.ComponentProps<\"li\"> & React.RefAttributes<HTMLLIElement>\n> = React.forwardRef<HTMLLIElement, React.ComponentProps<\"li\">>(\n ({ ...props }, ref) => <li ref={ref} {...props} />,\n);\nSidebarMenuSubItem.displayName = \"SidebarMenuSubItem\";\n\nconst SidebarMenuSubButton: React.ForwardRefExoticComponent<\n React.ComponentProps<\"a\"> & {\n asChild?: boolean;\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n } & React.RefAttributes<HTMLAnchorElement>\n> = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentProps<\"a\"> & {\n asChild?: boolean;\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n }\n>(({ asChild = false, size = \"md\", isActive, className, ...props }, ref) => {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n ref={ref}\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n size === \"sm\" && \"text-xs\",\n size === \"md\" && \"text-sm\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n});\nSidebarMenuSubButton.displayName = \"SidebarMenuSubButton\";\n\n// ---------------------------------------------------------------------------\n// Exports\n// ---------------------------------------------------------------------------\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n useSidebar,\n};\n"],"mappings":";;;;;;;;;AAcA,SAAS,GAAG,GAAG,QAAsB;AACnC,QAAO,QAAQ,KAAK,OAAO,CAAC;;AAG9B,SAAS,UAAU,EACjB,WACA,cAAc,cACd,GAAG,SAIF;AACD,QACE,oBAAC,OAAD;EACE,MAAK;EACL,oBAAkB;EAClB,WAAW,GACT,sBACA,gBAAgB,eAAe,gBAAgB,eAC/C,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,SAAS,EAChB,WACA,GAAG,SACoC;AACvC,QACE,oBAAC,OAAD;EACE,WAAW,GAAG,qCAAqC,UAAU;EAC7D,GAAI;EACJ,CAAA;;AAQN,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,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AAI;EACJ,CAAA;EAEJ;AACF,qBAAqB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-mobile.cjs","names":[],"sources":["../../src/shell/use-mobile.ts"],"sourcesContent":["import { useState, useEffect } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\nconst TABLET_BREAKPOINT = 1024;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobile;\n}\n\nexport function useIsTablet() {\n const [isTablet, setIsTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(\n `(min-width: ${MOBILE_BREAKPOINT}px) and (max-width: ${TABLET_BREAKPOINT - 1}px)`,\n );\n const onChange = () => {\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n };\n mql.addEventListener(\"change\", onChange);\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isTablet;\n}\n\nexport function useIsMobileOrTablet() {\n const [isMobileOrTablet, setIsMobileOrTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${TABLET_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobileOrTablet;\n}\n"],"mappings":";;;;AAEA,MAAM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, useEffect } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\nconst TABLET_BREAKPOINT = 1024;\n\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobile;\n}\n\nexport function useIsTablet(): boolean {\n const [isTablet, setIsTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(\n `(min-width: ${MOBILE_BREAKPOINT}px) and (max-width: ${TABLET_BREAKPOINT - 1}px)`,\n );\n const onChange = () => {\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n };\n mql.addEventListener(\"change\", onChange);\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isTablet;\n}\n\nexport function useIsMobileOrTablet(): boolean {\n const [isMobileOrTablet, setIsMobileOrTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${TABLET_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobileOrTablet;\n}\n"],"mappings":";;;;AAEA,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAE1B,SAAgB,cAAuB;CACrC,MAAM,CAAC,UAAU,gBAAA,GAAA,MAAA,UAAiC,MAAM;AAExD,EAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,KAAK;EACxE,MAAM,iBAAiB;AACrB,eAAY,OAAO,aAAa,kBAAkB;;AAEpD,MAAI,iBAAiB,UAAU,SAAS;AACxC,cAAY,OAAO,aAAa,kBAAkB;AAClD,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO;;AAGT,SAAgB,cAAuB;CACrC,MAAM,CAAC,UAAU,gBAAA,GAAA,MAAA,UAAiC,MAAM;AAExD,EAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,MAAM,OAAO,WACjB,eAAe,kBAAkB,sBAAsB,oBAAoB,EAAE,KAC9E;EACD,MAAM,iBAAiB;AACrB,eACE,OAAO,cAAc,qBACnB,OAAO,aAAa,kBACvB;;AAEH,MAAI,iBAAiB,UAAU,SAAS;AACxC,cACE,OAAO,cAAc,qBACnB,OAAO,aAAa,kBACvB;AACD,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO;;AAGT,SAAgB,sBAA+B;CAC7C,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,UAAyC,MAAM;AAExE,EAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,KAAK;EACxE,MAAM,iBAAiB;AACrB,uBAAoB,OAAO,aAAa,kBAAkB;;AAE5D,MAAI,iBAAiB,UAAU,SAAS;AACxC,sBAAoB,OAAO,aAAa,kBAAkB;AAC1D,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-mobile.mjs","names":[],"sources":["../../src/shell/use-mobile.ts"],"sourcesContent":["import { useState, useEffect } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\nconst TABLET_BREAKPOINT = 1024;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobile;\n}\n\nexport function useIsTablet() {\n const [isTablet, setIsTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(\n `(min-width: ${MOBILE_BREAKPOINT}px) and (max-width: ${TABLET_BREAKPOINT - 1}px)`,\n );\n const onChange = () => {\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n };\n mql.addEventListener(\"change\", onChange);\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isTablet;\n}\n\nexport function useIsMobileOrTablet() {\n const [isMobileOrTablet, setIsMobileOrTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${TABLET_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobileOrTablet;\n}\n"],"mappings":";;AAEA,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAE1B,SAAgB,cAAc;CAC5B,MAAM,CAAC,UAAU,eAAe,SAAkB,MAAM;AAExD,iBAAgB;EACd,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,KAAK;EACxE,MAAM,iBAAiB;AACrB,eAAY,OAAO,aAAa,kBAAkB;;AAEpD,MAAI,iBAAiB,UAAU,SAAS;AACxC,cAAY,OAAO,aAAa,kBAAkB;AAClD,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO;;AAGT,SAAgB,cAAc;CAC5B,MAAM,CAAC,UAAU,eAAe,SAAkB,MAAM;AAExD,iBAAgB;EACd,MAAM,MAAM,OAAO,WACjB,eAAe,kBAAkB,sBAAsB,oBAAoB,EAAE,KAC9E;EACD,MAAM,iBAAiB;AACrB,eACE,OAAO,cAAc,qBACnB,OAAO,aAAa,kBACvB;;AAEH,MAAI,iBAAiB,UAAU,SAAS;AACxC,cACE,OAAO,cAAc,qBACnB,OAAO,aAAa,kBACvB;AACD,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO;;AAGT,SAAgB,sBAAsB;CACpC,MAAM,CAAC,kBAAkB,uBAAuB,SAAkB,MAAM;AAExE,iBAAgB;EACd,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,KAAK;EACxE,MAAM,iBAAiB;AACrB,uBAAoB,OAAO,aAAa,kBAAkB;;AAE5D,MAAI,iBAAiB,UAAU,SAAS;AACxC,sBAAoB,OAAO,aAAa,kBAAkB;AAC1D,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO"}
1
+ {"version":3,"file":"use-mobile.mjs","names":[],"sources":["../../src/shell/use-mobile.ts"],"sourcesContent":["import { useState, useEffect } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\nconst TABLET_BREAKPOINT = 1024;\n\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobile;\n}\n\nexport function useIsTablet(): boolean {\n const [isTablet, setIsTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(\n `(min-width: ${MOBILE_BREAKPOINT}px) and (max-width: ${TABLET_BREAKPOINT - 1}px)`,\n );\n const onChange = () => {\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n };\n mql.addEventListener(\"change\", onChange);\n setIsTablet(\n window.innerWidth >= MOBILE_BREAKPOINT &&\n window.innerWidth < TABLET_BREAKPOINT,\n );\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isTablet;\n}\n\nexport function useIsMobileOrTablet(): boolean {\n const [isMobileOrTablet, setIsMobileOrTablet] = useState<boolean>(false);\n\n useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${TABLET_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobileOrTablet(window.innerWidth < TABLET_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobileOrTablet;\n}\n"],"mappings":";;AAEA,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAE1B,SAAgB,cAAuB;CACrC,MAAM,CAAC,UAAU,eAAe,SAAkB,MAAM;AAExD,iBAAgB;EACd,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,KAAK;EACxE,MAAM,iBAAiB;AACrB,eAAY,OAAO,aAAa,kBAAkB;;AAEpD,MAAI,iBAAiB,UAAU,SAAS;AACxC,cAAY,OAAO,aAAa,kBAAkB;AAClD,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO;;AAGT,SAAgB,cAAuB;CACrC,MAAM,CAAC,UAAU,eAAe,SAAkB,MAAM;AAExD,iBAAgB;EACd,MAAM,MAAM,OAAO,WACjB,eAAe,kBAAkB,sBAAsB,oBAAoB,EAAE,KAC9E;EACD,MAAM,iBAAiB;AACrB,eACE,OAAO,cAAc,qBACnB,OAAO,aAAa,kBACvB;;AAEH,MAAI,iBAAiB,UAAU,SAAS;AACxC,cACE,OAAO,cAAc,qBACnB,OAAO,aAAa,kBACvB;AACD,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO;;AAGT,SAAgB,sBAA+B;CAC7C,MAAM,CAAC,kBAAkB,uBAAuB,SAAkB,MAAM;AAExE,iBAAgB;EACd,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,KAAK;EACxE,MAAM,iBAAiB;AACrB,uBAAoB,OAAO,aAAa,kBAAkB;;AAE5D,MAAI,iBAAiB,UAAU,SAAS;AACxC,sBAAoB,OAAO,aAAa,kBAAkB;AAC1D,eAAa,IAAI,oBAAoB,UAAU,SAAS;IACvD,EAAE,CAAC;AAEN,QAAO"}
@@ -324,6 +324,7 @@ function emitNonColorVars(theme) {
324
324
  const globalCSSOverride = [
325
325
  "--color-background-foreground: var(--color-foreground);",
326
326
  "--color-foreground-foreground: var(--color-background);",
327
+ "--color-contrast: var(--color-foreground);",
327
328
  ...SEMANTIC_COLOR_NAMES.map((value) => `--${value}: var(--color-${value});`),
328
329
  ...SEMANTIC_COLOR_NAMES.map((value) => `--${value}-foreground: var(--color-${value}-foreground);`),
329
330
  "--sidebar-ring: var(--color-primary);",
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Color","Color","Color"],"sources":["../../src/theme/types.ts","../../src/theme/color-engine.ts","../../src/theme/tailwind-overrides.ts","../../src/theme/css-generator.ts","../../src/theme/defaults.ts","../../src/theme/serialisation.ts","../../src/theme/transforms.ts","../../src/theme/theme-applicator.ts"],"sourcesContent":["import type Color from \"colorjs.io\";\n\n// Semantic color names - matches rep-widgets tailwind.config.ts and field-types.ts\nexport const SEMANTIC_COLOR_NAMES = [\n \"background\",\n \"foreground\",\n \"primary\",\n \"secondary\",\n \"accent\",\n \"muted\",\n \"destructive\",\n] as const;\nexport type SemanticColorName = (typeof SEMANTIC_COLOR_NAMES)[number];\n\nexport const SHADE_STEPS = [\n 100, 200, 300, 400, 500, 600, 700, 800, 900,\n] as const;\nexport type ShadeStep = (typeof SHADE_STEPS)[number];\n\nexport const FONT_SIZE_KEYS = [\n \"extraSmall\",\n \"small\",\n \"regular\",\n \"large\",\n \"extraLarge\",\n \"giant\",\n] as const;\nexport type FontSizeKey = (typeof FONT_SIZE_KEYS)[number];\n\nexport const FONT_FAMILY_KEYS = [\"header\", \"body\"] as const;\nexport type FontFamilyKey = (typeof FONT_FAMILY_KEYS)[number];\n\nexport const RADIUS_KEYS = [\"small\", \"medium\", \"large\", \"extraLarge\"] as const;\nexport type RadiusKey = (typeof RADIUS_KEYS)[number];\n\n/** Author-time color input (what the user configures) */\nexport interface ThemeColorInput {\n base: Color;\n foreground: Color;\n}\n\n/** Complete theme definition — stored in-memory with Color objects */\nexport interface ThemeDefinition {\n id: string;\n name: string;\n /** Light mode — always fully specified */\n light: Record<SemanticColorName, ThemeColorInput>;\n /**\n * Dark mode — only user-overridden colors.\n * Missing keys are auto-derived from `light` at resolve time.\n */\n dark: Partial<Record<SemanticColorName, Partial<ThemeColorInput>>>;\n fontSizes: Record<FontSizeKey, string>;\n fontFamilies: Record<FontFamilyKey, string>;\n spacing: string;\n radii: Record<RadiusKey, string>;\n /** When true, theme colors are re-derived from brand guidelines on every load */\n syncWithBrandColors?: boolean;\n}\n\n/** Resolved semantic color with generated shade ramp */\nexport interface ResolvedSemanticColor {\n base: Color;\n foreground: Color;\n shades: Record<ShadeStep, Color>;\n}\n\n/** Complete resolved color set for one mode */\nexport type ResolvedColorSet = Record<SemanticColorName, ResolvedSemanticColor>;\n\n/** Fully resolved theme — all colors materialised for both modes */\nexport interface ResolvedTheme {\n id: string;\n name: string;\n light: ResolvedColorSet;\n dark: ResolvedColorSet;\n fontSizes: ThemeDefinition[\"fontSizes\"];\n fontFamilies: ThemeDefinition[\"fontFamilies\"];\n spacing: string;\n radii: ThemeDefinition[\"radii\"];\n}\n\n/** Plain OKLCH triplet for JSON serialisation (no Color dependency) */\nexport interface OklchPlain {\n l: number;\n c: number;\n h: number;\n}\n\n/** Serialised color pair as stored in the backend payload */\nexport interface ThemeColorPlain {\n base: OklchPlain;\n foreground: OklchPlain;\n}\n\n/** Backend payload — plain JSON, no Color objects */\nexport interface ThemePayload {\n [key: string]: unknown;\n id: string;\n name: string;\n light: Record<SemanticColorName, ThemeColorPlain>;\n dark: Partial<\n Record<SemanticColorName, { base?: OklchPlain; foreground?: OklchPlain }>\n >;\n fontSizes: Record<FontSizeKey, string>;\n fontFamilies: Record<FontFamilyKey, string>;\n spacing: string;\n radii: Record<RadiusKey, string>;\n syncWithBrandColors?: boolean;\n}\n","import Color from \"colorjs.io\";\nimport {\n SEMANTIC_COLOR_NAMES,\n SHADE_STEPS,\n type SemanticColorName,\n type ShadeStep,\n type ThemeColorInput,\n type ThemeDefinition,\n type ResolvedColorSet,\n type ResolvedTheme,\n} from \"./types\";\n\n/**\n * Attempt to convert any string into a Color using colorjs.io.\n * If the string is exactly 6 characters it is assumed to be a bare hex value\n * (e.g. \"3b82f6\") and a \"#\" prefix is added before parsing.\n *\n * @returns the parsed Color, or a neutral gray (`oklch(0.5 0 0)`) on failure\n */\nexport function parseColor(value: string): Color {\n if (value.length === 6) {\n value = `#${value}`;\n }\n try {\n return new Color(value);\n } catch (error) {\n console.warn(\"[theme] Failed to parse color:\", value, error);\n return new Color(\"oklch\", [0.5, 0, 0]);\n }\n}\n\n/**\n * Returns either the original foreground or a corrected lightness variant,\n * whichever provides better contrast against `color`.\n * Inversion triggers when the APCA contrast is below 50.\n */\nexport function getForegroundColor(foreground: Color, color: Color): Color {\n if (foreground.oklch.l == null || color.oklch.l == null) {\n return foreground;\n }\n const contrast = color.contrastAPCA(foreground);\n\n if (contrast < 50) {\n return new Color(\"oklch\", [\n color.oklch.l < 0.7 ? 0.95 : 0.15,\n foreground.oklch.c || 0,\n foreground.oklch.h || 0,\n ]);\n }\n return foreground;\n}\n\n/**\n * Generate a 100–900 shade ramp from a base color.\n * Base anchors at 500. Light shades (100–400) step toward white,\n * dark shades (600–900) step toward black. Dark steps use an asymmetric\n * multiplier (1.6×, 1.875×, 3×, 4× of `darkStep`) for a more gradual\n * initial descent. Chroma is nudged per step for perceptually natural ramps.\n */\nexport function generateShades(base: Color): Record<ShadeStep, Color> {\n const l = base.oklch.l ?? 0;\n const c = base.oklch.c ?? 0;\n const h = base.oklch.h ?? 0;\n\n const safeMax = l >= 0.885 ? 0.995 : 0.97;\n const safeMin = l <= 0.33 ? 0 : 0.21;\n\n const lightStep = (safeMax - l) / 5;\n const darkStep = -(l - safeMin) / 8;\n\n const shade = (lDelta: number, cDelta: number): Color => {\n return new Color(\"oklch\", [\n Math.max(0, Math.min(1, l + lDelta)),\n c <= 0.001 ? c : Math.max(0, c + cDelta),\n h,\n ]);\n };\n\n return {\n 100: shade(5 * lightStep, -0.00375),\n 200: shade(4 * lightStep, -0.00375),\n 300: shade(3 * lightStep, -0.00375),\n 400: shade(2 * lightStep, -0.00375),\n 500: new Color(\"oklch\", [l, c, h]),\n 600: shade(1.6 * darkStep, 0.025),\n 700: shade(1.875 * 2 * darkStep, 0.05),\n 800: shade(3 * 2 * darkStep, 0.075),\n 900: shade(4 * 2 * darkStep, 0.1),\n };\n}\n\n// ── Dark Mode Derivation ────────────────────────────────────────────\n//\n// Dark-mode colors are derived from their light counterparts by adjusting\n// OKLCH lightness and optionally scaling chroma. Neutral slots (background,\n// foreground, muted) use fixed lightness values while chromatic slots\n// (primary, secondary, accent, destructive) invert lightness around 0.5.\n\nconst DARK_DERIVATION_CONFIG: Record<\n SemanticColorName,\n {\n baseLightness: number | \"invert\";\n fgLightness: number | \"invert\";\n chromaScale?: number;\n }\n> = {\n background: { baseLightness: 0.15, fgLightness: 0.93 },\n foreground: { baseLightness: 0.93, fgLightness: 0.15 },\n muted: { baseLightness: 0.22, fgLightness: 0.75 },\n primary: { baseLightness: \"invert\", fgLightness: 0.95, chromaScale: 0.9 },\n secondary: { baseLightness: \"invert\", fgLightness: 0.93, chromaScale: 0.85 },\n accent: { baseLightness: \"invert\", fgLightness: 0.95, chromaScale: 0.9 },\n destructive: {\n baseLightness: \"invert\",\n fgLightness: 0.95,\n chromaScale: 0.95,\n },\n};\n\n/** Invert OKLCH lightness (1 - l), clamped to [0.35, 0.75] to avoid extremes. */\nfunction invertLightness(l: number): number {\n const inverted = 1 - l;\n return Math.max(0.35, Math.min(0.75, inverted));\n}\n\n/**\n * Derive a dark-mode ThemeColorInput from its light-mode counterpart.\n */\nexport function deriveDarkVariant(\n name: SemanticColorName,\n light: ThemeColorInput,\n): ThemeColorInput {\n const config = DARK_DERIVATION_CONFIG[name];\n const chromaScale = config.chromaScale ?? 1;\n\n const baseLightness =\n config.baseLightness === \"invert\"\n ? invertLightness(light.base.oklch.l ?? 0)\n : config.baseLightness;\n\n const fgLightness =\n config.fgLightness === \"invert\"\n ? invertLightness(light.foreground.oklch.l ?? 0)\n : config.fgLightness;\n\n return {\n base: new Color(\"oklch\", [\n baseLightness,\n (light.base.oklch.c || 0) * chromaScale,\n light.base.oklch.h || 0,\n ]),\n foreground: new Color(\"oklch\", [\n fgLightness,\n (light.foreground.oklch.c || 0) * chromaScale,\n light.foreground.oklch.h || 0,\n ]),\n };\n}\n\n// ── Dark Mode Merge ─────────────────────────────────────────────────\n\n/**\n * Merge auto-derived dark colors with any user-specified overrides.\n * For each semantic color, if the user has fully overridden both base and\n * foreground those are used; otherwise the missing channels are derived.\n */\nexport function mergeDarkOverrides(\n def: ThemeDefinition,\n): Record<SemanticColorName, ThemeColorInput> {\n const darkColors = {} as Record<SemanticColorName, ThemeColorInput>;\n\n for (const name of SEMANTIC_COLOR_NAMES) {\n const lightInput = def.light[name];\n const darkOverride = def.dark[name];\n\n if (darkOverride?.base && darkOverride?.foreground) {\n darkColors[name] = darkOverride as ThemeColorInput;\n } else if (darkOverride) {\n const base =\n darkOverride.base ?? deriveDarkVariant(name, lightInput).base;\n darkColors[name] = {\n base: base,\n foreground:\n darkOverride.foreground ??\n getForegroundColor(def.light.foreground.base, base),\n };\n } else {\n darkColors[name] = deriveDarkVariant(name, lightInput);\n }\n }\n\n return darkColors;\n}\n\n// ── Theme Resolution ────────────────────────────────────────────────\n\nfunction resolveColorSet(\n colors: Record<SemanticColorName, ThemeColorInput>,\n): ResolvedColorSet {\n const resolved = {} as ResolvedColorSet;\n\n for (const name of SEMANTIC_COLOR_NAMES) {\n const input = colors[name];\n const shades = generateShades(input.base);\n const resolvedShades = {} as Record<ShadeStep, Color>;\n\n for (const step of SHADE_STEPS) {\n resolvedShades[step] = shades[step];\n }\n\n resolved[name] = {\n base: input.base.clone(),\n foreground: input.foreground.clone(),\n shades: resolvedShades,\n };\n }\n\n return resolved;\n}\n\n/**\n * Resolve a ThemeDefinition into a complete ResolvedTheme.\n * Dark mode colors are derived from light where not overridden.\n */\nexport function resolveTheme(def: ThemeDefinition): ResolvedTheme {\n return {\n id: def.id,\n name: def.name,\n light: resolveColorSet(def.light),\n dark: resolveColorSet(mergeDarkOverrides(def)),\n fontSizes: { ...def.fontSizes },\n fontFamilies: { ...def.fontFamilies },\n spacing: def.spacing,\n radii: { ...def.radii },\n };\n}\n","import { SHADE_STEPS, type SemanticColorName, type ShadeStep } from \"./types\";\n\n/**\n * Specific overrides, otherwise all the overrides are generated using emitTailwindOverrides\n */\nconst OVERRIDES: Partial<Record<string, string>> = {\n \"--color-gray-50\": \"var(--color-muted)\",\n \"--color-gray-100\": \"var(--color-muted-600)\",\n \"--color-gray-200\": \"var(--color-border)\",\n} as const;\n\n/**\n * Returns the inverted shade for dark mode foreground colors.\n * In dark mode, light shades (50, 100) should map to dark values (950, 900) and vice versa.\n */\nfunction getInvertedStep(shade: ShadeStep): ShadeStep {\n const shadeIndex = SHADE_STEPS.indexOf(shade);\n const invertedIndex = SHADE_STEPS.length - 1 - shadeIndex;\n return SHADE_STEPS[invertedIndex] || 500;\n}\n\n/**\n * Map semantic colors to Tailwind built-in color names.\n */\nexport function emitTailwindOverrides(darkMode: boolean = false): string[] {\n const TAILWIND_COLOR_MAP: Record<string, SemanticColorName> = {\n gray: \"foreground\",\n red: \"destructive\",\n blue: \"primary\",\n green: \"accent\",\n };\n\n const TAILWIND_SHADES = [\n 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950,\n ] as const;\n const SHADE_REMAP: Partial<Record<number, ShadeStep>> = {\n 50: 100,\n 950: 900,\n };\n\n const lines: string[] = [];\n for (const [twName, semantic] of Object.entries(TAILWIND_COLOR_MAP)) {\n for (const shade of TAILWIND_SHADES) {\n const step = (SHADE_REMAP[shade] ?? shade) as ShadeStep;\n const override = OVERRIDES[`--color-${twName}-${shade}`];\n lines.push(\n `--color-${twName}-${shade}: ${override ? override : `var(--color-${semantic}-${semantic === \"foreground\" && darkMode === true ? getInvertedStep(step) : step})`};`,\n );\n }\n }\n\n lines.push(\"--color-white: var(--color-background);\");\n lines.push(\"--color-black: var(--color-foreground);\");\n\n return lines;\n}\n","import { emitTailwindOverrides } from \"./tailwind-overrides\";\nimport {\n SEMANTIC_COLOR_NAMES,\n SHADE_STEPS,\n FONT_SIZE_KEYS,\n FONT_FAMILY_KEYS,\n RADIUS_KEYS,\n type ResolvedColorSet,\n type ResolvedTheme,\n} from \"./types\";\n\nfunction colorToCSS(color: import(\"colorjs.io\").default): string {\n const result = color.toString({ format: \"oklch\" });\n if (result.includes(\"NaN\")) {\n console.warn(\n \"[theme] colorToCSS produced NaN, using neutral fallback:\",\n result,\n );\n return \"oklch(0.5 0 0)\";\n }\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Emit --color-{name}, --color-{name}-foreground, --color-{name}-{shade} vars.\n * Uses --color- prefix to match rep-widgets/tailwind.config.ts.\n */\nfunction emitColorVars(colors: ResolvedColorSet): string[] {\n const lines: string[] = [];\n\n for (const name of SEMANTIC_COLOR_NAMES) {\n const color = colors[name];\n lines.push(`--color-${name}: ${colorToCSS(color.base)};`);\n lines.push(`--color-${name}-foreground: ${colorToCSS(color.foreground)};`);\n for (const step of SHADE_STEPS) {\n lines.push(`--color-${name}-${step}: ${colorToCSS(color.shades[step])};`);\n }\n }\n\n return lines;\n}\n\n/**\n * Emit non-color CSS variables (font sizes, families, spacing, radii).\n */\nfunction emitNonColorVars(theme: ResolvedTheme): string[] {\n const lines: string[] = [];\n for (const key of FONT_SIZE_KEYS) {\n lines.push(`--font-size-${camelToKebab(key)}: ${theme.fontSizes[key]};`);\n }\n for (const key of FONT_FAMILY_KEYS) {\n lines.push(`--font-${key}: ${theme.fontFamilies[key]};`);\n }\n lines.push(`--spacing: ${theme.spacing};`);\n for (const key of RADIUS_KEYS) {\n lines.push(`--radius-${camelToKebab(key)}: ${theme.radii[key]};`);\n }\n return lines;\n}\n\n/**\n * Static CSS alias variables that bridge theme var names to Tailwind/component conventions.\n * These are always emitted and not mode-dependent.\n */\nconst globalCSSOverride = [\n \"--color-background-foreground: var(--color-foreground);\",\n \"--color-foreground-foreground: var(--color-background);\",\n ...SEMANTIC_COLOR_NAMES.map((value) => `--${value}: var(--color-${value});`),\n ...SEMANTIC_COLOR_NAMES.map(\n (value) => `--${value}-foreground: var(--color-${value}-foreground);`,\n ),\n\n \"--sidebar-ring: var(--color-primary);\",\n \"--sidebar-border: var(--color-border);\",\n \"--sidebar-accent-foreground: var(--color-accent-foreground);\",\n \"--sidebar-accent: var(--color-accent);\",\n \"--sidebar-primary-foreground: var(--color-primary-foreground);\",\n \"--sidebar-primary: var(--color-primary);\",\n \"--sidebar-foreground: var(--color-muted-foreground);\",\n \"--sidebar: var(--color-muted);\",\n \"--border: var(--color-background-600);\",\n \"--ring: var(--color-primary);\",\n \"--popover: var(--color-background);\",\n \"--popover-foreground: var(--color-foreground);\",\n \"--card: var(--color-muted);\",\n \"--card-foreground: var(--color-muted-foreground);\",\n\n \"--radius-sm: var(--radius-small);\",\n \"--radius-md: var(--radius-medium);\",\n \"--radius-lg: var(--radius-large);\",\n \"--radius-xl: var(--radius-extra-large);\",\n \"--text-xs: var(--font-size-extra-small);\",\n \"--text-sm: var(--font-size-small);\",\n \"--text-base: var(--font-size-regular);\",\n \"--text-lg: var(--font-size-large);\",\n \"--text-xl: var(--font-size-extra-large);\",\n \"--text-2xl: var(--font-size-giant);\",\n \"--font-sans: var(--font-body);\",\n // Tailwind's font-mono is repurposed as the display/header font\n \"--font-mono: var(--font-header);\",\n];\n\n/**\n * Overrides for global tailwindcss for specifically dark mode.\n */\nconst globalDarkCSSOverride = [\"--border: var(--color-background-400);\"];\n\nexport interface GenerateThemeCSSOptions {\n /** Whether or not to allow prefers-color-scheme to choose the theme mode */\n disableAutoTheme?: boolean;\n /** Whether to emit Tailwind built-in color overrides (default true) */\n mapTailwindColors?: boolean;\n}\n\n/**\n * Generate a complete CSS string for a resolved theme.\n * Outputs 2–3 blocks: light default, dark explicit via `[data-theme-mode=\"dark\"]`,\n * and (unless `disableAutoTheme`) a `prefers-color-scheme: dark` media query block.\n */\nexport function generateThemeCSS(\n theme: ResolvedTheme,\n options: GenerateThemeCSSOptions = {},\n): string {\n const sel = `[data-theme=\"${theme.id}\"]`;\n const tw = options.mapTailwindColors ?? true;\n const blocks: string[] = [];\n\n // Light mode (default)\n blocks.push(`${sel} {`);\n blocks.push(...globalCSSOverride);\n blocks.push(...emitNonColorVars(theme));\n blocks.push(...emitColorVars(theme.light));\n if (tw) blocks.push(...emitTailwindOverrides());\n blocks.push(`}`);\n\n // Dark mode: explicit via attribute\n blocks.push(`${sel}[data-theme-mode=\"dark\"] {`);\n blocks.push(...globalDarkCSSOverride);\n blocks.push(...emitColorVars(theme.dark));\n if (tw) blocks.push(...emitTailwindOverrides(true));\n blocks.push(`}`);\n\n // Dark mode: auto via system preference\n if (!options.disableAutoTheme) {\n blocks.push(`@media (prefers-color-scheme: dark) {`);\n blocks.push(`${sel}:not([data-theme-mode]) {`);\n blocks.push(...globalDarkCSSOverride);\n blocks.push(...emitColorVars(theme.dark).map((l) => `${l}`));\n if (tw) blocks.push(...emitTailwindOverrides(true).map((l) => `${l}`));\n blocks.push(`}`);\n blocks.push(`}`);\n }\n\n return blocks.join(\"\\n\");\n}\n","import Color from \"colorjs.io\";\nimport type {\n FontSizeKey,\n FontFamilyKey,\n RadiusKey,\n ThemeDefinition,\n} from \"./types\";\nimport { getForegroundColor } from \"./color-engine\";\n\n// ── Non-color defaults ──────────────────────────────────────────────\n\nexport const DEFAULT_FONT_SIZES: Record<FontSizeKey, string> = {\n extraSmall: \"0.75rem\",\n small: \"0.875rem\",\n regular: \"1rem\",\n large: \"1.125rem\",\n extraLarge: \"1.25rem\",\n giant: \"1.5rem\",\n};\n\nexport const DEFAULT_FONT_FAMILIES: Record<FontFamilyKey, string> = {\n header: \"var(--font-inter)\",\n body: \"var(--font-inter)\",\n};\n\nexport const DEFAULT_SPACING = \"0.25rem\";\n\nexport const DEFAULT_RADII: Record<RadiusKey, string> = {\n small: \"0.25rem\",\n medium: \"0.5rem\",\n large: \"0.75rem\",\n extraLarge: \"1rem\",\n};\n\n// ── Default colors (hex) ────────────────────────────────────────────\n\nexport const DEFAULT_COLORS = {\n background: \"#ffffff\",\n foreground: \"#1a1a1a\",\n primary: \"#3b82f6\",\n secondary: \"#6b7280\",\n accent: \"#10b981\",\n muted: \"#f3f4f6\",\n destructive: \"#ef4444\",\n mutedForeground: \"#6b7280\",\n} as const;\n\n// ── Default theme identity ──────────────────────────────────────────\n\nexport const DEFAULT_THEME_ID = \"default\";\nexport const DEFAULT_THEME_NAME = \"Default Theme\";\n\n// ── Factory ─────────────────────────────────────────────────────────\n\n/**\n * Build a fresh ThemeDefinition populated with all defaults.\n * Returns a new object each call because Color instances are mutable — do not cache the result.\n */\nexport function getDefaultThemeDefinition(): ThemeDefinition {\n const bg = new Color(DEFAULT_COLORS.background);\n const fg = new Color(DEFAULT_COLORS.foreground);\n const primary = new Color(DEFAULT_COLORS.primary);\n const secondary = new Color(DEFAULT_COLORS.secondary);\n const accent = new Color(DEFAULT_COLORS.accent);\n const muted = new Color(DEFAULT_COLORS.muted);\n const destructive = new Color(DEFAULT_COLORS.destructive);\n const mutedFg = new Color(DEFAULT_COLORS.mutedForeground);\n\n const darkBg = new Color(\"#0a0a0a\");\n const darkFg = new Color(\"#fafafa\");\n const darkMuted = new Color(\"#171717\");\n const darkMutedForeground = new Color(\"#dddddd\");\n\n return {\n id: DEFAULT_THEME_ID,\n name: DEFAULT_THEME_NAME,\n light: {\n background: { base: bg, foreground: fg },\n foreground: { base: fg, foreground: bg },\n primary: {\n base: primary,\n foreground: getForegroundColor(fg, primary),\n },\n secondary: {\n base: secondary,\n foreground: getForegroundColor(fg, secondary),\n },\n accent: {\n base: accent,\n foreground: getForegroundColor(fg, accent),\n },\n muted: { base: muted, foreground: mutedFg },\n destructive: {\n base: destructive,\n foreground: getForegroundColor(fg, destructive),\n },\n },\n dark: {\n background: { base: darkBg, foreground: darkFg },\n foreground: { base: darkFg, foreground: darkBg },\n muted: { base: darkMuted, foreground: darkMutedForeground },\n },\n fontSizes: { ...DEFAULT_FONT_SIZES },\n fontFamilies: { ...DEFAULT_FONT_FAMILIES },\n spacing: DEFAULT_SPACING,\n radii: { ...DEFAULT_RADII },\n };\n}\n","import Color from \"colorjs.io\";\nimport {\n SEMANTIC_COLOR_NAMES,\n type SemanticColorName,\n type ThemeColorInput,\n type ThemeDefinition,\n type ThemePayload,\n type OklchPlain,\n type FontSizeKey,\n type FontFamilyKey,\n type RadiusKey,\n} from \"./types\";\nimport {\n DEFAULT_FONT_SIZES,\n DEFAULT_FONT_FAMILIES,\n DEFAULT_SPACING,\n DEFAULT_RADII,\n getDefaultThemeDefinition,\n} from \"./defaults\";\n\nfunction colorToPlain(color: Color): OklchPlain {\n return {\n l: color.oklch.l ?? 0,\n c: color.oklch.c ?? 0,\n h: color.oklch.h ?? 0,\n };\n}\n\nfunction plainToColor(plain: OklchPlain): Color {\n return new Color(\"oklch\", [plain.l, plain.c, plain.h]);\n}\n\n/**\n * Serialise a ThemeDefinition (with Color objects) to a plain JSON payload\n * suitable for backend storage.\n */\nexport function serialiseTheme(def: ThemeDefinition): ThemePayload {\n const light = {} as ThemePayload[\"light\"];\n for (const name of SEMANTIC_COLOR_NAMES) {\n light[name] = {\n base: colorToPlain(def.light[name].base),\n foreground: colorToPlain(def.light[name].foreground),\n };\n }\n\n const dark: ThemePayload[\"dark\"] = {};\n for (const [name, value] of Object.entries(def.dark)) {\n if (!value) continue;\n dark[name as SemanticColorName] = {\n ...(value.base ? { base: colorToPlain(value.base) } : {}),\n ...(value.foreground\n ? { foreground: colorToPlain(value.foreground) }\n : {}),\n };\n }\n\n return {\n id: def.id,\n name: def.name,\n light,\n dark,\n fontSizes: { ...def.fontSizes },\n fontFamilies: { ...def.fontFamilies },\n spacing: def.spacing,\n radii: { ...def.radii },\n ...(def.syncWithBrandColors ? { syncWithBrandColors: true } : {}),\n };\n}\n\n/**\n * Deserialise a backend payload into a ThemeDefinition with Color objects.\n * Accepts `Record<string, unknown>` because API data is untyped at the boundary.\n * Falls back to default colors for any missing light-mode entries.\n */\nexport function deserialiseTheme(\n payload: Record<string, unknown>,\n): ThemeDefinition {\n const lightRaw = ((payload.light as Record<string, unknown> | undefined) ??\n {}) as Record<string, { base: OklchPlain; foreground: OklchPlain }>;\n const darkRaw = ((payload.dark as Record<string, unknown> | undefined) ??\n {}) as Record<string, { base?: OklchPlain; foreground?: OklchPlain }>;\n\n const defaults = getDefaultThemeDefinition();\n const light = {} as Record<SemanticColorName, ThemeColorInput>;\n for (const name of SEMANTIC_COLOR_NAMES) {\n const entry = lightRaw[name];\n if (entry) {\n light[name] = {\n base: plainToColor(entry.base),\n foreground: plainToColor(entry.foreground),\n };\n } else {\n console.warn(\n `[theme] deserialiseTheme: missing light color \"${name}\", using default`,\n );\n light[name] = defaults.light[name];\n }\n }\n\n const dark: Partial<Record<SemanticColorName, Partial<ThemeColorInput>>> = {};\n for (const [name, value] of Object.entries(darkRaw)) {\n if (!value) continue;\n dark[name as SemanticColorName] = {\n ...(value.base ? { base: plainToColor(value.base) } : {}),\n ...(value.foreground\n ? { foreground: plainToColor(value.foreground) }\n : {}),\n };\n }\n\n return {\n id: payload.id as string,\n name: payload.name as string,\n light,\n dark,\n fontSizes: (payload.fontSizes ?? DEFAULT_FONT_SIZES) as Record<\n FontSizeKey,\n string\n >,\n fontFamilies: (payload.fontFamilies ?? DEFAULT_FONT_FAMILIES) as Record<\n FontFamilyKey,\n string\n >,\n spacing: (payload.spacing as string) ?? DEFAULT_SPACING,\n radii: (payload.radii ?? DEFAULT_RADII) as Record<RadiusKey, string>,\n ...(payload.syncWithBrandColors === true\n ? { syncWithBrandColors: true }\n : {}),\n };\n}\n","/**\n * Theme Transforms\n * Convert raw API theme objects to ThemeDefinition format.\n * Handles both new structured format (OKLCH) and legacy flat format (hex strings).\n */\n\nimport type { ThemeDefinition } from \"./types\";\nimport { deserialiseTheme } from \"./serialisation\";\nimport { parseColor, getForegroundColor } from \"./color-engine\";\nimport {\n DEFAULT_COLORS,\n DEFAULT_FONT_SIZES,\n DEFAULT_FONT_FAMILIES,\n DEFAULT_SPACING,\n DEFAULT_RADII,\n} from \"./defaults\";\n\n/** Shape of a raw theme from the FluidOS API */\nexport interface RawApiTheme {\n id: number;\n config?: Record<string, unknown> | null;\n active?: boolean | null;\n name?: string | null;\n}\n\n/**\n * Check if a theme config uses the new structured format (has a `light` key\n * that is an object) vs the legacy flat format.\n */\nfunction isNewThemeFormat(config: Record<string, unknown>): boolean {\n return config.light != null && typeof config.light === \"object\";\n}\n\n/**\n * Convert a legacy flat config to a ThemeDefinition.\n * Legacy format: { base: \"#fff\", text: \"#000\", primary: \"oklch(0.6 0.2 250)\", ... }\n */\nfunction legacyConfigToDefinition(\n id: number,\n name: string,\n config: Record<string, string>,\n): ThemeDefinition {\n const bg = parseColor(\n config.base ?? config.background ?? DEFAULT_COLORS.background,\n );\n const fg = parseColor(\n config.text ?? config.foreground ?? DEFAULT_COLORS.foreground,\n );\n const primary = parseColor(config.primary ?? DEFAULT_COLORS.primary);\n const secondary = parseColor(config.secondary ?? DEFAULT_COLORS.secondary);\n const accent = parseColor(config.accent ?? DEFAULT_COLORS.accent);\n const muted = parseColor(config.muted ?? DEFAULT_COLORS.muted);\n const destructive = parseColor(\n config.destructive ?? DEFAULT_COLORS.destructive,\n );\n const mutedFg = parseColor(\n config.mutedForeground ?? DEFAULT_COLORS.mutedForeground,\n );\n\n return {\n id: String(id),\n name,\n light: {\n background: { base: bg, foreground: fg },\n foreground: { base: fg, foreground: bg },\n primary: {\n base: primary,\n foreground: getForegroundColor(fg, primary),\n },\n secondary: {\n base: secondary,\n foreground: getForegroundColor(fg, secondary),\n },\n accent: {\n base: accent,\n foreground: getForegroundColor(fg, accent),\n },\n muted: { base: muted, foreground: mutedFg },\n destructive: {\n base: destructive,\n foreground: getForegroundColor(fg, destructive),\n },\n },\n dark: {},\n fontSizes: {\n extraSmall: config.extraSmall ?? DEFAULT_FONT_SIZES.extraSmall,\n small: config.small ?? DEFAULT_FONT_SIZES.small,\n regular: config.regular ?? DEFAULT_FONT_SIZES.regular,\n large: config.large ?? DEFAULT_FONT_SIZES.large,\n extraLarge: config.extraLarge ?? DEFAULT_FONT_SIZES.extraLarge,\n giant: config.giant ?? DEFAULT_FONT_SIZES.giant,\n },\n fontFamilies: {\n header: config.headerFont ?? DEFAULT_FONT_FAMILIES.header,\n body: config.bodyFont ?? DEFAULT_FONT_FAMILIES.body,\n },\n spacing: config.globalSpacing ?? DEFAULT_SPACING,\n radii: {\n small: config.radiusSmall ?? DEFAULT_RADII.small,\n medium: config.radiusMedium ?? DEFAULT_RADII.medium,\n large: config.radiusLarge ?? DEFAULT_RADII.large,\n extraLarge: config.radiusExtraLarge ?? DEFAULT_RADII.extraLarge,\n },\n };\n}\n\n/**\n * Build a ThemeDefinition from a single API theme object.\n * Handles both new structured format and legacy flat format.\n */\nexport function buildThemeDefinition(theme: RawApiTheme): ThemeDefinition {\n const config = (theme.config ?? {}) as Record<string, unknown>;\n\n if (isNewThemeFormat(config)) {\n return deserialiseTheme({\n ...config,\n id: String(theme.id),\n name: theme.name ?? \"Untitled Theme\",\n });\n }\n\n return legacyConfigToDefinition(\n theme.id,\n theme.name ?? \"Untitled Theme\",\n config as Record<string, string>,\n );\n}\n\n/**\n * Transform raw API themes to ThemeDefinition[].\n * Catches and logs errors per theme (graceful degradation).\n */\nexport function transformThemes(themes: RawApiTheme[]): ThemeDefinition[] {\n return themes.flatMap((theme) => {\n try {\n return [buildThemeDefinition(theme)];\n } catch (error) {\n console.error(`[theme] Failed to build theme id=${theme.id}:`, error);\n return [];\n }\n });\n}\n\n/**\n * Get the active theme ID from a list of raw API themes.\n * Falls back to the first theme if none is marked active.\n */\nexport function getActiveThemeId(themes: RawApiTheme[]): string | undefined {\n const active = themes.find((t) => t.active) ?? themes[0];\n return active ? String(active.id) : undefined;\n}\n","import { generateThemeCSS } from \"./css-generator\";\nimport type { ResolvedTheme } from \"./types\";\nimport type { GenerateThemeCSSOptions } from \"./css-generator\";\n\nconst STYLE_PREFIX = \"theme-style-\";\n\n/**\n * Inject or update a `<style>` element in `<head>` for the given theme.\n * The element ID is deterministic (`theme-style-{themeId}`) so repeated calls\n * for the same theme are idempotent — the existing element is updated in place.\n * No-op when `document` is unavailable (SSR).\n */\nexport function applyTheme(\n theme: ResolvedTheme,\n options?: GenerateThemeCSSOptions,\n): void {\n if (typeof document === \"undefined\") return;\n\n try {\n const styleId = `${STYLE_PREFIX}${theme.id}`;\n let el = document.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!el) {\n el = document.createElement(\"style\");\n el.id = styleId;\n document.head.appendChild(el);\n }\n\n el.textContent = generateThemeCSS(theme, options);\n } catch (error) {\n console.error(`[theme] applyTheme failed for \"${theme.id}\":`, error);\n }\n}\n\n/** Remove an injected theme stylesheet. No-op during SSR. */\nexport function removeTheme(themeId: string): void {\n if (typeof document === \"undefined\") return;\n document.getElementById(`${STYLE_PREFIX}${themeId}`)?.remove();\n}\n\n/** Remove all injected theme stylesheets. No-op during SSR. */\nexport function removeAllThemes(): void {\n if (typeof document === \"undefined\") return;\n document\n .querySelectorAll(`style[id^=\"${STYLE_PREFIX}\"]`)\n .forEach((el) => el.remove());\n}\n"],"mappings":";;;;;AAGA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAGD,MAAa,cAAc;CACzB;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CACzC;AAGD,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACD;AAGD,MAAa,mBAAmB,CAAC,UAAU,OAAO;AAGlD,MAAa,cAAc;CAAC;CAAS;CAAU;CAAS;CAAa;;;;;;;;;;ACbrE,SAAgB,WAAW,OAAsB;AAC/C,KAAI,MAAM,WAAW,EACnB,SAAQ,IAAI;AAEd,KAAI;AACF,SAAO,IAAIA,WAAAA,QAAM,MAAM;UAChB,OAAO;AACd,UAAQ,KAAK,kCAAkC,OAAO,MAAM;AAC5D,SAAO,IAAIA,WAAAA,QAAM,SAAS;GAAC;GAAK;GAAG;GAAE,CAAC;;;;;;;;AAS1C,SAAgB,mBAAmB,YAAmB,OAAqB;AACzE,KAAI,WAAW,MAAM,KAAK,QAAQ,MAAM,MAAM,KAAK,KACjD,QAAO;AAIT,KAFiB,MAAM,aAAa,WAAW,GAEhC,GACb,QAAO,IAAIA,WAAAA,QAAM,SAAS;EACxB,MAAM,MAAM,IAAI,KAAM,MAAO;EAC7B,WAAW,MAAM,KAAK;EACtB,WAAW,MAAM,KAAK;EACvB,CAAC;AAEJ,QAAO;;;;;;;;;AAUT,SAAgB,eAAe,MAAuC;CACpE,MAAM,IAAI,KAAK,MAAM,KAAK;CAC1B,MAAM,IAAI,KAAK,MAAM,KAAK;CAC1B,MAAM,IAAI,KAAK,MAAM,KA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engine.ts","../../src/theme/tailwind-overrides.ts","../../src/theme/css-generator.ts","../../src/theme/defaults.ts","../../src/theme/serialisation.ts","../../src/theme/transforms.ts","../../src/theme/theme-applicator.ts"],"sourcesContent":["import type Color from \"colorjs.io\";\n\n// Semantic color names - matches rep-widgets tailwind.config.ts and field-types.ts\nexport const SEMANTIC_COLOR_NAMES = [\n \"background\",\n \"foreground\",\n \"primary\",\n \"secondary\",\n \"accent\",\n \"muted\",\n \"destructive\",\n] as const;\nexport type SemanticColorName = (typeof SEMANTIC_COLOR_NAMES)[number];\n\nexport const SHADE_STEPS = [\n 100, 200, 300, 400, 500, 600, 700, 800, 900,\n] as const;\nexport type ShadeStep = (typeof SHADE_STEPS)[number];\n\nexport const FONT_SIZE_KEYS = [\n \"extraSmall\",\n \"small\",\n \"regular\",\n \"large\",\n \"extraLarge\",\n \"giant\",\n] as const;\nexport type FontSizeKey = (typeof FONT_SIZE_KEYS)[number];\n\nexport const FONT_FAMILY_KEYS = [\"header\", \"body\"] as const;\nexport type FontFamilyKey = (typeof FONT_FAMILY_KEYS)[number];\n\nexport const RADIUS_KEYS = [\"small\", \"medium\", \"large\", \"extraLarge\"] as const;\nexport type RadiusKey = (typeof RADIUS_KEYS)[number];\n\n/** Author-time color input (what the user configures) */\nexport interface ThemeColorInput {\n base: Color;\n foreground: Color;\n}\n\n/** Complete theme definition — stored in-memory with Color objects */\nexport interface ThemeDefinition {\n id: string;\n name: string;\n /** Light mode — always fully specified */\n light: Record<SemanticColorName, ThemeColorInput>;\n /**\n * Dark mode — only user-overridden colors.\n * Missing keys are auto-derived from `light` at resolve time.\n */\n dark: Partial<Record<SemanticColorName, Partial<ThemeColorInput>>>;\n fontSizes: Record<FontSizeKey, string>;\n fontFamilies: Record<FontFamilyKey, string>;\n spacing: string;\n radii: Record<RadiusKey, string>;\n /** When true, theme colors are re-derived from brand guidelines on every load */\n syncWithBrandColors?: boolean;\n}\n\n/** Resolved semantic color with generated shade ramp */\nexport interface ResolvedSemanticColor {\n base: Color;\n foreground: Color;\n shades: Record<ShadeStep, Color>;\n}\n\n/** Complete resolved color set for one mode */\nexport type ResolvedColorSet = Record<SemanticColorName, ResolvedSemanticColor>;\n\n/** Fully resolved theme — all colors materialised for both modes */\nexport interface ResolvedTheme {\n id: string;\n name: string;\n light: ResolvedColorSet;\n dark: ResolvedColorSet;\n fontSizes: ThemeDefinition[\"fontSizes\"];\n fontFamilies: ThemeDefinition[\"fontFamilies\"];\n spacing: string;\n radii: ThemeDefinition[\"radii\"];\n}\n\n/** Plain OKLCH triplet for JSON serialisation (no Color dependency) */\nexport interface OklchPlain {\n l: number;\n c: number;\n h: number;\n}\n\n/** Serialised color pair as stored in the backend payload */\nexport interface ThemeColorPlain {\n base: OklchPlain;\n foreground: OklchPlain;\n}\n\n/** Backend payload — plain JSON, no Color objects */\nexport interface ThemePayload {\n [key: string]: unknown;\n id: string;\n name: string;\n light: Record<SemanticColorName, ThemeColorPlain>;\n dark: Partial<\n Record<SemanticColorName, { base?: OklchPlain; foreground?: OklchPlain }>\n >;\n fontSizes: Record<FontSizeKey, string>;\n fontFamilies: Record<FontFamilyKey, string>;\n spacing: string;\n radii: Record<RadiusKey, string>;\n syncWithBrandColors?: boolean;\n}\n","import Color from \"colorjs.io\";\nimport {\n SEMANTIC_COLOR_NAMES,\n SHADE_STEPS,\n type SemanticColorName,\n type ShadeStep,\n type ThemeColorInput,\n type ThemeDefinition,\n type ResolvedColorSet,\n type ResolvedTheme,\n} from \"./types\";\n\n/**\n * Attempt to convert any string into a Color using colorjs.io.\n * If the string is exactly 6 characters it is assumed to be a bare hex value\n * (e.g. \"3b82f6\") and a \"#\" prefix is added before parsing.\n *\n * @returns the parsed Color, or a neutral gray (`oklch(0.5 0 0)`) on failure\n */\nexport function parseColor(value: string): Color {\n if (value.length === 6) {\n value = `#${value}`;\n }\n try {\n return new Color(value);\n } catch (error) {\n console.warn(\"[theme] Failed to parse color:\", value, error);\n return new Color(\"oklch\", [0.5, 0, 0]);\n }\n}\n\n/**\n * Returns either the original foreground or a corrected lightness variant,\n * whichever provides better contrast against `color`.\n * Inversion triggers when the APCA contrast is below 50.\n */\nexport function getForegroundColor(foreground: Color, color: Color): Color {\n if (foreground.oklch.l == null || color.oklch.l == null) {\n return foreground;\n }\n const contrast = color.contrastAPCA(foreground);\n\n if (contrast < 50) {\n return new Color(\"oklch\", [\n color.oklch.l < 0.7 ? 0.95 : 0.15,\n foreground.oklch.c || 0,\n foreground.oklch.h || 0,\n ]);\n }\n return foreground;\n}\n\n/**\n * Generate a 100–900 shade ramp from a base color.\n * Base anchors at 500. Light shades (100–400) step toward white,\n * dark shades (600–900) step toward black. Dark steps use an asymmetric\n * multiplier (1.6×, 1.875×, 3×, 4× of `darkStep`) for a more gradual\n * initial descent. Chroma is nudged per step for perceptually natural ramps.\n */\nexport function generateShades(base: Color): Record<ShadeStep, Color> {\n const l = base.oklch.l ?? 0;\n const c = base.oklch.c ?? 0;\n const h = base.oklch.h ?? 0;\n\n const safeMax = l >= 0.885 ? 0.995 : 0.97;\n const safeMin = l <= 0.33 ? 0 : 0.21;\n\n const lightStep = (safeMax - l) / 5;\n const darkStep = -(l - safeMin) / 8;\n\n const shade = (lDelta: number, cDelta: number): Color => {\n return new Color(\"oklch\", [\n Math.max(0, Math.min(1, l + lDelta)),\n c <= 0.001 ? c : Math.max(0, c + cDelta),\n h,\n ]);\n };\n\n return {\n 100: shade(5 * lightStep, -0.00375),\n 200: shade(4 * lightStep, -0.00375),\n 300: shade(3 * lightStep, -0.00375),\n 400: shade(2 * lightStep, -0.00375),\n 500: new Color(\"oklch\", [l, c, h]),\n 600: shade(1.6 * darkStep, 0.025),\n 700: shade(1.875 * 2 * darkStep, 0.05),\n 800: shade(3 * 2 * darkStep, 0.075),\n 900: shade(4 * 2 * darkStep, 0.1),\n };\n}\n\n// ── Dark Mode Derivation ────────────────────────────────────────────\n//\n// Dark-mode colors are derived from their light counterparts by adjusting\n// OKLCH lightness and optionally scaling chroma. Neutral slots (background,\n// foreground, muted) use fixed lightness values while chromatic slots\n// (primary, secondary, accent, destructive) invert lightness around 0.5.\n\nconst DARK_DERIVATION_CONFIG: Record<\n SemanticColorName,\n {\n baseLightness: number | \"invert\";\n fgLightness: number | \"invert\";\n chromaScale?: number;\n }\n> = {\n background: { baseLightness: 0.15, fgLightness: 0.93 },\n foreground: { baseLightness: 0.93, fgLightness: 0.15 },\n muted: { baseLightness: 0.22, fgLightness: 0.75 },\n primary: { baseLightness: \"invert\", fgLightness: 0.95, chromaScale: 0.9 },\n secondary: { baseLightness: \"invert\", fgLightness: 0.93, chromaScale: 0.85 },\n accent: { baseLightness: \"invert\", fgLightness: 0.95, chromaScale: 0.9 },\n destructive: {\n baseLightness: \"invert\",\n fgLightness: 0.95,\n chromaScale: 0.95,\n },\n};\n\n/** Invert OKLCH lightness (1 - l), clamped to [0.35, 0.75] to avoid extremes. */\nfunction invertLightness(l: number): number {\n const inverted = 1 - l;\n return Math.max(0.35, Math.min(0.75, inverted));\n}\n\n/**\n * Derive a dark-mode ThemeColorInput from its light-mode counterpart.\n */\nexport function deriveDarkVariant(\n name: SemanticColorName,\n light: ThemeColorInput,\n): ThemeColorInput {\n const config = DARK_DERIVATION_CONFIG[name];\n const chromaScale = config.chromaScale ?? 1;\n\n const baseLightness =\n config.baseLightness === \"invert\"\n ? invertLightness(light.base.oklch.l ?? 0)\n : config.baseLightness;\n\n const fgLightness =\n config.fgLightness === \"invert\"\n ? invertLightness(light.foreground.oklch.l ?? 0)\n : config.fgLightness;\n\n return {\n base: new Color(\"oklch\", [\n baseLightness,\n (light.base.oklch.c || 0) * chromaScale,\n light.base.oklch.h || 0,\n ]),\n foreground: new Color(\"oklch\", [\n fgLightness,\n (light.foreground.oklch.c || 0) * chromaScale,\n light.foreground.oklch.h || 0,\n ]),\n };\n}\n\n// ── Dark Mode Merge ─────────────────────────────────────────────────\n\n/**\n * Merge auto-derived dark colors with any user-specified overrides.\n * For each semantic color, if the user has fully overridden both base and\n * foreground those are used; otherwise the missing channels are derived.\n */\nexport function mergeDarkOverrides(\n def: ThemeDefinition,\n): Record<SemanticColorName, ThemeColorInput> {\n const darkColors = {} as Record<SemanticColorName, ThemeColorInput>;\n\n for (const name of SEMANTIC_COLOR_NAMES) {\n const lightInput = def.light[name];\n const darkOverride = def.dark[name];\n\n if (darkOverride?.base && darkOverride?.foreground) {\n darkColors[name] = darkOverride as ThemeColorInput;\n } else if (darkOverride) {\n const base =\n darkOverride.base ?? deriveDarkVariant(name, lightInput).base;\n darkColors[name] = {\n base: base,\n foreground:\n darkOverride.foreground ??\n getForegroundColor(def.light.foreground.base, base),\n };\n } else {\n darkColors[name] = deriveDarkVariant(name, lightInput);\n }\n }\n\n return darkColors;\n}\n\n// ── Theme Resolution ────────────────────────────────────────────────\n\nfunction resolveColorSet(\n colors: Record<SemanticColorName, ThemeColorInput>,\n): ResolvedColorSet {\n const resolved = {} as ResolvedColorSet;\n\n for (const name of SEMANTIC_COLOR_NAMES) {\n const input = colors[name];\n const shades = generateShades(input.base);\n const resolvedShades = {} as Record<ShadeStep, Color>;\n\n for (const step of SHADE_STEPS) {\n resolvedShades[step] = shades[step];\n }\n\n resolved[name] = {\n base: input.base.clone(),\n foreground: input.foreground.clone(),\n shades: resolvedShades,\n };\n }\n\n return resolved;\n}\n\n/**\n * Resolve a ThemeDefinition into a complete ResolvedTheme.\n * Dark mode colors are derived from light where not overridden.\n */\nexport function resolveTheme(def: ThemeDefinition): ResolvedTheme {\n return {\n id: def.id,\n name: def.name,\n light: resolveColorSet(def.light),\n dark: resolveColorSet(mergeDarkOverrides(def)),\n fontSizes: { ...def.fontSizes },\n fontFamilies: { ...def.fontFamilies },\n spacing: def.spacing,\n radii: { ...def.radii },\n };\n}\n","import { SHADE_STEPS, type SemanticColorName, type ShadeStep } from \"./types\";\n\n/**\n * Specific overrides, otherwise all the overrides are generated using emitTailwindOverrides\n */\nconst OVERRIDES: Partial<Record<string, string>> = {\n \"--color-gray-50\": \"var(--color-muted)\",\n \"--color-gray-100\": \"var(--color-muted-600)\",\n \"--color-gray-200\": \"var(--color-border)\",\n} as const;\n\n/**\n * Returns the inverted shade for dark mode foreground colors.\n * In dark mode, light shades (50, 100) should map to dark values (950, 900) and vice versa.\n */\nfunction getInvertedStep(shade: ShadeStep): ShadeStep {\n const shadeIndex = SHADE_STEPS.indexOf(shade);\n const invertedIndex = SHADE_STEPS.length - 1 - shadeIndex;\n return SHADE_STEPS[invertedIndex] || 500;\n}\n\n/**\n * Map semantic colors to Tailwind built-in color names.\n */\nexport function emitTailwindOverrides(darkMode: boolean = false): string[] {\n const TAILWIND_COLOR_MAP: Record<string, SemanticColorName> = {\n gray: \"foreground\",\n red: \"destructive\",\n blue: \"primary\",\n green: \"accent\",\n };\n\n const TAILWIND_SHADES = [\n 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950,\n ] as const;\n const SHADE_REMAP: Partial<Record<number, ShadeStep>> = {\n 50: 100,\n 950: 900,\n };\n\n const lines: string[] = [];\n for (const [twName, semantic] of Object.entries(TAILWIND_COLOR_MAP)) {\n for (const shade of TAILWIND_SHADES) {\n const step = (SHADE_REMAP[shade] ?? shade) as ShadeStep;\n const override = OVERRIDES[`--color-${twName}-${shade}`];\n lines.push(\n `--color-${twName}-${shade}: ${override ? override : `var(--color-${semantic}-${semantic === \"foreground\" && darkMode === true ? getInvertedStep(step) : step})`};`,\n );\n }\n }\n\n lines.push(\"--color-white: var(--color-background);\");\n lines.push(\"--color-black: var(--color-foreground);\");\n\n return lines;\n}\n","import { emitTailwindOverrides } from \"./tailwind-overrides\";\nimport {\n SEMANTIC_COLOR_NAMES,\n SHADE_STEPS,\n FONT_SIZE_KEYS,\n FONT_FAMILY_KEYS,\n RADIUS_KEYS,\n type ResolvedColorSet,\n type ResolvedTheme,\n} from \"./types\";\n\nfunction colorToCSS(color: import(\"colorjs.io\").default): string {\n const result = color.toString({ format: \"oklch\" });\n if (result.includes(\"NaN\")) {\n console.warn(\n \"[theme] colorToCSS produced NaN, using neutral fallback:\",\n result,\n );\n return \"oklch(0.5 0 0)\";\n }\n return result;\n}\n\nfunction camelToKebab(str: string): string {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Emit --color-{name}, --color-{name}-foreground, --color-{name}-{shade} vars.\n * Uses --color- prefix to match rep-widgets/tailwind.config.ts.\n */\nfunction emitColorVars(colors: ResolvedColorSet): string[] {\n const lines: string[] = [];\n\n for (const name of SEMANTIC_COLOR_NAMES) {\n const color = colors[name];\n lines.push(`--color-${name}: ${colorToCSS(color.base)};`);\n lines.push(`--color-${name}-foreground: ${colorToCSS(color.foreground)};`);\n for (const step of SHADE_STEPS) {\n lines.push(`--color-${name}-${step}: ${colorToCSS(color.shades[step])};`);\n }\n }\n\n return lines;\n}\n\n/**\n * Emit non-color CSS variables (font sizes, families, spacing, radii).\n */\nfunction emitNonColorVars(theme: ResolvedTheme): string[] {\n const lines: string[] = [];\n for (const key of FONT_SIZE_KEYS) {\n lines.push(`--font-size-${camelToKebab(key)}: ${theme.fontSizes[key]};`);\n }\n for (const key of FONT_FAMILY_KEYS) {\n lines.push(`--font-${key}: ${theme.fontFamilies[key]};`);\n }\n lines.push(`--spacing: ${theme.spacing};`);\n for (const key of RADIUS_KEYS) {\n lines.push(`--radius-${camelToKebab(key)}: ${theme.radii[key]};`);\n }\n return lines;\n}\n\n/**\n * Static CSS alias variables that bridge theme var names to Tailwind/component conventions.\n * These are always emitted and not mode-dependent.\n */\nconst globalCSSOverride = [\n \"--color-background-foreground: var(--color-foreground);\",\n \"--color-foreground-foreground: var(--color-background);\",\n \"--color-contrast: var(--color-foreground);\",\n ...SEMANTIC_COLOR_NAMES.map((value) => `--${value}: var(--color-${value});`),\n ...SEMANTIC_COLOR_NAMES.map(\n (value) => `--${value}-foreground: var(--color-${value}-foreground);`,\n ),\n\n \"--sidebar-ring: var(--color-primary);\",\n \"--sidebar-border: var(--color-border);\",\n \"--sidebar-accent-foreground: var(--color-accent-foreground);\",\n \"--sidebar-accent: var(--color-accent);\",\n \"--sidebar-primary-foreground: var(--color-primary-foreground);\",\n \"--sidebar-primary: var(--color-primary);\",\n \"--sidebar-foreground: var(--color-muted-foreground);\",\n \"--sidebar: var(--color-muted);\",\n \"--border: var(--color-background-600);\",\n \"--ring: var(--color-primary);\",\n \"--popover: var(--color-background);\",\n \"--popover-foreground: var(--color-foreground);\",\n \"--card: var(--color-muted);\",\n \"--card-foreground: var(--color-muted-foreground);\",\n\n \"--radius-sm: var(--radius-small);\",\n \"--radius-md: var(--radius-medium);\",\n \"--radius-lg: var(--radius-large);\",\n \"--radius-xl: var(--radius-extra-large);\",\n \"--text-xs: var(--font-size-extra-small);\",\n \"--text-sm: var(--font-size-small);\",\n \"--text-base: var(--font-size-regular);\",\n \"--text-lg: var(--font-size-large);\",\n \"--text-xl: var(--font-size-extra-large);\",\n \"--text-2xl: var(--font-size-giant);\",\n \"--font-sans: var(--font-body);\",\n // Tailwind's font-mono is repurposed as the display/header font\n \"--font-mono: var(--font-header);\",\n];\n\n/**\n * Overrides for global tailwindcss for specifically dark mode.\n */\nconst globalDarkCSSOverride = [\"--border: var(--color-background-400);\"];\n\nexport interface GenerateThemeCSSOptions {\n /** Whether or not to allow prefers-color-scheme to choose the theme mode */\n disableAutoTheme?: boolean;\n /** Whether to emit Tailwind built-in color overrides (default true) */\n mapTailwindColors?: boolean;\n}\n\n/**\n * Generate a complete CSS string for a resolved theme.\n * Outputs 2–3 blocks: light default, dark explicit via `[data-theme-mode=\"dark\"]`,\n * and (unless `disableAutoTheme`) a `prefers-color-scheme: dark` media query block.\n */\nexport function generateThemeCSS(\n theme: ResolvedTheme,\n options: GenerateThemeCSSOptions = {},\n): string {\n const sel = `[data-theme=\"${theme.id}\"]`;\n const tw = options.mapTailwindColors ?? true;\n const blocks: string[] = [];\n\n // Light mode (default)\n blocks.push(`${sel} {`);\n blocks.push(...globalCSSOverride);\n blocks.push(...emitNonColorVars(theme));\n blocks.push(...emitColorVars(theme.light));\n if (tw) blocks.push(...emitTailwindOverrides());\n blocks.push(`}`);\n\n // Dark mode: explicit via attribute\n blocks.push(`${sel}[data-theme-mode=\"dark\"] {`);\n blocks.push(...globalDarkCSSOverride);\n blocks.push(...emitColorVars(theme.dark));\n if (tw) blocks.push(...emitTailwindOverrides(true));\n blocks.push(`}`);\n\n // Dark mode: auto via system preference\n if (!options.disableAutoTheme) {\n blocks.push(`@media (prefers-color-scheme: dark) {`);\n blocks.push(`${sel}:not([data-theme-mode]) {`);\n blocks.push(...globalDarkCSSOverride);\n blocks.push(...emitColorVars(theme.dark).map((l) => `${l}`));\n if (tw) blocks.push(...emitTailwindOverrides(true).map((l) => `${l}`));\n blocks.push(`}`);\n blocks.push(`}`);\n }\n\n return blocks.join(\"\\n\");\n}\n","import Color from \"colorjs.io\";\nimport type {\n FontSizeKey,\n FontFamilyKey,\n RadiusKey,\n ThemeDefinition,\n} from \"./types\";\nimport { getForegroundColor } from \"./color-engine\";\n\n// ── Non-color defaults ──────────────────────────────────────────────\n\nexport const DEFAULT_FONT_SIZES: Record<FontSizeKey, string> = {\n extraSmall: \"0.75rem\",\n small: \"0.875rem\",\n regular: \"1rem\",\n large: \"1.125rem\",\n extraLarge: \"1.25rem\",\n giant: \"1.5rem\",\n};\n\nexport const DEFAULT_FONT_FAMILIES: Record<FontFamilyKey, string> = {\n header: \"var(--font-inter)\",\n body: \"var(--font-inter)\",\n};\n\nexport const DEFAULT_SPACING = \"0.25rem\";\n\nexport const DEFAULT_RADII: Record<RadiusKey, string> = {\n small: \"0.25rem\",\n medium: \"0.5rem\",\n large: \"0.75rem\",\n extraLarge: \"1rem\",\n};\n\n// ── Default colors (hex) ────────────────────────────────────────────\n\nexport const DEFAULT_COLORS = {\n background: \"#ffffff\",\n foreground: \"#1a1a1a\",\n primary: \"#3b82f6\",\n secondary: \"#6b7280\",\n accent: \"#10b981\",\n muted: \"#f3f4f6\",\n destructive: \"#ef4444\",\n mutedForeground: \"#6b7280\",\n} as const;\n\n// ── Default theme identity ──────────────────────────────────────────\n\nexport const DEFAULT_THEME_ID = \"default\";\nexport const DEFAULT_THEME_NAME = \"Default Theme\";\n\n// ── Factory ─────────────────────────────────────────────────────────\n\n/**\n * Build a fresh ThemeDefinition populated with all defaults.\n * Returns a new object each call because Color instances are mutable — do not cache the result.\n */\nexport function getDefaultThemeDefinition(): ThemeDefinition {\n const bg = new Color(DEFAULT_COLORS.background);\n const fg = new Color(DEFAULT_COLORS.foreground);\n const primary = new Color(DEFAULT_COLORS.primary);\n const secondary = new Color(DEFAULT_COLORS.secondary);\n const accent = new Color(DEFAULT_COLORS.accent);\n const muted = new Color(DEFAULT_COLORS.muted);\n const destructive = new Color(DEFAULT_COLORS.destructive);\n const mutedFg = new Color(DEFAULT_COLORS.mutedForeground);\n\n const darkBg = new Color(\"#0a0a0a\");\n const darkFg = new Color(\"#fafafa\");\n const darkMuted = new Color(\"#171717\");\n const darkMutedForeground = new Color(\"#dddddd\");\n\n return {\n id: DEFAULT_THEME_ID,\n name: DEFAULT_THEME_NAME,\n light: {\n background: { base: bg, foreground: fg },\n foreground: { base: fg, foreground: bg },\n primary: {\n base: primary,\n foreground: getForegroundColor(fg, primary),\n },\n secondary: {\n base: secondary,\n foreground: getForegroundColor(fg, secondary),\n },\n accent: {\n base: accent,\n foreground: getForegroundColor(fg, accent),\n },\n muted: { base: muted, foreground: mutedFg },\n destructive: {\n base: destructive,\n foreground: getForegroundColor(fg, destructive),\n },\n },\n dark: {\n background: { base: darkBg, foreground: darkFg },\n foreground: { base: darkFg, foreground: darkBg },\n muted: { base: darkMuted, foreground: darkMutedForeground },\n },\n fontSizes: { ...DEFAULT_FONT_SIZES },\n fontFamilies: { ...DEFAULT_FONT_FAMILIES },\n spacing: DEFAULT_SPACING,\n radii: { ...DEFAULT_RADII },\n };\n}\n","import Color from \"colorjs.io\";\nimport {\n SEMANTIC_COLOR_NAMES,\n type SemanticColorName,\n type ThemeColorInput,\n type ThemeDefinition,\n type ThemePayload,\n type OklchPlain,\n type FontSizeKey,\n type FontFamilyKey,\n type RadiusKey,\n} from \"./types\";\nimport {\n DEFAULT_FONT_SIZES,\n DEFAULT_FONT_FAMILIES,\n DEFAULT_SPACING,\n DEFAULT_RADII,\n getDefaultThemeDefinition,\n} from \"./defaults\";\n\nfunction colorToPlain(color: Color): OklchPlain {\n return {\n l: color.oklch.l ?? 0,\n c: color.oklch.c ?? 0,\n h: color.oklch.h ?? 0,\n };\n}\n\nfunction plainToColor(plain: OklchPlain): Color {\n return new Color(\"oklch\", [plain.l, plain.c, plain.h]);\n}\n\n/**\n * Serialise a ThemeDefinition (with Color objects) to a plain JSON payload\n * suitable for backend storage.\n */\nexport function serialiseTheme(def: ThemeDefinition): ThemePayload {\n const light = {} as ThemePayload[\"light\"];\n for (const name of SEMANTIC_COLOR_NAMES) {\n light[name] = {\n base: colorToPlain(def.light[name].base),\n foreground: colorToPlain(def.light[name].foreground),\n };\n }\n\n const dark: ThemePayload[\"dark\"] = {};\n for (const [name, value] of Object.entries(def.dark)) {\n if (!value) continue;\n dark[name as SemanticColorName] = {\n ...(value.base ? { base: colorToPlain(value.base) } : {}),\n ...(value.foreground\n ? { foreground: colorToPlain(value.foreground) }\n : {}),\n };\n }\n\n return {\n id: def.id,\n name: def.name,\n light,\n dark,\n fontSizes: { ...def.fontSizes },\n fontFamilies: { ...def.fontFamilies },\n spacing: def.spacing,\n radii: { ...def.radii },\n ...(def.syncWithBrandColors ? { syncWithBrandColors: true } : {}),\n };\n}\n\n/**\n * Deserialise a backend payload into a ThemeDefinition with Color objects.\n * Accepts `Record<string, unknown>` because API data is untyped at the boundary.\n * Falls back to default colors for any missing light-mode entries.\n */\nexport function deserialiseTheme(\n payload: Record<string, unknown>,\n): ThemeDefinition {\n const lightRaw = ((payload.light as Record<string, unknown> | undefined) ??\n {}) as Record<string, { base: OklchPlain; foreground: OklchPlain }>;\n const darkRaw = ((payload.dark as Record<string, unknown> | undefined) ??\n {}) as Record<string, { base?: OklchPlain; foreground?: OklchPlain }>;\n\n const defaults = getDefaultThemeDefinition();\n const light = {} as Record<SemanticColorName, ThemeColorInput>;\n for (const name of SEMANTIC_COLOR_NAMES) {\n const entry = lightRaw[name];\n if (entry) {\n light[name] = {\n base: plainToColor(entry.base),\n foreground: plainToColor(entry.foreground),\n };\n } else {\n console.warn(\n `[theme] deserialiseTheme: missing light color \"${name}\", using default`,\n );\n light[name] = defaults.light[name];\n }\n }\n\n const dark: Partial<Record<SemanticColorName, Partial<ThemeColorInput>>> = {};\n for (const [name, value] of Object.entries(darkRaw)) {\n if (!value) continue;\n dark[name as SemanticColorName] = {\n ...(value.base ? { base: plainToColor(value.base) } : {}),\n ...(value.foreground\n ? { foreground: plainToColor(value.foreground) }\n : {}),\n };\n }\n\n return {\n id: payload.id as string,\n name: payload.name as string,\n light,\n dark,\n fontSizes: (payload.fontSizes ?? DEFAULT_FONT_SIZES) as Record<\n FontSizeKey,\n string\n >,\n fontFamilies: (payload.fontFamilies ?? DEFAULT_FONT_FAMILIES) as Record<\n FontFamilyKey,\n string\n >,\n spacing: (payload.spacing as string) ?? DEFAULT_SPACING,\n radii: (payload.radii ?? DEFAULT_RADII) as Record<RadiusKey, string>,\n ...(payload.syncWithBrandColors === true\n ? { syncWithBrandColors: true }\n : {}),\n };\n}\n","/**\n * Theme Transforms\n * Convert raw API theme objects to ThemeDefinition format.\n * Handles both new structured format (OKLCH) and legacy flat format (hex strings).\n */\n\nimport type { ThemeDefinition } from \"./types\";\nimport { deserialiseTheme } from \"./serialisation\";\nimport { parseColor, getForegroundColor } from \"./color-engine\";\nimport {\n DEFAULT_COLORS,\n DEFAULT_FONT_SIZES,\n DEFAULT_FONT_FAMILIES,\n DEFAULT_SPACING,\n DEFAULT_RADII,\n} from \"./defaults\";\n\n/** Shape of a raw theme from the FluidOS API */\nexport interface RawApiTheme {\n id: number;\n config?: Record<string, unknown> | null;\n active?: boolean | null;\n name?: string | null;\n}\n\n/**\n * Check if a theme config uses the new structured format (has a `light` key\n * that is an object) vs the legacy flat format.\n */\nfunction isNewThemeFormat(config: Record<string, unknown>): boolean {\n return config.light != null && typeof config.light === \"object\";\n}\n\n/**\n * Convert a legacy flat config to a ThemeDefinition.\n * Legacy format: { base: \"#fff\", text: \"#000\", primary: \"oklch(0.6 0.2 250)\", ... }\n */\nfunction legacyConfigToDefinition(\n id: number,\n name: string,\n config: Record<string, string>,\n): ThemeDefinition {\n const bg = parseColor(\n config.base ?? config.background ?? DEFAULT_COLORS.background,\n );\n const fg = parseColor(\n config.text ?? config.foreground ?? DEFAULT_COLORS.foreground,\n );\n const primary = parseColor(config.primary ?? DEFAULT_COLORS.primary);\n const secondary = parseColor(config.secondary ?? DEFAULT_COLORS.secondary);\n const accent = parseColor(config.accent ?? DEFAULT_COLORS.accent);\n const muted = parseColor(config.muted ?? DEFAULT_COLORS.muted);\n const destructive = parseColor(\n config.destructive ?? DEFAULT_COLORS.destructive,\n );\n const mutedFg = parseColor(\n config.mutedForeground ?? DEFAULT_COLORS.mutedForeground,\n );\n\n return {\n id: String(id),\n name,\n light: {\n background: { base: bg, foreground: fg },\n foreground: { base: fg, foreground: bg },\n primary: {\n base: primary,\n foreground: getForegroundColor(fg, primary),\n },\n secondary: {\n base: secondary,\n foreground: getForegroundColor(fg, secondary),\n },\n accent: {\n base: accent,\n foreground: getForegroundColor(fg, accent),\n },\n muted: { base: muted, foreground: mutedFg },\n destructive: {\n base: destructive,\n foreground: getForegroundColor(fg, destructive),\n },\n },\n dark: {},\n fontSizes: {\n extraSmall: config.extraSmall ?? DEFAULT_FONT_SIZES.extraSmall,\n small: config.small ?? DEFAULT_FONT_SIZES.small,\n regular: config.regular ?? DEFAULT_FONT_SIZES.regular,\n large: config.large ?? DEFAULT_FONT_SIZES.large,\n extraLarge: config.extraLarge ?? DEFAULT_FONT_SIZES.extraLarge,\n giant: config.giant ?? DEFAULT_FONT_SIZES.giant,\n },\n fontFamilies: {\n header: config.headerFont ?? DEFAULT_FONT_FAMILIES.header,\n body: config.bodyFont ?? DEFAULT_FONT_FAMILIES.body,\n },\n spacing: config.globalSpacing ?? DEFAULT_SPACING,\n radii: {\n small: config.radiusSmall ?? DEFAULT_RADII.small,\n medium: config.radiusMedium ?? DEFAULT_RADII.medium,\n large: config.radiusLarge ?? DEFAULT_RADII.large,\n extraLarge: config.radiusExtraLarge ?? DEFAULT_RADII.extraLarge,\n },\n };\n}\n\n/**\n * Build a ThemeDefinition from a single API theme object.\n * Handles both new structured format and legacy flat format.\n */\nexport function buildThemeDefinition(theme: RawApiTheme): ThemeDefinition {\n const config = (theme.config ?? {}) as Record<string, unknown>;\n\n if (isNewThemeFormat(config)) {\n return deserialiseTheme({\n ...config,\n id: String(theme.id),\n name: theme.name ?? \"Untitled Theme\",\n });\n }\n\n return legacyConfigToDefinition(\n theme.id,\n theme.name ?? \"Untitled Theme\",\n config as Record<string, string>,\n );\n}\n\n/**\n * Transform raw API themes to ThemeDefinition[].\n * Catches and logs errors per theme (graceful degradation).\n */\nexport function transformThemes(themes: RawApiTheme[]): ThemeDefinition[] {\n return themes.flatMap((theme) => {\n try {\n return [buildThemeDefinition(theme)];\n } catch (error) {\n console.error(`[theme] Failed to build theme id=${theme.id}:`, error);\n return [];\n }\n });\n}\n\n/**\n * Get the active theme ID from a list of raw API themes.\n * Falls back to the first theme if none is marked active.\n */\nexport function getActiveThemeId(themes: RawApiTheme[]): string | undefined {\n const active = themes.find((t) => t.active) ?? themes[0];\n return active ? String(active.id) : undefined;\n}\n","import { generateThemeCSS } from \"./css-generator\";\nimport type { ResolvedTheme } from \"./types\";\nimport type { GenerateThemeCSSOptions } from \"./css-generator\";\n\nconst STYLE_PREFIX = \"theme-style-\";\n\n/**\n * Inject or update a `<style>` element in `<head>` for the given theme.\n * The element ID is deterministic (`theme-style-{themeId}`) so repeated calls\n * for the same theme are idempotent — the existing element is updated in place.\n * No-op when `document` is unavailable (SSR).\n */\nexport function applyTheme(\n theme: ResolvedTheme,\n options?: GenerateThemeCSSOptions,\n): void {\n if (typeof document === \"undefined\") return;\n\n try {\n const styleId = `${STYLE_PREFIX}${theme.id}`;\n let el = document.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!el) {\n el = document.createElement(\"style\");\n el.id = styleId;\n document.head.appendChild(el);\n }\n\n el.textContent = generateThemeCSS(theme, options);\n } catch (error) {\n console.error(`[theme] applyTheme failed for \"${theme.id}\":`, error);\n }\n}\n\n/** Remove an injected theme stylesheet. No-op during SSR. */\nexport function removeTheme(themeId: string): void {\n if (typeof document === \"undefined\") return;\n document.getElementById(`${STYLE_PREFIX}${themeId}`)?.remove();\n}\n\n/** Remove all injected theme stylesheets. No-op during SSR. */\nexport function removeAllThemes(): void {\n if (typeof document === \"undefined\") return;\n document\n .querySelectorAll(`style[id^=\"${STYLE_PREFIX}\"]`)\n .forEach((el) => el.remove());\n}\n"],"mappings":";;;;;AAGA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAGD,MAAa,cAAc;CACzB;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CACzC;AAGD,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACD;AAGD,MAAa,mBAAmB,CAAC,UAAU,OAAO;AAGlD,MAAa,cAAc;CAAC;CAAS;CAAU;CAAS;CAAa;;;;;;;;;;ACbrE,SAAgB,WAAW,OAAsB;AAC/C,KAAI,MAAM,WAAW,EACnB,SAAQ,IAAI;AAEd,KAAI;AACF,SAAO,IAAIA,WAAAA,QAAM,MAAM;UAChB,OAAO;AACd,UAAQ,KAAK,kCAAkC,OAAO,MAAM;AAC5D,SAAO,IAAIA,WAAAA,QAAM,SAAS;GAAC;GAAK;GAAG;GAAE,CAAC;;;;;;;;AAS1C,SAAgB,mBAAmB,YAAmB,OAAqB;AACzE,KAAI,WAAW,MAAM,KAAK,QAAQ,MAAM,MAAM,KAAK,KACjD,QAAO;AAIT,KAFiB,MAAM,aAAa,WAAW,GAEhC,GACb,QAAO,IAAIA,WAAAA,QA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