@cascivo/react 0.10.0 → 0.11.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/README.md +40 -10
- package/dist/index.d.ts +53 -22
- package/dist/node/react/src/index.js +3 -3
- package/dist/node/react/src/theme.js +37 -24
- package/dist/react/src/index.js +3 -3
- package/dist/react/src/theme.js +37 -24
- package/dist/styles.css +766 -0
- package/package.json +6 -5
- package/readme.body.md +39 -9
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<a href="https://cascivo.com"><img src="https://cascivo.com/favicon.svg" width="72" height="72" alt="cascivo logo"></a>
|
|
5
5
|
<h1>@cascivo/react</h1>
|
|
6
|
-
<p><strong>Prebuilt cascivo design system components — use without copying source</strong></p>
|
|
6
|
+
<p><strong>Prebuilt cascivo design system components — use without copying source. @cascivo/themes installs with it; pair with @cascivo/charts (data-viz) and @cascivo/icons. Docs offline: npx @cascivo/docs</strong></p>
|
|
7
7
|
|
|
8
8
|
[](https://www.npmjs.com/package/@cascivo/react)
|
|
9
9
|
[](https://www.npmjs.com/package/@cascivo/react)
|
|
@@ -25,16 +25,30 @@ can coexist in one project.
|
|
|
25
25
|
## Install
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
pnpm add @cascivo/react @
|
|
28
|
+
pnpm add @cascivo/react @preact/signals-react
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
**Peer dependencies** (install them in your app): `react >=18`, `react-dom >=18`,
|
|
32
32
|
and `@preact/signals-react` — cascivo components are signal-driven, so the
|
|
33
|
-
signals runtime is required.
|
|
34
|
-
supplies the tokens and themes the components read.
|
|
33
|
+
signals runtime is required.
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
[`@cascivo/themes`](https://github.com/cascivo/cascivo/tree/main/packages/themes)
|
|
36
|
+
is a **dependency** of `@cascivo/react`, so it installs automatically — you don't
|
|
37
|
+
add it yourself. It supplies the tokens and semantic color values the components
|
|
38
|
+
read; **you must import its CSS once** (see below), or components render
|
|
39
|
+
grayscale (`ThemeProvider` warns in dev when that happens).
|
|
40
|
+
|
|
41
|
+
**The wider family** (separate installs, only if you use them):
|
|
42
|
+
|
|
43
|
+
- Charts — [`@cascivo/charts`](https://github.com/cascivo/cascivo/tree/main/packages/charts):
|
|
44
|
+
`LineChart`, `AreaChart`, `BarChart`, `Sparkline`, and 20+ more.
|
|
45
|
+
- Icons — [`@cascivo/icons`](https://github.com/cascivo/cascivo/tree/main/packages/icons):
|
|
46
|
+
~440 tree-shakeable SVG icon components for `SideNav` items, `IconButton`, and
|
|
47
|
+
`Button` icons (sized by the token system) — so you don't hand-roll SVGs.
|
|
48
|
+
|
|
49
|
+
> **Can't reach npmjs.com or cascivo.com?** The complete docs also ship as an npm
|
|
50
|
+
> package: `npx -y @cascivo/docs` prints the index; `npx @cascivo/docs <component>`
|
|
51
|
+
> prints one component's reference — no website needed. See [Using with AI tools](#using-with-ai-tools-v0-cursor-claude-code-gemini).
|
|
38
52
|
|
|
39
53
|
> **Types are the reference.** The shipped `dist/index.d.ts` is a self-contained, flat
|
|
40
54
|
> rollup — every component's `…Props` interface is real, documentation-grade API. Reading
|
|
@@ -58,10 +72,12 @@ Components ship with `'use client'` preserved in the bundle, so they work inside
|
|
|
58
72
|
RSC without any extra wrapper.
|
|
59
73
|
|
|
60
74
|
> **No bundler? (CDN, import maps, plain `<link>`)** Import the aggregate sheet
|
|
61
|
-
> `@cascivo/react/styles.css` — every component's CSS
|
|
62
|
-
> ~
|
|
63
|
-
>
|
|
64
|
-
>
|
|
75
|
+
> `@cascivo/react/styles.css` — every component's CSS **plus the tokens and the
|
|
76
|
+
> light & dark themes** in one file (~305 KB / ~40 KB gzip, not tree-shaken). It is
|
|
77
|
+
> self-contained: this single import gives you a fully-colored app with no separate
|
|
78
|
+
> `@cascivo/themes` import. With a bundler (CSR) you don't need it; import it only if
|
|
79
|
+
> you prefer one explicit stylesheet over per-component tree-shaking, or for Vite SSR
|
|
80
|
+
> (below), where it is required.
|
|
65
81
|
|
|
66
82
|
> **Vite SSR / TanStack Start / Remix / workerd?** The 4-line SSR checklist (full
|
|
67
83
|
> recipe: [USING-WITH-VITE-SSR.md](https://github.com/cascivo/cascivo/blob/main/docs/USING-WITH-VITE-SSR.md)):
|
|
@@ -145,6 +161,20 @@ the tool. cascivo has no training-data footprint yet, so **don't rely on a tool
|
|
|
145
161
|
fetching cascivo.com** — that channel is the least reliable one. Use the channels
|
|
146
162
|
that travel with the package instead:
|
|
147
163
|
|
|
164
|
+
- **Zero web access needed — the whole docs surface as an npm package
|
|
165
|
+
([`@cascivo/docs`](https://www.npmjs.com/package/@cascivo/docs)):**
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
npx -y @cascivo/docs # prints llms.txt (the index)
|
|
169
|
+
npx -y @cascivo/docs button # prints one component's full reference
|
|
170
|
+
npx -y @cascivo/docs --full # prints llms-full.txt (the entire library)
|
|
171
|
+
npx -y @cascivo/docs guide theming
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
It reaches an agent through the same npm registry that installed your packages
|
|
175
|
+
— the one channel proven to work when `npmjs.com` and `cascivo.com` are blocked,
|
|
176
|
+
proxied, or offline. No install, no config; `npx` runs it from cache.
|
|
177
|
+
|
|
148
178
|
- **One file, one fetch — paste or link this into any chat/agent:**
|
|
149
179
|
[`https://cascivo.com/llms-full.txt`](https://cascivo.com/llms-full.txt). It is
|
|
150
180
|
the entire library — setup, the signals/CSS-layer rules, and every component's
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @cascivo/react — every cascivo component, prebuilt. Full API below.
|
|
3
|
+
*
|
|
4
|
+
* Quickstart:
|
|
5
|
+
* pnpm add @cascivo/react @preact/signals-react
|
|
6
|
+
* // @cascivo/themes is installed with @cascivo/react. Once, in your entry file:
|
|
7
|
+
* import '@cascivo/themes/all.css' // tokens + base + light & dark — REQUIRED for color
|
|
8
|
+
* // No-bundler / single-file alternative (themes bundled in): '@cascivo/react/styles.css'
|
|
9
|
+
* import { Button, Card } from '@cascivo/react'
|
|
10
|
+
*
|
|
11
|
+
* Skip the theme import and components render grayscale (ThemeProvider warns in dev).
|
|
12
|
+
*
|
|
13
|
+
* Wider family (separate installs):
|
|
14
|
+
* @cascivo/charts — LineChart, AreaChart, BarChart, Sparkline, 25 chart types
|
|
15
|
+
* @cascivo/icons — ~440 tree-shakeable SVG icons for SideNav / IconButton / Button
|
|
16
|
+
* @cascivo/themes — 12 themes; scope any with data-theme="…" on any element
|
|
17
|
+
*
|
|
18
|
+
* Reactivity: components are signal-driven. Without the signals Babel transform, any
|
|
19
|
+
* component reading signal.value in render must call useSignals() (from @cascivo/core) first.
|
|
20
|
+
*
|
|
21
|
+
* Docs: https://cascivo.com/llms.txt — or fully offline, no website needed:
|
|
22
|
+
* npx -y @cascivo/docs (index; `npx @cascivo/docs <component>` for one doc)
|
|
23
|
+
*/
|
|
24
|
+
import { ErrorBoundary, FocusScope, LinkComponent, LinkComponentProps, Portal, RovingOrientation, Signal, SpaceStep, SuspenseBoundary, getLinkComponent, setLinkComponent } from "@cascivo/core";
|
|
2
25
|
import { AnchorHTMLAttributes, ButtonHTMLAttributes, FormHTMLAttributes, HTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, MouseEvent, ReactElement, ReactNode, RefObject, SelectHTMLAttributes, TextareaHTMLAttributes, TimeHTMLAttributes } from "react";
|
|
3
26
|
|
|
4
27
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -670,6 +693,8 @@ interface SideNavLinkSubItem {
|
|
|
670
693
|
id?: string;
|
|
671
694
|
label: string;
|
|
672
695
|
href?: string;
|
|
696
|
+
/** Leading icon (any ReactNode). `@cascivo/icons` ships ~440 SVG icon components
|
|
697
|
+
* sized by the token system — use one here instead of hand-rolling an SVG. */
|
|
673
698
|
icon?: ReactNode;
|
|
674
699
|
active?: boolean;
|
|
675
700
|
/** Shows a trailing checkmark; use for picker-style "current selection" rows. */
|
|
@@ -689,6 +714,8 @@ interface SideNavItem {
|
|
|
689
714
|
id?: string;
|
|
690
715
|
label: string;
|
|
691
716
|
href?: string;
|
|
717
|
+
/** Leading icon (any ReactNode). `@cascivo/icons` ships ~440 SVG icon components
|
|
718
|
+
* sized by the token system — use one here instead of hand-rolling an SVG. */
|
|
692
719
|
icon?: ReactNode;
|
|
693
720
|
active?: boolean;
|
|
694
721
|
items?: SideNavSubItem[];
|
|
@@ -801,7 +828,7 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
801
828
|
onDismiss?: () => void;
|
|
802
829
|
dismissLabel?: string;
|
|
803
830
|
}
|
|
804
|
-
declare function Tag
|
|
831
|
+
declare function Tag({
|
|
805
832
|
variant,
|
|
806
833
|
size,
|
|
807
834
|
onDismiss,
|
|
@@ -1980,7 +2007,7 @@ interface StatProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
|
1980
2007
|
delta?: string;
|
|
1981
2008
|
trend?: 'up' | 'down' | 'flat';
|
|
1982
2009
|
helpText?: string;
|
|
1983
|
-
/** Trailing visual, e.g. a `Sparkline` from `@cascivo/charts
|
|
2010
|
+
/** Trailing visual, e.g. a `Sparkline` from the separate `@cascivo/charts` package (not exported from `@cascivo/react`; `pnpm add @cascivo/charts`). Purely decorative — mark it `aria-hidden` yourself if it duplicates the value/delta already announced. */
|
|
1984
2011
|
visual?: ReactNode;
|
|
1985
2012
|
}
|
|
1986
2013
|
declare function Stat({
|
|
@@ -2091,7 +2118,7 @@ interface TextProps extends HTMLAttributes<HTMLElement> {
|
|
|
2091
2118
|
muted?: boolean;
|
|
2092
2119
|
}
|
|
2093
2120
|
declare function Text({
|
|
2094
|
-
as:
|
|
2121
|
+
as: Component,
|
|
2095
2122
|
size,
|
|
2096
2123
|
weight,
|
|
2097
2124
|
muted,
|
|
@@ -2122,7 +2149,7 @@ interface ListProps extends HTMLAttributes<HTMLElement> {
|
|
|
2122
2149
|
marker?: 'disc' | 'decimal' | 'none';
|
|
2123
2150
|
}
|
|
2124
2151
|
declare function List({
|
|
2125
|
-
as:
|
|
2152
|
+
as: Component,
|
|
2126
2153
|
marker,
|
|
2127
2154
|
className,
|
|
2128
2155
|
children,
|
|
@@ -2368,7 +2395,8 @@ declare function Filter({
|
|
|
2368
2395
|
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2369
2396
|
/** Accessible name for the icon-only control. Required — there is no visible text. */
|
|
2370
2397
|
label: string;
|
|
2371
|
-
/** The icon to render. Alias for `children`.
|
|
2398
|
+
/** The icon to render. Alias for `children`. Any ReactNode — `@cascivo/icons`
|
|
2399
|
+
* ships ~440 ready-made SVG icon components, or pass your own. */
|
|
2372
2400
|
icon?: ReactNode;
|
|
2373
2401
|
size?: 'sm' | 'md' | 'lg';
|
|
2374
2402
|
variant?: 'ghost' | 'outline' | 'filled';
|
|
@@ -3285,7 +3313,6 @@ declare function SwipeItem({
|
|
|
3285
3313
|
trailingActions,
|
|
3286
3314
|
className
|
|
3287
3315
|
}: SwipeItemProps): import("react").JSX.Element;
|
|
3288
|
-
type SpaceStep$4 = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
3289
3316
|
/** A scalar value, or a per-breakpoint object keyed by the canonical scale. */
|
|
3290
3317
|
type Responsive<T> = T | Partial<Record<'base' | 'sm' | 'md' | 'lg' | 'xl', T>>;
|
|
3291
3318
|
/** Grid track alignment keyword (maps directly to `align-items` / `justify-items`). */
|
|
@@ -3293,7 +3320,7 @@ type GridAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
|
3293
3320
|
interface GridProps extends HTMLAttributes<HTMLDivElement> {
|
|
3294
3321
|
/** Column count. A number, or `{ base, sm, md, lg, xl }` for responsive columns. */
|
|
3295
3322
|
cols?: Responsive<number>;
|
|
3296
|
-
gap?: SpaceStep
|
|
3323
|
+
gap?: SpaceStep;
|
|
3297
3324
|
/** Block-axis alignment of items within their cells (`align-items`). Defaults to `stretch`. */
|
|
3298
3325
|
align?: GridAlign;
|
|
3299
3326
|
/** Inline-axis alignment of items within their cells (`justify-items`). Defaults to `stretch`. */
|
|
@@ -3319,10 +3346,9 @@ declare function GridItem({
|
|
|
3319
3346
|
style,
|
|
3320
3347
|
...props
|
|
3321
3348
|
}: GridItemProps): import("react").JSX.Element;
|
|
3322
|
-
type SpaceStep$3 = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
3323
3349
|
interface FlexProps extends HTMLAttributes<HTMLDivElement> {
|
|
3324
3350
|
direction?: 'vertical' | 'horizontal';
|
|
3325
|
-
gap?: SpaceStep
|
|
3351
|
+
gap?: SpaceStep;
|
|
3326
3352
|
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
3327
3353
|
justify?: 'start' | 'center' | 'end' | 'between';
|
|
3328
3354
|
wrap?: boolean;
|
|
@@ -3337,10 +3363,9 @@ declare function Flex({
|
|
|
3337
3363
|
style,
|
|
3338
3364
|
...props
|
|
3339
3365
|
}: FlexProps): import("react").JSX.Element;
|
|
3340
|
-
type SpaceStep$2 = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
3341
3366
|
interface ColumnsProps extends HTMLAttributes<HTMLDivElement> {
|
|
3342
3367
|
count?: 2 | 3 | 4;
|
|
3343
|
-
gap?: SpaceStep
|
|
3368
|
+
gap?: SpaceStep;
|
|
3344
3369
|
}
|
|
3345
3370
|
declare function Columns({
|
|
3346
3371
|
count,
|
|
@@ -3359,9 +3384,8 @@ declare function Center({
|
|
|
3359
3384
|
style,
|
|
3360
3385
|
...props
|
|
3361
3386
|
}: CenterProps): import("react").JSX.Element;
|
|
3362
|
-
type SpaceStep$1 = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
3363
3387
|
interface SpacerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3364
|
-
size?: SpaceStep
|
|
3388
|
+
size?: SpaceStep;
|
|
3365
3389
|
}
|
|
3366
3390
|
declare function Spacer({
|
|
3367
3391
|
size,
|
|
@@ -3369,7 +3393,6 @@ declare function Spacer({
|
|
|
3369
3393
|
style,
|
|
3370
3394
|
...props
|
|
3371
3395
|
}: SpacerProps): import("react").JSX.Element;
|
|
3372
|
-
type SpaceStep = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
3373
3396
|
interface AutoGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
3374
3397
|
/** Minimum track size before items wrap to fewer columns. */
|
|
3375
3398
|
min?: string;
|
|
@@ -3389,18 +3412,26 @@ declare function AutoGrid({
|
|
|
3389
3412
|
*/
|
|
3390
3413
|
declare function setTheme(next: string): void;
|
|
3391
3414
|
/**
|
|
3392
|
-
* Read and set the active theme.
|
|
3393
|
-
*
|
|
3394
|
-
* `useSignals()` for you, so it
|
|
3415
|
+
* Read and set the active theme. Returns the current theme **name** (a plain
|
|
3416
|
+
* string) and a setter — the component re-renders when the theme changes with no
|
|
3417
|
+
* signal handling on your part (this hook calls `useSignals()` for you, so it
|
|
3418
|
+
* works in React apps with no Babel transform). This is the React-idiomatic shape;
|
|
3419
|
+
* for signal-native code (`computed()`, `effect()`, Preact) use {@link themeSignal}.
|
|
3395
3420
|
*
|
|
3396
3421
|
* ```tsx
|
|
3397
3422
|
* const [theme, setTheme] = useTheme()
|
|
3398
|
-
* return <button onClick={() => setTheme(theme
|
|
3399
|
-
* {theme
|
|
3423
|
+
* return <button onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>
|
|
3424
|
+
* {theme}
|
|
3400
3425
|
* </button>
|
|
3401
3426
|
* ```
|
|
3402
3427
|
*/
|
|
3403
|
-
declare function useTheme(): readonly [
|
|
3428
|
+
declare function useTheme(): readonly [string, (next: string) => void];
|
|
3429
|
+
/**
|
|
3430
|
+
* The underlying theme signal, for signal-native code — `computed()`, `effect()`,
|
|
3431
|
+
* or a Preact app where signals are natively reactive. Most React apps want
|
|
3432
|
+
* {@link useTheme}, which hands back a plain string and handles subscription.
|
|
3433
|
+
*/
|
|
3434
|
+
declare function themeSignal(): Signal<string>;
|
|
3404
3435
|
interface ThemeProviderProps {
|
|
3405
3436
|
/**
|
|
3406
3437
|
* Theme to use when nothing is persisted yet. When set, it **wins over** the
|
|
@@ -3491,4 +3522,4 @@ declare function themePreloadScript(options?: {
|
|
|
3491
3522
|
attribute?: string;
|
|
3492
3523
|
defaultTheme?: string;
|
|
3493
3524
|
}): string;
|
|
3494
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, ActionSheet, ActionSheetAction, ActionSheetProps, Alert, AlertDialog, AlertDialogLabels, AlertDialogProps, AlertProps, AppShell, AppShellProps, AspectRatio, AspectRatioProps, AutoGrid, AutoGridProps, Avatar, AvatarGroup, AvatarGroupLabels, AvatarGroupProps, AvatarProps, Badge, BadgeProps, Blockquote, BlockquoteProps, BottomSheet, BottomSheetProps, Breadcrumb, BreadcrumbItem, BreadcrumbProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Calendar, CalendarLabels, CalendarProps, Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselLabels, CarouselProps, Center, CenterProps, ChatBubble, ChatBubbleProps, ChatBubbleSide, Checkbox, CheckboxCard, CheckboxCardProps, CheckboxProps, Code, type CodeLang, CodeProps, CodeSnippet, CodeSnippetProps, Collapsible, CollapsibleProps, ColorPicker, ColorPickerLabels, ColorPickerProps, Column, Columns, ColumnsProps, Combobox, ComboboxLabels, ComboboxOption, ComboboxProps, CommandAction, CommandGroup, CommandItem, CommandMenu, CommandMenuProps, CommandPage, CommandScope, CommandStatus, Comparison, ComparisonProps, ContainedList, ContainedListItem, ContainedListItemProps, ContainedListProps, ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuProps, CopyButton, CopyButtonProps, DataList, DataListItem, DataListProps, DataTable, DataTableLabels, DataTableProps, DatePicker, DatePickerLabels, DatePickerProps, DateRange, DateRangePicker, DateRangePickerLabels, DateRangePickerProps, DateRangePreset, Dock, DockItem, DockProps, Drawer, DrawerProps, Dropdown, DropdownItem, DropdownProps, Editable, EditableProps, EmptyState, EmptyStateProps, ErrorBoundary, Fab, FabAction, FabProps, Field, FieldProps, FileUploader, FileUploaderLabels, FileUploaderProps, Filter, FilterOption, FilterProps, FilterVariant, Flex, FlexProps, FocusScope, Form, FormConfig, FormProps, FormStore, FuzzyMatch, Grid, GridAlign, GridItem, GridItemProps, GridProps, Header, HeaderLabels, HeaderLink, HeaderPanel, HeaderPanelLabels, HeaderPanelProps, HeaderProps, Heading, HeadingLevel, HeadingProps, HeadingSize, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, IconButton, IconButtonProps, Image, ImageProps, Indicator, IndicatorPlacement, IndicatorProps, InlineLoading, InlineLoadingProps, InlineLoadingStatus, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, type InputGroupProps, InputProps, Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemMedia, ItemMediaProps, ItemProps, ItemTitle, ItemTitleProps, Join, JoinOrientation, JoinProps, Kbd, KbdProps, Label, LabelProps, Link, type LinkComponent, type LinkComponentProps, LinkProps, List, ListItem, ListItemProps, ListProps, LogLevel, LogLine, LogViewer, LogViewerLabels, LogViewerProps, Menu, MenuButton, MenuButtonItem, MenuButtonProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator, MenuTrigger, MenuTriggerProps, Menubar, MenubarItem, MenubarMenu, MenubarProps, Modal, ModalProps, MultiSelect, MultiSelectLabels, MultiSelectOption, MultiSelectProps, NativeSelect, NativeSelectOption, NativeSelectProps, NavigationMenu, NavigationMenuItem, NavigationMenuProps, Notification, NotificationProps, NotificationVariant, NumberInput, NumberInputProps, OtpInput, OtpInputProps, OverflowMenu, OverflowMenuItem, OverflowMenuProps, Pagination, PaginationLabels, PaginationProps, PasswordInput, PasswordInputLabels, PasswordInputProps, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Portal, Progress, ProgressBar, ProgressBarProps, ProgressCircle, ProgressCircleProps, ProgressIndicator, ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressStep, ProgressVariant, Prose, ProseProps, PullToRefresh, PullToRefreshProps, QrCode, QrCodeProps, RadialProgress, RadialProgressProps, RadialProgressSize, RadialProgressVariant, Radio, RadioCard, RadioCardGroup, RadioCardGroupProps, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, RatingGroup, RatingGroupLabels, RatingGroupProps, RelativeTime, RelativeTimeProps, Resizable, ResizableProps, Responsive, ScrollArea, ScrollAreaProps, Search, SearchProps, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectOption, SelectProps, Separator, SeparatorProps, Sheet, SheetProps, ShellHeader, ShellHeaderAction, ShellHeaderBrand, ShellHeaderLabels, ShellHeaderNavItem, ShellHeaderNavLink, ShellHeaderNavMenu, ShellHeaderNavMenuItem, ShellHeaderProps, SideNav, SideNavGroup, SideNavItem, SideNavLinkProps, SideNavLinkSubItem, SideNavProps, SideNavSubItem, SideNavTone, Skeleton, SkeletonProps, SkipNavLink, SkipNavLinkProps, SkipNavTarget, SkipNavTargetProps, Slider, SliderProps, SortDirection, SortState, Spacer, SpacerProps, Spinner, SpinnerProps, Stack, StackProps, type StandardSchemaV1, Stat, StatProps, Status, StatusProps, Step, StepState, Steps, StepsProps, StructuredList, StructuredListItem, StructuredListProps, SuspenseBoundary, Swap, SwapMode, SwapProps, SwipeAction, SwipeItem, SwipeItemProps, Switcher, SwitcherEntry, SwitcherLink, SwitcherProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsProps, TabsTrigger, TabsTriggerProps, Tag
|
|
3525
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, ActionSheet, ActionSheetAction, ActionSheetProps, Alert, AlertDialog, AlertDialogLabels, AlertDialogProps, AlertProps, AppShell, AppShellProps, AspectRatio, AspectRatioProps, AutoGrid, AutoGridProps, Avatar, AvatarGroup, AvatarGroupLabels, AvatarGroupProps, AvatarProps, Badge, BadgeProps, Blockquote, BlockquoteProps, BottomSheet, BottomSheetProps, Breadcrumb, BreadcrumbItem, BreadcrumbProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Calendar, CalendarLabels, CalendarProps, Card, CardContent, CardContentProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps, Carousel, CarouselLabels, CarouselProps, Center, CenterProps, ChatBubble, ChatBubbleProps, ChatBubbleSide, Checkbox, CheckboxCard, CheckboxCardProps, CheckboxProps, Code, type CodeLang, CodeProps, CodeSnippet, CodeSnippetProps, Collapsible, CollapsibleProps, ColorPicker, ColorPickerLabels, ColorPickerProps, Column, Columns, ColumnsProps, Combobox, ComboboxLabels, ComboboxOption, ComboboxProps, CommandAction, CommandGroup, CommandItem, CommandMenu, CommandMenuProps, CommandPage, CommandScope, CommandStatus, Comparison, ComparisonProps, ContainedList, ContainedListItem, ContainedListItemProps, ContainedListProps, ContextMenu, ContextMenuItem, ContextMenuItemProps, ContextMenuProps, CopyButton, CopyButtonProps, DataList, DataListItem, DataListProps, DataTable, DataTableLabels, DataTableProps, DatePicker, DatePickerLabels, DatePickerProps, DateRange, DateRangePicker, DateRangePickerLabels, DateRangePickerProps, DateRangePreset, Dock, DockItem, DockProps, Drawer, DrawerProps, Dropdown, DropdownItem, DropdownProps, Editable, EditableProps, EmptyState, EmptyStateProps, ErrorBoundary, Fab, FabAction, FabProps, Field, FieldProps, FileUploader, FileUploaderLabels, FileUploaderProps, Filter, FilterOption, FilterProps, FilterVariant, Flex, FlexProps, FocusScope, Form, FormConfig, FormProps, FormStore, FuzzyMatch, Grid, GridAlign, GridItem, GridItemProps, GridProps, Header, HeaderLabels, HeaderLink, HeaderPanel, HeaderPanelLabels, HeaderPanelProps, HeaderProps, Heading, HeadingLevel, HeadingProps, HeadingSize, HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, HoverCardTrigger, HoverCardTriggerProps, IconButton, IconButtonProps, Image, ImageProps, Indicator, IndicatorPlacement, IndicatorProps, InlineLoading, InlineLoadingProps, InlineLoadingStatus, Input, InputGroup, InputGroupAddon, type InputGroupAddonProps, type InputGroupProps, InputProps, Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemMedia, ItemMediaProps, ItemProps, ItemTitle, ItemTitleProps, Join, JoinOrientation, JoinProps, Kbd, KbdProps, Label, LabelProps, Link, type LinkComponent, type LinkComponentProps, LinkProps, List, ListItem, ListItemProps, ListProps, LogLevel, LogLine, LogViewer, LogViewerLabels, LogViewerProps, Menu, MenuButton, MenuButtonItem, MenuButtonProps, MenuItem, MenuItemProps, MenuProps, MenuSeparator, MenuTrigger, MenuTriggerProps, Menubar, MenubarItem, MenubarMenu, MenubarProps, Modal, ModalProps, MultiSelect, MultiSelectLabels, MultiSelectOption, MultiSelectProps, NativeSelect, NativeSelectOption, NativeSelectProps, NavigationMenu, NavigationMenuItem, NavigationMenuProps, Notification, NotificationProps, NotificationVariant, NumberInput, NumberInputProps, OtpInput, OtpInputProps, OverflowMenu, OverflowMenuItem, OverflowMenuProps, Pagination, PaginationLabels, PaginationProps, PasswordInput, PasswordInputLabels, PasswordInputProps, Popover, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps, Portal, Progress, ProgressBar, ProgressBarProps, ProgressCircle, ProgressCircleProps, ProgressIndicator, ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressStep, ProgressVariant, Prose, ProseProps, PullToRefresh, PullToRefreshProps, QrCode, QrCodeProps, RadialProgress, RadialProgressProps, RadialProgressSize, RadialProgressVariant, Radio, RadioCard, RadioCardGroup, RadioCardGroupProps, RadioCardProps, RadioGroup, RadioGroupProps, RadioProps, RatingGroup, RatingGroupLabels, RatingGroupProps, RelativeTime, RelativeTimeProps, Resizable, ResizableProps, Responsive, ScrollArea, ScrollAreaProps, Search, SearchProps, SegmentedControl, SegmentedControlOption, SegmentedControlProps, Select, SelectOption, SelectProps, Separator, SeparatorProps, Sheet, SheetProps, ShellHeader, ShellHeaderAction, ShellHeaderBrand, ShellHeaderLabels, ShellHeaderNavItem, ShellHeaderNavLink, ShellHeaderNavMenu, ShellHeaderNavMenuItem, ShellHeaderProps, SideNav, SideNavGroup, SideNavItem, SideNavLinkProps, SideNavLinkSubItem, SideNavProps, SideNavSubItem, SideNavTone, Skeleton, SkeletonProps, SkipNavLink, SkipNavLinkProps, SkipNavTarget, SkipNavTargetProps, Slider, SliderProps, SortDirection, SortState, Spacer, SpacerProps, Spinner, SpinnerProps, Stack, StackProps, type StandardSchemaV1, Stat, StatProps, Status, StatusProps, Step, StepState, Steps, StepsProps, StructuredList, StructuredListItem, StructuredListProps, SuspenseBoundary, Swap, SwapMode, SwapProps, SwipeAction, SwipeItem, SwipeItemProps, Switcher, SwitcherEntry, SwitcherLink, SwitcherProps, Tabs, TabsContent, TabsContentProps, TabsList, TabsProps, TabsTrigger, TabsTriggerProps, Tag, TagProps, TagsInput, TagsInputProps, Text, TextProps, Textarea, TextareaProps, ThemeProvider, type ThemeProviderProps, Tile, TileProps, TimePicker, TimePickerProps, Timeline, TimelineItem, TimelineProps, ToastOptions, ToastProvider, ToastVariant, Toc, TocItem, TocProps, Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupProps, ToggleProps, Toggletip, ToggletipPlacement, ToggletipProps, Tooltip, TooltipProps, TreeNode, TreeView, TreeViewProps, UploaderFile, type UsePopoverOptions, type UsePopoverReturn, type UseTocFromRegionOptions, User, UserProps, VisuallyHidden, VisuallyHiddenProps, createForm, dismissAllToasts, fuzzyMatch, fuzzyScore, getLinkComponent, setLinkComponent, setTheme, themePreloadScript, themeSignal, treeViewMessages, useForm, usePopover, useTheme, useToast, useTocFromRegion };
|
|
@@ -133,6 +133,6 @@ import { Columns as an } from "../../layouts/src/columns/columns.js";
|
|
|
133
133
|
import { Center as on } from "../../layouts/src/center/center.js";
|
|
134
134
|
import { Spacer as sn } from "../../layouts/src/spacer/spacer.js";
|
|
135
135
|
import { AutoGrid as cn } from "../../layouts/src/auto-grid/auto-grid.js";
|
|
136
|
-
import { ThemeProvider as ln, setTheme as un, themePreloadScript as dn,
|
|
137
|
-
import { ErrorBoundary as
|
|
138
|
-
export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState,
|
|
136
|
+
import { ThemeProvider as ln, setTheme as un, themePreloadScript as dn, themeSignal as fn, useTheme as pn } from "./theme.js";
|
|
137
|
+
import { ErrorBoundary as mn, FocusScope as hn, Portal as gn, SuspenseBoundary as _n, getLinkComponent as vn, setLinkComponent as yn } from "@cascivo/core";
|
|
138
|
+
export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState, mn as ErrorBoundary, Z as Fab, lt as Field, ue as FileUploader, ut as Filter, rn as Flex, hn as FocusScope, ae as Form, tn as Grid, nn as GridItem, H as Header, Be as HeaderPanel, Ze as Heading, Te as HoverCard, Ee as HoverCardContent, De as HoverCardTrigger, dt as IconButton, h as Image, qt as Indicator, mt as InlineLoading, n as Input, Ne as InputGroup, Pe as InputGroupAddon, At as Item, jt as ItemActions, Mt as ItemContent, Nt as ItemDescription, Pt as ItemMedia, Ft as ItemTitle, Jt as Join, L as Kbd, ct as Label, R as Link, tt as List, nt as ListItem, rt as LogViewer, he as Menu, yt as MenuButton, ge as MenuItem, _e as MenuSeparator, ve as MenuTrigger, xt as Menubar, l as Modal, ke as MultiSelect, Ut as NativeSelect, St as NavigationMenu, ht as Notification, ee as NumberInput, je as OtpInput, Q as OverflowMenu, G as Pagination, Oe as PasswordInput, fe as Popover, pe as PopoverContent, me as PopoverTrigger, gn as Portal, Ye as Progress, Y as ProgressBar, Xe as ProgressCircle, K as ProgressIndicator, it as Prose, at as PullToRefresh, ot as QrCode, Qt as RadialProgress, y as Radio, Le as RadioCard, Re as RadioCardGroup, b as RadioGroup, Fe as RatingGroup, st as RelativeTime, Bt as Resizable, gt as ScrollArea, $ as Search, Me as SegmentedControl, _ as Select, u as Separator, be as Sheet, ze as ShellHeader, W as SideNav, J as Skeleton, qe as SkipNavLink, Je as SkipNavTarget, S as Slider, sn as Spacer, e as Spinner, Yt as Stack, We as Stat, Ge as Status, Gt as Steps, Tt as StructuredList, _n as SuspenseBoundary, $t as Swap, en as SwipeItem, Ve as Switcher, O as Tabs, k as TabsContent, A as TabsList, j as TabsTrigger, q as Tag, Ae as TagsInput, Qe as Text, g as Textarea, ln as ThemeProvider, Kt as Tile, de as TimePicker, kt as Timeline, T as ToastProvider, B as Toc, x as Toggle, pt as ToggleGroup, bt as Toggletip, C as Tooltip, Ct as TreeView, m as User, Ke as VisuallyHidden, oe as createForm, E as dismissAllToasts, re as fuzzyMatch, ie as fuzzyScore, vn as getLinkComponent, yn as setLinkComponent, un as setTheme, dn as themePreloadScript, fn as themeSignal, wt as treeViewMessages, se as useForm, U as usePopover, pn as useTheme, D as useToast, V as useTocFromRegion };
|
|
@@ -5,50 +5,63 @@ import { useSignalEffect as t, useSignals as n } from "@cascivo/core";
|
|
|
5
5
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
import { useRef as o } from "react";
|
|
7
7
|
//#region src/theme.tsx
|
|
8
|
-
var s = "cascivo-theme", c = "data-theme"
|
|
8
|
+
var s = "cascivo-theme", c = "data-theme";
|
|
9
|
+
function l() {
|
|
10
|
+
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
11
|
+
}
|
|
12
|
+
var u = /* @__PURE__ */ new Set();
|
|
13
|
+
function d(e, t) {
|
|
14
|
+
l() && (e === null || typeof document > "u" || typeof requestAnimationFrame != "function" || u.has(t) || requestAnimationFrame(() => {
|
|
15
|
+
u.has(t) || getComputedStyle(e).getPropertyValue("--cascivo-color-accent").trim() === "" && (u.add(t), console.warn(`cascivo ThemeProvider: data-theme=${JSON.stringify(t)} was set, but no cascivo theme CSS defines it — every --cascivo-color-* token is unresolved, so components render grayscale. Import '@cascivo/themes/all.css' once in your entry (or '@cascivo/react/styles.css', which bundles the light and dark themes). Using a custom theme? Ensure its stylesheet is loaded and defines [data-theme=${JSON.stringify(t)}]. Docs: https://cascivo.com/docs/theming — offline: npx -y @cascivo/docs guide theming`));
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
var f = null, p = {
|
|
9
19
|
storageKey: s,
|
|
10
20
|
defaultTheme: "light",
|
|
11
21
|
explicit: !1
|
|
12
22
|
};
|
|
13
|
-
function
|
|
23
|
+
function m(e) {
|
|
14
24
|
return typeof window > "u" || typeof window.matchMedia != "function" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : e;
|
|
15
25
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
26
|
+
function h() {
|
|
27
|
+
return p.explicit ? p.defaultTheme : m(p.defaultTheme);
|
|
18
28
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
29
|
+
function g() {
|
|
30
|
+
return f ??= e(p.storageKey, h()), f;
|
|
21
31
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
32
|
+
function _(e) {
|
|
33
|
+
g().value = e;
|
|
24
34
|
}
|
|
25
|
-
function
|
|
26
|
-
return n(), [
|
|
35
|
+
function v() {
|
|
36
|
+
return n(), [g().value, _];
|
|
37
|
+
}
|
|
38
|
+
function y() {
|
|
39
|
+
return g();
|
|
27
40
|
}
|
|
28
|
-
function
|
|
41
|
+
function b(e) {
|
|
29
42
|
return JSON.stringify(e).replace(/</g, "\\u003c");
|
|
30
43
|
}
|
|
31
|
-
function
|
|
44
|
+
function x({ defaultTheme: e, value: n, storageKey: l = s, attribute: u = c, target: m, onChange: h, nonce: _, children: v }) {
|
|
32
45
|
let y = o(!1);
|
|
33
|
-
y.current || (y.current = !0, (
|
|
34
|
-
storageKey:
|
|
46
|
+
y.current || (y.current = !0, (f === null || p.storageKey !== l) && (p = {
|
|
47
|
+
storageKey: l,
|
|
35
48
|
defaultTheme: e ?? "light",
|
|
36
49
|
explicit: e !== void 0
|
|
37
|
-
},
|
|
38
|
-
let
|
|
39
|
-
n !== void 0 && (
|
|
40
|
-
let
|
|
41
|
-
return
|
|
42
|
-
let e =
|
|
43
|
-
(
|
|
50
|
+
}, f = null));
|
|
51
|
+
let x = g();
|
|
52
|
+
n !== void 0 && (x.value = n);
|
|
53
|
+
let S = o(h);
|
|
54
|
+
return S.current = h, t(() => {
|
|
55
|
+
let e = x.value, t = m ? m.current : typeof document < "u" ? document.documentElement : null;
|
|
56
|
+
t?.setAttribute(u, e), d(t, e), S.current?.(e);
|
|
44
57
|
}), n !== void 0 && !m ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("script", {
|
|
45
58
|
nonce: _,
|
|
46
|
-
dangerouslySetInnerHTML: { __html: `document.documentElement.setAttribute(${
|
|
59
|
+
dangerouslySetInnerHTML: { __html: `document.documentElement.setAttribute(${b(u)},${b(n)})` }
|
|
47
60
|
}), v] }) : /* @__PURE__ */ i(r, { children: v });
|
|
48
61
|
}
|
|
49
|
-
function
|
|
62
|
+
function S(e = {}) {
|
|
50
63
|
let t = JSON.stringify(e.storageKey ?? s), n = JSON.stringify(e.attribute ?? c), r = JSON.stringify(e.defaultTheme ?? "light"), i = e.defaultTheme === void 0 ? "if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}" : "";
|
|
51
64
|
return `(function(){try{var v=${r};` + i + `var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
|
|
52
65
|
}
|
|
53
66
|
//#endregion
|
|
54
|
-
export {
|
|
67
|
+
export { x as ThemeProvider, _ as setTheme, S as themePreloadScript, y as themeSignal, v as useTheme };
|
package/dist/react/src/index.js
CHANGED
|
@@ -133,6 +133,6 @@ import { Columns as an } from "../../layouts/src/columns/columns.js";
|
|
|
133
133
|
import { Center as on } from "../../layouts/src/center/center.js";
|
|
134
134
|
import { Spacer as sn } from "../../layouts/src/spacer/spacer.js";
|
|
135
135
|
import { AutoGrid as cn } from "../../layouts/src/auto-grid/auto-grid.js";
|
|
136
|
-
import { ThemeProvider as ln, setTheme as un, themePreloadScript as dn,
|
|
137
|
-
import { ErrorBoundary as
|
|
138
|
-
export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState,
|
|
136
|
+
import { ThemeProvider as ln, setTheme as un, themePreloadScript as dn, themeSignal as fn, useTheme as pn } from "./theme.js";
|
|
137
|
+
import { ErrorBoundary as mn, FocusScope as hn, Portal as gn, SuspenseBoundary as _n, getLinkComponent as vn, setLinkComponent as yn } from "@cascivo/core";
|
|
138
|
+
export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState, mn as ErrorBoundary, Z as Fab, lt as Field, ue as FileUploader, ut as Filter, rn as Flex, hn as FocusScope, ae as Form, tn as Grid, nn as GridItem, H as Header, Be as HeaderPanel, Ze as Heading, Te as HoverCard, Ee as HoverCardContent, De as HoverCardTrigger, dt as IconButton, h as Image, qt as Indicator, mt as InlineLoading, n as Input, Ne as InputGroup, Pe as InputGroupAddon, At as Item, jt as ItemActions, Mt as ItemContent, Nt as ItemDescription, Pt as ItemMedia, Ft as ItemTitle, Jt as Join, L as Kbd, ct as Label, R as Link, tt as List, nt as ListItem, rt as LogViewer, he as Menu, yt as MenuButton, ge as MenuItem, _e as MenuSeparator, ve as MenuTrigger, xt as Menubar, l as Modal, ke as MultiSelect, Ut as NativeSelect, St as NavigationMenu, ht as Notification, ee as NumberInput, je as OtpInput, Q as OverflowMenu, G as Pagination, Oe as PasswordInput, fe as Popover, pe as PopoverContent, me as PopoverTrigger, gn as Portal, Ye as Progress, Y as ProgressBar, Xe as ProgressCircle, K as ProgressIndicator, it as Prose, at as PullToRefresh, ot as QrCode, Qt as RadialProgress, y as Radio, Le as RadioCard, Re as RadioCardGroup, b as RadioGroup, Fe as RatingGroup, st as RelativeTime, Bt as Resizable, gt as ScrollArea, $ as Search, Me as SegmentedControl, _ as Select, u as Separator, be as Sheet, ze as ShellHeader, W as SideNav, J as Skeleton, qe as SkipNavLink, Je as SkipNavTarget, S as Slider, sn as Spacer, e as Spinner, Yt as Stack, We as Stat, Ge as Status, Gt as Steps, Tt as StructuredList, _n as SuspenseBoundary, $t as Swap, en as SwipeItem, Ve as Switcher, O as Tabs, k as TabsContent, A as TabsList, j as TabsTrigger, q as Tag, Ae as TagsInput, Qe as Text, g as Textarea, ln as ThemeProvider, Kt as Tile, de as TimePicker, kt as Timeline, T as ToastProvider, B as Toc, x as Toggle, pt as ToggleGroup, bt as Toggletip, C as Tooltip, Ct as TreeView, m as User, Ke as VisuallyHidden, oe as createForm, E as dismissAllToasts, re as fuzzyMatch, ie as fuzzyScore, vn as getLinkComponent, yn as setLinkComponent, un as setTheme, dn as themePreloadScript, fn as themeSignal, wt as treeViewMessages, se as useForm, U as usePopover, pn as useTheme, D as useToast, V as useTocFromRegion };
|
package/dist/react/src/theme.js
CHANGED
|
@@ -5,50 +5,63 @@ import { useSignalEffect as t, useSignals as n } from "@cascivo/core";
|
|
|
5
5
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
import { useRef as o } from "react";
|
|
7
7
|
//#region src/theme.tsx
|
|
8
|
-
var s = "cascivo-theme", c = "data-theme"
|
|
8
|
+
var s = "cascivo-theme", c = "data-theme";
|
|
9
|
+
function l() {
|
|
10
|
+
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
11
|
+
}
|
|
12
|
+
var u = /* @__PURE__ */ new Set();
|
|
13
|
+
function d(e, t) {
|
|
14
|
+
l() && (e === null || typeof document > "u" || typeof requestAnimationFrame != "function" || u.has(t) || requestAnimationFrame(() => {
|
|
15
|
+
u.has(t) || getComputedStyle(e).getPropertyValue("--cascivo-color-accent").trim() === "" && (u.add(t), console.warn(`cascivo ThemeProvider: data-theme=${JSON.stringify(t)} was set, but no cascivo theme CSS defines it — every --cascivo-color-* token is unresolved, so components render grayscale. Import '@cascivo/themes/all.css' once in your entry (or '@cascivo/react/styles.css', which bundles the light and dark themes). Using a custom theme? Ensure its stylesheet is loaded and defines [data-theme=${JSON.stringify(t)}]. Docs: https://cascivo.com/docs/theming — offline: npx -y @cascivo/docs guide theming`));
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
var f = null, p = {
|
|
9
19
|
storageKey: s,
|
|
10
20
|
defaultTheme: "light",
|
|
11
21
|
explicit: !1
|
|
12
22
|
};
|
|
13
|
-
function
|
|
23
|
+
function m(e) {
|
|
14
24
|
return typeof window > "u" || typeof window.matchMedia != "function" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : e;
|
|
15
25
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
26
|
+
function h() {
|
|
27
|
+
return p.explicit ? p.defaultTheme : m(p.defaultTheme);
|
|
18
28
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
29
|
+
function g() {
|
|
30
|
+
return f ??= e(p.storageKey, h()), f;
|
|
21
31
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
32
|
+
function _(e) {
|
|
33
|
+
g().value = e;
|
|
24
34
|
}
|
|
25
|
-
function
|
|
26
|
-
return n(), [
|
|
35
|
+
function v() {
|
|
36
|
+
return n(), [g().value, _];
|
|
37
|
+
}
|
|
38
|
+
function y() {
|
|
39
|
+
return g();
|
|
27
40
|
}
|
|
28
|
-
function
|
|
41
|
+
function b(e) {
|
|
29
42
|
return JSON.stringify(e).replace(/</g, "\\u003c");
|
|
30
43
|
}
|
|
31
|
-
function
|
|
44
|
+
function x({ defaultTheme: e, value: n, storageKey: l = s, attribute: u = c, target: m, onChange: h, nonce: _, children: v }) {
|
|
32
45
|
let y = o(!1);
|
|
33
|
-
y.current || (y.current = !0, (
|
|
34
|
-
storageKey:
|
|
46
|
+
y.current || (y.current = !0, (f === null || p.storageKey !== l) && (p = {
|
|
47
|
+
storageKey: l,
|
|
35
48
|
defaultTheme: e ?? "light",
|
|
36
49
|
explicit: e !== void 0
|
|
37
|
-
},
|
|
38
|
-
let
|
|
39
|
-
n !== void 0 && (
|
|
40
|
-
let
|
|
41
|
-
return
|
|
42
|
-
let e =
|
|
43
|
-
(
|
|
50
|
+
}, f = null));
|
|
51
|
+
let x = g();
|
|
52
|
+
n !== void 0 && (x.value = n);
|
|
53
|
+
let S = o(h);
|
|
54
|
+
return S.current = h, t(() => {
|
|
55
|
+
let e = x.value, t = m ? m.current : typeof document < "u" ? document.documentElement : null;
|
|
56
|
+
t?.setAttribute(u, e), d(t, e), S.current?.(e);
|
|
44
57
|
}), n !== void 0 && !m ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("script", {
|
|
45
58
|
nonce: _,
|
|
46
|
-
dangerouslySetInnerHTML: { __html: `document.documentElement.setAttribute(${
|
|
59
|
+
dangerouslySetInnerHTML: { __html: `document.documentElement.setAttribute(${b(u)},${b(n)})` }
|
|
47
60
|
}), v] }) : /* @__PURE__ */ i(r, { children: v });
|
|
48
61
|
}
|
|
49
|
-
function
|
|
62
|
+
function S(e = {}) {
|
|
50
63
|
let t = JSON.stringify(e.storageKey ?? s), n = JSON.stringify(e.attribute ?? c), r = JSON.stringify(e.defaultTheme ?? "light"), i = e.defaultTheme === void 0 ? "if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}" : "";
|
|
51
64
|
return `(function(){try{var v=${r};` + i + `var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
|
|
52
65
|
}
|
|
53
66
|
//#endregion
|
|
54
|
-
export {
|
|
67
|
+
export { x as ThemeProvider, _ as setTheme, S as themePreloadScript, y as themeSignal, v as useTheme };
|