@resistdesign/voltra 3.0.0-alpha.5 → 3.0.0-alpha.51

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 (222) hide show
  1. package/README.md +392 -14
  2. package/api/DBX/DBXAsserts.d.ts +95 -0
  3. package/api/DBX/DBXRequest.d.ts +5 -0
  4. package/api/DBX/DBXRuntime.d.ts +5 -0
  5. package/api/DBX/DBXScenarioConfig.d.ts +9 -0
  6. package/api/DBX/DBXSeed.d.ts +124 -0
  7. package/api/DBX/DBXTypes.d.ts +176 -0
  8. package/api/DBX/index.d.ts +8 -0
  9. package/api/DataAccessControl.d.ts +220 -0
  10. package/api/Indexing/API.d.ts +224 -0
  11. package/api/Indexing/Cursor.d.ts +101 -0
  12. package/api/Indexing/Handler/Config.d.ts +39 -0
  13. package/api/Indexing/Handler.d.ts +166 -0
  14. package/api/Indexing/Trace.d.ts +54 -0
  15. package/api/Indexing/Types.d.ts +204 -0
  16. package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
  17. package/api/Indexing/ddb/Types.d.ts +209 -0
  18. package/api/Indexing/docId.d.ts +27 -0
  19. package/api/Indexing/exact/ExactDdb.d.ts +58 -0
  20. package/api/Indexing/exact/ExactIndex.d.ts +90 -0
  21. package/api/Indexing/exact/ExactS3.d.ts +41 -0
  22. package/api/Indexing/fieldQualification.d.ts +12 -0
  23. package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +212 -0
  24. package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
  25. package/api/Indexing/fulltext/Schema.d.ts +164 -0
  26. package/api/Indexing/hashUniversal.d.ts +13 -0
  27. package/api/Indexing/index.d.ts +45 -0
  28. package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
  29. package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
  30. package/api/Indexing/lossy/LossyS3.d.ts +40 -0
  31. package/api/Indexing/rel/Cursor.d.ts +25 -0
  32. package/api/Indexing/rel/Handlers.d.ts +144 -0
  33. package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
  34. package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
  35. package/api/Indexing/rel/Types.d.ts +69 -0
  36. package/api/Indexing/structured/Cursor.d.ts +26 -0
  37. package/api/Indexing/structured/Handlers.d.ts +128 -0
  38. package/api/Indexing/structured/SearchStructured.d.ts +44 -0
  39. package/api/Indexing/structured/StructuredDdb.d.ts +184 -0
  40. package/api/Indexing/structured/StructuredDdbBackend.d.ts +112 -0
  41. package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +40 -0
  42. package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +61 -0
  43. package/api/Indexing/structured/StructuredStringLike.d.ts +54 -0
  44. package/api/Indexing/structured/StructuredWriter.d.ts +74 -0
  45. package/api/Indexing/structured/Types.d.ts +126 -0
  46. package/api/Indexing/structured/index.d.ts +9 -0
  47. package/api/Indexing/tokenize.d.ts +31 -0
  48. package/api/ORM/DACUtils.d.ts +270 -0
  49. package/api/ORM/ListItemUtils.d.ts +40 -0
  50. package/api/ORM/ORMRouteMap.d.ts +70 -0
  51. package/api/ORM/TypeInfoORMService.d.ts +879 -0
  52. package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
  53. package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +90 -0
  54. package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
  55. package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +56 -0
  56. package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
  57. package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
  58. package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
  59. package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
  60. package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
  61. package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
  62. package/api/ORM/drivers/S3FileItemDBDriver.d.ts +71 -0
  63. package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
  64. package/api/ORM/drivers/common/Types.d.ts +202 -0
  65. package/api/ORM/drivers/common/index.d.ts +2 -0
  66. package/api/ORM/drivers/index.d.ts +8 -0
  67. package/api/ORM/getTypeInfoORMIndexingConfigFromTypeInfoMap.d.ts +31 -0
  68. package/api/ORM/index.d.ts +10 -0
  69. package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +22 -0
  70. package/api/Router/AWS.d.ts +80 -0
  71. package/api/Router/Auth.d.ts +14 -0
  72. package/api/Router/CORS.d.ts +66 -0
  73. package/api/Router/Types.d.ts +138 -0
  74. package/api/Router/index.d.ts +89 -0
  75. package/api/index.d.ts +72 -6
  76. package/api/index.js +3553 -1948
  77. package/app/forms/Engine.d.ts +23 -0
  78. package/app/forms/UI.d.ts +83 -0
  79. package/app/forms/core/createAutoField.d.ts +43 -0
  80. package/app/forms/core/createFormRenderer.d.ts +25 -0
  81. package/app/forms/core/getFieldKind.d.ts +14 -0
  82. package/app/forms/core/index.d.ts +11 -0
  83. package/app/forms/core/mergeSuites.d.ts +23 -0
  84. package/app/forms/core/resolveSuite.d.ts +15 -0
  85. package/app/forms/core/types.d.ts +180 -0
  86. package/app/forms/index.d.ts +9 -0
  87. package/app/forms/types.d.ts +137 -0
  88. package/app/helpers/styled.d.ts +3 -0
  89. package/app/index.d.ts +116 -5
  90. package/app/index.js +120 -382
  91. package/app/utils/ApplicationState.d.ts +161 -0
  92. package/app/utils/ApplicationStateLoader.d.ts +91 -0
  93. package/app/utils/Controller.d.ts +10 -0
  94. package/app/utils/Debug.d.ts +14 -0
  95. package/app/utils/EasyLayout.d.ts +89 -0
  96. package/app/utils/History.d.ts +165 -0
  97. package/app/utils/Route.d.ts +207 -0
  98. package/app/utils/RouteHistory.d.ts +27 -0
  99. package/app/utils/Service.d.ts +45 -0
  100. package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
  101. package/app/utils/TypeInfoORMClient.d.ts +104 -0
  102. package/app/utils/UniversalRouteAdapter.d.ts +73 -0
  103. package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
  104. package/app/utils/easy-layout/computeTracks.d.ts +16 -0
  105. package/app/utils/easy-layout/index.d.ts +5 -0
  106. package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
  107. package/app/utils/easy-layout/types.d.ts +52 -0
  108. package/app/utils/easy-layout/validateAreas.d.ts +5 -0
  109. package/app/utils/index.d.ts +24 -0
  110. package/build/TypeMapping.d.ts +17 -0
  111. package/build/TypeParsing.d.ts +10 -0
  112. package/build/index.d.ts +15 -0
  113. package/build/index.js +569 -0
  114. package/chunk-2JDOM6PB.js +138 -0
  115. package/chunk-3HVYVX3S.js +546 -0
  116. package/chunk-ATO2455Q.js +258 -0
  117. package/chunk-BSHQIRBV.js +71 -0
  118. package/chunk-I2KLQ2HA.js +19 -0
  119. package/chunk-K4R2PFNG.js +1258 -0
  120. package/chunk-TJFTWPXQ.js +39 -0
  121. package/chunk-XHOMAXLR.js +84 -0
  122. package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
  123. package/common/CommandLine/index.d.ts +6 -0
  124. package/common/HelperTypes.d.ts +9 -0
  125. package/common/IdGeneration/getSimpleId.d.ts +8 -0
  126. package/common/IdGeneration/index.d.ts +1 -0
  127. package/common/ItemRelationshipInfoTypes.d.ts +64 -0
  128. package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
  129. package/common/ItemRelationships/index.d.ts +2 -0
  130. package/common/Logging/Utils.d.ts +10 -0
  131. package/common/Logging/index.d.ts +1 -0
  132. package/common/Routing.d.ts +81 -0
  133. package/common/SearchTypes.d.ts +227 -0
  134. package/common/SearchUtils.d.ts +55 -0
  135. package/common/SearchValidation.d.ts +27 -0
  136. package/common/StringTransformers.d.ts +28 -0
  137. package/common/Testing/CLI.d.ts +6 -0
  138. package/common/Testing/Types.d.ts +216 -0
  139. package/common/Testing/Utils.d.ts +112 -0
  140. package/common/Testing/index.d.ts +8 -0
  141. package/common/TypeInfoDataItemUtils.d.ts +39 -0
  142. package/{Types-C7XjUjoF.d.ts → common/TypeInfoORM/Types.d.ts} +150 -20
  143. package/common/TypeInfoORM/index.d.ts +3 -0
  144. package/common/TypeParsing/Constants.d.ts +4 -0
  145. package/common/TypeParsing/ParsingUtils/Constants.d.ts +8 -0
  146. package/common/TypeParsing/ParsingUtils/checkType.d.ts +14 -0
  147. package/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +12 -0
  148. package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
  149. package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
  150. package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
  151. package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
  152. package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
  153. package/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +9 -0
  154. package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
  155. package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
  156. package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
  157. package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
  158. package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
  159. package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
  160. package/common/TypeParsing/TypeInfo.d.ts +235 -0
  161. package/common/TypeParsing/Utils.d.ts +47 -0
  162. package/common/TypeParsing/Validation.d.ts +327 -0
  163. package/common/TypeParsing/index.d.ts +8 -0
  164. package/common/index.d.ts +47 -4
  165. package/common/index.js +25 -1737
  166. package/{index-BkFZlfit.d.ts → iac/SimpleCFT.d.ts} +5 -25
  167. package/iac/index.d.ts +40 -2
  168. package/iac/index.js +2 -1661
  169. package/iac/packs/auth.d.ts +131 -0
  170. package/iac/packs/build/utils.d.ts +289 -0
  171. package/iac/packs/build.d.ts +92 -0
  172. package/iac/packs/cdn.d.ts +33 -0
  173. package/iac/packs/cloud-function.d.ts +67 -0
  174. package/iac/packs/database.d.ts +32 -0
  175. package/iac/packs/dns.d.ts +34 -0
  176. package/iac/packs/file-storage.d.ts +46 -0
  177. package/iac/packs/gateway.d.ts +82 -0
  178. package/iac/packs/index.d.ts +60 -1
  179. package/iac/packs/index.js +391 -594
  180. package/iac/packs/repo.d.ts +28 -0
  181. package/iac/packs/ssl-certificate.d.ts +28 -0
  182. package/iac/types/Constants.d.ts +24 -0
  183. package/{index-DcvJOZ_c.d.ts → iac/types/IaCTypes.d.ts} +23 -1018
  184. package/iac/types/Renderers.d.ts +96 -0
  185. package/iac/types/Types.d.ts +131 -0
  186. package/iac/types/Utils.d.ts +9 -0
  187. package/iac/types/generate.d.ts +1 -0
  188. package/iac/utils/index.d.ts +87 -0
  189. package/iac/utils/patch-utils.d.ts +66 -0
  190. package/iac-packs/index.d.ts +6 -0
  191. package/native/forms/UI.d.ts +73 -0
  192. package/native/forms/createNativeFormRenderer.d.ts +21 -0
  193. package/native/forms/index.d.ts +25 -0
  194. package/native/forms/primitives/index.d.ts +38 -0
  195. package/native/forms/suite.d.ts +15 -0
  196. package/native/index.d.ts +19 -0
  197. package/native/index.js +792 -0
  198. package/native/testing/react-native.d.ts +46 -0
  199. package/native/utils/EasyLayout.d.ts +88 -0
  200. package/native/utils/History.d.ts +124 -0
  201. package/native/utils/NavButton.d.ts +25 -0
  202. package/native/utils/Route.d.ts +41 -0
  203. package/native/utils/index.d.ts +25 -0
  204. package/package.json +54 -21
  205. package/web/forms/UI.d.ts +74 -0
  206. package/web/forms/createWebFormRenderer.d.ts +21 -0
  207. package/web/forms/index.d.ts +9 -0
  208. package/web/forms/primitives/index.d.ts +21 -0
  209. package/web/forms/suite.d.ts +15 -0
  210. package/web/index.d.ts +15 -0
  211. package/web/index.js +701 -0
  212. package/web/utils/EasyLayout.d.ts +47 -0
  213. package/web/utils/NavLink.d.ts +24 -0
  214. package/web/utils/Route.d.ts +16 -0
  215. package/web/utils/index.d.ts +8 -0
  216. package/SearchTypes-DjN6YQzE.d.ts +0 -577
  217. package/Validation-CFP59oIP.d.ts +0 -226
  218. package/index-C3-iD9Mh.d.ts +0 -690
  219. package/index-CK5Qwvfb.d.ts +0 -5378
  220. package/index-IokxSNxm.d.ts +0 -745
  221. package/index.d.ts +0 -13
  222. package/index.js +0 -11005
