@epam/ai-dial-modulify-ui 0.42.0-rc.10 → 0.42.0-rc.11
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/index.esm.js +8 -11
- package/package.json +1 -1
- package/src/lib/ComponentBuilder.d.ts +11 -11
- package/src/lib/Inversify.d.ts +9 -13
package/index.esm.js
CHANGED
|
@@ -9401,7 +9401,6 @@ const DATA_CUSTOMIZE_ID = 'data-customize-id';
|
|
|
9401
9401
|
class ComponentBuilder {
|
|
9402
9402
|
constructor(component) {
|
|
9403
9403
|
this.htmlReplacements = {};
|
|
9404
|
-
this.baseComponent = () => null;
|
|
9405
9404
|
this.usedMethods = new Set();
|
|
9406
9405
|
this.stylesFn = () => ({});
|
|
9407
9406
|
this.classNamesFn = () => ({ host: [], component: [] });
|
|
@@ -9462,9 +9461,7 @@ class ComponentBuilder {
|
|
|
9462
9461
|
}
|
|
9463
9462
|
else {
|
|
9464
9463
|
this.htmlReplacements = htmlContentFnOrBlocks;
|
|
9465
|
-
this.htmlContentFn = ((children, state, handlers) =>
|
|
9466
|
-
return this.applyHTMLReplacements(children, state, handlers);
|
|
9467
|
-
});
|
|
9464
|
+
this.htmlContentFn = ((children, state, handlers) => this.applyHTMLReplacements(children, state, handlers));
|
|
9468
9465
|
}
|
|
9469
9466
|
return this;
|
|
9470
9467
|
}
|
|
@@ -9487,8 +9484,8 @@ class ComponentBuilder {
|
|
|
9487
9484
|
return this;
|
|
9488
9485
|
}
|
|
9489
9486
|
build(options = {}) {
|
|
9490
|
-
const
|
|
9491
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
9487
|
+
const BuiltComponent = (props) => {
|
|
9488
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9492
9489
|
const [componentState, setComponentState] = reactExports.useState({});
|
|
9493
9490
|
const classNames = this.useClassNames(componentState);
|
|
9494
9491
|
const handlers = this.useHandlers(componentState, setComponentState);
|
|
@@ -9505,21 +9502,21 @@ class ComponentBuilder {
|
|
|
9505
9502
|
? this.baseComponent(Object.assign({}, props))
|
|
9506
9503
|
: reactExports.createElement(this.baseComponent, Object.assign({}, props)));
|
|
9507
9504
|
const typedReactElement = reactElement;
|
|
9508
|
-
const renderedChildren = reactExports.cloneElement(typedReactElement, Object.assign(Object.assign({}, typedReactElement.props), { className: composeClassNames(typedReactElement.props.className, composedComponentClassNames) }));
|
|
9509
|
-
const Wrapper = composedHostClassNames || Object.keys((
|
|
9505
|
+
const renderedChildren = reactExports.cloneElement(typedReactElement, Object.assign(Object.assign({}, typedReactElement.props), { className: composeClassNames((_e = typedReactElement.props.className) !== null && _e !== void 0 ? _e : '', composedComponentClassNames) }));
|
|
9506
|
+
const Wrapper = composedHostClassNames || Object.keys((_f = handlers.host) !== null && _f !== void 0 ? _f : {}).length
|
|
9510
9507
|
? 'div'
|
|
9511
9508
|
: reactExports.Fragment;
|
|
9512
9509
|
const wrapperProps = Wrapper === 'div'
|
|
9513
9510
|
? Object.assign({ className: composedHostClassNames }, handlers.host) : {};
|
|
9514
|
-
return (jsxRuntimeExports.jsx(Wrapper, Object.assign({}, wrapperProps, { children: (
|
|
9511
|
+
return (jsxRuntimeExports.jsx(Wrapper, Object.assign({}, wrapperProps, { children: (_h = (_g = this.htmlContentFn) === null || _g === void 0 ? void 0 : _g.call(this, renderedChildren, componentState, handlers.component)) !== null && _h !== void 0 ? _h : renderedChildren })));
|
|
9515
9512
|
};
|
|
9516
|
-
Object.defineProperty(
|
|
9513
|
+
Object.defineProperty(BuiltComponent, 'name', {
|
|
9517
9514
|
value: this.baseComponent.name,
|
|
9518
9515
|
writable: false,
|
|
9519
9516
|
configurable: true,
|
|
9520
9517
|
enumerable: false,
|
|
9521
9518
|
});
|
|
9522
|
-
return (options === null || options === void 0 ? void 0 : options.reactMemo) ? reactExports.memo(
|
|
9519
|
+
return (options === null || options === void 0 ? void 0 : options.reactMemo) ? reactExports.memo(BuiltComponent) : BuiltComponent;
|
|
9523
9520
|
}
|
|
9524
9521
|
applyHTMLReplacements(children, state, handlers) {
|
|
9525
9522
|
return reactExports.Children.map(children, (child) => {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@epam/ai-dial-modulify-ui",
|
|
3
3
|
"description": "Modulify Toolkit (UI) for turning a monolith-like project into a modular one",
|
|
4
4
|
"homepage": "https://dialx.ai",
|
|
5
|
-
"version": "0.42.0-rc.
|
|
5
|
+
"version": "0.42.0-rc.11",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bugs": {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DependencyList, Dispatch, EffectCallback, FC,
|
|
1
|
+
import { DependencyList, Dispatch, EffectCallback, FC, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import { Styles } from 'react-jss';
|
|
3
3
|
export declare const DATA_CUSTOMIZE_ID = "data-customize-id";
|
|
4
4
|
export type CB_State = Record<string, unknown>;
|
|
5
|
-
export type
|
|
5
|
+
export type CB_SetState = Dispatch<SetStateAction<CB_State>>;
|
|
6
|
+
export type CB_StateFn = (state: CB_State, setState: CB_SetState) => void;
|
|
6
7
|
export interface CB_Styles {
|
|
7
8
|
host?: Styles;
|
|
8
9
|
component?: Styles;
|
|
@@ -17,36 +18,35 @@ export interface CB_Effect {
|
|
|
17
18
|
effect: EffectCallback;
|
|
18
19
|
dependencies: DependencyList;
|
|
19
20
|
}
|
|
20
|
-
export type CB_EffectsFn = (state?: CB_State, setState?:
|
|
21
|
+
export type CB_EffectsFn = (state?: CB_State, setState?: CB_SetState) => CB_Effect[];
|
|
21
22
|
type CB_HostHandlers = Record<string, (...args: unknown[]) => unknown>;
|
|
22
23
|
type CB_ComponentHandlers = Record<string, (...args: unknown[]) => unknown>;
|
|
23
24
|
export interface CB_Handlers {
|
|
24
25
|
host?: CB_HostHandlers;
|
|
25
26
|
component?: CB_ComponentHandlers;
|
|
26
27
|
}
|
|
27
|
-
export type CB_HandlersFn = (state?: CB_State, setState?:
|
|
28
|
+
export type CB_HandlersFn = (state?: CB_State, setState?: CB_SetState) => CB_Handlers;
|
|
28
29
|
export type CB_HTMLContentFn = (children?: ReactNode | ReactNode[], state?: CB_State, handlers?: CB_Handlers['component']) => ReactNode;
|
|
29
|
-
|
|
30
|
-
export declare class ComponentBuilder<Component extends FC<PropsWithChildren<any>>, BlockIds extends string, Props extends ComponentProps<Component> = ComponentProps<Component>> {
|
|
30
|
+
export declare class ComponentBuilder<P extends object, Component extends FC<P>, BlockIds extends string = never> {
|
|
31
31
|
private htmlReplacements;
|
|
32
|
+
private readonly baseComponent;
|
|
32
33
|
private constructor();
|
|
33
|
-
static use<
|
|
34
|
+
static use<BlockIds extends string = never, P extends object = object>(component: FC<P>): ComponentBuilder<P, FC<P>, BlockIds>;
|
|
34
35
|
updateClassNames(updateFn: (classNames: CB_ClassNames, state?: CB_State) => CB_ClassNames): this;
|
|
35
36
|
updateStyles(updateFn: (css: CB_Styles, state?: CB_State) => CB_Styles): this;
|
|
36
37
|
updateHTML(htmlContentFnOrBlocks: CB_HTMLContentFn | Partial<Record<BlockIds, CB_HTMLContentFn>>): this;
|
|
37
|
-
updateHandlers(updateFn: (handlers: CB_Handlers, state?: CB_State, setState?:
|
|
38
|
+
updateHandlers(updateFn: (handlers: CB_Handlers, state?: CB_State, setState?: CB_SetState) => CB_Handlers): this;
|
|
38
39
|
addState(stateFn: CB_StateFn): this;
|
|
39
40
|
addEffects(effectsFn: CB_EffectsFn): this;
|
|
40
41
|
build(options?: {
|
|
41
42
|
reactMemo?: boolean;
|
|
42
|
-
}):
|
|
43
|
-
private readonly baseComponent;
|
|
43
|
+
}): FC<P> | import("react").NamedExoticComponent<P>;
|
|
44
44
|
private usedMethods;
|
|
45
45
|
private stylesFn;
|
|
46
46
|
private classNamesFn;
|
|
47
47
|
private htmlContentFn;
|
|
48
48
|
private handlersFn;
|
|
49
|
-
private stateFn
|
|
49
|
+
private stateFn?;
|
|
50
50
|
private effectsFn;
|
|
51
51
|
private useClassNames;
|
|
52
52
|
private useStyles;
|
package/src/lib/Inversify.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type ComponentImplementation<OC extends OriginalComponent> = FC<ComponentProps<OC>>;
|
|
6
|
-
interface ComponentResolve<OC extends OriginalComponent> {
|
|
7
|
-
instance: () => ComponentImplementation<OC> | undefined;
|
|
8
|
-
bind: (componentFactory: (component: OC) => ComponentImplementation<OC>) => ComponentImplementation<OC>;
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface ComponentResolve<P extends object> {
|
|
3
|
+
instance: () => FC<P> | undefined;
|
|
4
|
+
bind: (componentFactory: (component: FC<P>) => FC<P>) => FC<P>;
|
|
9
5
|
unbind: () => void;
|
|
10
|
-
render: () =>
|
|
11
|
-
original:
|
|
6
|
+
render: () => FC<P> & {
|
|
7
|
+
original: FC<P>;
|
|
12
8
|
};
|
|
13
9
|
}
|
|
14
10
|
export declare class Inversify {
|
|
15
11
|
private static container;
|
|
16
|
-
static register<
|
|
17
|
-
original:
|
|
12
|
+
static register<P extends object>(name: string, component: FC<P>): FC<P> & {
|
|
13
|
+
original: FC<P>;
|
|
18
14
|
};
|
|
19
|
-
static resolve<
|
|
15
|
+
static resolve<P extends object>(component: FC<P>): ComponentResolve<P>;
|
|
20
16
|
private static bindImplementation;
|
|
21
17
|
private static renderImplementation;
|
|
22
18
|
}
|