@salesforcedevs/docs-components 1.29.0-newct-alpha → 1.29.0-newct-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-newct-alpha",
3
+ "version": "1.29.0-newct-alpha1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -1,9 +1,3 @@
1
- /*
2
- * Keep the host transparent to layout: no positioning context, no new
3
- * stacking/containment block, no margin/padding. This is critical so the
4
- * inner <doc-content-layout>'s sticky math for the sidebar / right-nav / doc-
5
- * phase wrapper continues to use the document viewport as its reference.
6
- */
7
1
  :host {
8
2
  display: block;
9
3
  }
@@ -1,31 +1,34 @@
1
1
  <template>
2
2
  <doc-content-layout
3
+ class="content-type content-type-markdown content-type-docs"
3
4
  breadcrumbs={breadcrumbs}
4
- sidebar-content={sidebarContent}
5
- sidebar-value={sidebarValue}
5
+ share-title={shareTitle}
6
+ share-twitter-via={twitterVia}
6
7
  sidebar-header={sidebarHeader}
8
+ sidebar-value={sidebarValue}
9
+ sidebar-content={sidebarContent}
7
10
  toc-title={tocTitle}
8
11
  toc-options={tocOptions}
9
12
  toc-aria-level={tocAriaLevel}
10
- enable-slot-change={enableSlotChange}
11
- use-old-sidebar={useOldSidebar}
13
+ enable-slot-change="true"
12
14
  languages={languages}
13
15
  language={language}
14
- bail-href={bailHref}
15
- bail-label={bailLabel}
16
- dev-center={devCenter}
17
- brand={brand}
18
- empty-state-message={emptyStateMessage}
19
- show-footer={showFooter}
20
- reading-time={readingTime}
21
- share-title={shareTitle}
22
- share-url={shareUrl}
23
- share-twitter-via={shareTwitterVia}
16
+ show-footer={enableFooter}
24
17
  origin={origin}
25
18
  >
26
- <slot></slot>
27
- <slot name="doc-phase" slot="doc-phase"></slot>
28
- <slot name="version-banner" slot="version-banner"></slot>
29
- <slot name="sidebar-header" slot="sidebar-header"></slot>
19
+ <doc-phase
20
+ slot="doc-phase"
21
+ lwc:if={docPhaseInfo}
22
+ doc-phase-info={docPhaseInfo}
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
+ -->
30
33
  </doc-content-layout>
31
34
  </template>
@@ -1,98 +1,85 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import { normalizeBoolean } from "dxUtils/normalizers";
2
3
  import type { OptionWithLink } from "typings/custom";
3
- import "doc/contentLayout";
4
- import "doc/phase";
5
4
 
6
5
  /**
7
- * Orchestrator LWC for the unified `docs` content-type.
8
- *
9
- * Today (Phase 2): thin pass-through over `<doc-content-layout>` for markdown
10
- * topics. The data contract matches what `DocsContentTypeParser.compile()`
11
- * already emits (`dxSideBarContents`, `routeurl`, `breadcrumbs`,
12
- * `docPhaseInfo`, etc.), so the parser does not need to fabricate a
13
- * `reference-set-config` shape the way `<doc-amf-reference>` requires.
14
- *
15
- * Navigation: LNB clicks go through the browser's default `<a href>`
16
- * navigation (the same behavior as references and every other SFDocs
17
- * content-type). SFDocs is a server-rendered (Nunjucks) framework; LWR's
18
- * Outlet only swaps LWC view components, not server-rendered HTML, so there
19
- * is no soft-nav mechanism here today. A previous experiment to fake soft
20
- * nav with `history.pushState` + a synthetic `popstate` was removed because
21
- * it updated the URL bar but did NOT re-fetch the new topic's content (the
22
- * content body stayed as the originally-loaded topic until a manual
23
- * refresh). Real client-side soft nav for server-rendered routes would
24
- * require a Turbo-style fetch + DOM surgery; if that becomes a requirement
25
- * it should live in @salesforcedocs/doc-framework so every content-type
26
- * benefits, not be patched into this wrapper.
27
- *
28
- * The two side-effect imports above (`doc/contentLayout`, `doc/phase`) exist
29
- * so LWR's static-analysis-based modulepreload emitter discovers them on
30
- * the route. Without them the docs route's first paint shows a visible
31
- * flash on local dev because the inner LWC + phase badge load only after
32
- * this wrapper's bundle parses.
6
+ * Topic types emitted by the docs content-type parser
7
+ * (see @salesforcedevs/sfdocs-doc-framework: `TopicTypeEnum`).
8
+ */
9
+ const TOPIC_TYPE_MARKDOWN = "markdown";
10
+ const TOPIC_TYPE_SPEC = "spec";
11
+
12
+ /**
13
+ * Wrapper around `doc-content-layout` for the "docs" content type emitted by
14
+ * the `DocsContentTypeParser`.
33
15
  *
34
- * Future:
35
- * - Phase 3: version-picker wiring in the `sidebar-header` named slot
36
- * (parser emits `versions` / `selectedVersion`; wrapper renders
37
- * `<doc-version-picker>` here).
38
- * - Phase 4: markdown-vs-spec branching in the default slot (use the
39
- * existing `<doc-amf-topic>` + `AmfModelParser` primitives, mirroring
40
- * `<doc-amf-reference>`'s template pattern but without inheriting its
41
- * `/references/` URL conventions or per-reference sidebar tiles).
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`.
42
20
  *
43
- * Every property is a plain pass-through. `contentLayout`'s own setters run
44
- * `toJson` / `normalizeBoolean` on the values, so re-normalizing here would
45
- * only risk diverging from upstream as the inner component evolves.
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.
46
23
  */
