@processpuzzle/base-app 0.2.1 → 0.3.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.
@@ -1,1731 +1,1636 @@
1
- import { WIDGET_PLACEMENTS, WidgetPlacement, WIDGET_REGISTRY, WidgetInstance } from '@processpuzzle/widgets';
2
- export { WIDGET_PLACEMENTS, WidgetInstance } from '@processpuzzle/widgets';
3
- import { BaseEntityAttrDescriptor, FormControlType, FlexboxDescriptor, FlexDirection, BaseEntityDescriptor, toSelectables, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseEntityContainerStore, BaseEntityFacade, EmbeddedEntityFacade, translateLabel, EntityScreenResolver, entityScreenRoute, EntityLabelPipe, BaseUrlSegments, BaseEntityContainerComponent, BaseFormHostDirective, baseEntityRoutes } from '@processpuzzle/base-entity';
4
- import * as i0 from '@angular/core';
5
- import { Injectable, inject, input, computed, Component, viewChild, ViewChild } from '@angular/core';
6
- import { map, firstValueFrom } from 'rxjs';
7
- import { signalStoreFeature, type, withMethods, patchState, signalStore } from '@ngrx/signals';
8
- import { withDevtools } from '@angular-architects/ngrx-toolkit';
9
- import { httpErrorMessage } from '@processpuzzle/util';
10
- import { provideTranslocoScope, TranslocoService, TranslocoPipe } from '@jsverse/transloco';
11
- import { ActivatedRoute, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
12
- import * as i1 from '@angular/common';
13
- import { CommonModule, NgTemplateOutlet, NgComponentOutlet } from '@angular/common';
14
- import { MatButton } from '@angular/material/button';
15
- import { MatTooltip } from '@angular/material/tooltip';
16
- import { MatSidenav, MatSidenavContainer, MatSidenavContent } from '@angular/material/sidenav';
17
- import { MatNavList, MatListItem, MatListItemIcon, MatListItemTitle } from '@angular/material/list';
18
-
19
- /**
20
- * Frontend model of the `AppDefinition` schema of `base-app-api.yaml`. `theme` and `layout` are
21
- * flattened onto the entity by {@link AppDefinitionMapper} so that the generated form can offer a
22
- * typed control per field; the original objects are kept alongside, because a full replacement PUT
23
- * would otherwise drop the parts no control writes. `regions`, `routes` and `modules` stay nested and
24
- * are edited through the `EMBEDDED_COMPONENTS` controls of the `App Region` / `App Route` /
25
- * `App Module Mount` descriptors.
26
- *
27
- * A route's `target` is flattened the same way, for the same reason and by the same mapper. The
28
- * contract already keeps `RouteTarget` flat rather than a `oneOf` because the generic form cannot edit
29
- * a discriminated union of classes; a nested object it equally cannot reach, since an
30
- * `EMBEDDED_COMPONENTS` row is edited as the parsed JSON it arrived as and a descriptor addresses one
31
- * property, not a path. So {@link RouteDefinition} carries `kind` and the per-kind fields directly and
32
- * {@link AppDefinitionMapper} re-nests them on save.
33
- *
34
- * The nested definitions are classes rather than interfaces, because each is an embedded entity of
35
- * its own: `EmbeddedEntityFacade` mints the blank row an `Add` opens the child's form on, and that
36
- * needs a constructor. They stay plain data — the rows of a loaded aggregate are the parsed JSON,
37
- * never instances of these classes, so nothing may rely on `instanceof` or on a method.
38
- */
39
- const MATERIAL_THEMES = ['azure-blue', 'rose-red', 'magenta-violet', 'cyan-orange'];
40
- const COLOR_SCHEMES = ['light', 'dark', 'auto'];
41
- const LAYOUT_PRESETS = ['sidenav-left', 'sidenav-right', 'top-nav'];
42
- const SIDENAV_MODES = ['side', 'over', 'push'];
43
- /**
44
- * No `content`: once routes own the content area it *is* the router outlet, so a content region would
45
- * have no field of its own — `widgets` is header/footer-only and `navItems` sidenav-only. Its sizing
46
- * lives in {@link LayoutDefinition.contentMaxWidth}.
47
- */
48
- const REGION_TYPES = ['header', 'sidenav', 'footer'];
49
- /**
50
- * What a route renders. Uppercase because the contract's enum is — `RegionType` and the theme enums
51
- * are lowercase, and mixing the two up is a silent miss rather than a type error once a value reaches
52
- * JSON.
53
- */
54
- const ROUTE_TARGET_KINDS = ['WIDGETS', 'DOCUMENT', 'ENTITY'];
55
- const ENTITY_MODES = ['LIST', 'DETAILS'];
1
+ import { APPLICATION_CONTEXT, SidenavAutosizeDirective, THEME_COLOR_SCHEMES, THEME_PRESETS, ThemeService, WIDGET_PLACEMENTS, WidgetHostComponent, WidgetInstance, WidgetPlacement, createWidgetPropsAttrDescriptor } from "@processpuzzle/widgets";
2
+ import { BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityDescriptor, BaseEntityFacade, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseUrlSegments, EmbeddedEntityFacade, EntityLabelPipe, EntityScreenResolver, FlexDirection, FlexboxDescriptor, FormControlType, baseEntityRoutes, entityScreenRoute, toSelectables, translateLabel } from "@processpuzzle/base-entity";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, ElementRef, Injectable, ViewChild, computed, effect, inject, input, signal, viewChild } from "@angular/core";
5
+ import { firstValueFrom, map } from "rxjs";
6
+ import { patchState, signalStore, signalStoreFeature, type, withMethods } from "@ngrx/signals";
7
+ import { withDevtools } from "@angular-architects/ngrx-toolkit";
8
+ import { LayoutService, httpErrorMessage } from "@processpuzzle/util";
9
+ import { TranslocoPipe, TranslocoService, provideTranslocoScope } from "@jsverse/transloco";
10
+ import { ActivatedRoute, RouterLink, RouterLinkActive, RouterOutlet } from "@angular/router";
11
+ import { MatButton } from "@angular/material/button";
12
+ import { MatTooltip } from "@angular/material/tooltip";
13
+ import { Dialog } from "@angular/cdk/dialog";
14
+ import { OverlayContainer } from "@angular/cdk/overlay";
15
+ import { NgComponentOutlet, NgTemplateOutlet } from "@angular/common";
16
+ import { MatDialog } from "@angular/material/dialog";
17
+ import { MatSidenav, MatSidenavContainer, MatSidenavContent } from "@angular/material/sidenav";
18
+ import { MatListItem, MatListItemIcon, MatListItemTitle, MatNavList } from "@angular/material/list";
19
+ const MATERIAL_THEMES = THEME_PRESETS;
20
+ const COLOR_SCHEMES = THEME_COLOR_SCHEMES;
21
+ const LAYOUT_PRESETS = [
22
+ "sidenav-left",
23
+ "sidenav-right",
24
+ "top-nav"
25
+ ];
26
+ const SIDENAV_MODES = [
27
+ "side",
28
+ "over",
29
+ "push"
30
+ ];
31
+ const REGION_TYPES = [
32
+ "header",
33
+ "sidenav",
34
+ "footer"
35
+ ];
36
+ const ROUTE_TARGET_KINDS = [
37
+ "WIDGETS",
38
+ "DOCUMENT",
39
+ "ENTITY"
40
+ ];
41
+ const ENTITY_MODES = ["LIST", "DETAILS"];
56
42
  var AppDefinitionStatus;
