@salesforcedevs/dx-components 0.25.3 → 0.26.1-alpha.10
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 +1 -0
- package/package.json +5 -4
- package/src/modules/dx/.DS_Store +0 -0
- package/src/modules/dx/header/header.html +2 -1
- package/src/modules/dx/skipNavLink/skipNavLink.css +21 -0
- package/src/modules/dx/skipNavLink/skipNavLink.html +3 -0
- package/src/modules/dx/skipNavLink/skipNavLink.ts +3 -0
- package/src/modules/dx/slackCta/slackCta.css +1 -10
- package/src/modules/helpers/commonHeader/commonHeader.css +1 -1
- package/src/modules/helpers/table/table.css +1 -1
- package/LICENSE +0 -12
- package/src/assets/icons/action-sprite/svg/symbols.svg +0 -1
- package/src/assets/icons/brand-sprite/svg/symbols.svg +0 -1381
- package/src/assets/icons/custom-sprite/svg/symbols.svg +0 -1
- package/src/assets/icons/doctype-sprite/svg/symbols.svg +0 -1
- package/src/assets/icons/general-sprite/svg/symbols.svg +0 -3013
- package/src/assets/icons/salesforcebrand-sprite/svg/symbols.svg +0 -257
- package/src/assets/icons/standard-sprite/svg/symbols.svg +0 -1
- package/src/assets/icons/utility-sprite/svg/symbols.svg +0 -1
- package/src/assets/svg/card-news-learn-moar.svg +0 -415
- package/src/assets/svg/cloud-1.svg +0 -24
- package/src/assets/svg/cloud-2.svg +0 -18
- package/src/assets/svg/codey.svg +0 -93
- package/src/assets/svg/command.svg +0 -9
- package/src/assets/svg/control.svg +0 -10
- package/src/assets/svg/docs-empty-state-small.svg +0 -72
- package/src/assets/svg/docs-empty-state.svg +0 -86
- package/src/assets/svg/dsc-home-news-bear.svg +0 -3
- package/src/assets/svg/dsc-home-news-community.png +0 -0
- package/src/assets/svg/dsc-home-news-goatbear.svg +0 -257
- package/src/assets/svg/dsc-home-news-samplegallery.svg +0 -76
- package/src/assets/svg/empty-state-assistant.svg +0 -1
- package/src/assets/svg/fch-blog-cloud-1.png +0 -0
- package/src/assets/svg/fch-blog-cloud-2.png +0 -0
- package/src/assets/svg/fch-blog-planet.png +0 -0
- package/src/assets/svg/feature-backdrop1.svg +0 -10
- package/src/assets/svg/feature-backdrop2.svg +0 -10
- package/src/assets/svg/featured-demo-art-blank.svg +0 -76
- package/src/assets/svg/featured-demo-art-eBikes.svg +0 -77
- package/src/assets/svg/footer-graphic-large.svg +0 -207
- package/src/assets/svg/footer-graphic-mountains-small.svg +0 -17
- package/src/assets/svg/footer-graphic-mountains.svg +0 -21
- package/src/assets/svg/footer-graphic-trees-small.svg +0 -33
- package/src/assets/svg/footer-graphic-trees.svg +0 -62
- package/src/assets/svg/lake-mountain.svg +0 -79
- package/src/assets/svg/podcast-subscription-clouds-small.svg +0 -49
- package/src/assets/svg/podcast-subscription-clouds.svg +0 -57
- package/src/assets/svg/podcasts-subscription-apple.svg +0 -164
- package/src/assets/svg/podcasts-subscription-google.svg +0 -29
- package/src/assets/svg/podcasts-subscription-spotify.svg +0 -11
- package/src/assets/svg/salesforce-cloud.svg +0 -7
- package/src/assets/svg/salesforce-logo-corporate.svg +0 -21
- package/src/assets/svg/salesforce-logo.svg +0 -14
- package/src/assets/svg/sidebar-loading.svg +0 -34
- package/src/assets/svg/slack-cta-podcast-background-left.svg +0 -28
- package/src/assets/svg/slack-cta-podcast-background-right.svg +0 -38
- package/src/assets/svg/trees.svg +0 -42
- package/src/modules/test-components/buttonTest/buttonTest.html +0 -3
- package/src/modules/test-components/buttonTest/buttonTest.ts +0 -3
- package/src/modules/test-components/codeBlockTest/codeBlockTest.js +0 -4
- package/src/modules/test-components/featureGridTest/featureGridTest.html +0 -7
- package/src/modules/test-components/featureGridTest/featureGridTest.ts +0 -5
- package/src/modules/test-components/instrumentationTest/instrumentationTest.html +0 -4
- package/src/modules/test-components/instrumentationTest/instrumentationTest.ts +0 -8
- package/src/modules/test-components/popoverTest/popoverTest.html +0 -6
- package/src/modules/test-components/popoverTest/popoverTest.ts +0 -5
- package/src/modules/utils-internal/archiveCard/archiveCard.ts +0 -35
- package/src/modules/utils-internal/coveo/coveo.ts +0 -70
- package/src/modules/utils-internal/css/css.ts +0 -43
- package/src/modules/utils-internal/devices/devices.ts +0 -1
- package/src/modules/utils-internal/headerBase/headerBase.ts +0 -204
- package/src/modules/utils-internal/jest/jest.ts +0 -58
- package/src/modules/utils-internal/options/options.ts +0 -39
- package/src/modules/utils-internal/prismjs/prismjs.html +0 -3
- package/src/modules/utils-internal/prismjs/prismjs.ts +0 -3321
- package/src/modules/utils-internal/recentSearches/__tests__/recentSearches.test.ts +0 -83
- package/src/modules/utils-internal/recentSearches/recentSearches.ts +0 -57
- package/src/modules/utils-internal/regexps/regexps.ts +0 -5
- package/src/modules/utils-internal/seo/seo.ts +0 -4
- package/src/modules/utils-internal/slot/slot.ts +0 -17
- package/src/modules/utils-internal/storybook/storybook.ts +0 -32
- package/src/modules/utils-internal/tests/tests.ts +0 -38
- package/src/modules/utils-internal/wordpress/__tests__/wordpress.test.ts +0 -15
- package/src/modules/utils-internal/wordpress/wordpress.ts +0 -13
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RecentSearches,
|
|
3
|
-
LOCAL_STORAGE_KEY,
|
|
4
|
-
LIMIT
|
|
5
|
-
} from "utils-internal/recentSearches";
|
|
6
|
-
|
|
7
|
-
describe("recentSearches", () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
window.localStorage.clear();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("initializes correctly from local storage", () => {
|
|
13
|
-
const initial = ["test", "test1", "test2"];
|
|
14
|
-
|
|
15
|
-
window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(initial));
|
|
16
|
-
const searches = new RecentSearches();
|
|
17
|
-
|
|
18
|
-
expect(searches.get()).toEqual(initial);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("ignores exact duplicate additions", () => {
|
|
22
|
-
const searches = new RecentSearches();
|
|
23
|
-
|
|
24
|
-
const item = "test";
|
|
25
|
-
|
|
26
|
-
searches.add(item);
|
|
27
|
-
searches.add(item);
|
|
28
|
-
|
|
29
|
-
expect(searches.get().length).toEqual(1);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("ignores duplicate additions with extraneous white space", () => {
|
|
33
|
-
const searches = new RecentSearches();
|
|
34
|
-
|
|
35
|
-
const item1 = "test";
|
|
36
|
-
const item2 = " test ";
|
|
37
|
-
|
|
38
|
-
searches.add(item1);
|
|
39
|
-
searches.add(item2);
|
|
40
|
-
|
|
41
|
-
expect(searches.get().length).toEqual(1);
|
|
42
|
-
expect(searches.get()[0]).toEqual(item1);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("prioritizes the last searched item", () => {
|
|
46
|
-
const searches = new RecentSearches();
|
|
47
|
-
|
|
48
|
-
const item1 = "test1";
|
|
49
|
-
const item2 = "test2";
|
|
50
|
-
|
|
51
|
-
searches.add(item1);
|
|
52
|
-
searches.add(item2);
|
|
53
|
-
|
|
54
|
-
expect(searches.get().length).toEqual(2);
|
|
55
|
-
|
|
56
|
-
expect(searches.get()[0]).toEqual(item2);
|
|
57
|
-
expect(searches.get()[1]).toEqual(item1);
|
|
58
|
-
|
|
59
|
-
searches.add(item1);
|
|
60
|
-
|
|
61
|
-
expect(searches.get().length).toEqual(2);
|
|
62
|
-
expect(searches.get()[0]).toEqual(item1);
|
|
63
|
-
expect(searches.get()[1]).toEqual(item2);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("will not exceed the limit", () => {
|
|
67
|
-
const searches = new RecentSearches();
|
|
68
|
-
|
|
69
|
-
Array.apply(null, Array(LIMIT + 1)).forEach((_, i) => {
|
|
70
|
-
searches.add(i.toString());
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
expect(searches.get().length).toEqual(LIMIT);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("doesn't add a bogus value", () => {
|
|
77
|
-
const searches = new RecentSearches();
|
|
78
|
-
|
|
79
|
-
[null, "", " ", " ", 5].forEach((v) => searches.add(v));
|
|
80
|
-
|
|
81
|
-
expect(searches.get().length).toEqual(0);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export const LOCAL_STORAGE_KEY = "dx-sidebar-recent-searches";
|
|
2
|
-
|
|
3
|
-
export const LIMIT = 5;
|
|
4
|
-
|
|
5
|
-
export class RecentSearches {
|
|
6
|
-
items: string[] = [];
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
this._init();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get() {
|
|
13
|
-
return this.items;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
add(item: string | undefined) {
|
|
17
|
-
if (!item || typeof item !== "string") {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const normalized = item.trim();
|
|
21
|
-
if (normalized === "") {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
this._prepend(normalized);
|
|
25
|
-
this._removeDuplicates(normalized);
|
|
26
|
-
this._cutOffExcess();
|
|
27
|
-
this._addToStorage();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// private
|
|
31
|
-
_init() {
|
|
32
|
-
this.items = JSON.parse(
|
|
33
|
-
window.localStorage.getItem(LOCAL_STORAGE_KEY) || "[]"
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
_prepend(item: string) {
|
|
38
|
-
this.items.unshift(item);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
_removeDuplicates(item: string) {
|
|
42
|
-
while (this.items.lastIndexOf(item) > 0) {
|
|
43
|
-
this.items.splice(this.items.lastIndexOf(item), 1);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_cutOffExcess() {
|
|
48
|
-
this.items = this.items.slice(0, LIMIT);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_addToStorage() {
|
|
52
|
-
window.localStorage.setItem(
|
|
53
|
-
LOCAL_STORAGE_KEY,
|
|
54
|
-
JSON.stringify(this.items)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { LightningSlotElement } from "typings/custom";
|
|
2
|
-
|
|
3
|
-
export const isSlotEmpty = (e: LightningSlotElement) =>
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
e.target.assignedElements().length === 0;
|
|
6
|
-
|
|
7
|
-
const stopPropagation = (event: Event) => {
|
|
8
|
-
event.stopPropagation();
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const stopPropagationOnSlotted = (e: LightningSlotElement) => {
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
const slot = e.target;
|
|
14
|
-
slot.assignedElements().forEach((el: HTMLElement) => {
|
|
15
|
-
el.addEventListener("click", stopPropagation);
|
|
16
|
-
});
|
|
17
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { html } from "lit-html";
|
|
2
|
-
|
|
3
|
-
export const createRenderComponents =
|
|
4
|
-
(component: string) =>
|
|
5
|
-
(num: number = 12, props: string = "") => {
|
|
6
|
-
let shell = ``;
|
|
7
|
-
for (let i = 0; i < num; i++) {
|
|
8
|
-
const insertIndex = component.indexOf(">");
|
|
9
|
-
const _component = [
|
|
10
|
-
component.slice(0, insertIndex),
|
|
11
|
-
` ${props}`,
|
|
12
|
-
component.slice(insertIndex)
|
|
13
|
-
].join("");
|
|
14
|
-
shell = `
|
|
15
|
-
${shell}
|
|
16
|
-
${_component}
|
|
17
|
-
`;
|
|
18
|
-
}
|
|
19
|
-
return shell;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const renderStyle = (componentTag: string) => html`
|
|
23
|
-
<style>
|
|
24
|
-
span {
|
|
25
|
-
color: grey;
|
|
26
|
-
}
|
|
27
|
-
${componentTag} {
|
|
28
|
-
margin-top: 16px;
|
|
29
|
-
margin-bottom: 36px;
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
32
|
-
`;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createElement, LightningElement } from "lwc";
|
|
2
|
-
|
|
3
|
-
export const renderLightningElement = (
|
|
4
|
-
element: LightningElement,
|
|
5
|
-
properties = {}
|
|
6
|
-
) => {
|
|
7
|
-
Object.assign(element, properties);
|
|
8
|
-
document.body.appendChild(element as unknown as Node);
|
|
9
|
-
return element;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const createRenderComponent =
|
|
13
|
-
(tag: string, LWC: new () => LightningElement) =>
|
|
14
|
-
(properties = {}) => {
|
|
15
|
-
const component = createElement(tag, {
|
|
16
|
-
is: LWC
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
renderLightningElement(component, properties);
|
|
20
|
-
return component;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const mockSlottedElement = <T extends HTMLElement>(
|
|
24
|
-
element: any,
|
|
25
|
-
elementType = "button",
|
|
26
|
-
slotName?: string
|
|
27
|
-
): { slottedElement: T; slot: HTMLSlotElement } => {
|
|
28
|
-
const slot: HTMLSlotElement = element.shadowRoot.querySelector(
|
|
29
|
-
`slot${slotName ? `[name='${slotName}` : ""}']`
|
|
30
|
-
);
|
|
31
|
-
expect(slot).not.toBeNull();
|
|
32
|
-
|
|
33
|
-
const slottedElement = document.createElement(elementType) as T;
|
|
34
|
-
slot.assignedElements = jest.fn(() => [slottedElement]);
|
|
35
|
-
slot.dispatchEvent(new Event("slotchange"));
|
|
36
|
-
|
|
37
|
-
return { slottedElement, slot };
|
|
38
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { fetchWordpressPosts } from "../wordpress";
|
|
2
|
-
|
|
3
|
-
global.fetch = jest.fn(() =>
|
|
4
|
-
Promise.resolve({
|
|
5
|
-
json: () => Promise.resolve({ res: { status: 404 } })
|
|
6
|
-
})
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
describe("wordpress network request", () => {
|
|
10
|
-
it("displays a console error and returns null on unsuccessful request", async () => {
|
|
11
|
-
const res = await fetchWordpressPosts("", "");
|
|
12
|
-
|
|
13
|
-
expect(res).toBeNull();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const fetchWordpressPosts = async (
|
|
2
|
-
path: string,
|
|
3
|
-
normalizer: any,
|
|
4
|
-
count: string = "6"
|
|
5
|
-
) => {
|
|
6
|
-
const res = await fetch(`${path}?maxResults=${count}`);
|
|
7
|
-
if (res.status !== 200) {
|
|
8
|
-
console.error("Failed to fetch posts", res);
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
const json = await res.json();
|
|
12
|
-
return json.posts.map(normalizer);
|
|
13
|
-
};
|