@umber-style/react 0.1.0-alpha.1 → 0.1.0-alpha.2

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.
@@ -26,7 +26,7 @@ function createDefaultStyle() {
26
26
  if (bound) throw new Error("configure must be called before the default style is used.");
27
27
  pending = options;
28
28
  }
29
- const styled = (0, _umber_style_core.withTagShorthands)(((tag, options) => getStyle().styled(tag, options)));
29
+ const styled = (0, _umber_style_core.withTagShorthands)(((tag, options) => (...args) => getStyle().styled(tag, options)(...args)));
30
30
  const StyleSheet = { create: ((styles) => typeof styles === "function" ? getStyle().StyleSheet.create(styles) : (0, _umber_style_core.createDeferredRecord)(styles, () => getStyle().StyleSheet.create(styles))) };
31
31
  const useStyle = ((sheet) => getStyle().useStyle(sheet));
32
32
  function useTheme() {
@@ -26,7 +26,7 @@ function createDefaultStyle() {
26
26
  if (bound) throw new Error("configure must be called before the default style is used.");
27
27
  pending = options;
28
28
  }
29
- const styled = withTagShorthands(((tag, options) => getStyle().styled(tag, options)));
29
+ const styled = withTagShorthands(((tag, options) => (...args) => getStyle().styled(tag, options)(...args)));
30
30
  const StyleSheet = { create: ((styles) => typeof styles === "function" ? getStyle().StyleSheet.create(styles) : createDeferredRecord(styles, () => getStyle().StyleSheet.create(styles))) };
31
31
  const useStyle = ((sheet) => getStyle().useStyle(sheet));
32
32
  function useTheme() {
@@ -18,7 +18,7 @@ function createDefaultStyle() {
18
18
  if (bound) throw new Error("configure must be called before the default style is used.");
19
19
  pending = options;
20
20
  }
21
- const styled = (0, _umber_style_core.withTagShorthands)(((tag, options) => getStyle().styled(tag, options)));
21
+ const styled = (0, _umber_style_core.withTagShorthands)(((tag, options) => (...args) => getStyle().styled(tag, options)(...args)));
22
22
  const StyleSheet = { create: ((styles) => typeof styles === "function" ? getStyle().StyleSheet.create(styles) : (0, _umber_style_core.createDeferredRecord)(styles, () => getStyle().StyleSheet.create(styles))) };
23
23
  const useStyle = ((sheet) => getStyle().useStyle(sheet));
24
24
  function useTheme() {
@@ -18,7 +18,7 @@ function createDefaultStyle() {
18
18
  if (bound) throw new Error("configure must be called before the default style is used.");
19
19
  pending = options;
20
20
  }
21
- const styled = withTagShorthands(((tag, options) => getStyle().styled(tag, options)));
21
+ const styled = withTagShorthands(((tag, options) => (...args) => getStyle().styled(tag, options)(...args)));
22
22
  const StyleSheet = { create: ((styles) => typeof styles === "function" ? getStyle().StyleSheet.create(styles) : createDeferredRecord(styles, () => getStyle().StyleSheet.create(styles))) };
23
23
  const useStyle = ((sheet) => getStyle().useStyle(sheet));
24
24
  function useTheme() {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { add, alpha, at, divide, multiply, negate, subtract } from "@umber-style/core";
2
- import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.cjs";
2
+ import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CreateStyledComponent, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.cjs";
3
3
  import { CacheProvider } from "./CacheProvider.cjs";
4
4
  import { MediaQueryOptions, useMediaQuery } from "./useMediaQuery.cjs";
5
5
  import { bindEngine, createStyle } from "./createStyle.cjs";
@@ -25,4 +25,4 @@ export declare const configure: (options: DefaultStyleOptions) => void, getEngin
25
25
  (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").GlobalStyles<Theme>;
26
26
  (styles: import("@umber-style/core").GlobalStylesInput<Theme>): import("@umber-style/core").GlobalStyles<Theme>;
27
27
  }, Global: (props: GlobalProps<Theme>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
28
- export { type AlphaColor, type CSSObject, CacheProvider, CacheProviderProps, type ComponentSelector, CreateStyled, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type MediaQueryOptions, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract, useMediaQuery };
28
+ export { type AlphaColor, type CSSObject, CacheProvider, CacheProviderProps, type ComponentSelector, CreateStyled, CreateStyledComponent, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type MediaQueryOptions, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract, useMediaQuery };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.mjs";
1
+ import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CreateStyledComponent, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.mjs";
2
2
  import { add, alpha, at, divide, multiply, negate, subtract } from "@umber-style/core";
3
3
  import { CacheProvider } from "./CacheProvider.mjs";
4
4
  import { MediaQueryOptions, useMediaQuery } from "./useMediaQuery.mjs";
@@ -25,4 +25,4 @@ export declare const configure: (options: DefaultStyleOptions) => void, getEngin
25
25
  (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").GlobalStyles<Theme>;
26
26
  (styles: import("@umber-style/core").GlobalStylesInput<Theme>): import("@umber-style/core").GlobalStyles<Theme>;
27
27
  }, Global: (props: GlobalProps<Theme>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
28
- export { type AlphaColor, type CSSObject, CacheProvider, CacheProviderProps, type ComponentSelector, CreateStyled, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type MediaQueryOptions, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract, useMediaQuery };
28
+ export { type AlphaColor, type CSSObject, CacheProvider, CacheProviderProps, type ComponentSelector, CreateStyled, CreateStyledComponent, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type MediaQueryOptions, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract, useMediaQuery };
@@ -1,5 +1,5 @@
1
1
  import { add, alpha, at, divide, multiply, negate, subtract } from "@umber-style/core";
2
- import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.cjs";
2
+ import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CreateStyledComponent, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.cjs";
3
3
  import { bindEngine, createStyle } from "./createStyle.server.cjs";
4
4
  import { createDefaultStyle } from "./defaultStyle.server.cjs";
5
5
  export declare const configure: (options: DefaultStyleOptions) => void, getEngine: () => import("@umber-style/core").Engine<Theme>, styled: Styled<Theme>, StyleSheet: {
@@ -23,4 +23,4 @@ export declare const configure: (options: DefaultStyleOptions) => void, getEngin
23
23
  (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").GlobalStyles<Theme>;
24
24
  (styles: import("@umber-style/core").GlobalStylesInput<Theme>): import("@umber-style/core").GlobalStyles<Theme>;
25
25
  }, Global: (props: GlobalProps<Theme>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
26
- export { type AlphaColor, type CSSObject, CacheProviderProps, type ComponentSelector, CreateStyled, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract };
26
+ export { type AlphaColor, type CSSObject, CacheProviderProps, type ComponentSelector, CreateStyled, CreateStyledComponent, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract };
@@ -1,4 +1,4 @@
1
- import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.mjs";
1
+ import { AlphaColor, CSSObject, CacheProviderProps, ComponentSelector, CreateStyled, CreateStyledComponent, CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, GlobalInput, GlobalProps, GlobalStyleObject, GlobalStyles, Interpolation, InterpolationResult, Keyframes, KeyframesSteps, NestedKey, PropsOf, SchemeKey, SchemeName, SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, SheetEntry, StaticTemplateValue, Style, StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, TemplateValue, Theme, ThemeInput, ThemeKey, ThemeProviderProps, ThemeScopeProps, UmberCache, WebNested, WebProperties, WebStyle, WebStyleObject, WebThemeProviderProps } from "./types.mjs";
2
2
  import { add, alpha, at, divide, multiply, negate, subtract } from "@umber-style/core";
3
3
  import { bindEngine, createStyle } from "./createStyle.server.mjs";
4
4
  import { createDefaultStyle } from "./defaultStyle.server.mjs";
@@ -23,4 +23,4 @@ export declare const configure: (options: DefaultStyleOptions) => void, getEngin
23
23
  (template: TemplateStringsArray, ...values: import("@umber-style/core").TemplateValue<unknown, Theme>[]): import("@umber-style/core").GlobalStyles<Theme>;
24
24
  (styles: import("@umber-style/core").GlobalStylesInput<Theme>): import("@umber-style/core").GlobalStyles<Theme>;
25
25
  }, Global: (props: GlobalProps<Theme>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
26
- export { type AlphaColor, type CSSObject, CacheProviderProps, type ComponentSelector, CreateStyled, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract };
26
+ export { type AlphaColor, type CSSObject, CacheProviderProps, type ComponentSelector, CreateStyled, CreateStyledComponent, type CssArgument, CssFunction, DefaultStyleOptions, FilteringStyledOptions, type GlobalInput, GlobalProps, type GlobalStyleObject, type GlobalStyles, Interpolation, type InterpolationResult, type Keyframes, type KeyframesSteps, type NestedKey, PropsOf, type SchemeKey, type SchemeName, type SerializedStyles, ServerStyle, ServerStyleOptions, SheetDefinition, type SheetEntry, type StaticTemplateValue, Style, type StyleObject, StyleOptions, StyleProp, Styled, StyledCall, StyledComponent, StyledFactory, StyledOptions, StyledStatics, StyledTags, type TemplateValue, Theme, type ThemeInput, type ThemeKey, ThemeProviderProps, ThemeScopeProps, type UmberCache, type WebNested, type WebProperties, WebStyle, type WebStyleObject, WebThemeProviderProps, add, alpha, at, bindEngine, createDefaultStyle, createStyle, divide, multiply, negate, subtract };
package/dist/types.d.cts CHANGED
@@ -35,8 +35,12 @@ export interface DefaultStyleOptions extends BindingOptions<Theme>, ServerStyleO
35
35
  /** The base theme, for an app that has no provider at all. */
36
36
  theme?: Theme;
37
37
  }
38
- /** The options of `styled(tag, options)`: the label of the class, which props reach the element, and a class of your own. */
39
- export interface StyledOptions extends StylerOptions {
38
+ /**
39
+ * The options of `styled(tag, options)`: the label of the class, which props reach the element, and a class
40
+ * of your own. `_Props`, the props of the tag, changes nothing: it lets a wrapper of `styled` write
41
+ * `StyledOptions<ComponentProps<C>>` next to `FilteringStyledOptions<ComponentProps<C>, Forwarded>`.
42
+ */
43
+ export interface StyledOptions<_Props = unknown> extends StylerOptions {
40
44
  /**
41
45
  * Whether a prop is forwarded to a string tag. It replaces the default, which forwards the attributes
42
46
  * of HTML and SVG (by their React names), `data-*`, `aria-*`, event handlers and React's own props, and
@@ -55,7 +59,7 @@ export interface StyledOptions extends StylerOptions {
55
59
  * `StyledOptions` whose `shouldForwardProp` is a type guard: the props of the tag that a styled component
56
60
  * then takes are only the ones it names, `Forwarded`.
57
61
  */
58
- export interface FilteringStyledOptions<Props = Record<string, unknown>, Forwarded extends keyof Props & string = keyof Props & string> extends StyledOptions {
62
+ export interface FilteringStyledOptions<Props = Record<string, unknown>, Forwarded extends keyof Props & string = keyof Props & string> extends StyledOptions<Props> {
59
63
  /** A type guard of the props that are forwarded to a string tag: the component takes only the props of the tag that it names. */
60
64
  shouldForwardProp?: (prop: string) => prop is Forwarded;
61
65
  }
@@ -92,17 +96,31 @@ export type StyledComponent<C extends ElementType, P extends object, Base extend
92
96
  as?: ElementType;
93
97
  style?: StyleProp;
94
98
  }> & StyledStatics;
99
+ /** The props that a function style reads: the props of the tag `Base`, with the component's own `P` over them. */
100
+ type StyleFunctionProps<Base extends object, P extends object> = Omit<Base, keyof P> & P;
101
+ /** The props that the element of a styled component takes: those of the component, of the tag, and the ones only the element takes. */
102
+ type ElementProps<ComponentProps extends object, SpecificComponentProps extends object, JSXProps extends object> = ComponentProps & SpecificComponentProps & JSXProps;
95
103
  /**
96
- * What `styled(tag, options)` returns: it takes the styles and makes the component, or is used as a tag,
97
- * whose template is one style (a function of the props when an interpolation is a function).
104
+ * What `styled(tag, options)` returns, in the form that a wrapper of `styled` names it: the props of the
105
+ * component are `ComponentProps` and `SpecificComponentProps` (a wrapper puts its own, such as `theme`, in
106
+ * the first, and the props of the tag in the second), and `JSXProps` are props that only the element takes
107
+ * (`ref`). It takes the styles and makes the component, or is used as a tag, whose template is one style.
108
+ * The props of the component's own are a type argument, `AdditionalProps`. A function style reads all of
109
+ * them, the component's own over the others, and `theme`, the theme `T`.
98
110
  */
99
- export interface StyledFactory<T, C extends ElementType, Base extends object = ComponentProps<C>> {
100
- <P extends object = object>(style: (props: P & {
111
+ export interface CreateStyledComponent<ComponentProps extends object, SpecificComponentProps extends object = object, JSXProps extends object = object, T = Theme> {
112
+ <AdditionalProps extends object = object>(style: (props: StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps> & {
101
113
  theme: T;
102
- }) => InterpolationResult$1, ...styles: Interpolation<P, T>[]): StyledComponent<C, P, Base>;
103
- <P extends object = object>(template: TemplateStringsArray, ...values: TemplateValue$1<NoInfer<P>, T>[]): StyledComponent<C, P, Base>;
104
- <P extends object = object>(...styles: Interpolation<P, T>[]): StyledComponent<C, P, Base>;
114
+ }) => InterpolationResult$1, ...styles: Interpolation<StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps>, T>[]): StyledComponent<ElementType, AdditionalProps, ElementProps<ComponentProps, SpecificComponentProps, JSXProps>>;
115
+ <AdditionalProps extends object = object>(template: TemplateStringsArray, ...values: TemplateValue$1<NoInfer<StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps>>, T>[]): StyledComponent<ElementType, AdditionalProps, ElementProps<ComponentProps, SpecificComponentProps, JSXProps>>;
116
+ <AdditionalProps extends object = object>(...styles: Interpolation<StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps>, T>[]): StyledComponent<ElementType, AdditionalProps, ElementProps<ComponentProps, SpecificComponentProps, JSXProps>>;
105
117
  }
118
+ /**
119
+ * What `styled(tag, options)` returns for the theme `T` and the tag `C`, whose props the component takes
120
+ * (`Base`: all of them, unless a `shouldForwardProp` type guard named some): `CreateStyledComponent` with
121
+ * the props of the tag.
122
+ */
123
+ export type StyledFactory<T, C extends ElementType, Base extends object = ComponentProps<C>> = CreateStyledComponent<object, Base, object, T>;
106
124
  /** The shorthand of each HTML and SVG tag: `styled.div(...styles)` is `styled('div')(...styles)`. */
107
125
  export type StyledTags<T> = { readonly [K in keyof JSX.IntrinsicElements]: StyledFactory<T, K>; };
108
126
  /** `styled(tag, options)`: with a `shouldForwardProp` type guard, the component takes only the props of `tag` that it names. */
@@ -126,13 +144,28 @@ export interface SheetDefinition<S extends SheetStyles, E> {
126
144
  /** Never set at run time: it only carries the types. */
127
145
  readonly entries?: { [K in keyof S]: E; };
128
146
  }
147
+ /**
148
+ * What the `theme` of a provider of the theme `T` takes: `ThemeInput<T>`. The `Theme` of the default style
149
+ * has no member of its own until an app declares its members in it, and until then no theme of the app
150
+ * would match it (TypeScript rejects an object that shares no member with a type whose members are all
151
+ * optional); so while it has none, the provider takes any theme object, or a function of the theme above
152
+ * whose parameter the app types (`(outer: AppTheme) => AppTheme`).
153
+ */
154
+ type ProviderThemeInput<T> = [Exclude<keyof T, '_theme'>] extends [never] ? object | UntypedThemeFunction['derive'] : ThemeInput$1<T>;
155
+ /**
156
+ * The function form of `ProviderThemeInput` for a theme with no members: its parameter is compared both
157
+ * ways, as a method's is, so a function whose parameter the app types as its own theme is taken.
158
+ */
159
+ interface UntypedThemeFunction {
160
+ derive(outer: object): object;
161
+ }
129
162
  /** The props of `ThemeProvider`: the theme of the subtree, and on the web its color scheme and wrapper. */
130
163
  export interface ThemeProviderProps<T> {
131
164
  /**
132
165
  * The theme, or the part of it that this subtree changes; or a function of the theme above (the base
133
166
  * theme, or an empty object, for the outermost provider) that returns it. It is merged over the theme above.
134
167
  */
135
- readonly theme: ThemeInput$1<T>;
168
+ readonly theme: ProviderThemeInput<T>;
136
169
  /** Web only. */
137
170
  readonly colorScheme?: ColorScheme;
138
171
  /** Web only: a class of the wrapper of a nested provider. */
package/dist/types.d.mts CHANGED
@@ -35,8 +35,12 @@ export interface DefaultStyleOptions extends BindingOptions<Theme>, ServerStyleO
35
35
  /** The base theme, for an app that has no provider at all. */
36
36
  theme?: Theme;
37
37
  }
38
- /** The options of `styled(tag, options)`: the label of the class, which props reach the element, and a class of your own. */
39
- export interface StyledOptions extends StylerOptions {
38
+ /**
39
+ * The options of `styled(tag, options)`: the label of the class, which props reach the element, and a class
40
+ * of your own. `_Props`, the props of the tag, changes nothing: it lets a wrapper of `styled` write
41
+ * `StyledOptions<ComponentProps<C>>` next to `FilteringStyledOptions<ComponentProps<C>, Forwarded>`.
42
+ */
43
+ export interface StyledOptions<_Props = unknown> extends StylerOptions {
40
44
  /**
41
45
  * Whether a prop is forwarded to a string tag. It replaces the default, which forwards the attributes
42
46
  * of HTML and SVG (by their React names), `data-*`, `aria-*`, event handlers and React's own props, and
@@ -55,7 +59,7 @@ export interface StyledOptions extends StylerOptions {
55
59
  * `StyledOptions` whose `shouldForwardProp` is a type guard: the props of the tag that a styled component
56
60
  * then takes are only the ones it names, `Forwarded`.
57
61
  */
58
- export interface FilteringStyledOptions<Props = Record<string, unknown>, Forwarded extends keyof Props & string = keyof Props & string> extends StyledOptions {
62
+ export interface FilteringStyledOptions<Props = Record<string, unknown>, Forwarded extends keyof Props & string = keyof Props & string> extends StyledOptions<Props> {
59
63
  /** A type guard of the props that are forwarded to a string tag: the component takes only the props of the tag that it names. */
60
64
  shouldForwardProp?: (prop: string) => prop is Forwarded;
61
65
  }
@@ -92,17 +96,31 @@ export type StyledComponent<C extends ElementType, P extends object, Base extend
92
96
  as?: ElementType;
93
97
  style?: StyleProp;
94
98
  }> & StyledStatics;
99
+ /** The props that a function style reads: the props of the tag `Base`, with the component's own `P` over them. */
100
+ type StyleFunctionProps<Base extends object, P extends object> = Omit<Base, keyof P> & P;
101
+ /** The props that the element of a styled component takes: those of the component, of the tag, and the ones only the element takes. */
102
+ type ElementProps<ComponentProps extends object, SpecificComponentProps extends object, JSXProps extends object> = ComponentProps & SpecificComponentProps & JSXProps;
95
103
  /**
96
- * What `styled(tag, options)` returns: it takes the styles and makes the component, or is used as a tag,
97
- * whose template is one style (a function of the props when an interpolation is a function).
104
+ * What `styled(tag, options)` returns, in the form that a wrapper of `styled` names it: the props of the
105
+ * component are `ComponentProps` and `SpecificComponentProps` (a wrapper puts its own, such as `theme`, in
106
+ * the first, and the props of the tag in the second), and `JSXProps` are props that only the element takes
107
+ * (`ref`). It takes the styles and makes the component, or is used as a tag, whose template is one style.
108
+ * The props of the component's own are a type argument, `AdditionalProps`. A function style reads all of
109
+ * them, the component's own over the others, and `theme`, the theme `T`.
98
110
  */
99
- export interface StyledFactory<T, C extends ElementType, Base extends object = ComponentProps<C>> {
100
- <P extends object = object>(style: (props: P & {
111
+ export interface CreateStyledComponent<ComponentProps extends object, SpecificComponentProps extends object = object, JSXProps extends object = object, T = Theme> {
112
+ <AdditionalProps extends object = object>(style: (props: StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps> & {
101
113
  theme: T;
102
- }) => InterpolationResult$1, ...styles: Interpolation<P, T>[]): StyledComponent<C, P, Base>;
103
- <P extends object = object>(template: TemplateStringsArray, ...values: TemplateValue$1<NoInfer<P>, T>[]): StyledComponent<C, P, Base>;
104
- <P extends object = object>(...styles: Interpolation<P, T>[]): StyledComponent<C, P, Base>;
114
+ }) => InterpolationResult$1, ...styles: Interpolation<StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps>, T>[]): StyledComponent<ElementType, AdditionalProps, ElementProps<ComponentProps, SpecificComponentProps, JSXProps>>;
115
+ <AdditionalProps extends object = object>(template: TemplateStringsArray, ...values: TemplateValue$1<NoInfer<StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps>>, T>[]): StyledComponent<ElementType, AdditionalProps, ElementProps<ComponentProps, SpecificComponentProps, JSXProps>>;
116
+ <AdditionalProps extends object = object>(...styles: Interpolation<StyleFunctionProps<ComponentProps & SpecificComponentProps, AdditionalProps>, T>[]): StyledComponent<ElementType, AdditionalProps, ElementProps<ComponentProps, SpecificComponentProps, JSXProps>>;
105
117
  }
118
+ /**
119
+ * What `styled(tag, options)` returns for the theme `T` and the tag `C`, whose props the component takes
120
+ * (`Base`: all of them, unless a `shouldForwardProp` type guard named some): `CreateStyledComponent` with
121
+ * the props of the tag.
122
+ */
123
+ export type StyledFactory<T, C extends ElementType, Base extends object = ComponentProps<C>> = CreateStyledComponent<object, Base, object, T>;
106
124
  /** The shorthand of each HTML and SVG tag: `styled.div(...styles)` is `styled('div')(...styles)`. */
107
125
  export type StyledTags<T> = { readonly [K in keyof JSX.IntrinsicElements]: StyledFactory<T, K>; };
108
126
  /** `styled(tag, options)`: with a `shouldForwardProp` type guard, the component takes only the props of `tag` that it names. */
@@ -126,13 +144,28 @@ export interface SheetDefinition<S extends SheetStyles, E> {
126
144
  /** Never set at run time: it only carries the types. */
127
145
  readonly entries?: { [K in keyof S]: E; };
128
146
  }
147
+ /**
148
+ * What the `theme` of a provider of the theme `T` takes: `ThemeInput<T>`. The `Theme` of the default style
149
+ * has no member of its own until an app declares its members in it, and until then no theme of the app
150
+ * would match it (TypeScript rejects an object that shares no member with a type whose members are all
151
+ * optional); so while it has none, the provider takes any theme object, or a function of the theme above
152
+ * whose parameter the app types (`(outer: AppTheme) => AppTheme`).
153
+ */
154
+ type ProviderThemeInput<T> = [Exclude<keyof T, '_theme'>] extends [never] ? object | UntypedThemeFunction['derive'] : ThemeInput$1<T>;
155
+ /**
156
+ * The function form of `ProviderThemeInput` for a theme with no members: its parameter is compared both
157
+ * ways, as a method's is, so a function whose parameter the app types as its own theme is taken.
158
+ */
159
+ interface UntypedThemeFunction {
160
+ derive(outer: object): object;
161
+ }
129
162
  /** The props of `ThemeProvider`: the theme of the subtree, and on the web its color scheme and wrapper. */
130
163
  export interface ThemeProviderProps<T> {
131
164
  /**
132
165
  * The theme, or the part of it that this subtree changes; or a function of the theme above (the base
133
166
  * theme, or an empty object, for the outermost provider) that returns it. It is merged over the theme above.
134
167
  */
135
- readonly theme: ThemeInput$1<T>;
168
+ readonly theme: ProviderThemeInput<T>;
136
169
  /** Web only. */
137
170
  readonly colorScheme?: ColorScheme;
138
171
  /** Web only: a class of the wrapper of a nested provider. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umber-style/react",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "UmberStyle for React: styled, ThemeProvider, useTheme, StyleSheet, useStyle and apply, with a server build for server components.",
5
5
  "keywords": [
6
6
  "styling",
@@ -54,7 +54,7 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@umber-style/core": "0.1.0-alpha.4"
57
+ "@umber-style/core": "0.1.0-alpha.5"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "^19.2.8"