@cratis/scene.engine 4.2.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/dist/cjs/editing/DescriptorCatalog.js +42 -0
  2. package/dist/cjs/editing/DescriptorCatalog.js.map +1 -0
  3. package/dist/cjs/editing/EditSession.js +44 -0
  4. package/dist/cjs/editing/EditSession.js.map +1 -0
  5. package/dist/cjs/editing/applyEdit.js +83 -0
  6. package/dist/cjs/editing/applyEdit.js.map +1 -0
  7. package/dist/cjs/editing/applyEffectiveConfiguration.js +62 -0
  8. package/dist/cjs/editing/applyEffectiveConfiguration.js.map +1 -0
  9. package/dist/cjs/editing/collectComponents.js +34 -0
  10. package/dist/cjs/editing/collectComponents.js.map +1 -0
  11. package/dist/cjs/editing/collectIconUsages.js +86 -0
  12. package/dist/cjs/editing/collectIconUsages.js.map +1 -0
  13. package/dist/cjs/editing/describeNode.js +63 -0
  14. package/dist/cjs/editing/describeNode.js.map +1 -0
  15. package/dist/cjs/editing/diagnoseIcons.js +67 -0
  16. package/dist/cjs/editing/diagnoseIcons.js.map +1 -0
  17. package/dist/cjs/editing/diagnostics.js +36 -0
  18. package/dist/cjs/editing/diagnostics.js.map +1 -0
  19. package/dist/cjs/editing/documentPaths.js +45 -0
  20. package/dist/cjs/editing/documentPaths.js.map +1 -0
  21. package/dist/cjs/editing/exposureEdits.js +106 -0
  22. package/dist/cjs/editing/exposureEdits.js.map +1 -0
  23. package/dist/cjs/editing/exposureGrants.js +115 -0
  24. package/dist/cjs/editing/exposureGrants.js.map +1 -0
  25. package/dist/cjs/editing/iconDiagnostics.js +103 -0
  26. package/dist/cjs/editing/iconDiagnostics.js.map +1 -0
  27. package/dist/cjs/editing/indexDocument.js +400 -0
  28. package/dist/cjs/editing/indexDocument.js.map +1 -0
  29. package/dist/cjs/editing/inspect.js +154 -0
  30. package/dist/cjs/editing/inspect.js.map +1 -0
  31. package/dist/cjs/editing/instanceEdits.js +267 -0
  32. package/dist/cjs/editing/instanceEdits.js.map +1 -0
  33. package/dist/cjs/editing/layoutTypeDescriptors.js +425 -0
  34. package/dist/cjs/editing/layoutTypeDescriptors.js.map +1 -0
  35. package/dist/cjs/editing/layoutTypeEdits.js +141 -0
  36. package/dist/cjs/editing/layoutTypeEdits.js.map +1 -0
  37. package/dist/cjs/editing/nodeIds.js +115 -0
  38. package/dist/cjs/editing/nodeIds.js.map +1 -0
  39. package/dist/cjs/editing/pathAccess.js +53 -0
  40. package/dist/cjs/editing/pathAccess.js.map +1 -0
  41. package/dist/cjs/editing/propertyEdits.js +125 -0
  42. package/dist/cjs/editing/propertyEdits.js.map +1 -0
  43. package/dist/cjs/editing/resolveEffectiveConfiguration.js +200 -0
  44. package/dist/cjs/editing/resolveEffectiveConfiguration.js.map +1 -0
  45. package/dist/cjs/editing/resolveTemplateChain.js +100 -0
  46. package/dist/cjs/editing/resolveTemplateChain.js.map +1 -0
  47. package/dist/cjs/editing/structureEdits.js +231 -0
  48. package/dist/cjs/editing/structureEdits.js.map +1 -0
  49. package/dist/cjs/editing/validateBinding.js +111 -0
  50. package/dist/cjs/editing/validateBinding.js.map +1 -0
  51. package/dist/cjs/editing/validateValue.js +114 -0
  52. package/dist/cjs/editing/validateValue.js.map +1 -0
  53. package/dist/cjs/icons/EffectiveIconCatalog.js +212 -0
  54. package/dist/cjs/icons/EffectiveIconCatalog.js.map +1 -0
  55. package/dist/cjs/icons/EffectiveIconEntry.js +22 -0
  56. package/dist/cjs/icons/EffectiveIconEntry.js.map +1 -0
  57. package/dist/cjs/icons/analyzeIconImpact.js +48 -0
  58. package/dist/cjs/icons/analyzeIconImpact.js.map +1 -0
  59. package/dist/cjs/icons/matchesIconQuery.js +22 -0
  60. package/dist/cjs/icons/matchesIconQuery.js.map +1 -0
  61. package/dist/cjs/icons/resolveIconLibraries.js +45 -0
  62. package/dist/cjs/icons/resolveIconLibraries.js.map +1 -0
  63. package/dist/cjs/index.js +67 -0
  64. package/dist/cjs/index.js.map +1 -1
  65. package/dist/esm/editing/DescriptorCatalog.d.ts +9 -0
  66. package/dist/esm/editing/DescriptorCatalog.d.ts.map +1 -0
  67. package/dist/esm/editing/DescriptorCatalog.js +38 -0
  68. package/dist/esm/editing/DescriptorCatalog.js.map +1 -0
  69. package/dist/esm/editing/DocumentIndex.d.ts +31 -0
  70. package/dist/esm/editing/DocumentIndex.d.ts.map +1 -0
  71. package/dist/esm/editing/DocumentIndex.js +2 -0
  72. package/dist/esm/editing/DocumentIndex.js.map +1 -0
  73. package/dist/esm/editing/EditOutcome.d.ts +7 -0
  74. package/dist/esm/editing/EditOutcome.d.ts.map +1 -0
  75. package/dist/esm/editing/EditOutcome.js +2 -0
  76. package/dist/esm/editing/EditOutcome.js.map +1 -0
  77. package/dist/esm/editing/EditSession.d.ts +20 -0
  78. package/dist/esm/editing/EditSession.d.ts.map +1 -0
  79. package/dist/esm/editing/EditSession.js +42 -0
  80. package/dist/esm/editing/EditSession.js.map +1 -0
  81. package/dist/esm/editing/EditingContext.d.ts +10 -0
  82. package/dist/esm/editing/EditingContext.d.ts.map +1 -0
  83. package/dist/esm/editing/EditingContext.js +2 -0
  84. package/dist/esm/editing/EditingContext.js.map +1 -0
  85. package/dist/esm/editing/TemplateChain.d.ts +13 -0
  86. package/dist/esm/editing/TemplateChain.d.ts.map +1 -0
  87. package/dist/esm/editing/TemplateChain.js +2 -0
  88. package/dist/esm/editing/TemplateChain.js.map +1 -0
  89. package/dist/esm/editing/applyEdit.d.ts +5 -0
  90. package/dist/esm/editing/applyEdit.d.ts.map +1 -0
  91. package/dist/esm/editing/applyEdit.js +81 -0
  92. package/dist/esm/editing/applyEdit.js.map +1 -0
  93. package/dist/esm/editing/applyEffectiveConfiguration.d.ts +3 -0
  94. package/dist/esm/editing/applyEffectiveConfiguration.d.ts.map +1 -0
  95. package/dist/esm/editing/applyEffectiveConfiguration.js +60 -0
  96. package/dist/esm/editing/applyEffectiveConfiguration.js.map +1 -0
  97. package/dist/esm/editing/collectComponents.d.ts +3 -0
  98. package/dist/esm/editing/collectComponents.d.ts.map +1 -0
  99. package/dist/esm/editing/collectComponents.js +32 -0
  100. package/dist/esm/editing/collectComponents.js.map +1 -0
  101. package/dist/esm/editing/collectIconUsages.d.ts +5 -0
  102. package/dist/esm/editing/collectIconUsages.d.ts.map +1 -0
  103. package/dist/esm/editing/collectIconUsages.js +84 -0
  104. package/dist/esm/editing/collectIconUsages.js.map +1 -0
  105. package/dist/esm/editing/describeNode.d.ts +11 -0
  106. package/dist/esm/editing/describeNode.d.ts.map +1 -0
  107. package/dist/esm/editing/describeNode.js +60 -0
  108. package/dist/esm/editing/describeNode.js.map +1 -0
  109. package/dist/esm/editing/diagnoseIcons.d.ts +4 -0
  110. package/dist/esm/editing/diagnoseIcons.d.ts.map +1 -0
  111. package/dist/esm/editing/diagnoseIcons.js +65 -0
  112. package/dist/esm/editing/diagnoseIcons.js.map +1 -0
  113. package/dist/esm/editing/diagnostics.d.ts +6 -0
  114. package/dist/esm/editing/diagnostics.d.ts.map +1 -0
  115. package/dist/esm/editing/diagnostics.js +32 -0
  116. package/dist/esm/editing/diagnostics.js.map +1 -0
  117. package/dist/esm/editing/documentPaths.d.ts +8 -0
  118. package/dist/esm/editing/documentPaths.d.ts.map +1 -0
  119. package/dist/esm/editing/documentPaths.js +41 -0
  120. package/dist/esm/editing/documentPaths.js.map +1 -0
  121. package/dist/esm/editing/exposureEdits.d.ts +5 -0
  122. package/dist/esm/editing/exposureEdits.d.ts.map +1 -0
  123. package/dist/esm/editing/exposureEdits.js +103 -0
  124. package/dist/esm/editing/exposureEdits.js.map +1 -0
  125. package/dist/esm/editing/exposureGrants.d.ts +21 -0
  126. package/dist/esm/editing/exposureGrants.d.ts.map +1 -0
  127. package/dist/esm/editing/exposureGrants.js +112 -0
  128. package/dist/esm/editing/exposureGrants.js.map +1 -0
  129. package/dist/esm/editing/given/a_layout_document.d.ts +14 -0
  130. package/dist/esm/editing/given/a_layout_document.d.ts.map +1 -0
  131. package/dist/esm/editing/given/a_layout_document.js +67 -0
  132. package/dist/esm/editing/given/a_layout_document.js.map +1 -0
  133. package/dist/esm/editing/given/a_scene_document.d.ts +20 -0
  134. package/dist/esm/editing/given/a_scene_document.d.ts.map +1 -0
  135. package/dist/esm/editing/given/a_scene_document.js +110 -0
  136. package/dist/esm/editing/given/a_scene_document.js.map +1 -0
  137. package/dist/esm/editing/iconDiagnostics.d.ts +11 -0
  138. package/dist/esm/editing/iconDiagnostics.d.ts.map +1 -0
  139. package/dist/esm/editing/iconDiagnostics.js +99 -0
  140. package/dist/esm/editing/iconDiagnostics.js.map +1 -0
  141. package/dist/esm/editing/index.d.ts +22 -0
  142. package/dist/esm/editing/index.d.ts.map +1 -0
  143. package/dist/esm/editing/index.js +22 -0
  144. package/dist/esm/editing/index.js.map +1 -0
  145. package/dist/esm/editing/indexDocument.d.ts +6 -0
  146. package/dist/esm/editing/indexDocument.d.ts.map +1 -0
  147. package/dist/esm/editing/indexDocument.js +396 -0
  148. package/dist/esm/editing/indexDocument.js.map +1 -0
  149. package/dist/esm/editing/inspect.d.ts +8 -0
  150. package/dist/esm/editing/inspect.d.ts.map +1 -0
  151. package/dist/esm/editing/inspect.js +151 -0
  152. package/dist/esm/editing/inspect.js.map +1 -0
  153. package/dist/esm/editing/instanceEdits.d.ts +9 -0
  154. package/dist/esm/editing/instanceEdits.d.ts.map +1 -0
  155. package/dist/esm/editing/instanceEdits.js +260 -0
  156. package/dist/esm/editing/instanceEdits.js.map +1 -0
  157. package/dist/esm/editing/layoutTypeDescriptors.d.ts +5 -0
  158. package/dist/esm/editing/layoutTypeDescriptors.d.ts.map +1 -0
  159. package/dist/esm/editing/layoutTypeDescriptors.js +421 -0
  160. package/dist/esm/editing/layoutTypeDescriptors.js.map +1 -0
  161. package/dist/esm/editing/layoutTypeEdits.d.ts +4 -0
  162. package/dist/esm/editing/layoutTypeEdits.d.ts.map +1 -0
  163. package/dist/esm/editing/layoutTypeEdits.js +139 -0
  164. package/dist/esm/editing/layoutTypeEdits.js.map +1 -0
  165. package/dist/esm/editing/nodeIds.d.ts +14 -0
  166. package/dist/esm/editing/nodeIds.d.ts.map +1 -0
  167. package/dist/esm/editing/nodeIds.js +102 -0
  168. package/dist/esm/editing/nodeIds.js.map +1 -0
  169. package/dist/esm/editing/pathAccess.d.ts +7 -0
  170. package/dist/esm/editing/pathAccess.d.ts.map +1 -0
  171. package/dist/esm/editing/pathAccess.js +48 -0
  172. package/dist/esm/editing/pathAccess.js.map +1 -0
  173. package/dist/esm/editing/propertyEdits.d.ts +15 -0
  174. package/dist/esm/editing/propertyEdits.d.ts.map +1 -0
  175. package/dist/esm/editing/propertyEdits.js +120 -0
  176. package/dist/esm/editing/propertyEdits.js.map +1 -0
  177. package/dist/esm/editing/resolveEffectiveConfiguration.d.ts +5 -0
  178. package/dist/esm/editing/resolveEffectiveConfiguration.d.ts.map +1 -0
  179. package/dist/esm/editing/resolveEffectiveConfiguration.js +198 -0
  180. package/dist/esm/editing/resolveEffectiveConfiguration.js.map +1 -0
  181. package/dist/esm/editing/resolveTemplateChain.d.ts +4 -0
  182. package/dist/esm/editing/resolveTemplateChain.d.ts.map +1 -0
  183. package/dist/esm/editing/resolveTemplateChain.js +98 -0
  184. package/dist/esm/editing/resolveTemplateChain.js.map +1 -0
  185. package/dist/esm/editing/structureEdits.d.ts +6 -0
  186. package/dist/esm/editing/structureEdits.d.ts.map +1 -0
  187. package/dist/esm/editing/structureEdits.js +227 -0
  188. package/dist/esm/editing/structureEdits.js.map +1 -0
  189. package/dist/esm/editing/validateBinding.d.ts +7 -0
  190. package/dist/esm/editing/validateBinding.d.ts.map +1 -0
  191. package/dist/esm/editing/validateBinding.js +108 -0
  192. package/dist/esm/editing/validateBinding.js.map +1 -0
  193. package/dist/esm/editing/validateValue.d.ts +8 -0
  194. package/dist/esm/editing/validateValue.d.ts.map +1 -0
  195. package/dist/esm/editing/validateValue.js +111 -0
  196. package/dist/esm/editing/validateValue.js.map +1 -0
  197. package/dist/esm/icons/EffectiveIconCatalog.d.ts +25 -0
  198. package/dist/esm/icons/EffectiveIconCatalog.d.ts.map +1 -0
  199. package/dist/esm/icons/EffectiveIconCatalog.js +210 -0
  200. package/dist/esm/icons/EffectiveIconCatalog.js.map +1 -0
  201. package/dist/esm/icons/EffectiveIconEntry.d.ts +9 -0
  202. package/dist/esm/icons/EffectiveIconEntry.d.ts.map +1 -0
  203. package/dist/esm/icons/EffectiveIconEntry.js +20 -0
  204. package/dist/esm/icons/EffectiveIconEntry.js.map +1 -0
  205. package/dist/esm/icons/IconCatalogSource.d.ts +6 -0
  206. package/dist/esm/icons/IconCatalogSource.d.ts.map +1 -0
  207. package/dist/esm/icons/IconCatalogSource.js +2 -0
  208. package/dist/esm/icons/IconCatalogSource.js.map +1 -0
  209. package/dist/esm/icons/IconDiagnostic.d.ts +9 -0
  210. package/dist/esm/icons/IconDiagnostic.d.ts.map +1 -0
  211. package/dist/esm/icons/IconDiagnostic.js +2 -0
  212. package/dist/esm/icons/IconDiagnostic.js.map +1 -0
  213. package/dist/esm/icons/IconImpactReport.d.ts +18 -0
  214. package/dist/esm/icons/IconImpactReport.d.ts.map +1 -0
  215. package/dist/esm/icons/IconImpactReport.js +2 -0
  216. package/dist/esm/icons/IconImpactReport.js.map +1 -0
  217. package/dist/esm/icons/IconLibraryResolution.d.ts +7 -0
  218. package/dist/esm/icons/IconLibraryResolution.d.ts.map +1 -0
  219. package/dist/esm/icons/IconLibraryResolution.js +2 -0
  220. package/dist/esm/icons/IconLibraryResolution.js.map +1 -0
  221. package/dist/esm/icons/IconQuery.d.ts +7 -0
  222. package/dist/esm/icons/IconQuery.d.ts.map +1 -0
  223. package/dist/esm/icons/IconQuery.js +2 -0
  224. package/dist/esm/icons/IconQuery.js.map +1 -0
  225. package/dist/esm/icons/IconResolution.d.ts +14 -0
  226. package/dist/esm/icons/IconResolution.d.ts.map +1 -0
  227. package/dist/esm/icons/IconResolution.js +2 -0
  228. package/dist/esm/icons/IconResolution.js.map +1 -0
  229. package/dist/esm/icons/IconSearchResult.d.ts +7 -0
  230. package/dist/esm/icons/IconSearchResult.d.ts.map +1 -0
  231. package/dist/esm/icons/IconSearchResult.js +2 -0
  232. package/dist/esm/icons/IconSearchResult.js.map +1 -0
  233. package/dist/esm/icons/IconUsage.d.ts +6 -0
  234. package/dist/esm/icons/IconUsage.d.ts.map +1 -0
  235. package/dist/esm/icons/IconUsage.js +2 -0
  236. package/dist/esm/icons/IconUsage.js.map +1 -0
  237. package/dist/esm/icons/ResolvedIconLibrary.d.ts +8 -0
  238. package/dist/esm/icons/ResolvedIconLibrary.d.ts.map +1 -0
  239. package/dist/esm/icons/ResolvedIconLibrary.js +2 -0
  240. package/dist/esm/icons/ResolvedIconLibrary.js.map +1 -0
  241. package/dist/esm/icons/analyzeIconImpact.d.ts +5 -0
  242. package/dist/esm/icons/analyzeIconImpact.d.ts.map +1 -0
  243. package/dist/esm/icons/analyzeIconImpact.js +46 -0
  244. package/dist/esm/icons/analyzeIconImpact.js.map +1 -0
  245. package/dist/esm/icons/index.d.ts +14 -0
  246. package/dist/esm/icons/index.d.ts.map +1 -0
  247. package/dist/esm/icons/index.js +14 -0
  248. package/dist/esm/icons/index.js.map +1 -0
  249. package/dist/esm/icons/matchesIconQuery.d.ts +4 -0
  250. package/dist/esm/icons/matchesIconQuery.d.ts.map +1 -0
  251. package/dist/esm/icons/matchesIconQuery.js +20 -0
  252. package/dist/esm/icons/matchesIconQuery.js.map +1 -0
  253. package/dist/esm/icons/resolveIconLibraries.d.ts +4 -0
  254. package/dist/esm/icons/resolveIconLibraries.d.ts.map +1 -0
  255. package/dist/esm/icons/resolveIconLibraries.js +43 -0
  256. package/dist/esm/icons/resolveIconLibraries.js.map +1 -0
  257. package/dist/esm/index.d.ts +2 -0
  258. package/dist/esm/index.d.ts.map +1 -1
  259. package/dist/esm/index.js +21 -0
  260. package/dist/esm/index.js.map +1 -1
  261. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  262. package/editing/DescriptorCatalog.ts +51 -0
  263. package/editing/DocumentIndex.ts +73 -0
  264. package/editing/EditOutcome.ts +21 -0
  265. package/editing/EditSession.ts +50 -0
  266. package/editing/EditingContext.ts +34 -0
  267. package/editing/TemplateChain.ts +36 -0
  268. package/editing/applyEdit.ts +69 -0
  269. package/editing/applyEffectiveConfiguration.ts +53 -0
  270. package/editing/collectComponents.ts +36 -0
  271. package/editing/collectIconUsages.ts +78 -0
  272. package/editing/describeNode.ts +61 -0
  273. package/editing/diagnoseIcons.ts +60 -0
  274. package/editing/diagnostics.ts +30 -0
  275. package/editing/documentPaths.ts +40 -0
  276. package/editing/exposureEdits.ts +119 -0
  277. package/editing/exposureGrants.ts +159 -0
  278. package/editing/given/a_layout_document.ts +88 -0
  279. package/editing/given/a_scene_document.ts +135 -0
  280. package/editing/iconDiagnostics.ts +90 -0
  281. package/editing/index.ts +24 -0
  282. package/editing/indexDocument.ts +237 -0
  283. package/editing/inspect.ts +165 -0
  284. package/editing/instanceEdits.ts +251 -0
  285. package/editing/layoutTypeDescriptors.ts +191 -0
  286. package/editing/layoutTypeEdits.ts +135 -0
  287. package/editing/nodeIds.ts +111 -0
  288. package/editing/pathAccess.ts +81 -0
  289. package/editing/propertyEdits.ts +127 -0
  290. package/editing/resolveEffectiveConfiguration.ts +202 -0
  291. package/editing/resolveTemplateChain.ts +109 -0
  292. package/editing/structureEdits.ts +234 -0
  293. package/editing/validateBinding.ts +103 -0
  294. package/editing/validateValue.ts +130 -0
  295. package/icons/EffectiveIconCatalog.ts +199 -0
  296. package/icons/EffectiveIconEntry.ts +36 -0
  297. package/icons/IconCatalogSource.ts +23 -0
  298. package/icons/IconDiagnostic.ts +45 -0
  299. package/icons/IconImpactReport.ts +63 -0
  300. package/icons/IconLibraryResolution.ts +22 -0
  301. package/icons/IconQuery.ts +27 -0
  302. package/icons/IconResolution.ts +25 -0
  303. package/icons/IconSearchResult.ts +21 -0
  304. package/icons/IconUsage.ts +21 -0
  305. package/icons/ResolvedIconLibrary.ts +32 -0
  306. package/icons/analyzeIconImpact.ts +41 -0
  307. package/icons/index.ts +16 -0
  308. package/icons/matchesIconQuery.ts +19 -0
  309. package/icons/resolveIconLibraries.ts +47 -0
  310. package/index.ts +2 -0
  311. package/package.json +3 -3
