@foblex/m-render 2.6.7 → 2.6.8
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/fesm2022/foblex-m-render.mjs +29 -40
- package/fesm2022/foblex-m-render.mjs.map +1 -1
- package/lib/documentation-page/components/markdown-container/f-markdown/components/f-markdown-footer/f-markdown-footer.component.d.ts +1 -1
- package/lib/documentation-page/components/navigation-panel/navigation-panel.component.d.ts +1 -1
- package/lib/documentation-page/domain/handle-navigation-links/handle-navigation-links.handler.d.ts +0 -5
- package/lib/documentation-page/domain/handle-navigation-links/handle-navigation-links.request.d.ts +5 -1
- package/package.json +1 -1
@@ -8,13 +8,13 @@ import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
8
|
import { Overlay, CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
9
9
|
import { Router, RouterLink, NavigationEnd, ActivatedRoute, RouterOutlet } from '@angular/router';
|
10
10
|
import { DOCUMENT, TitleCasePipe } from '@angular/common';
|
11
|
-
import { __decorate } from 'tslib';
|
12
|
-
import { FExecutionRegister, FMediator } from '@foblex/mediator';
|
13
11
|
import { deepClone } from '@foblex/utils';
|
14
12
|
import { createHighlighter } from 'shiki';
|
15
13
|
import MarkdownIt from 'markdown-it';
|
16
14
|
import { DomSanitizer } from '@angular/platform-browser';
|
17
15
|
import container from 'markdown-it-container';
|
16
|
+
import { __decorate } from 'tslib';
|
17
|
+
import { FExecutionRegister, FMediator } from '@foblex/mediator';
|
18
18
|
|
19
19
|
let uniqueId$1 = 0;
|
20
20
|
class FCheckboxComponent {
|
@@ -583,30 +583,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
583
583
|
args: [{ providedIn: 'root' }]
|
584
584
|
}] });
|
585
585
|
|
586
|
-
class
|
587
|
-
event;
|
588
|
-
constructor(event) {
|
589
|
-
this.event = event;
|
590
|
-
}
|
591
|
-
}
|
592
|
-
|
593
|
-
let HandleNavigationLinksHandler = class HandleNavigationLinksHandler {
|
594
|
-
_router = inject(Router);
|
595
|
-
_browser = inject(BrowserService);
|
586
|
+
class HandleNavigationLinksHandler {
|
596
587
|
handle(request) {
|
597
|
-
|
598
|
-
if (!target) {
|
599
|
-
return;
|
600
|
-
}
|
601
|
-
target = this._getClosestAnchorTag(target);
|
588
|
+
const target = this._getClosestAnchorTag(this._getTargetElement(request.event));
|
602
589
|
if (target && this._hasHref(target)) {
|
603
590
|
request.event.preventDefault();
|
604
591
|
const href = target.getAttribute('href');
|
605
592
|
if (!this._isExternalLink(href)) {
|
606
|
-
this._navigateInternalLink(href);
|
593
|
+
this._navigateInternalLink(href, request.router);
|
607
594
|
}
|
608
595
|
else {
|
609
|
-
this._navigateExternalLink(href);
|
596
|
+
this._navigateExternalLink(href, request.browser);
|
610
597
|
}
|
611
598
|
}
|
612
599
|
}
|
@@ -614,7 +601,7 @@ let HandleNavigationLinksHandler = class HandleNavigationLinksHandler {
|
|
614
601
|
return event?.target;
|
615
602
|
}
|
616
603
|
_getClosestAnchorTag(element) {
|
617
|
-
return element
|
604
|
+
return element?.closest('a');
|
618
605
|
}
|
619
606
|
_hasHref(element) {
|
620
607
|
return element.hasAttribute('href');
|
@@ -622,24 +609,27 @@ let HandleNavigationLinksHandler = class HandleNavigationLinksHandler {
|
|
622
609
|
_isExternalLink(href) {
|
623
610
|
return href.startsWith('www') || href.startsWith('http');
|
624
611
|
}
|
625
|
-
_navigateInternalLink(href) {
|
612
|
+
_navigateInternalLink(href, router) {
|
626
613
|
if (href.startsWith('/')) {
|
627
614
|
href = href.substring(1);
|
628
615
|
}
|
629
|
-
|
616
|
+
router.navigate([href]).then();
|
630
617
|
}
|
631
|
-
_navigateExternalLink(href) {
|
632
|
-
|
618
|
+
_navigateExternalLink(href, browser) {
|
619
|
+
browser.window.open(href, '_blank');
|
633
620
|
}
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
621
|
+
}
|
622
|
+
|
623
|
+
class HandleNavigationLinksRequest {
|
624
|
+
event;
|
625
|
+
browser;
|
626
|
+
router;
|
627
|
+
constructor(event, browser, router) {
|
628
|
+
this.event = event;
|
629
|
+
this.browser = browser;
|
630
|
+
this.router = router;
|
631
|
+
}
|
632
|
+
}
|
643
633
|
|
644
634
|
function provide404Markdown(notFoundMarkdown) {
|
645
635
|
return {
|
@@ -928,9 +918,9 @@ class NavigationPanelComponent {
|
|
928
918
|
optional: true,
|
929
919
|
});
|
930
920
|
_router = inject(Router);
|
931
|
-
_mediator = inject(FMediator);
|
932
921
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
933
922
|
_destroyRef = inject(DestroyRef);
|
923
|
+
_browser = inject(BrowserService);
|
934
924
|
value;
|
935
925
|
navigation = this._provider.getNavigation();
|
936
926
|
title = this._provider.getTitle();
|
@@ -976,7 +966,7 @@ class NavigationPanelComponent {
|
|
976
966
|
});
|
977
967
|
}
|
978
968
|
_onDocumentClick(event) {
|
979
|
-
|
969
|
+
new HandleNavigationLinksHandler().handle(new HandleNavigationLinksRequest(event, this._browser, this._router));
|
980
970
|
}
|
981
971
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NavigationPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
982
972
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: NavigationPanelComponent, isStandalone: true, selector: "f-navigation-panel", host: { listeners: { "click": "_onDocumentClick($event)" } }, ngImport: i0, template: "<a routerLink class=\"navigation-header\">\n <img [src]=\"image\" width=\"24\" height=\"24\" alt=\"logo\" class=\"logo\"/> {{ title }}\n</a>\n\n@for (group of navigation; track group) {\n <f-navigation-group [title]=\"group.text\">\n @for (item of group.items; track item.link) {\n <a f-navigation-item [href]=\"item.link\" [class.active]=\"item.link === value\">\n <div class=\"text-ellipsis\">{{ item.text }}</div>\n @if (item.badge) {\n <span class=\"f-badge {{ item.badge.type }}\">{{ item.badge.text }}</span>\n }\n </a>\n }\n </f-navigation-group>\n}\n", styles: [":host{height:100%;flex-direction:column;justify-content:flex-start;align-items:flex-start;padding:0 var(--navigation-panel-padding);background-color:var(--navigation-panel-background);overflow:hidden;overflow-y:auto;position:fixed;width:var(--navigation-panel-width);top:0;left:calc(-1 * var(--navigation-panel-width));transition:transform .2s ease-in-out;z-index:var(--z-index-navigation);transform:none}@media (min-width: 960px){:host{position:unset;display:flex;min-width:var(--navigation-panel-width);width:fit-content;transform:none!important}}@media (min-width: 1440px){:host{min-width:calc((100% - (var(--layout-max-width) - 64px)) / 3 + var(--navigation-panel-width) - var(--navigation-panel-padding))}}:host.visible{transform:translate(var(--navigation-panel-width))}.navigation-header{display:flex;justify-content:flex-start;align-items:center;padding:20px 0;font-weight:600;color:var(--primary-text);height:var(--header-height);width:100%;max-width:240px;margin-left:auto;cursor:pointer}.navigation-header img{margin-right:8px}\n"], dependencies: [{ kind: "component", type: FNavigationItemComponent, selector: "a[f-navigation-item]" }, { kind: "component", type: NavigationGroupComponent, selector: "f-navigation-group", inputs: ["title"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
@@ -2035,12 +2025,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
2035
2025
|
}] });
|
2036
2026
|
|
2037
2027
|
class FMarkdownFooterComponent {
|
2038
|
-
_mediator = inject(FMediator);
|
2039
2028
|
_provider = inject(DocumentationStore);
|
2040
2029
|
_router = inject(Router);
|
2041
2030
|
_activatedRoute = inject(ActivatedRoute);
|
2042
2031
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
2043
2032
|
_destroyRef = inject(DestroyRef);
|
2033
|
+
_browser = inject(BrowserService);
|
2044
2034
|
navigation = {};
|
2045
2035
|
editLink;
|
2046
2036
|
previousLink;
|
@@ -2081,7 +2071,7 @@ class FMarkdownFooterComponent {
|
|
2081
2071
|
return this._activatedRoute.snapshot.url.map((x) => x.path).join('/');
|
2082
2072
|
}
|
2083
2073
|
_onDocumentClick(event) {
|
2084
|
-
|
2074
|
+
new HandleNavigationLinksHandler().handle(new HandleNavigationLinksRequest(event, this._browser, this._router));
|
2085
2075
|
}
|
2086
2076
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FMarkdownFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2087
2077
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: FMarkdownFooterComponent, isStandalone: true, selector: "footer [f-markdown-footer]", host: { listeners: { "click": "_onDocumentClick($event)" } }, ngImport: i0, template: "@if (editLink) {\n <f-footer-edit-information>\n <a f-footer-edit-link [href]=\"editLink\">\n {{ navigation.editLink?.text || 'Edit this page on GitHub' }}\n </a>\n\n<!-- <f-footer-last-updated>-->\n<!-- Last updated: <span>111</span>-->\n<!-- </f-footer-last-updated>-->\n </f-footer-edit-information>\n}\n\n@if (previousLink || nextLink) {\n <nav f-footer-navigation>\n @if (previousLink) {\n <a f-footer-navigation-button\n [href]=\"previousLink.link\"\n [description]=\"navigation.previous\"\n [link]=\"previousLink\">\n </a>\n }\n @if (nextLink) {\n <a f-footer-navigation-button class=\"next\"\n [href]=\"nextLink.link\"\n [description]=\"navigation.next\"\n [link]=\"nextLink\">\n </a>\n }\n </nav>\n}\n\n", styles: [":host{display:block;margin-top:64px}\n"], dependencies: [{ kind: "component", type: FFooterNavigationComponent, selector: "nav[f-footer-navigation]" }, { kind: "component", type: FFooterNavigationButtonComponent, selector: "a[f-footer-navigation-button]", inputs: ["description", "link"] }, { kind: "component", type: FFooterEditInformationComponent, selector: "f-footer-edit-information" }, { kind: "component", type: FFooterEditLinkComponent, selector: "a[f-footer-edit-link]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
@@ -2758,8 +2748,7 @@ class FMarkdownRendererComponent {
|
|
2758
2748
|
}, { injector: this._injector });
|
2759
2749
|
}
|
2760
2750
|
_onDocumentClick(event) {
|
2761
|
-
|
2762
|
-
this._mediator.execute(new HandleNavigationLinksRequest(event));
|
2751
|
+
new HandleNavigationLinksHandler().handle(new HandleNavigationLinksRequest(event, this._browser, this._router));
|
2763
2752
|
}
|
2764
2753
|
ngOnDestroy() {
|
2765
2754
|
this._provider.disposeDComponents();
|
@@ -2969,7 +2958,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
2969
2958
|
GetPreviousNextPageNavigationRequest: GetPreviousNextPageNavigationRequest,
|
2970
2959
|
GetPreviousNextPageNavigationResponse: GetPreviousNextPageNavigationResponse,
|
2971
2960
|
HamburgerButtonComponent: HamburgerButtonComponent,
|
2972
|
-
|
2961
|
+
HandleNavigationLinksHandler: HandleNavigationLinksHandler,
|
2973
2962
|
HandleNavigationLinksRequest: HandleNavigationLinksRequest,
|
2974
2963
|
HeaderComponent: HeaderComponent,
|
2975
2964
|
HighlightComponent: HighlightComponent,
|