47
24
  export default class UnifiedContentLayout extends LightningElement {
48
- /* ---------- Sidebar / breadcrumb / TOC inputs ---------- */
49
25
  @api breadcrumbs: string | null = null;
50
- @api sidebarContent: string | object | null = null;
51
- @api sidebarValue: string | null = null;
52
- @api sidebarHeader: string | null = null;
53
-
26
+ @api sidebarHeader?: string;
27
+ @api sidebarValue?: string;
28
+ @api sidebarContent?: string;
54
29
  @api tocTitle?: string;
55
30
  @api tocOptions?: string;
56
31
  @api tocAriaLevel?: string;
32
+ @api languages?: OptionWithLink[];
33
+ @api language?: string;
57
34
 
58
- /* ---------- contentLayout feature toggles ---------- */
59
- @api enableSlotChange: string | boolean = false;
60
- @api useOldSidebar: string | boolean = false;
61
- @api showFooter: string | boolean = false;
62
-
63
- /* ---------- Localization ---------- */
64
- @api languages: OptionWithLink[] | null = null;
65
- @api language: string | null = null;
66
-
67
- /* ---------- Empty-state / chrome ---------- */
68
- @api bailHref: string | null = null;
69
- @api bailLabel: string | null = null;
70
- @api emptyStateMessage: string | null = null;
71
- @api readingTime: string | null = null;
72
-
73
- @api devCenter: string | null = null;
74
- @api brand: string | null = null;
35
+ /** Optional origin URL for the footer MFE (e.g. wp-json endpoint). */
36
+ @api origin: string | null = null;
75
37
 
76
- /* ---------- Social share ---------- */
38
+ /** Article name from breadcrumbs, used as share title (e.g. for social share). */
77
39
  @api shareTitle: string | null = null;
78
- @api shareUrl: string | null = null;
79
- @api shareTwitterVia: string | null = null;
80
40
 
81
- /* ---------- Footer integration ---------- */
82
- @api origin: string | null = null;
41
+ /** Optional Twitter "via" handle (e.g. SalesforceDevs) for social share. */
42
+ @api twitterVia: string | null = null;
43
+
44
+ @api hideFooter = false;
83
45
 
84
46
  /**
85
- * Forwarded imperative method so any caller that holds a reference to the
86
- * wrapper (and previously called `contentLayout.setSidebarInputValue`)
87
- * keeps working without changes.
47
+ * Topic type forwarded from the layout template. The docs parser supports
48
+ * `markdown` today and `spec` (OAS via Redoc) in a follow-up.
88
49
  */
50
+ @api topicType: string = TOPIC_TYPE_MARKDOWN;
51
+
52
+ private _docPhaseInfo: string | null = null;
53
+
89
54
  @api
90
- setSidebarInputValue(searchTerm: string): void {
91
- const inner = this.template.querySelector("doc-content-layout") as
92
- | (HTMLElement & {
93
- setSidebarInputValue?: (term: string) => void;
94
- })
95
- | null;
96
- inner?.setSidebarInputValue?.(searchTerm);
55
+ get docPhaseInfo(): string | null {
56
+ return this._docPhaseInfo;
57
+ }
58
+
59
+ set docPhaseInfo(value: string | null) {
60
+ this._docPhaseInfo = value || null;
61
+ }
62
+
63
+ private _expandChildren = false;
64
+
65
+ @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;
76
+ }
77
+
78
+ get isSpecTopic(): boolean {
79
+ return this.topicType === TOPIC_TYPE_SPEC;
80
+ }
81
+
82
+ private get enableFooter(): boolean {
83
+ return !this.hideFooter;
97
84
  }
98
85
  }