Socket
Socket
Sign inDemoInstall

@salesforcedevs/docs-components

Package Overview
Dependencies
Maintainers
38
Versions
637
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salesforcedevs/docs-components - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

2

package.json
{
"name": "@salesforcedevs/docs-components",
"version": "0.0.5",
"version": "0.0.6",
"description": "Docs Lightning web components for DSC",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -15,3 +15,3 @@ import { LightningElement, api } from "lwc";

PdfUrl
} from "typings/custom";
} from "../../../../../../../typings/custom";

@@ -183,3 +183,3 @@ const API_MAIN_URL = "https://developer.salesforce.com/docs/get_document/";

this.pageReference.domain = `${window.location.protocol}//${window.location.host}`;
//this.updateSelectedItem();
this.updateSelectedItem();
}

@@ -259,3 +259,3 @@

}
//this.updateSelectedItem();
this.updateSelectedItem();
}

@@ -272,4 +272,2 @@ if (

/*
TODO: use set selected item for new navigation components
updateSelectedItem() {

@@ -284,6 +282,5 @@ if (this.pageReference.contentDocumentId) {

}
this.selectedItem = item;
this.selectedNavigationItem = item;
}
}
*/

@@ -349,3 +346,2 @@ handleToolbarEvent(event: CustomEvent) {

}
console.log("Incorrect Doc Type");
return "";

@@ -359,3 +355,3 @@ }

normalizeToc(toc) {
normalizeToc(toc: DocToc) {
let normalizedToc = JSON.stringify(toc).replace(/"text"/g, '"label"');

@@ -365,4 +361,4 @@ normalizedToc = normalizedToc.replace(/"id"/g, '"name"');

jsonToc.isExpanded = true;
return jsonToc;
return [jsonToc];
}
}
/* eslint-disable @lwc/lwc/no-inner-html */
import { LightningElement, api, track } from "lwc";
import {
DocContent,
PageReference
} from "../../../../../../../typings/custom-new";
import { DocContent, PageReference } from "../../../../../../../typings/custom";

@@ -39,10 +36,2 @@ export default class Content extends LightningElement {

constructor() {
super();
this.template.addEventListener(
"themechange",
this.updateTheme.bind(this) // eslint-disableline no-use-before-define
);
}
updateTheme() {

@@ -96,5 +85,37 @@ this._codeBlockTheme =

// Query the callouts and create a doc-content-callout component that contains the code
const calloutEls = templateEl.content.querySelectorAll(".message");
calloutEls.forEach((calloutEl) => {
const calloutCompEl = document.createElement("doc-content-callout");
const detailEls = calloutEl.querySelectorAll("p");
detailEls.forEach((detailEl) => {
calloutCompEl.appendChild(detailEl);
});
const type = calloutEl.querySelector("h4").textContent;
const typeLower = type.toLowerCase();
calloutCompEl.setAttribute("title", type);
calloutCompEl.setAttribute("variant", typeLower);
calloutEl.innerHTML = "";
calloutEl.appendChild(calloutCompEl);
});
// Modify links to work with any domain
const anchorEls = templateEl.content.querySelectorAll("a");
anchorEls.forEach((anchorEl) => {
if (anchorEl.textContent.includes("Next →")) {
anchorEl.textContent = "";
const buttonEl = document.createElement("dx-button");
buttonEl.setAttribute("icon-symbol", "chevronright");
buttonEl.textContent = "Next";
anchorEl.appendChild(buttonEl);
}
if (anchorEl.textContent.includes("← Previous")) {
anchorEl.textContent = "";
const buttonEl = document.createElement("dx-button");
buttonEl.setAttribute("icon-symbol", "chevronleft");
buttonEl.setAttribute("icon-position", "left");
buttonEl.setAttribute("variant", "secondary");
buttonEl.textContent = "Previous";
anchorEl.appendChild(buttonEl);
}
const href = anchorEl.href.split("/");

@@ -151,4 +172,5 @@ if (

const src = imgEl.src;
const origin = window.location.origin;
const updatedURL = src.replace(
this.pageReference.domain,
origin,
"https://developer.salesforce.com"

@@ -155,0 +177,0 @@ );

@@ -26,16 +26,10 @@ import { createElement } from "lwc";

describe("doc-nav", () => {
it("renders the navigation", () => {
const component = render(MOCK_PARAMETERS);
document.body.appendChild(component);
const toolbarEl = component.shadowRoot.querySelector("doc-toolbar");
expect(toolbarEl).not.toBeNull();
});
it("renders the content", () => {
const component = render(MOCK_PARAMETERS);
const tocEl = component.shadowRoot.querySelector("dx-tree");
const tocEl = component.shadowRoot.querySelector("dx-sidebar");
expect(tocEl).not.toBeNull();
});
/*
it("fires the event", () => {

@@ -45,3 +39,3 @@ const component = render(MOCK_PARAMETERS);

const tocEl: HTMLElement = component.shadowRoot.querySelector(
"dx-tree"
"dx-sidebar"
);

@@ -68,2 +62,4 @@ const mockNavClick = jest.fn();

});
*/
});

@@ -11,3 +11,3 @@ import { LightningElement, api } from "lwc";

SelectedVersion
} from "typings/custom";
} from "../../../../../../../typings/custom";

@@ -14,0 +14,0 @@ export default class Nav extends LightningElement {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc