@salesforcedevs/docs-components 1.29.0-docspec-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-docspec-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",
@@ -6,7 +6,6 @@ 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";
10
9
 
11
10
  declare global {
12
11
  interface Window {
@@ -92,7 +91,16 @@ export default class RedocReference extends LightningElement {
92
91
  * Project title (same value passed to `<doc-header>` as `subtitle`). Used
93
92
  * inside the Redoc-rendered UI to label the parent project.
94
93
  */
95
- @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";
96
104
 
97
105
  /**
98
106
  * Href to navigate to when the back link is clicked AND there is no
@@ -102,29 +110,40 @@ export default class RedocReference extends LightningElement {
102
110
  @api headerHref: string | null = null;
103
111
 
104
112
  @api
105
- get docContentType(): boolean {
106
- return this._docContentType;
113
+ get contentType(): string {
114
+ return this._contentType;
107
115
  }
108
- set docContentType(value: boolean | string) {
109
- this._docContentType = normalizeBoolean(value);
116
+ set contentType(value: string) {
117
+ this._contentType = value;
110
118
  }
111
- private _docContentType = false;
119
+ private _contentType: string = "";
112
120
 
113
121
  get specTitle(): string | null {
114
122
  return this.getSelectedReference()?.title ?? null;
115
123
  }
116
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
+
117
138
  /**
118
139
  * Whether to show the project header. Shown for multi-spec reference
119
140
  * sets, and for any docs-content spec topic so it always has a back
120
141
  * link.
121
142
  */
122
143
  get showRedocHeader(): boolean {
123
- const refCount = this._referenceConfig?.refList?.length ?? 0;
124
- const isMultiSpecSet = refCount > 1;
125
144
  return (
126
- (isMultiSpecSet || this._docContentType) &&
127
- !!(this.projectTitle || this.specTitle)
145
+ (this.isReferenceContentType && this.isMultiSpecSet) ||
146
+ this.isDocContentType
128
147
  );
129
148
  }
130
149
 
@@ -138,7 +157,7 @@ export default class RedocReference extends LightningElement {
138
157
  window.location.href = referrerHref;
139
158
  return;
140
159
  }
141
- if (this._docContentType && this.headerHref) {
160
+ if (this.headerHref) {
142
161
  window.location.href = this.headerHref;
143
162
  return;
144
163
  }