@processpuzzle/base-app 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"processpuzzle-base-app.mjs","names":[],"sources":["../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.ts","../../../../libs/js-shared/base-app-frontend/src/lib/base-app.i18n.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-entity-names.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-mount.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/region-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/route-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/nav-item.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/widget-instance.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/route-definition.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.store.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.store.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-definition.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/module-definition.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-module-mount.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-nav-item.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-route-builder.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/widget-list.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/route-widgets.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/route-unsupported.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-route-renderer.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-region.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-route.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-widget.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-shell.model.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/region-footer.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/region-header.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/region-nav.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-region.renderer.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/shell-application-context.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/shell-overlay-container.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-shell.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-preview.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-shell-routes.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-preview-tab.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-definition-container.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/module-definition-container.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/base-app.providers.ts","../../../../libs/js-shared/base-app-frontend/src/lib/base-app.routes.ts"],"sourcesContent":["import { BaseEntity } from '@processpuzzle/base-entity';\nimport { THEME_COLOR_SCHEMES, THEME_PRESETS, ThemeColorScheme, ThemePreset, WidgetInstance } from '@processpuzzle/widgets';\n\nexport { WIDGET_PLACEMENTS, WidgetInstance, WidgetPlacement } from '@processpuzzle/widgets';\n\n/**\n * Frontend model of the `AppDefinition` schema of `base-app-api.yaml`. `theme` and `layout` are\n * flattened onto the entity by {@link AppDefinitionMapper} so that the generated form can offer a\n * typed control per field; the original objects are kept alongside, because a full replacement PUT\n * would otherwise drop the parts no control writes. `regions`, `routes` and `modules` stay nested and\n * are edited through the `EMBEDDED_COMPONENTS` controls of the `App Region` / `App Route` /\n * `App Module Mount` descriptors.\n *\n * A route's `target` is flattened the same way, for the same reason and by the same mapper. The\n * contract already keeps `RouteTarget` flat rather than a `oneOf` because the generic form cannot edit\n * a discriminated union of classes; a nested object it equally cannot reach, since an\n * `EMBEDDED_COMPONENTS` row is edited as the parsed JSON it arrived as and a descriptor addresses one\n * property, not a path. So {@link RouteDefinition} carries `kind` and the per-kind fields directly and\n * {@link AppDefinitionMapper} re-nests them on save.\n *\n * The nested definitions are classes rather than interfaces, because each is an embedded entity of\n * its own: `EmbeddedEntityFacade` mints the blank row an `Add` opens the child's form on, and that\n * needs a constructor. They stay plain data — the rows of a loaded aggregate are the parsed JSON,\n * never instances of these classes, so nothing may rely on `instanceof` or on a method.\n */\n\n/**\n * The theme presets and colour schemes the contract's `MaterialTheme` / `ColorScheme` enums allow. They are\n * the widgets library's lists, because that is where the stylesheet defining them and the `ThemesButton`\n * picking from them live.\n */\nexport const MATERIAL_THEMES = THEME_PRESETS;\nexport type MaterialTheme = ThemePreset;\n\nexport const COLOR_SCHEMES = THEME_COLOR_SCHEMES;\nexport type ColorScheme = ThemeColorScheme;\n\nexport const LAYOUT_PRESETS = ['sidenav-left', 'sidenav-right', 'top-nav'] as const;\nexport type LayoutPreset = (typeof LAYOUT_PRESETS)[number];\n\nexport const SIDENAV_MODES = ['side', 'over', 'push'] as const;\nexport type SidenavMode = (typeof SIDENAV_MODES)[number];\n\n/**\n * No `content`: once routes own the content area it *is* the router outlet, so a content region would\n * have no field of its own — `widgets` is header/footer-only and `navItems` sidenav-only. Its sizing\n * lives in {@link LayoutDefinition.contentMaxWidth}.\n */\nexport const REGION_TYPES = ['header', 'sidenav', 'footer'] as const;\nexport type RegionType = (typeof REGION_TYPES)[number];\n\n/**\n * What a route renders. Uppercase because the contract's enum is — `RegionType` and the theme enums\n * are lowercase, and mixing the two up is a silent miss rather than a type error once a value reaches\n * JSON.\n */\nexport const ROUTE_TARGET_KINDS = ['WIDGETS', 'DOCUMENT', 'ENTITY'] as const;\nexport type RouteTargetKind = (typeof ROUTE_TARGET_KINDS)[number];\n\nexport const ENTITY_MODES = ['LIST', 'DETAILS'] as const;\nexport type EntityMode = (typeof ENTITY_MODES)[number];\n\nexport enum AppDefinitionStatus {\n DRAFT = 'DRAFT',\n PUBLISHED = 'PUBLISHED',\n}\n\nexport interface ThemeDefinition {\n materialTheme?: MaterialTheme;\n colorScheme?: ColorScheme;\n /** Overrides for the `--pp-*` custom properties of `base-widget-frontend/src/theme/pp-colors.css`. */\n tokenOverrides?: Record<string, string>;\n logoUrl?: string;\n faviconUrl?: string;\n}\n\nexport interface LayoutDefinition {\n preset?: LayoutPreset;\n sidenavMode?: SidenavMode;\n sidenavCollapsible?: boolean;\n sidenavOpenByDefault?: boolean;\n contentMaxWidth?: string;\n}\n\nexport class NavItem implements BaseEntity {\n id: string;\n label: string;\n translocoId?: string;\n icon?: string;\n /**\n * `RouteDefinition.path` of the route this entry navigates to, resolved by string. Absent on a group\n * node, which expands its {@link children} instead of navigating.\n *\n * A path naming no route is a validation *warning* server-side, not an error: it may name a route of\n * a module that has not been authored yet, and modules stay loosely coupled.\n */\n routePath?: string;\n roles?: string[];\n children?: NavItem[];\n\n constructor(init: Partial<NavItem> = {}) {\n this.id = init.id ?? '';\n this.label = init.label ?? '';\n this.translocoId = init.translocoId;\n this.icon = init.icon;\n this.routePath = init.routePath;\n this.roles = init.roles;\n this.children = init.children;\n }\n}\n\nexport class RegionDefinition implements BaseEntity {\n /**\n * Declared, never assigned. The contract gives a region no `id` — `type` identifies it, see\n * `APP_REGION_ID_FIELD` — but `BaseEntity`'s only property is an optional `id`, and TypeScript's\n * weak-type rule rejects a type that shares no property with it. `declare` emits nothing, so the\n * payload stays exactly the shape the schema describes.\n */\n declare readonly id?: string;\n\n /**\n * Required by the contract, but undefined while a region is being created — the dropdown is declared\n * `required`, so the form is what enforces the contract before the row reaches the payload.\n */\n type: RegionType | undefined;\n /** `sidenav` only; left undefined so a header region's payload carries no empty nav tree. */\n navItems?: NavItem[];\n /** `header` / `footer` only. */\n widgets?: WidgetInstance[];\n\n constructor(init: Partial<RegionDefinition> = {}) {\n this.type = init.type;\n this.navItems = init.navItems;\n this.widgets = init.widgets;\n }\n}\n\n/**\n * The nested `target` object of the DTO. Only {@link AppDefinitionMapper} handles it — the form works\n * on the fields {@link RouteDefinition} carries flattened — so it is an interface rather than a class.\n */\nexport interface RouteTarget {\n kind: RouteTargetKind;\n /** WIDGETS only. */\n widgets?: WidgetInstance[];\n /** DOCUMENT only. */\n documentSlug?: string;\n /** ENTITY only. */\n entityName?: string;\n /** ENTITY only. */\n entityMode?: EntityMode;\n /** ENTITY + LIST only. */\n rsqlFilter?: string;\n}\n\n/**\n * One navigable route. **Flat: a route has no children.** `path` may be multi-segment, so `claims`,\n * `claims/open` and `claims/:id` are three sibling entries rather than a tree — Angular's own nesting\n * is derived from those prefixes when the shell builds its `Routes`, because nesting is a rendering\n * concern rather than something worth authoring. Structure is broken up at the module boundary\n * instead, through {@link ModuleMount}.\n *\n * The `target` fields are flattened onto the row and re-nested by {@link AppDefinitionMapper}; which of\n * them are meaningful follows from {@link kind}, and the backend — not the form — is what enforces it.\n */\nexport class RouteDefinition implements BaseEntity {\n /**\n * Declared, never assigned. The contract gives a route no `id`: `path` identifies it, which is what\n * a `NavItem.routePath` resolves against. Same reason as {@link RegionDefinition.id}.\n */\n declare readonly id?: string;\n\n /** Relative to the app root, no leading slash. May contain `/` for depth and `:name` for a parameter. */\n path: string;\n title: string;\n translocoId?: string;\n icon?: string;\n /** Empty or absent means any authenticated member of the organization, as on {@link NavItem.roles}. */\n roles?: string[];\n // region flattened target — re-nested into `target` by AppDefinitionMapper\n /**\n * Required by the contract, but undefined while a route is being created — the dropdown is declared\n * `required`, so the form is what enforces it before the row reaches the payload.\n */\n kind: RouteTargetKind | undefined;\n /** WIDGETS only. Starts as an empty array so the embedded list has something to append to. */\n widgets: WidgetInstance[];\n documentSlug?: string;\n entityName?: string;\n entityMode?: EntityMode;\n rsqlFilter?: string;\n // endregion\n /** The object the flattened fields came from, preserved so a save cannot drop a future field. */\n target?: RouteTarget;\n\n constructor(init: Partial<RouteDefinition> = {}) {\n this.path = init.path ?? '';\n this.title = init.title ?? '';\n this.translocoId = init.translocoId;\n this.icon = init.icon;\n this.roles = init.roles;\n this.kind = init.kind;\n this.widgets = init.widgets ?? [];\n this.documentSlug = init.documentSlug;\n this.entityName = init.entityName;\n this.entityMode = init.entityMode;\n this.rsqlFilter = init.rsqlFilter;\n this.target = init.target;\n }\n}\n\n/**\n * Mounts a module's routes under {@link basePath}. The one place route structure composes, and it\n * composes exactly one level deep: a module cannot mount modules.\n */\nexport class ModuleMount implements BaseEntity {\n /** `moduleKey` identifies the mount; the contract gives it no `id`. */\n declare readonly id?: string;\n\n /**\n * Key of a `ModuleDefinition` in this organization. One naming no existing module is a validation\n * warning, not an error — an app may mount a module before it has been authored.\n */\n moduleKey: string;\n basePath: string;\n\n constructor(init: Partial<ModuleMount> = {}) {\n this.moduleKey = init.moduleKey ?? '';\n this.basePath = init.basePath ?? '';\n }\n}\n\nexport class AppDefinition implements BaseEntity {\n /** Unique within the organization and used verbatim as the run-time route segment. */\n id: string;\n name: string;\n translocoId: string | undefined;\n description: string | undefined;\n // region flattened theme\n materialTheme: MaterialTheme | undefined;\n colorScheme: ColorScheme | undefined;\n tokenOverrides: Record<string, string> | undefined;\n logoUrl: string | undefined;\n faviconUrl: string | undefined;\n // endregion\n // region flattened layout\n preset: LayoutPreset | undefined;\n sidenavMode: SidenavMode | undefined;\n sidenavCollapsible: boolean;\n sidenavOpenByDefault: boolean;\n contentMaxWidth: string | undefined;\n // endregion\n /** The objects the flattened fields came from, preserved so a save cannot drop a future field. */\n theme: ThemeDefinition | undefined;\n layout: LayoutDefinition | undefined;\n regions: RegionDefinition[] | undefined;\n routes: RouteDefinition[] | undefined;\n modules: ModuleMount[] | undefined;\n // region server-assigned\n orgKey: string | undefined;\n status: AppDefinitionStatus | undefined;\n version: number | undefined;\n publishedVersion: number | undefined;\n createdAt: string | undefined;\n updatedAt: string | undefined;\n // endregion\n\n constructor(init: Partial<AppDefinition> = {}) {\n this.id = init.id ?? '';\n this.name = init.name ?? '';\n this.translocoId = init.translocoId;\n this.description = init.description;\n this.materialTheme = init.materialTheme;\n this.colorScheme = init.colorScheme;\n this.tokenOverrides = init.tokenOverrides;\n this.logoUrl = init.logoUrl;\n this.faviconUrl = init.faviconUrl;\n this.preset = init.preset;\n this.sidenavMode = init.sidenavMode;\n this.sidenavCollapsible = init.sidenavCollapsible ?? true;\n this.sidenavOpenByDefault = init.sidenavOpenByDefault ?? true;\n this.contentMaxWidth = init.contentMaxWidth;\n this.theme = init.theme;\n this.layout = init.layout;\n this.regions = init.regions;\n this.routes = init.routes;\n this.modules = init.modules;\n this.orgKey = init.orgKey;\n this.status = init.status;\n this.version = init.version;\n this.publishedVersion = init.publishedVersion;\n this.createdAt = init.createdAt;\n this.updatedAt = init.updatedAt;\n }\n}\n","import { BaseEntity } from '@processpuzzle/base-entity';\nimport { RouteDefinition } from './app-definition';\n\n/**\n * Frontend model of the `ModuleDefinition` schema of `base-app-api.yaml`: a lazily-loadable slice of an\n * application, with its own flat route list and its own transloco scope. An {@link ModuleMount} of an\n * `AppDefinition` names one of these by key and mounts its routes under a base path.\n *\n * **What \"lazy\" honestly means.** A module lazy-loads *metadata* — this definition, its routes, its\n * translations, and the documents and descriptors they name. It does **not** lazy-load widget code:\n * widget components are bundled at compile time and resolved through the frontend registry, so a\n * metadata module cannot split a bundle on its own. The wins are that `AppDefinition` stops being one\n * aggregate that has to be loaded, locked and published atomically, and that a module is the unit of\n * authoring permission and versioning. Nothing here should be justified on bundle size.\n *\n * Unlike the region / route / mount classes this one is a **routable** entity: it has endpoints of its\n * own, so it comes with a service, a store and a facade rather than travelling inside another payload.\n */\nexport class ModuleDefinition implements BaseEntity {\n /**\n * The contract calls this field `key`; base-entity keys every store, URL and reference on `id`, so\n * {@link ModuleDefinitionMapper} renames it on the way in and out rather than teaching the framework a\n * second identity field. One name for one thing on this side of the mapper — a `key` property beside\n * `id` could only ever disagree with it.\n *\n * Immutable by contract: `ModuleMount.moduleKey` resolves against it, and a rename would silently\n * unmount the module from every app that mounts it.\n */\n id: string;\n name: string;\n translocoId: string | undefined;\n description: string | undefined;\n /**\n * Transloco scope the module's translations load under. Absent means {@link id}, which is the default\n * the contract states; {@link moduleTranslocoScope} is the one place that default is applied.\n */\n translocoScope: string | undefined;\n /**\n * The module's routes, flat and relative to the base path it is mounted at — the same shape and the\n * same derived nesting as `AppDefinition.routes`, and flattened by the same mapper. A module does not\n * mount modules: this is where composition stops.\n */\n routes: RouteDefinition[] | undefined;\n // region server-assigned\n orgKey: string | undefined;\n version: number | undefined;\n createdAt: string | undefined;\n updatedAt: string | undefined;\n // endregion\n\n constructor(init: Partial<ModuleDefinition> = {}) {\n this.id = init.id ?? '';\n this.name = init.name ?? '';\n this.translocoId = init.translocoId;\n this.description = init.description;\n this.translocoScope = init.translocoScope;\n this.routes = init.routes;\n this.orgKey = init.orgKey;\n this.version = init.version;\n this.createdAt = init.createdAt;\n this.updatedAt = init.updatedAt;\n }\n}\n\n/**\n * The scope a module's translations load under, applying the contract's default. Kept as a function\n * rather than resolved in the mapper, so a definition never carries a `translocoScope` the designer did\n * not author — the field stays empty in the form, and the fallback is a rendering decision.\n */\nexport function moduleTranslocoScope(definition: ModuleDefinition): string {\n return definition.translocoScope?.trim() || definition.id;\n}\n","import type { TranslationSource } from '@processpuzzle/util';\n/**\n * Transloco scope of this library. The translations live in\n * `libs/js-shared/base-app-frontend/src/assets/i18n/base_app/*.json` and are published with the\n * package; a consuming application copies them to `assets/i18n/base_app` (see the testbed's\n * `project.json`). The scope is registered on {@link BASE_APP_ROUTES}, so it loads lazily with the\n * route rather than with the application shell.\n *\n * The alias is spelled out on purpose: transloco camel-cases the default alias, which would turn\n * `base_app` into `baseApp` and silently miss every key below.\n */\nexport const BASE_APP_TRANSLOCO_SCOPE = 'base_app';\n\n/**\n * Scope of the generic framework labels (`base_entity.tabs.*`, `base_entity.toolbar.*`), whose files\n * base-entity owns. It has to be registered next to {@link BASE_APP_TRANSLOCO_SCOPE} wherever the\n * generic screens are hosted: `BaseEntityTabsComponent` translates from it through `TranslocoPipe`,\n * which caches the value it resolved for a key on first render. If only `base_app` were loaded, the\n * tabs would keep the raw key even after the toolbar — which registers this scope for itself —\n * triggers the load.\n */\nexport const BASE_ENTITY_TRANSLOCO_SCOPE = 'base_entity';\n\n/** Key root of the `AppDefinition` entity name (`._self`) and of its attribute labels. */\nexport const APP_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_definition`;\n\n/**\n * Label of the Preview tab. Under this library's own scope rather than `base_entity.tabs.*`: the generic\n * tabs are List and Details, and an application preview is this feature's contribution, not the framework's.\n * Resolved with `{ entity }` like the generic tab labels, so a translation may name the entity if it reads\n * better that way.\n */\nexport const APP_PREVIEW_I18N_KEY = `${APP_DEFINITION_I18N_SCOPE}.tabs.preview`;\n\n/**\n * Key root of the `ModuleDefinition` entity name and attribute labels. A child of this library's scope\n * like the one above, and not to be confused with `ModuleDefinition.translocoScope`, which is a scope an\n * *authored* module's own translations load under — see {@link moduleTranslocoScope}. These keys are the\n * framework's labels for the authoring form; that one is the tenant's content.\n */\nexport const MODULE_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.module_definition`;\n\n/**\n * Key roots of the nested definitions the `AppDefinition` form contains through `EMBEDDED_COMPONENTS`\n * controls. They are children of {@link BASE_APP_TRANSLOCO_SCOPE} rather than scopes of their own,\n * because the whole graph is edited under `BASE_APP_ROUTES` and one scope registration has to cover\n * all of it — the embedded route branches add none.\n */\nexport const APP_REGION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_region`;\nexport const APP_ROUTE_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_route`;\nexport const APP_MODULE_MOUNT_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_module_mount`;\nexport const APP_NAV_ITEM_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_nav_item`;\nexport const APP_WIDGET_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_widget`;\n\n/** Keys of the `Publish` form action contributed by `AppDefinitionContainerComponent`. */\nexport const PUBLISH_BUTTON_I18N_KEY = `${BASE_APP_TRANSLOCO_SCOPE}.publish.button`;\nexport const PUBLISH_TOOLTIP_I18N_KEY = `${BASE_APP_TRANSLOCO_SCOPE}.publish.tooltip`;\n\n/**\n * Where this library's transloco bundles come from when the application ships without its assets.\n *\n * Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into\n * `BASE_ENTITY_FACADE_REGISTRY`. The scopes below normally arrive as static files — the build copies\n * them into `assets/i18n/<scope>` and the loader tries the asset first — so this is reached only by a\n * host that skips that copy step. It is declared here rather than in the application because which\n * backend owns a scope is base-app's knowledge, not its caller's.\n */\nexport const BASE_APP_TRANSLATION_SOURCE: TranslationSource = {\n scopes: ['base_app'],\n serviceRootKey: 'APP_SERVICE_ROOT',\n segment: 'app',\n};\n","/**\n * Entity names of the app-definition graph, kept in one dependency-free module.\n *\n * They live here rather than next to their descriptors because the graph is cyclic: `App Definition`\n * aggregates `App Region`, and `App Region` names `App Definition` as its `componentParent`. Each\n * descriptor module re-exports its own name, so importers are unaffected.\n */\nexport const APP_DEFINITION_ENTITY_NAME = 'App Definition';\n/**\n * A second aggregate root beside `App Definition`, not a part of it — hence no `App` prefix, which in\n * every other name here marks something the app document carries. `App Module Mount` is the row inside\n * an app that *names* one of these.\n */\nexport const MODULE_DEFINITION_ENTITY_NAME = 'Module Definition';\nexport const APP_MODULE_MOUNT_ENTITY_NAME = 'App Module Mount';\nexport const APP_NAV_ITEM_ENTITY_NAME = 'App Nav Item';\nexport const APP_REGION_ENTITY_NAME = 'App Region';\nexport const APP_ROUTE_ENTITY_NAME = 'App Route';\nexport const APP_WIDGET_ENTITY_NAME = 'App Widget';\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType } from '@processpuzzle/base-entity';\nimport { APP_MODULE_MOUNT_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_DEFINITION_ENTITY_NAME, APP_MODULE_MOUNT_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_MODULE_MOUNT_ENTITY_NAME };\n\n/** `ModuleMount` has no `id` — an app mounts a given module once, so `moduleKey` identifies the row. */\nexport const APP_MODULE_MOUNT_ID_FIELD = 'moduleKey';\n\nfunction createModuleMountAttrDescriptors(): AbstractAttrDescriptor[] {\n // A plain text box rather than a FOREIGN_KEY onto the module list: modules stay loosely coupled, so a\n // key naming no existing module is a server-side warning rather than an error, and a dropdown of the\n // modules authored so far would turn that warning into something the form refuses to let happen.\n const moduleKeyAttr = new BaseEntityAttrDescriptor('moduleKey', FormControlType.TEXT_BOX, 'Module Key', undefined, true);\n moduleKeyAttr.required = true;\n moduleKeyAttr.isHeading = true;\n moduleKeyAttr.placeholder = 'Key of a module definition of this organization';\n // Both patterns are the contract's own. Declaring them here makes the form refuse what the backend\n // would refuse anyway, and puts them in the e2e registry, so generated fixtures produce dashed tokens\n // rather than prose the PUT answers with 400.\n moduleKeyAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';\n\n const basePathAttr = new BaseEntityAttrDescriptor('basePath', FormControlType.TEXT_BOX, 'Base Path');\n basePathAttr.required = true;\n basePathAttr.placeholder = 'The module routes are mounted under this prefix, e.g. claims';\n basePathAttr.pattern = '^[a-z0-9][a-z0-9\\\\-/]*$';\n\n const flexBoxContainer = new FlexboxDescriptor([moduleKeyAttr, basePathAttr], FlexDirection.ROW);\n flexBoxContainer.style = { 'column-gap': '10px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createModuleMountDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_MODULE_MOUNT_ENTITY_NAME,\n attrDescriptors: createModuleMountAttrDescriptors(),\n i18nScope: APP_MODULE_MOUNT_I18N_SCOPE,\n componentParent: APP_DEFINITION_ENTITY_NAME,\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { APP_REGION_I18N_SCOPE } from '../base-app.i18n';\nimport { REGION_TYPES } from './app-definition';\nimport { APP_DEFINITION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME, APP_REGION_ENTITY_NAME, APP_WIDGET_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_REGION_ENTITY_NAME };\n\n/**\n * `RegionDefinition` has no `id` — a region is identified by the shell slot it fills, and an app\n * declares each slot at most once. Referencing attributes therefore have to set\n * `referenceIdField = 'type'`; see the `regions` attribute of the `AppDefinition` descriptor.\n */\nexport const APP_REGION_ID_FIELD = 'type';\n\nfunction createRegionDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.DROPDOWN, 'Type', toSelectables(REGION_TYPES), true);\n typeAttr.required = true;\n typeAttr.isHeading = true;\n\n // Per the contract, `navItems` applies to `sidenav` and `widgets` to `header` / `footer`; the\n // schema models them as optional siblings rather than a discriminated union, so both are offered\n // and it is the region's type that decides which one is meaningful. Both are contained: the rows\n // are nested arrays of this region, which is itself nested in the app definition's document.\n const navItemsAttr = new BaseEntityAttrDescriptor('navItems', FormControlType.EMBEDDED_COMPONENTS, 'Nav Items');\n navItemsAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;\n navItemsAttr.hideInTable = true;\n\n const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');\n widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;\n widgetsAttr.hideInTable = true;\n\n const flexBoxContainer = new FlexboxDescriptor([typeAttr, navItemsAttr, widgetsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createRegionDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_REGION_ENTITY_NAME,\n attrDescriptors: createRegionDefinitionAttrDescriptors(),\n i18nScope: APP_REGION_I18N_SCOPE,\n componentParent: APP_DEFINITION_ENTITY_NAME,\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { APP_ROUTE_I18N_SCOPE } from '../base-app.i18n';\nimport { ENTITY_MODES, ROUTE_TARGET_KINDS } from './app-definition';\nimport { APP_DEFINITION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME, APP_WIDGET_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_ROUTE_ENTITY_NAME };\n\n/**\n * `RouteDefinition` has no `id` — `path` identifies a route, and it is what a `NavItem.routePath`\n * resolves against. Referencing attributes therefore have to set `referenceIdField = 'path'`; see the\n * `routePath` attribute of the `App Nav Item` descriptor.\n *\n * Unlike `App Region`'s `type`, this value may contain `/`, so the authoring URL that addresses one row\n * carries it percent-encoded (`app-route/claims%2Fopen/details`). Angular round-trips that, but a\n * reverse proxy that normalizes `%2F` before the SPA sees it would not — worth an e2e case once\n * multi-segment routes are authored in the testbed.\n */\nexport const APP_ROUTE_ID_FIELD = 'path';\n\nfunction createRouteDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n const pathAttr = new BaseEntityAttrDescriptor('path', FormControlType.TEXT_BOX, 'Path', undefined, true);\n pathAttr.required = true;\n pathAttr.placeholder = 'Relative to the app root, e.g. claims/open or claims/:id';\n // The contract's own pattern. Declaring it here is what makes the form reject a value the backend\n // would reject anyway — and it is serialized into the e2e registry, so generated fixtures produce a\n // dashed token instead of a prose value the PUT answers with 400.\n pathAttr.pattern = '^[a-z0-9:][a-z0-9\\\\-:/]*$';\n\n const titleAttr = new BaseEntityAttrDescriptor('title', FormControlType.TEXT_BOX, 'Title');\n titleAttr.required = true;\n titleAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the route title';\n translocoIdAttr.hideInTable = true;\n\n const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');\n iconAttr.placeholder = 'Material or FontAwesome icon name';\n iconAttr.hideInTable = true;\n\n const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');\n rolesAttr.placeholder = 'Empty means any authenticated member of the organization';\n rolesAttr.hideInTable = true;\n\n // region flattened target — re-nested into `target` by AppDefinitionMapper\n // Which of the fields below is meaningful follows from `kind`; all of them are offered, and the\n // backend validator — not the form — is what rejects a combination that makes no sense. The generic\n // form has no conditional visibility, and a discriminated union is not something a descriptor can\n // express in the first place.\n const kindAttr = new BaseEntityAttrDescriptor('kind', FormControlType.DROPDOWN, 'Renders', toSelectables(ROUTE_TARGET_KINDS));\n kindAttr.required = true;\n\n const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');\n widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;\n widgetsAttr.hideInTable = true;\n\n const documentSlugAttr = new BaseEntityAttrDescriptor('documentSlug', FormControlType.TEXT_BOX, 'Document Slug');\n documentSlugAttr.placeholder = 'DOCUMENT only: slug of the document to render';\n documentSlugAttr.hideInTable = true;\n\n const entityNameAttr = new BaseEntityAttrDescriptor('entityName', FormControlType.TEXT_BOX, 'Entity Name');\n entityNameAttr.placeholder = 'ENTITY only: name of the descriptor to generate the screen from';\n entityNameAttr.hideInTable = true;\n\n const entityModeAttr = new BaseEntityAttrDescriptor('entityMode', FormControlType.DROPDOWN, 'Entity Mode', toSelectables(ENTITY_MODES));\n entityModeAttr.hideInTable = true;\n\n const rsqlFilterAttr = new BaseEntityAttrDescriptor('rsqlFilter', FormControlType.TEXT_BOX, 'Rsql Filter');\n rsqlFilterAttr.placeholder = 'ENTITY + LIST only: RSQL the list is pre-filtered with';\n rsqlFilterAttr.hideInTable = true;\n // endregion\n\n const identityRow = new FlexboxDescriptor([pathAttr, titleAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const presentationRow = new FlexboxDescriptor([iconAttr, kindAttr], FlexDirection.ROW);\n presentationRow.style = { 'column-gap': '10px' };\n const documentRow = new FlexboxDescriptor([documentSlugAttr], FlexDirection.ROW);\n documentRow.style = { 'column-gap': '10px' };\n const entityRow = new FlexboxDescriptor([entityNameAttr, entityModeAttr, rsqlFilterAttr], FlexDirection.ROW);\n entityRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, presentationRow, rolesAttr, documentRow, entityRow, widgetsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createRouteDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_ROUTE_ENTITY_NAME,\n attrDescriptors: createRouteDefinitionAttrDescriptors(),\n i18nScope: APP_ROUTE_I18N_SCOPE,\n // Two parents, one descriptor: an app's own routes and a module's routes are the same schema, and a\n // route has to mean the same thing wherever it was authored. The module's paths are simply relative\n // to the base path its mount gives them.\n componentParent: [APP_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME],\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { APP_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { AppDefinitionStatus, COLOR_SCHEMES, LAYOUT_PRESETS, MATERIAL_THEMES, SIDENAV_MODES } from './app-definition';\nimport { APP_DEFINITION_ENTITY_NAME, APP_MODULE_MOUNT_ENTITY_NAME, APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME } from './app-entity-names';\nimport { APP_MODULE_MOUNT_ID_FIELD } from './module-mount.descriptors';\nimport { APP_REGION_ID_FIELD } from './region-definition.descriptors';\nimport { APP_ROUTE_ID_FIELD } from './route-definition.descriptors';\n\nexport { APP_DEFINITION_ENTITY_NAME };\n\nconst statusSelectables = toSelectables(Object.keys(AppDefinitionStatus));\n\nfunction createAppDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');\n idAttr.required = true;\n idAttr.placeholder = 'Unique within the organization, e.g. claims-app';\n\n const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);\n nameAttr.required = true;\n nameAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the application name';\n translocoIdAttr.hideInTable = true;\n\n const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');\n descriptionAttr.styleClass = 'full-width';\n descriptionAttr.hideInTable = true;\n\n // Server-assigned: shown so the designer can see where a definition stands, never edited here.\n // Status changes through `POST .../publish`, the versions through any successful write.\n const statusAttr = new BaseEntityAttrDescriptor('status', FormControlType.DROPDOWN, 'Status', statusSelectables);\n statusAttr.disabled = true;\n\n const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');\n versionAttr.disabled = true;\n\n const publishedVersionAttr = new BaseEntityAttrDescriptor('publishedVersion', FormControlType.TEXT_BOX, 'Published Version');\n publishedVersionAttr.disabled = true;\n\n const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');\n updatedAtAttr.disabled = true;\n\n // region theme — flattened out of `theme` by AppDefinitionMapper\n const materialThemeAttr = new BaseEntityAttrDescriptor('materialTheme', FormControlType.DROPDOWN, 'Material Theme', toSelectables(MATERIAL_THEMES));\n materialThemeAttr.hideInTable = true;\n\n const colorSchemeAttr = new BaseEntityAttrDescriptor('colorScheme', FormControlType.DROPDOWN, 'Color Scheme', toSelectables(COLOR_SCHEMES));\n colorSchemeAttr.hideInTable = true;\n\n const logoUrlAttr = new BaseEntityAttrDescriptor('logoUrl', FormControlType.TEXT_BOX, 'Logo Url');\n logoUrlAttr.placeholder = 'Tenant logo shown in the header region';\n logoUrlAttr.hideInTable = true;\n\n const faviconUrlAttr = new BaseEntityAttrDescriptor('faviconUrl', FormControlType.TEXT_BOX, 'Favicon Url');\n faviconUrlAttr.hideInTable = true;\n\n // An open key/value map by contract — keys are `--pp-*` token names, values any CSS color — so a\n // key/value editor is the only shape that can carry it without the form inventing a closed list.\n const tokenOverridesAttr = new BaseEntityAttrDescriptor('tokenOverrides', FormControlType.ADDITIONAL_PROPERTIES, 'Token Overrides');\n tokenOverridesAttr.hideInTable = true;\n // endregion\n\n // region layout — flattened out of `layout` by AppDefinitionMapper\n const presetAttr = new BaseEntityAttrDescriptor('preset', FormControlType.DROPDOWN, 'Layout Preset', toSelectables(LAYOUT_PRESETS));\n presetAttr.hideInTable = true;\n\n const sidenavModeAttr = new BaseEntityAttrDescriptor('sidenavMode', FormControlType.DROPDOWN, 'Sidenav Mode', toSelectables(SIDENAV_MODES));\n sidenavModeAttr.hideInTable = true;\n\n const contentMaxWidthAttr = new BaseEntityAttrDescriptor('contentMaxWidth', FormControlType.TEXT_BOX, 'Content Max Width');\n contentMaxWidthAttr.placeholder = 'CSS length, e.g. 1280px; empty means full width';\n contentMaxWidthAttr.hideInTable = true;\n\n const sidenavCollapsibleAttr = new BaseEntityAttrDescriptor('sidenavCollapsible', FormControlType.CHECKBOX, 'Sidenav Collapsible');\n sidenavCollapsibleAttr.hideInTable = true;\n\n const sidenavOpenByDefaultAttr = new BaseEntityAttrDescriptor('sidenavOpenByDefault', FormControlType.CHECKBOX, 'Sidenav Open By Default');\n sidenavOpenByDefaultAttr.hideInTable = true;\n // endregion\n\n // region nested graph — kept on the entity as-is by AppDefinitionMapper, so the full-replacement PUT preserves it\n // Containment, not association: the contract nests `RegionDefinition`, `RouteDefinition` and\n // `ModuleMount` inside the AppDefinition document, and none has an endpoint of its own, so the rows\n // travel inside this entity's payload and are saved with it. A `ModuleMount` is the exception that\n // proves it — the module it *names* is a separate aggregate with its own endpoints, but the mount\n // itself belongs to this app.\n const regionsAttr = new BaseEntityAttrDescriptor('regions', FormControlType.EMBEDDED_COMPONENTS, 'Regions');\n regionsAttr.linkedEntityType = APP_REGION_ENTITY_NAME;\n // A region has no `id` in the contract; `type` is what identifies it. See APP_REGION_ID_FIELD.\n regionsAttr.referenceIdField = APP_REGION_ID_FIELD;\n regionsAttr.hideInTable = true;\n\n // Flat by design: a route has no children, and the multi-segment paths of these rows are what the\n // shell derives Angular's nesting from at registration time.\n const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');\n routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;\n routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;\n routesAttr.hideInTable = true;\n\n const modulesAttr = new BaseEntityAttrDescriptor('modules', FormControlType.EMBEDDED_COMPONENTS, 'Modules');\n modulesAttr.linkedEntityType = APP_MODULE_MOUNT_ENTITY_NAME;\n modulesAttr.referenceIdField = APP_MODULE_MOUNT_ID_FIELD;\n modulesAttr.hideInTable = true;\n // endregion\n\n const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const revisionRow = new FlexboxDescriptor([statusAttr, versionAttr, publishedVersionAttr, updatedAtAttr], FlexDirection.ROW);\n revisionRow.style = { 'column-gap': '10px' };\n const themeRow = new FlexboxDescriptor([materialThemeAttr, colorSchemeAttr], FlexDirection.ROW);\n themeRow.style = { 'column-gap': '10px' };\n const brandingRow = new FlexboxDescriptor([logoUrlAttr, faviconUrlAttr], FlexDirection.ROW);\n brandingRow.style = { 'column-gap': '10px' };\n const layoutRow = new FlexboxDescriptor([presetAttr, sidenavModeAttr, contentMaxWidthAttr], FlexDirection.ROW);\n layoutRow.style = { 'column-gap': '10px' };\n const sidenavRow = new FlexboxDescriptor([sidenavCollapsibleAttr, sidenavOpenByDefaultAttr], FlexDirection.ROW);\n sidenavRow.style = { 'column-gap': '10px' };\n const graphRow = new FlexboxDescriptor([regionsAttr, routesAttr, modulesAttr], FlexDirection.ROW);\n graphRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor(\n [identityRow, revisionRow, descriptionAttr, themeRow, brandingRow, tokenOverridesAttr, layoutRow, sidenavRow, graphRow],\n FlexDirection.COLUMN,\n );\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createAppDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({ entityName: APP_DEFINITION_ENTITY_NAME, attrDescriptors: createAppDefinitionAttrDescriptors(), i18nScope: APP_DEFINITION_I18N_SCOPE });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType } from '@processpuzzle/base-entity';\nimport { APP_NAV_ITEM_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_NAV_ITEM_ENTITY_NAME, APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME } from './app-entity-names';\nimport { APP_ROUTE_ID_FIELD } from './route-definition.descriptors';\n\nexport { APP_NAV_ITEM_ENTITY_NAME };\n\nfunction createNavItemAttrDescriptors(): AbstractAttrDescriptor[] {\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');\n idAttr.required = true;\n\n const labelAttr = new BaseEntityAttrDescriptor('label', FormControlType.TEXT_BOX, 'Label', undefined, true);\n labelAttr.required = true;\n labelAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the label';\n translocoIdAttr.hideInTable = true;\n\n const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');\n iconAttr.placeholder = 'Material or FontAwesome icon name';\n iconAttr.hideInTable = true;\n\n // A group node expands its children instead of navigating, so this stays optional. The route is\n // resolved by `path` rather than by an id — see APP_ROUTE_ID_FIELD.\n const routePathAttr = new BaseEntityAttrDescriptor('routePath', FormControlType.FOREIGN_KEY, 'Route');\n routePathAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;\n routePathAttr.referenceIdField = APP_ROUTE_ID_FIELD;\n\n const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');\n rolesAttr.placeholder = 'Empty means any authenticated member of the organization';\n rolesAttr.hideInTable = true;\n\n // A group node contains its children rather than pointing at them — they are an inline array of this\n // entry, and the entry itself is nested in the app definition's document.\n const childrenAttr = new BaseEntityAttrDescriptor('children', FormControlType.EMBEDDED_COMPONENTS, 'Children');\n childrenAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;\n childrenAttr.hideInTable = true;\n\n const identityRow = new FlexboxDescriptor([idAttr, labelAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const targetRow = new FlexboxDescriptor([iconAttr, routePathAttr], FlexDirection.ROW);\n targetRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, targetRow, rolesAttr, childrenAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createNavItemDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_NAV_ITEM_ENTITY_NAME,\n attrDescriptors: createNavItemAttrDescriptors(),\n i18nScope: APP_NAV_ITEM_I18N_SCOPE,\n // A nav item hangs off the sidenav region, or off another nav item as a group child.\n componentParent: [APP_REGION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME],\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { createWidgetPropsAttrDescriptor } from '@processpuzzle/widgets';\nimport { APP_WIDGET_I18N_SCOPE } from '../base-app.i18n';\nimport { WIDGET_PLACEMENTS } from './app-definition';\nimport { APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME, APP_WIDGET_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_WIDGET_ENTITY_NAME };\n\nfunction createWidgetInstanceAttrDescriptors(): AbstractAttrDescriptor[] {\n // `id` rather than `type` identifies the widget: it is unique within its page or region, while a\n // page with two `entity-grid`s would otherwise show the same label twice.\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id', undefined, true);\n idAttr.required = true;\n idAttr.isHeading = true;\n idAttr.placeholder = 'Unique within the page or region, e.g. widget-claims-grid';\n\n // Deliberately a free-text box and not a dropdown: `WidgetInstance.type` is a key into the frontend\n // widget registry, which the contract keeps open so new widget types need no schema change.\n const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.TEXT_BOX, 'Type');\n typeAttr.required = true;\n typeAttr.placeholder = 'Widget registry key, e.g. entity-grid';\n\n // Generated from the chosen type's `propsSchema`, as registered in the WIDGET_REGISTRY: one typed control per\n // prop, rebuilt when `type` changes. A type nobody registered or described gets the open key/value editor.\n const propsAttr = createWidgetPropsAttrDescriptor('props', 'type', 'Props');\n propsAttr.hideInTable = true;\n\n // Widgets do not nest: a container widget type lists the ids of siblings in `props.childIds`, and each\n // of those siblings is marked REFERENCED so it is placed by the container instead of rendering twice.\n // That is the whole of composition here — there is no child collection to edit.\n const placementAttr = new BaseEntityAttrDescriptor('placement', FormControlType.DROPDOWN, 'Placement', toSelectables(WIDGET_PLACEMENTS));\n placementAttr.hideInTable = true;\n\n const identityRow = new FlexboxDescriptor([idAttr, typeAttr, placementAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, propsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createWidgetInstanceDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_WIDGET_ENTITY_NAME,\n attrDescriptors: createWidgetInstanceAttrDescriptors(),\n i18nScope: APP_WIDGET_I18N_SCOPE,\n // A widget sits in a header/footer region or on a page — and only there, since it cannot be nested\n // in another widget.\n componentParent: [APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME],\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType } from '@processpuzzle/base-entity';\nimport { MODULE_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_ROUTE_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME } from './app-entity-names';\nimport { APP_ROUTE_ID_FIELD } from './route-definition.descriptors';\n\nexport { MODULE_DEFINITION_ENTITY_NAME };\n\nfunction createModuleDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n // The contract's `key`, renamed to `id` by ModuleDefinitionMapper because base-entity keys stores and\n // URLs on `id`. Labelled 'Key' so the designer sees the name the contract and `ModuleMount.moduleKey`\n // use. The pattern is the contract's own: the key is a URL segment of the module endpoints and the\n // prefix a mount composes with, so a value needing encoding would break both.\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Key');\n idAttr.required = true;\n idAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';\n idAttr.placeholder = 'Unique within the organization, e.g. claims — immutable once mounted';\n\n const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);\n nameAttr.required = true;\n nameAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the module name';\n translocoIdAttr.hideInTable = true;\n\n const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');\n descriptionAttr.styleClass = 'full-width';\n descriptionAttr.hideInTable = true;\n\n // Left empty means the key, which is the default the contract states — applied by\n // `moduleTranslocoScope` rather than written into the row, so an empty field stays empty.\n const translocoScopeAttr = new BaseEntityAttrDescriptor('translocoScope', FormControlType.TEXT_BOX, 'Transloco Scope');\n translocoScopeAttr.placeholder = \"Scope the module's translations load under; empty means the key\";\n translocoScopeAttr.hideInTable = true;\n\n // Server-assigned, shown so the designer can see where a module stands.\n const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');\n versionAttr.disabled = true;\n\n const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');\n updatedAtAttr.disabled = true;\n\n // The same rows, the same descriptor and the same derived nesting as `AppDefinition.routes` — only the\n // paths are relative to the base path a mount gives them. `App Route` therefore names this entity as a\n // second `componentParent`.\n const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');\n routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;\n routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;\n routesAttr.hideInTable = true;\n\n const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const revisionRow = new FlexboxDescriptor([translocoScopeAttr, versionAttr, updatedAtAttr], FlexDirection.ROW);\n revisionRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, revisionRow, descriptionAttr, routesAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createModuleDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: MODULE_DEFINITION_ENTITY_NAME,\n attrDescriptors: createModuleDefinitionAttrDescriptors(),\n i18nScope: MODULE_DEFINITION_I18N_SCOPE,\n });\n}\n","import { RouteDefinition, RouteTarget } from './app-definition';\n\n/** The `RouteDefinition` schema as it travels: `target` nested, exactly as the contract declares it. */\nexport interface RouteDefinitionDto {\n path?: string;\n title?: string;\n translocoId?: string;\n icon?: string;\n roles?: string[];\n target?: RouteTarget;\n}\n\n/**\n * The `target` flattening both aggregates that own routes need — `AppDefinition.routes` and\n * `ModuleDefinition.routes` carry the same schema, and a route authored in a module has to behave\n * exactly like one authored in an app.\n *\n * Why flatten at all: `EMBEDDED_COMPONENTS` edits a row as the flat JSON it arrived as, and a descriptor\n * addresses one property rather than a path, so nothing in the generated form could reach\n * `target.documentSlug`. The contract already keeps `RouteTarget` flat rather than a `oneOf` for the\n * related reason that the form cannot edit a discriminated union of classes.\n */\nexport function flattenRouteTarget(dto: RouteDefinitionDto): RouteDefinition {\n const target = dto.target;\n return new RouteDefinition({\n path: dto.path,\n title: dto.title,\n translocoId: dto.translocoId,\n icon: dto.icon,\n roles: dto.roles,\n kind: target?.kind,\n widgets: target?.widgets,\n documentSlug: target?.documentSlug,\n entityName: target?.entityName,\n entityMode: target?.entityMode,\n rsqlFilter: target?.rsqlFilter,\n // Kept so nestRouteTarget can merge onto it rather than replace it.\n target,\n });\n}\n\n/**\n * The inverse. `kind` is non-optional in the contract but undefined on a row the designer has not\n * finished — the dropdown is `required`, so the form rejects that before a save; the cast keeps this\n * mapping from having to invent a default the backend would then have to second-guess.\n *\n * `widgets` is omitted when empty rather than sent as `[]`, so a DOCUMENT or ENTITY route does not\n * persist an empty widget list it has no use for. The rest is merged onto the `target` the fields were\n * lifted out of, which preserves any field a later contract version adds before this mapping learns\n * about it — a PUT is a full replacement, so anything dropped here is dropped for good.\n */\nexport function nestRouteTarget(route: RouteDefinition): RouteDefinitionDto {\n const widgets = route.widgets;\n return {\n path: route.path,\n title: route.title,\n translocoId: route.translocoId,\n icon: route.icon,\n roles: route.roles,\n target: {\n ...route.target,\n kind: route.kind as RouteTarget['kind'],\n widgets: widgets?.length ? widgets : undefined,\n documentSlug: route.documentSlug,\n entityName: route.entityName,\n entityMode: route.entityMode,\n rsqlFilter: route.rsqlFilter,\n },\n };\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityMapper } from '@processpuzzle/base-entity';\nimport { AppDefinition, AppDefinitionStatus, ColorScheme, LayoutDefinition, LayoutPreset, MaterialTheme, SidenavMode, ThemeDefinition } from './app-definition';\nimport { flattenRouteTarget, nestRouteTarget, RouteDefinitionDto } from './route-definition.mapper';\n\ninterface AppDefinitionDto {\n id?: string;\n name?: string;\n translocoId?: string;\n description?: string;\n theme?: ThemeDefinition;\n layout?: LayoutDefinition;\n regions?: AppDefinition['regions'];\n routes?: RouteDefinitionDto[];\n modules?: AppDefinition['modules'];\n orgKey?: string;\n status?: AppDefinitionStatus;\n version?: number;\n publishedVersion?: number;\n createdAt?: string;\n updatedAt?: string;\n}\n\n/** What `PUT /app-definitions/{appId}` receives: the DTO with `theme` and `layout` always rebuilt. */\ntype AppDefinitionPayload = AppDefinitionDto & { theme: ThemeDefinition; layout: LayoutDefinition };\n\n/**\n * Translates between the `AppDefinition` DTO of `base-app-api.yaml` and the flat entity the\n * generated form works with.\n *\n * Two invariants matter here. The form saves `{ ...entity, ...form.value }`, so every DTO field the\n * form does not show has to survive on the entity — `regions`, `routes` and `modules` are nested\n * rather than flattened for exactly that reason, and the `EMBEDDED_COMPONENTS` controls edit them in\n * place. And `PUT /app-definitions/{appId}` is a full replacement, so {@link toDto} rebuilds `theme`\n * and `layout` from the flattened controls *on top of* the objects they were lifted out of, which\n * keeps any field a later contract version adds before this mapper learns about it.\n *\n * A route's `target` is the third thing flattened, one level deeper: `regions` and `modules` rows\n * travel as the raw DTO they arrived as, but a route row cannot. That flattening lives in\n * `route-definition.mapper.ts` rather than here, because `ModuleDefinition.routes` carries the same\n * schema and a route authored in a module has to behave exactly like one authored in an app.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppDefinitionMapper implements BaseEntityMapper<AppDefinition> {\n fromDto(dto: unknown): AppDefinition {\n const source = dto as AppDefinitionDto;\n const theme = source.theme;\n const layout = source.layout;\n return new AppDefinition({\n id: source.id,\n name: source.name,\n translocoId: source.translocoId,\n description: source.description,\n materialTheme: theme?.materialTheme as MaterialTheme | undefined,\n colorScheme: theme?.colorScheme as ColorScheme | undefined,\n tokenOverrides: theme?.tokenOverrides,\n logoUrl: theme?.logoUrl,\n faviconUrl: theme?.faviconUrl,\n preset: layout?.preset as LayoutPreset | undefined,\n sidenavMode: layout?.sidenavMode as SidenavMode | undefined,\n sidenavCollapsible: layout?.sidenavCollapsible,\n sidenavOpenByDefault: layout?.sidenavOpenByDefault,\n contentMaxWidth: layout?.contentMaxWidth,\n theme,\n layout,\n regions: source.regions,\n routes: source.routes?.map(flattenRouteTarget),\n modules: source.modules,\n orgKey: source.orgKey,\n status: source.status,\n version: source.version,\n publishedVersion: source.publishedVersion,\n createdAt: source.createdAt,\n updatedAt: source.updatedAt,\n });\n }\n\n toDto(entity: AppDefinition): AppDefinitionPayload {\n // Listed field by field rather than spread, so the flattened controls never reach the payload.\n return {\n id: entity.id,\n name: entity.name,\n translocoId: entity.translocoId,\n description: entity.description,\n theme: this.mergeTheme(entity),\n layout: this.mergeLayout(entity),\n regions: entity.regions,\n routes: entity.routes?.map(nestRouteTarget),\n modules: entity.modules,\n orgKey: entity.orgKey,\n status: entity.status,\n version: entity.version,\n publishedVersion: entity.publishedVersion,\n createdAt: entity.createdAt,\n updatedAt: entity.updatedAt,\n };\n }\n\n private mergeTheme(entity: AppDefinition): ThemeDefinition {\n return {\n ...entity.theme,\n materialTheme: entity.materialTheme,\n colorScheme: entity.colorScheme,\n tokenOverrides: entity.tokenOverrides,\n logoUrl: entity.logoUrl,\n faviconUrl: entity.faviconUrl,\n };\n }\n\n private mergeLayout(entity: AppDefinition): LayoutDefinition {\n return {\n ...entity.layout,\n preset: entity.preset,\n sidenavMode: entity.sidenavMode,\n sidenavCollapsible: entity.sidenavCollapsible,\n sidenavOpenByDefault: entity.sidenavOpenByDefault,\n contentMaxWidth: entity.contentMaxWidth,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { map, Observable } from 'rxjs';\nimport { BaseEntityRestService, PersistedEntity } from '@processpuzzle/base-entity';\nimport { AppDefinition } from './app-definition';\nimport { AppDefinitionMapper } from './app-definition.mapper';\n\n/**\n * REST access to `/organizations/{orgKey}/app-definitions`. As in base-rule, the organization is\n * part of the configured service root — `APP_SERVICE_ROOT`, the optional per-feature escape hatch,\n * falling back to `BACKEND_SERVICE_ROOT`, which is what every deployment actually sets — so the\n * tenant is a deployment concern rather than something every call has to carry.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppDefinitionService extends BaseEntityRestService<AppDefinition> {\n constructor(protected override entityMapper: AppDefinitionMapper) {\n super(entityMapper, 'APP_SERVICE_ROOT', 'app-definitions');\n }\n\n /**\n * `POST /app-definitions/{appId}/publish` — promotes the stored `version` to `publishedVersion` and\n * sets the status to `PUBLISHED`. The backend validates the definition first and answers 400 when it\n * is not publishable, so the caller only has to deal with the happy path and the error.\n */\n publish(id: string): Observable<PersistedEntity<AppDefinition>> {\n const pathParams = new Map<string, string>([['id', String(id)]]);\n const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}/publish', { pathParams });\n if (!fullUrl) throw new Error('Could not determine the full url');\n return this.httpClient.post(fullUrl, {}, { headers: this.headers }).pipe(map((response: unknown) => this.entityMapper.fromDto(response) as PersistedEntity<AppDefinition>));\n }\n}\n","import { inject } from '@angular/core';\nimport { patchState, signalStore, signalStoreFeature, type, withMethods } from '@ngrx/signals';\nimport { withDevtools } from '@angular-architects/ngrx-toolkit';\nimport { BaseEntityContainerStore, BaseEntityStore, BaseEntityTabsStore, PersistedEntity } from '@processpuzzle/base-entity';\nimport { httpErrorMessage } from '@processpuzzle/util';\nimport { firstValueFrom } from 'rxjs';\nimport { AppDefinition } from './app-definition';\nimport { AppDefinitionService } from './app-definition.service';\n\n/** The slice of `BaseEntityStore`'s state that {@link AppDefinitionPublishStore} reads and patches. */\ntype PublishableState = {\n entities: AppDefinition[];\n currentEntity: AppDefinition | undefined;\n isLoading: boolean;\n error: string | undefined;\n};\n\n/**\n * Adds the `publish` use case on top of the generic CRUD store. It keeps the same contract as\n * `addEntity` / `updateEntity`: flip `isLoading`, replace the entity in the list with the server's\n * answer so the form's read-only `status` / `publishedVersion` fields refresh, and surface failures\n * through `error` rather than by throwing.\n */\nexport function AppDefinitionPublishStore() {\n return signalStoreFeature(\n { state: type<PublishableState>() },\n withMethods((store, service = inject(AppDefinitionService)) => ({\n publish: async (id: string): Promise<PersistedEntity<AppDefinition> | undefined> => {\n patchState(store, { isLoading: true, error: undefined });\n try {\n const publishedEntity = await firstValueFrom(service.publish(id));\n const entities = [...store.entities()];\n const indexToUpdate = entities.findIndex((entity) => entity.id === id);\n if (indexToUpdate >= 0) entities[indexToUpdate] = publishedEntity;\n const currentEntity = store.currentEntity()?.id === id ? publishedEntity : store.currentEntity();\n patchState(store, { entities, currentEntity, isLoading: false });\n return publishedEntity;\n } catch (error) {\n patchState(store, { error: httpErrorMessage(error), isLoading: false });\n return undefined;\n }\n },\n })),\n );\n}\n\nexport const AppDefinitionStore = signalStore(\n { providedIn: 'root' },\n BaseEntityStore<AppDefinition>(AppDefinition, () => inject(AppDefinitionService)),\n BaseEntityTabsStore(),\n BaseEntityContainerStore(),\n AppDefinitionPublishStore(),\n withDevtools('AppDefinition'),\n);\n","import { Injectable } from '@angular/core';\nimport { BaseEntityMapper } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from './module-definition';\nimport { flattenRouteTarget, nestRouteTarget, RouteDefinitionDto } from './route-definition.mapper';\n\ninterface ModuleDefinitionDto {\n key?: string;\n name?: string;\n translocoId?: string;\n description?: string;\n translocoScope?: string;\n routes?: RouteDefinitionDto[];\n orgKey?: string;\n version?: number;\n createdAt?: string;\n updatedAt?: string;\n}\n\n/**\n * Translates between the `ModuleDefinition` DTO of `base-app-api.yaml` and the entity the generated form\n * works with. Two renamings, and nothing else — a module is a much smaller aggregate than an app:\n *\n * - **`key` becomes `id`.** base-entity keys every store, URL and reference on `id`, so the rename\n * happens here rather than in the framework. See {@link ModuleDefinition.id}.\n * - **each route's `target` is flattened** onto the row and re-nested on save, by the same functions\n * `AppDefinitionMapper` uses, so a route authored in a module behaves like one authored in an app.\n */\n@Injectable({ providedIn: 'root' })\nexport class ModuleDefinitionMapper implements BaseEntityMapper<ModuleDefinition> {\n fromDto(dto: unknown): ModuleDefinition {\n const source = dto as ModuleDefinitionDto;\n return new ModuleDefinition({\n id: source.key,\n name: source.name,\n translocoId: source.translocoId,\n description: source.description,\n translocoScope: source.translocoScope,\n routes: source.routes?.map(flattenRouteTarget),\n orgKey: source.orgKey,\n version: source.version,\n createdAt: source.createdAt,\n updatedAt: source.updatedAt,\n });\n }\n\n toDto(entity: ModuleDefinition): ModuleDefinitionDto {\n // Field by field rather than spread, so `id` does not travel beside the `key` it became.\n return {\n key: entity.id,\n name: entity.name,\n translocoId: entity.translocoId,\n description: entity.description,\n translocoScope: entity.translocoScope,\n routes: entity.routes?.map(nestRouteTarget),\n orgKey: entity.orgKey,\n version: entity.version,\n createdAt: entity.createdAt,\n updatedAt: entity.updatedAt,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityRestService } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from './module-definition';\nimport { ModuleDefinitionMapper } from './module-definition.mapper';\n\n/**\n * REST access to `/organizations/{orgKey}/modules`. As for `AppDefinitionService`, the organization is\n * part of the configured service root (`APP_SERVICE_ROOT`, falling back to `BACKEND_SERVICE_ROOT`), so\n * the tenant is a deployment concern rather\n * than something every call has to carry.\n *\n * The URL variable is the module key — `ModuleDefinitionMapper` maps it onto `id`, which is what the\n * inherited `findById` builds `GET .../modules/{moduleKey}` from. That single-module read is also the call\n * the shell makes when something first navigates under a mount; see `ModuleLoader` in\n * `app-route-builder.ts`.\n */\n@Injectable({ providedIn: 'root' })\nexport class ModuleDefinitionService extends BaseEntityRestService<ModuleDefinition> {\n constructor(protected override entityMapper: ModuleDefinitionMapper) {\n super(entityMapper, 'APP_SERVICE_ROOT', 'modules');\n }\n}\n","import { inject } from '@angular/core';\nimport { signalStore } from '@ngrx/signals';\nimport { withDevtools } from '@angular-architects/ngrx-toolkit';\nimport { BaseEntityContainerStore, BaseEntityStore, BaseEntityTabsStore } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from './module-definition';\nimport { ModuleDefinitionService } from './module-definition.service';\n\n/**\n * Plain generic CRUD — a module has no `publish` of its own. Publishing is an `AppDefinition` operation:\n * an app is what a user navigates to, and its status is what decides whether a mount is live. Giving a\n * module a second, independent lifecycle would make \"which version of what is live\" a question with two\n * answers.\n */\nexport const ModuleDefinitionStore = signalStore(\n { providedIn: 'root' },\n BaseEntityStore<ModuleDefinition>(ModuleDefinition, () => inject(ModuleDefinitionService)),\n BaseEntityTabsStore(),\n BaseEntityContainerStore(),\n withDevtools('ModuleDefinition'),\n);\n","import { inject, Injectable, Type } from '@angular/core';\nimport { BaseEntityDescriptor, BaseEntityFacade } from '@processpuzzle/base-entity';\nimport { AppDefinition } from '../domain/app-definition';\nimport { AppDefinitionMapper } from '../domain/app-definition.mapper';\nimport { AppDefinitionService } from '../domain/app-definition.service';\nimport { AppDefinitionStore } from '../domain/app-definition.store';\nimport { createAppDefinitionDescriptor } from '../domain/app-definition.descriptors';\n\n@Injectable()\nexport class AppDefinitionFacade extends BaseEntityFacade<AppDefinition> {\n readonly entityType = AppDefinition;\n\n private readonly mapperRef = inject(AppDefinitionMapper);\n private readonly serviceRef = inject(AppDefinitionService);\n\n protected override createMapper() {\n return this.mapperRef;\n }\n\n protected override createService() {\n return this.serviceRef;\n }\n\n protected override createStoreClass(): Type<unknown> {\n return AppDefinitionStore;\n }\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createAppDefinitionDescriptor();\n }\n}\n","import { inject, Injectable, Type } from '@angular/core';\nimport { BaseEntityDescriptor, BaseEntityFacade } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from '../domain/module-definition';\nimport { createModuleDefinitionDescriptor } from '../domain/module-definition.descriptors';\nimport { ModuleDefinitionMapper } from '../domain/module-definition.mapper';\nimport { ModuleDefinitionService } from '../domain/module-definition.service';\nimport { ModuleDefinitionStore } from '../domain/module-definition.store';\n\n@Injectable()\nexport class ModuleDefinitionFacade extends BaseEntityFacade<ModuleDefinition> {\n readonly entityType = ModuleDefinition;\n\n private readonly mapperRef = inject(ModuleDefinitionMapper);\n private readonly serviceRef = inject(ModuleDefinitionService);\n\n protected override createMapper() {\n return this.mapperRef;\n }\n\n protected override createService() {\n return this.serviceRef;\n }\n\n protected override createStoreClass(): Type<unknown> {\n return ModuleDefinitionStore;\n }\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createModuleDefinitionDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { ModuleMount } from '../domain/app-definition';\nimport { createModuleMountDescriptor } from '../domain/module-mount.descriptors';\n\n/**\n * A mount is a row of the `App Definition` document, so it is edited through that document — unlike the\n * `ModuleDefinition` it names, which is an aggregate of its own with its own endpoints.\n */\n@Injectable()\nexport class AppModuleMountFacade extends EmbeddedEntityFacade<ModuleMount> {\n readonly entityType = ModuleMount;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createModuleMountDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { NavItem } from '../domain/app-definition';\nimport { createNavItemDescriptor } from '../domain/nav-item.descriptors';\n\n/**\n * One facade covers every level of the nav tree, however deep: the store is a root singleton and the row\n * it stands for comes from the route, so `app-nav-item/a/details/app-nav-item/b/details` resolves through\n * the same facade as the top level.\n */\n@Injectable()\nexport class AppNavItemFacade extends EmbeddedEntityFacade<NavItem> {\n readonly entityType = NavItem;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createNavItemDescriptor();\n }\n}\n","import { Route, Routes } from '@angular/router';\nimport { provideTranslocoScope } from '@jsverse/transloco';\nimport { ModuleMount, RouteDefinition } from '../domain/app-definition';\nimport { ModuleDefinition, moduleTranslocoScope } from '../domain/module-definition';\nimport { BASE_APP_TRANSLOCO_SCOPE, BASE_ENTITY_TRANSLOCO_SCOPE } from '../base-app.i18n';\n\n/**\n * What the run-time shell registers routes from. `routes` and `modules` are the app definition's own\n * fields; the other two are how the routes of a mounted module get in.\n *\n * `moduleRoutes` holds the modules the shell already has, keyed by module key. `loadModule` is for the\n * ones it does not: a mount whose key is absent from `moduleRoutes` becomes a `loadChildren` that calls\n * it on first navigation into the mount. With neither, such a mount contributes nothing — a mount naming\n * a module that has not been authored is a warning rather than an error.\n *\n * A key present in `moduleRoutes` is never loaded again, so an empty array there says \"this module has no\n * routes\" and is honoured as such.\n */\nexport interface AppRouteSource {\n routes?: RouteDefinition[];\n modules?: ModuleMount[];\n moduleRoutes?: Record<string, RouteDefinition[] | undefined>;\n loadModule?: ModuleLoader;\n}\n\n/**\n * Fetches one module by key, or resolves to `undefined` if the organization has no such module. Rejecting\n * is a navigation error; resolving to `undefined` is the loose coupling the contract asks for.\n */\nexport type ModuleLoader = (moduleKey: string) => Promise<ModuleDefinition | undefined>;\n\n/**\n * Turns one authored route into the `Route` that renders it — component or `loadComponent`, `title`,\n * `data`, and any `canMatch` guard the definition's `roles` call for. `path` is {@link buildAppRoutes}'\n * to set; `children` it may contribute, and the authored ones are appended to them.\n *\n * May be asynchronous. An `ENTITY` route's screens are built from a `BaseEntityDescriptor` that has to be\n * *fetched* when the entity exists only as metadata, and the routes below it depend on what that\n * descriptor turns out to contain — which embedded children it carries. Making the renderer async is what\n * lets a route be emitted complete or not at all; the alternative, a guard that fills `children` in on the\n * way past, has no way to signal failure other than leaving the route matching nothing.\n */\nexport type RouteRenderer = (definition: RouteDefinition) => Route | Promise<Route>;\n\ninterface TrieNode {\n segment: string;\n definition?: RouteDefinition;\n children: TrieNode[];\n}\n\n/**\n * Derives Angular's nested `Routes` from the flat route list of an `AppDefinition`.\n *\n * Nesting is computed here rather than authored, which is the whole point of keeping\n * {@link RouteDefinition} flat: `claims`, `claims/open` and `claims/:id` are three sibling rows a\n * designer can reorder, rename and reason about one at a time, and it is only at registration that\n * they become a parent with two children. Two rules produce that shape:\n *\n * - **An authored route that is a prefix of others becomes their parent.** So `claims` stays mounted\n * while `claims/open` renders in its `<router-outlet>` — which is the one thing a flat registration\n * could not express, and the reason this function exists at all. A component rendering a route that\n * has children therefore has to host an outlet.\n * - **A prefix nothing authored stays part of the path.** With only `claims/open` and `claims/closed`\n * declared, no synthetic `claims` parent is invented: the two are emitted with their full paths, since\n * a component-less grouping node would change nothing about what matches or what renders.\n *\n * Modules mount as a parent of their own at {@link ModuleMount.basePath}, component-less because a mount\n * is a prefix rather than a screen. That is the single composition point, and it composes one level: the\n * routes of a mounted module are built by the same two rules, and a module mounts no modules. A module the\n * shell already has is emitted now; one it has not is emitted as `loadChildren` — see {@link lazyMount}.\n *\n * Siblings are ordered static-prefix-first, so `claims/new` is matched before `claims/:id` rather than\n * swallowed by it. Beyond that the authored order is kept, and a duplicate path — which the backend\n * rejects as an error, so it should never arrive — keeps its first occurrence.\n */\nexport async function buildAppRoutes(source: AppRouteSource, renderRoute: RouteRenderer): Promise<Routes> {\n const appRoutes = await emitLevel(trieOf(source.routes), [], renderRoute);\n return [...appRoutes, ...(await moduleRoutesOf(source, renderRoute))];\n}\n\nasync function moduleRoutesOf(source: AppRouteSource, renderRoute: RouteRenderer): Promise<Routes> {\n const mounted: Routes = [];\n for (const mount of source.modules ?? []) {\n if (!mount.basePath) continue;\n const routes = source.moduleRoutes?.[mount.moduleKey];\n if (routes) {\n if (routes.length) mounted.push({ path: mount.basePath, children: await emitLevel(trieOf(routes), [], renderRoute) });\n } else if (source.loadModule) {\n mounted.push(lazyMount(mount.moduleKey, mount.basePath, source.loadModule, renderRoute));\n }\n }\n return mounted;\n}\n\n/**\n * A mount whose module the shell has not got yet: the same component-less parent at the base path, with\n * its children resolved on first navigation into it instead of now.\n *\n * What is deferred is the *metadata* — one `GET /modules/{key}` per module the user actually visits, so an\n * app that mounts twenty modules does not fetch twenty definitions to show its first screen. It is not a\n * deferred *bundle*: the widgets a module's routes render come from the widget registry and are part of\n * the application's own build either way.\n *\n * The module's transloco scope is registered here, on a component-less wrapper inside the loaded children,\n * because that is the first moment its name is known — the default is the module key, but a module may\n * name its own. The alias is spelled out, as everywhere in this workspace: transloco would otherwise\n * camel-case it and miss every key below it.\n *\n * The framework scopes are re-registered alongside it, for the reason `BASE_APP_ROUTES.authoringScopes()`\n * gives: a route that declares TRANSLOCO_SCOPE *replaces* the collection it inherits rather than adding to\n * it, because Angular does not merge `multi` providers across injectors. A module's routes render the same\n * generic screens as everything else — an ENTITY route reaches `BaseEntityTabsComponent`, which translates\n * `base_entity.tabs.*` — so naming only the module's scope here would leave every framework label below the\n * mount unresolved.\n */\nfunction lazyMount(moduleKey: string, basePath: string, loadModule: ModuleLoader, renderRoute: RouteRenderer): Route {\n return {\n path: basePath,\n loadChildren: async () => {\n const definition = await loadModule(moduleKey);\n const children = await emitLevel(trieOf(definition?.routes), [], renderRoute);\n if (!definition || !children.length) return [];\n const scope = moduleTranslocoScope(definition);\n const providers = [\n provideTranslocoScope(\n { scope, alias: scope },\n { scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE },\n { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE },\n ),\n ];\n return [{ path: '', providers, children }];\n },\n };\n}\n\n/** The authored paths as a trie, so a route that is a prefix of another can be recognized as its parent. */\nfunction trieOf(routes: RouteDefinition[] | undefined): TrieNode[] {\n const roots: TrieNode[] = [];\n for (const definition of routes ?? []) {\n const segments = segmentsOf(definition.path);\n if (!segments.length) continue;\n let level = roots;\n let node: TrieNode = { segment: '', children: roots };\n for (const segment of segments) {\n const existing = level.find((candidate) => candidate.segment === segment);\n node = existing ?? { segment, children: [] };\n if (!existing) level.push(node);\n level = node.children;\n }\n // First occurrence wins: a duplicate path is a validation error server-side, so the only way to see\n // one here is a definition that bypassed validation, and dropping the later row is the harmless read.\n node.definition ??= definition;\n }\n return roots;\n}\n\n/**\n * The routes of one level. An authored node becomes a `Route` whose children are emitted below it; an\n * unauthored one contributes its segment to the paths of its descendants instead of a route of its own.\n */\nasync function emitLevel(nodes: TrieNode[], prefix: string[], renderRoute: RouteRenderer): Promise<Routes> {\n const routes = (await Promise.all(nodes.map((node) => emitNode(node, prefix, renderRoute)))).flat();\n return routes.sort((left, right) => staticDepthOf(right.path) - staticDepthOf(left.path));\n}\n\nasync function emitNode(node: TrieNode, prefix: string[], renderRoute: RouteRenderer): Promise<Routes> {\n const path = [...prefix, node.segment];\n if (!node.definition) return (await Promise.all(node.children.map((child) => emitNode(child, path, renderRoute)))).flat();\n\n const authoredChildren = await emitLevel(node.children, [], renderRoute);\n const rendered = await renderRoute(node.definition);\n const route: Route = { ...rendered, path: path.join('/') };\n // The renderer's own children come first and the authored ones after, rather than the authored ones\n // replacing them. An `ENTITY` route contributes the List and Details routes of its entity *and* may be\n // the path prefix of other authored routes; overwriting would silently drop whichever of the two the\n // builder happened not to know about. The renderer's include an empty-path redirect, which `pathMatch:\n // 'full'` confines to the prefix's own URL, so it cannot shadow an authored sibling.\n const children = [...(rendered.children ?? []), ...authoredChildren];\n if (children.length) route.children = children;\n return [route];\n}\n\nfunction segmentsOf(path: string | undefined): string[] {\n return (path ?? '').split('/').filter((segment) => segment.length > 0);\n}\n\n/**\n * How many leading segments of a path are static. Sorting by it descending is what keeps a parameterized\n * route from shadowing its static siblings: `claims/new` scores 2, `claims/:id` scores 1, and Angular\n * matches in the order given.\n */\nfunction staticDepthOf(path: string | undefined): number {\n const segments = segmentsOf(path);\n const firstParameter = segments.findIndex((segment) => segment.startsWith(':') || segment === '**');\n return firstParameter === -1 ? segments.length : firstParameter;\n}\n","import { Component, computed, input } from '@angular/core';\nimport { WidgetHostComponent, WidgetInstance, WidgetPlacement } from '@processpuzzle/widgets';\n\n/** The widgets rendered in sequence — every one but those a container widget places by id. */\nexport function standaloneWidgets(widgets: WidgetInstance[] | undefined): WidgetInstance[] {\n return (widgets ?? []).filter((widget) => widget.placement !== WidgetPlacement.REFERENCED);\n}\n\n/**\n * Renders the top-level widgets shared by routed content and static shell regions, each through\n * base-widget's {@link WidgetHostComponent} — which resolves the component, binds the props and shows a\n * placeholder for a type the application did not register. This component only decides *which* widgets\n * render here, and in what order.\n *\n * base-app passes no binding resolver: a page or region declares no ports for `inputBindings` to resolve\n * against, so a placement here is configured by its props alone.\n */\n@Component({\n selector: 'pp-widget-list',\n standalone: true,\n imports: [WidgetHostComponent],\n template: `\n @for (widget of rows(); track widget.id) {\n <pp-widget-host [widget]=\"widget\" />\n }\n `,\n})\nexport class WidgetListComponent {\n readonly widgets = input<WidgetInstance[]>([]);\n\n protected readonly rows = computed(() => standaloneWidgets(this.widgets()));\n}\n","import { Component, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { WidgetInstance } from '@processpuzzle/widgets';\nimport { WidgetListComponent } from './widget-list.component';\n\n/**\n * Renders a route whose kind is WIDGETS: every STANDALONE instance in order, each through base-widget's\n * WidgetHostComponent. REFERENCED instances are skipped here for the same reason\n * DocumentEditorComponent skips them at its top level — they're placed by whichever STANDALONE\n * container widget names them in props.childIds, not by this component.\n *\n * Delegates the common widget rendering rule to WidgetListComponent, which is also used by the\n * header and footer regions in the application preview.\n */\n@Component({\n selector: 'pp-route-widgets',\n standalone: true,\n imports: [WidgetListComponent],\n template: `<pp-widget-list [widgets]=\"widgets\" />`,\n})\nexport class RouteWidgetsComponent {\n private readonly route = inject(ActivatedRoute);\n\n protected readonly widgets = (this.route.snapshot.data['widgets'] as WidgetInstance[] | undefined) ?? [];\n}\n","import { Component, computed, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\n\n/**\n * Fallback rendered by {@link AppRouteRenderer} for a route kind it doesn't yet know how to build a\n * real component for (today: DOCUMENT, and any kind value the frontend doesn't recognize). Exists so\n * an unfinished part of the shell fails visibly and specifically at the one route that hits it,\n * rather than throwing during route registration and taking the whole app down, or — worse — silently\n * rendering nothing and leaving a designer to wonder why their route is blank.\n *\n * Not an error state: an app definition is allowed to reference a route kind the frontend hasn't\n * caught up to yet, same spirit as a NavItem naming a route that hasn't been authored being a warning\n * rather than a validation failure elsewhere in this library.\n */\n@Component({\n selector: 'pp-route-unsupported',\n standalone: true,\n template: `<p class=\"pp-route-unsupported\">{{ reason() }}</p>`,\n})\nexport class RouteUnsupportedComponent {\n private readonly route = inject(ActivatedRoute);\n\n protected readonly reason = computed(() => (this.route.snapshot.data['reason'] as string) ?? 'This route is not yet supported.');\n}\n","import { inject, Injectable } from '@angular/core';\nimport { ResolveFn, Route } from '@angular/router';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { entityScreenRoute, EntityScreenResolver, translateLabel } from '@processpuzzle/base-entity';\nimport { RouteDefinition } from '../domain/app-definition';\nimport { RouteWidgetsComponent } from './route-widgets.component';\nimport { RouteUnsupportedComponent } from './route-unsupported.component';\n\n/**\n * The route's `title`, preferring `translocoId` over the authored literal where the key resolves.\n *\n * A `ResolveFn` rather than a plain string because a title is resolved per navigation, which is late\n * enough for a lazily-loaded module scope to have arrived — the string form is captured when the route is\n * built, before the scope that owns the key is registered. `translateLabel` falls back to the literal, so\n * a route whose scope is absent or whose key is missing keeps the authored title.\n */\nfunction titleOf(definition: RouteDefinition): ResolveFn<string> {\n return () => translateLabel(inject(TranslocoService), definition.translocoId, definition.title);\n}\n\n/**\n * The `RouteRenderer` {@link buildAppRoutes} needs — turns one authored `RouteDefinition` into the\n * `Route` that actually renders it. Owns `component`, `data` and any `children` the kind calls for; `path`\n * is `buildAppRoutes`' to set, and the routes authored *below* this one are appended to whatever children\n * this contributes.\n *\n * A separate injectable rather than a free function because it is the one piece Preview and the eventual\n * production shell must call identically — same reasoning as `buildAppRoutes` itself being free of any\n * component.\n *\n * `roles` -> `canMatch` is deliberately not set here yet — see the note on this design's own deferral of\n * that question. `kind: DOCUMENT` is deliberately unhandled too: `BaseDocumentContainerComponent` is an\n * authoring component wired to one document via an injected store, not something parameterizable by a\n * route's `documentSlug` at runtime. Rendering a document read-only inside a live app is its own small\n * design question and this falls through to {@link RouteUnsupportedComponent} rather than guessing.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppRouteRenderer {\n private readonly entityScreens = inject(EntityScreenResolver);\n\n render = async (definition: RouteDefinition): Promise<Route> => {\n switch (definition.kind) {\n case 'WIDGETS':\n return { component: RouteWidgetsComponent, title: titleOf(definition), data: { widgets: definition.widgets } };\n case 'ENTITY':\n return this.entityRoute(definition);\n case 'DOCUMENT':\n return {\n component: RouteUnsupportedComponent,\n title: titleOf(definition),\n data: { reason: `DOCUMENT routes are not yet supported (route '${definition.path}')` },\n };\n default:\n return {\n component: RouteUnsupportedComponent,\n title: titleOf(definition),\n data: { reason: `Unknown route kind '${String(definition.kind)}' (route '${definition.path}')` },\n };\n }\n };\n\n /**\n * An `ENTITY` route: base-entity's generated screens, mounted at the authored path.\n *\n * Both halves belong to base-entity and are called rather than reimplemented here: `EntityScreenResolver`\n * answers for an entity with a compile-time facade and for one that exists only as a `BaseEntityDefinition`\n * alike, and `entityScreenRoute` owns the URL shape those screens need. What is left is exactly the\n * *application definition* concern — when the routes are built, the authored title, and the authored\n * `entityMode` / `rsqlFilter`.\n *\n * The descriptor is resolved **before** the route exists, which is what makes the route either complete or\n * a leaf. An entity nothing answers to keeps the leaf, whose component says so at the URL the nav item\n * links to; a legitimate state, since an `AppDefinition` may name an entity that has been renamed or one\n * whose definitions this deployment's backend does not serve.\n *\n * `entityMode` is passed along but not applied. A `DETAILS` route lands on the list, from which the row is\n * one click away: making it open a form directly means carrying the authored route's own `:id` into the\n * child URL, and the `RedirectFunction` that would do it receives a *partial* route snapshot whose\n * parameter inheritance at recognition time is not something to bet a navigation on. Deferred with `roles`\n * and `rsqlFilter` rather than guessed at.\n */\n private async entityRoute(definition: RouteDefinition): Promise<Route> {\n const screens = await this.entityScreens.resolve(definition.entityName);\n const route = entityScreenRoute({\n entityName: definition.entityName,\n screens,\n hostPath: definition.path,\n data: { entityMode: definition.entityMode, rsqlFilter: definition.rsqlFilter },\n });\n\n return { ...route, title: titleOf(definition) };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { RegionDefinition } from '../domain/app-definition';\nimport { createRegionDefinitionDescriptor } from '../domain/region-definition.descriptors';\n\n/**\n * A region has a facade like any other entity — that is what gives it a store, and so a working list and\n * form. Its repository reads and writes the `App Definition` document instead of an endpoint of its own,\n * because the contract nests `regions` inside that document.\n */\n@Injectable()\nexport class AppRegionFacade extends EmbeddedEntityFacade<RegionDefinition> {\n readonly entityType = RegionDefinition;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createRegionDefinitionDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { RouteDefinition } from '../domain/app-definition';\nimport { createRouteDefinitionDescriptor } from '../domain/route-definition.descriptors';\n\n/**\n * `GET .../app-definitions/{appId}/layout` is a read-only projection for the run-time shell, not a write\n * endpoint — a route is authored inside the `App Definition` document, so its store goes through that\n * document like every other embedded child of the graph.\n */\n@Injectable()\nexport class AppRouteFacade extends EmbeddedEntityFacade<RouteDefinition> {\n readonly entityType = RouteDefinition;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createRouteDefinitionDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { WidgetInstance } from '../domain/app-definition';\nimport { createWidgetInstanceDescriptor } from '../domain/widget-instance.descriptors';\n\n/**\n * A widget sits under a region, a page or another widget, and one facade serves all three: which owner's\n * rows its store reads is decided by the route that is open, not by the facade.\n */\n@Injectable()\nexport class AppWidgetFacade extends EmbeddedEntityFacade<WidgetInstance> {\n readonly entityType = WidgetInstance;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createWidgetInstanceDescriptor();\n }\n}\n","import { ThemeSelection } from '@processpuzzle/widgets';\nimport { AppDefinition, LayoutPreset, SidenavMode } from '../../domain/app-definition';\n\n/**\n * The layout decisions {@link AppShellComponent} renders from, resolved out of an `AppDefinition`'s\n * `layout` fields with every default already applied — so the template reads values rather than\n * spelling out fallbacks, and every default is asserted in one spec instead of being implied by a\n * `??` in markup.\n *\n * A plain function rather than a service for the same reason `buildAppRoutes` is one: nothing here\n * needs injection, and a pure derivation is testable without a `TestBed`.\n */\nexport interface ResolvedLayout {\n preset: LayoutPreset;\n /**\n * Always resolved, even for `top-nav` where it is meaningless — {@link hasSidenav} is what says\n * whether a sidenav is rendered at all. Leaving it undefined there would only push a `?? 'side'`\n * into the template that no definition can ever reach, since `hasSidenav` already implies a mode.\n */\n sidenavMode: SidenavMode;\n /** `end` for `sidenav-right`, `start` otherwise — the values `matSidenav`'s `position` takes. */\n sidenavPosition: 'start' | 'end';\n /** Whether the shell renders a sidenav at all. False for `top-nav`. */\n hasSidenav: boolean;\n sidenavOpened: boolean;\n sidenavCollapsible: boolean;\n /** Undefined means unconstrained, which is what an absent `contentMaxWidth` asks for. */\n contentMaxWidth?: string;\n}\n\n/**\n * `sidenav-left` because a definition that declares no preset is the common case — a freshly created\n * app — and the framework's own screens are left-sidenav. The same value the contract documents as\n * its default.\n */\nconst DEFAULT_PRESET: LayoutPreset = 'sidenav-left';\n\n/** Matches the contract's default and Material's own, so an unset value behaves as `mat-sidenav` does. */\nconst DEFAULT_SIDENAV_MODE: SidenavMode = 'side';\n\n/**\n * Resolves the layout of one definition.\n *\n * Each field is read from the flattened property first and from `layout` second. For an entity that\n * came through {@link AppDefinitionMapper} the two always agree — `fromDto` copies `layout.preset`\n * onto `preset`, and `toDto` merges the flattened value back — so the fallback is there for the\n * definitions nothing mapped: `new AppDefinition({ layout: { preset: 'top-nav' } })` is a legal\n * construction that leaves `preset` undefined, and a shell that ignored `layout` would silently\n * render the default instead.\n *\n * `sidenavCollapsible` and `sidenavOpenByDefault` need no such fallback: they are non-optional on the\n * entity and the constructor defaults them, so there is always a value to read.\n */\nexport function layoutOf(definition: AppDefinition | undefined): ResolvedLayout {\n const preset = definition?.preset ?? definition?.layout?.preset ?? DEFAULT_PRESET;\n\n return {\n preset,\n sidenavMode: definition?.sidenavMode ?? definition?.layout?.sidenavMode ?? DEFAULT_SIDENAV_MODE,\n sidenavPosition: preset === 'sidenav-right' ? 'end' : 'start',\n hasSidenav: preset !== 'top-nav',\n sidenavOpened: definition?.sidenavOpenByDefault ?? true,\n sidenavCollapsible: definition?.sidenavCollapsible ?? true,\n contentMaxWidth: definition?.contentMaxWidth ?? definition?.layout?.contentMaxWidth,\n };\n}\n\n/**\n * The `--pp-*` overrides of one definition, as a style object to bind on the shell's host element.\n *\n * Custom properties cascade, so setting them on one element re-tints every framework surface below it\n * — which is what makes a themed preview possible at all without an iframe. `materialTheme` and\n * `colorScheme` are not handled here but by {@link themeDefaultsOf} and the shell's `ThemeService`, as\n * classes on the same element.\n *\n * Keys are passed through untouched, including their leading `--`: Angular's `[style]` binding treats\n * a custom property as a custom property, and the contract calls these overrides of the tokens in\n * `pp-colors.css`, so anything else would be this function inventing a naming rule.\n */\nexport function themeVarsOf(definition: AppDefinition | undefined): Record<string, string> {\n // The nested object first, so an override the form actually edited wins over the one the server sent.\n return { ...definition?.theme?.tokenOverrides, ...definition?.tokenOverrides };\n}\n\n/**\n * The route paths this definition accounts for: its own routes' paths, plus the base path of every module\n * it mounts.\n *\n * A module's *own* routes are deliberately absent. They live in the module's definition, which the router\n * fetches only when something navigates into the mount, so they cannot be known here — which is why the\n * consumer of this list treats a path *below* a known one as accounted for. See `toNavRows`.\n */\nexport function knownRoutePathsOf(definition: AppDefinition | undefined): string[] {\n const declared = (definition?.routes ?? []).map((route) => route.path);\n const mounted = (definition?.modules ?? []).map((mount) => mount.basePath);\n return [...declared, ...mounted].filter((path): path is string => !!path);\n}\n\n/**\n * The theme preset and colour scheme a definition declares, as the defaults of the shell's `ThemeService` —\n * which a user's choice in a `ThemesButton` overrides, and which fall back to the ProcessPuzzle look, light,\n * for whatever the definition leaves unset. Those fallbacks are the contract's defaults too, so the server\n * fills the same values in on save.\n */\nexport function themeDefaultsOf(definition: AppDefinition | undefined): Partial<ThemeSelection> {\n const preset = definition?.materialTheme ?? definition?.theme?.materialTheme;\n const scheme = definition?.colorScheme ?? definition?.theme?.colorScheme;\n return { ...(preset ? { preset } : {}), ...(scheme ? { scheme } : {}) };\n}\n","import { Component, input } from '@angular/core';\nimport { WidgetInstance } from '@processpuzzle/widgets';\nimport { WidgetListComponent } from '../widget-list.component';\n\n/**\n * The `footer` region: the widgets it declares, and nothing else. The contract gives a footer no field\n * beyond `widgets`, so this stays a thin styled host over {@link WidgetListComponent} — separate from\n * the header only because the two are different slots with different styling, not because they share\n * no logic.\n */\n@Component({\n selector: 'pp-region-footer',\n standalone: true,\n imports: [WidgetListComponent],\n template: `<pp-widget-list [widgets]=\"widgets()\" />`,\n styles: [\n `\n :host {\n align-items: center;\n background-color: var(--pp-surface-header);\n color: var(--pp-on-header);\n display: flex;\n gap: 16px;\n justify-content: space-between;\n padding: 8px 16px;\n }\n /* Beside one another, as in the header — see the note there on why the list stays unopinionated. */\n pp-widget-list {\n align-items: center;\n display: flex;\n gap: 8px;\n }\n `,\n ],\n})\nexport class RegionFooterComponent {\n readonly widgets = input<WidgetInstance[]>([]);\n}\n","import { Component, input } from '@angular/core';\nimport { WidgetInstance } from '@processpuzzle/widgets';\nimport { WidgetListComponent } from '../widget-list.component';\n\n/**\n * The `header` region: the widgets the region declares, laid out in one row.\n *\n * The brand is widgets too — `app-logo` and `app-title` — which read the application's name and logo from\n * the shell's `APPLICATION_CONTEXT`. So a designer orders, omits or restyles them like any other widget, and\n * the header has no second, built-in way of showing the same thing. `--pp-app-title-color` is set to the\n * on-header colour here, so the title stays legible on the header surface whatever the theme.\n *\n * Nav items are *not* handled here. Under the `top-nav` preset the shell places the `sidenav` region's\n * nav beside this component in the same row, so that a `top-nav` app with no header region is still\n * navigable — see {@link AppShellComponent}.\n */\n@Component({\n selector: 'pp-region-header',\n standalone: true,\n imports: [WidgetListComponent],\n template: `<pp-widget-list [widgets]=\"widgets()\" />`,\n styles: [\n `\n :host {\n --pp-app-title-color: var(--pp-on-header, inherit);\n background-color: var(--pp-surface-header);\n color: var(--pp-on-header);\n align-items: center;\n display: flex;\n flex: 1;\n padding: 8px 16px;\n }\n /*\n * A row, because a header's widgets sit beside one another. The list component itself stays\n * unopinionated — the same component fills a routed content area, where a landing page's widgets\n * belong *under* one another — so the axis is the region's to choose, and a chrome row is the one\n * place it is not the default.\n */\n pp-widget-list {\n align-items: center;\n display: flex;\n flex: 1;\n gap: 8px;\n min-width: 0;\n }\n `,\n ],\n})\nexport class RegionHeaderComponent {\n readonly widgets = input<WidgetInstance[]>([]);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, input } from '@angular/core';\nimport { MatListItem, MatListItemIcon, MatListItemTitle, MatNavList } from '@angular/material/list';\nimport { RouterLink, RouterLinkActive } from '@angular/router';\nimport { EntityLabelPipe } from '@processpuzzle/base-entity';\nimport { NavItem } from '../../domain/app-definition';\n\n/** Which way the list runs. The shell decides it from `layout.preset`, not the region definition. */\nexport type NavOrientation = 'vertical' | 'horizontal';\n\n/**\n * One rendered row. A view model rather than the `NavItem` itself, so that \"does this item navigate, and\n * does its target exist\" is decided once per definition in a pure function instead of by methods the\n * template would re-run on every change detection pass.\n */\nexport interface NavRow {\n id: string;\n label: string;\n /**\n * Transloco key for {@link label}, preferred over it when the key resolves. Carried onto the row rather\n * than translated here: `toNavRows` is a pure function and translation depends on the active language\n * and on which scopes have finished loading, both of which are the template's concern.\n */\n translocoId?: string;\n icon?: string;\n /** Present only when the item names a route that something accounts for — see {@link toNavRows}. */\n routePath?: string;\n /** The item names a route path, but nothing in the definition accounts for it. */\n unresolved: boolean;\n children: NavRow[];\n}\n\n/**\n * Maps the authored nav tree onto rows, resolving each `routePath` against the paths the definition\n * accounts for.\n *\n * A path counts as resolved if it equals a declared route's path *or* sits below one — below a declared\n * route, or below a mounted module's base path. The prefix rule is what keeps this from crying wolf: the\n * routes inside a module live in the module's own definition, which is fetched lazily and is not knowable\n * here, so `back-office/lines` has to be trusted on the strength of the `back-office` mount alone.\n *\n * A group node — no `routePath`, children instead — is not unresolved. It expands rather than navigates.\n */\nexport function toNavRows(items: NavItem[] | undefined, knownPaths: string[]): NavRow[] {\n return (items ?? []).map((item) => {\n const routePath = normalize(item.routePath);\n const resolved = routePath !== undefined && knownPaths.some((known) => routePath === known || routePath.startsWith(`${known}/`));\n return {\n id: item.id,\n label: item.label,\n translocoId: item.translocoId,\n icon: item.icon,\n ...(resolved ? { routePath } : {}),\n unresolved: routePath !== undefined && !resolved,\n children: toNavRows(item.children, knownPaths),\n };\n });\n}\n\n/**\n * A route path as it is compared and linked: no surrounding slashes, since `RouteDefinition.path` is\n * relative with no leading slash by contract and a nav item may still have been authored with one.\n * Whitespace-only counts as absent — an item mid-authoring is a group node, not a broken link.\n */\nfunction normalize(routePath: string | undefined): string | undefined {\n const trimmed = routePath\n ?.trim()\n .replace(/^\\/+|\\/+$/g, '')\n .trim();\n return trimmed ? trimmed : undefined;\n}\n\n/**\n * Renders the nav tree of the `sidenav` region — in the sidenav for the two sidenav presets, and\n * horizontally in the header row for `top-nav`. One component for both, because the tree and its\n * grouping rules are the same either way and only the axis differs.\n *\n * Links are relative, which is what makes the same component work in the designer's Preview tab and in a\n * standalone deployment: `routerLink=\"orders\"` resolves against whichever route hosts the shell, so it\n * becomes `…/app-definition/demo/preview/orders` under the designer and `/orders` under a runtime host,\n * with nothing here needing to know which.\n *\n * An item whose target nothing accounts for is rendered as an inert row with a title, not as a link that\n * would navigate into a 404. A dangling `routePath` is a *warning* server-side by design — it may name a\n * route of a module authored later — so the shell has to render it as something rather than reject it.\n *\n * `translocoId` is preferred over `label` where it resolves, through the impure `ppLabel` pipe — so a row\n * shows the authored literal until the scope that owns its key has loaded, then re-renders. A nav label is\n * *tenant* content living under a module's own scope, which for an authored module is served by the\n * backend rather than shipped as an asset; `ppLabel` falling back is the normal case, not a defect.\n */\n@Component({\n selector: 'pp-region-nav',\n standalone: true,\n imports: [MatNavList, MatListItem, MatListItemIcon, MatListItemTitle, NgTemplateOutlet, RouterLink, RouterLinkActive, EntityLabelPipe],\n template: `\n @if (compact()) {\n <nav class=\"pp-region-nav--compact\">\n <ng-container *ngTemplateOutlet=\"compactRowList; context: { $implicit: rows() }\"></ng-container>\n </nav>\n } @else {\n <mat-nav-list [class.pp-region-nav--horizontal]=\"orientation() === 'horizontal'\">\n <ng-container *ngTemplateOutlet=\"rowList; context: { $implicit: rows(), depth: 0 }\"></ng-container>\n </mat-nav-list>\n }\n\n <!--\n Recursive through ngTemplateOutlet: a NavItem nests in itself, so the depth is not knowable here.\n\n The icon and the title are spelled out in both branches rather than shared through one more template.\n A list item sorts its content with an ng-content selector on [matListItemIcon], and a projection\n selector is matched at compile time against the element's own children — so anything arriving through\n ngTemplateOutlet is one opaque node to it, and lands in the unprojected slot beside the title. That is\n what put the icon on a line of its own above every label.\n -->\n <ng-template #rowList let-rows let-depth=\"depth\">\n @for (row of rows; track row.id) {\n @if (row.routePath; as routePath) {\n <!-- An anchor, not a bare list item: RouterLink only writes href onto one, and without it the row\n is not a real link — no middle-click, no open-in-new-tab, no keyboard activation. -->\n <a\n mat-list-item\n class=\"pp-region-nav__item\"\n [routerLink]=\"routePath\"\n routerLinkActive=\"pp-region-nav__item--active\"\n [style.padding-inline-start.px]=\"depth * 12\"\n [attr.data-testid]=\"'nav-' + row.id\"\n >\n @if (row.icon) {\n <span matListItemIcon class=\"material-symbols-outlined\">{{ row.icon }}</span>\n }\n <div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>\n </a>\n } @else {\n <mat-list-item\n class=\"pp-region-nav__item\"\n [class.pp-region-nav__item--unresolved]=\"row.unresolved\"\n [title]=\"row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''\"\n [style.padding-inline-start.px]=\"depth * 12\"\n [attr.data-testid]=\"'nav-' + row.id\"\n >\n @if (row.icon) {\n <span matListItemIcon class=\"material-symbols-outlined\">{{ row.icon }}</span>\n }\n <div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>\n </mat-list-item>\n }\n @if (row.children.length) {\n <ng-container *ngTemplateOutlet=\"rowList; context: { $implicit: row.children, depth: depth + 1 }\"></ng-container>\n }\n }\n </ng-template>\n <!--\n The compact rows of a tablet layout: the icon above a short label, so the drawer — which is sized to its\n content — narrows to a rail. Plain elements rather than list items, whose fixed height and leading-icon\n slot are exactly the row layout this replaces. Nesting is shown by order alone; a rail has no room for\n indentation.\n -->\n <ng-template #compactRowList let-rows>\n @for (row of rows; track row.id) {\n @if (row.routePath; as routePath) {\n <a class=\"pp-region-nav__compact-item\" [routerLink]=\"routePath\" routerLinkActive=\"pp-region-nav__item--active\" [attr.data-testid]=\"'nav-' + row.id\">\n @if (row.icon) {\n <span class=\"material-symbols-outlined pp-region-nav__compact-icon\">{{ row.icon }}</span>\n }\n <span class=\"pp-region-nav__compact-label\">{{ row.translocoId | ppLabel: row.label }}</span>\n </a>\n } @else {\n <span\n class=\"pp-region-nav__compact-item\"\n [class.pp-region-nav__item--unresolved]=\"row.unresolved\"\n [title]=\"row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''\"\n [attr.data-testid]=\"'nav-' + row.id\"\n >\n @if (row.icon) {\n <span class=\"material-symbols-outlined pp-region-nav__compact-icon\">{{ row.icon }}</span>\n }\n <span class=\"pp-region-nav__compact-label\">{{ row.translocoId | ppLabel: row.label }}</span>\n </span>\n }\n @if (row.children.length) {\n <ng-container *ngTemplateOutlet=\"compactRowList; context: { $implicit: row.children }\"></ng-container>\n }\n }\n </ng-template>\n `,\n styles: [\n `\n :host {\n display: block;\n }\n .pp-region-nav--horizontal {\n display: flex;\n padding-top: 0;\n }\n .pp-region-nav--horizontal .pp-region-nav__item {\n width: auto;\n }\n .pp-region-nav--compact {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 8px 4px;\n }\n .pp-region-nav__compact-item {\n align-items: center;\n border-radius: 8px;\n color: inherit;\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 6px 4px;\n text-decoration: none;\n }\n a.pp-region-nav__compact-item:hover,\n .pp-region-nav__compact-item.pp-region-nav__item--active {\n background-color: color-mix(in srgb, currentColor 12%, transparent);\n }\n .pp-region-nav__compact-label {\n font: var(--mat-sys-label-small);\n max-width: 80px;\n overflow: hidden;\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .pp-region-nav__item--unresolved {\n font-style: italic;\n opacity: 0.6;\n }\n `,\n ],\n})\nexport class RegionNavComponent {\n readonly navItems = input<NavItem[]>([]);\n readonly orientation = input<NavOrientation>('vertical');\n /**\n * Icon-over-label rows for a narrow layout. Set by the shell on a tablet layout, where a content-sized\n * drawer with full rows would take too much of the screen; meaningless for the horizontal nav.\n */\n readonly compact = input(false);\n /** Route paths the definition accounts for, supplied by `AppRegionRenderer`. See {@link toNavRows}. */\n readonly knownPaths = input<string[]>([]);\n\n protected readonly rows = computed(() => toNavRows(this.navItems(), this.knownPaths()));\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AppDefinition, RegionDefinition, RegionType } from '../../domain/app-definition';\nimport { knownRoutePathsOf } from './app-shell.model';\nimport { RegionFooterComponent } from './region-footer.component';\nimport { RegionHeaderComponent } from './region-header.component';\nimport { RegionNavComponent } from './region-nav.component';\n\n/**\n * One region resolved to something renderable: which slot it fills, the component that fills it and\n * the inputs to bind. **Data, not a view** — deliberately the same shape of answer\n * {@link AppRouteRenderer} gives for a route, and for the same reasons: it is assertable from a spec\n * without a `TestBed`, and the shell can bind it declaratively so that editing the definition in the\n * neighbouring form re-renders through ordinary signal propagation.\n *\n * `slot` is where the region *asks* to go. The shell may place it elsewhere — the `top-nav` preset puts\n * the `sidenav` slot's view in the header row — and may override {@link inputs} when it does, which is\n * the second reason this carries inputs rather than a constructed component.\n */\nexport interface RegionView {\n slot: RegionType;\n component: Type<unknown>;\n inputs: Record<string, unknown>;\n}\n\n/**\n * Turns one authored `RegionDefinition` into the {@link RegionView} that renders it.\n *\n * An injectable rather than a free function, though stateless today, for the reason `AppRouteRenderer`\n * is one: the Preview tab and the eventual standalone runtime host must resolve regions *identically*,\n * so there has to be exactly one of these, and a constructor parameter is a cheaper way to grow it than\n * a rewrite.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppRegionRenderer {\n render = (region: RegionDefinition, definition: AppDefinition | undefined): RegionView | undefined => {\n switch (region.type) {\n case 'header':\n // Widgets alone: the brand is an `app-logo` and an `app-title` widget like any other, reading the\n // definition's name and logo through the shell's APPLICATION_CONTEXT.\n return { slot: 'header', component: RegionHeaderComponent, inputs: { widgets: region.widgets ?? [] } };\n case 'footer':\n return { slot: 'footer', component: RegionFooterComponent, inputs: { widgets: region.widgets ?? [] } };\n case 'sidenav':\n // `orientation` is left at the component's own default; the shell overrides it for `top-nav`,\n // because the axis follows the layout preset rather than anything authored on the region.\n // `knownPaths` comes from the definition rather than the region: whether a nav entry resolves is a\n // question about the *application's* routes, which only this function can see from here.\n return { slot: 'sidenav', component: RegionNavComponent, inputs: { navItems: region.navItems ?? [], knownPaths: knownRoutePathsOf(definition) } };\n default:\n // A region whose `type` the designer has not chosen yet. `RegionDefinition.type` is\n // `RegionType | undefined` precisely because a row exists before its dropdown is touched, and\n // the preview renders it *while* that is happening — so this is the normal path, not an error\n // one. Omitting it is quieter than a placeholder, and the form already shows the empty row.\n return undefined;\n }\n };\n}\n","import { computed, Injectable, signal } from '@angular/core';\nimport { ApplicationContext, NavMenuItem } from '@processpuzzle/widgets';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { knownRoutePathsOf } from './app-shell.model';\nimport { NavRow, toNavRows } from './region-nav.component';\n\n/**\n * The shell's answer to base-widget's `APPLICATION_CONTEXT`: the name, logo and navigation of the definition\n * it renders, for `app-title`, `app-logo` and `nav-menu` to read without props.\n *\n * Provided on `AppShellComponent`, so every widget below it — in a region or in routed content — sees the\n * application it is part of. The shell writes {@link definition}; everything else derives from it.\n */\n@Injectable()\nexport class ShellApplicationContext implements ApplicationContext {\n readonly definition = signal<AppDefinition | undefined>(undefined);\n\n readonly name = computed(() => this.definition()?.name ?? '');\n readonly logoUrl = computed(() => this.definition()?.logoUrl ?? this.definition()?.theme?.logoUrl);\n readonly navItems = computed(() => navMenuItemsOf(this.definition()));\n}\n\n/**\n * The sidenav region's entries as menu items, resolved the way the sidenav resolves them: an entry naming a\n * route the application does not account for keeps its place but loses its link, so the menu never offers\n * a navigation the router would reject.\n */\nexport function navMenuItemsOf(definition: AppDefinition | undefined): NavMenuItem[] {\n const sidenav = definition?.regions?.find((region) => region.type === 'sidenav');\n return toMenuItems(toNavRows(sidenav?.navItems, knownRoutePathsOf(definition)));\n}\n\nfunction toMenuItems(rows: NavRow[]): NavMenuItem[] {\n return rows.map((row) => ({\n id: row.id,\n label: row.label,\n ...(row.translocoId ? { translocoId: row.translocoId } : {}),\n ...(row.icon ? { icon: row.icon } : {}),\n ...(row.routePath ? { routePath: row.routePath } : {}),\n ...(row.children.length ? { children: toMenuItems(row.children) } : {}),\n }));\n}\n","import { OverlayContainer } from '@angular/cdk/overlay';\nimport { ElementRef, inject, Injectable } from '@angular/core';\n\n/**\n * An `OverlayContainer` that lives inside the shell's host element instead of under `<body>`.\n *\n * The shell's theme is a set of custom properties and a `color-scheme` on its host, and they only cascade to\n * descendants. A menu, tooltip or dialog opened from inside the shell renders into the overlay container, so\n * with CDK's default one it would wear the surrounding application's theme — a light menu over a dark\n * previewed app. Moving the container into the host is all it takes; the container is `position: fixed`, and\n * native popovers render in the top layer regardless of where they sit in the DOM.\n *\n * Provided in `AppShellComponent`'s `providers`, which is also where `ElementRef` comes from. Menus and\n * tooltips resolve it through their own element injector; dialogs need `Dialog` and `MatDialog` provided\n * there as well, since the root ones would resolve the root container.\n */\n@Injectable()\nexport class ShellOverlayContainer extends OverlayContainer {\n private readonly host: HTMLElement = inject(ElementRef).nativeElement;\n\n protected override _createContainer(): void {\n super._createContainer();\n if (this._containerElement) this.host.appendChild(this._containerElement);\n }\n}\n","import { Dialog } from '@angular/cdk/dialog';\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { NgComponentOutlet } from '@angular/common';\nimport { Component, computed, effect, inject, input } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatSidenav, MatSidenavContainer, MatSidenavContent } from '@angular/material/sidenav';\nimport { RouterOutlet } from '@angular/router';\nimport { LayoutService } from '@processpuzzle/util';\nimport { APPLICATION_CONTEXT, SidenavAutosizeDirective, ThemeService } from '@processpuzzle/widgets';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { AppRegionRenderer, RegionView } from './app-region.renderer';\nimport { layoutOf, themeDefaultsOf, themeVarsOf } from './app-shell.model';\nimport { NavOrientation } from './region-nav.component';\nimport { ShellApplicationContext } from './shell-application-context';\nimport { ShellOverlayContainer } from './shell-overlay-container';\n\n/**\n * The run-time shell of a metadata-defined application: the chrome an `AppDefinition` describes, with a\n * `<router-outlet>` where its routes render.\n *\n * **This is the application, not a picture of one.** `AppPreviewComponent` hosts it so that the Preview\n * tab shows the real thing, and the standalone runtime host will mount the same component — which is\n * the whole point of it being a component with one input rather than something assembled inside the\n * preview. A shell built for the preview would drift from the one built for production, and a preview\n * that drifts is worse than none.\n *\n * Everything is bound declaratively. Regions are resolved to {@link RegionView}s and rendered through\n * `NgComponentOutlet`, never created imperatively, so that a definition edited in the neighbouring\n * details form re-renders through ordinary signal propagation instead of a clear-and-rebuild that would\n * drop scroll position and focus on every keystroke.\n *\n * The whole theme is applied here, not only the brand colours: `--pp-*` overrides as a style binding, and\n * a class selecting one of the scoped Material themes of widgets' `src/theme/pp-material-themes.scss`. The\n * class comes from the shell's own {@link ThemeService}: the definition's `materialTheme` / `colorScheme`\n * are its defaults, and a `ThemesButton` placed in one of the regions overrides them for this application\n * only. Both work because a Material theme is a set of custom properties and nothing else. That file is a\n * **global stylesheet the application registers**; if it is not registered the classes still land and the\n * shell simply inherits the host's theme. Overlays opened from inside the shell render into a\n * {@link ShellOverlayContainer} in its host, so they are themed as well.\n *\n * Not yet handled, deliberately: **no routes are registered** under the outlet. That is the nested router\n * context, which needs `EntityTabDescriptor` to be able to carry child routes.\n */\n@Component({\n selector: 'pp-app-shell',\n standalone: true,\n imports: [NgComponentOutlet, MatSidenav, MatSidenavContainer, MatSidenavContent, RouterOutlet, SidenavAutosizeDirective],\n providers: [\n ThemeService,\n ShellApplicationContext,\n { provide: APPLICATION_CONTEXT, useExisting: ShellApplicationContext },\n { provide: OverlayContainer, useClass: ShellOverlayContainer },\n Dialog,\n MatDialog,\n ],\n // Both theme bindings go on the host rather than on a wrapper, so the element that *is* the shell is\n // also the element they cascade from — and so the host can be the grid, see the stylesheet. `[class]`\n // selects one of the scoped Material themes there; `[style]` carries the `--pp-*` overrides.\n host: { '[class]': 'themeClass()', '[style]': 'themeVars()' },\n template: `\n @if (headerView() || topNavView()) {\n <div class=\"pp-app-shell__top\">\n @if (headerView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: view.inputs\"></ng-container>\n }\n @if (topNavView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: topNavInputs()\"></ng-container>\n }\n </div>\n }\n\n <mat-sidenav-container class=\"pp-app-shell__body\">\n @if (sidenavView(); as view) {\n <mat-sidenav\n class=\"pp-app-shell__sidenav\"\n ppSidenavAutosize\n [mode]=\"layout().sidenavMode\"\n [opened]=\"layout().sidenavOpened && !layoutService.isSidenavHidden()\"\n [position]=\"layout().sidenavPosition\"\n >\n <ng-container *ngComponentOutlet=\"view.component; inputs: sidenavInputs()\"></ng-container>\n </mat-sidenav>\n }\n <mat-sidenav-content>\n <main class=\"pp-app-shell__content\" [style.max-width]=\"layout().contentMaxWidth\">\n <router-outlet />\n </main>\n </mat-sidenav-content>\n </mat-sidenav-container>\n\n @if (footerView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: view.inputs\"></ng-container>\n }\n `,\n styleUrl: 'app-shell.component.scss',\n})\nexport class AppShellComponent {\n /**\n * The definition to render. Optional rather than required because the shell is mounted before the\n * definition resolves — the preview's store selects the entity in its own `ngOnInit`, and a deep link\n * arrives with nothing loaded — so an empty shell is a state to render, not an error.\n */\n readonly definition = input<AppDefinition | undefined>(undefined);\n\n /**\n * Whether a theme the user picks in a `ThemesButton` inside the shell is remembered, per application id.\n * The designer's preview turns it off: there a choice is only tried out, and a stored one would shadow the\n * theme being edited in the neighbouring form.\n */\n readonly persistTheme = input(true);\n\n private readonly regionRenderer = inject(AppRegionRenderer);\n private readonly theme = inject(ThemeService);\n private readonly applicationContext = inject(ShellApplicationContext);\n protected readonly layoutService = inject(LayoutService);\n\n protected readonly layout = computed(() => layoutOf(this.definition()));\n protected readonly themeVars = computed(() => themeVarsOf(this.definition()));\n protected readonly themeClass = this.theme.themeClass;\n\n // Re-run on every edit of the definition. Persisting, that re-reads the same stored choice; in the preview\n // it drops the choice tried out there, so an edit to the theme fields always shows.\n private readonly applyThemeDefaults = effect(() => {\n const definition = this.definition();\n this.theme.setDefaults(themeDefaultsOf(definition));\n this.theme.persistUnder(this.persistTheme() && definition?.id ? `pp-theme:${definition.id}` : null);\n this.applicationContext.definition.set(definition);\n });\n\n private readonly regionViews = computed(() =>\n (this.definition()?.regions ?? []).map((region) => this.regionRenderer.render(region, this.definition())).filter((view): view is RegionView => view !== undefined),\n );\n\n protected readonly headerView = computed(() => this.viewOf('header'));\n protected readonly footerView = computed(() => this.viewOf('footer'));\n\n /**\n * The nav in the sidenav, for the two sidenav presets. Split from {@link topNavView} rather than\n * decided in the template, so each slot is one unambiguous `@if` and the mutual exclusion is stated\n * once, here.\n */\n protected readonly sidenavView = computed(() => (this.layout().hasSidenav && !this.isSmallScreen() ? this.viewOf('sidenav') : undefined));\n\n /**\n * The same nav relocated into the header row under `top-nav`. It is placed beside the header region\n * rather than inside it, so that a `top-nav` app which declares no header region is still navigable —\n * and so that the shell still never invents a region that was not authored.\n */\n protected readonly topNavView = computed(() => (this.layout().hasSidenav || this.isSmallScreen() ? undefined : this.viewOf('sidenav')));\n\n /**\n * A handset layout has room for neither a sidenav nor a horizontal nav row, so the shell renders the nav\n * in neither place there; a `nav-menu` widget in the header stands in for it, reading the same entries\n * through the APPLICATION_CONTEXT. A definition with no such widget is not navigable on a phone — which is\n * why the seeded applications all place one.\n */\n private readonly isSmallScreen = computed(() => this.layoutService.isSmallDevice());\n\n /**\n * The nav view's own inputs with the axis the layout dictates laid over them.\n *\n * Computeds rather than a method called from the template: a method would hand `NgComponentOutlet` a\n * freshly built object on every change-detection pass, so it would re-diff and re-apply the nav's\n * inputs continuously. Memoized, the identity only changes when the definition or the preset does.\n */\n // Compact on a tablet layout, the sidenav's middle size: the drawer is sized to its content, so compact\n // rows are what narrow it to a rail. See SidenavAutosizeDirective for how the content margin follows.\n protected readonly sidenavInputs = computed(() => ({ ...this.navInputsOf(this.sidenavView(), 'vertical'), compact: this.layoutService.isMediumDevice() }));\n protected readonly topNavInputs = computed(() => this.navInputsOf(this.topNavView(), 'horizontal'));\n\n private navInputsOf(view: RegionView | undefined, orientation: NavOrientation): Record<string, unknown> {\n return { ...view?.inputs, orientation };\n }\n\n private viewOf(slot: RegionView['slot']): RegionView | undefined {\n // First occurrence wins. An app declares each slot at most once — `type` is the region's identity,\n // see APP_REGION_ID_FIELD — so a second one is a definition that bypassed validation, and ignoring\n // it is the harmless read. The same rule `buildAppRoutes` applies to a duplicate path.\n return this.regionViews().find((view) => view.slot === slot);\n }\n}\n","import { Component, computed, inject, input, OnInit } from '@angular/core';\nimport { AppDefinition } from '../domain/app-definition';\nimport { AppDefinitionStore } from '../domain/app-definition.store';\nimport { AppShellComponent } from './shell/app-shell.component';\n\n/**\n * The Preview tab's screen, mounted at `app-definition/<id>/preview` by `BASE_APP_ROUTES` — a sibling of\n * the generic Details form rather than something stacked under it, which is what the `extraTabs` hook on\n * `BaseEntityDescriptor` exists for.\n *\n * A **container and nothing more**: it resolves which definition is being previewed and frames the\n * result. Everything about *how* an application renders belongs to {@link AppShellComponent}, which the\n * standalone runtime host will mount just as this does — so the preview cannot grow behaviour the real\n * shell lacks, which is the only way a preview stays honest.\n *\n * The frame below — rounded, white, and tall enough to look like an application — is the preview's own,\n * not the shell's. In production the shell fills the viewport and none of it applies.\n */\n@Component({\n selector: 'pp-app-preview-tab',\n standalone: true,\n imports: [AppShellComponent],\n template: `\n <div class=\"pp-app-preview\">\n <pp-app-shell [definition]=\"app()\" [persistTheme]=\"false\" />\n </div>\n `,\n styles: [\n `\n .pp-app-preview {\n background-color: var(--pp-surface-base, #ffffff);\n border-radius: 6px;\n overflow: hidden;\n }\n /*\n * How tall a previewed application is, and therefore where its footer sits: at the bottom of this\n * box, not directly under the header. The shell is a three-row grid whose middle row takes the slack,\n * so giving it a height is all that is needed — but something has to, and nothing above this can:\n * the tab panel, the router outlets and the designer's own layout are all auto-height, so a\n * percentage here would resolve against nothing.\n *\n * Viewport-relative rather than a calc() subtracting the chrome: what sits above a preview is a tab\n * bar, a status bar and a toolbar whose heights are Material's to change, and a subtraction would go\n * quietly wrong when they do.\n */\n .pp-app-preview > pp-app-shell {\n min-height: 65vh;\n }\n `,\n ],\n})\nexport class AppPreviewComponent implements OnInit {\n /**\n * Bound from the route's `:entityId` param by `withComponentInputBinding()`, the same way\n * `BaseEntityFormComponent` receives it — so a deep link and a reload resolve the same app definition as a\n * click through the tab does.\n */\n readonly entityId = input.required<string>();\n\n private readonly store = inject(AppDefinitionStore);\n\n protected readonly app = computed(() => this.store.currentEntity() as AppDefinition | undefined);\n\n ngOnInit(): void {\n // Also sets the current entity, so the tab bar's Details link stays enabled and the status bar keeps\n // naming the record — arriving here directly, nothing else has selected it.\n this.store.setCurrentEntity(this.entityId());\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { CanMatchFn, Routes } from '@angular/router';\nimport { BaseUrlSegments } from '@processpuzzle/base-entity';\nimport { firstValueFrom } from 'rxjs';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { AppDefinitionService } from '../../domain/app-definition.service';\nimport { AppDefinitionStore } from '../../domain/app-definition.store';\nimport { ModuleDefinition } from '../../domain/module-definition';\nimport { ModuleDefinitionService } from '../../domain/module-definition.service';\nimport { ModuleDefinitionStore } from '../../domain/module-definition.store';\nimport { buildAppRoutes } from '../app-route-builder';\nimport { AppRouteRenderer } from '../app-route-renderer';\n\n/**\n * Turns one `AppDefinition` into the `Routes` that render its screens — the missing consumer of\n * {@link buildAppRoutes}, which until now produced routes nothing registered.\n *\n * Separate from the guard below so the interesting part is testable without a router: this class answers\n * \"what routes does app X have\", and the guard is only the two lines that hand them to Angular.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppShellRoutesFactory {\n private readonly appStore = inject(AppDefinitionStore);\n private readonly appService = inject(AppDefinitionService);\n private readonly moduleStore = inject(ModuleDefinitionStore);\n private readonly moduleService = inject(ModuleDefinitionService);\n private readonly renderRoute = inject(AppRouteRenderer).render;\n\n async childrenOf(appId: string): Promise<Routes> {\n const definition = await this.definitionOf(appId);\n if (!definition) return [];\n\n const built = await buildAppRoutes({ routes: definition.routes, modules: definition.modules, loadModule: this.loadModule }, this.renderRoute);\n return built.length ? [indexRoute(definition, built), ...built] : built;\n }\n\n /**\n * Store first, endpoint second.\n *\n * The store holds the newest definition immediately after a Save, so the next navigation inside the\n * preview picks up a route the designer just added — without a second GET, and without this having to\n * know that a save happened. The fetch is for the case the store cannot serve: a deep link or a reload,\n * where nothing has been loaded yet.\n *\n * A failure resolves to `undefined` rather than propagating. A guard that rejects fails the whole\n * navigation, and an app whose definition cannot be read should render an empty shell, not a dead URL.\n */\n private async definitionOf(appId: string): Promise<AppDefinition | undefined> {\n const known = this.appStore.loadById(appId);\n if (known) return known;\n return (await this.fetch(() => firstValueFrom(this.appService.findById(appId)))) as AppDefinition | undefined;\n }\n\n /**\n * The {@link ModuleLoader} `buildAppRoutes` calls for a mount whose module it has not got. Resolving to\n * `undefined` is deliberate and is what the contract asks for: a `ModuleMount` naming a module nobody has\n * authored yet is a validation *warning*, so it must contribute no routes rather than break navigation.\n */\n private loadModule = async (moduleKey: string): Promise<ModuleDefinition | undefined> => {\n const known = this.moduleStore.loadById(moduleKey);\n if (known) return known;\n return (await this.fetch(() => firstValueFrom(this.moduleService.findById(moduleKey)))) as ModuleDefinition | undefined;\n };\n\n /** `findById` resolves to `void` for a missing record and rejects on a transport error; both mean \"no\". */\n private async fetch<Result>(read: () => Promise<Result | void>): Promise<Result | undefined> {\n try {\n return (await read()) || undefined;\n } catch {\n return undefined;\n }\n }\n}\n\n/**\n * Where the application root goes. Without it the app's own URL — `…/preview` with nothing after it —\n * matches none of the children and the *whole* route fails to match, which would take the preview screen\n * down rather than merely leave its content area empty.\n *\n * The authored order decides, falling back to the first route as built. The fallback is not decoration: an\n * app may declare no routes of its own and mount all of its screens from a module, in which case the\n * definition offers no path to land on but the built routes do.\n */\nfunction indexRoute(definition: AppDefinition, built: Routes) {\n const target = definition.routes?.find((route) => route.path)?.path ?? built[0].path;\n // `pathMatch: 'full'`, or an empty path would prefix-match every URL below it and swallow the app.\n return { path: '', pathMatch: 'full' as const, redirectTo: target };\n}\n\n/**\n * Registers an application's own routes as the children of the Preview tab's route, so that navigating\n * inside a previewed application is *real* navigation: real URLs, real back button, real outlet.\n *\n * Why a `canMatch` guard rather than `loadChildren`, which is the obvious hook for lazily-known children:\n * the router caches a `loadChildren` result on the `Route` object as `_loadedRoutes`, and one Route object\n * serves every `:entityId`. The first app previewed would therefore have its routes replayed for the\n * second. `children`, by contrast, is read fresh on every recognition and never cached — and `canMatch`\n * runs, and is awaited, *before* the router reads it. So this is the one hook that can answer \"children of\n * *this* app\" and still work on a deep link.\n *\n * Always returns `true`. It is not deciding whether the tab may be entered — it is filling in the tab's\n * children on the way past.\n */\nexport const appShellRoutesGuard: CanMatchFn = (route, _segments, snapshot) => {\n const appId = snapshot.paramMap.get(BaseUrlSegments.EntityID);\n if (!appId) return true;\n\n // `inject` before the first await: an async function loses the injection context at its first suspension.\n const factory = inject(AppShellRoutesFactory);\n return factory.childrenOf(appId).then((children) => {\n route.children = children;\n return true;\n });\n};\n","import { EntityTabDescriptor } from '@processpuzzle/base-entity';\nimport { APP_PREVIEW_I18N_KEY } from '../base-app.i18n';\nimport { AppPreviewComponent } from './app-preview.component';\nimport { appShellRoutesGuard } from './shell/app-shell-routes';\n\n/**\n * The Preview tab, declared once and consumed twice: `BASE_APP_ROUTES` mounts it as\n * `app-definition/<id>/preview`, and `AppDefinitionContainerComponent` puts it on the descriptor so the tab bar\n * renders the link. One constant rather than two literals because the segment is what ties the link to the\n * route — a mismatch would render a tab that navigates to a URL nothing matches.\n *\n * The tab is a *container*: `children` starts empty and {@link appShellRoutesGuard} fills it with the\n * previewed application's own routes on every navigation, so the shell's `<router-outlet>` renders real\n * screens at real URLs — `app-definition/demo/preview/orders`. The empty array is load-bearing; a route with\n * no `children` at all takes the `loadChildren` path instead, which is cached per Route object and so cannot\n * vary by `:entityId`.\n */\nexport const APP_PREVIEW_TAB: EntityTabDescriptor = {\n segment: 'preview',\n i18nKey: APP_PREVIEW_I18N_KEY,\n component: AppPreviewComponent,\n testIdSuffix: 'show-preview',\n children: [],\n canMatch: [appShellRoutesGuard],\n};\n","import { Component, ComponentRef, computed, inject, OnDestroy, TemplateRef, viewChild, ViewChild } from '@angular/core';\nimport { TranslocoPipe } from '@jsverse/transloco';\nimport { MatButton } from '@angular/material/button';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { BaseEntityContainerComponent, BaseEntityDescriptor, BaseFormHostDirective } from '@processpuzzle/base-entity';\nimport { PUBLISH_BUTTON_I18N_KEY, PUBLISH_TOOLTIP_I18N_KEY } from '../base-app.i18n';\nimport { AppDefinitionStore } from '../domain/app-definition.store';\nimport { createAppDefinitionDescriptor } from '../domain/app-definition.descriptors';\nimport { APP_PREVIEW_TAB } from './app-preview-tab';\n\n@Component({\n selector: 'pp-app-definition-container',\n standalone: true,\n imports: [BaseEntityContainerComponent, MatButton, MatTooltip, TranslocoPipe],\n template: `\n <base-entity-container [entityDescriptor]=\"entityDescriptor\"></base-entity-container>\n <ng-template #publishActionsTpl>\n <button id=\"publish\" type=\"button\" mat-raised-button color=\"accent\" [disabled]=\"!canPublish()\" [matTooltip]=\"publishTooltipKey | transloco\" (click)=\"onPublish()\">\n {{ publishButtonKey | transloco }}\n </button>\n </ng-template>\n `,\n})\nexport class AppDefinitionContainerComponent implements OnDestroy {\n private readonly containerComponentRef: ComponentRef<BaseEntityContainerComponent> | undefined;\n @ViewChild(BaseFormHostDirective, { static: true, read: BaseFormHostDirective }) baseEntityHost!: BaseFormHostDirective;\n readonly publishActionsTpl = viewChild<TemplateRef<unknown>>('publishActionsTpl');\n private readonly store = inject(AppDefinitionStore);\n readonly entityDescriptor: BaseEntityDescriptor;\n readonly publishButtonKey = PUBLISH_BUTTON_I18N_KEY;\n readonly publishTooltipKey = PUBLISH_TOOLTIP_I18N_KEY;\n /** Only a definition the backend already knows can be promoted, so a not-yet-saved form cannot publish. */\n readonly canPublish = computed(() => !this.store.isLoading() && !!this.store.currentEntity()?.id);\n\n constructor() {\n this.entityDescriptor = createAppDefinitionDescriptor();\n this.entityDescriptor.store = this.store;\n this.entityDescriptor.extraFormActionsTemplate = () => this.publishActionsTpl();\n this.entityDescriptor.extraTabs = [APP_PREVIEW_TAB];\n }\n\n ngOnDestroy(): void {\n if (this.containerComponentRef) {\n this.containerComponentRef.destroy();\n }\n }\n\n async onPublish(): Promise<void> {\n const id = this.store.currentEntity()?.id;\n if (!id) return;\n await this.store.publish(id);\n }\n}\n","import { Component, inject } from '@angular/core';\nimport { BaseEntityContainerComponent, BaseEntityDescriptor } from '@processpuzzle/base-entity';\nimport { createModuleDefinitionDescriptor } from '../domain/module-definition.descriptors';\nimport { ModuleDefinitionStore } from '../domain/module-definition.store';\n\n/**\n * Hosts the generic container for `Module Definition`, whose only job is to bind the descriptor to the\n * store the routable screens read from.\n *\n * Deliberately without the `Publish` action `AppDefinitionContainerComponent` contributes: publishing is\n * an application operation. An app is what a user navigates to and its status is what decides whether a\n * mount is live, so a module with a lifecycle of its own would make \"which version of what is live\" a\n * question with two answers.\n */\n@Component({\n selector: 'pp-module-definition-container',\n standalone: true,\n imports: [BaseEntityContainerComponent],\n template: `<base-entity-container [entityDescriptor]=\"entityDescriptor\"></base-entity-container>`,\n})\nexport class ModuleDefinitionContainerComponent {\n private readonly store = inject(ModuleDefinitionStore);\n readonly entityDescriptor: BaseEntityDescriptor;\n\n constructor() {\n this.entityDescriptor = createModuleDefinitionDescriptor();\n this.entityDescriptor.store = this.store;\n }\n}\n","import type { Provider } from '@angular/core';\nimport type { BaseEntityFacadeRegistry } from '@processpuzzle/base-entity';\nimport {\n APP_DEFINITION_ENTITY_NAME,\n APP_MODULE_MOUNT_ENTITY_NAME,\n APP_NAV_ITEM_ENTITY_NAME,\n APP_REGION_ENTITY_NAME,\n APP_ROUTE_ENTITY_NAME,\n APP_WIDGET_ENTITY_NAME,\n MODULE_DEFINITION_ENTITY_NAME,\n} from './domain/app-entity-names';\nimport { AppDefinitionFacade } from './feature/app-definition.facade';\nimport { AppModuleMountFacade } from './feature/app-module-mount.facade';\nimport { AppNavItemFacade } from './feature/app-nav-item.facade';\nimport { AppRegionFacade } from './feature/app-region.facade';\nimport { AppRouteFacade } from './feature/app-route.facade';\nimport { AppWidgetFacade } from './feature/app-widget.facade';\nimport { ModuleDefinitionFacade } from './feature/module-definition.facade';\n\n/**\n * The facades of the whole definition graph, to be spread into the application's `providers`.\n *\n * The embedded ones are here for the same reason the routable one is: an embedded entity has a facade\n * like any other — that is what gives it a store — and only its repository differs, reading and writing\n * the `App Definition` document rather than an endpoint of its own.\n */\nexport const BASE_APP_FACADE_PROVIDERS: Provider[] = [AppDefinitionFacade, ModuleDefinitionFacade, AppRegionFacade, AppRouteFacade, AppModuleMountFacade, AppNavItemFacade, AppWidgetFacade];\n\n/**\n * The same facades keyed by entity name, to be spread into the application's\n * `BASE_ENTITY_FACADE_REGISTRY` value.\n *\n * Every entity an `EMBEDDED_COMPONENTS` attribute of this library names has to appear here, or the\n * control throws on first render rather than showing a list whose rows go nowhere on save — the\n * registry is how it reaches the child's store and descriptor. Spread rather than provided separately,\n * because the token holds one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the\n * application's own entities instead of adding to them.\n */\nexport const BASE_APP_ENTITY_FACADES: BaseEntityFacadeRegistry = {\n [APP_DEFINITION_ENTITY_NAME]: AppDefinitionFacade,\n [MODULE_DEFINITION_ENTITY_NAME]: ModuleDefinitionFacade,\n [APP_REGION_ENTITY_NAME]: AppRegionFacade,\n [APP_ROUTE_ENTITY_NAME]: AppRouteFacade,\n [APP_MODULE_MOUNT_ENTITY_NAME]: AppModuleMountFacade,\n [APP_NAV_ITEM_ENTITY_NAME]: AppNavItemFacade,\n [APP_WIDGET_ENTITY_NAME]: AppWidgetFacade,\n};\n","import { Routes } from '@angular/router';\nimport { provideTranslocoScope } from '@jsverse/transloco';\nimport { baseEntityRoutes, type EmbeddedChildRoute } from '@processpuzzle/base-entity';\nimport { BASE_APP_TRANSLOCO_SCOPE, BASE_ENTITY_TRANSLOCO_SCOPE } from './base-app.i18n';\nimport { APP_DEFINITION_ENTITY_NAME } from './domain/app-definition.descriptors';\nimport {\n APP_MODULE_MOUNT_ENTITY_NAME,\n APP_NAV_ITEM_ENTITY_NAME,\n APP_REGION_ENTITY_NAME,\n APP_ROUTE_ENTITY_NAME,\n APP_WIDGET_ENTITY_NAME,\n MODULE_DEFINITION_ENTITY_NAME\n} from './domain/app-entity-names';\nimport { AppDefinitionContainerComponent } from './feature/app-definition-container.component';\nimport { APP_PREVIEW_TAB } from './feature/app-preview-tab';\nimport { AppModuleMountFacade } from './feature/app-module-mount.facade';\nimport { AppNavItemFacade } from './feature/app-nav-item.facade';\nimport { AppRegionFacade } from './feature/app-region.facade';\nimport { AppRouteFacade } from './feature/app-route.facade';\nimport { AppWidgetFacade } from './feature/app-widget.facade';\nimport { ModuleDefinitionContainerComponent } from './feature/module-definition-container.component';\n\n/**\n * The path segment has to be `snakeCaseName('App Definition')`, because\n * `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — see the same\n * constraint on `BASE_RULE_ROUTES`.\n */\nexport const BASE_APP_ROUTES: Routes = [\n {\n path: 'app-definition',\n title: 'ProcessPuzzle Design - Applications',\n data: { icon: 'web', menuTitle: 'design.applications', entityName: APP_DEFINITION_ENTITY_NAME },\n component: AppDefinitionContainerComponent,\n providers: [authoringScopes()],\n children: baseEntityRoutes(embeddedDefinitionRoutes(), [APP_PREVIEW_TAB]),\n },\n // A sibling rather than a child of the branch above: a module is an aggregate of its own, with its own\n // endpoints and its own list screen. What ties the two together is data — a `ModuleMount` naming a key —\n // and the run-time shell that resolves it, not the authoring URL.\n {\n path: 'module-definition',\n title: 'ProcessPuzzle Design - Modules',\n data: { icon: 'extension', menuTitle: 'design.modules', entityName: MODULE_DEFINITION_ENTITY_NAME },\n component: ModuleDefinitionContainerComponent,\n providers: [authoringScopes()],\n children: baseEntityRoutes([routeRoute()]),\n },\n];\n\n/**\n * The transloco scopes every authoring branch of this library needs. Both are required: a route that\n * declares TRANSLOCO_SCOPE replaces the collection it inherits rather than adding to it, and the generic\n * tabs translate the framework's own `base_entity.*` keys (see BASE_ENTITY_TRANSLOCO_SCOPE).\n *\n * Registered on the top-level routes rather than on the containers, so the base-entity tabs, list and form\n * rendered in the child routes resolve entity and attribute labels from the same scopes. The embedded\n * branches below need none of their own: `base_app.app_region.*` and its siblings are keys of the scope\n * already registered here.\n *\n * Both aliases are spelled out, as everywhere in this workspace: transloco camel-cases the default alias,\n * so `base_app` would silently become `baseApp` and miss every key below it.\n */\nfunction authoringScopes() {\n return provideTranslocoScope({ scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE }, { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE });\n}\n\n/**\n * The definition graph as route branches: a region, a route and a module mount hang below the\n * definition's details route, a nav item and a widget below the region's, a widget below the route's,\n * and a nav item below itself.\n *\n * The nesting mirrors the containment of `base-app-api.yaml` exactly, and it has to: an embedded row has\n * no id of its own to be looked up by, so the URL — `app-definition/claims-app/details/app-region/sidenav/\n * details/app-nav-item/nav-claims/details` — is what addresses it, and each segment resolves against the\n * rows of the level above it.\n *\n * These are the *authoring* routes and have nothing to do with the routes an `AppDefinition` declares:\n * `App Route` rows are data here, and it is the run-time shell that turns them into `Routes` of their\n * own. A module mount is a leaf — the module it names is a separate aggregate with its own endpoints,\n * so its routes are authored there rather than through this branch.\n */\nfunction embeddedDefinitionRoutes(): EmbeddedChildRoute[] {\n return [\n { entityName: APP_REGION_ENTITY_NAME, facade: AppRegionFacade, children: () => [navItemRoute(), widgetRoute()] },\n routeRoute(),\n { entityName: APP_MODULE_MOUNT_ENTITY_NAME, facade: AppModuleMountFacade },\n ];\n}\n\n/**\n * The `App Route` branch, shared by both aggregates that own routes: an app's `routes` and a module's are\n * the same rows edited by the same descriptor, so the branch below them has to be the same too. Only the\n * URL prefix differs — `app-definition/demo/details/app-route/...` against\n * `module-definition/claims/details/app-route/...`.\n */\nfunction routeRoute(): EmbeddedChildRoute {\n return { entityName: APP_ROUTE_ENTITY_NAME, facade: AppRouteFacade, children: () => [widgetRoute()] };\n}\n\n/** A nav item nests in itself — a group node's children are nav items. Hence the thunk: the structure is\n * infinite, and `loadChildren` expands one level per navigation. */\nfunction navItemRoute(): EmbeddedChildRoute {\n return { entityName: APP_NAV_ITEM_ENTITY_NAME, facade: AppNavItemFacade, children: () => [navItemRoute()] };\n}\n\n/**\n * A widget, unlike a nav item, is a leaf branch: widgets do not nest, so there is no deeper level to\n * expand. A container widget places its siblings by id through `props.childIds`, and those siblings are\n * rows of this same list — reachable at this level, not below it.\n */\nfunction widgetRoute(): EmbeddedChildRoute {\n return { entityName: APP_WIDGET_ENTITY_NAME, facade: AppWidgetFacade };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,MAAa,kBAAkB;AAG/B,MAAa,gBAAgB;AAG7B,MAAa,iBAAiB;CAAC;CAAgB;CAAiB;AAAS;AAGzE,MAAa,gBAAgB;CAAC;CAAQ;CAAQ;AAAM;AAQpD,MAAa,eAAe;CAAC;CAAU;CAAW;AAAQ;AAQ1D,MAAa,qBAAqB;CAAC;CAAW;CAAY;AAAQ;AAGlE,MAAa,eAAe,CAAC,QAAQ,SAAS;AAG9C,IAAY;CAAZ,SAAY,qBAAmB;CAC7B,oBAAA,WAAA;CACA,oBAAA,eAAA;AACF,EAAA,CAHY,wBAAA,sBAAmB,CAAA,EAAA;AAsB/B,IAAa,UAAb,MAAoB;CAClB;CACA;CACA;CACA;CAQA;CACA;CACA;CAEA,YAAY,OA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2B,GAAI;EAAE,OAAO;EAA0B,OAAO;CAAwB,CAAE;AAC/K;AAiBA,SAAS,2BAAwB;CAC/B,OAAO;EACL;GAAE,YAAY;GAAwB,QAAQ;GAAiB,gBAAgB,CAAC,aAAY,GAAI,YAAW,CAAE;EAAC;EAC9G,WAAU;EACV;GAAE,YAAY;GAA8B,QAAQ;EAAoB;CACzE;AACH;AAQA,SAAS,aAAU;CACjB,OAAO;EAAE,YAAY;EAAuB,QAAQ;EAAgB,gBAAgB,CAAC,YAAW,CAAE;CAAC;AACrG;AAIA,SAAS,eAAY;CACnB,OAAO;EAAE,YAAY;EAA0B,QAAQ;EAAkB,gBAAgB,CAAC,aAAY,CAAE;CAAC;AAC3G;AAOA,SAAS,cAAW;CAClB,OAAO;EAAE,YAAY;EAAwB,QAAQ;CAAe;AACtE"}
1
+ {"version":3,"file":"processpuzzle-base-app.mjs","names":["trimSlashes","i1.AppDefinitionMapper","i1.ModuleDefinitionMapper"],"sources":["../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-translation.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/base-app.i18n.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-asset.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/assets-control.base.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-assets-control.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-translation.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-translations-control.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-asset.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-assets-control.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-translations-control.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-entity-names.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-mount.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/working-context.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/region-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/route-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/nav-item.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/widget-instance.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.descriptors.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/route-definition.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/working-context-row.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.mapper.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-definition.store.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.service.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-definition.store.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-definition.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/module-definition.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-module-mount.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-nav-item.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-route-builder.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/widget-list.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/route-widgets.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/route-unsupported.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-route-renderer.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-region.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-route.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-widget.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-shell.model.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/region-footer.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/region-header.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/region-nav.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-region.renderer.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/shell-application-context.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/shell-sidenav-control.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/shell-overlay-container.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-shell.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-preview.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/app-asset-context.ts","../../../../libs/js-shared/base-app-frontend/src/lib/domain/module-asset-context.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-translations.loader.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/app-shell-routes.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-preview-tab.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-definition-container.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/published-app-routes.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/shell/published-app-theme.directive.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-concepts-guide.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/module-definition-container.component.ts","../../../../libs/js-shared/base-app-frontend/src/lib/feature/app-context.facade.ts","../../../../libs/js-shared/base-app-frontend/src/lib/base-app.providers.ts","../../../../libs/js-shared/base-app-frontend/src/lib/base-app.routes.ts"],"sourcesContent":["import { BaseEntity, WorkingContextDefinition, WorkingContextPersistence } from '@processpuzzle/base-entity';\nimport { THEME_COLOR_SCHEMES, THEME_PRESETS, ThemeColorScheme, ThemePreset, WidgetInstance } from '@processpuzzle/widgets';\nimport type { ModuleDefinition } from './module-definition';\n\nexport { WIDGET_PLACEMENTS, WidgetInstance, WidgetPlacement } from '@processpuzzle/widgets';\n\n/**\n * Frontend model of the `AppDefinition` schema of `base-app-api.yaml`. `theme` and `layout` are\n * flattened onto the entity by {@link AppDefinitionMapper} so that the generated form can offer a\n * typed control per field; the original objects are kept alongside, because a full replacement PUT\n * would otherwise drop the parts no control writes. `regions`, `routes` and `modules` stay nested and\n * are edited through the `EMBEDDED_COMPONENTS` controls of the `App Region` / `App Route` /\n * `App Module Mount` descriptors.\n *\n * A route's `target` is flattened the same way, for the same reason and by the same mapper. The\n * contract already keeps `RouteTarget` flat rather than a `oneOf` because the generic form cannot edit\n * a discriminated union of classes; a nested object it equally cannot reach, since an\n * `EMBEDDED_COMPONENTS` row is edited as the parsed JSON it arrived as and a descriptor addresses one\n * property, not a path. So {@link RouteDefinition} carries `kind` and the per-kind fields directly and\n * {@link AppDefinitionMapper} re-nests them on save.\n *\n * The nested definitions are classes rather than interfaces, because each is an embedded entity of\n * its own: `EmbeddedEntityFacade` mints the blank row an `Add` opens the child's form on, and that\n * needs a constructor. They stay plain data — the rows of a loaded aggregate are the parsed JSON,\n * never instances of these classes, so nothing may rely on `instanceof` or on a method.\n */\n\n/**\n * The theme presets and colour schemes the contract's `MaterialTheme` / `ColorScheme` enums allow. They are\n * the widgets library's lists, because that is where the stylesheet defining them and the `ThemesButton`\n * picking from them live.\n */\nexport const MATERIAL_THEMES = THEME_PRESETS;\nexport type MaterialTheme = ThemePreset;\n\nexport const COLOR_SCHEMES = THEME_COLOR_SCHEMES;\nexport type ColorScheme = ThemeColorScheme;\n\nexport const LAYOUT_PRESETS = ['sidenav-left', 'sidenav-right', 'top-nav'] as const;\nexport type LayoutPreset = (typeof LAYOUT_PRESETS)[number];\n\nexport const SIDENAV_MODES = ['side', 'over', 'push'] as const;\nexport type SidenavMode = (typeof SIDENAV_MODES)[number];\n\n/**\n * `statusbar` carries neither `navItems` nor `widgets`: the shell fills it with the active working contexts.\n *\n * No `content`: once routes own the content area it *is* the router outlet, so a content region would\n * have no field of its own — `widgets` is header/footer-only and `navItems` sidenav-only. Its sizing\n * lives in {@link LayoutDefinition.contentMaxWidth}.\n */\nexport const REGION_TYPES = ['header', 'sidenav', 'footer', 'statusbar'] as const;\nexport type RegionType = (typeof REGION_TYPES)[number];\n\n/**\n * What a route renders. Uppercase because the contract's enum is — `RegionType` and the theme enums\n * are lowercase, and mixing the two up is a silent miss rather than a type error once a value reaches\n * JSON.\n */\nexport const ROUTE_TARGET_KINDS = ['WIDGETS', 'DOCUMENT', 'ENTITY'] as const;\nexport type RouteTargetKind = (typeof ROUTE_TARGET_KINDS)[number];\n\nexport const ENTITY_MODES = ['LIST', 'DETAILS'] as const;\nexport type EntityMode = (typeof ENTITY_MODES)[number];\n\nexport enum AppDefinitionStatus {\n DRAFT = 'DRAFT',\n PUBLISHED = 'PUBLISHED',\n}\n\nexport interface ThemeDefinition {\n materialTheme?: MaterialTheme;\n colorScheme?: ColorScheme;\n /** Overrides for the `--pp-*` custom properties of `base-widget-frontend/src/theme/pp-colors.css`. */\n tokenOverrides?: Record<string, string>;\n logoUrl?: string;\n faviconUrl?: string;\n}\n\nexport interface LayoutDefinition {\n preset?: LayoutPreset;\n sidenavMode?: SidenavMode;\n sidenavCollapsible?: boolean;\n sidenavOpenByDefault?: boolean;\n contentMaxWidth?: string;\n}\n\nexport class NavItem implements BaseEntity {\n id: string;\n label: string;\n translocoId?: string;\n icon?: string;\n /**\n * `RouteDefinition.path` of the route this entry navigates to, resolved by string. Absent on a group\n * node, which expands its {@link children} instead of navigating.\n *\n * A path naming no route is a validation *warning* server-side, not an error: it may name a route of\n * a module that has not been authored yet, and modules stay loosely coupled.\n */\n routePath?: string;\n roles?: string[];\n children?: NavItem[];\n\n constructor(init: Partial<NavItem> = {}) {\n this.id = init.id ?? '';\n this.label = init.label ?? '';\n this.translocoId = init.translocoId;\n this.icon = init.icon;\n this.routePath = init.routePath;\n this.roles = init.roles;\n this.children = init.children;\n }\n}\n\nexport class RegionDefinition implements BaseEntity {\n /**\n * Declared, never assigned. The contract gives a region no `id` — `type` identifies it, see\n * `APP_REGION_ID_FIELD` — but `BaseEntity`'s only property is an optional `id`, and TypeScript's\n * weak-type rule rejects a type that shares no property with it. `declare` emits nothing, so the\n * payload stays exactly the shape the schema describes.\n */\n declare readonly id?: string;\n\n /**\n * Required by the contract, but undefined while a region is being created — the dropdown is declared\n * `required`, so the form is what enforces the contract before the row reaches the payload.\n */\n type: RegionType | undefined;\n /** `sidenav` only; left undefined so a header region's payload carries no empty nav tree. */\n navItems?: NavItem[];\n /** `header` / `footer` only. */\n widgets?: WidgetInstance[];\n\n constructor(init: Partial<RegionDefinition> = {}) {\n this.type = init.type;\n this.navItems = init.navItems;\n this.widgets = init.widgets;\n }\n}\n\n/**\n * The nested `target` object of the DTO. Only {@link AppDefinitionMapper} handles it — the form works\n * on the fields {@link RouteDefinition} carries flattened — so it is an interface rather than a class.\n */\nexport interface RouteTarget {\n kind: RouteTargetKind;\n /** WIDGETS only. */\n widgets?: WidgetInstance[];\n /** DOCUMENT only. */\n documentSlug?: string;\n /** ENTITY only. */\n entityName?: string;\n /** ENTITY only. */\n entityMode?: EntityMode;\n /** ENTITY + LIST only. */\n rsqlFilter?: string;\n /** ENTITY + LIST only: see {@link RouteDefinition.filterByContext}. */\n filterByContext?: string;\n /** ENTITY only, with `requiresContext`: see {@link RouteDefinition.contextPath}. */\n contextPath?: string;\n}\n\n/**\n * One navigable route. **Flat: a route has no children.** `path` may be multi-segment, so `claims`,\n * `claims/open` and `claims/:id` are three sibling entries rather than a tree — Angular's own nesting\n * is derived from those prefixes when the shell builds its `Routes`, because nesting is a rendering\n * concern rather than something worth authoring. Structure is broken up at the module boundary\n * instead, through {@link ModuleMount}.\n *\n * The `target` fields are flattened onto the row and re-nested by {@link AppDefinitionMapper}; which of\n * them are meaningful follows from {@link kind}, and the backend — not the form — is what enforces it.\n */\nexport class RouteDefinition implements BaseEntity {\n /**\n * Declared, never assigned. The contract gives a route no `id`: `path` identifies it, which is what\n * a `NavItem.routePath` resolves against. Same reason as {@link RegionDefinition.id}.\n */\n declare readonly id?: string;\n\n /** Relative to the app root, no leading slash. May contain `/` for depth and `:name` for a parameter. */\n path: string;\n title: string;\n translocoId?: string;\n icon?: string;\n /** Empty or absent means any authenticated member of the organization, as on {@link NavItem.roles}. */\n roles?: string[];\n /**\n * Name of a {@link WorkingContextRow} the route needs. The route is then served below `ctx/<name>/<id>/` and,\n * opened without an active entity, shows a \"Select a …\" empty state with the picker instead of the screen.\n */\n requiresContext?: string;\n // region flattened target — re-nested into `target` by AppDefinitionMapper\n /**\n * Required by the contract, but undefined while a route is being created — the dropdown is declared\n * `required`, so the form is what enforces it before the row reaches the payload.\n */\n kind: RouteTargetKind | undefined;\n /** WIDGETS only. Starts as an empty array so the embedded list has something to append to. */\n widgets: WidgetInstance[];\n documentSlug?: string;\n entityName?: string;\n entityMode?: EntityMode;\n rsqlFilter?: string;\n /**\n * With `requiresContext` on an ENTITY route: the attribute of the context's entity whose embedded collection the\n * route lists, `entityName` being the items' type. Adding, editing and removing an item then acts on the **active**\n * entity of the context — no selection, and no form of the whole entity.\n */\n contextPath?: string;\n /**\n * ENTITY + LIST: the working context the list may be narrowed to. The route does not require the context — an optional\n * view, shown with a toggle \"only the active …\" that filters the list by `<context name> == <active id>` while it is on.\n */\n filterByContext?: string;\n // endregion\n /** The object the flattened fields came from, preserved so a save cannot drop a future field. */\n target?: RouteTarget;\n\n constructor(init: Partial<RouteDefinition> = {}) {\n this.path = init.path ?? '';\n this.title = init.title ?? '';\n this.translocoId = init.translocoId;\n this.icon = init.icon;\n this.roles = init.roles;\n this.requiresContext = init.requiresContext;\n this.kind = init.kind;\n this.widgets = init.widgets ?? [];\n this.documentSlug = init.documentSlug;\n this.entityName = init.entityName;\n this.entityMode = init.entityMode;\n this.rsqlFilter = init.rsqlFilter;\n this.contextPath = init.contextPath;\n this.filterByContext = init.filterByContext;\n this.target = init.target;\n }\n}\n\n/**\n * One working context of the app, as the form edits it: `picker` and `display` flattened onto the row, because a\n * descriptor addresses one property rather than a path, and `confirmSwitchWhen` reduced to the one condition the\n * form offers — the states that make leaving the entity ask first. {@link source} keeps the object the row came\n * from, so a save cannot drop what no control writes.\n *\n * A class rather than an interface for the reason {@link NavItem} is one: the `Add` action mints a blank row.\n */\nexport class WorkingContextRow implements BaseEntity {\n /** The contract gives a context no `id`: `name` identifies it, as `moduleKey` does a mount. */\n declare readonly id?: string;\n\n name: string;\n entityName: string;\n parent?: string;\n basePath?: string;\n persist?: WorkingContextPersistence;\n // region flattened picker / display / confirmSwitchWhen — re-nested by the mapper\n pickerSearchFields?: string[];\n pickerRecent?: number;\n displayLabel?: string;\n displayBadge?: string;\n displayExtra?: string;\n confirmSwitchStates?: string[];\n // endregion\n source?: WorkingContextDefinition;\n\n constructor(init: Partial<WorkingContextRow> = {}) {\n this.name = init.name ?? '';\n this.entityName = init.entityName ?? '';\n this.parent = init.parent;\n this.basePath = init.basePath;\n this.persist = init.persist;\n this.pickerSearchFields = init.pickerSearchFields;\n this.pickerRecent = init.pickerRecent;\n this.displayLabel = init.displayLabel;\n this.displayBadge = init.displayBadge;\n this.displayExtra = init.displayExtra;\n this.confirmSwitchStates = init.confirmSwitchStates;\n this.source = init.source;\n }\n}\n\n/**\n * Mounts a module's routes under {@link basePath}. The one place route structure composes, and it\n * composes exactly one level deep: a module cannot mount modules.\n */\nexport class ModuleMount implements BaseEntity {\n /** `moduleKey` identifies the mount; the contract gives it no `id`. */\n declare readonly id?: string;\n\n /**\n * Key of a `ModuleDefinition` in this organization. One naming no existing module is a validation\n * warning, not an error — an app may mount a module before it has been authored.\n */\n moduleKey: string;\n basePath: string;\n\n constructor(init: Partial<ModuleMount> = {}) {\n this.moduleKey = init.moduleKey ?? '';\n this.basePath = init.basePath ?? '';\n }\n}\n\nexport class AppDefinition implements BaseEntity {\n /** Unique within the organization and used verbatim as the run-time route segment. */\n id: string;\n name: string;\n translocoId: string | undefined;\n description: string | undefined;\n // region flattened theme\n materialTheme: MaterialTheme | undefined;\n colorScheme: ColorScheme | undefined;\n tokenOverrides: Record<string, string> | undefined;\n logoUrl: string | undefined;\n faviconUrl: string | undefined;\n // endregion\n // region flattened layout\n preset: LayoutPreset | undefined;\n sidenavMode: SidenavMode | undefined;\n sidenavCollapsible: boolean;\n sidenavOpenByDefault: boolean;\n contentMaxWidth: string | undefined;\n // endregion\n /** The objects the flattened fields came from, preserved so a save cannot drop a future field. */\n theme: ThemeDefinition | undefined;\n layout: LayoutDefinition | undefined;\n regions: RegionDefinition[] | undefined;\n routes: RouteDefinition[] | undefined;\n modules: ModuleMount[] | undefined;\n /** Working contexts routes may require, with `picker` / `display` flattened for the form. */\n contexts: WorkingContextRow[] | undefined;\n /**\n * The mounted modules themselves, as the `/layout` read carries them: the released rows with the published\n * revision, the drafts with the draft. Read-only, never saved, and `undefined` on the designer's own read —\n * which is how the route builder tells a layout that brought its modules from a definition that did not.\n */\n mountedModules: ModuleDefinition[] | undefined;\n // region server-assigned\n orgKey: string | undefined;\n status: AppDefinitionStatus | undefined;\n version: number | undefined;\n publishedVersion: number | undefined;\n createdAt: string | undefined;\n updatedAt: string | undefined;\n // endregion\n\n constructor(init: Partial<AppDefinition> = {}) {\n this.id = init.id ?? '';\n this.name = init.name ?? '';\n this.translocoId = init.translocoId;\n this.description = init.description;\n this.materialTheme = init.materialTheme;\n this.colorScheme = init.colorScheme;\n this.tokenOverrides = init.tokenOverrides;\n this.logoUrl = init.logoUrl;\n this.faviconUrl = init.faviconUrl;\n this.preset = init.preset;\n this.sidenavMode = init.sidenavMode;\n this.sidenavCollapsible = init.sidenavCollapsible ?? true;\n this.sidenavOpenByDefault = init.sidenavOpenByDefault ?? true;\n this.contentMaxWidth = init.contentMaxWidth;\n this.theme = init.theme;\n this.layout = init.layout;\n this.regions = init.regions;\n this.routes = init.routes;\n this.modules = init.modules;\n this.contexts = init.contexts;\n this.mountedModules = init.mountedModules;\n this.orgKey = init.orgKey;\n this.status = init.status;\n this.version = init.version;\n this.publishedVersion = init.publishedVersion;\n this.createdAt = init.createdAt;\n this.updatedAt = init.updatedAt;\n }\n}\n","import { BaseEntity } from '@processpuzzle/base-entity';\nimport { RouteDefinition } from './app-definition';\n\n/**\n * Frontend model of the `ModuleDefinition` schema of `base-app-api.yaml`: a lazily-loadable slice of an\n * application, with its own flat route list and its own transloco scope. An {@link ModuleMount} of an\n * `AppDefinition` names one of these by key and mounts its routes under a base path.\n *\n * **What \"lazy\" honestly means.** A module lazy-loads *metadata* — this definition, its routes, its\n * translations, and the documents and descriptors they name. It does **not** lazy-load widget code:\n * widget components are bundled at compile time and resolved through the frontend registry, so a\n * metadata module cannot split a bundle on its own. The wins are that `AppDefinition` stops being one\n * aggregate that has to be loaded, locked and published atomically, and that a module is the unit of\n * authoring permission and versioning. Nothing here should be justified on bundle size.\n *\n * Unlike the region / route / mount classes this one is a **routable** entity: it has endpoints of its\n * own, so it comes with a service, a store and a facade rather than travelling inside another payload.\n */\nexport class ModuleDefinition implements BaseEntity {\n /**\n * The contract calls this field `key`; base-entity keys every store, URL and reference on `id`, so\n * {@link ModuleDefinitionMapper} renames it on the way in and out rather than teaching the framework a\n * second identity field. One name for one thing on this side of the mapper — a `key` property beside\n * `id` could only ever disagree with it.\n *\n * Immutable by contract: `ModuleMount.moduleKey` resolves against it, and a rename would silently\n * unmount the module from every app that mounts it.\n */\n id: string;\n name: string;\n translocoId: string | undefined;\n description: string | undefined;\n /**\n * Transloco scope the module's translations load under. Absent means {@link id}, which is the default\n * the contract states; {@link moduleTranslocoScope} is the one place that default is applied.\n */\n translocoScope: string | undefined;\n /**\n * The module's routes, flat and relative to the base path it is mounted at — the same shape and the\n * same derived nesting as `AppDefinition.routes`, and flattened by the same mapper. A module does not\n * mount modules: this is where composition stops.\n */\n routes: RouteDefinition[] | undefined;\n // region server-assigned\n orgKey: string | undefined;\n version: number | undefined;\n createdAt: string | undefined;\n updatedAt: string | undefined;\n // endregion\n\n constructor(init: Partial<ModuleDefinition> = {}) {\n this.id = init.id ?? '';\n this.name = init.name ?? '';\n this.translocoId = init.translocoId;\n this.description = init.description;\n this.translocoScope = init.translocoScope;\n this.routes = init.routes;\n this.orgKey = init.orgKey;\n this.version = init.version;\n this.createdAt = init.createdAt;\n this.updatedAt = init.updatedAt;\n }\n}\n\n/**\n * The scope a module's translations load under, applying the contract's default: the module key with its dashes\n * written as underscores (`conduct-race` is `conduct_race`), because transloco keys use underscores and the scope is\n * the first segment of every key a widget names for the module. The backend derives the same default\n * (`ModuleDefinition.getTranslocoScope`). Kept as a function\n * rather than resolved in the mapper, so a definition never carries a `translocoScope` the designer did\n * not author — the field stays empty in the form, and the fallback is a rendering decision.\n */\nexport function moduleTranslocoScope(definition: ModuleDefinition): string {\n return definition.translocoScope?.trim() || definition.id.replaceAll('-', '_');\n}\n\n/**\n * The transloco key a module's route title is translated under: the authored `translocoId`, else one derived\n * from the scope and the path — `<scope>.route.<path>`. A designer therefore never has to type a key for a\n * module to be translatable; the backend derives the same key when it prepares the translation files\n * (`ModuleTranslationKeys`), and the two have to agree.\n */\nexport function moduleRouteTranslocoId(scope: string, route: RouteDefinition): string {\n return route.translocoId?.trim() || `${scope}.route.${route.path}`;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { RUNTIME_CONFIGURATION, serviceRootOf } from '@processpuzzle/util';\nimport { ModuleTranslationBundle, ModuleTranslationCoverage, ModuleTranslationUploadReport } from './module-translation';\n\n/**\n * REST access to the prepared translation files of a module, under `/organizations/{orgKey}/modules/{key}`.\n * A service of its own rather than more methods on `ModuleDefinitionService`: those would inherit the JSON\n * `Content-Type` header of the generic CRUD client, which is wrong for a multipart upload and a zip download.\n */\n@Injectable({ providedIn: 'root' })\nexport class ModuleTranslationService {\n private readonly http = inject(HttpClient);\n private readonly runtimeConfiguration = inject(RUNTIME_CONFIGURATION);\n\n /** The draft's coverage of every supported language. */\n coverage(moduleKey: string): Observable<ModuleTranslationCoverage[]> {\n return this.http.get<ModuleTranslationCoverage[]>(`${this.moduleUrl(moduleKey)}/translation-coverage`);\n }\n\n /** The zip of one prepared `<language>.json` per supported language. */\n download(moduleKey: string): Observable<Blob> {\n return this.http.get(`${this.moduleUrl(moduleKey)}/translations`, { responseType: 'blob' });\n }\n\n /** Stores the translated files — the zip, or one `<language>.json` — onto the draft. */\n upload(moduleKey: string, file: File): Observable<ModuleTranslationUploadReport> {\n const body = new FormData();\n body.append('file', file, file.name);\n return this.http.put<ModuleTranslationUploadReport>(`${this.moduleUrl(moduleKey)}/translations`, body);\n }\n\n /**\n * What the module's transloco scope loads for one language: the stored translations only, keys relative\n * to the scope. `released` is the running application's read, `draft` the designer's.\n */\n bundle(moduleKey: string, locale: string, revision: 'draft' | 'released'): Observable<ModuleTranslationBundle> {\n return this.http.get<ModuleTranslationBundle>(`${this.moduleUrl(moduleKey)}/translations/${encodeURIComponent(locale)}`, { params: { revision } });\n }\n\n private moduleUrl(moduleKey: string): string {\n return `${serviceRootOf(this.runtimeConfiguration, 'APP_SERVICE_ROOT')}/modules/${encodeURIComponent(moduleKey)}`;\n }\n}\n","import type { TranslationSource } from '@processpuzzle/util';\n/**\n * Transloco scope of this library. The translations live in\n * `libs/js-shared/base-app-frontend/src/assets/i18n/base_app/*.json` and are published with the\n * package; a consuming application copies them to `assets/i18n/base_app` (see the testbed's\n * `project.json`). The scope is registered on {@link BASE_APP_ROUTES}, so it loads lazily with the\n * route rather than with the application shell.\n *\n * The alias is spelled out on purpose: transloco camel-cases the default alias, which would turn\n * `base_app` into `baseApp` and silently miss every key below.\n */\nexport const BASE_APP_TRANSLOCO_SCOPE = 'base_app';\n\n/**\n * Scope of the generic framework labels (`base_entity.tabs.*`, `base_entity.toolbar.*`), whose files\n * base-entity owns. It has to be registered next to {@link BASE_APP_TRANSLOCO_SCOPE} wherever the\n * generic screens are hosted: `BaseEntityTabsComponent` translates from it through `TranslocoPipe`,\n * which caches the value it resolved for a key on first render. If only `base_app` were loaded, the\n * tabs would keep the raw key even after the toolbar — which registers this scope for itself —\n * triggers the load.\n */\nexport const BASE_ENTITY_TRANSLOCO_SCOPE = 'base_entity';\n\n/** Key root of the `AppDefinition` entity name (`._self`) and of its attribute labels. */\nexport const APP_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_definition`;\n\n/**\n * Label of the Preview tab. Under this library's own scope rather than `base_entity.tabs.*`: the generic\n * tabs are List and Details, and an application preview is this feature's contribution, not the framework's.\n * Resolved with `{ entity }` like the generic tab labels, so a translation may name the entity if it reads\n * better that way.\n */\nexport const APP_PREVIEW_I18N_KEY = `${APP_DEFINITION_I18N_SCOPE}.tabs.preview`;\n\n/**\n * Key root of the `ModuleDefinition` entity name and attribute labels. A child of this library's scope\n * like the one above, and not to be confused with `ModuleDefinition.translocoScope`, which is a scope an\n * *authored* module's own translations load under — see {@link moduleTranslocoScope}. These keys are the\n * framework's labels for the authoring form; that one is the tenant's content.\n */\nexport const MODULE_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.module_definition`;\n\n/**\n * Key roots of the nested definitions the `AppDefinition` form contains through `EMBEDDED_COMPONENTS`\n * controls. They are children of {@link BASE_APP_TRANSLOCO_SCOPE} rather than scopes of their own,\n * because the whole graph is edited under `BASE_APP_ROUTES` and one scope registration has to cover\n * all of it — the embedded route branches add none.\n */\nexport const APP_REGION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_region`;\nexport const APP_ROUTE_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_route`;\nexport const APP_CONTEXT_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_context`;\nexport const APP_MODULE_MOUNT_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_module_mount`;\nexport const APP_NAV_ITEM_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_nav_item`;\nexport const APP_WIDGET_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_widget`;\n\n/** Key root of the dynamic-application guide shown under the App Definition list. */\nexport const APP_CONCEPTS_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.concepts`;\n\n/**\n * Where this library's transloco bundles come from when the application ships without its assets.\n *\n * Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into\n * `BASE_ENTITY_FACADE_REGISTRY`. The scopes below normally arrive as static files — the build copies\n * them into `assets/i18n/<scope>` and the loader tries the asset first — so this is reached only by a\n * host that skips that copy step. It is declared here rather than in the application because which\n * backend owns a scope is base-app's knowledge, not its caller's.\n */\nexport const BASE_APP_TRANSLATION_SOURCE: TranslationSource = {\n scopes: ['base_app'],\n serviceRootKey: 'APP_SERVICE_ROOT',\n segment: 'app',\n};\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { RUNTIME_CONFIGURATION, serviceRootOf } from '@processpuzzle/util';\nimport { Observable } from 'rxjs';\nimport { AppAsset } from './app-asset';\n\n/**\n * REST access to the assets of an application, under `/organizations/{orgKey}/app-definitions/{appId}/assets`. A\n * service of its own, for the reason {@link ModuleAssetService} is: the generic CRUD client sends a JSON\n * `Content-Type`, which is wrong for a multipart upload and for a file download.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppAssetService {\n private readonly http = inject(HttpClient);\n private readonly runtimeConfiguration = inject(RUNTIME_CONFIGURATION);\n\n list(appId: string, revision: 'draft' | 'released' = 'draft'): Observable<AppAsset[]> {\n return this.http.get<AppAsset[]>(this.assetsUrl(appId), { params: { revision } });\n }\n\n /** Adds the file to the application draft under `path`, replacing the asset already there; its own name when `path` is empty. */\n upload(appId: string, file: File, path?: string): Observable<AppAsset> {\n const body = new FormData();\n body.append('file', file, file.name);\n if (path) body.append('path', path);\n return this.http.post<AppAsset>(this.assetsUrl(appId), body);\n }\n\n remove(appId: string, path: string): Observable<void> {\n return this.http.delete<void>(this.assetsUrl(appId), { params: { path } });\n }\n\n /** The bytes of one asset. Through `HttpClient`, so that the bearer token goes with it. */\n content(appId: string, path: string, revision: 'draft' | 'released'): Observable<Blob> {\n return this.http.get(`${this.assetsUrl(appId)}/content`, { params: { path, revision }, responseType: 'blob' });\n }\n\n private assetsUrl(appId: string): string {\n return `${serviceRootOf(this.runtimeConfiguration, 'APP_SERVICE_ROOT')}/app-definitions/${encodeURIComponent(appId)}/assets`;\n }\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { Component, DestroyRef, inject, OnInit, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { BaseEntity, BaseFormControlComponent } from '@processpuzzle/base-entity';\nimport { Observable } from 'rxjs';\n\n/** One file an owner brings along, as the list endpoint reports it. */\nexport interface OwnedAsset {\n readonly path: string;\n readonly mimeType: string;\n readonly size: number;\n readonly sha256: string;\n}\n\n/** What the Assets section needs of the service behind it: a module's or an application's. */\nexport interface OwnedAssetService {\n list(ownerKey: string): Observable<OwnedAsset[]>;\n upload(ownerKey: string, file: File, path?: string): Observable<OwnedAsset>;\n remove(ownerKey: string, path: string): Observable<void>;\n}\n\n/** The markup the module and the application form share; the two differ in words, scheme and test ids only. */\nexport const ASSETS_CONTROL_TEMPLATE = `\n <div class=\"base-entity-form-field pp-assets\">\n <span class=\"pp-assets__label\">{{ config().i18nKey() | ppLabel: config().label }}</span>\n @if (ownerKey(); as key) {\n <p class=\"pp-assets__hint\">{{ scope + '.hint' | transloco }}</p>\n @if (assets().length) {\n <table class=\"pp-assets__list\" [attr.data-testid]=\"testIdPrefix + '-assets-list'\">\n <thead>\n <tr>\n <th>{{ scope + '.path' | transloco }}</th>\n <th>{{ scope + '.type' | transloco }}</th>\n <th>{{ scope + '.size' | transloco }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (asset of assets(); track asset.path) {\n <tr [attr.data-testid]=\"testIdPrefix + '-asset-' + asset.path\">\n <td>\n <code>{{ scheme }}:{{ asset.path }}</code>\n </td>\n <td>{{ asset.mimeType }}</td>\n <td>{{ sizeOf(asset) }}</td>\n <td>\n <button mat-button type=\"button\" [attr.data-testid]=\"testIdPrefix + '-asset-remove-' + asset.path\" (click)=\"remove(key, asset)\">{{ scope + '.remove' | transloco }}</button>\n </td>\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <p class=\"pp-assets__hint\" [attr.data-testid]=\"testIdPrefix + '-assets-none'\">{{ scope + '.none' | transloco }}</p>\n }\n <div class=\"pp-assets__actions\">\n <label class=\"pp-assets__folder\">\n <span>{{ scope + '.folder' | transloco }}</span>\n <input #folder type=\"text\" placeholder=\"docs/img\" [attr.data-testid]=\"testIdPrefix + '-assets-folder'\" />\n </label>\n <button mat-stroked-button type=\"button\" [attr.data-testid]=\"testIdPrefix + '-assets-upload'\" (click)=\"fileInput.click()\">{{ scope + '.upload' | transloco }}</button>\n <input #fileInput type=\"file\" multiple hidden [attr.data-testid]=\"testIdPrefix + '-assets-file'\" (change)=\"upload(key, fileInput, folder.value)\" />\n </div>\n @if (error(); as message) {\n <p class=\"pp-assets__error\" [attr.data-testid]=\"testIdPrefix + '-assets-error'\">{{ message }}</p>\n }\n } @else {\n <p class=\"pp-assets__hint\" [attr.data-testid]=\"testIdPrefix + '-assets-save-first'\">{{ scope + '.save_first' | transloco }}</p>\n }\n </div>\n `;\n\nexport const ASSETS_CONTROL_STYLES = `\n .pp-assets {\n border: 1px solid var(--mat-sys-outline-variant);\n border-radius: 4px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 8px 12px;\n }\n .pp-assets__label {\n font: var(--mat-sys-label-large);\n }\n .pp-assets__hint {\n margin: 0;\n opacity: 0.7;\n font-size: 12px;\n }\n .pp-assets__list {\n border-collapse: collapse;\n text-align: left;\n }\n .pp-assets__list th,\n .pp-assets__list td {\n padding: 2px 16px 2px 0;\n }\n .pp-assets__actions {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n .pp-assets__folder {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n .pp-assets__error {\n margin: 0;\n color: var(--mat-sys-error);\n }\n `;\n\n/**\n * The logic of an Assets section: the files an owner — a module or an application — brings along, listed with\n * their path, type and size, and added one by one, never as an archive. A widget names one as `<scheme>:<path>`.\n *\n * Offered once the owner is saved, since an asset belongs to the stored draft. Each upload goes to the folder the\n * user typed (empty: the owner's root), under the file's own name.\n */\n// A component rather than a directive, because it extends one; the subclasses bring the markup.\n@Component({ template: '' })\nexport abstract class AssetsControlBase<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {\n /** Key root of the section's own words. */\n protected abstract readonly scope: string;\n /** What a widget writes before the path: `module` or `app`. */\n protected abstract readonly scheme: string;\n /** Prefix of the section's test ids. */\n protected abstract readonly testIdPrefix: string;\n protected abstract readonly service: OwnedAssetService;\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly savedKey = signal<string | undefined>(undefined);\n\n /** The key of the stored owner, once there is one. */\n protected readonly ownerKey = this.savedKey.asReadonly();\n protected readonly assets = signal<OwnedAsset[]>([]);\n protected readonly error = signal<string | undefined>(undefined);\n\n ngOnInit(): void {\n const id = this.formGroup?.get('id');\n const version = this.formGroup?.get('version');\n const refresh = () => this.updateKey(id?.value, version?.value);\n refresh();\n id?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(refresh);\n version?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(refresh);\n }\n\n protected sizeOf(asset: OwnedAsset): string {\n return asset.size < 1024 ? `${asset.size} B` : `${(asset.size / 1024).toFixed(1)} kB`;\n }\n\n /** Uploads each chosen file, one request apiece, into the folder typed beside the button. */\n protected upload(ownerKey: string, input: HTMLInputElement, folder: string): void {\n const files = Array.from(input.files ?? []);\n if (!files.length) return;\n this.error.set(undefined);\n const prefix = trimSlashes(folder.trim());\n let pending = files.length;\n for (const file of files) {\n this.service.upload(ownerKey, file, prefix ? `${prefix}/${file.name}` : undefined).subscribe({\n next: () => undefined,\n error: (failure: unknown) => {\n this.error.set(this.messageOf(failure));\n if (--pending === 0) this.reload(ownerKey);\n },\n complete: () => {\n if (--pending === 0) this.reload(ownerKey);\n },\n });\n }\n // Cleared so that choosing the same file again — after fixing it — still fires `change`.\n input.value = '';\n }\n\n protected remove(ownerKey: string, asset: OwnedAsset): void {\n this.error.set(undefined);\n this.service.remove(ownerKey, asset.path).subscribe({\n next: () => this.reload(ownerKey),\n error: (failure: unknown) => this.error.set(this.messageOf(failure)),\n });\n }\n\n /** Only a saved owner has a draft to hold assets; a key typed into a new form is not one. */\n private updateKey(id: unknown, version: unknown): void {\n const key = typeof id === 'string' && id !== '' && version ? id : undefined;\n if (key === this.savedKey()) return;\n this.savedKey.set(key);\n this.assets.set([]);\n if (key) this.reload(key);\n }\n\n private reload(ownerKey: string): void {\n this.service.list(ownerKey).subscribe({\n next: (assets) => this.assets.set(assets),\n error: () => this.assets.set([]),\n });\n }\n\n private messageOf(failure: unknown): string {\n if (failure instanceof HttpErrorResponse) {\n const detail = (failure.error as { errorText?: string } | null)?.errorText;\n return detail ?? failure.message;\n }\n return String(failure);\n }\n}\n\n/** Without the slashes at either end, which a typed folder may carry and an asset path may not. */\nfunction trimSlashes(value: string): string {\n let start = 0;\n let end = value.length;\n while (start < end && value[start] === '/') start++;\n while (end > start && value[end - 1] === '/') end--;\n return value.slice(start, end);\n}\n","import { Component, inject } from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { TranslocoPipe } from '@jsverse/transloco';\nimport { BaseEntity, BaseEntityAttrDescriptor, EntityLabelPipe, FormControlType } from '@processpuzzle/base-entity';\nimport { APP_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { AppAssetService } from './app-asset.service';\nimport { ASSETS_CONTROL_STYLES, ASSETS_CONTROL_TEMPLATE, AssetsControlBase } from './assets-control.base';\n\n/** Key root of the control's own words. */\nexport const APP_ASSETS_I18N_SCOPE = `${APP_DEFINITION_I18N_SCOPE}.assets_panel`;\n\n/**\n * The application form's Assets section. Like the module form's it is not a form field — nothing here is saved\n * with the application — so it is disabled and the form never submits it.\n */\nexport class AppAssetsAttrDescriptor extends BaseEntityAttrDescriptor {\n constructor() {\n super('assets', FormControlType.CUSTOM, 'Assets');\n this.component = AppAssetsControlComponent;\n this.disabled = true;\n this.hideInTable = true;\n }\n}\n\n/** The files an application brings along — the pictures of its own pages, say; a widget names one as `app:<path>`. */\n@Component({\n selector: 'pp-app-assets-control',\n standalone: true,\n imports: [EntityLabelPipe, MatButton, TranslocoPipe],\n template: ASSETS_CONTROL_TEMPLATE,\n styles: [ASSETS_CONTROL_STYLES],\n})\nexport class AppAssetsControlComponent<Entity extends BaseEntity> extends AssetsControlBase<Entity> {\n protected readonly scope = APP_ASSETS_I18N_SCOPE;\n protected readonly scheme = 'app';\n protected readonly testIdPrefix = 'app';\n protected readonly service = inject(AppAssetService);\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { RUNTIME_CONFIGURATION, serviceRootOf } from '@processpuzzle/util';\nimport { AppTranslationBundle, AppTranslationUploadReport } from './app-translation';\n\n/**\n * REST access to the translation files of an application, under `/organizations/{orgKey}/app-definitions/{appId}`.\n * A service of its own, for the reason {@link ModuleTranslationService} is: the generic CRUD client sends a JSON\n * `Content-Type`, which is wrong for a multipart upload and a zip download.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppTranslationService {\n private readonly http = inject(HttpClient);\n private readonly runtimeConfiguration = inject(RUNTIME_CONFIGURATION);\n\n /** The zip of one `<language>.json` per supported language, holding what the draft has stored. */\n download(appId: string): Observable<Blob> {\n return this.http.get(`${this.translationsUrl(appId)}`, { responseType: 'blob' });\n }\n\n /** Stores the translated files — the zip, or one `<language>.json` — onto the draft, replacing each language they name. */\n upload(appId: string, file: File): Observable<AppTranslationUploadReport> {\n const body = new FormData();\n body.append('file', file, file.name);\n return this.http.put<AppTranslationUploadReport>(this.translationsUrl(appId), body);\n }\n\n /** Removes the draft bundle of one language. */\n remove(appId: string, locale: string): Observable<void> {\n return this.http.delete<void>(`${this.translationsUrl(appId)}/${encodeURIComponent(locale)}`);\n }\n\n /**\n * The stored texts of one language, flat. `released` is the running application's read, `draft` the designer's.\n */\n bundle(appId: string, locale: string, revision: 'draft' | 'released'): Observable<AppTranslationBundle> {\n return this.http.get<AppTranslationBundle>(`${this.translationsUrl(appId)}/${encodeURIComponent(locale)}`, { params: { revision } });\n }\n\n private translationsUrl(appId: string): string {\n return `${serviceRootOf(this.runtimeConfiguration, 'APP_SERVICE_ROOT')}/app-definitions/${encodeURIComponent(appId)}/translations`;\n }\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { Component, computed, DestroyRef, inject, OnInit, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatButton } from '@angular/material/button';\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { catchError, forkJoin, map, Observable, of, Subscription } from 'rxjs';\nimport { BaseEntity, BaseEntityAttrDescriptor, BaseFormControlComponent, EntityLabelPipe, FormControlType } from '@processpuzzle/base-entity';\nimport { APP_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { AppTranslationUploadReport } from './app-translation';\nimport { AppTranslationService } from './app-translation.service';\n\n/** Key root of the control's own words. */\nexport const APP_TRANSLATIONS_I18N_SCOPE = `${APP_DEFINITION_I18N_SCOPE}.translations_panel`;\n\n/** One language the draft holds texts for, its keys sorted so the list reads the same every time. */\ninterface StoredLanguage {\n readonly locale: string;\n readonly texts: Record<string, string>;\n readonly keys: string[];\n}\n\n/**\n * The application form's Translations section. Not a form field — nothing here is saved with the application — so\n * it is disabled, like the module form's, and the form never submits it.\n */\nexport class AppTranslationsAttrDescriptor extends BaseEntityAttrDescriptor {\n constructor() {\n super('translations', FormControlType.CUSTOM, 'Translations');\n this.component = AppTranslationsControlComponent;\n this.disabled = true;\n this.hideInTable = true;\n }\n}\n\n/**\n * Where the user fetches and returns the texts of the application's own pages. *Download* gives one file per\n * supported language holding what is stored (an empty one for a language nothing is stored for), the user fills them\n * in off-line, and *Upload* takes them back. Unlike a module's, the keys are not derived from the definition: they are\n * whatever the application's widgets name under their `translocoPrefix`, so the section shows what is stored: each\n * language that holds texts, with its count, and — on a click — its keys and texts, read-only.\n *\n * There is no endpoint listing the stored languages, and none is needed: the draft bundle of a language answers an\n * empty object when nothing is stored, so each language the application offers is read and the empty ones are left\n * out. A failed read counts as empty — the list is a view, and Download still gives the authoritative files.\n *\n * Offered once the application is saved, since the texts belong to the stored draft.\n */\n@Component({\n selector: 'pp-app-translations-control',\n standalone: true,\n imports: [EntityLabelPipe, MatButton, TranslocoPipe],\n template: `\n <div class=\"base-entity-form-field pp-app-translations\">\n <span class=\"pp-app-translations__label\">{{ config().i18nKey() | ppLabel: config().label }}</span>\n @if (appId(); as id) {\n <p class=\"pp-app-translations__hint\">{{ scope + '.hint' | transloco }}</p>\n @if (stored(); as languages) {\n @if (languages.length) {\n <div class=\"pp-app-translations__languages\" data-testid=\"app-translations-languages\">\n @for (language of languages; track language.locale) {\n <button\n mat-button\n type=\"button\"\n [class.pp-app-translations__language--selected]=\"selected() === language.locale\"\n [attr.aria-pressed]=\"selected() === language.locale\"\n [attr.data-testid]=\"'app-translations-language-' + language.locale\"\n (click)=\"toggle(language.locale)\">\n {{ language.locale }} · {{ scope + '.stored' | transloco: { count: language.keys.length } }}\n </button>\n }\n </div>\n @if (selectedLanguage(); as language) {\n <table class=\"pp-app-translations__texts\" data-testid=\"app-translations-texts\">\n <thead>\n <tr>\n <th>{{ scope + '.key' | transloco }}</th>\n <th>{{ scope + '.text' | transloco }}</th>\n </tr>\n </thead>\n <tbody>\n @for (key of language.keys; track key) {\n <tr>\n <td class=\"pp-app-translations__key\">{{ key }}</td>\n <td>{{ language.texts[key] }}</td>\n </tr>\n }\n </tbody>\n </table>\n }\n } @else {\n <p class=\"pp-app-translations__hint\" data-testid=\"app-translations-none\">{{ scope + '.none_stored' | transloco }}</p>\n }\n }\n <div class=\"pp-app-translations__actions\">\n <button mat-stroked-button type=\"button\" data-testid=\"app-translations-download\" (click)=\"download(id)\">{{ scope + '.download' | transloco }}</button>\n <button mat-stroked-button type=\"button\" data-testid=\"app-translations-upload\" (click)=\"fileInput.click()\">{{ scope + '.upload' | transloco }}</button>\n <input #fileInput type=\"file\" accept=\".zip,.json\" hidden data-testid=\"app-translations-file\" (change)=\"upload(id, fileInput)\" />\n </div>\n @if (report(); as uploaded) {\n <ul class=\"pp-app-translations__report\" data-testid=\"app-translations-report\">\n @for (language of uploaded.languages; track language.locale) {\n <li>\n <strong>{{ language.locale }}</strong\n >: {{ scope + '.stored' | transloco: { count: language.storedKeys } }}\n </li>\n }\n </ul>\n }\n @if (error(); as message) {\n <p class=\"pp-app-translations__error\" data-testid=\"app-translations-error\">{{ message }}</p>\n }\n } @else {\n <p class=\"pp-app-translations__hint\" data-testid=\"app-translations-save-first\">{{ scope + '.save_first' | transloco }}</p>\n }\n </div>\n `,\n styles: [\n `\n .pp-app-translations {\n border: 1px solid var(--mat-sys-outline-variant);\n border-radius: 4px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 8px 12px;\n }\n .pp-app-translations__label {\n font: var(--mat-sys-label-large);\n }\n .pp-app-translations__hint {\n margin: 0;\n opacity: 0.7;\n font-size: 12px;\n }\n .pp-app-translations__actions {\n display: flex;\n gap: 8px;\n }\n .pp-app-translations__languages {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n }\n .pp-app-translations__language--selected {\n background: var(--mat-sys-secondary-container);\n }\n .pp-app-translations__texts {\n border-collapse: collapse;\n display: block;\n font-size: 12px;\n max-height: 320px;\n overflow: auto;\n }\n .pp-app-translations__texts th,\n .pp-app-translations__texts td {\n border-bottom: 1px solid var(--mat-sys-outline-variant);\n padding: 2px 8px;\n text-align: left;\n vertical-align: top;\n }\n .pp-app-translations__key {\n font-family: monospace;\n white-space: nowrap;\n }\n .pp-app-translations__report {\n margin: 0;\n padding-left: 16px;\n }\n .pp-app-translations__error {\n margin: 0;\n color: var(--mat-sys-error);\n }\n `,\n ],\n})\nexport class AppTranslationsControlComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {\n protected readonly scope = APP_TRANSLATIONS_I18N_SCOPE;\n private readonly translations = inject(AppTranslationService);\n private readonly transloco = inject(TranslocoService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly savedId = signal<string | undefined>(undefined);\n private reading?: Subscription;\n\n /** The id of the stored application, once there is one. */\n protected readonly appId = this.savedId.asReadonly();\n protected readonly report = signal<AppTranslationUploadReport | undefined>(undefined);\n protected readonly error = signal<string | undefined>(undefined);\n /** The languages holding texts; `undefined` until the first read answers. */\n protected readonly stored = signal<StoredLanguage[] | undefined>(undefined);\n protected readonly selected = signal<string | undefined>(undefined);\n protected readonly selectedLanguage = computed(() => this.stored()?.find((language) => language.locale === this.selected()));\n\n ngOnInit(): void {\n const id = this.formGroup?.get('id');\n const version = this.formGroup?.get('version');\n const refresh = () => this.updateId(id?.value, version?.value);\n refresh();\n id?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(refresh);\n version?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(refresh);\n }\n\n protected download(appId: string): void {\n this.error.set(undefined);\n this.translations.download(appId).subscribe({\n next: (zip) => this.save(zip, `${appId}-translations.zip`),\n error: (failure: unknown) => this.error.set(this.messageOf(failure)),\n });\n }\n\n protected upload(appId: string, input: HTMLInputElement): void {\n const file = input.files?.item(0);\n if (!file) return;\n this.error.set(undefined);\n this.translations.upload(appId, file).subscribe({\n next: (report) => {\n this.report.set(report);\n this.readStored(appId);\n },\n error: (failure: unknown) => this.error.set(this.messageOf(failure)),\n });\n // Cleared so that choosing the same file again — after fixing it — still fires `change`.\n input.value = '';\n }\n\n /** Only a saved application has a draft to hold the texts; an id typed into a new form is not one. */\n private updateId(id: unknown, version: unknown): void {\n const key = typeof id === 'string' && id !== '' && version ? id : undefined;\n if (key === this.savedId()) return;\n this.savedId.set(key);\n this.report.set(undefined);\n this.stored.set(undefined);\n this.selected.set(undefined);\n if (key) this.readStored(key);\n }\n\n /** Shows a language's texts, or hides them when it is the one already shown. */\n protected toggle(locale: string): void {\n this.selected.update((current) => (current === locale ? undefined : locale));\n }\n\n /** Reads the draft bundle of every offered language; a newer read replaces one still under way. */\n private readStored(appId: string): void {\n this.reading?.unsubscribe();\n const reads = this.languages().map((locale) => this.readLanguage(appId, locale));\n this.reading = forkJoin(reads)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((languages) => {\n const stored = languages.filter((language): language is StoredLanguage => !!language);\n this.stored.set(stored);\n if (!stored.some((language) => language.locale === this.selected())) this.selected.set(undefined);\n });\n }\n\n private readLanguage(appId: string, locale: string): Observable<StoredLanguage | undefined> {\n return this.translations.bundle(appId, locale, 'draft').pipe(\n map((texts) => {\n const keys = Object.keys(texts ?? {}).sort((left, right) => left.localeCompare(right));\n return keys.length ? { locale, texts, keys } : undefined;\n }),\n catchError(() => of(undefined)),\n );\n }\n\n /** The languages the application is offered in, the fallback one included, in the configured order. */\n private languages(): string[] {\n const available = this.transloco.getAvailableLangs().map((lang) => (typeof lang === 'string' ? lang : lang.id));\n return [...new Set([...available, 'en'])];\n }\n\n private save(zip: Blob, fileName: string): void {\n const url = URL.createObjectURL(zip);\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.click();\n URL.revokeObjectURL(url);\n }\n\n private messageOf(failure: unknown): string {\n if (failure instanceof HttpErrorResponse) {\n const detail = (failure.error as { errorText?: string } | null)?.errorText;\n return detail ?? failure.message;\n }\n return String(failure);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { RUNTIME_CONFIGURATION, serviceRootOf } from '@processpuzzle/util';\nimport { Observable } from 'rxjs';\nimport { ModuleAsset } from './module-asset';\n\n/**\n * REST access to the assets of a module, under `/organizations/{orgKey}/modules/{key}/assets`. A service of its\n * own, for the reason `ModuleTranslationService` is: the generic CRUD client sends a JSON `Content-Type`, which is\n * wrong for a multipart upload and for a file download.\n */\n@Injectable({ providedIn: 'root' })\nexport class ModuleAssetService {\n private readonly http = inject(HttpClient);\n private readonly runtimeConfiguration = inject(RUNTIME_CONFIGURATION);\n\n list(moduleKey: string, revision: 'draft' | 'released' = 'draft'): Observable<ModuleAsset[]> {\n return this.http.get<ModuleAsset[]>(this.assetsUrl(moduleKey), { params: { revision } });\n }\n\n /** Adds the file to the module draft under `path`, replacing the asset already there; its own name when `path` is empty. */\n upload(moduleKey: string, file: File, path?: string): Observable<ModuleAsset> {\n const body = new FormData();\n body.append('file', file, file.name);\n if (path) body.append('path', path);\n return this.http.post<ModuleAsset>(this.assetsUrl(moduleKey), body);\n }\n\n remove(moduleKey: string, path: string): Observable<void> {\n return this.http.delete<void>(this.assetsUrl(moduleKey), { params: { path } });\n }\n\n /** The bytes of one asset. Through `HttpClient`, so that the bearer token goes with it. */\n content(moduleKey: string, path: string, revision: 'draft' | 'released'): Observable<Blob> {\n return this.http.get(`${this.assetsUrl(moduleKey)}/content`, { params: { path, revision }, responseType: 'blob' });\n }\n\n private assetsUrl(moduleKey: string): string {\n return `${serviceRootOf(this.runtimeConfiguration, 'APP_SERVICE_ROOT')}/modules/${encodeURIComponent(moduleKey)}/assets`;\n }\n}\n","import { Component, inject } from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { TranslocoPipe } from '@jsverse/transloco';\nimport { BaseEntity, BaseEntityAttrDescriptor, EntityLabelPipe, FormControlType } from '@processpuzzle/base-entity';\nimport { MODULE_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { ASSETS_CONTROL_STYLES, ASSETS_CONTROL_TEMPLATE, AssetsControlBase } from './assets-control.base';\nimport { ModuleAssetService } from './module-asset.service';\n\n/** Key root of the control's own words. */\nexport const MODULE_ASSETS_I18N_SCOPE = `${MODULE_DEFINITION_I18N_SCOPE}.assets_panel`;\n\n/**\n * The module form's Assets section. Like the translations section it is not a form field — nothing here is saved\n * with the module — so it is disabled and the form never submits it.\n */\nexport class ModuleAssetsAttrDescriptor extends BaseEntityAttrDescriptor {\n constructor() {\n super('assets', FormControlType.CUSTOM, 'Assets');\n this.component = ModuleAssetsControlComponent;\n this.disabled = true;\n this.hideInTable = true;\n }\n}\n\n/** The files a module brings along; a widget names one as `module:<path>`, a markdown file links the others relatively. */\n@Component({\n selector: 'pp-module-assets-control',\n standalone: true,\n imports: [EntityLabelPipe, MatButton, TranslocoPipe],\n template: ASSETS_CONTROL_TEMPLATE,\n styles: [ASSETS_CONTROL_STYLES],\n})\nexport class ModuleAssetsControlComponent<Entity extends BaseEntity> extends AssetsControlBase<Entity> {\n protected readonly scope = MODULE_ASSETS_I18N_SCOPE;\n protected readonly scheme = 'module';\n protected readonly testIdPrefix = 'module';\n protected readonly service = inject(ModuleAssetService);\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { Component, DestroyRef, inject, OnInit, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatButton } from '@angular/material/button';\nimport { TranslocoPipe } from '@jsverse/transloco';\nimport { BaseEntity, BaseEntityAttrDescriptor, BaseFormControlComponent, EntityLabelPipe, FormControlType } from '@processpuzzle/base-entity';\nimport { MODULE_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { ModuleTranslationCoverage, ModuleTranslationUploadReport } from './module-translation';\nimport { ModuleTranslationService } from './module-translation.service';\n\n/** Key root of the control's own words. */\nexport const MODULE_TRANSLATIONS_I18N_SCOPE = `${MODULE_DEFINITION_I18N_SCOPE}.translations_panel`;\n\n/**\n * The module form's Translations section. Not a form field — nothing here is saved with the module — so it\n * is disabled, like the event parameters list of base-workflow, and the form never submits it.\n */\nexport class ModuleTranslationsAttrDescriptor extends BaseEntityAttrDescriptor {\n constructor() {\n super('translations', FormControlType.CUSTOM, 'Translations');\n this.component = ModuleTranslationsControlComponent;\n this.disabled = true;\n this.hideInTable = true;\n }\n}\n\n/**\n * Where the user fetches and returns the module's translation files. The app is deliberately not a\n * translation editor: *Download* prepares one file per supported language holding every translatable item\n * of the module, the user translates them off-line, and *Upload* takes them back. What the section shows is\n * how far each language is covered, and — after an upload — what was stored and what was not understood.\n *\n * Offered once the module is saved: the files are prepared from the stored draft, so for a module that has\n * only been typed into the form there is nothing yet to prepare them from.\n */\n@Component({\n selector: 'pp-module-translations-control',\n standalone: true,\n imports: [EntityLabelPipe, MatButton, TranslocoPipe],\n template: `\n <div class=\"base-entity-form-field pp-module-translations\">\n <span class=\"pp-module-translations__label\">{{ config().i18nKey() | ppLabel: config().label }}</span>\n @if (moduleKey(); as key) {\n <p class=\"pp-module-translations__hint\">{{ scope + '.hint' | transloco }}</p>\n @if (coverage().length) {\n <table class=\"pp-module-translations__coverage\" data-testid=\"module-translations-coverage\">\n <thead>\n <tr>\n <th>{{ scope + '.language' | transloco }}</th>\n <th>{{ scope + '.translated' | transloco }}</th>\n </tr>\n </thead>\n <tbody>\n @for (language of coverage(); track language.locale) {\n <tr [attr.data-testid]=\"'module-translations-' + language.locale\">\n <td>{{ language.locale }}</td>\n <td [title]=\"language.missingKeys.join(', ')\">{{ language.translatedCount }} / {{ language.keyCount }}</td>\n </tr>\n }\n </tbody>\n </table>\n }\n <div class=\"pp-module-translations__actions\">\n <button mat-stroked-button type=\"button\" data-testid=\"module-translations-download\" (click)=\"download(key)\">{{ scope + '.download' | transloco }}</button>\n <button mat-stroked-button type=\"button\" data-testid=\"module-translations-upload\" (click)=\"fileInput.click()\">{{ scope + '.upload' | transloco }}</button>\n <input #fileInput type=\"file\" accept=\".zip,.json\" hidden data-testid=\"module-translations-file\" (change)=\"upload(key, fileInput)\" />\n </div>\n @if (report(); as uploaded) {\n <ul class=\"pp-module-translations__report\" data-testid=\"module-translations-report\">\n @for (language of uploaded.languages; track language.locale) {\n <li>\n <strong>{{ language.locale }}</strong\n >: {{ scope + '.stored' | transloco: { count: language.storedKeys } }}\n @if (language.additionalKeys.length) {\n <span class=\"pp-module-translations__note\" [title]=\"language.additionalKeys.join(', ')\">{{ scope + '.additional' | transloco: { count: language.additionalKeys.length } }}</span>\n }\n @if (language.missingKeys.length) {\n <span class=\"pp-module-translations__warning\" [title]=\"language.missingKeys.join(', ')\">{{ scope + '.missing' | transloco: { count: language.missingKeys.length } }}</span>\n }\n @if (language.untranslatedKeys.length) {\n <span class=\"pp-module-translations__warning\" [title]=\"language.untranslatedKeys.join(', ')\">{{\n scope + '.untranslated' | transloco: { count: language.untranslatedKeys.length }\n }}</span>\n }\n </li>\n }\n </ul>\n }\n @if (error(); as message) {\n <p class=\"pp-module-translations__error\" data-testid=\"module-translations-error\">{{ message }}</p>\n }\n } @else {\n <p class=\"pp-module-translations__hint\" data-testid=\"module-translations-save-first\">{{ scope + '.save_first' | transloco }}</p>\n }\n </div>\n `,\n styles: [\n `\n .pp-module-translations {\n border: 1px solid var(--mat-sys-outline-variant);\n border-radius: 4px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 8px 12px;\n }\n .pp-module-translations__label {\n font: var(--mat-sys-label-large);\n }\n .pp-module-translations__hint {\n margin: 0;\n opacity: 0.7;\n font-size: 12px;\n }\n .pp-module-translations__coverage {\n border-collapse: collapse;\n text-align: left;\n }\n .pp-module-translations__coverage th,\n .pp-module-translations__coverage td {\n padding: 2px 16px 2px 0;\n }\n .pp-module-translations__actions {\n display: flex;\n gap: 8px;\n }\n .pp-module-translations__report {\n margin: 0;\n padding-left: 16px;\n }\n .pp-module-translations__note {\n margin-left: 8px;\n font-size: 12px;\n opacity: 0.7;\n }\n .pp-module-translations__warning {\n margin-left: 8px;\n font-size: 12px;\n color: var(--mat-sys-tertiary);\n }\n .pp-module-translations__error {\n margin: 0;\n color: var(--mat-sys-error);\n }\n `,\n ],\n})\nexport class ModuleTranslationsControlComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {\n protected readonly scope = MODULE_TRANSLATIONS_I18N_SCOPE;\n private readonly translations = inject(ModuleTranslationService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly savedKey = signal<string | undefined>(undefined);\n\n /** The key of the stored module, once there is one. */\n protected readonly moduleKey = this.savedKey.asReadonly();\n protected readonly coverage = signal<ModuleTranslationCoverage[]>([]);\n protected readonly report = signal<ModuleTranslationUploadReport | undefined>(undefined);\n protected readonly error = signal<string | undefined>(undefined);\n\n ngOnInit(): void {\n const id = this.formGroup?.get('id');\n const version = this.formGroup?.get('version');\n const refresh = () => this.updateKey(id?.value, version?.value);\n refresh();\n id?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(refresh);\n version?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(refresh);\n }\n\n protected download(moduleKey: string): void {\n this.error.set(undefined);\n this.translations.download(moduleKey).subscribe({\n next: (zip) => this.save(zip, `${moduleKey}-translations.zip`),\n error: (failure: unknown) => this.error.set(this.messageOf(failure)),\n });\n }\n\n protected upload(moduleKey: string, input: HTMLInputElement): void {\n const file = input.files?.item(0);\n if (!file) return;\n this.error.set(undefined);\n this.translations.upload(moduleKey, file).subscribe({\n next: (report) => {\n this.report.set(report);\n this.loadCoverage(moduleKey);\n },\n error: (failure: unknown) => this.error.set(this.messageOf(failure)),\n });\n // Cleared so that choosing the same file again — after fixing it — still fires `change`.\n input.value = '';\n }\n\n /** Only a saved module has a draft to prepare the files from; a key typed into a new form is not one. */\n private updateKey(id: unknown, version: unknown): void {\n const key = typeof id === 'string' && id !== '' && version ? id : undefined;\n if (key === this.savedKey()) return;\n this.savedKey.set(key);\n this.report.set(undefined);\n this.coverage.set([]);\n if (key) this.loadCoverage(key);\n }\n\n private loadCoverage(moduleKey: string): void {\n this.translations.coverage(moduleKey).subscribe({\n next: (coverage) => this.coverage.set(coverage),\n error: () => this.coverage.set([]),\n });\n }\n\n private save(zip: Blob, fileName: string): void {\n const url = URL.createObjectURL(zip);\n const link = document.createElement('a');\n link.href = url;\n link.download = fileName;\n link.click();\n URL.revokeObjectURL(url);\n }\n\n private messageOf(failure: unknown): string {\n if (failure instanceof HttpErrorResponse) {\n const detail = (failure.error as { errorText?: string } | null)?.errorText;\n return detail ?? failure.message;\n }\n return String(failure);\n }\n}\n","/**\n * Entity names of the app-definition graph, kept in one dependency-free module.\n *\n * They live here rather than next to their descriptors because the graph is cyclic: `App Definition`\n * aggregates `App Region`, and `App Region` names `App Definition` as its `componentParent`. Each\n * descriptor module re-exports its own name, so importers are unaffected.\n */\nexport const APP_DEFINITION_ENTITY_NAME = 'App Definition';\n/**\n * A second aggregate root beside `App Definition`, not a part of it — hence no `App` prefix, which in\n * every other name here marks something the app document carries. `App Module Mount` is the row inside\n * an app that *names* one of these.\n */\nexport const MODULE_DEFINITION_ENTITY_NAME = 'Module Definition';\nexport const APP_MODULE_MOUNT_ENTITY_NAME = 'App Module Mount';\nexport const APP_NAV_ITEM_ENTITY_NAME = 'App Nav Item';\nexport const APP_REGION_ENTITY_NAME = 'App Region';\nexport const APP_ROUTE_ENTITY_NAME = 'App Route';\nexport const APP_CONTEXT_ENTITY_NAME = 'App Context';\nexport const APP_WIDGET_ENTITY_NAME = 'App Widget';\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType } from '@processpuzzle/base-entity';\nimport { APP_MODULE_MOUNT_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_DEFINITION_ENTITY_NAME, APP_MODULE_MOUNT_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_MODULE_MOUNT_ENTITY_NAME };\n\n/** `ModuleMount` has no `id` — an app mounts a given module once, so `moduleKey` identifies the row. */\nexport const APP_MODULE_MOUNT_ID_FIELD = 'moduleKey';\n\nfunction createModuleMountAttrDescriptors(): AbstractAttrDescriptor[] {\n // A plain text box rather than a FOREIGN_KEY onto the module list: modules stay loosely coupled, so a\n // key naming no existing module is a server-side warning rather than an error, and a dropdown of the\n // modules authored so far would turn that warning into something the form refuses to let happen.\n const moduleKeyAttr = new BaseEntityAttrDescriptor('moduleKey', FormControlType.TEXT_BOX, 'Module Key', undefined, true);\n moduleKeyAttr.required = true;\n moduleKeyAttr.isHeading = true;\n moduleKeyAttr.placeholder = 'Key of a module definition of this organization';\n // Both patterns are the contract's own. Declaring them here makes the form refuse what the backend\n // would refuse anyway, and puts them in the e2e registry, so generated fixtures produce dashed tokens\n // rather than prose the PUT answers with 400.\n moduleKeyAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';\n\n const basePathAttr = new BaseEntityAttrDescriptor('basePath', FormControlType.TEXT_BOX, 'Base Path');\n basePathAttr.required = true;\n basePathAttr.placeholder = 'The module routes are mounted under this prefix, e.g. claims';\n basePathAttr.pattern = '^[a-z0-9][a-z0-9\\\\-/]*$';\n\n const flexBoxContainer = new FlexboxDescriptor([moduleKeyAttr, basePathAttr], FlexDirection.ROW);\n flexBoxContainer.style = { 'column-gap': '10px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createModuleMountDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_MODULE_MOUNT_ENTITY_NAME,\n attrDescriptors: createModuleMountAttrDescriptors(),\n i18nScope: APP_MODULE_MOUNT_I18N_SCOPE,\n componentParent: APP_DEFINITION_ENTITY_NAME,\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { APP_CONTEXT_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_CONTEXT_ENTITY_NAME, APP_DEFINITION_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_CONTEXT_ENTITY_NAME };\n\n/** `WorkingContextDefinition` has no `id`: `name` identifies it, and it is what a route's `requiresContext` names. */\nexport const APP_CONTEXT_ID_FIELD = 'name';\n\n/** The values of the contract's `persist` enum. */\nconst PERSIST_MODES = ['url', 'url-local-storage'] as const;\n\nfunction createContextAttrDescriptors(): AbstractAttrDescriptor[] {\n const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);\n nameAttr.required = true;\n nameAttr.isHeading = true;\n nameAttr.placeholder = \"The context's URL segment, e.g. warehouse\";\n // The contract's own pattern; see the note on the module mount's key.\n nameAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';\n\n // A plain text box, as for a route's entity name: whether the entity exists is the backend validator's call.\n const entityNameAttr = new BaseEntityAttrDescriptor('entityName', FormControlType.TEXT_BOX, 'Entity Name');\n entityNameAttr.required = true;\n entityNameAttr.placeholder = 'The entity type the user picks, e.g. Warehouse';\n\n const parentAttr = new BaseEntityAttrDescriptor('parent', FormControlType.TEXT_BOX, 'Parent');\n parentAttr.placeholder = 'Name of the context this one is nested in';\n parentAttr.hideInTable = true;\n\n const basePathAttr = new BaseEntityAttrDescriptor('basePath', FormControlType.TEXT_BOX, 'Base Path');\n basePathAttr.placeholder = 'Where its routes are mounted, e.g. /conduct; empty for the app root';\n basePathAttr.hideInTable = true;\n\n const persistAttr = new BaseEntityAttrDescriptor('persist', FormControlType.DROPDOWN, 'Persist', toSelectables(PERSIST_MODES));\n persistAttr.hideInTable = true;\n\n // region flattened picker / display / confirmSwitchWhen — re-nested by AppDefinitionMapper\n const pickerSearchFieldsAttr = new BaseEntityAttrDescriptor('pickerSearchFields', FormControlType.TAGS, 'Picker Search Fields');\n pickerSearchFieldsAttr.placeholder = 'Attributes the picker searches; empty for the title attribute';\n pickerSearchFieldsAttr.hideInTable = true;\n\n const pickerRecentAttr = new BaseEntityAttrDescriptor('pickerRecent', FormControlType.TEXT_BOX, 'Picker Recent', undefined, false, { inputType: 'number' });\n pickerRecentAttr.hideInTable = true;\n\n const displayLabelAttr = new BaseEntityAttrDescriptor('displayLabel', FormControlType.TEXT_BOX, 'Display Label');\n displayLabelAttr.placeholder = 'Crumb text, e.g. {{name}}; empty for the title attribute';\n displayLabelAttr.hideInTable = true;\n\n const displayBadgeAttr = new BaseEntityAttrDescriptor('displayBadge', FormControlType.TEXT_BOX, 'Display Badge');\n displayBadgeAttr.placeholder = 'Attribute shown as a badge; state for the state attribute';\n displayBadgeAttr.hideInTable = true;\n\n const displayExtraAttr = new BaseEntityAttrDescriptor('displayExtra', FormControlType.TEXT_BOX, 'Display Extra');\n displayExtraAttr.placeholder = 'A second text, e.g. zone {{currentZone}}';\n displayExtraAttr.hideInTable = true;\n\n const confirmSwitchStatesAttr = new BaseEntityAttrDescriptor('confirmSwitchStates', FormControlType.TAGS, 'Confirm Switch States');\n confirmSwitchStatesAttr.placeholder = 'States that make leaving the entity ask first, e.g. Running';\n confirmSwitchStatesAttr.hideInTable = true;\n // endregion\n\n const identityRow = new FlexboxDescriptor([nameAttr, entityNameAttr, parentAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const placementRow = new FlexboxDescriptor([basePathAttr, persistAttr], FlexDirection.ROW);\n placementRow.style = { 'column-gap': '10px' };\n const pickerRow = new FlexboxDescriptor([pickerSearchFieldsAttr, pickerRecentAttr], FlexDirection.ROW);\n pickerRow.style = { 'column-gap': '10px' };\n const displayRow = new FlexboxDescriptor([displayLabelAttr, displayBadgeAttr, displayExtraAttr], FlexDirection.ROW);\n displayRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, placementRow, pickerRow, displayRow, confirmSwitchStatesAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createWorkingContextDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_CONTEXT_ENTITY_NAME,\n attrDescriptors: createContextAttrDescriptors(),\n i18nScope: APP_CONTEXT_I18N_SCOPE,\n componentParent: APP_DEFINITION_ENTITY_NAME,\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { APP_REGION_I18N_SCOPE } from '../base-app.i18n';\nimport { REGION_TYPES } from './app-definition';\nimport { APP_DEFINITION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME, APP_REGION_ENTITY_NAME, APP_WIDGET_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_REGION_ENTITY_NAME };\n\n/**\n * `RegionDefinition` has no `id` — a region is identified by the shell slot it fills, and an app\n * declares each slot at most once. Referencing attributes therefore have to set\n * `referenceIdField = 'type'`; see the `regions` attribute of the `AppDefinition` descriptor.\n */\nexport const APP_REGION_ID_FIELD = 'type';\n\nfunction createRegionDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.DROPDOWN, 'Type', toSelectables(REGION_TYPES), true);\n typeAttr.required = true;\n typeAttr.isHeading = true;\n\n // Per the contract, `navItems` applies to `sidenav` and `widgets` to `header` / `footer`; the\n // schema models them as optional siblings rather than a discriminated union, so both are offered\n // and it is the region's type that decides which one is meaningful. Both are contained: the rows\n // are nested arrays of this region, which is itself nested in the app definition's document.\n const navItemsAttr = new BaseEntityAttrDescriptor('navItems', FormControlType.EMBEDDED_COMPONENTS, 'Nav Items');\n navItemsAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;\n navItemsAttr.hideInTable = true;\n // Listed in this order by the nav.\n navItemsAttr.ordered = true;\n\n const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');\n widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;\n widgetsAttr.hideInTable = true;\n // Rendered in this order, which is also how a spacer aligns the widgets around it.\n widgetsAttr.ordered = true;\n\n const flexBoxContainer = new FlexboxDescriptor([typeAttr, navItemsAttr, widgetsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createRegionDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_REGION_ENTITY_NAME,\n attrDescriptors: createRegionDefinitionAttrDescriptors(),\n i18nScope: APP_REGION_I18N_SCOPE,\n componentParent: APP_DEFINITION_ENTITY_NAME,\n isEmbedded: true,\n });\n}\n","import {\n AbstractAttrDescriptor,\n BaseEntityAttrDescriptor,\n BaseEntityDescriptor,\n FlexboxDescriptor,\n FlexDirection,\n FormControlType,\n REALM_ROLE_SUGGESTIONS,\n toSelectables,\n} from '@processpuzzle/base-entity';\nimport { APP_ROUTE_I18N_SCOPE } from '../base-app.i18n';\nimport { ENTITY_MODES, ROUTE_TARGET_KINDS } from './app-definition';\nimport { APP_DEFINITION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME, APP_WIDGET_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_ROUTE_ENTITY_NAME };\n\n/**\n * `RouteDefinition` has no `id` — `path` identifies a route, and it is what a `NavItem.routePath`\n * resolves against. Referencing attributes therefore have to set `referenceIdField = 'path'`; see the\n * `routePath` attribute of the `App Nav Item` descriptor.\n *\n * Unlike `App Region`'s `type`, this value may contain `/`, so the authoring URL that addresses one row\n * carries it percent-encoded (`app-route/claims%2Fopen/details`). Angular round-trips that, but a\n * reverse proxy that normalizes `%2F` before the SPA sees it would not — worth an e2e case once\n * multi-segment routes are authored in the testbed.\n */\nexport const APP_ROUTE_ID_FIELD = 'path';\n\nfunction createRouteDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n const pathAttr = new BaseEntityAttrDescriptor('path', FormControlType.TEXT_BOX, 'Path', undefined, true);\n pathAttr.required = true;\n pathAttr.placeholder = 'Relative to the app root, e.g. claims/open or claims/:id';\n // The contract's own pattern. Declaring it here is what makes the form reject a value the backend\n // would reject anyway — and it is serialized into the e2e registry, so generated fixtures produce a\n // dashed token instead of a prose value the PUT answers with 400.\n pathAttr.pattern = '^[a-z0-9:][a-z0-9\\\\-:/]*$';\n\n const titleAttr = new BaseEntityAttrDescriptor('title', FormControlType.TEXT_BOX, 'Title');\n titleAttr.required = true;\n titleAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the route title';\n translocoIdAttr.hideInTable = true;\n\n const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');\n iconAttr.placeholder = 'Material or FontAwesome icon name';\n iconAttr.hideInTable = true;\n\n const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');\n rolesAttr.placeholder = 'Empty means any authenticated member of the organization';\n rolesAttr.hideInTable = true;\n rolesAttr.tagSuggestions = REALM_ROLE_SUGGESTIONS;\n\n const requiresContextAttr = new BaseEntityAttrDescriptor('requiresContext', FormControlType.TEXT_BOX, 'Requires Context');\n requiresContextAttr.placeholder = 'Name of a context of the app; the page then lives below ctx/<name>/<id>';\n requiresContextAttr.hideInTable = true;\n\n // region flattened target — re-nested into `target` by AppDefinitionMapper\n // Which of the fields below is meaningful follows from `kind`; all of them are offered, and the\n // backend validator — not the form — is what rejects a combination that makes no sense. The generic\n // form has no conditional visibility, and a discriminated union is not something a descriptor can\n // express in the first place.\n const kindAttr = new BaseEntityAttrDescriptor('kind', FormControlType.DROPDOWN, 'Renders', toSelectables(ROUTE_TARGET_KINDS));\n kindAttr.required = true;\n\n const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');\n widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;\n widgetsAttr.hideInTable = true;\n // Rendered in this order, which is also how a spacer aligns the widgets around it.\n widgetsAttr.ordered = true;\n\n const documentSlugAttr = new BaseEntityAttrDescriptor('documentSlug', FormControlType.TEXT_BOX, 'Document Slug');\n documentSlugAttr.placeholder = 'DOCUMENT only: slug of the document to render';\n documentSlugAttr.hideInTable = true;\n\n const entityNameAttr = new BaseEntityAttrDescriptor('entityName', FormControlType.TEXT_BOX, 'Entity Name');\n entityNameAttr.placeholder = 'ENTITY only: name of the descriptor to generate the screen from';\n entityNameAttr.hideInTable = true;\n\n const entityModeAttr = new BaseEntityAttrDescriptor('entityMode', FormControlType.DROPDOWN, 'Entity Mode', toSelectables(ENTITY_MODES));\n entityModeAttr.hideInTable = true;\n\n const rsqlFilterAttr = new BaseEntityAttrDescriptor('rsqlFilter', FormControlType.TEXT_BOX, 'Rsql Filter');\n rsqlFilterAttr.placeholder = 'ENTITY + LIST only: RSQL the list is pre-filtered with';\n rsqlFilterAttr.hideInTable = true;\n const contextPathAttr = new BaseEntityAttrDescriptor('contextPath', FormControlType.TEXT_BOX, 'Context Path');\n contextPathAttr.placeholder = \"ENTITY + requires context: the context entity's collection to list, e.g. zones\";\n contextPathAttr.hideInTable = true;\n\n const filterByContextAttr = new BaseEntityAttrDescriptor('filterByContext', FormControlType.TEXT_BOX, 'Filter By Context');\n filterByContextAttr.placeholder = 'ENTITY + LIST: name of a context; the list can be narrowed to its active entity';\n filterByContextAttr.hideInTable = true;\n // endregion\n\n const identityRow = new FlexboxDescriptor([pathAttr, titleAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const presentationRow = new FlexboxDescriptor([iconAttr, kindAttr, requiresContextAttr], FlexDirection.ROW);\n presentationRow.style = { 'column-gap': '10px' };\n const documentRow = new FlexboxDescriptor([documentSlugAttr], FlexDirection.ROW);\n documentRow.style = { 'column-gap': '10px' };\n const entityRow = new FlexboxDescriptor([entityNameAttr, entityModeAttr, rsqlFilterAttr, contextPathAttr, filterByContextAttr], FlexDirection.ROW);\n entityRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, presentationRow, rolesAttr, documentRow, entityRow, widgetsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createRouteDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_ROUTE_ENTITY_NAME,\n attrDescriptors: createRouteDefinitionAttrDescriptors(),\n i18nScope: APP_ROUTE_I18N_SCOPE,\n // Two parents, one descriptor: an app's own routes and a module's routes are the same schema, and a\n // route has to mean the same thing wherever it was authored. The module's paths are simply relative\n // to the base path its mount gives them.\n componentParent: [APP_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME],\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, toSelectables } from '@processpuzzle/base-entity';\nimport { AppAssetsAttrDescriptor } from './app-assets-control.component';\nimport { AppTranslationsAttrDescriptor } from './app-translations-control.component';\nimport { APP_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { AppDefinitionStatus, COLOR_SCHEMES, LAYOUT_PRESETS, MATERIAL_THEMES, SIDENAV_MODES } from './app-definition';\nimport { APP_CONTEXT_ENTITY_NAME, APP_DEFINITION_ENTITY_NAME, APP_MODULE_MOUNT_ENTITY_NAME, APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME } from './app-entity-names';\nimport { APP_MODULE_MOUNT_ID_FIELD } from './module-mount.descriptors';\nimport { APP_CONTEXT_ID_FIELD } from './working-context.descriptors';\nimport { APP_REGION_ID_FIELD } from './region-definition.descriptors';\nimport { APP_ROUTE_ID_FIELD } from './route-definition.descriptors';\n\nexport { APP_DEFINITION_ENTITY_NAME };\n\nconst statusSelectables = toSelectables(Object.keys(AppDefinitionStatus));\n\nfunction createAppDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n // The id is what opens the application from the list: it is the one value of the row that is unique and never empty,\n // where the name is free text. The name stays the heading of the form.\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id', undefined, true);\n idAttr.required = true;\n idAttr.placeholder = 'Unique within the organization, e.g. claims-app';\n\n const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name');\n nameAttr.required = true;\n nameAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the application name';\n translocoIdAttr.hideInTable = true;\n\n const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');\n descriptionAttr.styleClass = 'full-width';\n descriptionAttr.hideInTable = true;\n\n // Server-assigned: shown so the designer can see where a definition stands, never edited here.\n // Status changes through `POST .../publish`, the versions through any successful write.\n const statusAttr = new BaseEntityAttrDescriptor('status', FormControlType.DROPDOWN, 'Status', statusSelectables);\n statusAttr.disabled = true;\n\n const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');\n versionAttr.disabled = true;\n\n const publishedVersionAttr = new BaseEntityAttrDescriptor('publishedVersion', FormControlType.TEXT_BOX, 'Published Version');\n publishedVersionAttr.disabled = true;\n\n const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');\n updatedAtAttr.disabled = true;\n\n // region theme — flattened out of `theme` by AppDefinitionMapper\n const materialThemeAttr = new BaseEntityAttrDescriptor('materialTheme', FormControlType.DROPDOWN, 'Material Theme', toSelectables(MATERIAL_THEMES));\n materialThemeAttr.hideInTable = true;\n\n const colorSchemeAttr = new BaseEntityAttrDescriptor('colorScheme', FormControlType.DROPDOWN, 'Color Scheme', toSelectables(COLOR_SCHEMES));\n colorSchemeAttr.hideInTable = true;\n\n const logoUrlAttr = new BaseEntityAttrDescriptor('logoUrl', FormControlType.TEXT_BOX, 'Logo Url');\n logoUrlAttr.placeholder = 'Tenant logo shown in the header region';\n logoUrlAttr.hideInTable = true;\n\n const faviconUrlAttr = new BaseEntityAttrDescriptor('faviconUrl', FormControlType.TEXT_BOX, 'Favicon Url');\n faviconUrlAttr.hideInTable = true;\n\n // An open key/value map by contract — keys are `--pp-*` token names, values any CSS color — so a\n // key/value editor is the only shape that can carry it without the form inventing a closed list.\n const tokenOverridesAttr = new BaseEntityAttrDescriptor('tokenOverrides', FormControlType.ADDITIONAL_PROPERTIES, 'Token Overrides');\n tokenOverridesAttr.hideInTable = true;\n // endregion\n\n // region layout — flattened out of `layout` by AppDefinitionMapper\n const presetAttr = new BaseEntityAttrDescriptor('preset', FormControlType.DROPDOWN, 'Layout Preset', toSelectables(LAYOUT_PRESETS));\n presetAttr.hideInTable = true;\n\n const sidenavModeAttr = new BaseEntityAttrDescriptor('sidenavMode', FormControlType.DROPDOWN, 'Sidenav Mode', toSelectables(SIDENAV_MODES));\n sidenavModeAttr.hideInTable = true;\n\n const contentMaxWidthAttr = new BaseEntityAttrDescriptor('contentMaxWidth', FormControlType.TEXT_BOX, 'Content Max Width');\n contentMaxWidthAttr.placeholder = 'CSS length, e.g. 1280px; empty means full width';\n contentMaxWidthAttr.hideInTable = true;\n\n const sidenavCollapsibleAttr = new BaseEntityAttrDescriptor('sidenavCollapsible', FormControlType.CHECKBOX, 'Sidenav Collapsible');\n sidenavCollapsibleAttr.hideInTable = true;\n\n const sidenavOpenByDefaultAttr = new BaseEntityAttrDescriptor('sidenavOpenByDefault', FormControlType.CHECKBOX, 'Sidenav Open By Default');\n sidenavOpenByDefaultAttr.hideInTable = true;\n // endregion\n\n // region nested graph — kept on the entity as-is by AppDefinitionMapper, so the full-replacement PUT preserves it\n // Containment, not association: the contract nests `RegionDefinition`, `RouteDefinition` and\n // `ModuleMount` inside the AppDefinition document, and none has an endpoint of its own, so the rows\n // travel inside this entity's payload and are saved with it. A `ModuleMount` is the exception that\n // proves it — the module it *names* is a separate aggregate with its own endpoints, but the mount\n // itself belongs to this app.\n const regionsAttr = new BaseEntityAttrDescriptor('regions', FormControlType.EMBEDDED_COMPONENTS, 'Regions');\n regionsAttr.linkedEntityType = APP_REGION_ENTITY_NAME;\n // A region has no `id` in the contract; `type` is what identifies it. See APP_REGION_ID_FIELD.\n regionsAttr.referenceIdField = APP_REGION_ID_FIELD;\n regionsAttr.hideInTable = true;\n\n // Flat by design: a route has no children, and the multi-segment paths of these rows are what the\n // shell derives Angular's nesting from at registration time.\n const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');\n routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;\n routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;\n routesAttr.hideInTable = true;\n\n const modulesAttr = new BaseEntityAttrDescriptor('modules', FormControlType.EMBEDDED_COMPONENTS, 'Modules');\n modulesAttr.linkedEntityType = APP_MODULE_MOUNT_ENTITY_NAME;\n modulesAttr.referenceIdField = APP_MODULE_MOUNT_ID_FIELD;\n modulesAttr.hideInTable = true;\n\n // Working contexts: entities the user selects once and works inside. A route opts in with `requiresContext`.\n const contextsAttr = new BaseEntityAttrDescriptor('contexts', FormControlType.EMBEDDED_COMPONENTS, 'Contexts');\n contextsAttr.linkedEntityType = APP_CONTEXT_ENTITY_NAME;\n contextsAttr.referenceIdField = APP_CONTEXT_ID_FIELD;\n contextsAttr.hideInTable = true;\n // endregion\n\n // The files the application brings along, named by widgets as app:<path>. Like the module's, not part of the saved\n // application: the section talks to the application's own asset endpoints.\n const assetsAttr = new AppAssetsAttrDescriptor();\n\n // The texts of the application's own pages, uploaded per language. Not part of the saved application either.\n const translationsAttr = new AppTranslationsAttrDescriptor();\n\n const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const revisionRow = new FlexboxDescriptor([statusAttr, versionAttr, publishedVersionAttr, updatedAtAttr], FlexDirection.ROW);\n revisionRow.style = { 'column-gap': '10px' };\n const themeRow = new FlexboxDescriptor([materialThemeAttr, colorSchemeAttr], FlexDirection.ROW);\n themeRow.style = { 'column-gap': '10px' };\n const brandingRow = new FlexboxDescriptor([logoUrlAttr, faviconUrlAttr], FlexDirection.ROW);\n brandingRow.style = { 'column-gap': '10px' };\n const layoutRow = new FlexboxDescriptor([presetAttr, sidenavModeAttr, contentMaxWidthAttr], FlexDirection.ROW);\n layoutRow.style = { 'column-gap': '10px' };\n const sidenavRow = new FlexboxDescriptor([sidenavCollapsibleAttr, sidenavOpenByDefaultAttr], FlexDirection.ROW);\n sidenavRow.style = { 'column-gap': '10px' };\n const graphRow = new FlexboxDescriptor([regionsAttr, routesAttr, modulesAttr, contextsAttr], FlexDirection.ROW);\n graphRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor(\n [identityRow, revisionRow, descriptionAttr, themeRow, brandingRow, tokenOverridesAttr, layoutRow, sidenavRow, graphRow, translationsAttr, assetsAttr],\n FlexDirection.COLUMN,\n );\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createAppDefinitionDescriptor(): BaseEntityDescriptor {\n // `titleKey`: the id is the link of the list, but the status bar names the application it is open on.\n return new BaseEntityDescriptor({ entityName: APP_DEFINITION_ENTITY_NAME, attrDescriptors: createAppDefinitionAttrDescriptors(), i18nScope: APP_DEFINITION_I18N_SCOPE, titleKey: 'name' });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, REALM_ROLE_SUGGESTIONS } from '@processpuzzle/base-entity';\nimport { APP_NAV_ITEM_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_NAV_ITEM_ENTITY_NAME, APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME } from './app-entity-names';\nimport { APP_ROUTE_ID_FIELD } from './route-definition.descriptors';\n\nexport { APP_NAV_ITEM_ENTITY_NAME };\n\nfunction createNavItemAttrDescriptors(): AbstractAttrDescriptor[] {\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');\n idAttr.required = true;\n\n const labelAttr = new BaseEntityAttrDescriptor('label', FormControlType.TEXT_BOX, 'Label', undefined, true);\n labelAttr.required = true;\n labelAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the label';\n translocoIdAttr.hideInTable = true;\n\n const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');\n iconAttr.placeholder = 'Material or FontAwesome icon name';\n iconAttr.hideInTable = true;\n\n // A group node expands its children instead of navigating, so this stays optional. The route is\n // resolved by `path` rather than by an id — see APP_ROUTE_ID_FIELD.\n const routePathAttr = new BaseEntityAttrDescriptor('routePath', FormControlType.FOREIGN_KEY, 'Route');\n routePathAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;\n routePathAttr.referenceIdField = APP_ROUTE_ID_FIELD;\n\n const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');\n rolesAttr.placeholder = 'Empty means any authenticated member of the organization';\n rolesAttr.hideInTable = true;\n rolesAttr.tagSuggestions = REALM_ROLE_SUGGESTIONS;\n\n // A group node contains its children rather than pointing at them — they are an inline array of this\n // entry, and the entry itself is nested in the app definition's document.\n const childrenAttr = new BaseEntityAttrDescriptor('children', FormControlType.EMBEDDED_COMPONENTS, 'Children');\n childrenAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;\n childrenAttr.hideInTable = true;\n // Listed in this order under their group.\n childrenAttr.ordered = true;\n\n const identityRow = new FlexboxDescriptor([idAttr, labelAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const targetRow = new FlexboxDescriptor([iconAttr, routePathAttr], FlexDirection.ROW);\n targetRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, targetRow, rolesAttr, childrenAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createNavItemDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_NAV_ITEM_ENTITY_NAME,\n attrDescriptors: createNavItemAttrDescriptors(),\n i18nScope: APP_NAV_ITEM_I18N_SCOPE,\n // A nav item hangs off the sidenav region, or off another nav item as a group child.\n componentParent: [APP_REGION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME],\n isEmbedded: true,\n });\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType, Selectable, SelectablesInput, toSelectables } from '@processpuzzle/base-entity';\nimport { createWidgetPropsAttrDescriptor, type WidgetRegistration } from '@processpuzzle/widgets';\nimport { APP_WIDGET_I18N_SCOPE } from '../base-app.i18n';\nimport { WIDGET_PLACEMENTS } from './app-definition';\nimport { APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME, APP_WIDGET_ENTITY_NAME } from './app-entity-names';\n\nexport { APP_WIDGET_ENTITY_NAME };\n\nfunction createWidgetInstanceAttrDescriptors(widgetTypes: SelectablesInput): AbstractAttrDescriptor[] {\n // `id` rather than `type` identifies the widget: it is unique within its page or region, while a\n // page with two `entity-grid`s would otherwise show the same label twice.\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id', undefined, true);\n idAttr.required = true;\n idAttr.isHeading = true;\n idAttr.placeholder = 'Unique within the page or region, e.g. widget-claims-grid';\n\n // `WidgetInstance.type` is a key into the frontend widget registry. The contract keeps it an open string,\n // so a new widget type needs no schema change; the form still offers only the keys that can render —\n // the ones registered in this build, passed in by the facade.\n const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.DROPDOWN, 'Type', widgetTypes);\n typeAttr.required = true;\n\n // Generated from the chosen type's `propsSchema`, as registered in the WIDGET_REGISTRY: one typed control per\n // prop, rebuilt when `type` changes. A type nobody registered or described gets the open key/value editor.\n const propsAttr = createWidgetPropsAttrDescriptor('props', 'type', 'Props');\n propsAttr.hideInTable = true;\n\n // Widgets do not nest: a container widget type lists the ids of siblings in `props.childIds`, and each\n // of those siblings is marked REFERENCED so it is placed by the container instead of rendering twice.\n // That is the whole of composition here — there is no child collection to edit.\n const placementAttr = new BaseEntityAttrDescriptor('placement', FormControlType.DROPDOWN, 'Placement', toSelectables(WIDGET_PLACEMENTS));\n placementAttr.hideInTable = true;\n\n const identityRow = new FlexboxDescriptor([idAttr, typeAttr, placementAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, propsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\n/**\n * @param widgetTypes the options of the `type` dropdown — see {@link widgetTypeSelectables}. Without them the\n * dropdown is empty, as it should be where no widget is registered: none could render.\n */\nexport function createWidgetInstanceDescriptor(widgetTypes: SelectablesInput = []): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: APP_WIDGET_ENTITY_NAME,\n attrDescriptors: createWidgetInstanceAttrDescriptors(widgetTypes),\n i18nScope: APP_WIDGET_I18N_SCOPE,\n // A widget sits in a header/footer region or on a page — and only there, since it cannot be nested\n // in another widget.\n componentParent: [APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME],\n isEmbedded: true,\n });\n}\n\n/**\n * The registered widget types as dropdown options, sorted alphabetically using the current locale. `key` and `value` are both the registry key,\n * because the dropdown stores and displays `value` — a display name there would be saved as the type.\n */\nexport function widgetTypeSelectables(registry: ReadonlyMap<string, WidgetRegistration>): Selectable[] {\n return toSelectables([...registry.keys()].sort((left, right) => left.localeCompare(right)));\n}\n","import { AbstractAttrDescriptor, BaseEntityAttrDescriptor, BaseEntityDescriptor, FlexboxDescriptor, FlexDirection, FormControlType } from '@processpuzzle/base-entity';\nimport { MODULE_DEFINITION_I18N_SCOPE } from '../base-app.i18n';\nimport { APP_ROUTE_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME } from './app-entity-names';\nimport { ModuleAssetsAttrDescriptor } from './module-assets-control.component';\nimport { ModuleTranslationsAttrDescriptor } from './module-translations-control.component';\nimport { APP_ROUTE_ID_FIELD } from './route-definition.descriptors';\n\nexport { MODULE_DEFINITION_ENTITY_NAME };\n\nfunction createModuleDefinitionAttrDescriptors(): AbstractAttrDescriptor[] {\n // The contract's `key`, renamed to `id` by ModuleDefinitionMapper because base-entity keys stores and\n // URLs on `id`. Labelled 'Key' so the designer sees the name the contract and `ModuleMount.moduleKey`\n // use. The pattern is the contract's own: the key is a URL segment of the module endpoints and the\n // prefix a mount composes with, so a value needing encoding would break both.\n const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Key');\n idAttr.required = true;\n idAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';\n idAttr.placeholder = 'Unique within the organization, e.g. claims — immutable once mounted';\n\n const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);\n nameAttr.required = true;\n nameAttr.isHeading = true;\n\n const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');\n translocoIdAttr.placeholder = 'Translation key of the module name';\n translocoIdAttr.hideInTable = true;\n\n const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');\n descriptionAttr.styleClass = 'full-width';\n descriptionAttr.hideInTable = true;\n\n // Left empty means the key, which is the default the contract states — applied by\n // `moduleTranslocoScope` rather than written into the row, so an empty field stays empty.\n const translocoScopeAttr = new BaseEntityAttrDescriptor('translocoScope', FormControlType.TEXT_BOX, 'Transloco Scope');\n translocoScopeAttr.placeholder = \"Scope the module's translations load under; empty means the key\";\n translocoScopeAttr.hideInTable = true;\n\n // Server-assigned, shown so the designer can see where a module stands.\n const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');\n versionAttr.disabled = true;\n\n const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');\n updatedAtAttr.disabled = true;\n\n // The same rows, the same descriptor and the same derived nesting as `AppDefinition.routes` — only the\n // paths are relative to the base path a mount gives them. `App Route` therefore names this entity as a\n // second `componentParent`.\n const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');\n routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;\n routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;\n routesAttr.hideInTable = true;\n\n // The prepared translation files of the module — fetched and returned here, never edited in the app. Not part\n // of the saved module: it only talks to the module's own translation endpoints.\n const translationsAttr = new ModuleTranslationsAttrDescriptor();\n\n // The files the module brings along, added one by one and named by widgets as module:<path>. Like the\n // translations, not part of the saved module: the section talks to the module's own asset endpoints.\n const assetsAttr = new ModuleAssetsAttrDescriptor();\n\n const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);\n identityRow.style = { 'column-gap': '10px' };\n const revisionRow = new FlexboxDescriptor([translocoScopeAttr, versionAttr, updatedAtAttr], FlexDirection.ROW);\n revisionRow.style = { 'column-gap': '10px' };\n\n const flexBoxContainer = new FlexboxDescriptor([identityRow, revisionRow, descriptionAttr, routesAttr, translationsAttr, assetsAttr], FlexDirection.COLUMN);\n flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };\n return [flexBoxContainer];\n}\n\nexport function createModuleDefinitionDescriptor(): BaseEntityDescriptor {\n return new BaseEntityDescriptor({\n entityName: MODULE_DEFINITION_ENTITY_NAME,\n attrDescriptors: createModuleDefinitionAttrDescriptors(),\n i18nScope: MODULE_DEFINITION_I18N_SCOPE,\n });\n}\n","import { RouteDefinition, RouteTarget } from './app-definition';\n\n/** The `RouteDefinition` schema as it travels: `target` nested, exactly as the contract declares it. */\nexport interface RouteDefinitionDto {\n path?: string;\n title?: string;\n translocoId?: string;\n icon?: string;\n roles?: string[];\n requiresContext?: string;\n target?: RouteTarget;\n}\n\n/**\n * The `target` flattening both aggregates that own routes need — `AppDefinition.routes` and\n * `ModuleDefinition.routes` carry the same schema, and a route authored in a module has to behave\n * exactly like one authored in an app.\n *\n * Why flatten at all: `EMBEDDED_COMPONENTS` edits a row as the flat JSON it arrived as, and a descriptor\n * addresses one property rather than a path, so nothing in the generated form could reach\n * `target.documentSlug`. The contract already keeps `RouteTarget` flat rather than a `oneOf` for the\n * related reason that the form cannot edit a discriminated union of classes.\n */\nexport function flattenRouteTarget(dto: RouteDefinitionDto): RouteDefinition {\n const target = dto.target;\n return new RouteDefinition({\n path: dto.path,\n title: dto.title,\n translocoId: dto.translocoId,\n icon: dto.icon,\n roles: dto.roles,\n requiresContext: dto.requiresContext,\n kind: target?.kind,\n widgets: target?.widgets,\n documentSlug: target?.documentSlug,\n entityName: target?.entityName,\n entityMode: target?.entityMode,\n rsqlFilter: target?.rsqlFilter,\n contextPath: target?.contextPath,\n filterByContext: target?.filterByContext,\n // Kept so nestRouteTarget can merge onto it rather than replace it.\n target,\n });\n}\n\n/**\n * The inverse. `kind` is non-optional in the contract but undefined on a row the designer has not\n * finished — the dropdown is `required`, so the form rejects that before a save; the cast keeps this\n * mapping from having to invent a default the backend would then have to second-guess.\n *\n * `widgets` is omitted when empty rather than sent as `[]`, so a DOCUMENT or ENTITY route does not\n * persist an empty widget list it has no use for. The rest is merged onto the `target` the fields were\n * lifted out of, which preserves any field a later contract version adds before this mapping learns\n * about it — a PUT is a full replacement, so anything dropped here is dropped for good.\n */\nexport function nestRouteTarget(route: RouteDefinition): RouteDefinitionDto {\n const widgets = route.widgets;\n return {\n path: route.path,\n title: route.title,\n translocoId: route.translocoId,\n icon: route.icon,\n roles: route.roles,\n requiresContext: route.requiresContext || undefined,\n target: {\n ...route.target,\n kind: route.kind as RouteTarget['kind'],\n widgets: widgets?.length ? widgets : undefined,\n documentSlug: route.documentSlug,\n entityName: route.entityName,\n entityMode: route.entityMode,\n rsqlFilter: route.rsqlFilter,\n contextPath: route.contextPath || undefined,\n filterByContext: route.filterByContext || undefined,\n },\n };\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityMapper } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from './module-definition';\nimport { flattenRouteTarget, nestRouteTarget, RouteDefinitionDto } from './route-definition.mapper';\n\ninterface ModuleDefinitionDto {\n key?: string;\n name?: string;\n translocoId?: string;\n description?: string;\n translocoScope?: string;\n routes?: RouteDefinitionDto[];\n orgKey?: string;\n version?: number;\n createdAt?: string;\n updatedAt?: string;\n}\n\n/**\n * Translates between the `ModuleDefinition` DTO of `base-app-api.yaml` and the entity the generated form\n * works with. Two renamings, and nothing else — a module is a much smaller aggregate than an app:\n *\n * - **`key` becomes `id`.** base-entity keys every store, URL and reference on `id`, so the rename\n * happens here rather than in the framework. See {@link ModuleDefinition.id}.\n * - **each route's `target` is flattened** onto the row and re-nested on save, by the same functions\n * `AppDefinitionMapper` uses, so a route authored in a module behaves like one authored in an app.\n */\n@Injectable({ providedIn: 'root' })\nexport class ModuleDefinitionMapper implements BaseEntityMapper<ModuleDefinition> {\n fromDto(dto: unknown): ModuleDefinition {\n const source = dto as ModuleDefinitionDto;\n return new ModuleDefinition({\n id: source.key,\n name: source.name,\n translocoId: source.translocoId,\n description: source.description,\n translocoScope: source.translocoScope,\n routes: source.routes?.map(flattenRouteTarget),\n orgKey: source.orgKey,\n version: source.version,\n createdAt: source.createdAt,\n updatedAt: source.updatedAt,\n });\n }\n\n toDto(entity: ModuleDefinition): ModuleDefinitionDto {\n // Field by field rather than spread, so `id` does not travel beside the `key` it became.\n return {\n key: entity.id,\n name: entity.name,\n translocoId: entity.translocoId,\n description: entity.description,\n translocoScope: entity.translocoScope,\n routes: entity.routes?.map(nestRouteTarget),\n orgKey: entity.orgKey,\n version: entity.version,\n createdAt: entity.createdAt,\n updatedAt: entity.updatedAt,\n };\n }\n}\n","import { WorkingContextDefinition, WorkingContextPersistence } from '@processpuzzle/base-entity';\nimport { WorkingContextRow } from './app-definition';\n\n/** The `confirmSwitchWhen` key the form's `confirmSwitchStates` control writes. */\nconst STATE_CONDITION = 'state';\n\n/** Lifts `picker` / `display` / `confirmSwitchWhen` onto the row, where a form control can reach them. */\nexport function flattenWorkingContext(dto: WorkingContextDefinition): WorkingContextRow {\n const states = dto.confirmSwitchWhen?.[STATE_CONDITION];\n return new WorkingContextRow({\n name: dto.name,\n entityName: dto.entityName,\n parent: dto.parent,\n basePath: dto.basePath,\n persist: dto.persist,\n pickerSearchFields: dto.picker?.searchFields,\n pickerRecent: dto.picker?.recent,\n displayLabel: dto.display?.label,\n displayBadge: dto.display?.badge,\n displayExtra: dto.display?.extra,\n confirmSwitchStates: states === undefined ? undefined : [states].flat().map(String),\n // Kept so nestWorkingContext can merge onto it rather than replace it.\n source: dto,\n });\n}\n\n/** The inverse: what the backend takes. Nested objects that would be empty are left out, not sent as `{}`. */\nexport function nestWorkingContext(row: WorkingContextRow): WorkingContextDefinition {\n const picker = clean({ ...row.source?.picker, searchFields: row.pickerSearchFields?.length ? row.pickerSearchFields : undefined, recent: toCount(row.pickerRecent) });\n const display = clean({ ...row.source?.display, label: row.displayLabel || undefined, badge: row.displayBadge || undefined, extra: row.displayExtra || undefined });\n // Conditions on other attributes, which only a hand-written definition can carry, survive next to the one the form writes.\n const confirmSwitchWhen = clean({ ...row.source?.confirmSwitchWhen, [STATE_CONDITION]: row.confirmSwitchStates?.length ? row.confirmSwitchStates : undefined });\n return clean({\n ...row.source,\n name: row.name,\n entityName: row.entityName,\n parent: row.parent || undefined,\n basePath: row.basePath || undefined,\n persist: (row.persist || undefined) as WorkingContextPersistence | undefined,\n picker,\n display,\n confirmSwitchWhen,\n }) as WorkingContextDefinition;\n}\n\n/**\n * The picker's count as the contract wants it: a whole number, or nothing. The form holds what was typed, which is text\n * — and an empty box is \"not set\", not a count of zero.\n */\nfunction toCount(value: unknown): number | undefined {\n if (value === undefined || value === null || value === '') return undefined;\n const count = Number(value);\n return Number.isInteger(count) && count >= 0 ? count : undefined;\n}\n\n/** Drops `undefined` members, and an object left with none. */\nfunction clean<T extends object>(value: T): T | undefined {\n const entries = Object.entries(value).filter(([, member]) => member !== undefined);\n return entries.length === 0 ? undefined : (Object.fromEntries(entries) as T);\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityMapper } from '@processpuzzle/base-entity';\nimport { AppDefinition, AppDefinitionStatus, ColorScheme, LayoutDefinition, LayoutPreset, MaterialTheme, SidenavMode, ThemeDefinition } from './app-definition';\nimport { ModuleDefinitionMapper } from './module-definition.mapper';\nimport { flattenWorkingContext, nestWorkingContext } from './working-context-row.mapper';\nimport { flattenRouteTarget, nestRouteTarget, RouteDefinitionDto } from './route-definition.mapper';\n\ninterface AppDefinitionDto {\n id?: string;\n name?: string;\n translocoId?: string;\n description?: string;\n theme?: ThemeDefinition;\n layout?: LayoutDefinition;\n regions?: AppDefinition['regions'];\n routes?: RouteDefinitionDto[];\n modules?: AppDefinition['modules'];\n contexts?: Parameters<typeof flattenWorkingContext>[0][];\n /** `/layout` only. */\n mountedModules?: unknown[];\n orgKey?: string;\n status?: AppDefinitionStatus;\n version?: number;\n publishedVersion?: number;\n createdAt?: string;\n updatedAt?: string;\n}\n\n/** What `PUT /app-definitions/{appId}` receives: the DTO with `theme` and `layout` always rebuilt. */\ntype AppDefinitionPayload = AppDefinitionDto & { theme: ThemeDefinition; layout: LayoutDefinition };\n\n/**\n * Translates between the `AppDefinition` DTO of `base-app-api.yaml` and the flat entity the\n * generated form works with.\n *\n * Two invariants matter here. The form saves `{ ...entity, ...form.value }`, so every DTO field the\n * form does not show has to survive on the entity — `regions`, `routes` and `modules` are nested\n * rather than flattened for exactly that reason, and the `EMBEDDED_COMPONENTS` controls edit them in\n * place. And `PUT /app-definitions/{appId}` is a full replacement, so {@link toDto} rebuilds `theme`\n * and `layout` from the flattened controls *on top of* the objects they were lifted out of, which\n * keeps any field a later contract version adds before this mapper learns about it.\n *\n * A route's `target` is the third thing flattened, one level deeper: `regions` and `modules` rows\n * travel as the raw DTO they arrived as, but a route row cannot. That flattening lives in\n * `route-definition.mapper.ts` rather than here, because `ModuleDefinition.routes` carries the same\n * schema and a route authored in a module has to behave exactly like one authored in an app.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppDefinitionMapper implements BaseEntityMapper<AppDefinition> {\n private readonly moduleMapper = new ModuleDefinitionMapper();\n\n fromDto(dto: unknown): AppDefinition {\n const source = dto as AppDefinitionDto;\n const theme = source.theme;\n const layout = source.layout;\n return new AppDefinition({\n id: source.id,\n name: source.name,\n translocoId: source.translocoId,\n description: source.description,\n materialTheme: theme?.materialTheme as MaterialTheme | undefined,\n colorScheme: theme?.colorScheme as ColorScheme | undefined,\n tokenOverrides: theme?.tokenOverrides,\n logoUrl: theme?.logoUrl,\n faviconUrl: theme?.faviconUrl,\n preset: layout?.preset as LayoutPreset | undefined,\n sidenavMode: layout?.sidenavMode as SidenavMode | undefined,\n sidenavCollapsible: layout?.sidenavCollapsible,\n sidenavOpenByDefault: layout?.sidenavOpenByDefault,\n contentMaxWidth: layout?.contentMaxWidth,\n theme,\n layout,\n regions: source.regions,\n routes: source.routes?.map(flattenRouteTarget),\n modules: source.modules,\n contexts: source.contexts?.map(flattenWorkingContext),\n mountedModules: source.mountedModules?.map((module) => this.moduleMapper.fromDto(module)),\n orgKey: source.orgKey,\n status: source.status,\n version: source.version,\n publishedVersion: source.publishedVersion,\n createdAt: source.createdAt,\n updatedAt: source.updatedAt,\n });\n }\n\n toDto(entity: AppDefinition): AppDefinitionPayload {\n // Listed field by field rather than spread, so the flattened controls never reach the payload.\n return {\n id: entity.id,\n name: entity.name,\n translocoId: entity.translocoId,\n description: entity.description,\n theme: this.mergeTheme(entity),\n layout: this.mergeLayout(entity),\n regions: entity.regions,\n routes: entity.routes?.map(nestRouteTarget),\n modules: entity.modules,\n contexts: entity.contexts?.map(nestWorkingContext),\n orgKey: entity.orgKey,\n status: entity.status,\n version: entity.version,\n publishedVersion: entity.publishedVersion,\n createdAt: entity.createdAt,\n updatedAt: entity.updatedAt,\n };\n }\n\n private mergeTheme(entity: AppDefinition): ThemeDefinition {\n return {\n ...entity.theme,\n materialTheme: entity.materialTheme,\n colorScheme: entity.colorScheme,\n tokenOverrides: entity.tokenOverrides,\n logoUrl: entity.logoUrl,\n faviconUrl: entity.faviconUrl,\n };\n }\n\n private mergeLayout(entity: AppDefinition): LayoutDefinition {\n return {\n ...entity.layout,\n preset: entity.preset,\n sidenavMode: entity.sidenavMode,\n sidenavCollapsible: entity.sidenavCollapsible,\n sidenavOpenByDefault: entity.sidenavOpenByDefault,\n contentMaxWidth: entity.contentMaxWidth,\n };\n }\n}\n","import { HttpContext, HttpErrorResponse } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { catchError, map, Observable, of, throwError } from 'rxjs';\nimport { BaseEntityRestService, PersistedEntity } from '@processpuzzle/base-entity';\nimport { EXPECTED_ERROR_STATUSES } from '@processpuzzle/util';\nimport { AppDefinition } from './app-definition';\nimport { AppDefinitionMapper } from './app-definition.mapper';\n\n/**\n * REST access to `/organizations/{orgKey}/app-definitions`. As in base-rule, the organization is\n * part of the configured service root — `APP_SERVICE_ROOT`, the optional per-feature escape hatch,\n * falling back to `BACKEND_SERVICE_ROOT`, which is what every deployment actually sets — so the\n * tenant is a deployment concern rather than something every call has to carry.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppDefinitionService extends BaseEntityRestService<AppDefinition> {\n constructor(protected override entityMapper: AppDefinitionMapper) {\n super(entityMapper, 'APP_SERVICE_ROOT', 'app-definitions');\n }\n\n /**\n * `POST /app-definitions/{appId}/publish` — promotes the stored `version` to `publishedVersion` and\n * sets the status to `PUBLISHED`. The backend validates the definition first and answers 400 when it\n * is not publishable, so the caller only has to deal with the happy path and the error.\n */\n publish(id: string): Observable<PersistedEntity<AppDefinition>> {\n const pathParams = new Map<string, string>([['id', String(id)]]);\n const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}/publish', { pathParams });\n if (!fullUrl) throw new Error('Could not determine the full url');\n return this.httpClient.post(fullUrl, {}, { headers: this.headers }).pipe(map((response: unknown) => this.entityMapper.fromDto(response) as PersistedEntity<AppDefinition>));\n }\n\n /**\n * `GET /app-definitions/{appId}/layout` — the **published** revision, role-filtered, with its routes:\n * what the runtime host renders. `findById` is the designer's read and always returns the draft.\n *\n * Resolves to `undefined` while the application has never been published, which the backend answers\n * with 404. That is the state of every new organization, so it is not reported as an error.\n */\n findPublished(id: string): Observable<AppDefinition | undefined> {\n const pathParams = new Map<string, string>([['id', String(id)]]);\n const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}/layout', { pathParams });\n if (!fullUrl) throw new Error('Could not determine the full url');\n const context = new HttpContext().set(EXPECTED_ERROR_STATUSES, [404]);\n return this.httpClient.get(fullUrl, { headers: this.headers, context }).pipe(\n map((response: unknown) => this.entityMapper.fromDto(response) as AppDefinition),\n catchError((error: unknown) => (error instanceof HttpErrorResponse && error.status === 404 ? of(undefined) : throwError(() => error))),\n );\n }\n}\n","import { inject } from '@angular/core';\nimport { patchState, signalStore, signalStoreFeature, type, withMethods } from '@ngrx/signals';\nimport { withDevtools } from '@angular-architects/ngrx-toolkit';\nimport { BaseEntityContainerStore, BaseEntityStore, BaseEntityTabsStore, PersistedEntity } from '@processpuzzle/base-entity';\nimport { httpErrorMessage } from '@processpuzzle/util';\nimport { firstValueFrom } from 'rxjs';\nimport { AppDefinition } from './app-definition';\nimport { AppDefinitionService } from './app-definition.service';\n\n/** The slice of `BaseEntityStore`'s state that {@link AppDefinitionPublishStore} reads and patches. */\ntype PublishableState = {\n entities: AppDefinition[];\n currentEntity: AppDefinition | undefined;\n isLoading: boolean;\n error: string | undefined;\n};\n\n/**\n * Adds the `publish` use case on top of the generic CRUD store. It keeps the same contract as\n * `addEntity` / `updateEntity`: flip `isLoading`, replace the entity in the list with the server's\n * answer so the form's read-only `status` / `publishedVersion` fields refresh, and surface failures\n * through `error` rather than by throwing.\n */\nexport function AppDefinitionPublishStore() {\n return signalStoreFeature(\n { state: type<PublishableState>() },\n withMethods((store, service = inject(AppDefinitionService)) => ({\n publish: async (id: string): Promise<PersistedEntity<AppDefinition> | undefined> => {\n patchState(store, { isLoading: true, error: undefined });\n try {\n const publishedEntity = await firstValueFrom(service.publish(id));\n const entities = [...store.entities()];\n const indexToUpdate = entities.findIndex((entity) => entity.id === id);\n if (indexToUpdate >= 0) entities[indexToUpdate] = publishedEntity;\n const currentEntity = store.currentEntity()?.id === id ? publishedEntity : store.currentEntity();\n patchState(store, { entities, currentEntity, isLoading: false });\n return publishedEntity;\n } catch (error) {\n patchState(store, { error: httpErrorMessage(error), isLoading: false });\n return undefined;\n }\n },\n })),\n );\n}\n\nexport const AppDefinitionStore = signalStore(\n { providedIn: 'root' },\n BaseEntityStore<AppDefinition>(AppDefinition, () => inject(AppDefinitionService)),\n BaseEntityTabsStore(),\n BaseEntityContainerStore(),\n AppDefinitionPublishStore(),\n withDevtools('AppDefinition'),\n);\n","import { Injectable } from '@angular/core';\nimport { BaseEntityRestService } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from './module-definition';\nimport { ModuleDefinitionMapper } from './module-definition.mapper';\n\n/**\n * REST access to `/organizations/{orgKey}/modules`. As for `AppDefinitionService`, the organization is\n * part of the configured service root (`APP_SERVICE_ROOT`, falling back to `BACKEND_SERVICE_ROOT`), so\n * the tenant is a deployment concern rather\n * than something every call has to carry.\n *\n * The URL variable is the module key — `ModuleDefinitionMapper` maps it onto `id`, which is what the\n * inherited `findById` builds `GET .../modules/{moduleKey}` from. That single-module read is also the call\n * the shell makes when something first navigates under a mount; see `ModuleLoader` in\n * `app-route-builder.ts`.\n */\n@Injectable({ providedIn: 'root' })\nexport class ModuleDefinitionService extends BaseEntityRestService<ModuleDefinition> {\n constructor(protected override entityMapper: ModuleDefinitionMapper) {\n super(entityMapper, 'APP_SERVICE_ROOT', 'modules');\n }\n}\n","import { inject } from '@angular/core';\nimport { signalStore } from '@ngrx/signals';\nimport { withDevtools } from '@angular-architects/ngrx-toolkit';\nimport { BaseEntityContainerStore, BaseEntityStore, BaseEntityTabsStore } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from './module-definition';\nimport { ModuleDefinitionService } from './module-definition.service';\n\n/**\n * Plain generic CRUD — a module has no `publish` of its own. Publishing is an `AppDefinition` operation:\n * an app is what a user navigates to, and its status is what decides whether a mount is live. Giving a\n * module a second, independent lifecycle would make \"which version of what is live\" a question with two\n * answers.\n */\nexport const ModuleDefinitionStore = signalStore(\n { providedIn: 'root' },\n BaseEntityStore<ModuleDefinition>(ModuleDefinition, () => inject(ModuleDefinitionService)),\n BaseEntityTabsStore(),\n BaseEntityContainerStore(),\n withDevtools('ModuleDefinition'),\n);\n","import { inject, Injectable, Type } from '@angular/core';\nimport { BaseEntityDescriptor, BaseEntityFacade } from '@processpuzzle/base-entity';\nimport { AppDefinition } from '../domain/app-definition';\nimport { AppDefinitionMapper } from '../domain/app-definition.mapper';\nimport { AppDefinitionService } from '../domain/app-definition.service';\nimport { AppDefinitionStore } from '../domain/app-definition.store';\nimport { createAppDefinitionDescriptor } from '../domain/app-definition.descriptors';\n\n@Injectable()\nexport class AppDefinitionFacade extends BaseEntityFacade<AppDefinition> {\n readonly entityType = AppDefinition;\n\n private readonly mapperRef = inject(AppDefinitionMapper);\n private readonly serviceRef = inject(AppDefinitionService);\n\n protected override createMapper() {\n return this.mapperRef;\n }\n\n protected override createService() {\n return this.serviceRef;\n }\n\n protected override createStoreClass(): Type<unknown> {\n return AppDefinitionStore;\n }\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createAppDefinitionDescriptor();\n }\n}\n","import { inject, Injectable, Type } from '@angular/core';\nimport { BaseEntityDescriptor, BaseEntityFacade } from '@processpuzzle/base-entity';\nimport { ModuleDefinition } from '../domain/module-definition';\nimport { createModuleDefinitionDescriptor } from '../domain/module-definition.descriptors';\nimport { ModuleDefinitionMapper } from '../domain/module-definition.mapper';\nimport { ModuleDefinitionService } from '../domain/module-definition.service';\nimport { ModuleDefinitionStore } from '../domain/module-definition.store';\n\n@Injectable()\nexport class ModuleDefinitionFacade extends BaseEntityFacade<ModuleDefinition> {\n readonly entityType = ModuleDefinition;\n\n private readonly mapperRef = inject(ModuleDefinitionMapper);\n private readonly serviceRef = inject(ModuleDefinitionService);\n\n protected override createMapper() {\n return this.mapperRef;\n }\n\n protected override createService() {\n return this.serviceRef;\n }\n\n protected override createStoreClass(): Type<unknown> {\n return ModuleDefinitionStore;\n }\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createModuleDefinitionDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { ModuleMount } from '../domain/app-definition';\nimport { createModuleMountDescriptor } from '../domain/module-mount.descriptors';\n\n/**\n * A mount is a row of the `App Definition` document, so it is edited through that document — unlike the\n * `ModuleDefinition` it names, which is an aggregate of its own with its own endpoints.\n */\n@Injectable()\nexport class AppModuleMountFacade extends EmbeddedEntityFacade<ModuleMount> {\n readonly entityType = ModuleMount;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createModuleMountDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { NavItem } from '../domain/app-definition';\nimport { createNavItemDescriptor } from '../domain/nav-item.descriptors';\n\n/**\n * One facade covers every level of the nav tree, however deep: the store is a root singleton and the row\n * it stands for comes from the route, so `app-nav-item/a/details/app-nav-item/b/details` resolves through\n * the same facade as the top level.\n */\n@Injectable()\nexport class AppNavItemFacade extends EmbeddedEntityFacade<NavItem> {\n readonly entityType = NavItem;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createNavItemDescriptor();\n }\n}\n","import { EnvironmentProviders, Provider } from '@angular/core';\nimport { Route, Routes } from '@angular/router';\nimport { provideTranslocoScope, Translation } from '@jsverse/transloco';\nimport { ModuleMount, RouteDefinition } from '../domain/app-definition';\nimport { MODULE_ASSET_CONTEXT, ModuleAssetContext } from '@processpuzzle/widgets';\nimport { ModuleDefinition, moduleRouteTranslocoId, moduleTranslocoScope } from '../domain/module-definition';\nimport { BASE_APP_TRANSLOCO_SCOPE, BASE_ENTITY_TRANSLOCO_SCOPE } from '../base-app.i18n';\nimport { type EmbeddedChildRoute, workingContextRoutes, type WorkingContextAggregate } from '@processpuzzle/base-entity';\n\n/** What the builder needs to know of a context: its name, and the one it is nested in. */\nexport interface ContextRef {\n name: string;\n parent?: string;\n /** The context's entity type. With it, the context's route is the aggregate root of the embedded screens below it. */\n entityName?: string;\n /** What the entity is made of, for those screens; filled in by {@link buildAppRoutes} from `contextChildren`. */\n aggregate?: WorkingContextAggregate;\n}\n\n/** Route data naming the context a route requires; set by {@link emitNode}, read by {@link groupContextRoutes}. */\nconst REQUIRES_CONTEXT_DATA_KEY = 'requiresContext';\n\n/**\n * What the run-time shell registers routes from. `routes` and `modules` are the app definition's own\n * fields; the other two are how the routes of a mounted module get in.\n *\n * `moduleRoutes` holds the modules the shell already has, keyed by module key. `loadModule` is for the\n * ones it does not: a mount whose key is absent from `moduleRoutes` becomes a `loadChildren` that calls\n * it on first navigation into the mount. With neither, such a mount contributes nothing — a mount naming\n * a module that has not been authored is a warning rather than an error.\n *\n * A key present in `moduleRoutes` is never loaded again, so an empty array there says \"this module has no\n * routes\" and is honoured as such.\n *\n * `loadTranslations` is where a lazily mounted module's own translations come from; without it the module's\n * scope is registered with the application's default loader alone.\n */\nexport interface AppRouteSource {\n routes?: RouteDefinition[];\n modules?: ModuleMount[];\n /** The app's working contexts. A route naming one is served below `ctx/<name>/:id/`; see {@link groupContextRoutes}. */\n contexts?: ContextRef[];\n /**\n * The embedded children of an entity type, as its own details route mounts them. Asked once per context that names an\n * entity: the rows of those children open as screens below the context's route, saved through the item endpoints.\n */\n contextChildren?: (entityName: string) => EmbeddedChildRoute[] | Promise<EmbeddedChildRoute[]>;\n moduleRoutes?: Record<string, RouteDefinition[] | undefined>;\n loadModule?: ModuleLoader;\n loadTranslations?: ModuleTranslationLoader;\n /** The assets of a module, by key, for the widgets below its mount; without it a `module:` value resolves to nothing. */\n moduleAssets?: (moduleKey: string) => ModuleAssetContext;\n}\n\n/**\n * Fetches the translations of one module and language. `languages` — read when the module loads, so it may be\n * a getter — is what the module's scope is registered\n * for: transloco enumerates an inline loader's languages when the scope is registered, so a loader that\n * answers any language still has to name the ones it answers.\n */\nexport interface ModuleTranslationLoader {\n readonly languages: string[];\n load(moduleKey: string, scope: string, locale: string): Promise<Translation>;\n}\n\n/**\n * Fetches one module by key, or resolves to `undefined` if the organization has no such module. Rejecting\n * is a navigation error; resolving to `undefined` is the loose coupling the contract asks for.\n */\nexport type ModuleLoader = (moduleKey: string) => Promise<ModuleDefinition | undefined>;\n\n/**\n * Turns one authored route into the `Route` that renders it — component or `loadComponent`, `title`,\n * `data`, and any `canMatch` guard the definition's `roles` call for. `path` is {@link buildAppRoutes}'\n * to set; `children` it may contribute, and the authored ones are appended to them.\n *\n * May be asynchronous. An `ENTITY` route's screens are built from a `BaseEntityDescriptor` that has to be\n * *fetched* when the entity exists only as metadata, and the routes below it depend on what that\n * descriptor turns out to contain — which embedded children it carries. Making the renderer async is what\n * lets a route be emitted complete or not at all; the alternative, a guard that fills `children` in on the\n * way past, has no way to signal failure other than leaving the route matching nothing.\n */\nexport type RouteRenderer = (definition: RouteDefinition) => Route | Promise<Route>;\n\ninterface TrieNode {\n segment: string;\n definition?: RouteDefinition;\n children: TrieNode[];\n}\n\n/**\n * Derives Angular's nested `Routes` from the flat route list of an `AppDefinition`.\n *\n * Nesting is computed here rather than authored, which is the whole point of keeping\n * {@link RouteDefinition} flat: `claims`, `claims/open` and `claims/:id` are three sibling rows a\n * designer can reorder, rename and reason about one at a time, and it is only at registration that\n * they become a parent with two children. Two rules produce that shape:\n *\n * - **An authored route that is a prefix of others becomes their parent.** So `claims` stays mounted\n * while `claims/open` renders in its `<router-outlet>` — which is the one thing a flat registration\n * could not express, and the reason this function exists at all. A component rendering a route that\n * has children therefore has to host an outlet.\n * - **A prefix nothing authored stays part of the path.** With only `claims/open` and `claims/closed`\n * declared, no synthetic `claims` parent is invented: the two are emitted with their full paths, since\n * a component-less grouping node would change nothing about what matches or what renders.\n *\n * Modules mount as a parent of their own at {@link ModuleMount.basePath}, component-less because a mount\n * is a prefix rather than a screen. That is the single composition point, and it composes one level: the\n * routes of a mounted module are built by the same two rules, and a module mounts no modules. A module the\n * shell already has is emitted now; one it has not is emitted as `loadChildren` — see {@link lazyMount}.\n *\n * Siblings are ordered static-prefix-first, so `claims/new` is matched before `claims/:id` rather than\n * swallowed by it. Beyond that the authored order is kept, and a duplicate path — which the backend\n * rejects as an error, so it should never arrive — keeps its first occurrence.\n */\nexport async function buildAppRoutes(source: AppRouteSource, renderRoute: RouteRenderer): Promise<Routes> {\n const contexts = await withAggregates(source);\n const appRoutes = await emitLevel(trieOf(source.routes), [], renderRoute, contexts);\n return [...appRoutes, ...(await moduleRoutesOf(source, renderRoute, contexts))];\n}\n\n/** The contexts, each with the embedded children of its entity — what the screens below the context's route are mounted from. */\nasync function withAggregates(source: AppRouteSource): Promise<ContextRef[]> {\n return Promise.all(\n (source.contexts ?? []).map(async (context) => {\n if (!context.entityName) return context;\n const embeddedChildren = (await source.contextChildren?.(context.entityName)) ?? [];\n return { ...context, aggregate: { entityName: context.entityName, embeddedChildren } };\n }),\n );\n}\n\nasync function moduleRoutesOf(source: AppRouteSource, renderRoute: RouteRenderer, contexts: ContextRef[]): Promise<Routes> {\n const mounted: Routes = [];\n for (const mount of source.modules ?? []) {\n if (!mount.basePath) continue;\n const routes = source.moduleRoutes?.[mount.moduleKey];\n if (routes) {\n if (routes.length) mounted.push({ path: mount.basePath, children: await emitLevel(trieOf(routes), [], renderRoute, contexts) });\n } else if (source.loadModule) {\n mounted.push(lazyMount(mount.moduleKey, mount.basePath, source.loadModule, renderRoute, source.loadTranslations, source.moduleAssets, contexts));\n }\n }\n return mounted;\n}\n\n/**\n * A mount whose module the shell has not got yet: the same component-less parent at the base path, with\n * its children resolved on first navigation into it instead of now.\n *\n * What is deferred is the *metadata* — one `GET /modules/{key}` per module the user actually visits, so an\n * app that mounts twenty modules does not fetch twenty definitions to show its first screen. It is not a\n * deferred *bundle*: the widgets a module's routes render come from the widget registry and are part of\n * the application's own build either way.\n *\n * The module's transloco scope is registered here, on a component-less wrapper inside the loaded children,\n * because that is the first moment its name is known — the default is the module key, but a module may\n * name its own. The alias is spelled out, as everywhere in this workspace: transloco would otherwise\n * camel-case it and miss every key below it.\n *\n * The module's assets reach its widgets the same way, as the {@link MODULE_ASSET_CONTEXT} of the wrapper: a widget\n * property saying `module:docs/welcome.md` is looked up among *this* module's files.\n *\n * The module's own translations — what a user uploaded from the files the Module form prepares — are the scope's\n * *inline loader*, so they load with the module and not before it. Every route title is translated under a key\n * as well, the authored `translocoId` or the one derived from the scope and path (see\n * {@link moduleRouteTranslocoId}), which is what lets an upload translate a title whose designer typed no key.\n *\n * The framework scopes are re-registered alongside it, for the reason `BASE_APP_ROUTES.authoringScopes()`\n * gives: a route that declares TRANSLOCO_SCOPE *replaces* the collection it inherits rather than adding to\n * it, because Angular does not merge `multi` providers across injectors. A module's routes render the same\n * generic screens as everything else — an ENTITY route reaches `BaseEntityTabsComponent`, which translates\n * `base_entity.tabs.*` — so naming only the module's scope here would leave every framework label below the\n * mount unresolved.\n */\nfunction lazyMount(\n moduleKey: string,\n basePath: string,\n loadModule: ModuleLoader,\n renderRoute: RouteRenderer,\n translations?: ModuleTranslationLoader,\n assets?: (moduleKey: string) => ModuleAssetContext,\n contexts: ContextRef[] = [],\n): Route {\n return {\n path: basePath,\n loadChildren: async () => {\n const definition = await loadModule(moduleKey);\n if (!definition) return [];\n const scope = moduleTranslocoScope(definition);\n // Every title is translated under a key from here on, authored or derived, so that a module whose\n // designer never typed a `translocoId` can still be translated from the files it downloads.\n const routes = definition.routes?.map((route) => ({ ...route, translocoId: moduleRouteTranslocoId(scope, route) }));\n const children = await emitLevel(trieOf(routes), [], renderRoute, contexts);\n if (!children.length) return [];\n const providers: Array<Provider | EnvironmentProviders> = [\n provideTranslocoScope(\n { scope, alias: scope, ...(translations && { loader: inlineLoaderOf(translations, moduleKey, scope) }) },\n { scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE },\n { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE },\n ),\n ];\n // Provided on the wrapper, so every widget below the mount finds the assets of *this* module, and a widget\n // rendered anywhere else finds none.\n if (assets) providers.push({ provide: MODULE_ASSET_CONTEXT, useValue: assets(moduleKey) });\n return [{ path: '', providers, children }];\n },\n };\n}\n\n/** One `() => Promise<Translation>` per language, which is the shape transloco's inline loader takes. */\nfunction inlineLoaderOf(translations: ModuleTranslationLoader, moduleKey: string, scope: string): Record<string, () => Promise<Translation>> {\n return Object.fromEntries(translations.languages.map((locale) => [locale, () => translations.load(moduleKey, scope, locale)]));\n}\n\n/** The authored paths as a trie, so a route that is a prefix of another can be recognized as its parent. */\nfunction trieOf(routes: RouteDefinition[] | undefined): TrieNode[] {\n const roots: TrieNode[] = [];\n for (const definition of routes ?? []) {\n const segments = segmentsOf(definition.path);\n if (!segments.length) continue;\n let level = roots;\n let node: TrieNode = { segment: '', children: roots };\n for (const segment of segments) {\n const existing = level.find((candidate) => candidate.segment === segment);\n node = existing ?? { segment, children: [] };\n if (!existing) level.push(node);\n level = node.children;\n }\n // First occurrence wins: a duplicate path is a validation error server-side, so the only way to see\n // one here is a definition that bypassed validation, and dropping the later row is the harmless read.\n node.definition ??= definition;\n }\n return roots;\n}\n\n/**\n * The routes of one level. An authored node becomes a `Route` whose children are emitted below it; an\n * unauthored one contributes its segment to the paths of its descendants instead of a route of its own.\n */\nasync function emitLevel(nodes: TrieNode[], prefix: string[], renderRoute: RouteRenderer, contexts: ContextRef[]): Promise<Routes> {\n const routes = (await Promise.all(nodes.map((node) => emitNode(node, prefix, renderRoute, contexts)))).flat();\n return groupContextRoutes(\n routes.sort((left, right) => staticDepthOf(right.path) - staticDepthOf(left.path)),\n contexts,\n );\n}\n\n/**\n * Moves the routes that require a working context below it. `workingContextRoutes` mounts the views of one\n * context twice — `ctx/<name>/:id/<view>` with the entity resolved, and `ctx/<name>/<view>` as the empty state\n * with the picker — so the authored path of a route becomes its path *inside* the context.\n *\n * A context nested in another (`parent`) is grouped inside its parent's, whose own group is created even when\n * no route names the parent directly: `ctx/race/:id/ctx/heat/:id/scores`. A route whose context the app does\n * not declare is grouped all the same, and shows an empty state with nothing to pick — the backend rejects\n * such a definition, so the only way to see it is one that bypassed validation.\n *\n * Context routes come first: they begin with a static `ctx` segment, and a parameterized sibling must not\n * shadow them.\n */\nfunction groupContextRoutes(routes: Routes, contexts: ContextRef[]): Routes {\n const bound = routes.filter((route) => contextOf(route) !== undefined);\n if (bound.length === 0) return routes;\n\n const own = new Map<string, Routes>();\n for (const route of bound) own.set(contextOf(route) as string, [...(own.get(contextOf(route) as string) ?? []), route]);\n\n const parentOf = (name: string) => contexts.find((context) => context.name === name && context.parent && contexts.some((candidate) => candidate.name === context.parent))?.parent;\n const names = new Set(own.keys());\n for (const name of [...names]) for (let parent = parentOf(name); parent && !names.has(parent); parent = parentOf(parent)) names.add(parent);\n\n const build = (name: string): Routes =>\n workingContextRoutes(name, [...(own.get(name) ?? []), ...[...names].filter((child) => parentOf(child) === name).flatMap(build)], contexts.find((context) => context.name === name)?.aggregate);\n const roots = [...names].filter((name) => parentOf(name) === undefined);\n return [...roots.flatMap(build), ...routes.filter((route) => contextOf(route) === undefined)];\n}\n\nfunction contextOf(route: Route): string | undefined {\n const name = route.data?.[REQUIRES_CONTEXT_DATA_KEY];\n return typeof name === 'string' && name.length > 0 ? name : undefined;\n}\n\nasync function emitNode(node: TrieNode, prefix: string[], renderRoute: RouteRenderer, contexts: ContextRef[]): Promise<Routes> {\n const path = [...prefix, node.segment];\n if (!node.definition) return (await Promise.all(node.children.map((child) => emitNode(child, path, renderRoute, contexts)))).flat();\n\n const authoredChildren = await emitLevel(node.children, [], renderRoute, contexts);\n const rendered = await renderRoute(node.definition);\n const route: Route = { ...rendered, path: path.join('/') };\n if (node.definition.requiresContext) route.data = { ...rendered.data, [REQUIRES_CONTEXT_DATA_KEY]: node.definition.requiresContext };\n // The renderer's own children come first and the authored ones after, rather than the authored ones\n // replacing them. An `ENTITY` route contributes the List and Details routes of its entity *and* may be\n // the path prefix of other authored routes; overwriting would silently drop whichever of the two the\n // builder happened not to know about. The renderer's include an empty-path redirect, which `pathMatch:\n // 'full'` confines to the prefix's own URL, so it cannot shadow an authored sibling.\n const children = [...(rendered.children ?? []), ...authoredChildren];\n if (children.length) route.children = children;\n return [route];\n}\n\nfunction segmentsOf(path: string | undefined): string[] {\n return (path ?? '').split('/').filter((segment) => segment.length > 0);\n}\n\n/**\n * How many leading segments of a path are static. Sorting by it descending is what keeps a parameterized\n * route from shadowing its static siblings: `claims/new` scores 2, `claims/:id` scores 1, and Angular\n * matches in the order given.\n */\nfunction staticDepthOf(path: string | undefined): number {\n const segments = segmentsOf(path);\n const firstParameter = segments.findIndex((segment) => segment.startsWith(':') || segment === '**');\n return firstParameter === -1 ? segments.length : firstParameter;\n}\n","import { Component, computed, input } from '@angular/core';\nimport { WidgetHostComponent, WidgetInstance, WidgetPlacement } from '@processpuzzle/widgets';\n\n/** The widgets rendered in sequence — every one but those a container widget places by id. */\nexport function standaloneWidgets(widgets: WidgetInstance[] | undefined): WidgetInstance[] {\n return (widgets ?? []).filter((widget) => widget.placement !== WidgetPlacement.REFERENCED);\n}\n\n/**\n * Renders the top-level widgets shared by routed content and static shell regions, each through\n * base-widget's {@link WidgetHostComponent} — which resolves the component, binds the props and shows a\n * placeholder for a type the application did not register. This component only decides *which* widgets\n * render here, and in what order.\n *\n * base-app passes no binding resolver: a page or region declares no ports for `inputBindings` to resolve\n * against, so a placement here is configured by its props alone.\n */\n@Component({\n selector: 'pp-widget-list',\n standalone: true,\n imports: [WidgetHostComponent],\n template: `\n @for (widget of rows(); track widget.id) {\n <pp-widget-host [widget]=\"widget\" />\n }\n `,\n})\nexport class WidgetListComponent {\n readonly widgets = input<WidgetInstance[]>([]);\n\n protected readonly rows = computed(() => standaloneWidgets(this.widgets()));\n}\n","import { Component, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { WidgetInstance } from '@processpuzzle/widgets';\nimport { WidgetListComponent } from './widget-list.component';\n\n/**\n * Renders a route whose kind is WIDGETS: every STANDALONE instance in order, each through base-widget's\n * WidgetHostComponent. REFERENCED instances are skipped here for the same reason\n * DocumentEditorComponent skips them at its top level — they're placed by whichever STANDALONE\n * container widget names them in props.childIds, not by this component.\n *\n * Delegates the common widget rendering rule to WidgetListComponent, which is also used by the\n * header and footer regions in the application preview.\n */\n@Component({\n selector: 'pp-route-widgets',\n standalone: true,\n imports: [WidgetListComponent],\n template: `<pp-widget-list [widgets]=\"widgets\" />`,\n})\nexport class RouteWidgetsComponent {\n private readonly route = inject(ActivatedRoute);\n\n protected readonly widgets = (this.route.snapshot.data['widgets'] as WidgetInstance[] | undefined) ?? [];\n}\n","import { Component, computed, inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\n\n/**\n * Fallback rendered by {@link AppRouteRenderer} for a route kind it doesn't yet know how to build a\n * real component for (today: DOCUMENT, and any kind value the frontend doesn't recognize). Exists so\n * an unfinished part of the shell fails visibly and specifically at the one route that hits it,\n * rather than throwing during route registration and taking the whole app down, or — worse — silently\n * rendering nothing and leaving a designer to wonder why their route is blank.\n *\n * Not an error state: an app definition is allowed to reference a route kind the frontend hasn't\n * caught up to yet, same spirit as a NavItem naming a route that hasn't been authored being a warning\n * rather than a validation failure elsewhere in this library.\n */\n@Component({\n selector: 'pp-route-unsupported',\n standalone: true,\n template: `<p class=\"pp-route-unsupported\">{{ reason() }}</p>`,\n})\nexport class RouteUnsupportedComponent {\n private readonly route = inject(ActivatedRoute);\n\n protected readonly reason = computed(() => (this.route.snapshot.data['reason'] as string) ?? 'This route is not yet supported.');\n}\n","import { inject, Injectable } from '@angular/core';\nimport { ResolveFn, Route } from '@angular/router';\nimport { TranslocoService } from '@jsverse/transloco';\nimport {\n CONTEXT_COLLECTION_CONTEXT_KEY,\n CONTEXT_COLLECTION_ENTITY_KEY,\n CONTEXT_COLLECTION_PATH_KEY,\n ContextCollectionComponent,\n entityScreenRoute,\n EntityScreenResolver,\n translateLabel,\n} from '@processpuzzle/base-entity';\nimport { RouteDefinition } from '../domain/app-definition';\nimport { RouteWidgetsComponent } from './route-widgets.component';\nimport { RouteUnsupportedComponent } from './route-unsupported.component';\n\n/**\n * The route's `title`, preferring `translocoId` over the authored literal where the key resolves.\n *\n * A `ResolveFn` rather than a plain string because a title is resolved per navigation, which is late\n * enough for a lazily-loaded module scope to have arrived — the string form is captured when the route is\n * built, before the scope that owns the key is registered. `translateLabel` falls back to the literal, so\n * a route whose scope is absent or whose key is missing keeps the authored title.\n */\nfunction titleOf(definition: RouteDefinition): ResolveFn<string> {\n return () => translateLabel(inject(TranslocoService), definition.translocoId, definition.title);\n}\n\n/**\n * The `RouteRenderer` {@link buildAppRoutes} needs — turns one authored `RouteDefinition` into the\n * `Route` that actually renders it. Owns `component`, `data` and any `children` the kind calls for; `path`\n * is `buildAppRoutes`' to set, and the routes authored *below* this one are appended to whatever children\n * this contributes.\n *\n * A separate injectable rather than a free function because it is the one piece Preview and the eventual\n * production shell must call identically — same reasoning as `buildAppRoutes` itself being free of any\n * component.\n *\n * `roles` -> `canMatch` is deliberately not set here yet — see the note on this design's own deferral of\n * that question. `kind: DOCUMENT` is deliberately unhandled too: `BaseDocumentContainerComponent` is an\n * authoring component wired to one document via an injected store, not something parameterizable by a\n * route's `documentSlug` at runtime. Rendering a document read-only inside a live app is its own small\n * design question and this falls through to {@link RouteUnsupportedComponent} rather than guessing.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppRouteRenderer {\n private readonly entityScreens = inject(EntityScreenResolver);\n\n render = async (definition: RouteDefinition): Promise<Route> => {\n switch (definition.kind) {\n case 'WIDGETS':\n return { component: RouteWidgetsComponent, title: titleOf(definition), data: { widgets: definition.widgets } };\n case 'ENTITY':\n return this.entityRoute(definition);\n case 'DOCUMENT':\n return {\n component: RouteUnsupportedComponent,\n title: titleOf(definition),\n data: { reason: `DOCUMENT routes are not yet supported (route '${definition.path}')` },\n };\n default:\n return {\n component: RouteUnsupportedComponent,\n title: titleOf(definition),\n data: { reason: `Unknown route kind '${String(definition.kind)}' (route '${definition.path}')` },\n };\n }\n };\n\n /**\n * An `ENTITY` route: base-entity's generated screens, mounted at the authored path.\n *\n * Both halves belong to base-entity and are called rather than reimplemented here: `EntityScreenResolver`\n * answers for an entity with a compile-time facade and for one that exists only as a `BaseEntityDefinition`\n * alike, and `entityScreenRoute` owns the URL shape those screens need. What is left is exactly the\n * *application definition* concern — when the routes are built, the authored title, and the authored\n * `entityMode` / `rsqlFilter`.\n *\n * The descriptor is resolved **before** the route exists, which is what makes the route either complete or\n * a leaf. An entity nothing answers to keeps the leaf, whose component says so at the URL the nav item\n * links to; a legitimate state, since an `AppDefinition` may name an entity that has been renamed or one\n * whose definitions this deployment's backend does not serve.\n *\n * `entityMode` is passed along but not applied. A `DETAILS` route lands on the list, from which the row is\n * one click away: making it open a form directly means carrying the authored route's own `:id` into the\n * child URL, and the `RedirectFunction` that would do it receives a *partial* route snapshot whose\n * parameter inheritance at recognition time is not something to bet a navigation on. Deferred with `roles`\n * and `rsqlFilter` rather than guessed at.\n */\n private async entityRoute(definition: RouteDefinition): Promise<Route> {\n // A collection of the active context's entity is its own screen: it reads and writes through the item-level\n // endpoints of that entity, which the generic list and form — bound to an entity type of their own — cannot do.\n if (definition.requiresContext && definition.contextPath && definition.entityName) {\n return {\n component: ContextCollectionComponent,\n title: titleOf(definition),\n data: {\n [CONTEXT_COLLECTION_CONTEXT_KEY]: definition.requiresContext,\n [CONTEXT_COLLECTION_PATH_KEY]: definition.contextPath,\n [CONTEXT_COLLECTION_ENTITY_KEY]: definition.entityName,\n },\n };\n }\n\n const screens = await this.entityScreens.resolve(definition.entityName);\n const route = entityScreenRoute({\n entityName: definition.entityName,\n screens,\n hostPath: definition.path,\n data: { entityMode: definition.entityMode, rsqlFilter: definition.rsqlFilter, filterByContext: definition.filterByContext },\n });\n\n return { ...route, title: titleOf(definition) };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { RegionDefinition } from '../domain/app-definition';\nimport { createRegionDefinitionDescriptor } from '../domain/region-definition.descriptors';\n\n/**\n * A region has a facade like any other entity — that is what gives it a store, and so a working list and\n * form. Its repository reads and writes the `App Definition` document instead of an endpoint of its own,\n * because the contract nests `regions` inside that document.\n */\n@Injectable()\nexport class AppRegionFacade extends EmbeddedEntityFacade<RegionDefinition> {\n readonly entityType = RegionDefinition;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createRegionDefinitionDescriptor();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { RouteDefinition } from '../domain/app-definition';\nimport { createRouteDefinitionDescriptor } from '../domain/route-definition.descriptors';\n\n/**\n * `GET .../app-definitions/{appId}/layout` is a read-only projection for the run-time shell, not a write\n * endpoint — a route is authored inside the `App Definition` document, so its store goes through that\n * document like every other embedded child of the graph.\n */\n@Injectable()\nexport class AppRouteFacade extends EmbeddedEntityFacade<RouteDefinition> {\n readonly entityType = RouteDefinition;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createRouteDefinitionDescriptor();\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { WIDGET_REGISTRY, WidgetRegistration } from '@processpuzzle/widgets';\nimport { WidgetInstance } from '../domain/app-definition';\nimport { createWidgetInstanceDescriptor, widgetTypeSelectables } from '../domain/widget-instance.descriptors';\n\n/**\n * A widget sits under a region, a page or another widget, and one facade serves all three: which owner's\n * rows its store reads is decided by the route that is open, not by the facade.\n *\n * The `type` dropdown lists the registry this facade's injector sees — widgets registered only in a lazily\n * loaded route below it are not offered, the same limit the props control has.\n */\n@Injectable()\nexport class AppWidgetFacade extends EmbeddedEntityFacade<WidgetInstance> {\n readonly entityType = WidgetInstance;\n private readonly widgetRegistry = inject(WIDGET_REGISTRY, { optional: true }) ?? new Map<string, WidgetRegistration>();\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createWidgetInstanceDescriptor(widgetTypeSelectables(this.widgetRegistry));\n }\n}\n","import { ThemeSelection } from '@processpuzzle/widgets';\nimport { AppDefinition, LayoutPreset, SidenavMode } from '../../domain/app-definition';\n\n/**\n * The layout decisions {@link AppShellComponent} renders from, resolved out of an `AppDefinition`'s\n * `layout` fields with every default already applied — so the template reads values rather than\n * spelling out fallbacks, and every default is asserted in one spec instead of being implied by a\n * `??` in markup.\n *\n * A plain function rather than a service for the same reason `buildAppRoutes` is one: nothing here\n * needs injection, and a pure derivation is testable without a `TestBed`.\n */\nexport interface ResolvedLayout {\n preset: LayoutPreset;\n /**\n * Always resolved, even for `top-nav` where it is meaningless — {@link hasSidenav} is what says\n * whether a sidenav is rendered at all. Leaving it undefined there would only push a `?? 'side'`\n * into the template that no definition can ever reach, since `hasSidenav` already implies a mode.\n */\n sidenavMode: SidenavMode;\n /** `end` for `sidenav-right`, `start` otherwise — the values `matSidenav`'s `position` takes. */\n sidenavPosition: 'start' | 'end';\n /** Whether the shell renders a sidenav at all. False for `top-nav`. */\n hasSidenav: boolean;\n sidenavOpened: boolean;\n sidenavCollapsible: boolean;\n /** Undefined means unconstrained, which is what an absent `contentMaxWidth` asks for. */\n contentMaxWidth?: string;\n}\n\n/**\n * `sidenav-left` because a definition that declares no preset is the common case — a freshly created\n * app — and the framework's own screens are left-sidenav. The same value the contract documents as\n * its default.\n */\nconst DEFAULT_PRESET: LayoutPreset = 'sidenav-left';\n\n/** Matches the contract's default and Material's own, so an unset value behaves as `mat-sidenav` does. */\nconst DEFAULT_SIDENAV_MODE: SidenavMode = 'side';\n\n/**\n * Resolves the layout of one definition.\n *\n * Each field is read from the flattened property first and from `layout` second. For an entity that\n * came through {@link AppDefinitionMapper} the two always agree — `fromDto` copies `layout.preset`\n * onto `preset`, and `toDto` merges the flattened value back — so the fallback is there for the\n * definitions nothing mapped: `new AppDefinition({ layout: { preset: 'top-nav' } })` is a legal\n * construction that leaves `preset` undefined, and a shell that ignored `layout` would silently\n * render the default instead.\n *\n * `sidenavCollapsible` and `sidenavOpenByDefault` need no such fallback: they are non-optional on the\n * entity and the constructor defaults them, so there is always a value to read.\n */\nexport function layoutOf(definition: AppDefinition | undefined): ResolvedLayout {\n const preset = definition?.preset ?? definition?.layout?.preset ?? DEFAULT_PRESET;\n\n return {\n preset,\n sidenavMode: definition?.sidenavMode ?? definition?.layout?.sidenavMode ?? DEFAULT_SIDENAV_MODE,\n sidenavPosition: preset === 'sidenav-right' ? 'end' : 'start',\n hasSidenav: preset !== 'top-nav',\n sidenavOpened: definition?.sidenavOpenByDefault ?? true,\n sidenavCollapsible: definition?.sidenavCollapsible ?? true,\n contentMaxWidth: definition?.contentMaxWidth ?? definition?.layout?.contentMaxWidth,\n };\n}\n\n/**\n * The `--pp-*` overrides of one definition, as a style object to bind on the shell's host element.\n *\n * Custom properties cascade, so setting them on one element re-tints every framework surface below it\n * — which is what makes a themed preview possible at all without an iframe. `materialTheme` and\n * `colorScheme` are not handled here but by {@link themeDefaultsOf} and the shell's `ThemeService`, as\n * classes on the same element.\n *\n * Keys are passed through untouched, including their leading `--`: Angular's `[style]` binding treats\n * a custom property as a custom property, and the contract calls these overrides of the tokens in\n * `pp-colors.css`, so anything else would be this function inventing a naming rule.\n */\nexport function themeVarsOf(definition: AppDefinition | undefined): Record<string, string> {\n // The nested object first, so an override the form actually edited wins over the one the server sent.\n return { ...definition?.theme?.tokenOverrides, ...definition?.tokenOverrides };\n}\n\n/**\n * The route paths this definition accounts for: its own routes' paths, plus the base path of every module\n * it mounts.\n *\n * A module's *own* routes are deliberately absent. They live in the module's definition, which the router\n * fetches only when something navigates into the mount, so they cannot be known here — which is why the\n * consumer of this list treats a path *below* a known one as accounted for. See `toNavRows`.\n */\nexport function knownRoutePathsOf(definition: AppDefinition | undefined): string[] {\n const declared = (definition?.routes ?? []).map((route) => route.path);\n const mounted = (definition?.modules ?? []).map((mount) => mount.basePath);\n return [...declared, ...mounted].filter((path): path is string => !!path);\n}\n\n/**\n * The theme preset and colour scheme a definition declares, as the defaults of the shell's `ThemeService` —\n * which a user's choice in a `ThemesButton` overrides, and which fall back to the ProcessPuzzle look, light,\n * for whatever the definition leaves unset. Those fallbacks are the contract's defaults too, so the server\n * fills the same values in on save.\n */\n/** The path without surrounding slashes. A loop rather than a regular expression: those backtrack on long runs of slashes. */\nexport function trimSlashes(path: string): string {\n let start = 0;\n let end = path.length;\n while (start < end && path[start] === '/') start++;\n while (end > start && path[end - 1] === '/') end--;\n return path.slice(start, end);\n}\n\n/**\n * A route that requires a working context, by where the shell serves it: `base` is the module mount's path (empty\n * for the app's own routes), `path` the route's own. Its pages live at `<base>/ctx/<context>/[<id>/]<path>`.\n */\nexport interface ContextLink {\n base: string;\n path: string;\n context: string;\n}\n\n/** The routes of the app and of its mounted modules that name a context. The modules are the ones the layout carried. */\nexport function contextLinksOf(definition: AppDefinition | undefined): ContextLink[] {\n const own = (definition?.routes ?? []).filter((route) => route.requiresContext).map((route) => ({ base: '', path: route.path, context: route.requiresContext as string }));\n const mounted = (definition?.modules ?? []).flatMap((mount) => {\n const module = definition?.mountedModules?.find((candidate) => candidate.id === mount.moduleKey);\n return (module?.routes ?? []).filter((route) => route.requiresContext).map((route) => ({ base: mount.basePath, path: route.path, context: route.requiresContext as string }));\n });\n return [...own, ...mounted].filter((link) => !!link.path);\n}\n\n/**\n * Where a nav entry's `routePath` leads when the route it names is bound to a context: into the context with the\n * entity that is active now, or — with none — to the page's empty state, which restores the last one.\n * `activeIds` maps a context name to its active entity's id.\n */\nexport function resolveContextLink(routePath: string, links: ContextLink[], activeIds: Record<string, string | undefined>): string {\n for (const { base, path, context } of links) {\n const full = [base, path].filter(Boolean).join('/');\n if (routePath !== full && !routePath.startsWith(full + '/')) continue;\n const id = activeIds[context];\n return [base, 'ctx', context, id, path, routePath.slice(full.length + 1)].filter(Boolean).join('/');\n }\n return routePath;\n}\n\nexport function themeDefaultsOf(definition: AppDefinition | undefined): Partial<ThemeSelection> {\n const preset = definition?.materialTheme ?? definition?.theme?.materialTheme;\n const scheme = definition?.colorScheme ?? definition?.theme?.colorScheme;\n return { ...(preset ? { preset } : {}), ...(scheme ? { scheme } : {}) };\n}\n","import { Component, input } from '@angular/core';\nimport { WidgetInstance } from '@processpuzzle/widgets';\nimport { WidgetListComponent } from '../widget-list.component';\n\n/**\n * The `footer` region: the widgets it declares, and nothing else. The contract gives a footer no field\n * beyond `widgets`, so this stays a thin styled host over {@link WidgetListComponent} — separate from\n * the header only because the two are different slots with different styling, not because they share\n * no logic.\n */\n@Component({\n selector: 'pp-region-footer',\n standalone: true,\n imports: [WidgetListComponent],\n template: `<pp-widget-list [widgets]=\"widgets()\" />`,\n styles: [\n `\n :host {\n align-items: center;\n background-color: var(--pp-surface-header);\n color: var(--pp-on-header);\n display: flex;\n gap: 16px;\n justify-content: space-between;\n padding: 8px 16px;\n }\n /* Beside one another, as in the header — see the note there on why the list stays unopinionated. */\n pp-widget-list {\n align-items: center;\n display: flex;\n gap: 8px;\n }\n `,\n ],\n})\nexport class RegionFooterComponent {\n readonly widgets = input<WidgetInstance[]>([]);\n}\n","import { Component, input } from '@angular/core';\nimport { WidgetInstance } from '@processpuzzle/widgets';\nimport { WidgetListComponent } from '../widget-list.component';\n\n/**\n * The `header` region: the widgets the region declares, laid out in one row.\n *\n * The brand is widgets too — `app-logo` and `app-title` — which read the application's name and logo from\n * the shell's `APPLICATION_CONTEXT`. So a designer orders, omits or restyles them like any other widget, and\n * the header has no second, built-in way of showing the same thing. `--pp-app-title-color` is set to the\n * on-header colour here, so the title stays legible on the header surface whatever the theme.\n *\n * Nav items are *not* handled here. Under the `top-nav` preset the shell places the `sidenav` region's\n * nav beside this component in the same row, so that a `top-nav` app with no header region is still\n * navigable — see {@link AppShellComponent}.\n */\n@Component({\n selector: 'pp-region-header',\n standalone: true,\n imports: [WidgetListComponent],\n template: `<pp-widget-list [widgets]=\"widgets()\" />`,\n styles: [\n `\n :host {\n --pp-app-title-color: var(--pp-on-header, inherit);\n background-color: var(--pp-surface-header);\n color: var(--pp-on-header);\n align-items: center;\n display: flex;\n flex: 1;\n padding: 8px 16px;\n }\n /*\n * A row, because a header's widgets sit beside one another. The list component itself stays\n * unopinionated — the same component fills a routed content area, where a landing page's widgets\n * belong *under* one another — so the axis is the region's to choose, and a chrome row is the one\n * place it is not the default.\n */\n pp-widget-list {\n align-items: center;\n display: flex;\n flex: 1;\n gap: 8px;\n min-width: 0;\n }\n `,\n ],\n})\nexport class RegionHeaderComponent {\n readonly widgets = input<WidgetInstance[]>([]);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, inject, input } from '@angular/core';\nimport { MatListItem, MatListItemIcon, MatListItemTitle, MatNavList } from '@angular/material/list';\nimport { RouterLink, RouterLinkActive } from '@angular/router';\nimport { EntityLabelPipe, WorkingContextService } from '@processpuzzle/base-entity';\nimport { ContextLink, resolveContextLink, trimSlashes } from './app-shell.model';\nimport { NavItem } from '../../domain/app-definition';\n\n/** Which way the list runs. The shell decides it from `layout.preset`, not the region definition. */\nexport type NavOrientation = 'vertical' | 'horizontal';\n\n/**\n * One rendered row. A view model rather than the `NavItem` itself, so that \"does this item navigate, and\n * does its target exist\" is decided once per definition in a pure function instead of by methods the\n * template would re-run on every change detection pass.\n */\nexport interface NavRow {\n id: string;\n label: string;\n /**\n * Transloco key for {@link label}, preferred over it when the key resolves. Carried onto the row rather\n * than translated here: `toNavRows` is a pure function and translation depends on the active language\n * and on which scopes have finished loading, both of which are the template's concern.\n */\n translocoId?: string;\n icon?: string;\n /** Present only when the item names a route that something accounts for — see {@link toNavRows}. */\n routePath?: string;\n /** The item names a route path, but nothing in the definition accounts for it. */\n unresolved: boolean;\n children: NavRow[];\n}\n\n/**\n * Maps the authored nav tree onto rows, resolving each `routePath` against the paths the definition\n * accounts for.\n *\n * A path counts as resolved if it equals a declared route's path *or* sits below one — below a declared\n * route, or below a mounted module's base path. The prefix rule is what keeps this from crying wolf: the\n * routes inside a module live in the module's own definition, which is fetched lazily and is not knowable\n * here, so `back-office/lines` has to be trusted on the strength of the `back-office` mount alone.\n *\n * A group node — no `routePath`, children instead — is not unresolved. It expands rather than navigates.\n */\nexport function toNavRows(items: NavItem[] | undefined, knownPaths: string[]): NavRow[] {\n return (items ?? []).map((item) => {\n const routePath = normalize(item.routePath);\n const resolved = routePath !== undefined && knownPaths.some((known) => routePath === known || routePath.startsWith(`${known}/`));\n return {\n id: item.id,\n label: item.label,\n translocoId: item.translocoId,\n icon: item.icon,\n ...(resolved ? { routePath } : {}),\n unresolved: routePath !== undefined && !resolved,\n children: toNavRows(item.children, knownPaths),\n };\n });\n}\n\n/**\n * A route path as it is compared and linked: no surrounding slashes, since `RouteDefinition.path` is\n * relative with no leading slash by contract and a nav item may still have been authored with one.\n * Whitespace-only counts as absent — an item mid-authoring is a group node, not a broken link.\n */\nfunction normalize(routePath: string | undefined): string | undefined {\n const trimmed = trimSlashes(routePath?.trim() ?? '').trim();\n return trimmed ? trimmed : undefined;\n}\n\n/**\n * Renders the nav tree of the `sidenav` region — in the sidenav for the two sidenav presets, and\n * horizontally in the header row for `top-nav`. One component for both, because the tree and its\n * grouping rules are the same either way and only the axis differs.\n *\n * Links are relative, which is what makes the same component work in the designer's Preview tab and in a\n * standalone deployment: `routerLink=\"orders\"` resolves against whichever route hosts the shell, so it\n * becomes `…/app-definition/demo/preview/orders` under the designer and `/orders` under a runtime host,\n * with nothing here needing to know which.\n *\n * An item whose target nothing accounts for is rendered as an inert row with a title, not as a link that\n * would navigate into a 404. A dangling `routePath` is a *warning* server-side by design — it may name a\n * route of a module authored later — so the shell has to render it as something rather than reject it.\n *\n * `translocoId` is preferred over `label` where it resolves, through the impure `ppLabel` pipe — so a row\n * shows the authored literal until the scope that owns its key has loaded, then re-renders. A nav label is\n * *tenant* content living under a module's own scope, which for an authored module is served by the\n * backend rather than shipped as an asset; `ppLabel` falling back is the normal case, not a defect.\n */\n@Component({\n selector: 'pp-region-nav',\n standalone: true,\n imports: [MatNavList, MatListItem, MatListItemIcon, MatListItemTitle, NgTemplateOutlet, RouterLink, RouterLinkActive, EntityLabelPipe],\n template: `\n @if (compact()) {\n <nav class=\"pp-region-nav--compact\">\n <ng-container *ngTemplateOutlet=\"compactRowList; context: { $implicit: rows() }\"></ng-container>\n </nav>\n } @else {\n <mat-nav-list [class.pp-region-nav--horizontal]=\"orientation() === 'horizontal'\">\n <ng-container *ngTemplateOutlet=\"rowList; context: { $implicit: rows(), depth: 0 }\"></ng-container>\n </mat-nav-list>\n }\n\n <!--\n Recursive through ngTemplateOutlet: a NavItem nests in itself, so the depth is not knowable here.\n\n The icon and the title are spelled out in both branches rather than shared through one more template.\n A list item sorts its content with an ng-content selector on [matListItemIcon], and a projection\n selector is matched at compile time against the element's own children — so anything arriving through\n ngTemplateOutlet is one opaque node to it, and lands in the unprojected slot beside the title. That is\n what put the icon on a line of its own above every label.\n -->\n <ng-template #rowList let-rows let-depth=\"depth\">\n @for (row of rows; track row.id) {\n @if (row.routePath; as routePath) {\n <!-- An anchor, not a bare list item: RouterLink only writes href onto one, and without it the row\n is not a real link — no middle-click, no open-in-new-tab, no keyboard activation. -->\n <a\n mat-list-item\n class=\"pp-region-nav__item\"\n [routerLink]=\"routePath\"\n routerLinkActive=\"pp-region-nav__item--active\"\n [style.padding-inline-start.px]=\"depth * 12\"\n [attr.data-testid]=\"'nav-' + row.id\"\n >\n @if (row.icon) {\n <span matListItemIcon class=\"material-symbols-outlined\">{{ row.icon }}</span>\n }\n <div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>\n </a>\n } @else {\n <mat-list-item\n class=\"pp-region-nav__item\"\n [class.pp-region-nav__item--unresolved]=\"row.unresolved\"\n [title]=\"row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''\"\n [style.padding-inline-start.px]=\"depth * 12\"\n [attr.data-testid]=\"'nav-' + row.id\"\n >\n @if (row.icon) {\n <span matListItemIcon class=\"material-symbols-outlined\">{{ row.icon }}</span>\n }\n <div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>\n </mat-list-item>\n }\n @if (row.children.length) {\n <ng-container *ngTemplateOutlet=\"rowList; context: { $implicit: row.children, depth: depth + 1 }\"></ng-container>\n }\n }\n </ng-template>\n <!--\n The compact rows of a tablet layout: the icon above a short label, so the drawer — which is sized to its\n content — narrows to a rail. Plain elements rather than list items, whose fixed height and leading-icon\n slot are exactly the row layout this replaces. Nesting is shown by order alone; a rail has no room for\n indentation.\n -->\n <ng-template #compactRowList let-rows>\n @for (row of rows; track row.id) {\n @if (row.routePath; as routePath) {\n <a class=\"pp-region-nav__compact-item\" [routerLink]=\"routePath\" routerLinkActive=\"pp-region-nav__item--active\" [attr.data-testid]=\"'nav-' + row.id\">\n @if (row.icon) {\n <span class=\"material-symbols-outlined pp-region-nav__compact-icon\">{{ row.icon }}</span>\n }\n <span class=\"pp-region-nav__compact-label\">{{ row.translocoId | ppLabel: row.label }}</span>\n </a>\n } @else {\n <span\n class=\"pp-region-nav__compact-item\"\n [class.pp-region-nav__item--unresolved]=\"row.unresolved\"\n [title]=\"row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''\"\n [attr.data-testid]=\"'nav-' + row.id\"\n >\n @if (row.icon) {\n <span class=\"material-symbols-outlined pp-region-nav__compact-icon\">{{ row.icon }}</span>\n }\n <span class=\"pp-region-nav__compact-label\">{{ row.translocoId | ppLabel: row.label }}</span>\n </span>\n }\n @if (row.children.length) {\n <ng-container *ngTemplateOutlet=\"compactRowList; context: { $implicit: row.children }\"></ng-container>\n }\n }\n </ng-template>\n `,\n styles: [\n `\n :host {\n display: block;\n }\n .pp-region-nav--horizontal {\n display: flex;\n padding-top: 0;\n }\n .pp-region-nav--horizontal .pp-region-nav__item {\n width: auto;\n }\n .pp-region-nav--compact {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 8px 4px;\n }\n .pp-region-nav__compact-item {\n align-items: center;\n border-radius: 8px;\n color: inherit;\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 6px 4px;\n text-decoration: none;\n }\n a.pp-region-nav__compact-item:hover,\n .pp-region-nav__compact-item.pp-region-nav__item--active {\n background-color: color-mix(in srgb, currentColor 12%, transparent);\n }\n .pp-region-nav__compact-label {\n font: var(--mat-sys-label-small);\n max-width: 80px;\n overflow: hidden;\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .pp-region-nav__item--unresolved {\n font-style: italic;\n opacity: 0.6;\n }\n `,\n ],\n})\nexport class RegionNavComponent {\n readonly navItems = input<NavItem[]>([]);\n readonly orientation = input<NavOrientation>('vertical');\n /**\n * Icon-over-label rows for a narrow layout. Set by the shell on a tablet layout, where a content-sized\n * drawer with full rows would take too much of the screen; meaningless for the horizontal nav.\n */\n readonly compact = input(false);\n /** Route paths the definition accounts for, supplied by `AppRegionRenderer`. See {@link toNavRows}. */\n readonly knownPaths = input<string[]>([]);\n\n /** Routes bound to a working context, supplied by `AppRegionRenderer`: their nav entries lead into the context. */\n readonly contextLinks = input<ContextLink[]>([]);\n\n private readonly workingContext = inject(WorkingContextService);\n private readonly activeIds = computed(() => Object.fromEntries(this.workingContext.active().map((context) => [context.name, context.id])));\n\n protected readonly rows = computed(() => this.withContextLinks(toNavRows(this.navItems(), this.knownPaths())));\n\n private withContextLinks(rows: NavRow[]): NavRow[] {\n const links = this.contextLinks();\n if (links.length === 0) return rows;\n const activeIds = this.activeIds();\n return rows.map((row) => ({ ...row, ...(row.routePath ? { routePath: resolveContextLink(row.routePath, links, activeIds) } : {}), children: this.withContextLinks(row.children) }));\n }\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AppDefinition, RegionDefinition, RegionType } from '../../domain/app-definition';\nimport { contextLinksOf, knownRoutePathsOf } from './app-shell.model';\nimport { RegionFooterComponent } from './region-footer.component';\nimport { RegionHeaderComponent } from './region-header.component';\nimport { RegionNavComponent } from './region-nav.component';\nimport { WorkingContextStatusbarComponent } from '@processpuzzle/base-entity';\n\n/**\n * One region resolved to something renderable: which slot it fills, the component that fills it and\n * the inputs to bind. **Data, not a view** — deliberately the same shape of answer\n * {@link AppRouteRenderer} gives for a route, and for the same reasons: it is assertable from a spec\n * without a `TestBed`, and the shell can bind it declaratively so that editing the definition in the\n * neighbouring form re-renders through ordinary signal propagation.\n *\n * `slot` is where the region *asks* to go. The shell may place it elsewhere — the `top-nav` preset puts\n * the `sidenav` slot's view in the header row — and may override {@link inputs} when it does, which is\n * the second reason this carries inputs rather than a constructed component.\n */\nexport interface RegionView {\n slot: RegionType;\n component: Type<unknown>;\n inputs: Record<string, unknown>;\n}\n\n/**\n * Turns one authored `RegionDefinition` into the {@link RegionView} that renders it.\n *\n * An injectable rather than a free function, though stateless today, for the reason `AppRouteRenderer`\n * is one: the Preview tab and the runtime host must resolve regions *identically*,\n * so there has to be exactly one of these, and a constructor parameter is a cheaper way to grow it than\n * a rewrite.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppRegionRenderer {\n render = (region: RegionDefinition, definition: AppDefinition | undefined): RegionView | undefined => {\n switch (region.type) {\n case 'header':\n // Widgets alone: the brand is an `app-logo` and an `app-title` widget like any other, reading the\n // definition's name and logo through the shell's APPLICATION_CONTEXT.\n return { slot: 'header', component: RegionHeaderComponent, inputs: { widgets: region.widgets ?? [] } };\n case 'footer':\n return { slot: 'footer', component: RegionFooterComponent, inputs: { widgets: region.widgets ?? [] } };\n case 'statusbar':\n // No inputs: it shows whatever working contexts the URL names, which is not the region's to say.\n return { slot: 'statusbar', component: WorkingContextStatusbarComponent, inputs: {} };\n case 'sidenav':\n // `orientation` is left at the component's own default; the shell overrides it for `top-nav`,\n // because the axis follows the layout preset rather than anything authored on the region.\n // `knownPaths` comes from the definition rather than the region: whether a nav entry resolves is a\n // question about the *application's* routes, which only this function can see from here.\n return { slot: 'sidenav', component: RegionNavComponent, inputs: { navItems: region.navItems ?? [], knownPaths: knownRoutePathsOf(definition), contextLinks: contextLinksOf(definition) } };\n default:\n // A region whose `type` the designer has not chosen yet. `RegionDefinition.type` is\n // `RegionType | undefined` precisely because a row exists before its dropdown is touched, and\n // the preview renders it *while* that is happening — so this is the normal path, not an error\n // one. Omitting it is quieter than a placeholder, and the form already shows the empty row.\n return undefined;\n }\n };\n}\n","import { computed, Injectable, signal } from '@angular/core';\nimport { ApplicationContext, NavMenuItem } from '@processpuzzle/widgets';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { knownRoutePathsOf } from './app-shell.model';\nimport { NavRow, toNavRows } from './region-nav.component';\n\n/**\n * The shell's answer to base-widget's `APPLICATION_CONTEXT`: the name, logo and navigation of the definition\n * it renders, for `app-title`, `app-logo` and `nav-menu` to read without props.\n *\n * Provided on `AppShellComponent`, so every widget below it — in a region or in routed content — sees the\n * application it is part of. The shell writes {@link definition}; everything else derives from it.\n */\n@Injectable()\nexport class ShellApplicationContext implements ApplicationContext {\n readonly definition = signal<AppDefinition | undefined>(undefined);\n\n readonly name = computed(() => this.definition()?.name ?? '');\n readonly logoUrl = computed(() => this.definition()?.logoUrl ?? this.definition()?.theme?.logoUrl);\n readonly navItems = computed(() => navMenuItemsOf(this.definition()));\n}\n\n/**\n * The sidenav region's entries as menu items, resolved the way the sidenav resolves them: an entry naming a\n * route the application does not account for keeps its place but loses its link, so the menu never offers\n * a navigation the router would reject.\n */\nexport function navMenuItemsOf(definition: AppDefinition | undefined): NavMenuItem[] {\n const sidenav = definition?.regions?.find((region) => region.type === 'sidenav');\n return toMenuItems(toNavRows(sidenav?.navItems, knownRoutePathsOf(definition)));\n}\n\nfunction toMenuItems(rows: NavRow[]): NavMenuItem[] {\n return rows.map((row) => ({\n id: row.id,\n label: row.label,\n ...(row.translocoId ? { translocoId: row.translocoId } : {}),\n ...(row.icon ? { icon: row.icon } : {}),\n ...(row.routePath ? { routePath: row.routePath } : {}),\n ...(row.children.length ? { children: toMenuItems(row.children) } : {}),\n }));\n}\n","import { Injectable, signal } from '@angular/core';\nimport { SidenavControl } from '@processpuzzle/widgets';\n\n/**\n * The shell's answer to base-widget's `SIDENAV_CONTROL`, for the `sidenav-toggle` widget. The shell owns the\n * drawer and writes {@link available}; the widget only flips {@link opened}, which the shell binds to it.\n */\n@Injectable()\nexport class ShellSidenavControl implements SidenavControl {\n readonly available = signal(false);\n readonly opened = signal(true);\n\n toggle(): void {\n this.opened.update((opened) => !opened);\n }\n}\n","import { OverlayContainer } from '@angular/cdk/overlay';\nimport { ElementRef, inject, Injectable } from '@angular/core';\n\n/**\n * An `OverlayContainer` that lives inside the shell's host element instead of under `<body>`.\n *\n * The shell's theme is a set of custom properties and a `color-scheme` on its host, and they only cascade to\n * descendants. A menu, tooltip or dialog opened from inside the shell renders into the overlay container, so\n * with CDK's default one it would wear the surrounding application's theme — a light menu over a dark\n * previewed app. Moving the container into the host is all it takes; the container is `position: fixed`, and\n * native popovers render in the top layer regardless of where they sit in the DOM.\n *\n * Provided in `AppShellComponent`'s `providers`, which is also where `ElementRef` comes from. Menus and\n * tooltips resolve it through their own element injector; dialogs need `Dialog` and `MatDialog` provided\n * there as well, since the root ones would resolve the root container.\n */\n@Injectable()\nexport class ShellOverlayContainer extends OverlayContainer {\n private readonly host: HTMLElement = inject(ElementRef).nativeElement;\n\n protected override _createContainer(): void {\n super._createContainer();\n if (this._containerElement) this.host.appendChild(this._containerElement);\n }\n}\n","import { Dialog } from '@angular/cdk/dialog';\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { NgComponentOutlet } from '@angular/common';\nimport { Component, computed, contentChild, Directive, effect, inject, input } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatSidenav, MatSidenavContainer, MatSidenavContent } from '@angular/material/sidenav';\nimport { ActivatedRoute, RouterOutlet } from '@angular/router';\nimport { WorkingContextService } from '@processpuzzle/base-entity';\nimport { nestWorkingContext } from '../../domain/working-context-row.mapper';\nimport { LayoutService } from '@processpuzzle/util';\nimport { APPLICATION_CONTEXT, SIDENAV_CONTROL, SidenavAutosizeDirective, SidenavContentOutletComponent, ThemeService } from '@processpuzzle/widgets';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { AppRegionRenderer, RegionView } from './app-region.renderer';\nimport { layoutOf, themeDefaultsOf, themeVarsOf, trimSlashes } from './app-shell.model';\nimport { NavOrientation } from './region-nav.component';\nimport { ShellApplicationContext } from './shell-application-context';\nimport { ShellSidenavControl } from './shell-sidenav-control';\nimport { ShellOverlayContainer } from './shell-overlay-container';\n\n/**\n * Marks content a host projects into the end of the shell's top row: `<div ppShellActions>…</div>`.\n *\n * For controls that belong to the platform rather than to the application — signing out, switching\n * organization, opening the designer. They come from the host and not from a header region, because a\n * definition decides what its regions hold, and a definition that could drop the designer button would\n * let a designer lock themselves out of the designer.\n *\n * **It brings its own overlay container.** Projected content resolves its dependencies through the\n * injectors of the template that declared it — the host's — not through the shell's, so the shell's\n * {@link ShellOverlayContainer} is out of its reach: a menu opened from one of these controls would render\n * under `<body>` and wear the host's theme. This element is inside the shell's host, which is all a\n * container needs to wear the application's.\n */\n@Directive({\n selector: '[ppShellActions]',\n standalone: true,\n host: { class: 'pp-app-shell__actions' },\n providers: [{ provide: OverlayContainer, useClass: ShellOverlayContainer }],\n})\nexport class ShellActionsDirective {}\n\n/**\n * The run-time shell of a metadata-defined application: the chrome an `AppDefinition` describes, with a\n * `<router-outlet>` where its routes render.\n *\n * **This is the application, not a picture of one.** `AppPreviewComponent` hosts it with the draft so\n * that the Preview tab shows the real thing, and a runtime host mounts the same component with the\n * published revision — which is the whole point of it being a component with one input rather than\n * something assembled inside the preview. A shell built for the preview would drift from the one built for production, and a preview\n * that drifts is worse than none.\n *\n * Everything is bound declaratively. Regions are resolved to {@link RegionView}s and rendered through\n * `NgComponentOutlet`, never created imperatively, so that a definition edited in the neighbouring\n * details form re-renders through ordinary signal propagation instead of a clear-and-rebuild that would\n * drop scroll position and focus on every keystroke.\n *\n * The whole theme is applied here, not only the brand colours: `--pp-*` overrides as a style binding, and\n * a class selecting one of the scoped Material themes of widgets' `src/theme/pp-material-themes.scss`. The\n * class comes from the shell's own {@link ThemeService}: the definition's `materialTheme` / `colorScheme`\n * are its defaults, and a `ThemesButton` placed in one of the regions overrides them for this application\n * only. Both work because a Material theme is a set of custom properties and nothing else. That file is a\n * **global stylesheet the application registers**; if it is not registered the classes still land and the\n * shell simply inherits the host's theme. Overlays opened from inside the shell render into a\n * {@link ShellOverlayContainer} in its host, so they are themed as well.\n *\n * The definition's routes render in the outlet once its host registers them as the children of the route\n * the shell is mounted on — `appShellRoutesGuard` for the Preview, `publishedAppRoutesGuard` for a runtime\n * host.\n *\n * A host may also project controls of its own into the end of the top row, marked {@link ShellActionsDirective}\n * — the platform's controls a definition must not be able to remove, such as the way into the designer.\n */\n@Component({\n selector: 'pp-app-shell',\n standalone: true,\n imports: [NgComponentOutlet, MatSidenav, MatSidenavContainer, MatSidenavContent, RouterOutlet, SidenavAutosizeDirective, SidenavContentOutletComponent],\n providers: [\n ThemeService,\n ShellApplicationContext,\n { provide: APPLICATION_CONTEXT, useExisting: ShellApplicationContext },\n ShellSidenavControl,\n { provide: SIDENAV_CONTROL, useExisting: ShellSidenavControl },\n { provide: OverlayContainer, useClass: ShellOverlayContainer },\n Dialog,\n MatDialog,\n ],\n // Both theme bindings go on the host rather than on a wrapper, so the element that *is* the shell is\n // also the element they cascade from — and so the host can be the grid, see the stylesheet. `[class]`\n // selects one of the scoped Material themes there; `[style]` carries the `--pp-*` overrides.\n host: { '[class]': 'themeClass()', '[style]': 'themeVars()' },\n template: `\n @if (headerView() || topNavView() || hostActions()) {\n <div class=\"pp-app-shell__top\">\n @if (headerView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: view.inputs\"></ng-container>\n }\n @if (topNavView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: topNavInputs()\"></ng-container>\n }\n <ng-content select=\"[ppShellActions]\" />\n </div>\n }\n\n @if (statusbarView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: view.inputs\"></ng-container>\n }\n\n <mat-sidenav-container class=\"pp-app-shell__body\">\n @if (sidenavView(); as view) {\n <mat-sidenav\n class=\"pp-app-shell__sidenav\"\n ppSidenavAutosize\n [mode]=\"layout().sidenavMode\"\n [opened]=\"sidenavControl.opened() && !layoutService.isSidenavHidden()\"\n (openedChange)=\"onSidenavOpenedChange($event)\"\n [position]=\"layout().sidenavPosition\"\n >\n <!-- A page such as a content book may take the sidenav over; the outlet keeps the nav one click away. -->\n <pp-sidenav-content-outlet>\n <ng-container *ngComponentOutlet=\"view.component; inputs: sidenavInputs()\"></ng-container>\n </pp-sidenav-content-outlet>\n </mat-sidenav>\n }\n <mat-sidenav-content>\n <main class=\"pp-app-shell__content\" [style.max-width]=\"layout().contentMaxWidth\">\n <router-outlet />\n </main>\n </mat-sidenav-content>\n </mat-sidenav-container>\n\n @if (footerView(); as view) {\n <ng-container *ngComponentOutlet=\"view.component; inputs: view.inputs\"></ng-container>\n }\n `,\n styleUrl: 'app-shell.component.scss',\n})\nexport class AppShellComponent {\n /**\n * The definition to render. Optional rather than required because the shell is mounted before the\n * definition resolves — the preview's store selects the entity in its own `ngOnInit`, and a deep link\n * arrives with nothing loaded — so an empty shell is a state to render, not an error.\n */\n readonly definition = input<AppDefinition | undefined>(undefined);\n\n /**\n * Whether a theme the user picks in a `ThemesButton` inside the shell is remembered, per application id.\n * The designer's preview turns it off: there a choice is only tried out, and a stored one would shadow the\n * theme being edited in the neighbouring form.\n */\n readonly persistTheme = input(true);\n\n private readonly regionRenderer = inject(AppRegionRenderer);\n private readonly theme = inject(ThemeService);\n private readonly applicationContext = inject(ShellApplicationContext);\n private readonly workingContext = inject(WorkingContextService);\n private readonly hostRoute = inject(ActivatedRoute);\n protected readonly layoutService = inject(LayoutService);\n protected readonly sidenavControl = inject(ShellSidenavControl);\n\n /** Controls the host projected into the top row; the row is rendered for them alone if need be. */\n protected readonly hostActions = contentChild(ShellActionsDirective);\n\n protected readonly layout = computed(() => layoutOf(this.definition()));\n protected readonly themeVars = computed(() => themeVarsOf(this.definition()));\n protected readonly themeClass = this.theme.themeClass;\n\n // Re-run on every edit of the definition. Persisting, that re-reads the same stored choice; in the preview\n // it drops the choice tried out there, so an edit to the theme fields always shows.\n private readonly applyThemeDefaults = effect(() => {\n const definition = this.definition();\n this.theme.setDefaults(themeDefaultsOf(definition));\n this.theme.persistUnder(this.persistTheme() && definition?.id ? `pp-theme:${definition.id}` : null);\n this.applicationContext.definition.set(definition);\n });\n\n /**\n * Hands the definition's working contexts to the service, with the URL the shell is mounted at in front of\n * each `basePath` — what lets \"Set as active\" on an entity's list reach the context's pages from outside them.\n * Re-run on every edit, and undone on destroy, so a previewed definition's contexts never outlive its preview.\n */\n private readonly registerWorkingContexts = effect((onCleanup) => {\n const contexts = this.definition()?.contexts;\n if (!contexts?.length) return;\n const mountedAt = '/' + this.hostRoute.pathFromRoot.flatMap((route) => route.snapshot.url.map((segment) => segment.path)).join('/');\n const prefix = mountedAt === '/' ? '' : mountedAt;\n onCleanup(this.workingContext.register(contexts.map((row) => ({ ...nestWorkingContext(row), basePath: prefix + '/' + trimSlashes(row.basePath ?? '') }))));\n });\n\n // The definition's default re-applies on every edit, like the theme: a toggle in the Preview is only tried out.\n private readonly applySidenavDefault = effect(() => this.sidenavControl.opened.set(this.layout().sidenavOpened));\n\n private readonly regionViews = computed(() =>\n (this.definition()?.regions ?? []).map((region) => this.regionRenderer.render(region, this.definition())).filter((view): view is RegionView => view !== undefined),\n );\n\n protected readonly headerView = computed(() => this.viewOf('header'));\n protected readonly footerView = computed(() => this.viewOf('footer'));\n protected readonly statusbarView = computed(() => this.viewOf('statusbar'));\n\n /**\n * The nav in the sidenav, for the two sidenav presets. Split from {@link topNavView} rather than\n * decided in the template, so each slot is one unambiguous `@if` and the mutual exclusion is stated\n * once, here.\n */\n protected readonly sidenavView = computed(() => (this.layout().hasSidenav && !this.isSmallScreen() ? this.viewOf('sidenav') : undefined));\n\n /**\n * The same nav relocated into the header row under `top-nav`. It is placed beside the header region\n * rather than inside it, so that a `top-nav` app which declares no header region is still navigable —\n * and so that the shell still never invents a region that was not authored.\n */\n protected readonly topNavView = computed(() => (this.layout().hasSidenav || this.isSmallScreen() ? undefined : this.viewOf('sidenav')));\n\n /**\n * A handset layout has room for neither a sidenav nor a horizontal nav row, so the shell renders the nav\n * in neither place there; a `nav-menu` widget in the header stands in for it, reading the same entries\n * through the APPLICATION_CONTEXT. A definition with no such widget is not navigable on a phone — which is\n * why the seeded applications all place one.\n */\n private readonly isSmallScreen = computed(() => this.layoutService.isSmallDevice());\n\n /**\n * The nav view's own inputs with the axis the layout dictates laid over them.\n *\n * Computeds rather than a method called from the template: a method would hand `NgComponentOutlet` a\n * freshly built object on every change-detection pass, so it would re-diff and re-apply the nav's\n * inputs continuously. Memoized, the identity only changes when the definition or the preset does.\n */\n // Compact on a tablet layout, the sidenav's middle size: the drawer is sized to its content, so compact\n // rows are what narrow it to a rail. See SidenavAutosizeDirective for how the content margin follows.\n protected readonly sidenavInputs = computed(() => ({ ...this.navInputsOf(this.sidenavView(), 'vertical'), compact: this.layoutService.isMediumDevice() }));\n protected readonly topNavInputs = computed(() => this.navInputsOf(this.topNavView(), 'horizontal'));\n\n private readonly syncSidenavAvailability = effect(() => this.sidenavControl.available.set(this.sidenavView() !== undefined && !this.layoutService.isSidenavHidden()));\n\n /** A backdrop click or Escape closes an over-mode drawer; a hide request from a page is not the user's choice. */\n protected onSidenavOpenedChange(opened: boolean): void {\n if (!this.layoutService.isSidenavHidden()) this.sidenavControl.opened.set(opened);\n }\n\n private navInputsOf(view: RegionView | undefined, orientation: NavOrientation): Record<string, unknown> {\n return { ...view?.inputs, orientation };\n }\n\n private viewOf(slot: RegionView['slot']): RegionView | undefined {\n // First occurrence wins. An app declares each slot at most once — `type` is the region's identity,\n // see APP_REGION_ID_FIELD — so a second one is a definition that bypassed validation, and ignoring\n // it is the harmless read. The same rule `buildAppRoutes` applies to a duplicate path.\n return this.regionViews().find((view) => view.slot === slot);\n }\n}\n","import { Component, computed, inject, input, OnInit } from '@angular/core';\nimport { AppDefinition } from '../domain/app-definition';\nimport { AppDefinitionStore } from '../domain/app-definition.store';\nimport { AppShellComponent } from './shell/app-shell.component';\n\n/**\n * The Preview tab's screen, mounted at `app-definition/<id>/preview` by `BASE_APP_ROUTES` — a sibling of\n * the generic Details form rather than something stacked under it, which is what the `extraTabs` hook on\n * `BaseEntityDescriptor` exists for.\n *\n * A **container and nothing more**: it resolves which definition is being previewed and frames the\n * result. Everything about *how* an application renders belongs to {@link AppShellComponent}, which the\n * runtime host mounts just as this does — so the preview cannot grow behaviour the real\n * shell lacks, which is the only way a preview stays honest.\n *\n * The frame below — rounded, white, and tall enough to look like an application — is the preview's own,\n * not the shell's. In production the shell fills the viewport and none of it applies.\n */\n@Component({\n selector: 'pp-app-preview-tab',\n standalone: true,\n imports: [AppShellComponent],\n template: `\n <div class=\"pp-app-preview\">\n <pp-app-shell [definition]=\"app()\" [persistTheme]=\"false\" />\n </div>\n `,\n styles: [\n `\n .pp-app-preview {\n background-color: var(--pp-surface-base, #ffffff);\n border-radius: 6px;\n overflow: hidden;\n }\n /*\n * How tall a previewed application is, and therefore where its footer sits: at the bottom of this\n * box, not directly under the header. The shell is a three-row grid whose middle row takes the slack,\n * so giving it a height is all that is needed — but something has to, and nothing above this can:\n * the tab panel, the router outlets and the designer's own layout are all auto-height, so a\n * percentage here would resolve against nothing.\n *\n * Viewport-relative rather than a calc() subtracting the chrome: what sits above a preview is a tab\n * bar, a status bar and a toolbar whose heights are Material's to change, and a subtraction would go\n * quietly wrong when they do.\n */\n .pp-app-preview > pp-app-shell {\n min-height: 65vh;\n }\n `,\n ],\n})\nexport class AppPreviewComponent implements OnInit {\n /**\n * Bound from the route's `:entityId` param by `withComponentInputBinding()`, the same way\n * `BaseEntityFormComponent` receives it — so a deep link and a reload resolve the same app definition as a\n * click through the tab does.\n */\n readonly entityId = input.required<string>();\n\n private readonly store = inject(AppDefinitionStore);\n\n protected readonly app = computed(() => this.store.currentEntity() as AppDefinition | undefined);\n\n ngOnInit(): void {\n // Also sets the current entity, so the tab bar's Details link stays enabled and the status bar keeps\n // naming the record — arriving here directly, nothing else has selected it.\n this.store.setCurrentEntity(this.entityId());\n }\n}\n","import { AppAssetContext } from '@processpuzzle/widgets';\nimport { AppAssetService } from './app-asset.service';\n\n/**\n * The {@link AppAssetContext} of one application: what its widgets ask when a property says `app:<path>`. Reads the\n * channel the routes were built from — the draft in the designer's Preview, the released one in the running\n * application — so a widget never shows an asset its application has not released.\n */\nexport function appAssetContextOf(service: AppAssetService, appId: string, revision: 'draft' | 'released'): AppAssetContext {\n return { blob: (path) => service.content(appId, path, revision) };\n}\n","import { ModuleAssetContext } from '@processpuzzle/widgets';\nimport { ModuleAssetService } from './module-asset.service';\n\n/**\n * The {@link ModuleAssetContext} of one mounted module: what its widgets ask when a property says\n * `module:<path>`. Reads the channel the mount itself was built from — the draft in the designer's Preview, the\n * released module in the running application — so a widget never shows an asset its module has not released.\n */\nexport function moduleAssetContextOf(service: ModuleAssetService, moduleKey: string, revision: 'draft' | 'released'): ModuleAssetContext {\n return { blob: (path) => service.content(moduleKey, path, revision) };\n}\n","import { inject, Injectable } from '@angular/core';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { firstValueFrom, Subscription } from 'rxjs';\nimport { AppTranslationService } from '../../domain/app-translation.service';\n\n/**\n * Brings the texts of an application's own pages — a home page's cards, say — to the widgets that name them. They\n * are merged into the translations of every language rather than into a scope of their own: the application's\n * widgets resolve their keys under whatever `translocoPrefix` the designer typed, in the root scope, so a key the\n * author uploaded is found wherever it is looked for.\n *\n * <p>What is stored is read in the channel the routes were built from — the draft in the designer's Preview, the\n * released one in the running application. The shipped translations of a language are loaded first and the uploaded\n * texts merged over them, never the other way round, so an uploaded text wins and nothing shipped is lost. A language\n * with nothing stored, or whose read fails, simply adds nothing: the widgets then show what they showed before, the\n * keys themselves.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppTranslationsLoader {\n private readonly transloco = inject(TranslocoService);\n private readonly service = inject(AppTranslationService);\n private watching?: Subscription;\n\n /**\n * Merges the application's texts, for the language in use at once and for the others in the background, and again\n * for each language the user switches to later. Replaces what an earlier call arranged: one application is live at\n * a time.\n */\n async activate(appId: string, revision: 'draft' | 'released'): Promise<void> {\n this.watching?.unsubscribe();\n const merged = new Set<string>();\n const mergeOnce = (lang: string): Promise<void> => {\n if (merged.has(lang)) return Promise.resolve();\n merged.add(lang);\n return this.merge(appId, lang, revision);\n };\n const active = this.transloco.getActiveLang();\n await mergeOnce(active);\n for (const lang of this.languages()) void mergeOnce(lang);\n this.watching = this.transloco.langChanges$.subscribe((lang) => void mergeOnce(lang));\n }\n\n private async merge(appId: string, lang: string, revision: 'draft' | 'released'): Promise<void> {\n let texts: Record<string, string>;\n try {\n texts = await firstValueFrom(this.service.bundle(appId, lang, revision));\n } catch {\n return;\n }\n if (!Object.keys(texts ?? {}).length) return;\n try {\n // The shipped file first: it merges *into* what is there, so loading it afterwards would overwrite the uploads.\n await firstValueFrom(this.transloco.load(lang));\n } catch {\n // A language with no shipped file still takes the uploaded texts.\n }\n this.transloco.setTranslation(texts, lang, { merge: true });\n }\n\n /** The languages transloco is configured for, and the fallback one. */\n private languages(): string[] {\n const available = this.transloco.getAvailableLangs().map((lang) => (typeof lang === 'string' ? lang : lang.id));\n return [...new Set([...available, 'en'])];\n }\n}\n","import { inject, Injectable, Injector, Provider } from '@angular/core';\nimport { CanMatchFn, Routes } from '@angular/router';\nimport { BaseUrlSegments, EntityScreenResolver } from '@processpuzzle/base-entity';\nimport { APP_ASSET_CONTEXT } from '@processpuzzle/widgets';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { TranslocoHttpLoader } from '@processpuzzle/util';\nimport { firstValueFrom } from 'rxjs';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { AppDefinitionService } from '../../domain/app-definition.service';\nimport { AppDefinitionStore } from '../../domain/app-definition.store';\nimport { ModuleDefinition } from '../../domain/module-definition';\nimport { ModuleDefinitionService } from '../../domain/module-definition.service';\nimport { ModuleDefinitionStore } from '../../domain/module-definition.store';\nimport { appAssetContextOf } from '../../domain/app-asset-context';\nimport { AppAssetService } from '../../domain/app-asset.service';\nimport { moduleAssetContextOf } from '../../domain/module-asset-context';\nimport { ModuleAssetService } from '../../domain/module-asset.service';\nimport { ModuleTranslationBundle } from '../../domain/module-translation';\nimport { ModuleTranslationService } from '../../domain/module-translation.service';\nimport { buildAppRoutes, ModuleLoader, ModuleTranslationLoader } from '../app-route-builder';\nimport { AppRouteRenderer } from '../app-route-renderer';\nimport { AppTranslationsLoader } from './app-translations.loader';\n\n/**\n * Turns one `AppDefinition` into the `Routes` that render its screens — the missing consumer of\n * {@link buildAppRoutes}, which until now produced routes nothing registered.\n *\n * Separate from the guard below so the interesting part is testable without a router: this class answers\n * \"what routes does app X have\", and the guard is only the two lines that hand them to Angular.\n */\n@Injectable({ providedIn: 'root' })\nexport class AppShellRoutesFactory {\n // The two stores — and the translation services, which a host that mounts no module never needs — are read on\n // first use rather than injected here. They are the designer's stores of\n // drafts, and each loads every definition the moment it is created — which a runtime host, building\n // the routes of the published revision it already holds, must not set off on its way past.\n private readonly injector = inject(Injector);\n private readonly appService = inject(AppDefinitionService);\n private readonly moduleService = inject(ModuleDefinitionService);\n private readonly renderRoute = inject(AppRouteRenderer).render;\n private readonly entityScreens = inject(EntityScreenResolver);\n\n async childrenOf(appId: string): Promise<Routes> {\n const definition = await this.definitionOf(appId);\n return definition ? this.childrenFor(definition) : [];\n }\n\n /**\n * The routes of a definition already in hand — the published one the runtime host fetched, or the draft\n * {@link childrenOf} found. One builder for both is what keeps the Preview and the live application from\n * rendering the same definition differently.\n *\n * A definition read through `/layout` brings its mounted modules along, from its own side — the released\n * modules with the published revision — and those are the only ones it mounts. Fetching a module instead\n * would read its draft, and the live application would show edits nobody has released.\n */\n async childrenFor(definition: AppDefinition): Promise<Routes> {\n const loadModule = definition.mountedModules ? inlineModules(definition.mountedModules) : this.loadModule;\n // The released modules come with the published layout, so their translations and assets are the released\n // ones too; a draft definition — the designer's Preview — reads the draft ones a user just uploaded.\n const revision = definition.mountedModules ? 'released' : 'draft';\n const loadTranslations = this.translationsOf(revision);\n // The texts of the application's own pages, which no module's scope carries. A failed read leaves the keys as text.\n await this.injector\n .get(AppTranslationsLoader)\n .activate(definition.id, revision)\n .catch(() => undefined);\n const moduleAssets = (moduleKey: string) => moduleAssetContextOf(this.injector.get(ModuleAssetService), moduleKey, revision);\n const built = await buildAppRoutes(\n {\n routes: definition.routes,\n modules: definition.modules,\n contexts: definition.contexts?.map(({ name, parent, entityName }) => ({ name, parent, entityName })),\n contextChildren: async (entityName) => (await this.entityScreens.resolve(entityName))?.embeddedChildren ?? [],\n loadModule,\n loadTranslations,\n moduleAssets,\n },\n this.renderRoute,\n );\n // Provided on every top-level route, the mounts included, so that an `app:` value is found on the application's\n // own pages and below a module alike.\n const appAssets: Provider = { provide: APP_ASSET_CONTEXT, useFactory: () => appAssetContextOf(this.injector.get(AppAssetService), definition.id, revision) };\n const withAssets = built.map((route) => ({ ...route, providers: [...(route.providers ?? []), appAssets] }));\n return withAssets.length ? [indexRoute(definition, withAssets), ...withAssets] : withAssets;\n }\n\n /**\n * Where a mounted module's translations come from: whatever the application or the seeded bundles already\n * serve for the scope, under what the module's own uploaded files say. The shipped bundle stays underneath\n * so that a module translated the way every module was before files could be uploaded — a seeded\n * `order_admin` bundle — keeps its words.\n *\n * A language the module has nothing uploaded for answers with the shipped bundle alone, and a failed read\n * of the uploaded one is no reason to fail the load: the titles keep their authored text.\n */\n private translationsOf(revision: 'draft' | 'released'): ModuleTranslationLoader {\n const languages = () => this.languages();\n return {\n get languages() {\n return languages();\n },\n load: async (moduleKey, scope, locale) => {\n const [shipped, uploaded] = await Promise.all([this.shipped(scope, locale), this.uploaded(moduleKey, locale, revision)]);\n return { ...shipped, ...uploaded };\n },\n };\n }\n\n /**\n * The bundle the application ships for the scope, if it ships one. A module a Business Starter brought has only\n * the texts it uploaded, so there is no `assets/i18n/<scope>/<locale>.json` and the request answers 404 — which\n * must not fail the whole load, or the uploaded texts would never reach the module.\n */\n private async shipped(scope: string, locale: string): Promise<Record<string, string>> {\n try {\n return (await firstValueFrom(this.injector.get(TranslocoHttpLoader).getTranslation(`${scope}/${locale}`, { scope }))) as Record<string, string>;\n } catch {\n return {};\n }\n }\n\n private async uploaded(moduleKey: string, locale: string, revision: 'draft' | 'released'): Promise<ModuleTranslationBundle> {\n try {\n return await firstValueFrom(this.injector.get(ModuleTranslationService).bundle(moduleKey, locale, revision));\n } catch {\n return {};\n }\n }\n\n /** The languages transloco is configured for, the active and the fallback one included. */\n private languages(): string[] {\n const transloco = this.injector.get(TranslocoService);\n const available = transloco.getAvailableLangs().map((lang) => (typeof lang === 'string' ? lang : lang.id));\n return [...new Set([...available, transloco.getActiveLang(), 'en'])];\n }\n\n /**\n * Store first, endpoint second.\n *\n * The store holds the newest definition immediately after a Save, so the next navigation inside the\n * preview picks up a route the designer just added — without a second GET, and without this having to\n * know that a save happened. The fetch is for the case the store cannot serve: a deep link or a reload,\n * where nothing has been loaded yet.\n *\n * A failure resolves to `undefined` rather than propagating. A guard that rejects fails the whole\n * navigation, and an app whose definition cannot be read should render an empty shell, not a dead URL.\n */\n private async definitionOf(appId: string): Promise<AppDefinition | undefined> {\n const known = this.injector.get(AppDefinitionStore).loadById(appId);\n if (known) return known;\n return (await this.fetch(() => firstValueFrom(this.appService.findById(appId)))) as AppDefinition | undefined;\n }\n\n /**\n * The {@link ModuleLoader} `buildAppRoutes` calls for a mount whose module it has not got. Resolving to\n * `undefined` is deliberate and is what the contract asks for: a `ModuleMount` naming a module nobody has\n * authored yet is a validation *warning*, so it must contribute no routes rather than break navigation.\n */\n private loadModule = async (moduleKey: string): Promise<ModuleDefinition | undefined> => {\n const known = this.injector.get(ModuleDefinitionStore).loadById(moduleKey);\n if (known) return known;\n return (await this.fetch(() => firstValueFrom(this.moduleService.findById(moduleKey)))) as ModuleDefinition | undefined;\n };\n\n /** `findById` resolves to `void` for a missing record and rejects on a transport error; both mean \"no\". */\n private async fetch<Result>(read: () => Promise<Result | void>): Promise<Result | undefined> {\n try {\n return (await read()) || undefined;\n } catch {\n return undefined;\n }\n }\n}\n\n/** A {@link ModuleLoader} over the modules a layout carried; a mount naming any other module shows nothing. */\nfunction inlineModules(modules: ModuleDefinition[]): ModuleLoader {\n return async (moduleKey) => modules.find((module) => module.id === moduleKey);\n}\n\n/**\n * Where the application root goes. Without it the app's own URL — `…/preview` with nothing after it —\n * matches none of the children and the *whole* route fails to match, which would take the preview screen\n * down rather than merely leave its content area empty.\n *\n * The authored order decides, falling back to the first route as built. The fallback is not decoration: an\n * app may declare no routes of its own and mount all of its screens from a module, in which case the\n * definition offers no path to land on but the built routes do.\n */\nfunction indexRoute(definition: AppDefinition, built: Routes) {\n const target = definition.routes?.find((route) => route.path)?.path ?? built[0].path;\n // `pathMatch: 'full'`, or an empty path would prefix-match every URL below it and swallow the app.\n return { path: '', pathMatch: 'full' as const, redirectTo: target };\n}\n\n/**\n * Registers an application's own routes as the children of the Preview tab's route, so that navigating\n * inside a previewed application is *real* navigation: real URLs, real back button, real outlet.\n *\n * Why a `canMatch` guard rather than `loadChildren`, which is the obvious hook for lazily-known children:\n * the router caches a `loadChildren` result on the `Route` object as `_loadedRoutes`, and one Route object\n * serves every `:entityId`. The first app previewed would therefore have its routes replayed for the\n * second. `children`, by contrast, is read fresh on every recognition and never cached — and `canMatch`\n * runs, and is awaited, *before* the router reads it. So this is the one hook that can answer \"children of\n * *this* app\" and still work on a deep link.\n *\n * Always returns `true`. It is not deciding whether the tab may be entered — it is filling in the tab's\n * children on the way past.\n */\nexport const appShellRoutesGuard: CanMatchFn = (route, _segments, snapshot) => {\n const appId = snapshot.paramMap.get(BaseUrlSegments.EntityID);\n if (!appId) return true;\n\n // `inject` before the first await: an async function loses the injection context at its first suspension.\n const factory = inject(AppShellRoutesFactory);\n return factory.childrenOf(appId).then((children) => {\n route.children = children;\n return true;\n });\n};\n","import { EntityTabDescriptor } from '@processpuzzle/base-entity';\nimport { APP_PREVIEW_I18N_KEY } from '../base-app.i18n';\nimport { AppPreviewComponent } from './app-preview.component';\nimport { appShellRoutesGuard } from './shell/app-shell-routes';\n\n/**\n * The Preview tab, declared once and consumed twice: `BASE_APP_ROUTES` mounts it as\n * `app-definition/<id>/preview`, and `AppDefinitionContainerComponent` puts it on the descriptor so the tab bar\n * renders the link. One constant rather than two literals because the segment is what ties the link to the\n * route — a mismatch would render a tab that navigates to a URL nothing matches.\n *\n * The tab is a *container*: `children` starts empty and {@link appShellRoutesGuard} fills it with the\n * previewed application's own routes on every navigation, so the shell's `<router-outlet>` renders real\n * screens at real URLs — `app-definition/demo/preview/orders`. The empty array is load-bearing; a route with\n * no `children` at all takes the `loadChildren` path instead, which is cached per Route object and so cannot\n * vary by `:entityId`.\n */\nexport const APP_PREVIEW_TAB: EntityTabDescriptor = {\n segment: 'preview',\n i18nKey: APP_PREVIEW_I18N_KEY,\n component: AppPreviewComponent,\n testIdSuffix: 'show-preview',\n children: [],\n canMatch: [appShellRoutesGuard],\n};\n","import { Component, ComponentRef, inject, OnDestroy, ViewChild } from '@angular/core';\nimport { BaseEntityContainerComponent, BaseEntityDescriptor, BaseFormHostDirective } from '@processpuzzle/base-entity';\nimport { AppDefinitionStore } from '../domain/app-definition.store';\nimport { createAppDefinitionDescriptor } from '../domain/app-definition.descriptors';\nimport { APP_PREVIEW_TAB } from './app-preview-tab';\n\n/**\n * The App Definition screens, with the Preview tab beside the form.\n *\n * There is no Publish button here any more. An application goes live together with everything it uses — its\n * modules, and the entities, rules and workflows its routes reach — so publishing is the organization's\n * release, made from the designer's Release section, not an action on one definition.\n */\n@Component({\n selector: 'pp-app-definition-container',\n standalone: true,\n imports: [BaseEntityContainerComponent],\n template: ` <base-entity-container [entityDescriptor]=\"entityDescriptor\"></base-entity-container> `,\n})\nexport class AppDefinitionContainerComponent implements OnDestroy {\n private readonly containerComponentRef: ComponentRef<BaseEntityContainerComponent> | undefined;\n @ViewChild(BaseFormHostDirective, { static: true, read: BaseFormHostDirective }) baseEntityHost!: BaseFormHostDirective;\n private readonly store = inject(AppDefinitionStore);\n readonly entityDescriptor: BaseEntityDescriptor;\n\n constructor() {\n this.entityDescriptor = createAppDefinitionDescriptor();\n this.entityDescriptor.store = this.store;\n this.entityDescriptor.extraTabs = [APP_PREVIEW_TAB];\n }\n\n ngOnDestroy(): void {\n if (this.containerComponentRef) {\n this.containerComponentRef.destroy();\n }\n }\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { inject, Injectable, signal } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanMatchFn, Route, Router, Routes } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\nimport { AppDefinition } from '../../domain/app-definition';\nimport { AppDefinitionService } from '../../domain/app-definition.service';\nimport { AppShellRoutesFactory } from './app-shell-routes';\n\n/**\n * The published revision of the application the runtime host renders — what end users see, as opposed to\n * the draft the designer edits and previews.\n *\n * Held here rather than in `AppDefinitionStore`, which is the designer's store of drafts: the two are\n * different revisions of the same entity, and one store holding both would let a save in the designer\n * leak into the live application before it was published.\n */\n@Injectable({ providedIn: 'root' })\nexport class PublishedAppStore {\n private readonly appService = inject(AppDefinitionService);\n private readonly _published = signal<AppDefinition | undefined>(undefined);\n private readonly _loaded = signal(false);\n\n /** The published definition; `undefined` before the first load and while nothing has been published. */\n readonly published = this._published.asReadonly();\n /** Whether a load has finished, so a host can tell \"not published\" from \"not asked yet\". */\n readonly loaded = this._loaded.asReadonly();\n\n /**\n * Reads the published revision afresh. A transport failure is treated like \"not published\": the host then\n * renders its fallback rather than a dead URL, and the error itself has been reported by the interceptor.\n *\n * A 401 is the exception: it says the session ended, not that nothing is published, and answering it with\n * the fallback would show the user a working-looking application that fails on every call. It is rethrown\n * and the store is left as it was — neither `published` nor `loaded` changes — while the session-expired\n * interceptor sends the user to sign in again.\n */\n async load(appId: string): Promise<AppDefinition | undefined> {\n let definition: AppDefinition | undefined;\n try {\n definition = await firstValueFrom(this.appService.findPublished(appId));\n } catch (error) {\n if (error instanceof HttpErrorResponse && error.status === 401) throw error;\n definition = undefined;\n }\n this._published.set(definition);\n this._loaded.set(true);\n return definition;\n }\n\n /** Records that there is no application to load, as a finished load that found nothing. */\n async clear(): Promise<undefined> {\n this._published.set(undefined);\n this._loaded.set(true);\n return undefined;\n }\n}\n\n/**\n * Registers the **published** application's routes as the children of the runtime host's route — the\n * production counterpart of `appShellRoutesGuard`, and the same `canMatch` technique for the same reason:\n * `children` is read fresh on every recognition, and this runs, awaited, before the router reads it.\n *\n * **When it fetches.** On entering the host — the first load, or coming back from the designer or any other\n * screen outside it — and not on navigations inside it. Entering is the moment a newly published revision\n * has to show up: \"Publish, then back to the application\" is the designer's whole workflow. Inside, the\n * routes built on entry stay, so moving between the application's pages costs no request.\n *\n * `fallback` takes the place of the application's routes while nothing has been published — or a published\n * revision has no routes — so that the host's URL always matches something. Without it the host route would\n * fail to match, a catch-all would redirect back to it, and the navigation would never settle.\n *\n * `appId` is either the id itself or a function that finds it — for a host that cannot know it at build\n * time, because the organization's application is whichever one it kept. The function is called in the\n * guard's injection context, and an `undefined` answer means there is no application: the fallback.\n *\n * Always resolves to `true`: it does not decide whether the host may be entered, it fills in its children.\n */\nexport function publishedAppRoutesGuard(appId: string | AppIdResolver, fallback: Routes = []): CanMatchFn {\n return (route) => {\n const router = inject(Router);\n if (isActive(router.routerState.snapshot.root, route)) return true;\n\n // `inject` before the first await: an async callback loses the injection context at its first suspension.\n const store = inject(PublishedAppStore);\n const factory = inject(AppShellRoutesFactory);\n const id = typeof appId === 'string' ? Promise.resolve(appId) : appId();\n return id\n .then((resolved) => (resolved ? store.load(resolved) : store.clear()))\n .then(async (definition) => {\n const children = definition ? await factory.childrenFor(definition) : [];\n route.children = children.length ? children : fallback;\n return true;\n });\n };\n}\n\n/** Finds the id of the application a runtime host renders; `undefined` when the organization has none. */\nexport type AppIdResolver = () => Promise<string | undefined>;\n\n/** Whether `route` is part of the router state being navigated away from — i.e. the host is already showing. */\nfunction isActive(snapshot: ActivatedRouteSnapshot, route: Route): boolean {\n return snapshot.routeConfig === route || snapshot.children.some((child) => isActive(child, route));\n}\n","import { computed, Directive, effect, EnvironmentInjector, inject, input, runInInjectionContext } from '@angular/core';\nimport { ThemeService } from '@processpuzzle/widgets';\nimport { themeDefaultsOf, themeVarsOf } from './app-shell.model';\nimport { AppIdResolver, PublishedAppStore } from './published-app-routes';\n\n/**\n * Makes the element and everything below it wear the theme of the **published** application — the preset,\n * colour scheme and token overrides its definition declares, and the user's own choice in a `ThemesButton`,\n * remembered under the same key `AppShellComponent` uses. So the screens that work *on* the application\n * (administration, for one) look like the application instead of like the host's default.\n *\n * The standard way for a custom application's own chrome to follow the application's theme: bind it on the\n * chrome's root element, passing the {@link AppIdResolver} that finds the application. When the published\n * revision has not been read yet — a deep link straight into the administration — the directive reads it.\n *\n * `enabled` switches the theme off, for a mode that must keep the host's look (the designer).\n *\n * Like `AppShellComponent` it needs `pp-material-themes.scss` among the application's global styles.\n */\n@Directive({\n selector: '[ppPublishedAppTheme]',\n providers: [ThemeService],\n host: { '[class]': 'themeClass()', '[style]': 'themeVars()' },\n})\nexport class PublishedAppThemeDirective {\n readonly appIdResolver = input.required<AppIdResolver>({ alias: 'ppPublishedAppTheme' });\n readonly enabled = input(true, { alias: 'ppPublishedAppThemeEnabled' });\n\n private readonly store = inject(PublishedAppStore);\n private readonly theme = inject(ThemeService);\n private readonly injector = inject(EnvironmentInjector);\n private loading = false;\n\n protected readonly themeClass = computed(() => (this.enabled() ? this.theme.themeClass() : ''));\n protected readonly themeVars = computed(() => (this.enabled() ? themeVarsOf(this.store.published()) : {}));\n\n private readonly loadWhenUnread = effect(() => {\n if (!this.enabled() || this.store.loaded() || this.loading) return;\n this.loading = true;\n const resolver = this.appIdResolver();\n void runInInjectionContext(this.injector, resolver)\n .then((appId) => (appId ? this.store.load(appId) : this.store.clear()))\n // A refused read (401: the session ended) leaves the store unloaded and is acted on by the session-expired\n // interceptor and the host's guard; it is not this directive's to report, and must not escape as an unhandled rejection.\n .catch(() => undefined)\n .finally(() => (this.loading = false));\n });\n\n private readonly applyDefaults = effect(() => {\n const definition = this.store.published();\n this.theme.setDefaults(themeDefaultsOf(definition));\n this.theme.persistUnder(definition?.id ? `pp-theme:${definition.id}` : null);\n });\n}\n","import { afterNextRender, Component, DestroyRef, inject, Injector } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute } from '@angular/router';\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { take } from 'rxjs';\nimport { APP_CONCEPTS_I18N_SCOPE, BASE_APP_TRANSLOCO_SCOPE } from '../base-app.i18n';\n\n/**\n * The concepts the guide explains, in the order an application is assembled. Each is a section with a\n * stable anchor — see {@link appConceptAnchor} — so a designer tooltip can point at exactly the paragraph\n * that explains its field.\n */\nexport const APP_CONCEPTS = [\n 'assembling',\n 'application',\n 'theme',\n 'layout',\n 'regions',\n 'header',\n 'footer',\n 'navigation',\n 'routes',\n 'widgets',\n 'entities',\n 'documents',\n 'modules',\n 'roles',\n 'lifecycle',\n] as const;\nexport type AppConcept = (typeof APP_CONCEPTS)[number];\n\n/** Element id of a concept's section; append it as the URL fragment of a page hosting the guide. */\nexport function appConceptAnchor(concept: AppConcept): string {\n return `app-concept-${concept}`;\n}\n\n/**\n * The guide hosted by the application samples page: what a dynamic application is made of and how the\n * pieces relate, written for the person assembling one rather than for a developer.\n *\n * The bodies are translation values carrying a little inline markup (`<b>`, `<code>`, `<ul>`), bound\n * through `[innerHTML]` — Angular's sanitizer keeps exactly that subset, and the text is ours, not the tenant's.\n */\n@Component({\n selector: 'pp-app-concepts-guide',\n standalone: true,\n imports: [TranslocoPipe],\n template: `\n <article class=\"guide\" aria-labelledby=\"app-concepts-title\">\n <h2 id=\"app-concepts-title\">{{ scope + '.title' | transloco }}</h2>\n <p class=\"intro\" [innerHTML]=\"scope + '.intro' | transloco\"></p>\n @for (concept of concepts; track concept) {\n <section [id]=\"anchor(concept)\">\n <h3>{{ scope + '.' + concept + '.title' | transloco }}</h3>\n <div [innerHTML]=\"scope + '.' + concept + '.body' | transloco\"></div>\n </section>\n }\n </article>\n `,\n styles: [\n `\n .guide {\n max-width: 960px;\n padding: 16px 24px 32px;\n line-height: 1.5;\n }\n .intro {\n font-size: 1.05em;\n }\n section {\n border-top: 1px solid rgba(0, 0, 0, 0.12);\n padding-top: 8px;\n scroll-margin-top: 16px;\n }\n h3 {\n margin: 8px 0 4px;\n }\n :host ::ng-deep code {\n background: rgba(0, 0, 0, 0.06);\n border-radius: 3px;\n padding: 0 4px;\n }\n `,\n ],\n})\nexport class AppConceptsGuideComponent {\n readonly scope = APP_CONCEPTS_I18N_SCOPE;\n readonly concepts = APP_CONCEPTS;\n readonly anchor = appConceptAnchor;\n private readonly route = inject(ActivatedRoute);\n private readonly transloco = inject(TranslocoService);\n private readonly injector = inject(Injector);\n\n constructor() {\n // A deep link from a tooltip is honoured here rather than by the router's anchor scrolling, which runs\n // before this guide exists. Not before the scope's translations arrive, either: until then every section\n // is an empty heading, and the target would slide down the page as the text above it filled in.\n const fragment = this.route.snapshot.fragment;\n if (!fragment) return;\n this.transloco\n .selectTranslation(`${BASE_APP_TRANSLOCO_SCOPE}/${this.transloco.getActiveLang()}`)\n .pipe(take(1), takeUntilDestroyed(inject(DestroyRef)))\n .subscribe(() => afterNextRender(() => document.getElementById(fragment)?.scrollIntoView({ block: 'start' }), { injector: this.injector }));\n }\n}\n","import { Component, inject } from '@angular/core';\nimport { BaseEntityContainerComponent, BaseEntityDescriptor } from '@processpuzzle/base-entity';\nimport { createModuleDefinitionDescriptor } from '../domain/module-definition.descriptors';\nimport { ModuleDefinitionStore } from '../domain/module-definition.store';\n\n/**\n * Hosts the generic container for `Module Definition`, whose only job is to bind the descriptor to the\n * store the routable screens read from.\n *\n * Deliberately without the `Publish` action `AppDefinitionContainerComponent` contributes: publishing is\n * an application operation. An app is what a user navigates to and its status is what decides whether a\n * mount is live, so a module with a lifecycle of its own would make \"which version of what is live\" a\n * question with two answers.\n */\n@Component({\n selector: 'pp-module-definition-container',\n standalone: true,\n imports: [BaseEntityContainerComponent],\n template: `<base-entity-container [entityDescriptor]=\"entityDescriptor\"></base-entity-container>`,\n})\nexport class ModuleDefinitionContainerComponent {\n private readonly store = inject(ModuleDefinitionStore);\n readonly entityDescriptor: BaseEntityDescriptor;\n\n constructor() {\n this.entityDescriptor = createModuleDefinitionDescriptor();\n this.entityDescriptor.store = this.store;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BaseEntityDescriptor, EmbeddedEntityFacade } from '@processpuzzle/base-entity';\nimport { WorkingContextRow } from '../domain/app-definition';\nimport { createWorkingContextDescriptor } from '../domain/working-context.descriptors';\n\n/** A context is a row of the `App Definition` document, edited through it like a route or a mount. */\n@Injectable()\nexport class AppContextFacade extends EmbeddedEntityFacade<WorkingContextRow> {\n readonly entityType = WorkingContextRow;\n\n protected override createDescriptor(): BaseEntityDescriptor {\n return createWorkingContextDescriptor();\n }\n}\n","import type { Provider } from '@angular/core';\nimport type { BaseEntityFacadeRegistry } from '@processpuzzle/base-entity';\nimport {\n APP_CONTEXT_ENTITY_NAME,\n APP_DEFINITION_ENTITY_NAME,\n APP_MODULE_MOUNT_ENTITY_NAME,\n APP_NAV_ITEM_ENTITY_NAME,\n APP_REGION_ENTITY_NAME,\n APP_ROUTE_ENTITY_NAME,\n APP_WIDGET_ENTITY_NAME,\n MODULE_DEFINITION_ENTITY_NAME,\n} from './domain/app-entity-names';\nimport { AppContextFacade } from './feature/app-context.facade';\nimport { AppDefinitionFacade } from './feature/app-definition.facade';\nimport { AppModuleMountFacade } from './feature/app-module-mount.facade';\nimport { AppNavItemFacade } from './feature/app-nav-item.facade';\nimport { AppRegionFacade } from './feature/app-region.facade';\nimport { AppRouteFacade } from './feature/app-route.facade';\nimport { AppWidgetFacade } from './feature/app-widget.facade';\nimport { ModuleDefinitionFacade } from './feature/module-definition.facade';\n\n/**\n * The facades of the whole definition graph, to be spread into the application's `providers`.\n *\n * The embedded ones are here for the same reason the routable one is: an embedded entity has a facade\n * like any other — that is what gives it a store — and only its repository differs, reading and writing\n * the `App Definition` document rather than an endpoint of its own.\n */\nexport const BASE_APP_FACADE_PROVIDERS: Provider[] = [\n AppDefinitionFacade,\n ModuleDefinitionFacade,\n AppRegionFacade,\n AppRouteFacade,\n AppModuleMountFacade,\n AppContextFacade,\n AppNavItemFacade,\n AppWidgetFacade,\n];\n\n/**\n * The same facades keyed by entity name, to be spread into the application's\n * `BASE_ENTITY_FACADE_REGISTRY` value.\n *\n * Every entity an `EMBEDDED_COMPONENTS` attribute of this library names has to appear here, or the\n * control throws on first render rather than showing a list whose rows go nowhere on save — the\n * registry is how it reaches the child's store and descriptor. Spread rather than provided separately,\n * because the token holds one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the\n * application's own entities instead of adding to them.\n */\nexport const BASE_APP_ENTITY_FACADES: BaseEntityFacadeRegistry = {\n [APP_DEFINITION_ENTITY_NAME]: AppDefinitionFacade,\n [MODULE_DEFINITION_ENTITY_NAME]: ModuleDefinitionFacade,\n [APP_REGION_ENTITY_NAME]: AppRegionFacade,\n [APP_ROUTE_ENTITY_NAME]: AppRouteFacade,\n [APP_MODULE_MOUNT_ENTITY_NAME]: AppModuleMountFacade,\n [APP_CONTEXT_ENTITY_NAME]: AppContextFacade,\n [APP_NAV_ITEM_ENTITY_NAME]: AppNavItemFacade,\n [APP_WIDGET_ENTITY_NAME]: AppWidgetFacade,\n};\n","import { Routes } from '@angular/router';\nimport { provideTranslocoScope } from '@jsverse/transloco';\nimport { baseEntityRoutes, type EmbeddedChildRoute } from '@processpuzzle/base-entity';\nimport { BASE_APP_TRANSLOCO_SCOPE, BASE_ENTITY_TRANSLOCO_SCOPE } from './base-app.i18n';\nimport { APP_DEFINITION_ENTITY_NAME } from './domain/app-definition.descriptors';\nimport {\n APP_CONTEXT_ENTITY_NAME,\n APP_MODULE_MOUNT_ENTITY_NAME,\n APP_NAV_ITEM_ENTITY_NAME,\n APP_REGION_ENTITY_NAME,\n APP_ROUTE_ENTITY_NAME,\n APP_WIDGET_ENTITY_NAME,\n MODULE_DEFINITION_ENTITY_NAME,\n} from './domain/app-entity-names';\nimport { AppDefinitionContainerComponent } from './feature/app-definition-container.component';\nimport { APP_PREVIEW_TAB } from './feature/app-preview-tab';\nimport { AppContextFacade } from './feature/app-context.facade';\nimport { AppModuleMountFacade } from './feature/app-module-mount.facade';\nimport { AppNavItemFacade } from './feature/app-nav-item.facade';\nimport { AppRegionFacade } from './feature/app-region.facade';\nimport { AppRouteFacade } from './feature/app-route.facade';\nimport { AppWidgetFacade } from './feature/app-widget.facade';\nimport { ModuleDefinitionContainerComponent } from './feature/module-definition-container.component';\n\n/**\n * The path segment has to be `snakeCaseName('App Definition')`, because\n * `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — see the same\n * constraint on `BASE_RULE_ROUTES`.\n */\nexport const BASE_APP_ROUTES: Routes = [\n {\n path: 'app-definition',\n title: 'ProcessPuzzle Design - Applications',\n data: { icon: 'web', menuTitle: 'design.applications', entityName: APP_DEFINITION_ENTITY_NAME },\n component: AppDefinitionContainerComponent,\n providers: [authoringScopes()],\n children: baseEntityRoutes(embeddedDefinitionRoutes(), [APP_PREVIEW_TAB]),\n },\n // A sibling rather than a child of the branch above: a module is an aggregate of its own, with its own\n // endpoints and its own list screen. What ties the two together is data — a `ModuleMount` naming a key —\n // and the run-time shell that resolves it, not the authoring URL.\n {\n path: 'module-definition',\n title: 'ProcessPuzzle Design - Modules',\n data: { icon: 'extension', menuTitle: 'design.modules', entityName: MODULE_DEFINITION_ENTITY_NAME },\n component: ModuleDefinitionContainerComponent,\n providers: [authoringScopes()],\n children: baseEntityRoutes([routeRoute()]),\n },\n];\n\n/**\n * The transloco scopes every authoring branch of this library needs. Both are required: a route that\n * declares TRANSLOCO_SCOPE replaces the collection it inherits rather than adding to it, and the generic\n * tabs translate the framework's own `base_entity.*` keys (see BASE_ENTITY_TRANSLOCO_SCOPE).\n *\n * Registered on the top-level routes rather than on the containers, so the base-entity tabs, list and form\n * rendered in the child routes resolve entity and attribute labels from the same scopes. The embedded\n * branches below need none of their own: `base_app.app_region.*` and its siblings are keys of the scope\n * already registered here.\n *\n * Both aliases are spelled out, as everywhere in this workspace: transloco camel-cases the default alias,\n * so `base_app` would silently become `baseApp` and miss every key below it.\n */\nfunction authoringScopes() {\n return provideTranslocoScope({ scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE }, { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE });\n}\n\n/**\n * The definition graph as route branches: a region, a route and a module mount hang below the\n * definition's details route, a nav item and a widget below the region's, a widget below the route's,\n * and a nav item below itself.\n *\n * The nesting mirrors the containment of `base-app-api.yaml` exactly, and it has to: an embedded row has\n * no id of its own to be looked up by, so the URL — `app-definition/claims-app/details/app-region/sidenav/\n * details/app-nav-item/nav-claims/details` — is what addresses it, and each segment resolves against the\n * rows of the level above it.\n *\n * These are the *authoring* routes and have nothing to do with the routes an `AppDefinition` declares:\n * `App Route` rows are data here, and it is the run-time shell that turns them into `Routes` of their\n * own. A module mount is a leaf — the module it names is a separate aggregate with its own endpoints,\n * so its routes are authored there rather than through this branch.\n */\nfunction embeddedDefinitionRoutes(): EmbeddedChildRoute[] {\n return [\n { entityName: APP_REGION_ENTITY_NAME, facade: AppRegionFacade, children: () => [navItemRoute(), widgetRoute()] },\n routeRoute(),\n { entityName: APP_MODULE_MOUNT_ENTITY_NAME, facade: AppModuleMountFacade },\n { entityName: APP_CONTEXT_ENTITY_NAME, facade: AppContextFacade },\n ];\n}\n\n/**\n * The `App Route` branch, shared by both aggregates that own routes: an app's `routes` and a module's are\n * the same rows edited by the same descriptor, so the branch below them has to be the same too. Only the\n * URL prefix differs — `app-definition/demo/details/app-route/...` against\n * `module-definition/claims/details/app-route/...`.\n */\nfunction routeRoute(): EmbeddedChildRoute {\n return { entityName: APP_ROUTE_ENTITY_NAME, facade: AppRouteFacade, children: () => [widgetRoute()] };\n}\n\n/** A nav item nests in itself — a group node's children are nav items. Hence the thunk: the structure is\n * infinite, and `loadChildren` expands one level per navigation. */\nfunction navItemRoute(): EmbeddedChildRoute {\n return { entityName: APP_NAV_ITEM_ENTITY_NAME, facade: AppNavItemFacade, children: () => [navItemRoute()] };\n}\n\n/**\n * A widget, unlike a nav item, is a leaf branch: widgets do not nest, so there is no deeper level to\n * expand. A container widget places its siblings by id through `props.childIds`, and those siblings are\n * rows of this same list — reachable at this level, not below it.\n */\nfunction widgetRoute(): EmbeddedChildRoute {\n return { entityName: APP_WIDGET_ENTITY_NAME, facade: AppWidgetFacade };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,MAAa,kBAAkB;AAG/B,MAAa,gBAAgB;AAG7B,MAAa,iBAAiB;CAAC;CAAgB;CAAiB;AAAS;AAGzE,MAAa,gBAAgB;CAAC;CAAQ;CAAQ;AAAM;AAUpD,MAAa,eAAe;CAAC;CAAU;CAAW;CAAU;AAAW;AAQvE,MAAa,qBAAqB;CAAC;CAAW;CAAY;AAAQ;AAGlE,MAAa,eAAe,CAAC,QAAQ,SAAS;AAG9C,IAAY;CAAZ,SAAY,qBAAmB;CAC7B,oBAAA,WAAA;CACA,oBAAA,eAAA;AACF,EAAA,CAHY,wBAAA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