@fluentui-react-native/framework-base 0.1.3 → 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/CHANGELOG.json +31 -1
- package/CHANGELOG.md +18 -2
- package/README.md +10 -11
- package/lib/component-patterns/render.d.ts +8 -0
- package/lib/component-patterns/render.d.ts.map +1 -0
- package/lib/component-patterns/render.js +42 -0
- package/lib/component-patterns/render.js.map +1 -0
- package/lib/component-patterns/render.types.d.ts +98 -0
- package/lib/component-patterns/render.types.d.ts.map +1 -0
- package/lib/component-patterns/render.types.js +2 -0
- package/lib/component-patterns/render.types.js.map +1 -0
- package/lib/component-patterns/stagedComponent.d.ts +7 -31
- package/lib/component-patterns/stagedComponent.d.ts.map +1 -1
- package/lib/component-patterns/stagedComponent.js +18 -0
- package/lib/component-patterns/stagedComponent.js.map +1 -1
- package/lib/component-patterns/withSlots.d.ts +2 -2
- package/lib/component-patterns/withSlots.d.ts.map +1 -1
- package/lib/component-patterns/withSlots.js +2 -2
- package/lib/component-patterns/withSlots.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/jsx-runtime.d.ts +4 -0
- package/lib/jsx-runtime.d.ts.map +1 -0
- package/lib/jsx-runtime.js +9 -0
- package/lib/jsx-runtime.js.map +1 -0
- package/lib-commonjs/component-patterns/render.d.ts +8 -0
- package/lib-commonjs/component-patterns/render.d.ts.map +1 -0
- package/lib-commonjs/component-patterns/render.js +48 -0
- package/lib-commonjs/component-patterns/render.js.map +1 -0
- package/lib-commonjs/component-patterns/render.types.d.ts +98 -0
- package/lib-commonjs/component-patterns/render.types.d.ts.map +1 -0
- package/lib-commonjs/component-patterns/render.types.js +3 -0
- package/lib-commonjs/component-patterns/render.types.js.map +1 -0
- package/lib-commonjs/component-patterns/stagedComponent.d.ts +7 -31
- package/lib-commonjs/component-patterns/stagedComponent.d.ts.map +1 -1
- package/lib-commonjs/component-patterns/stagedComponent.js +20 -1
- package/lib-commonjs/component-patterns/stagedComponent.js.map +1 -1
- package/lib-commonjs/component-patterns/withSlots.d.ts +2 -2
- package/lib-commonjs/component-patterns/withSlots.d.ts.map +1 -1
- package/lib-commonjs/component-patterns/withSlots.js +2 -2
- package/lib-commonjs/component-patterns/withSlots.js.map +1 -1
- package/lib-commonjs/index.d.ts +4 -4
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +9 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/jsx-runtime.d.ts +4 -0
- package/lib-commonjs/jsx-runtime.d.ts.map +1 -0
- package/lib-commonjs/jsx-runtime.js +15 -0
- package/lib-commonjs/jsx-runtime.js.map +1 -0
- package/package.json +7 -2
- package/src/component-patterns/README.md +39 -0
- package/src/component-patterns/render.ts +54 -0
- package/src/component-patterns/render.types.ts +114 -0
- package/src/component-patterns/stagedComponent.tsx +45 -0
- package/src/component-patterns/withSlots.tsx +4 -8
- package/src/immutable-merge/README.md +185 -0
- package/src/index.ts +17 -4
- package/src/jsx-runtime.ts +11 -0
- package/src/memo-cache/README.md +141 -0
- package/src/merge-props/README.md +43 -0
- package/lib/component-patterns/renderSlot.d.ts +0 -21
- package/lib/component-patterns/renderSlot.d.ts.map +0 -1
- package/lib/component-patterns/renderSlot.js +0 -14
- package/lib/component-patterns/renderSlot.js.map +0 -1
- package/lib-commonjs/component-patterns/renderSlot.d.ts +0 -21
- package/lib-commonjs/component-patterns/renderSlot.d.ts.map +0 -1
- package/lib-commonjs/component-patterns/renderSlot.js +0 -19
- package/lib-commonjs/component-patterns/renderSlot.js.map +0 -1
- package/src/component-patterns/renderSlot.ts +0 -27
- package/src/component-patterns/stagedComponent.ts +0 -53
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
"name": "@fluentui-react-native/framework-base",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 29 Jul 2025 06:31:24 GMT",
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"tag": "@fluentui-react-native/framework-base_v0.2.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "jasonmo@microsoft.com",
|
|
12
|
+
"package": "@fluentui-react-native/framework-base",
|
|
13
|
+
"commit": "78329a2222622ac8d90345d3aa908355e70f5d1a",
|
|
14
|
+
"comment": "implement both new and old render patterns for classic and jsx-runtimes"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Fri, 25 Jul 2025 21:36:33 GMT",
|
|
21
|
+
"version": "0.1.4",
|
|
22
|
+
"tag": "@fluentui-react-native/framework-base_v0.1.4",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "jasonmo@microsoft.com",
|
|
27
|
+
"package": "@fluentui-react-native/framework-base",
|
|
28
|
+
"commit": "d541dadbec1c9a1750ca45509aa41df3f8a04349",
|
|
29
|
+
"comment": "tune lage.config and fix @types/node version"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Wed, 23 Jul 2025 00:22:13 GMT",
|
|
6
36
|
"version": "0.1.3",
|
|
7
37
|
"tag": "@fluentui-react-native/framework-base_v0.1.3",
|
|
8
38
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/framework-base
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Tue, 29 Jul 2025 06:31:24 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.2.0
|
|
8
|
+
|
|
9
|
+
Tue, 29 Jul 2025 06:31:24 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- implement both new and old render patterns for classic and jsx-runtimes (jasonmo@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 0.1.4
|
|
16
|
+
|
|
17
|
+
Fri, 25 Jul 2025 21:36:33 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- tune lage.config and fix @types/node version (jasonmo@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 0.1.3
|
|
8
24
|
|
|
9
|
-
Wed, 23 Jul 2025 00:
|
|
25
|
+
Wed, 23 Jul 2025 00:22:13 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
package/README.md
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@fluentui-react-native/framework-base`
|
|
2
2
|
|
|
3
|
-
This package provides core
|
|
3
|
+
This package provides core implementations and types to support both the legacy and current frameworks.
|
|
4
4
|
|
|
5
5
|
Several previously standalone packages have had their implementations moved into this package. This allows them to share certain typings and helpers without having to work around circular dependency issues. The moved packages are:
|
|
6
6
|
|
|
7
|
-
- `@fluentui-react-native/immutable-merge`
|
|
8
|
-
- `@fluentui-react-native/memo-cache`
|
|
9
|
-
- `@fluentui-react-native/merge-props`
|
|
7
|
+
- [`@fluentui-react-native/immutable-merge`](./src/immutable-merge/README.md)
|
|
8
|
+
- [`@fluentui-react-native/memo-cache`](./src/memo-cache/README.md)
|
|
9
|
+
- [`@fluentui-react-native/merge-props`](./src/merge-props/README.md)
|
|
10
10
|
|
|
11
|
-
The functionality in these packages
|
|
12
|
-
in JS/web projects.
|
|
11
|
+
The functionality in these packages is now exposed as part of this package.
|
|
13
12
|
|
|
14
|
-
##
|
|
13
|
+
## Component Patterns
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
The shared patterns for rendering components, as well as the JSX handlers have been centralized in this package. More information can be found [here](./src/component-patterns/README.md).
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Type Helpers
|
|
19
18
|
|
|
20
|
-
- TODO:
|
|
19
|
+
- TODO: There are a number of issues with the way types are handled in the larger fluentui-react-native project, helpers and core types will be added here to help solve inference issues, avoid hard typecasts, and help the project eventually move to typescript 5.x.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as ReactJSX from 'react/jsx-runtime';
|
|
3
|
+
import type { RenderType, RenderResult } from './render.types';
|
|
4
|
+
export type CustomRender = () => RenderResult;
|
|
5
|
+
export declare function renderForJsxRuntime<TProps>(type: React.ElementType, props: React.PropsWithChildren<TProps>, key?: React.Key, jsxFn?: typeof ReactJSX.jsx): RenderResult;
|
|
6
|
+
export declare function renderForClassicRuntime<TProps>(type: RenderType, props: TProps, ...children: React.ReactNode[]): RenderResult;
|
|
7
|
+
export declare const renderSlot: typeof renderForClassicRuntime;
|
|
8
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/component-patterns/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAA0C,MAAM,gBAAgB,CAAC;AAEvG,MAAM,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC;AAgB9C,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,IAAI,EAAE,KAAK,CAAC,WAAW,EACvB,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,EACtC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,EACf,KAAK,GAAE,OAAO,QAAQ,CAAC,GAAkB,GACxC,YAAY,CAad;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,YAAY,CAW7H;AAED,eAAO,MAAM,UAAU,gCAA0B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as ReactJSX from 'react/jsx-runtime';
|
|
3
|
+
function asDirectComponent(type) {
|
|
4
|
+
if (typeof type === 'function' && type._callDirect) {
|
|
5
|
+
return type;
|
|
6
|
+
}
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
function asLegacyDirectComponent(type) {
|
|
10
|
+
if (typeof type === 'function' && type._canCompose) {
|
|
11
|
+
return type;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
export function renderForJsxRuntime(type, props, key, jsxFn = ReactJSX.jsx) {
|
|
16
|
+
const legacyDirect = asLegacyDirectComponent(type);
|
|
17
|
+
if (legacyDirect) {
|
|
18
|
+
const { children, ...rest } = props;
|
|
19
|
+
const newProps = { ...rest, key };
|
|
20
|
+
return legacyDirect(newProps, ...React.Children.toArray(children));
|
|
21
|
+
}
|
|
22
|
+
const directComponent = asDirectComponent(type);
|
|
23
|
+
if (directComponent) {
|
|
24
|
+
const newProps = { ...props, key };
|
|
25
|
+
return directComponent(newProps);
|
|
26
|
+
}
|
|
27
|
+
return jsxFn(type, props, key);
|
|
28
|
+
}
|
|
29
|
+
export function renderForClassicRuntime(type, props, ...children) {
|
|
30
|
+
const legacyDirect = asLegacyDirectComponent(type);
|
|
31
|
+
if (legacyDirect) {
|
|
32
|
+
return legacyDirect(props, ...children);
|
|
33
|
+
}
|
|
34
|
+
const directComponent = asDirectComponent(type);
|
|
35
|
+
if (directComponent) {
|
|
36
|
+
const newProps = { ...props, children };
|
|
37
|
+
return directComponent(newProps);
|
|
38
|
+
}
|
|
39
|
+
return React.createElement(type, props, ...children);
|
|
40
|
+
}
|
|
41
|
+
export const renderSlot = renderForClassicRuntime;
|
|
42
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/component-patterns/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAK9C,SAAS,iBAAiB,CAAS,IAAgB;IACjD,IAAI,OAAO,IAAI,KAAK,UAAU,IAAK,IAAgC,CAAC,WAAW,EAAE;QAC/E,OAAO,IAA+B,CAAC;KACxC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,uBAAuB,CAAS,IAAgB;IACvD,IAAI,OAAO,IAAI,KAAK,UAAU,IAAK,IAAsC,CAAC,WAAW,EAAE;QACrF,OAAO,IAAqC,CAAC;KAC9C;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAuB,EACvB,KAAsC,EACtC,GAAe,EACf,QAA6B,QAAQ,CAAC,GAAG;IAEzC,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE;QAChB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAiB,CAAC;KACpF;IACD,MAAM,eAAe,GAAG,iBAAiB,CAAS,IAAI,CAAC,CAAC;IACxD,IAAI,eAAe,EAAE;QACnB,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;QACnC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;KAClC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAS,IAAgB,EAAE,KAAa,EAAE,GAAG,QAA2B;IAC7G,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAiB,CAAC;KACzD;IACD,MAAM,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,eAAe,EAAE;QACnB,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC;QACxC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;KAClC;IACD,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type ReactJSX from 'react/jsx-runtime';
|
|
3
|
+
/**
|
|
4
|
+
* Base types for rendering components in a react application, extracted from react types
|
|
5
|
+
*/
|
|
6
|
+
export type RenderResult = ReturnType<typeof ReactJSX.jsx>;
|
|
7
|
+
export type RenderType = Parameters<typeof ReactJSX.jsx>[0] | string;
|
|
8
|
+
/**
|
|
9
|
+
* The standard element type inputs for react and react-native. This might be View or Button, or it might be 'div' in web. Effectively
|
|
10
|
+
* it is what react accepts for React.createElement
|
|
11
|
+
*/
|
|
12
|
+
export type NativeReactType = RenderType;
|
|
13
|
+
/**
|
|
14
|
+
* DIRECT RENDERING
|
|
15
|
+
*
|
|
16
|
+
* This is a pattern where a function can by called directly to render a component, bypassing creating additional layers of the
|
|
17
|
+
* rendering tree. This is useful for higher order components that mainly need to do simple prop manipulation but want to
|
|
18
|
+
* compartmentalize the logic.
|
|
19
|
+
*
|
|
20
|
+
* Note that for this to be safe, hooks cannot be used in the function. This is the reason why function component is redefined,
|
|
21
|
+
* to help linting tools catch bad usage.
|
|
22
|
+
*
|
|
23
|
+
* The newer DirectComponent type should be used, as it will handle children consistently.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* type of the render function, not a FunctionComponent to help prevent hook usage
|
|
27
|
+
*/
|
|
28
|
+
export type DirectComponentFunction<TProps> = (props: TProps) => RenderResult;
|
|
29
|
+
/**
|
|
30
|
+
* The full component definition that has the attached properties to allow the jsx handlers to render it directly.
|
|
31
|
+
*/
|
|
32
|
+
export type DirectComponent<TProps> = DirectComponentFunction<TProps> & {
|
|
33
|
+
displayName?: string;
|
|
34
|
+
_callDirect?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Legacy slot function type, this allows the rendering handlers to bypass the normal JSX rendering and call the function
|
|
38
|
+
* directly. This expects the function to have children as the last argument of the call which isn't consistent with standard
|
|
39
|
+
* react usage, where children are passed as a prop. If writing new components use the DirectComponent type instead.
|
|
40
|
+
* @deprecated use DirectComponent instead
|
|
41
|
+
*/
|
|
42
|
+
export type LegacyDirectComponent<TProps> = React.FunctionComponent<TProps> & {
|
|
43
|
+
_canCompose?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Legacy type name used for consistency with old rendering patterns.
|
|
47
|
+
*/
|
|
48
|
+
export type SlotFn<TProps> = LegacyDirectComponent<TProps>;
|
|
49
|
+
/**
|
|
50
|
+
* MULTI-STAGE RENDERING
|
|
51
|
+
*
|
|
52
|
+
* The above direct rendering pattern is useful for simple components, but it does not allow for hooks or complex logic. The staged render pattern allows
|
|
53
|
+
* for a component to be rendered in two stages, allowing for hooks to be used in the first stage and then the second stage to be a simple render function that can
|
|
54
|
+
* be called directly.
|
|
55
|
+
*
|
|
56
|
+
* In code that respects the pattern the first stage will be called with props (though children will not be present) and will return a function that will be called
|
|
57
|
+
* with additional props, this time with children present. This allows for the first stage to handle all the logic and hooks, while the second stage can be a simple render function
|
|
58
|
+
* that can leverage direct rendering if supported.
|
|
59
|
+
*
|
|
60
|
+
* The component itself will be a FunctionComponent, but it will have an attached property that is the staged render function. This allows the component to be used in two
|
|
61
|
+
* parts via the useSlot hook, or to be used directly in JSX/TSX as a normal component.
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* This is an updated version of the staged render that handles children and types more consistently. Generally children
|
|
65
|
+
* will be passed as part of the props for component rendering, it is inconsistent to have them as a variable argument.
|
|
66
|
+
*
|
|
67
|
+
* The `children` prop will be automatically inferred and typed correctly by the prop type. Hooks are still expected
|
|
68
|
+
*/
|
|
69
|
+
export type TwoStageRender<TProps> = (props: TProps) => React.ComponentType<React.PropsWithChildren<TProps>>;
|
|
70
|
+
/**
|
|
71
|
+
* Component type for a component that can be rendered in two stages, with the attached render function.
|
|
72
|
+
*/
|
|
73
|
+
export type StagedComponent<TProps> = React.FunctionComponent<TProps> & {
|
|
74
|
+
_twoStageRender?: TwoStageRender<TProps>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The final rendering of the props in a staged render. This is the function component signature that matches that of
|
|
78
|
+
* React.createElement, children (if present) will be part of the variable args at the end.
|
|
79
|
+
*/
|
|
80
|
+
export type FinalRender<TProps> = (props: TProps, ...children: React.ReactNode[]) => JSX.Element | null;
|
|
81
|
+
/**
|
|
82
|
+
* Signature for a staged render function.
|
|
83
|
+
* @deprecated Use TwoStageRender instead
|
|
84
|
+
*/
|
|
85
|
+
export type StagedRender<TProps> = (props: TProps, ...args: any[]) => FinalRender<TProps>;
|
|
86
|
+
/**
|
|
87
|
+
* Signature for a component that uses the staged render pattern.
|
|
88
|
+
* @deprecated Use TwoStageRender instead
|
|
89
|
+
*/
|
|
90
|
+
export type ComposableFunction<TProps> = React.FunctionComponent<TProps> & {
|
|
91
|
+
_staged?: StagedRender<TProps>;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* A type aggregating all the custom types that can be used in the render process.
|
|
95
|
+
* @internal only used in this package, should not be exported
|
|
96
|
+
*/
|
|
97
|
+
export type AnyCustomType<TProps> = React.FunctionComponent<TProps> | DirectComponent<TProps> | StagedComponent<TProps> | ComposableFunction<TProps> | LegacyDirectComponent<TProps>;
|
|
98
|
+
//# sourceMappingURL=render.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.types.d.ts","sourceRoot":"","sources":["../../src/component-patterns/render.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC,GAAG;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAAC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7G;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG;IACtE,eAAe,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AAExG;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC;AAE1F;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAAC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE9G;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,IAC5B,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAC/B,eAAe,CAAC,MAAM,CAAC,GACvB,eAAe,CAAC,MAAM,CAAC,GACvB,kBAAkB,CAAC,MAAM,CAAC,GAC1B,qBAAqB,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.types.js","sourceRoot":"","sources":["../../src/component-patterns/render.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* The final rendering of the props in a staged render. This is the function component signature that matches that of
|
|
4
|
-
* React.createElement, children (if present) will be part of the variable args at the end.
|
|
5
|
-
*/
|
|
6
|
-
export type FinalRender<TProps> = (props: TProps, ...children: React.ReactNode[]) => JSX.Element | null;
|
|
7
|
-
/**
|
|
8
|
-
* This is a pattern of rendering where a functional component can be executed in two stages rather than in a single pass.
|
|
9
|
-
*
|
|
10
|
-
* The pattern looks like:
|
|
11
|
-
* (props) => {
|
|
12
|
-
* // handle props
|
|
13
|
-
* // call hooks, remember these can't be conditional
|
|
14
|
-
* // build styles and props to pass to child components
|
|
15
|
-
*
|
|
16
|
-
* return (additionalProps, ...children) => {
|
|
17
|
-
* // return the actual element tree, this includes conditional branching or rendering
|
|
18
|
-
* // mixin additional props, props which require logic should be required in phase 1.
|
|
19
|
-
*
|
|
20
|
-
* // NOTE: This is where children will show up
|
|
21
|
-
* };
|
|
22
|
-
* }
|
|
23
|
-
*/
|
|
24
|
-
export type StagedRender<TProps> = (props: TProps, ...args: any[]) => FinalRender<TProps>;
|
|
25
|
-
/**
|
|
26
|
-
* A composable function may have a two stage render function as an attached property. This allows the function to work
|
|
27
|
-
* in all the standard react flows, but allows for pulling out the staged render when components understand it.
|
|
28
|
-
*/
|
|
29
|
-
export type ComposableFunction<TProps> = React.FunctionComponent<TProps> & {
|
|
30
|
-
_staged?: StagedRender<TProps>;
|
|
31
|
-
};
|
|
1
|
+
import type { StagedComponent, TwoStageRender, StagedRender, ComposableFunction } from './render.types';
|
|
32
2
|
/**
|
|
33
3
|
* Take a staged render function and make a real component out of it
|
|
34
4
|
*
|
|
@@ -36,4 +6,10 @@ export type ComposableFunction<TProps> = React.FunctionComponent<TProps> & {
|
|
|
36
6
|
* @param memo - optional flag to enable wrapping the created component in a React.memo HOC
|
|
37
7
|
*/
|
|
38
8
|
export declare function stagedComponent<TProps>(staged: StagedRender<TProps>, memo?: boolean): ComposableFunction<TProps>;
|
|
9
|
+
/**
|
|
10
|
+
* Take a two stage render function and make a real component out of it, attaching the staged render function
|
|
11
|
+
* so it can be split if used in that manner.
|
|
12
|
+
* @param staged - two stage render function to wrap into a staged component
|
|
13
|
+
*/
|
|
14
|
+
export declare function twoStageComponent<TProps>(staged: TwoStageRender<TProps>): StagedComponent<TProps>;
|
|
39
15
|
//# sourceMappingURL=stagedComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stagedComponent.d.ts","sourceRoot":"","sources":["../../src/component-patterns/stagedComponent.
|
|
1
|
+
{"version":3,"file":"stagedComponent.d.ts","sourceRoot":"","sources":["../../src/component-patterns/stagedComponent.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMxG;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAQhH;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAUjG"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx withSlots
|
|
4
|
+
*/
|
|
1
5
|
import * as React from 'react';
|
|
6
|
+
import { withSlots } from './withSlots';
|
|
2
7
|
function asArray(val) {
|
|
3
8
|
return Array.isArray(val) ? val : [val];
|
|
4
9
|
}
|
|
@@ -17,4 +22,17 @@ export function stagedComponent(staged, memo) {
|
|
|
17
22
|
Object.assign(stagedComponent, { _staged: staged });
|
|
18
23
|
return stagedComponent;
|
|
19
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Take a two stage render function and make a real component out of it, attaching the staged render function
|
|
27
|
+
* so it can be split if used in that manner.
|
|
28
|
+
* @param staged - two stage render function to wrap into a staged component
|
|
29
|
+
*/
|
|
30
|
+
export function twoStageComponent(staged) {
|
|
31
|
+
return Object.assign((props) => {
|
|
32
|
+
const { children, ...outerProps } = props;
|
|
33
|
+
const innerProps = { children };
|
|
34
|
+
const Inner = staged(outerProps);
|
|
35
|
+
return withSlots(Inner, { ...innerProps });
|
|
36
|
+
}, { _twoStageRender: staged });
|
|
37
|
+
}
|
|
20
38
|
//# sourceMappingURL=stagedComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stagedComponent.js","sourceRoot":"","sources":["../../src/component-patterns/stagedComponent.
|
|
1
|
+
{"version":3,"file":"stagedComponent.js","sourceRoot":"","sources":["../../src/component-patterns/stagedComponent.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,SAAS,OAAO,CAAI,GAAY;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAS,MAA4B,EAAE,IAAc;IAClF,MAAM,SAAS,GAAG,CAAC,KAAsC,EAAE,EAAE;QAC3D,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACpC,OAAO,MAAM,CAAC,IAAc,CAAC,CAAC,EAAqC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1F,CAAC,CAAC;IACF,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACpD,OAAO,eAA6C,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAS,MAA8B;IACtE,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,KAAsC,EAAE,EAAE;QACzC,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;QAC1C,MAAM,UAAU,GAAG,EAAE,QAAQ,EAAqC,CAAC;QACnE,MAAM,KAAK,GAAG,MAAM,CAAC,UAAoB,CAAC,CAAC;QAC3C,OAAO,UAAC,KAAK,OAAK,UAAU,GAAI,CAAC;IACnC,CAAC,EACD,EAAE,eAAe,EAAE,MAAM,EAAE,CAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* This function is required for any module that uses slots.
|
|
4
4
|
*
|
|
@@ -11,5 +11,5 @@ import type { NativeReactType } from './renderSlot';
|
|
|
11
11
|
*
|
|
12
12
|
* See React.createElement
|
|
13
13
|
*/
|
|
14
|
-
export declare function withSlots
|
|
14
|
+
export declare function withSlots(reactType: Parameters<typeof React.createElement>[0], props?: unknown, ...children: React.ReactNode[]): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
15
15
|
//# sourceMappingURL=withSlots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSlots.d.ts","sourceRoot":"","sources":["../../src/component-patterns/withSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"withSlots.d.ts","sourceRoot":"","sources":["../../src/component-patterns/withSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;;;;;;;;GAWG;AAGH,wBAAgB,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,sEAG9H"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderForClassicRuntime } from './render';
|
|
2
2
|
/**
|
|
3
3
|
* This function is required for any module that uses slots.
|
|
4
4
|
*
|
|
@@ -14,6 +14,6 @@ import { renderSlot } from './renderSlot';
|
|
|
14
14
|
// Can't use typeof on React.createElement since it's overloaded. Approximate createElement's signature for now and widen as needed.
|
|
15
15
|
export function withSlots(reactType, props, ...children) {
|
|
16
16
|
// if it is a non-string type with _canCompose set just call the function directly, otherwise call createElement as normal
|
|
17
|
-
return
|
|
17
|
+
return renderForClassicRuntime(reactType, props, ...children);
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=withSlots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSlots.js","sourceRoot":"","sources":["../../src/component-patterns/withSlots.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"withSlots.js","sourceRoot":"","sources":["../../src/component-patterns/withSlots.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;GAWG;AAEH,oIAAoI;AACpI,MAAM,UAAU,SAAS,CAAC,SAAoD,EAAE,KAAe,EAAE,GAAG,QAA2B;IAC7H,0HAA0H;IAC1H,OAAO,uBAAuB,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;AAChE,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export { memoize } from './memo-cache/memoize';
|
|
|
6
6
|
export type { StyleProp } from './merge-props/mergeStyles.types';
|
|
7
7
|
export { mergeStyles } from './merge-props/mergeStyles';
|
|
8
8
|
export { mergeProps } from './merge-props/mergeProps';
|
|
9
|
-
export { renderSlot } from './component-patterns/
|
|
10
|
-
export type { SlotFn, NativeReactType } from './component-patterns/
|
|
9
|
+
export { renderForClassicRuntime, renderForJsxRuntime, renderSlot } from './component-patterns/render';
|
|
10
|
+
export type { DirectComponent, DirectComponentFunction, LegacyDirectComponent, StagedComponent, StagedRender, TwoStageRender, RenderType, RenderResult, ComposableFunction, FinalRender, SlotFn, NativeReactType, } from './component-patterns/render.types';
|
|
11
11
|
export { withSlots } from './component-patterns/withSlots';
|
|
12
|
-
export { stagedComponent } from './component-patterns/stagedComponent';
|
|
13
|
-
export
|
|
12
|
+
export { stagedComponent, twoStageComponent } from './component-patterns/stagedComponent';
|
|
13
|
+
export { jsx, jsxs } from './jsx-runtime';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAChH,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,YAAY,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAChH,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,YAAY,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACvG,YAAY,EACV,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,8 @@ export { memoize } from './memo-cache/memoize';
|
|
|
5
5
|
export { mergeStyles } from './merge-props/mergeStyles';
|
|
6
6
|
export { mergeProps } from './merge-props/mergeProps';
|
|
7
7
|
// component pattern exports
|
|
8
|
-
export { renderSlot } from './component-patterns/
|
|
8
|
+
export { renderForClassicRuntime, renderForJsxRuntime, renderSlot } from './component-patterns/render';
|
|
9
9
|
export { withSlots } from './component-patterns/withSlots';
|
|
10
|
-
export { stagedComponent } from './component-patterns/stagedComponent';
|
|
10
|
+
export { stagedComponent, twoStageComponent } from './component-patterns/stagedComponent';
|
|
11
|
+
export { jsx, jsxs } from './jsx-runtime';
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAYhH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI/C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,4BAA4B;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAYhH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI/C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,4BAA4B;AAC5B,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAevG,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare function jsx(type: React.ElementType, props: React.PropsWithChildren<unknown>, key?: React.Key): React.ReactElement;
|
|
3
|
+
export declare function jsxs(type: React.ElementType, props: React.PropsWithChildren<unknown>, key?: React.Key): React.ReactElement;
|
|
4
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,wBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,YAAY,CAEzH;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,YAAY,CAE1H"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ReactJSX from 'react/jsx-runtime';
|
|
2
|
+
import { renderForJsxRuntime } from './component-patterns/render';
|
|
3
|
+
export function jsx(type, props, key) {
|
|
4
|
+
return renderForJsxRuntime(type, props, key, ReactJSX.jsx);
|
|
5
|
+
}
|
|
6
|
+
export function jsxs(type, props, key) {
|
|
7
|
+
return renderForJsxRuntime(type, props, key, ReactJSX.jsxs);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,UAAU,GAAG,CAAC,IAAuB,EAAE,KAAuC,EAAE,GAAe;IACnG,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAuB,EAAE,KAAuC,EAAE,GAAe;IACpG,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as ReactJSX from 'react/jsx-runtime';
|
|
3
|
+
import type { RenderType, RenderResult } from './render.types';
|
|
4
|
+
export type CustomRender = () => RenderResult;
|
|
5
|
+
export declare function renderForJsxRuntime<TProps>(type: React.ElementType, props: React.PropsWithChildren<TProps>, key?: React.Key, jsxFn?: typeof ReactJSX.jsx): RenderResult;
|
|
6
|
+
export declare function renderForClassicRuntime<TProps>(type: RenderType, props: TProps, ...children: React.ReactNode[]): RenderResult;
|
|
7
|
+
export declare const renderSlot: typeof renderForClassicRuntime;
|
|
8
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/component-patterns/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAA0C,MAAM,gBAAgB,CAAC;AAEvG,MAAM,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC;AAgB9C,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,IAAI,EAAE,KAAK,CAAC,WAAW,EACvB,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,EACtC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,EACf,KAAK,GAAE,OAAO,QAAQ,CAAC,GAAkB,GACxC,YAAY,CAad;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,YAAY,CAW7H;AAED,eAAO,MAAM,UAAU,gCAA0B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderSlot = exports.renderForClassicRuntime = exports.renderForJsxRuntime = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const ReactJSX = tslib_1.__importStar(require("react/jsx-runtime"));
|
|
7
|
+
function asDirectComponent(type) {
|
|
8
|
+
if (typeof type === 'function' && type._callDirect) {
|
|
9
|
+
return type;
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
function asLegacyDirectComponent(type) {
|
|
14
|
+
if (typeof type === 'function' && type._canCompose) {
|
|
15
|
+
return type;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
function renderForJsxRuntime(type, props, key, jsxFn = ReactJSX.jsx) {
|
|
20
|
+
const legacyDirect = asLegacyDirectComponent(type);
|
|
21
|
+
if (legacyDirect) {
|
|
22
|
+
const { children, ...rest } = props;
|
|
23
|
+
const newProps = { ...rest, key };
|
|
24
|
+
return legacyDirect(newProps, ...react_1.default.Children.toArray(children));
|
|
25
|
+
}
|
|
26
|
+
const directComponent = asDirectComponent(type);
|
|
27
|
+
if (directComponent) {
|
|
28
|
+
const newProps = { ...props, key };
|
|
29
|
+
return directComponent(newProps);
|
|
30
|
+
}
|
|
31
|
+
return jsxFn(type, props, key);
|
|
32
|
+
}
|
|
33
|
+
exports.renderForJsxRuntime = renderForJsxRuntime;
|
|
34
|
+
function renderForClassicRuntime(type, props, ...children) {
|
|
35
|
+
const legacyDirect = asLegacyDirectComponent(type);
|
|
36
|
+
if (legacyDirect) {
|
|
37
|
+
return legacyDirect(props, ...children);
|
|
38
|
+
}
|
|
39
|
+
const directComponent = asDirectComponent(type);
|
|
40
|
+
if (directComponent) {
|
|
41
|
+
const newProps = { ...props, children };
|
|
42
|
+
return directComponent(newProps);
|
|
43
|
+
}
|
|
44
|
+
return react_1.default.createElement(type, props, ...children);
|
|
45
|
+
}
|
|
46
|
+
exports.renderForClassicRuntime = renderForClassicRuntime;
|
|
47
|
+
exports.renderSlot = renderForClassicRuntime;
|
|
48
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/component-patterns/render.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,oEAA8C;AAK9C,SAAS,iBAAiB,CAAS,IAAgB;IACjD,IAAI,OAAO,IAAI,KAAK,UAAU,IAAK,IAAgC,CAAC,WAAW,EAAE;QAC/E,OAAO,IAA+B,CAAC;KACxC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,uBAAuB,CAAS,IAAgB;IACvD,IAAI,OAAO,IAAI,KAAK,UAAU,IAAK,IAAsC,CAAC,WAAW,EAAE;QACrF,OAAO,IAAqC,CAAC;KAC9C;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,mBAAmB,CACjC,IAAuB,EACvB,KAAsC,EACtC,GAAe,EACf,QAA6B,QAAQ,CAAC,GAAG;IAEzC,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE;QAChB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC,QAAQ,EAAE,GAAG,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAiB,CAAC;KACpF;IACD,MAAM,eAAe,GAAG,iBAAiB,CAAS,IAAI,CAAC,CAAC;IACxD,IAAI,eAAe,EAAE;QACnB,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;QACnC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;KAClC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAlBD,kDAkBC;AAED,SAAgB,uBAAuB,CAAS,IAAgB,EAAE,KAAa,EAAE,GAAG,QAA2B;IAC7G,MAAM,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAiB,CAAC;KACzD;IACD,MAAM,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,eAAe,EAAE;QACnB,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC;QACxC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;KAClC;IACD,OAAO,eAAK,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;AACvD,CAAC;AAXD,0DAWC;AAEY,QAAA,UAAU,GAAG,uBAAuB,CAAC"}
|