package/dist/cjs/index.js CHANGED
@@ -4,6 +4,10 @@ var renderElement = require('./renderElement.js');
4
4
  var elementKind = require('./elementKind.js');
5
5
  var panelKind = require('./panelKind.js');
6
6
  var flowNodeKind = require('./flowNodeKind.js');
7
+ var resolveIconLibraries = require('./icons/resolveIconLibraries.js');
8
+ var EffectiveIconEntry = require('./icons/EffectiveIconEntry.js');
9
+ var EffectiveIconCatalog = require('./icons/EffectiveIconCatalog.js');
10
+ var analyzeIconImpact = require('./icons/analyzeIconImpact.js');
7
11
  var resolveComponentName = require('./resolveComponentName.js');
8
12
  var computeSizeClass = require('./computeSizeClass.js');
9
13
  var evaluateFlowArrangement = require('./evaluateFlowArrangement.js');
@@ -21,6 +25,23 @@ var incompatibleStarterThemes = require('./incompatibleStarterThemes.js');
21
25
  var runActions = require('./runActions.js');
22
26
  var resolveBehaviors = require('./resolveBehaviors.js');
23
27
  var resolveStrings = require('./resolveStrings.js');
28
+ var diagnostics = require('./editing/diagnostics.js');
29
+ var nodeIds = require('./editing/nodeIds.js');
30
+ var layoutTypeDescriptors = require('./editing/layoutTypeDescriptors.js');
31
+ var DescriptorCatalog = require('./editing/DescriptorCatalog.js');
32
+ var validateValue = require('./editing/validateValue.js');
33
+ var validateBinding = require('./editing/validateBinding.js');
34
+ var collectComponents = require('./editing/collectComponents.js');
35
+ var resolveTemplateChain = require('./editing/resolveTemplateChain.js');
36
+ var exposureGrants = require('./editing/exposureGrants.js');
37
+ var resolveEffectiveConfiguration = require('./editing/resolveEffectiveConfiguration.js');
38
+ var applyEffectiveConfiguration = require('./editing/applyEffectiveConfiguration.js');
39
+ var indexDocument = require('./editing/indexDocument.js');
40
+ var inspect = require('./editing/inspect.js');
41
+ var applyEdit = require('./editing/applyEdit.js');
42
+ var iconDiagnostics = require('./editing/iconDiagnostics.js');
43
+ var diagnoseIcons = require('./editing/diagnoseIcons.js');
44
+ var collectIconUsages = require('./editing/collectIconUsages.js');
24
45
 
