@cratis/scene.engine 4.26.0 → 4.27.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 (121) hide show
  1. package/dist/cjs/editing/resolveEffectiveConfiguration.js +8 -0
  2. package/dist/cjs/editing/resolveEffectiveConfiguration.js.map +1 -1
  3. package/dist/cjs/index.js +23 -0
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/navigation/NavigationDiagnosticCode.js +5 -0
  6. package/dist/cjs/navigation/NavigationDiagnosticCode.js.map +1 -1
  7. package/dist/cjs/navigation/NavigationEditKind.js +16 -0
  8. package/dist/cjs/navigation/NavigationEditKind.js.map +1 -0
  9. package/dist/cjs/navigation/NavigationItemOrigin.js +14 -0
  10. package/dist/cjs/navigation/NavigationItemOrigin.js.map +1 -0
  11. package/dist/cjs/navigation/NavigationSourcesKind.js +16 -0
  12. package/dist/cjs/navigation/NavigationSourcesKind.js.map +1 -0
  13. package/dist/cjs/navigation/diagnoseNavigation.js +8 -1
  14. package/dist/cjs/navigation/diagnoseNavigation.js.map +1 -1
  15. package/dist/cjs/navigation/diagnoseNavigationRegions.js +99 -0
  16. package/dist/cjs/navigation/diagnoseNavigationRegions.js.map +1 -0
  17. package/dist/cjs/navigation/effectiveNavigation.js +133 -0
  18. package/dist/cjs/navigation/effectiveNavigation.js.map +1 -0
  19. package/dist/cjs/navigation/navigationEdits.js +230 -0
  20. package/dist/cjs/navigation/navigationEdits.js.map +1 -0
  21. package/dist/cjs/navigation/navigationRegions.js +42 -0
  22. package/dist/cjs/navigation/navigationRegions.js.map +1 -0
  23. package/dist/cjs/validateNavigationDestinations.js +2 -0
  24. package/dist/cjs/validateNavigationDestinations.js.map +1 -1
  25. package/dist/esm/editing/resolveEffectiveConfiguration.d.ts.map +1 -1
  26. package/dist/esm/editing/resolveEffectiveConfiguration.js +8 -0
  27. package/dist/esm/editing/resolveEffectiveConfiguration.js.map +1 -1
  28. package/dist/esm/index.js +7 -0
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/navigation/EffectiveNavItem.d.ts +14 -0
  31. package/dist/esm/navigation/EffectiveNavItem.d.ts.map +1 -0
  32. package/dist/esm/navigation/EffectiveNavItem.js +2 -0
  33. package/dist/esm/navigation/EffectiveNavItem.js.map +1 -0
  34. package/dist/esm/navigation/EffectiveNavigationRegion.d.ts +11 -0
  35. package/dist/esm/navigation/EffectiveNavigationRegion.d.ts.map +1 -0
  36. package/dist/esm/navigation/EffectiveNavigationRegion.js +2 -0
  37. package/dist/esm/navigation/EffectiveNavigationRegion.js.map +1 -0
  38. package/dist/esm/navigation/NavigationDiagnosticCode.d.ts +6 -1
  39. package/dist/esm/navigation/NavigationDiagnosticCode.d.ts.map +1 -1
  40. package/dist/esm/navigation/NavigationDiagnosticCode.js +5 -0
  41. package/dist/esm/navigation/NavigationDiagnosticCode.js.map +1 -1
  42. package/dist/esm/navigation/NavigationEdit.d.ts +13 -0
  43. package/dist/esm/navigation/NavigationEdit.d.ts.map +1 -0
  44. package/dist/esm/navigation/NavigationEdit.js +2 -0
  45. package/dist/esm/navigation/NavigationEdit.js.map +1 -0
  46. package/dist/esm/navigation/NavigationEditKind.d.ts +7 -0
  47. package/dist/esm/navigation/NavigationEditKind.d.ts.map +1 -0
  48. package/dist/esm/navigation/NavigationEditKind.js +14 -0
  49. package/dist/esm/navigation/NavigationEditKind.js.map +1 -0
  50. package/dist/esm/navigation/NavigationEditOutcome.d.ts +7 -0
  51. package/dist/esm/navigation/NavigationEditOutcome.d.ts.map +1 -0
  52. package/dist/esm/navigation/NavigationEditOutcome.js +2 -0
  53. package/dist/esm/navigation/NavigationEditOutcome.js.map +1 -0
  54. package/dist/esm/navigation/NavigationEditPlan.d.ts +6 -0
  55. package/dist/esm/navigation/NavigationEditPlan.d.ts.map +1 -0
  56. package/dist/esm/navigation/NavigationEditPlan.js +2 -0
  57. package/dist/esm/navigation/NavigationEditPlan.js.map +1 -0
  58. package/dist/esm/navigation/NavigationGraph.d.ts +4 -1
  59. package/dist/esm/navigation/NavigationGraph.d.ts.map +1 -1
  60. package/dist/esm/navigation/NavigationItemOrigin.d.ts +5 -0
  61. package/dist/esm/navigation/NavigationItemOrigin.d.ts.map +1 -0
  62. package/dist/esm/navigation/NavigationItemOrigin.js +12 -0
  63. package/dist/esm/navigation/NavigationItemOrigin.js.map +1 -0
  64. package/dist/esm/navigation/NavigationSources.d.ts +6 -0
  65. package/dist/esm/navigation/NavigationSources.d.ts.map +1 -0
  66. package/dist/esm/navigation/NavigationSources.js +2 -0
  67. package/dist/esm/navigation/NavigationSources.js.map +1 -0
  68. package/dist/esm/navigation/NavigationSourcesKind.d.ts +7 -0
  69. package/dist/esm/navigation/NavigationSourcesKind.d.ts.map +1 -0
  70. package/dist/esm/navigation/NavigationSourcesKind.js +14 -0
  71. package/dist/esm/navigation/NavigationSourcesKind.js.map +1 -0
  72. package/dist/esm/navigation/ResolvedNavigationTarget.d.ts +6 -0
  73. package/dist/esm/navigation/ResolvedNavigationTarget.d.ts.map +1 -0
  74. package/dist/esm/navigation/ResolvedNavigationTarget.js +2 -0
  75. package/dist/esm/navigation/ResolvedNavigationTarget.js.map +1 -0
  76. package/dist/esm/navigation/diagnoseNavigation.d.ts.map +1 -1
  77. package/dist/esm/navigation/diagnoseNavigation.js +8 -1
  78. package/dist/esm/navigation/diagnoseNavigation.js.map +1 -1
  79. package/dist/esm/navigation/diagnoseNavigationRegions.d.ts +8 -0
  80. package/dist/esm/navigation/diagnoseNavigationRegions.d.ts.map +1 -0
  81. package/dist/esm/navigation/diagnoseNavigationRegions.js +97 -0
  82. package/dist/esm/navigation/diagnoseNavigationRegions.js.map +1 -0
  83. package/dist/esm/navigation/effectiveNavigation.d.ts +5 -0
  84. package/dist/esm/navigation/effectiveNavigation.d.ts.map +1 -0
  85. package/dist/esm/navigation/effectiveNavigation.js +131 -0
  86. package/dist/esm/navigation/effectiveNavigation.js.map +1 -0
  87. package/dist/esm/navigation/index.d.ts +14 -0
  88. package/dist/esm/navigation/index.d.ts.map +1 -1
  89. package/dist/esm/navigation/index.js +14 -0
  90. package/dist/esm/navigation/index.js.map +1 -1
  91. package/dist/esm/navigation/navigationEdits.d.ts +11 -0
  92. package/dist/esm/navigation/navigationEdits.d.ts.map +1 -0
  93. package/dist/esm/navigation/navigationEdits.js +225 -0
  94. package/dist/esm/navigation/navigationEdits.js.map +1 -0
  95. package/dist/esm/navigation/navigationRegions.d.ts +9 -0
  96. package/dist/esm/navigation/navigationRegions.d.ts.map +1 -0
  97. package/dist/esm/navigation/navigationRegions.js +34 -0
  98. package/dist/esm/navigation/navigationRegions.js.map +1 -0
  99. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  100. package/dist/esm/validateNavigationDestinations.js +2 -0
  101. package/dist/esm/validateNavigationDestinations.js.map +1 -1
  102. package/editing/resolveEffectiveConfiguration.ts +13 -0
  103. package/navigation/EffectiveNavItem.ts +37 -0
  104. package/navigation/EffectiveNavigationRegion.ts +26 -0
  105. package/navigation/NavigationDiagnosticCode.ts +15 -0
  106. package/navigation/NavigationEdit.ts +36 -0
  107. package/navigation/NavigationEditKind.ts +19 -0
  108. package/navigation/NavigationEditOutcome.ts +18 -0
  109. package/navigation/NavigationEditPlan.ts +15 -0
  110. package/navigation/NavigationGraph.ts +10 -1
  111. package/navigation/NavigationItemOrigin.ts +13 -0
  112. package/navigation/NavigationSources.ts +15 -0
  113. package/navigation/NavigationSourcesKind.ts +19 -0
  114. package/navigation/ResolvedNavigationTarget.ts +19 -0
  115. package/navigation/diagnoseNavigation.ts +7 -1
  116. package/navigation/diagnoseNavigationRegions.ts +122 -0
  117. package/navigation/effectiveNavigation.ts +105 -0
  118. package/navigation/index.ts +14 -0
  119. package/navigation/navigationEdits.ts +176 -0
  120. package/navigation/navigationRegions.ts +39 -0
  121. package/package.json +3 -3
