@salesforcedevs/docs-components 1.29.0-newct-alpha → 1.29.0-newct-alpha2
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,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
|
-
|
|
5
|
-
|
|
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=
|
|
11
|
-
use-old-sidebar={useOldSidebar}
|
|
13
|
+
enable-slot-change="true"
|
|
12
14
|
languages={languages}
|
|
13
15
|
language={language}
|
|
14
|
-
|
|
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
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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,94 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { toJson, 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
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
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
|
-
*
|
|
44
|
-
*
|
|
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
|
|
51
|
-
@api sidebarValue
|
|
52
|
-
@api sidebarHeader: string | null = null;
|
|
53
|
-
|
|
26
|
+
@api sidebarHeader?: string;
|
|
27
|
+
@api sidebarValue?: string;
|
|
54
28
|
@api tocTitle?: string;
|
|
55
29
|
@api tocOptions?: string;
|
|
56
30
|
@api tocAriaLevel?: string;
|
|
31
|
+
@api languages?: OptionWithLink[];
|
|
32
|
+
@api language?: string;
|
|
57
33
|
|
|
58
|
-
|
|
59
|
-
@api
|
|
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;
|
|
34
|
+
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). */
|
|
35
|
+
@api origin: string | null = null;
|
|
75
36
|
|
|
76
|
-
|
|
37
|
+
/** Article name from breadcrumbs, used as share title (e.g. for social share). */
|
|
77
38
|
@api shareTitle: string | null = null;
|
|
78
|
-
@api shareUrl: string | null = null;
|
|
79
|
-
@api shareTwitterVia: string | null = null;
|
|
80
39
|
|
|
81
|
-
|
|
82
|
-
@api
|
|
40
|
+
/** Optional Twitter "via" handle (e.g. SalesforceDevs) for social share. */
|
|
41
|
+
@api twitterVia: string | null = null;
|
|
42
|
+
|
|
43
|
+
@api hideFooter = false;
|
|
83
44
|
|
|
84
45
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* keeps working without changes.
|
|
46
|
+
* Topic type forwarded from the layout template. The docs parser supports
|
|
47
|
+
* `markdown` today and `spec` (OAS via Redoc) in a follow-up.
|
|
88
48
|
*/
|
|
49
|
+
@api topicType: string = TOPIC_TYPE_MARKDOWN;
|
|
50
|
+
|
|
51
|
+
private _docPhaseInfo: string | null = null;
|
|
52
|
+
private _sidebarContent: unknown = null;
|
|
53
|
+
|
|
54
|
+
@api
|
|
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
|
+
@api
|
|
64
|
+
get sidebarContent(): unknown {
|
|
65
|
+
return this._sidebarContent;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
set sidebarContent(value: string | { topics?: unknown } | null) {
|
|
69
|
+
this._sidebarContent = value ? toJson(value)?.topics ?? null : null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private _expandChildren = false;
|
|
73
|
+
|
|
89
74
|
@api
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
75
|
+
get expandChildren(): boolean {
|
|
76
|
+
return this._expandChildren;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set expandChildren(value: boolean | string) {
|
|
80
|
+
this._expandChildren = normalizeBoolean(value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get isMarkdownTopic(): boolean {
|
|
84
|
+
return this.topicType === TOPIC_TYPE_MARKDOWN;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get isSpecTopic(): boolean {
|
|
88
|
+
return this.topicType === TOPIC_TYPE_SPEC;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private get enableFooter(): boolean {
|
|
92
|
+
return !this.hideFooter;
|
|
97
93
|
}
|
|
98
94
|
}
|