@uisatin/ui 0.1.0 → 0.1.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type AgentLoadingIndicator } from './agent-loading';
2
+ import { type AgentLoadingIndicator } from './agent-loading.js';
3
3
  /**
4
4
  * Thinking, 1:1 with the uiKit `Thinking` set (3239:20908) and its parts thinking/header
5
5
  * (3239:20766), thinking/step (3239:20791) and thinking/_mark (3239:20674).
package/index.d.ts CHANGED
@@ -1,64 +1,64 @@
1
- export { cn } from './lib/utils';
2
- export * from './theme';
3
- export * from './components/accordion';
4
- export * from './components/avatar';
5
- export { Badge, badgeVariants, type BadgeProps, type BadgeTone } from './components/badge';
6
- export * from './components/banner';
7
- export { Breadcrumb, type BreadcrumbProps, type BreadcrumbItem } from './components/breadcrumb';
8
- export { Button, buttonVariants, type ButtonProps } from './components/button';
9
- export * from './components/card';
10
- export { ChartCard, ChartTooltip, ChartLegendRow, ChartLegendPill, type ChartDatum, type ChartCardBaseProps } from './components/chart';
11
- export { LineCard, AreaCard, type LineCardProps } from './components/line-chart';
12
- export { DonutCard, type DonutCardProps } from './components/donut-chart';
13
- export { BarCard, type BarCardProps } from './components/bar-chart';
14
- export { ChannelCard, type ChannelCardProps } from './components/channel-chart';
15
- export { Checkbox, type CheckboxProps } from './components/checkbox';
16
- export { Chip, ChipAvatar, chipVariants, type ChipProps } from './components/chip';
17
- export { Combobox, type ComboboxProps } from './components/combobox';
18
- export { CommandMenu, type CommandMenuProps, type CommandItem, type CommandGroup } from './components/command-menu';
19
- export { CodeBlock, type CodeBlockProps } from './components/code-block';
20
- export { Dialog, DialogClose, DialogAlert, CloseIcon, type DialogProps, type DialogVariant, type DialogAlertProps, type DialogAlertIntent } from './components/dialog';
21
- export * from './components/dot';
22
- export { Floating, type FloatingProps, type FloatingSide } from './components/floating';
23
- export { DropdownMenu, DropdownMenuGroup, DropdownMenuItem, MenuItemContent, menuItemClass, menuSurfaceClass, menuGroupClass, menuGroupLabelClass, type DropdownMenuProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type MenuItemContentProps } from './components/dropdown';
24
- export { FormField, useFormField, type FormFieldProps, type FormFieldContextValue } from './components/form-field';
25
- export { Input, type InputProps } from './components/input';
26
- export * from './components/kbd';
27
- export { Pagination, paginationRange, type PaginationProps } from './components/pagination';
28
- export { Popover, PopoverClose, PopoverPanel, type PopoverProps } from './components/popover';
29
- export { Progress, type ProgressProps } from './components/progress';
30
- export { Radio, RadioGroup, type RadioProps, type RadioGroupProps } from './components/radio';
31
- export { SearchBar, type SearchBarProps } from './components/search-bar';
32
- export { Select, FieldChrome, useFieldChrome, SelectChevron, type SelectProps, type SelectOption, type SelectGroup } from './components/select';
33
- export { SegmentedControl, type SegmentedControlItem, type SegmentedControlProps } from './components/segmented-control';
34
- export { Sheet, SheetClose, type SheetProps } from './components/sheet';
35
- export * from './components/sidebar';
36
- export { Skeleton, type SkeletonProps } from './components/skeleton';
37
- export { Slider, type SliderProps } from './components/slider';
38
- export { Switch, type SwitchProps } from './components/switch';
39
- export { Table, type TableProps, type Column, type Row, type Sort } from './components/table';
40
- export { Tabs, TabsContent, type TabsProps, type TabItem } from './components/tabs';
41
- export { Textarea, type TextareaProps } from './components/textarea';
42
- export { Toast, Toaster, toast, type ToastProps, type ToasterProps, type ToastOptions, type ToastIntent, type ToastAction } from './components/toast';
43
- export { Toggle, toggleVariants, type ToggleProps } from './components/toggle';
44
- export { Tooltip, TooltipBubble, type TooltipProps } from './components/tooltip';
45
- export * from './components/agent-picker';
46
- export * from './components/attachment';
47
- export * from './components/decision-card';
48
- export * from './components/empty-state';
49
- export { Message, type MessageProps, type MessageSource } from './components/message';
50
- export { MessageActions, type MessageActionsProps, type MessageFeedback } from './components/message-actions';
51
- export { PromptBar, defaultActions as promptBarDefaultActions, type PromptBarProps, type PromptBarModel, type PromptBarAction } from './components/prompt-bar';
52
- export { StreamingText, type StreamingTextProps } from './components/streaming-text';
53
- export { Thinking, type ThinkingProps, type ThinkingStep, type ThinkingState, type ThinkingIndicator } from './components/thinking';
54
- export { AgentLoading, type AgentLoadingProps, type AgentLoadingIndicator, TetrisMark, TetrisLabel, TetrisStill, FlappySprite, ShimmerLabel, type Glimmer } from './components/agent-loading';
55
- export { FileUpload, FileUploadItem, fileIconFor, formatBytes, type FileUploadProps, type FileUploadFile, type FileUploadRejection, type FileUploadStatus } from './components/file-upload';
56
- export { InputOTP, type InputOTPProps } from './components/input-otp';
57
- export { NumberInput, type NumberInputProps } from './components/number-input';
58
- export { ContextMenu, ContextMenuItem, ContextMenuSub, ContextMenuSeparator, type ContextMenuProps, type ContextMenuItemProps, type ContextMenuSubProps } from './components/context-menu';
59
- export { HoverCard, hoverCardClass, type HoverCardProps } from './components/hover-card';
60
- export { Citation, Sources, type CitationProps, type CitationSource, type SourcesProps } from './components/citations';
61
- export { Calendar, DatePicker, DatePickerPanel, DateRangePicker, DateRangePickerPanel, formatDate, formatRange, type CalendarProps, type DatePickerProps, type DatePickerPanelProps, type DateRangePickerPanelProps, type DateRangePickerProps, type DateRange } from './components/date-picker';
62
- export { AgentSuggestion, AgentSuggestionQuote, AgentSuggestionMetric, AgentSuggestionDiff, AgentSuggestionChanges, type AgentSuggestionProps, type AgentSuggestionChange } from './components/agent-suggestion';
63
- export { CookieConsent, type CookieConsentProps } from './components/cookie-consent';
64
- export { AnnouncementBar, type AnnouncementBarProps } from './components/announcement-bar';
1
+ export { cn } from './lib/utils.js';
2
+ export * from './theme/index.js';
3
+ export * from './components/accordion.js';
4
+ export * from './components/avatar.js';
5
+ export { Badge, badgeVariants, type BadgeProps, type BadgeTone } from './components/badge.js';
6
+ export * from './components/banner.js';
7
+ export { Breadcrumb, type BreadcrumbProps, type BreadcrumbItem } from './components/breadcrumb.js';
8
+ export { Button, buttonVariants, type ButtonProps } from './components/button.js';
9
+ export * from './components/card.js';
10
+ export { ChartCard, ChartTooltip, ChartLegendRow, ChartLegendPill, type ChartDatum, type ChartCardBaseProps } from './components/chart.js';
11
+ export { LineCard, AreaCard, type LineCardProps } from './components/line-chart.js';
12
+ export { DonutCard, type DonutCardProps } from './components/donut-chart.js';
13
+ export { BarCard, type BarCardProps } from './components/bar-chart.js';
14
+ export { ChannelCard, type ChannelCardProps } from './components/channel-chart.js';
15
+ export { Checkbox, type CheckboxProps } from './components/checkbox.js';
16
+ export { Chip, ChipAvatar, chipVariants, type ChipProps } from './components/chip.js';
17
+ export { Combobox, type ComboboxProps } from './components/combobox.js';
18
+ export { CommandMenu, type CommandMenuProps, type CommandItem, type CommandGroup } from './components/command-menu.js';
19
+ export { CodeBlock, type CodeBlockProps } from './components/code-block.js';
20
+ export { Dialog, DialogClose, DialogAlert, CloseIcon, type DialogProps, type DialogVariant, type DialogAlertProps, type DialogAlertIntent } from './components/dialog.js';
21
+ export * from './components/dot.js';
22
+ export { Floating, type FloatingProps, type FloatingSide } from './components/floating.js';
23
+ export { DropdownMenu, DropdownMenuGroup, DropdownMenuItem, MenuItemContent, menuItemClass, menuSurfaceClass, menuGroupClass, menuGroupLabelClass, type DropdownMenuProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type MenuItemContentProps } from './components/dropdown.js';
24
+ export { FormField, useFormField, type FormFieldProps, type FormFieldContextValue } from './components/form-field.js';
25
+ export { Input, type InputProps } from './components/input.js';
26
+ export * from './components/kbd.js';
27
+ export { Pagination, paginationRange, type PaginationProps } from './components/pagination.js';
28
+ export { Popover, PopoverClose, PopoverPanel, type PopoverProps } from './components/popover.js';
29
+ export { Progress, type ProgressProps } from './components/progress.js';
30
+ export { Radio, RadioGroup, type RadioProps, type RadioGroupProps } from './components/radio.js';
31
+ export { SearchBar, type SearchBarProps } from './components/search-bar.js';
32
+ export { Select, FieldChrome, useFieldChrome, SelectChevron, type SelectProps, type SelectOption, type SelectGroup } from './components/select.js';
33
+ export { SegmentedControl, type SegmentedControlItem, type SegmentedControlProps } from './components/segmented-control.js';
34
+ export { Sheet, SheetClose, type SheetProps } from './components/sheet.js';
35
+ export * from './components/sidebar.js';
36
+ export { Skeleton, type SkeletonProps } from './components/skeleton.js';
37
+ export { Slider, type SliderProps } from './components/slider.js';
38
+ export { Switch, type SwitchProps } from './components/switch.js';
39
+ export { Table, type TableProps, type Column, type Row, type Sort } from './components/table.js';
40
+ export { Tabs, TabsContent, type TabsProps, type TabItem } from './components/tabs.js';
41
+ export { Textarea, type TextareaProps } from './components/textarea.js';
42
+ export { Toast, Toaster, toast, type ToastProps, type ToasterProps, type ToastOptions, type ToastIntent, type ToastAction } from './components/toast.js';
43
+ export { Toggle, toggleVariants, type ToggleProps } from './components/toggle.js';
44
+ export { Tooltip, TooltipBubble, type TooltipProps } from './components/tooltip.js';
45
+ export * from './components/agent-picker.js';
46
+ export * from './components/attachment.js';
47
+ export * from './components/decision-card.js';
48
+ export * from './components/empty-state.js';
49
+ export { Message, type MessageProps, type MessageSource } from './components/message.js';
50
+ export { MessageActions, type MessageActionsProps, type MessageFeedback } from './components/message-actions.js';
51
+ export { PromptBar, defaultActions as promptBarDefaultActions, type PromptBarProps, type PromptBarModel, type PromptBarAction } from './components/prompt-bar.js';
52
+ export { StreamingText, type StreamingTextProps } from './components/streaming-text.js';
53
+ export { Thinking, type ThinkingProps, type ThinkingStep, type ThinkingState, type ThinkingIndicator } from './components/thinking.js';
54
+ export { AgentLoading, type AgentLoadingProps, type AgentLoadingIndicator, TetrisMark, TetrisLabel, TetrisStill, FlappySprite, ShimmerLabel, type Glimmer } from './components/agent-loading.js';
55
+ export { FileUpload, FileUploadItem, fileIconFor, formatBytes, type FileUploadProps, type FileUploadFile, type FileUploadRejection, type FileUploadStatus } from './components/file-upload.js';
56
+ export { InputOTP, type InputOTPProps } from './components/input-otp.js';
57
+ export { NumberInput, type NumberInputProps } from './components/number-input.js';
58
+ export { ContextMenu, ContextMenuItem, ContextMenuSub, ContextMenuSeparator, type ContextMenuProps, type ContextMenuItemProps, type ContextMenuSubProps } from './components/context-menu.js';
59
+ export { HoverCard, hoverCardClass, type HoverCardProps } from './components/hover-card.js';
60
+ export { Citation, Sources, type CitationProps, type CitationSource, type SourcesProps } from './components/citations.js';
61
+ export { Calendar, DatePicker, DatePickerPanel, DateRangePicker, DateRangePickerPanel, formatDate, formatRange, type CalendarProps, type DatePickerProps, type DatePickerPanelProps, type DateRangePickerPanelProps, type DateRangePickerProps, type DateRange } from './components/date-picker.js';
62
+ export { AgentSuggestion, AgentSuggestionQuote, AgentSuggestionMetric, AgentSuggestionDiff, AgentSuggestionChanges, type AgentSuggestionProps, type AgentSuggestionChange } from './components/agent-suggestion.js';
63
+ export { CookieConsent, type CookieConsentProps } from './components/cookie-consent.js';
64
+ export { AnnouncementBar, type AnnouncementBarProps } from './components/announcement-bar.js';
package/index.js CHANGED
@@ -1,16 +1,18 @@
1
- 'use client';export { StreamingText } from './chunk-RTJ76X5U.js';
1
+ 'use client';export { Toggle, toggleVariants } from './chunk-UC3ZJWOD.js';
2
+ export { StreamingText } from './chunk-RTJ76X5U.js';
2
3
  export { Switch } from './chunk-SH6NG6VN.js';
3
4
  export { Table } from './chunk-X3PQANZO.js';
4
5
  export { Tabs, TabsContent } from './chunk-DETGJAIC.js';
5
6
  export { Textarea } from './chunk-QUF2IPOZ.js';
6
7
  export { Toast, Toaster, toast } from './chunk-2HKBZFIK.js';
7
- export { Toggle, toggleVariants } from './chunk-UC3ZJWOD.js';
8
+ export { Radio, RadioGroup } from './chunk-LLHTVIM3.js';
8
9
  export { SearchBar } from './chunk-UGRSWP6U.js';
9
10
  export { SegmentedControl } from './chunk-WTMZT3IT.js';
10
11
  export { Sheet, SheetClose } from './chunk-TKO44NDI.js';
11
12
  export { Sidebar, SidebarGroup, SidebarItem, SidebarSubGroup, SidebarSubItem } from './chunk-BNTPPZCK.js';
12
13
  export { Skeleton } from './chunk-YG7JOOLJ.js';
13
14
  export { Slider } from './chunk-L6NCCSIP.js';
15
+ export { AreaCard, LineCard } from './chunk-SHDFUXYV.js';
14
16
  export { Message } from './chunk-PVOLDO4G.js';
15
17
  export { Thinking } from './chunk-ESC5JCVQ.js';
16
18
  export { MessageActions } from './chunk-AN2RNJLR.js';
@@ -18,11 +20,11 @@ export { NumberInput } from './chunk-LW3TRU5W.js';
18
20
  export { Pagination, paginationRange } from './chunk-QS4N4MNP.js';
19
21
  export { Popover, PopoverClose, PopoverPanel } from './chunk-BNZVTLHV.js';
20
22
  export { PromptBar, defaultActions as promptBarDefaultActions } from './chunk-6YXUBP27.js';
21
- export { Radio, RadioGroup } from './chunk-LLHTVIM3.js';
23
+ export { EmptyState, emptyStateVariants } from './chunk-WX6BP5ZP.js';
22
24
  export { FileUpload, FileUploadItem, fileIconFor, formatBytes } from './chunk-GICKPMJU.js';
23
25
  export { InputOTP } from './chunk-XL75JRUA.js';
24
26
  export { Input } from './chunk-YPNKBE5X.js';
25
- export { AreaCard, LineCard } from './chunk-SHDFUXYV.js';
27
+ export { ContextMenu, ContextMenuItem, ContextMenuSeparator, ContextMenuSub } from './chunk-PF3YBUKT.js';
26
28
  export { CookieConsent } from './chunk-NN6PKJWS.js';
27
29
  export { Calendar, DatePicker, DatePickerPanel, DateRangePicker, DateRangePickerPanel, formatDate, formatRange } from './chunk-XZNHT6MO.js';
28
30
  export { DecisionCard, DecisionItemPreview } from './chunk-TX3H3QMA.js';
@@ -30,7 +32,7 @@ import './chunk-J3NSDRVH.js';
30
32
  export { CloseIcon, Dialog, DialogAlert, DialogClose } from './chunk-JPNWHWAQ.js';
31
33
  export { DonutCard } from './chunk-CL2II6BX.js';
32
34
  export { Dot, dotVariants } from './chunk-B2K45IUR.js';
33
- export { EmptyState, emptyStateVariants } from './chunk-WX6BP5ZP.js';
35
+ export { ChannelCard } from './chunk-LZMKSFCF.js';
34
36
  export { Checkbox } from './chunk-FDKIX4DC.js';
35
37
  export { Citation, Sources } from './chunk-6C7CGJX2.js';
36
38
  export { HoverCard, hoverCardClass } from './chunk-HRKPV66B.js';
@@ -38,27 +40,26 @@ export { CodeBlock } from './chunk-A5XEM3GF.js';
38
40
  export { Combobox } from './chunk-NSRTTYQ4.js';
39
41
  export { Chip, ChipAvatar, chipVariants } from './chunk-3ERGAHKA.js';
40
42
  export { CommandMenu } from './chunk-P4O6TGDR.js';
41
- export { ContextMenu, ContextMenuItem, ContextMenuSeparator, ContextMenuSub } from './chunk-PF3YBUKT.js';
42
43
  export { AVATAR_TOOLTIP_DELAY, Avatar, avatarVariants } from './chunk-TVLGZGYN.js';
43
44
  export { Tooltip, TooltipBubble } from './chunk-B6V4VSGH.js';
44
45
  export { BarCard } from './chunk-DO3TBNSC.js';
45
- export { Breadcrumb } from './chunk-HL42K2NH.js';
46
- export { Card, cardVariants } from './chunk-XILQ7GXE.js';
47
- export { ChannelCard } from './chunk-LZMKSFCF.js';
48
46
  export { ChartCard, ChartLegendPill, ChartLegendRow, ChartTooltip } from './chunk-YPJYW624.js';
49
47
  export { Floating } from './chunk-Y5AYU7PK.js';
50
48
  export { FieldChrome, Select, SelectChevron, useFieldChrome } from './chunk-72OCFAPT.js';
51
49
  export { FormField, useFormField } from './chunk-UBNHSZSE.js';
50
+ export { Breadcrumb } from './chunk-HL42K2NH.js';
52
51
  export { DropdownMenu, DropdownMenuGroup, DropdownMenuItem, MenuItemContent, menuGroupClass, menuGroupLabelClass, menuItemClass, menuSurfaceClass } from './chunk-3DINAQLL.js';
53
52
  export { Kbd, KbdArrowDown, KbdArrowUp, KbdGroup, KbdHint, KbdReturn, keysOf } from './chunk-BKZBWPUH.js';
53
+ export { Card, cardVariants } from './chunk-XILQ7GXE.js';
54
54
  export { Accordion, AccordionItem } from './chunk-GQA24FYG.js';
55
55
  export { AgentLoading, FlappySprite, ShimmerLabel, TetrisLabel, TetrisMark, TetrisStill } from './chunk-KNUWZNFV.js';
56
56
  export { AgentAvatar, AgentMenuItem, AgentPicker, AgentPickerRow } from './chunk-VAGIAREV.js';
57
57
  export { AgentSuggestion, AgentSuggestionChanges, AgentSuggestionDiff, AgentSuggestionMetric, AgentSuggestionQuote } from './chunk-MR3JDI7E.js';
58
58
  export { Progress } from './chunk-7TXHCRAG.js';
59
59
  export { Badge, badgeVariants } from './chunk-O7F3CIDV.js';
60
- export { AnnouncementBar } from './chunk-2YEWSJD7.js';
61
- export { Banner, bannerMesh, bannerVariants } from './chunk-TOMSU4S4.js';
60
+ export { AnnouncementBar } from './chunk-D7RZNTFC.js';
61
+ export { Banner, bannerVariants } from './chunk-6QMSWITQ.js';
62
+ export { bannerMesh } from './chunk-YX5VNRJX.js';
62
63
  export { Attachment, AttachmentGroup, AttachmentPreview, AttachmentPreviewPager, AttachmentPreviewSheets, FileIcon } from './chunk-H4NU7NPO.js';
63
64
  export { Button, buttonVariants } from './chunk-HNQUX43Z.js';
64
65
  export { cn } from './chunk-H63FYCMY.js';
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme/create-theme.ts"],"names":["vars"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BO,IAAM,YAAA,GAA2B,EAAE,KAAA,EAAO,SAAA,EAAW,QAAQ,CAAA;AAQpE,IAAM,QAAA,GAAW,CAAC,CAAA,KAAe,CAAA,IAAK,UAAU,CAAA,GAAI,KAAA,GAAA,CAAA,CAAU,CAAA,GAAI,KAAA,IAAS,KAAA,KAAU,GAAA;AACrF,IAAM,OAAA,GAAU,CAAC,CAAA,KAAe,CAAA,IAAK,QAAA,GAAY,QAAQ,CAAA,GAAI,KAAA,GAAQ,CAAA,KAAM,CAAA,GAAI,GAAA,CAAA,GAAO,KAAA;AAEtF,SAAS,SAAS,GAAA,EAAuC;AACvD,EAAA,MAAM,CAAA,GAAI,GAAA,CAAI,OAAA,CAAQ,GAAA,EAAK,EAAE,CAAA;AAC7B,EAAA,MAAM,IAAA,GAAO,EAAE,MAAA,KAAW,CAAA,GAAI,CAAC,GAAG,CAAC,EAAE,GAAA,CAAI,CAAC,MAAM,CAAA,GAA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CAAC,CAAA,EAAG,GAAG,IAAI,CAAA;AAEpF,EAAA,MAAM,OAAO,UAAA,GAAa,EAAA,GAAK,IAAA,CAAK,MAAA,KAAW,GAAA,IAAO,GAAA;AACtD,EAAA,MAAM,CAAA,GAAI,GAAA,GAAM,IAAA,CAAK,MAAA,EAAO,GAAI,IAAA;AAChC,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,CAAC,CAAA,EAAG,IAAA,GAAO,KAAK,MAAA,EAAO,GAAI,IAAA,EAAM,GAAG,CAAC,CAAA;AAC9D,EAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,EAAG,GAAA,EAAK,CAAA,EAAG,GAAG,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,KAAM,OAAA,EAAS,MAAM,CAAA;AAClE,EAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,KAAA,CAAM,KAAK,MAAA,EAAO,GAAI,KAAA,CAAM,MAAM,CAAC,CAAA;AAC7D,EAAA,OAAO,EAAE,OAAO,MAAA,EAAO;AACzB","file":"index.js","sourcesContent":["/**\n * Satin theming: one small config in, CSS variables out. Type isn't part of it: Satin's type\n * scale is fixed (14px body, 13px for compact controls like badges, chips and small fields).\n *\n * Every Satin component reads tokens, never raw values, so a theme only has to repoint a few\n * of them and the whole system follows:\n *\n * - `brand` replaces the brand ramp (the `--color-blue-*` primitives and the dark-mode primary\n * primitives). Each step keeps the lightness of the original ramp, takes the brand's hue and\n * scales its chroma, so tints, borders and soft tones stay in the same places. The solid\n * steps (hover, rest, pressed) sit at the brand's own lightness, lowered just enough that\n * white text reads at 4.5:1 on rest and hover, in Light and Dark. Labels stay white for\n * every brand, so buttons look the same family whatever the colour.\n * - `radius` scales every corner token, pill-shaped controls included; 1 is Satin's own, 0 is\n * square. Circles (avatars, dots, switch and radio marks) stay round.\n *\n * `themeVars()` returns the variables per mode; `themeCss()` the same as a stylesheet to load\n * after `@uisatin/ui/styles.css`.\n */\n\nexport interface SatinTheme {\n /** Brand colour as hex, e.g. \"#4633D7\". */\n brand: string\n /** Corner scale: 0, 0.5, 1 (default) or 1.5. */\n radius: number\n}\n\nexport const defaultTheme: SatinTheme = { brand: '#4633D7', radius: 1 }\n\ntype Vars = Record<string, string>\n\n/* ---------- OKLCH ---------- */\n\ntype Lch = [number, number, number]\n\nconst toLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)\nconst toGamma = (c: number) => (c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055)\n\nfunction hexToRgb(hex: string): [number, number, number] {\n const h = hex.replace('#', '')\n const full = h.length === 3 ? [...h].map((c) => c + c).join('') : h.slice(0, 6)\n return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16) / 255) as [number, number, number]\n}\n\nfunction rgbToOklch([r, g, b]: [number, number, number]): Lch {\n const [lr, lg, lb] = [r, g, b].map(toLinear)\n const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb)\n const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb)\n const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb)\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s\n const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s\n const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s\n return [L, Math.hypot(A, B), ((Math.atan2(B, A) * 180) / Math.PI + 360) % 360]\n}\n\nfunction oklchToRgb([L, C, H]: Lch): [number, number, number] {\n const a = C * Math.cos((H * Math.PI) / 180)\n const b = C * Math.sin((H * Math.PI) / 180)\n const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3\n const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3\n const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n ]\n}\n\nconst inGamut = (rgb: number[]) => rgb.every((c) => c >= -0.0005 && c <= 1.0005)\n\n/** OKLCH to hex, lowering chroma until the colour fits sRGB. */\nfunction oklchToHex([L, C, H]: Lch) {\n let c = C\n let rgb = oklchToRgb([L, c, H])\n while (!inGamut(rgb) && c > 0) {\n c = Math.max(0, c - 0.005)\n rgb = oklchToRgb([L, c, H])\n }\n return '#' + rgb.map((v) => Math.round(Math.min(1, Math.max(0, toGamma(v))) * 255).toString(16).padStart(2, '0')).join('').toUpperCase()\n}\n\nconst luminance = (hex: string) => {\n const [r, g, b] = hexToRgb(hex).map(toLinear)\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\nexport const contrast = (a: string, b: string) => {\n const [x, y] = [luminance(a), luminance(b)].sort((p, q) => q - p)\n return (x + 0.05) / (y + 0.05)\n}\n\n/* ---------- Brand ---------- */\n\n// Satin's own brand ramp. Each generated step keeps its lightness and chroma ratio.\nconst RAMP: Record<string, string> = {\n 'blue-50': '#F2F4FF',\n 'blue-200': '#CFD6FF',\n 'blue-300': '#B1BBFE',\n 'blue-500': '#5146E9',\n 'blue-600': '#4633D7',\n 'blue-700': '#3923B9',\n 'blue-900': '#1D1168',\n 'blue-950': '#110A47',\n 'blue-soft-50': '#F3F5FF',\n 'blue-soft-200': '#D9DEFB',\n 'blue-soft-300': '#BEC7FC',\n 'blue-soft-700': '#5158A0',\n 'blue-soft-900': '#30344F',\n 'blue-soft-950': '#1F2132',\n 'primary-dark': '#493DD6',\n 'primary-hover-dark': '#554FE7',\n 'primary-pressed-dark': '#3E2AC5',\n 'primary-border-light': '#9085E7',\n 'primary-border-dark': '#928BE6',\n}\n// The steps a button is painted with: they move with the brand's lightness.\nconst SOLID = new Set(['blue-500', 'blue-600', 'blue-700', 'primary-dark', 'primary-hover-dark', 'primary-pressed-dark'])\n\n// Darkest the solid fill may need to go: white on it, and on its hover, reads at 4.5:1\n// (aimed at 4.7, since fitting each step into sRGB trims its chroma a little).\nfunction solidLightness(c: number, h: number, base: number, hoverStep: number) {\n const passes = (L: number) =>\n contrast(oklchToHex([L, c, h]), '#FFFFFF') >= 4.7 && contrast(oklchToHex([L + hoverStep, c, h]), '#FFFFFF') >= 4.7\n if (passes(base)) return base\n let lo = 0.2\n let hi = base\n for (let i = 0; i < 20; i++) {\n const mid = (lo + hi) / 2\n if (passes(mid)) lo = mid\n else hi = mid\n }\n return lo\n}\n\nfunction brandVars(brand: string): Vars {\n const [bl, bc, bh] = rgbToOklch(hexToRgb(brand))\n const lch = (step: string) => rgbToOklch(hexToRgb(RAMP[step]))\n const [rl, rc, rh] = lch('blue-600')\n const chroma = bc / rc\n // Where the light and the dark solid fills sit: the brand's lightness, darker if white needs it.\n const light = solidLightness(bc, bh, bl, lch('blue-500')[0] - rl)\n const darkRest = lch('primary-dark')[0]\n const dark = solidLightness(bc, bh, light + (darkRest - rl), lch('primary-hover-dark')[0] - darkRest)\n const root: Vars = {}\n for (const [step, hex] of Object.entries(RAMP)) {\n const [l, c, h] = rgbToOklch(hexToRgb(hex))\n const isDark = step.endsWith('-dark') && step !== 'primary-border-dark'\n const L = SOLID.has(step) ? (isDark ? dark + (l - darkRest) : light + (l - rl)) : l\n root[`--color-${step}`] =\n step === 'blue-600' && light === bl ? brand.toUpperCase() : oklchToHex([Math.min(0.97, Math.max(0.15, L)), c * chroma, bh + (h - rh)])\n }\n root['--color-blue-600-a20'] = `${root['--color-blue-600']}33`\n root['--color-blue-500-a20'] = `${root['--color-blue-500']}33`\n root['--color-primary-focus-dark'] = `${root['--color-primary-dark']}33`\n return root\n}\n\n/* ---------- Radius ---------- */\n\nconst RADII: Record<string, number> = { xs: 4, sm: 6, md: 8, xl: 12, '2xl': 16, '3xl': 20 }\n\nfunction radiusVars(scale: number): Vars {\n const v: Vars = {}\n for (const [k, px] of Object.entries(RADII)) v[`--radius-${k}`] = `${Math.round(px * scale * 2) / 2}px`\n v['--radius'] = `${Math.round(10 * scale * 2) / 2}px`\n // Pills follow the corners too: square at 0, a soft 8px at 0.5, a full pill from 1.\n v['--radius-pill'] = scale >= 1 ? '9999px' : `${Math.round(16 * scale)}px`\n return v\n}\n\n/* ---------- Output ---------- */\n\nexport function themeVars(theme: SatinTheme): { root: Vars; dark: Vars } {\n return { root: { ...brandVars(theme.brand), ...radiusVars(theme.radius) }, dark: {} }\n}\n\n// Semantic tokens that read the brand ramp or the radius. CSS resolves var() where a property is\n// declared, so a theme limited to part of a page has to declare these again inside it.\nconst SCOPED_LIGHT: Vars = {\n '--border-focus': 'var(--color-blue-600)',\n '--action-primary-bg': 'var(--color-blue-600)',\n '--action-primary-bg-hover': 'var(--color-blue-500)',\n '--action-primary-bg-pressed': 'var(--color-blue-700)',\n '--action-primary-border': 'var(--color-primary-border-light)',\n '--action-focus-ring': 'var(--color-blue-600-a20)',\n '--status-brand-bg': 'var(--color-blue-soft-50)',\n '--status-brand-border': 'var(--color-blue-soft-200)',\n '--status-brand-fg': 'var(--color-blue-soft-700)',\n '--radius-lg': 'var(--radius)',\n}\nconst SCOPED_DARK: Vars = {\n '--border-focus': 'var(--color-primary-hover-dark)',\n '--action-primary-bg': 'var(--color-primary-dark)',\n '--action-primary-bg-hover': 'var(--color-primary-hover-dark)',\n '--action-primary-bg-pressed': 'var(--color-primary-pressed-dark)',\n '--action-primary-border': 'var(--color-primary-border-dark)',\n '--action-focus-ring': 'var(--color-primary-focus-dark)',\n '--status-brand-bg': 'var(--color-blue-soft-950)',\n '--status-brand-border': 'var(--color-blue-soft-900)',\n '--status-brand-fg': 'var(--color-blue-soft-300)',\n}\n\n/**\n * The theme as a stylesheet. Load it after `@uisatin/ui/styles.css`. By default it themes the\n * whole page; pass a `scope` selector to theme only what's inside it (the docs do this for\n * their previews, so the site around them keeps Satin's own look).\n */\nexport function themeCss(theme: SatinTheme, scope?: string) {\n const vars = themeVars(theme)\n const root = scope ? { ...vars.root, ...SCOPED_LIGHT } : vars.root\n const dark = scope ? { ...vars.dark, ...SCOPED_DARK } : vars.dark\n const block = (sel: string, vars: Vars) =>\n `${sel} {\\n${Object.entries(vars)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join('\\n')}\\n}`\n return [\n `/* Satin theme: brand ${theme.brand.toUpperCase()}, radius ${theme.radius}. */`,\n // :root:root outranks Satin's own :root, so the theme wins wherever the file is loaded.\n block(scope ?? ':root:root', root),\n ...(Object.keys(dark).length ? [block(scope ? `.dark ${scope}` : ':root.dark', dark)] : []),\n '',\n ].join('\\n\\n')\n}\n\n/* ---------- Random ---------- */\n\n/**\n * A random theme that still reads: a brand with enough chroma and a corner scale.\n * Pass the current theme to make sure the brand and the corners visibly change.\n */\nexport function randomTheme(current?: SatinTheme): SatinTheme {\n const [, , currentHue] = current ? rgbToOklch(hexToRgb(current.brand)) : [0, 0, -360]\n // At least 60° away from the current hue, so the new brand never looks like the old one.\n const hue = (currentHue + 60 + Math.random() * 240) % 360\n const l = 0.5 + Math.random() * 0.25\n const brand = oklchToHex([l, 0.12 + Math.random() * 0.08, hue])\n const radii = [0, 0.5, 1, 1.5].filter((r) => r !== current?.radius)\n const radius = radii[Math.floor(Math.random() * radii.length)]\n return { brand, radius }\n}\n"]}
1
+ {"version":3,"sources":["../src/theme/create-theme.ts"],"names":["vars"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BO,IAAM,YAAA,GAA2B,EAAE,KAAA,EAAO,SAAA,EAAW,QAAQ,CAAA;AAQpE,IAAM,QAAA,GAAW,CAAC,CAAA,KAAe,CAAA,IAAK,UAAU,CAAA,GAAI,KAAA,GAAA,CAAA,CAAU,CAAA,GAAI,KAAA,IAAS,KAAA,KAAU,GAAA;AACrF,IAAM,OAAA,GAAU,CAAC,CAAA,KAAe,CAAA,IAAK,QAAA,GAAY,QAAQ,CAAA,GAAI,KAAA,GAAQ,CAAA,KAAM,CAA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AA,EAAS,KAAK,CAAA,CAAA,GAAK,YAAA,EAAc,IAAI,CAAC,IAAI,EAAC;AAAA,IACzF;AAAA,GACF,CAAE,KAAK,MAAM,CAAA;AACf;AAQO,SAAS,YAAY,OAAA,EAAkC;AAC5D,EAAA,MAAM,KAAK,UAAU,IAAI,OAAA,GAAU,UAAA,CAAW,QAAA,CAAS,OAAA,CAAQ,KAAK,CAAC,CAAA,GAAI,CAAC,CAAA,EAAG,GAAG,IAAI,CAAA;AAEpF,EAAA,MAAM,OAAO,UAAA,GAAa,EAAA,GAAK,IAAA,CAAK,MAAA,KAAW,GAAA,IAAO,GAAA;AACtD,EAAA,MAAM,CAAA,GAAI,GAAA,GAAM,IAAA,CAAK,MAAA,EAAO,GAAI,IAAA;AAChC,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,CAAC,CAAA,EAAG,IAAA,GAAO,KAAK,MAAA,EAAO,GAAI,IAAA,EAAM,GAAG,CAAC,CAAA;AAC9D,EAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,EAAG,GAAA,EAAK,CAAA,EAAG,GAAG,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,KAAM,OAAA,EAAS,MAAM,CAAA;AAClE,EAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,KAAA,CAAM,KAAK,MAAA,EAAO,GAAI,KAAA,CAAM,MAAM,CAAC,CAAA;AAC7D,EAAA,OAAO,EAAE,OAAO,MAAA,EAAO;AACzB","file":"index.js","sourcesContent":["/**\n * Satin theming: one small config in, CSS variables out. Type isn't part of it: Satin's type\n * scale is fixed (14px body, 13px for compact controls like badges, chips and small fields).\n *\n * Every Satin component reads tokens, never raw values, so a theme only has to repoint a few\n * of them and the whole system follows:\n *\n * - `brand` replaces the brand ramp (the `--color-blue-*` primitives and the dark-mode primary\n * primitives). Each step keeps the lightness of the original ramp, takes the brand's hue and\n * scales its chroma, so tints, borders and soft tones stay in the same places. The solid\n * steps (hover, rest, pressed) sit at the brand's own lightness, lowered just enough that\n * white text reads at 4.5:1 on rest and hover, in Light and Dark. Labels stay white for\n * every brand, so buttons look the same family whatever the colour.\n * - `radius` scales every corner token, pill-shaped controls included; 1 is Satin's own, 0 is\n * square. Circles (avatars, dots, switch and radio marks) stay round.\n *\n * `themeVars()` returns the variables per mode; `themeCss()` the same as a stylesheet to load\n * after `@uisatin/ui/styles.css`.\n */\n\nexport interface SatinTheme {\n /** Brand colour as hex, e.g. \"#4633D7\". */\n brand: string\n /** Corner scale: 0, 0.5, 1 (default) or 1.5. */\n radius: number\n}\n\nexport const defaultTheme: SatinTheme = { brand: '#4633D7', radius: 1 }\n\ntype Vars = Record<string, string>\n\n/* ---------- OKLCH ---------- */\n\ntype Lch = [number, number, number]\n\nconst toLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)\nconst toGamma = (c: number) => (c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055)\n\nfunction hexToRgb(hex: string): [number, number, number] {\n const h = hex.replace('#', '')\n const full = h.length === 3 ? [...h].map((c) => c + c).join('') : h.slice(0, 6)\n return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16) / 255) as [number, number, number]\n}\n\nfunction rgbToOklch([r, g, b]: [number, number, number]): Lch {\n const [lr, lg, lb] = [r, g, b].map(toLinear)\n const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb)\n const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb)\n const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb)\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s\n const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s\n const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s\n return [L, Math.hypot(A, B), ((Math.atan2(B, A) * 180) / Math.PI + 360) % 360]\n}\n\nfunction oklchToRgb([L, C, H]: Lch): [number, number, number] {\n const a = C * Math.cos((H * Math.PI) / 180)\n const b = C * Math.sin((H * Math.PI) / 180)\n const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3\n const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3\n const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n ]\n}\n\nconst inGamut = (rgb: number[]) => rgb.every((c) => c >= -0.0005 && c <= 1.0005)\n\n/** OKLCH to hex, lowering chroma until the colour fits sRGB. */\nfunction oklchToHex([L, C, H]: Lch) {\n let c = C\n let rgb = oklchToRgb([L, c, H])\n while (!inGamut(rgb) && c > 0) {\n c = Math.max(0, c - 0.005)\n rgb = oklchToRgb([L, c, H])\n }\n return '#' + rgb.map((v) => Math.round(Math.min(1, Math.max(0, toGamma(v))) * 255).toString(16).padStart(2, '0')).join('').toUpperCase()\n}\n\nconst luminance = (hex: string) => {\n const [r, g, b] = hexToRgb(hex).map(toLinear)\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\nexport const contrast = (a: string, b: string) => {\n const [x, y] = [luminance(a), luminance(b)].sort((p, q) => q - p)\n return (x + 0.05) / (y + 0.05)\n}\n\n/* ---------- Brand ---------- */\n\n// Satin's own brand ramp. Each generated step keeps its lightness and chroma ratio.\nconst RAMP: Record<string, string> = {\n 'blue-50': '#F2F4FF',\n 'blue-200': '#CFD6FF',\n 'blue-300': '#B1BBFE',\n 'blue-500': '#5146E9',\n 'blue-600': '#4633D7',\n 'blue-700': '#3923B9',\n 'blue-900': '#1D1168',\n 'blue-950': '#110A47',\n 'blue-soft-50': '#F3F5FF',\n 'blue-soft-200': '#D9DEFB',\n 'blue-soft-300': '#BEC7FC',\n 'blue-soft-700': '#5158A0',\n 'blue-soft-900': '#30344F',\n 'blue-soft-950': '#1F2132',\n 'primary-dark': '#493DD6',\n 'primary-hover-dark': '#554FE7',\n 'primary-pressed-dark': '#3E2AC5',\n 'primary-border-light': '#9085E7',\n 'primary-border-dark': '#928BE6',\n}\n// The steps a button is painted with: they move with the brand's lightness.\nconst SOLID = new Set(['blue-500', 'blue-600', 'blue-700', 'primary-dark', 'primary-hover-dark', 'primary-pressed-dark'])\n\n// Darkest the solid fill may need to go: white on it, and on its hover, reads at 4.5:1\n// (aimed at 4.7, since fitting each step into sRGB trims its chroma a little).\nfunction solidLightness(c: number, h: number, base: number, hoverStep: number) {\n const passes = (L: number) =>\n contrast(oklchToHex([L, c, h]), '#FFFFFF') >= 4.7 && contrast(oklchToHex([L + hoverStep, c, h]), '#FFFFFF') >= 4.7\n if (passes(base)) return base\n let lo = 0.2\n let hi = base\n for (let i = 0; i < 20; i++) {\n const mid = (lo + hi) / 2\n if (passes(mid)) lo = mid\n else hi = mid\n }\n return lo\n}\n\nfunction brandVars(brand: string): Vars {\n const [bl, bc, bh] = rgbToOklch(hexToRgb(brand))\n const lch = (step: string) => rgbToOklch(hexToRgb(RAMP[step]))\n const [rl, rc, rh] = lch('blue-600')\n const chroma = bc / rc\n // Where the light and the dark solid fills sit: the brand's lightness, darker if white needs it.\n const light = solidLightness(bc, bh, bl, lch('blue-500')[0] - rl)\n const darkRest = lch('primary-dark')[0]\n const dark = solidLightness(bc, bh, light + (darkRest - rl), lch('primary-hover-dark')[0] - darkRest)\n const root: Vars = {}\n for (const [step, hex] of Object.entries(RAMP)) {\n const [l, c, h] = rgbToOklch(hexToRgb(hex))\n const isDark = step.endsWith('-dark') && step !== 'primary-border-dark'\n const L = SOLID.has(step) ? (isDark ? dark + (l - darkRest) : light + (l - rl)) : l\n root[`--color-${step}`] =\n step === 'blue-600' && light === bl ? brand.toUpperCase() : oklchToHex([Math.min(0.97, Math.max(0.15, L)), c * chroma, bh + (h - rh)])\n }\n root['--color-blue-600-a20'] = `${root['--color-blue-600']}33`\n root['--color-blue-500-a20'] = `${root['--color-blue-500']}33`\n root['--color-primary-focus-dark'] = `${root['--color-primary-dark']}33`\n return root\n}\n\n/* ---------- Radius ---------- */\n\nconst RADII: Record<string, number> = { xs: 4, sm: 6, md: 8, xl: 12, '2xl': 16, '3xl': 20 }\n\nfunction radiusVars(scale: number): Vars {\n const v: Vars = {}\n for (const [k, px] of Object.entries(RADII)) v[`--radius-${k}`] = `${Math.round(px * scale * 2) / 2}px`\n v['--radius'] = `${Math.round(10 * scale * 2) / 2}px`\n // Pills follow the corners too: square at 0, a soft 8px at 0.5, a full pill from 1.\n v['--radius-pill'] = scale >= 1 ? '9999px' : `${Math.round(16 * scale)}px`\n return v\n}\n\n/* ---------- Output ---------- */\n\nexport function themeVars(theme: SatinTheme): { root: Vars; dark: Vars } {\n return { root: { ...brandVars(theme.brand), ...radiusVars(theme.radius) }, dark: {} }\n}\n\n// Semantic tokens that read the brand ramp or the radius. CSS resolves var() where a property is\n// declared, so a theme limited to part of a page has to declare these again inside it.\nconst SCOPED_LIGHT: Vars = {\n '--border-focus': 'var(--color-blue-600)',\n '--action-primary-bg': 'var(--color-blue-600)',\n '--action-primary-bg-hover': 'var(--color-blue-500)',\n '--action-primary-bg-pressed': 'var(--color-blue-700)',\n '--action-primary-border': 'var(--color-primary-border-light)',\n '--action-focus-ring': 'var(--color-blue-600-a20)',\n '--status-brand-bg': 'var(--color-blue-soft-50)',\n '--status-brand-border': 'var(--color-blue-soft-200)',\n '--status-brand-fg': 'var(--color-blue-soft-700)',\n '--radius-lg': 'var(--radius)',\n}\nconst SCOPED_DARK: Vars = {\n '--border-focus': 'var(--color-primary-hover-dark)',\n '--action-primary-bg': 'var(--color-primary-dark)',\n '--action-primary-bg-hover': 'var(--color-primary-hover-dark)',\n '--action-primary-bg-pressed': 'var(--color-primary-pressed-dark)',\n '--action-primary-border': 'var(--color-primary-border-dark)',\n '--action-focus-ring': 'var(--color-primary-focus-dark)',\n '--status-brand-bg': 'var(--color-blue-soft-950)',\n '--status-brand-border': 'var(--color-blue-soft-900)',\n '--status-brand-fg': 'var(--color-blue-soft-300)',\n}\n\n/**\n * The theme as a stylesheet. Load it after `@uisatin/ui/styles.css`. By default it themes the\n * whole page; pass a `scope` selector to theme only what's inside it (the docs do this for\n * their previews, so the site around them keeps Satin's own look).\n */\nexport function themeCss(theme: SatinTheme, scope?: string) {\n const vars = themeVars(theme)\n const root = scope ? { ...vars.root, ...SCOPED_LIGHT } : vars.root\n const dark = scope ? { ...vars.dark, ...SCOPED_DARK } : vars.dark\n const block = (sel: string, vars: Vars) =>\n `${sel} {\\n${Object.entries(vars)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join('\\n')}\\n}`\n return [\n `/* Satin theme: brand ${theme.brand.toUpperCase()}, radius ${theme.radius}. */`,\n // :root:root outranks Satin's own :root, so the theme wins wherever the file is loaded.\n block(scope ?? ':root:root', root),\n ...(Object.keys(dark).length ? [block(scope ? `.dark ${scope}` : ':root.dark', dark)] : []),\n '',\n ].join('\\n\\n')\n}\n\n/* ---------- Random ---------- */\n\n/**\n * A random theme that still reads: a brand with enough chroma and a corner scale.\n * Pass the current theme to make sure the brand and the corners visibly change.\n */\nexport function randomTheme(current?: SatinTheme): SatinTheme {\n const [, , currentHue] = current ? rgbToOklch(hexToRgb(current.brand)) : [0, 0, -360]\n // At least 60° away from the current hue, so the new brand never looks like the old one.\n const hue = (currentHue + 60 + Math.random() * 240) % 360\n const l = 0.5 + Math.random() * 0.25\n const brand = oklchToHex([l, 0.12 + Math.random() * 0.08, hue])\n const radii = [0, 0.5, 1, 1.5].filter((r) => r !== current?.radius)\n const radius = radii[Math.floor(Math.random() * radii.length)]\n return { brand, radius }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uisatin/ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Satin Free: the open-source React components of the Satin design system. shadcn-based, built on Radix, themed with Satin tokens.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/theme/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { contrast, defaultTheme, randomTheme, themeCss, themeVars, type SatinTheme } from './create-theme';
1
+ export { contrast, defaultTheme, randomTheme, themeCss, themeVars, type SatinTheme } from './create-theme.js';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/banner.tsx"],"names":[],"mappings":";;;;;;;AA8BA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,wFAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,MAAA,EAAQ;AAAA,QACN,UAAA,EAAY,0CAAA;AAAA,QACZ,OAAA,EAAS;AAAA,OACX;AAAA,MACA,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,YAAA;AAAA,QACT,IAAA,EAAM;AAAA,OACR;AAAA,MACA,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,EAAA;AAAA,QACL,GAAA,EAAK;AAAA;AACP,KACF;AAAA,IACA,gBAAA,EAAkB,CAAC,EAAE,MAAA,EAAQ,YAAA,EAAc,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,SAAA,EAAW,cAAA,EAAgB,CAAA;AAAA,IACnG,iBAAiB,EAAE,MAAA,EAAQ,cAAc,KAAA,EAAO,SAAA,EAAW,OAAO,KAAA;AAAM;AAE5E;AAKO,IAAM,UAAA,GAA4E;AAAA,EACvF,UAAA,EAAY;AAAA,IACV,GAAA,EAAK,EAAE,KAAA,EAAO,8BAAA,EAAgC,MAAM,6BAAA,EAA8B;AAAA,IAClF,GAAA,EAAK,EAAE,KAAA,EAAO,kCAAA,EAAoC,MAAM,iCAAA;AAAkC,GAC5F;AAAA,EACA,OAAA,EAAS;AAAA,IACP,GAAA,EAAK,EAAE,KAAA,EAAO,sCAAA,EAAwC,MAAM,qCAAA,EAAsC;AAAA,IAClG,GAAA,EAAK,EAAE,KAAA,EAAO,uBAAA,EAAyB,MAAM,sBAAA;AAAuB;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C,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAW,EAAA,CAAG,WAAA,EAAa,OAAA,GAAU,2BAAA,GAA8B,iBAAA,EAAmB,CAAC,OAAA,IAAW,UAAU,GAAI,QAAA,EAAA,WAAA,EAAY;AAAA;AAAA;AAAA,SAEnI;AAAA,QACC,0BACC,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,UAAA,MAAA,oBAAU,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mCAAA,EAAqC,QAAA,EAAA,MAAA,EAAO,CAAA;AAAA,UACrE;AAAA,SAAA,EACH,KAEC,MAAA,IAAU,KAAA,qBACT,IAAA,CAAC,KAAA,EAAA,EAAI,WAAU,kCAAA,EACZ,QAAA,EAAA;AAAA,UAAA,MAAA;AAAA,UACA;AAAA,SAAA,EACH;AAAA;AAAA;AAAA,GAGN;AAEJ","file":"chunk-TOMSU4S4.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Xmark } from 'iconoir-react'\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\n\n/**\n * Banner, 1:1 with the uiKit `Banner` set (3822:3475): a title, an optional description (one\n * or two lines) and one action, on bg/card with a 1px border/default and the shadcn md shadow.\n *\n * - layout=\"horizontal\": 450 wide, one row, 12 × 8 padding, 10 gap; the action and the close\n * button sit on the right, 4px apart.\n * - layout=\"sidebar\": 222 wide (the navigation column's inner width), 12 padding, 12 gap; copy on\n * top, the action stretched across the bottom, close pinned 3px from the top-right corner.\n * - shape=\"rounded\" is radius-xl (12). shape=\"pill\" is fully round on a one-line horizontal\n * banner and radius-3xl (20) wherever the banner is taller.\n * - background=\"mesh\" lays two pre-rendered glows over the card: a light one in Multiply (shows\n * on white, gone on dark) and a dark one in Screen (glows on dark, gone on white), so it follows\n * the theme without variables. Figma renders one pair per layout and line count; the PNGs live\n * in satin-lab/public/figma and can be swapped with `mesh`.\n *\n * tone=\"primary\" turns the card action/primary/bg (border action/primary/border) with\n * action/primary/fg copy (description at 80%); its mesh is the dark glow alone, in Screen, so it\n * lightens the primary. `shimmer` sends a soft band of light across now and then.\n *\n * Title is 14/18 medium, description Body/md in text/muted, 2px apart. The close\n * button only renders when `onDismiss` is passed.\n */\nconst bannerVariants = cva(\n [\n 'relative isolate flex max-w-full overflow-clip border border-border-default bg-bg-card',\n '[box-shadow:0_2px_4px_-2px_var(--effect-shadow-sm),0_4px_6px_-1px_var(--effect-shadow-sm)]',\n ],\n {\n variants: {\n layout: {\n horizontal: 'w-[450px] items-center gap-2.5 px-3 py-2',\n sidebar: 'w-[222px] flex-col items-start gap-3 p-3',\n },\n shape: {\n rounded: 'rounded-xl',\n pill: 'rounded-3xl',\n },\n lines: {\n one: '',\n two: '',\n },\n },\n compoundVariants: [{ layout: 'horizontal', shape: 'pill', lines: 'one', className: 'rounded-pill' }],\n defaultVariants: { layout: 'horizontal', shape: 'rounded', lines: 'one' },\n },\n)\n\ntype Mesh = { light: string; dark: string }\n\n/** Figma's pre-rendered mesh pairs, per layout and line count (served from satin-lab/public). */\nexport const bannerMesh: Record<'horizontal' | 'sidebar', Record<'one' | 'two', Mesh>> = {\n horizontal: {\n one: { light: '/figma/banner-mesh-light.png', dark: '/figma/banner-mesh-dark.png' },\n two: { light: '/figma/banner-mesh-two-light.png', dark: '/figma/banner-mesh-two-dark.png' },\n },\n sidebar: {\n one: { light: '/figma/banner-mesh-sidebar-light.png', dark: '/figma/banner-mesh-sidebar-dark.png' },\n two: { light: '/figma/mesh-light.png', dark: '/figma/mesh-dark.png' },\n },\n}\n\nexport interface BannerProps\n extends Omit<React.ComponentProps<'div'>, 'title'>,\n Omit<VariantProps<typeof bannerVariants>, 'lines'> {\n title: React.ReactNode\n description?: React.ReactNode\n /** One action, usually `<Button variant=\"secondary\">`. Stretches across a sidebar banner. */\n action?: React.ReactNode\n background?: 'mesh' | 'plain'\n /** `primary`: action/primary/bg with action/primary/fg text; its mesh glows lighter on top. */\n tone?: 'default' | 'primary'\n /** Now and then a soft band of light crosses the banner (off under reduced motion). */\n shimmer?: boolean\n /** Shows the close button. */\n onDismiss?: () => void\n /** Accessible name of the close button. */\n dismissLabel?: string\n /** Replace the mesh images. */\n mesh?: Mesh\n}\n\nexport function Banner({\n className,\n title,\n description,\n action,\n layout = 'horizontal',\n background = 'mesh',\n tone = 'default',\n shimmer = false,\n shape = 'rounded',\n onDismiss,\n dismissLabel = 'Dismiss',\n mesh,\n ...props\n}: BannerProps) {\n const lines = description ? 'two' : 'one'\n const layoutKey = layout ?? 'horizontal'\n const glow = mesh ?? bannerMesh[layoutKey][lines]\n const sidebar = layoutKey === 'sidebar'\n const primary = tone === 'primary'\n\n const close = onDismiss && (\n <Button\n variant=\"tertiary\"\n shape=\"rounded\"\n iconOnly\n aria-label={dismissLabel}\n onClick={onDismiss}\n className={cn(\n sidebar && 'absolute top-[3px] right-[3px] z-10',\n primary && 'text-action-primary-fg [&_svg]:text-action-primary-fg satin-hover:bg-action-primary-bg-hover',\n )}\n >\n <Xmark aria-hidden />\n </Button>\n )\n\n return (\n <div\n data-slot=\"banner\"\n data-layout={layoutKey}\n data-background={background}\n data-tone={tone}\n className={cn(\n bannerVariants({ layout, shape, lines }),\n primary && 'border-action-primary-border bg-action-primary-bg',\n shimmer && 'satin-sheen',\n className,\n )}\n {...props}\n >\n {background === 'mesh' && primary && (\n <img\n src={glow.dark}\n alt=\"\"\n aria-hidden\n className=\"pointer-events-none absolute -inset-px -z-10 size-[calc(100%+2px)] max-w-none object-cover mix-blend-screen\"\n />\n )}\n {background === 'mesh' && !primary && (\n <>\n <img\n src={glow.light}\n alt=\"\"\n aria-hidden\n className=\"pointer-events-none absolute -inset-px -z-10 size-[calc(100%+2px)] max-w-none object-cover mix-blend-multiply\"\n />\n <img\n src={glow.dark}\n alt=\"\"\n aria-hidden\n className=\"pointer-events-none absolute -inset-px -z-10 size-[calc(100%+2px)] max-w-none object-cover mix-blend-screen\"\n />\n </>\n )}\n <div\n className={cn(\n 'flex min-w-0 flex-col justify-center text-sm',\n sidebar ? 'w-full' : 'flex-1',\n description && 'gap-0.5',\n )}\n >\n <p className={cn('truncate text-base leading-[18px] font-medium', primary ? 'text-action-primary-fg' : 'text-text-default')}>{title}</p>\n {description && (\n <p className={cn('text-body', primary ? 'text-action-primary-fg/80' : 'text-text-muted', !sidebar && 'truncate')}>{description}</p>\n )}\n </div>\n {sidebar ? (\n <>\n {action && <div className=\"flex w-full items-center *:flex-1\">{action}</div>}\n {close}\n </>\n ) : (\n (action || close) && (\n <div className=\"flex shrink-0 items-center gap-1\">\n {action}\n {close}\n </div>\n )\n )}\n </div>\n )\n}\n\nexport { bannerVariants }\n"]}