@pyreon/rocketstyle 0.1.2 → 0.2.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/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { VNode, VNodeChild } from "@pyreon/core";
1
+ import { VNodeChild } from "@pyreon/core";
2
2
  import { config, context, render } from "@pyreon/ui-core";
3
3
 
4
4
  //#region src/context/context.d.ts
@@ -7,7 +7,7 @@ type Theme$1 = {
7
7
  breakpoints?: Record<string, number>;
8
8
  } & Record<string, unknown>;
9
9
  type TProvider = {
10
- children: VNode | VNode[] | null;
10
+ children: VNodeChild;
11
11
  theme?: Theme$1 | undefined;
12
12
  mode?: "light" | "dark" | undefined;
13
13
  inversed?: boolean | undefined;
@@ -18,13 +18,13 @@ type TProvider = {
18
18
  * Reads the parent context, merges incoming props, and resolves
19
19
  * the active mode (with optional inversion for nested dark/light switching).
20
20
  *
21
- * In Pyreon, context is provided via pushContext/popContext instead of React.Provider.
21
+ * In Pyreon, context is provided via provide() instead of React.Provider.
22
22
  */
23
23
  declare const Provider: ({
24
24
  provider,
25
25
  inversed,
26
26
  ...props
27
- }: TProvider) => VNode | null;
27
+ }: TProvider) => VNodeChild;
28
28
  //#endregion
29
29
  //#region src/constants/defaultDimensions.d.ts
30
30
  /**
@@ -72,7 +72,7 @@ type TObj = Record<string, unknown>;
72
72
  type TFn = (...args: any) => any;
73
73
  type CallBackParam = TObj | TFn;
74
74
  /** In Pyreon, components are plain functions — no forwardRef needed. */
75
- type ComponentFn<P = any> = ((props: P) => VNode | null) & Partial<Record<string, any>>;
75
+ type ComponentFn<P = any> = ((props: P) => VNodeChild) & Partial<Record<string, any>>;
76
76
  type ElementType<T extends TObj | unknown = any> = ComponentFn<T>;
77
77
  type ValueOf<T> = T[keyof T];
78
78
  type ArrayOfValues<T> = T[keyof T][];
@@ -232,7 +232,7 @@ type RocketStyleComponent<OA extends TObj = {}, EA extends TObj = {}, T extends
232
232
  * @param DFP Calculated final component props
233
233
  */
234
234
  interface IRocketStyleComponent<OA extends TObj = {}, EA extends TObj = {}, T extends TObj = {}, CSS extends TObj = {}, S extends TObj = {}, HOC extends TObj = {}, D extends Dimensions = Dimensions, UB extends boolean = boolean, DKP extends TDKP = TDKP, DFP = MergeTypes<[OA, EA, DefaultProps, ExtractDimensionProps<D, DKP, UB>]>> {
235
- (props: DFP): VNode | null;
235
+ (props: DFP): VNodeChild;
236
236
  config: <NC extends ElementType | unknown = unknown>({
237
237
  name,
238
238
  component: NC,
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext, onUnmount, popContext, pushContext, useContext } from "@pyreon/core";
1
+ import { createContext, provide, useContext } from "@pyreon/core";
2
2
  import { Provider as Provider$1, compose, config, context, get, hoistNonReactStatics, isEmpty, merge, omit, pick, render, set } from "@pyreon/ui-core";
3
3
  import { signal } from "@pyreon/reactivity";
4
4
 
@@ -53,7 +53,7 @@ const ALL_RESERVED_KEYS = [
53
53
  * Reads the parent context, merges incoming props, and resolves
54
54
  * the active mode (with optional inversion for nested dark/light switching).
55
55
  *
56
- * In Pyreon, context is provided via pushContext/popContext instead of React.Provider.
56
+ * In Pyreon, context is provided via provide() instead of React.Provider.
57
57
  */
58
58
  const Provider = ({ provider = Provider$1, inversed, ...props }) => {
59
59
  const { theme, mode, provider: RocketstyleProvider, children } = {
@@ -140,8 +140,8 @@ const useLocalContext = (consumer) => {
140
140
  * detecting pseudo-states (hover, focus, pressed) via mouse/focus events
141
141
  * and broadcasting them through local context to child rocketstyle components.
142
142
  *
143
- * In Pyreon, context is provided via pushContext/popContext, and state is
144
- * managed with signals instead of useState.
143
+ * In Pyreon, context is provided via provide(), and state is managed
144
+ * with signals instead of useState.
145
145
  */
146
146
  const createLocalProvider = (WrappedComponent) => {
147
147
  const HOCComponent = ({ onMouseEnter, onMouseLeave, onMouseUp, onMouseDown, onFocus, onBlur, $rocketstate, ...props }) => {
@@ -187,8 +187,7 @@ const createLocalProvider = (WrappedComponent) => {
187
187
  ...pseudoState()
188
188
  }
189
189
  };
190
- pushContext(new Map([[localContext.id, updatedState]]));
191
- onUnmount(() => popContext());
190
+ provide(localContext, updatedState);
192
191
  return WrappedComponent({
193
192
  ...props,
194
193
  ...events,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/rocketstyle",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/pyreon/ui-system",
@@ -43,8 +43,8 @@
43
43
  "peerDependencies": {
44
44
  "@pyreon/core": ">=0.4.0 <1.0.0",
45
45
  "@pyreon/reactivity": ">=0.4.0 <1.0.0",
46
- "@pyreon/ui-core": ">=0.1.2",
47
- "@pyreon/styler": ">=0.1.2"
46
+ "@pyreon/ui-core": ">=0.2.0",
47
+ "@pyreon/styler": ">=0.2.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@vitus-labs/tools-rolldown": "^1.15.3",