@umber-style/vue 0.0.0 → 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,261 @@
1
+ import { Component, ComputedRef, FunctionalComponent, IntrinsicElementAttributes, PropType } from "vue";
2
+ import { AlphaColor, BindingOptions, CSSObject, Cache, ColorScheme, ComponentSelector, CssArgument, CssArgument as CssArgument$1, Engine, GlobalInput, GlobalInput as GlobalInput$1, GlobalStyleObject, GlobalStyleObject as GlobalStyleObject$1, GlobalStyles, GlobalStyles as GlobalStyles$1, GlobalStylesInput, Interpolation as Interpolation$1, InterpolationResult, InterpolationResult as InterpolationResult$1, Keyframes, Keyframes as Keyframes$1, KeyframesInput, KeyframesOptions, KeyframesSteps, KeyframesSteps as KeyframesSteps$1, NestedKey, ObjectSheet, SchemeKey, SchemeName, SerializedStyles, SerializedStyles as SerializedStyles$1, SheetEntry, SheetEntry as SheetEntry$1, SheetStyles, StaticTemplateValue, StaticTemplateValue as StaticTemplateValue$1, StyleInput, StyleObject, StylerOptions, TemplateValue, TemplateValue as TemplateValue$1, Theme as Theme$1, ThemeInput, ThemeInput as ThemeInput$1, ThemeKey, UmberCache, WebNested, WebProperties, WebStyleObject, WebStyleObject as WebStyleObject$1, add, alpha, at, divide, multiply, negate, subtract } from "@umber-style/core";
3
+ /**
4
+ * The theme of the default style of this binding: what `styled`, `useTheme`, `StyleSheet` and
5
+ * `ThemeProvider` of the default style read. It extends the core's `Theme`, so an app gives it members
6
+ * from either module: `declare module '@umber-style/vue' { interface Theme extends MyTheme {} }` for Vue
7
+ * alone, or `declare module '@umber-style/core'` for a theme that every binding shares. The optional
8
+ * member below only keeps it from being empty.
9
+ */
10
+ export interface Theme extends Theme$1 {
11
+ readonly _theme?: never;
12
+ }
13
+ /**
14
+ * A style in any form that `styled` takes: a style object, a `css()` result or a sheet entry, a function
15
+ * of the attributes and the theme, nothing, or a list of them. The core's `Interpolation`, with this
16
+ * binding's `Theme` unless another is given.
17
+ */
18
+ export type Interpolation<Props = Record<string, unknown>, T = Theme> = Interpolation$1<Props, T>;
19
+ /** The options of `createStyle`: the engine options of the core, or an engine to bind. */
20
+ export type StyleOptions<T = never> = BindingOptions<T>;
21
+ /** The options of `styled(tag, options)`: the label of the class, what reaches the element, a class name of your own. */
22
+ export interface StyledOptions extends StylerOptions {
23
+ /** Whether an attribute is forwarded to a string tag. Default: every attribute but `as`, `theme`, `class` and `style`, which the component handles itself. */
24
+ shouldForwardProp?: (prop: string) => boolean;
25
+ /**
26
+ * A class name of your own that the element always has, after the engine's classes: a stable name
27
+ * that a parent's selector or a test can find. It is not a style and has no rule. A component that
28
+ * wraps this one keeps it, and adds its own.
29
+ */
30
+ target?: string;
31
+ }
32
+ /**
33
+ * `StyledOptions` whose `shouldForwardProp` is a type guard. A Vue styled component takes any attribute,
34
+ * so it only types the guard; the attributes that are forwarded are the ones it names.
35
+ */
36
+ export interface FilteringStyledOptions<Props = Record<string, unknown>, Forwarded extends keyof Props & string = keyof Props & string> extends StyledOptions {
37
+ /** Whether an attribute is forwarded to a string tag, as a type guard over the names it forwards. */
38
+ shouldForwardProp?: (prop: string) => prop is Forwarded;
39
+ }
40
+ /** The props of a component or a tag: what its instances declare, or the attributes of an element. */
41
+ export type PropsOf<C> = C extends keyof IntrinsicElementAttributes ? IntrinsicElementAttributes[C] : C extends (new (...args: never[]) => {
42
+ $props: infer P;
43
+ }) ? P : C extends FunctionalComponent<infer P> ? P : Record<string, unknown>;
44
+ /** What a styled component keeps, so that styling it again flattens into one element. */
45
+ export interface StyledStatics {
46
+ /** Every style of the component, the styles of the components it wraps first. */
47
+ _styles: readonly StyleInput[];
48
+ /** The tag or component that is finally rendered. */
49
+ _tag: string | Component;
50
+ _shouldForwardProp?: (prop: string) => boolean;
51
+ /** The `target` classes of the component and of the components it wraps. */
52
+ _target?: string;
53
+ /** The component as a selector: `.` and a class that every element of it has. Throws when it has none. */
54
+ toString(): string;
55
+ }
56
+ /** A component that `styled` made: it takes any attribute, and keeps its styles for a component that wraps it. */
57
+ export type StyledComponent = FunctionalComponent<Record<string, unknown>> & StyledStatics;
58
+ /**
59
+ * What `styled(tag, options)` returns: it takes the styles and makes the component, or is used as a tag,
60
+ * whose template is one style (a function of the attributes when an interpolation is a function).
61
+ */
62
+ export interface StyledFactory<T> {
63
+ (style: (props: Record<string, unknown> & {
64
+ theme: T;
65
+ }) => InterpolationResult$1, ...styles: Interpolation<Record<string, unknown>, T>[]): StyledComponent;
66
+ (template: TemplateStringsArray, ...values: TemplateValue$1<Record<string, unknown>, T>[]): StyledComponent;
67
+ (...styles: Interpolation<Record<string, unknown>, T>[]): StyledComponent;
68
+ }
69
+ /** The shorthand of each HTML and SVG tag: `styled.div(...styles)` is `styled('div')(...styles)`. */
70
+ export type StyledTags<T> = { readonly [K in keyof IntrinsicElementAttributes]: StyledFactory<T>; };
71
+ /** `styled` over the theme `T`: a function of a tag or a component and its options, with the tag shorthands. */
72
+ export type Styled<T> = ((tag: string | Component, options?: StyledOptions) => StyledFactory<T>) & StyledTags<T>;
73
+ /** The type of `styled` itself, with the tag shorthands: `Styled` of this binding's `Theme` unless another is given. */
74
+ export type CreateStyled<T = Theme> = Styled<T>;
75
+ /** `css()`: one style made once and passed around, from styles or from a tagged template. */
76
+ export interface CssFunction {
77
+ (template: TemplateStringsArray, ...values: StaticTemplateValue$1[]): SerializedStyles$1;
78
+ (...styles: CssArgument$1[]): SerializedStyles$1;
79
+ }
80
+ /** A set of named styles made from a function of the theme: it has no entries until `useStyle` resolves it. */
81
+ export interface Sheet<S extends SheetStyles> {
82
+ /** The entries of the sheet for a theme view, which `useStyle` passes. */
83
+ resolve(theme?: unknown): { [K in keyof S]: SheetEntry$1; };
84
+ }
85
+ /** The props of `ThemeProvider`. */
86
+ export interface ThemeProviderProps<T> {
87
+ /**
88
+ * The theme, or the part of it that this subtree changes; or a function of the theme above (the base
89
+ * theme, or an empty object, for the outermost provider) that returns it. It is merged over the theme above.
90
+ */
91
+ theme: ThemeInput$1<T>;
92
+ /** The color scheme of this subtree, which `whenScheme()` matches and the theme class carries. Default: none, the system preference. */
93
+ colorScheme?: ColorScheme;
94
+ /** The element of the wrapper of a nested provider. Default 'div'. */
95
+ as?: string;
96
+ /**
97
+ * Renders no element, no class and no rule: the app puts `themeClass(theme)` on an ancestor, usually
98
+ * `<html>`. Without it the outermost provider declares its theme on `:root`, and renders no element either.
99
+ */
100
+ isRoot?: boolean;
101
+ }
102
+ /** The props of `Global`. */
103
+ export interface GlobalProps<T> {
104
+ /**
105
+ * The global styles: a handle that `globalStyles` made, a style object, a function of the theme, or a
106
+ * list of them, written in the order of the list. A function of the theme reads the nearest provider:
107
+ * tokens are references, raw keys (`breakpoints`) are its real values.
108
+ */
109
+ styles: GlobalInput$1<T>;
110
+ }
111
+ /** What `createStyle` and `bindEngine` return: the Vue styling of one engine. */
112
+ export interface Style<T> {
113
+ /** The engine every member writes through. */
114
+ engine: Engine<T>;
115
+ /** The cache of the engine: its rules and sheet. */
116
+ cache: Engine<T>['cache'];
117
+ /** Makes a styled component of a tag or a component; `styled.div` and the other tag shorthands too. */
118
+ styled: Styled<T>;
119
+ /** Makes sheets of named styles. */
120
+ StyleSheet: {
121
+ /** A sheet given as an object is its entries, usable at once, with no hook and no theme. */
122
+ create<K extends string>(styles: ObjectSheet<K>): { readonly [P in K]: SheetEntry$1; };
123
+ /** A sheet given as a function of the theme is for `useStyle`, which resolves it against the theme. */
124
+ create<K extends string>(styles: (theme: T) => Record<K, WebStyleObject$1>): Sheet<Record<K, WebStyleObject$1>>;
125
+ };
126
+ /** The entries of a sheet; an object sheet is its own entries and is returned as it is. */
127
+ useStyle<K extends string>(sheet: { readonly [P in K]: SheetEntry$1; }): { readonly [P in K]: SheetEntry$1; };
128
+ /** The entries of a sheet made from a function of the theme, resolved against the nearest provider. Call it in `setup`. */
129
+ useStyle<S extends SheetStyles>(sheet: Sheet<S>): { [K in keyof S]: SheetEntry$1; };
130
+ /** The attributes that apply entries of a sheet: a class. */
131
+ apply(...entries: (SheetEntry$1 | string | null | undefined | false)[]): {
132
+ class?: string;
133
+ };
134
+ /**
135
+ * One style made once and passed around: style objects, `css()` results and sheet entries (lists too,
136
+ * falsy values dropped) merged in order, the last winning; or, as a tag, the template read as CSS text.
137
+ * It returns a sheet entry: its text is its class name, and it goes in the `style` attribute of a styled
138
+ * component, in `apply`, in another `css()`, among the styles of `styled` and under a selector of
139
+ * global styles. Equal styles give the same class. A function is a `TypeError`: there are no props.
140
+ */
141
+ css: CssFunction;
142
+ /** Gives its slot a theme, merged over the theme above: the outermost one on `:root`, a nested one on its wrapper. */
143
+ ThemeProvider: Component<ThemeProviderProps<T>>;
144
+ /**
145
+ * Renders the wrapper of the nearest nested provider again (the same element and classes) around its
146
+ * slot, for content that a teleport puts elsewhere in the document; under the outermost provider, or
147
+ * none, the slot alone.
148
+ */
149
+ ThemeScope: Component;
150
+ /** The real theme values, merged over the providers above; reactive. With no provider, the base theme, or an empty object. Call it in `setup`. */
151
+ useTheme(): ComputedRef<T>;
152
+ /** The class string of the wrapper of the nearest nested provider, reactive; undefined under the outermost provider, or none. Call it in `setup`. */
153
+ useThemeClass(): ComputedRef<string | undefined>;
154
+ /** The class string of a theme (and a color scheme), for an element the app renders itself, such as `<html>`. */
155
+ themeClass: Engine<T>['themeClass'];
156
+ /** A style key for "the nearest theme is this theme"; it needs `@scope`. */
157
+ when: Engine<T>['when'];
158
+ /** A style key for "the nearest color scheme is this one": the nearest theme given that `colorScheme`, else the system preference. */
159
+ whenScheme: Engine<T>['whenScheme'];
160
+ /**
161
+ * Registers an animation and returns its name, `<label>-<hash>`, for `animation` or `animationName`.
162
+ * It writes nothing and needs no engine, so a module can call it before `configure()`: the
163
+ * `@keyframes` rule is written once, when a class that uses the name is first written.
164
+ */
165
+ keyframes(steps: (theme: T) => KeyframesSteps$1, options?: KeyframesOptions): Keyframes$1;
166
+ /** As a tag: the steps written as CSS text (`from { ... } to { ... }`); a function among the interpolations is called with `{ theme }`. */
167
+ keyframes(template: TemplateStringsArray, ...values: TemplateValue$1<unknown, T>[]): Keyframes$1;
168
+ /** The steps as an object, or a function of the theme. */
169
+ keyframes(steps: KeyframesInput<T>, options?: KeyframesOptions): Keyframes$1;
170
+ /** Makes global styles (selectors and at-rules as keys) and returns their handle, for `Global`. It writes nothing and needs no engine. */
171
+ globalStyles(styles: (theme: T) => GlobalStyleObject$1): GlobalStyles$1<T>;
172
+ /** As a tag: the styles written as CSS text (`body { margin: 0; }`); a function among the interpolations is called with `{ theme }`. */
173
+ globalStyles(template: TemplateStringsArray, ...values: TemplateValue$1<unknown, T>[]): GlobalStyles$1<T>;
174
+ /** The styles as an object, or a function of the theme. */
175
+ globalStyles(styles: GlobalStylesInput<T>): GlobalStyles$1<T>;
176
+ /**
177
+ * Writes global styles into the `global` layer while it is mounted, and renders nothing. In the browser
178
+ * the rules are removed when it unmounts, and replaced when its styles, or what they read of the theme,
179
+ * change. On a server they are written for good, for `extractPageStyles`.
180
+ */
181
+ Global: Component<GlobalProps<T>>;
182
+ }
183
+ /** The options of `configure`: the engine options of the core, and the base theme. */
184
+ export interface DefaultStyleOptions extends BindingOptions<Theme> {
185
+ /** The base theme, for an app that has no provider at all. */
186
+ theme?: Theme;
187
+ }
188
+ /** Makes the default styling: one engine, made on first use, behind `styled`, `ThemeProvider` and the rest. */
189
+ export declare function createDefaultStyle(): {
190
+ configure: (options: DefaultStyleOptions) => void;
191
+ getEngine: () => import("@umber-style/core").Engine<Theme>;
192
+ styled: Styled<Theme>;
193
+ StyleSheet: {
194
+ create<K extends string>(styles: import("@umber-style/core").ObjectSheet<K>): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
195
+ create<K extends string>(styles: (theme: Theme) => Record<K, WebStyleObject$1>): Sheet<Record<K, WebStyleObject$1>>;
196
+ };
197
+ useStyle: {
198
+ <K extends string>(sheet: { readonly [P in K]: import("@umber-style/core").SheetEntry; }): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
199
+ <S extends import("@umber-style/core").SheetStyles>(sheet: Sheet<S>): { [K in keyof S]: import("@umber-style/core").SheetEntry; };
200
+ };
201
+ useTheme: () => ComputedRef<Theme>;
202
+ ThemeProvider: Component<ThemeProviderProps<Theme>>;
203
+ ThemeScope: Component;
204
+ useThemeClass: () => ComputedRef<string | undefined>;
205
+ apply: Style<Theme>['apply'];
206
+ css: Style<Theme>['css'];
207
+ when: Style<Theme>['when'];
208
+ whenScheme: Style<Theme>['whenScheme'];
209
+ themeClass: Style<Theme>['themeClass'];
210
+ keyframes: Style<Theme>['keyframes'];
211
+ globalStyles: Style<Theme>['globalStyles'];
212
+ Global: Component<GlobalProps<Theme>>;
213
+ };
214
+ /**
215
+ * Gives the subtree in its slot its cache: every rule that a component of the binding writes there goes
216
+ * to `value` (classes, sheet entries, global rules, keyframes, the root theme and the theme classes of the
217
+ * providers below), through the engine of the same theme over that cache. Outside any provider the
218
+ * engine's own cache is used. `value` is read once, in `setup`: to give the subtree another cache, render
219
+ * another provider (a new `key`).
220
+ */
221
+ export declare const CacheProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
222
+ /** The cache of the subtree: one that `createCache` of `@umber-style/cache` (or of the core) made. */
223
+ value: {
224
+ type: PropType<Cache>;
225
+ required: true;
226
+ };
227
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
228
+ [key: string]: any;
229
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
230
+ /** The cache of the subtree: one that `createCache` of `@umber-style/cache` (or of the core) made. */
231
+ value: {
232
+ type: PropType<Cache>;
233
+ required: true;
234
+ };
235
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
236
+ /** Makes the Vue styling over an engine: `styled`, sheets, the theme provider and `useTheme`. */
237
+ export declare function bindEngine<T extends object>(engine: Engine<T>): Style<T>;
238
+ /** Makes the Vue styling of one theme shape, apart from the default one: its own engine, or the one given. */
239
+ export declare function createStyle<T extends object>(theme: T, options?: StyleOptions<T>): Style<T>;
240
+ export declare const configure: (options: DefaultStyleOptions) => void, getEngine: () => import("@umber-style/core").Engine<Theme>, styled: Styled<Theme>, StyleSheet: {
241
+ create<K extends string>(styles: import("@umber-style/core").ObjectSheet<K>): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
242
+ create<K extends string>(styles: (theme: Theme) => Record<K, import("@umber-style/core").WebStyleObject>): Sheet<Record<K, import("@umber-style/core").WebStyleObject>>;
243
+ }, useStyle: {
244
+ <K extends string>(sheet: { readonly [P in K]: import("@umber-style/core").SheetEntry; }): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
245
+ <S extends import("@umber-style/core").SheetStyles>(sheet: Sheet<S>): { [K in keyof S]: import("@umber-style/core").SheetEntry; };
246
+ }, useTheme: () => import("vue").ComputedRef<Theme>, ThemeProvider: import("vue").Component<ThemeProviderProps<Theme>>, ThemeScope: import("vue").Component, useThemeClass: () => import("vue").ComputedRef<string | undefined>, apply: (...entries: (import("@umber-style/core").SheetEntry | string | null | undefined | false)[]) => {
247
+ class?: string;
248
+ }, css: CssFunction, themeClass: (theme: {
249
+ readonly _theme?: never;
250
+ }, colorScheme?: import("@umber-style/core").ColorScheme) => string, when: (theme: {
251
+ readonly _theme?: never;
252
+ }, colorScheme?: import("@umber-style/core").ColorScheme) => import("@umber-style/core").ThemeKey, whenScheme: (scheme: import("@umber-style/core").SchemeName) => import("@umber-style/core").SchemeKey, keyframes: {
253
+ (steps: (theme: Theme) => import("@umber-style/core").KeyframesSteps, options?: import("@umber-style/core").KeyframesOptions): import("@umber-style/core").Keyframes;
254
+ (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").Keyframes;
255
+ (steps: import("@umber-style/core").KeyframesInput<Theme>, options?: import("@umber-style/core").KeyframesOptions): import("@umber-style/core").Keyframes;
256
+ }, globalStyles: {
257
+ (styles: (theme: Theme) => import("@umber-style/core").GlobalStyleObject): import("@umber-style/core").GlobalStyles<Theme>;
258
+ (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").GlobalStyles<Theme>;
259
+ (styles: import("@umber-style/core").GlobalStylesInput<Theme>): import("@umber-style/core").GlobalStyles<Theme>;
260
+ }, Global: import("vue").Component<GlobalProps<Theme>>;
261
+ export { type AlphaColor, type CSSObject, type ComponentSelector, type CssArgument, type GlobalInput, type GlobalStyleObject, type GlobalStyles, type InterpolationResult, type Keyframes, type KeyframesSteps, type NestedKey, type SchemeKey, type SchemeName, type SerializedStyles, type SheetEntry, type StaticTemplateValue, type StyleObject, type TemplateValue, type ThemeInput, type ThemeKey, type UmberCache, type WebNested, type WebProperties, type WebStyleObject, add, alpha, at, divide, multiply, negate, subtract };
@@ -0,0 +1,261 @@
1
+ import { Component, ComputedRef, FunctionalComponent, IntrinsicElementAttributes, PropType } from "vue";
2
+ import { AlphaColor, BindingOptions, CSSObject, Cache, ColorScheme, ComponentSelector, CssArgument, CssArgument as CssArgument$1, Engine, GlobalInput, GlobalInput as GlobalInput$1, GlobalStyleObject, GlobalStyleObject as GlobalStyleObject$1, GlobalStyles, GlobalStyles as GlobalStyles$1, GlobalStylesInput, Interpolation as Interpolation$1, InterpolationResult, InterpolationResult as InterpolationResult$1, Keyframes, Keyframes as Keyframes$1, KeyframesInput, KeyframesOptions, KeyframesSteps, KeyframesSteps as KeyframesSteps$1, NestedKey, ObjectSheet, SchemeKey, SchemeName, SerializedStyles, SerializedStyles as SerializedStyles$1, SheetEntry, SheetEntry as SheetEntry$1, SheetStyles, StaticTemplateValue, StaticTemplateValue as StaticTemplateValue$1, StyleInput, StyleObject, StylerOptions, TemplateValue, TemplateValue as TemplateValue$1, Theme as Theme$1, ThemeInput, ThemeInput as ThemeInput$1, ThemeKey, UmberCache, WebNested, WebProperties, WebStyleObject, WebStyleObject as WebStyleObject$1, add, alpha, at, divide, multiply, negate, subtract } from "@umber-style/core";
3
+ /**
4
+ * The theme of the default style of this binding: what `styled`, `useTheme`, `StyleSheet` and
5
+ * `ThemeProvider` of the default style read. It extends the core's `Theme`, so an app gives it members
6
+ * from either module: `declare module '@umber-style/vue' { interface Theme extends MyTheme {} }` for Vue
7
+ * alone, or `declare module '@umber-style/core'` for a theme that every binding shares. The optional
8
+ * member below only keeps it from being empty.
9
+ */
10
+ export interface Theme extends Theme$1 {
11
+ readonly _theme?: never;
12
+ }
13
+ /**
14
+ * A style in any form that `styled` takes: a style object, a `css()` result or a sheet entry, a function
15
+ * of the attributes and the theme, nothing, or a list of them. The core's `Interpolation`, with this
16
+ * binding's `Theme` unless another is given.
17
+ */
18
+ export type Interpolation<Props = Record<string, unknown>, T = Theme> = Interpolation$1<Props, T>;
19
+ /** The options of `createStyle`: the engine options of the core, or an engine to bind. */
20
+ export type StyleOptions<T = never> = BindingOptions<T>;
21
+ /** The options of `styled(tag, options)`: the label of the class, what reaches the element, a class name of your own. */
22
+ export interface StyledOptions extends StylerOptions {
23
+ /** Whether an attribute is forwarded to a string tag. Default: every attribute but `as`, `theme`, `class` and `style`, which the component handles itself. */
24
+ shouldForwardProp?: (prop: string) => boolean;
25
+ /**
26
+ * A class name of your own that the element always has, after the engine's classes: a stable name
27
+ * that a parent's selector or a test can find. It is not a style and has no rule. A component that
28
+ * wraps this one keeps it, and adds its own.
29
+ */
30
+ target?: string;
31
+ }
32
+ /**
33
+ * `StyledOptions` whose `shouldForwardProp` is a type guard. A Vue styled component takes any attribute,
34
+ * so it only types the guard; the attributes that are forwarded are the ones it names.
35
+ */
36
+ export interface FilteringStyledOptions<Props = Record<string, unknown>, Forwarded extends keyof Props & string = keyof Props & string> extends StyledOptions {
37
+ /** Whether an attribute is forwarded to a string tag, as a type guard over the names it forwards. */
38
+ shouldForwardProp?: (prop: string) => prop is Forwarded;
39
+ }
40
+ /** The props of a component or a tag: what its instances declare, or the attributes of an element. */
41
+ export type PropsOf<C> = C extends keyof IntrinsicElementAttributes ? IntrinsicElementAttributes[C] : C extends (new (...args: never[]) => {
42
+ $props: infer P;
43
+ }) ? P : C extends FunctionalComponent<infer P> ? P : Record<string, unknown>;
44
+ /** What a styled component keeps, so that styling it again flattens into one element. */
45
+ export interface StyledStatics {
46
+ /** Every style of the component, the styles of the components it wraps first. */
47
+ _styles: readonly StyleInput[];
48
+ /** The tag or component that is finally rendered. */
49
+ _tag: string | Component;
50
+ _shouldForwardProp?: (prop: string) => boolean;
51
+ /** The `target` classes of the component and of the components it wraps. */
52
+ _target?: string;
53
+ /** The component as a selector: `.` and a class that every element of it has. Throws when it has none. */
54
+ toString(): string;
55
+ }
56
+ /** A component that `styled` made: it takes any attribute, and keeps its styles for a component that wraps it. */
57
+ export type StyledComponent = FunctionalComponent<Record<string, unknown>> & StyledStatics;
58
+ /**
59
+ * What `styled(tag, options)` returns: it takes the styles and makes the component, or is used as a tag,
60
+ * whose template is one style (a function of the attributes when an interpolation is a function).
61
+ */
62
+ export interface StyledFactory<T> {
63
+ (style: (props: Record<string, unknown> & {
64
+ theme: T;
65
+ }) => InterpolationResult$1, ...styles: Interpolation<Record<string, unknown>, T>[]): StyledComponent;
66
+ (template: TemplateStringsArray, ...values: TemplateValue$1<Record<string, unknown>, T>[]): StyledComponent;
67
+ (...styles: Interpolation<Record<string, unknown>, T>[]): StyledComponent;
68
+ }
69
+ /** The shorthand of each HTML and SVG tag: `styled.div(...styles)` is `styled('div')(...styles)`. */
70
+ export type StyledTags<T> = { readonly [K in keyof IntrinsicElementAttributes]: StyledFactory<T>; };
71
+ /** `styled` over the theme `T`: a function of a tag or a component and its options, with the tag shorthands. */
72
+ export type Styled<T> = ((tag: string | Component, options?: StyledOptions) => StyledFactory<T>) & StyledTags<T>;
73
+ /** The type of `styled` itself, with the tag shorthands: `Styled` of this binding's `Theme` unless another is given. */
74
+ export type CreateStyled<T = Theme> = Styled<T>;
75
+ /** `css()`: one style made once and passed around, from styles or from a tagged template. */
76
+ export interface CssFunction {
77
+ (template: TemplateStringsArray, ...values: StaticTemplateValue$1[]): SerializedStyles$1;
78
+ (...styles: CssArgument$1[]): SerializedStyles$1;
79
+ }
80
+ /** A set of named styles made from a function of the theme: it has no entries until `useStyle` resolves it. */
81
+ export interface Sheet<S extends SheetStyles> {
82
+ /** The entries of the sheet for a theme view, which `useStyle` passes. */
83
+ resolve(theme?: unknown): { [K in keyof S]: SheetEntry$1; };
84
+ }
85
+ /** The props of `ThemeProvider`. */
86
+ export interface ThemeProviderProps<T> {
87
+ /**
88
+ * The theme, or the part of it that this subtree changes; or a function of the theme above (the base
89
+ * theme, or an empty object, for the outermost provider) that returns it. It is merged over the theme above.
90
+ */
91
+ theme: ThemeInput$1<T>;
92
+ /** The color scheme of this subtree, which `whenScheme()` matches and the theme class carries. Default: none, the system preference. */
93
+ colorScheme?: ColorScheme;
94
+ /** The element of the wrapper of a nested provider. Default 'div'. */
95
+ as?: string;
96
+ /**
97
+ * Renders no element, no class and no rule: the app puts `themeClass(theme)` on an ancestor, usually
98
+ * `<html>`. Without it the outermost provider declares its theme on `:root`, and renders no element either.
99
+ */
100
+ isRoot?: boolean;
101
+ }
102
+ /** The props of `Global`. */
103
+ export interface GlobalProps<T> {
104
+ /**
105
+ * The global styles: a handle that `globalStyles` made, a style object, a function of the theme, or a
106
+ * list of them, written in the order of the list. A function of the theme reads the nearest provider:
107
+ * tokens are references, raw keys (`breakpoints`) are its real values.
108
+ */
109
+ styles: GlobalInput$1<T>;
110
+ }
111
+ /** What `createStyle` and `bindEngine` return: the Vue styling of one engine. */
112
+ export interface Style<T> {
113
+ /** The engine every member writes through. */
114
+ engine: Engine<T>;
115
+ /** The cache of the engine: its rules and sheet. */
116
+ cache: Engine<T>['cache'];
117
+ /** Makes a styled component of a tag or a component; `styled.div` and the other tag shorthands too. */
118
+ styled: Styled<T>;
119
+ /** Makes sheets of named styles. */
120
+ StyleSheet: {
121
+ /** A sheet given as an object is its entries, usable at once, with no hook and no theme. */
122
+ create<K extends string>(styles: ObjectSheet<K>): { readonly [P in K]: SheetEntry$1; };
123
+ /** A sheet given as a function of the theme is for `useStyle`, which resolves it against the theme. */
124
+ create<K extends string>(styles: (theme: T) => Record<K, WebStyleObject$1>): Sheet<Record<K, WebStyleObject$1>>;
125
+ };
126
+ /** The entries of a sheet; an object sheet is its own entries and is returned as it is. */
127
+ useStyle<K extends string>(sheet: { readonly [P in K]: SheetEntry$1; }): { readonly [P in K]: SheetEntry$1; };
128
+ /** The entries of a sheet made from a function of the theme, resolved against the nearest provider. Call it in `setup`. */
129
+ useStyle<S extends SheetStyles>(sheet: Sheet<S>): { [K in keyof S]: SheetEntry$1; };
130
+ /** The attributes that apply entries of a sheet: a class. */
131
+ apply(...entries: (SheetEntry$1 | string | null | undefined | false)[]): {
132
+ class?: string;
133
+ };
134
+ /**
135
+ * One style made once and passed around: style objects, `css()` results and sheet entries (lists too,
136
+ * falsy values dropped) merged in order, the last winning; or, as a tag, the template read as CSS text.
137
+ * It returns a sheet entry: its text is its class name, and it goes in the `style` attribute of a styled
138
+ * component, in `apply`, in another `css()`, among the styles of `styled` and under a selector of
139
+ * global styles. Equal styles give the same class. A function is a `TypeError`: there are no props.
140
+ */
141
+ css: CssFunction;
142
+ /** Gives its slot a theme, merged over the theme above: the outermost one on `:root`, a nested one on its wrapper. */
143
+ ThemeProvider: Component<ThemeProviderProps<T>>;
144
+ /**
145
+ * Renders the wrapper of the nearest nested provider again (the same element and classes) around its
146
+ * slot, for content that a teleport puts elsewhere in the document; under the outermost provider, or
147
+ * none, the slot alone.
148
+ */
149
+ ThemeScope: Component;
150
+ /** The real theme values, merged over the providers above; reactive. With no provider, the base theme, or an empty object. Call it in `setup`. */
151
+ useTheme(): ComputedRef<T>;
152
+ /** The class string of the wrapper of the nearest nested provider, reactive; undefined under the outermost provider, or none. Call it in `setup`. */
153
+ useThemeClass(): ComputedRef<string | undefined>;
154
+ /** The class string of a theme (and a color scheme), for an element the app renders itself, such as `<html>`. */
155
+ themeClass: Engine<T>['themeClass'];
156
+ /** A style key for "the nearest theme is this theme"; it needs `@scope`. */
157
+ when: Engine<T>['when'];
158
+ /** A style key for "the nearest color scheme is this one": the nearest theme given that `colorScheme`, else the system preference. */
159
+ whenScheme: Engine<T>['whenScheme'];
160
+ /**
161
+ * Registers an animation and returns its name, `<label>-<hash>`, for `animation` or `animationName`.
162
+ * It writes nothing and needs no engine, so a module can call it before `configure()`: the
163
+ * `@keyframes` rule is written once, when a class that uses the name is first written.
164
+ */
165
+ keyframes(steps: (theme: T) => KeyframesSteps$1, options?: KeyframesOptions): Keyframes$1;
166
+ /** As a tag: the steps written as CSS text (`from { ... } to { ... }`); a function among the interpolations is called with `{ theme }`. */
167
+ keyframes(template: TemplateStringsArray, ...values: TemplateValue$1<unknown, T>[]): Keyframes$1;
168
+ /** The steps as an object, or a function of the theme. */
169
+ keyframes(steps: KeyframesInput<T>, options?: KeyframesOptions): Keyframes$1;
170
+ /** Makes global styles (selectors and at-rules as keys) and returns their handle, for `Global`. It writes nothing and needs no engine. */
171
+ globalStyles(styles: (theme: T) => GlobalStyleObject$1): GlobalStyles$1<T>;
172
+ /** As a tag: the styles written as CSS text (`body { margin: 0; }`); a function among the interpolations is called with `{ theme }`. */
173
+ globalStyles(template: TemplateStringsArray, ...values: TemplateValue$1<unknown, T>[]): GlobalStyles$1<T>;
174
+ /** The styles as an object, or a function of the theme. */
175
+ globalStyles(styles: GlobalStylesInput<T>): GlobalStyles$1<T>;
176
+ /**
177
+ * Writes global styles into the `global` layer while it is mounted, and renders nothing. In the browser
178
+ * the rules are removed when it unmounts, and replaced when its styles, or what they read of the theme,
179
+ * change. On a server they are written for good, for `extractPageStyles`.
180
+ */
181
+ Global: Component<GlobalProps<T>>;
182
+ }
183
+ /** The options of `configure`: the engine options of the core, and the base theme. */
184
+ export interface DefaultStyleOptions extends BindingOptions<Theme> {
185
+ /** The base theme, for an app that has no provider at all. */
186
+ theme?: Theme;
187
+ }
188
+ /** Makes the default styling: one engine, made on first use, behind `styled`, `ThemeProvider` and the rest. */
189
+ export declare function createDefaultStyle(): {
190
+ configure: (options: DefaultStyleOptions) => void;
191
+ getEngine: () => import("@umber-style/core").Engine<Theme>;
192
+ styled: Styled<Theme>;
193
+ StyleSheet: {
194
+ create<K extends string>(styles: import("@umber-style/core").ObjectSheet<K>): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
195
+ create<K extends string>(styles: (theme: Theme) => Record<K, WebStyleObject$1>): Sheet<Record<K, WebStyleObject$1>>;
196
+ };
197
+ useStyle: {
198
+ <K extends string>(sheet: { readonly [P in K]: import("@umber-style/core").SheetEntry; }): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
199
+ <S extends import("@umber-style/core").SheetStyles>(sheet: Sheet<S>): { [K in keyof S]: import("@umber-style/core").SheetEntry; };
200
+ };
201
+ useTheme: () => ComputedRef<Theme>;
202
+ ThemeProvider: Component<ThemeProviderProps<Theme>>;
203
+ ThemeScope: Component;
204
+ useThemeClass: () => ComputedRef<string | undefined>;
205
+ apply: Style<Theme>['apply'];
206
+ css: Style<Theme>['css'];
207
+ when: Style<Theme>['when'];
208
+ whenScheme: Style<Theme>['whenScheme'];
209
+ themeClass: Style<Theme>['themeClass'];
210
+ keyframes: Style<Theme>['keyframes'];
211
+ globalStyles: Style<Theme>['globalStyles'];
212
+ Global: Component<GlobalProps<Theme>>;
213
+ };
214
+ /**
215
+ * Gives the subtree in its slot its cache: every rule that a component of the binding writes there goes
216
+ * to `value` (classes, sheet entries, global rules, keyframes, the root theme and the theme classes of the
217
+ * providers below), through the engine of the same theme over that cache. Outside any provider the
218
+ * engine's own cache is used. `value` is read once, in `setup`: to give the subtree another cache, render
219
+ * another provider (a new `key`).
220
+ */
221
+ export declare const CacheProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
222
+ /** The cache of the subtree: one that `createCache` of `@umber-style/cache` (or of the core) made. */
223
+ value: {
224
+ type: PropType<Cache>;
225
+ required: true;
226
+ };
227
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
228
+ [key: string]: any;
229
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
230
+ /** The cache of the subtree: one that `createCache` of `@umber-style/cache` (or of the core) made. */
231
+ value: {
232
+ type: PropType<Cache>;
233
+ required: true;
234
+ };
235
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
236
+ /** Makes the Vue styling over an engine: `styled`, sheets, the theme provider and `useTheme`. */
237
+ export declare function bindEngine<T extends object>(engine: Engine<T>): Style<T>;
238
+ /** Makes the Vue styling of one theme shape, apart from the default one: its own engine, or the one given. */
239
+ export declare function createStyle<T extends object>(theme: T, options?: StyleOptions<T>): Style<T>;
240
+ export declare const configure: (options: DefaultStyleOptions) => void, getEngine: () => import("@umber-style/core").Engine<Theme>, styled: Styled<Theme>, StyleSheet: {
241
+ create<K extends string>(styles: import("@umber-style/core").ObjectSheet<K>): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
242
+ create<K extends string>(styles: (theme: Theme) => Record<K, import("@umber-style/core").WebStyleObject>): Sheet<Record<K, import("@umber-style/core").WebStyleObject>>;
243
+ }, useStyle: {
244
+ <K extends string>(sheet: { readonly [P in K]: import("@umber-style/core").SheetEntry; }): { readonly [P in K]: import("@umber-style/core").SheetEntry; };
245
+ <S extends import("@umber-style/core").SheetStyles>(sheet: Sheet<S>): { [K in keyof S]: import("@umber-style/core").SheetEntry; };
246
+ }, useTheme: () => import("vue").ComputedRef<Theme>, ThemeProvider: import("vue").Component<ThemeProviderProps<Theme>>, ThemeScope: import("vue").Component, useThemeClass: () => import("vue").ComputedRef<string | undefined>, apply: (...entries: (import("@umber-style/core").SheetEntry | string | null | undefined | false)[]) => {
247
+ class?: string;
248
+ }, css: CssFunction, themeClass: (theme: {
249
+ readonly _theme?: never;
250
+ }, colorScheme?: import("@umber-style/core").ColorScheme) => string, when: (theme: {
251
+ readonly _theme?: never;
252
+ }, colorScheme?: import("@umber-style/core").ColorScheme) => import("@umber-style/core").ThemeKey, whenScheme: (scheme: import("@umber-style/core").SchemeName) => import("@umber-style/core").SchemeKey, keyframes: {
253
+ (steps: (theme: Theme) => import("@umber-style/core").KeyframesSteps, options?: import("@umber-style/core").KeyframesOptions): import("@umber-style/core").Keyframes;
254
+ (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").Keyframes;
255
+ (steps: import("@umber-style/core").KeyframesInput<Theme>, options?: import("@umber-style/core").KeyframesOptions): import("@umber-style/core").Keyframes;
256
+ }, globalStyles: {
257
+ (styles: (theme: Theme) => import("@umber-style/core").GlobalStyleObject): import("@umber-style/core").GlobalStyles<Theme>;
258
+ (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").GlobalStyles<Theme>;
259
+ (styles: import("@umber-style/core").GlobalStylesInput<Theme>): import("@umber-style/core").GlobalStyles<Theme>;
260
+ }, Global: import("vue").Component<GlobalProps<Theme>>;
261
+ export { type AlphaColor, type CSSObject, type ComponentSelector, type CssArgument, type GlobalInput, type GlobalStyleObject, type GlobalStyles, type InterpolationResult, type Keyframes, type KeyframesSteps, type NestedKey, type SchemeKey, type SchemeName, type SerializedStyles, type SheetEntry, type StaticTemplateValue, type StyleObject, type TemplateValue, type ThemeInput, type ThemeKey, type UmberCache, type WebNested, type WebProperties, type WebStyleObject, add, alpha, at, divide, multiply, negate, subtract };