silva-ui 1.3.1 → 2.0.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 +129 -30
- package/dist/library/silva-ui.css +1 -1
- package/dist/library/silva-ui.js +993 -23305
- package/dist/types/core/Theme.d.ts +28 -6
- package/dist/types/core/colors/index.d.ts +16 -8
- package/dist/types/core/compound.d.ts +6 -0
- package/dist/types/core/dynamic-colors.css.d.ts +6 -0
- package/dist/types/core/gradient.d.ts +1 -1
- package/dist/types/core/sprinkles.css.d.ts +17 -407
- package/dist/types/core/theme/index.css.d.ts +4 -398
- package/dist/types/core/theme.css.d.ts +3 -3
- package/dist/types/core/themes/index.d.ts +228 -6
- package/dist/types/core/types.d.ts +11 -6
- package/dist/types/core/utils.d.ts +2 -1
- package/dist/types/core/visuals.css.d.ts +2 -2
- package/dist/types/display/Avatar.d.ts +1 -1
- package/dist/types/display/Card.d.ts +1 -1
- package/dist/types/display/Image.d.ts +2 -2
- package/dist/types/display/ListItem.d.ts +1 -1
- package/dist/types/display/Loader.d.ts +1 -1
- package/dist/types/display/Spinner.d.ts +1 -1
- package/dist/types/forms/Button.d.ts +1 -1
- package/dist/types/forms/Checkbox.d.ts +1 -1
- package/dist/types/forms/Field.d.ts +1 -1
- package/dist/types/forms/Form.d.ts +1 -1
- package/dist/types/forms/Input.d.ts +1 -1
- package/dist/types/forms/Label.d.ts +1 -1
- package/dist/types/forms/Progress.d.ts +1 -1
- package/dist/types/forms/RadioGroup.d.ts +1 -1
- package/dist/types/forms/Select.d.ts +9 -2
- package/dist/types/forms/Slider.d.ts +1 -1
- package/dist/types/forms/Switch.d.ts +1 -1
- package/dist/types/forms/TextArea.d.ts +1 -1
- package/dist/types/forms/ToggleGroup.d.ts +1 -1
- package/dist/types/index.d.ts +99 -99
- package/dist/types/layout/Box.d.ts +2 -2
- package/dist/types/layout/Separator.d.ts +1 -1
- package/dist/types/layout/XGroup.d.ts +1 -1
- package/dist/types/layout/XStack.d.ts +1 -1
- package/dist/types/layout/YStack.d.ts +1 -1
- package/dist/types/overlays/Accordion.d.ts +1 -1
- package/dist/types/overlays/AlertDialog.d.ts +3 -2
- package/dist/types/overlays/ContextMenu.d.ts +1 -1
- package/dist/types/overlays/Dialog.d.ts +3 -2
- package/dist/types/overlays/Menu.d.ts +1 -1
- package/dist/types/overlays/Popover.d.ts +1 -1
- package/dist/types/overlays/Sheet.d.ts +3 -2
- package/dist/types/overlays/Tabs.d.ts +1 -1
- package/dist/types/overlays/Toast.d.ts +1 -1
- package/dist/types/overlays/Tooltip.d.ts +1 -1
- package/dist/types/typography/Anchor.d.ts +1 -1
- package/dist/types/typography/Heading.d.ts +1 -1
- package/dist/types/typography/Headings.d.ts +1 -1
- package/dist/types/typography/Paragraph.d.ts +1 -1
- package/dist/types/typography/SizableText.d.ts +2 -2
- package/dist/types/typography/Text.d.ts +1 -1
- package/package.json +81 -70
- package/dist/types/core/colors/radix.d.ts +0 -1396
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name
|
|
1
|
+
import { type CSSNamedColor } from "./colors/index.js";
|
|
2
|
+
import { type ThemeName } from "./theme.css.js";
|
|
3
|
+
import type { BaseProps } from "./types.js";
|
|
4
|
+
export interface ThemeProps<Name extends string = ThemeName> extends BaseProps {
|
|
5
|
+
/** A built-in, CSS named color, or a custom name supplied by createThemeScope. */
|
|
6
|
+
name?: Name;
|
|
7
|
+
/** Override this theme scope's semantic accent with a CSS named color. */
|
|
8
|
+
accentColor?: CSSNamedColor;
|
|
6
9
|
/** HTML element to render. Defaults to 'div'. */
|
|
7
10
|
as?: string;
|
|
8
11
|
[key: string]: any;
|
|
9
12
|
}
|
|
13
|
+
type CustomTheme = string | readonly [string, unknown] | {
|
|
14
|
+
className: string;
|
|
15
|
+
mode?: 'light' | 'dark';
|
|
16
|
+
};
|
|
17
|
+
type ReservedName = ThemeName | `${CSSNamedColor}${number}` | `light-${CSSNamedColor}${number}` | `dark-${CSSNamedColor}${number}`;
|
|
18
|
+
/**
|
|
19
|
+
* Bind vanilla-extract theme classes to names in a locally typed component.
|
|
20
|
+
* TypeScript requires literal, required keys and rejects built-in, CSS color and
|
|
21
|
+
* shade names, using case-sensitive CSS color literals and numeric suffix patterns.
|
|
22
|
+
* At runtime only built-in theme collisions are checked: JS callers or type
|
|
23
|
+
* assertions can register color/shade names, and custom entries take precedence
|
|
24
|
+
* over dynamic color themes. Alphabetic custom names are allowed.
|
|
25
|
+
* Use { className, mode } to set the palette base and accent contrast for a mode;
|
|
26
|
+
* otherwise the base is inherited and an accent override uses light-mode contrast.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createThemeScope<const T extends Record<string, CustomTheme>>(definitions: T & (string extends keyof T ? never : {
|
|
29
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K extends ReservedName ? never : T[K];
|
|
30
|
+
})): (props: ThemeProps<ThemeName | Extract<keyof T, string>>) => import("hono/jsx/jsx-dev-runtime").JSX.Element;
|
|
10
31
|
/**
|
|
11
32
|
* Theme — container for applying and nesting themes (sub-theming).
|
|
12
33
|
*
|
|
@@ -25,4 +46,5 @@ export interface ThemeProps extends BaseProps {
|
|
|
25
46
|
* </Theme>
|
|
26
47
|
* ```
|
|
27
48
|
*/
|
|
28
|
-
export declare function Theme(
|
|
49
|
+
export declare function Theme(props: ThemeProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
|
|
50
|
+
export {};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
export type ColorTokenName = `${
|
|
1
|
+
/** CSS Color Level 4 named colors (excluding transparent and currentColor). */
|
|
2
|
+
export type CSSNamedColor = 'aliceblue' | 'antiquewhite' | 'aqua' | 'aquamarine' | 'azure' | 'beige' | 'bisque' | 'black' | 'blanchedalmond' | 'blue' | 'blueviolet' | 'brown' | 'burlywood' | 'cadetblue' | 'chartreuse' | 'chocolate' | 'coral' | 'cornflowerblue' | 'cornsilk' | 'crimson' | 'cyan' | 'darkblue' | 'darkcyan' | 'darkgoldenrod' | 'darkgray' | 'darkgreen' | 'darkgrey' | 'darkkhaki' | 'darkmagenta' | 'darkolivegreen' | 'darkorange' | 'darkorchid' | 'darkred' | 'darksalmon' | 'darkseagreen' | 'darkslateblue' | 'darkslategray' | 'darkslategrey' | 'darkturquoise' | 'darkviolet' | 'deeppink' | 'deepskyblue' | 'dimgray' | 'dimgrey' | 'dodgerblue' | 'firebrick' | 'floralwhite' | 'forestgreen' | 'fuchsia' | 'gainsboro' | 'ghostwhite' | 'gold' | 'goldenrod' | 'gray' | 'green' | 'greenyellow' | 'grey' | 'honeydew' | 'hotpink' | 'indianred' | 'indigo' | 'ivory' | 'khaki' | 'lavender' | 'lavenderblush' | 'lawngreen' | 'lemonchiffon' | 'lightblue' | 'lightcoral' | 'lightcyan' | 'lightgoldenrodyellow' | 'lightgray' | 'lightgreen' | 'lightgrey' | 'lightpink' | 'lightsalmon' | 'lightseagreen' | 'lightskyblue' | 'lightslategray' | 'lightslategrey' | 'lightsteelblue' | 'lightyellow' | 'lime' | 'limegreen' | 'linen' | 'magenta' | 'maroon' | 'mediumaquamarine' | 'mediumblue' | 'mediumorchid' | 'mediumpurple' | 'mediumseagreen' | 'mediumslateblue' | 'mediumspringgreen' | 'mediumturquoise' | 'mediumvioletred' | 'midnightblue' | 'mintcream' | 'mistyrose' | 'moccasin' | 'navajowhite' | 'navy' | 'oldlace' | 'olive' | 'olivedrab' | 'orange' | 'orangered' | 'orchid' | 'palegoldenrod' | 'palegreen' | 'paleturquoise' | 'palevioletred' | 'papayawhip' | 'peachpuff' | 'peru' | 'pink' | 'plum' | 'powderblue' | 'purple' | 'rebeccapurple' | 'red' | 'rosybrown' | 'royalblue' | 'saddlebrown' | 'salmon' | 'sandybrown' | 'seagreen' | 'seashell' | 'sienna' | 'silver' | 'skyblue' | 'slateblue' | 'slategray' | 'slategrey' | 'snow' | 'springgreen' | 'steelblue' | 'tan' | 'teal' | 'thistle' | 'tomato' | 'turquoise' | 'violet' | 'wheat' | 'white' | 'whitesmoke' | 'yellow' | 'yellowgreen';
|
|
3
|
+
export type ColorShade = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
4
|
+
export type ColorTokenName = `${CSSNamedColor}${ColorShade}` | CSSNamedColor;
|
|
5
|
+
/** The theme input variables can be set on a theme scope or its Theme component. */
|
|
6
|
+
export declare const themeColorVariable = "--silva-theme-color";
|
|
7
|
+
export declare const themeBaseVariable = "--silva-theme-base";
|
|
8
|
+
export declare const themeContrastVariable = "--silva-theme-contrast";
|
|
9
|
+
export declare function accentContrast(color: CSSNamedColor, isDark: boolean): string;
|
|
10
|
+
/** Shade 1 is 10% color; shade 10 is 100% color. */
|
|
11
|
+
export declare function mixColor(color: string, shade: ColorShade, base: string): string;
|
|
12
|
+
/** Resolve a named palette token on demand. No list of names is shipped at runtime.
|
|
13
|
+
* Types enforce valid names; at runtime CSS validates the color identifier. */
|
|
14
|
+
export declare function namedColorTokenToCss(token: string): string | undefined;
|
|
5
15
|
export declare const colorTokens: Record<ColorTokenName, string>;
|
|
6
16
|
export declare const darkColorTokens: Record<ColorTokenName, string>;
|
|
7
|
-
export declare const colorScales: Record<
|
|
8
|
-
export declare const darkColorScales: Record<
|
|
9
|
-
export declare const colorTokenContract: Record<ColorTokenName, ''>;
|
|
10
|
-
export {};
|
|
17
|
+
export declare const colorScales: Record<CSSNamedColor, string[]>;
|
|
18
|
+
export declare const darkColorScales: Record<CSSNamedColor, string[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Child } from 'hono/jsx';
|
|
2
|
+
/**
|
|
3
|
+
* Applies props to selected compound children while preserving explicit props
|
|
4
|
+
* supplied by the consumer. Fragments and nested arrays are traversed too.
|
|
5
|
+
*/
|
|
6
|
+
export declare function injectCompoundProps(children: Child, matches: (tag: unknown) => boolean, resolveProps: (props: Record<string, unknown>) => Record<string, unknown>): Child;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const properties: readonly ['color', 'backgroundColor', 'borderColor'];
|
|
2
|
+
declare const conditions: readonly ['default', 'hover', 'active', 'focus'];
|
|
3
|
+
export type DynamicColorProperty = typeof properties[number];
|
|
4
|
+
export type DynamicColorCondition = typeof conditions[number];
|
|
5
|
+
export declare const dynamicColorClasses: Record<DynamicColorProperty, Record<DynamicColorCondition, string>>;
|
|
6
|
+
export {};
|