@ng-doc/ui-kit 22.0.0-beta.1 → 22.0.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 +20 -29
- package/fesm2022/ng-doc-ui-kit-cdk-combobox-host.mjs +43 -22
- package/fesm2022/ng-doc-ui-kit-cdk-combobox-host.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-classes-base-input.mjs +24 -13
- package/fesm2022/ng-doc-ui-kit-classes-base-input.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-classes-overlay-ref.mjs +62 -22
- package/fesm2022/ng-doc-ui-kit-classes-overlay-ref.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-blockquote.mjs +39 -14
- package/fesm2022/ng-doc-ui-kit-components-blockquote.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-button-icon.mjs +30 -18
- package/fesm2022/ng-doc-ui-kit-components-button-icon.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-button-toggle.mjs +12 -9
- package/fesm2022/ng-doc-ui-kit-components-button-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-button.mjs +15 -24
- package/fesm2022/ng-doc-ui-kit-components-button.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-checkbox.mjs +13 -13
- package/fesm2022/ng-doc-ui-kit-components-checkbox.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-clear-control.mjs +14 -9
- package/fesm2022/ng-doc-ui-kit-components-clear-control.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-combobox.mjs +30 -26
- package/fesm2022/ng-doc-ui-kit-components-combobox.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-data-list-group.mjs +37 -38
- package/fesm2022/ng-doc-ui-kit-components-data-list-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-data-list.mjs +32 -39
- package/fesm2022/ng-doc-ui-kit-components-data-list.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-dialog-outlet.mjs +23 -20
- package/fesm2022/ng-doc-ui-kit-components-dialog-outlet.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-dot.mjs +20 -16
- package/fesm2022/ng-doc-ui-kit-components-dot.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-dropdown.mjs +120 -125
- package/fesm2022/ng-doc-ui-kit-components-dropdown.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-expander.mjs +17 -17
- package/fesm2022/ng-doc-ui-kit-components-expander.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-floated-border.mjs +4 -4
- package/fesm2022/ng-doc-ui-kit-components-floated-border.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-floated-content.mjs +16 -17
- package/fesm2022/ng-doc-ui-kit-components-floated-content.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-focus-control.mjs +20 -12
- package/fesm2022/ng-doc-ui-kit-components-focus-control.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-icon.mjs +175 -54
- package/fesm2022/ng-doc-ui-kit-components-icon.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-input-wrapper.mjs +43 -46
- package/fesm2022/ng-doc-ui-kit-components-input-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-label.mjs +14 -16
- package/fesm2022/ng-doc-ui-kit-components-label.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-line.mjs +7 -4
- package/fesm2022/ng-doc-ui-kit-components-line.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-list.mjs +24 -8
- package/fesm2022/ng-doc-ui-kit-components-list.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-magnifier-controller.mjs +9 -4
- package/fesm2022/ng-doc-ui-kit-components-magnifier-controller.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-magnifier.mjs +39 -18
- package/fesm2022/ng-doc-ui-kit-components-magnifier.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-option-group.mjs +22 -27
- package/fesm2022/ng-doc-ui-kit-components-option-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-option.mjs +28 -22
- package/fesm2022/ng-doc-ui-kit-components-option.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-overlay-container.mjs +56 -52
- package/fesm2022/ng-doc-ui-kit-components-overlay-container.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-overlay-pointer.mjs +19 -21
- package/fesm2022/ng-doc-ui-kit-components-overlay-pointer.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-pane.mjs +91 -69
- package/fesm2022/ng-doc-ui-kit-components-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-selection.mjs +173 -76
- package/fesm2022/ng-doc-ui-kit-components-selection.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-sidenav.mjs +23 -22
- package/fesm2022/ng-doc-ui-kit-components-sidenav.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-spinner.mjs +14 -12
- package/fesm2022/ng-doc-ui-kit-components-spinner.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-tab-group.mjs +86 -61
- package/fesm2022/ng-doc-ui-kit-components-tab-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-tab-routes-group.mjs +16 -13
- package/fesm2022/ng-doc-ui-kit-components-tab-routes-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-tag.mjs +23 -24
- package/fesm2022/ng-doc-ui-kit-components-tag.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-text.mjs +37 -52
- package/fesm2022/ng-doc-ui-kit-components-text.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-toggle.mjs +82 -57
- package/fesm2022/ng-doc-ui-kit-components-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-components-wrapper.mjs +7 -4
- package/fesm2022/ng-doc-ui-kit-components-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-autofocus.mjs +13 -10
- package/fesm2022/ng-doc-ui-kit-directives-autofocus.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-checked-change.mjs +30 -26
- package/fesm2022/ng-doc-ui-kit-directives-checked-change.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-data.mjs +8 -5
- package/fesm2022/ng-doc-ui-kit-directives-data.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-handler.mjs +19 -18
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-handler.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-origin.mjs +7 -9
- package/fesm2022/ng-doc-ui-kit-directives-dropdown-origin.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-event-switcher.mjs +22 -19
- package/fesm2022/ng-doc-ui-kit-directives-event-switcher.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-focus-catcher.mjs +30 -25
- package/fesm2022/ng-doc-ui-kit-directives-focus-catcher.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-focusable.mjs +13 -16
- package/fesm2022/ng-doc-ui-kit-directives-focusable.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-fullscreen.mjs +90 -0
- package/fesm2022/ng-doc-ui-kit-directives-fullscreen.mjs.map +1 -0
- package/fesm2022/ng-doc-ui-kit-directives-hotkey.mjs +34 -28
- package/fesm2022/ng-doc-ui-kit-directives-hotkey.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-input-number.mjs +10 -12
- package/fesm2022/ng-doc-ui-kit-directives-input-number.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-input-string.mjs +9 -12
- package/fesm2022/ng-doc-ui-kit-directives-input-string.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-radio-group.mjs +7 -4
- package/fesm2022/ng-doc-ui-kit-directives-radio-group.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-rotator.mjs +16 -22
- package/fesm2022/ng-doc-ui-kit-directives-rotator.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives-tooltip.mjs +105 -101
- package/fesm2022/ng-doc-ui-kit-directives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-directives.mjs +1 -1
- package/fesm2022/ng-doc-ui-kit-interceptors.mjs +24 -21
- package/fesm2022/ng-doc-ui-kit-interceptors.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-observables.mjs +2 -58
- package/fesm2022/ng-doc-ui-kit-observables.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-as-array.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-as-array.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-bind.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-bind.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-execute.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-execute.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-pipes-highlighter.mjs +3 -4
- package/fesm2022/ng-doc-ui-kit-pipes-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-dialog.mjs +14 -8
- package/fesm2022/ng-doc-ui-kit-services-dialog.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-notify.mjs +13 -8
- package/fesm2022/ng-doc-ui-kit-services-notify.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-overlay-strategy.mjs +15 -11
- package/fesm2022/ng-doc-ui-kit-services-overlay-strategy.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-overlay.mjs +20 -9
- package/fesm2022/ng-doc-ui-kit-services-overlay.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-services-scroll.mjs +11 -13
- package/fesm2022/ng-doc-ui-kit-services-scroll.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-tokens.mjs +29 -3
- package/fesm2022/ng-doc-ui-kit-tokens.mjs.map +1 -1
- package/fesm2022/ng-doc-ui-kit-types.mjs +0 -1
- package/fesm2022/ng-doc-ui-kit-types.mjs.map +1 -1
- package/package.json +31 -33
- package/styles/main.css +275 -38
- package/types/ng-doc-ui-kit-cdk-combobox-host.d.ts +16 -8
- package/types/ng-doc-ui-kit-classes-base-input.d.ts +12 -1
- package/types/ng-doc-ui-kit-classes-overlay-ref.d.ts +27 -4
- package/types/ng-doc-ui-kit-components-blockquote.d.ts +22 -5
- package/types/ng-doc-ui-kit-components-button-icon.d.ts +23 -5
- package/types/ng-doc-ui-kit-components-button-toggle.d.ts +5 -1
- package/types/ng-doc-ui-kit-components-button.d.ts +6 -6
- package/types/ng-doc-ui-kit-components-checkbox.d.ts +5 -3
- package/types/ng-doc-ui-kit-components-clear-control.d.ts +7 -0
- package/types/ng-doc-ui-kit-components-combobox.d.ts +19 -9
- package/types/ng-doc-ui-kit-components-data-list-group.d.ts +16 -11
- package/types/ng-doc-ui-kit-components-data-list.d.ts +21 -11
- package/types/ng-doc-ui-kit-components-dialog-outlet.d.ts +11 -6
- package/types/ng-doc-ui-kit-components-dot.d.ts +10 -5
- package/types/ng-doc-ui-kit-components-dropdown.d.ts +39 -27
- package/types/ng-doc-ui-kit-components-expander.d.ts +9 -7
- package/types/ng-doc-ui-kit-components-floated-content.d.ts +8 -6
- package/types/ng-doc-ui-kit-components-focus-control.d.ts +10 -4
- package/types/ng-doc-ui-kit-components-icon.d.ts +49 -14
- package/types/ng-doc-ui-kit-components-input-wrapper.d.ts +31 -17
- package/types/ng-doc-ui-kit-components-label.d.ts +8 -5
- package/types/ng-doc-ui-kit-components-line.d.ts +3 -0
- package/types/ng-doc-ui-kit-components-list.d.ts +14 -3
- package/types/ng-doc-ui-kit-components-magnifier-controller.d.ts +5 -1
- package/types/ng-doc-ui-kit-components-magnifier.d.ts +19 -4
- package/types/ng-doc-ui-kit-components-option-group.d.ts +12 -8
- package/types/ng-doc-ui-kit-components-option.d.ts +9 -2
- package/types/ng-doc-ui-kit-components-overlay-container.d.ts +18 -15
- package/types/ng-doc-ui-kit-components-overlay-pointer.d.ts +10 -6
- package/types/ng-doc-ui-kit-components-pane.d.ts +25 -9
- package/types/ng-doc-ui-kit-components-selection.d.ts +59 -21
- package/types/ng-doc-ui-kit-components-sidenav.d.ts +17 -8
- package/types/ng-doc-ui-kit-components-spinner.d.ts +7 -3
- package/types/ng-doc-ui-kit-components-tab-group.d.ts +43 -22
- package/types/ng-doc-ui-kit-components-tab-routes-group.d.ts +4 -2
- package/types/ng-doc-ui-kit-components-tag.d.ts +13 -6
- package/types/ng-doc-ui-kit-components-text.d.ts +21 -19
- package/types/ng-doc-ui-kit-components-toggle.d.ts +13 -7
- package/types/ng-doc-ui-kit-components-wrapper.d.ts +3 -0
- package/types/ng-doc-ui-kit-directives-autofocus.d.ts +7 -5
- package/types/ng-doc-ui-kit-directives-checked-change.d.ts +15 -11
- package/types/ng-doc-ui-kit-directives-data.d.ts +6 -4
- package/types/ng-doc-ui-kit-directives-dropdown-handler.d.ts +5 -3
- package/types/ng-doc-ui-kit-directives-dropdown-origin.d.ts +0 -2
- package/types/ng-doc-ui-kit-directives-event-switcher.d.ts +11 -6
- package/types/ng-doc-ui-kit-directives-focus-catcher.d.ts +11 -8
- package/types/ng-doc-ui-kit-directives-focusable.d.ts +6 -3
- package/types/ng-doc-ui-kit-directives-fullscreen.d.ts +39 -0
- package/types/ng-doc-ui-kit-directives-hotkey.d.ts +14 -7
- package/types/ng-doc-ui-kit-directives-input-number.d.ts +3 -2
- package/types/ng-doc-ui-kit-directives-input-string.d.ts +2 -2
- package/types/ng-doc-ui-kit-directives-radio-group.d.ts +4 -0
- package/types/ng-doc-ui-kit-directives-rotator.d.ts +8 -8
- package/types/ng-doc-ui-kit-directives-tooltip.d.ts +35 -23
- package/types/ng-doc-ui-kit-directives.d.ts +1 -1
- package/types/ng-doc-ui-kit-interceptors.d.ts +18 -2
- package/types/ng-doc-ui-kit-interfaces.d.ts +20 -4
- package/types/ng-doc-ui-kit-observables.d.ts +2 -19
- package/types/ng-doc-ui-kit-services-dialog.d.ts +10 -1
- package/types/ng-doc-ui-kit-services-notify.d.ts +9 -1
- package/types/ng-doc-ui-kit-services-overlay-strategy.d.ts +5 -3
- package/types/ng-doc-ui-kit-services-overlay.d.ts +14 -3
- package/types/ng-doc-ui-kit-services-scroll.d.ts +4 -5
- package/types/ng-doc-ui-kit-types.d.ts +2 -2
- package/fesm2022/ng-doc-ui-kit-decorators.mjs +0 -53
- package/fesm2022/ng-doc-ui-kit-decorators.mjs.map +0 -1
- package/fesm2022/ng-doc-ui-kit-directives-let.mjs +0 -43
- package/fesm2022/ng-doc-ui-kit-directives-let.mjs.map +0 -1
- package/types/ng-doc-ui-kit-decorators.d.ts +0 -12
- package/types/ng-doc-ui-kit-directives-let.d.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-floated-border.mjs","sources":["../../../../libs/ui-kit/components/floated-border/floated-border.component.ts","../../../../libs/ui-kit/components/floated-border/ng-doc-ui-kit-components-floated-border.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-floated-border.mjs","sources":["../../../../libs/ui-kit/components/floated-border/floated-border.component.ts","../../../../libs/ui-kit/components/floated-border/ng-doc-ui-kit-components-floated-border.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'ng-doc-floated-border',\n template: ` <ng-content></ng-content> `,\n styleUrls: ['./floated-border.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgDocFloatedBorderComponent {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAQa,2BAA2B,CAAA;8GAA3B,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,2BAA2B,iFAJ5B,CAAA,2BAAA,CAA6B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oZAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAI5B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBANvC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,uBAAuB,EAAA,QAAA,EACvB,CAAA,2BAAA,CAA6B,EAAA,eAAA,EAEtB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,oZAAA,CAAA,EAAA;;;ACNjD;;AAEG;;;;"}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef,
|
|
2
|
+
import { input, inject, ElementRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/** Content that floats over the edge of its container, aligned to one side. */
|
|
4
5
|
class NgDocFloatedContentComponent {
|
|
5
6
|
constructor() {
|
|
6
|
-
this.
|
|
7
|
-
|
|
7
|
+
this.bindTo = input(/* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [undefined, { debugName: "bindTo" }] : /* istanbul ignore next */ []));
|
|
9
|
+
this.propertyName = input('', /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "propertyName" }] : /* istanbul ignore next */ []));
|
|
11
|
+
/** The side the content is aligned to. */
|
|
12
|
+
this.alignTo = input('left', /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "alignTo" }] : /* istanbul ignore next */ []));
|
|
8
14
|
this.element = inject(ElementRef).nativeElement;
|
|
9
15
|
}
|
|
10
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
11
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocFloatedContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
17
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.1", type: NgDocFloatedContentComponent, isStandalone: true, selector: "[ng-doc-floated-content]", inputs: { bindTo: { classPropertyName: "bindTo", publicName: "bindTo", isSignal: true, isRequired: false, transformFunction: null }, propertyName: { classPropertyName: "propertyName", publicName: "propertyName", isSignal: true, isRequired: false, transformFunction: null }, alignTo: { classPropertyName: "alignTo", publicName: "alignTo", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-ng-doc-align": "alignTo()" } }, ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, styles: [":host{position:absolute;display:flex;top:0;align-items:center;height:100%;pointer-events:none}:host[data-ng-doc-align=left]{left:0}:host[data-ng-doc-align=right]{right:0}:host ::ng-deep>*{pointer-events:auto}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
12
18
|
}
|
|
13
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocFloatedContentComponent, decorators: [{
|
|
14
20
|
type: Component,
|
|
15
|
-
args: [{ selector: '[ng-doc-floated-content]', template: ` <ng-content></ng-content> `, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type: Input
|
|
20
|
-
}], alignTo: [{
|
|
21
|
-
type: Input
|
|
22
|
-
}, {
|
|
23
|
-
type: HostBinding,
|
|
24
|
-
args: ['attr.data-ng-doc-align']
|
|
25
|
-
}] } });
|
|
21
|
+
args: [{ selector: '[ng-doc-floated-content]', template: ` <ng-content></ng-content> `, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
22
|
+
'[attr.data-ng-doc-align]': 'alignTo()',
|
|
23
|
+
}, styles: [":host{position:absolute;display:flex;top:0;align-items:center;height:100%;pointer-events:none}:host[data-ng-doc-align=left]{left:0}:host[data-ng-doc-align=right]{right:0}:host ::ng-deep>*{pointer-events:auto}\n"] }]
|
|
24
|
+
}], propDecorators: { bindTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "bindTo", required: false }] }], propertyName: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyName", required: false }] }], alignTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignTo", required: false }] }] } });
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-floated-content.mjs","sources":["../../../../libs/ui-kit/components/floated-content/floated-content.component.ts","../../../../libs/ui-kit/components/floated-content/ng-doc-ui-kit-components-floated-content.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-floated-content.mjs","sources":["../../../../libs/ui-kit/components/floated-content/floated-content.component.ts","../../../../libs/ui-kit/components/floated-content/ng-doc-ui-kit-components-floated-content.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ElementRef, inject, input } from '@angular/core';\nimport { BaseElement, NgDocHorizontalAlign } from '@ng-doc/ui-kit/types';\n\n/** Content that floats over the edge of its container, aligned to one side. */\n@Component({\n selector: '[ng-doc-floated-content]',\n template: ` <ng-content></ng-content> `,\n styleUrls: ['./floated-content.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-ng-doc-align]': 'alignTo()',\n },\n})\nexport class NgDocFloatedContentComponent {\n readonly bindTo = input<BaseElement<HTMLElement>>();\n\n readonly propertyName = input<string>('');\n\n /** The side the content is aligned to. */\n readonly alignTo = input<NgDocHorizontalAlign>('left');\n\n readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;MAUa,4BAA4B,CAAA;AATzC,IAAA,WAAA,GAAA;AAUW,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK;8FAA4B;QAE1C,IAAA,CAAA,YAAY,GAAG,KAAK,CAAS,EAAE;yFAAC;;QAGhC,IAAA,CAAA,OAAO,GAAG,KAAK,CAAuB,MAAM;oFAAC;AAE7C,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAA0B,UAAU,CAAC,CAAC,aAAa;AAC7E,IAAA;8GATY,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,4BAA4B,uiBAP7B,CAAA,2BAAA,CAA6B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oNAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAO5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBATxC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,YAC1B,CAAA,2BAAA,CAA6B,EAAA,eAAA,EAEtB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,0BAA0B,EAAE,WAAW;AACxC,qBAAA,EAAA,MAAA,EAAA,CAAA,oNAAA,CAAA,EAAA;;;ACXH;;AAEG;;;;"}
|
|
@@ -1,40 +1,48 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, DOCUMENT,
|
|
2
|
+
import { inject, DOCUMENT, input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { NgDocFocusableDirective } from '@ng-doc/ui-kit/directives/focusable';
|
|
4
4
|
import { NgDocFocusUtils } from '@ng-doc/ui-kit/utils';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Surrounds its content with two focus traps. Tabbing out of the content moves the focus to the
|
|
8
|
+
* element before or after `focusHost` in the document, instead of leaving it on the traps.
|
|
9
|
+
*/
|
|
6
10
|
class NgDocFocusControlComponent {
|
|
7
11
|
constructor() {
|
|
8
12
|
this.documentRef = inject(DOCUMENT);
|
|
9
|
-
|
|
13
|
+
/** Element from which the focus moves on when it leaves the content. */
|
|
14
|
+
this.focusHost = input(null, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "focusHost" }] : /* istanbul ignore next */ []));
|
|
10
16
|
}
|
|
17
|
+
/** Focuses the focusable element before `focusHost`. */
|
|
11
18
|
focusPrev() {
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
const focusHost = this.focusHost();
|
|
20
|
+
if (focusHost) {
|
|
21
|
+
NgDocFocusUtils.focusClosestElement(focusHost, this.documentRef.body, false);
|
|
14
22
|
}
|
|
15
23
|
}
|
|
24
|
+
/** Focuses the focusable element after `focusHost`. */
|
|
16
25
|
focusNext() {
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
const focusHost = this.focusHost();
|
|
27
|
+
if (focusHost) {
|
|
28
|
+
NgDocFocusUtils.focusClosestElement(focusHost, this.documentRef.body);
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
22
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocFocusControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
32
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.1", type: NgDocFocusControlComponent, isStandalone: true, selector: "ng-doc-focus-control", inputs: { focusHost: { classPropertyName: "focusHost", publicName: "focusHost", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
23
33
|
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusPrev()"></div>
|
|
24
34
|
<ng-content></ng-content>
|
|
25
35
|
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusNext()"></div>
|
|
26
36
|
`, isInline: true, styles: [":host{width:100%}\n"], dependencies: [{ kind: "directive", type: NgDocFocusableDirective, selector: "[ngDocFocusable]", inputs: ["ngDocFocusable"], exportAs: ["ngDocFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
27
37
|
}
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocFocusControlComponent, decorators: [{
|
|
29
39
|
type: Component,
|
|
30
40
|
args: [{ selector: 'ng-doc-focus-control', template: `
|
|
31
41
|
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusPrev()"></div>
|
|
32
42
|
<ng-content></ng-content>
|
|
33
43
|
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusNext()"></div>
|
|
34
44
|
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocFocusableDirective], styles: [":host{width:100%}\n"] }]
|
|
35
|
-
}],
|
|
36
|
-
type: Input
|
|
37
|
-
}] } });
|
|
45
|
+
}], propDecorators: { focusHost: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusHost", required: false }] }] } });
|
|
38
46
|
|
|
39
47
|
/**
|
|
40
48
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-focus-control.mjs","sources":["../../../../libs/ui-kit/components/focus-control/focus-control.component.ts","../../../../libs/ui-kit/components/focus-control/ng-doc-ui-kit-components-focus-control.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, DOCUMENT, inject,
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-focus-control.mjs","sources":["../../../../libs/ui-kit/components/focus-control/focus-control.component.ts","../../../../libs/ui-kit/components/focus-control/ng-doc-ui-kit-components-focus-control.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, DOCUMENT, inject, input } from '@angular/core';\nimport { NgDocFocusableDirective } from '@ng-doc/ui-kit/directives/focusable';\nimport { NgDocFocusUtils } from '@ng-doc/ui-kit/utils';\n\n/**\n * Surrounds its content with two focus traps. Tabbing out of the content moves the focus to the\n * element before or after `focusHost` in the document, instead of leaving it on the traps.\n */\n@Component({\n selector: 'ng-doc-focus-control',\n template: `\n <div [ngDocFocusable]=\"true\" data-ng-doc-focus-trap=\"true\" (focus)=\"focusPrev()\"></div>\n <ng-content></ng-content>\n <div [ngDocFocusable]=\"true\" data-ng-doc-focus-trap=\"true\" (focus)=\"focusNext()\"></div>\n `,\n styles: [':host {width: 100%}'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgDocFocusableDirective],\n})\nexport class NgDocFocusControlComponent {\n private readonly documentRef = inject<Document>(DOCUMENT);\n\n /** Element from which the focus moves on when it leaves the content. */\n readonly focusHost = input<HTMLElement | null>(null);\n\n /** Focuses the focusable element before `focusHost`. */\n focusPrev(): void {\n const focusHost: HTMLElement | null = this.focusHost();\n\n if (focusHost) {\n NgDocFocusUtils.focusClosestElement(focusHost, this.documentRef.body, false);\n }\n }\n\n /** Focuses the focusable element after `focusHost`. */\n focusNext(): void {\n const focusHost: HTMLElement | null = this.focusHost();\n\n if (focusHost) {\n NgDocFocusUtils.focusClosestElement(focusHost, this.documentRef.body);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA;;;AAGG;MAYU,0BAA0B,CAAA;AAXvC,IAAA,WAAA,GAAA;AAYmB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAW,QAAQ,CAAC;;QAGhD,IAAA,CAAA,SAAS,GAAG,KAAK,CAAqB,IAAI;sFAAC;AAmBrD,IAAA;;IAhBC,SAAS,GAAA;AACP,QAAA,MAAM,SAAS,GAAuB,IAAI,CAAC,SAAS,EAAE;QAEtD,IAAI,SAAS,EAAE;AACb,YAAA,eAAe,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;QAC9E;IACF;;IAGA,SAAS,GAAA;AACP,QAAA,MAAM,SAAS,GAAuB,IAAI,CAAC,SAAS,EAAE;QAEtD,IAAI,SAAS,EAAE;YACb,eAAe,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QACvE;IACF;8GAtBW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAT3B;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAGS,uBAAuB,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAEtB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAXtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,QAAA,EACtB;;;;AAIT,EAAA,CAAA,EAAA,eAAA,EAEgB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,uBAAuB,CAAC,EAAA,MAAA,EAAA,CAAA,qBAAA,CAAA,EAAA;;;ACjBpC;;AAEG;;;;"}
|
|
@@ -1,75 +1,196 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject,
|
|
4
|
-
import { NgDocCacheInterceptor } from '@ng-doc/ui-kit/interceptors';
|
|
3
|
+
import { inject, untracked, signal, Service, numberAttribute, ElementRef, input, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
4
|
import { NG_REQUEST_BASE_PATH, NG_DOC_ASSETS_PATH, NG_DOC_CUSTOM_ICONS_PATH } from '@ng-doc/ui-kit/tokens';
|
|
6
|
-
import { Subject, of } from 'rxjs';
|
|
7
|
-
import { startWith, switchMap, catchError } from 'rxjs/operators';
|
|
8
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Loads SVG icons and keeps them for the lifetime of the application.
|
|
8
|
+
*
|
|
9
|
+
* Every URL is requested once and shared by all icons that show it, whether or not the
|
|
10
|
+
* application registers HTTP interceptors. A failed request is logged and remembered: reading the
|
|
11
|
+
* icon again does not send a new request, only `retry()` does. A response that is not SVG markup
|
|
12
|
+
* counts as a failure: dev servers answer a missing file with the application's `index.html`,
|
|
13
|
+
* which must not be rendered as an icon.
|
|
14
|
+
*/
|
|
15
|
+
class NgDocIconRegistry {
|
|
16
|
+
constructor() {
|
|
17
|
+
// The application may provide `HttpClient` only in a lazy injector (route providers), which a
|
|
18
|
+
// root service cannot see. Callers can pass their own client; this one is the fallback.
|
|
19
|
+
this.rootHttpClient = inject(HttpClient, { optional: true });
|
|
20
|
+
this.icons = new Map();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the SVG markup stored at `url`, loading it on the first call.
|
|
24
|
+
* @param url - URL of the SVG file.
|
|
25
|
+
* @param httpClient - Client for the request; defaults to the root `HttpClient`.
|
|
26
|
+
* @returns A signal with the markup: `null` while it loads, `''` when the request failed.
|
|
27
|
+
*/
|
|
28
|
+
get(url, httpClient) {
|
|
29
|
+
// Callers read icons from `computed` and templates. The request may answer synchronously
|
|
30
|
+
// (for example from the hydration transfer cache), and writing a signal while a reactive
|
|
31
|
+
// context is active is an error, so the request runs untracked.
|
|
32
|
+
return untracked(() => {
|
|
33
|
+
let entry = this.icons.get(url);
|
|
34
|
+
if (!entry) {
|
|
35
|
+
entry = { svg: signal(null), failed: false };
|
|
36
|
+
this.icons.set(url, entry);
|
|
37
|
+
this.load(url, entry, httpClient);
|
|
38
|
+
}
|
|
39
|
+
return entry.svg.asReadonly();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Requests `url` again if its last request failed. Does nothing for an icon that has loaded
|
|
44
|
+
* or is loading.
|
|
45
|
+
* @param url - URL of the SVG file.
|
|
46
|
+
* @param httpClient - Client for the request; defaults to the root `HttpClient`.
|
|
47
|
+
*/
|
|
48
|
+
retry(url, httpClient) {
|
|
49
|
+
untracked(() => {
|
|
50
|
+
const entry = this.icons.get(url);
|
|
51
|
+
if (entry?.failed) {
|
|
52
|
+
entry.failed = false;
|
|
53
|
+
this.load(url, entry, httpClient);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
load(url, entry, httpClient) {
|
|
58
|
+
const client = httpClient ?? this.rootHttpClient;
|
|
59
|
+
if (!client) {
|
|
60
|
+
throw new Error('[NgDocIconRegistry] No HttpClient: provide one with provideHttpClient() or pass it to get().');
|
|
61
|
+
}
|
|
62
|
+
client.get(url, { responseType: 'text', observe: 'response' }).subscribe({
|
|
63
|
+
next: (response) => {
|
|
64
|
+
const svg = response.body ?? '';
|
|
65
|
+
if (isSvg(svg, response.headers.get('content-type'))) {
|
|
66
|
+
entry.svg.set(svg);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.fail(entry, new Error(`[NgDocIconRegistry] "${url}" is not an SVG file (content type "${response.headers.get('content-type') ?? 'unknown'}").`));
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
error: (error) => this.fail(entry, error),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
fail(entry, error) {
|
|
76
|
+
console.error(error);
|
|
77
|
+
// The entry stays: a failure must not start a new request by itself, or an icon that reads
|
|
78
|
+
// it would request a missing file in a loop.
|
|
79
|
+
entry.failed = true;
|
|
80
|
+
entry.svg.set('');
|
|
81
|
+
}
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocIconRegistry, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
|
|
83
|
+
static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.2.1", ngImport: i0, type: NgDocIconRegistry }); }
|
|
84
|
+
}
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocIconRegistry, decorators: [{
|
|
86
|
+
type: Service
|
|
87
|
+
}] });
|
|
88
|
+
/**
|
|
89
|
+
* Tells whether a response holds SVG markup. The content type is only checked when the server
|
|
90
|
+
* sent one: responses replayed from the hydration transfer cache carry no headers.
|
|
91
|
+
* @param body - The response body.
|
|
92
|
+
* @param contentType - The `Content-Type` header, if any.
|
|
93
|
+
*/
|
|
94
|
+
function isSvg(body, contentType) {
|
|
95
|
+
if (contentType && /html/i.test(contentType)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return /<svg[\s>]/i.test(body);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Converts the `size` input of the icon, which can be set as an attribute (`size="24"`).
|
|
103
|
+
* @param value - Value bound to the input.
|
|
104
|
+
* @returns The icon size.
|
|
105
|
+
*/
|
|
106
|
+
function iconSizeAttribute(value) {
|
|
107
|
+
return numberAttribute(value, 16);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Shows an SVG icon from the UI Kit assets or from the application's custom icons.
|
|
111
|
+
*/
|
|
9
112
|
class NgDocIconComponent {
|
|
10
113
|
constructor() {
|
|
11
114
|
this.elementRef = inject(ElementRef);
|
|
115
|
+
this.registry = inject(NgDocIconRegistry);
|
|
116
|
+
// Injected here rather than in the root registry, so that an `HttpClient` provided in a lazy
|
|
117
|
+
// injector (route providers) is used.
|
|
12
118
|
this.httpClient = inject(HttpClient);
|
|
13
119
|
this.baseUrl = inject(NG_REQUEST_BASE_PATH);
|
|
120
|
+
this.assetsPath = inject(NG_DOC_ASSETS_PATH, { optional: true }) ?? '';
|
|
121
|
+
this.customIconsPath = inject(NG_DOC_CUSTOM_ICONS_PATH, { optional: true }) ?? '';
|
|
14
122
|
/** Icon name */
|
|
15
|
-
this.icon = ''
|
|
123
|
+
this.icon = input('', /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
16
125
|
/** Custom icon name, if not set, `icon` will be used */
|
|
17
|
-
this.customIcon = ''
|
|
126
|
+
this.customIcon = input('', /* @ts-ignore */
|
|
127
|
+
...(ngDevMode ? [{ debugName: "customIcon" }] : /* istanbul ignore next */ []));
|
|
18
128
|
/** Icon size */
|
|
19
|
-
this.size = 16;
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
|
|
129
|
+
this.size = input(16, { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), transform: iconSizeAttribute });
|
|
130
|
+
/** URL of the SVG file that the icon shows. */
|
|
131
|
+
this.href = computed(() => {
|
|
132
|
+
const customIcon = this.customIcon();
|
|
133
|
+
const icon = this.icon();
|
|
134
|
+
return (this.baseUrl +
|
|
135
|
+
(customIcon
|
|
136
|
+
? `${this.customIconsPath}/${customIcon}.svg#${customIcon}`
|
|
137
|
+
: `${this.assetsPath}/icons/${this.size()}/${icon}.svg#${icon}`));
|
|
138
|
+
}, /* @ts-ignore */
|
|
139
|
+
...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
140
|
+
this.svg = computed(() => this.registry.get(this.href(), this.httpClient)(), /* @ts-ignore */
|
|
141
|
+
...(ngDevMode ? [{ debugName: "svg" }] : /* istanbul ignore next */ []));
|
|
142
|
+
// A URL that failed before is requested again when an icon starts showing it (a new icon or
|
|
143
|
+
// a new `href`), and only then: the failure itself must not trigger another request.
|
|
144
|
+
effect(() => {
|
|
145
|
+
const href = this.href();
|
|
146
|
+
untracked(() => this.registry.retry(href, this.httpClient));
|
|
147
|
+
});
|
|
148
|
+
// The markup is written as is: binding it through `[innerHTML]` would sanitize the SVG away.
|
|
149
|
+
// The previous icon stays until the next one has loaded, so switching icons does not flash.
|
|
150
|
+
effect(() => {
|
|
151
|
+
const svg = this.svg();
|
|
152
|
+
if (svg !== null) {
|
|
153
|
+
writeMarkup(this.elementRef.nativeElement, svg);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
23
156
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
ngOnInit() {
|
|
28
|
-
this.reload$
|
|
29
|
-
.pipe(startWith(null), switchMap(() => this.httpClient
|
|
30
|
-
.get(this.href, {
|
|
31
|
-
responseType: 'text',
|
|
32
|
-
params: { [NgDocCacheInterceptor.TOKEN]: 'true' },
|
|
33
|
-
})
|
|
34
|
-
.pipe(catchError((e) => {
|
|
35
|
-
console.error(e);
|
|
36
|
-
return of('');
|
|
37
|
-
}))))
|
|
38
|
-
.subscribe((svg) => (this.elementRef.nativeElement.innerHTML = svg));
|
|
39
|
-
}
|
|
40
|
-
get href() {
|
|
41
|
-
return (this.baseUrl +
|
|
42
|
-
(this.customIcon
|
|
43
|
-
? `${this.customIconsPath}/${this.customIcon}.svg#${this.customIcon}`
|
|
44
|
-
: `${this.assetsPath}/icons/${this.size}/${this.icon}.svg#${this.icon}`));
|
|
45
|
-
}
|
|
46
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgDocIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
47
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "21.0.6", type: NgDocIconComponent, isStandalone: true, selector: "ng-doc-icon", inputs: { icon: "icon", customIcon: "customIcon", size: ["size", "size", numberAttribute] }, host: { properties: { "attr.data-ng-doc-icon": "this.icon", "attr.data-ng-doc-custom-icon": "this.customIcon", "attr.data-ng-doc-size": "this.size" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [":host{display:inline-flex;align-items:center;justify-content:center;width:var(--ng-doc-icon-width, 16px);height:var(--ng-doc-icon-height, 16px);color:var(--ng-doc-icon-color, var(--ng-doc-text));vertical-align:sub}:host svg{vertical-align:top}:host[data-ng-doc-size=\"24\"]{width:var(--ng-doc-icon-width, 24px);height:var(--ng-dpc-icon-height, 24px)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
157
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
158
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.1", type: NgDocIconComponent, isStandalone: true, selector: "ng-doc-icon", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, customIcon: { classPropertyName: "customIcon", publicName: "customIcon", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-ng-doc-icon": "icon()", "attr.data-ng-doc-custom-icon": "customIcon()", "attr.data-ng-doc-size": "size()" } }, ngImport: i0, template: '', isInline: true, styles: [":host{display:inline-flex;align-items:center;justify-content:center;width:var(--ng-doc-icon-width, 16px);height:var(--ng-doc-icon-height, 16px);color:var(--ng-doc-icon-color, var(--ng-doc-text));vertical-align:sub}:host svg{vertical-align:top}:host[data-ng-doc-size=\"24\"]{width:var(--ng-doc-icon-width, 24px);height:var(--ng-doc-icon-height, 24px)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
48
159
|
}
|
|
49
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocIconComponent, decorators: [{
|
|
50
161
|
type: Component,
|
|
51
|
-
args: [{ selector: 'ng-doc-icon', template: '', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
162
|
+
args: [{ selector: 'ng-doc-icon', template: '', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
163
|
+
'[attr.data-ng-doc-icon]': 'icon()',
|
|
164
|
+
'[attr.data-ng-doc-custom-icon]': 'customIcon()',
|
|
165
|
+
'[attr.data-ng-doc-size]': 'size()',
|
|
166
|
+
}, styles: [":host{display:inline-flex;align-items:center;justify-content:center;width:var(--ng-doc-icon-width, 16px);height:var(--ng-doc-icon-height, 16px);color:var(--ng-doc-icon-color, var(--ng-doc-text));vertical-align:sub}:host svg{vertical-align:top}:host[data-ng-doc-size=\"24\"]{width:var(--ng-doc-icon-width, 24px);height:var(--ng-doc-icon-height, 24px)}\n"] }]
|
|
167
|
+
}], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], customIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "customIcon", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
168
|
+
/**
|
|
169
|
+
* Replaces the children of `host` with the parsed `markup`.
|
|
170
|
+
*
|
|
171
|
+
* The host is not always an HTML element. Angular 22.2 creates a component through a
|
|
172
|
+
* `ViewContainerRef` in the namespace of the container's parent node, and a control-flow block
|
|
173
|
+
* keeps the SVG namespace of an `<svg>` that comes before it in the same template, so a page
|
|
174
|
+
* processor can create the icon as an SVG element. The server DOM (domino) implements the
|
|
175
|
+
* `innerHTML` setter only for HTML elements and throws `NotYetImplemented` for the others, so the
|
|
176
|
+
* markup is parsed by an HTML `<template>` instead, which gives the same nodes in the browser and
|
|
177
|
+
* on the server whatever the host's namespace.
|
|
178
|
+
* @param host - The element to fill.
|
|
179
|
+
* @param markup - The SVG markup.
|
|
180
|
+
*/
|
|
181
|
+
function writeMarkup(host, markup) {
|
|
182
|
+
const document = host.ownerDocument;
|
|
183
|
+
const template = document.createElement('template');
|
|
184
|
+
template.innerHTML = markup;
|
|
185
|
+
while (host.firstChild) {
|
|
186
|
+
host.removeChild(host.firstChild);
|
|
187
|
+
}
|
|
188
|
+
host.appendChild(document.importNode(template.content, true));
|
|
189
|
+
}
|
|
69
190
|
|
|
70
191
|
/**
|
|
71
192
|
* Generated bundle index. Do not edit.
|
|
72
193
|
*/
|
|
73
194
|
|
|
74
|
-
export { NgDocIconComponent };
|
|
195
|
+
export { NgDocIconComponent, NgDocIconRegistry };
|
|
75
196
|
//# sourceMappingURL=ng-doc-ui-kit-components-icon.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-ui-kit-components-icon.mjs","sources":["../../../../libs/ui-kit/components/icon/icon.component.ts","../../../../libs/ui-kit/components/icon/ng-doc-ui-kit-components-icon.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n inject,\n Input,\n numberAttribute,\n OnChanges,\n OnInit,\n} from '@angular/core';\nimport { NgDocCacheInterceptor } from '@ng-doc/ui-kit/interceptors';\nimport {\n NG_DOC_ASSETS_PATH,\n NG_DOC_CUSTOM_ICONS_PATH,\n NG_REQUEST_BASE_PATH,\n} from '@ng-doc/ui-kit/tokens';\nimport { NgDocIconSize } from '@ng-doc/ui-kit/types';\nimport { of, Subject } from 'rxjs';\nimport { catchError, startWith, switchMap } from 'rxjs/operators';\n\n@Component({\n selector: 'ng-doc-icon',\n template: '',\n styleUrls: ['./icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class NgDocIconComponent implements OnChanges, OnInit {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly httpClient = inject(HttpClient);\n private readonly baseUrl = inject(NG_REQUEST_BASE_PATH);\n\n /** Icon name */\n @Input()\n @HostBinding('attr.data-ng-doc-icon')\n icon: string = '';\n\n /** Custom icon name, if not set, `icon` will be used */\n @Input()\n @HostBinding('attr.data-ng-doc-custom-icon')\n customIcon: string = '';\n\n /** Icon size */\n @Input({ transform: numberAttribute })\n @HostBinding('attr.data-ng-doc-size')\n size: NgDocIconSize = 16;\n\n private readonly reload$: Subject<void> = new Subject<void>();\n private readonly assetsPath: string = inject(NG_DOC_ASSETS_PATH, { optional: true }) ?? '';\n private readonly customIconsPath: string =\n inject(NG_DOC_CUSTOM_ICONS_PATH, { optional: true }) ?? '';\n\n constructor() {}\n\n ngOnChanges(): void {\n this.reload$.next();\n }\n\n ngOnInit(): void {\n this.reload$\n .pipe(\n startWith(null),\n switchMap(() =>\n this.httpClient\n .get(this.href, {\n responseType: 'text',\n params: { [NgDocCacheInterceptor.TOKEN]: 'true' },\n })\n .pipe(\n catchError((e: Error) => {\n console.error(e);\n\n return of('');\n }),\n ),\n ),\n )\n .subscribe((svg: string) => (this.elementRef.nativeElement.innerHTML = svg));\n }\n\n get href(): string {\n return (\n this.baseUrl +\n (this.customIcon\n ? `${this.customIconsPath}/${this.customIcon}.svg#${this.customIcon}`\n : `${this.assetsPath}/icons/${this.size}/${this.icon}.svg#${this.icon}`)\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MA6Ba,kBAAkB,CAAA;AAyB7B,IAAA,WAAA,GAAA;AAxBiB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;AACxD,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,oBAAoB,CAAC;;QAKvD,IAAA,CAAA,IAAI,GAAW,EAAE;;QAKjB,IAAA,CAAA,UAAU,GAAW,EAAE;;QAKvB,IAAA,CAAA,IAAI,GAAkB,EAAE;AAEP,QAAA,IAAA,CAAA,OAAO,GAAkB,IAAI,OAAO,EAAQ;AAC5C,QAAA,IAAA,CAAA,UAAU,GAAW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AAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,UAAA,EAAA,YAAA,EAAA,IAAA,EAAA,CAAA,MAAA,EAAA,MAAA,EAgBT,eAAe,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,uBAAA,EAAA,WAAA,EAAA,8BAAA,EAAA,iBAAA,EAAA,uBAAA,EAAA,WAAA,EAAA,EAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EArBzB,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,kWAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAKD,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,YACb,EAAE,EAAA,eAAA,EAEK,uBAAuB,CAAC,MAAM,cACnC,IAAI,EAAA,MAAA,EAAA,CAAA,kWAAA,CAAA,EAAA;;sBAQf;;sBACA,WAAW;uBAAC,uBAAuB;;sBAInC;;sBACA,WAAW;uBAAC,8BAA8B;;sBAI1C,KAAK;uBAAC,EAAE,SAAS,EAAE,eAAe,EAAE;;sBACpC,WAAW;uBAAC,uBAAuB;;;AC9CtC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-ui-kit-components-icon.mjs","sources":["../../../../libs/ui-kit/components/icon/icon-registry.service.ts","../../../../libs/ui-kit/components/icon/icon.component.ts","../../../../libs/ui-kit/components/icon/ng-doc-ui-kit-components-icon.ts"],"sourcesContent":["import { HttpClient, HttpResponse } from '@angular/common/http';\nimport { inject, Service, Signal, signal, untracked, WritableSignal } from '@angular/core';\n\n/** State of one icon URL. */\ninterface NgDocIconEntry {\n readonly svg: WritableSignal<string | null>;\n failed: boolean;\n}\n\n/**\n * Loads SVG icons and keeps them for the lifetime of the application.\n *\n * Every URL is requested once and shared by all icons that show it, whether or not the\n * application registers HTTP interceptors. A failed request is logged and remembered: reading the\n * icon again does not send a new request, only `retry()` does. A response that is not SVG markup\n * counts as a failure: dev servers answer a missing file with the application's `index.html`,\n * which must not be rendered as an icon.\n */\n@Service()\nexport class NgDocIconRegistry {\n // The application may provide `HttpClient` only in a lazy injector (route providers), which a\n // root service cannot see. Callers can pass their own client; this one is the fallback.\n private readonly rootHttpClient = inject(HttpClient, { optional: true });\n private readonly icons: Map<string, NgDocIconEntry> = new Map();\n\n /**\n * Returns the SVG markup stored at `url`, loading it on the first call.\n * @param url - URL of the SVG file.\n * @param httpClient - Client for the request; defaults to the root `HttpClient`.\n * @returns A signal with the markup: `null` while it loads, `''` when the request failed.\n */\n get(url: string, httpClient?: HttpClient): Signal<string | null> {\n // Callers read icons from `computed` and templates. The request may answer synchronously\n // (for example from the hydration transfer cache), and writing a signal while a reactive\n // context is active is an error, so the request runs untracked.\n return untracked(() => {\n let entry: NgDocIconEntry | undefined = this.icons.get(url);\n\n if (!entry) {\n entry = { svg: signal<string | null>(null), failed: false };\n this.icons.set(url, entry);\n this.load(url, entry, httpClient);\n }\n\n return entry.svg.asReadonly();\n });\n }\n\n /**\n * Requests `url` again if its last request failed. Does nothing for an icon that has loaded\n * or is loading.\n * @param url - URL of the SVG file.\n * @param httpClient - Client for the request; defaults to the root `HttpClient`.\n */\n retry(url: string, httpClient?: HttpClient): void {\n untracked(() => {\n const entry: NgDocIconEntry | undefined = this.icons.get(url);\n\n if (entry?.failed) {\n entry.failed = false;\n this.load(url, entry, httpClient);\n }\n });\n }\n\n private load(url: string, entry: NgDocIconEntry, httpClient?: HttpClient): void {\n const client: HttpClient | null = httpClient ?? this.rootHttpClient;\n\n if (!client) {\n throw new Error(\n '[NgDocIconRegistry] No HttpClient: provide one with provideHttpClient() or pass it to get().',\n );\n }\n\n client.get(url, { responseType: 'text', observe: 'response' }).subscribe({\n next: (response: HttpResponse<string>) => {\n const svg: string = response.body ?? '';\n\n if (isSvg(svg, response.headers.get('content-type'))) {\n entry.svg.set(svg);\n } else {\n this.fail(\n entry,\n new Error(\n `[NgDocIconRegistry] \"${url}\" is not an SVG file (content type \"${response.headers.get('content-type') ?? 'unknown'}\").`,\n ),\n );\n }\n },\n error: (error: unknown) => this.fail(entry, error),\n });\n }\n\n private fail(entry: NgDocIconEntry, error: unknown): void {\n console.error(error);\n // The entry stays: a failure must not start a new request by itself, or an icon that reads\n // it would request a missing file in a loop.\n entry.failed = true;\n entry.svg.set('');\n }\n}\n\n/**\n * Tells whether a response holds SVG markup. The content type is only checked when the server\n * sent one: responses replayed from the hydration transfer cache carry no headers.\n * @param body - The response body.\n * @param contentType - The `Content-Type` header, if any.\n */\nfunction isSvg(body: string, contentType: string | null): boolean {\n if (contentType && /html/i.test(contentType)) {\n return false;\n }\n\n return /<svg[\\s>]/i.test(body);\n}\n","import { HttpClient } from '@angular/common/http';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n numberAttribute,\n Signal,\n untracked,\n} from '@angular/core';\nimport {\n NG_DOC_ASSETS_PATH,\n NG_DOC_CUSTOM_ICONS_PATH,\n NG_REQUEST_BASE_PATH,\n} from '@ng-doc/ui-kit/tokens';\nimport { NgDocIconSize } from '@ng-doc/ui-kit/types';\n\nimport { NgDocIconRegistry } from './icon-registry.service';\n\n/**\n * Converts the `size` input of the icon, which can be set as an attribute (`size=\"24\"`).\n * @param value - Value bound to the input.\n * @returns The icon size.\n */\nfunction iconSizeAttribute(value: NgDocIconSize | `${NgDocIconSize}`): NgDocIconSize {\n return numberAttribute(value, 16) as NgDocIconSize;\n}\n\n/**\n * Shows an SVG icon from the UI Kit assets or from the application's custom icons.\n */\n@Component({\n selector: 'ng-doc-icon',\n template: '',\n styleUrls: ['./icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-ng-doc-icon]': 'icon()',\n '[attr.data-ng-doc-custom-icon]': 'customIcon()',\n '[attr.data-ng-doc-size]': 'size()',\n },\n})\nexport class NgDocIconComponent {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly registry = inject(NgDocIconRegistry);\n // Injected here rather than in the root registry, so that an `HttpClient` provided in a lazy\n // injector (route providers) is used.\n private readonly httpClient = inject(HttpClient);\n private readonly baseUrl = inject(NG_REQUEST_BASE_PATH);\n private readonly assetsPath: string = inject(NG_DOC_ASSETS_PATH, { optional: true }) ?? '';\n private readonly customIconsPath: string =\n inject(NG_DOC_CUSTOM_ICONS_PATH, { optional: true }) ?? '';\n\n /** Icon name */\n readonly icon = input<string>('');\n\n /** Custom icon name, if not set, `icon` will be used */\n readonly customIcon = input<string>('');\n\n /** Icon size */\n readonly size = input<NgDocIconSize, NgDocIconSize | `${NgDocIconSize}`>(16, {\n transform: iconSizeAttribute,\n });\n\n /** URL of the SVG file that the icon shows. */\n readonly href: Signal<string> = computed(() => {\n const customIcon: string = this.customIcon();\n const icon: string = this.icon();\n\n return (\n this.baseUrl +\n (customIcon\n ? `${this.customIconsPath}/${customIcon}.svg#${customIcon}`\n : `${this.assetsPath}/icons/${this.size()}/${icon}.svg#${icon}`)\n );\n });\n\n private readonly svg: Signal<string | null> = computed(() =>\n this.registry.get(this.href(), this.httpClient)(),\n );\n\n constructor() {\n // A URL that failed before is requested again when an icon starts showing it (a new icon or\n // a new `href`), and only then: the failure itself must not trigger another request.\n effect(() => {\n const href: string = this.href();\n\n untracked(() => this.registry.retry(href, this.httpClient));\n });\n\n // The markup is written as is: binding it through `[innerHTML]` would sanitize the SVG away.\n // The previous icon stays until the next one has loaded, so switching icons does not flash.\n effect(() => {\n const svg: string | null = this.svg();\n\n if (svg !== null) {\n writeMarkup(this.elementRef.nativeElement, svg);\n }\n });\n }\n}\n\n/**\n * Replaces the children of `host` with the parsed `markup`.\n *\n * The host is not always an HTML element. Angular 22.2 creates a component through a\n * `ViewContainerRef` in the namespace of the container's parent node, and a control-flow block\n * keeps the SVG namespace of an `<svg>` that comes before it in the same template, so a page\n * processor can create the icon as an SVG element. The server DOM (domino) implements the\n * `innerHTML` setter only for HTML elements and throws `NotYetImplemented` for the others, so the\n * markup is parsed by an HTML `<template>` instead, which gives the same nodes in the browser and\n * on the server whatever the host's namespace.\n * @param host - The element to fill.\n * @param markup - The SVG markup.\n */\nfunction writeMarkup(host: Element, markup: string): void {\n const document: Document = host.ownerDocument;\n const template: HTMLTemplateElement = document.createElement('template');\n\n template.innerHTML = markup;\n\n while (host.firstChild) {\n host.removeChild(host.firstChild);\n }\n\n host.appendChild(document.importNode(template.content, true));\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA;;;;;;;;AAQG;MAEU,iBAAiB,CAAA;AAD9B,IAAA,WAAA,GAAA;;;QAImB,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACvD,QAAA,IAAA,CAAA,KAAK,GAAgC,IAAI,GAAG,EAAE;AA6EhE,IAAA;AA3EC;;;;;AAKG;IACH,GAAG,CAAC,GAAW,EAAE,UAAuB,EAAA;;;;QAItC,OAAO,SAAS,CAAC,MAAK;YACpB,IAAI,KAAK,GAA+B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YAE3D,IAAI,CAAC,KAAK,EAAE;AACV,gBAAA,KAAK,GAAG,EAAE,GAAG,EAAE,MAAM,CAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE;gBAC3D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;gBAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC;YACnC;AAEA,YAAA,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