@vitus-labs/rocketstyle 1.4.3-alpha.9 → 2.0.0-alpha.10

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/lib/index.d.ts CHANGED
@@ -38,6 +38,25 @@ declare const DEFAULT_DIMENSIONS: {
38
38
  };
39
39
  type DefaultDimensions = typeof DEFAULT_DIMENSIONS;
40
40
  //#endregion
41
+ //#region src/types/pseudo.d.ts
42
+ type PseudoActions = {
43
+ onMouseEnter: MouseEventHandler;
44
+ onMouseLeave: MouseEventHandler;
45
+ onMouseDown: MouseEventHandler;
46
+ onMouseUp: MouseEventHandler;
47
+ onFocus: FocusEventHandler;
48
+ onBlur: FocusEventHandler;
49
+ };
50
+ type PseudoState = {
51
+ active: boolean;
52
+ hover: boolean;
53
+ focus: boolean;
54
+ pressed: boolean;
55
+ disabled: boolean;
56
+ readOnly: boolean;
57
+ };
58
+ type PseudoProps = Partial<PseudoState & PseudoActions>;
59
+ //#endregion
41
60
  //#region src/types/utils.d.ts
42
61
  type TObj = Record<string, unknown>;
43
62
  type TFn = (...args: any) => any;
@@ -65,7 +84,27 @@ type ExtractProps<TComponentOrTProps> = TComponentOrTProps extends ComponentType
65
84
  interface StylesDefault {}
66
85
  type Styles<S> = S extends unknown ? StylesDefault : MergeTypes<[StylesDefault, S]>;
67
86
  type Css = typeof config.css;
68
- type StylesCb = (css: Css) => ReturnType<Css>;
87
+ /**
88
+ * Props available inside `.styles()` interpolation functions.
89
+ *
90
+ * - `$rocketstyle` — computed theme (inferred from `.theme()` chain)
91
+ * - `$rocketstate` — active dimension values + pseudo state
92
+ */
93
+ type RocketStyleInterpolationProps<CSS extends TObj = TObj> = {
94
+ $rocketstyle: CSS;
95
+ $rocketstate: Record<string, string | string[]> & {
96
+ pseudo: Partial<PseudoState>;
97
+ };
98
+ } & Record<string, any>;
99
+ /**
100
+ * A tagged-template css function whose interpolation functions
101
+ * receive typed props including `$rocketstyle` and `$rocketstate`.
102
+ *
103
+ * When used via `.styles()`, `CSS` is inferred from the chain's
104
+ * accumulated `.theme()` calls, so both props are typed automatically.
105
+ */
106
+ type RocketCss<CSS extends TObj = TObj> = (strings: TemplateStringsArray, ...values: Array<string | number | boolean | null | undefined | ((props: RocketStyleInterpolationProps<CSS>) => any) | any[]>) => any;
107
+ type StylesCb<CSS extends TObj = TObj> = (css: RocketCss<CSS>) => ReturnType<Css>;
69
108
  type StylesCbArray = StylesCb[];
70
109
  //#endregion
71
110
  //#region src/constants/index.d.ts
@@ -107,25 +146,6 @@ type DimensionBooleanAttrs<DKP extends TDKP> = Partial<Record<ValueOf<DimensionT
107
146
  type ExtractDimensionProps<D extends Dimensions, DKP extends TDKP, UB extends boolean> = UB extends true ? Partial<ExtractNullableDimensionKeys<DimensionObjAttrs<D, DKP> & DimensionBooleanAttrs<DKP>>> : Partial<ExtractNullableDimensionKeys<DimensionObjAttrs<D, DKP>>>;
108
147
  type ExtractDimensions<D extends Dimensions, DKP extends TDKP> = ExtractNullableDimensionKeys<DimensionObjAttrs<D, DKP>>;
109
148
  //#endregion
110
- //#region src/types/pseudo.d.ts
111
- type PseudoActions = {
112
- onMouseEnter: MouseEventHandler;
113
- onMouseLeave: MouseEventHandler;
114
- onMouseDown: MouseEventHandler;
115
- onMouseUp: MouseEventHandler;
116
- onFocus: FocusEventHandler;
117
- onBlur: FocusEventHandler;
118
- };
119
- type PseudoState = {
120
- active: boolean;
121
- hover: boolean;
122
- focus: boolean;
123
- pressed: boolean;
124
- disabled: boolean;
125
- readOnly: boolean;
126
- };
127
- type PseudoProps = Partial<PseudoState & PseudoActions>;
128
- //#endregion
129
149
  //#region src/types/config.d.ts
130
150
  type RocketComponentType = ElementType & {
131
151
  IS_ROCKETSTYLE: true;
@@ -345,7 +365,7 @@ interface IRocketStyleComponent<OA extends TObj = {}, EA extends TObj = {}, T ex
345
365
  * }))
