@semcore/core 1.11.2 → 1.11.5
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/CHANGELOG.md +18 -0
- package/lib/cjs/Component.js +3 -2
- package/lib/cjs/Component.js.map +1 -1
- package/lib/cjs/enhancement/Children.js +7 -4
- package/lib/cjs/enhancement/Children.js.map +1 -1
- package/lib/cjs/enhancement/Root.js +9 -6
- package/lib/cjs/enhancement/Root.js.map +1 -1
- package/lib/cjs/enhancement/dataName.js +2 -2
- package/lib/cjs/enhancement/hoistProps.js +2 -2
- package/lib/cjs/enhancement/hoistProps.js.map +1 -1
- package/lib/cjs/enhancement/staticChildren.js +3 -3
- package/lib/cjs/enhancement/staticChildren.js.map +1 -1
- package/lib/cjs/enhancement/style.js +7 -4
- package/lib/cjs/enhancement/style.js.map +1 -1
- package/lib/cjs/enhancement/uncontrolledProps.js +2 -2
- package/lib/cjs/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/cjs/index.js +29 -29
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/styled/index.js +11 -7
- package/lib/cjs/styled/sstyled.js +4 -6
- package/lib/cjs/styled/sstyled.js.map +1 -1
- package/lib/es6/Component.js +1 -1
- package/lib/es6/Component.js.map +1 -1
- package/lib/es6/enhancement/Children.js +6 -4
- package/lib/es6/enhancement/Children.js.map +1 -1
- package/lib/es6/enhancement/Root.js +8 -6
- package/lib/es6/enhancement/Root.js.map +1 -1
- package/lib/es6/enhancement/dataName.js +2 -2
- package/lib/es6/enhancement/hoistProps.js +2 -2
- package/lib/es6/enhancement/hoistProps.js.map +1 -1
- package/lib/es6/enhancement/staticChildren.js +3 -3
- package/lib/es6/enhancement/staticChildren.js.map +1 -1
- package/lib/es6/enhancement/style.js +6 -4
- package/lib/es6/enhancement/style.js.map +1 -1
- package/lib/es6/enhancement/uncontrolledProps.js +2 -2
- package/lib/es6/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/es6/index.js +13 -11
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/styled/sstyled.js +4 -6
- package/lib/es6/styled/sstyled.js.map +1 -1
- package/lib/types/Component.d.ts +7 -1
- package/lib/types/index.d.ts +2 -2
- package/package.json +11 -3
- package/src/Component.tsx +18 -5
- package/src/enhancement/Root.tsx +1 -1
- package/src/enhancement/staticChildren.tsx +1 -1
- package/src/index.tsx +15 -20
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/core",
|
|
3
3
|
"description": "SEMRush Core Component",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.5",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -15,12 +15,20 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@semcore/utils": "^3.29",
|
|
17
17
|
"@reshadow/core": "0.0.1-alpha.74",
|
|
18
|
-
"hoist-non-react-statics": "
|
|
18
|
+
"hoist-non-react-statics": "3.3.2"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "16.8 - 17"
|
|
22
22
|
},
|
|
23
23
|
"jest": {
|
|
24
|
-
"preset": "jest-preset-ui"
|
|
24
|
+
"preset": "@semcore/jest-preset-ui"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/semrush/intergalactic.git",
|
|
29
|
+
"directory": "semcore/core"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@semcore/jest-preset-ui": "1.0.0"
|
|
25
33
|
}
|
|
26
34
|
}
|
package/src/Component.tsx
CHANGED
|
@@ -76,11 +76,10 @@ declare const Root: Root;
|
|
|
76
76
|
|
|
77
77
|
export { Root };
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
Props
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
> extends PureComponent<Props & IRootComponentProps<Props, Context>, State> {
|
|
79
|
+
abstract class RootComponent<Props = {}, Context = {}, State = {}> extends PureComponent<
|
|
80
|
+
Props & IRootComponentProps<Props, Context>,
|
|
81
|
+
State
|
|
82
|
+
> {
|
|
84
83
|
get handlers(): Readonly<IRootComponentHandlers> {
|
|
85
84
|
return {};
|
|
86
85
|
}
|
|
@@ -93,3 +92,17 @@ export default abstract class RootComponent<
|
|
|
93
92
|
|
|
94
93
|
Root: Root;
|
|
95
94
|
}
|
|
95
|
+
|
|
96
|
+
export const Component = RootComponent;
|
|
97
|
+
export type Component<
|
|
98
|
+
Props = {},
|
|
99
|
+
Context = {},
|
|
100
|
+
State = {},
|
|
101
|
+
Handlers extends IRootComponentHandlers = IRootComponentHandlers,
|
|
102
|
+
> = React.ComponentClass<Props, State> & {
|
|
103
|
+
handlers: Readonly<Handlers>;
|
|
104
|
+
|
|
105
|
+
asProps: Readonly<Merge<Props & IRootComponentProps<Props, Context>, AllHTMLAttributes<any>>>;
|
|
106
|
+
|
|
107
|
+
Root: Root;
|
|
108
|
+
};
|
package/src/enhancement/Root.tsx
CHANGED
|
@@ -52,7 +52,7 @@ function Enhancement(childComponents, createComponent, options) {
|
|
|
52
52
|
const selfGetterMethod = getterMethodNameByDisplayName(WrapperComponent.displayName);
|
|
53
53
|
logger.warn(
|
|
54
54
|
true,
|
|
55
|
-
|
|
55
|
+
`Getter \`${selfGetterMethod}\` can't be fired as it is a getter of static component`,
|
|
56
56
|
props['data-ui-name'] || WrapperComponent.displayName,
|
|
57
57
|
);
|
|
58
58
|
};
|
package/src/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import useEnhancedEffect from '@semcore/utils/lib/use/useEnhancedEffect';
|
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
import _assignProps from '@semcore/utils/lib/assignProps';
|
|
9
9
|
|
|
10
|
-
import Component,
|
|
10
|
+
import { Component, PropsWithRenderFnChildren } from './Component';
|
|
11
11
|
import register from './register';
|
|
12
12
|
|
|
13
13
|
import childrenEnhancement, { CHILDREN_COMPONENT } from './enhancement/Children';
|
|
@@ -132,7 +132,7 @@ function wrapClass(OriginComponent, enhancements, Context) {
|
|
|
132
132
|
this[CORE_AS_PROPS] = null;
|
|
133
133
|
// TODO if not production
|
|
134
134
|
if (!super.render) {
|
|
135
|
-
throw new Error('
|
|
135
|
+
throw new Error('Component `render` method is not defined');
|
|
136
136
|
}
|
|
137
137
|
const asProps = this.asProps;
|
|
138
138
|
const ctx = this.setContext();
|
|
@@ -246,26 +246,22 @@ export type ComponentType<
|
|
|
246
246
|
ChildComponentProps = {},
|
|
247
247
|
ContextType = {},
|
|
248
248
|
UCProps = {},
|
|
249
|
-
FNType = null
|
|
249
|
+
FNType = null,
|
|
250
250
|
> = (FNType extends null
|
|
251
251
|
? ForwardRefComponent<ComponentProps, ContextType, UCProps>
|
|
252
|
-
: FNType & { displayName: string }) &
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
ChildComponentProps,
|
|
264
|
-
ContextType,
|
|
265
|
-
UCProps
|
|
266
|
-
>;
|
|
267
|
-
};
|
|
252
|
+
: FNType & { displayName: string }) & {
|
|
253
|
+
[K in keyof ChildComponentProps]: ComponentOrProps<ChildComponentProps[K], ContextType, UCProps>;
|
|
254
|
+
} & {
|
|
255
|
+
[CORE_COMPONENT]: boolean;
|
|
256
|
+
[CREATE_COMPONENT]: () => ComponentType<
|
|
257
|
+
ComponentProps,
|
|
258
|
+
ChildComponentProps,
|
|
259
|
+
ContextType,
|
|
260
|
+
UCProps
|
|
261
|
+
>;
|
|
262
|
+
};
|
|
268
263
|
|
|
264
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
269
265
|
interface ClassWithUncontrolledProps<Props> {
|
|
270
266
|
uncontrolledProps(): unknown;
|
|
271
267
|
}
|
|
@@ -372,7 +368,6 @@ export * from './styled';
|
|
|
372
368
|
export * from './register';
|
|
373
369
|
export {
|
|
374
370
|
createBaseComponent,
|
|
375
|
-
Component,
|
|
376
371
|
register,
|
|
377
372
|
CREATE_COMPONENT,
|
|
378
373
|
CORE_INSTANCE,
|