@foblex/m-render 2.8.6 → 2.8.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 +77 -79
- package/fesm2022/foblex-m-render.mjs.map +1 -1
- package/index.d.ts +8 -8
- package/package.json +1 -1
|
@@ -2590,6 +2590,68 @@ class TableOfContentData {
|
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
2592
|
|
|
2593
|
+
let CalculateTableOfContent = class CalculateTableOfContent {
|
|
2594
|
+
_dataProvider = inject(DocumentationStore);
|
|
2595
|
+
_mediatr = inject(Mediatr);
|
|
2596
|
+
handle(request) {
|
|
2597
|
+
const flat = [];
|
|
2598
|
+
const tree = [];
|
|
2599
|
+
const stack = [];
|
|
2600
|
+
this._getNavigationSelectors(request.hostElement, this._dataProvider.getTableOfContent()?.range).forEach((element) => {
|
|
2601
|
+
const tocItem = this._createItem(element);
|
|
2602
|
+
this._insertItemIntoTree(tocItem, tree, stack);
|
|
2603
|
+
flat.push(tocItem);
|
|
2604
|
+
});
|
|
2605
|
+
this._dataProvider.tocData.set(new TableOfContentData(flat, tree));
|
|
2606
|
+
//this._mediatr.execute(new CalculateHashFromScrollPositionRequest());
|
|
2607
|
+
}
|
|
2608
|
+
_getNavigationSelectors(fMarkdownPage, tocRange) {
|
|
2609
|
+
if (!tocRange || tocRange.start < 1 || tocRange.end > 6) {
|
|
2610
|
+
tocRange = { start: 2, end: 6 };
|
|
2611
|
+
}
|
|
2612
|
+
const selectors = [];
|
|
2613
|
+
for (let i = tocRange.start; i <= tocRange.end; i++) {
|
|
2614
|
+
selectors.push(`h${i}`);
|
|
2615
|
+
}
|
|
2616
|
+
return Array.from(fMarkdownPage.querySelectorAll(selectors.join(', ')));
|
|
2617
|
+
}
|
|
2618
|
+
_createItem(element) {
|
|
2619
|
+
element.id = this._createNavigationId(element);
|
|
2620
|
+
return {
|
|
2621
|
+
hash: `#${CSS.escape(element.id)}`,
|
|
2622
|
+
title: element.innerHTML,
|
|
2623
|
+
element,
|
|
2624
|
+
children: [],
|
|
2625
|
+
};
|
|
2626
|
+
}
|
|
2627
|
+
_createNavigationId(element) {
|
|
2628
|
+
return element.innerHTML.toLowerCase().replaceAll(' ', '-');
|
|
2629
|
+
}
|
|
2630
|
+
_getLevel(element) {
|
|
2631
|
+
return parseInt(element.tagName.substring(1));
|
|
2632
|
+
}
|
|
2633
|
+
_insertItemIntoTree(tocItem, tree, stack) {
|
|
2634
|
+
while (stack.length > 0 && this._getLevel(stack[stack.length - 1].element) >= this._getLevel(tocItem.element)) {
|
|
2635
|
+
stack.pop();
|
|
2636
|
+
}
|
|
2637
|
+
if (stack.length === 0) {
|
|
2638
|
+
tree.push(tocItem);
|
|
2639
|
+
}
|
|
2640
|
+
else {
|
|
2641
|
+
stack[stack.length - 1].children.push(tocItem);
|
|
2642
|
+
}
|
|
2643
|
+
stack.push(tocItem);
|
|
2644
|
+
}
|
|
2645
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateTableOfContent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2646
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateTableOfContent });
|
|
2647
|
+
};
|
|
2648
|
+
CalculateTableOfContent = __decorate([
|
|
2649
|
+
MExecution(CalculateTableOfContentRequest)
|
|
2650
|
+
], CalculateTableOfContent);
|
|
2651
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateTableOfContent, decorators: [{
|
|
2652
|
+
type: Injectable
|
|
2653
|
+
}] });
|
|
2654
|
+
|
|
2593
2655
|
class CalculateAbsoluteTopToContainerRequest {
|
|
2594
2656
|
element;
|
|
2595
2657
|
static requestToken = Symbol('CalculateAbsoluteTopToContainerRequest');
|
|
@@ -2621,7 +2683,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
|
|
|
2621
2683
|
type: Injectable
|
|
2622
2684
|
}] });
|
|
2623
2685
|
|
|
2624
|
-
|
|
2686
|
+
// @MExecution(CalculateHashFromScrollPositionRequest)
|
|
2687
|
+
class CalculateHashFromScrollPosition {
|
|
2625
2688
|
_docElement = inject(DOCUMENT_ELEMENT);
|
|
2626
2689
|
_window = inject(WINDOW);
|
|
2627
2690
|
_provider = inject(DocumentationStore);
|
|
@@ -2672,83 +2735,18 @@ let CalculateHashFromScrollPositionAndActivateToc = class CalculateHashFromScrol
|
|
|
2672
2735
|
}
|
|
2673
2736
|
return result;
|
|
2674
2737
|
}
|
|
2675
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type:
|
|
2676
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type:
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
|
-
MExecution(CalculateHashFromScrollPositionAndActivateTocRequest)
|
|
2680
|
-
], CalculateHashFromScrollPositionAndActivateToc);
|
|
2681
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateHashFromScrollPositionAndActivateToc, decorators: [{
|
|
2738
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateHashFromScrollPosition, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2739
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateHashFromScrollPosition });
|
|
2740
|
+
}
|
|
2741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateHashFromScrollPosition, decorators: [{
|
|
2682
2742
|
type: Injectable
|
|
2683
2743
|
}] });
|
|
2684
2744
|
|
|
2685
|
-
class
|
|
2686
|
-
static requestToken = Symbol('
|
|
2687
|
-
|
|
2688
|
-
constructor() { }
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
|
-
let CalculateTableOfContent = class CalculateTableOfContent {
|
|
2692
|
-
_dataProvider = inject(DocumentationStore);
|
|
2693
|
-
_mediatr = inject(Mediatr);
|
|
2694
|
-
handle(request) {
|
|
2695
|
-
const flat = [];
|
|
2696
|
-
const tree = [];
|
|
2697
|
-
const stack = [];
|
|
2698
|
-
this._getNavigationSelectors(request.hostElement, this._dataProvider.getTableOfContent()?.range).forEach((element) => {
|
|
2699
|
-
const tocItem = this._createItem(element);
|
|
2700
|
-
this._insertItemIntoTree(tocItem, tree, stack);
|
|
2701
|
-
flat.push(tocItem);
|
|
2702
|
-
});
|
|
2703
|
-
this._dataProvider.tocData.set(new TableOfContentData(flat, tree));
|
|
2704
|
-
this._mediatr.execute(new CalculateHashFromScrollPositionAndActivateTocRequest());
|
|
2705
|
-
}
|
|
2706
|
-
_getNavigationSelectors(fMarkdownPage, tocRange) {
|
|
2707
|
-
if (!tocRange || tocRange.start < 1 || tocRange.end > 6) {
|
|
2708
|
-
tocRange = { start: 2, end: 6 };
|
|
2709
|
-
}
|
|
2710
|
-
const selectors = [];
|
|
2711
|
-
for (let i = tocRange.start; i <= tocRange.end; i++) {
|
|
2712
|
-
selectors.push(`h${i}`);
|
|
2713
|
-
}
|
|
2714
|
-
return Array.from(fMarkdownPage.querySelectorAll(selectors.join(', ')));
|
|
2715
|
-
}
|
|
2716
|
-
_createItem(element) {
|
|
2717
|
-
element.id = this._createNavigationId(element);
|
|
2718
|
-
return {
|
|
2719
|
-
hash: `#${CSS.escape(element.id)}`,
|
|
2720
|
-
title: element.innerHTML,
|
|
2721
|
-
element,
|
|
2722
|
-
children: [],
|
|
2723
|
-
};
|
|
2724
|
-
}
|
|
2725
|
-
_createNavigationId(element) {
|
|
2726
|
-
return element.innerHTML.toLowerCase().replaceAll(' ', '-');
|
|
2727
|
-
}
|
|
2728
|
-
_getLevel(element) {
|
|
2729
|
-
return parseInt(element.tagName.substring(1));
|
|
2730
|
-
}
|
|
2731
|
-
_insertItemIntoTree(tocItem, tree, stack) {
|
|
2732
|
-
while (stack.length > 0 && this._getLevel(stack[stack.length - 1].element) >= this._getLevel(tocItem.element)) {
|
|
2733
|
-
stack.pop();
|
|
2734
|
-
}
|
|
2735
|
-
if (stack.length === 0) {
|
|
2736
|
-
tree.push(tocItem);
|
|
2737
|
-
}
|
|
2738
|
-
else {
|
|
2739
|
-
stack[stack.length - 1].children.push(tocItem);
|
|
2740
|
-
}
|
|
2741
|
-
stack.push(tocItem);
|
|
2745
|
+
class CalculateHashFromScrollPositionRequest {
|
|
2746
|
+
static requestToken = Symbol('CalculateHashFromScrollPositionRequest');
|
|
2747
|
+
constructor() {
|
|
2742
2748
|
}
|
|
2743
|
-
|
|
2744
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateTableOfContent });
|
|
2745
|
-
};
|
|
2746
|
-
CalculateTableOfContent = __decorate([
|
|
2747
|
-
MExecution(CalculateTableOfContentRequest)
|
|
2748
|
-
], CalculateTableOfContent);
|
|
2749
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CalculateTableOfContent, decorators: [{
|
|
2750
|
-
type: Injectable
|
|
2751
|
-
}] });
|
|
2749
|
+
}
|
|
2752
2750
|
|
|
2753
2751
|
class ScrollToElementInContainerRequest {
|
|
2754
2752
|
hash;
|
|
@@ -2822,7 +2820,7 @@ const TABLE_OF_CONTENT_MODULE_PROVIDERS = [
|
|
|
2822
2820
|
CalculateTableOfContent,
|
|
2823
2821
|
ScrollToElementInContainer,
|
|
2824
2822
|
CalculateAbsoluteTopToContainer,
|
|
2825
|
-
|
|
2823
|
+
CalculateHashFromScrollPosition,
|
|
2826
2824
|
];
|
|
2827
2825
|
|
|
2828
2826
|
class TableOfContent {
|
|
@@ -2882,7 +2880,7 @@ class ScrollableContainer {
|
|
|
2882
2880
|
.subscribe(() => this._calculateHashAndActivate());
|
|
2883
2881
|
}
|
|
2884
2882
|
_calculateHashAndActivate() {
|
|
2885
|
-
this._mediatr.execute(new
|
|
2883
|
+
//this._mediatr.execute(new CalculateHashFromScrollPositionRequest());
|
|
2886
2884
|
}
|
|
2887
2885
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: ScrollableContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2888
2886
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.8", type: ScrollableContainer, isStandalone: true, selector: "scrollable-container", providers: [
|
|
@@ -3124,8 +3122,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3124
3122
|
ActivateTocByHashRequest: ActivateTocByHashRequest,
|
|
3125
3123
|
get CalculateAbsoluteTopToContainer () { return CalculateAbsoluteTopToContainer; },
|
|
3126
3124
|
CalculateAbsoluteTopToContainerRequest: CalculateAbsoluteTopToContainerRequest,
|
|
3127
|
-
|
|
3128
|
-
|
|
3125
|
+
CalculateHashFromScrollPosition: CalculateHashFromScrollPosition,
|
|
3126
|
+
CalculateHashFromScrollPositionRequest: CalculateHashFromScrollPositionRequest,
|
|
3129
3127
|
get CalculateTableOfContent () { return CalculateTableOfContent; },
|
|
3130
3128
|
CalculateTableOfContentRequest: CalculateTableOfContentRequest,
|
|
3131
3129
|
DOCUMENTATION_CONFIGURATION: DOCUMENTATION_CONFIGURATION,
|
|
@@ -3439,5 +3437,5 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3439
3437
|
* Generated bundle index. Do not edit.
|
|
3440
3438
|
*/
|
|
3441
3439
|
|
|
3442
|
-
export { AVAILABLE_LANGUAGES, ActivateTocByHash, ActivateTocByHashRequest, CalculateAbsoluteTopToContainer, CalculateAbsoluteTopToContainerRequest,
|
|
3440
|
+
export { AVAILABLE_LANGUAGES, ActivateTocByHash, ActivateTocByHashRequest, CalculateAbsoluteTopToContainer, CalculateAbsoluteTopToContainerRequest, CalculateHashFromScrollPosition, CalculateHashFromScrollPositionRequest, CalculateTableOfContent, CalculateTableOfContentRequest, CodeGroup, CodeView, DOCUMENTATION_CONFIGURATION, DOCUMENTATION_ROUTES, DOCUMENT_ELEMENT, DYNAMIC_COMPONENTS_MODULE_PROVIDERS, Documentation, DocumentationStore, DropdownMenu, DynamicComponentsStore, EMarkdownContainerType, EParsedContainerType, EXTERNAL_COMPONENT_PROVIDER, ExternalComponent, FCheckboxComponent, FHomePageButtonsRowComponent, FHomePageFeaturesComponent, FHomePageFooterComponent, FHomePageHeaderComponent, FHomePageHeroComponent, FHomePageMembershipsComponent, FMetaService, FNavigationItemComponent, FRadioButtonComponent, FSearchButtonComponent, F_PREVIEW_NAVIGATION_PROVIDER, FooterNavigationButton, GTAG_CONFIG, GTagService, GetPreviousNextPageNavigationHandler, GetPreviousNextPageNavigationRequest, GetPreviousNextPageNavigationResponse, HEADER_CONFIGURATION_PROVIDER, HOME_PAGE_CONFIGURATION, HOME_ROUTES, HamburgerButton, HandleNavigationLinksHandler, HandleNavigationLinksRequest, HeaderComponent, HeaderMenuBase, Highlight, HighlightService, HomeRootComponent, HomeStore, IS_BROWSER_PLATFORM, InlineMenu, LOCAL_STORAGE, LOCATION, MEDIA_LINKS_PROVIDER, MExecution, MarkCodeFocusedBlocksPostProcessor, MarkdownFooter, MarkdownRenderer, MarkdownRouter, MarkdownService, MediaLinks, Mediatr, NavigationGroupComponent, NavigationPanelComponent, ParseAlerts, ParseAngularExampleWithCodeLinks, ParseGroupedCodeItems, ParsePreviewGroup, ParseShowcase, ParseSingleCodeItem, PopoverService, PreviewActionBar, PreviewCard, PreviewCardBase, PreviewGroupService, RenderDynamicComponent, RenderDynamicComponentRequest, RenderExternalComponent, RenderExternalComponentRequest, RenderInternalComponents, RenderInternalComponentsRequest, SCROLLABLE_CONTAINER, SHOWCASE_DATA, ScrollToElementInContainer, ScrollToElementInContainerRequest, ScrollableContainer, Showcase, ShowcaseItem, TABLE_OF_CONTENT_MODULE_PROVIDERS, TOGGLE_NAVIGATION_COMPONENT, TableOfContent, TableOfContentData, TableOfContentItemsComponent, ThemeButtonComponent, ThemeService, UNIVERSAL_THEME, WINDOW, calculateMarkdownUrl, coerceComponentHeight$1 as coerceComponentHeight, copyToClipboard, defineLazyComponent, defineNavigationGroup, encodeDataAttr, extractComponent, getContent, isClosingToken, isOpeningToken, parseComponentTag, parseFileLinkLine, parseSingleBracketText, provide404Markdown, provideBackground, provideComponents, provideDirectory, provideDocumentation, provideFooterNavigation, provideGTag, provideHeader, provideHeaderMediaLinks, provideHeaderNavigation, provideHeaderSearch, provideHero, provideHomeButtons, provideHomeFeatures, provideHomeFooter, provideHomePage, provideImage, provideLanguage, provideLogo, provideMeta, provideNavigation, provideShowcase, provideTableOfContent, provideTheme, provideTitle };
|
|
3443
3441
|
//# sourceMappingURL=foblex-m-render.mjs.map
|