package/dist/esm/index.js CHANGED
@@ -58,6 +58,13 @@ export { NavigationDiagnosticCode } from './navigation/NavigationDiagnosticCode.
58
58
  export { diagnoseNavigation } from './navigation/diagnoseNavigation.js';
59
59
  export { navigationEntriesFrom } from './navigation/navigationEntriesFrom.js';
60
60
  export { authoredRouteKey, navigationTarget } from './navigation/navigationRoute.js';
61
+ export { applicationItems, collectItemIds, findModuleNavigation, findNavigationRegion, modeOfModuleRegion, navigationRegionOrder, primarySlot } from './navigation/navigationRegions.js';
62
+ export { NavigationItemOrigin } from './navigation/NavigationItemOrigin.js';
63
+ export { NavigationSourcesKind } from './navigation/NavigationSourcesKind.js';
64
+ export { effectiveNavigation } from './navigation/effectiveNavigation.js';
65
+ export { diagnoseNavigationRegions } from './navigation/diagnoseNavigationRegions.js';
66
+ export { NavigationEditKind } from './navigation/NavigationEditKind.js';
67
+ export { addNavItem, applyNavigationEdits, setApplicationLogo, switchRegionMode } from './navigation/navigationEdits.js';
61
68
  export { validateNavigationDestinations } from './validateNavigationDestinations.js';
62
69
  export { errorDiagnostic, hasErrors, warningDiagnostic } from './editing/diagnostics.js';
63
70
  export { dialogTemplateNodeId, elementNodeId, flowNodeId, freeformNodeId, layoutNodeId, ownerArrangementId, placementNodeId, scopeInstanceId, scopeNodeId, screenNodeId, screenTemplateNodeId, slotNodeId } from './editing/nodeIds.js';
@@ -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,14 @@
1
+ import { NavigationItemOrigin } from './NavigationItemOrigin';
2
+ import { ResolvedNavigationTarget } from './ResolvedNavigationTarget';
3
+ export interface EffectiveNavItem {
4
+ id: string;
5
+ title: string;
6
+ icon?: string;
7
+ slot: string;
8
+ target?: ResolvedNavigationTarget;
9
+ origin: NavigationItemOrigin;
10
+ readOnly: boolean;
11
+ reason: string;
12
+ children?: EffectiveNavItem[];
13
+ }
14
+ //# sourceMappingURL=EffectiveNavItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffectiveNavItem.d.ts","sourceRoot":"","sources":["../../../navigation/EffectiveNavItem.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAKtE,MAAM,WAAW,gBAAgB;IAE7B,EAAE,EAAE,MAAM,CAAC;IAGX,KAAK,EAAE,MAAM,CAAC;IAGd,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAGlC,MAAM,EAAE,oBAAoB,CAAC;IAG7B,QAAQ,EAAE,OAAO,CAAC;IAGlB,MAAM,EAAE,MAAM,CAAC;IAGf,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACjC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EffectiveNavItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffectiveNavItem.js","sourceRoot":"","sources":["../../../navigation/EffectiveNavItem.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { NavigationRegionKind, NavigationRegionMode } from '@cratis/scene.model';
2
+ import { EffectiveNavItem } from './EffectiveNavItem';
3
+ import { NavigationSources } from './NavigationSources';
4
+ export interface EffectiveNavigationRegion {
5
+ region: NavigationRegionKind;
6
+ module?: string;
7
+ mode?: NavigationRegionMode;
8
+ sources: NavigationSources;
9
+ items: EffectiveNavItem[];
10
+ }
11
+ //# sourceMappingURL=EffectiveNavigationRegion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffectiveNavigationRegion.d.ts","sourceRoot":"","sources":["../../../navigation/EffectiveNavigationRegion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,yBAAyB;IAEtC,MAAM,EAAE,oBAAoB,CAAC;IAG7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAG5B,OAAO,EAAE,iBAAiB,CAAC;IAG3B,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC7B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EffectiveNavigationRegion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EffectiveNavigationRegion.js","sourceRoot":"","sources":["../../../navigation/EffectiveNavigationRegion.ts"],"names":[],"mappings":""}
@@ -4,6 +4,11 @@ export declare enum NavigationDiagnosticCode {
4
4
  MissingOutlet = "missingOutlet",
5
5
  IncompatibleOutlet = "incompatibleOutlet",
6
6
  NavigationCycle = "navigationCycle",
7
- UnavailableTarget = "unavailableTarget"
7
+ UnavailableTarget = "unavailableTarget",
8
+ NavTargetMissing = "navTargetMissing",
9
+ NavSlotUnknown = "navSlotUnknown",
10
+ NavDuplicateId = "navDuplicateId",
11
+ NavModuleWithoutFeatures = "navModuleWithoutFeatures",
12
+ NavTargetOutOfScope = "navTargetOutOfScope"
8
13
  }
9
14
  //# sourceMappingURL=NavigationDiagnosticCode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationDiagnosticCode.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationDiagnosticCode.ts"],"names":[],"mappings":"AAOA,oBAAY,wBAAwB;IAEhC,cAAc,mBAAmB;IAGjC,eAAe,oBAAoB;IAGnC,aAAa,kBAAkB;IAG/B,kBAAkB,uBAAuB;IAGzC,eAAe,oBAAoB;IAGnC,iBAAiB,sBAAsB;CAC1C"}
1
+ {"version":3,"file":"NavigationDiagnosticCode.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationDiagnosticCode.ts"],"names":[],"mappings":"AAOA,oBAAY,wBAAwB;IAEhC,cAAc,mBAAmB;IAGjC,eAAe,oBAAoB;IAGnC,aAAa,kBAAkB;IAG/B,kBAAkB,uBAAuB;IAGzC,eAAe,oBAAoB;IAGnC,iBAAiB,sBAAsB;IAGvC,gBAAgB,qBAAqB;IAGrC,cAAc,mBAAmB;IAGjC,cAAc,mBAAmB;IAGjC,wBAAwB,6BAA6B;IAGrD,mBAAmB,wBAAwB;CAC9C"}
@@ -10,6 +10,11 @@
10
10
  /** A destination names an outlet that cannot host what it opens. */ NavigationDiagnosticCode["IncompatibleOutlet"] = "incompatibleOutlet";
11
11
  /** Screens are placed in outlets owned by each other, so composition never terminates. */ NavigationDiagnosticCode["NavigationCycle"] = "navigationCycle";
12
12
  /** A destination opens a screen or dialog that does not exist, or names nothing to open. */ NavigationDiagnosticCode["UnavailableTarget"] = "unavailableTarget";
13
+ /** A navigation item has no target, or targets a module or feature the application does not have. */ NavigationDiagnosticCode["NavTargetMissing"] = "navTargetMissing";
14
+ /** A navigation item renders into a slot the layout does not declare. */ NavigationDiagnosticCode["NavSlotUnknown"] = "navSlotUnknown";
15
+ /** Two navigation items of one region share an id. */ NavigationDiagnosticCode["NavDuplicateId"] = "navDuplicateId";
16
+ /** A navigation item targets a module that has no feature to go to. */ NavigationDiagnosticCode["NavModuleWithoutFeatures"] = "navModuleWithoutFeatures";
17
+ /** A module's own navigation item targets a different module. */ NavigationDiagnosticCode["NavTargetOutOfScope"] = "navTargetOutOfScope";
13
18
  return NavigationDiagnosticCode;
