@peculiar/certificates-viewer-react 3.10.1 → 4.0.2
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/README.md +10 -8
- package/dist/index.js +223 -0
- package/dist/index.js.map +1 -0
- package/dist/types/components.d.ts +2 -3
- package/dist/types/react-component-lib/createComponent.d.ts +1 -1
- package/dist/types/react-component-lib/utils/attachProps.d.ts +8 -4
- package/dist/types/react-component-lib/utils/index.d.ts +4 -1
- package/package.json +14 -14
- package/dist/cjs/components.js +0 -19
- package/dist/cjs/index.js +0 -29
- package/dist/cjs/react-component-lib/createComponent.js +0 -62
- package/dist/cjs/react-component-lib/index.js +0 -5
- package/dist/cjs/react-component-lib/interfaces.js +0 -2
- package/dist/cjs/react-component-lib/utils/attachProps.js +0 -102
- package/dist/cjs/react-component-lib/utils/case.js +0 -11
- package/dist/cjs/react-component-lib/utils/dev.js +0 -17
- package/dist/cjs/react-component-lib/utils/index.js +0 -39
- package/dist/esm/components.js +0 -16
- package/dist/esm/index.js +0 -13
- package/dist/esm/react-component-lib/createComponent.js +0 -58
- package/dist/esm/react-component-lib/index.js +0 -1
- package/dist/esm/react-component-lib/interfaces.js +0 -1
- package/dist/esm/react-component-lib/utils/attachProps.js +0 -95
- package/dist/esm/react-component-lib/utils/case.js +0 -6
- package/dist/esm/react-component-lib/utils/dev.js +0 -12
- package/dist/esm/react-component-lib/utils/index.js +0 -20
- package/dist/esnext/components.js +0 -16
- package/dist/esnext/index.js +0 -13
- package/dist/esnext/react-component-lib/createComponent.js +0 -52
- package/dist/esnext/react-component-lib/index.js +0 -1
- package/dist/esnext/react-component-lib/interfaces.js +0 -1
- package/dist/esnext/react-component-lib/utils/attachProps.js +0 -95
- package/dist/esnext/react-component-lib/utils/case.js +0 -6
- package/dist/esnext/react-component-lib/utils/dev.js +0 -12
- package/dist/esnext/react-component-lib/utils/index.js +0 -20
package/README.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @peculiar/certificates-viewer-react
|
|
2
2
|
|
|
3
3
|
These are React specific building blocks on top of [@peculiar/certificates-viewer](../webcomponents) components.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Using components
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
To get started with using components install the `@peculiar/certificates-viewer-react` package:
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
npm install @peculiar/certificates-viewer-react
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Import the stylesheets from peculiar in your main app file:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import '@peculiar/certificates-viewer/dist/peculiar/peculiar.css';
|
|
17
|
+
```
|
|
14
18
|
|
|
15
19
|
Then you can use a components anywhere in your JSX.
|
|
16
20
|
|
|
@@ -27,8 +31,6 @@ ReactDOM.render(
|
|
|
27
31
|
);
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
### Customize the theme
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@peculiar/certificates-viewer/dist/peculiar/peculiar.css">
|
|
34
|
-
```
|
|
36
|
+
To customize the look and feel of the components, components have CSS variables you can override to provide a theme for your components. See the supported CSS variables in [peculiar.scss](../webcomponents/src/css/peculiar.scss) file.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { defineCustomElement } from '@peculiar/certificates-viewer/components/peculiar-attribute-certificate-viewer.js';
|
|
4
|
+
import { defineCustomElement as defineCustomElement$1 } from '@peculiar/certificates-viewer/components/peculiar-certificate-viewer.js';
|
|
5
|
+
import { defineCustomElement as defineCustomElement$2 } from '@peculiar/certificates-viewer/components/peculiar-certificates-viewer.js';
|
|
6
|
+
import { defineCustomElement as defineCustomElement$3 } from '@peculiar/certificates-viewer/components/peculiar-crl-viewer.js';
|
|
7
|
+
import { defineCustomElement as defineCustomElement$4 } from '@peculiar/certificates-viewer/components/peculiar-csr-viewer.js';
|
|
8
|
+
|
|
9
|
+
const dashToPascalCase = (str) => str
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.split('-')
|
|
12
|
+
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
13
|
+
.join('');
|
|
14
|
+
const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
|
|
15
|
+
|
|
16
|
+
const attachProps = (node, newProps, oldProps = {}) => {
|
|
17
|
+
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
18
|
+
if (node instanceof Element) {
|
|
19
|
+
// add any classes in className to the class list
|
|
20
|
+
const className = getClassName(node.classList, newProps, oldProps);
|
|
21
|
+
if (className !== '') {
|
|
22
|
+
node.className = className;
|
|
23
|
+
}
|
|
24
|
+
Object.keys(newProps).forEach((name) => {
|
|
25
|
+
if (name === 'children' ||
|
|
26
|
+
name === 'style' ||
|
|
27
|
+
name === 'ref' ||
|
|
28
|
+
name === 'class' ||
|
|
29
|
+
name === 'className' ||
|
|
30
|
+
name === 'forwardedRef') {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
34
|
+
const eventName = name.substring(2);
|
|
35
|
+
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
36
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
37
|
+
syncEvent(node, eventNameLc, newProps[name]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
node[name] = newProps[name];
|
|
42
|
+
const propType = typeof newProps[name];
|
|
43
|
+
if (propType === 'string') {
|
|
44
|
+
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const getClassName = (classList, newProps, oldProps) => {
|
|
51
|
+
const newClassProp = newProps.className || newProps.class;
|
|
52
|
+
const oldClassProp = oldProps.className || oldProps.class;
|
|
53
|
+
// map the classes to Maps for performance
|
|
54
|
+
const currentClasses = arrayToMap(classList);
|
|
55
|
+
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
56
|
+
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
57
|
+
const finalClassNames = [];
|
|
58
|
+
// loop through each of the current classes on the component
|
|
59
|
+
// to see if it should be a part of the classNames added
|
|
60
|
+
currentClasses.forEach((currentClass) => {
|
|
61
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
62
|
+
// add it as its already included in classnames coming in from newProps
|
|
63
|
+
finalClassNames.push(currentClass);
|
|
64
|
+
incomingPropClasses.delete(currentClass);
|
|
65
|
+
}
|
|
66
|
+
else if (!oldPropClasses.has(currentClass)) {
|
|
67
|
+
// add it as it has NOT been removed by user
|
|
68
|
+
finalClassNames.push(currentClass);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
72
|
+
return finalClassNames.join(' ');
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Transforms a React event name to a browser event name.
|
|
76
|
+
*/
|
|
77
|
+
const transformReactEventName = (eventNameSuffix) => {
|
|
78
|
+
switch (eventNameSuffix) {
|
|
79
|
+
case 'doubleclick':
|
|
80
|
+
return 'dblclick';
|
|
81
|
+
}
|
|
82
|
+
return eventNameSuffix;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Checks if an event is supported in the current execution environment.
|
|
86
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
87
|
+
*/
|
|
88
|
+
const isCoveredByReact = (eventNameSuffix) => {
|
|
89
|
+
if (typeof document === 'undefined') {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const eventName = 'on' + transformReactEventName(eventNameSuffix);
|
|
94
|
+
let isSupported = eventName in document;
|
|
95
|
+
if (!isSupported) {
|
|
96
|
+
const element = document.createElement('div');
|
|
97
|
+
element.setAttribute(eventName, 'return;');
|
|
98
|
+
isSupported = typeof element[eventName] === 'function';
|
|
99
|
+
}
|
|
100
|
+
return isSupported;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const syncEvent = (node, eventName, newEventHandler) => {
|
|
104
|
+
const eventStore = node.__events || (node.__events = {});
|
|
105
|
+
const oldEventHandler = eventStore[eventName];
|
|
106
|
+
// Remove old listener so they don't double up.
|
|
107
|
+
if (oldEventHandler) {
|
|
108
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
109
|
+
}
|
|
110
|
+
// Bind new listener.
|
|
111
|
+
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
112
|
+
if (newEventHandler) {
|
|
113
|
+
newEventHandler.call(this, e);
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
const arrayToMap = (arr) => {
|
|
118
|
+
const map = new Map();
|
|
119
|
+
arr.forEach((s) => map.set(s, s));
|
|
120
|
+
return map;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const setRef = (ref, value) => {
|
|
124
|
+
if (typeof ref === 'function') {
|
|
125
|
+
ref(value);
|
|
126
|
+
}
|
|
127
|
+
else if (ref != null) {
|
|
128
|
+
// Cast as a MutableRef so we can assign current
|
|
129
|
+
ref.current = value;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const mergeRefs = (...refs) => {
|
|
133
|
+
return (value) => {
|
|
134
|
+
refs.forEach((ref) => {
|
|
135
|
+
setRef(ref, value);
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
const createForwardRef = (ReactComponent, displayName) => {
|
|
140
|
+
const forwardRef = (props, ref) => {
|
|
141
|
+
return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
142
|
+
};
|
|
143
|
+
forwardRef.displayName = displayName;
|
|
144
|
+
return React.forwardRef(forwardRef);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
|
|
148
|
+
if (defineCustomElement !== undefined) {
|
|
149
|
+
defineCustomElement();
|
|
150
|
+
}
|
|
151
|
+
const displayName = dashToPascalCase(tagName);
|
|
152
|
+
const ReactComponent = class extends React.Component {
|
|
153
|
+
constructor(props) {
|
|
154
|
+
super(props);
|
|
155
|
+
this.setComponentElRef = (element) => {
|
|
156
|
+
this.componentEl = element;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
componentDidMount() {
|
|
160
|
+
this.componentDidUpdate(this.props);
|
|
161
|
+
}
|
|
162
|
+
componentDidUpdate(prevProps) {
|
|
163
|
+
attachProps(this.componentEl, this.props, prevProps);
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
|
|
167
|
+
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
168
|
+
const value = cProps[name];
|
|
169
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
170
|
+
const eventName = name.substring(2).toLowerCase();
|
|
171
|
+
if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
|
|
172
|
+
acc[name] = value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// we should only render strings, booleans, and numbers as attrs in html.
|
|
177
|
+
// objects, functions, arrays etc get synced via properties on mount.
|
|
178
|
+
const type = typeof value;
|
|
179
|
+
if (type === 'string' || type === 'boolean' || type === 'number') {
|
|
180
|
+
acc[camelToDashCase(name)] = value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return acc;
|
|
184
|
+
}, {});
|
|
185
|
+
if (manipulatePropsFunction) {
|
|
186
|
+
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
187
|
+
}
|
|
188
|
+
const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
|
|
189
|
+
/**
|
|
190
|
+
* We use createElement here instead of
|
|
191
|
+
* React.createElement to work around a
|
|
192
|
+
* bug in Vite (https://github.com/vitejs/vite/issues/6104).
|
|
193
|
+
* React.createElement causes all elements to be rendered
|
|
194
|
+
* as <tagname> instead of the actual Web Component.
|
|
195
|
+
*/
|
|
196
|
+
return React.createElement(tagName, newProps, children);
|
|
197
|
+
}
|
|
198
|
+
static get displayName() {
|
|
199
|
+
return displayName;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
203
|
+
if (ReactComponentContext) {
|
|
204
|
+
ReactComponent.contextType = ReactComponentContext;
|
|
205
|
+
}
|
|
206
|
+
return createForwardRef(ReactComponent, displayName);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @license
|
|
211
|
+
* Copyright (c) Peculiar Ventures, LLC.
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the MIT license found in the
|
|
214
|
+
* LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/
|
|
216
|
+
const PeculiarAttributeCertificateViewer = /*@__PURE__*/ createReactComponent('peculiar-attribute-certificate-viewer', undefined, undefined, defineCustomElement);
|
|
217
|
+
const PeculiarCertificateViewer = /*@__PURE__*/ createReactComponent('peculiar-certificate-viewer', undefined, undefined, defineCustomElement$1);
|
|
218
|
+
const PeculiarCertificatesViewer = /*@__PURE__*/ createReactComponent('peculiar-certificates-viewer', undefined, undefined, defineCustomElement$2);
|
|
219
|
+
const PeculiarCrlViewer = /*@__PURE__*/ createReactComponent('peculiar-crl-viewer', undefined, undefined, defineCustomElement$3);
|
|
220
|
+
const PeculiarCsrViewer = /*@__PURE__*/ createReactComponent('peculiar-csr-viewer', undefined, undefined, defineCustomElement$4);
|
|
221
|
+
|
|
222
|
+
export { PeculiarAttributeCertificateViewer, PeculiarCertificateViewer, PeculiarCertificatesViewer, PeculiarCrlViewer, PeculiarCsrViewer };
|
|
223
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/react-component-lib/utils/case.ts","../src/react-component-lib/utils/attachProps.ts","../src/react-component-lib/utils/index.tsx","../src/react-component-lib/createComponent.tsx","../src/components.ts"],"sourcesContent":["export const dashToPascalCase = (str: string) =>\n str\n .toLowerCase()\n .split('-')\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join('');\nexport const camelToDashCase = (str: string) => str.replace(/([A-Z])/g, (m: string) => `-${m[0].toLowerCase()}`);\n","import { camelToDashCase } from './case';\n\nexport const attachProps = (node: HTMLElement, newProps: any, oldProps: any = {}) => {\n // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first\n if (node instanceof Element) {\n // add any classes in className to the class list\n const className = getClassName(node.classList, newProps, oldProps);\n if (className !== '') {\n node.className = className;\n }\n\n Object.keys(newProps).forEach((name) => {\n if (\n name === 'children' ||\n name === 'style' ||\n name === 'ref' ||\n name === 'class' ||\n name === 'className' ||\n name === 'forwardedRef'\n ) {\n return;\n }\n if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {\n const eventName = name.substring(2);\n const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);\n\n if (!isCoveredByReact(eventNameLc)) {\n syncEvent(node, eventNameLc, newProps[name]);\n }\n } else {\n (node as any)[name] = newProps[name];\n const propType = typeof newProps[name];\n if (propType === 'string') {\n node.setAttribute(camelToDashCase(name), newProps[name]);\n }\n }\n });\n }\n};\n\nexport const getClassName = (classList: DOMTokenList, newProps: any, oldProps: any) => {\n const newClassProp: string = newProps.className || newProps.class;\n const oldClassProp: string = oldProps.className || oldProps.class;\n // map the classes to Maps for performance\n const currentClasses = arrayToMap(classList);\n const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);\n const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);\n const finalClassNames: string[] = [];\n // loop through each of the current classes on the component\n // to see if it should be a part of the classNames added\n currentClasses.forEach((currentClass) => {\n if (incomingPropClasses.has(currentClass)) {\n // add it as its already included in classnames coming in from newProps\n finalClassNames.push(currentClass);\n incomingPropClasses.delete(currentClass);\n } else if (!oldPropClasses.has(currentClass)) {\n // add it as it has NOT been removed by user\n finalClassNames.push(currentClass);\n }\n });\n incomingPropClasses.forEach((s) => finalClassNames.push(s));\n return finalClassNames.join(' ');\n};\n\n/**\n * Transforms a React event name to a browser event name.\n */\nexport const transformReactEventName = (eventNameSuffix: string) => {\n switch (eventNameSuffix) {\n case 'doubleclick':\n return 'dblclick';\n }\n return eventNameSuffix;\n};\n\n/**\n * Checks if an event is supported in the current execution environment.\n * @license Modernizr 3.0.0pre (Custom Build) | MIT\n */\nexport const isCoveredByReact = (eventNameSuffix: string) => {\n if (typeof document === 'undefined') {\n return true;\n } else {\n const eventName = 'on' + transformReactEventName(eventNameSuffix);\n let isSupported = eventName in document;\n\n if (!isSupported) {\n const element = document.createElement('div');\n element.setAttribute(eventName, 'return;');\n isSupported = typeof (element as any)[eventName] === 'function';\n }\n\n return isSupported;\n }\n};\n\nexport const syncEvent = (\n node: Element & { __events?: { [key: string]: ((e: Event) => any) | undefined } },\n eventName: string,\n newEventHandler?: (e: Event) => any\n) => {\n const eventStore = node.__events || (node.__events = {});\n const oldEventHandler = eventStore[eventName];\n\n // Remove old listener so they don't double up.\n if (oldEventHandler) {\n node.removeEventListener(eventName, oldEventHandler);\n }\n\n // Bind new listener.\n node.addEventListener(\n eventName,\n (eventStore[eventName] = function handler(e: Event) {\n if (newEventHandler) {\n newEventHandler.call(this, e);\n }\n })\n );\n};\n\nconst arrayToMap = (arr: string[] | DOMTokenList) => {\n const map = new Map<string, string>();\n (arr as string[]).forEach((s: string) => map.set(s, s));\n return map;\n};\n","import * as React from 'react';\n\nimport type { StyleReactProps } from '../interfaces';\n\nexport type StencilReactExternalProps<PropType, ElementType> = PropType &\n Omit<React.HTMLAttributes<ElementType>, 'style'> &\n StyleReactProps;\n\n// This will be replaced with React.ForwardedRef when react-output-target is upgraded to React v17\nexport type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;\n\nexport const setRef = (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref != null) {\n // Cast as a MutableRef so we can assign current\n (ref as React.MutableRefObject<any>).current = value;\n }\n};\n\nexport const mergeRefs = (\n ...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]\n): React.RefCallback<any> => {\n return (value: any) => {\n refs.forEach((ref) => {\n setRef(ref, value);\n });\n };\n};\n\nexport const createForwardRef = <PropType, ElementType>(ReactComponent: any, displayName: string) => {\n const forwardRef = (\n props: StencilReactExternalProps<PropType, ElementType>,\n ref: StencilReactForwardedRef<ElementType>\n ) => {\n return <ReactComponent {...props} forwardedRef={ref} />;\n };\n forwardRef.displayName = displayName;\n\n return React.forwardRef(forwardRef);\n};\n\nexport const defineCustomElement = (tagName: string, customElement: any) => {\n if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {\n customElements.define(tagName, customElement);\n }\n};\n\nexport * from './attachProps';\nexport * from './case';\n","import * as React from 'react';\n\nimport { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils';\n\nexport interface HTMLStencilElement extends HTMLElement {\n componentOnReady(): Promise<this>;\n}\n\ninterface StencilReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {\n forwardedRef: React.RefObject<ElementType>;\n ref?: React.Ref<any>;\n}\n\nexport const createReactComponent = <\n PropType,\n ElementType extends HTMLStencilElement,\n ContextStateType = {},\n ExpandedPropsTypes = {}\n>(\n tagName: string,\n ReactComponentContext?: React.Context<ContextStateType>,\n manipulatePropsFunction?: (\n originalProps: StencilReactInternalProps<ElementType>,\n propsToPass: any\n ) => ExpandedPropsTypes,\n defineCustomElement?: () => void\n) => {\n if (defineCustomElement !== undefined) {\n defineCustomElement();\n }\n\n const displayName = dashToPascalCase(tagName);\n const ReactComponent = class extends React.Component<StencilReactInternalProps<ElementType>> {\n componentEl!: ElementType;\n\n setComponentElRef = (element: ElementType) => {\n this.componentEl = element;\n };\n\n constructor(props: StencilReactInternalProps<ElementType>) {\n super(props);\n }\n\n componentDidMount() {\n this.componentDidUpdate(this.props);\n }\n\n componentDidUpdate(prevProps: StencilReactInternalProps<ElementType>) {\n attachProps(this.componentEl, this.props, prevProps);\n }\n\n render() {\n const { children, forwardedRef, style, className, ref, ...cProps } = this.props;\n\n let propsToPass = Object.keys(cProps).reduce((acc: any, name) => {\n const value = (cProps as any)[name];\n\n if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {\n const eventName = name.substring(2).toLowerCase();\n if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {\n acc[name] = value;\n }\n } else {\n // we should only render strings, booleans, and numbers as attrs in html.\n // objects, functions, arrays etc get synced via properties on mount.\n const type = typeof value;\n\n if (type === 'string' || type === 'boolean' || type === 'number') {\n acc[camelToDashCase(name)] = value;\n }\n }\n return acc;\n }, {} as ExpandedPropsTypes);\n\n if (manipulatePropsFunction) {\n propsToPass = manipulatePropsFunction(this.props, propsToPass);\n }\n\n const newProps: Omit<StencilReactInternalProps<ElementType>, 'forwardedRef'> = {\n ...propsToPass,\n ref: mergeRefs(forwardedRef, this.setComponentElRef),\n style,\n };\n\n /**\n * We use createElement here instead of\n * React.createElement to work around a\n * bug in Vite (https://github.com/vitejs/vite/issues/6104).\n * React.createElement causes all elements to be rendered\n * as <tagname> instead of the actual Web Component.\n */\n return React.createElement(tagName, newProps, children);\n }\n\n static get displayName() {\n return displayName;\n }\n };\n\n // If context was passed to createReactComponent then conditionally add it to the Component Class\n if (ReactComponentContext) {\n ReactComponent.contextType = ReactComponentContext;\n }\n\n return createForwardRef<PropType, ElementType>(ReactComponent, displayName);\n};\n","/**\n * @license\n * Copyright (c) Peculiar Ventures, LLC.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/* eslint-disable */\n/* tslint:disable */\n/* auto-generated react proxies */\nimport { createReactComponent } from './react-component-lib';\n\nimport type { JSX } from '@peculiar/certificates-viewer/components';\n\nimport { defineCustomElement as definePeculiarAttributeCertificateViewer } from '@peculiar/certificates-viewer/components/peculiar-attribute-certificate-viewer.js';\nimport { defineCustomElement as definePeculiarCertificateViewer } from '@peculiar/certificates-viewer/components/peculiar-certificate-viewer.js';\nimport { defineCustomElement as definePeculiarCertificatesViewer } from '@peculiar/certificates-viewer/components/peculiar-certificates-viewer.js';\nimport { defineCustomElement as definePeculiarCrlViewer } from '@peculiar/certificates-viewer/components/peculiar-crl-viewer.js';\nimport { defineCustomElement as definePeculiarCsrViewer } from '@peculiar/certificates-viewer/components/peculiar-csr-viewer.js';\n\nexport const PeculiarAttributeCertificateViewer = /*@__PURE__*/createReactComponent<JSX.PeculiarAttributeCertificateViewer, HTMLPeculiarAttributeCertificateViewerElement>('peculiar-attribute-certificate-viewer', undefined, undefined, definePeculiarAttributeCertificateViewer);\nexport const PeculiarCertificateViewer = /*@__PURE__*/createReactComponent<JSX.PeculiarCertificateViewer, HTMLPeculiarCertificateViewerElement>('peculiar-certificate-viewer', undefined, undefined, definePeculiarCertificateViewer);\nexport const PeculiarCertificatesViewer = /*@__PURE__*/createReactComponent<JSX.PeculiarCertificatesViewer, HTMLPeculiarCertificatesViewerElement>('peculiar-certificates-viewer', undefined, undefined, definePeculiarCertificatesViewer);\nexport const PeculiarCrlViewer = /*@__PURE__*/createReactComponent<JSX.PeculiarCrlViewer, HTMLPeculiarCrlViewerElement>('peculiar-crl-viewer', undefined, undefined, definePeculiarCrlViewer);\nexport const PeculiarCsrViewer = /*@__PURE__*/createReactComponent<JSX.PeculiarCsrViewer, HTMLPeculiarCsrViewerElement>('peculiar-csr-viewer', undefined, undefined, definePeculiarCsrViewer);\n"],"names":["definePeculiarAttributeCertificateViewer","definePeculiarCertificateViewer","definePeculiarCertificatesViewer","definePeculiarCrlViewer","definePeculiarCsrViewer"],"mappings":";;;;;;;;AAAO,MAAM,gBAAgB,GAAG,CAAC,GAAW,KAC1C,GAAG;AACA,KAAA,WAAW,EAAE;KACb,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACpE,IAAI,CAAC,EAAE,CAAC,CAAC;AACP,MAAM,eAAe,GAAG,CAAC,GAAW,KAAK,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAS,KAAK,CAAA,CAAA,EAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA,CAAE,CAAC;;ACJzG,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAE,QAAa,EAAE,QAAA,GAAgB,EAAE,KAAI;;IAElF,IAAI,IAAI,YAAY,OAAO,EAAE;;AAE3B,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,SAAS,KAAK,EAAE,EAAE;AACpB,YAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC5B,SAAA;QAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;YACrC,IACE,IAAI,KAAK,UAAU;AACnB,gBAAA,IAAI,KAAK,OAAO;AAChB,gBAAA,IAAI,KAAK,KAAK;AACd,gBAAA,IAAI,KAAK,OAAO;AAChB,gBAAA,IA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N,MAAA,0BAA0B,iBAAgB,oBAAoB,CAAwE,8BAA8B,EAAE,SAAS,EAAE,SAAS,EAAEC,qBAAgC,EAAE;AAC9N,MAAA,iBAAiB,iBAAgB,oBAAoB,CAAsD,qBAAqB,EAAE,SAAS,EAAE,SAAS,EAAEC,qBAAuB,EAAE;AACjL,MAAA,iBAAiB,iBAAgB,oBAAoB,CAAsD,qBAAqB,EAAE,SAAS,EAAE,SAAS,EAAEC,qBAAuB;;;;"}
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="react" />
|
|
9
|
-
import type { JSX } from '@peculiar/certificates-viewer';
|
|
9
|
+
import type { JSX } from '@peculiar/certificates-viewer/components';
|
|
10
10
|
export declare const PeculiarAttributeCertificateViewer: import("react").ForwardRefExoticComponent<JSX.PeculiarAttributeCertificateViewer & Omit<import("react").HTMLAttributes<HTMLPeculiarAttributeCertificateViewerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarAttributeCertificateViewerElement>>;
|
|
11
|
-
export declare const PeculiarCertificateDecoder: import("react").ForwardRefExoticComponent<JSX.PeculiarCertificateDecoder & Omit<import("react").HTMLAttributes<HTMLPeculiarCertificateDecoderElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarCertificateDecoderElement>>;
|
|
12
11
|
export declare const PeculiarCertificateViewer: import("react").ForwardRefExoticComponent<JSX.PeculiarCertificateViewer & Omit<import("react").HTMLAttributes<HTMLPeculiarCertificateViewerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarCertificateViewerElement>>;
|
|
13
12
|
export declare const PeculiarCertificatesViewer: import("react").ForwardRefExoticComponent<JSX.PeculiarCertificatesViewer & Omit<import("react").HTMLAttributes<HTMLPeculiarCertificatesViewerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarCertificatesViewerElement>>;
|
|
14
|
-
export declare const PeculiarCsrViewer: import("react").ForwardRefExoticComponent<JSX.PeculiarCsrViewer & Omit<import("react").HTMLAttributes<HTMLPeculiarCsrViewerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarCsrViewerElement>>;
|
|
15
13
|
export declare const PeculiarCrlViewer: import("react").ForwardRefExoticComponent<JSX.PeculiarCrlViewer & Omit<import("react").HTMLAttributes<HTMLPeculiarCrlViewerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarCrlViewerElement>>;
|
|
14
|
+
export declare const PeculiarCsrViewer: import("react").ForwardRefExoticComponent<JSX.PeculiarCsrViewer & Omit<import("react").HTMLAttributes<HTMLPeculiarCsrViewerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLPeculiarCsrViewerElement>>;
|
|
@@ -6,5 +6,5 @@ interface StencilReactInternalProps<ElementType> extends React.HTMLAttributes<El
|
|
|
6
6
|
forwardedRef: React.RefObject<ElementType>;
|
|
7
7
|
ref?: React.Ref<any>;
|
|
8
8
|
}
|
|
9
|
-
export declare const createReactComponent: <PropType, ElementType extends HTMLStencilElement, ContextStateType = {}, ExpandedPropsTypes = {}>(tagName: string, ReactComponentContext?: React.Context<ContextStateType
|
|
9
|
+
export declare const createReactComponent: <PropType, ElementType extends HTMLStencilElement, ContextStateType = {}, ExpandedPropsTypes = {}>(tagName: string, ReactComponentContext?: React.Context<ContextStateType> | undefined, manipulatePropsFunction?: ((originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes) | undefined, defineCustomElement?: () => void) => React.ForwardRefExoticComponent<React.PropsWithoutRef<PropType & Omit<React.HTMLAttributes<ElementType>, "style"> & import("./interfaces").StyleReactProps> & React.RefAttributes<ElementType>>;
|
|
10
10
|
export {};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export declare const attachProps: (node: HTMLElement, newProps: any, oldProps?: any) => void;
|
|
2
2
|
export declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: any) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Transforms a React event name to a browser event name.
|
|
5
|
+
*/
|
|
6
|
+
export declare const transformReactEventName: (eventNameSuffix: string) => string;
|
|
3
7
|
/**
|
|
4
8
|
* Checks if an event is supported in the current execution environment.
|
|
5
9
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
6
10
|
*/
|
|
7
|
-
export declare const isCoveredByReact: (eventNameSuffix: string
|
|
11
|
+
export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
|
|
8
12
|
export declare const syncEvent: (node: Element & {
|
|
9
13
|
__events?: {
|
|
10
|
-
[key: string]: (e: Event) => any;
|
|
11
|
-
};
|
|
12
|
-
}, eventName: string, newEventHandler?: (e: Event) => any) => void;
|
|
14
|
+
[key: string]: ((e: Event) => any) | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}, eventName: string, newEventHandler?: ((e: Event) => any) | undefined) => void;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { StyleReactProps } from '../interfaces';
|
|
3
3
|
export declare type StencilReactExternalProps<PropType, ElementType> = PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps;
|
|
4
|
-
export declare
|
|
4
|
+
export declare type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
|
|
5
|
+
export declare const setRef: (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => void;
|
|
6
|
+
export declare const mergeRefs: (...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]) => React.RefCallback<any>;
|
|
5
7
|
export declare const createForwardRef: <PropType, ElementType>(ReactComponent: any, displayName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<PropType & Omit<React.HTMLAttributes<ElementType>, "style"> & StyleReactProps> & React.RefAttributes<ElementType>>;
|
|
8
|
+
export declare const defineCustomElement: (tagName: string, customElement: any) => void;
|
|
6
9
|
export * from './attachProps';
|
|
7
10
|
export * from './case';
|
package/package.json
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peculiar/certificates-viewer-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "",
|
|
6
|
-
"main": "dist/
|
|
7
|
-
"
|
|
8
|
-
"esnext": "dist/esnext/index.js",
|
|
9
|
-
"typings": "dist/types/index.d.ts",
|
|
5
|
+
"description": "React specific wrapper for @peculiar/certificates-viewer",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
10
8
|
"files": [
|
|
11
9
|
"dist/"
|
|
12
10
|
],
|
|
13
11
|
"scripts": {
|
|
14
|
-
"build": "npm run
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"clean": "rimraf dist"
|
|
12
|
+
"build": "npm run clean && npm run compile",
|
|
13
|
+
"clean": "rimraf dist",
|
|
14
|
+
"compile": "npm run tsc && rollup -c",
|
|
15
|
+
"tsc": "tsc -p ."
|
|
19
16
|
},
|
|
20
17
|
"license": "MIT",
|
|
21
18
|
"author": "PeculiarVentures Team",
|
|
@@ -28,18 +25,21 @@
|
|
|
28
25
|
"access": "public"
|
|
29
26
|
},
|
|
30
27
|
"devDependencies": {
|
|
31
|
-
"@
|
|
28
|
+
"@rollup/plugin-node-resolve": "^8.1.0",
|
|
29
|
+
"@types/node": "^16.11.7",
|
|
32
30
|
"@types/react": "^16.9.46",
|
|
33
31
|
"react": "^16.13.1",
|
|
34
32
|
"rimraf": "^3.0.2",
|
|
33
|
+
"rollup": "^2.26.4",
|
|
34
|
+
"rollup-plugin-sourcemaps": "^0.6.2",
|
|
35
35
|
"typescript": "^4.0.5"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@peculiar/certificates-viewer": "^
|
|
38
|
+
"@peculiar/certificates-viewer": "^4.0.2",
|
|
39
39
|
"tslib": "^2.4.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.13.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "8716e2eb0defcb12b59b28a5dff943f57e09e780"
|
|
45
45
|
}
|
package/dist/cjs/components.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.PeculiarCrlViewer = exports.PeculiarCsrViewer = exports.PeculiarCertificatesViewer = exports.PeculiarCertificateViewer = exports.PeculiarCertificateDecoder = exports.PeculiarAttributeCertificateViewer = void 0;
|
|
11
|
-
/* eslint-disable */
|
|
12
|
-
/* tslint:disable */
|
|
13
|
-
const react_component_lib_1 = require("./react-component-lib");
|
|
14
|
-
exports.PeculiarAttributeCertificateViewer = (0, react_component_lib_1.createReactComponent)('peculiar-attribute-certificate-viewer');
|
|
15
|
-
exports.PeculiarCertificateDecoder = (0, react_component_lib_1.createReactComponent)('peculiar-certificate-decoder');
|
|
16
|
-
exports.PeculiarCertificateViewer = (0, react_component_lib_1.createReactComponent)('peculiar-certificate-viewer');
|
|
17
|
-
exports.PeculiarCertificatesViewer = (0, react_component_lib_1.createReactComponent)('peculiar-certificates-viewer');
|
|
18
|
-
exports.PeculiarCsrViewer = (0, react_component_lib_1.createReactComponent)('peculiar-csr-viewer');
|
|
19
|
-
exports.PeculiarCrlViewer = (0, react_component_lib_1.createReactComponent)('peculiar-crl-viewer');
|
package/dist/cjs/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
const loader_1 = require("@peculiar/certificates-viewer/loader");
|
|
25
|
-
__exportStar(require("./components"), exports);
|
|
26
|
-
if (typeof window !== 'undefined') {
|
|
27
|
-
(0, loader_1.applyPolyfills)()
|
|
28
|
-
.then(() => (0, loader_1.defineCustomElements)(window));
|
|
29
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.createReactComponent = void 0;
|
|
15
|
-
const React = require("react");
|
|
16
|
-
const utils_1 = require("./utils");
|
|
17
|
-
const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction) => {
|
|
18
|
-
const displayName = (0, utils_1.dashToPascalCase)(tagName);
|
|
19
|
-
const ReactComponent = class extends React.Component {
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
this.setComponentElRef = (element) => {
|
|
23
|
-
this.componentEl = element;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.componentDidUpdate(this.props);
|
|
28
|
-
}
|
|
29
|
-
componentDidUpdate(prevProps) {
|
|
30
|
-
(0, utils_1.attachProps)(this.componentEl, this.props, prevProps);
|
|
31
|
-
}
|
|
32
|
-
render() {
|
|
33
|
-
const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
|
|
34
|
-
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
35
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
36
|
-
const eventName = name.substring(2).toLowerCase();
|
|
37
|
-
if (typeof document !== 'undefined' && (0, utils_1.isCoveredByReact)(eventName, document)) {
|
|
38
|
-
acc[name] = cProps[name];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
acc[name] = cProps[name];
|
|
43
|
-
}
|
|
44
|
-
return acc;
|
|
45
|
-
}, {});
|
|
46
|
-
if (manipulatePropsFunction) {
|
|
47
|
-
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
48
|
-
}
|
|
49
|
-
let newProps = Object.assign(Object.assign({}, propsToPass), { ref: (0, utils_1.mergeRefs)(forwardedRef, this.setComponentElRef), style });
|
|
50
|
-
return React.createElement(tagName, newProps, children);
|
|
51
|
-
}
|
|
52
|
-
static get displayName() {
|
|
53
|
-
return displayName;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
57
|
-
if (ReactComponentContext) {
|
|
58
|
-
ReactComponent.contextType = ReactComponentContext;
|
|
59
|
-
}
|
|
60
|
-
return (0, utils_1.createForwardRef)(ReactComponent, displayName);
|
|
61
|
-
};
|
|
62
|
-
exports.createReactComponent = createReactComponent;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createReactComponent = void 0;
|
|
4
|
-
var createComponent_1 = require("./createComponent");
|
|
5
|
-
Object.defineProperty(exports, "createReactComponent", { enumerable: true, get: function () { return createComponent_1.createReactComponent; } });
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.syncEvent = exports.isCoveredByReact = exports.getClassName = exports.attachProps = void 0;
|
|
4
|
-
const case_1 = require("./case");
|
|
5
|
-
const attachProps = (node, newProps, oldProps = {}) => {
|
|
6
|
-
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
7
|
-
if (node instanceof Element) {
|
|
8
|
-
// add any classes in className to the class list
|
|
9
|
-
const className = (0, exports.getClassName)(node.classList, newProps, oldProps);
|
|
10
|
-
if (className !== '') {
|
|
11
|
-
node.className = className;
|
|
12
|
-
}
|
|
13
|
-
Object.keys(newProps).forEach((name) => {
|
|
14
|
-
if (name === 'children' ||
|
|
15
|
-
name === 'style' ||
|
|
16
|
-
name === 'ref' ||
|
|
17
|
-
name === 'class' ||
|
|
18
|
-
name === 'className' ||
|
|
19
|
-
name === 'forwardedRef') {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
23
|
-
const eventName = name.substring(2);
|
|
24
|
-
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
25
|
-
if (typeof document !== 'undefined' && !(0, exports.isCoveredByReact)(eventNameLc, document)) {
|
|
26
|
-
(0, exports.syncEvent)(node, eventNameLc, newProps[name]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
node[name] = newProps[name];
|
|
31
|
-
const propType = typeof newProps[name];
|
|
32
|
-
if (propType === 'string') {
|
|
33
|
-
node.setAttribute((0, case_1.camelToDashCase)(name), newProps[name]);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
node[name] = newProps[name];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
exports.attachProps = attachProps;
|
|
43
|
-
const getClassName = (classList, newProps, oldProps) => {
|
|
44
|
-
const newClassProp = newProps.className || newProps.class;
|
|
45
|
-
const oldClassProp = oldProps.className || oldProps.class;
|
|
46
|
-
// map the classes to Maps for performance
|
|
47
|
-
const currentClasses = arrayToMap(classList);
|
|
48
|
-
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
49
|
-
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
50
|
-
const finalClassNames = [];
|
|
51
|
-
// loop through each of the current classes on the component
|
|
52
|
-
// to see if it should be a part of the classNames added
|
|
53
|
-
currentClasses.forEach((currentClass) => {
|
|
54
|
-
if (incomingPropClasses.has(currentClass)) {
|
|
55
|
-
// add it as its already included in classnames coming in from newProps
|
|
56
|
-
finalClassNames.push(currentClass);
|
|
57
|
-
incomingPropClasses.delete(currentClass);
|
|
58
|
-
}
|
|
59
|
-
else if (!oldPropClasses.has(currentClass)) {
|
|
60
|
-
// add it as it has NOT been removed by user
|
|
61
|
-
finalClassNames.push(currentClass);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
65
|
-
return finalClassNames.join(' ');
|
|
66
|
-
};
|
|
67
|
-
exports.getClassName = getClassName;
|
|
68
|
-
/**
|
|
69
|
-
* Checks if an event is supported in the current execution environment.
|
|
70
|
-
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
71
|
-
*/
|
|
72
|
-
const isCoveredByReact = (eventNameSuffix, doc) => {
|
|
73
|
-
const eventName = `on${eventNameSuffix}`;
|
|
74
|
-
let isSupported = eventName in doc;
|
|
75
|
-
if (!isSupported) {
|
|
76
|
-
const element = doc.createElement('div');
|
|
77
|
-
element.setAttribute(eventName, 'return;');
|
|
78
|
-
isSupported = typeof element[eventName] === 'function';
|
|
79
|
-
}
|
|
80
|
-
return isSupported;
|
|
81
|
-
};
|
|
82
|
-
exports.isCoveredByReact = isCoveredByReact;
|
|
83
|
-
const syncEvent = (node, eventName, newEventHandler) => {
|
|
84
|
-
const eventStore = node.__events || (node.__events = {});
|
|
85
|
-
const oldEventHandler = eventStore[eventName];
|
|
86
|
-
// Remove old listener so they don't double up.
|
|
87
|
-
if (oldEventHandler) {
|
|
88
|
-
node.removeEventListener(eventName, oldEventHandler);
|
|
89
|
-
}
|
|
90
|
-
// Bind new listener.
|
|
91
|
-
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
92
|
-
if (newEventHandler) {
|
|
93
|
-
newEventHandler.call(this, e);
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
96
|
-
};
|
|
97
|
-
exports.syncEvent = syncEvent;
|
|
98
|
-
const arrayToMap = (arr) => {
|
|
99
|
-
const map = new Map();
|
|
100
|
-
arr.forEach((s) => map.set(s, s));
|
|
101
|
-
return map;
|
|
102
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelToDashCase = exports.dashToPascalCase = void 0;
|
|
4
|
-
const dashToPascalCase = (str) => str
|
|
5
|
-
.toLowerCase()
|
|
6
|
-
.split('-')
|
|
7
|
-
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
8
|
-
.join('');
|
|
9
|
-
exports.dashToPascalCase = dashToPascalCase;
|
|
10
|
-
const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
|
|
11
|
-
exports.camelToDashCase = camelToDashCase;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deprecationWarning = exports.isDevMode = void 0;
|
|
4
|
-
const isDevMode = () => {
|
|
5
|
-
return process && process.env && process.env.NODE_ENV === 'development';
|
|
6
|
-
};
|
|
7
|
-
exports.isDevMode = isDevMode;
|
|
8
|
-
const warnings = {};
|
|
9
|
-
const deprecationWarning = (key, message) => {
|
|
10
|
-
if ((0, exports.isDevMode)()) {
|
|
11
|
-
if (!warnings[key]) {
|
|
12
|
-
console.warn(message);
|
|
13
|
-
warnings[key] = true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.deprecationWarning = deprecationWarning;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createForwardRef = exports.mergeRefs = void 0;
|
|
18
|
-
const React = require("react");
|
|
19
|
-
// The comma in the type is to trick typescript because it things a single generic in a tsx file is jsx
|
|
20
|
-
const mergeRefs = (...refs) => (value) => refs.forEach((ref) => {
|
|
21
|
-
if (typeof ref === 'function') {
|
|
22
|
-
ref(value);
|
|
23
|
-
}
|
|
24
|
-
else if (ref != null) {
|
|
25
|
-
// This is typed as readonly so we need to allow for override
|
|
26
|
-
ref.current = value;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
exports.mergeRefs = mergeRefs;
|
|
30
|
-
const createForwardRef = (ReactComponent, displayName) => {
|
|
31
|
-
const forwardRef = (props, ref) => {
|
|
32
|
-
return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
33
|
-
};
|
|
34
|
-
forwardRef.displayName = displayName;
|
|
35
|
-
return React.forwardRef(forwardRef);
|
|
36
|
-
};
|
|
37
|
-
exports.createForwardRef = createForwardRef;
|
|
38
|
-
__exportStar(require("./attachProps"), exports);
|
|
39
|
-
__exportStar(require("./case"), exports);
|
package/dist/esm/components.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
/* eslint-disable */
|
|
9
|
-
/* tslint:disable */
|
|
10
|
-
import { createReactComponent } from './react-component-lib';
|
|
11
|
-
export const PeculiarAttributeCertificateViewer = /*@__PURE__*/ createReactComponent('peculiar-attribute-certificate-viewer');
|
|
12
|
-
export const PeculiarCertificateDecoder = /*@__PURE__*/ createReactComponent('peculiar-certificate-decoder');
|
|
13
|
-
export const PeculiarCertificateViewer = /*@__PURE__*/ createReactComponent('peculiar-certificate-viewer');
|
|
14
|
-
export const PeculiarCertificatesViewer = /*@__PURE__*/ createReactComponent('peculiar-certificates-viewer');
|
|
15
|
-
export const PeculiarCsrViewer = /*@__PURE__*/ createReactComponent('peculiar-csr-viewer');
|
|
16
|
-
export const PeculiarCrlViewer = /*@__PURE__*/ createReactComponent('peculiar-crl-viewer');
|
package/dist/esm/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
import { defineCustomElements, applyPolyfills } from '@peculiar/certificates-viewer/loader';
|
|
9
|
-
export * from './components';
|
|
10
|
-
if (typeof window !== 'undefined') {
|
|
11
|
-
applyPolyfills()
|
|
12
|
-
.then(() => defineCustomElements(window));
|
|
13
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { attachProps, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
|
|
14
|
-
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction) => {
|
|
15
|
-
const displayName = dashToPascalCase(tagName);
|
|
16
|
-
const ReactComponent = class extends React.Component {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.setComponentElRef = (element) => {
|
|
20
|
-
this.componentEl = element;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
this.componentDidUpdate(this.props);
|
|
25
|
-
}
|
|
26
|
-
componentDidUpdate(prevProps) {
|
|
27
|
-
attachProps(this.componentEl, this.props, prevProps);
|
|
28
|
-
}
|
|
29
|
-
render() {
|
|
30
|
-
const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
|
|
31
|
-
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
32
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
33
|
-
const eventName = name.substring(2).toLowerCase();
|
|
34
|
-
if (typeof document !== 'undefined' && isCoveredByReact(eventName, document)) {
|
|
35
|
-
acc[name] = cProps[name];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
acc[name] = cProps[name];
|
|
40
|
-
}
|
|
41
|
-
return acc;
|
|
42
|
-
}, {});
|
|
43
|
-
if (manipulatePropsFunction) {
|
|
44
|
-
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
45
|
-
}
|
|
46
|
-
let newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
|
|
47
|
-
return React.createElement(tagName, newProps, children);
|
|
48
|
-
}
|
|
49
|
-
static get displayName() {
|
|
50
|
-
return displayName;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
54
|
-
if (ReactComponentContext) {
|
|
55
|
-
ReactComponent.contextType = ReactComponentContext;
|
|
56
|
-
}
|
|
57
|
-
return createForwardRef(ReactComponent, displayName);
|
|
58
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createReactComponent } from './createComponent';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { camelToDashCase } from './case';
|
|
2
|
-
export const attachProps = (node, newProps, oldProps = {}) => {
|
|
3
|
-
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
4
|
-
if (node instanceof Element) {
|
|
5
|
-
// add any classes in className to the class list
|
|
6
|
-
const className = getClassName(node.classList, newProps, oldProps);
|
|
7
|
-
if (className !== '') {
|
|
8
|
-
node.className = className;
|
|
9
|
-
}
|
|
10
|
-
Object.keys(newProps).forEach((name) => {
|
|
11
|
-
if (name === 'children' ||
|
|
12
|
-
name === 'style' ||
|
|
13
|
-
name === 'ref' ||
|
|
14
|
-
name === 'class' ||
|
|
15
|
-
name === 'className' ||
|
|
16
|
-
name === 'forwardedRef') {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
20
|
-
const eventName = name.substring(2);
|
|
21
|
-
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
22
|
-
if (typeof document !== 'undefined' && !isCoveredByReact(eventNameLc, document)) {
|
|
23
|
-
syncEvent(node, eventNameLc, newProps[name]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
node[name] = newProps[name];
|
|
28
|
-
const propType = typeof newProps[name];
|
|
29
|
-
if (propType === 'string') {
|
|
30
|
-
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
node[name] = newProps[name];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const getClassName = (classList, newProps, oldProps) => {
|
|
40
|
-
const newClassProp = newProps.className || newProps.class;
|
|
41
|
-
const oldClassProp = oldProps.className || oldProps.class;
|
|
42
|
-
// map the classes to Maps for performance
|
|
43
|
-
const currentClasses = arrayToMap(classList);
|
|
44
|
-
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
45
|
-
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
46
|
-
const finalClassNames = [];
|
|
47
|
-
// loop through each of the current classes on the component
|
|
48
|
-
// to see if it should be a part of the classNames added
|
|
49
|
-
currentClasses.forEach((currentClass) => {
|
|
50
|
-
if (incomingPropClasses.has(currentClass)) {
|
|
51
|
-
// add it as its already included in classnames coming in from newProps
|
|
52
|
-
finalClassNames.push(currentClass);
|
|
53
|
-
incomingPropClasses.delete(currentClass);
|
|
54
|
-
}
|
|
55
|
-
else if (!oldPropClasses.has(currentClass)) {
|
|
56
|
-
// add it as it has NOT been removed by user
|
|
57
|
-
finalClassNames.push(currentClass);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
61
|
-
return finalClassNames.join(' ');
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Checks if an event is supported in the current execution environment.
|
|
65
|
-
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
66
|
-
*/
|
|
67
|
-
export const isCoveredByReact = (eventNameSuffix, doc) => {
|
|
68
|
-
const eventName = `on${eventNameSuffix}`;
|
|
69
|
-
let isSupported = eventName in doc;
|
|
70
|
-
if (!isSupported) {
|
|
71
|
-
const element = doc.createElement('div');
|
|
72
|
-
element.setAttribute(eventName, 'return;');
|
|
73
|
-
isSupported = typeof element[eventName] === 'function';
|
|
74
|
-
}
|
|
75
|
-
return isSupported;
|
|
76
|
-
};
|
|
77
|
-
export const syncEvent = (node, eventName, newEventHandler) => {
|
|
78
|
-
const eventStore = node.__events || (node.__events = {});
|
|
79
|
-
const oldEventHandler = eventStore[eventName];
|
|
80
|
-
// Remove old listener so they don't double up.
|
|
81
|
-
if (oldEventHandler) {
|
|
82
|
-
node.removeEventListener(eventName, oldEventHandler);
|
|
83
|
-
}
|
|
84
|
-
// Bind new listener.
|
|
85
|
-
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
86
|
-
if (newEventHandler) {
|
|
87
|
-
newEventHandler.call(this, e);
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
};
|
|
91
|
-
const arrayToMap = (arr) => {
|
|
92
|
-
const map = new Map();
|
|
93
|
-
arr.forEach((s) => map.set(s, s));
|
|
94
|
-
return map;
|
|
95
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const isDevMode = () => {
|
|
2
|
-
return process && process.env && process.env.NODE_ENV === 'development';
|
|
3
|
-
};
|
|
4
|
-
const warnings = {};
|
|
5
|
-
export const deprecationWarning = (key, message) => {
|
|
6
|
-
if (isDevMode()) {
|
|
7
|
-
if (!warnings[key]) {
|
|
8
|
-
console.warn(message);
|
|
9
|
-
warnings[key] = true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
// The comma in the type is to trick typescript because it things a single generic in a tsx file is jsx
|
|
3
|
-
export const mergeRefs = (...refs) => (value) => refs.forEach((ref) => {
|
|
4
|
-
if (typeof ref === 'function') {
|
|
5
|
-
ref(value);
|
|
6
|
-
}
|
|
7
|
-
else if (ref != null) {
|
|
8
|
-
// This is typed as readonly so we need to allow for override
|
|
9
|
-
ref.current = value;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export const createForwardRef = (ReactComponent, displayName) => {
|
|
13
|
-
const forwardRef = (props, ref) => {
|
|
14
|
-
return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
15
|
-
};
|
|
16
|
-
forwardRef.displayName = displayName;
|
|
17
|
-
return React.forwardRef(forwardRef);
|
|
18
|
-
};
|
|
19
|
-
export * from './attachProps';
|
|
20
|
-
export * from './case';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
/* eslint-disable */
|
|
9
|
-
/* tslint:disable */
|
|
10
|
-
import { createReactComponent } from './react-component-lib';
|
|
11
|
-
export const PeculiarAttributeCertificateViewer = /*@__PURE__*/ createReactComponent('peculiar-attribute-certificate-viewer');
|
|
12
|
-
export const PeculiarCertificateDecoder = /*@__PURE__*/ createReactComponent('peculiar-certificate-decoder');
|
|
13
|
-
export const PeculiarCertificateViewer = /*@__PURE__*/ createReactComponent('peculiar-certificate-viewer');
|
|
14
|
-
export const PeculiarCertificatesViewer = /*@__PURE__*/ createReactComponent('peculiar-certificates-viewer');
|
|
15
|
-
export const PeculiarCsrViewer = /*@__PURE__*/ createReactComponent('peculiar-csr-viewer');
|
|
16
|
-
export const PeculiarCrlViewer = /*@__PURE__*/ createReactComponent('peculiar-crl-viewer');
|
package/dist/esnext/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) Peculiar Ventures, LLC.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
import { defineCustomElements, applyPolyfills } from '@peculiar/certificates-viewer/loader';
|
|
9
|
-
export * from './components';
|
|
10
|
-
if (typeof window !== 'undefined') {
|
|
11
|
-
applyPolyfills()
|
|
12
|
-
.then(() => defineCustomElements(window));
|
|
13
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { attachProps, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
|
|
3
|
-
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction) => {
|
|
4
|
-
const displayName = dashToPascalCase(tagName);
|
|
5
|
-
const ReactComponent = class extends React.Component {
|
|
6
|
-
componentEl;
|
|
7
|
-
setComponentElRef = (element) => {
|
|
8
|
-
this.componentEl = element;
|
|
9
|
-
};
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
}
|
|
13
|
-
componentDidMount() {
|
|
14
|
-
this.componentDidUpdate(this.props);
|
|
15
|
-
}
|
|
16
|
-
componentDidUpdate(prevProps) {
|
|
17
|
-
attachProps(this.componentEl, this.props, prevProps);
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
const { children, forwardedRef, style, className, ref, ...cProps } = this.props;
|
|
21
|
-
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
22
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
23
|
-
const eventName = name.substring(2).toLowerCase();
|
|
24
|
-
if (typeof document !== 'undefined' && isCoveredByReact(eventName, document)) {
|
|
25
|
-
acc[name] = cProps[name];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
acc[name] = cProps[name];
|
|
30
|
-
}
|
|
31
|
-
return acc;
|
|
32
|
-
}, {});
|
|
33
|
-
if (manipulatePropsFunction) {
|
|
34
|
-
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
35
|
-
}
|
|
36
|
-
let newProps = {
|
|
37
|
-
...propsToPass,
|
|
38
|
-
ref: mergeRefs(forwardedRef, this.setComponentElRef),
|
|
39
|
-
style,
|
|
40
|
-
};
|
|
41
|
-
return React.createElement(tagName, newProps, children);
|
|
42
|
-
}
|
|
43
|
-
static get displayName() {
|
|
44
|
-
return displayName;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
48
|
-
if (ReactComponentContext) {
|
|
49
|
-
ReactComponent.contextType = ReactComponentContext;
|
|
50
|
-
}
|
|
51
|
-
return createForwardRef(ReactComponent, displayName);
|
|
52
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createReactComponent } from './createComponent';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { camelToDashCase } from './case';
|
|
2
|
-
export const attachProps = (node, newProps, oldProps = {}) => {
|
|
3
|
-
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
4
|
-
if (node instanceof Element) {
|
|
5
|
-
// add any classes in className to the class list
|
|
6
|
-
const className = getClassName(node.classList, newProps, oldProps);
|
|
7
|
-
if (className !== '') {
|
|
8
|
-
node.className = className;
|
|
9
|
-
}
|
|
10
|
-
Object.keys(newProps).forEach((name) => {
|
|
11
|
-
if (name === 'children' ||
|
|
12
|
-
name === 'style' ||
|
|
13
|
-
name === 'ref' ||
|
|
14
|
-
name === 'class' ||
|
|
15
|
-
name === 'className' ||
|
|
16
|
-
name === 'forwardedRef') {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
20
|
-
const eventName = name.substring(2);
|
|
21
|
-
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
22
|
-
if (typeof document !== 'undefined' && !isCoveredByReact(eventNameLc, document)) {
|
|
23
|
-
syncEvent(node, eventNameLc, newProps[name]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
node[name] = newProps[name];
|
|
28
|
-
const propType = typeof newProps[name];
|
|
29
|
-
if (propType === 'string') {
|
|
30
|
-
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
node[name] = newProps[name];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const getClassName = (classList, newProps, oldProps) => {
|
|
40
|
-
const newClassProp = newProps.className || newProps.class;
|
|
41
|
-
const oldClassProp = oldProps.className || oldProps.class;
|
|
42
|
-
// map the classes to Maps for performance
|
|
43
|
-
const currentClasses = arrayToMap(classList);
|
|
44
|
-
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
45
|
-
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
46
|
-
const finalClassNames = [];
|
|
47
|
-
// loop through each of the current classes on the component
|
|
48
|
-
// to see if it should be a part of the classNames added
|
|
49
|
-
currentClasses.forEach((currentClass) => {
|
|
50
|
-
if (incomingPropClasses.has(currentClass)) {
|
|
51
|
-
// add it as its already included in classnames coming in from newProps
|
|
52
|
-
finalClassNames.push(currentClass);
|
|
53
|
-
incomingPropClasses.delete(currentClass);
|
|
54
|
-
}
|
|
55
|
-
else if (!oldPropClasses.has(currentClass)) {
|
|
56
|
-
// add it as it has NOT been removed by user
|
|
57
|
-
finalClassNames.push(currentClass);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
61
|
-
return finalClassNames.join(' ');
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Checks if an event is supported in the current execution environment.
|
|
65
|
-
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
66
|
-
*/
|
|
67
|
-
export const isCoveredByReact = (eventNameSuffix, doc) => {
|
|
68
|
-
const eventName = `on${eventNameSuffix}`;
|
|
69
|
-
let isSupported = eventName in doc;
|
|
70
|
-
if (!isSupported) {
|
|
71
|
-
const element = doc.createElement('div');
|
|
72
|
-
element.setAttribute(eventName, 'return;');
|
|
73
|
-
isSupported = typeof element[eventName] === 'function';
|
|
74
|
-
}
|
|
75
|
-
return isSupported;
|
|
76
|
-
};
|
|
77
|
-
export const syncEvent = (node, eventName, newEventHandler) => {
|
|
78
|
-
const eventStore = node.__events || (node.__events = {});
|
|
79
|
-
const oldEventHandler = eventStore[eventName];
|
|
80
|
-
// Remove old listener so they don't double up.
|
|
81
|
-
if (oldEventHandler) {
|
|
82
|
-
node.removeEventListener(eventName, oldEventHandler);
|
|
83
|
-
}
|
|
84
|
-
// Bind new listener.
|
|
85
|
-
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
86
|
-
if (newEventHandler) {
|
|
87
|
-
newEventHandler.call(this, e);
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
};
|
|
91
|
-
const arrayToMap = (arr) => {
|
|
92
|
-
const map = new Map();
|
|
93
|
-
arr.forEach((s) => map.set(s, s));
|
|
94
|
-
return map;
|
|
95
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const isDevMode = () => {
|
|
2
|
-
return process && process.env && process.env.NODE_ENV === 'development';
|
|
3
|
-
};
|
|
4
|
-
const warnings = {};
|
|
5
|
-
export const deprecationWarning = (key, message) => {
|
|
6
|
-
if (isDevMode()) {
|
|
7
|
-
if (!warnings[key]) {
|
|
8
|
-
console.warn(message);
|
|
9
|
-
warnings[key] = true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
// The comma in the type is to trick typescript because it things a single generic in a tsx file is jsx
|
|
3
|
-
export const mergeRefs = (...refs) => (value) => refs.forEach((ref) => {
|
|
4
|
-
if (typeof ref === 'function') {
|
|
5
|
-
ref(value);
|
|
6
|
-
}
|
|
7
|
-
else if (ref != null) {
|
|
8
|
-
// This is typed as readonly so we need to allow for override
|
|
9
|
-
ref.current = value;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export const createForwardRef = (ReactComponent, displayName) => {
|
|
13
|
-
const forwardRef = (props, ref) => {
|
|
14
|
-
return React.createElement(ReactComponent, { ...props, forwardedRef: ref });
|
|
15
|
-
};
|
|
16
|
-
forwardRef.displayName = displayName;
|
|
17
|
-
return React.forwardRef(forwardRef);
|
|
18
|
-
};
|
|
19
|
-
export * from './attachProps';
|
|
20
|
-
export * from './case';
|