@salesforcedevs/docs-components 0.53.6 → 0.54.0-alpha01

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/lwc.config.json CHANGED
@@ -4,13 +4,17 @@
4
4
  { "npm": "@salesforcedevs/dx-components" }
5
5
  ],
6
6
  "expose": [
7
+ "doc/amfReference",
7
8
  "doc/breadcrumbs",
9
+ "doc/content",
8
10
  "doc/contentCallout",
11
+ "doc/contentLayout",
9
12
  "doc/contentMedia",
10
- "doc/content",
13
+ "doc/docXmlContent",
11
14
  "doc/header",
12
15
  "doc/heading",
13
16
  "doc/headingAnchor",
14
- "doc/phase"
17
+ "doc/phase",
18
+ "doc/xmlContent"
15
19
  ]
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "0.53.6",
3
+ "version": "0.54.0-alpha01",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -10,5 +10,19 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "gitHead": "a4d2650ea90f41debfeeed590100be7432409a73"
13
+ "dependencies": {
14
+ "@api-components/amf-helper-mixin": "^4.5.17",
15
+ "@lwrjs/types": "^0.6.5",
16
+ "classnames": "^2.2.6",
17
+ "kagekiri": "^1.4.1",
18
+ "lodash.orderby": "^4.6.0",
19
+ "lodash.uniqby": "^4.7.0",
20
+ "query-string": "^7.1.1"
21
+ },
22
+ "devDependencies": {
23
+ "@types/classnames": "^2.2.10",
24
+ "@types/lodash.orderby": "^4.6.7",
25
+ "@types/lodash.uniqby": "^4.7.7"
26
+ },
27
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
14
28
  }
@@ -0,0 +1,93 @@
1
+
2
+ import { LightningElement, track } from "lwc";
3
+
4
+ /**
5
+ * This is a helper class for when you want your LWC component to have state
6
+ * that is automatically tracked _along with_ its previous state, in a React-
7
+ * like fashion, so that you can compare current state with previous state
8
+ * after a render (like React's `commponentDidUpdate`). One benefit of doing
9
+ * things this way is that you can put all of your reactions to state changes
10
+ * in one place, in `renderedCallback`, rather than having them in various
11
+ * places throughout the component.
12
+ *
13
+ * The API consists in `this.prevState`, `this.state`, and `this.setState`.
14
+ *
15
+ * Usage:
16
+ *
17
+ * ```
18
+ * type MyState = {
19
+ * isFetchingContent: boolean;
20
+ * };
21
+ *
22
+ * class MyFetchingComponent extends LightningElementWithState<MyState> {
23
+ * constructor() {
24
+ * // `this.state` can only be initialized once
25
+ * this.state = {
26
+ * isFetchingContent: false
27
+ * };
28
+ * }
29
+ *
30
+ * // Queued for execution whenever a `setState` call completes
31
+ * renderedCallback() {
32
+ * if (this.prevState.isFetchingContent && !this.state.isFetchingContent) {
33
+ * // Do something knowing that we just finished fetching.
34
+ * notifyFetchSuccessful();
35
+ * }
36
+ * }
37
+ *
38
+ * fetchSomething() {
39
+ * this.setState({
40
+ * isFetchingContent: true
41
+ * });
42
+ *
43
+ * fetch(whatever).then(() => {
44
+ * this.setState({
45
+ * isFetching: false
46
+ * }
47
+ * });
48
+ * }
49
+ * }
50
+ * ```
51
+ */
52
+ export abstract class LightningElementWithState<
53
+ T extends { [key: string]: unknown }
54
+ > extends LightningElement {
55
+ private _prevState = {} as T;
56
+ @track private _state = {} as T;
57
+
58
+ private _didInitializeState = false;
59
+
60
+ protected get prevState(): T {
61
+ return Object.freeze({
62
+ ...this._prevState
63
+ });
64
+ }
65
+
66
+ protected get state(): T {
67
+ return Object.freeze({
68
+ ...this._state
69
+ });
70
+ }
71
+
72
+ protected set state(initialState: T) {
73
+ if (!this._didInitializeState) {
74
+ this._state = {
75
+ ...initialState
76
+ };
77
+ this._didInitializeState = true;
78
+ } else {
79
+ throw new Error("To mutate state after initialization, use `this.setState`.");
80
+ }
81
+ }
82
+
83
+ protected setState = (state: Partial<T>): void => {
84
+ this._prevState = {
85
+ ...this._state
86
+ };
87
+ this._state = {
88
+ ...this._state,
89
+ ...state
90
+ };
91
+ };
92
+ }
93
+
@@ -0,0 +1,5 @@
1
+ @import "../../helpers/phaseContentLayout/phaseContentLayout.css";
2
+
3
+ .version-picker {
4
+ margin-left: auto;
5
+ }
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <doc-content-layout
3
+ use-old-sidebar={useOldSidebar}
4
+ class="content-type content-type-reference"
5
+ coveo-organization-id={coveoOrganizationId}
6
+ coveo-public-access-token={coveoPublicAccessToken}
7
+ coveo-search-hub={coveoSearchHub}
8
+ coveo-advanced-query-config={coveoAdvancedQueryConfig}
9
+ breadcrumbs={breadcrumbs}
10
+ sidebar-header={sidebarHeader}
11
+ sidebar-value={selectedSidebarValue}
12
+ sidebar-content={navigation}
13
+ onselect={onNavSelect}
14
+ >
15
+ <div slot="doc-phase" if:true={docPhaseInfo} class="doc-phase-wrapper">
16
+ <doc-phase doc-phase-info={docPhaseInfo}></doc-phase>
17
+ </div>
18
+ <div slot="sidebar-header" class="version-picker">
19
+ <template if:true={isVersionEnabled}>
20
+ <dx-dropdown
21
+ suppress-gtm-nav-headings
22
+ onchange={handleVersionChange}
23
+ data-type="version"
24
+ options={versions}
25
+ value={selectedVersion.id}
26
+ width="290px"
27
+ >
28
+ <dx-button variant="inline">{selectedVersion.id}</dx-button>
29
+ </dx-dropdown>
30
+ </template>
31
+ </div>
32
+
33
+ <div class="container">
34
+ <div class="api-documentation">
35
+ <doc-amf-topic model={topicModel}></doc-amf-topic>
36
+ </div>
37
+ </div>
38
+ </doc-content-layout>
39
+ </template>