@contember/react-multipass-rendering 2.1.0-alpha.30 → 2.1.0-alpha.36

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.
Files changed (114) hide show
  1. package/package.json +8 -3
  2. package/src/ChildrenAnalyzer.ts +26 -25
  3. package/src/helpers/wrapError.ts +2 -3
  4. package/src/nodeSpecs/BranchNode.ts +5 -5
  5. package/src/nodeSpecs/Leaf.ts +3 -7
  6. package/src/nodeSpecs/types/UnconstrainedLeafRepresentationFactory.ts +2 -2
  7. package/tests/cases/unit/childrenAnalyzer.spec.tsx +1 -3
  8. package/dist/development/index.cjs +0 -11
  9. package/dist/development/index.cjs.map +0 -1
  10. package/dist/development/index.js +0 -11
  11. package/dist/development/index.js.map +0 -1
  12. package/dist/development/src/ChildrenAnalyzer.cjs +0 -167
  13. package/dist/development/src/ChildrenAnalyzer.cjs.map +0 -1
  14. package/dist/development/src/ChildrenAnalyzer.js +0 -167
  15. package/dist/development/src/ChildrenAnalyzer.js.map +0 -1
  16. package/dist/development/src/ChildrenAnalyzerError.cjs +0 -14
  17. package/dist/development/src/ChildrenAnalyzerError.cjs.map +0 -1
  18. package/dist/development/src/ChildrenAnalyzerError.js +0 -14
  19. package/dist/development/src/ChildrenAnalyzerError.js.map +0 -1
  20. package/dist/development/src/helpers/getErrorMessage.cjs +0 -7
  21. package/dist/development/src/helpers/getErrorMessage.cjs.map +0 -1
  22. package/dist/development/src/helpers/getErrorMessage.js +0 -7
  23. package/dist/development/src/helpers/getErrorMessage.js.map +0 -1
  24. package/dist/development/src/helpers/wrapError.cjs +0 -51
  25. package/dist/development/src/helpers/wrapError.cjs.map +0 -1
  26. package/dist/development/src/helpers/wrapError.js +0 -51
  27. package/dist/development/src/helpers/wrapError.js.map +0 -1
  28. package/dist/development/src/nodeSpecs/BranchNode.cjs +0 -38
  29. package/dist/development/src/nodeSpecs/BranchNode.cjs.map +0 -1
  30. package/dist/development/src/nodeSpecs/BranchNode.js +0 -38
  31. package/dist/development/src/nodeSpecs/BranchNode.js.map +0 -1
  32. package/dist/development/src/nodeSpecs/Leaf.cjs +0 -24
  33. package/dist/development/src/nodeSpecs/Leaf.cjs.map +0 -1
  34. package/dist/development/src/nodeSpecs/Leaf.js +0 -24
  35. package/dist/development/src/nodeSpecs/Leaf.js.map +0 -1
  36. package/dist/production/index.cjs +0 -11
  37. package/dist/production/index.cjs.map +0 -1
  38. package/dist/production/index.js +0 -11
  39. package/dist/production/index.js.map +0 -1
  40. package/dist/production/src/ChildrenAnalyzer.cjs +0 -167
  41. package/dist/production/src/ChildrenAnalyzer.cjs.map +0 -1
  42. package/dist/production/src/ChildrenAnalyzer.js +0 -167
  43. package/dist/production/src/ChildrenAnalyzer.js.map +0 -1
  44. package/dist/production/src/ChildrenAnalyzerError.cjs +0 -14
  45. package/dist/production/src/ChildrenAnalyzerError.cjs.map +0 -1
  46. package/dist/production/src/ChildrenAnalyzerError.js +0 -14
  47. package/dist/production/src/ChildrenAnalyzerError.js.map +0 -1
  48. package/dist/production/src/helpers/getErrorMessage.cjs +0 -7
  49. package/dist/production/src/helpers/getErrorMessage.cjs.map +0 -1
  50. package/dist/production/src/helpers/getErrorMessage.js +0 -7
  51. package/dist/production/src/helpers/getErrorMessage.js.map +0 -1
  52. package/dist/production/src/helpers/wrapError.cjs +0 -51
  53. package/dist/production/src/helpers/wrapError.cjs.map +0 -1
  54. package/dist/production/src/helpers/wrapError.js +0 -51
  55. package/dist/production/src/helpers/wrapError.js.map +0 -1
  56. package/dist/production/src/nodeSpecs/BranchNode.cjs +0 -38
  57. package/dist/production/src/nodeSpecs/BranchNode.cjs.map +0 -1
  58. package/dist/production/src/nodeSpecs/BranchNode.js +0 -38
  59. package/dist/production/src/nodeSpecs/BranchNode.js.map +0 -1
  60. package/dist/production/src/nodeSpecs/Leaf.cjs +0 -24
  61. package/dist/production/src/nodeSpecs/Leaf.cjs.map +0 -1
  62. package/dist/production/src/nodeSpecs/Leaf.js +0 -24
  63. package/dist/production/src/nodeSpecs/Leaf.js.map +0 -1
  64. package/dist/types/BranchNodeList.d.ts +0 -3
  65. package/dist/types/BranchNodeList.d.ts.map +0 -1
  66. package/dist/types/ChildrenAnalyzer.d.ts +0 -15
  67. package/dist/types/ChildrenAnalyzer.d.ts.map +0 -1
  68. package/dist/types/ChildrenAnalyzerError.d.ts +0 -8
  69. package/dist/types/ChildrenAnalyzerError.d.ts.map +0 -1
  70. package/dist/types/ChildrenAnalyzerOptions.d.ts +0 -10
  71. package/dist/types/ChildrenAnalyzerOptions.d.ts.map +0 -1
  72. package/dist/types/ErrorMessageFactory.d.ts +0 -3
  73. package/dist/types/ErrorMessageFactory.d.ts.map +0 -1
  74. package/dist/types/LeafList.d.ts +0 -3
  75. package/dist/types/LeafList.d.ts.map +0 -1
  76. package/dist/types/helpers/getErrorMessage.d.ts +0 -4
  77. package/dist/types/helpers/getErrorMessage.d.ts.map +0 -1
  78. package/dist/types/helpers/index.d.ts +0 -2
  79. package/dist/types/helpers/index.d.ts.map +0 -1
  80. package/dist/types/helpers/wrapError.d.ts +0 -3
  81. package/dist/types/helpers/wrapError.d.ts.map +0 -1
  82. package/dist/types/index.d.ts +0 -5
  83. package/dist/types/index.d.ts.map +0 -1
  84. package/dist/types/nodeSpecs/BranchNode.d.ts +0 -23
  85. package/dist/types/nodeSpecs/BranchNode.d.ts.map +0 -1
  86. package/dist/types/nodeSpecs/BranchNodeOptions.d.ts +0 -5
  87. package/dist/types/nodeSpecs/BranchNodeOptions.d.ts.map +0 -1
  88. package/dist/types/nodeSpecs/Leaf.d.ts +0 -20
  89. package/dist/types/nodeSpecs/Leaf.d.ts.map +0 -1
  90. package/dist/types/nodeSpecs/RawNodeRepresentation.d.ts +0 -2
  91. package/dist/types/nodeSpecs/RawNodeRepresentation.d.ts.map +0 -1
  92. package/dist/types/nodeSpecs/index.d.ts +0 -6
  93. package/dist/types/nodeSpecs/index.d.ts.map +0 -1
  94. package/dist/types/nodeSpecs/types/ChildrenRepresentationReducer.d.ts +0 -2
  95. package/dist/types/nodeSpecs/types/ChildrenRepresentationReducer.d.ts.map +0 -1
  96. package/dist/types/nodeSpecs/types/ConstrainedLeafRepresentationFactory.d.ts +0 -3
  97. package/dist/types/nodeSpecs/types/ConstrainedLeafRepresentationFactory.d.ts.map +0 -1
  98. package/dist/types/nodeSpecs/types/DeclarationSiteNodeRepresentationFactory.d.ts +0 -2
  99. package/dist/types/nodeSpecs/types/DeclarationSiteNodeRepresentationFactory.d.ts.map +0 -1
  100. package/dist/types/nodeSpecs/types/RepresentationFactorySite.d.ts +0 -2
  101. package/dist/types/nodeSpecs/types/RepresentationFactorySite.d.ts.map +0 -1
  102. package/dist/types/nodeSpecs/types/StaticContextFactory.d.ts +0 -2
  103. package/dist/types/nodeSpecs/types/StaticContextFactory.d.ts.map +0 -1
  104. package/dist/types/nodeSpecs/types/SyntheticChildrenFactory.d.ts +0 -3
  105. package/dist/types/nodeSpecs/types/SyntheticChildrenFactory.d.ts.map +0 -1
  106. package/dist/types/nodeSpecs/types/UnconstrainedLeafRepresentationFactory.d.ts +0 -3
  107. package/dist/types/nodeSpecs/types/UnconstrainedLeafRepresentationFactory.d.ts.map +0 -1
  108. package/dist/types/nodeSpecs/types/UseSiteBranchNodeRepresentationFactory.d.ts +0 -3
  109. package/dist/types/nodeSpecs/types/UseSiteBranchNodeRepresentationFactory.d.ts.map +0 -1
  110. package/dist/types/nodeSpecs/types/ValidFactoryName.d.ts +0 -2
  111. package/dist/types/nodeSpecs/types/ValidFactoryName.d.ts.map +0 -1
  112. package/dist/types/nodeSpecs/types/index.d.ts +0 -10
  113. package/dist/types/nodeSpecs/types/index.d.ts.map +0 -1
  114. package/dist/types/tsconfig.tsbuildinfo +0 -1