25
46
 
26
47
 
@@ -40,6 +61,10 @@ exports.isFlowGrid = flowNodeKind.isFlowGrid;
40
61
  exports.isFlowLeaf = flowNodeKind.isFlowLeaf;
41
62
  exports.isFlowRow = flowNodeKind.isFlowRow;
42
63
  exports.isFlowSlotLeaf = flowNodeKind.isFlowSlotLeaf;
64
+ exports.resolveIconLibraries = resolveIconLibraries.resolveIconLibraries;
65
+ exports.referencesOfEntry = EffectiveIconEntry.referencesOfEntry;
66
+ exports.EffectiveIconCatalog = EffectiveIconCatalog.EffectiveIconCatalog;
67
+ exports.analyzeIconImpact = analyzeIconImpact.analyzeIconImpact;
43
68
  exports.corePackage = resolveComponentName.corePackage;
44
69
  exports.effectivePackages = resolveComponentName.effectivePackages;
45
70
  exports.resolveComponentName = resolveComponentName.resolveComponentName;
@@ -75,4 +100,46 @@ exports.resolveIntervalBehaviors = resolveBehaviors.resolveIntervalBehaviors;
75
100
  exports.isStringsReference = resolveStrings.isStringsReference;
76
101
  exports.resolveStringsInElement = resolveStrings.resolveStringsInElement;
77
102
  exports.resolveStringsValue = resolveStrings.resolveStringsValue;
