@salesforcedevs/docs-components 1.29.0-doc-alpha → 1.29.0-docspec-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.29.0-doc-alpha",
3
+ "version": "1.29.0-docspec-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -6,6 +6,7 @@ import DxIcon from "dx/icon";
6
6
  import SprigSurvey from "doc/sprigSurvey";
7
7
  import { throttle } from "throttle-debounce";
8
8
  import { pollUntil } from "dxUtils/async";
9
+ import { normalizeBoolean } from "dxUtils/normalizers";
9
10
 
10
11
  declare global {
11
12
  interface Window {
@@ -93,17 +94,38 @@ export default class RedocReference extends LightningElement {
93
94
  */
94
95
  @api projectTitle: string | null = "All Reference";
95
96
 
97
+ /**
98
+ * Href to navigate to when the back link is clicked AND there is no
99
+ * usable referrer (e.g. the user opened the page directly in a fresh
100
+ * tab).
101
+ */
102
+ @api headerHref: string | null = null;
103
+
104
+ @api
105
+ get docContentType(): boolean {
106
+ return this._docContentType;
107
+ }
108
+ set docContentType(value: boolean | string) {
109
+ this._docContentType = normalizeBoolean(value);
110
+ }
111
+ private _docContentType = false;
112
+
96
113
  get specTitle(): string | null {
97
114
  return this.getSelectedReference()?.title ?? null;
98
115
  }
99
116
 
100
117
  /**
101
- * Whether to show the project header (only for multi-spec reference sets).
118
+ * Whether to show the project header. Shown for multi-spec reference
119
+ * sets, and for any docs-content spec topic so it always has a back
120
+ * link.
102
121
  */
103
122
  get showRedocHeader(): boolean {
104
123
  const refCount = this._referenceConfig?.refList?.length ?? 0;
105
124
  const isMultiSpecSet = refCount > 1;
106
- return isMultiSpecSet && !!(this.projectTitle || this.specTitle);
125
+ return (
126
+ (isMultiSpecSet || this._docContentType) &&
127
+ !!(this.projectTitle || this.specTitle)
128
+ );
107
129
  }
108
130
 
109
131
  /**
@@ -116,6 +138,10 @@ export default class RedocReference extends LightningElement {
116
138
  window.location.href = referrerHref;
117
139
  return;
118
140
  }
141
+ if (this._docContentType && this.headerHref) {
142
+ window.location.href = this.headerHref;
143
+ return;
144
+ }
119
145
  const fallbackHref = this.getReferencesRootHref();
120
146
  if (fallbackHref) {
121
147
  window.location.href = fallbackHref;
@@ -1,3 +1,19 @@
1
1
  :host {
2
2
  display: block;
3
3
  }
4
+
5
+ .content-type-docs doc-phase {
6
+ --doc-c-phase-top: calc(
7
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
8
+ var(--dx-g-spacing-xl)
9
+ );
10
+ }
11
+
12
+ @media screen and (max-width: 768px) {
13
+ .content-type-docs doc-phase {
14
+ --doc-c-phase-top: calc(
15
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
16
+ 40px
17
+ );
18
+ }
19
+ }