346
366
  * ```
347
367
  */
348
- theme: <P extends TObj | unknown = unknown>(param: P extends TObj ? Partial<MergeTypes<[Styles<CSS>, P]>> | ThemeCb<MergeTypes<[Styles<CSS>, P]>, Theme<T>> : Partial<Styles<CSS>> | ThemeCb<Styles<CSS>, Theme<T>>) => P extends TObj ? RocketStyleComponent<OA, EA, T, MergeTypes<[CSS, P]>, S, HOC, D, UB, DKP> : RocketStyleComponent<OA, EA, T, CSS, S, HOC, D, UB, DKP>;
368
+ theme: <P extends TObj = {}>(param: Partial<P> | ThemeCb<P, Theme<T>>) => RocketStyleComponent<OA, EA, T, MergeTypes<[CSS, P]>, S, HOC, D, UB, DKP>;
349
369
  /**
350
370
  * A chaining method to define default rendered styles
351
371
  * @param param Callback of styled-components `css` function
@@ -358,7 +378,7 @@ interface IRocketStyleComponent<OA extends TObj = {}, EA extends TObj = {}, T ex
358
378
  * const newElement = base.styles(css => css``)
359
379
  * ```
360
380
  */
361
- styles: (param: StylesCb) => RocketStyleComponent<OA, EA, T, CSS, S, HOC, D, UB, DKP>;
381
+ styles: (param: StylesCb<CSS>) => RocketStyleComponent<OA, EA, T, CSS, S, HOC, D, UB, DKP>;
362
382
  /**
363
383
  * A chaining method to define high-order components to wrap
364
384
  * the defined component
@@ -553,5 +573,5 @@ declare const rocketstyle: Rocketstyle;
553
573
  type IsRocketComponent = <T>(component: T) => boolean;
554
574
  declare const isRocketComponent: IsRocketComponent;
555
575
  //#endregion
556
- export { type AttrsCb, type ComposeParam, type ConfigAttrs, type ConsumerCb, type ConsumerCtxCBValue, type ConsumerCtxCb, type DefaultProps, type DimensionCallbackParam, type DimensionProps, type DimensionValue, type Dimensions, type ElementType, type ExtractDimensionProps, type ExtractDimensions, type ExtractProps, type GenericHoc, type IRocketStyleComponent, type IsRocketComponent, type MergeTypes, Provider, type RocketComponentType, type RocketProviderState, type RocketStyleComponent, type Rocketstyle, type StylesCb, type StylesDefault, type TDKP, type TObj, type TProvider, type ThemeCb, type ThemeDefault, type ThemeMode, type ThemeModeCallback, type ThemeModeKeys, context, rocketstyle as default, rocketstyle, isRocketComponent };
576
+ export { type AttrsCb, type ComposeParam, type ConfigAttrs, type ConsumerCb, type ConsumerCtxCBValue, type ConsumerCtxCb, type DefaultProps, type DimensionCallbackParam, type DimensionProps, type DimensionValue, type Dimensions, type ElementType, type ExtractDimensionProps, type ExtractDimensions, type ExtractProps, type GenericHoc, type IRocketStyleComponent, type IsRocketComponent, type MergeTypes, Provider, type RocketComponentType, type RocketProviderState, type RocketStyleComponent, type RocketStyleInterpolationProps, type Rocketstyle, type StylesCb, type StylesDefault, type TDKP, type TObj, type TProvider, type ThemeCb, type ThemeDefault, type ThemeMode, type ThemeModeCallback, type ThemeModeKeys, context, rocketstyle as default, rocketstyle, isRocketComponent };
557
577
  //# sourceMappingURL=index2.d.ts.map
package/lib/index.js CHANGED
@@ -496,7 +496,7 @@ const rocketComponent = (options) => {
496
496
  useBooleans: options.useBooleans
497
497
  });
498
498
  const componentName = options.name ?? options.component.displayName ?? options.component.name;
499
- const STYLED_COMPONENT = component.IS_ROCKETSTYLE ?? options.styled !== true ? component : styled(component)`
499
+ const STYLED_COMPONENT = component.IS_ROCKETSTYLE ?? options.styled !== true ? component : styled(component, { boost: true })`
500
500
  ${calculateStyles(styles)};
501
501
  `;
502
502
  const RenderComponent = options.provider ? RocketStyleProviderComponent(STYLED_COMPONENT) : STYLED_COMPONENT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitus-labs/rocketstyle",
3
- "version": "1.4.3-alpha.9+6281beb",
3
+ "version": "2.0.0-alpha.10+4294ea0",
4
4
  "license": "MIT",
5
5
  "author": "Vit Bokisch <vit@bokisch.cz>",
6
6
  "maintainers": [
@@ -67,12 +67,12 @@
67
67
  "react": ">= 19"
68
68
  },
69
69
  "devDependencies": {
70
- "@vitus-labs/core": "1.4.3-alpha.9+6281beb",
71
- "@vitus-labs/elements": "1.4.3-alpha.9+6281beb",
70
+ "@vitus-labs/core": "2.0.0-alpha.10+4294ea0",
71
+ "@vitus-labs/elements": "2.0.0-alpha.10+4294ea0",
72
72
  "@vitus-labs/tools-rolldown": "^1.6.0",
73
73
  "@vitus-labs/tools-storybook": "^1.6.0",
74
74
  "@vitus-labs/tools-typescript": "^1.6.0",
75
- "@vitus-labs/unistyle": "1.4.3-alpha.9+6281beb"
75
+ "@vitus-labs/unistyle": "2.0.0-alpha.10+4294ea0"
76
76
  },
77
- "gitHead": "6281beb4302b5114c847fea02d01412cc81865ab"
77
+ "gitHead": "4294ea016cabeb1b0b649c34d31dbcdf362904ac"
78
78
  }