@runic-artifex/angular 0.19.0 → 0.20.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.
- package/README.md +130 -23
- package/dist/fesm2022/runic-artifex-angular-experimental.mjs +285 -0
- package/dist/fesm2022/runic-artifex-angular-experimental.mjs.map +1 -0
- package/dist/fesm2022/runic-artifex-angular-forms.mjs +246 -0
- package/dist/fesm2022/runic-artifex-angular-forms.mjs.map +1 -0
- package/dist/fesm2022/runic-artifex-angular.mjs +975 -0
- package/dist/fesm2022/runic-artifex-angular.mjs.map +1 -0
- package/dist/types/runic-artifex-angular-experimental.d.ts +85 -0
- package/dist/types/runic-artifex-angular-forms.d.ts +72 -0
- package/dist/types/runic-artifex-angular.d.ts +626 -0
- package/package.json +20 -17
- package/dist/esm/experimental.d.ts +0 -39
- package/dist/esm/experimental.js +0 -64
- package/dist/esm/forms/index.d.ts +0 -2
- package/dist/esm/forms/index.js +0 -2
- package/dist/esm/forms/runic-field.directive.d.ts +0 -48
- package/dist/esm/forms/runic-field.directive.js +0 -195
- package/dist/esm/forms/signal-forms.d.ts +0 -19
- package/dist/esm/forms/signal-forms.js +0 -29
- package/dist/esm/index.d.ts +0 -24
- package/dist/esm/index.js +0 -25
- package/dist/esm/inject-appearance.d.ts +0 -19
- package/dist/esm/inject-appearance.js +0 -28
- package/dist/esm/inject-bridge-connection.d.ts +0 -22
- package/dist/esm/inject-bridge-connection.js +0 -26
- package/dist/esm/inject-collection-viewport.d.ts +0 -13
- package/dist/esm/inject-collection-viewport.js +0 -31
- package/dist/esm/inject-command.d.ts +0 -35
- package/dist/esm/inject-command.js +0 -33
- package/dist/esm/inject-field.d.ts +0 -66
- package/dist/esm/inject-field.js +0 -58
- package/dist/esm/inject-form.d.ts +0 -40
- package/dist/esm/inject-form.js +0 -48
- package/dist/esm/inject-latest-operation.d.ts +0 -25
- package/dist/esm/inject-latest-operation.js +0 -35
- package/dist/esm/inject-menu-bar.d.ts +0 -32
- package/dist/esm/inject-menu-bar.js +0 -39
- package/dist/esm/inject-operation.d.ts +0 -23
- package/dist/esm/inject-operation.js +0 -33
- package/dist/esm/inject-query-collection.d.ts +0 -29
- package/dist/esm/inject-query-collection.js +0 -64
- package/dist/esm/inject-text-field.d.ts +0 -55
- package/dist/esm/inject-text-field.js +0 -51
- package/dist/esm/inject-text.d.ts +0 -57
- package/dist/esm/inject-text.js +0 -107
- package/dist/esm/inject-view-resource.d.ts +0 -39
- package/dist/esm/inject-view-resource.js +0 -98
- package/dist/esm/inject-view.d.ts +0 -41
- package/dist/esm/inject-view.js +0 -67
- package/dist/esm/instance.d.ts +0 -34
- package/dist/esm/instance.js +0 -48
- package/dist/esm/view-outlet.d.ts +0 -101
- package/dist/esm/view-outlet.js +0 -177
package/dist/esm/instance.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { assertInInjectionContext, inject, InjectionToken } from "@angular/core";
|
|
2
|
-
import { defaultInstance } from "@runic-artifex/views";
|
|
3
|
-
/**
|
|
4
|
-
* The Runic instance (`createRunicInstance` in `@runic-artifex/views`) that the `inject*` helpers, `ViewOutlet` and the
|
|
5
|
-
* `runicText` pipe connect and read through. Without a provider it is the default instance: the page instance, on
|
|
6
|
-
* `globalThis.__runicBridge`, as before instances existed, or in a component bundle its element's.
|
|
7
|
-
*/
|
|
8
|
-
export const RUNIC_INSTANCE = new InjectionToken("RUNIC_INSTANCE", {
|
|
9
|
-
providedIn: "root",
|
|
10
|
-
factory: () => defaultInstance(),
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* Provides `instance` as the {@link RUNIC_INSTANCE} of an injector: `injectView`, `injectField`, `injectText`,
|
|
14
|
-
* `injectBridgeConnection`, `injectAppearance` and the other helpers below it use it instead of the page instance. A
|
|
15
|
-
* guest that renders inside another page, such as an embedded component, adds it to its application's or its root
|
|
16
|
-
* component's `providers`.
|
|
17
|
-
*
|
|
18
|
-
* ```ts
|
|
19
|
-
* const instance = createRunicInstance({ bridge });
|
|
20
|
-
* bootstrapApplication(App, { providers: [provideRunicInstance(instance)] });
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function provideRunicInstance(instance) {
|
|
24
|
-
return { provide: RUNIC_INSTANCE, useValue: instance };
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The Runic instance of the injection context: the nearest {@link provideRunicInstance}, or the default instance
|
|
28
|
-
* (`defaultInstance()`: the page instance, or in a component bundle its element's).
|
|
29
|
-
*/
|
|
30
|
-
export function injectRunicInstance({ injector } = {}) {
|
|
31
|
-
if (injector)
|
|
32
|
-
return instanceOf(injector);
|
|
33
|
-
assertInInjectionContext(injectRunicInstance);
|
|
34
|
-
return inject(RUNIC_INSTANCE, { optional: true }) ?? defaultInstance();
|
|
35
|
-
}
|
|
36
|
-
/** @internal The Runic instance of `injector`. */
|
|
37
|
-
export function instanceOf(injector) {
|
|
38
|
-
return injector.get(RUNIC_INSTANCE, null) ?? defaultInstance();
|
|
39
|
-
}
|
|
40
|
-
/** @internal The Runic instance of the injection context, or the default instance outside one. */
|
|
41
|
-
export function contextInstance() {
|
|
42
|
-
try {
|
|
43
|
-
return inject(RUNIC_INSTANCE, { optional: true }) ?? defaultInstance();
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
return defaultInstance();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { type InputSignal, type TemplateRef, type Type } from "@angular/core";
|
|
2
|
-
import { type PageReference, type RegionCollection, type RegionEntry, type ViewRegistryPage } from "@runic-artifex/views";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* A build-known map checks each generated reference against its component input. A nullable
|
|
6
|
-
* reference, such as a region slot's `State["main"]`, checks its non-null kinds. A component whose `page` input is a
|
|
7
|
-
* shared page reference (`[RunicSharedClient]`), such as `ResultPagePageReference`, registers for each of its kinds.
|
|
8
|
-
*/
|
|
9
|
-
export type ViewRegistry<R extends PageReference | null | undefined> = {
|
|
10
|
-
readonly [K in NonNullable<R>["kind"]]: PageComponent<ViewRegistryPage<R, K>>;
|
|
11
|
-
};
|
|
12
|
-
type PageComponent<P> = P extends unknown ? Type<{
|
|
13
|
-
readonly page: InputSignal<P>;
|
|
14
|
-
}> : never;
|
|
15
|
-
/** The context of a `missing` template: the reference without a component, as `$implicit` (`let-page`) and `content`. */
|
|
16
|
-
export interface ViewOutletMissingContext<R extends PageReference = PageReference> {
|
|
17
|
-
readonly $implicit: R;
|
|
18
|
-
readonly content: R;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Headless host for a selected logical .NET View. A changed reference remounts its component, and
|
|
22
|
-
* the projected content renders while there is no reference. A kind without a component renders
|
|
23
|
-
* the `missing` template, for example localized text. Without it, a development build (`isDevMode()`) renders an
|
|
24
|
-
* English alert, and a production build renders nothing and reports the kind (`installErrorReporting`,
|
|
25
|
-
* `onBridgeDiagnostic`):
|
|
26
|
-
*
|
|
27
|
-
* ```html
|
|
28
|
-
* <runic-view-outlet [content]="state()?.main" [registry]="pages" [missing]="missingView" />
|
|
29
|
-
* <ng-template #missingView let-page><p role="alert">{{ missingText(page.kind) }}</p></ng-template>
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* The element keeps Angular's prefix convention: `<runic-view-outlet [content]="…" [registry]="…" />`.
|
|
33
|
-
*/
|
|
34
|
-
export declare class ViewOutlet<R extends PageReference = PageReference> {
|
|
35
|
-
readonly content: InputSignal<R | null | undefined>;
|
|
36
|
-
readonly registry: InputSignal<ViewRegistry<R>>;
|
|
37
|
-
/** Renders a reference whose kind has no registered component instead of the development alert. */
|
|
38
|
-
readonly missing: InputSignal<TemplateRef<ViewOutletMissingContext<R>> | undefined>;
|
|
39
|
-
readonly error: import("@angular/core").WritableSignal<string | undefined>;
|
|
40
|
-
private readonly mount;
|
|
41
|
-
private readonly selected;
|
|
42
|
-
constructor();
|
|
43
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ViewOutlet<any>, never>;
|
|
44
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ViewOutlet<any>, "runic-view-outlet", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "registry": { "alias": "registry"; "required": true; "isSignal": true; }; "missing": { "alias": "missing"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
45
|
-
}
|
|
46
|
-
/** How {@link RegionOutlets} renders the regions of a collection. */
|
|
47
|
-
export type RegionOutletsMode = "keep-mounted" | "selected";
|
|
48
|
-
/**
|
|
49
|
-
* Attributes that {@link RegionOutlets} sets on a region's wrapper, such as `id`, `role` and `aria-labelledby`. A
|
|
50
|
-
* `null` or `undefined` value leaves the attribute out. `hidden`, `style` and `data-region-key` stay controlled by
|
|
51
|
-
* the outlet and are ignored here.
|
|
52
|
-
*/
|
|
53
|
-
export type RegionPanelAttributes = Readonly<Record<string, string | null | undefined>>;
|
|
54
|
-
export declare class RegionPanel {
|
|
55
|
-
readonly attributes: InputSignal<Readonly<Record<string, string | null | undefined>> | undefined>;
|
|
56
|
-
constructor();
|
|
57
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RegionPanel, never>;
|
|
58
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RegionPanel, "[runicRegionPanel]", never, { "attributes": { "alias": "runicRegionPanel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Renders a {@link ViewOutlet} for the regions of a region collection, each in a `<div data-region-key>` tracked by
|
|
62
|
-
* the region's key. A region that is not selected is rendered with `hidden` and an inline `display: none`, which
|
|
63
|
-
* author CSS without `!important` cannot override. A new content reference in a region remounts only that region's
|
|
64
|
-
* component. The projected content renders while the collection has no region, and `missing` is passed to each
|
|
65
|
-
* outlet. `panelProps` returns attributes for each wrapper, so a tab can point `aria-controls` at its panel:
|
|
66
|
-
*
|
|
67
|
-
* ```html
|
|
68
|
-
* <runic-region-outlets [collection]="state()?.documents" [registry]="pages" [panelProps]="panel">No open documents</runic-region-outlets>
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* `mode` `"keep-mounted"` (the default) renders every region and hides all but the selected one, so each region
|
|
72
|
-
* keeps its component and DOM. `"selected"` renders only the selected region.
|
|
73
|
-
*/
|
|
74
|
-
export declare class RegionOutlets<R extends PageReference = PageReference> {
|
|
75
|
-
readonly collection: InputSignal<RegionCollection<R> | null | undefined>;
|
|
76
|
-
readonly registry: InputSignal<ViewRegistry<R>>;
|
|
77
|
-
/** Renders a reference whose kind has no registered component instead of the English alert. */
|
|
78
|
-
readonly missing: InputSignal<TemplateRef<ViewOutletMissingContext<R>> | undefined>;
|
|
79
|
-
readonly mode: InputSignal<RegionOutletsMode>;
|
|
80
|
-
/** Returns attributes for a region's wrapper, for example `{ id, role: "tabpanel", "aria-labelledby" }`. */
|
|
81
|
-
readonly panelProps: InputSignal<((entry: RegionEntry<R>) => RegionPanelAttributes) | undefined>;
|
|
82
|
-
protected readonly shown: import("@angular/core").Signal<{
|
|
83
|
-
region: RegionEntry<R>;
|
|
84
|
-
attributes: Readonly<Record<string, string | null | undefined>> | undefined;
|
|
85
|
-
}[]>;
|
|
86
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RegionOutlets<any>, never>;
|
|
87
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RegionOutlets<any>, "runic-region-outlets", never, { "collection": { "alias": "collection"; "required": false; "isSignal": true; }; "registry": { "alias": "registry"; "required": true; "isSignal": true; }; "missing": { "alias": "missing"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "panelProps": { "alias": "panelProps"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* The name of {@link ViewOutlet} before 0.7.0-preview.7, where React, Vue and Svelte already used
|
|
91
|
-
* `ViewOutlet`. It is the same component class, so it renders the same `<runic-view-outlet>` element
|
|
92
|
-
* without a second component definition for that selector (NG0912).
|
|
93
|
-
* @deprecated Import `ViewOutlet` instead; this alias is removed in the next major release.
|
|
94
|
-
*/
|
|
95
|
-
export declare const RunicViewOutlet: typeof ViewOutlet;
|
|
96
|
-
/**
|
|
97
|
-
* The name of {@link ViewOutlet} before 0.7.0-preview.7.
|
|
98
|
-
* @deprecated Import `ViewOutlet` instead; this alias is removed in the next major release.
|
|
99
|
-
*/
|
|
100
|
-
export type RunicViewOutlet<R extends PageReference = PageReference> = ViewOutlet<R>;
|
|
101
|
-
export {};
|
package/dist/esm/view-outlet.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { Component, computed, Directive, effect, ElementRef, inject, input, isDevMode, Renderer2, signal, untracked, viewChild, ViewContainerRef, } from "@angular/core";
|
|
2
|
-
import { regionEntries } from "@runic-artifex/views";
|
|
3
|
-
import { missingViewMessage, reportMissingView } from "@runic-artifex/views/bindings";
|
|
4
|
-
import { injectRunicInstance } from "./instance.js";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
// Projected content renders while there is no reference, like React's `fallback`, Vue's default slot
|
|
7
|
-
// and Svelte's `fallback` snippet: `<runic-view-outlet [content]="…" [registry]="…">Loading…</runic-view-outlet>`.
|
|
8
|
-
/**
|
|
9
|
-
* Headless host for a selected logical .NET View. A changed reference remounts its component, and
|
|
10
|
-
* the projected content renders while there is no reference. A kind without a component renders
|
|
11
|
-
* the `missing` template, for example localized text. Without it, a development build (`isDevMode()`) renders an
|
|
12
|
-
* English alert, and a production build renders nothing and reports the kind (`installErrorReporting`,
|
|
13
|
-
* `onBridgeDiagnostic`):
|
|
14
|
-
*
|
|
15
|
-
* ```html
|
|
16
|
-
* <runic-view-outlet [content]="state()?.main" [registry]="pages" [missing]="missingView" />
|
|
17
|
-
* <ng-template #missingView let-page><p role="alert">{{ missingText(page.kind) }}</p></ng-template>
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* The element keeps Angular's prefix convention: `<runic-view-outlet [content]="…" [registry]="…" />`.
|
|
21
|
-
*/
|
|
22
|
-
export class ViewOutlet {
|
|
23
|
-
content = input(/* @ts-ignore */
|
|
24
|
-
...(ngDevMode ? [undefined, { debugName: "content" }] : /* istanbul ignore next */ []));
|
|
25
|
-
registry = input.required(/* @ts-ignore */
|
|
26
|
-
...(ngDevMode ? [{ debugName: "registry" }] : /* istanbul ignore next */ []));
|
|
27
|
-
/** Renders a reference whose kind has no registered component instead of the development alert. */
|
|
28
|
-
missing = input(/* @ts-ignore */
|
|
29
|
-
...(ngDevMode ? [undefined, { debugName: "missing" }] : /* istanbul ignore next */ []));
|
|
30
|
-
error = signal(undefined, /* @ts-ignore */
|
|
31
|
-
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
32
|
-
mount = viewChild.required("mount", { ...(ngDevMode ? { debugName: "mount" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
|
|
33
|
-
selected = computed(() => {
|
|
34
|
-
const reference = this.content();
|
|
35
|
-
if (!reference)
|
|
36
|
-
return undefined;
|
|
37
|
-
// A registry built without `satisfies ViewRegistry<R>` may miss a kind at run time.
|
|
38
|
-
const component = this.registry()[reference.kind];
|
|
39
|
-
// `missing` is a dependency only while the kind has no component, so changing it never remounts one.
|
|
40
|
-
return { reference, component, missing: component ? undefined : this.missing() };
|
|
41
|
-
}, /* @ts-ignore */
|
|
42
|
-
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
43
|
-
constructor() {
|
|
44
|
-
const instance = injectRunicInstance();
|
|
45
|
-
effect(() => {
|
|
46
|
-
const container = this.mount();
|
|
47
|
-
const selection = this.selected();
|
|
48
|
-
// Creating the component runs its constructor and inputs; their signal
|
|
49
|
-
// reads must not become dependencies of this effect.
|
|
50
|
-
untracked(() => {
|
|
51
|
-
container.clear();
|
|
52
|
-
this.error.set(undefined);
|
|
53
|
-
if (!selection)
|
|
54
|
-
return;
|
|
55
|
-
if (!selection.component) {
|
|
56
|
-
if (selection.missing) {
|
|
57
|
-
container.createEmbeddedView(selection.missing, { $implicit: selection.reference, content: selection.reference });
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (isDevMode())
|
|
61
|
-
this.error.set(missingViewMessage(selection.reference.kind));
|
|
62
|
-
else
|
|
63
|
-
instance.run(() => reportMissingView(selection.reference.kind));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const component = container.createComponent(selection.component);
|
|
67
|
-
component.setInput("page", selection.reference);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: ViewOutlet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.3", type: ViewOutlet, isStandalone: true, selector: "runic-view-outlet", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, registry: { classPropertyName: "registry", publicName: "registry", isSignal: true, isRequired: true, transformFunction: null }, missing: { classPropertyName: "missing", publicName: "missing", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "mount", first: true, predicate: ["mount"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: `
|
|
73
|
-
<ng-container #mount />
|
|
74
|
-
@if (!content()) { <ng-content /> }
|
|
75
|
-
@if (error(); as issue) { <p role="alert">{{ issue }}</p> }
|
|
76
|
-
`, isInline: true });
|
|
77
|
-
}
|
|
78
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: ViewOutlet, decorators: [{
|
|
79
|
-
type: Component,
|
|
80
|
-
args: [{ selector: "runic-view-outlet", standalone: true, template: `
|
|
81
|
-
<ng-container #mount />
|
|
82
|
-
@if (!content()) { <ng-content /> }
|
|
83
|
-
@if (error(); as issue) { <p role="alert">{{ issue }}</p> }
|
|
84
|
-
` }]
|
|
85
|
-
}], ctorParameters: () => [], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], registry: [{ type: i0.Input, args: [{ isSignal: true, alias: "registry", required: true }] }], missing: [{ type: i0.Input, args: [{ isSignal: true, alias: "missing", required: false }] }], mount: [{ type: i0.ViewChild, args: ["mount", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
86
|
-
const outletAttributes = new Set(["hidden", "style", "data-region-key"]);
|
|
87
|
-
// Sets the attributes of the latest panelProps result on its element and removes the ones it no longer returns.
|
|
88
|
-
export class RegionPanel {
|
|
89
|
-
attributes = input(undefined, { ...(ngDevMode ? { debugName: "attributes" } : /* istanbul ignore next */ {}), alias: "runicRegionPanel" });
|
|
90
|
-
constructor() {
|
|
91
|
-
const element = inject(ElementRef).nativeElement;
|
|
92
|
-
const renderer = inject(Renderer2);
|
|
93
|
-
let applied = new Set();
|
|
94
|
-
effect(() => {
|
|
95
|
-
const set = new Set();
|
|
96
|
-
for (const [name, value] of Object.entries(this.attributes() ?? {})) {
|
|
97
|
-
if (value === null || value === undefined || outletAttributes.has(name.toLowerCase()))
|
|
98
|
-
continue;
|
|
99
|
-
renderer.setAttribute(element, name, value);
|
|
100
|
-
set.add(name);
|
|
101
|
-
}
|
|
102
|
-
for (const name of applied)
|
|
103
|
-
if (!set.has(name))
|
|
104
|
-
renderer.removeAttribute(element, name);
|
|
105
|
-
applied = set;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: RegionPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
109
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.3", type: RegionPanel, isStandalone: true, selector: "[runicRegionPanel]", inputs: { attributes: { classPropertyName: "attributes", publicName: "runicRegionPanel", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
110
|
-
}
|
|
111
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: RegionPanel, decorators: [{
|
|
112
|
-
type: Directive,
|
|
113
|
-
args: [{ selector: "[runicRegionPanel]", standalone: true }]
|
|
114
|
-
}], ctorParameters: () => [], propDecorators: { attributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "runicRegionPanel", required: false }] }] } });
|
|
115
|
-
/**
|
|
116
|
-
* Renders a {@link ViewOutlet} for the regions of a region collection, each in a `<div data-region-key>` tracked by
|
|
117
|
-
* the region's key. A region that is not selected is rendered with `hidden` and an inline `display: none`, which
|
|
118
|
-
* author CSS without `!important` cannot override. A new content reference in a region remounts only that region's
|
|
119
|
-
* component. The projected content renders while the collection has no region, and `missing` is passed to each
|
|
120
|
-
* outlet. `panelProps` returns attributes for each wrapper, so a tab can point `aria-controls` at its panel:
|
|
121
|
-
*
|
|
122
|
-
* ```html
|
|
123
|
-
* <runic-region-outlets [collection]="state()?.documents" [registry]="pages" [panelProps]="panel">No open documents</runic-region-outlets>
|
|
124
|
-
* ```
|
|
125
|
-
*
|
|
126
|
-
* `mode` `"keep-mounted"` (the default) renders every region and hides all but the selected one, so each region
|
|
127
|
-
* keeps its component and DOM. `"selected"` renders only the selected region.
|
|
128
|
-
*/
|
|
129
|
-
export class RegionOutlets {
|
|
130
|
-
collection = input(/* @ts-ignore */
|
|
131
|
-
...(ngDevMode ? [undefined, { debugName: "collection" }] : /* istanbul ignore next */ []));
|
|
132
|
-
registry = input.required(/* @ts-ignore */
|
|
133
|
-
...(ngDevMode ? [{ debugName: "registry" }] : /* istanbul ignore next */ []));
|
|
134
|
-
/** Renders a reference whose kind has no registered component instead of the English alert. */
|
|
135
|
-
missing = input(/* @ts-ignore */
|
|
136
|
-
...(ngDevMode ? [undefined, { debugName: "missing" }] : /* istanbul ignore next */ []));
|
|
137
|
-
mode = input("keep-mounted", /* @ts-ignore */
|
|
138
|
-
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
139
|
-
/** Returns attributes for a region's wrapper, for example `{ id, role: "tabpanel", "aria-labelledby" }`. */
|
|
140
|
-
panelProps = input(/* @ts-ignore */
|
|
141
|
-
...(ngDevMode ? [undefined, { debugName: "panelProps" }] : /* istanbul ignore next */ []));
|
|
142
|
-
shown = computed(() => {
|
|
143
|
-
const keepMounted = this.mode() === "keep-mounted";
|
|
144
|
-
const panelProps = this.panelProps();
|
|
145
|
-
return regionEntries(this.collection())
|
|
146
|
-
.filter(region => keepMounted || region.selected)
|
|
147
|
-
.map(region => ({ region, attributes: panelProps?.(region) }));
|
|
148
|
-
}, /* @ts-ignore */
|
|
149
|
-
...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
|
|
150
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: RegionOutlets, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
151
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.3", type: RegionOutlets, isStandalone: true, selector: "runic-region-outlets", inputs: { collection: { classPropertyName: "collection", publicName: "collection", isSignal: true, isRequired: false, transformFunction: null }, registry: { classPropertyName: "registry", publicName: "registry", isSignal: true, isRequired: true, transformFunction: null }, missing: { classPropertyName: "missing", publicName: "missing", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, panelProps: { classPropertyName: "panelProps", publicName: "panelProps", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
152
|
-
@for (panel of shown(); track panel.region.key) {
|
|
153
|
-
<div [runicRegionPanel]="panel.attributes" [hidden]="!panel.region.selected" [style.display]="panel.region.selected ? null : 'none'"
|
|
154
|
-
[attr.data-region-key]="panel.region.key">
|
|
155
|
-
<runic-view-outlet [content]="panel.region.content" [registry]="registry()" [missing]="missing()" />
|
|
156
|
-
</div>
|
|
157
|
-
} @empty { <ng-content /> }
|
|
158
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ViewOutlet, selector: "runic-view-outlet", inputs: ["content", "registry", "missing"] }, { kind: "directive", type: RegionPanel, selector: "[runicRegionPanel]", inputs: ["runicRegionPanel"] }] });
|
|
159
|
-
}
|
|
160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.3", ngImport: i0, type: RegionOutlets, decorators: [{
|
|
161
|
-
type: Component,
|
|
162
|
-
args: [{ selector: "runic-region-outlets", standalone: true, imports: [ViewOutlet, RegionPanel], template: `
|
|
163
|
-
@for (panel of shown(); track panel.region.key) {
|
|
164
|
-
<div [runicRegionPanel]="panel.attributes" [hidden]="!panel.region.selected" [style.display]="panel.region.selected ? null : 'none'"
|
|
165
|
-
[attr.data-region-key]="panel.region.key">
|
|
166
|
-
<runic-view-outlet [content]="panel.region.content" [registry]="registry()" [missing]="missing()" />
|
|
167
|
-
</div>
|
|
168
|
-
} @empty { <ng-content /> }
|
|
169
|
-
` }]
|
|
170
|
-
}], propDecorators: { collection: [{ type: i0.Input, args: [{ isSignal: true, alias: "collection", required: false }] }], registry: [{ type: i0.Input, args: [{ isSignal: true, alias: "registry", required: true }] }], missing: [{ type: i0.Input, args: [{ isSignal: true, alias: "missing", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], panelProps: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelProps", required: false }] }] } });
|
|
171
|
-
/**
|
|
172
|
-
* The name of {@link ViewOutlet} before 0.7.0-preview.7, where React, Vue and Svelte already used
|
|
173
|
-
* `ViewOutlet`. It is the same component class, so it renders the same `<runic-view-outlet>` element
|
|
174
|
-
* without a second component definition for that selector (NG0912).
|
|
175
|
-
* @deprecated Import `ViewOutlet` instead; this alias is removed in the next major release.
|
|
176
|
-
*/
|
|
177
|
-
export const RunicViewOutlet = ViewOutlet;
|