@salesforcedevs/docs-components 1.29.0-doc-alpha → 1.29.0-docspec-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.29.0-doc-alpha",
3
+ "version": "1.29.0-docspec-alpha1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -91,19 +91,60 @@ export default class RedocReference extends LightningElement {
91
91
  * Project title (same value passed to `<doc-header>` as `subtitle`). Used
92
92
  * inside the Redoc-rendered UI to label the parent project.
93
93
  */
94
- @api projectTitle: string | null = "All Reference";
94
+ @api
95
+ get projectTitle(): string | null {
96
+ return this._projectTitle;
97
+ }
98
+ set projectTitle(value: string | null) {
99
+ if (this.isDocContentType) {
100
+ this._projectTitle = value;
101
+ }
102
+ }
103
+ private _projectTitle: string | null = "All Reference";
104
+
105
+ /**
106
+ * Href to navigate to when the back link is clicked AND there is no
107
+ * usable referrer (e.g. the user opened the page directly in a fresh
108
+ * tab).
109
+ */
110
+ @api headerHref: string | null = null;
111
+
112
+ @api
113
+ get contentType(): string {
114
+ return this._contentType;
115
+ }
116
+ set contentType(value: string) {
117
+ this._contentType = value;
118
+ }
119
+ private _contentType: string = "";
95
120
 
96
121
  get specTitle(): string | null {
97
122
  return this.getSelectedReference()?.title ?? null;
98
123
  }
99
124
 
125
+ get isDocContentType(): boolean {
126
+ return this.contentType === "docs";
127
+ }
128
+
129
+ get isReferenceContentType(): boolean {
130
+ return this.contentType === "references";
131
+ }
132
+
133
+ get isMultiSpecSet(): boolean {
134
+ const refCount = this.referenceConfig?.refList?.length ?? 0;
135
+ return refCount > 1;
136
+ }
137
+
100
138
  /**
101
- * Whether to show the project header (only for multi-spec reference sets).
139
+ * Whether to show the project header. Shown for multi-spec reference
140
+ * sets, and for any docs-content spec topic so it always has a back
141
+ * link.
102
142
  */
103
143
  get showRedocHeader(): boolean {
104
- const refCount = this._referenceConfig?.refList?.length ?? 0;
105
- const isMultiSpecSet = refCount > 1;
106
- return isMultiSpecSet && !!(this.projectTitle || this.specTitle);
144
+ return (
145
+ (this.isReferenceContentType && this.isMultiSpecSet) ||
146
+ this.isDocContentType
147
+ );
107
148
  }
108
149
 
109
150
  /**
@@ -116,6 +157,10 @@ export default class RedocReference extends LightningElement {
116
157
  window.location.href = referrerHref;
117
158
  return;
118
159
  }
160
+ if (this.headerHref) {
161
+ window.location.href = this.headerHref;
162
+ return;
163
+ }
119
164
  const fallbackHref = this.getReferencesRootHref();
120
165
  if (fallbackHref) {
121
166
  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
+ }