@salesforcedevs/docs-components 1.34.3-fix-redoc-topic-v-2 → 1.34.3-style-fix-alpha1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.34.3-fix-
|
|
3
|
+
"version": "1.34.3-style-fix-alpha1",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,6 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
29
|
-
"stableVersion": "1.34.3"
|
|
28
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
30
29
|
}
|
|
@@ -10,15 +10,6 @@ import { throttle } from "throttle-debounce";
|
|
|
10
10
|
import { pollUntil } from "dxUtils/async";
|
|
11
11
|
import { toJson } from "dxUtils/normalizers";
|
|
12
12
|
import { oldVersionDocInfo } from "docUtils/utils";
|
|
13
|
-
import {
|
|
14
|
-
applyVersionToHref,
|
|
15
|
-
collectSubtreeCanonicalHrefs,
|
|
16
|
-
normalizePath,
|
|
17
|
-
getTopicVersionKey,
|
|
18
|
-
persistTopicVersion,
|
|
19
|
-
toCanonicalHref
|
|
20
|
-
} from "dxUtils/topicVersion";
|
|
21
|
-
import type { VersionedNode } from "dxUtils/topicVersion";
|
|
22
13
|
import type { DocPhaseInfo, OptionWithLink } from "typings/custom";
|
|
23
14
|
|
|
24
15
|
declare global {
|
|
@@ -56,8 +47,6 @@ type ReferenceVersion = {
|
|
|
56
47
|
type ReferenceConfig = {
|
|
57
48
|
refList: ReferenceItem[];
|
|
58
49
|
versions?: ReferenceVersion[];
|
|
59
|
-
/** Sidebar topic name. Sidebar stores the selected version under this key. */
|
|
60
|
-
versionTopicKey?: string;
|
|
61
50
|
};
|
|
62
51
|
|
|
63
52
|
const SCROLL_THROTTLE_DELAY = 50;
|
|
@@ -140,30 +129,6 @@ export default class RedocReference extends LightningElement {
|
|
|
140
129
|
*/
|
|
141
130
|
@api headerHref: string | null = null;
|
|
142
131
|
|
|
143
|
-
/**
|
|
144
|
-
* Versioned topic that owns this spec, including its children.
|
|
145
|
-
* Href matches this page, so an older version still has its version
|
|
146
|
-
* in the path.
|
|
147
|
-
*/
|
|
148
|
-
@api
|
|
149
|
-
set parentTopicFamily(value: string | { topics?: VersionedNode[] } | null) {
|
|
150
|
-
try {
|
|
151
|
-
const parsed = toJson(value) as { topics?: VersionedNode[] } | null;
|
|
152
|
-
this._parentTopicFamilyNode = parsed?.topics?.[0] ?? null;
|
|
153
|
-
} catch (error) {
|
|
154
|
-
this._parentTopicFamilyNode = null;
|
|
155
|
-
console.error("Failed to parse parent topic family", error);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
get parentTopicFamily(): { topics?: VersionedNode[] } | null {
|
|
160
|
-
return this._parentTopicFamilyNode
|
|
161
|
-
? { topics: [this._parentTopicFamilyNode] }
|
|
162
|
-
: null;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
private _parentTopicFamilyNode: VersionedNode | null = null;
|
|
166
|
-
|
|
167
132
|
@api
|
|
168
133
|
get contentType(): string {
|
|
169
134
|
return this._contentType;
|
|
@@ -268,64 +233,13 @@ export default class RedocReference extends LightningElement {
|
|
|
268
233
|
private onBackClick = (event: Event): void => {
|
|
269
234
|
event.preventDefault();
|
|
270
235
|
|
|
271
|
-
const target = this.
|
|
236
|
+
const target = this.getTranslatedBackTarget() ?? this.headerHref;
|
|
272
237
|
|
|
273
238
|
if (target) {
|
|
274
239
|
window.location.assign(target);
|
|
275
240
|
}
|
|
276
241
|
};
|
|
277
242
|
|
|
278
|
-
/**
|
|
279
|
-
* When the back target is in this spec's topic, return it on the
|
|
280
|
-
* selected version. With no back target, do the same for the header
|
|
281
|
-
* link when that link is the versioned parent.
|
|
282
|
-
*/
|
|
283
|
-
private getVersionedBackTarget(): string | null {
|
|
284
|
-
const stored = this.getTranslatedBackTarget();
|
|
285
|
-
const selectedVersion = this.selectedVersion;
|
|
286
|
-
const target = stored ?? this.headerHref;
|
|
287
|
-
if (!target || !selectedVersion) {
|
|
288
|
-
return stored;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
let targetUrl: URL;
|
|
292
|
-
try {
|
|
293
|
-
targetUrl = new URL(target, window.location.origin);
|
|
294
|
-
} catch {
|
|
295
|
-
return target;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// Family hrefs match this page's version. Compare them without
|
|
299
|
-
// the version segment. Rewrite only the pathname so the target's
|
|
300
|
-
// query and hash survive.
|
|
301
|
-
const familyHrefs = this._parentTopicFamilyNode
|
|
302
|
-
? collectSubtreeCanonicalHrefs(this._parentTopicFamilyNode).map(
|
|
303
|
-
(href) => toCanonicalHref(href, this.versions)
|
|
304
|
-
)
|
|
305
|
-
: [];
|
|
306
|
-
|
|
307
|
-
const canonicalTarget = toCanonicalHref(
|
|
308
|
-
targetUrl.pathname,
|
|
309
|
-
this.versions
|
|
310
|
-
);
|
|
311
|
-
const inFamily = familyHrefs.some(
|
|
312
|
-
(href) => normalizePath(href) === normalizePath(canonicalTarget)
|
|
313
|
-
);
|
|
314
|
-
if (!inFamily) {
|
|
315
|
-
return target;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const versioned = applyVersionToHref(
|
|
319
|
-
canonicalTarget,
|
|
320
|
-
selectedVersion,
|
|
321
|
-
this.versions
|
|
322
|
-
);
|
|
323
|
-
if (!versioned) {
|
|
324
|
-
return target;
|
|
325
|
-
}
|
|
326
|
-
return `${versioned}${targetUrl.search}${targetUrl.hash}`;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
243
|
private getTranslatedBackTarget(): string | null {
|
|
330
244
|
const stored = this.getBackTargetFromSession();
|
|
331
245
|
if (stored) {
|
|
@@ -448,13 +362,6 @@ export default class RedocReference extends LightningElement {
|
|
|
448
362
|
// Track the back target, preserving it across locale switches
|
|
449
363
|
this.trackBackTarget();
|
|
450
364
|
|
|
451
|
-
// Remember the selected version for the sidebar. Changing version
|
|
452
|
-
// reloads this page.
|
|
453
|
-
const topicKey = this.getParentTopicVersionKey();
|
|
454
|
-
if (topicKey && this.selectedVersion) {
|
|
455
|
-
persistTopicVersion(topicKey, this.selectedVersion.id);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
365
|
window.addEventListener("scroll", this.handleScrollAndResize);
|
|
459
366
|
window.addEventListener("resize", this.handleScrollAndResize);
|
|
460
367
|
}
|
|
@@ -763,18 +670,6 @@ export default class RedocReference extends LightningElement {
|
|
|
763
670
|
return wrapper;
|
|
764
671
|
}
|
|
765
672
|
|
|
766
|
-
/**
|
|
767
|
-
* Key the sidebar uses for this topic's selected version.
|
|
768
|
-
* Missing `versionTopicKey` returns null so nothing is written.
|
|
769
|
-
*/
|
|
770
|
-
private getParentTopicVersionKey(): string | null {
|
|
771
|
-
const versionTopicKey = this._referenceConfig?.versionTopicKey;
|
|
772
|
-
if (!versionTopicKey) {
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
return getTopicVersionKey({ name: versionTopicKey }) || null;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
673
|
/** Stashes the current view (URL hash) before the version link navigates. */
|
|
779
674
|
private onVersionChange = (): void => {
|
|
780
675
|
sessionStorage.setItem(
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
/* NOTE: doc-version-picker-width width variable is used by both dx-button and dx-dropdown to maintain a consistent width. */
|
|
4
4
|
:host {
|
|
5
|
+
/* Always positioned so the popover's containing block stays the picker.
|
|
6
|
+
Toggling position with aria-expanded lets the menu jump to the sidebar
|
|
7
|
+
(top of the ToC) for a frame before LWC hides it. */
|
|
8
|
+
position: relative;
|
|
9
|
+
|
|
5
10
|
--dx-c-dropdown-option-font-weight: normal;
|
|
11
|
+
--dx-c-dropdown-option-font-size: var(--dx-g-text-base);
|
|
6
12
|
--dx-c-dropdown-option-label-color: var(--dx-g-gray-10);
|
|
7
13
|
--dx-c-dropdown-option-padding: var(--dx-g-spacing-sm)
|
|
8
14
|
var(--dx-g-spacing-lg);
|
|
9
15
|
--dx-c-popover-padding: var(--dx-g-spacing-sm) 0;
|
|
10
16
|
--popover-container-open-transform: translateY(4px);
|
|
17
|
+
--dx-c-version-picker-focus-ring: 0 0 0 2px white,
|
|
18
|
+
0 0 0 4px var(--dx-g-blue-vibrant-60);
|
|
11
19
|
}
|
|
12
20
|
|
|
13
21
|
/* Open menus must stack above later sibling pickers in the sidebar. */
|
|
14
22
|
:host(:has([aria-expanded="true"])) {
|
|
15
|
-
position: relative;
|
|
16
23
|
z-index: 2;
|
|
17
24
|
}
|
|
18
25
|
|
|
@@ -48,13 +55,13 @@
|
|
|
48
55
|
.version-picker-button {
|
|
49
56
|
display: flex;
|
|
50
57
|
width: var(--doc-version-picker-width, 296px);
|
|
58
|
+
overflow: visible;
|
|
51
59
|
|
|
52
60
|
--dx-c-button-horizontal-spacing: var(--dx-g-spacing-sm);
|
|
53
61
|
--dx-g-button-icon-color: var(--dx-g-gray-50);
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
.version-picker-button:hover,
|
|
57
|
-
.version-picker-button:focus-within,
|
|
58
65
|
.version-picker-button[aria-expanded="true"] {
|
|
59
66
|
--dx-g-button-icon-color: var(--dx-g-blue-vibrant-20);
|
|
60
67
|
}
|
|
@@ -68,25 +75,59 @@ dx-button::part(content) {
|
|
|
68
75
|
overflow: hidden;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
/*
|
|
72
|
-
|
|
78
|
+
/* Border width stays 1px in every state. Hover, open, and focus paint the
|
|
79
|
+
2px blue stroke with an inset shadow so the box does not grow.
|
|
80
|
+
Tertiary's hover border is overridden. */
|
|
73
81
|
.version-picker-button::part(container) {
|
|
82
|
+
box-sizing: border-box;
|
|
74
83
|
background: white;
|
|
75
|
-
|
|
84
|
+
border: 1px solid var(--dx-g-gray-50);
|
|
85
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
86
|
+
box-shadow: none;
|
|
76
87
|
color: var(--dx-g-gray-10);
|
|
88
|
+
outline: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Hover only (not open): 2px #032D60 on #EEF4FF, no ring.
|
|
92
|
+
Border color matches the fill so the 1px border does not add a third
|
|
93
|
+
pixel around the inset stroke.
|
|
94
|
+
:focus-visible is included so click-open + Escape (which upgrades the
|
|
95
|
+
trigger to keyboard focus) still looks like hover while the pointer is on
|
|
96
|
+
the picker. */
|
|
97
|
+
.version-picker-button:hover:not([aria-expanded="true"])::part(container),
|
|
98
|
+
.version-picker-button:hover:not([aria-expanded="true"])::part(
|
|
99
|
+
container
|
|
100
|
+
):focus-visible {
|
|
101
|
+
background: var(--dx-g-blue-vibrant-95);
|
|
102
|
+
border: 1px solid var(--dx-g-blue-vibrant-95);
|
|
103
|
+
box-shadow: inset 0 0 0 2px var(--dx-g-blue-vibrant-20);
|
|
77
104
|
}
|
|
78
105
|
|
|
79
|
-
|
|
106
|
+
/* Halo lives on the dx-button host so inner tertiary styles / overflow
|
|
107
|
+
cannot flatten it. Fill and the inset stroke stay on the part. */
|
|
108
|
+
.version-picker-button[aria-expanded="true"] {
|
|
109
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
110
|
+
box-shadow: var(--dx-c-version-picker-focus-ring);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.version-picker-button[aria-expanded="true"]::part(container) {
|
|
80
114
|
background: var(--dx-g-blue-vibrant-95);
|
|
115
|
+
border: 1px solid var(--dx-g-blue-vibrant-95);
|
|
116
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
81
117
|
box-shadow: inset 0 0 0 2px var(--dx-g-blue-vibrant-20);
|
|
82
118
|
}
|
|
83
119
|
|
|
84
|
-
/*
|
|
85
|
-
.version-picker-button:
|
|
86
|
-
|
|
120
|
+
/* Keyboard focus while closed. Open uses the host halo above. */
|
|
121
|
+
.version-picker-button:not([aria-expanded="true"])::part(
|
|
122
|
+
container
|
|
123
|
+
):focus-visible {
|
|
124
|
+
--dx-g-button-icon-color: var(--dx-g-blue-vibrant-20);
|
|
125
|
+
|
|
87
126
|
background: var(--dx-g-blue-vibrant-95);
|
|
88
|
-
|
|
89
|
-
|
|
127
|
+
border: 1px solid var(--dx-g-blue-vibrant-95);
|
|
128
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
129
|
+
box-shadow: inset 0 0 0 2px var(--dx-g-blue-vibrant-20),
|
|
130
|
+
var(--dx-c-version-picker-focus-ring);
|
|
90
131
|
}
|
|
91
132
|
|
|
92
133
|
.selected-version {
|
|
@@ -112,12 +153,13 @@ dx-type-badge.not-latest-badge {
|
|
|
112
153
|
* Small "dot" variant (opt-in via `small`). Additive
|
|
113
154
|
* ------------------------------------------------------------------ */
|
|
114
155
|
|
|
115
|
-
/*
|
|
116
|
-
the
|
|
156
|
+
/* Menu is capped at the ToC width (296px), not the 104px trigger, so options
|
|
157
|
+
keep the same 16px / 8px 24px / gray-10 type as the default picker. */
|
|
117
158
|
.version-picker-dropdown-small {
|
|
118
|
-
--dx-c-dropdown-option-font-size: var(--dx-g-text-
|
|
159
|
+
--dx-c-dropdown-option-font-size: var(--dx-g-text-base);
|
|
119
160
|
--dx-c-dropdown-option-padding: var(--dx-g-spacing-sm)
|
|
120
|
-
var(--dx-g-spacing-
|
|
161
|
+
var(--dx-g-spacing-lg);
|
|
162
|
+
--dx-c-dropdown-option-label-color: var(--dx-g-gray-10);
|
|
121
163
|
--dx-c-dropdown-option-border-radius: 0;
|
|
122
164
|
--dx-c-popover-border: none;
|
|
123
165
|
|