103
+ exports.errorDiagnostic = diagnostics.errorDiagnostic;
104
+ exports.hasErrors = diagnostics.hasErrors;
105
+ exports.warningDiagnostic = diagnostics.warningDiagnostic;
106
+ exports.dialogTemplateNodeId = nodeIds.dialogTemplateNodeId;
107
+ exports.elementNodeId = nodeIds.elementNodeId;
108
+ exports.flowNodeId = nodeIds.flowNodeId;
109
+ exports.freeformNodeId = nodeIds.freeformNodeId;
110
+ exports.layoutNodeId = nodeIds.layoutNodeId;
111
+ exports.ownerArrangementId = nodeIds.ownerArrangementId;
112
+ exports.placementNodeId = nodeIds.placementNodeId;
113
+ exports.scopeInstanceId = nodeIds.scopeInstanceId;
114
+ exports.scopeNodeId = nodeIds.scopeNodeId;
115
+ exports.screenNodeId = nodeIds.screenNodeId;
116
+ exports.screenTemplateNodeId = nodeIds.screenTemplateNodeId;
117
+ exports.slotNodeId = nodeIds.slotNodeId;
118
+ exports.layoutTypeDescriptors = layoutTypeDescriptors.layoutTypeDescriptors;
119
+ exports.placementProperties = layoutTypeDescriptors.placementProperties;
120
+ exports.templateProperties = layoutTypeDescriptors.templateProperties;
121
+ exports.createDescriptorCatalog = DescriptorCatalog.createDescriptorCatalog;
122
+ exports.findComponentDescriptor = DescriptorCatalog.findComponentDescriptor;
123
+ exports.findLayoutTypeDescriptor = DescriptorCatalog.findLayoutTypeDescriptor;
124
+ exports.validateItemValues = validateValue.validateItemValues;
125
+ exports.validateValue = validateValue.validateValue;
126
+ exports.areTypesCompatible = validateBinding.areTypesCompatible;
127
+ exports.validateBinding = validateBinding.validateBinding;
128
+ exports.collectComponents = collectComponents.collectComponents;
129
+ exports.resolveTemplateChain = resolveTemplateChain.resolveTemplateChain;
130
+ exports.computeExposureGrants = exposureGrants.computeExposureGrants;
131
+ exports.grantKey = exposureGrants.grantKey;
132
+ exports.resolveEffectiveConfiguration = resolveEffectiveConfiguration.resolveEffectiveConfiguration;
133
+ exports.applyEffectiveConfiguration = applyEffectiveConfiguration.applyEffectiveConfiguration;
134
+ exports.flowLayoutType = indexDocument.flowLayoutType;
135
+ exports.indexDocument = indexDocument.indexDocument;
136
+ exports.panelLayoutType = indexDocument.panelLayoutType;
137
+ exports.inspect = inspect.inspect;
138
+ exports.provenanceOf = inspect.provenanceOf;
139
+ exports.applyEdit = applyEdit.applyEdit;
140
+ exports.iconProblem = iconDiagnostics.iconProblem;
141
+ exports.iconProblemsOfItems = iconDiagnostics.iconProblemsOfItems;
142
+ exports.iconProblemsOfProperty = iconDiagnostics.iconProblemsOfProperty;
143
+ exports.diagnoseIcons = diagnoseIcons.diagnoseIcons;
144
+ exports.collectIconUsages = collectIconUsages.collectIconUsages;
78
145
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ import { ComponentDescriptor, LayoutTypeDescriptor } from '@cratis/scene.model';
2
+ export interface DescriptorCatalog {
3
+ components: ComponentDescriptor[];
4
+ layoutTypes: LayoutTypeDescriptor[];
5
+ }
6
+ export declare function createDescriptorCatalog(componentDescriptors?: ComponentDescriptor[]): DescriptorCatalog;
7
+ export declare function findComponentDescriptor(catalog: DescriptorCatalog, componentName: string): ComponentDescriptor | undefined;
8
+ export declare function findLayoutTypeDescriptor(catalog: DescriptorCatalog, type: string): LayoutTypeDescriptor | undefined;
9
+ //# sourceMappingURL=DescriptorCatalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DescriptorCatalog.d.ts","sourceRoot":"","sources":["../../../editing/DescriptorCatalog.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAUhF,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAQD,wBAAgB,uBAAuB,CAAC,oBAAoB,GAAE,mBAAmB,EAAO,GAAG,iBAAiB,CAK3G;AAQD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAM1H;AAKD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAEnH"}
@@ -0,0 +1,38 @@
1
+ import { layoutTypeDescriptors } from './layoutTypeDescriptors.js';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * Builds a catalog from the component descriptors of the active packages, plus the built-in layout types.
7
+ *
8
+ * When two descriptors name the same component the later one wins, which is the same override-priority rule
9
+ * the profile's package order already means for components.
10
+ */ function createDescriptorCatalog(componentDescriptors = []) {
11
+ const byComponent = new Map();
12
+ for (const descriptor of componentDescriptors)byComponent.set(descriptor.component, descriptor);
13
+ return {
14
+ components: [
15
+ ...byComponent.values()
16
+ ],
17
+ layoutTypes: layoutTypeDescriptors
18
+ };
19
+ }
20
+ /**
21
+ * Finds the descriptor of a component by the name an element carries.
22
+ *
23
+ * An exact match wins. Otherwise a bare name (`dataTable`) finds the one descriptor whose component ends in
24
+ * `:dataTable`; a bare name that several packages describe has no single answer, so it finds none.
25
+ */ function findComponentDescriptor(catalog, componentName) {
26
+ const exact = catalog.components.find((descriptor)=>descriptor.component === componentName);
27
+ if (exact) return exact;
28
+ const matches = catalog.components.filter((descriptor)=>descriptor.component.endsWith(`:${componentName}`));
29
+ return matches.length === 1 ? matches[0] : undefined;
30
+ }
31
+ /**
32
+ * Finds the descriptor of a layout type.
33
+ */ function findLayoutTypeDescriptor(catalog, type) {
34
+ return catalog.layoutTypes.find((descriptor)=>descriptor.type === type);
35
+ }
36
+
37
+ export { createDescriptorCatalog, findComponentDescriptor, findLayoutTypeDescriptor };
38
+ //# sourceMappingURL=DescriptorCatalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DescriptorCatalog.js","sources":["../../../editing/DescriptorCatalog.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentDescriptor, LayoutTypeDescriptor } from '@cratis/scene.model';\nimport { layoutTypeDescriptors } from './layoutTypeDescriptors';\n\n/**\n * Everything an editor knows how to describe: the component descriptors packages contribute, and the layout types\n * the model itself defines.\n *\n * It is a derived view over what packages ship - not a registry anything registers into. Build one from the\n * descriptors of the packages a profile lists, and rebuild it when the list changes.\n */\nexport interface DescriptorCatalog {\n components: ComponentDescriptor[];\n layoutTypes: LayoutTypeDescriptor[];\n}\n\n/**\n * Builds a catalog from the component descriptors of the active packages, plus the built-in layout types.\n *\n * When two descriptors name the same component the later one wins, which is the same override-priority rule\n * the profile's package order already means for components.\n */\nexport function createDescriptorCatalog(componentDescriptors: ComponentDescriptor[] = []): DescriptorCatalog {\n const byComponent = new Map<string, ComponentDescriptor>();\n for (const descriptor of componentDescriptors) byComponent.set(descriptor.component, descriptor);\n\n return { components: [...byComponent.values()], layoutTypes: layoutTypeDescriptors };\n}\n\n/**\n * Finds the descriptor of a component by the name an element carries.\n *\n * An exact match wins. Otherwise a bare name (`dataTable`) finds the one descriptor whose component ends in\n * `:dataTable`; a bare name that several packages describe has no single answer, so it finds none.\n */\nexport function findComponentDescriptor(catalog: DescriptorCatalog, componentName: string): ComponentDescriptor | undefined {\n const exact = catalog.components.find(descriptor => descriptor.component === componentName);\n if (exact) return exact;\n\n const matches = catalog.components.filter(descriptor => descriptor.component.endsWith(`:${componentName}`));\n return matches.length === 1 ? matches[0] : undefined;\n}\n\n/**\n * Finds the descriptor of a layout type.\n */\nexport function findLayoutTypeDescriptor(catalog: DescriptorCatalog, type: string): LayoutTypeDescriptor | undefined {\n return catalog.layoutTypes.find(descriptor => descriptor.type === type);\n}\n"],"names":["createDescriptorCatalog","componentDescriptors","byComponent","Map","descriptor","set","component","components","values","layoutTypes","layoutTypeDescriptors","findComponentDescriptor","catalog","componentName","exact","find","matches","filter","endsWith","length","undefined","findLayoutTypeDescriptor","type"],"mappings":";;AAAA;AACA;AAiBA;;;;;AAKC,IACM,SAASA,uBAAAA,CAAwBC,oBAAAA,GAA8C,EAAE,EAAA;AACpF,IAAA,MAAMC,cAAc,IAAIC,GAAAA,EAAAA;IACxB,KAAK,MAAMC,cAAcH,oBAAAA,CAAsBC,WAAAA,CAAYG,GAAG,CAACD,UAAAA,CAAWE,SAAS,EAAEF,UAAAA,CAAAA;IAErF,OAAO;QAAEG,UAAAA,EAAY;AAAIL,YAAAA,GAAAA,WAAAA,CAAYM,MAAM;AAAG,SAAA;QAAEC,WAAAA,EAAaC;AAAsB,KAAA;AACvF;AAEA;;;;;AAKC,IACM,SAASC,uBAAAA,CAAwBC,OAA0B,EAAEC,aAAqB,EAAA;IACrF,MAAMC,KAAAA,GAAQF,OAAAA,CAAQL,UAAU,CAACQ,IAAI,CAACX,CAAAA,UAAAA,GAAcA,UAAAA,CAAWE,SAAS,KAAKO,aAAAA,CAAAA;AAC7E,IAAA,IAAIC,OAAO,OAAOA,KAAAA;AAElB,IAAA,MAAME,UAAUJ,OAAAA,CAAQL,UAAU,CAACU,MAAM,CAACb,CAAAA,UAAAA,GAAcA,UAAAA,CAAWE,SAAS,CAACY,QAAQ,CAAC,CAAC,CAAC,EAAEL,aAAAA,CAAAA,CAAe,CAAA,CAAA;AACzG,IAAA,OAAOG,QAAQG,MAAM,KAAK,IAAIH,OAAO,CAAC,EAAE,GAAGI,SAAAA;AAC/C;AAEA;;AAEC,IACM,SAASC,wBAAAA,CAAyBT,OAA0B,EAAEU,IAAY,EAAA;IAC7E,OAAOV,OAAAA,CAAQH,WAAW,CAACM,IAAI,CAACX,CAAAA,UAAAA,GAAcA,UAAAA,CAAWkB,IAAI,KAAKA,IAAAA,CAAAA;AACtE;;"}
@@ -0,0 +1,31 @@
1
+ import { SceneDiagnostic, SceneNodeKind } from '@cratis/scene.model';
2
+ export type DocumentPath = (string | number)[];
3
+ export interface ListLocation {
4
+ path: DocumentPath;
5
+ index: number;
6
+ }
7
+ export interface NodeRecord {
8
+ id: string;
9
+ kind: SceneNodeKind;
10
+ typeId: string;
11
+ label: string;
12
+ path: DocumentPath;
13
+ value: unknown;
14
+ parentId?: string;
15
+ owner: string;
16
+ ownerKind: SceneNodeKind;
17
+ list?: ListLocation;
18
+ leafId?: string;
19
+ placementIds?: string[];
20
+ mirror?: {
21
+ prefix: DocumentPath;
22
+ others: DocumentPath[];
23
+ };
24
+ slotName?: string;
25
+ contentPath?: DocumentPath;
26
+ }
27
+ export interface DocumentIndex {
28
+ nodes: Map<string, NodeRecord>;
29
+ diagnostics: SceneDiagnostic[];
30
+ }
31
+ //# sourceMappingURL=DocumentIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentIndex.d.ts","sourceRoot":"","sources":["../../../editing/DocumentIndex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKrE,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAK/C,MAAM,WAAW,YAAY;IAEzB,IAAI,EAAE,YAAY,CAAC;IAGnB,KAAK,EAAE,MAAM,CAAC;CACjB;AAKD,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IAGpB,MAAM,EAAE,MAAM,CAAC;IAGf,KAAK,EAAE,MAAM,CAAC;IAGd,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IAEf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;IAGzB,IAAI,CAAC,EAAE,YAAY,CAAC;IAGpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAMxB,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAG1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,WAAW,CAAC,EAAE,YAAY,CAAC;CAC9B;AAKD,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC/B,WAAW,EAAE,eAAe,EAAE,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DocumentIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentIndex.js","sourceRoot":"","sources":["../../../editing/DocumentIndex.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { SceneDiagnostic, SceneDocument } from '@cratis/scene.model';
2
+ export interface EditOutcome {
3
+ model: SceneDocument;
4
+ diagnostics: SceneDiagnostic[];
5
+ applied: boolean;
6
+ }
7
+ //# sourceMappingURL=EditOutcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditOutcome.d.ts","sourceRoot":"","sources":["../../../editing/EditOutcome.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKrE,MAAM,WAAW,WAAW;IAKxB,KAAK,EAAE,aAAa,CAAC;IAGrB,WAAW,EAAE,eAAe,EAAE,CAAC;IAG/B,OAAO,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EditOutcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditOutcome.js","sourceRoot":"","sources":["../../../editing/EditOutcome.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { SceneDocument } from '@cratis/scene.model';
2
+ import { EditingContext } from './EditingContext';
3
+ import { DocumentIndex, NodeRecord } from './DocumentIndex';
4
+ import { ExposureGrant, ExposureGrants } from './exposureGrants';
5
+ import { TemplateChain } from './TemplateChain';
6
+ import { EffectiveConfiguration } from '@cratis/scene.model';
7
+ export declare class EditSession {
8
+ readonly document: SceneDocument;
9
+ readonly context: EditingContext;
10
+ readonly index: DocumentIndex;
11
+ readonly chain: TemplateChain;
12
+ readonly grants: ExposureGrants;
13
+ readonly configuration: EffectiveConfiguration;
14
+ constructor(document: SceneDocument, context: EditingContext);
15
+ get scopeInstance(): string | undefined;
16
+ get scopeGrants(): Map<string, ExposureGrant>;
17
+ isLocal(record: NodeRecord): boolean;
18
+ sourceOf(record: NodeRecord): string;
19
+ }
20
+ //# sourceMappingURL=EditSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditSession.d.ts","sourceRoot":"","sources":["../../../editing/EditSession.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAyB,MAAM,kBAAkB,CAAC;AAKxF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,qBAAa,WAAW;IAMR,QAAQ,CAAC,QAAQ,EAAE,aAAa;IAAE,QAAQ,CAAC,OAAO,EAAE,cAAc;IAL9E,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAE/C,YAAqB,QAAQ,EAAE,aAAa,EAAW,OAAO,EAAE,cAAc,EAK7E;IAGD,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAGD,IAAI,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAE5C;IAGD,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAEnC;IAGD,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAEnC;CACJ"}
@@ -0,0 +1,42 @@
1
+ import { ProvenanceKind } from '@cratis/scene.model';
2
+ import { computeExposureGrants } from './exposureGrants.js';
3
+ import { indexDocument } from './indexDocument.js';
4
+ import { provenanceOf } from './inspect.js';
5
+ import { resolveEffectiveConfiguration } from './resolveEffectiveConfiguration.js';
6
+ import { resolveTemplateChain } from './resolveTemplateChain.js';
7
+
8
+ // Copyright (c) Cratis. All rights reserved.
9
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
10
+ /**
11
+ * Everything an edit needs to decide whether it is allowed, worked out once against the document as it was.
12
+ */ class EditSession {
13
+ document;
14
+ context;
15
+ index;
16
+ chain;
17
+ grants;
18
+ configuration;
19
+ constructor(document, context){
20
+ this.document = document;
21
+ this.context = context;
22
+ this.index = indexDocument(document);
23
+ this.chain = resolveTemplateChain(document, context.scope);
24
+ this.grants = computeExposureGrants(this.chain, context.catalog);
25
+ this.configuration = resolveEffectiveConfiguration(this.chain, document.instanceContributions, context.catalog);
26
+ }
27
+ /** The instance id the scope contributes as, or `undefined` when the scope was not found. */ get scopeInstance() {
28
+ return this.chain.levels.at(-1)?.instance;
29
+ }
30
+ /** What the scope's instance may configure on inherited components. */ get scopeGrants() {
31
+ return (this.scopeInstance === undefined ? undefined : this.grants.byInstance.get(this.scopeInstance)) ?? new Map();
32
+ }
33
+ /** Whether the scope itself owns the node. */ isLocal(record) {
34
+ return provenanceOf(record, this.chain, this.scopeGrants).kind === ProvenanceKind.Local;
35
+ }
36
+ /** Where an inherited node comes from, for a message. */ sourceOf(record) {
37
+ return record.owner;
38
+ }
39
+ }
40
+
41
+ export { EditSession };
42
+ //# sourceMappingURL=EditSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditSession.js","sources":["../../../editing/EditSession.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ProvenanceKind, SceneDocument } from '@cratis/scene.model';\nimport { EditingContext } from './EditingContext';\nimport { DocumentIndex, NodeRecord } from './DocumentIndex';\nimport { ExposureGrant, ExposureGrants, computeExposureGrants } from './exposureGrants';\nimport { indexDocument } from './indexDocument';\nimport { provenanceOf } from './inspect';\nimport { resolveEffectiveConfiguration } from './resolveEffectiveConfiguration';\nimport { resolveTemplateChain } from './resolveTemplateChain';\nimport { TemplateChain } from './TemplateChain';\nimport { EffectiveConfiguration } from '@cratis/scene.model';\n\n/**\n * Everything an edit needs to decide whether it is allowed, worked out once against the document as it was.\n */\nexport class EditSession {\n readonly index: DocumentIndex;\n readonly chain: TemplateChain;\n readonly grants: ExposureGrants;\n readonly configuration: EffectiveConfiguration;\n\n constructor(readonly document: SceneDocument, readonly context: EditingContext) {\n this.index = indexDocument(document);\n this.chain = resolveTemplateChain(document, context.scope);\n this.grants = computeExposureGrants(this.chain, context.catalog);\n this.configuration = resolveEffectiveConfiguration(this.chain, document.instanceContributions, context.catalog);\n }\n\n /** The instance id the scope contributes as, or `undefined` when the scope was not found. */\n get scopeInstance(): string | undefined {\n return this.chain.levels.at(-1)?.instance;\n }\n\n /** What the scope's instance may configure on inherited components. */\n get scopeGrants(): Map<string, ExposureGrant> {\n return (this.scopeInstance === undefined ? undefined : this.grants.byInstance.get(this.scopeInstance)) ?? new Map();\n }\n\n /** Whether the scope itself owns the node. */\n isLocal(record: NodeRecord): boolean {\n return provenanceOf(record, this.chain, this.scopeGrants).kind === ProvenanceKind.Local;\n }\n\n /** Where an inherited node comes from, for a message. */\n sourceOf(record: NodeRecord): string {\n return record.owner;\n }\n}\n"],"names":["EditSession","index","chain","grants","configuration","context","document","indexDocument","resolveTemplateChain","scope","computeExposureGrants","catalog","resolveEffectiveConfiguration","instanceContributions","scopeInstance","levels","at","instance","scopeGrants","undefined","byInstance","get","Map","isLocal","record","provenanceOf","kind","ProvenanceKind","Local","sourceOf","owner"],"mappings":";;;;;;;AAAA;AACA;AAaA;;AAEC,IACM,MAAMA,WAAAA,CAAAA;;;IACAC,KAAAA;IACAC,KAAAA;IACAC,MAAAA;IACAC,aAAAA;AAET,IAAA,WAAA,CAAY,QAAgC,EAAWC,OAAuB,CAAE;aAA3DC,QAAAA,GAAAA,QAAAA;aAAkCD,OAAAA,GAAAA,OAAAA;QACnD,IAAI,CAACJ,KAAK,GAAGM,aAAAA,CAAcD,QAAAA,CAAAA;AAC3B,QAAA,IAAI,CAACJ,KAAK,GAAGM,oBAAAA,CAAqBF,QAAAA,EAAUD,QAAQI,KAAK,CAAA;QACzD,IAAI,CAACN,MAAM,GAAGO,qBAAAA,CAAsB,IAAI,CAACR,KAAK,EAAEG,OAAAA,CAAQM,OAAO,CAAA;AAC/D,QAAA,IAAI,CAACP,aAAa,GAAGQ,6BAAAA,CAA8B,IAAI,CAACV,KAAK,EAAEI,QAAAA,CAASO,qBAAqB,EAAER,OAAAA,CAAQM,OAAO,CAAA;AAClH,IAAA;kGAGA,IAAIG,aAAAA,GAAoC;QACpC,OAAO,IAAI,CAACZ,KAAK,CAACa,MAAM,CAACC,EAAE,CAAC,EAAC,CAAA,EAAIC,QAAAA;AACrC,IAAA;4EAGA,IAAIC,WAAAA,GAA0C;QAC1C,OAAQ,CAAA,IAAI,CAACJ,aAAa,KAAKK,SAAAA,GAAYA,YAAY,IAAI,CAAChB,MAAM,CAACiB,UAAU,CAACC,GAAG,CAAC,IAAI,CAACP,aAAa,CAAA,KAAM,IAAIQ,GAAAA,EAAAA;AAClH,IAAA;mDAGAC,OAAAA,CAAQC,MAAkB,EAAW;AACjC,QAAA,OAAOC,YAAAA,CAAaD,MAAAA,EAAQ,IAAI,CAACtB,KAAK,EAAE,IAAI,CAACgB,WAAW,CAAA,CAAEQ,IAAI,KAAKC,eAAeC,KAAK;AAC3F,IAAA;8DAGAC,QAAAA,CAASL,MAAkB,EAAU;AACjC,QAAA,OAAOA,OAAOM,KAAK;AACvB,IAAA;AACJ;;"}
@@ -0,0 +1,10 @@
1
+ import { EditingScope, QueryCandidate } from '@cratis/scene.model';
2
+ import { EffectiveIconCatalog } from '../icons/EffectiveIconCatalog';
3
+ import { DescriptorCatalog } from './DescriptorCatalog';
4
+ export interface EditingContext {
5
+ catalog: DescriptorCatalog;
6
+ scope: EditingScope;
7
+ queryCandidates?: QueryCandidate[];
8
+ iconCatalog?: EffectiveIconCatalog;
9
+ }
10
+ //# sourceMappingURL=EditingContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditingContext.d.ts","sourceRoot":"","sources":["../../../editing/EditingContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAMxD,MAAM,WAAW,cAAc;IAE3B,OAAO,EAAE,iBAAiB,CAAC;IAG3B,KAAK,EAAE,YAAY,CAAC;IAMpB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAUnC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EditingContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditingContext.js","sourceRoot":"","sources":["../../../editing/EditingContext.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { ExposedProperty, ExternalComponent, SceneDiagnostic, SceneNodeKind } from '@cratis/scene.model';
2
+ export interface TemplateChainLevel {
3
+ owner: string;
4
+ kind: SceneNodeKind;
5
+ instance: string;
6
+ elements: ExternalComponent[];
7
+ exposures: ExposedProperty[];
8
+ }
9
+ export interface TemplateChain {
10
+ levels: TemplateChainLevel[];
11
+ diagnostics: SceneDiagnostic[];
12
+ }
13
+ //# sourceMappingURL=TemplateChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateChain.d.ts","sourceRoot":"","sources":["../../../editing/TemplateChain.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzG,MAAM,WAAW,kBAAkB;IAE/B,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,aAAa,CAAC;IAGpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAG9B,SAAS,EAAE,eAAe,EAAE,CAAC;CAChC;AAOD,MAAM,WAAW,aAAa;IAE1B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAG7B,WAAW,EAAE,eAAe,EAAE,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TemplateChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateChain.js","sourceRoot":"","sources":["../../../editing/TemplateChain.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { SceneDocument, SceneEdit } from '@cratis/scene.model';
2
+ import { EditOutcome } from './EditOutcome';
3
+ import { EditingContext } from './EditingContext';
4
+ export declare function applyEdit(model: SceneDocument, edit: SceneEdit, context: EditingContext): EditOutcome;
5
+ //# sourceMappingURL=applyEdit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyEdit.d.ts","sourceRoot":"","sources":["../../../editing/applyEdit.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmC,aAAa,EAAE,SAAS,EAAiB,MAAM,qBAAqB,CAAC;AAE/G,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAqDlD,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,WAAW,CASrG"}
@@ -0,0 +1,81 @@
1
+ import { DiagnosticCode, SceneEditKind } from '@cratis/scene.model';
2
+ import { hasErrors, errorDiagnostic } from './diagnostics.js';
3
+ import { EditSession } from './EditSession.js';
4
+ import { applyUnexposeProperty, applyExposeProperty } from './exposureEdits.js';
5
+ import { applyEditCollectionItem, applyReorderCollectionItem, applyRemoveCollectionItem, applyAddCollectionItem, applyResetInstanceValue, applySetInstanceValue } from './instanceEdits.js';
6
+ import { applyChangeLayoutType } from './layoutTypeEdits.js';
7
+ import { cloneData } from './pathAccess.js';
8
+ import { applyResetProperty, applySetProperty } from './propertyEdits.js';
9
+ import { applyRemoveNode, applyMoveNode, applyInsertNode } from './structureEdits.js';
10
+
11
+ // Copyright (c) Cratis. All rights reserved.
12
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
13
+ function run(session, edit, clone, diagnostics) {
14
+ const handle = (handler)=>handler(session, edit, clone, diagnostics);
15
+ switch(edit.kind){
16
+ case SceneEditKind.SetProperty:
17
+ return handle(applySetProperty);
18
+ case SceneEditKind.ResetProperty:
19
+ return handle(applyResetProperty);
20
+ case SceneEditKind.ChangeLayoutType:
21
+ return handle(applyChangeLayoutType);
22
+ case SceneEditKind.InsertNode:
23
+ return handle(applyInsertNode);
24
+ case SceneEditKind.MoveNode:
25
+ return handle(applyMoveNode);
26
+ case SceneEditKind.RemoveNode:
27
+ return handle(applyRemoveNode);
28
+ case SceneEditKind.SetInstanceValue:
29
+ return handle(applySetInstanceValue);
30
+ case SceneEditKind.ResetInstanceValue:
31
+ return handle(applyResetInstanceValue);
32
+ case SceneEditKind.AddCollectionItem:
33
+ return handle(applyAddCollectionItem);
34
+ case SceneEditKind.RemoveCollectionItem:
35
+ return handle(applyRemoveCollectionItem);
36
+ case SceneEditKind.ReorderCollectionItem:
37
+ return handle(applyReorderCollectionItem);
38
+ case SceneEditKind.EditCollectionItem:
39
+ return handle(applyEditCollectionItem);
40
+ case SceneEditKind.ExposeProperty:
41
+ return handle(applyExposeProperty);
42
+ case SceneEditKind.UnexposeProperty:
43
+ return handle(applyUnexposeProperty);
44
+ default:
45
+ diagnostics.push(errorDiagnostic(DiagnosticCode.InvalidEdit, `'${edit.kind}' is not an edit this engine knows.`));
46
+ }
47
+ }
48
+ /**
49
+ * Applies one edit to a document.
50
+ *
51
+ * Pure and immutable: the document passed in is never changed, and the result is a new document. Edits are plain
52
+ * data, so a host can persist them and build undo and redo by keeping the documents either side. On any error the
53
+ * prior document comes back - the same object - together with the diagnostics, so a refused edit leaves nothing
54
+ * half done.
55
+ *
56
+ * What an edit may touch follows the editing scope. Nodes the scope owns are edited directly; inherited nodes are
57
+ * read-only, and their exposed properties are configured with the instance edits, which are checked against what
58
+ * each owner exposed.
59
+ *
60
+ * @param model The document to edit.
61
+ * @param edit What to do.
62
+ * @param context The catalog and the editing scope.
63
+ */ function applyEdit(model, edit, context) {
64
+ const session = new EditSession(model, context);
65
+ const clone = cloneData(model);
66
+ const diagnostics = [];
67
+ run(session, edit, clone, diagnostics);
68
+ if (hasErrors(diagnostics)) return {
69
+ model,
70
+ diagnostics,
71
+ applied: false
72
+ };
73
+ return {
74
+ model: clone,
75
+ diagnostics,
76
+ applied: true
77
+ };
78
+ }
79
+
80
+ export { applyEdit };
81
+ //# sourceMappingURL=applyEdit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyEdit.js","sources":["../../../editing/applyEdit.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCode, SceneDiagnostic, SceneDocument, SceneEdit, SceneEditKind } from '@cratis/scene.model';\nimport { errorDiagnostic, hasErrors } from './diagnostics';\nimport { EditOutcome } from './EditOutcome';\nimport { EditingContext } from './EditingContext';\nimport { EditSession } from './EditSession';\nimport { applyExposeProperty, applyUnexposeProperty } from './exposureEdits';\nimport {\n applyAddCollectionItem, applyEditCollectionItem, applyRemoveCollectionItem, applyReorderCollectionItem,\n applyResetInstanceValue, applySetInstanceValue,\n} from './instanceEdits';\nimport { applyChangeLayoutType } from './layoutTypeEdits';\nimport { cloneData } from './pathAccess';\nimport { applyResetProperty, applySetProperty } from './propertyEdits';\nimport { applyInsertNode, applyMoveNode, applyRemoveNode } from './structureEdits';\n\ntype Handler<TEdit extends SceneEdit> = (session: EditSession, edit: TEdit, clone: SceneDocument, diagnostics: SceneDiagnostic[]) => void;\n\nfunction run(session: EditSession, edit: SceneEdit, clone: SceneDocument, diagnostics: SceneDiagnostic[]): void {\n const handle = <TEdit extends SceneEdit>(handler: Handler<TEdit>) => handler(session, edit as TEdit, clone, diagnostics);\n\n switch (edit.kind) {\n case SceneEditKind.SetProperty: return handle(applySetProperty);\n case SceneEditKind.ResetProperty: return handle(applyResetProperty);\n case SceneEditKind.ChangeLayoutType: return handle(applyChangeLayoutType);\n case SceneEditKind.InsertNode: return handle(applyInsertNode);\n case SceneEditKind.MoveNode: return handle(applyMoveNode);\n case SceneEditKind.RemoveNode: return handle(applyRemoveNode);\n case SceneEditKind.SetInstanceValue: return handle(applySetInstanceValue);\n case SceneEditKind.ResetInstanceValue: return handle(applyResetInstanceValue);\n case SceneEditKind.AddCollectionItem: return handle(applyAddCollectionItem);\n case SceneEditKind.RemoveCollectionItem: return handle(applyRemoveCollectionItem);\n case SceneEditKind.ReorderCollectionItem: return handle(applyReorderCollectionItem);\n case SceneEditKind.EditCollectionItem: return handle(applyEditCollectionItem);\n case SceneEditKind.ExposeProperty: return handle(applyExposeProperty);\n case SceneEditKind.UnexposeProperty: return handle(applyUnexposeProperty);\n default:\n diagnostics.push(errorDiagnostic(DiagnosticCode.InvalidEdit, `'${(edit as { kind?: string }).kind}' is not an edit this engine knows.`));\n }\n}\n\n/**\n * Applies one edit to a document.\n *\n * Pure and immutable: the document passed in is never changed, and the result is a new document. Edits are plain\n * data, so a host can persist them and build undo and redo by keeping the documents either side. On any error the\n * prior document comes back - the same object - together with the diagnostics, so a refused edit leaves nothing\n * half done.\n *\n * What an edit may touch follows the editing scope. Nodes the scope owns are edited directly; inherited nodes are\n * read-only, and their exposed properties are configured with the instance edits, which are checked against what\n * each owner exposed.\n *\n * @param model The document to edit.\n * @param edit What to do.\n * @param context The catalog and the editing scope.\n */\nexport function applyEdit(model: SceneDocument, edit: SceneEdit, context: EditingContext): EditOutcome {\n const session = new EditSession(model, context);\n const clone = cloneData(model);\n const diagnostics: SceneDiagnostic[] = [];\n\n run(session, edit, clone, diagnostics);\n\n if (hasErrors(diagnostics)) return { model, diagnostics, applied: false };\n return { model: clone, diagnostics, applied: true };\n}\n"],"names":["run","session","edit","clone","diagnostics","handle","handler","kind","SceneEditKind","SetProperty","applySetProperty","ResetProperty","applyResetProperty","ChangeLayoutType","applyChangeLayoutType","InsertNode","applyInsertNode","MoveNode","applyMoveNode","RemoveNode","applyRemoveNode","SetInstanceValue","applySetInstanceValue","ResetInstanceValue","applyResetInstanceValue","AddCollectionItem","applyAddCollectionItem","RemoveCollectionItem","applyRemoveCollectionItem","ReorderCollectionItem","applyReorderCollectionItem","EditCollectionItem","applyEditCollectionItem","ExposeProperty","applyExposeProperty","UnexposeProperty","applyUnexposeProperty","push","errorDiagnostic","DiagnosticCode","InvalidEdit","applyEdit","model","context","EditSession","cloneData","hasErrors","applied"],"mappings":";;;;;;;;;;AAAA;AACA;AAmBA,SAASA,IAAIC,OAAoB,EAAEC,IAAe,EAAEC,KAAoB,EAAEC,WAA8B,EAAA;AACpG,IAAA,MAAMC,SAAS,CAA0BC,OAAAA,GAA4BA,OAAAA,CAAQL,OAAAA,EAASC,MAAeC,KAAAA,EAAOC,WAAAA,CAAAA;AAE5G,IAAA,OAAQF,KAAKK,IAAI;AACb,QAAA,KAAKC,cAAcC,WAAW;AAAE,YAAA,OAAOJ,MAAAA,CAAOK,gBAAAA,CAAAA;AAC9C,QAAA,KAAKF,cAAcG,aAAa;AAAE,YAAA,OAAON,MAAAA,CAAOO,kBAAAA,CAAAA;AAChD,QAAA,KAAKJ,cAAcK,gBAAgB;AAAE,YAAA,OAAOR,MAAAA,CAAOS,qBAAAA,CAAAA;AACnD,QAAA,KAAKN,cAAcO,UAAU;AAAE,YAAA,OAAOV,MAAAA,CAAOW,eAAAA,CAAAA;AAC7C,QAAA,KAAKR,cAAcS,QAAQ;AAAE,YAAA,OAAOZ,MAAAA,CAAOa,aAAAA,CAAAA;AAC3C,QAAA,KAAKV,cAAcW,UAAU;AAAE,YAAA,OAAOd,MAAAA,CAAOe,eAAAA,CAAAA;AAC7C,QAAA,KAAKZ,cAAca,gBAAgB;AAAE,YAAA,OAAOhB,MAAAA,CAAOiB,qBAAAA,CAAAA;AACnD,QAAA,KAAKd,cAAce,kBAAkB;AAAE,YAAA,OAAOlB,MAAAA,CAAOmB,uBAAAA,CAAAA;AACrD,QAAA,KAAKhB,cAAciB,iBAAiB;AAAE,YAAA,OAAOpB,MAAAA,CAAOqB,sBAAAA,CAAAA;AACpD,QAAA,KAAKlB,cAAcmB,oBAAoB;AAAE,YAAA,OAAOtB,MAAAA,CAAOuB,yBAAAA,CAAAA;AACvD,QAAA,KAAKpB,cAAcqB,qBAAqB;AAAE,YAAA,OAAOxB,MAAAA,CAAOyB,0BAAAA,CAAAA;AACxD,QAAA,KAAKtB,cAAcuB,kBAAkB;AAAE,YAAA,OAAO1B,MAAAA,CAAO2B,uBAAAA,CAAAA;AACrD,QAAA,KAAKxB,cAAcyB,cAAc;AAAE,YAAA,OAAO5B,MAAAA,CAAO6B,mBAAAA,CAAAA;AACjD,QAAA,KAAK1B,cAAc2B,gBAAgB;AAAE,YAAA,OAAO9B,MAAAA,CAAO+B,qBAAAA,CAAAA;AACnD,QAAA;AACIhC,YAAAA,WAAAA,CAAYiC,IAAI,CAACC,eAAAA,CAAgBC,cAAAA,CAAeC,WAAW,EAAE,CAAC,CAAC,EAAE,IAACtC,CAA2BK,IAAI,CAAC,mCAAmC,CAAC,CAAA,CAAA;AAC9I;AACJ;AAEA;;;;;;;;;;;;;;;AAeC,IACM,SAASkC,SAAAA,CAAUC,KAAoB,EAAExC,IAAe,EAAEyC,OAAuB,EAAA;IACpF,MAAM1C,OAAAA,GAAU,IAAI2C,WAAAA,CAAYF,KAAAA,EAAOC,OAAAA,CAAAA;AACvC,IAAA,MAAMxC,QAAQ0C,SAAAA,CAAUH,KAAAA,CAAAA;AACxB,IAAA,MAAMtC,cAAiC,EAAE;IAEzCJ,GAAAA,CAAIC,OAAAA,EAASC,MAAMC,KAAAA,EAAOC,WAAAA,CAAAA;IAE1B,IAAI0C,SAAAA,CAAU1C,cAAc,OAAO;AAAEsC,QAAAA,KAAAA;AAAOtC,QAAAA,WAAAA;QAAa2C,OAAAA,EAAS;AAAM,KAAA;IACxE,OAAO;QAAEL,KAAAA,EAAOvC,KAAAA;AAAOC,QAAAA,WAAAA;QAAa2C,OAAAA,EAAS;AAAK,KAAA;AACtD;;"}
@@ -0,0 +1,3 @@
1
+ import { EffectiveConfiguration, SceneElement } from '@cratis/scene.model';
2
+ export declare function applyEffectiveConfiguration(element: SceneElement, configuration: EffectiveConfiguration): SceneElement;
3
+ //# sourceMappingURL=applyEffectiveConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyEffectiveConfiguration.d.ts","sourceRoot":"","sources":["../../../editing/applyEffectiveConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,sBAAsB,EAA0C,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAcnI,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,GAAG,YAAY,CAmCtH"}
@@ -0,0 +1,60 @@
1
+ import { isExternalComponent, isContentControl, isItemsControl, isPanel } from '../elementKind.js';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * Returns the element tree a renderer should draw once effective configuration is applied: each configurable
7
+ * component carries its resolved properties.
8
+ *
9
+ * Pure, and structure-sharing - an element with nothing to change comes back as the same object, so a renderer
10
+ * that memoizes on identity does not redraw what did not change. There is no design-time flag here or anywhere
11
+ * downstream: a screen being edited and a screen being played go through this same function.
12
+ *
13
+ * @param element The element tree from the template or screen.
14
+ * @param configuration What {@link resolveEffectiveConfiguration} produced for the chain the tree sits in.
15
+ */ function applyEffectiveConfiguration(element, configuration) {
16
+ if (isExternalComponent(element)) {
17
+ const resolved = configuration.components.find((candidate)=>candidate.component === element.id);
18
+ let changed = resolved !== undefined;
19
+ const slots = {};
20
+ for (const [name, children] of Object.entries(element.slots)){
21
+ const mapped = children.map((child)=>applyEffectiveConfiguration(child, configuration));
22
+ if (mapped.some((child, index)=>child !== children[index])) changed = true;
23
+ slots[name] = mapped;
24
+ }
25
+ const updated = {
26
+ ...element,
27
+ properties: resolved?.properties ?? element.properties,
28
+ slots
29
+ };
30
+ return changed ? updated : element;
31
+ }
32
+ if (isContentControl(element)) {
33
+ const content = applyEffectiveConfiguration(element.content, configuration);
34
+ const updated = {
35
+ ...element,
36
+ content
37
+ };
38
+ return content === element.content ? element : updated;
39
+ }
40
+ if (isItemsControl(element)) {
41
+ const itemTemplate = applyEffectiveConfiguration(element.itemTemplate, configuration);
42
+ const updated = {
43
+ ...element,
44
+ itemTemplate
45
+ };
46
+ return itemTemplate === element.itemTemplate ? element : updated;
47
+ }
48
+ if (isPanel(element)) {
49
+ const children = element.children.map((child)=>applyEffectiveConfiguration(child, configuration));
50
+ const updated = {
51
+ ...element,
52
+ children
53
+ };
54
+ return children.some((child, index)=>child !== element.children[index]) ? updated : element;
55
+ }
56
+ return element;
57
+ }
58
+
59
+ export { applyEffectiveConfiguration };
60
+ //# sourceMappingURL=applyEffectiveConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyEffectiveConfiguration.js","sources":["../../../editing/applyEffectiveConfiguration.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ContentControl, EffectiveConfiguration, ExternalComponent, ItemsControl, Panel, SceneElement } from '@cratis/scene.model';\nimport { isContentControl, isExternalComponent, isItemsControl, isPanel } from '../elementKind';\n\n/**\n * Returns the element tree a renderer should draw once effective configuration is applied: each configurable\n * component carries its resolved properties.\n *\n * Pure, and structure-sharing - an element with nothing to change comes back as the same object, so a renderer\n * that memoizes on identity does not redraw what did not change. There is no design-time flag here or anywhere\n * downstream: a screen being edited and a screen being played go through this same function.\n *\n * @param element The element tree from the template or screen.\n * @param configuration What {@link resolveEffectiveConfiguration} produced for the chain the tree sits in.\n */\nexport function applyEffectiveConfiguration(element: SceneElement, configuration: EffectiveConfiguration): SceneElement {\n if (isExternalComponent(element)) {\n const resolved = configuration.components.find(candidate => candidate.component === element.id);\n let changed = resolved !== undefined;\n\n const slots: typeof element.slots = {};\n for (const [name, children] of Object.entries(element.slots)) {\n const mapped = children.map(child => applyEffectiveConfiguration(child, configuration));\n if (mapped.some((child, index) => child !== children[index])) changed = true;\n slots[name] = mapped;\n }\n\n const updated: ExternalComponent = { ...element, properties: resolved?.properties ?? element.properties, slots };\n return changed ? updated : element;\n }\n\n if (isContentControl(element)) {\n const content = applyEffectiveConfiguration(element.content, configuration);\n const updated: ContentControl = { ...element, content };\n return content === element.content ? element : updated;\n }\n\n if (isItemsControl(element)) {\n const itemTemplate = applyEffectiveConfiguration(element.itemTemplate, configuration);\n const updated: ItemsControl = { ...element, itemTemplate };\n return itemTemplate === element.itemTemplate ? element : updated;\n }\n\n if (isPanel(element)) {\n const children = element.children.map(child => applyEffectiveConfiguration(child, configuration));\n const updated: Panel = { ...element, children };\n return children.some((child, index) => child !== element.children[index]) ? updated : element;\n }\n\n return element;\n}\n"],"names":["applyEffectiveConfiguration","element","configuration","isExternalComponent","resolved","components","find","candidate","component","id","changed","undefined","slots","name","children","Object","entries","mapped","map","child","some","index","updated","properties","isContentControl","content","isItemsControl","itemTemplate","isPanel"],"mappings":";;AAAA;AACA;AAKA;;;;;;;;;;AAUC,IACM,SAASA,2BAAAA,CAA4BC,OAAqB,EAAEC,aAAqC,EAAA;AACpG,IAAA,IAAIC,oBAAoBF,OAAAA,CAAAA,EAAU;AAC9B,QAAA,MAAMG,QAAAA,GAAWF,aAAAA,CAAcG,UAAU,CAACC,IAAI,CAACC,CAAAA,SAAAA,GAAaA,SAAAA,CAAUC,SAAS,KAAKP,OAAAA,CAAQQ,EAAE,CAAA;AAC9F,QAAA,IAAIC,UAAUN,QAAAA,KAAaO,SAAAA;AAE3B,QAAA,MAAMC,QAA8B,EAAC;QACrC,KAAK,MAAM,CAACC,IAAAA,EAAMC,QAAAA,CAAS,IAAIC,OAAOC,OAAO,CAACf,OAAAA,CAAQW,KAAK,CAAA,CAAG;AAC1D,YAAA,MAAMK,SAASH,QAAAA,CAASI,GAAG,CAACC,CAAAA,KAAAA,GAASnB,4BAA4BmB,KAAAA,EAAOjB,aAAAA,CAAAA,CAAAA;YACxE,IAAIe,MAAAA,CAAOG,IAAI,CAAC,CAACD,KAAAA,EAAOE,KAAAA,GAAUF,KAAAA,KAAUL,QAAQ,CAACO,KAAAA,CAAM,CAAA,EAAGX,OAAAA,GAAU,IAAA;YACxEE,KAAK,CAACC,KAAK,GAAGI,MAAAA;AAClB,QAAA;AAEA,QAAA,MAAMK,OAAAA,GAA6B;AAAE,YAAA,GAAGrB,OAAO;YAAEsB,UAAAA,EAAYnB,QAAAA,EAAUmB,UAAAA,IAActB,OAAAA,CAAQsB,UAAU;AAAEX,YAAAA;AAAM,SAAA;AAC/G,QAAA,OAAOF,UAAUY,OAAAA,GAAUrB,OAAAA;AAC/B,IAAA;AAEA,IAAA,IAAIuB,iBAAiBvB,OAAAA,CAAAA,EAAU;AAC3B,QAAA,MAAMwB,OAAAA,GAAUzB,2BAAAA,CAA4BC,OAAAA,CAAQwB,OAAO,EAAEvB,aAAAA,CAAAA;AAC7D,QAAA,MAAMoB,OAAAA,GAA0B;AAAE,YAAA,GAAGrB,OAAO;AAAEwB,YAAAA;AAAQ,SAAA;AACtD,QAAA,OAAOA,OAAAA,KAAYxB,OAAAA,CAAQwB,OAAO,GAAGxB,OAAAA,GAAUqB,OAAAA;AACnD,IAAA;AAEA,IAAA,IAAII,eAAezB,OAAAA,CAAAA,EAAU;AACzB,QAAA,MAAM0B,YAAAA,GAAe3B,2BAAAA,CAA4BC,OAAAA,CAAQ0B,YAAY,EAAEzB,aAAAA,CAAAA;AACvE,QAAA,MAAMoB,OAAAA,GAAwB;AAAE,YAAA,GAAGrB,OAAO;AAAE0B,YAAAA;AAAa,SAAA;AACzD,QAAA,OAAOA,YAAAA,KAAiB1B,OAAAA,CAAQ0B,YAAY,GAAG1B,OAAAA,GAAUqB,OAAAA;AAC7D,IAAA;AAEA,IAAA,IAAIM,QAAQ3B,OAAAA,CAAAA,EAAU;QAClB,MAAMa,QAAAA,GAAWb,QAAQa,QAAQ,CAACI,GAAG,CAACC,CAAAA,KAAAA,GAASnB,2BAAAA,CAA4BmB,KAAAA,EAAOjB,aAAAA,CAAAA,CAAAA;AAClF,QAAA,MAAMoB,OAAAA,GAAiB;AAAE,YAAA,GAAGrB,OAAO;AAAEa,YAAAA;AAAS,SAAA;AAC9C,QAAA,OAAOA,QAAAA,CAASM,IAAI,CAAC,CAACD,KAAAA,EAAOE,KAAAA,GAAUF,KAAAA,KAAUlB,OAAAA,CAAQa,QAAQ,CAACO,KAAAA,CAAM,CAAA,GAAIC,OAAAA,GAAUrB,OAAAA;AAC1F,IAAA;IAEA,OAAOA,OAAAA;AACX;;"}
@@ -0,0 +1,3 @@
1
+ import { ExternalComponent } from '@cratis/scene.model';
2
+ export declare function collectComponents(owner: unknown): ExternalComponent[];
3
+ //# sourceMappingURL=collectComponents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectComponents.d.ts","sourceRoot":"","sources":["../../../editing/collectComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAgBxD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,EAAE,CAgBrE"}
@@ -0,0 +1,32 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ function isExternalComponentValue(value) {
4
+ const candidate = value;
5
+ return typeof candidate.id === 'string' && typeof candidate.componentName === 'string' && candidate.properties !== null && typeof candidate.properties === 'object';
6
+ }
7
+ /**
8
+ * Finds every external component anywhere inside a layout, template, dialog template or screen, each once by id.
9
+ *
10
+ * It scans the value's structure rather than following a fixed list of properties, so a component is found
11
+ * wherever the model keeps it - slot content, a flow leaf, a freeform placement, a panel's children, another
12
+ * component's slot. A freeform arrangement repeats an element across its size-class variants; the first copy
13
+ * is the one returned.
14
+ */ function collectComponents(owner) {
15
+ const found = new Map();
16
+ const visit = (value)=>{
17
+ if (value === null || typeof value !== 'object') return;
18
+ if (Array.isArray(value)) {
19
+ for (const item of value)visit(item);
20
+ return;
21
+ }
22
+ if (isExternalComponentValue(value) && !found.has(value.id)) found.set(value.id, value);
23
+ for (const child of Object.values(value))visit(child);
24
+ };
25
+ visit(owner);
26
+ return [
27
+ ...found.values()
28
+ ];
29
+ }
30
+
31
+ export { collectComponents };
32
+ //# sourceMappingURL=collectComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectComponents.js","sources":["../../../editing/collectComponents.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ExternalComponent } from '@cratis/scene.model';\n\nfunction isExternalComponentValue(value: object): value is ExternalComponent {\n const candidate = value as Partial<ExternalComponent>;\n return typeof candidate.id === 'string' && typeof candidate.componentName === 'string'\n && candidate.properties !== null && typeof candidate.properties === 'object';\n}\n\n/**\n * Finds every external component anywhere inside a layout, template, dialog template or screen, each once by id.\n *\n * It scans the value's structure rather than following a fixed list of properties, so a component is found\n * wherever the model keeps it - slot content, a flow leaf, a freeform placement, a panel's children, another\n * component's slot. A freeform arrangement repeats an element across its size-class variants; the first copy\n * is the one returned.\n */\nexport function collectComponents(owner: unknown): ExternalComponent[] {\n const found = new Map<string, ExternalComponent>();\n\n const visit = (value: unknown): void => {\n if (value === null || typeof value !== 'object') return;\n if (Array.isArray(value)) {\n for (const item of value) visit(item);\n return;\n }\n\n if (isExternalComponentValue(value) && !found.has(value.id)) found.set(value.id, value);\n for (const child of Object.values(value)) visit(child);\n };\n\n visit(owner);\n return [...found.values()];\n}\n"],"names":["isExternalComponentValue","value","candidate","id","componentName","properties","collectComponents","owner","found","Map","visit","Array","isArray","item","has","set","child","Object","values"],"mappings":"AAAA;AACA;AAIA,SAASA,yBAAyBC,KAAa,EAAA;AAC3C,IAAA,MAAMC,SAAAA,GAAYD,KAAAA;AAClB,IAAA,OAAO,OAAOC,SAAAA,CAAUC,EAAE,KAAK,QAAA,IAAY,OAAOD,SAAAA,CAAUE,aAAa,KAAK,QAAA,IACvEF,UAAUG,UAAU,KAAK,QAAQ,OAAOH,SAAAA,CAAUG,UAAU,KAAK,QAAA;AAC5E;AAEA;;;;;;;IAQO,SAASC,iBAAAA,CAAkBC,KAAc,EAAA;AAC5C,IAAA,MAAMC,QAAQ,IAAIC,GAAAA,EAAAA;AAElB,IAAA,MAAMC,QAAQ,CAACT,KAAAA,GAAAA;AACX,QAAA,IAAIA,KAAAA,KAAU,IAAA,IAAQ,OAAOA,KAAAA,KAAU,QAAA,EAAU;QACjD,IAAIU,KAAAA,CAAMC,OAAO,CAACX,KAAAA,CAAAA,EAAQ;YACtB,KAAK,MAAMY,IAAAA,IAAQZ,KAAAA,CAAOS,KAAAA,CAAMG,IAAAA,CAAAA;AAChC,YAAA;AACJ,QAAA;AAEA,QAAA,IAAIb,wBAAAA,CAAyBC,KAAAA,CAAAA,IAAU,CAACO,KAAAA,CAAMM,GAAG,CAACb,KAAAA,CAAME,EAAE,CAAA,EAAGK,KAAAA,CAAMO,GAAG,CAACd,KAAAA,CAAME,EAAE,EAAEF,KAAAA,CAAAA;AACjF,QAAA,KAAK,MAAMe,KAAAA,IAASC,MAAAA,CAAOC,MAAM,CAACjB,OAAQS,KAAAA,CAAMM,KAAAA,CAAAA;AACpD,IAAA,CAAA;IAEAN,KAAAA,CAAMH,KAAAA,CAAAA;IACN,OAAO;AAAIC,QAAAA,GAAAA,KAAAA,CAAMU,MAAM;AAAG,KAAA;AAC9B;;"}
@@ -0,0 +1,5 @@
1
+ import { SceneDocument } from '@cratis/scene.model';
2
+ import { IconUsage } from '../icons/IconUsage';
3
+ import { DescriptorCatalog } from './DescriptorCatalog';
4
+ export declare function collectIconUsages(document: SceneDocument, catalog: DescriptorCatalog): IconUsage[];
5
+ //# sourceMappingURL=collectIconUsages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectIconUsages.d.ts","sourceRoot":"","sources":["../../../editing/collectIconUsages.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+D,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAsCjF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,EAAE,CA6BlG"}