@@ -0,0 +1,258 @@
1
+ import YAML from 'yaml';
2
+
3
+ // src/iac/utils/patch-utils.ts
4
+ var DEFAULT_MERGE_STRATEGY = "transpose";
5
+ var getValuePathString = (valuePathArray = []) => valuePathArray.map((p) => encodeURIComponent(p)).join("/");
6
+ var getValuePathArray = (valuePathString = "") => valuePathString.split("/").map((p) => decodeURIComponent(p));
7
+ var isConstructedFrom = (value, constructorReference) => value !== null && typeof value === "object" && "constructor" in value && value.constructor === constructorReference;
8
+ var mergeValues = (valuePathArray = [], existingValue, newValue, mergeStrategyMap = {}) => {
9
+ const valuePathString = getValuePathString(valuePathArray);
10
+ const arrayIndexWildcardValuePathString = getValuePathString(
11
+ valuePathArray.map((p) => typeof p === "number" ? "#" : p)
12
+ );
13
+ const {
14
+ [valuePathString]: {
15
+ strategy: specificKeyMergeStrategy = DEFAULT_MERGE_STRATEGY,
16
+ data: specificKeyMergeStrategyData = void 0
17
+ } = {},
18
+ [arrayIndexWildcardValuePathString]: {
19
+ strategy: arrayIndexWildcardMergeStrategy = DEFAULT_MERGE_STRATEGY,
20
+ data: arrayIndexWildcardMergeStrategyData = void 0
21
+ } = {}
22
+ } = mergeStrategyMap;
23
+ const mergeStrategy = valuePathString in mergeStrategyMap ? specificKeyMergeStrategy : arrayIndexWildcardMergeStrategy;
24
+ const mergeStrategyData = valuePathString in mergeStrategyMap ? specificKeyMergeStrategyData : arrayIndexWildcardMergeStrategyData;
25
+ let mergedValue = typeof newValue !== "undefined" ? newValue : existingValue;
26
+ if (mergeStrategy !== "replace") {
27
+ if (isConstructedFrom(existingValue, Array) && isConstructedFrom(newValue, Array)) {
28
+ if (mergeStrategy === "accumulate") {
29
+ mergedValue = [...existingValue, ...newValue];
30
+ } else if (mergeStrategy === "accumulate-unique") {
31
+ mergedValue = [
32
+ ...existingValue,
33
+ ...newValue.filter((item) => existingValue.indexOf(item) === -1)
34
+ ];
35
+ } else if (mergeStrategy === "accumulate-unique-by") {
36
+ const existingItemMap = {};
37
+ const newItemMap = {};
38
+ for (let i = 0; i < existingValue.length; i++) {
39
+ const existingItem = existingValue[i];
40
+ if (existingItem && typeof existingItem === "object") {
41
+ const identifier = mergeStrategyData instanceof Function ? mergeStrategyData(existingItem) : existingItem[mergeStrategyData];
42
+ existingItemMap[identifier] = existingItem;
43
+ }
44
+ }
45
+ for (let j = 0; j < newValue.length; j++) {
46
+ const newItem = newValue[j];
47
+ if (newItem && typeof newItem === "object") {
48
+ const identifier = mergeStrategyData instanceof Function ? mergeStrategyData(newItem) : newItem[mergeStrategyData];
49
+ newItemMap[identifier] = newItem;
50
+ }
51
+ }
52
+ mergedValue = Object.keys({
53
+ ...existingItemMap,
54
+ ...newItemMap
55
+ }).map(
56
+ (id, index) => mergeValues(
57
+ [...valuePathArray, index],
58
+ existingItemMap[id],
59
+ newItemMap[id],
60
+ mergeStrategyMap
61
+ )
62
+ );
63
+ } else if (mergeStrategy === "transpose") {
64
+ const fullLength = Math.max(existingValue.length, newValue.length);
65
+ mergedValue = [...new Array(fullLength)].map(
66
+ (_empty, index) => mergeValues(
67
+ [...valuePathArray, index],
68
+ existingValue[index],
69
+ newValue[index],
70
+ mergeStrategyMap
71
+ )
72
+ );
73
+ }
74
+ } else if (isConstructedFrom(existingValue, Object) && isConstructedFrom(newValue, Object)) {
75
+ mergedValue = Object.keys({ ...existingValue, ...newValue }).reduce(
76
+ (acc, k) => ({
77
+ ...acc,
78
+ [k]: mergeValues(
79
+ [...valuePathArray, k],
80
+ existingValue[k],
81
+ newValue[k],
82
+ mergeStrategyMap
83
+ )
84
+ }),
85
+ {}
86
+ );
87
+ }
88
+ }
89
+ return mergedValue;
90
+ };
91
+
92
+ // src/iac/utils/index.ts
93
+ var addParameter = (parameterInfo, template) => {
94
+ const { ParameterId, Parameter, Label, Group } = parameterInfo;
95
+ const {
96
+ Parameters,
97
+ Metadata: {
98
+ "AWS::CloudFormation::Interface": {
99
+ ParameterGroups = [],
100
+ ParameterLabels = {}
101
+ } = {}
102
+ } = {}
103
+ } = template;
104
+ let NewParameterGroups = ParameterGroups;
105
+ if (Group) {
106
+ const GroupObject = ParameterGroups.filter(
107
+ (g) => g.Label?.default === Group
108
+ )[0];
109
+ NewParameterGroups = GroupObject ? ParameterGroups.map(
110
+ (g) => g.Label?.default === Group ? {
111
+ ...g,
112
+ Parameters: [...g.Parameters || [], ParameterId]
113
+ } : g
114
+ ) : [
115
+ ...ParameterGroups,
116
+ {
117
+ Label: {
118
+ default: Group
119
+ },
120
+ Parameters: [ParameterId]
121
+ }
122
+ ];
123
+ }
124
+ return {
125
+ ...template,
126
+ Parameters: {
127
+ ...Parameters,
128
+ [ParameterId]: Parameter
129
+ },
130
+ Metadata: {
131
+ ...template.Metadata,
132
+ "AWS::CloudFormation::Interface": {
133
+ ...template?.Metadata?.["AWS::CloudFormation::Interface"],
134
+ ParameterGroups: NewParameterGroups,
135
+ ParameterLabels: {
136
+ ...ParameterLabels,
137
+ [ParameterId]: {
138
+ default: Label
139
+ }
140
+ }
141
+ }
142
+ }
143
+ };
144
+ };
145
+ var addParameters = (parameters, template) => parameters.reduce((acc, p) => addParameter(p, acc), template);
146
+ var patchTemplate = (patch, template) => mergeValues([], template, patch, {
147
+ [getValuePathString([
148
+ // Parameter Groups
149
+ "Metadata",
150
+ "AWS::CloudFormation::Interface",
151
+ "ParameterGroups"
152
+ ])]: {
153
+ strategy: "accumulate-unique-by",
154
+ data: (pG) => pG?.Label?.default
155
+ },
156
+ [getValuePathString([
157
+ // Parameter Group Parameter Ids
158
+ "Metadata",
159
+ "AWS::CloudFormation::Interface",
160
+ "ParameterGroups",
161
+ "#",
162
+ "Parameters"
163
+ ])]: {
164
+ strategy: "accumulate-unique"
165
+ }
166
+ });
167
+ var createResourcePack = (creator) => (params, template) => {
168
+ const patch = creator(params);
169
+ return patchTemplate(patch, template);
170
+ };
171
+ var SimpleCFT = class {
172
+ /**
173
+ * Create a SimpleCFT template wrapper.
174
+ *
175
+ * @param template - Initial CloudFormation template.
176
+ */
177
+ constructor(template = {
178
+ AWSTemplateFormatVersion: "2010-09-09"
179
+ }) {
180
+ this.template = template;
181
+ }
182
+ /**
183
+ * Apply a pack with configuration to the stack template.
184
+ * @see `@resistdesign/voltra/iac` and `@resistdesign/voltra/iac/packs` for examples.
185
+ * */
186
+ applyPack = (pack, params) => {
187
+ this.template = pack(params, this.template);
188
+ return this;
189
+ };
190
+ /**
191
+ * Apply a patch to the stack template.
192
+ *
193
+ * @param patch - Template patch to merge.
194
+ * */
195
+ patch = (patch) => {
196
+ this.template = patchTemplate(patch, this.template);
197
+ return this;
198
+ };
199
+ /**
200
+ * Add a stack parameter including its descriptive info and an optional parameter group.
201
+ *
202
+ * @param parameter - Parameter definition and metadata.
203
+ * */
204
+ addParameter = (parameter) => {
205
+ this.template = addParameter(parameter, this.template);
206
+ return this;
207
+ };
208
+ /**
209
+ * Add a group of stack parameters including their descriptive info and an optional parameter group.
210
+ *
211
+ * @param group - Parameter group definition.
212
+ * */
213
+ addParameterGroup = ({ Label: Group, Parameters }) => {
214
+ const parameterIds = Object.keys(Parameters);
215
+ const parameterList = parameterIds.map((ParameterId) => {
216
+ const { Label, ...Parameter } = Parameters[ParameterId];
217
+ return {
218
+ Group,
219
+ ParameterId,
220
+ Label,
221
+ Parameter
222
+ };
223
+ });
224
+ this.template = addParameters(parameterList, this.template);
225
+ return this;
226
+ };
227
+ /**
228
+ * Use a modification to dynamically apply various changes at once.
229
+ *
230
+ * @param modification - Modification callback to apply.
231
+ * */
232
+ modify = (modification) => {
233
+ modification(this);
234
+ return this;
235
+ };
236
+ /**
237
+ * Convert the stack template to a string.
238
+ *
239
+ * @returns JSON string representation of the template.
240
+ * */
241
+ toString = () => JSON.stringify(this.template, null, 2);
242
+ /**
243
+ * Convert the stack template to a JSON object.
244
+ *
245
+ * @returns Template JSON object.
246
+ * */
247
+ toJSON = () => this.template;
248
+ /**
249
+ * Convert the stack template to a YAML string.
250
+ *
251
+ * @returns YAML string representation of the template.
252
+ * */
253
+ toYAML = () => YAML.stringify(this.template, {
254
+ aliasDuplicateObjects: false
255
+ });
256
+ };
257
+
258
+ export { DEFAULT_MERGE_STRATEGY, SimpleCFT, addParameter, addParameters, createResourcePack, getValuePathArray, getValuePathString, isConstructedFrom, mergeValues, patchTemplate };
@@ -0,0 +1,71 @@
1
+ import { parseTemplate, validateAreas } from './chunk-K4R2PFNG.js';
2
+
3
+ // src/app/utils/EasyLayout.tsx
4
+ var getPascalCaseAreaName = (area) => {
5
+ return area.split("-").map((a) => a[0].toUpperCase() + a.slice(1)).join("");
6
+ };
7
+ var convertLayoutToCSS = (layout = "", spacing = {}) => {
8
+ const parsed = parseTemplate(layout);
9
+ validateAreas(parsed);
10
+ const renderTrack = (track) => {
11
+ if (track.kind === "px") {
12
+ return `${track.value}px`;
13
+ }
14
+ if (track.kind === "pct") {
15
+ return `${track.value}%`;
16
+ }
17
+ return `${track.value}fr`;
18
+ };
19
+ const areaRows = parsed.areaGrid.map((row) => row.join(" "));
20
+ const rows = parsed.rowTracks.map(renderTrack);
21
+ let css = "";
22
+ if (parsed.colTracks.length) {
23
+ css += `
24
+ grid-template-columns: ${parsed.colTracks.map(renderTrack).join(" ")};`;
25
+ }
26
+ css += `
27
+ grid-template-areas:
28
+ ${areaRows.map((a) => ` "${a}"`).join("\n")};`;
29
+ if (rows.length) {
30
+ css += `
31
+ grid-template-rows: ${rows.join(" ")};`;
32
+ }
33
+ if (typeof spacing.gap !== "undefined") {
34
+ css += `
35
+ gap: ${typeof spacing.gap === "number" ? `${spacing.gap}px` : spacing.gap};`;
36
+ }
37
+ if (typeof spacing.padding !== "undefined") {
38
+ css += `
39
+ padding: ${typeof spacing.padding === "number" ? `${spacing.padding}px` : spacing.padding};`;
40
+ }
41
+ return {
42
+ areasList: parsed.areaNames,
43
+ css
44
+ };
45
+ };
46
+ var getEasyLayoutTemplateDetails = (layout = "", spacing = {}) => convertLayoutToCSS(layout, spacing);
47
+ var createEasyLayout = (config, extendFrom, areasExtendFrom, spacing = {}) => {
48
+ return (layoutTemplate, ...expressions) => {
49
+ const mergedTemplate = layoutTemplate.reduce((acc, l, ind) => {
50
+ const expr = expressions[ind - 1];
51
+ const exprStr = typeof expr === "undefined" ? "" : expr;
52
+ return `${acc}${l}${exprStr}`;
53
+ }, "");
54
+ const { areasList, css } = convertLayoutToCSS(mergedTemplate, spacing);
55
+ const layout = config.createLayout({ base: extendFrom, css });
56
+ const areas = areasList.reduce((acc, area) => {
57
+ const pascalCaseAreaName = getPascalCaseAreaName(area);
58
+ const component = config.createArea({ base: areasExtendFrom, area });
59
+ return {
60
+ ...acc,
61
+ [pascalCaseAreaName]: component
62
+ };
63
+ }, {});
64
+ return {
65
+ layout,
66
+ areas
67
+ };
68
+ };
69
+ };
70
+
71
+ export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName };
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+
19
+ export { __export, __reExport };