@contember/react-multipass-rendering 1.0.0-alpha.8 → 1.0.0-rc.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/dist/types/BranchNodeList.d.ts +3 -0
- package/dist/types/BranchNodeList.d.ts.map +1 -0
- package/dist/types/ChildrenAnalyzer.d.ts +15 -0
- package/dist/types/ChildrenAnalyzer.d.ts.map +1 -0
- package/dist/types/ChildrenAnalyzerError.d.ts +3 -0
- package/dist/types/ChildrenAnalyzerError.d.ts.map +1 -0
- package/dist/types/ChildrenAnalyzerOptions.d.ts +10 -0
- package/dist/types/ChildrenAnalyzerOptions.d.ts.map +1 -0
- package/dist/types/ErrorMessageFactory.d.ts +3 -0
- package/dist/types/ErrorMessageFactory.d.ts.map +1 -0
- package/dist/types/LeafList.d.ts +3 -0
- package/dist/types/LeafList.d.ts.map +1 -0
- package/dist/types/assertNever.d.ts +2 -0
- package/dist/types/assertNever.d.ts.map +1 -0
- package/dist/types/helpers/getErrorMessage.d.ts +4 -0
- package/dist/types/helpers/getErrorMessage.d.ts.map +1 -0
- package/dist/types/helpers/index.d.ts +2 -0
- package/dist/types/helpers/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/nodeSpecs/BranchNode.d.ts +23 -0
- package/dist/types/nodeSpecs/BranchNode.d.ts.map +1 -0
- package/dist/types/nodeSpecs/BranchNodeOptions.d.ts +5 -0
- package/dist/types/nodeSpecs/BranchNodeOptions.d.ts.map +1 -0
- package/dist/types/nodeSpecs/Leaf.d.ts +20 -0
- package/dist/types/nodeSpecs/Leaf.d.ts.map +1 -0
- package/dist/types/nodeSpecs/RawNodeRepresentation.d.ts +2 -0
- package/dist/types/nodeSpecs/RawNodeRepresentation.d.ts.map +1 -0
- package/dist/types/nodeSpecs/index.d.ts +6 -0
- package/dist/types/nodeSpecs/index.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/ChildrenRepresentationReducer.d.ts +2 -0
- package/dist/types/nodeSpecs/types/ChildrenRepresentationReducer.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/ConstrainedLeafRepresentationFactory.d.ts +3 -0
- package/dist/types/nodeSpecs/types/ConstrainedLeafRepresentationFactory.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/DeclarationSiteNodeRepresentationFactory.d.ts +2 -0
- package/dist/types/nodeSpecs/types/DeclarationSiteNodeRepresentationFactory.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/RepresentationFactorySite.d.ts +2 -0
- package/dist/types/nodeSpecs/types/RepresentationFactorySite.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/StaticContextFactory.d.ts +2 -0
- package/dist/types/nodeSpecs/types/StaticContextFactory.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/SyntheticChildrenFactory.d.ts +3 -0
- package/dist/types/nodeSpecs/types/SyntheticChildrenFactory.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/UnconstrainedLeafRepresentationFactory.d.ts +3 -0
- package/dist/types/nodeSpecs/types/UnconstrainedLeafRepresentationFactory.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/UseSiteBranchNodeRepresentationFactory.d.ts +3 -0
- package/dist/types/nodeSpecs/types/UseSiteBranchNodeRepresentationFactory.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/ValidFactoryName.d.ts +2 -0
- package/dist/types/nodeSpecs/types/ValidFactoryName.d.ts.map +1 -0
- package/dist/types/nodeSpecs/types/index.d.ts +10 -0
- package/dist/types/nodeSpecs/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -5
- package/src/BranchNodeList.ts +10 -0
- package/src/ChildrenAnalyzer.ts +250 -0
- package/src/ChildrenAnalyzerError.ts +1 -0
- package/src/ChildrenAnalyzerOptions.ts +12 -0
- package/src/ErrorMessageFactory.ts +5 -0
- package/src/LeafList.ts +8 -0
- package/src/assertNever.ts +3 -0
- package/src/helpers/getErrorMessage.ts +10 -0
- package/src/helpers/index.ts +1 -0
- package/src/index.ts +5 -0
- package/src/nodeSpecs/BranchNode.ts +103 -0
- package/src/nodeSpecs/BranchNodeOptions.ts +4 -0
- package/src/nodeSpecs/Leaf.ts +59 -0
- package/src/nodeSpecs/RawNodeRepresentation.ts +5 -0
- package/src/nodeSpecs/index.ts +6 -0
- package/src/nodeSpecs/types/ChildrenRepresentationReducer.ts +3 -0
- package/src/nodeSpecs/types/ConstrainedLeafRepresentationFactory.ts +6 -0
- package/src/nodeSpecs/types/DeclarationSiteNodeRepresentationFactory.ts +10 -0
- package/src/nodeSpecs/types/RepresentationFactorySite.ts +1 -0
- package/src/nodeSpecs/types/StaticContextFactory.ts +4 -0
- package/src/nodeSpecs/types/SyntheticChildrenFactory.ts +6 -0
- package/src/nodeSpecs/types/UnconstrainedLeafRepresentationFactory.ts +6 -0
- package/src/nodeSpecs/types/UseSiteBranchNodeRepresentationFactory.ts +12 -0
- package/src/nodeSpecs/types/ValidFactoryName.ts +1 -0
- package/src/nodeSpecs/types/index.ts +9 -0
- package/src/tsconfig.json +6 -0
- package/dist/react-multipass-rendering.d.ts +0 -98
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react';
|
|
2
|
-
import type { ReactElement } from 'react';
|
|
3
|
-
import type { ReactNode } from 'react';
|
|
4
|
-
import type { ReactText } from 'react';
|
|
5
|
-
|
|
6
|
-
export declare class BranchNode<Props extends {} = {}, StaticContext = undefined, FactoryMethodName extends ValidFactoryName = string, ChildrenRepresentation = any, ReducedChildrenRepresentation = any, Representation = any> {
|
|
7
|
-
private static defaultOptions;
|
|
8
|
-
readonly specification: BranchNode.Specification<Props, StaticContext, FactoryMethodName, ChildrenRepresentation, ReducedChildrenRepresentation, Representation>;
|
|
9
|
-
readonly options: BranchNodeOptions;
|
|
10
|
-
constructor(factoryMethodName: FactoryMethodName, childrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>, options?: Partial<BranchNodeOptions>);
|
|
11
|
-
constructor(useSiteFactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>, ComponentType?: ElementType<Props>, options?: Partial<BranchNodeOptions>);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export declare namespace BranchNode {
|
|
15
|
-
export type Specification<Props extends {} = {}, StaticContext = any, FactoryMethodName extends ValidFactoryName = string, ChildrenRepresentation = any, ReducedChildrenRepresentation = any, Representation = any> = {
|
|
16
|
-
type: 'declarationSite';
|
|
17
|
-
factoryMethodName: FactoryMethodName;
|
|
18
|
-
childrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>;
|
|
19
|
-
} | {
|
|
20
|
-
type: 'useSite';
|
|
21
|
-
factory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>;
|
|
22
|
-
ComponentType?: ElementType<Props>;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare type BranchNodeList<LeavesRepresentationUnion, BranchNodesRepresentationUnion, StaticContext> = BranchNode<any, StaticContext, ValidFactoryName, RawNodeRepresentation<LeavesRepresentationUnion, BranchNodesRepresentationUnion>, any, BranchNodesRepresentationUnion>[];
|
|
27
|
-
|
|
28
|
-
export declare interface BranchNodeOptions {
|
|
29
|
-
childrenAreOptional: boolean;
|
|
30
|
-
childrenAbsentErrorMessage: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export declare class ChildrenAnalyzer<AllLeavesRepresentation = any, AllBranchNodesRepresentation = never, StaticContext = undefined> {
|
|
34
|
-
private static defaultOptions;
|
|
35
|
-
private readonly leaves;
|
|
36
|
-
private readonly branchNodes;
|
|
37
|
-
private readonly options;
|
|
38
|
-
constructor(leaves: LeafList<AllLeavesRepresentation, StaticContext>, options?: Partial<ChildrenAnalyzerOptions>);
|
|
39
|
-
constructor(leaves: LeafList<AllLeavesRepresentation, StaticContext>, branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>, options?: Partial<ChildrenAnalyzerOptions>);
|
|
40
|
-
processChildren(children: ReactNode, initialStaticContext: StaticContext): Array<AllLeavesRepresentation | AllBranchNodesRepresentation>;
|
|
41
|
-
private processNode;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export declare class ChildrenAnalyzerError extends Error {
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export declare interface ChildrenAnalyzerOptions<StaticContext = any> {
|
|
48
|
-
ignoreRenderProps: boolean;
|
|
49
|
-
renderPropsErrorMessage: ErrorMessageFactory<StaticContext>;
|
|
50
|
-
ignoreUnhandledNodes: boolean;
|
|
51
|
-
unhandledNodeErrorMessage: ErrorMessageFactory<StaticContext>;
|
|
52
|
-
staticContextFactoryName: string;
|
|
53
|
-
staticRenderFactoryName: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export declare type ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation> = (childrenRepresentations: ChildrenRepresentation) => ReducedChildrenRepresentation;
|
|
57
|
-
|
|
58
|
-
export declare type ConstrainedLeafRepresentationFactory<Props extends {}, Representation, StaticContext> = (node: ReactElement<Props, any>, staticContext: StaticContext) => Representation;
|
|
59
|
-
|
|
60
|
-
export declare type DeclarationSiteNodeRepresentationFactory<Props extends {}, ReducedChildrenRepresentation, Representation, StaticContext> = (props: Props, reducedChildrenRepresentation: ReducedChildrenRepresentation, staticContext: StaticContext) => Representation;
|
|
61
|
-
|
|
62
|
-
declare type ErrorMessageFactory<StaticContext = any> = string | ((node: ReactNode, staticContext: StaticContext) => string);
|
|
63
|
-
|
|
64
|
-
export declare class Leaf<Props extends {} = {}, StaticContext = any, FactoryMethodName extends ValidFactoryName = string, Representation = any> {
|
|
65
|
-
readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>;
|
|
66
|
-
constructor(factoryMethodName: FactoryMethodName);
|
|
67
|
-
constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>);
|
|
68
|
-
constructor(staticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>, ComponentType: ElementType<Props>);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export declare namespace Leaf {
|
|
72
|
-
export type Specification<FactoryMethodName extends ValidFactoryName, Representation, Props extends {}, StaticContext> = {
|
|
73
|
-
type: 'declarationSite';
|
|
74
|
-
factoryMethodName: FactoryMethodName;
|
|
75
|
-
} | {
|
|
76
|
-
type: 'useSite';
|
|
77
|
-
factory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>;
|
|
78
|
-
ComponentType?: ElementType<Props>;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare type LeafList<RepresentationUnion, StaticContext> = Leaf<any, StaticContext, ValidFactoryName, RepresentationUnion>[];
|
|
83
|
-
|
|
84
|
-
export declare type RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation = AllLeavesRepresentation> = AllLeavesRepresentation | AllBranchNodesRepresentation | Array<AllLeavesRepresentation | AllBranchNodesRepresentation> | undefined;
|
|
85
|
-
|
|
86
|
-
export declare type RepresentationFactorySite = 'declarationSite' | 'useSite';
|
|
87
|
-
|
|
88
|
-
export declare type StaticContextFactory<Props extends {}, StaticContext> = (props: Props, staticContext: StaticContext) => StaticContext;
|
|
89
|
-
|
|
90
|
-
export declare type SyntheticChildrenFactory<Props extends {}, StaticContext> = (props: Props, staticContext: StaticContext) => ReactNode;
|
|
91
|
-
|
|
92
|
-
export declare type UnconstrainedLeafRepresentationFactory<Props extends {}, Representation, StaticContext> = (node: ReactText | ReactElement<Props, any> | boolean | null | undefined | {}, staticContext: StaticContext) => Representation;
|
|
93
|
-
|
|
94
|
-
export declare type UseSiteBranchNodeRepresentationFactory<Props extends {}, ChildrenRepresentation, Representation, StaticContext> = (node: ReactElement<Props, any>, childrenRepresentation: ChildrenRepresentation, staticContext: StaticContext) => Representation;
|
|
95
|
-
|
|
96
|
-
export declare type ValidFactoryName = string | number;
|
|
97
|
-
|
|
98
|
-
export { }
|