14
19
  }({});
15
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationDiagnosticCode.js","sources":["../../../navigation/NavigationDiagnosticCode.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\n/**\n * What is wrong with a navigation destination. The values are shared with the C# engine so both report\n * the same code for the same model.\n */\nexport enum NavigationDiagnosticCode {\n /** Two destinations that go to different targets share one URL. */\n DuplicateRoute = 'duplicateRoute',\n\n /** Two surfaces declare an outlet with the same name, so a destination cannot tell them apart. */\n DuplicateOutlet = 'duplicateOutlet',\n\n /** A destination names an outlet that no layout or screen template declares. */\n MissingOutlet = 'missingOutlet',\n\n /** A destination names an outlet that cannot host what it opens. */\n IncompatibleOutlet = 'incompatibleOutlet',\n\n /** Screens are placed in outlets owned by each other, so composition never terminates. */\n NavigationCycle = 'navigationCycle',\n\n /** A destination opens a screen or dialog that does not exist, or names nothing to open. */\n UnavailableTarget = 'unavailableTarget',\n}\n"],"names":["NavigationDiagnosticCode"],"mappings":"AAAA;AACA;AAEA;;;IAIO,IAAKA,wBAAAA,iBAAAA,SAAAA,wBAAAA,EAAAA;wEACyD,wBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;uGAG+B,wBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;qFAGlB,wBAAA,CAAA,eAAA,CAAA,GAAA,eAAA;yEAGZ,wBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAA;+FAGsB,wBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;iGAGE,wBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAA;AAhBlFA,IAAAA,OAAAA,wBAAAA;AAkBX,CAAA,CAAA,EAAA;;"}
1
+ {"version":3,"file":"NavigationDiagnosticCode.js","sources":["../../../navigation/NavigationDiagnosticCode.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\n/**\n * What is wrong with a navigation destination. The values are shared with the C# engine so both report\n * the same code for the same model.\n */\nexport enum NavigationDiagnosticCode {\n /** Two destinations that go to different targets share one URL. */\n DuplicateRoute = 'duplicateRoute',\n\n /** Two surfaces declare an outlet with the same name, so a destination cannot tell them apart. */\n DuplicateOutlet = 'duplicateOutlet',\n\n /** A destination names an outlet that no layout or screen template declares. */\n MissingOutlet = 'missingOutlet',\n\n /** A destination names an outlet that cannot host what it opens. */\n IncompatibleOutlet = 'incompatibleOutlet',\n\n /** Screens are placed in outlets owned by each other, so composition never terminates. */\n NavigationCycle = 'navigationCycle',\n\n /** A destination opens a screen or dialog that does not exist, or names nothing to open. */\n UnavailableTarget = 'unavailableTarget',\n\n /** A navigation item has no target, or targets a module or feature the application does not have. */\n NavTargetMissing = 'navTargetMissing',\n\n /** A navigation item renders into a slot the layout does not declare. */\n NavSlotUnknown = 'navSlotUnknown',\n\n /** Two navigation items of one region share an id. */\n NavDuplicateId = 'navDuplicateId',\n\n /** A navigation item targets a module that has no feature to go to. */\n NavModuleWithoutFeatures = 'navModuleWithoutFeatures',\n\n /** A module's own navigation item targets a different module. */\n NavTargetOutOfScope = 'navTargetOutOfScope',\n}\n"],"names":["NavigationDiagnosticCode"],"mappings":"AAAA;AACA;AAEA;;;IAIO,IAAKA,wBAAAA,iBAAAA,SAAAA,wBAAAA,EAAAA;wEACyD,wBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;uGAG+B,wBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;qFAGlB,wBAAA,CAAA,eAAA,CAAA,GAAA,eAAA;yEAGZ,wBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAA;+FAGsB,wBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;iGAGE,wBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAA;0GAGS,wBAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA;8EAG5B,wBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;2DAGnB,wBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;4EAGiB,wBAAA,CAAA,0BAAA,CAAA,GAAA,0BAAA;sEAGN,wBAAA,CAAA,qBAAA,CAAA,GAAA,qBAAA;AA/BvDA,IAAAA,OAAAA,wBAAAA;AAiCX,CAAA,CAAA,EAAA;;"}
@@ -0,0 +1,13 @@
1
+ import { ApplicationLogo, NavigationRegionKind, NavigationRegionMode, NavItem } from '@cratis/scene.model';
2
+ import { NavigationEditKind } from './NavigationEditKind';
3
+ export interface NavigationEdit {
4
+ kind: NavigationEditKind;
5
+ module?: string;
6
+ region?: NavigationRegionKind;
7
+ mode?: NavigationRegionMode;
8
+ items?: NavItem[];
9
+ parent?: string;
10
+ item?: NavItem;
11
+ logo?: ApplicationLogo;
12
+ }
13
+ //# sourceMappingURL=NavigationEdit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEdit.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationEdit.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,WAAW,cAAc;IAE3B,IAAI,EAAE,kBAAkB,CAAC;IAGzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAG9B,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAG5B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAGlB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,IAAI,CAAC,EAAE,OAAO,CAAC;IAGf,IAAI,CAAC,EAAE,eAAe,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NavigationEdit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEdit.js","sourceRoot":"","sources":["../../../navigation/NavigationEdit.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare enum NavigationEditKind {
2
+ SetRegionMode = "setRegionMode",
3
+ SetRegionItems = "setRegionItems",
4
+ AddItem = "addItem",
5
+ SetLogo = "setLogo"
6
+ }
7
+ //# sourceMappingURL=NavigationEditKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEditKind.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationEditKind.ts"],"names":[],"mappings":"AAMA,oBAAY,kBAAkB;IAE1B,aAAa,kBAAkB;IAG/B,cAAc,mBAAmB;IAGjC,OAAO,YAAY;IAGnB,OAAO,YAAY;CACtB"}
@@ -0,0 +1,14 @@
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
+ /**
4
+ * What a navigation edit does. The values are shared with the C# engine.
5
+ */ var NavigationEditKind = /*#__PURE__*/ function(NavigationEditKind) {
6
+ /** Sets how a module's region relates to the application's. */ NavigationEditKind["SetRegionMode"] = "setRegionMode";
7
+ /** Replaces the items a level holds in a region. */ NavigationEditKind["SetRegionItems"] = "setRegionItems";
8
+ /** Adds an item, or a sub-item, after the ones already there. */ NavigationEditKind["AddItem"] = "addItem";
9
+ /** Sets the application logo. */ NavigationEditKind["SetLogo"] = "setLogo";
10
+ return NavigationEditKind;
11
+ }({});
12
+
13
+ export { NavigationEditKind };
14
+ //# sourceMappingURL=NavigationEditKind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEditKind.js","sources":["../../../navigation/NavigationEditKind.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\n/**\n * What a navigation edit does. The values are shared with the C# engine.\n */\nexport enum NavigationEditKind {\n /** Sets how a module's region relates to the application's. */\n SetRegionMode = 'setRegionMode',\n\n /** Replaces the items a level holds in a region. */\n SetRegionItems = 'setRegionItems',\n\n /** Adds an item, or a sub-item, after the ones already there. */\n AddItem = 'addItem',\n\n /** Sets the application logo. */\n SetLogo = 'setLogo',\n}\n"],"names":["NavigationEditKind"],"mappings":"AAAA;AACA;AAEA;;IAGO,IAAKA,kBAAAA,iBAAAA,SAAAA,kBAAAA,EAAAA;oEACqD,kBAAA,CAAA,eAAA,CAAA,GAAA,eAAA;yDAGX,kBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;sEAGa,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAA;sCAGhC,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAA;AAVvBA,IAAAA,OAAAA,kBAAAA;AAYX,CAAA,CAAA,EAAA;;"}
@@ -0,0 +1,7 @@
1
+ import { NavigationModel } from '@cratis/scene.model';
2
+ export interface NavigationEditOutcome {
3
+ applied: boolean;
4
+ model: NavigationModel;
5
+ rejected?: string;
6
+ }
7
+ //# sourceMappingURL=NavigationEditOutcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEditOutcome.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationEditOutcome.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKtD,MAAM,WAAW,qBAAqB;IAElC,OAAO,EAAE,OAAO,CAAC;IAGjB,KAAK,EAAE,eAAe,CAAC;IAGvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NavigationEditOutcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEditOutcome.js","sourceRoot":"","sources":["../../../navigation/NavigationEditOutcome.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { NavigationEdit } from './NavigationEdit';
2
+ export interface NavigationEditPlan {
3
+ edits: NavigationEdit[];
4
+ rejected?: string;
5
+ }
6
+ //# sourceMappingURL=NavigationEditPlan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEditPlan.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationEditPlan.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,MAAM,WAAW,kBAAkB;IAE/B,KAAK,EAAE,cAAc,EAAE,CAAC;IAGxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NavigationEditPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationEditPlan.js","sourceRoot":"","sources":["../../../navigation/NavigationEditPlan.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { DialogTemplate, Layout, Screen, ScreenTemplate } from '@cratis/scene.model';
1
+ import { ApplicationStructure, DialogTemplate, Layout, NavigationModel, Screen, ScreenTemplate } from '@cratis/scene.model';
2
2
  import { NavigationEntry } from './NavigationEntry';
