@salesforcedevs/docs-components 1.29.0-newct-alpha1 → 1.29.0-spec-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-newct-alpha1",
3
+ "version": "1.29.0-spec-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -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
+ }
@@ -21,14 +21,6 @@
21
21
  lwc:if={docPhaseInfo}
22
22
  doc-phase-info={docPhaseInfo}
23
23
  ></doc-phase>
24
-
25
- <template lwc:if={isMarkdownTopic}>
26
- <slot></slot>
27
- </template>
28
- <!--
29
- TODO(W-22340752): render OAS specs via doc-redoc-reference when
30
- topicType === "spec". The docs content-type parser currently 404s
31
- spec topics until that path lands.
32
- -->
24
+ <slot></slot>
33
25
  </doc-content-layout>
34
26
  </template>
@@ -1,31 +1,44 @@
1
1
  import { LightningElement, api } from "lwc";
2
- import { normalizeBoolean } from "dxUtils/normalizers";
3
- import type { OptionWithLink } from "typings/custom";
2
+ import { toJson } from "dxUtils/normalizers";
3
+ import type { OptionWithLink, TreeNode } from "typings/custom";
4
4
 
5
5
  /**
6
- * Topic types emitted by the docs content-type parser
7
- * (see @salesforcedevs/sfdocs-doc-framework: `TopicTypeEnum`).
6
+ * Per-topic type emitted by the docs content-type parser
7
+ * (see @salesforcedevs/sfdocs-doc-framework: `TopicTypeEnum`). Only `spec`
8
+ * is meaningful inside this component; everything else renders as a plain
9
+ * markdown-style tile.
8
10
  */
9
- const TOPIC_TYPE_MARKDOWN = "markdown";
10
11
  const TOPIC_TYPE_SPEC = "spec";
11
12
 
13
+ /**
14
+ * Translates per-topic `topicType` into the generic `showForwardArrow` flag
15
+ * that `dx-tree-tile` reads (spec topics get the forward arrow icon for Redoc).
16
+ */
17
+ function decorateTopicsWithForwardArrow(
18
+ topics: Array<TreeNode & { topicType?: string }> | undefined
19
+ ): TreeNode[] | undefined {
20
+ return topics?.map((topic) => {
21
+ const { topicType, ...decorated } = topic;
22
+ if (topicType === TOPIC_TYPE_SPEC) {
23
+ decorated.showForwardArrow = true;
24
+ }
25
+ if (decorated.children) {
26
+ decorated.children = decorateTopicsWithForwardArrow(
27
+ decorated.children
28
+ );
29
+ }
30
+ return decorated;
31
+ });
32
+ }
33
+
12
34
  /**
13
35
  * Wrapper around `doc-content-layout` for the "docs" content type emitted by
14
36
  * the `DocsContentTypeParser`.
15
- *
16
- * Mirrors the role that `doc-amf-reference` plays for the "reference" content
17
- * type: it owns content-type-aware concerns (markdown body vs. OAS spec via
18
- * Redoc) and forwards the chrome (sidebar, breadcrumbs, TOC, footer) to
19
- * `doc-content-layout`.
20
- *
21
- * Only the markdown topic type is wired up today. OAS spec rendering via Redoc
22
- * is tracked separately (W-22340752) and currently 404s upstream in the parser.
23
37
  */
24
38
  export default class UnifiedContentLayout extends LightningElement {
25
39
  @api breadcrumbs: string | null = null;
26
40
  @api sidebarHeader?: string;
27
41
  @api sidebarValue?: string;
28
- @api sidebarContent?: string;
29
42
  @api tocTitle?: string;
30
43
  @api tocOptions?: string;
31
44
  @api tocAriaLevel?: string;
@@ -43,13 +56,8 @@ export default class UnifiedContentLayout extends LightningElement {
43
56
 
44
57
  @api hideFooter = false;
45
58
 
46
- /**
47
- * Topic type forwarded from the layout template. The docs parser supports
48
- * `markdown` today and `spec` (OAS via Redoc) in a follow-up.
49
- */
50
- @api topicType: string = TOPIC_TYPE_MARKDOWN;
51
-
52
59
  private _docPhaseInfo: string | null = null;
60
+ private _sidebarContent: unknown = null;
53
61
 
54
62
  @api
55
63
  get docPhaseInfo(): string | null {
@@ -60,23 +68,15 @@ export default class UnifiedContentLayout extends LightningElement {
60
68
  this._docPhaseInfo = value || null;
61
69
  }
62
70
 
63
- private _expandChildren = false;
64
-
65
71
  @api
66
- get expandChildren(): boolean {
67
- return this._expandChildren;
68
- }
69
-
70
- set expandChildren(value: boolean | string) {
71
- this._expandChildren = normalizeBoolean(value);
72
- }
73
-
74
- get isMarkdownTopic(): boolean {
75
- return this.topicType === TOPIC_TYPE_MARKDOWN;
72
+ get sidebarContent(): unknown {
73
+ return this._sidebarContent;
76
74
  }
77
75
 
78
- get isSpecTopic(): boolean {
79
- return this.topicType === TOPIC_TYPE_SPEC;
76
+ set sidebarContent(value: string) {
77
+ this._sidebarContent = decorateTopicsWithForwardArrow(
78
+ toJson(value)?.topics
79
+ );
80
80
  }
81
81
 
82
82
  private get enableFooter(): boolean {