@slurp-ui/react 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/AvatarGroup/AvatarGroup.d.ts +26 -0
- package/dist/AvatarGroup/AvatarGroup.js +46 -0
- package/dist/AvatarGroup/AvatarGroup.js.map +1 -0
- package/dist/AvatarGroup/index.d.ts +3 -0
- package/dist/AvatarGroup/index.js +2 -0
- package/dist/Compare/Compare.d.ts +23 -0
- package/dist/Compare/Compare.js +61 -0
- package/dist/Compare/Compare.js.map +1 -0
- package/dist/Compare/index.d.ts +3 -0
- package/dist/Compare/index.js +2 -0
- package/dist/Consent/Consent.d.ts +30 -0
- package/dist/Consent/Consent.js +70 -0
- package/dist/Consent/Consent.js.map +1 -0
- package/dist/Consent/index.d.ts +3 -0
- package/dist/Consent/index.js +2 -0
- package/dist/Dialog/Dialog.d.ts +2 -0
- package/dist/Dialog/Dialog.js +19 -8
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Lightbox/Lightbox.d.ts +30 -0
- package/dist/Lightbox/Lightbox.js +74 -0
- package/dist/Lightbox/Lightbox.js.map +1 -0
- package/dist/Lightbox/index.d.ts +3 -0
- package/dist/Lightbox/index.js +2 -0
- package/dist/Menu/Menu.d.ts +13 -0
- package/dist/Menu/Menu.js +43 -11
- package/dist/Menu/Menu.js.map +1 -1
- package/dist/Menu/index.d.ts +2 -2
- package/dist/Menu/index.js +1 -1
- package/dist/MultiSuggest/MultiSuggest.d.ts +39 -0
- package/dist/MultiSuggest/MultiSuggest.js +267 -0
- package/dist/MultiSuggest/MultiSuggest.js.map +1 -0
- package/dist/MultiSuggest/index.d.ts +3 -0
- package/dist/MultiSuggest/index.js +2 -0
- package/dist/Reveal/Reveal.d.ts +16 -0
- package/dist/Reveal/Reveal.js +77 -0
- package/dist/Reveal/Reveal.js.map +1 -0
- package/dist/Reveal/index.d.ts +3 -0
- package/dist/Reveal/index.js +2 -0
- package/dist/Sheet/Sheet.d.ts +8 -3
- package/dist/Sheet/Sheet.js +1 -1
- package/dist/Sheet/Sheet.js.map +1 -1
- package/dist/Sheet/index.d.ts +2 -2
- package/dist/Table/Table.d.ts +12 -0
- package/dist/Table/Table.js +54 -10
- package/dist/Table/Table.js.map +1 -1
- package/dist/Timeline/Timeline.d.ts +23 -0
- package/dist/Timeline/Timeline.js +49 -0
- package/dist/Timeline/Timeline.js.map +1 -0
- package/dist/Timeline/index.d.ts +3 -0
- package/dist/Timeline/index.js +2 -0
- package/dist/Tree/Tree.d.ts +24 -0
- package/dist/Tree/Tree.js +113 -0
- package/dist/Tree/Tree.js.map +1 -0
- package/dist/Tree/index.d.ts +3 -0
- package/dist/Tree/index.js +2 -0
- package/dist/index.d.ts +21 -5
- package/dist/index.js +10 -2
- package/dist/lib/labels.d.ts +36 -1
- package/dist/lib/labels.js +24 -1
- package/dist/lib/labels.js.map +1 -1
- package/dist/lib/theme.d.ts +41 -1
- package/dist/lib/theme.js.map +1 -1
- package/dist/styles.css +576 -37
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { AccentScope, AccentScopeProps } from "./AccentScope/AccentScope.js";
|
|
|
6
6
|
import "./AccentScope/index.js";
|
|
7
7
|
import { Avatar, AvatarProps } from "./Avatar/Avatar.js";
|
|
8
8
|
import "./Avatar/index.js";
|
|
9
|
+
import { AVATAR_GROUP_LABELS, AvatarGroup, AvatarGroupLabels, AvatarGroupProps } from "./AvatarGroup/AvatarGroup.js";
|
|
10
|
+
import "./AvatarGroup/index.js";
|
|
9
11
|
import { Bento, BentoProps } from "./Bento/Bento.js";
|
|
10
12
|
import "./Bento/index.js";
|
|
11
13
|
import { Bloom, BloomPlacement, BloomProps } from "./Bloom/Bloom.js";
|
|
@@ -30,13 +32,17 @@ import { CHOICE_LABELS, Choice, ChoiceLabels, ChoiceOption, ChoiceProps } from "
|
|
|
30
32
|
import "./Choice/index.js";
|
|
31
33
|
import { CODE_LABELS, Code, CodeLabels, CodeProps } from "./Code/Code.js";
|
|
32
34
|
import "./Code/index.js";
|
|
35
|
+
import { COMPARE_LABELS, Compare, CompareLabels, CompareProps } from "./Compare/Compare.js";
|
|
36
|
+
import "./Compare/index.js";
|
|
37
|
+
import { CONSENT_LABELS, Consent, ConsentLabels, ConsentProps } from "./Consent/Consent.js";
|
|
38
|
+
import "./Consent/index.js";
|
|
33
39
|
import { CONTENTS_LABELS, Contents, ContentsItem, ContentsLabels, ContentsProps } from "./Contents/Contents.js";
|
|
34
40
|
import "./Contents/index.js";
|
|
35
41
|
import { Count, CountProps } from "./Count/Count.js";
|
|
36
42
|
import "./Count/index.js";
|
|
37
43
|
import { DATEFIELD_LABELS, DateField, DateFieldLabels, DateFieldProps } from "./DateField/DateField.js";
|
|
38
44
|
import "./DateField/index.js";
|
|
39
|
-
import { DIALOG_LABELS, Dialog, DialogLabels, DialogProps } from "./Dialog/Dialog.js";
|
|
45
|
+
import { DIALOG_LABELS, Dialog, DialogLabels, DialogProps, SheetSide } from "./Dialog/Dialog.js";
|
|
40
46
|
import "./Dialog/index.js";
|
|
41
47
|
import { DOCK_LABELS, Dock, DockActionProps, DockBackProps, DockCrumbProps, DockCrumbsProps, DockLabels, DockProps, DockSearchProps } from "./Dock/Dock.js";
|
|
42
48
|
import "./Dock/index.js";
|
|
@@ -67,6 +73,8 @@ import { Hint, HintProps } from "./Hint/Hint.js";
|
|
|
67
73
|
import "./Hint/index.js";
|
|
68
74
|
import { Kbd, KbdProps } from "./Kbd/Kbd.js";
|
|
69
75
|
import "./Kbd/index.js";
|
|
76
|
+
import { LIGHTBOX_LABELS, Lightbox, LightboxImage, LightboxLabels, LightboxProps } from "./Lightbox/Lightbox.js";
|
|
77
|
+
import "./Lightbox/index.js";
|
|
70
78
|
import { Link, LinkProps } from "./Link/Link.js";
|
|
71
79
|
import "./Link/index.js";
|
|
72
80
|
import { List, ListProps, ListRow, ListRowProps } from "./ListRow/ListRow.js";
|
|
@@ -75,8 +83,11 @@ import { Mark, MarkProps } from "./Mark/Mark.js";
|
|
|
75
83
|
import "./Mark/index.js";
|
|
76
84
|
import { Media, MediaProps } from "./Media/Media.js";
|
|
77
85
|
import "./Media/index.js";
|
|
78
|
-
import { Menu, MenuItem, MenuItemProps, MenuProps } from "./Menu/Menu.js";
|
|
86
|
+
import { Menu, MenuGroup, MenuGroupProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator } from "./Menu/Menu.js";
|
|
79
87
|
import "./Menu/index.js";
|
|
88
|
+
import { SUGGEST_LABELS, Suggest, SuggestLabels, SuggestOption, SuggestProps } from "./Suggest/Suggest.js";
|
|
89
|
+
import { MULTI_SUGGEST_LABELS, MultiSuggest, MultiSuggestLabels, MultiSuggestProps } from "./MultiSuggest/MultiSuggest.js";
|
|
90
|
+
import "./MultiSuggest/index.js";
|
|
80
91
|
import { NOTICE_LABELS, Notice, NoticeLabels, NoticeProps, StatusTone } from "./Notice/Notice.js";
|
|
81
92
|
import "./Notice/index.js";
|
|
82
93
|
import { NUMBERFIELD_LABELS, NumberField, NumberFieldLabels, NumberFieldProps } from "./NumberField/NumberField.js";
|
|
@@ -107,6 +118,8 @@ import { RATING_LABELS, Rating, RatingLabels, RatingProps } from "./Rating/Ratin
|
|
|
107
118
|
import "./Rating/index.js";
|
|
108
119
|
import { ResultRow, ResultRowProps } from "./ResultRow/ResultRow.js";
|
|
109
120
|
import "./ResultRow/index.js";
|
|
121
|
+
import { Reveal, RevealProps } from "./Reveal/Reveal.js";
|
|
122
|
+
import "./Reveal/index.js";
|
|
110
123
|
import { Score, ScoreProps } from "./Score/Score.js";
|
|
111
124
|
import "./Score/index.js";
|
|
112
125
|
import { SEARCH_LABELS, Search, SearchLabels, SearchProps } from "./Search/Search.js";
|
|
@@ -117,14 +130,13 @@ import { Segmented, SegmentedOption, SegmentedProps } from "./Segmented/Segmente
|
|
|
117
130
|
import "./Segmented/index.js";
|
|
118
131
|
import { SETTINGS_LABELS, Settings, SettingsLabels, SettingsLanguage, SettingsProps } from "./Settings/Settings.js";
|
|
119
132
|
import "./Settings/index.js";
|
|
120
|
-
import { Sheet, SheetProps } from "./Sheet/Sheet.js";
|
|
133
|
+
import { Sheet, SheetOwnProps, SheetProps } from "./Sheet/Sheet.js";
|
|
121
134
|
import "./Sheet/index.js";
|
|
122
135
|
import { Shelf, ShelfProps } from "./Shelf/Shelf.js";
|
|
123
136
|
import "./Shelf/index.js";
|
|
124
137
|
import { SKIPLINK_LABELS, SkipLink, SkipLinkLabels, SkipLinkProps } from "./SkipLink/SkipLink.js";
|
|
125
138
|
import "./SkipLink/index.js";
|
|
126
139
|
import { STEPS_LABELS, StepItem, Steps, StepsLabels, StepsProps } from "./Steps/Steps.js";
|
|
127
|
-
import { SUGGEST_LABELS, Suggest, SuggestLabels, SuggestOption, SuggestProps } from "./Suggest/Suggest.js";
|
|
128
140
|
import { TABLE_LABELS, Table, TableColumn, TableLabels, TableProps, TableSort } from "./Table/Table.js";
|
|
129
141
|
import { TOAST_LABELS, ToastLabels, ToastOptions, ToastProvider, ToastProviderProps, useToast } from "./Toast/Toast.js";
|
|
130
142
|
import { LabelsInput, SlurpLabels, labelsEn, labelsIt } from "./lib/labels.js";
|
|
@@ -135,6 +147,8 @@ import { Swatch, SwatchGroup, SwatchGroupProps, SwatchOption, SwatchProps } from
|
|
|
135
147
|
import { Switch, SwitchProps } from "./Switch/Switch.js";
|
|
136
148
|
import { TabItem, Tabs, TabsProps } from "./Tabs/Tabs.js";
|
|
137
149
|
import { Text, TextProps, TextTone } from "./Text/Text.js";
|
|
150
|
+
import { Tree, TreeItem, TreeProps } from "./Tree/Tree.js";
|
|
151
|
+
import { Timeline, TimelineItem, TimelineProps } from "./Timeline/Timeline.js";
|
|
138
152
|
import { Tag, TagProps } from "./Tag/Tag.js";
|
|
139
153
|
import { AccentInput, ColorSchemeMode, ComponentsConfig, DEFAULT_STORAGE_KEY, MotionOptions, ResolvedColorScheme, Theme, ThemeOptions, TokenOverrides, createTheme } from "./lib/theme.js";
|
|
140
154
|
import { SlurpProvider, SlurpProviderProps } from "./SlurpProvider/SlurpProvider.js";
|
|
@@ -152,7 +166,9 @@ import "./Tabs/index.js";
|
|
|
152
166
|
import "./Tag/index.js";
|
|
153
167
|
import "./Text/index.js";
|
|
154
168
|
import "./Tile/index.js";
|
|
169
|
+
import "./Timeline/index.js";
|
|
155
170
|
import "./Toast/index.js";
|
|
171
|
+
import "./Tree/index.js";
|
|
156
172
|
import { VisuallyHidden, VisuallyHiddenProps } from "./VisuallyHidden/VisuallyHidden.js";
|
|
157
173
|
import "./VisuallyHidden/index.js";
|
|
158
174
|
import { CONTRAST_MIN, alpha, contrast, meetsContrast, onColor, vivid } from "./lib/color.js";
|
|
@@ -171,4 +187,4 @@ import { FindInPage, focusHit, useFindInPage } from "./utils/useFindInPage.js";
|
|
|
171
187
|
import { useClipboard } from "./utils/useClipboard.js";
|
|
172
188
|
import { useScrollSpy } from "./utils/useScrollSpy.js";
|
|
173
189
|
import "./utils/index.js";
|
|
174
|
-
export { type AccentInput, AccentScope, type AccentScopeProps, AnimationGroup, type AnimationGroupProps, type AnimationProps, type Appearance, Avatar, type AvatarProps, type BaseProps, Bento, type BentoItem, type BentoProps, type BentoSpan, Bloom, type BloomPlacement, type BloomProps, Bubble, type BubbleProps, Button, type ButtonProps, type ButtonTone, CALENDAR_LABELS, CAROUSEL_LABELS, CHOICE_LABELS, CODE_LABELS, COMPACT_QUERY, CONTENTS_LABELS, CONTRAST_MIN, Calendar, type CalendarLabels, type CalendarProps, type CalendarValue, Card, type CardProps, Carousel, type CarouselLabels, type CarouselProps, Cell, type CellProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Choice, type ChoiceLabels, type ChoiceOption, type ChoiceProps, Code, type CodeLabels, type CodeProps, type ColorSchemeMode, ColorSchemeScript, type ColorSchemeScriptProps, type ColorSchemeState, type ColorValue, type ComponentsConfig, type ContentRef, Contents, type ContentsItem, type ContentsLabels, type ContentsProps, type ControlSize, type ControlledOptions, Count, type CountProps, type CrumbEnd, DATEFIELD_LABELS, DEFAULT_STORAGE_KEY, DIALOG_LABELS, DOCK_LABELS, DateField, type DateFieldLabels, type DateFieldProps, type DateRange, Dialog, type DialogLabels, type DialogProps, type DismissOptions, Dock, type DockActionProps, type DockBackProps, type DockCrumbProps, type DockCrumbsProps, type DockLabels, type DockProps, type DockSearchProps, ERRORSUMMARY_LABELS, Empty, type EmptyProps, ErrorSummary, type ErrorSummaryItem, type ErrorSummaryLabels, type ErrorSummaryProps, FILEDROP_LABELS, FILTERS_LABELS, FOCUSABLE, Fact, type FactProps, Field, type FieldProps, FileDrop, type FileDropLabels, type FileDropProps, Filters, type FiltersGroupProps, type FiltersLabels, type FiltersProps, type FindInPage, Flow, type FlowProps, Fold, type FoldProps, Footer, FooterBottom, FooterGroup, type FooterGroupProps, FooterLink, type FooterLinkProps, type FooterProps, Frame, type FrameProps, Ground, Hairline, type HairlineProps, Hint, type HintProps, Kbd, type KbdProps, type LabelsInput, Link, type LinkProps, List, type ListProps, ListRow, type ListRowProps, Mark, type MarkProps, type MaybeResponsive, Media, type MediaProps, Menu, MenuItem, type MenuItemProps, type MenuProps, type MotionOptions, type MoveFocusOptions, NOTICE_LABELS, NUMBERFIELD_LABELS, Notice, type NoticeLabels, type NoticeProps, NumberField, type NumberFieldLabels, type NumberFieldProps, PAGENAV_LABELS, PAGES_LABELS, type PageItem, PageNav, type PageNavLabels, type PageNavProps, type PageNavTarget, Pages, type PagesLabels, type PagesProps, PinField, type PinFieldProps, Placeholder, type PlaceholderProps, type PolymorphicProps, Portal, type PortalProps, Progress, type ProgressProps, Prose, type ProseProps, Quote, type QuoteProps, RATING_LABELS, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadiusValue, Rail, RailGroup, type RailGroupProps, RailLink, type RailLinkProps, type RailProps, Range, type RangeProps, Rating, type RatingLabels, type RatingProps, type ResolvedColorScheme, type Responsive, ResultRow, type ResultRowProps, type RovingFocusOptions, SEARCH_LABELS, SECRETFIELD_LABELS, SETTINGS_LABELS, SKIPLINK_LABELS, STEPS_LABELS, SUGGEST_LABELS, Score, type ScoreProps, Search, type SearchLabels, type SearchProps, SecretField, type SecretFieldLabels, type SecretFieldProps, Segmented, type SegmentedOption, type SegmentedProps, Settings, type SettingsLabels, type SettingsLanguage, type SettingsProps, Sheet, type SheetProps, Shelf, type ShelfProps, SkipLink, type SkipLinkLabels, type SkipLinkProps, type SlurpControls, type SlurpCss, type SlurpEnterOptions, type SlurpLabels, type SlurpNavigate, type SlurpNavigateOptions, SlurpProvider, type SlurpProviderProps, type SpaceValue, Stage, type StageProps, type StatusTone, type StepItem, Steps, type StepsLabels, type StepsProps, Suggest, type SuggestLabels, type SuggestOption, type SuggestProps, Surface, type SurfaceProps, Swatch, SwatchGroup, type SwatchGroupProps, type SwatchOption, type SwatchProps, Switch, type SwitchProps, TABLE_LABELS, TOAST_LABELS, type TabItem, Table, type TableColumn, type TableLabels, type TableProps, type TableSort, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, type TextTone, type Theme, type ThemeOptions, Tile, type TileProps, type ToastLabels, type ToastOptions, ToastProvider, type ToastProviderProps, type TokenOverrides, VisuallyHidden, type VisuallyHiddenProps, alpha, bentoLayout, contrast, createTheme, crumbPath, focusFirst, focusHit, labelsEn, labelsIt, matchRanges, matchesAll, meetsContrast, moveFocus, normalizeText, onColor, pageItems, useAnimationTarget, useClipboard, useColorScheme, useControlled, useDismiss, useFindInPage, useForkRef, useMediaQuery, useRovingFocus, useScrollSpy, useSlurp, useSlurpEnter, useSlurpNavigate, useTheme, useToast, vivid };
|
|
190
|
+
export { AVATAR_GROUP_LABELS, type AccentInput, AccentScope, type AccentScopeProps, AnimationGroup, type AnimationGroupProps, type AnimationProps, type Appearance, Avatar, AvatarGroup, type AvatarGroupLabels, type AvatarGroupProps, type AvatarProps, type BaseProps, Bento, type BentoItem, type BentoProps, type BentoSpan, Bloom, type BloomPlacement, type BloomProps, Bubble, type BubbleProps, Button, type ButtonProps, type ButtonTone, CALENDAR_LABELS, CAROUSEL_LABELS, CHOICE_LABELS, CODE_LABELS, COMPACT_QUERY, COMPARE_LABELS, CONSENT_LABELS, CONTENTS_LABELS, CONTRAST_MIN, Calendar, type CalendarLabels, type CalendarProps, type CalendarValue, Card, type CardProps, Carousel, type CarouselLabels, type CarouselProps, Cell, type CellProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Choice, type ChoiceLabels, type ChoiceOption, type ChoiceProps, Code, type CodeLabels, type CodeProps, type ColorSchemeMode, ColorSchemeScript, type ColorSchemeScriptProps, type ColorSchemeState, type ColorValue, Compare, type CompareLabels, type CompareProps, type ComponentsConfig, Consent, type ConsentLabels, type ConsentProps, type ContentRef, Contents, type ContentsItem, type ContentsLabels, type ContentsProps, type ControlSize, type ControlledOptions, Count, type CountProps, type CrumbEnd, DATEFIELD_LABELS, DEFAULT_STORAGE_KEY, DIALOG_LABELS, DOCK_LABELS, DateField, type DateFieldLabels, type DateFieldProps, type DateRange, Dialog, type DialogLabels, type DialogProps, type DismissOptions, Dock, type DockActionProps, type DockBackProps, type DockCrumbProps, type DockCrumbsProps, type DockLabels, type DockProps, type DockSearchProps, ERRORSUMMARY_LABELS, Empty, type EmptyProps, ErrorSummary, type ErrorSummaryItem, type ErrorSummaryLabels, type ErrorSummaryProps, FILEDROP_LABELS, FILTERS_LABELS, FOCUSABLE, Fact, type FactProps, Field, type FieldProps, FileDrop, type FileDropLabels, type FileDropProps, Filters, type FiltersGroupProps, type FiltersLabels, type FiltersProps, type FindInPage, Flow, type FlowProps, Fold, type FoldProps, Footer, FooterBottom, FooterGroup, type FooterGroupProps, FooterLink, type FooterLinkProps, type FooterProps, Frame, type FrameProps, Ground, Hairline, type HairlineProps, Hint, type HintProps, Kbd, type KbdProps, LIGHTBOX_LABELS, type LabelsInput, Lightbox, type LightboxImage, type LightboxLabels, type LightboxProps, Link, type LinkProps, List, type ListProps, ListRow, type ListRowProps, MULTI_SUGGEST_LABELS, Mark, type MarkProps, type MaybeResponsive, Media, type MediaProps, Menu, MenuGroup, type MenuGroupProps, MenuItem, type MenuItemProps, type MenuProps, MenuSeparator, type MotionOptions, type MoveFocusOptions, MultiSuggest, type MultiSuggestLabels, type MultiSuggestProps, NOTICE_LABELS, NUMBERFIELD_LABELS, Notice, type NoticeLabels, type NoticeProps, NumberField, type NumberFieldLabels, type NumberFieldProps, PAGENAV_LABELS, PAGES_LABELS, type PageItem, PageNav, type PageNavLabels, type PageNavProps, type PageNavTarget, Pages, type PagesLabels, type PagesProps, PinField, type PinFieldProps, Placeholder, type PlaceholderProps, type PolymorphicProps, Portal, type PortalProps, Progress, type ProgressProps, Prose, type ProseProps, Quote, type QuoteProps, RATING_LABELS, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadiusValue, Rail, RailGroup, type RailGroupProps, RailLink, type RailLinkProps, type RailProps, Range, type RangeProps, Rating, type RatingLabels, type RatingProps, type ResolvedColorScheme, type Responsive, ResultRow, type ResultRowProps, Reveal, type RevealProps, type RovingFocusOptions, SEARCH_LABELS, SECRETFIELD_LABELS, SETTINGS_LABELS, SKIPLINK_LABELS, STEPS_LABELS, SUGGEST_LABELS, Score, type ScoreProps, Search, type SearchLabels, type SearchProps, SecretField, type SecretFieldLabels, type SecretFieldProps, Segmented, type SegmentedOption, type SegmentedProps, Settings, type SettingsLabels, type SettingsLanguage, type SettingsProps, Sheet, type SheetOwnProps, type SheetProps, type SheetSide, Shelf, type ShelfProps, SkipLink, type SkipLinkLabels, type SkipLinkProps, type SlurpControls, type SlurpCss, type SlurpEnterOptions, type SlurpLabels, type SlurpNavigate, type SlurpNavigateOptions, SlurpProvider, type SlurpProviderProps, type SpaceValue, Stage, type StageProps, type StatusTone, type StepItem, Steps, type StepsLabels, type StepsProps, Suggest, type SuggestLabels, type SuggestOption, type SuggestProps, Surface, type SurfaceProps, Swatch, SwatchGroup, type SwatchGroupProps, type SwatchOption, type SwatchProps, Switch, type SwitchProps, TABLE_LABELS, TOAST_LABELS, type TabItem, Table, type TableColumn, type TableLabels, type TableProps, type TableSort, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, type TextTone, type Theme, type ThemeOptions, Tile, type TileProps, Timeline, type TimelineItem, type TimelineProps, type ToastLabels, type ToastOptions, ToastProvider, type ToastProviderProps, type TokenOverrides, Tree, type TreeItem, type TreeProps, VisuallyHidden, type VisuallyHiddenProps, alpha, bentoLayout, contrast, createTheme, crumbPath, focusFirst, focusHit, labelsEn, labelsIt, matchRanges, matchesAll, meetsContrast, moveFocus, normalizeText, onColor, pageItems, useAnimationTarget, useClipboard, useColorScheme, useControlled, useDismiss, useFindInPage, useForkRef, useMediaQuery, useRovingFocus, useScrollSpy, useSlurp, useSlurpEnter, useSlurpNavigate, useTheme, useToast, vivid };
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ import { CHOICE_LABELS, Choice } from "./Choice/Choice.js";
|
|
|
44
44
|
import { Tabs } from "./Tabs/Tabs.js";
|
|
45
45
|
import { Fold } from "./Fold/Fold.js";
|
|
46
46
|
import { Hint } from "./Hint/Hint.js";
|
|
47
|
-
import { Menu, MenuItem } from "./Menu/Menu.js";
|
|
47
|
+
import { Menu, MenuGroup, MenuItem, MenuSeparator } from "./Menu/Menu.js";
|
|
48
48
|
import { DIALOG_LABELS, Dialog } from "./Dialog/Dialog.js";
|
|
49
49
|
import { Sheet } from "./Sheet/Sheet.js";
|
|
50
50
|
import { TOAST_LABELS, ToastProvider, useToast } from "./Toast/Toast.js";
|
|
@@ -61,6 +61,14 @@ import { ResultRow } from "./ResultRow/ResultRow.js";
|
|
|
61
61
|
import { Mark } from "./Mark/Mark.js";
|
|
62
62
|
import { Empty } from "./Empty/Empty.js";
|
|
63
63
|
import { Link } from "./Link/Link.js";
|
|
64
|
+
import { Reveal } from "./Reveal/Reveal.js";
|
|
65
|
+
import { LIGHTBOX_LABELS, Lightbox } from "./Lightbox/Lightbox.js";
|
|
66
|
+
import { COMPARE_LABELS, Compare } from "./Compare/Compare.js";
|
|
67
|
+
import { Tree } from "./Tree/Tree.js";
|
|
68
|
+
import { CONSENT_LABELS, Consent } from "./Consent/Consent.js";
|
|
69
|
+
import { Timeline } from "./Timeline/Timeline.js";
|
|
70
|
+
import { AVATAR_GROUP_LABELS, AvatarGroup } from "./AvatarGroup/AvatarGroup.js";
|
|
71
|
+
import { MULTI_SUGGEST_LABELS, MultiSuggest } from "./MultiSuggest/MultiSuggest.js";
|
|
64
72
|
import { CALENDAR_LABELS, Calendar } from "./Calendar/Calendar.js";
|
|
65
73
|
import { DATEFIELD_LABELS, DateField } from "./DateField/DateField.js";
|
|
66
74
|
import { FILEDROP_LABELS, FileDrop } from "./FileDrop/FileDrop.js";
|
|
@@ -94,4 +102,4 @@ import { RATING_LABELS, Rating } from "./Rating/Rating.js";
|
|
|
94
102
|
import { TABLE_LABELS, Table } from "./Table/Table.js";
|
|
95
103
|
import { CAROUSEL_LABELS, Carousel } from "./Carousel/Carousel.js";
|
|
96
104
|
import { focusHit, useFindInPage } from "./utils/useFindInPage.js";
|
|
97
|
-
export { AccentScope, AnimationGroup, Avatar, Bento, Bloom, Bubble, Button, CALENDAR_LABELS, CAROUSEL_LABELS, CHOICE_LABELS, CODE_LABELS, COMPACT_QUERY, CONTENTS_LABELS, CONTRAST_MIN, Calendar, Card, Carousel, Cell, Checkbox, Chip, Choice, Code, ColorSchemeScript, Contents, Count, DATEFIELD_LABELS, DEFAULT_STORAGE_KEY, DIALOG_LABELS, DOCK_LABELS, DateField, Dialog, Dock, ERRORSUMMARY_LABELS, Empty, ErrorSummary, FILEDROP_LABELS, FILTERS_LABELS, FOCUSABLE, Fact, Field, FileDrop, Filters, Flow, Fold, Footer, FooterBottom, FooterGroup, FooterLink, Frame, Ground, Hairline, Hint, Kbd, Link, List, ListRow, Mark, Media, Menu, MenuItem, NOTICE_LABELS, NUMBERFIELD_LABELS, Notice, NumberField, PAGENAV_LABELS, PAGES_LABELS, PageNav, Pages, PinField, Placeholder, Portal, Progress, Prose, Quote, RATING_LABELS, Radio, RadioGroup, Rail, RailGroup, RailLink, Range, Rating, ResultRow, SEARCH_LABELS, SECRETFIELD_LABELS, SETTINGS_LABELS, SKIPLINK_LABELS, STEPS_LABELS, SUGGEST_LABELS, Score, Search, SecretField, Segmented, Settings, Sheet, Shelf, SkipLink, SlurpProvider, Stage, Steps, Suggest, Surface, Swatch, SwatchGroup, Switch, TABLE_LABELS, TOAST_LABELS, Table, Tabs, Tag, Text, Tile, ToastProvider, VisuallyHidden, alpha, bentoLayout, contrast, createTheme, crumbPath, focusFirst, focusHit, labelsEn, labelsIt, matchRanges, matchesAll, meetsContrast, moveFocus, normalizeText, onColor, pageItems, useAnimationTarget, useClipboard, useColorScheme, useControlled, useDismiss, useFindInPage, useForkRef, useMediaQuery, useRovingFocus, useScrollSpy, useSlurp, useSlurpEnter, useSlurpNavigate, useTheme, useToast, vivid };
|
|
105
|
+
export { AVATAR_GROUP_LABELS, AccentScope, AnimationGroup, Avatar, AvatarGroup, Bento, Bloom, Bubble, Button, CALENDAR_LABELS, CAROUSEL_LABELS, CHOICE_LABELS, CODE_LABELS, COMPACT_QUERY, COMPARE_LABELS, CONSENT_LABELS, CONTENTS_LABELS, CONTRAST_MIN, Calendar, Card, Carousel, Cell, Checkbox, Chip, Choice, Code, ColorSchemeScript, Compare, Consent, Contents, Count, DATEFIELD_LABELS, DEFAULT_STORAGE_KEY, DIALOG_LABELS, DOCK_LABELS, DateField, Dialog, Dock, ERRORSUMMARY_LABELS, Empty, ErrorSummary, FILEDROP_LABELS, FILTERS_LABELS, FOCUSABLE, Fact, Field, FileDrop, Filters, Flow, Fold, Footer, FooterBottom, FooterGroup, FooterLink, Frame, Ground, Hairline, Hint, Kbd, LIGHTBOX_LABELS, Lightbox, Link, List, ListRow, MULTI_SUGGEST_LABELS, Mark, Media, Menu, MenuGroup, MenuItem, MenuSeparator, MultiSuggest, NOTICE_LABELS, NUMBERFIELD_LABELS, Notice, NumberField, PAGENAV_LABELS, PAGES_LABELS, PageNav, Pages, PinField, Placeholder, Portal, Progress, Prose, Quote, RATING_LABELS, Radio, RadioGroup, Rail, RailGroup, RailLink, Range, Rating, ResultRow, Reveal, SEARCH_LABELS, SECRETFIELD_LABELS, SETTINGS_LABELS, SKIPLINK_LABELS, STEPS_LABELS, SUGGEST_LABELS, Score, Search, SecretField, Segmented, Settings, Sheet, Shelf, SkipLink, SlurpProvider, Stage, Steps, Suggest, Surface, Swatch, SwatchGroup, Switch, TABLE_LABELS, TOAST_LABELS, Table, Tabs, Tag, Text, Tile, Timeline, ToastProvider, Tree, VisuallyHidden, alpha, bentoLayout, contrast, createTheme, crumbPath, focusFirst, focusHit, labelsEn, labelsIt, matchRanges, matchesAll, meetsContrast, moveFocus, normalizeText, onColor, pageItems, useAnimationTarget, useClipboard, useColorScheme, useControlled, useDismiss, useFindInPage, useForkRef, useMediaQuery, useRovingFocus, useScrollSpy, useSlurp, useSlurpEnter, useSlurpNavigate, useTheme, useToast, vivid };
|
package/dist/lib/labels.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
import { AvatarGroupLabels } from "../AvatarGroup/AvatarGroup.js";
|
|
2
3
|
import { CalendarLabels } from "../Calendar/Calendar.js";
|
|
3
4
|
import { CarouselLabels } from "../Carousel/Carousel.js";
|
|
4
5
|
import { ChoiceLabels } from "../Choice/Choice.js";
|
|
5
6
|
import { CodeLabels } from "../Code/Code.js";
|
|
7
|
+
import { CompareLabels } from "../Compare/Compare.js";
|
|
8
|
+
import { ConsentLabels } from "../Consent/Consent.js";
|
|
6
9
|
import { ContentsLabels } from "../Contents/Contents.js";
|
|
7
10
|
import { DateFieldLabels } from "../DateField/DateField.js";
|
|
8
11
|
import { DialogLabels } from "../Dialog/Dialog.js";
|
|
@@ -10,6 +13,9 @@ import { DockLabels } from "../Dock/Dock.js";
|
|
|
10
13
|
import { ErrorSummaryLabels } from "../ErrorSummary/ErrorSummary.js";
|
|
11
14
|
import { FileDropLabels } from "../FileDrop/FileDrop.js";
|
|
12
15
|
import { FiltersLabels } from "../Filters/Filters.js";
|
|
16
|
+
import { LightboxLabels } from "../Lightbox/Lightbox.js";
|
|
17
|
+
import { SuggestLabels } from "../Suggest/Suggest.js";
|
|
18
|
+
import { MultiSuggestLabels } from "../MultiSuggest/MultiSuggest.js";
|
|
13
19
|
import { NoticeLabels } from "../Notice/Notice.js";
|
|
14
20
|
import { NumberFieldLabels } from "../NumberField/NumberField.js";
|
|
15
21
|
import { PageNavLabels } from "../PageNav/PageNav.js";
|
|
@@ -20,7 +26,6 @@ import { SecretFieldLabels } from "../SecretField/SecretField.js";
|
|
|
20
26
|
import { SettingsLabels } from "../Settings/Settings.js";
|
|
21
27
|
import { SkipLinkLabels } from "../SkipLink/SkipLink.js";
|
|
22
28
|
import { StepsLabels } from "../Steps/Steps.js";
|
|
23
|
-
import { SuggestLabels } from "../Suggest/Suggest.js";
|
|
24
29
|
import { TableLabels } from "../Table/Table.js";
|
|
25
30
|
import { ToastLabels } from "../Toast/Toast.js";
|
|
26
31
|
/** The texts of every component that has some, by component. Dialog's also apply to Sheet. */
|
|
@@ -46,6 +51,11 @@ export interface SlurpLabels {
|
|
|
46
51
|
Settings?: Partial<SettingsLabels>;
|
|
47
52
|
SkipLink?: Partial<SkipLinkLabels>;
|
|
48
53
|
Steps?: Partial<StepsLabels>;
|
|
54
|
+
AvatarGroup?: Partial<AvatarGroupLabels>;
|
|
55
|
+
Compare?: Partial<CompareLabels>;
|
|
56
|
+
Consent?: Partial<ConsentLabels>;
|
|
57
|
+
Lightbox?: Partial<LightboxLabels>;
|
|
58
|
+
MultiSuggest?: Partial<MultiSuggestLabels>;
|
|
49
59
|
Suggest?: Partial<SuggestLabels>;
|
|
50
60
|
Table?: Partial<TableLabels>;
|
|
51
61
|
Toast?: Partial<ToastLabels>;
|
|
@@ -158,12 +168,37 @@ export declare const labelsEn: {
|
|
|
158
168
|
label: string;
|
|
159
169
|
done: string;
|
|
160
170
|
};
|
|
171
|
+
AvatarGroup: {
|
|
172
|
+
more: (n: number) => string;
|
|
173
|
+
};
|
|
174
|
+
Compare: {
|
|
175
|
+
handle: string;
|
|
176
|
+
};
|
|
177
|
+
Lightbox: {
|
|
178
|
+
previous: string;
|
|
179
|
+
next: string;
|
|
180
|
+
position: (i: number, n: number) => string;
|
|
181
|
+
};
|
|
182
|
+
Consent: {
|
|
183
|
+
region: string;
|
|
184
|
+
accept: string;
|
|
185
|
+
reject: string;
|
|
186
|
+
customize: string;
|
|
187
|
+
};
|
|
188
|
+
MultiSuggest: {
|
|
189
|
+
results: (n: number) => string;
|
|
190
|
+
empty: string;
|
|
191
|
+
remove: (label: string) => string;
|
|
192
|
+
chosen: string;
|
|
193
|
+
};
|
|
161
194
|
Suggest: {
|
|
162
195
|
results: (n: number) => string;
|
|
163
196
|
empty: string;
|
|
164
197
|
};
|
|
165
198
|
Table: {
|
|
166
199
|
empty: string;
|
|
200
|
+
selectAll: string;
|
|
201
|
+
selectRow: string;
|
|
167
202
|
};
|
|
168
203
|
Toast: {
|
|
169
204
|
region: string;
|
package/dist/lib/labels.js
CHANGED
|
@@ -92,11 +92,34 @@ const labelsEn = {
|
|
|
92
92
|
label: "Steps",
|
|
93
93
|
done: "completed"
|
|
94
94
|
},
|
|
95
|
+
AvatarGroup: { more: (n) => n === 1 ? "one more person" : `${n} more people` },
|
|
96
|
+
Compare: { handle: "Compare before and after" },
|
|
97
|
+
Lightbox: {
|
|
98
|
+
previous: "Previous image",
|
|
99
|
+
next: "Next image",
|
|
100
|
+
position: (i, n) => `${i} of ${n}`
|
|
101
|
+
},
|
|
102
|
+
Consent: {
|
|
103
|
+
region: "Cookie preferences",
|
|
104
|
+
accept: "Accept",
|
|
105
|
+
reject: "Reject",
|
|
106
|
+
customize: "Customise"
|
|
107
|
+
},
|
|
108
|
+
MultiSuggest: {
|
|
109
|
+
results: (n) => n === 1 ? "1 suggestion" : `${n} suggestions`,
|
|
110
|
+
empty: "No suggestions",
|
|
111
|
+
remove: (label) => `Remove ${label}`,
|
|
112
|
+
chosen: "Chosen"
|
|
113
|
+
},
|
|
95
114
|
Suggest: {
|
|
96
115
|
results: (n) => n === 1 ? "1 suggestion" : `${n} suggestions`,
|
|
97
116
|
empty: "No suggestions"
|
|
98
117
|
},
|
|
99
|
-
Table: {
|
|
118
|
+
Table: {
|
|
119
|
+
empty: "No items",
|
|
120
|
+
selectAll: "Select all rows",
|
|
121
|
+
selectRow: "Select row"
|
|
122
|
+
},
|
|
100
123
|
Toast: {
|
|
101
124
|
region: "Notifications",
|
|
102
125
|
dismiss: "Dismiss notification"
|
package/dist/lib/labels.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","names":[],"sources":["../../src/lib/labels.ts"],"sourcesContent":["// Texts of the components, per language. Not an i18n system: every component keeps its Italian defaults and its\n// `labels` prop; a SlurpProvider can swap them all at once with a preset ('en') or an object.\nimport type { CarouselLabels } from '../Carousel/Carousel';\nimport type { SecretFieldLabels } from '../SecretField/SecretField';\nimport type { NumberFieldLabels } from '../NumberField/NumberField';\nimport type { FileDropLabels } from '../FileDrop/FileDrop';\nimport type { ErrorSummaryLabels } from '../ErrorSummary/ErrorSummary';\nimport type { DateFieldLabels } from '../DateField/DateField';\nimport type { CalendarLabels } from '../Calendar/Calendar';\nimport type { CodeLabels } from '../Code/Code';\nimport type { ContentsLabels } from '../Contents/Contents';\nimport type { PageNavLabels } from '../PageNav/PageNav';\nimport type { SkipLinkLabels } from '../SkipLink/SkipLink';\nimport type { ChoiceLabels } from '../Choice/Choice';\nimport type { DialogLabels } from '../Dialog/Dialog';\nimport type { DockLabels } from '../Dock/Dock';\nimport type { FiltersLabels } from '../Filters/Filters';\nimport type { NoticeLabels } from '../Notice/Notice';\nimport type { PagesLabels } from '../Pages/Pages';\nimport type { RatingLabels } from '../Rating/Rating';\nimport type { SearchLabels } from '../Search/Search';\nimport type { SettingsLabels } from '../Settings/Settings';\nimport type { StepsLabels } from '../Steps/Steps';\nimport type { SuggestLabels } from '../Suggest/Suggest';\nimport type { TableLabels } from '../Table/Table';\nimport type { ToastLabels } from '../Toast/Toast';\n\n/** The texts of every component that has some, by component. Dialog's also apply to Sheet. */\nexport interface SlurpLabels {\n SecretField?: Partial<SecretFieldLabels>;\n NumberField?: Partial<NumberFieldLabels>;\n FileDrop?: Partial<FileDropLabels>;\n ErrorSummary?: Partial<ErrorSummaryLabels>;\n DateField?: Partial<DateFieldLabels>;\n Calendar?: Partial<CalendarLabels>;\n Carousel?: Partial<CarouselLabels>;\n Choice?: Partial<ChoiceLabels>;\n Code?: Partial<CodeLabels>;\n Contents?: Partial<ContentsLabels>;\n Dialog?: Partial<DialogLabels>;\n Dock?: Partial<DockLabels>;\n Filters?: Partial<FiltersLabels>;\n Notice?: Partial<NoticeLabels>;\n PageNav?: Partial<PageNavLabels>;\n Pages?: Partial<PagesLabels>;\n Rating?: Partial<RatingLabels>;\n Search?: Partial<SearchLabels>;\n Settings?: Partial<SettingsLabels>;\n SkipLink?: Partial<SkipLinkLabels>;\n Steps?: Partial<StepsLabels>;\n Suggest?: Partial<SuggestLabels>;\n Table?: Partial<TableLabels>;\n Toast?: Partial<ToastLabels>;\n}\n\n/** A built-in language (a plain string, so a server component can pass it) or your own texts. */\nexport type LabelsInput = 'it' | 'en' | SlurpLabels;\n\n/** English texts for every component. Italian is the components' own default. */\nexport const labelsEn = {\n Calendar: { previous: 'Previous month', next: 'Next month' },\n DateField: { placeholder: 'Pick a date' },\n ErrorSummary: {\n title: (n) => (n === 1 ? 'There is 1 error to fix' : `There are ${n} errors to fix`),\n },\n FileDrop: {\n browse: 'Choose files',\n drop: 'or drop them here',\n remove: (name) => `Remove ${name}`,\n },\n NumberField: { decrement: 'Decrease', increment: 'Increase' },\n SecretField: { show: 'Show the password' },\n Carousel: {\n previous: 'Previous',\n next: 'Next',\n slide: (i, n) => `${i} of ${n}`,\n show: (i, n) => `Show ${i} of ${n}`,\n picker: 'Choose what to show',\n },\n Choice: { placeholder: 'Choose…' },\n Code: { copy: 'Copy the code', copied: 'Copied', region: 'Code' },\n Contents: { title: 'On this page' },\n Dialog: { close: 'Close' },\n Dock: {\n navigation: 'Navigation',\n crumbs: 'Path',\n back: 'Back',\n search: 'Search',\n searchPlaceholder: 'Search…',\n noResults: 'No results',\n matches: (i, n) => `${n === 1 ? '1 match' : `${n} matches`}, ${i} of ${n}`,\n nextMatch: (i, n) => `Go to the next match: ${i} of ${n}`,\n resultsHint: 'Arrow down to browse the results, Escape to close them.',\n },\n Filters: { title: 'Filters', reset: 'Reset filters' },\n Notice: {\n neutral: 'Note',\n success: 'Done',\n warning: 'Warning',\n danger: 'Error',\n dismiss: 'Dismiss notice',\n },\n PageNav: { label: 'Previous and next page', previous: 'Previous', next: 'Next' },\n Pages: {\n label: 'Pages',\n previous: 'Previous page',\n next: 'Next page',\n page: (n) => `Page ${n}`,\n status: (n, count) => `${n} of ${count}`,\n },\n Rating: {\n value: (v, max) => `${v} out of ${max}`,\n star: (n) => (n === 1 ? '1 star' : `${n} stars`),\n },\n Search: {\n label: 'Search',\n placeholder: 'Search…',\n clear: 'Clear the search',\n results: (n) => (n === 0 ? 'No results' : n === 1 ? '1 result' : `${n} results`),\n },\n Settings: {\n open: 'Settings',\n close: 'Close settings',\n title: 'Settings',\n theme: 'Theme',\n system: 'Automatic',\n light: 'Light',\n dark: 'Dark',\n language: 'Language',\n },\n SkipLink: { label: 'Skip to content' },\n Steps: { label: 'Steps', done: 'completed' },\n Suggest: {\n results: (n) => (n === 1 ? '1 suggestion' : `${n} suggestions`),\n empty: 'No suggestions',\n },\n Table: { empty: 'No items' },\n Toast: { region: 'Notifications', dismiss: 'Dismiss notification' },\n} satisfies Required<SlurpLabels>;\n\n/** Italian, the components' own defaults: nothing to swap. */\nexport const labelsIt: SlurpLabels = {};\n\n/** Resolves a provider's `labels` prop to texts by component. */\nexport function resolveLabels(input: LabelsInput | undefined): SlurpLabels | undefined {\n if (input === undefined) return undefined;\n if (input === 'en') return labelsEn;\n if (input === 'it') return labelsIt;\n return input;\n}\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"labels.js","names":[],"sources":["../../src/lib/labels.ts"],"sourcesContent":["// Texts of the components, per language. Not an i18n system: every component keeps its Italian defaults and its\n// `labels` prop; a SlurpProvider can swap them all at once with a preset ('en') or an object.\nimport type { CarouselLabels } from '../Carousel/Carousel';\nimport type { SecretFieldLabels } from '../SecretField/SecretField';\nimport type { NumberFieldLabels } from '../NumberField/NumberField';\nimport type { FileDropLabels } from '../FileDrop/FileDrop';\nimport type { ErrorSummaryLabels } from '../ErrorSummary/ErrorSummary';\nimport type { DateFieldLabels } from '../DateField/DateField';\nimport type { CalendarLabels } from '../Calendar/Calendar';\nimport type { CodeLabels } from '../Code/Code';\nimport type { ContentsLabels } from '../Contents/Contents';\nimport type { PageNavLabels } from '../PageNav/PageNav';\nimport type { SkipLinkLabels } from '../SkipLink/SkipLink';\nimport type { ChoiceLabels } from '../Choice/Choice';\nimport type { DialogLabels } from '../Dialog/Dialog';\nimport type { DockLabels } from '../Dock/Dock';\nimport type { FiltersLabels } from '../Filters/Filters';\nimport type { NoticeLabels } from '../Notice/Notice';\nimport type { PagesLabels } from '../Pages/Pages';\nimport type { RatingLabels } from '../Rating/Rating';\nimport type { SearchLabels } from '../Search/Search';\nimport type { SettingsLabels } from '../Settings/Settings';\nimport type { StepsLabels } from '../Steps/Steps';\nimport type { AvatarGroupLabels } from '../AvatarGroup/AvatarGroup';\nimport type { CompareLabels } from '../Compare/Compare';\nimport type { ConsentLabels } from '../Consent/Consent';\nimport type { LightboxLabels } from '../Lightbox/Lightbox';\nimport type { MultiSuggestLabels } from '../MultiSuggest/MultiSuggest';\nimport type { SuggestLabels } from '../Suggest/Suggest';\nimport type { TableLabels } from '../Table/Table';\nimport type { ToastLabels } from '../Toast/Toast';\n\n/** The texts of every component that has some, by component. Dialog's also apply to Sheet. */\nexport interface SlurpLabels {\n SecretField?: Partial<SecretFieldLabels>;\n NumberField?: Partial<NumberFieldLabels>;\n FileDrop?: Partial<FileDropLabels>;\n ErrorSummary?: Partial<ErrorSummaryLabels>;\n DateField?: Partial<DateFieldLabels>;\n Calendar?: Partial<CalendarLabels>;\n Carousel?: Partial<CarouselLabels>;\n Choice?: Partial<ChoiceLabels>;\n Code?: Partial<CodeLabels>;\n Contents?: Partial<ContentsLabels>;\n Dialog?: Partial<DialogLabels>;\n Dock?: Partial<DockLabels>;\n Filters?: Partial<FiltersLabels>;\n Notice?: Partial<NoticeLabels>;\n PageNav?: Partial<PageNavLabels>;\n Pages?: Partial<PagesLabels>;\n Rating?: Partial<RatingLabels>;\n Search?: Partial<SearchLabels>;\n Settings?: Partial<SettingsLabels>;\n SkipLink?: Partial<SkipLinkLabels>;\n Steps?: Partial<StepsLabels>;\n AvatarGroup?: Partial<AvatarGroupLabels>;\n Compare?: Partial<CompareLabels>;\n Consent?: Partial<ConsentLabels>;\n Lightbox?: Partial<LightboxLabels>;\n MultiSuggest?: Partial<MultiSuggestLabels>;\n Suggest?: Partial<SuggestLabels>;\n Table?: Partial<TableLabels>;\n Toast?: Partial<ToastLabels>;\n}\n\n/** A built-in language (a plain string, so a server component can pass it) or your own texts. */\nexport type LabelsInput = 'it' | 'en' | SlurpLabels;\n\n/** English texts for every component. Italian is the components' own default. */\nexport const labelsEn = {\n Calendar: { previous: 'Previous month', next: 'Next month' },\n DateField: { placeholder: 'Pick a date' },\n ErrorSummary: {\n title: (n) => (n === 1 ? 'There is 1 error to fix' : `There are ${n} errors to fix`),\n },\n FileDrop: {\n browse: 'Choose files',\n drop: 'or drop them here',\n remove: (name) => `Remove ${name}`,\n },\n NumberField: { decrement: 'Decrease', increment: 'Increase' },\n SecretField: { show: 'Show the password' },\n Carousel: {\n previous: 'Previous',\n next: 'Next',\n slide: (i, n) => `${i} of ${n}`,\n show: (i, n) => `Show ${i} of ${n}`,\n picker: 'Choose what to show',\n },\n Choice: { placeholder: 'Choose…' },\n Code: { copy: 'Copy the code', copied: 'Copied', region: 'Code' },\n Contents: { title: 'On this page' },\n Dialog: { close: 'Close' },\n Dock: {\n navigation: 'Navigation',\n crumbs: 'Path',\n back: 'Back',\n search: 'Search',\n searchPlaceholder: 'Search…',\n noResults: 'No results',\n matches: (i, n) => `${n === 1 ? '1 match' : `${n} matches`}, ${i} of ${n}`,\n nextMatch: (i, n) => `Go to the next match: ${i} of ${n}`,\n resultsHint: 'Arrow down to browse the results, Escape to close them.',\n },\n Filters: { title: 'Filters', reset: 'Reset filters' },\n Notice: {\n neutral: 'Note',\n success: 'Done',\n warning: 'Warning',\n danger: 'Error',\n dismiss: 'Dismiss notice',\n },\n PageNav: { label: 'Previous and next page', previous: 'Previous', next: 'Next' },\n Pages: {\n label: 'Pages',\n previous: 'Previous page',\n next: 'Next page',\n page: (n) => `Page ${n}`,\n status: (n, count) => `${n} of ${count}`,\n },\n Rating: {\n value: (v, max) => `${v} out of ${max}`,\n star: (n) => (n === 1 ? '1 star' : `${n} stars`),\n },\n Search: {\n label: 'Search',\n placeholder: 'Search…',\n clear: 'Clear the search',\n results: (n) => (n === 0 ? 'No results' : n === 1 ? '1 result' : `${n} results`),\n },\n Settings: {\n open: 'Settings',\n close: 'Close settings',\n title: 'Settings',\n theme: 'Theme',\n system: 'Automatic',\n light: 'Light',\n dark: 'Dark',\n language: 'Language',\n },\n SkipLink: { label: 'Skip to content' },\n Steps: { label: 'Steps', done: 'completed' },\n AvatarGroup: { more: (n) => (n === 1 ? 'one more person' : `${n} more people`) },\n Compare: { handle: 'Compare before and after' },\n Lightbox: {\n previous: 'Previous image',\n next: 'Next image',\n position: (i, n) => `${i} of ${n}`,\n },\n Consent: {\n region: 'Cookie preferences',\n accept: 'Accept',\n reject: 'Reject',\n customize: 'Customise',\n },\n MultiSuggest: {\n results: (n) => (n === 1 ? '1 suggestion' : `${n} suggestions`),\n empty: 'No suggestions',\n remove: (label) => `Remove ${label}`,\n chosen: 'Chosen',\n },\n Suggest: {\n results: (n) => (n === 1 ? '1 suggestion' : `${n} suggestions`),\n empty: 'No suggestions',\n },\n Table: { empty: 'No items', selectAll: 'Select all rows', selectRow: 'Select row' },\n Toast: { region: 'Notifications', dismiss: 'Dismiss notification' },\n} satisfies Required<SlurpLabels>;\n\n/** Italian, the components' own defaults: nothing to swap. */\nexport const labelsIt: SlurpLabels = {};\n\n/** Resolves a provider's `labels` prop to texts by component. */\nexport function resolveLabels(input: LabelsInput | undefined): SlurpLabels | undefined {\n if (input === undefined) return undefined;\n if (input === 'en') return labelsEn;\n if (input === 'it') return labelsIt;\n return input;\n}\n"],"mappings":";;;AAqEA,MAAa,WAAW;CACtB,UAAU;EAAE,UAAU;EAAkB,MAAM;CAAa;CAC3D,WAAW,EAAE,aAAa,cAAc;CACxC,cAAc,EACZ,QAAQ,MAAO,MAAM,IAAI,4BAA4B,aAAa,EAAE,gBACtE;CACA,UAAU;EACR,QAAQ;EACR,MAAM;EACN,SAAS,SAAS,UAAU;CAC9B;CACA,aAAa;EAAE,WAAW;EAAY,WAAW;CAAW;CAC5D,aAAa,EAAE,MAAM,oBAAoB;CACzC,UAAU;EACR,UAAU;EACV,MAAM;EACN,QAAQ,GAAG,MAAM,GAAG,EAAE,MAAM;EAC5B,OAAO,GAAG,MAAM,QAAQ,EAAE,MAAM;EAChC,QAAQ;CACV;CACA,QAAQ,EAAE,aAAa,UAAU;CACjC,MAAM;EAAE,MAAM;EAAiB,QAAQ;EAAU,QAAQ;CAAO;CAChE,UAAU,EAAE,OAAO,eAAe;CAClC,QAAQ,EAAE,OAAO,QAAQ;CACzB,MAAM;EACJ,YAAY;EACZ,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,mBAAmB;EACnB,WAAW;EACX,UAAU,GAAG,MAAM,GAAG,MAAM,IAAI,YAAY,GAAG,EAAE,UAAU,IAAI,EAAE,MAAM;EACvE,YAAY,GAAG,MAAM,yBAAyB,EAAE,MAAM;EACtD,aAAa;CACf;CACA,SAAS;EAAE,OAAO;EAAW,OAAO;CAAgB;CACpD,QAAQ;EACN,SAAS;EACT,SAAS;EACT,SAAS;EACT,QAAQ;EACR,SAAS;CACX;CACA,SAAS;EAAE,OAAO;EAA0B,UAAU;EAAY,MAAM;CAAO;CAC/E,OAAO;EACL,OAAO;EACP,UAAU;EACV,MAAM;EACN,OAAO,MAAM,QAAQ;EACrB,SAAS,GAAG,UAAU,GAAG,EAAE,MAAM;CACnC;CACA,QAAQ;EACN,QAAQ,GAAG,QAAQ,GAAG,EAAE,UAAU;EAClC,OAAO,MAAO,MAAM,IAAI,WAAW,GAAG,EAAE;CAC1C;CACA,QAAQ;EACN,OAAO;EACP,aAAa;EACb,OAAO;EACP,UAAU,MAAO,MAAM,IAAI,eAAe,MAAM,IAAI,aAAa,GAAG,EAAE;CACxE;CACA,UAAU;EACR,MAAM;EACN,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,MAAM;EACN,UAAU;CACZ;CACA,UAAU,EAAE,OAAO,kBAAkB;CACrC,OAAO;EAAE,OAAO;EAAS,MAAM;CAAY;CAC3C,aAAa,EAAE,OAAO,MAAO,MAAM,IAAI,oBAAoB,GAAG,EAAE,cAAe;CAC/E,SAAS,EAAE,QAAQ,2BAA2B;CAC9C,UAAU;EACR,UAAU;EACV,MAAM;EACN,WAAW,GAAG,MAAM,GAAG,EAAE,MAAM;CACjC;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,WAAW;CACb;CACA,cAAc;EACZ,UAAU,MAAO,MAAM,IAAI,iBAAiB,GAAG,EAAE;EACjD,OAAO;EACP,SAAS,UAAU,UAAU;EAC7B,QAAQ;CACV;CACA,SAAS;EACP,UAAU,MAAO,MAAM,IAAI,iBAAiB,GAAG,EAAE;EACjD,OAAO;CACT;CACA,OAAO;EAAE,OAAO;EAAY,WAAW;EAAmB,WAAW;CAAa;CAClF,OAAO;EAAE,QAAQ;EAAiB,SAAS;CAAuB;AACpE;;AAGA,MAAa,WAAwB,CAAC;;AAGtC,SAAgB,cAAc,OAAyD;CACrF,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,UAAU,MAAM,OAAO;CAC3B,OAAO;AACT"}
|
package/dist/lib/theme.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { SlurpCss } from "./css.js";
|
|
3
3
|
import { AccentScopeProps } from "../AccentScope/AccentScope.js";
|
|
4
4
|
import { AvatarProps } from "../Avatar/Avatar.js";
|
|
5
|
+
import { AvatarGroupProps } from "../AvatarGroup/AvatarGroup.js";
|
|
5
6
|
import { BentoProps } from "../Bento/Bento.js";
|
|
6
7
|
import { BloomProps } from "../Bloom/Bloom.js";
|
|
7
8
|
import { ButtonProps } from "../Button/Button.js";
|
|
@@ -14,6 +15,8 @@ import { CheckboxProps } from "../Checkbox/Checkbox.js";
|
|
|
14
15
|
import { ChipProps } from "../Chip/Chip.js";
|
|
15
16
|
import { ChoiceProps } from "../Choice/Choice.js";
|
|
16
17
|
import { CodeProps } from "../Code/Code.js";
|
|
18
|
+
import { CompareProps } from "../Compare/Compare.js";
|
|
19
|
+
import { ConsentProps } from "../Consent/Consent.js";
|
|
17
20
|
import { ContentsProps } from "../Contents/Contents.js";
|
|
18
21
|
import { CountProps } from "../Count/Count.js";
|
|
19
22
|
import { DateFieldProps } from "../DateField/DateField.js";
|
|
@@ -32,10 +35,13 @@ import { FrameProps } from "../Frame/Frame.js";
|
|
|
32
35
|
import { HairlineProps } from "../Hairline/Hairline.js";
|
|
33
36
|
import { HintProps } from "../Hint/Hint.js";
|
|
34
37
|
import { KbdProps } from "../Kbd/Kbd.js";
|
|
38
|
+
import { LightboxProps } from "../Lightbox/Lightbox.js";
|
|
35
39
|
import { LinkProps } from "../Link/Link.js";
|
|
36
40
|
import { ListProps, ListRowProps } from "../ListRow/ListRow.js";
|
|
37
41
|
import { MediaProps } from "../Media/Media.js";
|
|
38
42
|
import { MenuProps } from "../Menu/Menu.js";
|
|
43
|
+
import { SuggestProps } from "../Suggest/Suggest.js";
|
|
44
|
+
import { MultiSuggestProps } from "../MultiSuggest/MultiSuggest.js";
|
|
39
45
|
import { NoticeProps } from "../Notice/Notice.js";
|
|
40
46
|
import { NumberFieldProps } from "../NumberField/NumberField.js";
|
|
41
47
|
import { PageNavProps } from "../PageNav/PageNav.js";
|
|
@@ -50,6 +56,7 @@ import { RailProps } from "../Rail/Rail.js";
|
|
|
50
56
|
import { RangeProps } from "../Range/Range.js";
|
|
51
57
|
import { RatingProps } from "../Rating/Rating.js";
|
|
52
58
|
import { ResultRowProps } from "../ResultRow/ResultRow.js";
|
|
59
|
+
import { RevealProps } from "../Reveal/Reveal.js";
|
|
53
60
|
import { ScoreProps } from "../Score/Score.js";
|
|
54
61
|
import { SearchProps } from "../Search/Search.js";
|
|
55
62
|
import { SecretFieldProps } from "../SecretField/SecretField.js";
|
|
@@ -59,7 +66,6 @@ import { SheetProps } from "../Sheet/Sheet.js";
|
|
|
59
66
|
import { ShelfProps } from "../Shelf/Shelf.js";
|
|
60
67
|
import { SkipLinkProps } from "../SkipLink/SkipLink.js";
|
|
61
68
|
import { StepsProps } from "../Steps/Steps.js";
|
|
62
|
-
import { SuggestProps } from "../Suggest/Suggest.js";
|
|
63
69
|
import { TableProps } from "../Table/Table.js";
|
|
64
70
|
import { StageProps } from "../Stage/Stage.js";
|
|
65
71
|
import { TileProps } from "../Tile/Tile.js";
|
|
@@ -68,6 +74,8 @@ import { SwatchGroupProps, SwatchProps } from "../Swatch/Swatch.js";
|
|
|
68
74
|
import { SwitchProps } from "../Switch/Switch.js";
|
|
69
75
|
import { TabsProps } from "../Tabs/Tabs.js";
|
|
70
76
|
import { TextProps } from "../Text/Text.js";
|
|
77
|
+
import { TreeProps } from "../Tree/Tree.js";
|
|
78
|
+
import { TimelineProps } from "../Timeline/Timeline.js";
|
|
71
79
|
import { TagProps } from "../Tag/Tag.js";
|
|
72
80
|
import { GhostKind, SlurpDefaults } from "@slurp-ui/motion";
|
|
73
81
|
import { ColorToken, HueToken, RadiusToken, SpaceToken, blur, shadow } from "@slurp-ui/tokens";
|
|
@@ -95,6 +103,38 @@ export interface MotionOptions extends Pick<SlurpDefaults, 'duration' | 'stagger
|
|
|
95
103
|
}
|
|
96
104
|
/** Components that read defaults and `css` overrides from the theme, with their parts. */
|
|
97
105
|
export interface ThemeComponents {
|
|
106
|
+
Reveal: {
|
|
107
|
+
props: RevealProps;
|
|
108
|
+
parts: 'root';
|
|
109
|
+
};
|
|
110
|
+
Lightbox: {
|
|
111
|
+
props: LightboxProps;
|
|
112
|
+
parts: 'root';
|
|
113
|
+
};
|
|
114
|
+
Compare: {
|
|
115
|
+
props: CompareProps;
|
|
116
|
+
parts: 'root';
|
|
117
|
+
};
|
|
118
|
+
Tree: {
|
|
119
|
+
props: TreeProps;
|
|
120
|
+
parts: 'root';
|
|
121
|
+
};
|
|
122
|
+
Consent: {
|
|
123
|
+
props: ConsentProps;
|
|
124
|
+
parts: 'root';
|
|
125
|
+
};
|
|
126
|
+
Timeline: {
|
|
127
|
+
props: TimelineProps;
|
|
128
|
+
parts: 'root';
|
|
129
|
+
};
|
|
130
|
+
AvatarGroup: {
|
|
131
|
+
props: AvatarGroupProps;
|
|
132
|
+
parts: 'root';
|
|
133
|
+
};
|
|
134
|
+
MultiSuggest: {
|
|
135
|
+
props: MultiSuggestProps;
|
|
136
|
+
parts: 'root' | 'label' | 'control' | 'list' | 'option' | 'tags' | 'tag' | 'hint' | 'error';
|
|
137
|
+
};
|
|
98
138
|
DateField: {
|
|
99
139
|
props: DateFieldProps;
|
|
100
140
|
parts: 'root';
|
package/dist/lib/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":[],"sources":["../../src/lib/theme.ts"],"sourcesContent":["// createTheme() and the stylesheet that applies a theme. Server-safe: a theme is plain, serialisable data,\n// so it can be created in a server component and passed to <SlurpProvider>.\nimport { MOTION_DEFAULTS, type GhostKind, type SlurpDefaults } from '@slurp-ui/motion';\nimport type { blur, ColorToken, HueToken, RadiusToken, shadow, SpaceToken } from '@slurp-ui/tokens';\n\nimport type { AccentScopeProps } from '../AccentScope/AccentScope';\nimport type { BentoProps } from '../Bento/Bento';\nimport type { CardProps } from '../Card/Card';\nimport type { DockProps } from '../Dock/Dock';\nimport type { EmptyProps } from '../Empty/Empty';\nimport type { FactProps } from '../Fact/Fact';\nimport type { FiltersProps } from '../Filters/Filters';\nimport type { LinkProps } from '../Link/Link';\nimport type { ListProps, ListRowProps } from '../ListRow/ListRow';\nimport type { ResultRowProps } from '../ResultRow/ResultRow';\nimport type { ScoreProps } from '../Score/Score';\nimport type { SettingsProps } from '../Settings/Settings';\nimport type { ShelfProps } from '../Shelf/Shelf';\nimport type { StageProps } from '../Stage/Stage';\nimport type { TileProps } from '../Tile/Tile';\nimport type { CarouselProps } from '../Carousel/Carousel';\nimport type { PagesProps } from '../Pages/Pages';\nimport type { RatingProps } from '../Rating/Rating';\nimport type { StepsProps } from '../Steps/Steps';\nimport type { SuggestProps } from '../Suggest/Suggest';\nimport type { TableProps } from '../Table/Table';\nimport type { AvatarProps } from '../Avatar/Avatar';\nimport type { BloomProps } from '../Bloom/Bloom';\nimport type { BubbleProps } from '../Bubble/Bubble';\nimport type { ButtonProps } from '../Button/Button';\nimport type { CellProps } from '../Cell/Cell';\nimport type { CheckboxProps } from '../Checkbox/Checkbox';\nimport type { ChipProps } from '../Chip/Chip';\nimport type { ChoiceProps } from '../Choice/Choice';\nimport type { CountProps } from '../Count/Count';\nimport type { DialogProps } from '../Dialog/Dialog';\nimport type { FieldProps } from '../Field/Field';\nimport type { FlowProps } from '../Flow/Flow';\nimport type { FoldProps } from '../Fold/Fold';\nimport type { FrameProps } from '../Frame/Frame';\nimport type { HintProps } from '../Hint/Hint';\nimport type { MenuProps } from '../Menu/Menu';\nimport type { NoticeProps } from '../Notice/Notice';\nimport type { PlaceholderProps } from '../Placeholder/Placeholder';\nimport type { ProgressProps } from '../Progress/Progress';\nimport type { RadioGroupProps, RadioProps } from '../Radio/Radio';\nimport type { RangeProps } from '../Range/Range';\nimport type { SearchProps } from '../Search/Search';\nimport type { SegmentedProps } from '../Segmented/Segmented';\nimport type { SheetProps } from '../Sheet/Sheet';\nimport type { SurfaceProps } from '../Surface/Surface';\nimport type { SwatchGroupProps, SwatchProps } from '../Swatch/Swatch';\nimport type { SwitchProps } from '../Switch/Switch';\nimport type { TabsProps } from '../Tabs/Tabs';\nimport type { TextProps } from '../Text/Text';\nimport type { DateFieldProps } from '../DateField/DateField';\nimport type { CalendarProps } from '../Calendar/Calendar';\nimport type { FileDropProps } from '../FileDrop/FileDrop';\nimport type { ErrorSummaryProps } from '../ErrorSummary/ErrorSummary';\nimport type { PinFieldProps } from '../PinField/PinField';\nimport type { NumberFieldProps } from '../NumberField/NumberField';\nimport type { SecretFieldProps } from '../SecretField/SecretField';\nimport type { FooterProps } from '../Footer/Footer';\nimport type { MediaProps } from '../Media/Media';\nimport type { QuoteProps } from '../Quote/Quote';\nimport type { KbdProps } from '../Kbd/Kbd';\nimport type { TagProps } from '../Tag/Tag';\nimport type { CodeProps } from '../Code/Code';\nimport type { ContentsProps } from '../Contents/Contents';\nimport type { HairlineProps } from '../Hairline/Hairline';\nimport type { PageNavProps } from '../PageNav/PageNav';\nimport type { ProseProps } from '../Prose/Prose';\nimport type { RailProps } from '../Rail/Rail';\nimport type { SkipLinkProps } from '../SkipLink/SkipLink';\nimport { accentVars, resolveAccent } from './color';\nimport { hash, LAYER_ORDER, type SlurpCss } from './css';\n\nexport type ColorSchemeMode = 'light' | 'dark' | 'system';\nexport type ResolvedColorScheme = 'light' | 'dark';\n/** A `hue-*` preset (used as is) or any hex colour (turned into an accent with `vivid()`). */\nexport type AccentInput = `hue-${HueToken}` | `#${string}`;\n\ntype Themed = string | { light: string; dark: string };\ntype Length = string | number;\n\nexport interface TokenOverrides {\n color?: Partial<Record<ColorToken | `hue-${HueToken}`, Themed>>;\n space?: Partial<Record<SpaceToken, Length>>;\n radius?: Partial<Record<RadiusToken, Length>>;\n shadow?: Partial<Record<keyof typeof shadow, Themed>>;\n blur?: Partial<Record<keyof typeof blur, Length>>;\n}\n\n/** Defaults of the collapse / expand transitions started with useSlurp() (serialisable values only). */\nexport interface MotionOptions extends Pick<\n SlurpDefaults,\n 'duration' | 'stagger' | 'curve' | 'swell' | 'drop' | 'reducedMotion' | 'interrupt'\n> {\n goo: boolean | 'auto';\n ghost: GhostKind;\n order: 'distance' | 'dom';\n}\n\nconst { duration, stagger, curve, swell, drop, reducedMotion, interrupt } = MOTION_DEFAULTS;\nconst DEFAULT_MOTION: MotionOptions = {\n duration,\n stagger,\n curve,\n swell,\n drop,\n reducedMotion,\n interrupt,\n goo: 'auto',\n ghost: 'shape',\n order: 'distance',\n};\n\n/** Components that read defaults and `css` overrides from the theme, with their parts. */\nexport interface ThemeComponents {\n DateField: { props: DateFieldProps; parts: 'root' };\n Calendar: { props: CalendarProps; parts: 'root' };\n FileDrop: { props: FileDropProps; parts: 'root' };\n ErrorSummary: { props: ErrorSummaryProps; parts: 'root' };\n PinField: { props: PinFieldProps; parts: 'root' };\n NumberField: { props: NumberFieldProps; parts: 'root' };\n SecretField: { props: SecretFieldProps; parts: 'root' };\n Footer: { props: FooterProps; parts: 'root' };\n Media: { props: MediaProps; parts: 'root' | 'frame' | 'media' | 'caption' };\n Quote: { props: QuoteProps; parts: 'root' | 'quote' | 'caption' };\n Kbd: { props: KbdProps; parts: 'root' };\n Tag: { props: TagProps; parts: 'root' };\n AccentScope: { props: AccentScopeProps; parts: 'root' };\n Code: { props: CodeProps; parts: 'root' | 'bar' | 'filename' | 'copy' | 'pre' };\n Contents: { props: ContentsProps; parts: 'root' | 'title' | 'list' | 'item' | 'link' };\n Hairline: { props: HairlineProps; parts: 'root' };\n PageNav: { props: PageNavProps; parts: 'root' };\n Prose: { props: ProseProps; parts: 'root' };\n Rail: { props: RailProps; parts: 'root' };\n SkipLink: { props: SkipLinkProps; parts: 'root' };\n Bento: { props: BentoProps; parts: 'root' };\n Card: { props: CardProps; parts: 'root' | 'media' | 'badge' | 'title' | 'description' };\n Dock: { props: DockProps; parts: 'root' };\n Empty: { props: EmptyProps; parts: 'root' };\n Fact: { props: FactProps; parts: 'root' };\n Filters: { props: FiltersProps; parts: 'root' };\n Link: { props: LinkProps; parts: 'root' };\n List: { props: ListProps; parts: 'root' };\n ListRow: {\n props: ListRowProps;\n parts: 'root' | 'mark' | 'title' | 'link' | 'tag' | 'meta' | 'value' | 'action';\n };\n ResultRow: { props: ResultRowProps; parts: 'root' };\n Score: { props: ScoreProps; parts: 'root' };\n Settings: { props: SettingsProps; parts: 'root' };\n Shelf: { props: ShelfProps; parts: 'root' };\n Stage: { props: StageProps; parts: 'root' };\n Tile: {\n props: TileProps;\n parts: 'root' | 'blob' | 'text' | 'title' | 'subtitle' | 'badge' | 'media';\n };\n Avatar: { props: AvatarProps; parts: 'root' };\n Bloom: { props: BloomProps; parts: 'root' | 'surface' | 'trigger' | 'panel' };\n Bubble: { props: BubbleProps; parts: 'root' };\n Button: { props: ButtonProps; parts: 'root' | 'icon' | 'label' | 'endIcon' };\n Cell: { props: CellProps; parts: 'root' };\n Checkbox: { props: CheckboxProps; parts: 'root' | 'input' | 'box' | 'label' };\n Chip: { props: ChipProps; parts: 'root' };\n Choice: { props: ChoiceProps; parts: 'root' };\n Count: { props: CountProps; parts: 'root' };\n Dialog: {\n props: DialogProps;\n parts: 'root' | 'header' | 'title' | 'description' | 'body' | 'footer' | 'close';\n };\n Field: { props: FieldProps; parts: 'root' | 'label' | 'control' | 'hint' | 'error' };\n Flow: { props: FlowProps; parts: 'root' };\n Fold: { props: FoldProps; parts: 'root' | 'heading' | 'trigger' | 'region' };\n Frame: { props: FrameProps; parts: 'root' };\n Hint: { props: HintProps; parts: 'root' };\n Menu: { props: MenuProps; parts: 'root' };\n Notice: { props: NoticeProps; parts: 'root' | 'icon' | 'title' | 'body' | 'dismiss' };\n Placeholder: { props: PlaceholderProps; parts: 'root' };\n Progress: { props: ProgressProps; parts: 'root' };\n Radio: { props: RadioProps; parts: 'root' | 'input' | 'dot' | 'label' };\n RadioGroup: { props: RadioGroupProps; parts: 'root' | 'legend' };\n Range: { props: RangeProps; parts: 'root' | 'label' | 'value' | 'control' };\n Search: { props: SearchProps; parts: 'root' | 'icon' | 'control' | 'clear' | 'status' };\n Segmented: { props: SegmentedProps; parts: 'root' | 'item' };\n Sheet: {\n props: SheetProps;\n parts: 'root' | 'header' | 'title' | 'description' | 'body' | 'footer' | 'close';\n };\n Surface: { props: SurfaceProps; parts: 'root' };\n Swatch: { props: SwatchProps; parts: 'root' };\n SwatchGroup: { props: SwatchGroupProps; parts: 'root' };\n Switch: { props: SwitchProps; parts: 'root' | 'input' | 'track' | 'thumb' | 'label' };\n Tabs: { props: TabsProps; parts: 'root' | 'list' | 'tab' | 'indicator' | 'panel' };\n Text: { props: TextProps; parts: 'root' };\n Suggest: {\n props: SuggestProps;\n parts: 'root' | 'label' | 'control' | 'list' | 'option' | 'hint' | 'error';\n };\n Pages: { props: PagesProps; parts: 'root' | 'list' | 'item' | 'previous' | 'next' | 'status' };\n Steps: { props: StepsProps; parts: 'root' | 'list' | 'step' };\n Rating: { props: RatingProps; parts: 'root' };\n Table: { props: TableProps; parts: 'root' | 'table' | 'caption' };\n Carousel: {\n props: CarouselProps;\n parts: 'root' | 'track' | 'slide' | 'controls' | 'previous' | 'next' | 'dot';\n };\n}\nexport type ComponentName = keyof ThemeComponents;\n\nexport type ComponentsConfig = {\n [K in ComponentName]?: {\n defaults?: Partial<Omit<ThemeComponents[K]['props'], 'ref' | 'children' | 'css'>>;\n css?: Partial<Record<ThemeComponents[K]['parts'], SlurpCss>>;\n };\n};\n\nexport interface ThemeOptions {\n /** Initial colour scheme, until the person chooses one (default `system`). */\n colorScheme?: ColorSchemeMode;\n /** Default `hue-violet`. */\n accent?: AccentInput;\n /** Used only by Intl (numbers, prices). Not an i18n system. Default `it-IT`. */\n locale?: string;\n tokens?: TokenOverrides;\n motion?: Partial<MotionOptions>;\n components?: ComponentsConfig;\n}\n\nexport interface Theme {\n colorScheme: ColorSchemeMode;\n accent: AccentInput;\n /** The accent actually painted (hex). */\n accentColor: string;\n locale: string;\n tokens: TokenOverrides;\n motion: MotionOptions;\n components: ComponentsConfig;\n}\n\nconst DEFAULT_ACCENT: AccentInput = 'hue-violet';\n\n/** localStorage key of the chosen colour scheme (same as the design system's setTheme()). */\nexport const DEFAULT_STORAGE_KEY = 'slurp-theme';\n\nexport function createTheme(options: ThemeOptions = {}): Theme {\n const accent = options.accent ?? DEFAULT_ACCENT;\n return {\n colorScheme: options.colorScheme ?? 'system',\n accent,\n accentColor: resolveAccent(accent),\n locale: options.locale ?? 'it-IT',\n tokens: options.tokens ?? {},\n motion: { ...DEFAULT_MOTION, ...options.motion },\n components: options.components ?? {},\n };\n}\n\nexport const defaultTheme: Theme = createTheme();\n\nconst px = (v: Length) => (typeof v === 'number' ? `${v}px` : v);\n\n/** Light / dark declarations of the token overrides of a theme. */\nfunction overrideDeclarations(tokens: TokenOverrides) {\n const light: string[] = [];\n const dark: string[] = [];\n const add = (name: string, v: Themed | number) => {\n if (typeof v === 'object') {\n light.push(`--slurp-${name}:${v.light}`);\n dark.push(`--slurp-${name}:${v.dark}`);\n } else light.push(`--slurp-${name}:${px(v)}`);\n };\n for (const [k, v] of Object.entries(tokens.color ?? {})) if (v !== undefined) add(k, v);\n for (const [k, v] of Object.entries(tokens.space ?? {}))\n if (v !== undefined) add(`space-${k}`, v);\n for (const [k, v] of Object.entries(tokens.radius ?? {}))\n if (v !== undefined) add(`radius-${k}`, v);\n for (const [k, v] of Object.entries(tokens.shadow ?? {}))\n if (v !== undefined) add(`shadow-${k}`, v);\n for (const [k, v] of Object.entries(tokens.blur ?? {})) if (v !== undefined) add(`blur-${k}`, v);\n return { light, dark };\n}\n\nfunction selectors(scope: string | undefined) {\n if (!scope) {\n return {\n base: ':root,[data-theme]',\n dark: \"[data-theme='dark']\",\n systemDark: \":root:not([data-theme='light'])\",\n };\n }\n const s = `[data-slurp-theme=\"${scope}\"]`;\n return {\n base: `${s},${s} [data-theme]`,\n dark: `:root[data-theme='dark'] ${s},${s} [data-theme='dark']`,\n systemDark: `:root:not([data-theme='light']) ${s}`,\n };\n}\n\n/**\n * The stylesheet of a theme: accent variables and token overrides, on the root (or on a nested provider's `scope`)\n * and on every `data-theme` subtree, so derived values re-resolve per theme. Empty for the default theme.\n * tokens.css uses `:where()`, so these plain selectors win whatever the stylesheet order.\n */\nexport function themeCss(theme: Theme, scope?: string): string {\n const { light, dark } = overrideDeclarations(theme.tokens);\n const accent =\n theme.accent === DEFAULT_ACCENT\n ? []\n : Object.entries(accentVars(theme.accentColor)).map(([k, v]) => `${k}:${v}`);\n const base = [...accent, ...light];\n if (!base.length && !dark.length) return '';\n const sel = selectors(scope);\n const rules = [`${sel.base}{${base.join(';')}}`];\n if (dark.length) {\n rules.push(\n `${sel.dark}{${dark.join(';')}}`,\n `@media (prefers-color-scheme: dark){${sel.systemDark}{${dark.join(';')}}}`,\n );\n }\n return `${LAYER_ORDER}@layer slurp.base{${rules.join('')}}`;\n}\n\n/** Stable id of a stylesheet, for React's <style href> de-duplication. */\nexport const styleId = (prefix: string, css: string) => `slurp-${prefix}-${hash(css)}`;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../../src/lib/theme.ts"],"sourcesContent":["// createTheme() and the stylesheet that applies a theme. Server-safe: a theme is plain, serialisable data,\n// so it can be created in a server component and passed to <SlurpProvider>.\nimport { MOTION_DEFAULTS, type GhostKind, type SlurpDefaults } from '@slurp-ui/motion';\nimport type { blur, ColorToken, HueToken, RadiusToken, shadow, SpaceToken } from '@slurp-ui/tokens';\n\nimport type { AccentScopeProps } from '../AccentScope/AccentScope';\nimport type { BentoProps } from '../Bento/Bento';\nimport type { CardProps } from '../Card/Card';\nimport type { DockProps } from '../Dock/Dock';\nimport type { EmptyProps } from '../Empty/Empty';\nimport type { FactProps } from '../Fact/Fact';\nimport type { FiltersProps } from '../Filters/Filters';\nimport type { LinkProps } from '../Link/Link';\nimport type { ListProps, ListRowProps } from '../ListRow/ListRow';\nimport type { ResultRowProps } from '../ResultRow/ResultRow';\nimport type { ScoreProps } from '../Score/Score';\nimport type { SettingsProps } from '../Settings/Settings';\nimport type { ShelfProps } from '../Shelf/Shelf';\nimport type { StageProps } from '../Stage/Stage';\nimport type { TileProps } from '../Tile/Tile';\nimport type { CarouselProps } from '../Carousel/Carousel';\nimport type { PagesProps } from '../Pages/Pages';\nimport type { RatingProps } from '../Rating/Rating';\nimport type { StepsProps } from '../Steps/Steps';\nimport type { SuggestProps } from '../Suggest/Suggest';\nimport type { TableProps } from '../Table/Table';\nimport type { AvatarProps } from '../Avatar/Avatar';\nimport type { BloomProps } from '../Bloom/Bloom';\nimport type { BubbleProps } from '../Bubble/Bubble';\nimport type { ButtonProps } from '../Button/Button';\nimport type { CellProps } from '../Cell/Cell';\nimport type { CheckboxProps } from '../Checkbox/Checkbox';\nimport type { ChipProps } from '../Chip/Chip';\nimport type { ChoiceProps } from '../Choice/Choice';\nimport type { CountProps } from '../Count/Count';\nimport type { DialogProps } from '../Dialog/Dialog';\nimport type { FieldProps } from '../Field/Field';\nimport type { FlowProps } from '../Flow/Flow';\nimport type { FoldProps } from '../Fold/Fold';\nimport type { FrameProps } from '../Frame/Frame';\nimport type { HintProps } from '../Hint/Hint';\nimport type { MenuProps } from '../Menu/Menu';\nimport type { NoticeProps } from '../Notice/Notice';\nimport type { PlaceholderProps } from '../Placeholder/Placeholder';\nimport type { ProgressProps } from '../Progress/Progress';\nimport type { RadioGroupProps, RadioProps } from '../Radio/Radio';\nimport type { RangeProps } from '../Range/Range';\nimport type { SearchProps } from '../Search/Search';\nimport type { SegmentedProps } from '../Segmented/Segmented';\nimport type { SheetProps } from '../Sheet/Sheet';\nimport type { SurfaceProps } from '../Surface/Surface';\nimport type { SwatchGroupProps, SwatchProps } from '../Swatch/Swatch';\nimport type { SwitchProps } from '../Switch/Switch';\nimport type { TabsProps } from '../Tabs/Tabs';\nimport type { TextProps } from '../Text/Text';\nimport type { RevealProps } from '../Reveal/Reveal';\nimport type { LightboxProps } from '../Lightbox/Lightbox';\nimport type { CompareProps } from '../Compare/Compare';\nimport type { TreeProps } from '../Tree/Tree';\nimport type { ConsentProps } from '../Consent/Consent';\nimport type { TimelineProps } from '../Timeline/Timeline';\nimport type { AvatarGroupProps } from '../AvatarGroup/AvatarGroup';\nimport type { MultiSuggestProps } from '../MultiSuggest/MultiSuggest';\nimport type { DateFieldProps } from '../DateField/DateField';\nimport type { CalendarProps } from '../Calendar/Calendar';\nimport type { FileDropProps } from '../FileDrop/FileDrop';\nimport type { ErrorSummaryProps } from '../ErrorSummary/ErrorSummary';\nimport type { PinFieldProps } from '../PinField/PinField';\nimport type { NumberFieldProps } from '../NumberField/NumberField';\nimport type { SecretFieldProps } from '../SecretField/SecretField';\nimport type { FooterProps } from '../Footer/Footer';\nimport type { MediaProps } from '../Media/Media';\nimport type { QuoteProps } from '../Quote/Quote';\nimport type { KbdProps } from '../Kbd/Kbd';\nimport type { TagProps } from '../Tag/Tag';\nimport type { CodeProps } from '../Code/Code';\nimport type { ContentsProps } from '../Contents/Contents';\nimport type { HairlineProps } from '../Hairline/Hairline';\nimport type { PageNavProps } from '../PageNav/PageNav';\nimport type { ProseProps } from '../Prose/Prose';\nimport type { RailProps } from '../Rail/Rail';\nimport type { SkipLinkProps } from '../SkipLink/SkipLink';\nimport { accentVars, resolveAccent } from './color';\nimport { hash, LAYER_ORDER, type SlurpCss } from './css';\n\nexport type ColorSchemeMode = 'light' | 'dark' | 'system';\nexport type ResolvedColorScheme = 'light' | 'dark';\n/** A `hue-*` preset (used as is) or any hex colour (turned into an accent with `vivid()`). */\nexport type AccentInput = `hue-${HueToken}` | `#${string}`;\n\ntype Themed = string | { light: string; dark: string };\ntype Length = string | number;\n\nexport interface TokenOverrides {\n color?: Partial<Record<ColorToken | `hue-${HueToken}`, Themed>>;\n space?: Partial<Record<SpaceToken, Length>>;\n radius?: Partial<Record<RadiusToken, Length>>;\n shadow?: Partial<Record<keyof typeof shadow, Themed>>;\n blur?: Partial<Record<keyof typeof blur, Length>>;\n}\n\n/** Defaults of the collapse / expand transitions started with useSlurp() (serialisable values only). */\nexport interface MotionOptions extends Pick<\n SlurpDefaults,\n 'duration' | 'stagger' | 'curve' | 'swell' | 'drop' | 'reducedMotion' | 'interrupt'\n> {\n goo: boolean | 'auto';\n ghost: GhostKind;\n order: 'distance' | 'dom';\n}\n\nconst { duration, stagger, curve, swell, drop, reducedMotion, interrupt } = MOTION_DEFAULTS;\nconst DEFAULT_MOTION: MotionOptions = {\n duration,\n stagger,\n curve,\n swell,\n drop,\n reducedMotion,\n interrupt,\n goo: 'auto',\n ghost: 'shape',\n order: 'distance',\n};\n\n/** Components that read defaults and `css` overrides from the theme, with their parts. */\nexport interface ThemeComponents {\n Reveal: { props: RevealProps; parts: 'root' };\n Lightbox: { props: LightboxProps; parts: 'root' };\n Compare: { props: CompareProps; parts: 'root' };\n Tree: { props: TreeProps; parts: 'root' };\n Consent: { props: ConsentProps; parts: 'root' };\n Timeline: { props: TimelineProps; parts: 'root' };\n AvatarGroup: { props: AvatarGroupProps; parts: 'root' };\n MultiSuggest: {\n props: MultiSuggestProps;\n parts: 'root' | 'label' | 'control' | 'list' | 'option' | 'tags' | 'tag' | 'hint' | 'error';\n };\n DateField: { props: DateFieldProps; parts: 'root' };\n Calendar: { props: CalendarProps; parts: 'root' };\n FileDrop: { props: FileDropProps; parts: 'root' };\n ErrorSummary: { props: ErrorSummaryProps; parts: 'root' };\n PinField: { props: PinFieldProps; parts: 'root' };\n NumberField: { props: NumberFieldProps; parts: 'root' };\n SecretField: { props: SecretFieldProps; parts: 'root' };\n Footer: { props: FooterProps; parts: 'root' };\n Media: { props: MediaProps; parts: 'root' | 'frame' | 'media' | 'caption' };\n Quote: { props: QuoteProps; parts: 'root' | 'quote' | 'caption' };\n Kbd: { props: KbdProps; parts: 'root' };\n Tag: { props: TagProps; parts: 'root' };\n AccentScope: { props: AccentScopeProps; parts: 'root' };\n Code: { props: CodeProps; parts: 'root' | 'bar' | 'filename' | 'copy' | 'pre' };\n Contents: { props: ContentsProps; parts: 'root' | 'title' | 'list' | 'item' | 'link' };\n Hairline: { props: HairlineProps; parts: 'root' };\n PageNav: { props: PageNavProps; parts: 'root' };\n Prose: { props: ProseProps; parts: 'root' };\n Rail: { props: RailProps; parts: 'root' };\n SkipLink: { props: SkipLinkProps; parts: 'root' };\n Bento: { props: BentoProps; parts: 'root' };\n Card: { props: CardProps; parts: 'root' | 'media' | 'badge' | 'title' | 'description' };\n Dock: { props: DockProps; parts: 'root' };\n Empty: { props: EmptyProps; parts: 'root' };\n Fact: { props: FactProps; parts: 'root' };\n Filters: { props: FiltersProps; parts: 'root' };\n Link: { props: LinkProps; parts: 'root' };\n List: { props: ListProps; parts: 'root' };\n ListRow: {\n props: ListRowProps;\n parts: 'root' | 'mark' | 'title' | 'link' | 'tag' | 'meta' | 'value' | 'action';\n };\n ResultRow: { props: ResultRowProps; parts: 'root' };\n Score: { props: ScoreProps; parts: 'root' };\n Settings: { props: SettingsProps; parts: 'root' };\n Shelf: { props: ShelfProps; parts: 'root' };\n Stage: { props: StageProps; parts: 'root' };\n Tile: {\n props: TileProps;\n parts: 'root' | 'blob' | 'text' | 'title' | 'subtitle' | 'badge' | 'media';\n };\n Avatar: { props: AvatarProps; parts: 'root' };\n Bloom: { props: BloomProps; parts: 'root' | 'surface' | 'trigger' | 'panel' };\n Bubble: { props: BubbleProps; parts: 'root' };\n Button: { props: ButtonProps; parts: 'root' | 'icon' | 'label' | 'endIcon' };\n Cell: { props: CellProps; parts: 'root' };\n Checkbox: { props: CheckboxProps; parts: 'root' | 'input' | 'box' | 'label' };\n Chip: { props: ChipProps; parts: 'root' };\n Choice: { props: ChoiceProps; parts: 'root' };\n Count: { props: CountProps; parts: 'root' };\n Dialog: {\n props: DialogProps;\n parts: 'root' | 'header' | 'title' | 'description' | 'body' | 'footer' | 'close';\n };\n Field: { props: FieldProps; parts: 'root' | 'label' | 'control' | 'hint' | 'error' };\n Flow: { props: FlowProps; parts: 'root' };\n Fold: { props: FoldProps; parts: 'root' | 'heading' | 'trigger' | 'region' };\n Frame: { props: FrameProps; parts: 'root' };\n Hint: { props: HintProps; parts: 'root' };\n Menu: { props: MenuProps; parts: 'root' };\n Notice: { props: NoticeProps; parts: 'root' | 'icon' | 'title' | 'body' | 'dismiss' };\n Placeholder: { props: PlaceholderProps; parts: 'root' };\n Progress: { props: ProgressProps; parts: 'root' };\n Radio: { props: RadioProps; parts: 'root' | 'input' | 'dot' | 'label' };\n RadioGroup: { props: RadioGroupProps; parts: 'root' | 'legend' };\n Range: { props: RangeProps; parts: 'root' | 'label' | 'value' | 'control' };\n Search: { props: SearchProps; parts: 'root' | 'icon' | 'control' | 'clear' | 'status' };\n Segmented: { props: SegmentedProps; parts: 'root' | 'item' };\n Sheet: {\n props: SheetProps;\n parts: 'root' | 'header' | 'title' | 'description' | 'body' | 'footer' | 'close';\n };\n Surface: { props: SurfaceProps; parts: 'root' };\n Swatch: { props: SwatchProps; parts: 'root' };\n SwatchGroup: { props: SwatchGroupProps; parts: 'root' };\n Switch: { props: SwitchProps; parts: 'root' | 'input' | 'track' | 'thumb' | 'label' };\n Tabs: { props: TabsProps; parts: 'root' | 'list' | 'tab' | 'indicator' | 'panel' };\n Text: { props: TextProps; parts: 'root' };\n Suggest: {\n props: SuggestProps;\n parts: 'root' | 'label' | 'control' | 'list' | 'option' | 'hint' | 'error';\n };\n Pages: { props: PagesProps; parts: 'root' | 'list' | 'item' | 'previous' | 'next' | 'status' };\n Steps: { props: StepsProps; parts: 'root' | 'list' | 'step' };\n Rating: { props: RatingProps; parts: 'root' };\n Table: { props: TableProps; parts: 'root' | 'table' | 'caption' };\n Carousel: {\n props: CarouselProps;\n parts: 'root' | 'track' | 'slide' | 'controls' | 'previous' | 'next' | 'dot';\n };\n}\nexport type ComponentName = keyof ThemeComponents;\n\nexport type ComponentsConfig = {\n [K in ComponentName]?: {\n defaults?: Partial<Omit<ThemeComponents[K]['props'], 'ref' | 'children' | 'css'>>;\n css?: Partial<Record<ThemeComponents[K]['parts'], SlurpCss>>;\n };\n};\n\nexport interface ThemeOptions {\n /** Initial colour scheme, until the person chooses one (default `system`). */\n colorScheme?: ColorSchemeMode;\n /** Default `hue-violet`. */\n accent?: AccentInput;\n /** Used only by Intl (numbers, prices). Not an i18n system. Default `it-IT`. */\n locale?: string;\n tokens?: TokenOverrides;\n motion?: Partial<MotionOptions>;\n components?: ComponentsConfig;\n}\n\nexport interface Theme {\n colorScheme: ColorSchemeMode;\n accent: AccentInput;\n /** The accent actually painted (hex). */\n accentColor: string;\n locale: string;\n tokens: TokenOverrides;\n motion: MotionOptions;\n components: ComponentsConfig;\n}\n\nconst DEFAULT_ACCENT: AccentInput = 'hue-violet';\n\n/** localStorage key of the chosen colour scheme (same as the design system's setTheme()). */\nexport const DEFAULT_STORAGE_KEY = 'slurp-theme';\n\nexport function createTheme(options: ThemeOptions = {}): Theme {\n const accent = options.accent ?? DEFAULT_ACCENT;\n return {\n colorScheme: options.colorScheme ?? 'system',\n accent,\n accentColor: resolveAccent(accent),\n locale: options.locale ?? 'it-IT',\n tokens: options.tokens ?? {},\n motion: { ...DEFAULT_MOTION, ...options.motion },\n components: options.components ?? {},\n };\n}\n\nexport const defaultTheme: Theme = createTheme();\n\nconst px = (v: Length) => (typeof v === 'number' ? `${v}px` : v);\n\n/** Light / dark declarations of the token overrides of a theme. */\nfunction overrideDeclarations(tokens: TokenOverrides) {\n const light: string[] = [];\n const dark: string[] = [];\n const add = (name: string, v: Themed | number) => {\n if (typeof v === 'object') {\n light.push(`--slurp-${name}:${v.light}`);\n dark.push(`--slurp-${name}:${v.dark}`);\n } else light.push(`--slurp-${name}:${px(v)}`);\n };\n for (const [k, v] of Object.entries(tokens.color ?? {})) if (v !== undefined) add(k, v);\n for (const [k, v] of Object.entries(tokens.space ?? {}))\n if (v !== undefined) add(`space-${k}`, v);\n for (const [k, v] of Object.entries(tokens.radius ?? {}))\n if (v !== undefined) add(`radius-${k}`, v);\n for (const [k, v] of Object.entries(tokens.shadow ?? {}))\n if (v !== undefined) add(`shadow-${k}`, v);\n for (const [k, v] of Object.entries(tokens.blur ?? {})) if (v !== undefined) add(`blur-${k}`, v);\n return { light, dark };\n}\n\nfunction selectors(scope: string | undefined) {\n if (!scope) {\n return {\n base: ':root,[data-theme]',\n dark: \"[data-theme='dark']\",\n systemDark: \":root:not([data-theme='light'])\",\n };\n }\n const s = `[data-slurp-theme=\"${scope}\"]`;\n return {\n base: `${s},${s} [data-theme]`,\n dark: `:root[data-theme='dark'] ${s},${s} [data-theme='dark']`,\n systemDark: `:root:not([data-theme='light']) ${s}`,\n };\n}\n\n/**\n * The stylesheet of a theme: accent variables and token overrides, on the root (or on a nested provider's `scope`)\n * and on every `data-theme` subtree, so derived values re-resolve per theme. Empty for the default theme.\n * tokens.css uses `:where()`, so these plain selectors win whatever the stylesheet order.\n */\nexport function themeCss(theme: Theme, scope?: string): string {\n const { light, dark } = overrideDeclarations(theme.tokens);\n const accent =\n theme.accent === DEFAULT_ACCENT\n ? []\n : Object.entries(accentVars(theme.accentColor)).map(([k, v]) => `${k}:${v}`);\n const base = [...accent, ...light];\n if (!base.length && !dark.length) return '';\n const sel = selectors(scope);\n const rules = [`${sel.base}{${base.join(';')}}`];\n if (dark.length) {\n rules.push(\n `${sel.dark}{${dark.join(';')}}`,\n `@media (prefers-color-scheme: dark){${sel.systemDark}{${dark.join(';')}}}`,\n );\n }\n return `${LAYER_ORDER}@layer slurp.base{${rules.join('')}}`;\n}\n\n/** Stable id of a stylesheet, for React's <style href> de-duplication. */\nexport const styleId = (prefix: string, css: string) => `slurp-${prefix}-${hash(css)}`;\n"],"mappings":"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"}
|