@salesforcedevs/docs-components 1.3.171-alpha.0 → 1.3.172
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/LICENSE +12 -0
- package/package.json +2 -2
- package/src/modules/doc/amfReference/amfReference.ts +61 -80
- package/src/modules/doc/amfReference/utils.ts +5 -10
- package/src/modules/doc/amfTopic/amfTopic.ts +7 -12
- package/src/modules/doc/amfTopic/types.ts +12 -14
- package/src/modules/doc/amfTopic/utils.ts +6 -12
- package/src/modules/doc/content/content.css +0 -21
- package/src/modules/doc/content/content.ts +11 -10
- package/src/modules/doc/contentLayout/contentLayout.ts +34 -38
- package/src/modules/doc/heading/heading.ts +0 -2
- package/src/modules/doc/toc/toc.ts +1 -1
- package/src/modules/doc/xmlContent/types.ts +1 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +38 -43
- package/src/modules/docHelpers/imgStyle/imgStyle.css +12 -16
- package/src/modules/docUtils/SearchSyncer/SearchSyncer.ts +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.172",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@types/lodash.orderby": "^4.6.7",
|
|
25
25
|
"@types/lodash.uniqby": "^4.7.7"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "5ee185196e3f394e324227f4ca61d8578e6ec8d2"
|
|
28
28
|
}
|
|
@@ -2,7 +2,7 @@ import { LightningElement, api, track } from "lwc";
|
|
|
2
2
|
import { noCase } from "no-case";
|
|
3
3
|
import { sentenceCase } from "sentence-case";
|
|
4
4
|
import qs from "query-string";
|
|
5
|
-
import { AmfModelParser } from "
|
|
5
|
+
import { AmfModelParser } from "./utils";
|
|
6
6
|
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
7
7
|
import { CoveoAnalyticsClient } from "coveo.analytics";
|
|
8
8
|
import type {
|
|
@@ -30,26 +30,18 @@ import { restoreScroll } from "dx/scrollManager";
|
|
|
30
30
|
import { DocPhaseInfo } from "typings/custom";
|
|
31
31
|
import { oldVersionDocInfo } from "docUtils/utils";
|
|
32
32
|
|
|
33
|
-
type NavigationItem = {
|
|
34
|
-
label: string;
|
|
35
|
-
name: string;
|
|
36
|
-
isExpanded: boolean;
|
|
37
|
-
children: ParsedMarkdownTopic[];
|
|
38
|
-
isChildrenLoading: boolean;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
33
|
export default class AmfReference extends LightningElement {
|
|
42
|
-
@api breadcrumbs
|
|
34
|
+
@api breadcrumbs?: string | null | undefined = null;
|
|
43
35
|
@api sidebarHeader!: string;
|
|
44
36
|
@api coveoOrganizationId!: string;
|
|
45
37
|
@api coveoPublicAccessToken!: string;
|
|
46
38
|
@api coveoAnalyticsToken!: string;
|
|
47
39
|
@api coveoAdvancedQueryConfig!: string;
|
|
48
40
|
@api coveoSearchHub!: string;
|
|
49
|
-
@api useOldSidebar
|
|
41
|
+
@api useOldSidebar?: boolean = false;
|
|
50
42
|
@api tocTitle?: string;
|
|
51
43
|
@api tocOptions?: string;
|
|
52
|
-
@track navigation = []
|
|
44
|
+
@track navigation = [];
|
|
53
45
|
@track versions: Array<ReferenceVersion> = [];
|
|
54
46
|
@track showVersionBanner = false;
|
|
55
47
|
|
|
@@ -133,8 +125,8 @@ export default class AmfReference extends LightningElement {
|
|
|
133
125
|
}
|
|
134
126
|
|
|
135
127
|
@api
|
|
136
|
-
get docPhaseInfo()
|
|
137
|
-
return this.selectedReferenceDocPhase
|
|
128
|
+
get docPhaseInfo() {
|
|
129
|
+
return this.selectedReferenceDocPhase;
|
|
138
130
|
}
|
|
139
131
|
|
|
140
132
|
set docPhaseInfo(value: string) {
|
|
@@ -159,12 +151,12 @@ export default class AmfReference extends LightningElement {
|
|
|
159
151
|
protected _referenceSetConfig!: ReferenceSetConfig;
|
|
160
152
|
protected _currentReferenceId = "";
|
|
161
153
|
|
|
162
|
-
protected parentReferenceUrls = []
|
|
154
|
+
protected parentReferenceUrls = [];
|
|
163
155
|
protected amfMap: Record<string, AmfModelRecord> = {};
|
|
164
|
-
protected amfFetchPromiseMap = {}
|
|
156
|
+
protected amfFetchPromiseMap = {};
|
|
165
157
|
protected metadata: { [key: string]: AmfMetadataTopic } = {};
|
|
166
158
|
protected selectedTopic?: AmfMetaTopicType = undefined;
|
|
167
|
-
protected selectedSidebarValue
|
|
159
|
+
protected selectedSidebarValue = undefined;
|
|
168
160
|
|
|
169
161
|
protected selectedVersion: ReferenceVersion | null = null;
|
|
170
162
|
|
|
@@ -355,13 +347,13 @@ export default class AmfReference extends LightningElement {
|
|
|
355
347
|
/**
|
|
356
348
|
* Returns the selected version or the first available version.
|
|
357
349
|
*/
|
|
358
|
-
private getSelectedVersion(): ReferenceVersion
|
|
350
|
+
private getSelectedVersion(): ReferenceVersion {
|
|
359
351
|
const versions = this._referenceSetConfig?.versions || [];
|
|
360
352
|
const selectedVersion = versions.find(
|
|
361
353
|
(v: ReferenceVersion) => v.selected
|
|
362
354
|
);
|
|
363
355
|
// return a selected version if there is one, else return the first one.
|
|
364
|
-
return selectedVersion || (versions.length && versions[0])
|
|
356
|
+
return selectedVersion || (versions.length && versions[0]);
|
|
365
357
|
}
|
|
366
358
|
|
|
367
359
|
private updateAmfConfigInView(): void {
|
|
@@ -375,11 +367,9 @@ export default class AmfReference extends LightningElement {
|
|
|
375
367
|
}
|
|
376
368
|
}
|
|
377
369
|
|
|
378
|
-
private async fetchAmf(
|
|
379
|
-
amfConfig: AmfConfig
|
|
380
|
-
): Promise<AmfModel | AmfModel[]> {
|
|
370
|
+
private async fetchAmf(amfConfig): Promise<AmfModel | AmfModel[]> {
|
|
381
371
|
const { amf } = amfConfig;
|
|
382
|
-
const response = await fetch(amf
|
|
372
|
+
const response = await fetch(amf, {
|
|
383
373
|
headers: {
|
|
384
374
|
"Cache-Control": `max-age=86400`
|
|
385
375
|
}
|
|
@@ -398,7 +388,7 @@ export default class AmfReference extends LightningElement {
|
|
|
398
388
|
/**
|
|
399
389
|
* Returns whether given url is parent reference path like ../example-project/references/reference-id
|
|
400
390
|
*/
|
|
401
|
-
private isParentReferencePath(urlPath
|
|
391
|
+
private isParentReferencePath(urlPath: string): boolean {
|
|
402
392
|
if (!urlPath) {
|
|
403
393
|
return false;
|
|
404
394
|
}
|
|
@@ -429,9 +419,9 @@ export default class AmfReference extends LightningElement {
|
|
|
429
419
|
* Populates reference Items from amfConfigList and assigns it to navigation for sidebar
|
|
430
420
|
*/
|
|
431
421
|
private populateReferenceItems(): void {
|
|
432
|
-
const navAmfOrder = []
|
|
422
|
+
const navAmfOrder = [];
|
|
433
423
|
for (const [index, amfConfig] of this._amfConfigList.entries()) {
|
|
434
|
-
let navItemChildren = []
|
|
424
|
+
let navItemChildren = [];
|
|
435
425
|
let isChildrenLoading = false;
|
|
436
426
|
if (amfConfig.referenceType !== REFERENCE_TYPES.markdown) {
|
|
437
427
|
if (amfConfig.isSelected) {
|
|
@@ -451,10 +441,10 @@ export default class AmfReference extends LightningElement {
|
|
|
451
441
|
// check whether we should expand all the child nodes, this is required for Coveo to crawl.
|
|
452
442
|
if (isExpandChildrenEnabled) {
|
|
453
443
|
this.expandChildrenForMarkdownReferences(
|
|
454
|
-
amfConfig.topic
|
|
444
|
+
amfConfig.topic.children
|
|
455
445
|
);
|
|
456
446
|
}
|
|
457
|
-
navItemChildren = amfConfig.topic
|
|
447
|
+
navItemChildren = amfConfig.topic.children;
|
|
458
448
|
}
|
|
459
449
|
// store nav items for each spec in order
|
|
460
450
|
navAmfOrder[index] = {
|
|
@@ -475,9 +465,7 @@ export default class AmfReference extends LightningElement {
|
|
|
475
465
|
* Returns a boolean indicating whether the children should be expanded or not.
|
|
476
466
|
*/
|
|
477
467
|
private isExpandChildrenEnabled(referenceId: string): boolean {
|
|
478
|
-
return
|
|
479
|
-
!!this.expandChildren && this._currentReferenceId === referenceId
|
|
480
|
-
);
|
|
468
|
+
return this.expandChildren && this._currentReferenceId === referenceId;
|
|
481
469
|
}
|
|
482
470
|
|
|
483
471
|
/**
|
|
@@ -521,12 +509,12 @@ export default class AmfReference extends LightningElement {
|
|
|
521
509
|
referenceId: string,
|
|
522
510
|
items: ParsedTopicModel[]
|
|
523
511
|
): NavItem[] {
|
|
524
|
-
const methodList = []
|
|
512
|
+
const methodList = [];
|
|
525
513
|
|
|
526
514
|
items.forEach((item) => {
|
|
527
515
|
item.methods?.forEach((method) => {
|
|
528
516
|
const title =
|
|
529
|
-
this.getTitleForLabel(method.label
|
|
517
|
+
this.getTitleForLabel(method.label) || method.method;
|
|
530
518
|
const meta = this.addToMetadata(
|
|
531
519
|
parentReferencePath,
|
|
532
520
|
referenceId,
|
|
@@ -574,7 +562,7 @@ export default class AmfReference extends LightningElement {
|
|
|
574
562
|
const parentReferencePath = amfConfig.href;
|
|
575
563
|
const model = this.amfMap[referenceId].parser.parsedModel;
|
|
576
564
|
|
|
577
|
-
const children
|
|
565
|
+
const children = [];
|
|
578
566
|
const expandChildren = this.isExpandChildrenEnabled(referenceId);
|
|
579
567
|
|
|
580
568
|
NAVIGATION_ITEMS.forEach(
|
|
@@ -601,8 +589,8 @@ export default class AmfReference extends LightningElement {
|
|
|
601
589
|
}
|
|
602
590
|
case "endpoint":
|
|
603
591
|
if (
|
|
604
|
-
model[childrenPropertyName
|
|
605
|
-
model[childrenPropertyName
|
|
592
|
+
model[childrenPropertyName] &&
|
|
593
|
+
model[childrenPropertyName].length
|
|
606
594
|
) {
|
|
607
595
|
const amfTopicId = this.getFormattedIdentifier(
|
|
608
596
|
referenceId,
|
|
@@ -611,7 +599,7 @@ export default class AmfReference extends LightningElement {
|
|
|
611
599
|
const childTopics = this.assignEndpointNavItems(
|
|
612
600
|
parentReferencePath,
|
|
613
601
|
referenceId,
|
|
614
|
-
model[childrenPropertyName
|
|
602
|
+
model[childrenPropertyName]
|
|
615
603
|
);
|
|
616
604
|
children.push({
|
|
617
605
|
label,
|
|
@@ -626,25 +614,23 @@ export default class AmfReference extends LightningElement {
|
|
|
626
614
|
break;
|
|
627
615
|
case "security":
|
|
628
616
|
case "type":
|
|
629
|
-
if (model[childrenPropertyName
|
|
617
|
+
if (model[childrenPropertyName]?.length) {
|
|
630
618
|
// Sorting the types alphabetically
|
|
631
|
-
model[childrenPropertyName
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
);
|
|
619
|
+
model[childrenPropertyName].sort((typeA, typeB) => {
|
|
620
|
+
const typeALbl = typeA.label.toLowerCase();
|
|
621
|
+
const typeBLbl = typeB.label.toLowerCase();
|
|
622
|
+
return typeALbl < typeBLbl
|
|
623
|
+
? -1
|
|
624
|
+
: typeALbl > typeBLbl
|
|
625
|
+
? 1
|
|
626
|
+
: 0;
|
|
627
|
+
});
|
|
642
628
|
}
|
|
643
629
|
// eslint-disable-next-line no-fallthrough
|
|
644
630
|
default:
|
|
645
631
|
if (
|
|
646
|
-
model[childrenPropertyName
|
|
647
|
-
model[childrenPropertyName
|
|
632
|
+
model[childrenPropertyName] &&
|
|
633
|
+
model[childrenPropertyName].length
|
|
648
634
|
) {
|
|
649
635
|
const amfTopicId = this.getFormattedIdentifier(
|
|
650
636
|
referenceId,
|
|
@@ -657,8 +643,8 @@ export default class AmfReference extends LightningElement {
|
|
|
657
643
|
this.metadata[amfTopicId]?.meta
|
|
658
644
|
),
|
|
659
645
|
isExpanded: expandChildren,
|
|
660
|
-
children: model[childrenPropertyName
|
|
661
|
-
(topic
|
|
646
|
+
children: model[childrenPropertyName].map(
|
|
647
|
+
(topic) => {
|
|
662
648
|
const meta = this.addToMetadata(
|
|
663
649
|
parentReferencePath,
|
|
664
650
|
referenceId,
|
|
@@ -695,18 +681,12 @@ export default class AmfReference extends LightningElement {
|
|
|
695
681
|
type: string,
|
|
696
682
|
topic: { id: string; domId: string },
|
|
697
683
|
navTitle: string
|
|
698
|
-
): string {
|
|
699
|
-
const
|
|
700
|
-
const urlIdentifer = config.urlIdentifer;
|
|
701
|
-
let prefix = null;
|
|
702
|
-
if ("prefix" in config) {
|
|
703
|
-
prefix = config.prefix;
|
|
704
|
-
}
|
|
684
|
+
): string | undefined {
|
|
685
|
+
const { urlIdentifer, prefix } = URL_CONFIG[type];
|
|
705
686
|
|
|
706
687
|
// encodeURI to avoid special characters in the URL meta.
|
|
707
688
|
const identifier =
|
|
708
|
-
urlIdentifer
|
|
709
|
-
this.encodeIdentifier(topic[urlIdentifer as keyof typeof topic]);
|
|
689
|
+
topic[urlIdentifer] && this.encodeIdentifier(topic[urlIdentifer]);
|
|
710
690
|
let meta;
|
|
711
691
|
// Assuming that there will be an identifier always
|
|
712
692
|
if (identifier) {
|
|
@@ -722,7 +702,7 @@ export default class AmfReference extends LightningElement {
|
|
|
722
702
|
navTitle
|
|
723
703
|
};
|
|
724
704
|
}
|
|
725
|
-
return meta
|
|
705
|
+
return meta;
|
|
726
706
|
}
|
|
727
707
|
|
|
728
708
|
/**
|
|
@@ -733,7 +713,7 @@ export default class AmfReference extends LightningElement {
|
|
|
733
713
|
(metadata: AmfMetadataTopic) => {
|
|
734
714
|
return routeMeta.meta === metadata.meta;
|
|
735
715
|
}
|
|
736
|
-
)
|
|
716
|
+
);
|
|
737
717
|
}
|
|
738
718
|
|
|
739
719
|
/**
|
|
@@ -747,7 +727,7 @@ export default class AmfReference extends LightningElement {
|
|
|
747
727
|
return Object.values(this.metadata).find(
|
|
748
728
|
(metadata: AmfMetadataTopic) =>
|
|
749
729
|
referenceId === metadata.referenceId && amfId === metadata.amfId
|
|
750
|
-
)
|
|
730
|
+
);
|
|
751
731
|
}
|
|
752
732
|
|
|
753
733
|
/**
|
|
@@ -762,7 +742,7 @@ export default class AmfReference extends LightningElement {
|
|
|
762
742
|
(metadata: AmfMetadataTopic) =>
|
|
763
743
|
referenceId === metadata.referenceId &&
|
|
764
744
|
identifier === metadata.identifier
|
|
765
|
-
)
|
|
745
|
+
);
|
|
766
746
|
}
|
|
767
747
|
|
|
768
748
|
/**
|
|
@@ -776,7 +756,7 @@ export default class AmfReference extends LightningElement {
|
|
|
776
756
|
return Object.values(this.metadata).find(
|
|
777
757
|
(metadata: AmfMetadataTopic) =>
|
|
778
758
|
referenceId === metadata.referenceId && type === metadata.type
|
|
779
|
-
)
|
|
759
|
+
);
|
|
780
760
|
}
|
|
781
761
|
|
|
782
762
|
/**
|
|
@@ -853,8 +833,9 @@ export default class AmfReference extends LightningElement {
|
|
|
853
833
|
this._currentReferenceId
|
|
854
834
|
);
|
|
855
835
|
if (specBasedReference) {
|
|
856
|
-
const currentMeta: RouteMeta |
|
|
857
|
-
|
|
836
|
+
const currentMeta: RouteMeta | null = this.getReferenceMetaInfo(
|
|
837
|
+
window.location.href
|
|
838
|
+
);
|
|
858
839
|
const metadata =
|
|
859
840
|
currentMeta && this.getMetadataByUrlQuery(currentMeta);
|
|
860
841
|
if (metadata) {
|
|
@@ -890,7 +871,7 @@ export default class AmfReference extends LightningElement {
|
|
|
890
871
|
this._currentReferenceId
|
|
891
872
|
);
|
|
892
873
|
if (specBasedReference) {
|
|
893
|
-
const { meta } = this.selectedTopic
|
|
874
|
+
const { meta } = this.selectedTopic;
|
|
894
875
|
const metadata = this.metadata[meta];
|
|
895
876
|
if (metadata) {
|
|
896
877
|
const {
|
|
@@ -1007,7 +988,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1007
988
|
* 1. If the url is encoded already
|
|
1008
989
|
* 2. If the url is decoded
|
|
1009
990
|
*/
|
|
1010
|
-
getUrlEncoded(url: string)
|
|
991
|
+
getUrlEncoded(url: string) {
|
|
1011
992
|
// if url matches, then return the encoded url.
|
|
1012
993
|
if (decodeURIComponent(url) === url) {
|
|
1013
994
|
return encodeURIComponent(url);
|
|
@@ -1023,7 +1004,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1023
1004
|
* For spec based references gets meta parm from url and then topicId & type from meta
|
|
1024
1005
|
* For markdown based references gets topicId as last html path in the name, meta & type will be empty
|
|
1025
1006
|
*/
|
|
1026
|
-
getReferenceMetaInfo(referenceUrl: string
|
|
1007
|
+
getReferenceMetaInfo(referenceUrl: string): RouteMeta | undefined {
|
|
1027
1008
|
let metaReferenceInfo;
|
|
1028
1009
|
if (referenceUrl) {
|
|
1029
1010
|
const referenceId = this.getReferenceIdFromUrl(referenceUrl);
|
|
@@ -1065,10 +1046,10 @@ export default class AmfReference extends LightningElement {
|
|
|
1065
1046
|
let topicTitle = "";
|
|
1066
1047
|
for (let i = 0; i < topics.length; i++) {
|
|
1067
1048
|
const topic = topics[i];
|
|
1068
|
-
const meta = this.getMarkdownReferenceMeta(topic.link
|
|
1049
|
+
const meta = this.getMarkdownReferenceMeta(topic.link.href);
|
|
1069
1050
|
const childTopics = topic.children;
|
|
1070
1051
|
if (meta === topicMeta) {
|
|
1071
|
-
referenceUrl = topic.link
|
|
1052
|
+
referenceUrl = topic.link.href;
|
|
1072
1053
|
topicTitle = topic.label;
|
|
1073
1054
|
} else if (childTopics && childTopics.length) {
|
|
1074
1055
|
const referenceDetails = this.getReferenceDetailsInGivenTopics(
|
|
@@ -1179,7 +1160,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1179
1160
|
}
|
|
1180
1161
|
});
|
|
1181
1162
|
} else {
|
|
1182
|
-
let invalidTopicReferenceUrl
|
|
1163
|
+
let invalidTopicReferenceUrl = "";
|
|
1183
1164
|
if (topicId) {
|
|
1184
1165
|
const referenceDetails = this.getRefDetailsForGivenTopicMeta(
|
|
1185
1166
|
referenceId,
|
|
@@ -1215,7 +1196,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1215
1196
|
* set selected sidebar value as a pathname
|
|
1216
1197
|
*/
|
|
1217
1198
|
|
|
1218
|
-
private loadMarkdownBasedReference(referenceUrl?: string
|
|
1199
|
+
private loadMarkdownBasedReference(referenceUrl?: string): void {
|
|
1219
1200
|
let referenceId = "";
|
|
1220
1201
|
const currentUrl = window.location.href;
|
|
1221
1202
|
if (this.isProjectRootPath()) {
|
|
@@ -1229,7 +1210,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1229
1210
|
* CASE2: This case is to navigate to respective reference when the user clicked on root item
|
|
1230
1211
|
* Ex: .../references/markdown-ref should navigate to first topic.
|
|
1231
1212
|
*/
|
|
1232
|
-
referenceId = this.getReferenceIdFromUrl(referenceUrl
|
|
1213
|
+
referenceId = this.getReferenceIdFromUrl(referenceUrl);
|
|
1233
1214
|
} else if (this.isParentReferencePath(currentUrl)) {
|
|
1234
1215
|
/**
|
|
1235
1216
|
* CASE3: This case is to navigate to respective reference when the user entered url with reference id
|
|
@@ -1258,9 +1239,9 @@ export default class AmfReference extends LightningElement {
|
|
|
1258
1239
|
const amfConfig = this.getAmfConfigWithId(referenceId);
|
|
1259
1240
|
let redirectReferenceUrl = "";
|
|
1260
1241
|
if (amfConfig) {
|
|
1261
|
-
const childrenItems = amfConfig.topic
|
|
1242
|
+
const childrenItems = amfConfig.topic.children;
|
|
1262
1243
|
if (childrenItems.length > 0) {
|
|
1263
|
-
redirectReferenceUrl = childrenItems[0].link
|
|
1244
|
+
redirectReferenceUrl = childrenItems[0].link.href;
|
|
1264
1245
|
}
|
|
1265
1246
|
}
|
|
1266
1247
|
if (redirectReferenceUrl) {
|
|
@@ -1394,7 +1375,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1394
1375
|
|
|
1395
1376
|
handleSelectedItem(): void {
|
|
1396
1377
|
// update topic view
|
|
1397
|
-
const { referenceId, amfId, type } = this.selectedTopic
|
|
1378
|
+
const { referenceId, amfId, type } = this.selectedTopic;
|
|
1398
1379
|
|
|
1399
1380
|
// This updates the component in the content section.
|
|
1400
1381
|
this.topicModel = {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
AmfHelperMixin,
|
|
4
|
-
EndPoint,
|
|
5
|
-
Operation
|
|
6
|
-
} from "@api-components/amf-helper-mixin";
|
|
1
|
+
import { AmfHelperMixin } from "@api-components/amf-helper-mixin";
|
|
7
2
|
import { normalizeDomId } from "dxUtils/normalizers";
|
|
8
3
|
|
|
9
4
|
const ID_PROPERTY = "@id";
|
|
@@ -12,7 +7,7 @@ const TYPE_PROPERTY = "@type";
|
|
|
12
7
|
export class AmfModelParser extends AmfHelperMixin(Object) {
|
|
13
8
|
_parsedModel = null;
|
|
14
9
|
|
|
15
|
-
constructor(api
|
|
10
|
+
constructor(api) {
|
|
16
11
|
super();
|
|
17
12
|
if (api) {
|
|
18
13
|
this.amf = Array.isArray(api) ? api[0] : api;
|
|
@@ -522,7 +517,7 @@ export class AmfModelParser extends AmfHelperMixin(Object) {
|
|
|
522
517
|
* @param {string} selected Currently selected `@id`.
|
|
523
518
|
* @return {any|undefined} Model definition for an endpoint fragment.
|
|
524
519
|
*/
|
|
525
|
-
computeEndpointApiModel(model, selectedId)
|
|
520
|
+
computeEndpointApiModel(model, selectedId) {
|
|
526
521
|
const webApi = this._computeApi(model);
|
|
527
522
|
return this._computeEndpointModel(webApi, selectedId);
|
|
528
523
|
}
|
|
@@ -534,7 +529,7 @@ export class AmfModelParser extends AmfHelperMixin(Object) {
|
|
|
534
529
|
* @param {string} selected Currently selected `@id`.
|
|
535
530
|
* @return {any|undefined} Model definition for an endpoint fragment.
|
|
536
531
|
*/
|
|
537
|
-
computeMethodApiModel(model, selected)
|
|
532
|
+
computeMethodApiModel(model, selected) {
|
|
538
533
|
const webApi = this._computeApi(model);
|
|
539
534
|
return this._computeMethodModel(webApi, selected);
|
|
540
535
|
}
|
|
@@ -546,7 +541,7 @@ export class AmfModelParser extends AmfHelperMixin(Object) {
|
|
|
546
541
|
* @param {string} selected Currently selected `@id`.
|
|
547
542
|
* @return {any|undefined} Model definition for an endpoint fragment.
|
|
548
543
|
*/
|
|
549
|
-
computeEndpointApiMethodModel(model, selected)
|
|
544
|
+
computeEndpointApiMethodModel(model, selected) {
|
|
550
545
|
const webApi = this._computeApi(model);
|
|
551
546
|
return this._computeMethodEndpoint(webApi, selected);
|
|
552
547
|
}
|
|
@@ -8,15 +8,14 @@ import {
|
|
|
8
8
|
createTypeElement
|
|
9
9
|
} from "./utils";
|
|
10
10
|
import type { TopicModel } from "./types";
|
|
11
|
-
import { Json } from "typings/custom";
|
|
12
11
|
|
|
13
12
|
export default class AmfTopic extends LightningElement {
|
|
14
|
-
private _model
|
|
15
|
-
private amf
|
|
16
|
-
private type
|
|
13
|
+
private _model;
|
|
14
|
+
private amf;
|
|
15
|
+
private type;
|
|
17
16
|
|
|
18
17
|
@api
|
|
19
|
-
get model(): TopicModel
|
|
18
|
+
get model(): TopicModel {
|
|
20
19
|
return this._model;
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -42,11 +41,7 @@ export default class AmfTopic extends LightningElement {
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
update(): void {
|
|
45
|
-
|
|
46
|
-
throw new Error("Amf TopicModel undefined when trying to update");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const container = this.template.querySelector("div.topic-container")!;
|
|
44
|
+
const container = this.template.querySelector("div.topic-container");
|
|
50
45
|
const { id } = this.model;
|
|
51
46
|
const type = this.type;
|
|
52
47
|
const amf = this.amf;
|
|
@@ -84,7 +79,7 @@ export default class AmfTopic extends LightningElement {
|
|
|
84
79
|
if (container.firstChild) {
|
|
85
80
|
container.firstChild.remove();
|
|
86
81
|
}
|
|
87
|
-
container.appendChild(element
|
|
82
|
+
container.appendChild(element);
|
|
88
83
|
}
|
|
89
84
|
}
|
|
90
85
|
|
|
@@ -94,6 +89,6 @@ export default class AmfTopic extends LightningElement {
|
|
|
94
89
|
* @param value JSON Serializable object to clone.
|
|
95
90
|
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
|
|
96
91
|
*/
|
|
97
|
-
function clone(value
|
|
92
|
+
function clone(value): object {
|
|
98
93
|
return JSON.parse(JSON.stringify(value));
|
|
99
94
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { Json } from "typings/custom";
|
|
2
|
-
import { AmfModelParser } from "docUtils/amf";
|
|
3
|
-
import {
|
|
4
|
-
DomainElement,
|
|
5
|
-
EndPoint,
|
|
6
|
-
Operation,
|
|
7
|
-
Shape
|
|
8
|
-
} from "@api-components/amf-helper-mixin";
|
|
9
2
|
|
|
10
3
|
export type ApiSummaryElement = HTMLElement & {
|
|
11
4
|
amf: Json;
|
|
@@ -18,39 +11,44 @@ export type ApiEndpointElement = HTMLElement & {
|
|
|
18
11
|
inlineMethods: boolean;
|
|
19
12
|
noNavigation: boolean;
|
|
20
13
|
selected: string;
|
|
21
|
-
endpoint:
|
|
14
|
+
endpoint: Json;
|
|
22
15
|
noTryIt: boolean;
|
|
23
16
|
};
|
|
24
17
|
|
|
25
18
|
export type ApiMethodElement = HTMLElement & {
|
|
26
19
|
amf: Json;
|
|
27
20
|
noNavigation: boolean;
|
|
28
|
-
endpoint:
|
|
29
|
-
method:
|
|
21
|
+
endpoint: Json;
|
|
22
|
+
method: Json;
|
|
30
23
|
noTryIt: boolean;
|
|
31
24
|
};
|
|
32
25
|
|
|
33
26
|
export type ApiSecurityElement = HTMLElement & {
|
|
34
27
|
amf: Json;
|
|
35
|
-
security:
|
|
28
|
+
security: Json;
|
|
36
29
|
};
|
|
37
30
|
|
|
38
31
|
export type ApiTypeElement = HTMLElement & {
|
|
39
32
|
amf: Json;
|
|
40
|
-
type
|
|
33
|
+
type: Json;
|
|
41
34
|
mediaTypes: Json;
|
|
42
35
|
};
|
|
43
36
|
|
|
44
37
|
export type ApiDocElement = HTMLElement & {
|
|
45
38
|
amf: Json;
|
|
46
|
-
shape:
|
|
39
|
+
shape: Json;
|
|
47
40
|
};
|
|
48
41
|
|
|
49
42
|
export type AmfModel = Json;
|
|
50
43
|
|
|
44
|
+
export interface AmfParser {
|
|
45
|
+
parse(): void;
|
|
46
|
+
parsedModel: any;
|
|
47
|
+
}
|
|
48
|
+
|
|
51
49
|
export interface TopicModel {
|
|
52
50
|
id: string;
|
|
53
51
|
type: string;
|
|
54
52
|
amf: AmfModel;
|
|
55
|
-
parser:
|
|
53
|
+
parser: AmfParser;
|
|
56
54
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DomainElement,
|
|
3
|
-
EndPoint,
|
|
4
|
-
Operation,
|
|
5
|
-
Shape
|
|
6
|
-
} from "@api-components/amf-helper-mixin";
|
|
7
1
|
import type {
|
|
8
2
|
ApiDocElement,
|
|
9
3
|
ApiEndpointElement,
|
|
@@ -43,7 +37,7 @@ export function createSummaryElement(amf: Json): HTMLElement {
|
|
|
43
37
|
*/
|
|
44
38
|
export function createEndpointElement(
|
|
45
39
|
amf: Json,
|
|
46
|
-
endpointModel:
|
|
40
|
+
endpointModel: Json,
|
|
47
41
|
selected: string
|
|
48
42
|
): HTMLElement {
|
|
49
43
|
const el: ApiEndpointElement = document.createElement(
|
|
@@ -63,8 +57,8 @@ export function createEndpointElement(
|
|
|
63
57
|
*/
|
|
64
58
|
export function createMethodElement(
|
|
65
59
|
amf: Json,
|
|
66
|
-
endpointMethodModel:
|
|
67
|
-
methodModel:
|
|
60
|
+
endpointMethodModel: Json,
|
|
61
|
+
methodModel: Json
|
|
68
62
|
): HTMLElement {
|
|
69
63
|
const el: ApiMethodElement = document.createElement(
|
|
70
64
|
"api-method-documentation"
|
|
@@ -85,7 +79,7 @@ export function createMethodElement(
|
|
|
85
79
|
*/
|
|
86
80
|
export function createSecurityElement(
|
|
87
81
|
amf: Json,
|
|
88
|
-
securityModel:
|
|
82
|
+
securityModel: Json
|
|
89
83
|
): HTMLElement {
|
|
90
84
|
const el: ApiSecurityElement = document.createElement(
|
|
91
85
|
"api-security-documentation"
|
|
@@ -104,7 +98,7 @@ export function createSecurityElement(
|
|
|
104
98
|
*/
|
|
105
99
|
export function createTypeElement(
|
|
106
100
|
amf: Json,
|
|
107
|
-
typeModel:
|
|
101
|
+
typeModel: Json,
|
|
108
102
|
mediaTypes: Json
|
|
109
103
|
): HTMLElement {
|
|
110
104
|
const el: ApiTypeElement = document.createElement(
|
|
@@ -125,7 +119,7 @@ export function createTypeElement(
|
|
|
125
119
|
*/
|
|
126
120
|
export function createDocumentationElement(
|
|
127
121
|
amf: Json,
|
|
128
|
-
docsModel:
|
|
122
|
+
docsModel: Json
|
|
129
123
|
): HTMLElement {
|
|
130
124
|
const el: ApiDocElement = document.createElement(
|
|
131
125
|
"api-documentation-document"
|
|
@@ -271,27 +271,6 @@ a:hover,
|
|
|
271
271
|
text-decoration: underline;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
@media (max-width: 640px) {
|
|
275
|
-
/* Mobile */
|
|
276
|
-
img.content-image {
|
|
277
|
-
max-width: 95vw;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
@media (min-width: 641px) {
|
|
282
|
-
/* Tablet (medium) */
|
|
283
|
-
img.content-image {
|
|
284
|
-
max-width: 80vw;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
@media (min-width: 769px) {
|
|
289
|
-
/* Desktop */
|
|
290
|
-
img.content-image {
|
|
291
|
-
max-width: min(60vw, 650px);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
274
|
ul,
|
|
296
275
|
ol {
|
|
297
276
|
margin-left: var(--dx-g-spacing-lg);
|