@fluentui-react-native/framework-base 0.2.0 → 0.3.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 +16 -1
- package/CHANGELOG.md +43 -2
- package/README.md +18 -1
- package/babel.config.js +1 -1
- package/jsx-runtime.js +1 -0
- package/lib/component-patterns/directComponent.d.ts +7 -0
- package/lib/component-patterns/directComponent.d.ts.map +1 -0
- package/lib/component-patterns/directComponent.js +8 -0
- package/lib/component-patterns/directComponent.js.map +1 -0
- package/lib/component-patterns/extract.d.ts +22 -0
- package/lib/component-patterns/extract.d.ts.map +1 -0
- package/lib/component-patterns/extract.js +25 -0
- package/lib/component-patterns/extract.js.map +1 -0
- package/lib/component-patterns/phasedComponent.d.ts +18 -0
- package/lib/component-patterns/phasedComponent.d.ts.map +1 -0
- package/lib/component-patterns/phasedComponent.js +51 -0
- package/lib/component-patterns/phasedComponent.js.map +1 -0
- package/lib/component-patterns/render.d.ts +9 -3
- package/lib/component-patterns/render.d.ts.map +1 -1
- package/lib/component-patterns/render.js +39 -32
- package/lib/component-patterns/render.js.map +1 -1
- package/lib/component-patterns/render.types.d.ts +60 -34
- package/lib/component-patterns/render.types.d.ts.map +1 -1
- package/lib/component-patterns/render.types.js +1 -1
- package/lib/component-patterns/stagedComponent.d.ts +3 -8
- package/lib/component-patterns/stagedComponent.d.ts.map +1 -1
- package/lib/component-patterns/stagedComponent.js +10 -27
- package/lib/component-patterns/stagedComponent.js.map +1 -1
- package/lib/component-patterns/withSlots.d.ts +6 -2
- package/lib/component-patterns/withSlots.d.ts.map +1 -1
- package/lib/component-patterns/withSlots.js +3 -3
- package/lib/component-patterns/withSlots.js.map +1 -1
- package/lib/immutable-merge/Merge.d.ts +6 -3
- package/lib/immutable-merge/Merge.js +79 -83
- package/lib/immutable-merge/Merge.js.map +1 -1
- package/lib/immutable-merge/Merge.test.d.ts +1 -1
- package/lib/immutable-merge/Merge.test.js +231 -219
- package/lib/immutable-merge/Merge.test.js.map +1 -1
- package/lib/index.d.ts +33 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -4
- package/lib/index.js.map +1 -1
- package/lib/jsx-namespace.d.ts +65 -0
- package/lib/jsx-namespace.d.ts.map +1 -0
- package/lib/jsx-namespace.js +2 -0
- package/lib/jsx-namespace.js.map +1 -0
- package/lib/jsx-runtime.d.ts +6 -4
- package/lib/jsx-runtime.d.ts.map +1 -1
- package/lib/jsx-runtime.js +9 -7
- package/lib/jsx-runtime.js.map +1 -1
- package/lib/memo-cache/getCacheEntry.d.ts +13 -13
- package/lib/memo-cache/getCacheEntry.js +20 -22
- package/lib/memo-cache/getCacheEntry.js.map +1 -1
- package/lib/memo-cache/getCacheEntry.test.d.ts +1 -1
- package/lib/memo-cache/getCacheEntry.test.js +90 -90
- package/lib/memo-cache/getCacheEntry.test.js.map +1 -1
- package/lib/memo-cache/getMemoCache.d.ts +1 -1
- package/lib/memo-cache/getMemoCache.js +11 -11
- package/lib/memo-cache/getMemoCache.js.map +1 -1
- package/lib/memo-cache/getMemoCache.test.d.ts +1 -1
- package/lib/memo-cache/getMemoCache.test.js +73 -73
- package/lib/memo-cache/getMemoCache.test.js.map +1 -1
- package/lib/memo-cache/memoize.d.ts +1 -1
- package/lib/memo-cache/memoize.js +9 -9
- package/lib/memo-cache/memoize.js.map +1 -1
- package/lib/memo-cache/memoize.test.d.ts +1 -1
- package/lib/memo-cache/memoize.test.js +36 -38
- package/lib/memo-cache/memoize.test.js.map +1 -1
- package/lib/merge-props/index.d.ts +1 -1
- package/lib/merge-props/index.js +1 -1
- package/lib/merge-props/mergeProps.d.ts +1 -1
- package/lib/merge-props/mergeProps.js +4 -4
- package/lib/merge-props/mergeProps.js.map +1 -1
- package/lib/merge-props/mergeStyles.d.ts +33 -4
- package/lib/merge-props/mergeStyles.d.ts.map +1 -1
- package/lib/merge-props/mergeStyles.js +16 -17
- package/lib/merge-props/mergeStyles.js.map +1 -1
- package/lib/merge-props/mergeStyles.test.d.ts +1 -1
- package/lib/merge-props/mergeStyles.test.js +75 -75
- package/lib/merge-props/mergeStyles.test.js.map +1 -1
- package/lib/merge-props/mergeStyles.types.d.ts +4 -4
- package/lib/merge-props/mergeStyles.types.d.ts.map +1 -1
- package/lib/merge-props/mergeStyles.types.js +1 -1
- package/lib/utilities/filterProps.d.ts +3 -0
- package/lib/utilities/filterProps.d.ts.map +1 -0
- package/lib/utilities/filterProps.js +12 -0
- package/lib/utilities/filterProps.js.map +1 -0
- package/lib-commonjs/component-patterns/directComponent.d.ts +7 -0
- package/lib-commonjs/component-patterns/directComponent.d.ts.map +1 -0
- package/lib-commonjs/component-patterns/directComponent.js +11 -0
- package/lib-commonjs/component-patterns/directComponent.js.map +1 -0
- package/lib-commonjs/component-patterns/extract.d.ts +22 -0
- package/lib-commonjs/component-patterns/extract.d.ts.map +1 -0
- package/lib-commonjs/component-patterns/extract.js +30 -0
- package/lib-commonjs/component-patterns/extract.js.map +1 -0
- package/lib-commonjs/component-patterns/phasedComponent.d.ts +18 -0
- package/lib-commonjs/component-patterns/phasedComponent.d.ts.map +1 -0
- package/lib-commonjs/component-patterns/phasedComponent.js +60 -0
- package/lib-commonjs/component-patterns/phasedComponent.js.map +1 -0
- package/lib-commonjs/component-patterns/render.d.ts +9 -3
- package/lib-commonjs/component-patterns/render.d.ts.map +1 -1
- package/lib-commonjs/component-patterns/render.js +101 -39
- package/lib-commonjs/component-patterns/render.js.map +1 -1
- package/lib-commonjs/component-patterns/render.types.d.ts +60 -34
- package/lib-commonjs/component-patterns/render.types.d.ts.map +1 -1
- package/lib-commonjs/component-patterns/render.types.js +3 -3
- package/lib-commonjs/component-patterns/stagedComponent.d.ts +3 -8
- package/lib-commonjs/component-patterns/stagedComponent.d.ts.map +1 -1
- package/lib-commonjs/component-patterns/stagedComponent.js +64 -34
- package/lib-commonjs/component-patterns/stagedComponent.js.map +1 -1
- package/lib-commonjs/component-patterns/withSlots.d.ts +6 -2
- package/lib-commonjs/component-patterns/withSlots.d.ts.map +1 -1
- package/lib-commonjs/component-patterns/withSlots.js +7 -8
- package/lib-commonjs/component-patterns/withSlots.js.map +1 -1
- package/lib-commonjs/immutable-merge/Merge.d.ts +6 -3
- package/lib-commonjs/immutable-merge/Merge.js +85 -90
- package/lib-commonjs/immutable-merge/Merge.js.map +1 -1
- package/lib-commonjs/immutable-merge/Merge.test.d.ts +1 -1
- package/lib-commonjs/immutable-merge/Merge.test.js +234 -222
- package/lib-commonjs/immutable-merge/Merge.test.js.map +1 -1
- package/lib-commonjs/index.d.ts +33 -5
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +184 -31
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/jsx-namespace.d.ts +65 -0
- package/lib-commonjs/jsx-namespace.d.ts.map +1 -0
- package/lib-commonjs/jsx-namespace.js +3 -0
- package/lib-commonjs/jsx-namespace.js.map +1 -0
- package/lib-commonjs/jsx-runtime.d.ts +6 -4
- package/lib-commonjs/jsx-runtime.d.ts.map +1 -1
- package/lib-commonjs/jsx-runtime.js +70 -13
- package/lib-commonjs/jsx-runtime.js.map +1 -1
- package/lib-commonjs/memo-cache/getCacheEntry.d.ts +13 -13
- package/lib-commonjs/memo-cache/getCacheEntry.js +23 -26
- package/lib-commonjs/memo-cache/getCacheEntry.js.map +1 -1
- package/lib-commonjs/memo-cache/getCacheEntry.test.d.ts +1 -1
- package/lib-commonjs/memo-cache/getCacheEntry.test.js +93 -93
- package/lib-commonjs/memo-cache/getCacheEntry.test.js.map +1 -1
- package/lib-commonjs/memo-cache/getMemoCache.d.ts +1 -1
- package/lib-commonjs/memo-cache/getMemoCache.js +16 -17
- package/lib-commonjs/memo-cache/getMemoCache.js.map +1 -1
- package/lib-commonjs/memo-cache/getMemoCache.test.d.ts +1 -1
- package/lib-commonjs/memo-cache/getMemoCache.test.js +76 -76
- package/lib-commonjs/memo-cache/getMemoCache.test.js.map +1 -1
- package/lib-commonjs/memo-cache/memoize.d.ts +1 -1
- package/lib-commonjs/memo-cache/memoize.js +13 -14
- package/lib-commonjs/memo-cache/memoize.js.map +1 -1
- package/lib-commonjs/memo-cache/memoize.test.d.ts +1 -1
- package/lib-commonjs/memo-cache/memoize.test.js +39 -41
- package/lib-commonjs/memo-cache/memoize.test.js.map +1 -1
- package/lib-commonjs/merge-props/index.d.ts +1 -1
- package/lib-commonjs/merge-props/index.js +17 -7
- package/lib-commonjs/merge-props/index.js.map +1 -1
- package/lib-commonjs/merge-props/mergeProps.d.ts +1 -1
- package/lib-commonjs/merge-props/mergeProps.js +9 -10
- package/lib-commonjs/merge-props/mergeProps.js.map +1 -1
- package/lib-commonjs/merge-props/mergeStyles.d.ts +33 -4
- package/lib-commonjs/merge-props/mergeStyles.d.ts.map +1 -1
- package/lib-commonjs/merge-props/mergeStyles.js +23 -25
- package/lib-commonjs/merge-props/mergeStyles.js.map +1 -1
- package/lib-commonjs/merge-props/mergeStyles.test.d.ts +1 -1
- package/lib-commonjs/merge-props/mergeStyles.test.js +78 -78
- package/lib-commonjs/merge-props/mergeStyles.test.js.map +1 -1
- package/lib-commonjs/merge-props/mergeStyles.types.d.ts +4 -4
- package/lib-commonjs/merge-props/mergeStyles.types.d.ts.map +1 -1
- package/lib-commonjs/merge-props/mergeStyles.types.js +3 -3
- package/lib-commonjs/utilities/filterProps.d.ts +3 -0
- package/lib-commonjs/utilities/filterProps.d.ts.map +1 -0
- package/lib-commonjs/utilities/filterProps.js +15 -0
- package/lib-commonjs/utilities/filterProps.js.map +1 -0
- package/package.json +48 -20
- package/src/component-patterns/README.md +53 -16
- package/src/component-patterns/directComponent.ts +9 -0
- package/src/component-patterns/extract.ts +32 -0
- package/src/component-patterns/phasedComponent.ts +54 -0
- package/src/component-patterns/render.ts +21 -13
- package/src/component-patterns/render.types.ts +55 -30
- package/src/component-patterns/stagedComponent.ts +24 -0
- package/src/immutable-merge/Merge.test.ts +5 -1
- package/src/index.ts +27 -7
- package/src/jsx-namespace.ts +83 -0
- package/src/jsx-runtime.ts +8 -4
- package/src/memo-cache/README.md +1 -1
- package/src/merge-props/mergeStyles.test.ts +3 -2
- package/src/merge-props/mergeStyles.ts +52 -4
- package/src/merge-props/mergeStyles.types.ts +2 -2
- package/src/utilities/filterProps.ts +14 -0
- package/src/component-patterns/stagedComponent.tsx +0 -45
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import type { FurnJSX } from '../jsx-namespace';
|
|
3
3
|
/**
|
|
4
4
|
* Base types for rendering components in a react application, extracted from react types
|
|
5
5
|
*/
|
|
6
|
-
export type RenderResult =
|
|
7
|
-
export type RenderType =
|
|
6
|
+
export type RenderResult = FurnJSX.Element;
|
|
7
|
+
export type RenderType = FurnJSX.ElementType;
|
|
8
8
|
/**
|
|
9
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
10
|
* it is what react accepts for React.createElement
|
|
11
11
|
*/
|
|
12
12
|
export type NativeReactType = RenderType;
|
|
13
|
+
/**
|
|
14
|
+
* Get the props from a react component type
|
|
15
|
+
*/
|
|
16
|
+
export type PropsOf<TComponent> = TComponent extends React.JSXElementConstructor<infer P> ? P : never;
|
|
13
17
|
/**
|
|
14
18
|
* DIRECT RENDERING
|
|
15
19
|
*
|
|
@@ -25,74 +29,96 @@ export type NativeReactType = RenderType;
|
|
|
25
29
|
/**
|
|
26
30
|
* type of the render function, not a FunctionComponent to help prevent hook usage
|
|
27
31
|
*/
|
|
28
|
-
export type
|
|
32
|
+
export type FunctionComponentCore<TProps> = (props: TProps) => RenderResult;
|
|
33
|
+
/**
|
|
34
|
+
* A function component that returns an element type. This allows for the empty call props usage for native
|
|
35
|
+
* components, as well as handles the returns of React components.
|
|
36
|
+
*/
|
|
37
|
+
export type FunctionComponent<TProps> = FunctionComponentCore<TProps> & {
|
|
38
|
+
displayName?: string;
|
|
39
|
+
};
|
|
29
40
|
/**
|
|
30
41
|
* The full component definition that has the attached properties to allow the jsx handlers to render it directly.
|
|
31
42
|
*/
|
|
32
|
-
export type DirectComponent<TProps> =
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
export type DirectComponent<TProps> = FunctionComponentCore<TProps> & {
|
|
44
|
+
displayName?: string;
|
|
45
|
+
_callDirect?: boolean;
|
|
35
46
|
};
|
|
47
|
+
type LegacyComponentFunction<TProps> = (props: TProps, ...children: React.ReactNode[]) => RenderResult;
|
|
36
48
|
/**
|
|
37
49
|
* Legacy slot function type, this allows the rendering handlers to bypass the normal JSX rendering and call the function
|
|
38
50
|
* directly. This expects the function to have children as the last argument of the call which isn't consistent with standard
|
|
39
51
|
* react usage, where children are passed as a prop. If writing new components use the DirectComponent type instead.
|
|
40
52
|
* @deprecated use DirectComponent instead
|
|
41
53
|
*/
|
|
42
|
-
export type LegacyDirectComponent<TProps> =
|
|
43
|
-
|
|
54
|
+
export type LegacyDirectComponent<TProps> = LegacyComponentFunction<TProps> & {
|
|
55
|
+
_canCompose?: boolean;
|
|
44
56
|
};
|
|
45
57
|
/**
|
|
46
|
-
*
|
|
58
|
+
* Slot function type used in the composition framework. Slot functions return React elements (not arbitrary ReactNode values)
|
|
59
|
+
* since they always either call staged render functions or React.createElement.
|
|
47
60
|
*/
|
|
48
|
-
export type SlotFn<TProps> =
|
|
61
|
+
export type SlotFn<TProps> = {
|
|
62
|
+
(props: TProps, ...children: React.ReactNode[]): React.ReactElement | null;
|
|
63
|
+
_canCompose?: boolean;
|
|
64
|
+
};
|
|
49
65
|
/**
|
|
50
|
-
*
|
|
66
|
+
* PHASED RENDERING (formerly called "staged" or "two-stage" rendering)
|
|
51
67
|
*
|
|
52
|
-
* The above direct rendering pattern is useful for simple components, but it does not allow for hooks or complex logic. The
|
|
53
|
-
* for a component to be rendered in two
|
|
68
|
+
* The above direct rendering pattern is useful for simple components, but it does not allow for hooks or complex logic. The phased render pattern allows
|
|
69
|
+
* for a component to be rendered in two phases, allowing for hooks to be used in the first phase and then the second phase to be a simple render function that can
|
|
54
70
|
* be called directly.
|
|
55
71
|
*
|
|
56
|
-
* In code that respects the pattern the first
|
|
57
|
-
* with additional props, this time with children present. This allows for the first
|
|
72
|
+
* In code that respects the pattern, the first phase will be called with props (though children will not be present) and will return a function that will be called
|
|
73
|
+
* with additional props, this time with children present. This allows for the first phase to handle all the logic and hooks, while the second phase can be a simple render function
|
|
58
74
|
* that can leverage direct rendering if supported.
|
|
59
75
|
*
|
|
60
|
-
* The component itself will be a FunctionComponent, but it will have an attached property that is the
|
|
76
|
+
* The component itself will be a FunctionComponent, but it will have an attached property that is the phased render function. This allows the component to be used in two
|
|
61
77
|
* parts via the useSlot hook, or to be used directly in JSX/TSX as a normal component.
|
|
62
78
|
*/
|
|
63
79
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
80
|
+
* Phased render function signature. This is the recommended pattern for components that need hooks.
|
|
81
|
+
*
|
|
82
|
+
* Phase 1 receives props (without children) and can use hooks to compute derived state.
|
|
83
|
+
* Phase 2 returns a component that will be called with props including children.
|
|
66
84
|
*
|
|
67
|
-
*
|
|
85
|
+
* Children will be passed as part of the props for component rendering. The `children` prop will be
|
|
86
|
+
* automatically inferred and typed correctly by the prop type.
|
|
68
87
|
*/
|
|
69
|
-
export type
|
|
88
|
+
export type PhasedRender<TProps> = (props: TProps) => React.ComponentType<React.PropsWithChildren<TProps>>;
|
|
70
89
|
/**
|
|
71
|
-
* Component type for a component that can be rendered in two
|
|
90
|
+
* Component type for a component that can be rendered in two phases, with the attached phased render function.
|
|
91
|
+
* Use phasedComponent() to create these.
|
|
72
92
|
*/
|
|
73
|
-
export type
|
|
74
|
-
|
|
93
|
+
export type PhasedComponent<TProps> = FunctionComponent<TProps> & {
|
|
94
|
+
_phasedRender?: PhasedRender<TProps>;
|
|
75
95
|
};
|
|
76
96
|
/**
|
|
77
|
-
* The final rendering of the props in a
|
|
97
|
+
* The final rendering of the props in a phased render. This is the function component signature that matches that of
|
|
78
98
|
* React.createElement, children (if present) will be part of the variable args at the end.
|
|
79
99
|
*/
|
|
80
|
-
export type FinalRender<TProps> = (props: TProps, ...children: React.ReactNode[]) =>
|
|
100
|
+
export type FinalRender<TProps> = (props: TProps, ...children: React.ReactNode[]) => FurnJSX.Element | null;
|
|
81
101
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @deprecated Use
|
|
102
|
+
* Legacy staged render function signature.
|
|
103
|
+
* @deprecated Use PhasedRender instead. This older pattern splits children from props which is inconsistent with React conventions.
|
|
84
104
|
*/
|
|
85
105
|
export type StagedRender<TProps> = (props: TProps, ...args: any[]) => FinalRender<TProps>;
|
|
86
106
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @deprecated Use
|
|
107
|
+
* Legacy component type that uses the staged render pattern.
|
|
108
|
+
* @deprecated Use PhasedComponent instead. Create with phasedComponent() rather than stagedComponent().
|
|
89
109
|
*/
|
|
90
|
-
export type ComposableFunction<TProps> =
|
|
91
|
-
|
|
110
|
+
export type ComposableFunction<TProps> = FunctionComponent<TProps> & {
|
|
111
|
+
_staged?: StagedRender<TProps>;
|
|
92
112
|
};
|
|
93
113
|
/**
|
|
94
114
|
* A type aggregating all the custom types that can be used in the render process.
|
|
95
115
|
* @internal only used in this package, should not be exported
|
|
96
116
|
*/
|
|
97
|
-
export type AnyCustomType<TProps> =
|
|
98
|
-
|
|
117
|
+
export type AnyCustomType<TProps> =
|
|
118
|
+
| React.FunctionComponent<TProps>
|
|
119
|
+
| DirectComponent<TProps>
|
|
120
|
+
| PhasedComponent<TProps>
|
|
121
|
+
| ComposableFunction<TProps>
|
|
122
|
+
| LegacyDirectComponent<TProps>;
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=render.types.d.ts.map
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"render.types.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AAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
//# sourceMappingURL=render.types.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
//# sourceMappingURL=render.types.js.map
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StagedRender, ComposableFunction } from './render.types';
|
|
2
2
|
/**
|
|
3
3
|
* Take a staged render function and make a real component out of it
|
|
4
4
|
*
|
|
5
5
|
* @param staged - staged render function to wrap into a staged component
|
|
6
6
|
* @param memo - optional flag to enable wrapping the created component in a React.memo HOC
|
|
7
|
+
* @deprecated Use phasedComponent from phasedComponent.ts instead
|
|
7
8
|
*/
|
|
8
9
|
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>;
|
|
15
|
-
//# sourceMappingURL=stagedComponent.d.ts.map
|
|
10
|
+
//# 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.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMvE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAQhH"}
|
|
@@ -1,44 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return m[k];
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}
|
|
18
|
+
: function (o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
});
|
|
22
|
+
var __setModuleDefault =
|
|
23
|
+
(this && this.__setModuleDefault) ||
|
|
24
|
+
(Object.create
|
|
25
|
+
? function (o, v) {
|
|
26
|
+
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
27
|
+
}
|
|
28
|
+
: function (o, v) {
|
|
29
|
+
o['default'] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar =
|
|
32
|
+
(this && this.__importStar) ||
|
|
33
|
+
(function () {
|
|
34
|
+
var ownKeys = function (o) {
|
|
35
|
+
ownKeys =
|
|
36
|
+
Object.getOwnPropertyNames ||
|
|
37
|
+
function (o) {
|
|
38
|
+
var ar = [];
|
|
39
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
40
|
+
return ar;
|
|
41
|
+
};
|
|
42
|
+
return ownKeys(o);
|
|
43
|
+
};
|
|
44
|
+
return function (mod) {
|
|
45
|
+
if (mod && mod.__esModule) return mod;
|
|
46
|
+
var result = {};
|
|
47
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
|
|
48
|
+
__setModuleDefault(result, mod);
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
53
|
+
exports.stagedComponent = stagedComponent;
|
|
54
|
+
const React = __importStar(require('react'));
|
|
11
55
|
function asArray(val) {
|
|
12
|
-
|
|
56
|
+
return Array.isArray(val) ? val : [val];
|
|
13
57
|
}
|
|
14
58
|
/**
|
|
15
59
|
* Take a staged render function and make a real component out of it
|
|
16
60
|
*
|
|
17
61
|
* @param staged - staged render function to wrap into a staged component
|
|
18
62
|
* @param memo - optional flag to enable wrapping the created component in a React.memo HOC
|
|
63
|
+
* @deprecated Use phasedComponent from phasedComponent.ts instead
|
|
19
64
|
*/
|
|
20
65
|
function stagedComponent(staged, memo) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
exports.stagedComponent = stagedComponent;
|
|
30
|
-
/**
|
|
31
|
-
* Take a two stage render function and make a real component out of it, attaching the staged render function
|
|
32
|
-
* so it can be split if used in that manner.
|
|
33
|
-
* @param staged - two stage render function to wrap into a staged component
|
|
34
|
-
*/
|
|
35
|
-
function twoStageComponent(staged) {
|
|
36
|
-
return Object.assign((props) => {
|
|
37
|
-
const { children, ...outerProps } = props;
|
|
38
|
-
const innerProps = { children };
|
|
39
|
-
const Inner = staged(outerProps);
|
|
40
|
-
return (0, withSlots_1.withSlots)(Inner, { ...innerProps });
|
|
41
|
-
}, { _twoStageRender: staged });
|
|
66
|
+
const component = (props) => {
|
|
67
|
+
const { children, ...rest } = props;
|
|
68
|
+
return staged(rest)({}, asArray(children));
|
|
69
|
+
};
|
|
70
|
+
const stagedComponent = memo ? React.memo(component) : component;
|
|
71
|
+
Object.assign(stagedComponent, { _staged: staged });
|
|
72
|
+
return stagedComponent;
|
|
42
73
|
}
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=stagedComponent.js.map
|
|
74
|
+
//# 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.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,KAAK,kCAAc;AAI/B,SAAS,OAAO,CAAI,GAAY,EAAO;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,CACzC;AAED;;;;;;GAMG;AACH,yBAAwC,MAA4B,EAAE,IAAc,EAA8B;IAChH,MAAM,SAAS,GAAG,CAAC,KAAsC,EAAE,EAAE,CAAC;QAC5D,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;IAAA,CACzF,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;AAAA,CACtD"}
|
|
@@ -11,5 +11,9 @@ import type React from 'react';
|
|
|
11
11
|
*
|
|
12
12
|
* See React.createElement
|
|
13
13
|
*/
|
|
14
|
-
export declare function withSlots(
|
|
15
|
-
|
|
14
|
+
export declare function withSlots(
|
|
15
|
+
reactType: Parameters<typeof React.createElement>[0],
|
|
16
|
+
props?: unknown,
|
|
17
|
+
...children: React.ReactNode[]
|
|
18
|
+
): import('..').FurnJSX.Element;
|
|
19
|
+
//# 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,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,
|
|
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,gCAG9H"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.withSlots =
|
|
4
|
-
const render_1 = require(
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.withSlots = withSlots;
|
|
4
|
+
const render_1 = require('./render');
|
|
5
5
|
/**
|
|
6
6
|
* This function is required for any module that uses slots.
|
|
7
7
|
*
|
|
@@ -16,8 +16,7 @@ const render_1 = require("./render");
|
|
|
16
16
|
*/
|
|
17
17
|
// Can't use typeof on React.createElement since it's overloaded. Approximate createElement's signature for now and widen as needed.
|
|
18
18
|
function withSlots(reactType, props, ...children) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// if it is a non-string type with _canCompose set just call the function directly, otherwise call createElement as normal
|
|
20
|
+
return (0, render_1.renderForClassicRuntime)(reactType, props, ...children);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=withSlots.js.map
|
|
22
|
+
//# sourceMappingURL=withSlots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSlots.js","sourceRoot":"","sources":["../../src/component-patterns/withSlots.tsx"],"names":[],"mappings":";;;AACA,qCAAmD;AAEnD;;;;;;;;;;;GAWG;AAEH,oIAAoI;AACpI,
|
|
1
|
+
{"version":3,"file":"withSlots.js","sourceRoot":"","sources":["../../src/component-patterns/withSlots.tsx"],"names":[],"mappings":";;;AACA,qCAAmD;AAEnD;;;;;;;;;;;GAWG;AAEH,oIAAoI;AACpI,mBAA0B,SAAoD,EAAE,KAAe,EAAE,GAAG,QAA2B,EAAE;IAC/H,0HAA0H;IAC1H,OAAO,IAAA,gCAAuB,EAAC,SAAS,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;AAAA,CAC/D"}
|
|
@@ -41,7 +41,7 @@ export type ExpandedTypeof = TypeofResult | 'array' | 'null';
|
|
|
41
41
|
* - [key: string]: matches anything by name
|
|
42
42
|
*/
|
|
43
43
|
export interface MergeOptions {
|
|
44
|
-
|
|
44
|
+
[objectTypeOrKeyName: string]: RecursionOption | RecursionHandler | MergeOptions;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Filter a set of unknown values to only include those that extend ObjectBase
|
|
@@ -62,7 +62,10 @@ export declare function immutableMerge<T extends ObjectBase>(...objs: (T | undef
|
|
|
62
62
|
* @param options - configuration options for the merge, this dictates what keys will be handled in what way
|
|
63
63
|
* @param objs - set of objects to merge together
|
|
64
64
|
*/
|
|
65
|
-
export declare function immutableMergeCore<T extends ObjectBase>(
|
|
65
|
+
export declare function immutableMergeCore<T extends ObjectBase>(
|
|
66
|
+
options: RecursionOption | MergeOptions,
|
|
67
|
+
...objs: (T | undefined)[]
|
|
68
|
+
): T | undefined;
|
|
66
69
|
/**
|
|
67
70
|
* Process one or more immutable objects ensuring that handlers are called on every entry that applies. If a single object
|
|
68
71
|
* is passed in and no changes are made, that object will be returned. If updates happen from the handlers it will return the
|
|
@@ -75,4 +78,4 @@ export declare function immutableMergeCore<T extends ObjectBase>(options: Recurs
|
|
|
75
78
|
* @param objs - one or more objects to process. If multiple objects are passed they will be merged
|
|
76
79
|
*/
|
|
77
80
|
export declare function processImmutable<T extends ObjectBase>(options: MergeOptions, ...objs: (T | undefined)[]): T | undefined;
|
|
78
|
-
//# sourceMappingURL=Merge.d.ts.map
|
|
81
|
+
//# sourceMappingURL=Merge.d.ts.map
|