57
- (function (AppDefinitionStatus) {
58
- AppDefinitionStatus["DRAFT"] = "DRAFT";
59
- AppDefinitionStatus["PUBLISHED"] = "PUBLISHED";
43
+ (function(AppDefinitionStatus) {
44
+ AppDefinitionStatus["DRAFT"] = "DRAFT";
45
+ AppDefinitionStatus["PUBLISHED"] = "PUBLISHED";
60
46
  })(AppDefinitionStatus || (AppDefinitionStatus = {}));
61
- class NavItem {
62
- id;
63
- label;
64
- translocoId;
65
- icon;
66
- /**
67
- * `RouteDefinition.path` of the route this entry navigates to, resolved by string. Absent on a group
68
- * node, which expands its {@link children} instead of navigating.
69
- *
70
- * A path naming no route is a validation *warning* server-side, not an error: it may name a route of
71
- * a module that has not been authored yet, and modules stay loosely coupled.
72
- */
73
- routePath;
74
- roles;
75
- children;
76
- constructor(init = {}) {
77
- this.id = init.id ?? '';
78
- this.label = init.label ?? '';
79
- this.translocoId = init.translocoId;
80
- this.icon = init.icon;
81
- this.routePath = init.routePath;
82
- this.roles = init.roles;
83
- this.children = init.children;
84
- }
85
- }
86
- class RegionDefinition {
87
- /**
88
- * Required by the contract, but undefined while a region is being created — the dropdown is declared
89
- * `required`, so the form is what enforces the contract before the row reaches the payload.
90
- */
91
- type;
92
- /** `sidenav` only; left undefined so a header region's payload carries no empty nav tree. */
93
- navItems;
94
- /** `header` / `footer` only. */
95
- widgets;
96
- constructor(init = {}) {
97
- this.type = init.type;
98
- this.navItems = init.navItems;
99
- this.widgets = init.widgets;
100
- }
101
- }
102
- /**
103
- * One navigable route. **Flat: a route has no children.** `path` may be multi-segment, so `claims`,
104
- * `claims/open` and `claims/:id` are three sibling entries rather than a tree — Angular's own nesting
105
- * is derived from those prefixes when the shell builds its `Routes`, because nesting is a rendering
106
- * concern rather than something worth authoring. Structure is broken up at the module boundary
107
- * instead, through {@link ModuleMount}.
108
- *
109
- * The `target` fields are flattened onto the row and re-nested by {@link AppDefinitionMapper}; which of
110
- * them are meaningful follows from {@link kind}, and the backend — not the form — is what enforces it.
111
- */
112
- class RouteDefinition {
113
- /** Relative to the app root, no leading slash. May contain `/` for depth and `:name` for a parameter. */
114
- path;
115
- title;
116
- translocoId;
117
- icon;
118
- /** Empty or absent means any authenticated member of the organization, as on {@link NavItem.roles}. */
119
- roles;
120
- // region flattened target — re-nested into `target` by AppDefinitionMapper
121
- /**
122
- * Required by the contract, but undefined while a route is being created — the dropdown is declared
123
- * `required`, so the form is what enforces it before the row reaches the payload.
124
- */
125
- kind;
126
- /** WIDGETS only. Starts as an empty array so the embedded list has something to append to. */
127
- widgets;
128
- documentSlug;
129
- entityName;
130
- entityMode;
131
- rsqlFilter;
132
- // endregion
133
- /** The object the flattened fields came from, preserved so a save cannot drop a future field. */
134
- target;
135
- constructor(init = {}) {
136
- this.path = init.path ?? '';
137
- this.title = init.title ?? '';
138
- this.translocoId = init.translocoId;
139
- this.icon = init.icon;
140
- this.roles = init.roles;
141
- this.kind = init.kind;
142
- this.widgets = init.widgets ?? [];
143
- this.documentSlug = init.documentSlug;
144
- this.entityName = init.entityName;
145
- this.entityMode = init.entityMode;
146
- this.rsqlFilter = init.rsqlFilter;
147
- this.target = init.target;
148
- }
149
- }
150
- /**
151
- * Mounts a module's routes under {@link basePath}. The one place route structure composes, and it
152
- * composes exactly one level deep: a module cannot mount modules.
153
- */
154
- class ModuleMount {
155
- /**
156
- * Key of a `ModuleDefinition` in this organization. One naming no existing module is a validation
157
- * warning, not an error — an app may mount a module before it has been authored.
158
- */
159
- moduleKey;
160
- basePath;
161
- constructor(init = {}) {
162
- this.moduleKey = init.moduleKey ?? '';
163
- this.basePath = init.basePath ?? '';
164
- }
165
- }
166
- class AppDefinition {
167
- /** Unique within the organization and used verbatim as the run-time route segment. */
168
- id;
169
- name;
170
- translocoId;
171
- description;
172
- // region flattened theme
173
- materialTheme;
174
- colorScheme;
175
- tokenOverrides;
176
- logoUrl;
177
- faviconUrl;
178
- // endregion
179
- // region flattened layout
180
- preset;
181
- sidenavMode;
182
- sidenavCollapsible;
183
- sidenavOpenByDefault;
184
- contentMaxWidth;
185
- // endregion
186
- /** The objects the flattened fields came from, preserved so a save cannot drop a future field. */
187
- theme;
188
- layout;
189
- regions;
190
- routes;
191
- modules;
192
- // region server-assigned
193
- orgKey;
194
- status;
195
- version;
196
- publishedVersion;
197
- createdAt;
198
- updatedAt;
199
- // endregion
200
- constructor(init = {}) {
201
- this.id = init.id ?? '';
202
- this.name = init.name ?? '';
203
- this.translocoId = init.translocoId;
204
- this.description = init.description;
205
- this.materialTheme = init.materialTheme;
206
- this.colorScheme = init.colorScheme;
207
- this.tokenOverrides = init.tokenOverrides;
208
- this.logoUrl = init.logoUrl;
209
- this.faviconUrl = init.faviconUrl;
210
- this.preset = init.preset;
211
- this.sidenavMode = init.sidenavMode;
212
- this.sidenavCollapsible = init.sidenavCollapsible ?? true;
213
- this.sidenavOpenByDefault = init.sidenavOpenByDefault ?? true;
214
- this.contentMaxWidth = init.contentMaxWidth;
215
- this.theme = init.theme;
216
- this.layout = init.layout;
217
- this.regions = init.regions;
218
- this.routes = init.routes;
219
- this.modules = init.modules;
220
- this.orgKey = init.orgKey;
221
- this.status = init.status;
222
- this.version = init.version;
223
- this.publishedVersion = init.publishedVersion;
224
- this.createdAt = init.createdAt;
225
- this.updatedAt = init.updatedAt;
226
- }
227
- }
228
-
229
- /**
230
- * Frontend model of the `ModuleDefinition` schema of `base-app-api.yaml`: a lazily-loadable slice of an
231
- * application, with its own flat route list and its own transloco scope. An {@link ModuleMount} of an
232
- * `AppDefinition` names one of these by key and mounts its routes under a base path.
233
- *
234
- * **What "lazy" honestly means.** A module lazy-loads *metadata* — this definition, its routes, its
235
- * translations, and the documents and descriptors they name. It does **not** lazy-load widget code:
236
- * widget components are bundled at compile time and resolved through the frontend registry, so a
237
- * metadata module cannot split a bundle on its own. The wins are that `AppDefinition` stops being one
238
- * aggregate that has to be loaded, locked and published atomically, and that a module is the unit of
239
- * authoring permission and versioning. Nothing here should be justified on bundle size.
240
- *
241
- * Unlike the region / route / mount classes this one is a **routable** entity: it has endpoints of its
242
- * own, so it comes with a service, a store and a facade rather than travelling inside another payload.
243
- */
244
- class ModuleDefinition {
245
- /**
246
- * The contract calls this field `key`; base-entity keys every store, URL and reference on `id`, so
247
- * {@link ModuleDefinitionMapper} renames it on the way in and out rather than teaching the framework a
248
- * second identity field. One name for one thing on this side of the mapper — a `key` property beside
249
- * `id` could only ever disagree with it.
250
- *
251
- * Immutable by contract: `ModuleMount.moduleKey` resolves against it, and a rename would silently
252
- * unmount the module from every app that mounts it.
253
- */
254
- id;
255
- name;
256
- translocoId;
257
- description;
258
- /**
259
- * Transloco scope the module's translations load under. Absent means {@link id}, which is the default
260
- * the contract states; {@link moduleTranslocoScope} is the one place that default is applied.
261
- */
262
- translocoScope;
263
- /**
264
- * The module's routes, flat and relative to the base path it is mounted at — the same shape and the
265
- * same derived nesting as `AppDefinition.routes`, and flattened by the same mapper. A module does not
266
- * mount modules: this is where composition stops.
267
- */
268
- routes;
269
- // region server-assigned
270
- orgKey;
271
- version;
272
- createdAt;
273
- updatedAt;
274
- // endregion
275
- constructor(init = {}) {
276
- this.id = init.id ?? '';
277
- this.name = init.name ?? '';
278
- this.translocoId = init.translocoId;
279
- this.description = init.description;
280
- this.translocoScope = init.translocoScope;
281
- this.routes = init.routes;
282
- this.orgKey = init.orgKey;
283
- this.version = init.version;
284
- this.createdAt = init.createdAt;
285
- this.updatedAt = init.updatedAt;
286
- }
287
- }
288
- /**
289
- * The scope a module's translations load under, applying the contract's default. Kept as a function
290
- * rather than resolved in the mapper, so a definition never carries a `translocoScope` the designer did
291
- * not author — the field stays empty in the form, and the fallback is a rendering decision.
292
- */
47
+ var NavItem = class {
48
+ id;
49
+ label;
50
+ translocoId;
51
+ icon;
52
+ routePath;
53
+ roles;
54
+ children;
55
+ constructor(init = {}) {
56
+ this.id = init.id ?? "";
57
+ this.label = init.label ?? "";
58
+ this.translocoId = init.translocoId;
59
+ this.icon = init.icon;
60
+ this.routePath = init.routePath;
61
+ this.roles = init.roles;
62
+ this.children = init.children;
63
+ }
64
+ };
65
+ var RegionDefinition = class {
66
+ type;
67
+ navItems;
68
+ widgets;
69
+ constructor(init = {}) {
70
+ this.type = init.type;
71
+ this.navItems = init.navItems;
72
+ this.widgets = init.widgets;
73
+ }
74
+ };
75
+ var RouteDefinition = class {
76
+ path;
77
+ title;
78
+ translocoId;
79
+ icon;
80
+ roles;
81
+ kind;
82
+ widgets;
83
+ documentSlug;
84
+ entityName;
85
+ entityMode;
86
+ rsqlFilter;
87
+ target;
88
+ constructor(init = {}) {
89
+ this.path = init.path ?? "";
90
+ this.title = init.title ?? "";
91
+ this.translocoId = init.translocoId;
92
+ this.icon = init.icon;
93
+ this.roles = init.roles;
94
+ this.kind = init.kind;
95
+ this.widgets = init.widgets ?? [];
96
+ this.documentSlug = init.documentSlug;
97
+ this.entityName = init.entityName;
98
+ this.entityMode = init.entityMode;
99
+ this.rsqlFilter = init.rsqlFilter;
100
+ this.target = init.target;
101
+ }
102
+ };
103
+ var ModuleMount = class {
104
+ moduleKey;
105
+ basePath;
106
+ constructor(init = {}) {
107
+ this.moduleKey = init.moduleKey ?? "";
108
+ this.basePath = init.basePath ?? "";
109
+ }
110
+ };
111
+ var AppDefinition = class {
112
+ id;
113
+ name;
114
+ translocoId;
115
+ description;
116
+ materialTheme;
117
+ colorScheme;
118
+ tokenOverrides;
119
+ logoUrl;
120
+ faviconUrl;
121
+ preset;
122
+ sidenavMode;
123
+ sidenavCollapsible;
124
+ sidenavOpenByDefault;
125
+ contentMaxWidth;
126
+ theme;
127
+ layout;
128
+ regions;
129
+ routes;
130
+ modules;
131
+ orgKey;
132
+ status;
133
+ version;
134
+ publishedVersion;
135
+ createdAt;
136
+ updatedAt;
137
+ constructor(init = {}) {
138
+ this.id = init.id ?? "";
139
+ this.name = init.name ?? "";
140
+ this.translocoId = init.translocoId;
141
+ this.description = init.description;
142
+ this.materialTheme = init.materialTheme;
143
+ this.colorScheme = init.colorScheme;
144
+ this.tokenOverrides = init.tokenOverrides;
145
+ this.logoUrl = init.logoUrl;
146
+ this.faviconUrl = init.faviconUrl;
147
+ this.preset = init.preset;
148
+ this.sidenavMode = init.sidenavMode;
149
+ this.sidenavCollapsible = init.sidenavCollapsible ?? true;
150
+ this.sidenavOpenByDefault = init.sidenavOpenByDefault ?? true;
151
+ this.contentMaxWidth = init.contentMaxWidth;
152
+ this.theme = init.theme;
153
+ this.layout = init.layout;
154
+ this.regions = init.regions;
155
+ this.routes = init.routes;
156
+ this.modules = init.modules;
157
+ this.orgKey = init.orgKey;
158
+ this.status = init.status;
159
+ this.version = init.version;
160
+ this.publishedVersion = init.publishedVersion;
161
+ this.createdAt = init.createdAt;
162
+ this.updatedAt = init.updatedAt;
163
+ }
164
+ };
165
+ var ModuleDefinition = class {
166
+ id;
167
+ name;
168
+ translocoId;
169
+ description;
170
+ translocoScope;
171
+ routes;
172
+ orgKey;
173
+ version;
174
+ createdAt;
175
+ updatedAt;
176
+ constructor(init = {}) {
177
+ this.id = init.id ?? "";
178
+ this.name = init.name ?? "";
179
+ this.translocoId = init.translocoId;
180
+ this.description = init.description;
181
+ this.translocoScope = init.translocoScope;
182
+ this.routes = init.routes;
183
+ this.orgKey = init.orgKey;
184
+ this.version = init.version;
185
+ this.createdAt = init.createdAt;
186
+ this.updatedAt = init.updatedAt;
187
+ }
188
+ };
293
189
  function moduleTranslocoScope(definition) {
294
- return definition.translocoScope?.trim() || definition.id;
190
+ return definition.translocoScope?.trim() || definition.id;
295
191
  }
296
-
297
- /**
298
- * Transloco scope of this library. The translations live in
299
- * `libs/js-shared/base-app-frontend/src/assets/i18n/base_app/*.json` and are published with the
300
- * package; a consuming application copies them to `assets/i18n/base_app` (see the testbed's
301
- * `project.json`). The scope is registered on {@link BASE_APP_ROUTES}, so it loads lazily with the
302
- * route rather than with the application shell.
303
- *
304
- * The alias is spelled out on purpose: transloco camel-cases the default alias, which would turn
305
- * `base_app` into `baseApp` and silently miss every key below.
306
- */
307
- const BASE_APP_TRANSLOCO_SCOPE = 'base_app';
308
- /**
309
- * Scope of the generic framework labels (`base_entity.tabs.*`, `base_entity.toolbar.*`), whose files
310
- * base-entity owns. It has to be registered next to {@link BASE_APP_TRANSLOCO_SCOPE} wherever the
311
- * generic screens are hosted: `BaseEntityTabsComponent` translates from it through `TranslocoPipe`,
312
- * which caches the value it resolved for a key on first render. If only `base_app` were loaded, the
313
- * tabs would keep the raw key even after the toolbar — which registers this scope for itself —
314
- * triggers the load.
315
- */
316
- const BASE_ENTITY_TRANSLOCO_SCOPE = 'base_entity';
317
- /** Key root of the `AppDefinition` entity name (`._self`) and of its attribute labels. */
192
+ const BASE_APP_TRANSLOCO_SCOPE = "base_app";
193
+ const BASE_ENTITY_TRANSLOCO_SCOPE = "base_entity";
318
194
  const APP_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_definition`;
319
- /**
320
- * Label of the Preview tab. Under this library's own scope rather than `base_entity.tabs.*`: the generic
321
- * tabs are List and Details, and an application preview is this feature's contribution, not the framework's.
322
- * Resolved with `{ entity }` like the generic tab labels, so a translation may name the entity if it reads
323
- * better that way.
324
- */
325
195
  const APP_PREVIEW_I18N_KEY = `${APP_DEFINITION_I18N_SCOPE}.tabs.preview`;
326
- /**
327
- * Key root of the `ModuleDefinition` entity name and attribute labels. A child of this library's scope
328
- * like the one above, and not to be confused with `ModuleDefinition.translocoScope`, which is a scope an
329
- * *authored* module's own translations load under — see {@link moduleTranslocoScope}. These keys are the
330
- * framework's labels for the authoring form; that one is the tenant's content.
331
- */
332
196
  const MODULE_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.module_definition`;
333
- /**
334
- * Key roots of the nested definitions the `AppDefinition` form contains through `EMBEDDED_COMPONENTS`
335
- * controls. They are children of {@link BASE_APP_TRANSLOCO_SCOPE} rather than scopes of their own,
336
- * because the whole graph is edited under `BASE_APP_ROUTES` and one scope registration has to cover
337
- * all of it — the embedded route branches add none.
338
- */
339
197
  const APP_REGION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_region`;
340
198
  const APP_ROUTE_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_route`;
341
199
  const APP_MODULE_MOUNT_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_module_mount`;
342
200
  const APP_NAV_ITEM_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_nav_item`;
343
201
  const APP_WIDGET_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_widget`;
344
- /** Keys of the `Publish` form action contributed by `AppDefinitionContainerComponent`. */
345
202
  const PUBLISH_BUTTON_I18N_KEY = `${BASE_APP_TRANSLOCO_SCOPE}.publish.button`;
346
203
  const PUBLISH_TOOLTIP_I18N_KEY = `${BASE_APP_TRANSLOCO_SCOPE}.publish.tooltip`;
347
- /**
348
- * Where this library's transloco bundles come from when the application ships without its assets.
349
- *
350
- * Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into
351
- * `BASE_ENTITY_FACADE_REGISTRY`. The scopes below normally arrive as static files — the build copies
352
- * them into `assets/i18n/<scope>` and the loader tries the asset first — so this is reached only by a
353
- * host that skips that copy step. It is declared here rather than in the application because which
354
- * backend owns a scope is base-app's knowledge, not its caller's.
355
- */
356
204
  const BASE_APP_TRANSLATION_SOURCE = {
357
- scopes: ['base_app'],
358
- serviceRootKey: 'APP_SERVICE_ROOT',
359
- segment: 'app',
205
+ scopes: ["base_app"],
206
+ serviceRootKey: "APP_SERVICE_ROOT",
207
+ segment: "app"
360
208
  };
361
-
362
- /**
363
- * Entity names of the app-definition graph, kept in one dependency-free module.
364
- *
365
- * They live here rather than next to their descriptors because the graph is cyclic: `App Definition`
366
- * aggregates `App Region`, and `App Region` names `App Definition` as its `componentParent`. Each
367
- * descriptor module re-exports its own name, so importers are unaffected.
368
- */
369
- const APP_DEFINITION_ENTITY_NAME = 'App Definition';
370
- /**
371
- * A second aggregate root beside `App Definition`, not a part of it — hence no `App` prefix, which in
372
- * every other name here marks something the app document carries. `App Module Mount` is the row inside
373
- * an app that *names* one of these.
374
- */
375
- const MODULE_DEFINITION_ENTITY_NAME = 'Module Definition';
376
- const APP_MODULE_MOUNT_ENTITY_NAME = 'App Module Mount';
377
- const APP_NAV_ITEM_ENTITY_NAME = 'App Nav Item';
378
- const APP_REGION_ENTITY_NAME = 'App Region';
379
- const APP_ROUTE_ENTITY_NAME = 'App Route';
380
- const APP_WIDGET_ENTITY_NAME = 'App Widget';
381
-
382
- /** `ModuleMount` has no `id` — an app mounts a given module once, so `moduleKey` identifies the row. */
383
- const APP_MODULE_MOUNT_ID_FIELD = 'moduleKey';
209
+ const APP_DEFINITION_ENTITY_NAME = "App Definition";
210
+ const MODULE_DEFINITION_ENTITY_NAME = "Module Definition";
211
+ const APP_MODULE_MOUNT_ENTITY_NAME = "App Module Mount";
212
+ const APP_NAV_ITEM_ENTITY_NAME = "App Nav Item";
213
+ const APP_REGION_ENTITY_NAME = "App Region";
214
+ const APP_ROUTE_ENTITY_NAME = "App Route";
215
+ const APP_WIDGET_ENTITY_NAME = "App Widget";
216
+ const APP_MODULE_MOUNT_ID_FIELD = "moduleKey";
384
217
  function createModuleMountAttrDescriptors() {
385
- // A plain text box rather than a FOREIGN_KEY onto the module list: modules stay loosely coupled, so a
386
- // key naming no existing module is a server-side warning rather than an error, and a dropdown of the
387
- // modules authored so far would turn that warning into something the form refuses to let happen.
388
- const moduleKeyAttr = new BaseEntityAttrDescriptor('moduleKey', FormControlType.TEXT_BOX, 'Module Key', undefined, true);
389
- moduleKeyAttr.required = true;
390
- moduleKeyAttr.isHeading = true;
391
- moduleKeyAttr.placeholder = 'Key of a module definition of this organization';
392
- // Both patterns are the contract's own. Declaring them here makes the form refuse what the backend
393
- // would refuse anyway, and puts them in the e2e registry, so generated fixtures produce dashed tokens
394
- // rather than prose the PUT answers with 400.
395
- moduleKeyAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';
396
- const basePathAttr = new BaseEntityAttrDescriptor('basePath', FormControlType.TEXT_BOX, 'Base Path');
397
- basePathAttr.required = true;
398
- basePathAttr.placeholder = 'The module routes are mounted under this prefix, e.g. claims';
399
- basePathAttr.pattern = '^[a-z0-9][a-z0-9\\-/]*$';
400
- const flexBoxContainer = new FlexboxDescriptor([moduleKeyAttr, basePathAttr], FlexDirection.ROW);
401
- flexBoxContainer.style = { 'column-gap': '10px', width: 'fit-content' };
402
- return [flexBoxContainer];
218
+ const moduleKeyAttr = new BaseEntityAttrDescriptor("moduleKey", FormControlType.TEXT_BOX, "Module Key", void 0, true);
219
+ moduleKeyAttr.required = true;
220
+ moduleKeyAttr.isHeading = true;
221
+ moduleKeyAttr.placeholder = "Key of a module definition of this organization";
222
+ moduleKeyAttr.pattern = "^[a-z0-9]+(-[a-z0-9]+)*$";
223
+ const basePathAttr = new BaseEntityAttrDescriptor("basePath", FormControlType.TEXT_BOX, "Base Path");
224
+ basePathAttr.required = true;
225
+ basePathAttr.placeholder = "The module routes are mounted under this prefix, e.g. claims";
226
+ basePathAttr.pattern = "^[a-z0-9][a-z0-9\\-/]*$";
227
+ const flexBoxContainer = new FlexboxDescriptor([moduleKeyAttr, basePathAttr], FlexDirection.ROW);
228
+ flexBoxContainer.style = {
229
+ "column-gap": "10px",
230
+ width: "fit-content"
231
+ };
232
+ return [flexBoxContainer];
403
233
  }
404
234
  function createModuleMountDescriptor() {
405
- return new BaseEntityDescriptor({
406
- entityName: APP_MODULE_MOUNT_ENTITY_NAME,
407
- attrDescriptors: createModuleMountAttrDescriptors(),
408
- i18nScope: APP_MODULE_MOUNT_I18N_SCOPE,
409
- componentParent: APP_DEFINITION_ENTITY_NAME,
410
- isEmbedded: true,
411
- });
412
- }
413
-
414
- /**
415
- * `RegionDefinition` has no `id` — a region is identified by the shell slot it fills, and an app
416
- * declares each slot at most once. Referencing attributes therefore have to set
417
- * `referenceIdField = 'type'`; see the `regions` attribute of the `AppDefinition` descriptor.
418
- */
419
- const APP_REGION_ID_FIELD = 'type';
235
+ return new BaseEntityDescriptor({
236
+ entityName: APP_MODULE_MOUNT_ENTITY_NAME,
237
+ attrDescriptors: createModuleMountAttrDescriptors(),
238
+ i18nScope: APP_MODULE_MOUNT_I18N_SCOPE,
239
+ componentParent: APP_DEFINITION_ENTITY_NAME,
240
+ isEmbedded: true
241
+ });
242
+ }
243
+ const APP_REGION_ID_FIELD = "type";
420
244
  function createRegionDefinitionAttrDescriptors() {
421
- const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.DROPDOWN, 'Type', toSelectables(REGION_TYPES), true);
422
- typeAttr.required = true;
423
- typeAttr.isHeading = true;
424
- // Per the contract, `navItems` applies to `sidenav` and `widgets` to `header` / `footer`; the
425
- // schema models them as optional siblings rather than a discriminated union, so both are offered
426
- // and it is the region's type that decides which one is meaningful. Both are contained: the rows
427
- // are nested arrays of this region, which is itself nested in the app definition's document.
428
- const navItemsAttr = new BaseEntityAttrDescriptor('navItems', FormControlType.EMBEDDED_COMPONENTS, 'Nav Items');
429
- navItemsAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;
430
- navItemsAttr.hideInTable = true;
431
- const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');
432
- widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;
433
- widgetsAttr.hideInTable = true;
434
- const flexBoxContainer = new FlexboxDescriptor([typeAttr, navItemsAttr, widgetsAttr], FlexDirection.COLUMN);
435
- flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
436
- return [flexBoxContainer];
245
+ const typeAttr = new BaseEntityAttrDescriptor("type", FormControlType.DROPDOWN, "Type", toSelectables(REGION_TYPES), true);
246
+ typeAttr.required = true;
247
+ typeAttr.isHeading = true;
248
+ const navItemsAttr = new BaseEntityAttrDescriptor("navItems", FormControlType.EMBEDDED_COMPONENTS, "Nav Items");
249
+ navItemsAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;
250
+ navItemsAttr.hideInTable = true;
251
+ const widgetsAttr = new BaseEntityAttrDescriptor("widgets", FormControlType.EMBEDDED_COMPONENTS, "Widgets");
252
+ widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;
253
+ widgetsAttr.hideInTable = true;
254
+ const flexBoxContainer = new FlexboxDescriptor([
255
+ typeAttr,
256
+ navItemsAttr,
257
+ widgetsAttr
258
+ ], FlexDirection.COLUMN);
259
+ flexBoxContainer.style = {
260
+ "row-gap": "5px",
261
+ width: "fit-content"
262
+ };
263
+ return [flexBoxContainer];
437
264
  }
438
265
  function createRegionDefinitionDescriptor() {
439
- return new BaseEntityDescriptor({
440
- entityName: APP_REGION_ENTITY_NAME,
441
- attrDescriptors: createRegionDefinitionAttrDescriptors(),
442
- i18nScope: APP_REGION_I18N_SCOPE,
443
- componentParent: APP_DEFINITION_ENTITY_NAME,
444
- isEmbedded: true,
445
- });
446
- }
447
-
448
- /**
449
- * `RouteDefinition` has no `id` — `path` identifies a route, and it is what a `NavItem.routePath`
450
- * resolves against. Referencing attributes therefore have to set `referenceIdField = 'path'`; see the
451
- * `routePath` attribute of the `App Nav Item` descriptor.
452
- *
453
- * Unlike `App Region`'s `type`, this value may contain `/`, so the authoring URL that addresses one row
454
- * carries it percent-encoded (`app-route/claims%2Fopen/details`). Angular round-trips that, but a
455
- * reverse proxy that normalizes `%2F` before the SPA sees it would not — worth an e2e case once
456
- * multi-segment routes are authored in the testbed.
457
- */
458
- const APP_ROUTE_ID_FIELD = 'path';
266
+ return new BaseEntityDescriptor({
267
+ entityName: APP_REGION_ENTITY_NAME,
268
+ attrDescriptors: createRegionDefinitionAttrDescriptors(),
269
+ i18nScope: APP_REGION_I18N_SCOPE,
270
+ componentParent: APP_DEFINITION_ENTITY_NAME,
271
+ isEmbedded: true
272
+ });
273
+ }
274
+ const APP_ROUTE_ID_FIELD = "path";
459
275
  function createRouteDefinitionAttrDescriptors() {
460
- const pathAttr = new BaseEntityAttrDescriptor('path', FormControlType.TEXT_BOX, 'Path', undefined, true);
461
- pathAttr.required = true;
462
- pathAttr.placeholder = 'Relative to the app root, e.g. claims/open or claims/:id';
463
- // The contract's own pattern. Declaring it here is what makes the form reject a value the backend
464
- // would reject anyway — and it is serialized into the e2e registry, so generated fixtures produce a
465
- // dashed token instead of a prose value the PUT answers with 400.
466
- pathAttr.pattern = '^[a-z0-9:][a-z0-9\\-:/]*$';
467
- const titleAttr = new BaseEntityAttrDescriptor('title', FormControlType.TEXT_BOX, 'Title');
468
- titleAttr.required = true;
469
- titleAttr.isHeading = true;
470
- const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
471
- translocoIdAttr.placeholder = 'Translation key of the route title';
472
- translocoIdAttr.hideInTable = true;
473
- const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');
474
- iconAttr.placeholder = 'Material or FontAwesome icon name';
475
- iconAttr.hideInTable = true;
476
- const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');
477
- rolesAttr.placeholder = 'Empty means any authenticated member of the organization';
478
- rolesAttr.hideInTable = true;
479
- // region flattened target — re-nested into `target` by AppDefinitionMapper
480
- // Which of the fields below is meaningful follows from `kind`; all of them are offered, and the
481
- // backend validator — not the form — is what rejects a combination that makes no sense. The generic
482
- // form has no conditional visibility, and a discriminated union is not something a descriptor can
483
- // express in the first place.
484
- const kindAttr = new BaseEntityAttrDescriptor('kind', FormControlType.DROPDOWN, 'Renders', toSelectables(ROUTE_TARGET_KINDS));
485
- kindAttr.required = true;
486
- const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');
487
- widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;
488
- widgetsAttr.hideInTable = true;
489
- const documentSlugAttr = new BaseEntityAttrDescriptor('documentSlug', FormControlType.TEXT_BOX, 'Document Slug');
490
- documentSlugAttr.placeholder = 'DOCUMENT only: slug of the document to render';
491
- documentSlugAttr.hideInTable = true;
492
- const entityNameAttr = new BaseEntityAttrDescriptor('entityName', FormControlType.TEXT_BOX, 'Entity Name');
493
- entityNameAttr.placeholder = 'ENTITY only: name of the descriptor to generate the screen from';
494
- entityNameAttr.hideInTable = true;
495
- const entityModeAttr = new BaseEntityAttrDescriptor('entityMode', FormControlType.DROPDOWN, 'Entity Mode', toSelectables(ENTITY_MODES));
496
- entityModeAttr.hideInTable = true;
497
- const rsqlFilterAttr = new BaseEntityAttrDescriptor('rsqlFilter', FormControlType.TEXT_BOX, 'Rsql Filter');
498
- rsqlFilterAttr.placeholder = 'ENTITY + LIST only: RSQL the list is pre-filtered with';
499
- rsqlFilterAttr.hideInTable = true;
500
- // endregion
501
- const identityRow = new FlexboxDescriptor([pathAttr, titleAttr, translocoIdAttr], FlexDirection.ROW);
502
- identityRow.style = { 'column-gap': '10px' };
503
- const presentationRow = new FlexboxDescriptor([iconAttr, kindAttr], FlexDirection.ROW);
504
- presentationRow.style = { 'column-gap': '10px' };
505
- const documentRow = new FlexboxDescriptor([documentSlugAttr], FlexDirection.ROW);
506
- documentRow.style = { 'column-gap': '10px' };
507
- const entityRow = new FlexboxDescriptor([entityNameAttr, entityModeAttr, rsqlFilterAttr], FlexDirection.ROW);
508
- entityRow.style = { 'column-gap': '10px' };
509
- const flexBoxContainer = new FlexboxDescriptor([identityRow, presentationRow, rolesAttr, documentRow, entityRow, widgetsAttr], FlexDirection.COLUMN);
510
- flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
511
- return [flexBoxContainer];
276
+ const pathAttr = new BaseEntityAttrDescriptor("path", FormControlType.TEXT_BOX, "Path", void 0, true);
277
+ pathAttr.required = true;
278
+ pathAttr.placeholder = "Relative to the app root, e.g. claims/open or claims/:id";
279
+ pathAttr.pattern = "^[a-z0-9:][a-z0-9\\-:/]*$";
280
+ const titleAttr = new BaseEntityAttrDescriptor("title", FormControlType.TEXT_BOX, "Title");
281
+ titleAttr.required = true;
282
+ titleAttr.isHeading = true;
283
+ const translocoIdAttr = new BaseEntityAttrDescriptor("translocoId", FormControlType.TEXT_BOX, "Transloco Id");
284
+ translocoIdAttr.placeholder = "Translation key of the route title";
285
+ translocoIdAttr.hideInTable = true;
286
+ const iconAttr = new BaseEntityAttrDescriptor("icon", FormControlType.TEXT_BOX, "Icon");
287
+ iconAttr.placeholder = "Material or FontAwesome icon name";
288
+ iconAttr.hideInTable = true;
289
+ const rolesAttr = new BaseEntityAttrDescriptor("roles", FormControlType.TAGS, "Roles");
290
+ rolesAttr.placeholder = "Empty means any authenticated member of the organization";
291
+ rolesAttr.hideInTable = true;
292
+ const kindAttr = new BaseEntityAttrDescriptor("kind", FormControlType.DROPDOWN, "Renders", toSelectables(ROUTE_TARGET_KINDS));
293
+ kindAttr.required = true;
294
+ const widgetsAttr = new BaseEntityAttrDescriptor("widgets", FormControlType.EMBEDDED_COMPONENTS, "Widgets");
295
+ widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;
296
+ widgetsAttr.hideInTable = true;
297
+ const documentSlugAttr = new BaseEntityAttrDescriptor("documentSlug", FormControlType.TEXT_BOX, "Document Slug");
298
+ documentSlugAttr.placeholder = "DOCUMENT only: slug of the document to render";
299
+ documentSlugAttr.hideInTable = true;
300
+ const entityNameAttr = new BaseEntityAttrDescriptor("entityName", FormControlType.TEXT_BOX, "Entity Name");
301
+ entityNameAttr.placeholder = "ENTITY only: name of the descriptor to generate the screen from";
302
+ entityNameAttr.hideInTable = true;
303
+ const entityModeAttr = new BaseEntityAttrDescriptor("entityMode", FormControlType.DROPDOWN, "Entity Mode", toSelectables(ENTITY_MODES));
304
+ entityModeAttr.hideInTable = true;
305
+ const rsqlFilterAttr = new BaseEntityAttrDescriptor("rsqlFilter", FormControlType.TEXT_BOX, "Rsql Filter");
306
+ rsqlFilterAttr.placeholder = "ENTITY + LIST only: RSQL the list is pre-filtered with";
307
+ rsqlFilterAttr.hideInTable = true;
308
+ const identityRow = new FlexboxDescriptor([
309
+ pathAttr,
310
+ titleAttr,
311
+ translocoIdAttr
312
+ ], FlexDirection.ROW);
313
+ identityRow.style = { "column-gap": "10px" };
314
+ const presentationRow = new FlexboxDescriptor([iconAttr, kindAttr], FlexDirection.ROW);
315
+ presentationRow.style = { "column-gap": "10px" };
316
+ const documentRow = new FlexboxDescriptor([documentSlugAttr], FlexDirection.ROW);
317
+ documentRow.style = { "column-gap": "10px" };
318
+ const entityRow = new FlexboxDescriptor([
319
+ entityNameAttr,
320
+ entityModeAttr,
321
+ rsqlFilterAttr
322
+ ], FlexDirection.ROW);
323
+ entityRow.style = { "column-gap": "10px" };
324
+ const flexBoxContainer = new FlexboxDescriptor([
325
+ identityRow,
326
+ presentationRow,
327
+ rolesAttr,
328
+ documentRow,
329
+ entityRow,
330
+ widgetsAttr
331
+ ], FlexDirection.COLUMN);
332
+ flexBoxContainer.style = {
333
+ "row-gap": "5px",
334
+ width: "fit-content"
335
+ };
336
+ return [flexBoxContainer];
512
337
  }
513
338
  function createRouteDefinitionDescriptor() {
514
- return new BaseEntityDescriptor({
515
- entityName: APP_ROUTE_ENTITY_NAME,
516
- attrDescriptors: createRouteDefinitionAttrDescriptors(),
517
- i18nScope: APP_ROUTE_I18N_SCOPE,
518
- // Two parents, one descriptor: an app's own routes and a module's routes are the same schema, and a
519
- // route has to mean the same thing wherever it was authored. The module's paths are simply relative
520
- // to the base path its mount gives them.
521
- componentParent: [APP_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME],
522
- isEmbedded: true,
523
- });
339
+ return new BaseEntityDescriptor({
340
+ entityName: APP_ROUTE_ENTITY_NAME,
341
+ attrDescriptors: createRouteDefinitionAttrDescriptors(),
342
+ i18nScope: APP_ROUTE_I18N_SCOPE,
343
+ componentParent: [APP_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME],
344
+ isEmbedded: true
345
+ });
524
346
  }
525
-
526
347
  const statusSelectables = toSelectables(Object.keys(AppDefinitionStatus));
527
348
  function createAppDefinitionAttrDescriptors() {
528
- const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');
529
- idAttr.required = true;
530
- idAttr.placeholder = 'Unique within the organization, e.g. claims-app';
531
- const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);
532
- nameAttr.required = true;
533
- nameAttr.isHeading = true;
534
- const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
535
- translocoIdAttr.placeholder = 'Translation key of the application name';
536
- translocoIdAttr.hideInTable = true;
537
- const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');
538
- descriptionAttr.styleClass = 'full-width';
539
- descriptionAttr.hideInTable = true;
540
- // Server-assigned: shown so the designer can see where a definition stands, never edited here.
541
- // Status changes through `POST .../publish`, the versions through any successful write.
542
- const statusAttr = new BaseEntityAttrDescriptor('status', FormControlType.DROPDOWN, 'Status', statusSelectables);
543
- statusAttr.disabled = true;
544
- const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');
545
- versionAttr.disabled = true;
546
- const publishedVersionAttr = new BaseEntityAttrDescriptor('publishedVersion', FormControlType.TEXT_BOX, 'Published Version');
547
- publishedVersionAttr.disabled = true;
548
- const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');
549
- updatedAtAttr.disabled = true;
550
- // region theme — flattened out of `theme` by AppDefinitionMapper
551
- const materialThemeAttr = new BaseEntityAttrDescriptor('materialTheme', FormControlType.DROPDOWN, 'Material Theme', toSelectables(MATERIAL_THEMES));
552
- materialThemeAttr.hideInTable = true;
553
- const colorSchemeAttr = new BaseEntityAttrDescriptor('colorScheme', FormControlType.DROPDOWN, 'Color Scheme', toSelectables(COLOR_SCHEMES));
554
- colorSchemeAttr.hideInTable = true;
555
- const logoUrlAttr = new BaseEntityAttrDescriptor('logoUrl', FormControlType.TEXT_BOX, 'Logo Url');
556
- logoUrlAttr.placeholder = 'Tenant logo shown in the header region';
557
- logoUrlAttr.hideInTable = true;
558
- const faviconUrlAttr = new BaseEntityAttrDescriptor('faviconUrl', FormControlType.TEXT_BOX, 'Favicon Url');
559
- faviconUrlAttr.hideInTable = true;
560
- // An open key/value map by contract — keys are `--pp-*` token names, values any CSS color — so a
561
- // key/value editor is the only shape that can carry it without the form inventing a closed list.
562
- const tokenOverridesAttr = new BaseEntityAttrDescriptor('tokenOverrides', FormControlType.ADDITIONAL_PROPERTIES, 'Token Overrides');
563
- tokenOverridesAttr.hideInTable = true;
564
- // endregion
565
- // region layout — flattened out of `layout` by AppDefinitionMapper
566
- const presetAttr = new BaseEntityAttrDescriptor('preset', FormControlType.DROPDOWN, 'Layout Preset', toSelectables(LAYOUT_PRESETS));
567
- presetAttr.hideInTable = true;
568
- const sidenavModeAttr = new BaseEntityAttrDescriptor('sidenavMode', FormControlType.DROPDOWN, 'Sidenav Mode', toSelectables(SIDENAV_MODES));
569
- sidenavModeAttr.hideInTable = true;
570
- const contentMaxWidthAttr = new BaseEntityAttrDescriptor('contentMaxWidth', FormControlType.TEXT_BOX, 'Content Max Width');
571
- contentMaxWidthAttr.placeholder = 'CSS length, e.g. 1280px; empty means full width';
572
- contentMaxWidthAttr.hideInTable = true;
573
- const sidenavCollapsibleAttr = new BaseEntityAttrDescriptor('sidenavCollapsible', FormControlType.CHECKBOX, 'Sidenav Collapsible');
574
- sidenavCollapsibleAttr.hideInTable = true;
575
- const sidenavOpenByDefaultAttr = new BaseEntityAttrDescriptor('sidenavOpenByDefault', FormControlType.CHECKBOX, 'Sidenav Open By Default');
576
- sidenavOpenByDefaultAttr.hideInTable = true;
577
- // endregion
578
- // region nested graph — kept on the entity as-is by AppDefinitionMapper, so the full-replacement PUT preserves it
579
- // Containment, not association: the contract nests `RegionDefinition`, `RouteDefinition` and
580
- // `ModuleMount` inside the AppDefinition document, and none has an endpoint of its own, so the rows
581
- // travel inside this entity's payload and are saved with it. A `ModuleMount` is the exception that
582
- // proves it — the module it *names* is a separate aggregate with its own endpoints, but the mount
583
- // itself belongs to this app.
584
- const regionsAttr = new BaseEntityAttrDescriptor('regions', FormControlType.EMBEDDED_COMPONENTS, 'Regions');
585
- regionsAttr.linkedEntityType = APP_REGION_ENTITY_NAME;
586
- // A region has no `id` in the contract; `type` is what identifies it. See APP_REGION_ID_FIELD.
587
- regionsAttr.referenceIdField = APP_REGION_ID_FIELD;
588
- regionsAttr.hideInTable = true;
589
- // Flat by design: a route has no children, and the multi-segment paths of these rows are what the
590
- // shell derives Angular's nesting from at registration time.
591
- const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');
592
- routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
593
- routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;
594
- routesAttr.hideInTable = true;
595
- const modulesAttr = new BaseEntityAttrDescriptor('modules', FormControlType.EMBEDDED_COMPONENTS, 'Modules');
596
- modulesAttr.linkedEntityType = APP_MODULE_MOUNT_ENTITY_NAME;
597
- modulesAttr.referenceIdField = APP_MODULE_MOUNT_ID_FIELD;
598
- modulesAttr.hideInTable = true;
599
- // endregion
600
- const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);
601
- identityRow.style = { 'column-gap': '10px' };
602
- const revisionRow = new FlexboxDescriptor([statusAttr, versionAttr, publishedVersionAttr, updatedAtAttr], FlexDirection.ROW);
603
- revisionRow.style = { 'column-gap': '10px' };
604
- const themeRow = new FlexboxDescriptor([materialThemeAttr, colorSchemeAttr], FlexDirection.ROW);
605
- themeRow.style = { 'column-gap': '10px' };
606
- const brandingRow = new FlexboxDescriptor([logoUrlAttr, faviconUrlAttr], FlexDirection.ROW);
607
- brandingRow.style = { 'column-gap': '10px' };
608
- const layoutRow = new FlexboxDescriptor([presetAttr, sidenavModeAttr, contentMaxWidthAttr], FlexDirection.ROW);
609
- layoutRow.style = { 'column-gap': '10px' };
610
- const sidenavRow = new FlexboxDescriptor([sidenavCollapsibleAttr, sidenavOpenByDefaultAttr], FlexDirection.ROW);
611
- sidenavRow.style = { 'column-gap': '10px' };
612
- const graphRow = new FlexboxDescriptor([regionsAttr, routesAttr, modulesAttr], FlexDirection.ROW);
613
- graphRow.style = { 'column-gap': '10px' };
614
- const flexBoxContainer = new FlexboxDescriptor([identityRow, revisionRow, descriptionAttr, themeRow, brandingRow, tokenOverridesAttr, layoutRow, sidenavRow, graphRow], FlexDirection.COLUMN);
615
- flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
616
- return [flexBoxContainer];
349
+ const idAttr = new BaseEntityAttrDescriptor("id", FormControlType.TEXT_BOX, "Id");
350
+ idAttr.required = true;
351
+ idAttr.placeholder = "Unique within the organization, e.g. claims-app";
352
+ const nameAttr = new BaseEntityAttrDescriptor("name", FormControlType.TEXT_BOX, "Name", void 0, true);
353
+ nameAttr.required = true;
354
+ nameAttr.isHeading = true;
355
+ const translocoIdAttr = new BaseEntityAttrDescriptor("translocoId", FormControlType.TEXT_BOX, "Transloco Id");
356
+ translocoIdAttr.placeholder = "Translation key of the application name";
357
+ translocoIdAttr.hideInTable = true;
358
+ const descriptionAttr = new BaseEntityAttrDescriptor("description", FormControlType.TEXTAREA, "Description");
359
+ descriptionAttr.styleClass = "full-width";
360
+ descriptionAttr.hideInTable = true;
361
+ const statusAttr = new BaseEntityAttrDescriptor("status", FormControlType.DROPDOWN, "Status", statusSelectables);
362
+ statusAttr.disabled = true;
363
+ const versionAttr = new BaseEntityAttrDescriptor("version", FormControlType.TEXT_BOX, "Version");
364
+ versionAttr.disabled = true;
365
+ const publishedVersionAttr = new BaseEntityAttrDescriptor("publishedVersion", FormControlType.TEXT_BOX, "Published Version");
366
+ publishedVersionAttr.disabled = true;
367
+ const updatedAtAttr = new BaseEntityAttrDescriptor("updatedAt", FormControlType.TEXT_BOX, "Updated At");
368
+ updatedAtAttr.disabled = true;
369
+ const materialThemeAttr = new BaseEntityAttrDescriptor("materialTheme", FormControlType.DROPDOWN, "Material Theme", toSelectables(MATERIAL_THEMES));
370
+ materialThemeAttr.hideInTable = true;
371
+ const colorSchemeAttr = new BaseEntityAttrDescriptor("colorScheme", FormControlType.DROPDOWN, "Color Scheme", toSelectables(COLOR_SCHEMES));
372
+ colorSchemeAttr.hideInTable = true;
373
+ const logoUrlAttr = new BaseEntityAttrDescriptor("logoUrl", FormControlType.TEXT_BOX, "Logo Url");
374
+ logoUrlAttr.placeholder = "Tenant logo shown in the header region";
375
+ logoUrlAttr.hideInTable = true;
376
+ const faviconUrlAttr = new BaseEntityAttrDescriptor("faviconUrl", FormControlType.TEXT_BOX, "Favicon Url");
377
+ faviconUrlAttr.hideInTable = true;
378
+ const tokenOverridesAttr = new BaseEntityAttrDescriptor("tokenOverrides", FormControlType.ADDITIONAL_PROPERTIES, "Token Overrides");
379
+ tokenOverridesAttr.hideInTable = true;
380
+ const presetAttr = new BaseEntityAttrDescriptor("preset", FormControlType.DROPDOWN, "Layout Preset", toSelectables(LAYOUT_PRESETS));
381
+ presetAttr.hideInTable = true;
382
+ const sidenavModeAttr = new BaseEntityAttrDescriptor("sidenavMode", FormControlType.DROPDOWN, "Sidenav Mode", toSelectables(SIDENAV_MODES));
383
+ sidenavModeAttr.hideInTable = true;
384
+ const contentMaxWidthAttr = new BaseEntityAttrDescriptor("contentMaxWidth", FormControlType.TEXT_BOX, "Content Max Width");
385
+ contentMaxWidthAttr.placeholder = "CSS length, e.g. 1280px; empty means full width";
386
+ contentMaxWidthAttr.hideInTable = true;
387
+ const sidenavCollapsibleAttr = new BaseEntityAttrDescriptor("sidenavCollapsible", FormControlType.CHECKBOX, "Sidenav Collapsible");
388
+ sidenavCollapsibleAttr.hideInTable = true;
389
+ const sidenavOpenByDefaultAttr = new BaseEntityAttrDescriptor("sidenavOpenByDefault", FormControlType.CHECKBOX, "Sidenav Open By Default");
390
+ sidenavOpenByDefaultAttr.hideInTable = true;
391
+ const regionsAttr = new BaseEntityAttrDescriptor("regions", FormControlType.EMBEDDED_COMPONENTS, "Regions");
392
+ regionsAttr.linkedEntityType = APP_REGION_ENTITY_NAME;
393
+ regionsAttr.referenceIdField = APP_REGION_ID_FIELD;
394
+ regionsAttr.hideInTable = true;
395
+ const routesAttr = new BaseEntityAttrDescriptor("routes", FormControlType.EMBEDDED_COMPONENTS, "Routes");
396
+ routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
397
+ routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;
398
+ routesAttr.hideInTable = true;
399
+ const modulesAttr = new BaseEntityAttrDescriptor("modules", FormControlType.EMBEDDED_COMPONENTS, "Modules");
400
+ modulesAttr.linkedEntityType = APP_MODULE_MOUNT_ENTITY_NAME;
401
+ modulesAttr.referenceIdField = APP_MODULE_MOUNT_ID_FIELD;
402
+ modulesAttr.hideInTable = true;
403
+ const identityRow = new FlexboxDescriptor([
404
+ idAttr,
405
+ nameAttr,
406
+ translocoIdAttr
407
+ ], FlexDirection.ROW);
408
+ identityRow.style = { "column-gap": "10px" };
409
+ const revisionRow = new FlexboxDescriptor([
410
+ statusAttr,
411
+ versionAttr,
412
+ publishedVersionAttr,
413
+ updatedAtAttr
414
+ ], FlexDirection.ROW);
415
+ revisionRow.style = { "column-gap": "10px" };
416
+ const themeRow = new FlexboxDescriptor([materialThemeAttr, colorSchemeAttr], FlexDirection.ROW);
417
+ themeRow.style = { "column-gap": "10px" };
418
+ const brandingRow = new FlexboxDescriptor([logoUrlAttr, faviconUrlAttr], FlexDirection.ROW);
419
+ brandingRow.style = { "column-gap": "10px" };
420
+ const layoutRow = new FlexboxDescriptor([
421
+ presetAttr,
422
+ sidenavModeAttr,
423
+ contentMaxWidthAttr
424
+ ], FlexDirection.ROW);
425
+ layoutRow.style = { "column-gap": "10px" };
426
+ const sidenavRow = new FlexboxDescriptor([sidenavCollapsibleAttr, sidenavOpenByDefaultAttr], FlexDirection.ROW);
427
+ sidenavRow.style = { "column-gap": "10px" };
428
+ const graphRow = new FlexboxDescriptor([
429
+ regionsAttr,
430
+ routesAttr,
431
+ modulesAttr
432
+ ], FlexDirection.ROW);
433
+ graphRow.style = { "column-gap": "10px" };
434
+ const flexBoxContainer = new FlexboxDescriptor([
435
+ identityRow,
436
+ revisionRow,
437
+ descriptionAttr,
438
+ themeRow,
439
+ brandingRow,
440
+ tokenOverridesAttr,
441
+ layoutRow,
442
+ sidenavRow,
443
+ graphRow
444
+ ], FlexDirection.COLUMN);
445
+ flexBoxContainer.style = {
446
+ "row-gap": "5px",
447
+ width: "fit-content"
448
+ };
449
+ return [flexBoxContainer];
617
450
  }
618
451
  function createAppDefinitionDescriptor() {
619
- return new BaseEntityDescriptor({ entityName: APP_DEFINITION_ENTITY_NAME, attrDescriptors: createAppDefinitionAttrDescriptors(), i18nScope: APP_DEFINITION_I18N_SCOPE });
452
+ return new BaseEntityDescriptor({
453
+ entityName: APP_DEFINITION_ENTITY_NAME,
454
+ attrDescriptors: createAppDefinitionAttrDescriptors(),
455
+ i18nScope: APP_DEFINITION_I18N_SCOPE
456
+ });
620
457
  }
621
-
622
458
  function createNavItemAttrDescriptors() {
623
- const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');
624
- idAttr.required = true;
625
- const labelAttr = new BaseEntityAttrDescriptor('label', FormControlType.TEXT_BOX, 'Label', undefined, true);
626
- labelAttr.required = true;
627
- labelAttr.isHeading = true;
628
- const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
629
- translocoIdAttr.placeholder = 'Translation key of the label';
630
- translocoIdAttr.hideInTable = true;
631
- const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');
632
- iconAttr.placeholder = 'Material or FontAwesome icon name';
633
- iconAttr.hideInTable = true;
634
- // A group node expands its children instead of navigating, so this stays optional. The route is
635
- // resolved by `path` rather than by an id — see APP_ROUTE_ID_FIELD.
636
- const routePathAttr = new BaseEntityAttrDescriptor('routePath', FormControlType.FOREIGN_KEY, 'Route');
637
- routePathAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
638
- routePathAttr.referenceIdField = APP_ROUTE_ID_FIELD;
639
- const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');
640
- rolesAttr.placeholder = 'Empty means any authenticated member of the organization';
641
- rolesAttr.hideInTable = true;
642
- // A group node contains its children rather than pointing at them — they are an inline array of this
643
- // entry, and the entry itself is nested in the app definition's document.
644
- const childrenAttr = new BaseEntityAttrDescriptor('children', FormControlType.EMBEDDED_COMPONENTS, 'Children');
645
- childrenAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;
646
- childrenAttr.hideInTable = true;
647
- const identityRow = new FlexboxDescriptor([idAttr, labelAttr, translocoIdAttr], FlexDirection.ROW);
648
- identityRow.style = { 'column-gap': '10px' };
649
- const targetRow = new FlexboxDescriptor([iconAttr, routePathAttr], FlexDirection.ROW);
650
- targetRow.style = { 'column-gap': '10px' };
651
- const flexBoxContainer = new FlexboxDescriptor([identityRow, targetRow, rolesAttr, childrenAttr], FlexDirection.COLUMN);
652
- flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
653
- return [flexBoxContainer];
459
+ const idAttr = new BaseEntityAttrDescriptor("id", FormControlType.TEXT_BOX, "Id");
460
+ idAttr.required = true;
461
+ const labelAttr = new BaseEntityAttrDescriptor("label", FormControlType.TEXT_BOX, "Label", void 0, true);
462
+ labelAttr.required = true;
463
+ labelAttr.isHeading = true;
464
+ const translocoIdAttr = new BaseEntityAttrDescriptor("translocoId", FormControlType.TEXT_BOX, "Transloco Id");
465
+ translocoIdAttr.placeholder = "Translation key of the label";
466
+ translocoIdAttr.hideInTable = true;
467
+ const iconAttr = new BaseEntityAttrDescriptor("icon", FormControlType.TEXT_BOX, "Icon");
468
+ iconAttr.placeholder = "Material or FontAwesome icon name";
469
+ iconAttr.hideInTable = true;
470
+ const routePathAttr = new BaseEntityAttrDescriptor("routePath", FormControlType.FOREIGN_KEY, "Route");
471
+ routePathAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
472
+ routePathAttr.referenceIdField = APP_ROUTE_ID_FIELD;
473
+ const rolesAttr = new BaseEntityAttrDescriptor("roles", FormControlType.TAGS, "Roles");
474
+ rolesAttr.placeholder = "Empty means any authenticated member of the organization";
475
+ rolesAttr.hideInTable = true;
476
+ const childrenAttr = new BaseEntityAttrDescriptor("children", FormControlType.EMBEDDED_COMPONENTS, "Children");
477
+ childrenAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;
478
+ childrenAttr.hideInTable = true;
479
+ const identityRow = new FlexboxDescriptor([
480
+ idAttr,
481
+ labelAttr,
482
+ translocoIdAttr
483
+ ], FlexDirection.ROW);
484
+ identityRow.style = { "column-gap": "10px" };
485
+ const targetRow = new FlexboxDescriptor([iconAttr, routePathAttr], FlexDirection.ROW);
486
+ targetRow.style = { "column-gap": "10px" };
487
+ const flexBoxContainer = new FlexboxDescriptor([
488
+ identityRow,
489
+ targetRow,
490
+ rolesAttr,
491
+ childrenAttr
492
+ ], FlexDirection.COLUMN);
493
+ flexBoxContainer.style = {
494
+ "row-gap": "5px",
495
+ width: "fit-content"
496
+ };
497
+ return [flexBoxContainer];
654
498
  }
655
499
  function createNavItemDescriptor() {
656
- return new BaseEntityDescriptor({
657
- entityName: APP_NAV_ITEM_ENTITY_NAME,
658
- attrDescriptors: createNavItemAttrDescriptors(),
659
- i18nScope: APP_NAV_ITEM_I18N_SCOPE,
660
- // A nav item hangs off the sidenav region, or off another nav item as a group child.
661
- componentParent: [APP_REGION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME],
662
- isEmbedded: true,
663
- });
500
+ return new BaseEntityDescriptor({
501
+ entityName: APP_NAV_ITEM_ENTITY_NAME,
502
+ attrDescriptors: createNavItemAttrDescriptors(),
503
+ i18nScope: APP_NAV_ITEM_I18N_SCOPE,
504
+ componentParent: [APP_REGION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME],
505
+ isEmbedded: true
506
+ });
664
507
  }
665
-
666
508
  function createWidgetInstanceAttrDescriptors() {
667
- // `id` rather than `type` identifies the widget: it is unique within its page or region, while a
668
- // page with two `entity-grid`s would otherwise show the same label twice.
669
- const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id', undefined, true);
670
- idAttr.required = true;
671
- idAttr.isHeading = true;
672
- idAttr.placeholder = 'Unique within the page or region, e.g. widget-claims-grid';
673
- // Deliberately a free-text box and not a dropdown: `WidgetInstance.type` is a key into the frontend
674
- // widget registry, which the contract keeps open so new widget types need no schema change.
675
- const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.TEXT_BOX, 'Type');
676
- typeAttr.required = true;
677
- typeAttr.placeholder = 'Widget registry key, e.g. entity-grid';
678
- // Each widget type owns and validates its own props shape, so the only thing this form can
679
- // honestly offer is an open key/value editor.
680
- const propsAttr = new BaseEntityAttrDescriptor('props', FormControlType.ADDITIONAL_PROPERTIES, 'Props');
681
- propsAttr.hideInTable = true;
682
- // Widgets do not nest: a container widget type lists the ids of siblings in `props.childIds`, and each
683
- // of those siblings is marked REFERENCED so it is placed by the container instead of rendering twice.
684
- // That is the whole of composition here — there is no child collection to edit.
685
- const placementAttr = new BaseEntityAttrDescriptor('placement', FormControlType.DROPDOWN, 'Placement', toSelectables(WIDGET_PLACEMENTS));
686
- placementAttr.hideInTable = true;
687
- const identityRow = new FlexboxDescriptor([idAttr, typeAttr, placementAttr], FlexDirection.ROW);
688
- identityRow.style = { 'column-gap': '10px' };
689
- const flexBoxContainer = new FlexboxDescriptor([identityRow, propsAttr], FlexDirection.COLUMN);
690
- flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
691
- return [flexBoxContainer];
509
+ const idAttr = new BaseEntityAttrDescriptor("id", FormControlType.TEXT_BOX, "Id", void 0, true);
510
+ idAttr.required = true;
511
+ idAttr.isHeading = true;
512
+ idAttr.placeholder = "Unique within the page or region, e.g. widget-claims-grid";
513
+ const typeAttr = new BaseEntityAttrDescriptor("type", FormControlType.TEXT_BOX, "Type");
514
+ typeAttr.required = true;
515
+ typeAttr.placeholder = "Widget registry key, e.g. entity-grid";
516
+ const propsAttr = createWidgetPropsAttrDescriptor("props", "type", "Props");
517
+ propsAttr.hideInTable = true;
518
+ const placementAttr = new BaseEntityAttrDescriptor("placement", FormControlType.DROPDOWN, "Placement", toSelectables(WIDGET_PLACEMENTS));
519
+ placementAttr.hideInTable = true;
520
+ const identityRow = new FlexboxDescriptor([
521
+ idAttr,
522
+ typeAttr,
523
+ placementAttr
524
+ ], FlexDirection.ROW);
525
+ identityRow.style = { "column-gap": "10px" };
526
+ const flexBoxContainer = new FlexboxDescriptor([identityRow, propsAttr], FlexDirection.COLUMN);
527
+ flexBoxContainer.style = {
528
+ "row-gap": "5px",
529
+ width: "fit-content"
530
+ };
531
+ return [flexBoxContainer];
692
532
  }
693
533
  function createWidgetInstanceDescriptor() {
694
- return new BaseEntityDescriptor({
695
- entityName: APP_WIDGET_ENTITY_NAME,
696
- attrDescriptors: createWidgetInstanceAttrDescriptors(),
697
- i18nScope: APP_WIDGET_I18N_SCOPE,
698
- // A widget sits in a header/footer region or on a page — and only there, since it cannot be nested
699
- // in another widget.
700
- componentParent: [APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME],
701
- isEmbedded: true,
702
- });
534
+ return new BaseEntityDescriptor({
535
+ entityName: APP_WIDGET_ENTITY_NAME,
536
+ attrDescriptors: createWidgetInstanceAttrDescriptors(),
537
+ i18nScope: APP_WIDGET_I18N_SCOPE,
538
+ componentParent: [APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME],
539
+ isEmbedded: true
540
+ });
703
541
  }
704
-
705
542
  function createModuleDefinitionAttrDescriptors() {
706
- // The contract's `key`, renamed to `id` by ModuleDefinitionMapper because base-entity keys stores and
707
- // URLs on `id`. Labelled 'Key' so the designer sees the name the contract and `ModuleMount.moduleKey`
708
- // use. The pattern is the contract's own: the key is a URL segment of the module endpoints and the
709
- // prefix a mount composes with, so a value needing encoding would break both.
710
- const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Key');
711
- idAttr.required = true;
712
- idAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';
713
- idAttr.placeholder = 'Unique within the organization, e.g. claims — immutable once mounted';
714
- const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);
715
- nameAttr.required = true;
716
- nameAttr.isHeading = true;
717
- const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
718
- translocoIdAttr.placeholder = 'Translation key of the module name';
719
- translocoIdAttr.hideInTable = true;
720
- const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');
721
- descriptionAttr.styleClass = 'full-width';
722
- descriptionAttr.hideInTable = true;
723
- // Left empty means the key, which is the default the contract states — applied by
724
- // `moduleTranslocoScope` rather than written into the row, so an empty field stays empty.
725
- const translocoScopeAttr = new BaseEntityAttrDescriptor('translocoScope', FormControlType.TEXT_BOX, 'Transloco Scope');
726
- translocoScopeAttr.placeholder = "Scope the module's translations load under; empty means the key";
727
- translocoScopeAttr.hideInTable = true;
728
- // Server-assigned, shown so the designer can see where a module stands.
729
- const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');
730
- versionAttr.disabled = true;
731
- const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');
732
- updatedAtAttr.disabled = true;
733
- // The same rows, the same descriptor and the same derived nesting as `AppDefinition.routes` — only the
734
- // paths are relative to the base path a mount gives them. `App Route` therefore names this entity as a
735
- // second `componentParent`.
736
- const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');
737
- routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
738
- routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;
739
- routesAttr.hideInTable = true;
740
- const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);
741
- identityRow.style = { 'column-gap': '10px' };
742
- const revisionRow = new FlexboxDescriptor([translocoScopeAttr, versionAttr, updatedAtAttr], FlexDirection.ROW);
743
- revisionRow.style = { 'column-gap': '10px' };
744
- const flexBoxContainer = new FlexboxDescriptor([identityRow, revisionRow, descriptionAttr, routesAttr], FlexDirection.COLUMN);
745
- flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
746
- return [flexBoxContainer];
543
+ const idAttr = new BaseEntityAttrDescriptor("id", FormControlType.TEXT_BOX, "Key");
544
+ idAttr.required = true;
545
+ idAttr.pattern = "^[a-z0-9]+(-[a-z0-9]+)*$";
546
+ idAttr.placeholder = "Unique within the organization, e.g. claims — immutable once mounted";
547
+ const nameAttr = new BaseEntityAttrDescriptor("name", FormControlType.TEXT_BOX, "Name", void 0, true);
548
+ nameAttr.required = true;
549
+ nameAttr.isHeading = true;
550
+ const translocoIdAttr = new BaseEntityAttrDescriptor("translocoId", FormControlType.TEXT_BOX, "Transloco Id");
551
+ translocoIdAttr.placeholder = "Translation key of the module name";
552
+ translocoIdAttr.hideInTable = true;
553
+ const descriptionAttr = new BaseEntityAttrDescriptor("description", FormControlType.TEXTAREA, "Description");
554
+ descriptionAttr.styleClass = "full-width";
555
+ descriptionAttr.hideInTable = true;
556
+ const translocoScopeAttr = new BaseEntityAttrDescriptor("translocoScope", FormControlType.TEXT_BOX, "Transloco Scope");
557
+ translocoScopeAttr.placeholder = "Scope the module's translations load under; empty means the key";
558
+ translocoScopeAttr.hideInTable = true;
559
+ const versionAttr = new BaseEntityAttrDescriptor("version", FormControlType.TEXT_BOX, "Version");
560
+ versionAttr.disabled = true;
561
+ const updatedAtAttr = new BaseEntityAttrDescriptor("updatedAt", FormControlType.TEXT_BOX, "Updated At");
562
+ updatedAtAttr.disabled = true;
563
+ const routesAttr = new BaseEntityAttrDescriptor("routes", FormControlType.EMBEDDED_COMPONENTS, "Routes");
564
+ routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
565
+ routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;
566
+ routesAttr.hideInTable = true;
567
+ const identityRow = new FlexboxDescriptor([
568
+ idAttr,
569
+ nameAttr,
570
+ translocoIdAttr
571
+ ], FlexDirection.ROW);
572
+ identityRow.style = { "column-gap": "10px" };
573
+ const revisionRow = new FlexboxDescriptor([
574
+ translocoScopeAttr,
575
+ versionAttr,
576
+ updatedAtAttr
577
+ ], FlexDirection.ROW);
578
+ revisionRow.style = { "column-gap": "10px" };
579
+ const flexBoxContainer = new FlexboxDescriptor([
580
+ identityRow,
581
+ revisionRow,
582
+ descriptionAttr,
583
+ routesAttr
584
+ ], FlexDirection.COLUMN);
585
+ flexBoxContainer.style = {
586
+ "row-gap": "5px",
587
+ width: "fit-content"
588
+ };
589
+ return [flexBoxContainer];
747
590
  }
748
591
  function createModuleDefinitionDescriptor() {
749
- return new BaseEntityDescriptor({
750
- entityName: MODULE_DEFINITION_ENTITY_NAME,
751
- attrDescriptors: createModuleDefinitionAttrDescriptors(),
752
- i18nScope: MODULE_DEFINITION_I18N_SCOPE,
753
- });
592
+ return new BaseEntityDescriptor({
593
+ entityName: MODULE_DEFINITION_ENTITY_NAME,
594
+ attrDescriptors: createModuleDefinitionAttrDescriptors(),
595
+ i18nScope: MODULE_DEFINITION_I18N_SCOPE
596
+ });
754
597
  }
755
-
756
- /**
757
- * The `target` flattening both aggregates that own routes need — `AppDefinition.routes` and
758
- * `ModuleDefinition.routes` carry the same schema, and a route authored in a module has to behave
759
- * exactly like one authored in an app.
760
- *
761
- * Why flatten at all: `EMBEDDED_COMPONENTS` edits a row as the flat JSON it arrived as, and a descriptor
762
- * addresses one property rather than a path, so nothing in the generated form could reach
763
- * `target.documentSlug`. The contract already keeps `RouteTarget` flat rather than a `oneOf` for the
764
- * related reason that the form cannot edit a discriminated union of classes.
765
- */
766
598
  function flattenRouteTarget(dto) {
767
- const target = dto.target;
768
- return new RouteDefinition({
769
- path: dto.path,
770
- title: dto.title,
771
- translocoId: dto.translocoId,
772
- icon: dto.icon,
773
- roles: dto.roles,
774
- kind: target?.kind,
775
- widgets: target?.widgets,
776
- documentSlug: target?.documentSlug,
777
- entityName: target?.entityName,
778
- entityMode: target?.entityMode,
779
- rsqlFilter: target?.rsqlFilter,
780
- // Kept so nestRouteTarget can merge onto it rather than replace it.
781
- target,
782
- });
599
+ const target = dto.target;
600
+ return new RouteDefinition({
601
+ path: dto.path,
602
+ title: dto.title,
603
+ translocoId: dto.translocoId,
604
+ icon: dto.icon,
605
+ roles: dto.roles,
606
+ kind: target?.kind,
607
+ widgets: target?.widgets,
608
+ documentSlug: target?.documentSlug,
609
+ entityName: target?.entityName,
610
+ entityMode: target?.entityMode,
611
+ rsqlFilter: target?.rsqlFilter,
612
+ target
613
+ });
783
614
  }
784
- /**
785
- * The inverse. `kind` is non-optional in the contract but undefined on a row the designer has not
786
- * finished — the dropdown is `required`, so the form rejects that before a save; the cast keeps this
787
- * mapping from having to invent a default the backend would then have to second-guess.
788
- *
789
- * `widgets` is omitted when empty rather than sent as `[]`, so a DOCUMENT or ENTITY route does not
790
- * persist an empty widget list it has no use for. The rest is merged onto the `target` the fields were
791
- * lifted out of, which preserves any field a later contract version adds before this mapping learns
792
- * about it — a PUT is a full replacement, so anything dropped here is dropped for good.
793
- */
794
615
  function nestRouteTarget(route) {
795
- const widgets = route.widgets;
796
- return {
797
- path: route.path,
798
- title: route.title,
799
- translocoId: route.translocoId,
800
- icon: route.icon,
801
- roles: route.roles,
802
- target: {
803
- ...route.target,
804
- kind: route.kind,
805
- widgets: widgets?.length ? widgets : undefined,
806
- documentSlug: route.documentSlug,
807
- entityName: route.entityName,
808
- entityMode: route.entityMode,
809
- rsqlFilter: route.rsqlFilter,
810
- },
811
- };
812
- }
813
-
814
- /**
815
- * Translates between the `AppDefinition` DTO of `base-app-api.yaml` and the flat entity the
816
- * generated form works with.
817
- *
818
- * Two invariants matter here. The form saves `{ ...entity, ...form.value }`, so every DTO field the
819
- * form does not show has to survive on the entity — `regions`, `routes` and `modules` are nested
820
- * rather than flattened for exactly that reason, and the `EMBEDDED_COMPONENTS` controls edit them in
821
- * place. And `PUT /app-definitions/{appId}` is a full replacement, so {@link toDto} rebuilds `theme`
822
- * and `layout` from the flattened controls *on top of* the objects they were lifted out of, which
823
- * keeps any field a later contract version adds before this mapper learns about it.
824
- *
825
- * A route's `target` is the third thing flattened, one level deeper: `regions` and `modules` rows
826
- * travel as the raw DTO they arrived as, but a route row cannot. That flattening lives in
827
- * `route-definition.mapper.ts` rather than here, because `ModuleDefinition.routes` carries the same
828
- * schema and a route authored in a module has to behave exactly like one authored in an app.
829
- */
830
- class AppDefinitionMapper {
831
- fromDto(dto) {
832
- const source = dto;
833
- const theme = source.theme;
834
- const layout = source.layout;
835
- return new AppDefinition({
836
- id: source.id,
837
- name: source.name,
838
- translocoId: source.translocoId,
839
- description: source.description,
840
- materialTheme: theme?.materialTheme,
841
- colorScheme: theme?.colorScheme,
842
- tokenOverrides: theme?.tokenOverrides,
843
- logoUrl: theme?.logoUrl,
844
- faviconUrl: theme?.faviconUrl,
845
- preset: layout?.preset,
846
- sidenavMode: layout?.sidenavMode,
847
- sidenavCollapsible: layout?.sidenavCollapsible,
848
- sidenavOpenByDefault: layout?.sidenavOpenByDefault,
849
- contentMaxWidth: layout?.contentMaxWidth,
850
- theme,
851
- layout,
852
- regions: source.regions,
853
- routes: source.routes?.map(flattenRouteTarget),
854
- modules: source.modules,
855
- orgKey: source.orgKey,
856
- status: source.status,
857
- version: source.version,
858
- publishedVersion: source.publishedVersion,
859
- createdAt: source.createdAt,
860
- updatedAt: source.updatedAt,
861
- });
862
- }
863
- toDto(entity) {
864
- // Listed field by field rather than spread, so the flattened controls never reach the payload.
865
- return {
866
- id: entity.id,
867
- name: entity.name,
868
- translocoId: entity.translocoId,
869
- description: entity.description,
870
- theme: this.mergeTheme(entity),
871
- layout: this.mergeLayout(entity),
872
- regions: entity.regions,
873
- routes: entity.routes?.map(nestRouteTarget),
874
- modules: entity.modules,
875
- orgKey: entity.orgKey,
876
- status: entity.status,
877
- version: entity.version,
878
- publishedVersion: entity.publishedVersion,
879
- createdAt: entity.createdAt,
880
- updatedAt: entity.updatedAt,
881
- };
882
- }
883
- mergeTheme(entity) {
884
- return {
885
- ...entity.theme,
886
- materialTheme: entity.materialTheme,
887
- colorScheme: entity.colorScheme,
888
- tokenOverrides: entity.tokenOverrides,
889
- logoUrl: entity.logoUrl,
890
- faviconUrl: entity.faviconUrl,
891
- };
892
- }
893
- mergeLayout(entity) {
894
- return {
895
- ...entity.layout,
896
- preset: entity.preset,
897
- sidenavMode: entity.sidenavMode,
898
- sidenavCollapsible: entity.sidenavCollapsible,
899
- sidenavOpenByDefault: entity.sidenavOpenByDefault,
900
- contentMaxWidth: entity.contentMaxWidth,
901
- };
902
- }
903
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionMapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
904
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionMapper, providedIn: 'root' });
905
- }
906
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionMapper, decorators: [{
907
- type: Injectable,
908
- args: [{ providedIn: 'root' }]
909
- }] });
910
-
911
- /**
912
- * REST access to `/organizations/{orgKey}/app-definitions`. As in base-rule, the organization is
913
- * part of the configured service root — `APP_SERVICE_ROOT`, the optional per-feature escape hatch,
914
- * falling back to `BACKEND_SERVICE_ROOT`, which is what every deployment actually sets — so the
915
- * tenant is a deployment concern rather than something every call has to carry.
916
- */
917
- class AppDefinitionService extends BaseEntityRestService {
918
- entityMapper;
919
- constructor(entityMapper) {
920
- super(entityMapper, 'APP_SERVICE_ROOT', 'app-definitions');
921
- this.entityMapper = entityMapper;
922
- }
923
- /**
924
- * `POST /app-definitions/{appId}/publish` — promotes the stored `version` to `publishedVersion` and
925
- * sets the status to `PUBLISHED`. The backend validates the definition first and answers 400 when it
926
- * is not publishable, so the caller only has to deal with the happy path and the error.
927
- */
928
- publish(id) {
929
- const pathParams = new Map([['id', String(id)]]);
930
- const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}/publish', { pathParams });
931
- if (!fullUrl)
932
- throw new Error('Could not determine the full url');
933
- return this.httpClient.post(fullUrl, {}, { headers: this.headers }).pipe(map((response) => this.entityMapper.fromDto(response)));
934
- }
935
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionService, deps: [{ token: AppDefinitionMapper }], target: i0.ɵɵFactoryTarget.Injectable });
936
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionService, providedIn: 'root' });
937
- }
938
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionService, decorators: [{
939
- type: Injectable,
940
- args: [{ providedIn: 'root' }]
941
- }], ctorParameters: () => [{ type: AppDefinitionMapper }] });
942
-
943
- /**
944
- * Adds the `publish` use case on top of the generic CRUD store. It keeps the same contract as
945
- * `addEntity` / `updateEntity`: flip `isLoading`, replace the entity in the list with the server's
946
- * answer so the form's read-only `status` / `publishedVersion` fields refresh, and surface failures
947
- * through `error` rather than by throwing.
948
- */
616
+ const widgets = route.widgets;
617
+ return {
618
+ path: route.path,
619
+ title: route.title,
620
+ translocoId: route.translocoId,
621
+ icon: route.icon,
622
+ roles: route.roles,
623
+ target: {
624
+ ...route.target,
625
+ kind: route.kind,
626
+ widgets: widgets?.length ? widgets : void 0,
627
+ documentSlug: route.documentSlug,
628
+ entityName: route.entityName,
629
+ entityMode: route.entityMode,
630
+ rsqlFilter: route.rsqlFilter
631
+ }
632
+ };
633
+ }
634
+ var AppDefinitionMapper = class AppDefinitionMapper {
635
+ fromDto(dto) {
636
+ const source = dto;
637
+ const theme = source.theme;
638
+ const layout = source.layout;
639
+ return new AppDefinition({
640
+ id: source.id,
641
+ name: source.name,
642
+ translocoId: source.translocoId,
643
+ description: source.description,
644
+ materialTheme: theme?.materialTheme,
645
+ colorScheme: theme?.colorScheme,
646
+ tokenOverrides: theme?.tokenOverrides,
647
+ logoUrl: theme?.logoUrl,
648
+ faviconUrl: theme?.faviconUrl,
649
+ preset: layout?.preset,
650
+ sidenavMode: layout?.sidenavMode,
651
+ sidenavCollapsible: layout?.sidenavCollapsible,
652
+ sidenavOpenByDefault: layout?.sidenavOpenByDefault,
653
+ contentMaxWidth: layout?.contentMaxWidth,
654
+ theme,
655
+ layout,
656
+ regions: source.regions,
657
+ routes: source.routes?.map(flattenRouteTarget),
658
+ modules: source.modules,
659
+ orgKey: source.orgKey,
660
+ status: source.status,
661
+ version: source.version,
662
+ publishedVersion: source.publishedVersion,
663
+ createdAt: source.createdAt,
664
+ updatedAt: source.updatedAt
665
+ });
666
+ }
667
+ toDto(entity) {
668
+ return {
669
+ id: entity.id,
670
+ name: entity.name,
671
+ translocoId: entity.translocoId,
672
+ description: entity.description,
673
+ theme: this.mergeTheme(entity),
674
+ layout: this.mergeLayout(entity),
675
+ regions: entity.regions,
676
+ routes: entity.routes?.map(nestRouteTarget),
677
+ modules: entity.modules,
678
+ orgKey: entity.orgKey,
679
+ status: entity.status,
680
+ version: entity.version,
681
+ publishedVersion: entity.publishedVersion,
682
+ createdAt: entity.createdAt,
683
+ updatedAt: entity.updatedAt
684
+ };
685
+ }
686
+ mergeTheme(entity) {
687
+ return {
688
+ ...entity.theme,
689
+ materialTheme: entity.materialTheme,
690
+ colorScheme: entity.colorScheme,
691
+ tokenOverrides: entity.tokenOverrides,
692
+ logoUrl: entity.logoUrl,
693
+ faviconUrl: entity.faviconUrl
694
+ };
695
+ }
696
+ mergeLayout(entity) {
697
+ return {
698
+ ...entity.layout,
699
+ preset: entity.preset,
700
+ sidenavMode: entity.sidenavMode,
701
+ sidenavCollapsible: entity.sidenavCollapsible,
702
+ sidenavOpenByDefault: entity.sidenavOpenByDefault,
703
+ contentMaxWidth: entity.contentMaxWidth
704
+ };
705
+ }
706
+ static ɵfac = i0.ɵɵngDeclareFactory({
707
+ minVersion: "12.0.0",
708
+ version: "22.1.7",
709
+ ngImport: i0,
710
+ type: AppDefinitionMapper,
711
+ deps: [],
712
+ target: i0.ɵɵFactoryTarget.Injectable
713
+ });
714
+ static ɵprov = i0.ɵɵngDeclareInjectable({
715
+ minVersion: "12.0.0",
716
+ version: "22.1.7",
717
+ ngImport: i0,
718
+ type: AppDefinitionMapper,
719
+ providedIn: "root"
720
+ });
721
+ };
722
+ i0.ɵɵngDeclareClassMetadata({
723
+ minVersion: "12.0.0",
724
+ version: "22.1.7",
725
+ ngImport: i0,
726
+ type: AppDefinitionMapper,
727
+ decorators: [{
728
+ type: Injectable,
729
+ args: [{ providedIn: "root" }]
730
+ }]
731
+ });
732
+ var AppDefinitionService = class AppDefinitionService extends BaseEntityRestService {
733
+ entityMapper;
734
+ constructor(entityMapper) {
735
+ super(entityMapper, "APP_SERVICE_ROOT", "app-definitions");
736
+ this.entityMapper = entityMapper;
737
+ }
738
+ publish(id) {
739
+ const pathParams = /* @__PURE__ */ new Map([["id", String(id)]]);
740
+ const fullUrl = this.buildFullUrl(this.resourceUrl + "/%{id}/publish", { pathParams });
741
+ if (!fullUrl) throw new Error("Could not determine the full url");
742
+ return this.httpClient.post(fullUrl, {}, { headers: this.headers }).pipe(map((response) => this.entityMapper.fromDto(response)));
743
+ }
744
+ static ɵfac = i0.ɵɵngDeclareFactory({
745
+ minVersion: "12.0.0",
746
+ version: "22.1.7",
747
+ ngImport: i0,
748
+ type: AppDefinitionService,
749
+ deps: [{ token: AppDefinitionMapper }],
750
+ target: i0.ɵɵFactoryTarget.Injectable
751
+ });
752
+ static ɵprov = i0.ɵɵngDeclareInjectable({
753
+ minVersion: "12.0.0",
754
+ version: "22.1.7",
755
+ ngImport: i0,
756
+ type: AppDefinitionService,
757
+ providedIn: "root"
758
+ });
759
+ };
760
+ i0.ɵɵngDeclareClassMetadata({
761
+ minVersion: "12.0.0",
762
+ version: "22.1.7",
763
+ ngImport: i0,
764
+ type: AppDefinitionService,
765
+ decorators: [{
766
+ type: Injectable,
767
+ args: [{ providedIn: "root" }]
768
+ }],
769
+ ctorParameters: () => [{ type: AppDefinitionMapper }]
770
+ });
949
771
  function AppDefinitionPublishStore() {
950
- return signalStoreFeature({ state: type() }, withMethods((store, service = inject(AppDefinitionService)) => ({
951
- publish: async (id) => {
952
- patchState(store, { isLoading: true, error: undefined });
953
- try {
954
- const publishedEntity = await firstValueFrom(service.publish(id));
955
- const entities = [...store.entities()];
956
- const indexToUpdate = entities.findIndex((entity) => entity.id === id);
957
- if (indexToUpdate >= 0)
958
- entities[indexToUpdate] = publishedEntity;
959
- const currentEntity = store.currentEntity()?.id === id ? publishedEntity : store.currentEntity();
960
- patchState(store, { entities, currentEntity, isLoading: false });
961
- return publishedEntity;
962
- }
963
- catch (error) {
964
- patchState(store, { error: httpErrorMessage(error), isLoading: false });
965
- return undefined;
966
- }
967
- },
968
- })));
969
- }
970
- const AppDefinitionStore = signalStore({ providedIn: 'root' }, BaseEntityStore(AppDefinition, () => inject(AppDefinitionService)), BaseEntityTabsStore(), BaseEntityContainerStore(), AppDefinitionPublishStore(), withDevtools('AppDefinition'));
971
-
972
- /**
973
- * Translates between the `ModuleDefinition` DTO of `base-app-api.yaml` and the entity the generated form
974
- * works with. Two renamings, and nothing else — a module is a much smaller aggregate than an app:
975
- *
976
- * - **`key` becomes `id`.** base-entity keys every store, URL and reference on `id`, so the rename
977
- * happens here rather than in the framework. See {@link ModuleDefinition.id}.
978
- * - **each route's `target` is flattened** onto the row and re-nested on save, by the same functions
979
- * `AppDefinitionMapper` uses, so a route authored in a module behaves like one authored in an app.
980
- */
981
- class ModuleDefinitionMapper {
982
- fromDto(dto) {
983
- const source = dto;
984
- return new ModuleDefinition({
985
- id: source.key,
986
- name: source.name,
987
- translocoId: source.translocoId,
988
- description: source.description,
989
- translocoScope: source.translocoScope,
990
- routes: source.routes?.map(flattenRouteTarget),
991
- orgKey: source.orgKey,
992
- version: source.version,
993
- createdAt: source.createdAt,
994
- updatedAt: source.updatedAt,
995
- });
996
- }
997
- toDto(entity) {
998
- // Field by field rather than spread, so `id` does not travel beside the `key` it became.
999
- return {
1000
- key: entity.id,
1001
- name: entity.name,
1002
- translocoId: entity.translocoId,
1003
- description: entity.description,
1004
- translocoScope: entity.translocoScope,
1005
- routes: entity.routes?.map(nestRouteTarget),
1006
- orgKey: entity.orgKey,
1007
- version: entity.version,
1008
- createdAt: entity.createdAt,
1009
- updatedAt: entity.updatedAt,
1010
- };
1011
- }
1012
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionMapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1013
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionMapper, providedIn: 'root' });
1014
- }
1015
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionMapper, decorators: [{
1016
- type: Injectable,
1017
- args: [{ providedIn: 'root' }]
1018
- }] });
1019
-
1020
- /**
1021
- * REST access to `/organizations/{orgKey}/modules`. As for `AppDefinitionService`, the organization is
1022
- * part of the configured service root (`APP_SERVICE_ROOT`, falling back to `BACKEND_SERVICE_ROOT`), so
1023
- * the tenant is a deployment concern rather
1024
- * than something every call has to carry.
1025
- *
1026
- * The URL variable is the module key — `ModuleDefinitionMapper` maps it onto `id`, which is what the
1027
- * inherited `findById` builds `GET .../modules/{moduleKey}` from. That single-module read is also the call
1028
- * the shell makes when something first navigates under a mount; see `ModuleLoader` in
1029
- * `app-route-builder.ts`.
1030
- */
1031
- class ModuleDefinitionService extends BaseEntityRestService {
1032
- entityMapper;
1033
- constructor(entityMapper) {
1034
- super(entityMapper, 'APP_SERVICE_ROOT', 'modules');
1035
- this.entityMapper = entityMapper;
1036
- }
1037
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionService, deps: [{ token: ModuleDefinitionMapper }], target: i0.ɵɵFactoryTarget.Injectable });
1038
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionService, providedIn: 'root' });
1039
- }
1040
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionService, decorators: [{
1041
- type: Injectable,
1042
- args: [{ providedIn: 'root' }]
1043
- }], ctorParameters: () => [{ type: ModuleDefinitionMapper }] });
1044
-
1045
- /**
1046
- * Plain generic CRUD — a module has no `publish` of its own. Publishing is an `AppDefinition` operation:
1047
- * an app is what a user navigates to, and its status is what decides whether a mount is live. Giving a
1048
- * module a second, independent lifecycle would make "which version of what is live" a question with two
1049
- * answers.
1050
- */
1051
- const ModuleDefinitionStore = signalStore({ providedIn: 'root' }, BaseEntityStore(ModuleDefinition, () => inject(ModuleDefinitionService)), BaseEntityTabsStore(), BaseEntityContainerStore(), withDevtools('ModuleDefinition'));
1052
-
1053
- class AppDefinitionFacade extends BaseEntityFacade {
1054
- entityType = AppDefinition;
1055
- mapperRef = inject(AppDefinitionMapper);
1056
- serviceRef = inject(AppDefinitionService);
1057
- createMapper() {
1058
- return this.mapperRef;
1059
- }
1060
- createService() {
1061
- return this.serviceRef;
1062
- }
1063
- createStoreClass() {
1064
- return AppDefinitionStore;
1065
- }
1066
- createDescriptor() {
1067
- return createAppDefinitionDescriptor();
1068
- }
1069
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1070
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionFacade });
1071
- }
1072
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionFacade, decorators: [{
1073
- type: Injectable
1074
- }] });
1075
-
1076
- class ModuleDefinitionFacade extends BaseEntityFacade {
1077
- entityType = ModuleDefinition;
1078
- mapperRef = inject(ModuleDefinitionMapper);
1079
- serviceRef = inject(ModuleDefinitionService);
1080
- createMapper() {
1081
- return this.mapperRef;
1082
- }
1083
- createService() {
1084
- return this.serviceRef;
1085
- }
1086
- createStoreClass() {
1087
- return ModuleDefinitionStore;
1088
- }
1089
- createDescriptor() {
1090
- return createModuleDefinitionDescriptor();
1091
- }
1092
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1093
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionFacade });
1094
- }
1095
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionFacade, decorators: [{
1096
- type: Injectable
1097
- }] });
1098
-
1099
- /**
1100
- * A mount is a row of the `App Definition` document, so it is edited through that document — unlike the
1101
- * `ModuleDefinition` it names, which is an aggregate of its own with its own endpoints.
1102
- */
1103
- class AppModuleMountFacade extends EmbeddedEntityFacade {
1104
- entityType = ModuleMount;
1105
- createDescriptor() {
1106
- return createModuleMountDescriptor();
1107
- }
1108
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppModuleMountFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1109
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppModuleMountFacade });
1110
- }
1111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppModuleMountFacade, decorators: [{
1112
- type: Injectable
1113
- }] });
1114
-
1115
- /**
1116
- * One facade covers every level of the nav tree, however deep: the store is a root singleton and the row
1117
- * it stands for comes from the route, so `app-nav-item/a/details/app-nav-item/b/details` resolves through
1118
- * the same facade as the top level.
1119
- */
1120
- class AppNavItemFacade extends EmbeddedEntityFacade {
1121
- entityType = NavItem;
1122
- createDescriptor() {
1123
- return createNavItemDescriptor();
1124
- }
1125
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppNavItemFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1126
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppNavItemFacade });
1127
- }
1128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppNavItemFacade, decorators: [{
1129
- type: Injectable
1130
- }] });
1131
-
1132
- /**
1133
- * Derives Angular's nested `Routes` from the flat route list of an `AppDefinition`.
1134
- *
1135
- * Nesting is computed here rather than authored, which is the whole point of keeping
1136
- * {@link RouteDefinition} flat: `claims`, `claims/open` and `claims/:id` are three sibling rows a
1137
- * designer can reorder, rename and reason about one at a time, and it is only at registration that
1138
- * they become a parent with two children. Two rules produce that shape:
1139
- *
1140
- * - **An authored route that is a prefix of others becomes their parent.** So `claims` stays mounted
1141
- * while `claims/open` renders in its `<router-outlet>` — which is the one thing a flat registration
1142
- * could not express, and the reason this function exists at all. A component rendering a route that
1143
- * has children therefore has to host an outlet.
1144
- * - **A prefix nothing authored stays part of the path.** With only `claims/open` and `claims/closed`
1145
- * declared, no synthetic `claims` parent is invented: the two are emitted with their full paths, since
1146
- * a component-less grouping node would change nothing about what matches or what renders.
1147
- *
1148
- * Modules mount as a parent of their own at {@link ModuleMount.basePath}, component-less because a mount
1149
- * is a prefix rather than a screen. That is the single composition point, and it composes one level: the
1150
- * routes of a mounted module are built by the same two rules, and a module mounts no modules. A module the
1151
- * shell already has is emitted now; one it has not is emitted as `loadChildren` — see {@link lazyMount}.
1152
- *
1153
- * Siblings are ordered static-prefix-first, so `claims/new` is matched before `claims/:id` rather than
1154
- * swallowed by it. Beyond that the authored order is kept, and a duplicate path — which the backend
1155
- * rejects as an error, so it should never arrive — keeps its first occurrence.
1156
- */
772
+ return signalStoreFeature({ state: type() }, withMethods((store, service = inject(AppDefinitionService)) => ({ publish: async (id) => {
773
+ patchState(store, {
774
+ isLoading: true,
775
+ error: void 0
776
+ });
777
+ try {
778
+ const publishedEntity = await firstValueFrom(service.publish(id));
779
+ const entities = [...store.entities()];
780
+ const indexToUpdate = entities.findIndex((entity) => entity.id === id);
781
+ if (indexToUpdate >= 0) entities[indexToUpdate] = publishedEntity;
782
+ patchState(store, {
783
+ entities,
784
+ currentEntity: store.currentEntity()?.id === id ? publishedEntity : store.currentEntity(),
785
+ isLoading: false
786
+ });
787
+ return publishedEntity;
788
+ } catch (error) {
789
+ patchState(store, {
790
+ error: httpErrorMessage(error),
791
+ isLoading: false
792
+ });
793
+ return;
794
+ }
795
+ } })));
796
+ }
797
+ const AppDefinitionStore = signalStore({ providedIn: "root" }, BaseEntityStore(AppDefinition, () => inject(AppDefinitionService)), BaseEntityTabsStore(), BaseEntityContainerStore(), AppDefinitionPublishStore(), withDevtools("AppDefinition"));
798
+ var ModuleDefinitionMapper = class ModuleDefinitionMapper {
799
+ fromDto(dto) {
800
+ const source = dto;
801
+ return new ModuleDefinition({
802
+ id: source.key,
803
+ name: source.name,
804
+ translocoId: source.translocoId,
805
+ description: source.description,
806
+ translocoScope: source.translocoScope,
807
+ routes: source.routes?.map(flattenRouteTarget),
808
+ orgKey: source.orgKey,
809
+ version: source.version,
810
+ createdAt: source.createdAt,
811
+ updatedAt: source.updatedAt
812
+ });
813
+ }
814
+ toDto(entity) {
815
+ return {
816
+ key: entity.id,
817
+ name: entity.name,
818
+ translocoId: entity.translocoId,
819
+ description: entity.description,
820
+ translocoScope: entity.translocoScope,
821
+ routes: entity.routes?.map(nestRouteTarget),
822
+ orgKey: entity.orgKey,
823
+ version: entity.version,
824
+ createdAt: entity.createdAt,
825
+ updatedAt: entity.updatedAt
826
+ };
827
+ }
828
+ static ɵfac = i0.ɵɵngDeclareFactory({
829
+ minVersion: "12.0.0",
830
+ version: "22.1.7",
831
+ ngImport: i0,
832
+ type: ModuleDefinitionMapper,
833
+ deps: [],
834
+ target: i0.ɵɵFactoryTarget.Injectable
835
+ });
836
+ static ɵprov = i0.ɵɵngDeclareInjectable({
837
+ minVersion: "12.0.0",
838
+ version: "22.1.7",
839
+ ngImport: i0,
840
+ type: ModuleDefinitionMapper,
841
+ providedIn: "root"
842
+ });
843
+ };
844
+ i0.ɵɵngDeclareClassMetadata({
845
+ minVersion: "12.0.0",
846
+ version: "22.1.7",
847
+ ngImport: i0,
848
+ type: ModuleDefinitionMapper,
849
+ decorators: [{
850
+ type: Injectable,
851
+ args: [{ providedIn: "root" }]
852
+ }]
853
+ });
854
+ var ModuleDefinitionService = class ModuleDefinitionService extends BaseEntityRestService {
855
+ entityMapper;
856
+ constructor(entityMapper) {
857
+ super(entityMapper, "APP_SERVICE_ROOT", "modules");
858
+ this.entityMapper = entityMapper;
859
+ }
860
+ static ɵfac = i0.ɵɵngDeclareFactory({
861
+ minVersion: "12.0.0",
862
+ version: "22.1.7",
863
+ ngImport: i0,
864
+ type: ModuleDefinitionService,
865
+ deps: [{ token: ModuleDefinitionMapper }],
866
+ target: i0.ɵɵFactoryTarget.Injectable
867
+ });
868
+ static ɵprov = i0.ɵɵngDeclareInjectable({
869
+ minVersion: "12.0.0",
870
+ version: "22.1.7",
871
+ ngImport: i0,
872
+ type: ModuleDefinitionService,
873
+ providedIn: "root"
874
+ });
875
+ };
876
+ i0.ɵɵngDeclareClassMetadata({
877
+ minVersion: "12.0.0",
878
+ version: "22.1.7",
879
+ ngImport: i0,
880
+ type: ModuleDefinitionService,
881
+ decorators: [{
882
+ type: Injectable,
883
+ args: [{ providedIn: "root" }]
884
+ }],
885
+ ctorParameters: () => [{ type: ModuleDefinitionMapper }]
886
+ });
887
+ const ModuleDefinitionStore = signalStore({ providedIn: "root" }, BaseEntityStore(ModuleDefinition, () => inject(ModuleDefinitionService)), BaseEntityTabsStore(), BaseEntityContainerStore(), withDevtools("ModuleDefinition"));
888
+ var AppDefinitionFacade = class AppDefinitionFacade extends BaseEntityFacade {
889
+ entityType = AppDefinition;
890
+ mapperRef = inject(AppDefinitionMapper);
891
+ serviceRef = inject(AppDefinitionService);
892
+ createMapper() {
893
+ return this.mapperRef;
894
+ }
895
+ createService() {
896
+ return this.serviceRef;
897
+ }
898
+ createStoreClass() {
899
+ return AppDefinitionStore;
900
+ }
901
+ createDescriptor() {
902
+ return createAppDefinitionDescriptor();
903
+ }
904
+ static ɵfac = i0.ɵɵngDeclareFactory({
905
+ minVersion: "12.0.0",
906
+ version: "22.1.7",
907
+ ngImport: i0,
908
+ type: AppDefinitionFacade,
909
+ deps: null,
910
+ target: i0.ɵɵFactoryTarget.Injectable
911
+ });
912
+ static ɵprov = i0.ɵɵngDeclareInjectable({
913
+ minVersion: "12.0.0",
914
+ version: "22.1.7",
915
+ ngImport: i0,
916
+ type: AppDefinitionFacade
917
+ });
918
+ };
919
+ i0.ɵɵngDeclareClassMetadata({
920
+ minVersion: "12.0.0",
921
+ version: "22.1.7",
922
+ ngImport: i0,
923
+ type: AppDefinitionFacade,
924
+ decorators: [{ type: Injectable }]
925
+ });
926
+ var ModuleDefinitionFacade = class ModuleDefinitionFacade extends BaseEntityFacade {
927
+ entityType = ModuleDefinition;
928
+ mapperRef = inject(ModuleDefinitionMapper);
929
+ serviceRef = inject(ModuleDefinitionService);
930
+ createMapper() {
931
+ return this.mapperRef;
932
+ }
933
+ createService() {
934
+ return this.serviceRef;
935
+ }
936
+ createStoreClass() {
937
+ return ModuleDefinitionStore;
938
+ }
939
+ createDescriptor() {
940
+ return createModuleDefinitionDescriptor();
941
+ }
942
+ static ɵfac = i0.ɵɵngDeclareFactory({
943
+ minVersion: "12.0.0",
944
+ version: "22.1.7",
945
+ ngImport: i0,
946
+ type: ModuleDefinitionFacade,
947
+ deps: null,
948
+ target: i0.ɵɵFactoryTarget.Injectable
949
+ });
950
+ static ɵprov = i0.ɵɵngDeclareInjectable({
951
+ minVersion: "12.0.0",
952
+ version: "22.1.7",
953
+ ngImport: i0,
954
+ type: ModuleDefinitionFacade
955
+ });
956
+ };
957
+ i0.ɵɵngDeclareClassMetadata({
958
+ minVersion: "12.0.0",
959
+ version: "22.1.7",
960
+ ngImport: i0,
961
+ type: ModuleDefinitionFacade,
962
+ decorators: [{ type: Injectable }]
963
+ });
964
+ var AppModuleMountFacade = class AppModuleMountFacade extends EmbeddedEntityFacade {
965
+ entityType = ModuleMount;
966
+ createDescriptor() {
967
+ return createModuleMountDescriptor();
968
+ }
969
+ static ɵfac = i0.ɵɵngDeclareFactory({
970
+ minVersion: "12.0.0",
971
+ version: "22.1.7",
972
+ ngImport: i0,
973
+ type: AppModuleMountFacade,
974
+ deps: null,
975
+ target: i0.ɵɵFactoryTarget.Injectable
976
+ });
977
+ static ɵprov = i0.ɵɵngDeclareInjectable({
978
+ minVersion: "12.0.0",
979
+ version: "22.1.7",
980
+ ngImport: i0,
981
+ type: AppModuleMountFacade
982
+ });
983
+ };
984
+ i0.ɵɵngDeclareClassMetadata({
985
+ minVersion: "12.0.0",
986
+ version: "22.1.7",
987
+ ngImport: i0,
988
+ type: AppModuleMountFacade,
989
+ decorators: [{ type: Injectable }]
990
+ });
991
+ var AppNavItemFacade = class AppNavItemFacade extends EmbeddedEntityFacade {
992
+ entityType = NavItem;
993
+ createDescriptor() {
994
+ return createNavItemDescriptor();
995
+ }
996
+ static ɵfac = i0.ɵɵngDeclareFactory({
997
+ minVersion: "12.0.0",
998
+ version: "22.1.7",
999
+ ngImport: i0,
1000
+ type: AppNavItemFacade,
1001
+ deps: null,
1002
+ target: i0.ɵɵFactoryTarget.Injectable
1003
+ });
1004
+ static ɵprov = i0.ɵɵngDeclareInjectable({
1005
+ minVersion: "12.0.0",
1006
+ version: "22.1.7",
1007
+ ngImport: i0,
1008
+ type: AppNavItemFacade
1009
+ });
1010
+ };
1011
+ i0.ɵɵngDeclareClassMetadata({
1012
+ minVersion: "12.0.0",
1013
+ version: "22.1.7",
1014
+ ngImport: i0,
1015
+ type: AppNavItemFacade,
1016
+ decorators: [{ type: Injectable }]
1017
+ });
1157
1018
  async function buildAppRoutes(source, renderRoute) {
1158
- const appRoutes = await emitLevel(trieOf(source.routes), [], renderRoute);
1159
- return [...appRoutes, ...(await moduleRoutesOf(source, renderRoute))];
1019
+ return [...await emitLevel(trieOf(source.routes), [], renderRoute), ...await moduleRoutesOf(source, renderRoute)];
1160
1020
  }
1161
1021
  async function moduleRoutesOf(source, renderRoute) {
1162
- const mounted = [];
1163
- for (const mount of source.modules ?? []) {
1164
- if (!mount.basePath)
1165
- continue;
1166
- const routes = source.moduleRoutes?.[mount.moduleKey];
1167
- if (routes) {
1168
- if (routes.length)
1169
- mounted.push({ path: mount.basePath, children: await emitLevel(trieOf(routes), [], renderRoute) });
1170
- }
1171
- else if (source.loadModule) {
1172
- mounted.push(lazyMount(mount.moduleKey, mount.basePath, source.loadModule, renderRoute));
1173
- }
1174
- }
1175
- return mounted;
1022
+ const mounted = [];
1023
+ for (const mount of source.modules ?? []) {
1024
+ if (!mount.basePath) continue;
1025
+ const routes = source.moduleRoutes?.[mount.moduleKey];
1026
+ if (routes) {
1027
+ if (routes.length) mounted.push({
1028
+ path: mount.basePath,
1029
+ children: await emitLevel(trieOf(routes), [], renderRoute)
1030
+ });
1031
+ } else if (source.loadModule) mounted.push(lazyMount(mount.moduleKey, mount.basePath, source.loadModule, renderRoute));
1032
+ }
1033
+ return mounted;
1176
1034
  }
1177
- /**
1178
- * A mount whose module the shell has not got yet: the same component-less parent at the base path, with
1179
- * its children resolved on first navigation into it instead of now.
1180
- *
1181
- * What is deferred is the *metadata* — one `GET /modules/{key}` per module the user actually visits, so an
1182
- * app that mounts twenty modules does not fetch twenty definitions to show its first screen. It is not a
1183
- * deferred *bundle*: the widgets a module's routes render come from the widget registry and are part of
1184
- * the application's own build either way.
1185
- *
1186
- * The module's transloco scope is registered here, on a component-less wrapper inside the loaded children,
1187
- * because that is the first moment its name is known — the default is the module key, but a module may
1188
- * name its own. The alias is spelled out, as everywhere in this workspace: transloco would otherwise
1189
- * camel-case it and miss every key below it.
1190
- *
1191
- * The framework scopes are re-registered alongside it, for the reason `BASE_APP_ROUTES.authoringScopes()`
1192
- * gives: a route that declares TRANSLOCO_SCOPE *replaces* the collection it inherits rather than adding to
1193
- * it, because Angular does not merge `multi` providers across injectors. A module's routes render the same
1194
- * generic screens as everything else — an ENTITY route reaches `BaseEntityTabsComponent`, which translates
1195
- * `base_entity.tabs.*` — so naming only the module's scope here would leave every framework label below the
1196
- * mount unresolved.
1197
- */
1198
1035
  function lazyMount(moduleKey, basePath, loadModule, renderRoute) {
1199
- return {
1200
- path: basePath,
1201
- loadChildren: async () => {
1202
- const definition = await loadModule(moduleKey);
1203
- const children = await emitLevel(trieOf(definition?.routes), [], renderRoute);
1204
- if (!definition || !children.length)
1205
- return [];
1206
- const scope = moduleTranslocoScope(definition);
1207
- const providers = [
1208
- provideTranslocoScope({ scope, alias: scope }, { scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE }, { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE }),
1209
- ];
1210
- return [{ path: '', providers, children }];
1211
- },
1212
- };
1036
+ return {
1037
+ path: basePath,
1038
+ loadChildren: async () => {
1039
+ const definition = await loadModule(moduleKey);
1040
+ const children = await emitLevel(trieOf(definition?.routes), [], renderRoute);
1041
+ if (!definition || !children.length) return [];
1042
+ const scope = moduleTranslocoScope(definition);
1043
+ return [{
1044
+ path: "",
1045
+ providers: [provideTranslocoScope({
1046
+ scope,
1047
+ alias: scope
1048
+ }, {
1049
+ scope: BASE_ENTITY_TRANSLOCO_SCOPE,
1050
+ alias: BASE_ENTITY_TRANSLOCO_SCOPE
1051
+ }, {
1052
+ scope: BASE_APP_TRANSLOCO_SCOPE,
1053
+ alias: BASE_APP_TRANSLOCO_SCOPE
1054
+ })],
1055
+ children
1056
+ }];
1057
+ }
1058
+ };
1213
1059
  }
1214
- /** The authored paths as a trie, so a route that is a prefix of another can be recognized as its parent. */
1215
1060
  function trieOf(routes) {
1216
- const roots = [];
1217
- for (const definition of routes ?? []) {
1218
- const segments = segmentsOf(definition.path);
1219
- if (!segments.length)
1220
- continue;
1221
- let level = roots;
1222
- let node = { segment: '', children: roots };
1223
- for (const segment of segments) {
1224
- const existing = level.find((candidate) => candidate.segment === segment);
1225
- node = existing ?? { segment, children: [] };
1226
- if (!existing)
1227
- level.push(node);
1228
- level = node.children;
1229
- }
1230
- // First occurrence wins: a duplicate path is a validation error server-side, so the only way to see
1231
- // one here is a definition that bypassed validation, and dropping the later row is the harmless read.
1232
- node.definition ??= definition;
1233
- }
1234
- return roots;
1061
+ const roots = [];
1062
+ for (const definition of routes ?? []) {
1063
+ const segments = segmentsOf(definition.path);
1064
+ if (!segments.length) continue;
1065
+ let level = roots;
1066
+ let node = {
1067
+ segment: "",
1068
+ children: roots
1069
+ };
1070
+ for (const segment of segments) {
1071
+ const existing = level.find((candidate) => candidate.segment === segment);
1072
+ node = existing ?? {
1073
+ segment,
1074
+ children: []
1075
+ };
1076
+ if (!existing) level.push(node);
1077
+ level = node.children;
1078
+ }
1079
+ node.definition ??= definition;
1080
+ }
1081
+ return roots;
1235
1082
  }
1236
- /**
1237
- * The routes of one level. An authored node becomes a `Route` whose children are emitted below it; an
1238
- * unauthored one contributes its segment to the paths of its descendants instead of a route of its own.
1239
- */
1240
1083
  async function emitLevel(nodes, prefix, renderRoute) {
1241
- const routes = (await Promise.all(nodes.map((node) => emitNode(node, prefix, renderRoute)))).flat();
1242
- return routes.sort((left, right) => staticDepthOf(right.path) - staticDepthOf(left.path));
1084
+ return (await Promise.all(nodes.map((node) => emitNode(node, prefix, renderRoute)))).flat().sort((left, right) => staticDepthOf(right.path) - staticDepthOf(left.path));
1243
1085
  }
1244
1086
  async function emitNode(node, prefix, renderRoute) {
1245
- const path = [...prefix, node.segment];
1246
- if (!node.definition)
1247
- return (await Promise.all(node.children.map((child) => emitNode(child, path, renderRoute)))).flat();
1248
- const authoredChildren = await emitLevel(node.children, [], renderRoute);
1249
- const rendered = await renderRoute(node.definition);
1250
- const route = { ...rendered, path: path.join('/') };
1251
- // The renderer's own children come first and the authored ones after, rather than the authored ones
1252
- // replacing them. An `ENTITY` route contributes the List and Details routes of its entity *and* may be
1253
- // the path prefix of other authored routes; overwriting would silently drop whichever of the two the
1254
- // builder happened not to know about. The renderer's include an empty-path redirect, which `pathMatch:
1255
- // 'full'` confines to the prefix's own URL, so it cannot shadow an authored sibling.
1256
- const children = [...(rendered.children ?? []), ...authoredChildren];
1257
- if (children.length)
1258
- route.children = children;
1259
- return [route];
1087
+ const path = [...prefix, node.segment];
1088
+ if (!node.definition) return (await Promise.all(node.children.map((child) => emitNode(child, path, renderRoute)))).flat();
1089
+ const authoredChildren = await emitLevel(node.children, [], renderRoute);
1090
+ const rendered = await renderRoute(node.definition);
1091
+ const route = {
1092
+ ...rendered,
1093
+ path: path.join("/")
1094
+ };
1095
+ const children = [...rendered.children ?? [], ...authoredChildren];
1096
+ if (children.length) route.children = children;
1097
+ return [route];
1260
1098
  }
1261
1099
  function segmentsOf(path) {
1262
- return (path ?? '').split('/').filter((segment) => segment.length > 0);
1100
+ return (path ?? "").split("/").filter((segment) => segment.length > 0);
1263
1101
  }
1264
- /**
1265
- * How many leading segments of a path are static. Sorting by it descending is what keeps a parameterized
1266
- * route from shadowing its static siblings: `claims/new` scores 2, `claims/:id` scores 1, and Angular
1267
- * matches in the order given.
1268
- */
1269
1102
  function staticDepthOf(path) {
1270
- const segments = segmentsOf(path);
1271
- const firstParameter = segments.findIndex((segment) => segment.startsWith(':') || segment === '**');
1272
- return firstParameter === -1 ? segments.length : firstParameter;
1273
- }
1274
-
1275
- /** Maps widget instances onto rows, dropping the ones a container places by id rather than in sequence. */
1276
- function toWidgetRows(widgets, registry) {
1277
- return (widgets ?? [])
1278
- .filter((widget) => widget.placement !== WidgetPlacement.REFERENCED)
1279
- .map((widget) => {
1280
- const component = registry.get(widget.type);
1281
- return { id: widget.id, type: widget.type, props: widget.props, ...(component ? { component } : {}) };
1282
- });
1283
- }
1284
- /**
1285
- * Renders the top-level widgets shared by routed content and static shell regions.
1286
- *
1287
- * A `WidgetInstance.type` is an open string on the contract and the server checks it for blankness alone —
1288
- * it cannot know which components the hosting application registered. So an unregistered type is a state
1289
- * this component has to render, not one it can rule out: it shows a placeholder naming the type, where
1290
- * throwing would take the whole shell down over one mistyped widget in one region and leave the designer
1291
- * with a blank page instead of a pointer to the row at fault.
1292
- */
1293
- class WidgetListComponent {
1294
- widgets = input([], /* @ts-ignore */
1295
- ...(ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []));
1296
- /** Optional: an application that registers no widget at all renders every instance as a placeholder. */
1297
- registry = inject(WIDGET_REGISTRY, { optional: true }) ?? new Map();
1298
- rows = computed(() => toWidgetRows(this.widgets(), this.registry), /* @ts-ignore */
1299
- ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
1300
- explain(type) {
1301
- return `No component is registered for widget type '${type}' — check the provideWidget() calls of this application.`;
1302
- }
1303
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: WidgetListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1304
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: WidgetListComponent, isStandalone: true, selector: "pp-widget-list", inputs: { widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1305
- @for (row of rows(); track row.id) {
1306
- @if (row.component; as component) {
1307
- <ng-container *ngComponentOutlet="component; inputs: row.props"></ng-container>
1308
- } @else {
1309
- <span class="pp-widget-list__unregistered" [attr.data-testid]="'unregistered-' + row.id" [title]="explain(row.type)">{{ row.type }}</span>
1310
- }
1103
+ const segments = segmentsOf(path);
1104
+ const firstParameter = segments.findIndex((segment) => segment.startsWith(":") || segment === "**");
1105
+ return firstParameter === -1 ? segments.length : firstParameter;
1106
+ }
1107
+ function standaloneWidgets(widgets) {
1108
+ return (widgets ?? []).filter((widget) => widget.placement !== WidgetPlacement.REFERENCED);
1109
+ }
1110
+ var WidgetListComponent = class WidgetListComponent {
1111
+ widgets = input([], ...ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []);
1112
+ rows = computed(() => standaloneWidgets(this.widgets()), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
1113
+ static ɵfac = i0.ɵɵngDeclareFactory({
1114
+ minVersion: "12.0.0",
1115
+ version: "22.1.7",
1116
+ ngImport: i0,
1117
+ type: WidgetListComponent,
1118
+ deps: [],
1119
+ target: i0.ɵɵFactoryTarget.Component
1120
+ });
1121
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1122
+ minVersion: "17.0.0",
1123
+ version: "22.1.7",
1124
+ type: WidgetListComponent,
1125
+ isStandalone: true,
1126
+ selector: "pp-widget-list",
1127
+ inputs: { widgets: {
1128
+ classPropertyName: "widgets",
1129
+ publicName: "widgets",
1130
+ isSignal: true,
1131
+ isRequired: false,
1132
+ transformFunction: null
1133
+ } },
1134
+ ngImport: i0,
1135
+ template: `
1136
+ @for (widget of rows(); track widget.id) {
1137
+ <pp-widget-host [widget]="widget" />
1311
1138
  }
1312
- `, isInline: true, styles: [".pp-widget-list__unregistered{font-style:italic;opacity:.6}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }] });
1313
- }
1314
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: WidgetListComponent, decorators: [{
1315
- type: Component,
1316
- args: [{ selector: 'pp-widget-list', standalone: true, imports: [CommonModule], template: `
1317
- @for (row of rows(); track row.id) {
1318
- @if (row.component; as component) {
1319
- <ng-container *ngComponentOutlet="component; inputs: row.props"></ng-container>
1320
- } @else {
1321
- <span class="pp-widget-list__unregistered" [attr.data-testid]="'unregistered-' + row.id" [title]="explain(row.type)">{{ row.type }}</span>
1322
- }
1139
+ `,
1140
+ isInline: true,
1141
+ dependencies: [{
1142
+ kind: "component",
1143
+ type: WidgetHostComponent,
1144
+ selector: "pp-widget-host",
1145
+ inputs: ["widget", "bindingResolver"],
1146
+ outputs: ["portEmit"]
1147
+ }]
1148
+ });
1149
+ };
1150
+ i0.ɵɵngDeclareClassMetadata({
1151
+ minVersion: "12.0.0",
1152
+ version: "22.1.7",
1153
+ ngImport: i0,
1154
+ type: WidgetListComponent,
1155
+ decorators: [{
1156
+ type: Component,
1157
+ args: [{
1158
+ selector: "pp-widget-list",
1159
+ standalone: true,
1160
+ imports: [WidgetHostComponent],
1161
+ template: `
1162
+ @for (widget of rows(); track widget.id) {
1163
+ <pp-widget-host [widget]="widget" />
1323
1164
  }
1324
- `, styles: [".pp-widget-list__unregistered{font-style:italic;opacity:.6}\n"] }]
1325
- }], propDecorators: { widgets: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgets", required: false }] }] } });
1326
-
1327
- /**
1328
- * Renders a route whose kind is WIDGETS: every STANDALONE instance in order, via NgComponentOutlet
1329
- * resolved against WIDGET_REGISTRY. REFERENCED instances are skipped here for the same reason
1330
- * DocumentEditorComponent skips them at its top level — they're placed by whichever STANDALONE
1331
- * container widget names them in props.childIds, not by this component.
1332
- *
1333
- * Delegates the common widget rendering rule to WidgetListComponent, which is also used by the
1334
- * header and footer regions in the application preview.
1335
- */
1336
- class RouteWidgetsComponent {
1337
- route = inject(ActivatedRoute);
1338
- widgets = this.route.snapshot.data['widgets'] ?? [];
1339
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteWidgetsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1340
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: RouteWidgetsComponent, isStandalone: true, selector: "pp-route-widgets", ngImport: i0, template: `<pp-widget-list [widgets]="widgets" />`, isInline: true, dependencies: [{ kind: "component", type: WidgetListComponent, selector: "pp-widget-list", inputs: ["widgets"] }] });
1341
- }
1342
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteWidgetsComponent, decorators: [{
1343
- type: Component,
1344
- args: [{
1345
- selector: 'pp-route-widgets',
1346
- standalone: true,
1347
- imports: [WidgetListComponent],
1348
- template: `<pp-widget-list [widgets]="widgets" />`,
1349
- }]
1350
- }] });
1351
-
1352
- /**
1353
- * Fallback rendered by {@link AppRouteRenderer} for a route kind it doesn't yet know how to build a
1354
- * real component for (today: DOCUMENT, and any kind value the frontend doesn't recognize). Exists so
1355
- * an unfinished part of the shell fails visibly and specifically at the one route that hits it,
1356
- * rather than throwing during route registration and taking the whole app down, or — worse — silently
1357
- * rendering nothing and leaving a designer to wonder why their route is blank.
1358
- *
1359
- * Not an error state: an app definition is allowed to reference a route kind the frontend hasn't
1360
- * caught up to yet, same spirit as a NavItem naming a route that hasn't been authored being a warning
1361
- * rather than a validation failure elsewhere in this library.
1362
- */
1363
- class RouteUnsupportedComponent {
1364
- route = inject(ActivatedRoute);
1365
- reason = computed(() => this.route.snapshot.data['reason'] ?? 'This route is not yet supported.', /* @ts-ignore */
1366
- ...(ngDevMode ? [{ debugName: "reason" }] : /* istanbul ignore next */ []));
1367
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteUnsupportedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1368
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: RouteUnsupportedComponent, isStandalone: true, selector: "pp-route-unsupported", ngImport: i0, template: `<p class="pp-route-unsupported">{{ reason() }}</p>`, isInline: true });
1369
- }
1370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteUnsupportedComponent, decorators: [{
1371
- type: Component,
1372
- args: [{
1373
- selector: 'pp-route-unsupported',
1374
- standalone: true,
1375
- template: `<p class="pp-route-unsupported">{{ reason() }}</p>`,
1376
- }]
1377
- }] });
1378
-
1379
- /**
1380
- * The route's `title`, preferring `translocoId` over the authored literal where the key resolves.
1381
- *
1382
- * A `ResolveFn` rather than a plain string because a title is resolved per navigation, which is late
1383
- * enough for a lazily-loaded module scope to have arrived — the string form is captured when the route is
1384
- * built, before the scope that owns the key is registered. `translateLabel` falls back to the literal, so
1385
- * a route whose scope is absent or whose key is missing keeps the authored title.
1386
- */
1165
+ `
1166
+ }]
1167
+ }],
1168
+ propDecorators: { widgets: [{
1169
+ type: i0.Input,
1170
+ args: [{
1171
+ isSignal: true,
1172
+ alias: "widgets",
1173
+ required: false
1174
+ }]
1175
+ }] }
1176
+ });
1177
+ var RouteWidgetsComponent = class RouteWidgetsComponent {
1178
+ route = inject(ActivatedRoute);
1179
+ widgets = this.route.snapshot.data["widgets"] ?? [];
1180
+ static ɵfac = i0.ɵɵngDeclareFactory({
1181
+ minVersion: "12.0.0",
1182
+ version: "22.1.7",
1183
+ ngImport: i0,
1184
+ type: RouteWidgetsComponent,
1185
+ deps: [],
1186
+ target: i0.ɵɵFactoryTarget.Component
1187
+ });
1188
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1189
+ minVersion: "14.0.0",
1190
+ version: "22.1.7",
1191
+ type: RouteWidgetsComponent,
1192
+ isStandalone: true,
1193
+ selector: "pp-route-widgets",
1194
+ ngImport: i0,
1195
+ template: `<pp-widget-list [widgets]="widgets" />`,
1196
+ isInline: true,
1197
+ dependencies: [{
1198
+ kind: "component",
1199
+ type: WidgetListComponent,
1200
+ selector: "pp-widget-list",
1201
+ inputs: ["widgets"]
1202
+ }]
1203
+ });
1204
+ };
1205
+ i0.ɵɵngDeclareClassMetadata({
1206
+ minVersion: "12.0.0",
1207
+ version: "22.1.7",
1208
+ ngImport: i0,
1209
+ type: RouteWidgetsComponent,
1210
+ decorators: [{
1211
+ type: Component,
1212
+ args: [{
1213
+ selector: "pp-route-widgets",
1214
+ standalone: true,
1215
+ imports: [WidgetListComponent],
1216
+ template: `<pp-widget-list [widgets]="widgets" />`
1217
+ }]
1218
+ }]
1219
+ });
1220
+ var RouteUnsupportedComponent = class RouteUnsupportedComponent {
1221
+ route = inject(ActivatedRoute);
1222
+ reason = computed(() => this.route.snapshot.data["reason"] ?? "This route is not yet supported.", ...ngDevMode ? [{ debugName: "reason" }] : /* istanbul ignore next */ []);
1223
+ static ɵfac = i0.ɵɵngDeclareFactory({
1224
+ minVersion: "12.0.0",
1225
+ version: "22.1.7",
1226
+ ngImport: i0,
1227
+ type: RouteUnsupportedComponent,
1228
+ deps: [],
1229
+ target: i0.ɵɵFactoryTarget.Component
1230
+ });
1231
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1232
+ minVersion: "14.0.0",
1233
+ version: "22.1.7",
1234
+ type: RouteUnsupportedComponent,
1235
+ isStandalone: true,
1236
+ selector: "pp-route-unsupported",
1237
+ ngImport: i0,
1238
+ template: `<p class="pp-route-unsupported">{{ reason() }}</p>`,
1239
+ isInline: true
1240
+ });
1241
+ };
1242
+ i0.ɵɵngDeclareClassMetadata({
1243
+ minVersion: "12.0.0",
1244
+ version: "22.1.7",
1245
+ ngImport: i0,
1246
+ type: RouteUnsupportedComponent,
1247
+ decorators: [{
1248
+ type: Component,
1249
+ args: [{
1250
+ selector: "pp-route-unsupported",
1251
+ standalone: true,
1252
+ template: `<p class="pp-route-unsupported">{{ reason() }}</p>`
1253
+ }]
1254
+ }]
1255
+ });
1387
1256
  function titleOf(definition) {
1388
- return () => translateLabel(inject(TranslocoService), definition.translocoId, definition.title);
1389
- }
1390
- /**
1391
- * The `RouteRenderer` {@link buildAppRoutes} needs — turns one authored `RouteDefinition` into the
1392
- * `Route` that actually renders it. Owns `component`, `data` and any `children` the kind calls for; `path`
1393
- * is `buildAppRoutes`' to set, and the routes authored *below* this one are appended to whatever children
1394
- * this contributes.
1395
- *
1396
- * A separate injectable rather than a free function because it is the one piece Preview and the eventual
1397
- * production shell must call identically — same reasoning as `buildAppRoutes` itself being free of any
1398
- * component.
1399
- *
1400
- * `roles` -> `canMatch` is deliberately not set here yet — see the note on this design's own deferral of
1401
- * that question. `kind: DOCUMENT` is deliberately unhandled too: `BaseDocumentContainerComponent` is an
1402
- * authoring component wired to one document via an injected store, not something parameterizable by a
1403
- * route's `documentSlug` at runtime. Rendering a document read-only inside a live app is its own small
1404
- * design question and this falls through to {@link RouteUnsupportedComponent} rather than guessing.
1405
- */
1406
- class AppRouteRenderer {
1407
- entityScreens = inject(EntityScreenResolver);
1408
- render = async (definition) => {
1409
- switch (definition.kind) {
1410
- case 'WIDGETS':
1411
- return { component: RouteWidgetsComponent, title: titleOf(definition), data: { widgets: definition.widgets } };
1412
- case 'ENTITY':
1413
- return this.entityRoute(definition);
1414
- case 'DOCUMENT':
1415
- return {
1416
- component: RouteUnsupportedComponent,
1417
- title: titleOf(definition),
1418
- data: { reason: `DOCUMENT routes are not yet supported (route '${definition.path}')` },
1419
- };
1420
- default:
1421
- return {
1422
- component: RouteUnsupportedComponent,
1423
- title: titleOf(definition),
1424
- data: { reason: `Unknown route kind '${String(definition.kind)}' (route '${definition.path}')` },
1425
- };
1426
- }
1427
- };
1428
- /**
1429
- * An `ENTITY` route: base-entity's generated screens, mounted at the authored path.
1430
- *
1431
- * Both halves belong to base-entity and are called rather than reimplemented here: `EntityScreenResolver`
1432
- * answers for an entity with a compile-time facade and for one that exists only as a `BaseEntityDefinition`
1433
- * alike, and `entityScreenRoute` owns the URL shape those screens need. What is left is exactly the
1434
- * *application definition* concern — when the routes are built, the authored title, and the authored
1435
- * `entityMode` / `rsqlFilter`.
1436
- *
1437
- * The descriptor is resolved **before** the route exists, which is what makes the route either complete or
1438
- * a leaf. An entity nothing answers to keeps the leaf, whose component says so at the URL the nav item
1439
- * links to; a legitimate state, since an `AppDefinition` may name an entity that has been renamed or one
1440
- * whose definitions this deployment's backend does not serve.
1441
- *
1442
- * `entityMode` is passed along but not applied. A `DETAILS` route lands on the list, from which the row is
1443
- * one click away: making it open a form directly means carrying the authored route's own `:id` into the
1444
- * child URL, and the `RedirectFunction` that would do it receives a *partial* route snapshot whose
1445
- * parameter inheritance at recognition time is not something to bet a navigation on. Deferred with `roles`
1446
- * and `rsqlFilter` rather than guessed at.
1447
- */
1448
- async entityRoute(definition) {
1449
- const screens = await this.entityScreens.resolve(definition.entityName);
1450
- const route = entityScreenRoute({
1451
- entityName: definition.entityName,
1452
- screens,
1453
- hostPath: definition.path,
1454
- data: { entityMode: definition.entityMode, rsqlFilter: definition.rsqlFilter },
1455
- });
1456
- return { ...route, title: titleOf(definition) };
1457
- }
1458
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1459
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteRenderer, providedIn: 'root' });
1460
- }
1461
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteRenderer, decorators: [{
1462
- type: Injectable,
1463
- args: [{ providedIn: 'root' }]
1464
- }] });
1465
-
1466
- /**
1467
- * A region has a facade like any other entity — that is what gives it a store, and so a working list and
1468
- * form. Its repository reads and writes the `App Definition` document instead of an endpoint of its own,
1469
- * because the contract nests `regions` inside that document.
1470
- */
1471
- class AppRegionFacade extends EmbeddedEntityFacade {
1472
- entityType = RegionDefinition;
1473
- createDescriptor() {
1474
- return createRegionDefinitionDescriptor();
1475
- }
1476
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1477
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionFacade });
1478
- }
1479
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionFacade, decorators: [{
1480
- type: Injectable
1481
- }] });
1482
-
1483
- /**
1484
- * `GET .../app-definitions/{appId}/layout` is a read-only projection for the run-time shell, not a write
1485
- * endpoint — a route is authored inside the `App Definition` document, so its store goes through that
1486
- * document like every other embedded child of the graph.
1487
- */
1488
- class AppRouteFacade extends EmbeddedEntityFacade {
1489
- entityType = RouteDefinition;
1490
- createDescriptor() {
1491
- return createRouteDefinitionDescriptor();
1492
- }
1493
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1494
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteFacade });
1495
- }
1496
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteFacade, decorators: [{
1497
- type: Injectable
1498
- }] });
1499
-
1500
- /**
1501
- * A widget sits under a region, a page or another widget, and one facade serves all three: which owner's
1502
- * rows its store reads is decided by the route that is open, not by the facade.
1503
- */
1504
- class AppWidgetFacade extends EmbeddedEntityFacade {
1505
- entityType = WidgetInstance;
1506
- createDescriptor() {
1507
- return createWidgetInstanceDescriptor();
1508
- }
1509
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppWidgetFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1510
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppWidgetFacade });
1511
- }
1512
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppWidgetFacade, decorators: [{
1513
- type: Injectable
1514
- }] });
1515
-
1516
- /**
1517
- * `sidenav-left` because a definition that declares no preset is the common case — a freshly created
1518
- * app — and the framework's own screens are left-sidenav. The same value the contract documents as
1519
- * its default.
1520
- */
1521
- const DEFAULT_PRESET = 'sidenav-left';
1522
- /** Matches the contract's default and Material's own, so an unset value behaves as `mat-sidenav` does. */
1523
- const DEFAULT_SIDENAV_MODE = 'side';
1524
- /**
1525
- * Resolves the layout of one definition.
1526
- *
1527
- * Each field is read from the flattened property first and from `layout` second. For an entity that
1528
- * came through {@link AppDefinitionMapper} the two always agree — `fromDto` copies `layout.preset`
1529
- * onto `preset`, and `toDto` merges the flattened value back — so the fallback is there for the
1530
- * definitions nothing mapped: `new AppDefinition({ layout: { preset: 'top-nav' } })` is a legal
1531
- * construction that leaves `preset` undefined, and a shell that ignored `layout` would silently
1532
- * render the default instead.
1533
- *
1534
- * `sidenavCollapsible` and `sidenavOpenByDefault` need no such fallback: they are non-optional on the
1535
- * entity and the constructor defaults them, so there is always a value to read.
1536
- */
1257
+ return () => translateLabel(inject(TranslocoService), definition.translocoId, definition.title);
1258
+ }
1259
+ var AppRouteRenderer = class AppRouteRenderer {
1260
+ entityScreens = inject(EntityScreenResolver);
1261
+ render = async (definition) => {
1262
+ switch (definition.kind) {
1263
+ case "WIDGETS": return {
1264
+ component: RouteWidgetsComponent,
1265
+ title: titleOf(definition),
1266
+ data: { widgets: definition.widgets }
1267
+ };
1268
+ case "ENTITY": return this.entityRoute(definition);
1269
+ case "DOCUMENT": return {
1270
+ component: RouteUnsupportedComponent,
1271
+ title: titleOf(definition),
1272
+ data: { reason: `DOCUMENT routes are not yet supported (route '${definition.path}')` }
1273
+ };
1274
+ default: return {
1275
+ component: RouteUnsupportedComponent,
1276
+ title: titleOf(definition),
1277
+ data: { reason: `Unknown route kind '${String(definition.kind)}' (route '${definition.path}')` }
1278
+ };
1279
+ }
1280
+ };
1281
+ async entityRoute(definition) {
1282
+ const screens = await this.entityScreens.resolve(definition.entityName);
1283
+ return {
1284
+ ...entityScreenRoute({
1285
+ entityName: definition.entityName,
1286
+ screens,
1287
+ hostPath: definition.path,
1288
+ data: {
1289
+ entityMode: definition.entityMode,
1290
+ rsqlFilter: definition.rsqlFilter
1291
+ }
1292
+ }),
1293
+ title: titleOf(definition)
1294
+ };
1295
+ }
1296
+ static ɵfac = i0.ɵɵngDeclareFactory({
1297
+ minVersion: "12.0.0",
1298
+ version: "22.1.7",
1299
+ ngImport: i0,
1300
+ type: AppRouteRenderer,
1301
+ deps: [],
1302
+ target: i0.ɵɵFactoryTarget.Injectable
1303
+ });
1304
+ static ɵprov = i0.ɵɵngDeclareInjectable({
1305
+ minVersion: "12.0.0",
1306
+ version: "22.1.7",
1307
+ ngImport: i0,
1308
+ type: AppRouteRenderer,
1309
+ providedIn: "root"
1310
+ });
1311
+ };
1312
+ i0.ɵɵngDeclareClassMetadata({
1313
+ minVersion: "12.0.0",
1314
+ version: "22.1.7",
1315
+ ngImport: i0,
1316
+ type: AppRouteRenderer,
1317
+ decorators: [{
1318
+ type: Injectable,
1319
+ args: [{ providedIn: "root" }]
1320
+ }]
1321
+ });
1322
+ var AppRegionFacade = class AppRegionFacade extends EmbeddedEntityFacade {
1323
+ entityType = RegionDefinition;
1324
+ createDescriptor() {
1325
+ return createRegionDefinitionDescriptor();
1326
+ }
1327
+ static ɵfac = i0.ɵɵngDeclareFactory({
1328
+ minVersion: "12.0.0",
1329
+ version: "22.1.7",
1330
+ ngImport: i0,
1331
+ type: AppRegionFacade,
1332
+ deps: null,
1333
+ target: i0.ɵɵFactoryTarget.Injectable
1334
+ });
1335
+ static ɵprov = i0.ɵɵngDeclareInjectable({
1336
+ minVersion: "12.0.0",
1337
+ version: "22.1.7",
1338
+ ngImport: i0,
1339
+ type: AppRegionFacade
1340
+ });
1341
+ };
1342
+ i0.ɵɵngDeclareClassMetadata({
1343
+ minVersion: "12.0.0",
1344
+ version: "22.1.7",
1345
+ ngImport: i0,
1346
+ type: AppRegionFacade,
1347
+ decorators: [{ type: Injectable }]
1348
+ });
1349
+ var AppRouteFacade = class AppRouteFacade extends EmbeddedEntityFacade {
1350
+ entityType = RouteDefinition;
1351
+ createDescriptor() {
1352
+ return createRouteDefinitionDescriptor();
1353
+ }
1354
+ static ɵfac = i0.ɵɵngDeclareFactory({
1355
+ minVersion: "12.0.0",
1356
+ version: "22.1.7",
1357
+ ngImport: i0,
1358
+ type: AppRouteFacade,
1359
+ deps: null,
1360
+ target: i0.ɵɵFactoryTarget.Injectable
1361
+ });
1362
+ static ɵprov = i0.ɵɵngDeclareInjectable({
1363
+ minVersion: "12.0.0",
1364
+ version: "22.1.7",
1365
+ ngImport: i0,
1366
+ type: AppRouteFacade
1367
+ });
1368
+ };
1369
+ i0.ɵɵngDeclareClassMetadata({
1370
+ minVersion: "12.0.0",
1371
+ version: "22.1.7",
1372
+ ngImport: i0,
1373
+ type: AppRouteFacade,
1374
+ decorators: [{ type: Injectable }]
1375
+ });
1376
+ var AppWidgetFacade = class AppWidgetFacade extends EmbeddedEntityFacade {
1377
+ entityType = WidgetInstance;
1378
+ createDescriptor() {
1379
+ return createWidgetInstanceDescriptor();
1380
+ }
1381
+ static ɵfac = i0.ɵɵngDeclareFactory({
1382
+ minVersion: "12.0.0",
1383
+ version: "22.1.7",
1384
+ ngImport: i0,
1385
+ type: AppWidgetFacade,
1386
+ deps: null,
1387
+ target: i0.ɵɵFactoryTarget.Injectable
1388
+ });
1389
+ static ɵprov = i0.ɵɵngDeclareInjectable({
1390
+ minVersion: "12.0.0",
1391
+ version: "22.1.7",
1392
+ ngImport: i0,
1393
+ type: AppWidgetFacade
1394
+ });
1395
+ };
1396
+ i0.ɵɵngDeclareClassMetadata({
1397
+ minVersion: "12.0.0",
1398
+ version: "22.1.7",
1399
+ ngImport: i0,
1400
+ type: AppWidgetFacade,
1401
+ decorators: [{ type: Injectable }]
1402
+ });
1403
+ const DEFAULT_PRESET = "sidenav-left";
1404
+ const DEFAULT_SIDENAV_MODE = "side";
1537
1405
  function layoutOf(definition) {
1538
- const preset = definition?.preset ?? definition?.layout?.preset ?? DEFAULT_PRESET;
1539
- return {
1540
- preset,
1541
- sidenavMode: definition?.sidenavMode ?? definition?.layout?.sidenavMode ?? DEFAULT_SIDENAV_MODE,
1542
- sidenavPosition: preset === 'sidenav-right' ? 'end' : 'start',
1543
- hasSidenav: preset !== 'top-nav',
1544
- sidenavOpened: definition?.sidenavOpenByDefault ?? true,
1545
- sidenavCollapsible: definition?.sidenavCollapsible ?? true,
1546
- contentMaxWidth: definition?.contentMaxWidth ?? definition?.layout?.contentMaxWidth,
1547
- };
1406
+ const preset = definition?.preset ?? definition?.layout?.preset ?? DEFAULT_PRESET;
1407
+ return {
1408
+ preset,
1409
+ sidenavMode: definition?.sidenavMode ?? definition?.layout?.sidenavMode ?? DEFAULT_SIDENAV_MODE,
1410
+ sidenavPosition: preset === "sidenav-right" ? "end" : "start",
1411
+ hasSidenav: preset !== "top-nav",
1412
+ sidenavOpened: definition?.sidenavOpenByDefault ?? true,
1413
+ sidenavCollapsible: definition?.sidenavCollapsible ?? true,
1414
+ contentMaxWidth: definition?.contentMaxWidth ?? definition?.layout?.contentMaxWidth
1415
+ };
1548
1416
  }
1549
- /**
1550
- * The `--pp-*` overrides of one definition, as a style object to bind on the shell's host element.
1551
- *
1552
- * Custom properties cascade, so setting them on one element re-tints every framework surface below it
1553
- * — which is what makes a themed preview possible at all without an iframe. `materialTheme` and
1554
- * `colorScheme` are deliberately **not** handled: those want `:root` and a Material theme class, and
1555
- * neither scopes to a subtree. They belong to the standalone runtime host, where the shell owns the
1556
- * document.
1557
- *
1558
- * Keys are passed through untouched, including their leading `--`: Angular's `[style]` binding treats
1559
- * a custom property as a custom property, and the contract calls these overrides of the tokens in
1560
- * `pp-colors.css`, so anything else would be this function inventing a naming rule.
1561
- */
1562
1417
  function themeVarsOf(definition) {
1563
- // The nested object first, so an override the form actually edited wins over the one the server sent.
1564
- return { ...definition?.theme?.tokenOverrides, ...definition?.tokenOverrides };
1418
+ return {
1419
+ ...definition?.theme?.tokenOverrides,
1420
+ ...definition?.tokenOverrides
1421
+ };
1565
1422
  }
1566
- /**
1567
- * The route paths this definition accounts for: its own routes' paths, plus the base path of every module
1568
- * it mounts.
1569
- *
1570
- * A module's *own* routes are deliberately absent. They live in the module's definition, which the router
1571
- * fetches only when something navigates into the mount, so they cannot be known here — which is why the
1572
- * consumer of this list treats a path *below* a known one as accounted for. See `toNavRows`.
1573
- */
1574
1423
  function knownRoutePathsOf(definition) {
1575
- const declared = (definition?.routes ?? []).map((route) => route.path);
1576
- const mounted = (definition?.modules ?? []).map((mount) => mount.basePath);
1577
- return [...declared, ...mounted].filter((path) => !!path);
1578
- }
1579
- /** The scheme a definition that names none is rendered in, matching the contract's own default. */
1580
- const DEFAULT_COLOR_SCHEME = 'light';
1581
- /**
1582
- * Which of the scoped Material themes in `app-shell.component.scss` the shell should wear, as the class
1583
- * names that select it — `pp-theme-<materialTheme> pp-scheme-<colorScheme>`.
1584
- *
1585
- * **Empty unless a `materialTheme` is named.** A `colorScheme` on its own would be half a theme: it
1586
- * decides which side of the stylesheet's `light-dark()` values is used, and with no theme block applied
1587
- * there are none — so it would flip native controls to dark while every Material component kept the
1588
- * surrounding application's colours. Inheriting the host's theme untouched is the honest reading of a
1589
- * definition that has not chosen one, and matches the shell's rule of never inventing what was not
1590
- * authored.
1591
- */
1592
- function themeClassOf(definition) {
1593
- const materialTheme = definition?.materialTheme ?? definition?.theme?.materialTheme;
1594
- if (!materialTheme)
1595
- return '';
1596
- const colorScheme = definition?.colorScheme ?? definition?.theme?.colorScheme ?? DEFAULT_COLOR_SCHEME;
1597
- return `pp-theme-${materialTheme} pp-scheme-${colorScheme}`;
1598
- }
1599
-
1600
- /**
1601
- * The `footer` region: the widgets it declares, and nothing else. The contract gives a footer no field
1602
- * beyond `widgets`, so this stays a thin styled host over {@link WidgetListComponent} — separate from
1603
- * the header only because the two are different slots with different styling, not because they share
1604
- * no logic.
1605
- */
1606
- class RegionFooterComponent {
1607
- widgets = input([], /* @ts-ignore */
1608
- ...(ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []));
1609
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1610
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: RegionFooterComponent, isStandalone: true, selector: "pp-region-footer", inputs: { widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<pp-widget-list [widgets]="widgets()" />`, isInline: true, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;gap:16px;justify-content:space-between;padding:8px 16px}pp-widget-list{align-items:center;display:flex;gap:8px}\n"], dependencies: [{ kind: "component", type: WidgetListComponent, selector: "pp-widget-list", inputs: ["widgets"] }] });
1611
- }
1612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionFooterComponent, decorators: [{
1613
- type: Component,
1614
- args: [{ selector: 'pp-region-footer', standalone: true, imports: [WidgetListComponent], template: `<pp-widget-list [widgets]="widgets()" />`, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;gap:16px;justify-content:space-between;padding:8px 16px}pp-widget-list{align-items:center;display:flex;gap:8px}\n"] }]
1615
- }], propDecorators: { widgets: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgets", required: false }] }] } });
1616
-
1617
- /**
1618
- * The `header` region: the application's brand block and the widgets the region declares.
1619
- *
1620
- * The brand is the shell's contribution rather than the region's — `logoUrl` and the title come from
1621
- * the definition's theme and name, not from anything authored on the region — which is why they are
1622
- * inputs the renderer fills instead of something this component reaches into a store for. That keeps
1623
- * it renderable from a spec with three inputs and no providers.
1624
- *
1625
- * Nav items are *not* handled here. Under the `top-nav` preset the shell places the `sidenav` region's
1626
- * nav beside this component in the same row, so that a `top-nav` app with no header region is still
1627
- * navigable — see {@link AppShellComponent}.
1628
- */
1629
- class RegionHeaderComponent {
1630
- title = input('', /* @ts-ignore */
1631
- ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
1632
- logoUrl = input(undefined, /* @ts-ignore */
1633
- ...(ngDevMode ? [{ debugName: "logoUrl" }] : /* istanbul ignore next */ []));
1634
- widgets = input([], /* @ts-ignore */
1635
- ...(ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []));
1636
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1637
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: RegionHeaderComponent, isStandalone: true, selector: "pp-region-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, logoUrl: { classPropertyName: "logoUrl", publicName: "logoUrl", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1638
- <div class="pp-region-header__brand">
1639
- @if (logoUrl(); as logo) {
1640
- <img class="pp-region-header__logo" [src]="logo" [alt]="title()" />
1641
- }
1642
- <h2 class="pp-region-header__title">{{ title() }}</h2>
1643
- </div>
1644
- <pp-widget-list [widgets]="widgets()" />
1645
- `, isInline: true, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;flex:1;gap:16px;justify-content:space-between;padding:8px 16px}.pp-region-header__brand{align-items:center;display:flex;gap:12px;min-width:0}.pp-region-header__logo{display:block;max-height:48px;max-width:160px;object-fit:contain}.pp-region-header__title{margin:0}pp-widget-list{align-items:center;display:flex;gap:8px}\n"], dependencies: [{ kind: "component", type: WidgetListComponent, selector: "pp-widget-list", inputs: ["widgets"] }] });
1646
- }
1647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionHeaderComponent, decorators: [{
1648
- type: Component,
1649
- args: [{ selector: 'pp-region-header', standalone: true, imports: [WidgetListComponent], template: `
1650
- <div class="pp-region-header__brand">
1651
- @if (logoUrl(); as logo) {
1652
- <img class="pp-region-header__logo" [src]="logo" [alt]="title()" />
1653
- }
1654
- <h2 class="pp-region-header__title">{{ title() }}</h2>
1655
- </div>
1656
- <pp-widget-list [widgets]="widgets()" />
1657
- `, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;flex:1;gap:16px;justify-content:space-between;padding:8px 16px}.pp-region-header__brand{align-items:center;display:flex;gap:12px;min-width:0}.pp-region-header__logo{display:block;max-height:48px;max-width:160px;object-fit:contain}.pp-region-header__title{margin:0}pp-widget-list{align-items:center;display:flex;gap:8px}\n"] }]
1658
- }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], logoUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoUrl", required: false }] }], widgets: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgets", required: false }] }] } });
1659
-
1660
- /**
1661
- * Maps the authored nav tree onto rows, resolving each `routePath` against the paths the definition
1662
- * accounts for.
1663
- *
1664
- * A path counts as resolved if it equals a declared route's path *or* sits below one — below a declared
1665
- * route, or below a mounted module's base path. The prefix rule is what keeps this from crying wolf: the
1666
- * routes inside a module live in the module's own definition, which is fetched lazily and is not knowable
1667
- * here, so `back-office/lines` has to be trusted on the strength of the `back-office` mount alone.
1668
- *
1669
- * A group node — no `routePath`, children instead — is not unresolved. It expands rather than navigates.
1670
- */
1424
+ const declared = (definition?.routes ?? []).map((route) => route.path);
1425
+ const mounted = (definition?.modules ?? []).map((mount) => mount.basePath);
1426
+ return [...declared, ...mounted].filter((path) => !!path);
1427
+ }
1428
+ function themeDefaultsOf(definition) {
1429
+ const preset = definition?.materialTheme ?? definition?.theme?.materialTheme;
1430
+ const scheme = definition?.colorScheme ?? definition?.theme?.colorScheme;
1431
+ return {
1432
+ ...preset ? { preset } : {},
1433
+ ...scheme ? { scheme } : {}
1434
+ };
1435
+ }
1436
+ var RegionFooterComponent = class RegionFooterComponent {
1437
+ widgets = input([], ...ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []);
1438
+ static ɵfac = i0.ɵɵngDeclareFactory({
1439
+ minVersion: "12.0.0",
1440
+ version: "22.1.7",
1441
+ ngImport: i0,
1442
+ type: RegionFooterComponent,
1443
+ deps: [],
1444
+ target: i0.ɵɵFactoryTarget.Component
1445
+ });
1446
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1447
+ minVersion: "17.1.0",
1448
+ version: "22.1.7",
1449
+ type: RegionFooterComponent,
1450
+ isStandalone: true,
1451
+ selector: "pp-region-footer",
1452
+ inputs: { widgets: {
1453
+ classPropertyName: "widgets",
1454
+ publicName: "widgets",
1455
+ isSignal: true,
1456
+ isRequired: false,
1457
+ transformFunction: null
1458
+ } },
1459
+ ngImport: i0,
1460
+ template: `<pp-widget-list [widgets]="widgets()" />`,
1461
+ isInline: true,
1462
+ styles: [":host{align-items:center;background-color:var(--pp-surface-header);color:var(--pp-on-header);display:flex;gap:16px;justify-content:space-between;padding:8px 16px}pp-widget-list{align-items:center;display:flex;gap:8px}\n"],
1463
+ dependencies: [{
1464
+ kind: "component",
1465
+ type: WidgetListComponent,
1466
+ selector: "pp-widget-list",
1467
+ inputs: ["widgets"]
1468
+ }]
1469
+ });
1470
+ };
1471
+ i0.ɵɵngDeclareClassMetadata({
1472
+ minVersion: "12.0.0",
1473
+ version: "22.1.7",
1474
+ ngImport: i0,
1475
+ type: RegionFooterComponent,
1476
+ decorators: [{
1477
+ type: Component,
1478
+ args: [{
1479
+ selector: "pp-region-footer",
1480
+ standalone: true,
1481
+ imports: [WidgetListComponent],
1482
+ template: `<pp-widget-list [widgets]="widgets()" />`,
1483
+ styles: [":host{align-items:center;background-color:var(--pp-surface-header);color:var(--pp-on-header);display:flex;gap:16px;justify-content:space-between;padding:8px 16px}pp-widget-list{align-items:center;display:flex;gap:8px}\n"]
1484
+ }]
1485
+ }],
1486
+ propDecorators: { widgets: [{
1487
+ type: i0.Input,
1488
+ args: [{
1489
+ isSignal: true,
1490
+ alias: "widgets",
1491
+ required: false
1492
+ }]
1493
+ }] }
1494
+ });
1495
+ var RegionHeaderComponent = class RegionHeaderComponent {
1496
+ widgets = input([], ...ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []);
1497
+ static ɵfac = i0.ɵɵngDeclareFactory({
1498
+ minVersion: "12.0.0",
1499
+ version: "22.1.7",
1500
+ ngImport: i0,
1501
+ type: RegionHeaderComponent,
1502
+ deps: [],
1503
+ target: i0.ɵɵFactoryTarget.Component
1504
+ });
1505
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1506
+ minVersion: "17.1.0",
1507
+ version: "22.1.7",
1508
+ type: RegionHeaderComponent,
1509
+ isStandalone: true,
1510
+ selector: "pp-region-header",
1511
+ inputs: { widgets: {
1512
+ classPropertyName: "widgets",
1513
+ publicName: "widgets",
1514
+ isSignal: true,
1515
+ isRequired: false,
1516
+ transformFunction: null
1517
+ } },
1518
+ ngImport: i0,
1519
+ template: `<pp-widget-list [widgets]="widgets()" />`,
1520
+ isInline: true,
1521
+ styles: [":host{--pp-app-title-color: var(--pp-on-header, inherit);background-color:var(--pp-surface-header);color:var(--pp-on-header);align-items:center;display:flex;flex:1;padding:8px 16px}pp-widget-list{align-items:center;display:flex;flex:1;gap:8px;min-width:0}\n"],
1522
+ dependencies: [{
1523
+ kind: "component",
1524
+ type: WidgetListComponent,
1525
+ selector: "pp-widget-list",
1526
+ inputs: ["widgets"]
1527
+ }]
1528
+ });
1529
+ };
1530
+ i0.ɵɵngDeclareClassMetadata({
1531
+ minVersion: "12.0.0",
1532
+ version: "22.1.7",
1533
+ ngImport: i0,
1534
+ type: RegionHeaderComponent,
1535
+ decorators: [{
1536
+ type: Component,
1537
+ args: [{
1538
+ selector: "pp-region-header",
1539
+ standalone: true,
1540
+ imports: [WidgetListComponent],
1541
+ template: `<pp-widget-list [widgets]="widgets()" />`,
1542
+ styles: [":host{--pp-app-title-color: var(--pp-on-header, inherit);background-color:var(--pp-surface-header);color:var(--pp-on-header);align-items:center;display:flex;flex:1;padding:8px 16px}pp-widget-list{align-items:center;display:flex;flex:1;gap:8px;min-width:0}\n"]
1543
+ }]
1544
+ }],
1545
+ propDecorators: { widgets: [{
1546
+ type: i0.Input,
1547
+ args: [{
1548
+ isSignal: true,
1549
+ alias: "widgets",
1550
+ required: false
1551
+ }]
1552
+ }] }
1553
+ });
1671
1554
  function toNavRows(items, knownPaths) {
1672
- return (items ?? []).map((item) => {
1673
- const routePath = normalize(item.routePath);
1674
- const resolved = routePath !== undefined && knownPaths.some((known) => routePath === known || routePath.startsWith(`${known}/`));
1675
- return {
1676
- id: item.id,
1677
- label: item.label,
1678
- translocoId: item.translocoId,
1679
- icon: item.icon,
1680
- ...(resolved ? { routePath } : {}),
1681
- unresolved: routePath !== undefined && !resolved,
1682
- children: toNavRows(item.children, knownPaths),
1683
- };
1684
- });
1555
+ return (items ?? []).map((item) => {
1556
+ const routePath = normalize(item.routePath);
1557
+ const resolved = routePath !== void 0 && knownPaths.some((known) => routePath === known || routePath.startsWith(`${known}/`));
1558
+ return {
1559
+ id: item.id,
1560
+ label: item.label,
1561
+ translocoId: item.translocoId,
1562
+ icon: item.icon,
1563
+ ...resolved ? { routePath } : {},
1564
+ unresolved: routePath !== void 0 && !resolved,
1565
+ children: toNavRows(item.children, knownPaths)
1566
+ };
1567
+ });
1685
1568
  }
1686
- /**
1687
- * A route path as it is compared and linked: no surrounding slashes, since `RouteDefinition.path` is
1688
- * relative with no leading slash by contract and a nav item may still have been authored with one.
1689
- * Whitespace-only counts as absent — an item mid-authoring is a group node, not a broken link.
1690
- */
1691
1569
  function normalize(routePath) {
1692
- const trimmed = routePath?.trim().replace(/^\/+|\/+$/g, '').trim();
1693
- return trimmed ? trimmed : undefined;
1694
- }
1695
- /**
1696
- * Renders the nav tree of the `sidenav` region — in the sidenav for the two sidenav presets, and
1697
- * horizontally in the header row for `top-nav`. One component for both, because the tree and its
1698
- * grouping rules are the same either way and only the axis differs.
1699
- *
1700
- * Links are relative, which is what makes the same component work in the designer's Preview tab and in a
1701
- * standalone deployment: `routerLink="orders"` resolves against whichever route hosts the shell, so it
1702
- * becomes `…/app-definition/demo/preview/orders` under the designer and `/orders` under a runtime host,
1703
- * with nothing here needing to know which.
1704
- *
1705
- * An item whose target nothing accounts for is rendered as an inert row with a title, not as a link that
1706
- * would navigate into a 404. A dangling `routePath` is a *warning* server-side by design — it may name a
1707
- * route of a module authored later — so the shell has to render it as something rather than reject it.
1708
- *
1709
- * `translocoId` is preferred over `label` where it resolves, through the impure `ppLabel` pipe — so a row
1710
- * shows the authored literal until the scope that owns its key has loaded, then re-renders. A nav label is
1711
- * *tenant* content living under a module's own scope, which for an authored module is served by the
1712
- * backend rather than shipped as an asset; `ppLabel` falling back is the normal case, not a defect.
1713
- */
1714
- class RegionNavComponent {
1715
- navItems = input([], /* @ts-ignore */
1716
- ...(ngDevMode ? [{ debugName: "navItems" }] : /* istanbul ignore next */ []));
1717
- orientation = input('vertical', /* @ts-ignore */
1718
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
1719
- /** Route paths the definition accounts for, supplied by `AppRegionRenderer`. See {@link toNavRows}. */
1720
- knownPaths = input([], /* @ts-ignore */
1721
- ...(ngDevMode ? [{ debugName: "knownPaths" }] : /* istanbul ignore next */ []));
1722
- rows = computed(() => toNavRows(this.navItems(), this.knownPaths()), /* @ts-ignore */
1723
- ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
1724
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionNavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1725
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: RegionNavComponent, isStandalone: true, selector: "pp-region-nav", inputs: { navItems: { classPropertyName: "navItems", publicName: "navItems", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, knownPaths: { classPropertyName: "knownPaths", publicName: "knownPaths", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1726
- <mat-nav-list [class.pp-region-nav--horizontal]="orientation() === 'horizontal'">
1727
- <ng-container *ngTemplateOutlet="rowList; context: { $implicit: rows(), depth: 0 }"></ng-container>
1728
- </mat-nav-list>
1570
+ const trimmed = routePath?.trim().replace(/^\/+|\/+$/g, "").trim();
1571
+ return trimmed ? trimmed : void 0;
1572
+ }
1573
+ var RegionNavComponent = class RegionNavComponent {
1574
+ navItems = input([], ...ngDevMode ? [{ debugName: "navItems" }] : /* istanbul ignore next */ []);
1575
+ orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
1576
+ compact = input(false, ...ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []);
1577
+ knownPaths = input([], ...ngDevMode ? [{ debugName: "knownPaths" }] : /* istanbul ignore next */ []);
1578
+ rows = computed(() => toNavRows(this.navItems(), this.knownPaths()), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
1579
+ static ɵfac = i0.ɵɵngDeclareFactory({
1580
+ minVersion: "12.0.0",
1581
+ version: "22.1.7",
1582
+ ngImport: i0,
1583
+ type: RegionNavComponent,
1584
+ deps: [],
1585
+ target: i0.ɵɵFactoryTarget.Component
1586
+ });
1587
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1588
+ minVersion: "17.0.0",
1589
+ version: "22.1.7",
1590
+ type: RegionNavComponent,
1591
+ isStandalone: true,
1592
+ selector: "pp-region-nav",
1593
+ inputs: {
1594
+ navItems: {
1595
+ classPropertyName: "navItems",
1596
+ publicName: "navItems",
1597
+ isSignal: true,
1598
+ isRequired: false,
1599
+ transformFunction: null
1600
+ },
1601
+ orientation: {
1602
+ classPropertyName: "orientation",
1603
+ publicName: "orientation",
1604
+ isSignal: true,
1605
+ isRequired: false,
1606
+ transformFunction: null
1607
+ },
1608
+ compact: {
1609
+ classPropertyName: "compact",
1610
+ publicName: "compact",
1611
+ isSignal: true,
1612
+ isRequired: false,
1613
+ transformFunction: null
1614
+ },
1615
+ knownPaths: {
1616
+ classPropertyName: "knownPaths",
1617
+ publicName: "knownPaths",
1618
+ isSignal: true,
1619
+ isRequired: false,
1620
+ transformFunction: null
1621
+ }
1622
+ },
1623
+ ngImport: i0,
1624
+ template: `
1625
+ @if (compact()) {
1626
+ <nav class="pp-region-nav--compact">
1627
+ <ng-container *ngTemplateOutlet="compactRowList; context: { $implicit: rows() }"></ng-container>
1628
+ </nav>
1629
+ } @else {
1630
+ <mat-nav-list [class.pp-region-nav--horizontal]="orientation() === 'horizontal'">
1631
+ <ng-container *ngTemplateOutlet="rowList; context: { $implicit: rows(), depth: 0 }"></ng-container>
1632
+ </mat-nav-list>
1633
+ }
1729
1634
 
1730
1635
  <!--
1731
1636
  Recursive through ngTemplateOutlet: a NavItem nests in itself, so the depth is not knowable here.
@@ -1773,14 +1678,145 @@ class RegionNavComponent {
1773
1678
  }
1774
1679
  }
1775
1680
  </ng-template>
1776
- `, isInline: true, styles: [":host{display:block}.pp-region-nav--horizontal{display:flex;padding-top:0}.pp-region-nav--horizontal .pp-region-nav__item{width:auto}.pp-region-nav__item--unresolved{font-style:italic;opacity:.6}\n"], dependencies: [{ kind: "component", type: MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: MatListItemIcon, selector: "[matListItemIcon]" }, { kind: "directive", type: MatListItemTitle, selector: "[matListItemTitle]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "pipe", type: EntityLabelPipe, name: "ppLabel" }] });
1777
- }
1778
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionNavComponent, decorators: [{
1779
- type: Component,
1780
- args: [{ selector: 'pp-region-nav', standalone: true, imports: [MatNavList, MatListItem, MatListItemIcon, MatListItemTitle, NgTemplateOutlet, RouterLink, RouterLinkActive, EntityLabelPipe], template: `
1781
- <mat-nav-list [class.pp-region-nav--horizontal]="orientation() === 'horizontal'">
1782
- <ng-container *ngTemplateOutlet="rowList; context: { $implicit: rows(), depth: 0 }"></ng-container>
1783
- </mat-nav-list>
1681
+ <!--
1682
+ The compact rows of a tablet layout: the icon above a short label, so the drawer — which is sized to its
1683
+ content — narrows to a rail. Plain elements rather than list items, whose fixed height and leading-icon
1684
+ slot are exactly the row layout this replaces. Nesting is shown by order alone; a rail has no room for
1685
+ indentation.
1686
+ -->
1687
+ <ng-template #compactRowList let-rows>
1688
+ @for (row of rows; track row.id) {
1689
+ @if (row.routePath; as routePath) {
1690
+ <a class="pp-region-nav__compact-item" [routerLink]="routePath" routerLinkActive="pp-region-nav__item--active" [attr.data-testid]="'nav-' + row.id">
1691
+ @if (row.icon) {
1692
+ <span class="material-symbols-outlined pp-region-nav__compact-icon">{{ row.icon }}</span>
1693
+ }
1694
+ <span class="pp-region-nav__compact-label">{{ row.translocoId | ppLabel: row.label }}</span>
1695
+ </a>
1696
+ } @else {
1697
+ <span
1698
+ class="pp-region-nav__compact-item"
1699
+ [class.pp-region-nav__item--unresolved]="row.unresolved"
1700
+ [title]="row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''"
1701
+ [attr.data-testid]="'nav-' + row.id"
1702
+ >
1703
+ @if (row.icon) {
1704
+ <span class="material-symbols-outlined pp-region-nav__compact-icon">{{ row.icon }}</span>
1705
+ }
1706
+ <span class="pp-region-nav__compact-label">{{ row.translocoId | ppLabel: row.label }}</span>
1707
+ </span>
1708
+ }
1709
+ @if (row.children.length) {
1710
+ <ng-container *ngTemplateOutlet="compactRowList; context: { $implicit: row.children }"></ng-container>
1711
+ }
1712
+ }
1713
+ </ng-template>
1714
+ `,
1715
+ isInline: true,
1716
+ styles: [":host{display:block}.pp-region-nav--horizontal{display:flex;padding-top:0}.pp-region-nav--horizontal .pp-region-nav__item{width:auto}.pp-region-nav--compact{display:flex;flex-direction:column;gap:4px;padding:8px 4px}.pp-region-nav__compact-item{align-items:center;border-radius:8px;color:inherit;display:flex;flex-direction:column;gap:2px;padding:6px 4px;text-decoration:none}a.pp-region-nav__compact-item:hover,.pp-region-nav__compact-item.pp-region-nav__item--active{background-color:color-mix(in srgb,currentColor 12%,transparent)}.pp-region-nav__compact-label{font:var(--mat-sys-label-small);max-width:80px;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.pp-region-nav__item--unresolved{font-style:italic;opacity:.6}\n"],
1717
+ dependencies: [
1718
+ {
1719
+ kind: "component",
1720
+ type: MatNavList,
1721
+ selector: "mat-nav-list",
1722
+ exportAs: ["matNavList"]
1723
+ },
1724
+ {
1725
+ kind: "component",
1726
+ type: MatListItem,
1727
+ selector: "mat-list-item, a[mat-list-item], button[mat-list-item]",
1728
+ inputs: ["activated"],
1729
+ exportAs: ["matListItem"]
1730
+ },
1731
+ {
1732
+ kind: "directive",
1733
+ type: MatListItemIcon,
1734
+ selector: "[matListItemIcon]"
1735
+ },
1736
+ {
1737
+ kind: "directive",
1738
+ type: MatListItemTitle,
1739
+ selector: "[matListItemTitle]"
1740
+ },
1741
+ {
1742
+ kind: "directive",
1743
+ type: NgTemplateOutlet,
1744
+ selector: "[ngTemplateOutlet]",
1745
+ inputs: [
1746
+ "ngTemplateOutletContext",
1747
+ "ngTemplateOutlet",
1748
+ "ngTemplateOutletInjector"
1749
+ ]
1750
+ },
1751
+ {
1752
+ kind: "directive",
1753
+ type: RouterLink,
1754
+ selector: "[routerLink]",
1755
+ inputs: [
1756
+ "target",
1757
+ "queryParams",
1758
+ "fragment",
1759
+ "queryParamsHandling",
1760
+ "state",
1761
+ "info",
1762
+ "relativeTo",
1763
+ "preserveFragment",
1764
+ "skipLocationChange",
1765
+ "replaceUrl",
1766
+ "browserUrl",
1767
+ "routerLink"
1768
+ ]
1769
+ },
1770
+ {
1771
+ kind: "directive",
1772
+ type: RouterLinkActive,
1773
+ selector: "[routerLinkActive]",
1774
+ inputs: [
1775
+ "routerLinkActiveOptions",
1776
+ "ariaCurrentWhenActive",
1777
+ "routerLinkActive"
1778
+ ],
1779
+ outputs: ["isActiveChange"],
1780
+ exportAs: ["routerLinkActive"]
1781
+ },
1782
+ {
1783
+ kind: "pipe",
1784
+ type: EntityLabelPipe,
1785
+ name: "ppLabel"
1786
+ }
1787
+ ]
1788
+ });
1789
+ };
1790
+ i0.ɵɵngDeclareClassMetadata({
1791
+ minVersion: "12.0.0",
1792
+ version: "22.1.7",
1793
+ ngImport: i0,
1794
+ type: RegionNavComponent,
1795
+ decorators: [{
1796
+ type: Component,
1797
+ args: [{
1798
+ selector: "pp-region-nav",
1799
+ standalone: true,
1800
+ imports: [
1801
+ MatNavList,
1802
+ MatListItem,
1803
+ MatListItemIcon,
1804
+ MatListItemTitle,
1805
+ NgTemplateOutlet,
1806
+ RouterLink,
1807
+ RouterLinkActive,
1808
+ EntityLabelPipe
1809
+ ],
1810
+ template: `
1811
+ @if (compact()) {
1812
+ <nav class="pp-region-nav--compact">
1813
+ <ng-container *ngTemplateOutlet="compactRowList; context: { $implicit: rows() }"></ng-container>
1814
+ </nav>
1815
+ } @else {
1816
+ <mat-nav-list [class.pp-region-nav--horizontal]="orientation() === 'horizontal'">
1817
+ <ng-container *ngTemplateOutlet="rowList; context: { $implicit: rows(), depth: 0 }"></ng-container>
1818
+ </mat-nav-list>
1819
+ }
1784
1820
 
1785
1821
  <!--
1786
1822
  Recursive through ngTemplateOutlet: a NavItem nests in itself, so the depth is not knowable here.
@@ -1828,134 +1864,283 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImpor
1828
1864
  }
1829
1865
  }
1830
1866
  </ng-template>
1831
- `, styles: [":host{display:block}.pp-region-nav--horizontal{display:flex;padding-top:0}.pp-region-nav--horizontal .pp-region-nav__item{width:auto}.pp-region-nav__item--unresolved{font-style:italic;opacity:.6}\n"] }]
1832
- }], propDecorators: { navItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "navItems", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], knownPaths: [{ type: i0.Input, args: [{ isSignal: true, alias: "knownPaths", required: false }] }] } });
1833
-
1834
- /**
1835
- * Turns one authored `RegionDefinition` into the {@link RegionView} that renders it.
1836
- *
1837
- * An injectable rather than a free function, though stateless today, for the reason `AppRouteRenderer`
1838
- * is one: the Preview tab and the eventual standalone runtime host must resolve regions *identically*,
1839
- * so there has to be exactly one of these, and a constructor parameter is a cheaper way to grow it than
1840
- * a rewrite.
1841
- */
1842
- class AppRegionRenderer {
1843
- render = (region, definition) => {
1844
- switch (region.type) {
1845
- case 'header':
1846
- return {
1847
- slot: 'header',
1848
- component: RegionHeaderComponent,
1849
- // Brand from the definition, widgets from the region: the two halves of a header row come
1850
- // from different levels of the document, and only this function knows both.
1851
- inputs: { title: definition?.name ?? '', logoUrl: definition?.logoUrl ?? definition?.theme?.logoUrl, widgets: region.widgets ?? [] },
1852
- };
1853
- case 'footer':
1854
- return { slot: 'footer', component: RegionFooterComponent, inputs: { widgets: region.widgets ?? [] } };
1855
- case 'sidenav':
1856
- // `orientation` is left at the component's own default; the shell overrides it for `top-nav`,
1857
- // because the axis follows the layout preset rather than anything authored on the region.
1858
- // `knownPaths` comes from the definition rather than the region: whether a nav entry resolves is a
1859
- // question about the *application's* routes, which only this function can see from here.
1860
- return { slot: 'sidenav', component: RegionNavComponent, inputs: { navItems: region.navItems ?? [], knownPaths: knownRoutePathsOf(definition) } };
1861
- default:
1862
- // A region whose `type` the designer has not chosen yet. `RegionDefinition.type` is
1863
- // `RegionType | undefined` precisely because a row exists before its dropdown is touched, and
1864
- // the preview renders it *while* that is happening — so this is the normal path, not an error
1865
- // one. Omitting it is quieter than a placeholder, and the form already shows the empty row.
1866
- return undefined;
1867
+ <!--
1868
+ The compact rows of a tablet layout: the icon above a short label, so the drawer — which is sized to its
1869
+ content — narrows to a rail. Plain elements rather than list items, whose fixed height and leading-icon
1870
+ slot are exactly the row layout this replaces. Nesting is shown by order alone; a rail has no room for
1871
+ indentation.
1872
+ -->
1873
+ <ng-template #compactRowList let-rows>
1874
+ @for (row of rows; track row.id) {
1875
+ @if (row.routePath; as routePath) {
1876
+ <a class="pp-region-nav__compact-item" [routerLink]="routePath" routerLinkActive="pp-region-nav__item--active" [attr.data-testid]="'nav-' + row.id">
1877
+ @if (row.icon) {
1878
+ <span class="material-symbols-outlined pp-region-nav__compact-icon">{{ row.icon }}</span>
1879
+ }
1880
+ <span class="pp-region-nav__compact-label">{{ row.translocoId | ppLabel: row.label }}</span>
1881
+ </a>
1882
+ } @else {
1883
+ <span
1884
+ class="pp-region-nav__compact-item"
1885
+ [class.pp-region-nav__item--unresolved]="row.unresolved"
1886
+ [title]="row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''"
1887
+ [attr.data-testid]="'nav-' + row.id"
1888
+ >
1889
+ @if (row.icon) {
1890
+ <span class="material-symbols-outlined pp-region-nav__compact-icon">{{ row.icon }}</span>
1891
+ }
1892
+ <span class="pp-region-nav__compact-label">{{ row.translocoId | ppLabel: row.label }}</span>
1893
+ </span>
1867
1894
  }
1868
- };
1869
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1870
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionRenderer, providedIn: 'root' });
1871
- }
1872
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionRenderer, decorators: [{
1873
- type: Injectable,
1874
- args: [{ providedIn: 'root' }]
1875
- }] });
1876
-
1877
- /**
1878
- * The run-time shell of a metadata-defined application: the chrome an `AppDefinition` describes, with a
1879
- * `<router-outlet>` where its routes render.
1880
- *
1881
- * **This is the application, not a picture of one.** `AppPreviewComponent` hosts it so that the Preview
1882
- * tab shows the real thing, and the standalone runtime host will mount the same component — which is
1883
- * the whole point of it being a component with one input rather than something assembled inside the
1884
- * preview. A shell built for the preview would drift from the one built for production, and a preview
1885
- * that drifts is worse than none.
1886
- *
1887
- * Everything is bound declaratively. Regions are resolved to {@link RegionView}s and rendered through
1888
- * `NgComponentOutlet`, never created imperatively, so that a definition edited in the neighbouring
1889
- * details form re-renders through ordinary signal propagation instead of a clear-and-rebuild that would
1890
- * drop scroll position and focus on every keystroke.
1891
- *
1892
- * The whole theme is applied here, not only the brand colours: `--pp-*` overrides as a style binding and
1893
- * the definition's `materialTheme` / `colorScheme` as a class selecting one of the scoped Material themes
1894
- * in `src/theme/pp-material-themes.scss`. Both work because a Material theme is a set of custom
1895
- * properties and nothing else. That file is a **global stylesheet the application registers**; if it is
1896
- * not registered the classes below still land and the shell simply inherits the host's theme. See it for
1897
- * the one thing this cannot reach — CDK overlays, which render outside the shell's subtree.
1898
- *
1899
- * Not yet handled, deliberately: **no routes are registered** under the outlet. That is the nested router
1900
- * context, which needs `EntityTabDescriptor` to be able to carry child routes.
1901
- */
1902
- class AppShellComponent {
1903
- /**
1904
- * The definition to render. Optional rather than required because the shell is mounted before the
1905
- * definition resolves — the preview's store selects the entity in its own `ngOnInit`, and a deep link
1906
- * arrives with nothing loaded — so an empty shell is a state to render, not an error.
1907
- */
1908
- definition = input(undefined, /* @ts-ignore */
1909
- ...(ngDevMode ? [{ debugName: "definition" }] : /* istanbul ignore next */ []));
1910
- regionRenderer = inject(AppRegionRenderer);
1911
- layout = computed(() => layoutOf(this.definition()), /* @ts-ignore */
1912
- ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
1913
- themeVars = computed(() => themeVarsOf(this.definition()), /* @ts-ignore */
1914
- ...(ngDevMode ? [{ debugName: "themeVars" }] : /* istanbul ignore next */ []));
1915
- themeClass = computed(() => themeClassOf(this.definition()), /* @ts-ignore */
1916
- ...(ngDevMode ? [{ debugName: "themeClass" }] : /* istanbul ignore next */ []));
1917
- regionViews = computed(() => (this.definition()?.regions ?? []).map((region) => this.regionRenderer.render(region, this.definition())).filter((view) => view !== undefined), /* @ts-ignore */
1918
- ...(ngDevMode ? [{ debugName: "regionViews" }] : /* istanbul ignore next */ []));
1919
- headerView = computed(() => this.viewOf('header'), /* @ts-ignore */
1920
- ...(ngDevMode ? [{ debugName: "headerView" }] : /* istanbul ignore next */ []));
1921
- footerView = computed(() => this.viewOf('footer'), /* @ts-ignore */
1922
- ...(ngDevMode ? [{ debugName: "footerView" }] : /* istanbul ignore next */ []));
1923
- /**
1924
- * The nav in the sidenav, for the two sidenav presets. Split from {@link topNavView} rather than
1925
- * decided in the template, so each slot is one unambiguous `@if` and the mutual exclusion is stated
1926
- * once, here.
1927
- */
1928
- sidenavView = computed(() => (this.layout().hasSidenav ? this.viewOf('sidenav') : undefined), /* @ts-ignore */
1929
- ...(ngDevMode ? [{ debugName: "sidenavView" }] : /* istanbul ignore next */ []));
1930
- /**
1931
- * The same nav relocated into the header row under `top-nav`. It is placed beside the header region
1932
- * rather than inside it, so that a `top-nav` app which declares no header region is still navigable —
1933
- * and so that the shell still never invents a region that was not authored.
1934
- */
1935
- topNavView = computed(() => (this.layout().hasSidenav ? undefined : this.viewOf('sidenav')), /* @ts-ignore */
1936
- ...(ngDevMode ? [{ debugName: "topNavView" }] : /* istanbul ignore next */ []));
1937
- /**
1938
- * The nav view's own inputs with the axis the layout dictates laid over them.
1939
- *
1940
- * Computeds rather than a method called from the template: a method would hand `NgComponentOutlet` a
1941
- * freshly built object on every change-detection pass, so it would re-diff and re-apply the nav's
1942
- * inputs continuously. Memoized, the identity only changes when the definition or the preset does.
1943
- */
1944
- sidenavInputs = computed(() => this.navInputsOf(this.sidenavView(), 'vertical'), /* @ts-ignore */
1945
- ...(ngDevMode ? [{ debugName: "sidenavInputs" }] : /* istanbul ignore next */ []));
1946
- topNavInputs = computed(() => this.navInputsOf(this.topNavView(), 'horizontal'), /* @ts-ignore */
1947
- ...(ngDevMode ? [{ debugName: "topNavInputs" }] : /* istanbul ignore next */ []));
1948
- navInputsOf(view, orientation) {
1949
- return { ...view?.inputs, orientation };
1950
- }
1951
- viewOf(slot) {
1952
- // First occurrence wins. An app declares each slot at most once — `type` is the region's identity,
1953
- // see APP_REGION_ID_FIELD — so a second one is a definition that bypassed validation, and ignoring
1954
- // it is the harmless read. The same rule `buildAppRoutes` applies to a duplicate path.
1955
- return this.regionViews().find((view) => view.slot === slot);
1956
- }
1957
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1958
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: AppShellComponent, isStandalone: true, selector: "pp-app-shell", inputs: { definition: { classPropertyName: "definition", publicName: "definition", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "themeClass()", "style": "themeVars()" } }, ngImport: i0, template: `
1895
+ @if (row.children.length) {
1896
+ <ng-container *ngTemplateOutlet="compactRowList; context: { $implicit: row.children }"></ng-container>
1897
+ }
1898
+ }
1899
+ </ng-template>
1900
+ `,
1901
+ styles: [":host{display:block}.pp-region-nav--horizontal{display:flex;padding-top:0}.pp-region-nav--horizontal .pp-region-nav__item{width:auto}.pp-region-nav--compact{display:flex;flex-direction:column;gap:4px;padding:8px 4px}.pp-region-nav__compact-item{align-items:center;border-radius:8px;color:inherit;display:flex;flex-direction:column;gap:2px;padding:6px 4px;text-decoration:none}a.pp-region-nav__compact-item:hover,.pp-region-nav__compact-item.pp-region-nav__item--active{background-color:color-mix(in srgb,currentColor 12%,transparent)}.pp-region-nav__compact-label{font:var(--mat-sys-label-small);max-width:80px;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.pp-region-nav__item--unresolved{font-style:italic;opacity:.6}\n"]
1902
+ }]
1903
+ }],
1904
+ propDecorators: {
1905
+ navItems: [{
1906
+ type: i0.Input,
1907
+ args: [{
1908
+ isSignal: true,
1909
+ alias: "navItems",
1910
+ required: false
1911
+ }]
1912
+ }],
1913
+ orientation: [{
1914
+ type: i0.Input,
1915
+ args: [{
1916
+ isSignal: true,
1917
+ alias: "orientation",
1918
+ required: false
1919
+ }]
1920
+ }],
1921
+ compact: [{
1922
+ type: i0.Input,
1923
+ args: [{
1924
+ isSignal: true,
1925
+ alias: "compact",
1926
+ required: false
1927
+ }]
1928
+ }],
1929
+ knownPaths: [{
1930
+ type: i0.Input,
1931
+ args: [{
1932
+ isSignal: true,
1933
+ alias: "knownPaths",
1934
+ required: false
1935
+ }]
1936
+ }]
1937
+ }
1938
+ });
1939
+ var AppRegionRenderer = class AppRegionRenderer {
1940
+ render = (region, definition) => {
1941
+ switch (region.type) {
1942
+ case "header": return {
1943
+ slot: "header",
1944
+ component: RegionHeaderComponent,
1945
+ inputs: { widgets: region.widgets ?? [] }
1946
+ };
1947
+ case "footer": return {
1948
+ slot: "footer",
1949
+ component: RegionFooterComponent,
1950
+ inputs: { widgets: region.widgets ?? [] }
1951
+ };
1952
+ case "sidenav": return {
1953
+ slot: "sidenav",
1954
+ component: RegionNavComponent,
1955
+ inputs: {
1956
+ navItems: region.navItems ?? [],
1957
+ knownPaths: knownRoutePathsOf(definition)
1958
+ }
1959
+ };
1960
+ default: return;
1961
+ }
1962
+ };
1963
+ static ɵfac = i0.ɵɵngDeclareFactory({
1964
+ minVersion: "12.0.0",
1965
+ version: "22.1.7",
1966
+ ngImport: i0,
1967
+ type: AppRegionRenderer,
1968
+ deps: [],
1969
+ target: i0.ɵɵFactoryTarget.Injectable
1970
+ });
1971
+ static ɵprov = i0.ɵɵngDeclareInjectable({
1972
+ minVersion: "12.0.0",
1973
+ version: "22.1.7",
1974
+ ngImport: i0,
1975
+ type: AppRegionRenderer,
1976
+ providedIn: "root"
1977
+ });
1978
+ };
1979
+ i0.ɵɵngDeclareClassMetadata({
1980
+ minVersion: "12.0.0",
1981
+ version: "22.1.7",
1982
+ ngImport: i0,
1983
+ type: AppRegionRenderer,
1984
+ decorators: [{
1985
+ type: Injectable,
1986
+ args: [{ providedIn: "root" }]
1987
+ }]
1988
+ });
1989
+ var ShellApplicationContext = class ShellApplicationContext {
1990
+ definition = signal(void 0, ...ngDevMode ? [{ debugName: "definition" }] : /* istanbul ignore next */ []);
1991
+ name = computed(() => this.definition()?.name ?? "", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
1992
+ logoUrl = computed(() => this.definition()?.logoUrl ?? this.definition()?.theme?.logoUrl, ...ngDevMode ? [{ debugName: "logoUrl" }] : /* istanbul ignore next */ []);
1993
+ navItems = computed(() => navMenuItemsOf(this.definition()), ...ngDevMode ? [{ debugName: "navItems" }] : /* istanbul ignore next */ []);
1994
+ static ɵfac = i0.ɵɵngDeclareFactory({
1995
+ minVersion: "12.0.0",
1996
+ version: "22.1.7",
1997
+ ngImport: i0,
1998
+ type: ShellApplicationContext,
1999
+ deps: [],
2000
+ target: i0.ɵɵFactoryTarget.Injectable
2001
+ });
2002
+ static ɵprov = i0.ɵɵngDeclareInjectable({
2003
+ minVersion: "12.0.0",
2004
+ version: "22.1.7",
2005
+ ngImport: i0,
2006
+ type: ShellApplicationContext
2007
+ });
2008
+ };
2009
+ i0.ɵɵngDeclareClassMetadata({
2010
+ minVersion: "12.0.0",
2011
+ version: "22.1.7",
2012
+ ngImport: i0,
2013
+ type: ShellApplicationContext,
2014
+ decorators: [{ type: Injectable }]
2015
+ });
2016
+ function navMenuItemsOf(definition) {
2017
+ const sidenav = definition?.regions?.find((region) => region.type === "sidenav");
2018
+ return toMenuItems(toNavRows(sidenav?.navItems, knownRoutePathsOf(definition)));
2019
+ }
2020
+ function toMenuItems(rows) {
2021
+ return rows.map((row) => ({
2022
+ id: row.id,
2023
+ label: row.label,
2024
+ ...row.translocoId ? { translocoId: row.translocoId } : {},
2025
+ ...row.icon ? { icon: row.icon } : {},
2026
+ ...row.routePath ? { routePath: row.routePath } : {},
2027
+ ...row.children.length ? { children: toMenuItems(row.children) } : {}
2028
+ }));
2029
+ }
2030
+ var ShellOverlayContainer = class ShellOverlayContainer extends OverlayContainer {
2031
+ host = inject(ElementRef).nativeElement;
2032
+ _createContainer() {
2033
+ super._createContainer();
2034
+ if (this._containerElement) this.host.appendChild(this._containerElement);
2035
+ }
2036
+ static ɵfac = i0.ɵɵngDeclareFactory({
2037
+ minVersion: "12.0.0",
2038
+ version: "22.1.7",
2039
+ ngImport: i0,
2040
+ type: ShellOverlayContainer,
2041
+ deps: null,
2042
+ target: i0.ɵɵFactoryTarget.Injectable
2043
+ });
2044
+ static ɵprov = i0.ɵɵngDeclareInjectable({
2045
+ minVersion: "12.0.0",
2046
+ version: "22.1.7",
2047
+ ngImport: i0,
2048
+ type: ShellOverlayContainer
2049
+ });
2050
+ };
2051
+ i0.ɵɵngDeclareClassMetadata({
2052
+ minVersion: "12.0.0",
2053
+ version: "22.1.7",
2054
+ ngImport: i0,
2055
+ type: ShellOverlayContainer,
2056
+ decorators: [{ type: Injectable }]
2057
+ });
2058
+ var AppShellComponent = class AppShellComponent {
2059
+ definition = input(void 0, ...ngDevMode ? [{ debugName: "definition" }] : /* istanbul ignore next */ []);
2060
+ persistTheme = input(true, ...ngDevMode ? [{ debugName: "persistTheme" }] : /* istanbul ignore next */ []);
2061
+ regionRenderer = inject(AppRegionRenderer);
2062
+ theme = inject(ThemeService);
2063
+ applicationContext = inject(ShellApplicationContext);
2064
+ layoutService = inject(LayoutService);
2065
+ layout = computed(() => layoutOf(this.definition()), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
2066
+ themeVars = computed(() => themeVarsOf(this.definition()), ...ngDevMode ? [{ debugName: "themeVars" }] : /* istanbul ignore next */ []);
2067
+ themeClass = this.theme.themeClass;
2068
+ applyThemeDefaults = effect(() => {
2069
+ const definition = this.definition();
2070
+ this.theme.setDefaults(themeDefaultsOf(definition));
2071
+ this.theme.persistUnder(this.persistTheme() && definition?.id ? `pp-theme:${definition.id}` : null);
2072
+ this.applicationContext.definition.set(definition);
2073
+ }, ...ngDevMode ? [{ debugName: "applyThemeDefaults" }] : /* istanbul ignore next */ []);
2074
+ regionViews = computed(() => (this.definition()?.regions ?? []).map((region) => this.regionRenderer.render(region, this.definition())).filter((view) => view !== void 0), ...ngDevMode ? [{ debugName: "regionViews" }] : /* istanbul ignore next */ []);
2075
+ headerView = computed(() => this.viewOf("header"), ...ngDevMode ? [{ debugName: "headerView" }] : /* istanbul ignore next */ []);
2076
+ footerView = computed(() => this.viewOf("footer"), ...ngDevMode ? [{ debugName: "footerView" }] : /* istanbul ignore next */ []);
2077
+ sidenavView = computed(() => this.layout().hasSidenav && !this.isSmallScreen() ? this.viewOf("sidenav") : void 0, ...ngDevMode ? [{ debugName: "sidenavView" }] : /* istanbul ignore next */ []);
2078
+ topNavView = computed(() => this.layout().hasSidenav || this.isSmallScreen() ? void 0 : this.viewOf("sidenav"), ...ngDevMode ? [{ debugName: "topNavView" }] : /* istanbul ignore next */ []);
2079
+ isSmallScreen = computed(() => this.layoutService.isSmallDevice(), ...ngDevMode ? [{ debugName: "isSmallScreen" }] : /* istanbul ignore next */ []);
2080
+ sidenavInputs = computed(() => ({
2081
+ ...this.navInputsOf(this.sidenavView(), "vertical"),
2082
+ compact: this.layoutService.isMediumDevice()
2083
+ }), ...ngDevMode ? [{ debugName: "sidenavInputs" }] : /* istanbul ignore next */ []);
2084
+ topNavInputs = computed(() => this.navInputsOf(this.topNavView(), "horizontal"), ...ngDevMode ? [{ debugName: "topNavInputs" }] : /* istanbul ignore next */ []);
2085
+ navInputsOf(view, orientation) {
2086
+ return {
2087
+ ...view?.inputs,
2088
+ orientation
2089
+ };
2090
+ }
2091
+ viewOf(slot) {
2092
+ return this.regionViews().find((view) => view.slot === slot);
2093
+ }
2094
+ static ɵfac = i0.ɵɵngDeclareFactory({
2095
+ minVersion: "12.0.0",
2096
+ version: "22.1.7",
2097
+ ngImport: i0,
2098
+ type: AppShellComponent,
2099
+ deps: [],
2100
+ target: i0.ɵɵFactoryTarget.Component
2101
+ });
2102
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2103
+ minVersion: "17.0.0",
2104
+ version: "22.1.7",
2105
+ type: AppShellComponent,
2106
+ isStandalone: true,
2107
+ selector: "pp-app-shell",
2108
+ inputs: {
2109
+ definition: {
2110
+ classPropertyName: "definition",
2111
+ publicName: "definition",
2112
+ isSignal: true,
2113
+ isRequired: false,
2114
+ transformFunction: null
2115
+ },
2116
+ persistTheme: {
2117
+ classPropertyName: "persistTheme",
2118
+ publicName: "persistTheme",
2119
+ isSignal: true,
2120
+ isRequired: false,
2121
+ transformFunction: null
2122
+ }
2123
+ },
2124
+ host: { properties: {
2125
+ "class": "themeClass()",
2126
+ "style": "themeVars()"
2127
+ } },
2128
+ providers: [
2129
+ ThemeService,
2130
+ ShellApplicationContext,
2131
+ {
2132
+ provide: APPLICATION_CONTEXT,
2133
+ useExisting: ShellApplicationContext
2134
+ },
2135
+ {
2136
+ provide: OverlayContainer,
2137
+ useClass: ShellOverlayContainer
2138
+ },
2139
+ Dialog,
2140
+ MatDialog
2141
+ ],
2142
+ ngImport: i0,
2143
+ template: `
1959
2144
  @if (headerView() || topNavView()) {
1960
2145
  <div class="pp-app-shell__top">
1961
2146
  @if (headerView(); as view) {
@@ -1969,7 +2154,13 @@ class AppShellComponent {
1969
2154
 
1970
2155
  <mat-sidenav-container class="pp-app-shell__body">
1971
2156
  @if (sidenavView(); as view) {
1972
- <mat-sidenav class="pp-app-shell__sidenav" [mode]="layout().sidenavMode" [opened]="layout().sidenavOpened" [position]="layout().sidenavPosition">
2157
+ <mat-sidenav
2158
+ class="pp-app-shell__sidenav"
2159
+ ppSidenavAutosize
2160
+ [mode]="layout().sidenavMode"
2161
+ [opened]="layout().sidenavOpened && !layoutService.isSidenavHidden()"
2162
+ [position]="layout().sidenavPosition"
2163
+ >
1973
2164
  <ng-container *ngComponentOutlet="view.component; inputs: sidenavInputs()"></ng-container>
1974
2165
  </mat-sidenav>
1975
2166
  }
@@ -1983,11 +2174,104 @@ class AppShellComponent {
1983
2174
  @if (footerView(); as view) {
1984
2175
  <ng-container *ngComponentOutlet="view.component; inputs: view.inputs"></ng-container>
1985
2176
  }
1986
- `, isInline: true, styles: ["@charset \"UTF-8\";:host{display:grid;grid-template-rows:auto 1fr auto;height:100%}.pp-app-shell__top{align-items:stretch;display:flex;background-color:var(--pp-surface-header)}.pp-app-shell__body{height:100%;min-height:0}.pp-app-shell__sidenav{background-color:var(--pp-surface-sidenav);color:var(--pp-on-sidenav);min-width:200px}.pp-app-shell__content{padding:16px 20px 24px}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
1987
- }
1988
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellComponent, decorators: [{
1989
- type: Component,
1990
- args: [{ selector: 'pp-app-shell', standalone: true, imports: [NgComponentOutlet, MatSidenav, MatSidenavContainer, MatSidenavContent, RouterOutlet], host: { '[class]': 'themeClass()', '[style]': 'themeVars()' }, template: `
2177
+ `,
2178
+ isInline: true,
2179
+ styles: ["@charset \"UTF-8\";:host{display:grid;grid-template-rows:auto 1fr auto;height:100%}.pp-app-shell__top{align-items:stretch;display:flex;background-color:var(--pp-surface-header)}.pp-app-shell__body{height:100%;min-height:0}.pp-app-shell__sidenav{background-color:var(--pp-surface-sidenav);color:var(--pp-on-sidenav);width:auto}.pp-app-shell__content{padding:16px 20px 24px}\n"],
2180
+ dependencies: [
2181
+ {
2182
+ kind: "directive",
2183
+ type: NgComponentOutlet,
2184
+ selector: "[ngComponentOutlet]",
2185
+ inputs: [
2186
+ "ngComponentOutlet",
2187
+ "ngComponentOutletInputs",
2188
+ "ngComponentOutletInjector",
2189
+ "ngComponentOutletEnvironmentInjector",
2190
+ "ngComponentOutletContent",
2191
+ "ngComponentOutletNgModule"
2192
+ ],
2193
+ exportAs: ["ngComponentOutlet"]
2194
+ },
2195
+ {
2196
+ kind: "component",
2197
+ type: MatSidenav,
2198
+ selector: "mat-sidenav",
2199
+ inputs: [
2200
+ "fixedInViewport",
2201
+ "fixedTopGap",
2202
+ "fixedBottomGap"
2203
+ ],
2204
+ exportAs: ["matSidenav"]
2205
+ },
2206
+ {
2207
+ kind: "component",
2208
+ type: MatSidenavContainer,
2209
+ selector: "mat-sidenav-container",
2210
+ exportAs: ["matSidenavContainer"]
2211
+ },
2212
+ {
2213
+ kind: "component",
2214
+ type: MatSidenavContent,
2215
+ selector: "mat-sidenav-content"
2216
+ },
2217
+ {
2218
+ kind: "directive",
2219
+ type: RouterOutlet,
2220
+ selector: "router-outlet",
2221
+ inputs: ["name", "routerOutletData"],
2222
+ outputs: [
2223
+ "activate",
2224
+ "deactivate",
2225
+ "attach",
2226
+ "detach"
2227
+ ],
2228
+ exportAs: ["outlet"]
2229
+ },
2230
+ {
2231
+ kind: "directive",
2232
+ type: SidenavAutosizeDirective,
2233
+ selector: "mat-sidenav[ppSidenavAutosize]"
2234
+ }
2235
+ ]
2236
+ });
2237
+ };
2238
+ i0.ɵɵngDeclareClassMetadata({
2239
+ minVersion: "12.0.0",
2240
+ version: "22.1.7",
2241
+ ngImport: i0,
2242
+ type: AppShellComponent,
2243
+ decorators: [{
2244
+ type: Component,
2245
+ args: [{
2246
+ selector: "pp-app-shell",
2247
+ standalone: true,
2248
+ imports: [
2249
+ NgComponentOutlet,
2250
+ MatSidenav,
2251
+ MatSidenavContainer,
2252
+ MatSidenavContent,
2253
+ RouterOutlet,
2254
+ SidenavAutosizeDirective
2255
+ ],
2256
+ providers: [
2257
+ ThemeService,
2258
+ ShellApplicationContext,
2259
+ {
2260
+ provide: APPLICATION_CONTEXT,
2261
+ useExisting: ShellApplicationContext
2262
+ },
2263
+ {
2264
+ provide: OverlayContainer,
2265
+ useClass: ShellOverlayContainer
2266
+ },
2267
+ Dialog,
2268
+ MatDialog
2269
+ ],
2270
+ host: {
2271
+ "[class]": "themeClass()",
2272
+ "[style]": "themeVars()"
2273
+ },
2274
+ template: `
1991
2275
  @if (headerView() || topNavView()) {
1992
2276
  <div class="pp-app-shell__top">
1993
2277
  @if (headerView(); as view) {
@@ -2001,7 +2285,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImpor
2001
2285
 
2002
2286
  <mat-sidenav-container class="pp-app-shell__body">
2003
2287
  @if (sidenavView(); as view) {
2004
- <mat-sidenav class="pp-app-shell__sidenav" [mode]="layout().sidenavMode" [opened]="layout().sidenavOpened" [position]="layout().sidenavPosition">
2288
+ <mat-sidenav
2289
+ class="pp-app-shell__sidenav"
2290
+ ppSidenavAutosize
2291
+ [mode]="layout().sidenavMode"
2292
+ [opened]="layout().sidenavOpened && !layoutService.isSidenavHidden()"
2293
+ [position]="layout().sidenavPosition"
2294
+ >
2005
2295
  <ng-container *ngComponentOutlet="view.component; inputs: sidenavInputs()"></ng-container>
2006
2296
  </mat-sidenav>
2007
2297
  }
@@ -2015,389 +2305,455 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImpor
2015
2305
  @if (footerView(); as view) {
2016
2306
  <ng-container *ngComponentOutlet="view.component; inputs: view.inputs"></ng-container>
2017
2307
  }
2018
- `, styles: ["@charset \"UTF-8\";:host{display:grid;grid-template-rows:auto 1fr auto;height:100%}.pp-app-shell__top{align-items:stretch;display:flex;background-color:var(--pp-surface-header)}.pp-app-shell__body{height:100%;min-height:0}.pp-app-shell__sidenav{background-color:var(--pp-surface-sidenav);color:var(--pp-on-sidenav);min-width:200px}.pp-app-shell__content{padding:16px 20px 24px}\n"] }]
2019
- }], propDecorators: { definition: [{ type: i0.Input, args: [{ isSignal: true, alias: "definition", required: false }] }] } });
2020
-
2021
- /**
2022
- * The Preview tab's screen, mounted at `app-definition/<id>/preview` by `BASE_APP_ROUTES` — a sibling of
2023
- * the generic Details form rather than something stacked under it, which is what the `extraTabs` hook on
2024
- * `BaseEntityDescriptor` exists for.
2025
- *
2026
- * A **container and nothing more**: it resolves which definition is being previewed and frames the
2027
- * result. Everything about *how* an application renders belongs to {@link AppShellComponent}, which the
2028
- * standalone runtime host will mount just as this does — so the preview cannot grow behaviour the real
2029
- * shell lacks, which is the only way a preview stays honest.
2030
- *
2031
- * The frame below — rounded, white, and tall enough to look like an application — is the preview's own,
2032
- * not the shell's. In production the shell fills the viewport and none of it applies.
2033
- */
2034
- class AppPreviewComponent {
2035
- /**
2036
- * Bound from the route's `:entityId` param by `withComponentInputBinding()`, the same way
2037
- * `BaseEntityFormComponent` receives it — so a deep link and a reload resolve the same app definition as a
2038
- * click through the tab does.
2039
- */
2040
- entityId = input.required(/* @ts-ignore */
2041
- ...(ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []));
2042
- store = inject(AppDefinitionStore);
2043
- app = computed(() => this.store.currentEntity(), /* @ts-ignore */
2044
- ...(ngDevMode ? [{ debugName: "app" }] : /* istanbul ignore next */ []));
2045
- ngOnInit() {
2046
- // Also sets the current entity, so the tab bar's Details link stays enabled and the status bar keeps
2047
- // naming the record — arriving here directly, nothing else has selected it.
2048
- this.store.setCurrentEntity(this.entityId());
2049
- }
2050
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppPreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2051
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: AppPreviewComponent, isStandalone: true, selector: "pp-app-preview-tab", inputs: { entityId: { classPropertyName: "entityId", publicName: "entityId", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
2308
+ `,
2309
+ styles: ["@charset \"UTF-8\";:host{display:grid;grid-template-rows:auto 1fr auto;height:100%}.pp-app-shell__top{align-items:stretch;display:flex;background-color:var(--pp-surface-header)}.pp-app-shell__body{height:100%;min-height:0}.pp-app-shell__sidenav{background-color:var(--pp-surface-sidenav);color:var(--pp-on-sidenav);width:auto}.pp-app-shell__content{padding:16px 20px 24px}\n"]
2310
+ }]
2311
+ }],
2312
+ propDecorators: {
2313
+ definition: [{
2314
+ type: i0.Input,
2315
+ args: [{
2316
+ isSignal: true,
2317
+ alias: "definition",
2318
+ required: false
2319
+ }]
2320
+ }],
2321
+ persistTheme: [{
2322
+ type: i0.Input,
2323
+ args: [{
2324
+ isSignal: true,
2325
+ alias: "persistTheme",
2326
+ required: false
2327
+ }]
2328
+ }]
2329
+ }
2330
+ });
2331
+ var AppPreviewComponent = class AppPreviewComponent {
2332
+ entityId = input.required(...ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []);
2333
+ store = inject(AppDefinitionStore);
2334
+ app = computed(() => this.store.currentEntity(), ...ngDevMode ? [{ debugName: "app" }] : /* istanbul ignore next */ []);
2335
+ ngOnInit() {
2336
+ this.store.setCurrentEntity(this.entityId());
2337
+ }
2338
+ static ɵfac = i0.ɵɵngDeclareFactory({
2339
+ minVersion: "12.0.0",
2340
+ version: "22.1.7",
2341
+ ngImport: i0,
2342
+ type: AppPreviewComponent,
2343
+ deps: [],
2344
+ target: i0.ɵɵFactoryTarget.Component
2345
+ });
2346
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2347
+ minVersion: "17.1.0",
2348
+ version: "22.1.7",
2349
+ type: AppPreviewComponent,
2350
+ isStandalone: true,
2351
+ selector: "pp-app-preview-tab",
2352
+ inputs: { entityId: {
2353
+ classPropertyName: "entityId",
2354
+ publicName: "entityId",
2355
+ isSignal: true,
2356
+ isRequired: true,
2357
+ transformFunction: null
2358
+ } },
2359
+ ngImport: i0,
2360
+ template: `
2052
2361
  <div class="pp-app-preview">
2053
- <pp-app-shell [definition]="app()" />
2362
+ <pp-app-shell [definition]="app()" [persistTheme]="false" />
2054
2363
  </div>
2055
- `, isInline: true, styles: [".pp-app-preview{background-color:var(--pp-surface-base, #ffffff);border-radius:6px;overflow:hidden}.pp-app-preview>pp-app-shell{min-height:65vh}\n"], dependencies: [{ kind: "component", type: AppShellComponent, selector: "pp-app-shell", inputs: ["definition"] }] });
2056
- }
2057
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppPreviewComponent, decorators: [{
2058
- type: Component,
2059
- args: [{ selector: 'pp-app-preview-tab', standalone: true, imports: [AppShellComponent], template: `
2364
+ `,
2365
+ isInline: true,
2366
+ styles: [".pp-app-preview{background-color:var(--pp-surface-base, #ffffff);border-radius:6px;overflow:hidden}.pp-app-preview>pp-app-shell{min-height:65vh}\n"],
2367
+ dependencies: [{
2368
+ kind: "component",
2369
+ type: AppShellComponent,
2370
+ selector: "pp-app-shell",
2371
+ inputs: ["definition", "persistTheme"]
2372
+ }]
2373
+ });
2374
+ };
2375
+ i0.ɵɵngDeclareClassMetadata({
2376
+ minVersion: "12.0.0",
2377
+ version: "22.1.7",
2378
+ ngImport: i0,
2379
+ type: AppPreviewComponent,
2380
+ decorators: [{
2381
+ type: Component,
2382
+ args: [{
2383
+ selector: "pp-app-preview-tab",
2384
+ standalone: true,
2385
+ imports: [AppShellComponent],
2386
+ template: `
2060
2387
  <div class="pp-app-preview">
2061
- <pp-app-shell [definition]="app()" />
2388
+ <pp-app-shell [definition]="app()" [persistTheme]="false" />
2062
2389
  </div>
2063
- `, styles: [".pp-app-preview{background-color:var(--pp-surface-base, #ffffff);border-radius:6px;overflow:hidden}.pp-app-preview>pp-app-shell{min-height:65vh}\n"] }]
2064
- }], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }] } });
2065
-
2066
- /**
2067
- * Turns one `AppDefinition` into the `Routes` that render its screens — the missing consumer of
2068
- * {@link buildAppRoutes}, which until now produced routes nothing registered.
2069
- *
2070
- * Separate from the guard below so the interesting part is testable without a router: this class answers
2071
- * "what routes does app X have", and the guard is only the two lines that hand them to Angular.
2072
- */
2073
- class AppShellRoutesFactory {
2074
- appStore = inject(AppDefinitionStore);
2075
- appService = inject(AppDefinitionService);
2076
- moduleStore = inject(ModuleDefinitionStore);
2077
- moduleService = inject(ModuleDefinitionService);
2078
- renderRoute = inject(AppRouteRenderer).render;
2079
- async childrenOf(appId) {
2080
- const definition = await this.definitionOf(appId);
2081
- if (!definition)
2082
- return [];
2083
- const built = await buildAppRoutes({ routes: definition.routes, modules: definition.modules, loadModule: this.loadModule }, this.renderRoute);
2084
- return built.length ? [indexRoute(definition, built), ...built] : built;
2085
- }
2086
- /**
2087
- * Store first, endpoint second.
2088
- *
2089
- * The store holds the newest definition immediately after a Save, so the next navigation inside the
2090
- * preview picks up a route the designer just added — without a second GET, and without this having to
2091
- * know that a save happened. The fetch is for the case the store cannot serve: a deep link or a reload,
2092
- * where nothing has been loaded yet.
2093
- *
2094
- * A failure resolves to `undefined` rather than propagating. A guard that rejects fails the whole
2095
- * navigation, and an app whose definition cannot be read should render an empty shell, not a dead URL.
2096
- */
2097
- async definitionOf(appId) {
2098
- const known = this.appStore.loadById(appId);
2099
- if (known)
2100
- return known;
2101
- return (await this.fetch(() => firstValueFrom(this.appService.findById(appId))));
2102
- }
2103
- /**
2104
- * The {@link ModuleLoader} `buildAppRoutes` calls for a mount whose module it has not got. Resolving to
2105
- * `undefined` is deliberate and is what the contract asks for: a `ModuleMount` naming a module nobody has
2106
- * authored yet is a validation *warning*, so it must contribute no routes rather than break navigation.
2107
- */
2108
- loadModule = async (moduleKey) => {
2109
- const known = this.moduleStore.loadById(moduleKey);
2110
- if (known)
2111
- return known;
2112
- return (await this.fetch(() => firstValueFrom(this.moduleService.findById(moduleKey))));
2113
- };
2114
- /** `findById` resolves to `void` for a missing record and rejects on a transport error; both mean "no". */
2115
- async fetch(read) {
2116
- try {
2117
- return (await read()) || undefined;
2118
- }
2119
- catch {
2120
- return undefined;
2121
- }
2122
- }
2123
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellRoutesFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2124
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellRoutesFactory, providedIn: 'root' });
2125
- }
2126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellRoutesFactory, decorators: [{
2127
- type: Injectable,
2128
- args: [{ providedIn: 'root' }]
2129
- }] });
2130
- /**
2131
- * Where the application root goes. Without it the app's own URL — `…/preview` with nothing after it —
2132
- * matches none of the children and the *whole* route fails to match, which would take the preview screen
2133
- * down rather than merely leave its content area empty.
2134
- *
2135
- * The authored order decides, falling back to the first route as built. The fallback is not decoration: an
2136
- * app may declare no routes of its own and mount all of its screens from a module, in which case the
2137
- * definition offers no path to land on but the built routes do.
2138
- */
2390
+ `,
2391
+ styles: [".pp-app-preview{background-color:var(--pp-surface-base, #ffffff);border-radius:6px;overflow:hidden}.pp-app-preview>pp-app-shell{min-height:65vh}\n"]
2392
+ }]
2393
+ }],
2394
+ propDecorators: { entityId: [{
2395
+ type: i0.Input,
2396
+ args: [{
2397
+ isSignal: true,
2398
+ alias: "entityId",
2399
+ required: true
2400
+ }]
2401
+ }] }
2402
+ });
2403
+ var AppShellRoutesFactory = class AppShellRoutesFactory {
2404
+ appStore = inject(AppDefinitionStore);
2405
+ appService = inject(AppDefinitionService);
2406
+ moduleStore = inject(ModuleDefinitionStore);
2407
+ moduleService = inject(ModuleDefinitionService);
2408
+ renderRoute = inject(AppRouteRenderer).render;
2409
+ async childrenOf(appId) {
2410
+ const definition = await this.definitionOf(appId);
2411
+ if (!definition) return [];
2412
+ const built = await buildAppRoutes({
2413
+ routes: definition.routes,
2414
+ modules: definition.modules,
2415
+ loadModule: this.loadModule
2416
+ }, this.renderRoute);
2417
+ return built.length ? [indexRoute(definition, built), ...built] : built;
2418
+ }
2419
+ async definitionOf(appId) {
2420
+ const known = this.appStore.loadById(appId);
2421
+ if (known) return known;
2422
+ return await this.fetch(() => firstValueFrom(this.appService.findById(appId)));
2423
+ }
2424
+ loadModule = async (moduleKey) => {
2425
+ const known = this.moduleStore.loadById(moduleKey);
2426
+ if (known) return known;
2427
+ return await this.fetch(() => firstValueFrom(this.moduleService.findById(moduleKey)));
2428
+ };
2429
+ async fetch(read) {
2430
+ try {
2431
+ return await read() || void 0;
2432
+ } catch {
2433
+ return;
2434
+ }
2435
+ }
2436
+ static ɵfac = i0.ɵɵngDeclareFactory({
2437
+ minVersion: "12.0.0",
2438
+ version: "22.1.7",
2439
+ ngImport: i0,
2440
+ type: AppShellRoutesFactory,
2441
+ deps: [],
2442
+ target: i0.ɵɵFactoryTarget.Injectable
2443
+ });
2444
+ static ɵprov = i0.ɵɵngDeclareInjectable({
2445
+ minVersion: "12.0.0",
2446
+ version: "22.1.7",
2447
+ ngImport: i0,
2448
+ type: AppShellRoutesFactory,
2449
+ providedIn: "root"
2450
+ });
2451
+ };
2452
+ i0.ɵɵngDeclareClassMetadata({
2453
+ minVersion: "12.0.0",
2454
+ version: "22.1.7",
2455
+ ngImport: i0,
2456
+ type: AppShellRoutesFactory,
2457
+ decorators: [{
2458
+ type: Injectable,
2459
+ args: [{ providedIn: "root" }]
2460
+ }]
2461
+ });
2139
2462
  function indexRoute(definition, built) {
2140
- const target = definition.routes?.find((route) => route.path)?.path ?? built[0].path;
2141
- // `pathMatch: 'full'`, or an empty path would prefix-match every URL below it and swallow the app.
2142
- return { path: '', pathMatch: 'full', redirectTo: target };
2463
+ return {
2464
+ path: "",
2465
+ pathMatch: "full",
2466
+ redirectTo: definition.routes?.find((route) => route.path)?.path ?? built[0].path
2467
+ };
2143
2468
  }
2144
- /**
2145
- * Registers an application's own routes as the children of the Preview tab's route, so that navigating
2146
- * inside a previewed application is *real* navigation: real URLs, real back button, real outlet.
2147
- *
2148
- * Why a `canMatch` guard rather than `loadChildren`, which is the obvious hook for lazily-known children:
2149
- * the router caches a `loadChildren` result on the `Route` object as `_loadedRoutes`, and one Route object
2150
- * serves every `:entityId`. The first app previewed would therefore have its routes replayed for the
2151
- * second. `children`, by contrast, is read fresh on every recognition and never cached — and `canMatch`
2152
- * runs, and is awaited, *before* the router reads it. So this is the one hook that can answer "children of
2153
- * *this* app" and still work on a deep link.
2154
- *
2155
- * Always returns `true`. It is not deciding whether the tab may be entered — it is filling in the tab's
2156
- * children on the way past.
2157
- */
2158
2469
  const appShellRoutesGuard = (route, _segments, snapshot) => {
2159
- const appId = snapshot.paramMap.get(BaseUrlSegments.EntityID);
2160
- if (!appId)
2161
- return true;
2162
- // `inject` before the first await: an async function loses the injection context at its first suspension.
2163
- const factory = inject(AppShellRoutesFactory);
2164
- return factory.childrenOf(appId).then((children) => {
2165
- route.children = children;
2166
- return true;
2167
- });
2470
+ const appId = snapshot.paramMap.get(BaseUrlSegments.EntityID);
2471
+ if (!appId) return true;
2472
+ return inject(AppShellRoutesFactory).childrenOf(appId).then((children) => {
2473
+ route.children = children;
2474
+ return true;
2475
+ });
2168
2476
  };
2169
-
2170
- /**
2171
- * The Preview tab, declared once and consumed twice: `BASE_APP_ROUTES` mounts it as
2172
- * `app-definition/<id>/preview`, and `AppDefinitionContainerComponent` puts it on the descriptor so the tab bar
2173
- * renders the link. One constant rather than two literals because the segment is what ties the link to the
2174
- * route — a mismatch would render a tab that navigates to a URL nothing matches.
2175
- *
2176
- * The tab is a *container*: `children` starts empty and {@link appShellRoutesGuard} fills it with the
2177
- * previewed application's own routes on every navigation, so the shell's `<router-outlet>` renders real
2178
- * screens at real URLs — `app-definition/demo/preview/orders`. The empty array is load-bearing; a route with
2179
- * no `children` at all takes the `loadChildren` path instead, which is cached per Route object and so cannot
2180
- * vary by `:entityId`.
2181
- */
2182
2477
  const APP_PREVIEW_TAB = {
2183
- segment: 'preview',
2184
- i18nKey: APP_PREVIEW_I18N_KEY,
2185
- component: AppPreviewComponent,
2186
- testIdSuffix: 'show-preview',
2187
- children: [],
2188
- canMatch: [appShellRoutesGuard],
2478
+ segment: "preview",
2479
+ i18nKey: APP_PREVIEW_I18N_KEY,
2480
+ component: AppPreviewComponent,
2481
+ testIdSuffix: "show-preview",
2482
+ children: [],
2483
+ canMatch: [appShellRoutesGuard]
2189
2484
  };
2190
-
2191
- class AppDefinitionContainerComponent {
2192
- containerComponentRef;
2193
- baseEntityHost;
2194
- publishActionsTpl = viewChild('publishActionsTpl', /* @ts-ignore */
2195
- ...(ngDevMode ? [{ debugName: "publishActionsTpl" }] : /* istanbul ignore next */ []));
2196
- store = inject(AppDefinitionStore);
2197
- entityDescriptor;
2198
- publishButtonKey = PUBLISH_BUTTON_I18N_KEY;
2199
- publishTooltipKey = PUBLISH_TOOLTIP_I18N_KEY;
2200
- /** Only a definition the backend already knows can be promoted, so a not-yet-saved form cannot publish. */
2201
- canPublish = computed(() => !this.store.isLoading() && !!this.store.currentEntity()?.id, /* @ts-ignore */
2202
- ...(ngDevMode ? [{ debugName: "canPublish" }] : /* istanbul ignore next */ []));
2203
- constructor() {
2204
- this.entityDescriptor = createAppDefinitionDescriptor();
2205
- this.entityDescriptor.store = this.store;
2206
- this.entityDescriptor.extraFormActionsTemplate = () => this.publishActionsTpl();
2207
- this.entityDescriptor.extraTabs = [APP_PREVIEW_TAB];
2208
- }
2209
- ngOnDestroy() {
2210
- if (this.containerComponentRef) {
2211
- this.containerComponentRef.destroy();
2212
- }
2213
- }
2214
- async onPublish() {
2215
- const id = this.store.currentEntity()?.id;
2216
- if (!id)
2217
- return;
2218
- await this.store.publish(id);
2219
- }
2220
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2221
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.1", type: AppDefinitionContainerComponent, isStandalone: true, selector: "pp-app-definition-container", viewQueries: [{ propertyName: "publishActionsTpl", first: true, predicate: ["publishActionsTpl"], descendants: true, isSignal: true }, { propertyName: "baseEntityHost", first: true, predicate: BaseFormHostDirective, descendants: true, read: BaseFormHostDirective, static: true }], ngImport: i0, template: `
2485
+ var AppDefinitionContainerComponent = class AppDefinitionContainerComponent {
2486
+ containerComponentRef;
2487
+ baseEntityHost;
2488
+ publishActionsTpl = viewChild("publishActionsTpl", ...ngDevMode ? [{ debugName: "publishActionsTpl" }] : /* istanbul ignore next */ []);
2489
+ store = inject(AppDefinitionStore);
2490
+ entityDescriptor;
2491
+ publishButtonKey = PUBLISH_BUTTON_I18N_KEY;
2492
+ publishTooltipKey = PUBLISH_TOOLTIP_I18N_KEY;
2493
+ canPublish = computed(() => !this.store.isLoading() && !!this.store.currentEntity()?.id, ...ngDevMode ? [{ debugName: "canPublish" }] : /* istanbul ignore next */ []);
2494
+ constructor() {
2495
+ this.entityDescriptor = createAppDefinitionDescriptor();
2496
+ this.entityDescriptor.store = this.store;
2497
+ this.entityDescriptor.extraFormActionsTemplate = () => this.publishActionsTpl();
2498
+ this.entityDescriptor.extraTabs = [APP_PREVIEW_TAB];
2499
+ }
2500
+ ngOnDestroy() {
2501
+ if (this.containerComponentRef) this.containerComponentRef.destroy();
2502
+ }
2503
+ async onPublish() {
2504
+ const id = this.store.currentEntity()?.id;
2505
+ if (!id) return;
2506
+ await this.store.publish(id);
2507
+ }
2508
+ static ɵfac = i0.ɵɵngDeclareFactory({
2509
+ minVersion: "12.0.0",
2510
+ version: "22.1.7",
2511
+ ngImport: i0,
2512
+ type: AppDefinitionContainerComponent,
2513
+ deps: [],
2514
+ target: i0.ɵɵFactoryTarget.Component
2515
+ });
2516
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2517
+ minVersion: "17.2.0",
2518
+ version: "22.1.7",
2519
+ type: AppDefinitionContainerComponent,
2520
+ isStandalone: true,
2521
+ selector: "pp-app-definition-container",
2522
+ viewQueries: [{
2523
+ propertyName: "publishActionsTpl",
2524
+ first: true,
2525
+ predicate: ["publishActionsTpl"],
2526
+ descendants: true,
2527
+ isSignal: true
2528
+ }, {
2529
+ propertyName: "baseEntityHost",
2530
+ first: true,
2531
+ predicate: BaseFormHostDirective,
2532
+ descendants: true,
2533
+ read: BaseFormHostDirective,
2534
+ static: true
2535
+ }],
2536
+ ngImport: i0,
2537
+ template: `
2222
2538
  <base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>
2223
2539
  <ng-template #publishActionsTpl>
2224
2540
  <button id="publish" type="button" mat-raised-button color="accent" [disabled]="!canPublish()" [matTooltip]="publishTooltipKey | transloco" (click)="onPublish()">
2225
2541
  {{ publishButtonKey | transloco }}
2226
2542
  </button>
2227
2543
  </ng-template>
2228
- `, isInline: true, dependencies: [{ kind: "component", type: BaseEntityContainerComponent, selector: "base-entity-container", inputs: ["entityDescriptor", "facade"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
2229
- }
2230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionContainerComponent, decorators: [{
2231
- type: Component,
2232
- args: [{
2233
- selector: 'pp-app-definition-container',
2234
- standalone: true,
2235
- imports: [BaseEntityContainerComponent, MatButton, MatTooltip, TranslocoPipe],
2236
- template: `
2544
+ `,
2545
+ isInline: true,
2546
+ dependencies: [
2547
+ {
2548
+ kind: "component",
2549
+ type: BaseEntityContainerComponent,
2550
+ selector: "base-entity-container",
2551
+ inputs: ["entityDescriptor", "facade"]
2552
+ },
2553
+ {
2554
+ kind: "component",
2555
+ type: MatButton,
2556
+ selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
2557
+ inputs: ["matButton"],
2558
+ exportAs: ["matButton", "matAnchor"]
2559
+ },
2560
+ {
2561
+ kind: "directive",
2562
+ type: MatTooltip,
2563
+ selector: "[matTooltip]",
2564
+ inputs: [
2565
+ "matTooltipPosition",
2566
+ "matTooltipPositionAtOrigin",
2567
+ "matTooltipDisabled",
2568
+ "matTooltipShowDelay",
2569
+ "matTooltipHideDelay",
2570
+ "matTooltipTouchGestures",
2571
+ "matTooltip",
2572
+ "matTooltipClass"
2573
+ ],
2574
+ exportAs: ["matTooltip"]
2575
+ },
2576
+ {
2577
+ kind: "pipe",
2578
+ type: TranslocoPipe,
2579
+ name: "transloco"
2580
+ }
2581
+ ]
2582
+ });
2583
+ };
2584
+ i0.ɵɵngDeclareClassMetadata({
2585
+ minVersion: "12.0.0",
2586
+ version: "22.1.7",
2587
+ ngImport: i0,
2588
+ type: AppDefinitionContainerComponent,
2589
+ decorators: [{
2590
+ type: Component,
2591
+ args: [{
2592
+ selector: "pp-app-definition-container",
2593
+ standalone: true,
2594
+ imports: [
2595
+ BaseEntityContainerComponent,
2596
+ MatButton,
2597
+ MatTooltip,
2598
+ TranslocoPipe
2599
+ ],
2600
+ template: `
2237
2601
  <base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>
2238
2602
  <ng-template #publishActionsTpl>
2239
2603
  <button id="publish" type="button" mat-raised-button color="accent" [disabled]="!canPublish()" [matTooltip]="publishTooltipKey | transloco" (click)="onPublish()">
2240
2604
  {{ publishButtonKey | transloco }}
2241
2605
  </button>
2242
2606
  </ng-template>
2243
- `,
2244
- }]
2245
- }], ctorParameters: () => [], propDecorators: { baseEntityHost: [{
2246
- type: ViewChild,
2247
- args: [BaseFormHostDirective, { static: true, read: BaseFormHostDirective }]
2248
- }], publishActionsTpl: [{ type: i0.ViewChild, args: ['publishActionsTpl', { isSignal: true }] }] } });
2249
-
2250
- /**
2251
- * Hosts the generic container for `Module Definition`, whose only job is to bind the descriptor to the
2252
- * store the routable screens read from.
2253
- *
2254
- * Deliberately without the `Publish` action `AppDefinitionContainerComponent` contributes: publishing is
2255
- * an application operation. An app is what a user navigates to and its status is what decides whether a
2256
- * mount is live, so a module with a lifecycle of its own would make "which version of what is live" a
2257
- * question with two answers.
2258
- */
2259
- class ModuleDefinitionContainerComponent {
2260
- store = inject(ModuleDefinitionStore);
2261
- entityDescriptor;
2262
- constructor() {
2263
- this.entityDescriptor = createModuleDefinitionDescriptor();
2264
- this.entityDescriptor.store = this.store;
2265
- }
2266
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2267
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: ModuleDefinitionContainerComponent, isStandalone: true, selector: "pp-module-definition-container", ngImport: i0, template: `<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>`, isInline: true, dependencies: [{ kind: "component", type: BaseEntityContainerComponent, selector: "base-entity-container", inputs: ["entityDescriptor", "facade"] }] });
2268
- }
2269
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionContainerComponent, decorators: [{
2270
- type: Component,
2271
- args: [{
2272
- selector: 'pp-module-definition-container',
2273
- standalone: true,
2274
- imports: [BaseEntityContainerComponent],
2275
- template: `<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>`,
2276
- }]
2277
- }], ctorParameters: () => [] });
2278
-
2279
- /**
2280
- * The facades of the whole definition graph, to be spread into the application's `providers`.
2281
- *
2282
- * The embedded ones are here for the same reason the routable one is: an embedded entity has a facade
2283
- * like any other — that is what gives it a store — and only its repository differs, reading and writing
2284
- * the `App Definition` document rather than an endpoint of its own.
2285
- */
2286
- const BASE_APP_FACADE_PROVIDERS = [AppDefinitionFacade, ModuleDefinitionFacade, AppRegionFacade, AppRouteFacade, AppModuleMountFacade, AppNavItemFacade, AppWidgetFacade];
2287
- /**
2288
- * The same facades keyed by entity name, to be spread into the application's
2289
- * `BASE_ENTITY_FACADE_REGISTRY` value.
2290
- *
2291
- * Every entity an `EMBEDDED_COMPONENTS` attribute of this library names has to appear here, or the
2292
- * control throws on first render rather than showing a list whose rows go nowhere on save — the
2293
- * registry is how it reaches the child's store and descriptor. Spread rather than provided separately,
2294
- * because the token holds one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the
2295
- * application's own entities instead of adding to them.
2296
- */
2297
- const BASE_APP_ENTITY_FACADES = {
2298
- [APP_DEFINITION_ENTITY_NAME]: AppDefinitionFacade,
2299
- [MODULE_DEFINITION_ENTITY_NAME]: ModuleDefinitionFacade,
2300
- [APP_REGION_ENTITY_NAME]: AppRegionFacade,
2301
- [APP_ROUTE_ENTITY_NAME]: AppRouteFacade,
2302
- [APP_MODULE_MOUNT_ENTITY_NAME]: AppModuleMountFacade,
2303
- [APP_NAV_ITEM_ENTITY_NAME]: AppNavItemFacade,
2304
- [APP_WIDGET_ENTITY_NAME]: AppWidgetFacade,
2607
+ `
2608
+ }]
2609
+ }],
2610
+ ctorParameters: () => [],
2611
+ propDecorators: {
2612
+ baseEntityHost: [{
2613
+ type: ViewChild,
2614
+ args: [BaseFormHostDirective, {
2615
+ static: true,
2616
+ read: BaseFormHostDirective
2617
+ }]
2618
+ }],
2619
+ publishActionsTpl: [{
2620
+ type: i0.ViewChild,
2621
+ args: ["publishActionsTpl", { isSignal: true }]
2622
+ }]
2623
+ }
2624
+ });
2625
+ var ModuleDefinitionContainerComponent = class ModuleDefinitionContainerComponent {
2626
+ store = inject(ModuleDefinitionStore);
2627
+ entityDescriptor;
2628
+ constructor() {
2629
+ this.entityDescriptor = createModuleDefinitionDescriptor();
2630
+ this.entityDescriptor.store = this.store;
2631
+ }
2632
+ static ɵfac = i0.ɵɵngDeclareFactory({
2633
+ minVersion: "12.0.0",
2634
+ version: "22.1.7",
2635
+ ngImport: i0,
2636
+ type: ModuleDefinitionContainerComponent,
2637
+ deps: [],
2638
+ target: i0.ɵɵFactoryTarget.Component
2639
+ });
2640
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2641
+ minVersion: "14.0.0",
2642
+ version: "22.1.7",
2643
+ type: ModuleDefinitionContainerComponent,
2644
+ isStandalone: true,
2645
+ selector: "pp-module-definition-container",
2646
+ ngImport: i0,
2647
+ template: `<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>`,
2648
+ isInline: true,
2649
+ dependencies: [{
2650
+ kind: "component",
2651
+ type: BaseEntityContainerComponent,
2652
+ selector: "base-entity-container",
2653
+ inputs: ["entityDescriptor", "facade"]
2654
+ }]
2655
+ });
2305
2656
  };
2306
-
2307
- /**
2308
- * The path segment has to be `snakeCaseName('App Definition')`, because
2309
- * `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — see the same
2310
- * constraint on `BASE_RULE_ROUTES`.
2311
- */
2312
- const BASE_APP_ROUTES = [
2313
- {
2314
- path: 'app-definition',
2315
- title: 'ProcessPuzzle Design - Applications',
2316
- data: { icon: 'web', menuTitle: 'design.applications', entityName: APP_DEFINITION_ENTITY_NAME },
2317
- component: AppDefinitionContainerComponent,
2318
- providers: [authoringScopes()],
2319
- children: baseEntityRoutes(embeddedDefinitionRoutes(), [APP_PREVIEW_TAB]),
2320
- },
2321
- // A sibling rather than a child of the branch above: a module is an aggregate of its own, with its own
2322
- // endpoints and its own list screen. What ties the two together is data — a `ModuleMount` naming a key —
2323
- // and the run-time shell that resolves it, not the authoring URL.
2324
- {
2325
- path: 'module-definition',
2326
- title: 'ProcessPuzzle Design - Modules',
2327
- data: { icon: 'extension', menuTitle: 'design.modules', entityName: MODULE_DEFINITION_ENTITY_NAME },
2328
- component: ModuleDefinitionContainerComponent,
2329
- providers: [authoringScopes()],
2330
- children: baseEntityRoutes([routeRoute()]),
2331
- },
2657
+ i0.ɵɵngDeclareClassMetadata({
2658
+ minVersion: "12.0.0",
2659
+ version: "22.1.7",
2660
+ ngImport: i0,
2661
+ type: ModuleDefinitionContainerComponent,
2662
+ decorators: [{
2663
+ type: Component,
2664
+ args: [{
2665
+ selector: "pp-module-definition-container",
2666
+ standalone: true,
2667
+ imports: [BaseEntityContainerComponent],
2668
+ template: `<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>`
2669
+ }]
2670
+ }],
2671
+ ctorParameters: () => []
2672
+ });
2673
+ const BASE_APP_FACADE_PROVIDERS = [
2674
+ AppDefinitionFacade,
2675
+ ModuleDefinitionFacade,
2676
+ AppRegionFacade,
2677
+ AppRouteFacade,
2678
+ AppModuleMountFacade,
2679
+ AppNavItemFacade,
2680
+ AppWidgetFacade
2332
2681
  ];
2333
- /**
2334
- * The transloco scopes every authoring branch of this library needs. Both are required: a route that
2335
- * declares TRANSLOCO_SCOPE replaces the collection it inherits rather than adding to it, and the generic
2336
- * tabs translate the framework's own `base_entity.*` keys (see BASE_ENTITY_TRANSLOCO_SCOPE).
2337
- *
2338
- * Registered on the top-level routes rather than on the containers, so the base-entity tabs, list and form
2339
- * rendered in the child routes resolve entity and attribute labels from the same scopes. The embedded
2340
- * branches below need none of their own: `base_app.app_region.*` and its siblings are keys of the scope
2341
- * already registered here.
2342
- *
2343
- * Both aliases are spelled out, as everywhere in this workspace: transloco camel-cases the default alias,
2344
- * so `base_app` would silently become `baseApp` and miss every key below it.
2345
- */
2682
+ const BASE_APP_ENTITY_FACADES = {
2683
+ [APP_DEFINITION_ENTITY_NAME]: AppDefinitionFacade,
2684
+ [MODULE_DEFINITION_ENTITY_NAME]: ModuleDefinitionFacade,
2685
+ [APP_REGION_ENTITY_NAME]: AppRegionFacade,
2686
+ [APP_ROUTE_ENTITY_NAME]: AppRouteFacade,
2687
+ [APP_MODULE_MOUNT_ENTITY_NAME]: AppModuleMountFacade,
2688
+ [APP_NAV_ITEM_ENTITY_NAME]: AppNavItemFacade,
2689
+ [APP_WIDGET_ENTITY_NAME]: AppWidgetFacade
2690
+ };
2691
+ const BASE_APP_ROUTES = [{
2692
+ path: "app-definition",
2693
+ title: "ProcessPuzzle Design - Applications",
2694
+ data: {
2695
+ icon: "web",
2696
+ menuTitle: "design.applications",
2697
+ entityName: APP_DEFINITION_ENTITY_NAME
2698
+ },
2699
+ component: AppDefinitionContainerComponent,
2700
+ providers: [authoringScopes()],
2701
+ children: baseEntityRoutes(embeddedDefinitionRoutes(), [APP_PREVIEW_TAB])
2702
+ }, {
2703
+ path: "module-definition",
2704
+ title: "ProcessPuzzle Design - Modules",
2705
+ data: {
2706
+ icon: "extension",
2707
+ menuTitle: "design.modules",
2708
+ entityName: MODULE_DEFINITION_ENTITY_NAME
2709
+ },
2710
+ component: ModuleDefinitionContainerComponent,
2711
+ providers: [authoringScopes()],
2712
+ children: baseEntityRoutes([routeRoute()])
2713
+ }];
2346
2714
  function authoringScopes() {
2347
- return provideTranslocoScope({ scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE }, { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE });
2715
+ return provideTranslocoScope({
2716
+ scope: BASE_ENTITY_TRANSLOCO_SCOPE,
2717
+ alias: BASE_ENTITY_TRANSLOCO_SCOPE
2718
+ }, {
2719
+ scope: BASE_APP_TRANSLOCO_SCOPE,
2720
+ alias: BASE_APP_TRANSLOCO_SCOPE
2721
+ });
2348
2722
  }
2349
- /**
2350
- * The definition graph as route branches: a region, a route and a module mount hang below the
2351
- * definition's details route, a nav item and a widget below the region's, a widget below the route's,
2352
- * and a nav item below itself.
2353
- *
2354
- * The nesting mirrors the containment of `base-app-api.yaml` exactly, and it has to: an embedded row has
2355
- * no id of its own to be looked up by, so the URL — `app-definition/claims-app/details/app-region/sidenav/
2356
- * details/app-nav-item/nav-claims/details` — is what addresses it, and each segment resolves against the
2357
- * rows of the level above it.
2358
- *
2359
- * These are the *authoring* routes and have nothing to do with the routes an `AppDefinition` declares:
2360
- * `App Route` rows are data here, and it is the run-time shell that turns them into `Routes` of their
2361
- * own. A module mount is a leaf — the module it names is a separate aggregate with its own endpoints,
2362
- * so its routes are authored there rather than through this branch.
2363
- */
2364
2723
  function embeddedDefinitionRoutes() {
2365
- return [
2366
- { entityName: APP_REGION_ENTITY_NAME, facade: AppRegionFacade, children: () => [navItemRoute(), widgetRoute()] },
2367
- routeRoute(),
2368
- { entityName: APP_MODULE_MOUNT_ENTITY_NAME, facade: AppModuleMountFacade },
2369
- ];
2724
+ return [
2725
+ {
2726
+ entityName: APP_REGION_ENTITY_NAME,
2727
+ facade: AppRegionFacade,
2728
+ children: () => [navItemRoute(), widgetRoute()]
2729
+ },
2730
+ routeRoute(),
2731
+ {
2732
+ entityName: APP_MODULE_MOUNT_ENTITY_NAME,
2733
+ facade: AppModuleMountFacade
2734
+ }
2735
+ ];
2370
2736
  }
2371
- /**
2372
- * The `App Route` branch, shared by both aggregates that own routes: an app's `routes` and a module's are
2373
- * the same rows edited by the same descriptor, so the branch below them has to be the same too. Only the
2374
- * URL prefix differs — `app-definition/demo/details/app-route/...` against
2375
- * `module-definition/claims/details/app-route/...`.
2376
- */
2377
2737
  function routeRoute() {
2378
- return { entityName: APP_ROUTE_ENTITY_NAME, facade: AppRouteFacade, children: () => [widgetRoute()] };
2738
+ return {
2739
+ entityName: APP_ROUTE_ENTITY_NAME,
2740
+ facade: AppRouteFacade,
2741
+ children: () => [widgetRoute()]
2742
+ };
2379
2743
  }
2380
- /** A nav item nests in itself — a group node's children are nav items. Hence the thunk: the structure is
2381
- * infinite, and `loadChildren` expands one level per navigation. */
2382
2744
  function navItemRoute() {
2383
- return { entityName: APP_NAV_ITEM_ENTITY_NAME, facade: AppNavItemFacade, children: () => [navItemRoute()] };
2745
+ return {
2746
+ entityName: APP_NAV_ITEM_ENTITY_NAME,
2747
+ facade: AppNavItemFacade,
2748
+ children: () => [navItemRoute()]
2749
+ };
2384
2750
  }
2385
- /**
2386
- * A widget, unlike a nav item, is a leaf branch: widgets do not nest, so there is no deeper level to
2387
- * expand. A container widget places its siblings by id through `props.childIds`, and those siblings are
2388
- * rows of this same list — reachable at this level, not below it.
2389
- */
2390
2751
  function widgetRoute() {
2391
- return { entityName: APP_WIDGET_ENTITY_NAME, facade: AppWidgetFacade };
2752
+ return {
2753
+ entityName: APP_WIDGET_ENTITY_NAME,
2754
+ facade: AppWidgetFacade
2755
+ };
2392
2756
  }
2757
+ export { APP_DEFINITION_ENTITY_NAME, APP_DEFINITION_I18N_SCOPE, APP_MODULE_MOUNT_ENTITY_NAME, APP_MODULE_MOUNT_I18N_SCOPE, APP_MODULE_MOUNT_ID_FIELD, APP_NAV_ITEM_ENTITY_NAME, APP_NAV_ITEM_I18N_SCOPE, APP_PREVIEW_I18N_KEY, APP_PREVIEW_TAB, APP_REGION_ENTITY_NAME, APP_REGION_I18N_SCOPE, APP_REGION_ID_FIELD, APP_ROUTE_ENTITY_NAME, APP_ROUTE_I18N_SCOPE, APP_ROUTE_ID_FIELD, APP_WIDGET_ENTITY_NAME, APP_WIDGET_I18N_SCOPE, AppDefinition, AppDefinitionContainerComponent, AppDefinitionFacade, AppDefinitionMapper, AppDefinitionService, AppDefinitionStatus, AppDefinitionStore, AppModuleMountFacade, AppNavItemFacade, AppPreviewComponent, AppRegionFacade, AppRegionRenderer, AppRouteFacade, AppRouteRenderer, AppShellComponent, AppShellRoutesFactory, AppWidgetFacade, BASE_APP_ENTITY_FACADES, BASE_APP_FACADE_PROVIDERS, BASE_APP_ROUTES, BASE_APP_TRANSLATION_SOURCE, BASE_APP_TRANSLOCO_SCOPE, COLOR_SCHEMES, ENTITY_MODES, LAYOUT_PRESETS, MATERIAL_THEMES, MODULE_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_I18N_SCOPE, ModuleDefinition, ModuleDefinitionContainerComponent, ModuleDefinitionFacade, ModuleDefinitionMapper, ModuleDefinitionService, ModuleDefinitionStore, ModuleMount, NavItem, REGION_TYPES, ROUTE_TARGET_KINDS, RegionDefinition, RegionFooterComponent, RegionHeaderComponent, RegionNavComponent, RouteDefinition, RouteUnsupportedComponent, RouteWidgetsComponent, SIDENAV_MODES, WIDGET_PLACEMENTS, WidgetInstance, WidgetListComponent, appShellRoutesGuard, buildAppRoutes, createAppDefinitionDescriptor, createModuleDefinitionDescriptor, createModuleMountDescriptor, createNavItemDescriptor, createRegionDefinitionDescriptor, createRouteDefinitionDescriptor, createWidgetInstanceDescriptor, layoutOf, moduleTranslocoScope, themeVarsOf };
2393
2758
 
2394
- /*
2395
- * Public API Surface of @processpuzzle/base-app
2396
- */
2397
-
2398
- /**
2399
- * Generated bundle index. Do not edit.
2400
- */
2401
-
2402
- export { APP_DEFINITION_ENTITY_NAME, APP_DEFINITION_I18N_SCOPE, APP_MODULE_MOUNT_ENTITY_NAME, APP_MODULE_MOUNT_I18N_SCOPE, APP_MODULE_MOUNT_ID_FIELD, APP_NAV_ITEM_ENTITY_NAME, APP_NAV_ITEM_I18N_SCOPE, APP_PREVIEW_I18N_KEY, APP_PREVIEW_TAB, APP_REGION_ENTITY_NAME, APP_REGION_I18N_SCOPE, APP_REGION_ID_FIELD, APP_ROUTE_ENTITY_NAME, APP_ROUTE_I18N_SCOPE, APP_ROUTE_ID_FIELD, APP_WIDGET_ENTITY_NAME, APP_WIDGET_I18N_SCOPE, AppDefinition, AppDefinitionContainerComponent, AppDefinitionFacade, AppDefinitionMapper, AppDefinitionService, AppDefinitionStatus, AppDefinitionStore, AppModuleMountFacade, AppNavItemFacade, AppPreviewComponent, AppRegionFacade, AppRegionRenderer, AppRouteFacade, AppRouteRenderer, AppShellComponent, AppShellRoutesFactory, AppWidgetFacade, BASE_APP_ENTITY_FACADES, BASE_APP_FACADE_PROVIDERS, BASE_APP_ROUTES, BASE_APP_TRANSLATION_SOURCE, BASE_APP_TRANSLOCO_SCOPE, COLOR_SCHEMES, ENTITY_MODES, LAYOUT_PRESETS, MATERIAL_THEMES, MODULE_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_I18N_SCOPE, ModuleDefinition, ModuleDefinitionContainerComponent, ModuleDefinitionFacade, ModuleDefinitionMapper, ModuleDefinitionService, ModuleDefinitionStore, ModuleMount, NavItem, REGION_TYPES, ROUTE_TARGET_KINDS, RegionDefinition, RegionFooterComponent, RegionHeaderComponent, RegionNavComponent, RouteDefinition, RouteUnsupportedComponent, RouteWidgetsComponent, SIDENAV_MODES, WidgetListComponent, appShellRoutesGuard, buildAppRoutes, createAppDefinitionDescriptor, createModuleDefinitionDescriptor, createModuleMountDescriptor, createNavItemDescriptor, createRegionDefinitionDescriptor, createRouteDefinitionDescriptor, createWidgetInstanceDescriptor, layoutOf, moduleTranslocoScope, themeVarsOf };
2403
- //# sourceMappingURL=processpuzzle-base-app.mjs.map
2759
+ //# sourceMappingURL=processpuzzle-base-app.mjs.map