3
3
  export interface NavigationGraph {
4
4
  entries: NavigationEntry[];
@@ -6,5 +6,8 @@ export interface NavigationGraph {
6
6
  layouts?: Layout[];
7
7
  screenTemplates?: ScreenTemplate[];
8
8
  dialogTemplates?: DialogTemplate[];
9
+ structure?: ApplicationStructure;
10
+ navigation?: NavigationModel;
11
+ slots?: string[];
9
12
  }
10
13
  //# sourceMappingURL=NavigationGraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationGraph.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMpD,MAAM,WAAW,eAAe;IAE5B,OAAO,EAAE,eAAe,EAAE,CAAC;IAG3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAGnC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACtC"}
1
+ {"version":3,"file":"NavigationGraph.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC5H,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMpD,MAAM,WAAW,eAAe;IAE5B,OAAO,EAAE,eAAe,EAAE,CAAC;IAG3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAGnC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAGnC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAGjC,UAAU,CAAC,EAAE,eAAe,CAAC;IAG7B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
@@ -0,0 +1,5 @@
1
+ export declare enum NavigationItemOrigin {
2
+ Application = "application",
3
+ Module = "module"
4
+ }
5
+ //# sourceMappingURL=NavigationItemOrigin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationItemOrigin.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationItemOrigin.ts"],"names":[],"mappings":"AAMA,oBAAY,oBAAoB;IAE5B,WAAW,gBAAgB;IAG3B,MAAM,WAAW;CACpB"}
@@ -0,0 +1,12 @@
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
+ /**
4
+ * Which level defined a navigation item.
5
+ */ var NavigationItemOrigin = /*#__PURE__*/ function(NavigationItemOrigin) {
6
+ /** The application defined the item. */ NavigationItemOrigin["Application"] = "application";
7
+ /** A module defined the item. */ NavigationItemOrigin["Module"] = "module";
8
+ return NavigationItemOrigin;
9
+ }({});
10
+
11
+ export { NavigationItemOrigin };
12
+ //# sourceMappingURL=NavigationItemOrigin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationItemOrigin.js","sources":["../../../navigation/NavigationItemOrigin.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\n/**\n * Which level defined a navigation item.\n */\nexport enum NavigationItemOrigin {\n /** The application defined the item. */\n Application = 'application',\n\n /** A module defined the item. */\n Module = 'module',\n}\n"],"names":["NavigationItemOrigin"],"mappings":"AAAA;AACA;AAEA;;IAGO,IAAKA,oBAAAA,iBAAAA,SAAAA,oBAAAA,EAAAA;6CAC8B,oBAAA,CAAA,aAAA,CAAA,GAAA,aAAA;sCAGP,oBAAA,CAAA,QAAA,CAAA,GAAA,QAAA;AAJvBA,IAAAA,OAAAA,oBAAAA;AAMX,CAAA,CAAA,EAAA;;"}
@@ -0,0 +1,6 @@
1
+ import { NavigationSourcesKind } from './NavigationSourcesKind';
2
+ export interface NavigationSources {
3
+ kind: NavigationSourcesKind;
4
+ label: string;
5
+ }
6
+ //# sourceMappingURL=NavigationSources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationSources.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationSources.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,MAAM,WAAW,iBAAiB;IAE9B,IAAI,EAAE,qBAAqB,CAAC;IAG5B,KAAK,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NavigationSources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationSources.js","sourceRoot":"","sources":["../../../navigation/NavigationSources.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare enum NavigationSourcesKind {
2
+ DefinedHere = "definedHere",
3
+ Inherited = "inherited",
4
+ Extended = "extended",
5
+ Overridden = "overridden"
6
+ }
7
+ //# sourceMappingURL=NavigationSourcesKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationSourcesKind.d.ts","sourceRoot":"","sources":["../../../navigation/NavigationSourcesKind.ts"],"names":[],"mappings":"AAMA,oBAAY,qBAAqB;IAE7B,WAAW,gBAAgB;IAG3B,SAAS,cAAc;IAGvB,QAAQ,aAAa;IAGrB,UAAU,eAAe;CAC5B"}
@@ -0,0 +1,14 @@
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
+ /**
4
+ * How a region's effective items relate to the application's. The values are shared with the C# engine.
5
+ */ var NavigationSourcesKind = /*#__PURE__*/ function(NavigationSourcesKind) {
6
+ /** The application level: every region is defined here. */ NavigationSourcesKind["DefinedHere"] = "definedHere";
7
+ /** A module region that shows the application's items. */ NavigationSourcesKind["Inherited"] = "inherited";
8
+ /** A module region that shows the application's items and its own. */ NavigationSourcesKind["Extended"] = "extended";
9
+ /** A module region that shows its own items only. */ NavigationSourcesKind["Overridden"] = "overridden";
10
+ return NavigationSourcesKind;
11
+ }({});
12
+
13
+ export { NavigationSourcesKind };
14
+ //# sourceMappingURL=NavigationSourcesKind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationSourcesKind.js","sources":["../../../navigation/NavigationSourcesKind.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\n/**\n * How a region's effective items relate to the application's. The values are shared with the C# engine.\n */\nexport enum NavigationSourcesKind {\n /** The application level: every region is defined here. */\n DefinedHere = 'definedHere',\n\n /** A module region that shows the application's items. */\n Inherited = 'inherited',\n\n /** A module region that shows the application's items and its own. */\n Extended = 'extended',\n\n /** A module region that shows its own items only. */\n Overridden = 'overridden',\n}\n"],"names":["NavigationSourcesKind"],"mappings":"AAAA;AACA;AAEA;;IAGO,IAAKA,qBAAAA,iBAAAA,SAAAA,qBAAAA,EAAAA;gEACiD,qBAAA,CAAA,aAAA,CAAA,GAAA,aAAA;+DAGD,qBAAA,CAAA,WAAA,CAAA,GAAA,WAAA;2EAGY,qBAAA,CAAA,UAAA,CAAA,GAAA,UAAA;0DAGjB,qBAAA,CAAA,YAAA,CAAA,GAAA,YAAA;AAV3CA,IAAAA,OAAAA,qBAAAA;AAYX,CAAA,CAAA,EAAA;;"}
@@ -0,0 +1,6 @@
1
+ export interface ResolvedNavigationTarget {
2
+ module: string;
3
+ feature?: string;
4
+ resolvedFeature?: string;
5
+ }
6
+ //# sourceMappingURL=ResolvedNavigationTarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolvedNavigationTarget.d.ts","sourceRoot":"","sources":["../../../navigation/ResolvedNavigationTarget.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,wBAAwB;IAErC,MAAM,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,MAAM,CAAC;IAMjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ResolvedNavigationTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolvedNavigationTarget.js","sourceRoot":"","sources":["../../../navigation/ResolvedNavigationTarget.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"diagnoseNavigation.d.ts","sourceRoot":"","sources":["../../../navigation/diagnoseNavigation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAsC,MAAM,mBAAmB,CAAC;AAW3F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,GAAE,kBAAqC,GAAG,oBAAoB,EAAE,CA6ClI"}
1
+ {"version":3,"file":"diagnoseNavigation.d.ts","sourceRoot":"","sources":["../../../navigation/diagnoseNavigation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAsC,MAAM,mBAAmB,CAAC;AAY3F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,GAAE,kBAAqC,GAAG,oBAAoB,EAAE,CAiDlI"}
@@ -1,5 +1,6 @@
1
1
  import { DestinationKind } from '@cratis/scene.model';
2
2
  import { collectOutlets } from './collectOutlets.js';
3
+ import { diagnoseNavigationRegions } from './diagnoseNavigationRegions.js';
3
4
  import { findHostingCycles } from './findHostingCycles.js';
4
5
  import { NavigationDiagnosticCode } from './NavigationDiagnosticCode.js';
5
6
  import { authoredRouteKey, navigationTarget } from './navigationRoute.js';
@@ -12,7 +13,8 @@ import { authoredRouteKey, navigationTarget } from './navigationRoute.js';
12
13
  *
13
14
  * Routes are compared by `routeKey` - by default the authored route override, since the engine constructs no
14
15
  * URLs. Nothing is rewritten. The C# engine (`NavigationDiagnostics.Diagnose`) reports the same codes and
15
- * messages in the same order for the same model; both are asserted against `navigation-diagnostic-fixtures.json`.
16
+ * messages in the same order for the same model; both are asserted against `navigation-diagnostic-fixtures.json`. When the graph carries
17
+ an application `structure` and `navigation` regions, the regions are checked too ({@link diagnoseNavigationRegions}).
16
18
  */ function diagnoseNavigation(graph, routeKey = authoredRouteKey) {
17
19
  const diagnostics = [];
18
20
  const outlets = collectOutlets(graph, diagnostics);
@@ -69,6 +71,11 @@ import { authoredRouteKey, navigationTarget } from './navigationRoute.js';
69
71
  ].join(' -> ')}: each screen is placed in an outlet owned by the next, so composition never terminates.`
70
72
  });
71
73
  }
74
+ if (graph.structure && graph.navigation) {
75
+ diagnostics.push(...diagnoseNavigationRegions(graph.structure, graph.navigation, {
76
+ slots: graph.slots
77
+ }));
78
+ }
72
79
  return diagnostics;
73
80
  }
74
81
  function diagnoseTarget(graph, screens, destination, kind, entry, report) {
@@ -1 +1 @@
1
- {"version":3,"file":"diagnoseNavigation.js","sources":["../../../navigation/diagnoseNavigation.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 { DestinationKind, DestinationReference, Screen } from '@cratis/scene.model';\nimport { collectOutlets } from './collectOutlets';\nimport { findHostingCycles } from './findHostingCycles';\nimport { NavigationDiagnostic } from './NavigationDiagnostic';\nimport { NavigationDiagnosticCode } from './NavigationDiagnosticCode';\nimport { NavigationGraph } from './NavigationGraph';\nimport { NavigationRouteKey, authoredRouteKey, navigationTarget } from './navigationRoute';\nimport { OutletOwner } from './OutletOwner';\n\n/**\n * Diagnoses how destinations, outlets, routes and targets fit together: duplicate routes, duplicate,\n * missing or incompatible outlets, hosting cycles and unavailable targets.\n *\n * Routes are compared by `routeKey` - by default the authored route override, since the engine constructs no\n * URLs. Nothing is rewritten. The C# engine (`NavigationDiagnostics.Diagnose`) reports the same codes and\n * messages in the same order for the same model; both are asserted against `navigation-diagnostic-fixtures.json`.\n */\nexport function diagnoseNavigation(graph: NavigationGraph, routeKey: NavigationRouteKey = authoredRouteKey): NavigationDiagnostic[] {\n const diagnostics: NavigationDiagnostic[] = [];\n const outlets = collectOutlets(graph, diagnostics);\n const screens = graph.screens ? new Map(graph.screens.map(screen => [screen.name, screen])) : undefined;\n const routes = new Map<string, { entry: string; target: string }>();\n const hostedIn = new Map<string, string[]>();\n\n graph.entries.forEach((navigationEntry, index) => {\n const entry = navigationEntry.id ?? `#${index + 1}`;\n const destination = navigationEntry.destination;\n const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);\n const report = (code: NavigationDiagnosticCode, message: string) => diagnostics.push({ code, message, entry });\n\n if (!destination.screen && !destination.module && !destination.route && !destination.dialog) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' names no screen, stable identity, route or dialog.`);\n return;\n }\n\n diagnoseTarget(graph, screens, destination, kind, entry, report);\n const owner = diagnoseOutlet(graph, outlets, screens, destination, kind, entry, report);\n if (owner?.ownerKind === 'ScreenTemplate' && destination.screen && screens?.has(destination.screen)) {\n const hosts = graph.screens!.filter(screen => screen.screenTemplate === owner.owner).map(screen => screen.name);\n hostedIn.set(destination.screen, [...new Set([...(hostedIn.get(destination.screen) ?? []), ...hosts])]);\n }\n\n const route = kind === DestinationKind.External ? undefined : routeKey(destination);\n if (route) {\n const target = navigationTarget(destination, kind);\n const existing = routes.get(route);\n if (!existing) {\n routes.set(route, { entry, target });\n } else if (existing.target !== target) {\n report(NavigationDiagnosticCode.DuplicateRoute, `Route '${destination.route ?? route}' is used by destinations '${existing.entry}' and '${entry}', which open different targets.`);\n }\n }\n });\n\n for (const cycle of findHostingCycles(graph.screens?.map(screen => screen.name) ?? [], hostedIn)) {\n diagnostics.push({\n code: NavigationDiagnosticCode.NavigationCycle,\n message: `Navigation cycle ${[...cycle, cycle[0]].join(' -> ')}: each screen is placed in an outlet owned by the next, so composition never terminates.`,\n });\n }\n\n return diagnostics;\n}\n\ntype Report = (code: NavigationDiagnosticCode, message: string) => void;\n\nfunction diagnoseTarget(\n graph: NavigationGraph,\n screens: Map<string, Screen> | undefined,\n destination: DestinationReference,\n kind: DestinationKind,\n entry: string,\n report: Report,\n) {\n if (kind === DestinationKind.Dialog) {\n if (!destination.dialog) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Dialog destination '${entry}' names no dialog.`);\n } else if (graph.dialogTemplates && !graph.dialogTemplates.some(template => template.name === destination.dialog)) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens dialog '${destination.dialog}', which no dialog template provides.`);\n }\n return;\n }\n\n if (kind === DestinationKind.Outlet && destination.screen && screens && !screens.has(destination.screen)) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens screen '${destination.screen}', which does not exist.`);\n }\n}\n\nfunction diagnoseOutlet(\n graph: NavigationGraph,\n outlets: Map<string, OutletOwner>,\n screens: Map<string, Screen> | undefined,\n destination: DestinationReference,\n kind: DestinationKind,\n entry: string,\n report: Report,\n): OutletOwner | undefined {\n if (!destination.outlet) return undefined;\n\n if (kind !== DestinationKind.Outlet) {\n const opens = kind === DestinationKind.Dialog ? 'a dialog' : 'an external target';\n report(NavigationDiagnosticCode.IncompatibleOutlet, `Destination '${entry}' opens ${opens} but names outlet '${destination.outlet}'; only outlet destinations render in outlets.`);\n return undefined;\n }\n\n const owner = outlets.get(destination.outlet);\n if (!owner) {\n report(NavigationDiagnosticCode.MissingOutlet, `Destination '${entry}' targets missing outlet '${destination.outlet}'.`);\n return undefined;\n }\n\n const screen = destination.screen ? screens?.get(destination.screen) : undefined;\n if (!screen) return owner;\n\n if (owner.ownerKind === 'Layout' && screen.layout !== owner.owner) {\n report(\n NavigationDiagnosticCode.IncompatibleOutlet,\n `Outlet '${owner.outlet.name}' belongs to layout '${owner.owner}', but destination '${entry}' places '${screen.name}', which renders in layout '${screen.layout}'.`,\n );\n }\n\n if (owner.outlet.accepts) {\n const type = graph.screenTemplates?.find(template => template.name === screen.screenTemplate)?.metadata?.type;\n if (!type || !owner.outlet.accepts.includes(type)) {\n report(\n NavigationDiagnosticCode.IncompatibleOutlet,\n `Outlet '${owner.outlet.name}' accepts ${owner.outlet.accepts.join(', ')} screens, but destination '${entry}' places '${screen.name}' of type '${type ?? 'untyped'}'.`,\n );\n }\n }\n\n return owner;\n}\n"],"names":["diagnoseNavigation","graph","routeKey","authoredRouteKey","diagnostics","outlets","collectOutlets","screens","Map","map","screen","name","undefined","routes","hostedIn","entries","forEach","navigationEntry","index","entry","id","destination","kind","dialog","DestinationKind","Dialog","Outlet","report","code","message","push","module","route","NavigationDiagnosticCode","UnavailableTarget","diagnoseTarget","owner","diagnoseOutlet","ownerKind","has","hosts","filter","screenTemplate","set","Set","get","External","target","navigationTarget","existing","DuplicateRoute","cycle","findHostingCycles","NavigationCycle","join","dialogTemplates","some","template","outlet","opens","IncompatibleOutlet","MissingOutlet","layout","accepts","type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H,IAAAA;QACzG,IAAI,CAACA,IAAAA,IAAQ,CAAC5B,KAAAA,CAAMsB,MAAM,CAACK,OAAO,CAACK,QAAQ,CAACJ,IAAAA,CAAAA,EAAO;AAC/CrC,YAAAA,MAAAA,CACIM,wBAAAA,CAAyB2B,kBAAkB,EAC3C,CAAC,QAAQ,EAAExB,KAAAA,CAAMsB,MAAM,CAAC/C,IAAI,CAAC,UAAU,EAAEyB,KAAAA,CAAMsB,MAAM,CAACK,OAAO,CAACT,IAAI,CAAC,IAAA,CAAA,CAAM,2BAA2B,EAAEnC,MAAM,UAAU,EAAET,MAAAA,CAAOC,IAAI,CAAC,WAAW,EAAEqD,IAAAA,IAAQ,SAAA,CAAU,EAAE,CAAC,CAAA;AAE9K,QAAA;AACJ,IAAA;IAEA,OAAO5B,KAAAA;AACX;;"}
1
+ {"version":3,"file":"diagnoseNavigation.js","sources":["../../../navigation/diagnoseNavigation.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 { DestinationKind, DestinationReference, Screen } from '@cratis/scene.model';\nimport { collectOutlets } from './collectOutlets';\nimport { diagnoseNavigationRegions } from './diagnoseNavigationRegions';\nimport { findHostingCycles } from './findHostingCycles';\nimport { NavigationDiagnostic } from './NavigationDiagnostic';\nimport { NavigationDiagnosticCode } from './NavigationDiagnosticCode';\nimport { NavigationGraph } from './NavigationGraph';\nimport { NavigationRouteKey, authoredRouteKey, navigationTarget } from './navigationRoute';\nimport { OutletOwner } from './OutletOwner';\n\n/**\n * Diagnoses how destinations, outlets, routes and targets fit together: duplicate routes, duplicate,\n * missing or incompatible outlets, hosting cycles and unavailable targets.\n *\n * Routes are compared by `routeKey` - by default the authored route override, since the engine constructs no\n * URLs. Nothing is rewritten. The C# engine (`NavigationDiagnostics.Diagnose`) reports the same codes and\n * messages in the same order for the same model; both are asserted against `navigation-diagnostic-fixtures.json`. When the graph carries\nan application `structure` and `navigation` regions, the regions are checked too ({@link diagnoseNavigationRegions}).\n */\nexport function diagnoseNavigation(graph: NavigationGraph, routeKey: NavigationRouteKey = authoredRouteKey): NavigationDiagnostic[] {\n const diagnostics: NavigationDiagnostic[] = [];\n const outlets = collectOutlets(graph, diagnostics);\n const screens = graph.screens ? new Map(graph.screens.map(screen => [screen.name, screen])) : undefined;\n const routes = new Map<string, { entry: string; target: string }>();\n const hostedIn = new Map<string, string[]>();\n\n graph.entries.forEach((navigationEntry, index) => {\n const entry = navigationEntry.id ?? `#${index + 1}`;\n const destination = navigationEntry.destination;\n const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);\n const report = (code: NavigationDiagnosticCode, message: string) => diagnostics.push({ code, message, entry });\n\n if (!destination.screen && !destination.module && !destination.route && !destination.dialog) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' names no screen, stable identity, route or dialog.`);\n return;\n }\n\n diagnoseTarget(graph, screens, destination, kind, entry, report);\n const owner = diagnoseOutlet(graph, outlets, screens, destination, kind, entry, report);\n if (owner?.ownerKind === 'ScreenTemplate' && destination.screen && screens?.has(destination.screen)) {\n const hosts = graph.screens!.filter(screen => screen.screenTemplate === owner.owner).map(screen => screen.name);\n hostedIn.set(destination.screen, [...new Set([...(hostedIn.get(destination.screen) ?? []), ...hosts])]);\n }\n\n const route = kind === DestinationKind.External ? undefined : routeKey(destination);\n if (route) {\n const target = navigationTarget(destination, kind);\n const existing = routes.get(route);\n if (!existing) {\n routes.set(route, { entry, target });\n } else if (existing.target !== target) {\n report(NavigationDiagnosticCode.DuplicateRoute, `Route '${destination.route ?? route}' is used by destinations '${existing.entry}' and '${entry}', which open different targets.`);\n }\n }\n });\n\n for (const cycle of findHostingCycles(graph.screens?.map(screen => screen.name) ?? [], hostedIn)) {\n diagnostics.push({\n code: NavigationDiagnosticCode.NavigationCycle,\n message: `Navigation cycle ${[...cycle, cycle[0]].join(' -> ')}: each screen is placed in an outlet owned by the next, so composition never terminates.`,\n });\n }\n\n if (graph.structure && graph.navigation) {\n diagnostics.push(...diagnoseNavigationRegions(graph.structure, graph.navigation, { slots: graph.slots }));\n }\n\n return diagnostics;\n}\n\ntype Report = (code: NavigationDiagnosticCode, message: string) => void;\n\nfunction diagnoseTarget(\n graph: NavigationGraph,\n screens: Map<string, Screen> | undefined,\n destination: DestinationReference,\n kind: DestinationKind,\n entry: string,\n report: Report,\n) {\n if (kind === DestinationKind.Dialog) {\n if (!destination.dialog) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Dialog destination '${entry}' names no dialog.`);\n } else if (graph.dialogTemplates && !graph.dialogTemplates.some(template => template.name === destination.dialog)) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens dialog '${destination.dialog}', which no dialog template provides.`);\n }\n return;\n }\n\n if (kind === DestinationKind.Outlet && destination.screen && screens && !screens.has(destination.screen)) {\n report(NavigationDiagnosticCode.UnavailableTarget, `Destination '${entry}' opens screen '${destination.screen}', which does not exist.`);\n }\n}\n\nfunction diagnoseOutlet(\n graph: NavigationGraph,\n outlets: Map<string, OutletOwner>,\n screens: Map<string, Screen> | undefined,\n destination: DestinationReference,\n kind: DestinationKind,\n entry: string,\n report: Report,\n): OutletOwner | undefined {\n if (!destination.outlet) return undefined;\n\n if (kind !== DestinationKind.Outlet) {\n const opens = kind === DestinationKind.Dialog ? 'a dialog' : 'an external target';\n report(NavigationDiagnosticCode.IncompatibleOutlet, `Destination '${entry}' opens ${opens} but names outlet '${destination.outlet}'; only outlet destinations render in outlets.`);\n return undefined;\n }\n\n const owner = outlets.get(destination.outlet);\n if (!owner) {\n report(NavigationDiagnosticCode.MissingOutlet, `Destination '${entry}' targets missing outlet '${destination.outlet}'.`);\n return undefined;\n }\n\n const screen = destination.screen ? screens?.get(destination.screen) : undefined;\n if (!screen) return owner;\n\n if (owner.ownerKind === 'Layout' && screen.layout !== owner.owner) {\n report(\n NavigationDiagnosticCode.IncompatibleOutlet,\n `Outlet '${owner.outlet.name}' belongs to layout '${owner.owner}', but destination '${entry}' places '${screen.name}', which renders in layout '${screen.layout}'.`,\n );\n }\n\n if (owner.outlet.accepts) {\n const type = graph.screenTemplates?.find(template => template.name === screen.screenTemplate)?.metadata?.type;\n if (!type || !owner.outlet.accepts.includes(type)) {\n report(\n NavigationDiagnosticCode.IncompatibleOutlet,\n `Outlet '${owner.outlet.name}' accepts ${owner.outlet.accepts.join(', ')} screens, but destination '${entry}' places '${screen.name}' of type '${type ?? 'untyped'}'.`,\n );\n }\n }\n\n return owner;\n}\n"],"names":["diagnoseNavigation","graph","routeKey","authoredRouteKey","diagnostics","outlets","collectOutlets","screens","Map","map","screen","name","undefined","routes","hostedIn","entries","forEach","navigationEntry","index","entry","id","destination","kind","dialog","DestinationKind","Dialog","Outlet","report","code","message","push","module","route","NavigationDiagnosticCode","UnavailableTarget","diagnoseTarget","owner","diagnoseOutlet","ownerKind","has","hosts","filter","screenTemplate","set","Set","get","External","target","navigationTarget","existing","DuplicateRoute","cycle","findHostingCycles","NavigationCycle","join","structure","navigation","diagnoseNavigationRegions","slots","dialogTemplates","some","template","outlet","opens","IncompatibleOutlet","MissingOutlet","layout","accepts","type","screenTemplates","find","metadata","includes"],"mappings":";;;;;;;AAAA;AACA;AAYA;;;;;;;;AAQC,IACM,SAASA,kBAAAA,CAAmBC,KAAsB,EAAEC,WAA+BC,gBAAgB,EAAA;AACtG,IAAA,MAAMC,cAAsC,EAAE;IAC9C,MAAMC,OAAAA,GAAUC,eAAeL,KAAAA,EAAOG,WAAAA,CAAAA;AACtC,IAAA,MAAMG,OAAAA,GAAUN,KAAAA,CAAMM,OAAO,GAAG,IAAIC,GAAAA,CAAIP,KAAAA,CAAMM,OAAO,CAACE,GAAG,CAACC,CAAAA,MAAAA,GAAU;AAACA,YAAAA,MAAAA,CAAOC,IAAI;AAAED,YAAAA;SAAO,CAAA,CAAA,GAAKE,SAAAA;AAC9F,IAAA,MAAMC,SAAS,IAAIL,GAAAA,EAAAA;AACnB,IAAA,MAAMM,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C,UAAU,EAAEyB,KAAAA,CAAM0B,MAAM,CAACK,OAAO,CAACb,IAAI,CAAC,IAAA,CAAA,CAAM,2BAA2B,EAAEnC,MAAM,UAAU,EAAET,MAAAA,CAAOC,IAAI,CAAC,WAAW,EAAEyD,IAAAA,IAAQ,SAAA,CAAU,EAAE,CAAC,CAAA;AAE9K,QAAA;AACJ,IAAA;IAEA,OAAOhC,KAAAA;AACX;;"}
@@ -0,0 +1,8 @@
1
+ import { ApplicationStructure, NavigationModel } from '@cratis/scene.model';
2
+ import { ApplicationStructureIndex } from '../structure';
3
+ import { NavigationDiagnostic } from './NavigationDiagnostic';
4
+ export interface NavigationRegionDiagnosticOptions {
5
+ slots?: string[];
6
+ }
7
+ export declare function diagnoseNavigationRegions(structure: ApplicationStructure | ApplicationStructureIndex, navigation: NavigationModel, options?: NavigationRegionDiagnosticOptions): NavigationDiagnostic[];
8
+ //# sourceMappingURL=diagnoseNavigationRegions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnoseNavigationRegions.d.ts","sourceRoot":"","sources":["../../../navigation/diagnoseNavigationRegions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAyE,MAAM,qBAAqB,CAAC;AACnJ,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9D,MAAM,WAAW,iCAAiC;IAE9C,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAgBD,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,oBAAoB,GAAG,yBAAyB,EAC3D,UAAU,EAAE,eAAe,EAC3B,OAAO,GAAE,iCAAsC,GAChD,oBAAoB,EAAE,CAqBxB"}
@@ -0,0 +1,97 @@
1
+ import { NavigationRegionMode, NavigationRegionKind } from '@cratis/scene.model';
2
+ import { ApplicationStructureIndex } from '../structure/ApplicationStructureIndex.js';
3
+ import { NavigationDiagnosticCode } from './NavigationDiagnosticCode.js';
4
+ import { primarySlot, navigationRegionOrder, findNavigationRegion, collectItemIds, applicationItems } from './navigationRegions.js';
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /**
9
+ * Diagnoses the navigation regions of an application against its structure: duplicate item ids, targets that are
10
+ * missing, out of scope or lead nowhere, and slots the layout does not declare. The application is checked first,
11
+ * then each module in the order they are declared; within a level the topbar comes before the sidebar and items are
12
+ * visited depth first.
13
+ *
14
+ * The C# engine (`NavigationRegionDiagnostics`) reports the same codes and messages in the same order; both are
15
+ * asserted against `navigation-inheritance-fixtures.json`, `navigation-targets-fixtures.json` and
16
+ * `navigation-diagnostic-fixtures.json`.
17
+ *
18
+ * @param structure The modules, features and slices of the application.
19
+ * @param navigation The application and module regions.
20
+ * @param options The slots items may render into.
21
+ */ function diagnoseNavigationRegions(structure, navigation, options = {}) {
22
+ const index = structure instanceof ApplicationStructureIndex ? structure : new ApplicationStructureIndex(structure);
23
+ const slots = options.slots ?? [
24
+ primarySlot
25
+ ];
26
+ const diagnostics = [];
27
+ for (const region of navigationRegionOrder){
28
+ const defined = findNavigationRegion(navigation.application.regions, region);
29
+ if (defined) checkRegion(index, slots, diagnostics, undefined, defined, []);
30
+ }
31
+ for (const moduleNavigation of navigation.modules){
32
+ for (const region of navigationRegionOrder){
33
+ const defined = findNavigationRegion(moduleNavigation.regions, region);
34
+ if (!defined) continue;
35
+ const inherited = defined.mode === NavigationRegionMode.Extend ? collectItemIds(applicationItems(navigation.application, region), region) : [];
36
+ checkRegion(index, slots, diagnostics, moduleNavigation.module, defined, inherited);
37
+ }
38
+ }
39
+ return diagnostics;
40
+ }
41
+ function checkRegion(index, slots, diagnostics, owner, defined, applicationIds) {
42
+ const scope = owner === undefined ? 'the application' : `module '${owner}'`;
43
+ const seen = new Set();
44
+ const visit = (items)=>{
45
+ for (const item of items){
46
+ const entry = `${owner ?? 'application'}:${defined.region}:${item.id}`;
47
+ const report = (code, message)=>{
48
+ diagnostics.push({
49
+ code,
50
+ message,
51
+ entry
52
+ });
53
+ };
54
+ if (seen.has(item.id)) {
55
+ report(NavigationDiagnosticCode.NavDuplicateId, `Navigation item '${item.id}' is used more than once in ${scope} ${defined.region}.`);
56
+ } else if (applicationIds.includes(item.id)) {
57
+ report(NavigationDiagnosticCode.NavDuplicateId, `Navigation item '${item.id}' in ${scope} ${defined.region} is also used by an application item, and the region extends the application.`);
58
+ }
59
+ seen.add(item.id);
60
+ checkTarget(index, owner, item, report);
61
+ const slot = item.slot ?? primarySlot;
62
+ if (!slots.includes(slot)) {
63
+ report(NavigationDiagnosticCode.NavSlotUnknown, `Navigation item '${item.id}' renders into slot '${slot}', which the layout does not declare.`);
64
+ }
65
+ if (defined.region === NavigationRegionKind.Sidebar && item.children) visit(item.children);
66
+ }
67
+ };
68
+ visit(defined.items);
69
+ }
70
+ function checkTarget(index, owner, item, report) {
71
+ const module = item.target?.module;
72
+ const hasChildren = (item.children?.length ?? 0) > 0;
73
+ if (!module) {
74
+ // A sidebar item that only groups sub-items needs no target of its own.
75
+ if (!hasChildren) report(NavigationDiagnosticCode.NavTargetMissing, `Navigation item '${item.id}' has no target.`);
76
+ return;
77
+ }
78
+ if (!index.findModule(module)) {
79
+ report(NavigationDiagnosticCode.NavTargetMissing, `Navigation item '${item.id}' targets module '${module}', which does not exist.`);
80
+ return;
81
+ }
82
+ if (owner !== undefined && module !== owner) {
83
+ report(NavigationDiagnosticCode.NavTargetOutOfScope, `Navigation item '${item.id}' of module '${owner}' targets module '${module}'; a module's own items may only target that module.`);
84
+ return;
85
+ }
86
+ const feature = item.target?.feature;
87
+ if (feature) {
88
+ if (!index.findFeature(`${module}.${feature}`)) {
89
+ report(NavigationDiagnosticCode.NavTargetMissing, `Navigation item '${item.id}' targets feature '${module}.${feature}', which does not exist.`);
90
+ }
91
+ } else if (!index.firstFeature(module)) {
92
+ report(NavigationDiagnosticCode.NavModuleWithoutFeatures, `Navigation item '${item.id}' targets module '${module}', which has no features to go to.`);
93
+ }
94
+ }
95
+
96
+ export { diagnoseNavigationRegions };
97
+ //# sourceMappingURL=diagnoseNavigationRegions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnoseNavigationRegions.js","sources":["../../../navigation/diagnoseNavigationRegions.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 { ApplicationStructure, NavigationModel, NavigationRegion, NavigationRegionKind, NavigationRegionMode, NavItem } from '@cratis/scene.model';\nimport { ApplicationStructureIndex } from '../structure';\nimport { NavigationDiagnostic } from './NavigationDiagnostic';\nimport { NavigationDiagnosticCode } from './NavigationDiagnosticCode';\nimport { applicationItems, collectItemIds, findNavigationRegion, navigationRegionOrder, primarySlot } from './navigationRegions';\n\n/** What the region diagnostics are checked against. */\nexport interface NavigationRegionDiagnosticOptions {\n /** The rendering slots items may render into; `content` only when absent. */\n slots?: string[];\n}\n\n/**\n * Diagnoses the navigation regions of an application against its structure: duplicate item ids, targets that are\n * missing, out of scope or lead nowhere, and slots the layout does not declare. The application is checked first,\n * then each module in the order they are declared; within a level the topbar comes before the sidebar and items are\n * visited depth first.\n *\n * The C# engine (`NavigationRegionDiagnostics`) reports the same codes and messages in the same order; both are\n * asserted against `navigation-inheritance-fixtures.json`, `navigation-targets-fixtures.json` and\n * `navigation-diagnostic-fixtures.json`.\n *\n * @param structure The modules, features and slices of the application.\n * @param navigation The application and module regions.\n * @param options The slots items may render into.\n */\nexport function diagnoseNavigationRegions(\n structure: ApplicationStructure | ApplicationStructureIndex,\n navigation: NavigationModel,\n options: NavigationRegionDiagnosticOptions = {},\n): NavigationDiagnostic[] {\n const index = structure instanceof ApplicationStructureIndex ? structure : new ApplicationStructureIndex(structure);\n const slots = options.slots ?? [primarySlot];\n const diagnostics: NavigationDiagnostic[] = [];\n\n for (const region of navigationRegionOrder) {\n const defined = findNavigationRegion(navigation.application.regions, region);\n if (defined) checkRegion(index, slots, diagnostics, undefined, defined, []);\n }\n\n for (const moduleNavigation of navigation.modules) {\n for (const region of navigationRegionOrder) {\n const defined = findNavigationRegion(moduleNavigation.regions, region);\n if (!defined) continue;\n\n const inherited = defined.mode === NavigationRegionMode.Extend ? collectItemIds(applicationItems(navigation.application, region), region) : [];\n checkRegion(index, slots, diagnostics, moduleNavigation.module, defined, inherited);\n }\n }\n\n return diagnostics;\n}\n\nfunction checkRegion(\n index: ApplicationStructureIndex,\n slots: string[],\n diagnostics: NavigationDiagnostic[],\n owner: string | undefined,\n defined: NavigationRegion,\n applicationIds: string[],\n): void {\n const scope = owner === undefined ? 'the application' : `module '${owner}'`;\n const seen = new Set<string>();\n\n const visit = (items: NavItem[]): void => {\n for (const item of items) {\n const entry = `${owner ?? 'application'}:${defined.region}:${item.id}`;\n const report = (code: NavigationDiagnosticCode, message: string): void => { diagnostics.push({ code, message, entry }); };\n\n if (seen.has(item.id)) {\n report(NavigationDiagnosticCode.NavDuplicateId, `Navigation item '${item.id}' is used more than once in ${scope} ${defined.region}.`);\n } else if (applicationIds.includes(item.id)) {\n report(NavigationDiagnosticCode.NavDuplicateId, `Navigation item '${item.id}' in ${scope} ${defined.region} is also used by an application item, and the region extends the application.`);\n }\n seen.add(item.id);\n\n checkTarget(index, owner, item, report);\n\n const slot = item.slot ?? primarySlot;\n if (!slots.includes(slot)) {\n report(NavigationDiagnosticCode.NavSlotUnknown, `Navigation item '${item.id}' renders into slot '${slot}', which the layout does not declare.`);\n }\n\n if (defined.region === NavigationRegionKind.Sidebar && item.children) visit(item.children);\n }\n };\n\n visit(defined.items);\n}\n\nfunction checkTarget(index: ApplicationStructureIndex, owner: string | undefined, item: NavItem, report: (code: NavigationDiagnosticCode, message: string) => void): void {\n const module = item.target?.module;\n const hasChildren = (item.children?.length ?? 0) > 0;\n\n if (!module) {\n // A sidebar item that only groups sub-items needs no target of its own.\n if (!hasChildren) report(NavigationDiagnosticCode.NavTargetMissing, `Navigation item '${item.id}' has no target.`);\n return;\n }\n\n if (!index.findModule(module)) {\n report(NavigationDiagnosticCode.NavTargetMissing, `Navigation item '${item.id}' targets module '${module}', which does not exist.`);\n return;\n }\n\n if (owner !== undefined && module !== owner) {\n report(NavigationDiagnosticCode.NavTargetOutOfScope, `Navigation item '${item.id}' of module '${owner}' targets module '${module}'; a module's own items may only target that module.`);\n return;\n }\n\n const feature = item.target?.feature;\n if (feature) {\n if (!index.findFeature(`${module}.${feature}`)) {\n report(NavigationDiagnosticCode.NavTargetMissing, `Navigation item '${item.id}' targets feature '${module}.${feature}', which does not exist.`);\n }\n } else if (!index.firstFeature(module)) {\n report(NavigationDiagnosticCode.NavModuleWithoutFeatures, `Navigation item '${item.id}' targets module '${module}', which has no features to go to.`);\n }\n}\n"],"names":["diagnoseNavigationRegions","structure","navigation","options","index","ApplicationStructureIndex","slots","primarySlot","diagnostics","region","navigationRegionOrder","defined","findNavigationRegion","application","regions","checkRegion","undefined","moduleNavigation","modules","inherited","mode","NavigationRegionMode","Extend","collectItemIds","applicationItems","module","owner","applicationIds","scope","seen","Set","visit","items","item","entry","id","report","code","message","push","has","NavigationDiagnosticCode","NavDuplicateId","includes","add","checkTarget","slot","NavSlotUnknown","NavigationRegionKind","Sidebar","children","target","hasChildren","length","NavTargetMissing","findModule","NavTargetOutOfScope","feature","findFeature","firstFeature","NavModuleWithoutFeatures"],"mappings":";;;;;AAAA;AACA;AAcA;;;;;;;;;;;;;IAcO,SAASA,yBAAAA,CACZC,SAA2D,EAC3DC,UAA2B,EAC3BC,OAAAA,GAA6C,EAAE,EAAA;AAE/C,IAAA,MAAMC,KAAAA,GAAQH,SAAAA,YAAqBI,yBAAAA,GAA4BJ,SAAAA,GAAY,IAAII,yBAAAA,CAA0BJ,SAAAA,CAAAA;IACzG,MAAMK,KAAAA,GAAQH,OAAAA,CAAQG,KAAK,IAAI;AAACC,QAAAA;AAAY,KAAA;AAC5C,IAAA,MAAMC,cAAsC,EAAE;IAE9C,KAAK,M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