@sitecore-feaas/clientside 0.0.1
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/.prettierrc +9 -0
- package/README.md +115 -0
- package/dist/browser/index.cjs +3 -0
- package/dist/browser/index.d.ts +25 -0
- package/dist/browser/index.js +3 -0
- package/dist/browser/react.cjs +3 -0
- package/dist/browser/react.d.ts +36 -0
- package/dist/browser/react.js +3 -0
- package/dist/browser/webcomponent-189a307d.d.ts +103 -0
- package/dist/node/index.cjs +1301 -0
- package/dist/node/index.d.ts +25 -0
- package/dist/node/index.js +1286 -0
- package/dist/node/react.cjs +1358 -0
- package/dist/node/react.d.ts +36 -0
- package/dist/node/react.js +1339 -0
- package/dist/node/webcomponent-189a307d.d.ts +103 -0
- package/examples/index.html +54 -0
- package/index.cjs +3 -0
- package/index.d.ts +25 -0
- package/index.js +3 -0
- package/package.json +64 -0
- package/react.cjs +3 -0
- package/react.d.ts +36 -0
- package/react.js +3 -0
- package/src/cloud.ts +58 -0
- package/src/dom.ts +321 -0
- package/src/fetch.ts +64 -0
- package/src/index.ts +11 -0
- package/src/react.ts +66 -0
- package/src/webcomponent.ts +169 -0
- package/test/render.ts +858 -0
- package/tsconfig.json +12 -0
- package/webcomponent-189a307d.d.ts +103 -0
package/tsconfig.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": false /* Enable all strict type-checking options. */,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"forceConsistentCasingInFileNames": false,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"types": ["react", "react-dom"]
|
|
9
|
+
},
|
|
10
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
11
|
+
"exclude": ["**/node_modules", "**/dist"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
interface CloudTemplate {
|
|
2
|
+
hostname?: string;
|
|
3
|
+
library: string;
|
|
4
|
+
component: string;
|
|
5
|
+
variant: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
8
|
+
interface CloudStylesheet {
|
|
9
|
+
hostname?: string;
|
|
10
|
+
library: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function getComponentURL({ hostname, library, component, variant, version }: CloudTemplate): string;
|
|
14
|
+
declare function getStylesheetURL({ hostname, library, version }: CloudStylesheet): string;
|
|
15
|
+
declare function fetchComponent(props: CloudTemplate, callback: (html: string) => void): Promise<Response>;
|
|
16
|
+
declare function fetchStylesheet(props: CloudStylesheet, callback: (css: string) => void): Promise<Response>;
|
|
17
|
+
|
|
18
|
+
interface FEAASCustomizations {
|
|
19
|
+
processTemplate?: (element: HTMLElement, template: string, data: any) => string;
|
|
20
|
+
processData?: (element: HTMLElement, data: any) => any;
|
|
21
|
+
processValue?: (element: HTMLElement, property: string, value: any) => any;
|
|
22
|
+
shouldRepeat?: (element: HTMLElement, value: any) => boolean;
|
|
23
|
+
onRender?: (element: HTMLElement, data: any) => void;
|
|
24
|
+
}
|
|
25
|
+
interface ExplicitTemplate {
|
|
26
|
+
template: string;
|
|
27
|
+
}
|
|
28
|
+
declare type Datascopes = Record<string, any>;
|
|
29
|
+
declare type FEAASComponentProps = {
|
|
30
|
+
data?: Datascopes;
|
|
31
|
+
} & (ExplicitTemplate | CloudTemplate) & FEAASCustomizations;
|
|
32
|
+
declare function renderComponentElement(content: string, datasources?: Datascopes): HTMLDivElement;
|
|
33
|
+
declare function cleanCollectionBit(path: string): string;
|
|
34
|
+
declare function normalizeCollectionScope(path: string): string;
|
|
35
|
+
declare function queryScopes(scopes: any, datapath: string, singleValue?: boolean, json?: any): any;
|
|
36
|
+
declare function setDOMAttribute(element: HTMLElement, attribute: string, value: any, config?: FEAASCustomizations): void;
|
|
37
|
+
declare function observeDOMElement(element: HTMLElement): MutationObserver;
|
|
38
|
+
declare function autoloadScripts(element: HTMLElement, observe?: boolean): MutationObserver;
|
|
39
|
+
declare function loadScript(element: HTMLElement, src: string): boolean;
|
|
40
|
+
declare function renderDOMElement(input: HTMLElement | DocumentFragment, datascopes?: any, config?: FEAASCustomizations, isNested?: boolean): HTMLElement;
|
|
41
|
+
declare function renderDOMContent(root: HTMLElement, template: string, data?: Datascopes, config?: FEAASCustomizations): HTMLElement;
|
|
42
|
+
declare function renderStylesheet(props: CloudStylesheet, style?: HTMLStyleElement): HTMLStyleElement;
|
|
43
|
+
declare function renderStylesheetPromise(props: CloudStylesheet, style?: HTMLStyleElement): Promise<HTMLStyleElement>;
|
|
44
|
+
declare function renderComponent(props: FEAASComponentProps, root?: HTMLElement): HTMLElement;
|
|
45
|
+
declare function renderComponentPromise(props: FEAASComponentProps, root?: HTMLElement): Promise<HTMLElement>;
|
|
46
|
+
|
|
47
|
+
declare global {
|
|
48
|
+
namespace JSX {
|
|
49
|
+
interface IntrinsicElements {
|
|
50
|
+
'feaas-component': {
|
|
51
|
+
data?: any;
|
|
52
|
+
library: string;
|
|
53
|
+
component: string;
|
|
54
|
+
variant: string;
|
|
55
|
+
version?: string;
|
|
56
|
+
hostname?: string;
|
|
57
|
+
template?: string;
|
|
58
|
+
children?: any;
|
|
59
|
+
};
|
|
60
|
+
'feaas-stylesheet': {
|
|
61
|
+
library?: string;
|
|
62
|
+
hostname?: string;
|
|
63
|
+
children?: any;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
declare var WebComponent: {
|
|
69
|
+
new (): HTMLElement;
|
|
70
|
+
prototype: HTMLElement;
|
|
71
|
+
};
|
|
72
|
+
declare class HTMLFeaasComponent extends WebComponent {
|
|
73
|
+
static get observedAttributes(): string[];
|
|
74
|
+
connected: boolean;
|
|
75
|
+
template: string;
|
|
76
|
+
data: any;
|
|
77
|
+
isFetching: boolean;
|
|
78
|
+
connectedCallback(): void;
|
|
79
|
+
disconnectedCallback(): void;
|
|
80
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
81
|
+
update(): void;
|
|
82
|
+
setData(data: any): void;
|
|
83
|
+
getOriginal(): HTMLFeaasComponent;
|
|
84
|
+
getData(): any;
|
|
85
|
+
render(): void;
|
|
86
|
+
getProps(): CloudTemplate & {
|
|
87
|
+
data: Datascopes;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
declare class HTMLFeaasStylesheet extends WebComponent {
|
|
91
|
+
static get observedAttributes(): string[];
|
|
92
|
+
connected: boolean;
|
|
93
|
+
connectedCallback(): void;
|
|
94
|
+
attributeChangedCallback(): void;
|
|
95
|
+
render(): void;
|
|
96
|
+
getProps(): {
|
|
97
|
+
library: string;
|
|
98
|
+
version: string;
|
|
99
|
+
hostname: string;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { CloudStylesheet as C, Datascopes as D, ExplicitTemplate as E, FEAASCustomizations as F, HTMLFeaasComponent as H, HTMLFeaasStylesheet as a, FEAASComponentProps as b, cleanCollectionBit as c, autoloadScripts as d, renderDOMElement as e, renderDOMContent as f, renderStylesheet as g, renderStylesheetPromise as h, renderComponent as i, renderComponentPromise as j, CloudTemplate as k, loadScript as l, getComponentURL as m, normalizeCollectionScope as n, observeDOMElement as o, getStylesheetURL as p, queryScopes as q, renderComponentElement as r, setDOMAttribute as s, fetchComponent as t, fetchStylesheet as u };
|