@@ -1,167 +0,0 @@
1
- import { assertNever } from "@contember/utilities";
2
- import { ChildrenAnalyzerError } from "./ChildrenAnalyzerError.js";
3
- import { wrapError } from "./helpers/wrapError.js";
4
- import { getErrorMessage } from "./helpers/getErrorMessage.js";
5
- var __defProp = Object.defineProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
- const _ChildrenAnalyzer = class _ChildrenAnalyzer2 {
9
- constructor(leaves, decider = [], options = {}) {
10
- __publicField(this, "leaves");
11
- __publicField(this, "branchNodes");
12
- __publicField(this, "options");
13
- this.leaves = leaves;
14
- if (Array.isArray(decider)) {
15
- this.branchNodes = decider;
16
- } else {
17
- this.branchNodes = [];
18
- options = decider;
19
- }
20
- this.options = { ..._ChildrenAnalyzer2.defaultOptions, ...options };
21
- }
22
- processChildren(children, initialStaticContext) {
23
- const processed = this.processNode(children, initialStaticContext, []);
24
- const rawResult = Array.isArray(
25
- processed
26
- ) ? processed : [processed];
27
- return rawResult.filter(
28
- (item) => item !== void 0
29
- );
30
- }
31
- processNode(node, staticContext, componentPath) {
32
- if (!node || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
33
- for (const leaf of this.leaves) {
34
- const specification = leaf.specification;
35
- if (specification.type === "useSite") {
36
- const { ComponentType, factory } = specification;
37
- if (ComponentType === void 0) {
38
- return factory(node, staticContext);
39
- }
40
- }
41
- }
42
- if (node === false || node === void 0 || node === null) {
43
- return void 0;
44
- }
45
- if (!this.options.ignoreUnhandledNodes) {
46
- throw new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext));
47
- }
48
- return void 0;
49
- }
50
- if (typeof node === "function") {
51
- if (this.options.ignoreRenderProps) {
52
- return void 0;
53
- }
54
- throw new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext));
55
- }
56
- if (Array.isArray(node)) {
57
- let mapped = [];
58
- for (const subNode of node) {
59
- const processed = this.processNode(subNode, staticContext, componentPath);
60
- if (processed !== void 0) {
61
- if (Array.isArray(processed)) {
62
- mapped = mapped.concat(processed);
63
- } else {
64
- mapped.push(processed);
65
- }
66
- }
67
- }
68
- return mapped;
69
- }
70
- let children = void 0;
71
- if (!("type" in node)) {
72
- return this.processNode(children, staticContext, componentPath);
73
- }
74
- children = node.props.children;
75
- if (typeof node.type === "symbol") {
76
- return this.processNode(children, staticContext, componentPath);
77
- }
78
- const treeNode = node.type;
79
- componentPath = [...componentPath, node];
80
- if (typeof treeNode !== "string") {
81
- if (this.options.staticContextFactoryName in treeNode) {
82
- const staticContextFactory = treeNode[this.options.staticContextFactoryName];
83
- try {
84
- staticContext = staticContextFactory(node.props, staticContext);
85
- } catch (e) {
86
- wrapError(e, treeNode.displayName ?? "???", this.options.staticContextFactoryName, componentPath);
87
- }
88
- }
89
- if (this.options.staticRenderFactoryName in treeNode) {
90
- const factory = treeNode[this.options.staticRenderFactoryName];
91
- try {
92
- children = factory(node.props, staticContext);
93
- } catch (e) {
94
- wrapError(e, treeNode.displayName ?? "???", this.options.staticRenderFactoryName, componentPath);
95
- }
96
- }
97
- }
98
- for (const leaf of this.leaves) {
99
- const specification = leaf.specification;
100
- switch (specification.type) {
101
- case "declarationSite": {
102
- const { factoryMethodName } = specification;
103
- if (typeof treeNode !== "string" && factoryMethodName in treeNode) {
104
- const factory = treeNode[factoryMethodName];
105
- return factory(node.props, staticContext);
106
- }
107
- break;
108
- }
109
- case "useSite": {
110
- const { ComponentType, factory } = specification;
111
- if (ComponentType === void 0 || node.type === ComponentType) {
112
- return factory(node, staticContext);
113
- }
114
- break;
115
- }
116
- default:
117
- return assertNever(specification);
118
- }
119
- }
120
- const processedChildren = this.processNode(children, staticContext, componentPath);
121
- for (const branchNode of this.branchNodes) {
122
- const specification = branchNode.specification;
123
- switch (specification.type) {
124
- case "declarationSite": {
125
- const { factoryMethodName, childrenRepresentationReducer } = specification;
126
- if (typeof treeNode !== "string" && factoryMethodName in treeNode) {
127
- if (processedChildren === void 0 && !branchNode.options.childrenAreOptional) {
128
- throw new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage);
129
- }
130
- const factory = treeNode[factoryMethodName];
131
- return factory(node.props, childrenRepresentationReducer(processedChildren), staticContext);
132
- }
133
- break;
134
- }
135
- case "useSite": {
136
- const { factory, ComponentType } = specification;
137
- if (ComponentType === void 0 || node.type === ComponentType) {
138
- if (processedChildren === void 0 && !branchNode.options.childrenAreOptional) {
139
- throw new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage);
140
- }
141
- return factory(node, processedChildren, staticContext);
142
- }
143
- break;
144
- }
145
- default:
146
- return assertNever(specification);
147
- }
148
- }
149
- if (!this.options.ignoreUnhandledNodes && !(typeof treeNode !== "string" && this.options.staticRenderFactoryName in treeNode)) {
150
- throw new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext));
151
- }
152
- return processedChildren;
153
- }
154
- };
155
- __publicField(_ChildrenAnalyzer, "defaultOptions", {
156
- ignoreRenderProps: true,
157
- renderPropsErrorMessage: "Render props (functions as React component children) are not supported.",
158
- ignoreUnhandledNodes: true,
159
- unhandledNodeErrorMessage: "Encountered an unknown child.",
160
- staticContextFactoryName: "getStaticContext",
161
- staticRenderFactoryName: "staticRender"
162
- });
163
- let ChildrenAnalyzer = _ChildrenAnalyzer;
164
- export {
165
- ChildrenAnalyzer
166
- };
167
- //# sourceMappingURL=ChildrenAnalyzer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChildrenAnalyzer.js","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions'\nimport type { LeafList } from './LeafList'\nimport { getErrorMessage } from './helpers'\nimport { wrapError } from './helpers/wrapError'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\tprocessed,\n\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode = undefined\n\n\t\tif (!('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tchildren = node.props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as ElementType &\n\t\t{\n\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(node.props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(node.props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as UnconstrainedLeafRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(node.props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(node.props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes &&\n\t\t\t!(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer"],"mappings":";;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBe,k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AAEtD;AAAA,QAAA;AAAA,QAED;AACC,iBAAO,YAAY,aAAa;AAAA,MAAA;AAAA,IAClC;AAIA,QAAA,CAAC,KAAK,QAAQ,wBACd,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WACzE;AACK,YAAA,IAAI,sBAAsB,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAAA;AAGtG,WAAA;AAAA,EAAA;AAET;AA7OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var __defProp = Object.defineProperty;
4
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
6
- class ChildrenAnalyzerError extends Error {
7
- constructor(message, options) {
8
- super(message, options);
9
- __publicField(this, "details");
10
- this.details = options?.details;
11
- }
12
- }
13
- exports.ChildrenAnalyzerError = ChildrenAnalyzerError;
14
- //# sourceMappingURL=ChildrenAnalyzerError.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChildrenAnalyzerError.cjs","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzerError.ts"],"sourcesContent":["export class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n"],"names":[],"mappings":";;;;;AAAO,MAAM,8BAA8B,MAAM;AAAA,EAGhD,YAAY,SAAiB,SAA8C;AAC1E,UAAM,SAAS,OAAO;AAHhB,kBAAA,MAAA,SAAA;AAIN,SAAK,UAAU,SAAS;AAAA,EAAA;AAE1B;;"}
@@ -1,14 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
4
- class ChildrenAnalyzerError extends Error {
5
- constructor(message, options) {
6
- super(message, options);
7
- __publicField(this, "details");
8
- this.details = options?.details;
9
- }
10
- }
11
- export {
12
- ChildrenAnalyzerError
13
- };
14
- //# sourceMappingURL=ChildrenAnalyzerError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChildrenAnalyzerError.js","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzerError.ts"],"sourcesContent":["export class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n"],"names":[],"mappings":";;;AAAO,MAAM,8BAA8B,MAAM;AAAA,EAGhD,YAAY,SAAiB,SAA8C;AAC1E,UAAM,SAAS,OAAO;AAHhB,kBAAA,MAAA,SAAA;AAIN,SAAK,UAAU,SAAS;AAAA,EAAA;AAE1B;"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const getErrorMessage = (factory, node, staticContext) => {
4
- return typeof factory === "string" ? factory : factory(node, staticContext);
5
- };
6
- exports.getErrorMessage = getErrorMessage;
7
- //# sourceMappingURL=getErrorMessage.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getErrorMessage.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;;"}
@@ -1,7 +0,0 @@
1
- const getErrorMessage = (factory, node, staticContext) => {
2
- return typeof factory === "string" ? factory : factory(node, staticContext);
3
- };
4
- export {
5
- getErrorMessage
6
- };
7
- //# sourceMappingURL=getErrorMessage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getErrorMessage.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const ChildrenAnalyzerError = require("../ChildrenAnalyzerError.cjs");
5
- const wrapError = (e, currentComponentName, methodName, path) => {
6
- if (!(e instanceof Error)) {
7
- throw e;
8
- }
9
- const componentPath = path.map((it, index) => {
10
- const { children, ...props } = it.props;
11
- const printProps = (props2) => {
12
- let result = "";
13
- for (const [key, value] of Object.entries(props2)) {
14
- if (value === void 0) {
15
- continue;
16
- }
17
- try {
18
- const valuePrinted = JSON.stringify(
19
- value,
20
- (key2, value2) => {
21
- if (typeof value2 === "function") {
22
- return "(function)";
23
- }
24
- if (React.isValidElement(value2)) {
25
- return "(react element)";
26
- }
27
- return value2;
28
- }
29
- );
30
- result += ` ${key}=${valuePrinted}`;
31
- } catch {
32
- result += ` ${key}=(failed to print a value)`;
33
- }
34
- }
35
- return result;
36
- };
37
- const componentName = typeof it.type === "object" && "displayName" in it.type ? it.type.displayName : null;
38
- const propsPrinted = printProps(props);
39
- const indent = " ".repeat(index);
40
- return `${indent}<${componentName ?? "???"}${propsPrinted}>`;
41
- });
42
- const errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:
43
- ${e.message || "unknown error"}`;
44
- throw new ChildrenAnalyzerError.ChildrenAnalyzerError(errorMessage, {
45
- cause: e,
46
- details: `Component path:
47
- ${componentPath.join("\n")}`
48
- });
49
- };
50
- exports.wrapError = wrapError;
51
- //# sourceMappingURL=wrapError.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wrapError.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","ChildrenAnalyzerError"],"mappings":";;;;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACnH,MAAA,EAAE,aAAa,QAAQ;AACpB,UAAA;AAAA,EAAA;AAGP,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,UAAU,GAAG;AAC5B,UAAA,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QAAA;AAEG,YAAA;AACH,gBAAM,eAAe,KAAK;AAAA,YAAU;AAAA,YAAO,CAACC,MAAKC,WAAU;AACtD,kBAAA,OAAOA,WAAU,YAAY;AACzB,uBAAA;AAAA,cAAA;AAEJ,kBAAA,MAAM,eAAeA,MAAK,GAAG;AACzB,uBAAA;AAAA,cAAA;AAEDA,qBAAAA;AAAAA,YAAA;AAAA,UAER;AACU,oBAAA,IAAI,GAAG,IAAI,YAAY;AAAA,QAAA,QAC1B;AACP,oBAAU,IAAI,GAAG;AAAA,QAAA;AAAA,MAClB;AAEM,aAAA;AAAA,IACR;AACM,UAAA,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AACzG,UAAA,eAAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAIC,4CAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;"}
@@ -1,51 +0,0 @@
1
- import React__default from "react";
2
- import { ChildrenAnalyzerError } from "../ChildrenAnalyzerError.js";
3
- const wrapError = (e, currentComponentName, methodName, path) => {
4
- if (!(e instanceof Error)) {
5
- throw e;
6
- }
7
- const componentPath = path.map((it, index) => {
8
- const { children, ...props } = it.props;
9
- const printProps = (props2) => {
10
- let result = "";
11
- for (const [key, value] of Object.entries(props2)) {
12
- if (value === void 0) {
13
- continue;
14
- }
15
- try {
16
- const valuePrinted = JSON.stringify(
17
- value,
18
- (key2, value2) => {
19
- if (typeof value2 === "function") {
20
- return "(function)";
21
- }
22
- if (React__default.isValidElement(value2)) {
23
- return "(react element)";
24
- }
25
- return value2;
26
- }
27
- );
28
- result += ` ${key}=${valuePrinted}`;
29
- } catch {
30
- result += ` ${key}=(failed to print a value)`;
31
- }
32
- }
33
- return result;
34
- };
35
- const componentName = typeof it.type === "object" && "displayName" in it.type ? it.type.displayName : null;
36
- const propsPrinted = printProps(props);
37
- const indent = " ".repeat(index);
38
- return `${indent}<${componentName ?? "???"}${propsPrinted}>`;
39
- });
40
- const errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:
41
- ${e.message || "unknown error"}`;
42
- throw new ChildrenAnalyzerError(errorMessage, {
43
- cause: e,
44
- details: `Component path:
45
- ${componentPath.join("\n")}`
46
- });
47
- };
48
- export {
49
- wrapError
50
- };
51
- //# sourceMappingURL=wrapError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wrapError.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","React"],"mappings":";;AAGO,MAAM,Y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yzerError = require("../ChildrenAnalyzerError.cjs");
4
- var __defProp = Object.defineProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- const _BranchNode = class _BranchNode2 {
8
- constructor(factory, componentOrReducer, options) {
9
- __publicField(this, "specification");
10
- __publicField(this, "options");
11
- if (typeof factory !== "function") {
12
- this.specification = {
13
- type: "declarationSite",
14
- factoryMethodName: factory,
15
- childrenRepresentationReducer: componentOrReducer
16
- };
17
- } else if (typeof factory === "function") {
18
- this.specification = {
19
- type: "useSite",
20
- factory,
21
- ComponentType: componentOrReducer
22
- };
23
- } else {
24
- throw new ChildrenAnalyzerError.ChildrenAnalyzerError("Invalid arguments");
25
- }
26
- this.options = {
27
- ..._BranchNode2.defaultOptions,
28
- ...options
29
- };
30
- }
31
- };
32
- __publicField(_BranchNode, "defaultOptions", {
33
- childrenAreOptional: false,
34
- childrenAbsentErrorMessage: "Component must have children!"
35
- });
36
- let BranchNode = _BranchNode;
37
- exports.BranchNode = BranchNode;
38
- //# sourceMappingURL=BranchNode.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BranchNode.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\nimport type { BranchNodeOptions } from './BranchNodeOptions'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>\n\t\t }\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t }\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode","ChildrenAnalyzerError"],"mappings":";;;;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCc,kBAAA,MAAA,eAAA;AASA,kBAAA,MAAA,SAAA;AA0BX,QAAA,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAIhC;AAAA,IAAA,WACU,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAChB;AAAA,IAAA,OACM;AACA,YAAA,IAAIC,4CAAsB,mBAAmB;AAAA,IAAA;AAEpD,SAAK,UAAU;AAAA,MACd,GAAGD,aAAW;AAAA,MACd,GAAG;AAAA,IACJ;AAAA,EAAA;AAEF;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;;"}
@@ -1,38 +0,0 @@
1
- import { ChildrenAnalyzerError } from "../ChildrenAnalyzerError.js";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- const _BranchNode = class _BranchNode2 {
6
- constructor(factory, componentOrReducer, options) {
7
- __publicField(this, "specification");
8
- __publicField(this, "options");
9
- if (typeof factory !== "function") {
10
- this.specification = {
11
- type: "declarationSite",
12
- factoryMethodName: factory,
13
- childrenRepresentationReducer: componentOrReducer
14
- };
15
- } else if (typeof factory === "function") {
16
- this.specification = {
17
- type: "useSite",
18
- factory,
19
- ComponentType: componentOrReducer
20
- };
21
- } else {
22
- throw new ChildrenAnalyzerError("Invalid arguments");
23
- }
24
- this.options = {
25
- ..._BranchNode2.defaultOptions,
26
- ...options
27
- };
28
- }
29
- };
30
- __publicField(_BranchNode, "defaultOptions", {
31
- childrenAreOptional: false,
32
- childrenAbsentErrorMessage: "Component must have children!"
33
- });
34
- let BranchNode = _BranchNode;
35
- export {
36
- BranchNode
37
- };
38
- //# sourceMappingURL=BranchNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BranchNode.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\nimport type { BranchNodeOptions } from './BranchNodeOptions'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>\n\t\t }\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t }\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode"],"mappings":";;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCc,kBAAA,MAAA,eAAA;AASA,kBAAA,MAAA,SAAA;AA0BX,QAAA,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAIhC;AAAA,IAAA,WACU,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAChB;AAAA,IAAA,OACM;AACA,YAAA,IAAI,sBAAsB,mBAAmB;AAAA,IAAA;AAEpD,SAAK,UAAU;AAAA,MACd,GAAGA,aAAW;AAAA,MACd,GAAG;AAAA,IACJ;AAAA,EAAA;AAEF;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var __defProp = Object.defineProperty;
4
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
6
- class Leaf {
7
- constructor(factory, ComponentType) {
8
- __publicField(this, "specification");
9
- if (typeof factory === "function") {
10
- this.specification = {
11
- type: "useSite",
12
- ComponentType,
13
- factory
14
- };
15
- } else {
16
- this.specification = {
17
- type: "declarationSite",
18
- factoryMethodName: factory
19
- };
20
- }
21
- }
22
- }
23
- exports.Leaf = Leaf;
24
- //# sourceMappingURL=Leaf.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Leaf.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type {\n\tConstrainedLeafRepresentationFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './types'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t }\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t }\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;;;AAOA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXc,kBAAA,MAAA,eAAA;AAYX,QAAA,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAAA,IAAA,OACM;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MACpB;AAAA,IAAA;AAAA,EACD;AAEF;;"}
@@ -1,24 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
4
- class Leaf {
5
- constructor(factory, ComponentType) {
6
- __publicField(this, "specification");
7
- if (typeof factory === "function") {
8
- this.specification = {
9
- type: "useSite",
10
- ComponentType,
11
- factory
12
- };
13
- } else {
14
- this.specification = {
15
- type: "declarationSite",
16
- factoryMethodName: factory
17
- };
18
- }
19
- }
20
- }
21
- export {
22
- Leaf
23
- };
24
- //# sourceMappingURL=Leaf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Leaf.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type {\n\tConstrainedLeafRepresentationFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './types'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t }\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t }\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;AAOA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXc,kBAAA,MAAA,eAAA;AAYX,QAAA,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAAA,IAAA,OACM;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MACpB;AAAA,IAAA;AAAA,EACD;AAEF;"}
@@ -1,3 +0,0 @@
1
- import type { BranchNode, RawNodeRepresentation, ValidFactoryName } from './nodeSpecs';
2
- export type BranchNodeList<LeavesRepresentationUnion, BranchNodesRepresentationUnion, StaticContext> = BranchNode<any, StaticContext, ValidFactoryName, RawNodeRepresentation<LeavesRepresentationUnion, BranchNodesRepresentationUnion>, any, BranchNodesRepresentationUnion>[];
3
- //# sourceMappingURL=BranchNodeList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BranchNodeList.d.ts","sourceRoot":"","sources":["../../src/BranchNodeList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEtF,MAAM,MAAM,cAAc,CAAC,yBAAyB,EAAE,8BAA8B,EAAE,aAAa,IAAI,UAAU,CAChH,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,qBAAqB,CAAC,yBAAyB,EAAE,8BAA8B,CAAC,EAChF,GAAG,EACH,8BAA8B,CAC9B,EAAE,CAAA"}
@@ -1,15 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import type { BranchNodeList } from './BranchNodeList';
3
- import type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions';
4
- import type { LeafList } from './LeafList';
5
- export declare class ChildrenAnalyzer<AllLeavesRepresentation = any, AllBranchNodesRepresentation = never, StaticContext = undefined> {
6
- private static defaultOptions;
7
- private readonly leaves;
8
- private readonly branchNodes;
9
- private readonly options;
10
- constructor(leaves: LeafList<AllLeavesRepresentation, StaticContext>, options?: Partial<ChildrenAnalyzerOptions>);
11
- constructor(leaves: LeafList<AllLeavesRepresentation, StaticContext>, branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>, options?: Partial<ChildrenAnalyzerOptions>);
12
- processChildren(children: ReactNode, initialStaticContext: StaticContext): Array<AllLeavesRepresentation | AllBranchNodesRepresentation>;
13
- private processNode;
14
- }
15
- //# sourceMappingURL=ChildrenAnalyzer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChildrenAnalyzer.d.ts","sourceRoot":"","sources":["../../src/ChildrenAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAY1C,qBAAa,gBAAgB,CAC5B,uBAAuB,GAAG,GAAG,EAC7B,4BAA4B,GAAG,KAAK,EACpC,aAAa,GAAG,SAAS;IAEzB,OAAO,CAAC,MAAM,CAAC,cAAc,CAS5B;IAED,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;IACzE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsF;IAClH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwC;gBAG/D,MAAM,EAAE,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC,EACxD,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;gBAG1C,MAAM,EAAE,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC,EACxD,WAAW,EAAE,cAAc,CAAC,uBAAuB,EAAE,4BAA4B,EAAE,aAAa,CAAC,EACjG,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;IAoBpC,eAAe,CACrB,QAAQ,EAAE,SAAS,EACnB,oBAAoB,EAAE,aAAa,GACjC,KAAK,CAAC,uBAAuB,GAAG,4BAA4B,CAAC;IAchE,OAAO,CAAC,WAAW;CAkLnB"}
@@ -1,8 +0,0 @@
1
- export declare class ChildrenAnalyzerError extends Error {
2
- details?: string;
3
- constructor(message: string, options?: {
4
- cause: Error;
5
- details?: string;
6
- });
7
- }
8
- //# sourceMappingURL=ChildrenAnalyzerError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChildrenAnalyzerError.d.ts","sourceRoot":"","sources":["../../src/ChildrenAnalyzerError.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAsB,SAAQ,KAAK;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;gBAEX,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAIzE"}
@@ -1,10 +0,0 @@
1
- import type { ErrorMessageFactory } from './ErrorMessageFactory';
2
- export interface ChildrenAnalyzerOptions<StaticContext = any> {
3
- ignoreRenderProps: boolean;
4
- renderPropsErrorMessage: ErrorMessageFactory<StaticContext>;
5
- ignoreUnhandledNodes: boolean;
6
- unhandledNodeErrorMessage: ErrorMessageFactory<StaticContext>;
7
- staticContextFactoryName: string;
8
- staticRenderFactoryName: string;
9
- }
10
- //# sourceMappingURL=ChildrenAnalyzerOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChildrenAnalyzerOptions.d.ts","sourceRoot":"","sources":["../../src/ChildrenAnalyzerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,MAAM,WAAW,uBAAuB,CAAC,aAAa,GAAG,GAAG;IAC3D,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uBAAuB,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAE3D,oBAAoB,EAAE,OAAO,CAAA;IAC7B,yBAAyB,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAE7D,wBAAwB,EAAE,MAAM,CAAA;IAChC,uBAAuB,EAAE,MAAM,CAAA;CAC/B"}
@@ -1,3 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export type ErrorMessageFactory<StaticContext = any> = string | ((node: ReactNode, staticContext: StaticContext) => string);
3
- //# sourceMappingURL=ErrorMessageFactory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ErrorMessageFactory.d.ts","sourceRoot":"","sources":["../../src/ErrorMessageFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,mBAAmB,CAAC,aAAa,GAAG,GAAG,IAChD,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,KAAK,MAAM,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { Leaf, ValidFactoryName } from './nodeSpecs';
2
- export type LeafList<RepresentationUnion, StaticContext> = Leaf<any, StaticContext, ValidFactoryName, RepresentationUnion>[];
3
- //# sourceMappingURL=LeafList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LeafList.d.ts","sourceRoot":"","sources":["../../src/LeafList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEzD,MAAM,MAAM,QAAQ,CAAC,mBAAmB,EAAE,aAAa,IAAI,IAAI,CAC9D,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,mBAAmB,CACnB,EAAE,CAAA"}