@salesforcedevs/docs-components 1.34.3-fix-redoc-topic-v-1 → 1.34.3-style-fix-alpha
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-alpha",
|
|
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,51 +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
|
-
// Family hrefs match this page's version. Compare them without
|
|
292
|
-
// the version segment.
|
|
293
|
-
const familyHrefs = this._parentTopicFamilyNode
|
|
294
|
-
? collectSubtreeCanonicalHrefs(this._parentTopicFamilyNode).map(
|
|
295
|
-
(href) => toCanonicalHref(href, this.versions)
|
|
296
|
-
)
|
|
297
|
-
: [];
|
|
298
|
-
|
|
299
|
-
const canonicalTarget = toCanonicalHref(target, this.versions);
|
|
300
|
-
const inFamily = familyHrefs.some(
|
|
301
|
-
(href) => normalizePath(href) === normalizePath(canonicalTarget)
|
|
302
|
-
);
|
|
303
|
-
if (!inFamily) {
|
|
304
|
-
return target;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
return (
|
|
308
|
-
applyVersionToHref(
|
|
309
|
-
canonicalTarget,
|
|
310
|
-
selectedVersion,
|
|
311
|
-
this.versions
|
|
312
|
-
) ?? target
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
243
|
private getTranslatedBackTarget(): string | null {
|
|
317
244
|
const stored = this.getBackTargetFromSession();
|
|
318
245
|
if (stored) {
|
|
@@ -435,13 +362,6 @@ export default class RedocReference extends LightningElement {
|
|
|
435
362
|
// Track the back target, preserving it across locale switches
|
|
436
363
|
this.trackBackTarget();
|
|
437
364
|
|
|
438
|
-
// Remember the selected version for the sidebar. Changing version
|
|
439
|
-
// reloads this page.
|
|
440
|
-
const topicKey = this.getParentTopicVersionKey();
|
|
441
|
-
if (topicKey && this.selectedVersion) {
|
|
442
|
-
persistTopicVersion(topicKey, this.selectedVersion.id);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
365
|
window.addEventListener("scroll", this.handleScrollAndResize);
|
|
446
366
|
window.addEventListener("resize", this.handleScrollAndResize);
|
|
447
367
|
}
|
|
@@ -750,18 +670,6 @@ export default class RedocReference extends LightningElement {
|
|
|
750
670
|
return wrapper;
|
|
751
671
|
}
|
|
752
672
|
|
|
753
|
-
/**
|
|
754
|
-
* Key the sidebar uses for this topic's selected version.
|
|
755
|
-
* Missing `versionTopicKey` returns null so nothing is written.
|
|
756
|
-
*/
|
|
757
|
-
private getParentTopicVersionKey(): string | null {
|
|
758
|
-
const versionTopicKey = this._referenceConfig?.versionTopicKey;
|
|
759
|
-
if (!versionTopicKey) {
|
|
760
|
-
return null;
|
|
761
|
-
}
|
|
762
|
-
return getTopicVersionKey({ name: versionTopicKey }) || null;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
673
|
/** Stashes the current view (URL hash) before the version link navigates. */
|
|
766
674
|
private onVersionChange = (): void => {
|
|
767
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,55 @@ dx-button::part(content) {
|
|
|
68
75
|
overflow: hidden;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
/*
|
|
72
|
-
|
|
78
|
+
/* box-sizing: border-box so the 2px hover/focus border doesn't grow the
|
|
79
|
+
small variant's 24px box. Tertiary's 1px hover border is overridden. */
|
|
73
80
|
.version-picker-button::part(container) {
|
|
81
|
+
box-sizing: border-box;
|
|
74
82
|
background: white;
|
|
75
|
-
|
|
83
|
+
border: 1px solid var(--dx-g-gray-50);
|
|
84
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
85
|
+
box-shadow: none;
|
|
76
86
|
color: var(--dx-g-gray-10);
|
|
87
|
+
outline: none;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
|
|
90
|
+
/* Hover only (not open): 2px #032D60 on #EEF4FF, no ring.
|
|
91
|
+
:focus-visible is included so click-open + Escape (which upgrades the
|
|
92
|
+
trigger to keyboard focus) still looks like hover while the pointer is on
|
|
93
|
+
the picker. */
|
|
94
|
+
.version-picker-button:hover:not([aria-expanded="true"])::part(container),
|
|
95
|
+
.version-picker-button:hover:not([aria-expanded="true"])::part(
|
|
96
|
+
container
|
|
97
|
+
):focus-visible {
|
|
80
98
|
background: var(--dx-g-blue-vibrant-95);
|
|
81
|
-
|
|
99
|
+
border: 2px solid var(--dx-g-blue-vibrant-20);
|
|
100
|
+
box-shadow: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Halo lives on the dx-button host so inner tertiary styles / overflow
|
|
104
|
+
cannot flatten it. Fill and 2px border stay on the part. */
|
|
105
|
+
.version-picker-button[aria-expanded="true"] {
|
|
106
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
107
|
+
box-shadow: var(--dx-c-version-picker-focus-ring);
|
|
82
108
|
}
|
|
83
109
|
|
|
84
|
-
/* aria-expanded keeps the focus ring while the menu is open. */
|
|
85
|
-
.version-picker-button:focus-within::part(container),
|
|
86
110
|
.version-picker-button[aria-expanded="true"]::part(container) {
|
|
87
111
|
background: var(--dx-g-blue-vibrant-95);
|
|
88
|
-
|
|
89
|
-
|
|
112
|
+
border: 2px solid var(--dx-g-blue-vibrant-20);
|
|
113
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
114
|
+
box-shadow: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Keyboard focus while closed. Open uses the host halo above. */
|
|
118
|
+
.version-picker-button:not([aria-expanded="true"])::part(
|
|
119
|
+
container
|
|
120
|
+
):focus-visible {
|
|
121
|
+
--dx-g-button-icon-color: var(--dx-g-blue-vibrant-20);
|
|
122
|
+
|
|
123
|
+
background: var(--dx-g-blue-vibrant-95);
|
|
124
|
+
border: 2px solid var(--dx-g-blue-vibrant-20);
|
|
125
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
126
|
+
box-shadow: var(--dx-c-version-picker-focus-ring);
|
|
90
127
|
}
|
|
91
128
|
|
|
92
129
|
.selected-version {
|
|
@@ -112,12 +149,13 @@ dx-type-badge.not-latest-badge {
|
|
|
112
149
|
* Small "dot" variant (opt-in via `small`). Additive
|
|
113
150
|
* ------------------------------------------------------------------ */
|
|
114
151
|
|
|
115
|
-
/*
|
|
116
|
-
the
|
|
152
|
+
/* Menu is capped at the ToC width (296px), not the 104px trigger, so options
|
|
153
|
+
keep the same 16px / 8px 24px / gray-10 type as the default picker. */
|
|
117
154
|
.version-picker-dropdown-small {
|
|
118
|
-
--dx-c-dropdown-option-font-size: var(--dx-g-text-
|
|
155
|
+
--dx-c-dropdown-option-font-size: var(--dx-g-text-base);
|
|
119
156
|
--dx-c-dropdown-option-padding: var(--dx-g-spacing-sm)
|
|
120
|
-
var(--dx-g-spacing-
|
|
157
|
+
var(--dx-g-spacing-lg);
|
|
158
|
+
--dx-c-dropdown-option-label-color: var(--dx-g-gray-10);
|
|
121
159
|
--dx-c-dropdown-option-border-radius: 0;
|
|
122
160
|
--dx-c-popover-border: none;
|
|
123
161
|
|