@aweebit/react-essentials 0.10.3 → 0.10.4

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 CHANGED
@@ -20,7 +20,7 @@
20
20
  const useEventListener: UseEventListener;
21
21
  ```
22
22
 
23
- Defined in: [hooks/useEventListener.ts:135](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L135)
23
+ Defined in: [hooks/useEventListener.ts:135](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L135)
24
24
 
25
25
  Adds `handler` as a listener for the event `eventName` of `target` with the
26
26
  provided `options` applied
@@ -71,7 +71,7 @@ function useReducerWithDeps<S, A>(
71
71
  ): [S, ActionDispatch<A>];
72
72
  ```
73
73
 
74
- Defined in: [hooks/useReducerWithDeps.ts:59](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useReducerWithDeps.ts#L59)
74
+ Defined in: [hooks/useReducerWithDeps.ts:59](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useReducerWithDeps.ts#L59)
75
75
 
76
76
  `useReducer` hook with an additional dependency array `deps` that resets the
77
77
  state to `initialState` when dependencies change
@@ -214,7 +214,7 @@ function useStateWithDeps<S>(
214
214
  ): [S, Dispatch<SetStateAction<S>>];
215
215
  ```
216
216
 
217
- Defined in: [hooks/useStateWithDeps.ts:62](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useStateWithDeps.ts#L62)
217
+ Defined in: [hooks/useStateWithDeps.ts:62](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useStateWithDeps.ts#L62)
218
218
 
219
219
  `useState` hook with an additional dependency array `deps` that resets the
220
220
  state to `initialState` when dependencies change
@@ -341,10 +341,10 @@ Dependencies that reset the state to `initialState`
341
341
  ## contextualize()
342
342
 
343
343
  ```ts
344
- function contextualize(jsx): ContextualizePipe;
344
+ function contextualize(children): ContextualizePipe;
345
345
  ```
346
346
 
347
- Defined in: [misc/contextualize.tsx:79](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/contextualize.tsx#L79)
347
+ Defined in: [misc/contextualize.tsx:79](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/contextualize.tsx#L79)
348
348
 
349
349
  An alternative way to provide context values to component trees that avoids
350
350
  ever-increasing indentation
@@ -400,17 +400,17 @@ return contextualize(jsx)
400
400
  <tr>
401
401
  <td>
402
402
 
403
- `jsx`
403
+ `children`
404
404
 
405
405
  </td>
406
406
  <td>
407
407
 
408
- `Element`
408
+ `ReactNode`
409
409
 
410
410
  </td>
411
411
  <td>
412
412
 
413
- The JSX to contextualize
413
+ The children to contextualize
414
414
 
415
415
  </td>
416
416
  </tr>
@@ -425,8 +425,8 @@ An object with the following properties:
425
425
 
426
426
  - `with`: a function that accepts a context `Context` and a value `value` for
427
427
  it as arguments and returns
428
- `contextualize(<Context.Provider value={value}>{jsx}</Context.Provider>)`
429
- - `end`: a function that returns `jsx`
428
+ `contextualize(<Context.Provider value={value}>{children}</Context.Provider>)`
429
+ - `end`: a function that returns `children`
430
430
 
431
431
  ### See
432
432
 
@@ -444,7 +444,7 @@ function createSafeContext<T>(): <DisplayName>(displayName) => {
444
444
  };
445
445
  ```
446
446
 
447
- Defined in: [misc/createSafeContext.ts:62](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/createSafeContext.ts#L62)
447
+ Defined in: [misc/createSafeContext.ts:62](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/createSafeContext.ts#L62)
448
448
 
449
449
  For a given type `T`, returns a function that produces both a context of that
450
450
  type and a hook that returns the current context value if one was provided,
@@ -586,10 +586,10 @@ A function that accepts a single string argument `displayName` (e.g.
586
586
  ## wrapJSX()
587
587
 
588
588
  ```ts
589
- function wrapJSX(jsx): JSXWrapPipe;
589
+ function wrapJSX(children): JSXWrapPipe;
590
590
  ```
591
591
 
592
- Defined in: [misc/wrapJSX.tsx:93](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/wrapJSX.tsx#L93)
592
+ Defined in: [misc/wrapJSX.tsx:94](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/wrapJSX.tsx#L94)
593
593
 
594
594
  An alternative way to compose JSX that avoids ever-increasing indentation
595
595
 
@@ -643,17 +643,17 @@ createRoot(document.getElementById('root')!).render(
643
643
  <tr>
644
644
  <td>
645
645
 
646
- `jsx`
646
+ `children`
647
647
 
648
648
  </td>
649
649
  <td>
650
650
 
651
- `Element`
651
+ `ReactNode`
652
652
 
653
653
  </td>
654
654
  <td>
655
655
 
656
- The JSX to wrap
656
+ The children to wrap
657
657
 
658
658
  </td>
659
659
  </tr>
@@ -668,8 +668,8 @@ An object with the following properties:
668
668
 
669
669
  - `with`: a function that accepts a component `Component` and props `props`
670
670
  for it as arguments and returns
671
- `wrapJSX(<Component {...props}>{jsx}</Component>)`
672
- - `end`: a function that returns `jsx`
671
+ `wrapJSX(<Component {...props}>{children}</Component>)`
672
+ - `end`: a function that returns `children`
673
673
 
674
674
  ### See
675
675
 
@@ -685,7 +685,7 @@ type UseEventListener = UseEventListenerWithImplicitWindowTarget &
685
685
  UseEventListenerWithAnyExplicitTarget;
686
686
  ```
687
687
 
688
- Defined in: [hooks/useEventListener.ts:12](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L12)
688
+ Defined in: [hooks/useEventListener.ts:12](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L12)
689
689
 
690
690
  The type of [`useEventListener`](#useeventlistener)
691
691
 
@@ -704,7 +704,7 @@ The type of [`useEventListener`](#useeventlistener)
704
704
  type UseEventListenerWithImplicitWindowTarget = <K>(...args) => void;
705
705
  ```
706
706
 
707
- Defined in: [hooks/useEventListener.ts:21](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L21)
707
+ Defined in: [hooks/useEventListener.ts:21](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L21)
708
708
 
709
709
  ### Type Parameters
710
710
 
@@ -772,7 +772,7 @@ type UseEventListenerWithExplicitGlobalTarget =
772
772
  UseEventListenerWithExplicitTarget<MathMLElement, MathMLElementEventMap>;
773
773
  ```
774
774
 
775
- Defined in: [hooks/useEventListener.ts:32](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L32)
775
+ Defined in: [hooks/useEventListener.ts:32](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L32)
776
776
 
777
777
  ### See
778
778
 
@@ -789,7 +789,7 @@ type UseEventListenerWithExplicitTarget<Target, EventMap> = <T, K>(
789
789
  ) => void;
790
790
  ```
791
791
 
792
- Defined in: [hooks/useEventListener.ts:44](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L44)
792
+ Defined in: [hooks/useEventListener.ts:44](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L44)
793
793
 
794
794
  ### Type Parameters
795
795
 
@@ -888,7 +888,7 @@ type UseEventListenerWithAnyExplicitTarget = UseEventListenerWithExplicitTarget<
888
888
  >;
889
889
  ```
890
890
 
891
- Defined in: [hooks/useEventListener.ts:56](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L56)
891
+ Defined in: [hooks/useEventListener.ts:56](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L56)
892
892
 
893
893
  ### See
894
894
 
@@ -909,7 +909,7 @@ type UseEventListenerWithImplicitWindowTargetArgs<K> =
909
909
  : never;
910
910
  ```
911
911
 
912
- Defined in: [hooks/useEventListener.ts:64](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L64)
912
+ Defined in: [hooks/useEventListener.ts:64](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L64)
913
913
 
914
914
  ### Type Parameters
915
915
 
@@ -954,7 +954,7 @@ type UseEventListenerWithExplicitTargetArgs<EventMap, T, K> = [
954
954
  ];
955
955
  ```
956
956
 
957
- Defined in: [hooks/useEventListener.ts:78](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/hooks/useEventListener.ts#L78)
957
+ Defined in: [hooks/useEventListener.ts:78](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/hooks/useEventListener.ts#L78)
958
958
 
959
959
  ### Type Parameters
960
960
 
@@ -1000,11 +1000,11 @@ Defined in: [hooks/useEventListener.ts:78](https://github.com/aweebit/react-esse
1000
1000
  ```ts
1001
1001
  type ContextualizePipe = {
1002
1002
  with: ContextualizeWith;
1003
- end: () => React.JSX.Element;
1003
+ end: () => ReactNode;
1004
1004
  };
1005
1005
  ```
1006
1006
 
1007
- Defined in: [misc/contextualize.tsx:13](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/contextualize.tsx#L13)
1007
+ Defined in: [misc/contextualize.tsx:13](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/contextualize.tsx#L13)
1008
1008
 
1009
1009
  The return type of [`contextualize`](#contextualize)
1010
1010
 
@@ -1043,7 +1043,7 @@ The return type of [`contextualize`](#contextualize)
1043
1043
  </td>
1044
1044
  <td>
1045
1045
 
1046
- () => `React.JSX.Element`
1046
+ () => `ReactNode`
1047
1047
 
1048
1048
  </td>
1049
1049
  </tr>
@@ -1058,7 +1058,7 @@ The return type of [`contextualize`](#contextualize)
1058
1058
  type ContextualizeWith = <T>(Context, value) => ContextualizePipe;
1059
1059
  ```
1060
1060
 
1061
- Defined in: [misc/contextualize.tsx:23](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/contextualize.tsx#L23)
1061
+ Defined in: [misc/contextualize.tsx:23](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/contextualize.tsx#L23)
1062
1062
 
1063
1063
  ### Type Parameters
1064
1064
 
@@ -1132,11 +1132,11 @@ Defined in: [misc/contextualize.tsx:23](https://github.com/aweebit/react-essenti
1132
1132
  ```ts
1133
1133
  type JSXWrapPipe = {
1134
1134
  with: WrapJSXWith;
1135
- end: () => React.JSX.Element;
1135
+ end: () => ReactNode;
1136
1136
  };
1137
1137
  ```
1138
1138
 
1139
- Defined in: [misc/wrapJSX.tsx:17](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/wrapJSX.tsx#L17)
1139
+ Defined in: [misc/wrapJSX.tsx:18](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/wrapJSX.tsx#L18)
1140
1140
 
1141
1141
  The return type of [`wrapJSX`](#wrapjsx)
1142
1142
 
@@ -1175,7 +1175,7 @@ The return type of [`wrapJSX`](#wrapjsx)
1175
1175
  </td>
1176
1176
  <td>
1177
1177
 
1178
- () => `React.JSX.Element`
1178
+ () => `ReactNode`
1179
1179
 
1180
1180
  </td>
1181
1181
  </tr>
@@ -1190,7 +1190,7 @@ The return type of [`wrapJSX`](#wrapjsx)
1190
1190
  type WrapJSXWith = <C>(...args) => JSXWrapPipe;
1191
1191
  ```
1192
1192
 
1193
- Defined in: [misc/wrapJSX.tsx:27](https://github.com/aweebit/react-essentials/blob/v0.10.3/src/misc/wrapJSX.tsx#L27)
1193
+ Defined in: [misc/wrapJSX.tsx:28](https://github.com/aweebit/react-essentials/blob/v0.10.4/src/misc/wrapJSX.tsx#L28)
1194
1194
 
1195
1195
  ### Type Parameters
1196
1196
 
@@ -1,4 +1,4 @@
1
- import type { Context, default as React } from 'react';
1
+ import type { Context, ReactNode } from 'react';
2
2
  /**
3
3
  * The return type of {@linkcode contextualize}
4
4
  *
@@ -8,7 +8,7 @@ import type { Context, default as React } from 'react';
8
8
  */
9
9
  export type ContextualizePipe = {
10
10
  with: ContextualizeWith;
11
- end: () => React.JSX.Element;
11
+ end: () => ReactNode;
12
12
  };
13
13
  /**
14
14
  * @see
@@ -56,16 +56,16 @@ export type ContextualizeWith = <T>(Context: Context<T>, value: NoInfer<T>) => C
56
56
  * .end();
57
57
  * ```
58
58
  *
59
- * @param jsx The JSX to contextualize
59
+ * @param children The children to contextualize
60
60
  *
61
61
  * @returns An object with the following properties:
62
62
  * - `with`: a function that accepts a context `Context` and a value `value` for
63
63
  * it as arguments and returns
64
- * `contextualize(<Context.Provider value={value}>{jsx}</Context.Provider>)`
65
- * - `end`: a function that returns `jsx`
64
+ * `contextualize(<Context.Provider value={value}>{children}</Context.Provider>)`
65
+ * - `end`: a function that returns `children`
66
66
  *
67
67
  * @see
68
68
  * {@linkcode ContextualizePipe}
69
69
  */
70
- export declare function contextualize(jsx: React.JSX.Element): ContextualizePipe;
70
+ export declare function contextualize(children: ReactNode): ContextualizePipe;
71
71
  //# sourceMappingURL=contextualize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contextualize.d.ts","sourceRoot":"","sources":["../../src/misc/contextualize.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC;AAKvD;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,iBAAiB,CAAC;IACxB,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KACd,iBAAiB,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAWvE"}
1
+ {"version":3,"file":"contextualize.d.ts","sourceRoot":"","sources":["../../src/misc/contextualize.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKhD;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,iBAAiB,CAAC;IACxB,GAAG,EAAE,MAAM,SAAS,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KACd,iBAAiB,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,GAAG,iBAAiB,CAWpE"}
@@ -39,24 +39,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
39
39
  * .end();
40
40
  * ```
41
41
  *
42
- * @param jsx The JSX to contextualize
42
+ * @param children The children to contextualize
43
43
  *
44
44
  * @returns An object with the following properties:
45
45
  * - `with`: a function that accepts a context `Context` and a value `value` for
46
46
  * it as arguments and returns
47
- * `contextualize(<Context.Provider value={value}>{jsx}</Context.Provider>)`
48
- * - `end`: a function that returns `jsx`
47
+ * `contextualize(<Context.Provider value={value}>{children}</Context.Provider>)`
48
+ * - `end`: a function that returns `children`
49
49
  *
50
50
  * @see
51
51
  * {@linkcode ContextualizePipe}
52
52
  */
53
- export function contextualize(jsx) {
53
+ export function contextualize(children) {
54
54
  return {
55
55
  with(Context, value) {
56
- return contextualize(_jsx(Context.Provider, { value: value, children: jsx }));
56
+ return contextualize(_jsx(Context.Provider, { value: value, children: children }));
57
57
  },
58
58
  end() {
59
- return jsx;
59
+ return children;
60
60
  },
61
61
  };
62
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"contextualize.js","sourceRoot":"","sources":["../../src/misc/contextualize.tsx"],"names":[],"mappings":";AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,aAAa,CAAC,GAAsB;IAClD,OAAO;QACL,IAAI,CAAI,OAAmB,EAAE,KAAQ;YACnC,OAAO,aAAa,CAClB,KAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,GAAG,GAAoB,CACzD,CAAC;QACJ,CAAC;QACD,GAAG;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"contextualize.js","sourceRoot":"","sources":["../../src/misc/contextualize.tsx"],"names":[],"mappings":";AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,aAAa,CAAC,QAAmB;IAC/C,OAAO;QACL,IAAI,CAAI,OAAmB,EAAE,KAAQ;YACnC,OAAO,aAAa,CAClB,KAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoB,CAC9D,CAAC;QACJ,CAAC;QACD,GAAG;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ComponentProps, JSXElementConstructor, default as React } from 'react';
1
+ import type { ComponentProps, JSXElementConstructor, default as React, ReactNode } from 'react';
2
2
  /**
3
3
  * The return type of {@linkcode wrapJSX}
4
4
  *
@@ -8,7 +8,7 @@ import type { ComponentProps, JSXElementConstructor, default as React } from 're
8
8
  */
9
9
  export type JSXWrapPipe = {
10
10
  with: WrapJSXWith;
11
- end: () => React.JSX.Element;
11
+ end: () => ReactNode;
12
12
  };
13
13
  /**
14
14
  * @see
@@ -61,16 +61,16 @@ export type WrapJSXWith = <C extends keyof JSX.IntrinsicElements | JSXElementCon
61
61
  * );
62
62
  * ```
63
63
  *
64
- * @param jsx The JSX to wrap
64
+ * @param children The children to wrap
65
65
  *
66
66
  * @returns An object with the following properties:
67
67
  * - `with`: a function that accepts a component `Component` and props `props`
68
68
  * for it as arguments and returns
69
- * `wrapJSX(<Component {...props}>{jsx}</Component>)`
70
- * - `end`: a function that returns `jsx`
69
+ * `wrapJSX(<Component {...props}>{children}</Component>)`
70
+ * - `end`: a function that returns `children`
71
71
  *
72
72
  * @see
73
73
  * {@linkcode JSXWrapPipe}
74
74
  */
75
- export declare function wrapJSX(jsx: React.JSX.Element): JSXWrapPipe;
75
+ export declare function wrapJSX(children: ReactNode): JSXWrapPipe;
76
76
  //# sourceMappingURL=wrapJSX.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapJSX.d.ts","sourceRoot":"","sources":["../../src/misc/wrapJSX.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,OAAO,IAAI,KAAK,EACjB,MAAM,OAAO,CAAC;AAKf;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAErB,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,CAAC,EACjE,GAAG,IAAI,EAAE;IACP,SAAS,EAAE,CAAC;IACZ,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAClE;QACE,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,GACnC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;KACtC,GACD;QACE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAClC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;KACtC,CAAC;CACP,KACE,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,WAAW,CAc3D"}
1
+ {"version":3,"file":"wrapJSX.d.ts","sourceRoot":"","sources":["../../src/misc/wrapJSX.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,OAAO,IAAI,KAAK,EAChB,SAAS,EACV,MAAM,OAAO,CAAC;AAKf;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,MAAM,SAAS,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAErB,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,CAAC,EACjE,GAAG,IAAI,EAAE;IACP,SAAS,EAAE,CAAC;IACZ,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAClE;QACE,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,GACnC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;KACtC,GACD;QACE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,GAClC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;KACtC,CAAC;CACP,KACE,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,GAAG,WAAW,CAcxD"}
@@ -37,24 +37,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
37
37
  * );
38
38
  * ```
39
39
  *
40
- * @param jsx The JSX to wrap
40
+ * @param children The children to wrap
41
41
  *
42
42
  * @returns An object with the following properties:
43
43
  * - `with`: a function that accepts a component `Component` and props `props`
44
44
  * for it as arguments and returns
45
- * `wrapJSX(<Component {...props}>{jsx}</Component>)`
46
- * - `end`: a function that returns `jsx`
45
+ * `wrapJSX(<Component {...props}>{children}</Component>)`
46
+ * - `end`: a function that returns `children`
47
47
  *
48
48
  * @see
49
49
  * {@linkcode JSXWrapPipe}
50
50
  */
51
- export function wrapJSX(jsx) {
51
+ export function wrapJSX(children) {
52
52
  return {
53
53
  with(Component, props = {}) {
54
- return wrapJSX(_jsx(Component, { ...props, children: jsx }));
54
+ return wrapJSX(_jsx(Component, { ...props, children: children }));
55
55
  },
56
56
  end() {
57
- return jsx;
57
+ return children;
58
58
  },
59
59
  };
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrapJSX.js","sourceRoot":"","sources":["../../src/misc/wrapJSX.tsx"],"names":[],"mappings":";AA2CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,UAAU,OAAO,CAAC,GAAsB;IAC5C,OAAO;QACL,IAAI,CACF,SAEiC,EACjC,QAAgB,EAAE;YAElB,OAAO,OAAO,CAAC,KAAC,SAAS,OAAK,KAAK,YAAG,GAAG,GAAa,CAAC,CAAC;QAC1D,CAAC;QACD,GAAG;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"wrapJSX.js","sourceRoot":"","sources":["../../src/misc/wrapJSX.tsx"],"names":[],"mappings":";AA4CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,UAAU,OAAO,CAAC,QAAmB;IACzC,OAAO;QACL,IAAI,CACF,SAEiC,EACjC,QAAgB,EAAE;YAElB,OAAO,OAAO,CAAC,KAAC,SAAS,OAAK,KAAK,YAAG,QAAQ,GAAa,CAAC,CAAC;QAC/D,CAAC;QACD,GAAG;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aweebit/react-essentials",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "type": "module",
5
5
  "repository": "github:aweebit/react-essentials",
6
6
  "main": "dist/index.js",
@@ -1,4 +1,4 @@
1
- import type { Context, default as React } from 'react';
1
+ import type { Context, ReactNode } from 'react';
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
4
  import type { wrapJSX } from './wrapJSX.js';
@@ -12,7 +12,7 @@ import type { wrapJSX } from './wrapJSX.js';
12
12
  */
13
13
  export type ContextualizePipe = {
14
14
  with: ContextualizeWith;
15
- end: () => React.JSX.Element;
15
+ end: () => ReactNode;
16
16
  };
17
17
 
18
18
  /**
@@ -65,26 +65,26 @@ export type ContextualizeWith = <T>(
65
65
  * .end();
66
66
  * ```
67
67
  *
68
- * @param jsx The JSX to contextualize
68
+ * @param children The children to contextualize
69
69
  *
70
70
  * @returns An object with the following properties:
71
71
  * - `with`: a function that accepts a context `Context` and a value `value` for
72
72
  * it as arguments and returns
73
- * `contextualize(<Context.Provider value={value}>{jsx}</Context.Provider>)`
74
- * - `end`: a function that returns `jsx`
73
+ * `contextualize(<Context.Provider value={value}>{children}</Context.Provider>)`
74
+ * - `end`: a function that returns `children`
75
75
  *
76
76
  * @see
77
77
  * {@linkcode ContextualizePipe}
78
78
  */
79
- export function contextualize(jsx: React.JSX.Element): ContextualizePipe {
79
+ export function contextualize(children: ReactNode): ContextualizePipe {
80
80
  return {
81
81
  with<T>(Context: Context<T>, value: T) {
82
82
  return contextualize(
83
- <Context.Provider value={value}>{jsx}</Context.Provider>,
83
+ <Context.Provider value={value}>{children}</Context.Provider>,
84
84
  );
85
85
  },
86
86
  end() {
87
- return jsx;
87
+ return children;
88
88
  },
89
89
  };
90
90
  }
@@ -2,6 +2,7 @@ import type {
2
2
  ComponentProps,
3
3
  JSXElementConstructor,
4
4
  default as React,
5
+ ReactNode,
5
6
  } from 'react';
6
7
 
7
8
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -16,7 +17,7 @@ import type { contextualize } from './contextualize.js';
16
17
  */
17
18
  export type JSXWrapPipe = {
18
19
  with: WrapJSXWith;
19
- end: () => React.JSX.Element;
20
+ end: () => ReactNode;
20
21
  };
21
22
 
22
23
  /**
@@ -79,18 +80,18 @@ export type WrapJSXWith =
79
80
  * );
80
81
  * ```
81
82
  *
82
- * @param jsx The JSX to wrap
83
+ * @param children The children to wrap
83
84
  *
84
85
  * @returns An object with the following properties:
85
86
  * - `with`: a function that accepts a component `Component` and props `props`
86
87
  * for it as arguments and returns
87
- * `wrapJSX(<Component {...props}>{jsx}</Component>)`
88
- * - `end`: a function that returns `jsx`
88
+ * `wrapJSX(<Component {...props}>{children}</Component>)`
89
+ * - `end`: a function that returns `children`
89
90
  *
90
91
  * @see
91
92
  * {@linkcode JSXWrapPipe}
92
93
  */
93
- export function wrapJSX(jsx: React.JSX.Element): JSXWrapPipe {
94
+ export function wrapJSX(children: ReactNode): JSXWrapPipe {
94
95
  return {
95
96
  with(
96
97
  Component:
@@ -98,10 +99,10 @@ export function wrapJSX(jsx: React.JSX.Element): JSXWrapPipe {
98
99
  | JSXElementConstructor<object>,
99
100
  props: object = {},
100
101
  ) {
101
- return wrapJSX(<Component {...props}>{jsx}</Component>);
102
+ return wrapJSX(<Component {...props}>{children}</Component>);
102
103
  },
103
104
  end() {
104
- return jsx;
105
+ return children;
105
106
  },
106
107
  };
107
108
  }