web-component-wrapper 0.0.338 → 0.0.339
Sign up to get free protection for your applications and to get access to all the features.
- package/React.d.ts +12 -5
- package/Web.d.ts +7 -7
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/type.d.ts +6 -6
package/React.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Mapping } from 'clientnode/type';
|
2
|
-
import React from 'react';
|
2
|
+
import React, { HTMLAttributes } from 'react';
|
3
3
|
import Web from './Web';
|
4
|
-
import { ComponentType, ReactRenderItemFactory, ReactRenderItemsFactory, ReactRenderItems, WebComponentAPI } from './type';
|
4
|
+
import { ComponentAdapter, ComponentType, ReactRenderItemFactory, ReactRenderItemsFactory, ReactRenderItems, WebComponentAPI } from './type';
|
5
5
|
/**
|
6
6
|
* Adapter for exposing a react component as web-component.
|
7
7
|
* @property static:attachWebComponentAdapterIfNotExists - Indicates whether to
|
@@ -18,7 +18,14 @@ import { ComponentType, ReactRenderItemFactory, ReactRenderItemsFactory, ReactRe
|
|
18
18
|
* reacts memorizing wrapper to cache component render results.
|
19
19
|
* @property isWrapped - Indicates whether react component is wrapped already.
|
20
20
|
*/
|
21
|
-
export declare class ReactWeb<TElement = HTMLElement> extends
|
21
|
+
export declare class ReactWeb<TElement = HTMLElement, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> & {
|
22
|
+
children?: Array<React.ReactNode> | React.ReactNode;
|
23
|
+
dangerouslySetInnerHTML?: HTMLAttributes<TElement>['dangerouslySetInnerHTML'];
|
24
|
+
key?: string;
|
25
|
+
ref?: null | {
|
26
|
+
current?: ComponentAdapter;
|
27
|
+
};
|
28
|
+
} = Mapping<unknown>> extends Web<TElement, ExternalProperties, InternalProperties> {
|
22
29
|
static attachWebComponentAdapterIfNotExists: boolean;
|
23
30
|
static content: ComponentType | string;
|
24
31
|
static react: typeof React;
|
@@ -51,7 +58,7 @@ export declare class ReactWeb<TElement = HTMLElement> extends Web<TElement> {
|
|
51
58
|
*
|
52
59
|
* @returns Nothing.
|
53
60
|
*/
|
54
|
-
reflectExternalProperties(properties:
|
61
|
+
reflectExternalProperties(properties: ExternalProperties): void;
|
55
62
|
/**
|
56
63
|
* Method which does the rendering job. Should be called when ever state
|
57
64
|
* changes should be projected to the hosts dom content.
|
@@ -167,7 +174,7 @@ export declare class ReactWeb<TElement = HTMLElement> extends Web<TElement> {
|
|
167
174
|
*
|
168
175
|
* @returns Nothing.
|
169
176
|
*/
|
170
|
-
prepareProperties(properties:
|
177
|
+
prepareProperties(properties: InternalProperties): void;
|
171
178
|
/**
|
172
179
|
* Updates current component instance and reflects newly determined
|
173
180
|
* properties.
|
package/Web.d.ts
CHANGED
@@ -96,7 +96,7 @@ import { AttributesReflectionConfiguration, CompiledDomNodeTemplate, ComponentAd
|
|
96
96
|
*
|
97
97
|
* @property slots - Grabbed slots which where present in the connecting phase.
|
98
98
|
*/
|
99
|
-
export declare class Web<TElement = HTMLElement> extends HTMLElement {
|
99
|
+
export declare class Web<TElement = HTMLElement, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>> extends HTMLElement {
|
100
100
|
static applyRootBinding: boolean;
|
101
101
|
static content: unknown;
|
102
102
|
static determineRootBinding: boolean;
|
@@ -130,15 +130,15 @@ export declare class Web<TElement = HTMLElement> extends HTMLElement {
|
|
130
130
|
scope: Mapping<unknown>;
|
131
131
|
domNodeEventBindings: Map<Node, EventCallbackMapping>;
|
132
132
|
domNodeTemplateCache: CompiledDomNodeTemplate;
|
133
|
-
externalProperties:
|
133
|
+
externalProperties: ExternalProperties;
|
134
134
|
ignoreAttributeUpdateObservations: boolean;
|
135
|
-
internalProperties:
|
135
|
+
internalProperties: InternalProperties;
|
136
136
|
outputEventNames: Set<string>;
|
137
137
|
instance: null | {
|
138
138
|
current?: ComponentAdapter;
|
139
139
|
};
|
140
140
|
isRoot: boolean;
|
141
|
-
root: ShadowRoot | Web<TElement>;
|
141
|
+
root: ShadowRoot | Web<TElement, ExternalProperties, InternalProperties>;
|
142
142
|
runDomConnectionAndRenderingInSameEventQueue: boolean;
|
143
143
|
readonly self: typeof Web;
|
144
144
|
slots: Mapping<HTMLElement> & {
|
@@ -417,7 +417,7 @@ export declare class Web<TElement = HTMLElement> extends HTMLElement {
|
|
417
417
|
*
|
418
418
|
* @returns Nothing.
|
419
419
|
*/
|
420
|
-
reflectExternalProperties(properties:
|
420
|
+
reflectExternalProperties(properties: ExternalProperties): void;
|
421
421
|
/**
|
422
422
|
* Reflects wrapped component state back to web-component's attributes and
|
423
423
|
* properties.
|
@@ -425,7 +425,7 @@ export declare class Web<TElement = HTMLElement> extends HTMLElement {
|
|
425
425
|
*
|
426
426
|
* @returns Nothing.
|
427
427
|
*/
|
428
|
-
reflectProperties(properties:
|
428
|
+
reflectProperties(properties: ExternalProperties): void;
|
429
429
|
/**
|
430
430
|
* Triggers a new rendering cycle by respecting batch configuration.
|
431
431
|
* @param reason - A description why rendering should be triggered.
|
@@ -441,7 +441,7 @@ export declare class Web<TElement = HTMLElement> extends HTMLElement {
|
|
441
441
|
*
|
442
442
|
* @returns Mapped properties or null if nothing could be mapped.
|
443
443
|
*/
|
444
|
-
reflectEventToProperties(name: string, parameters: Array<unknown>):
|
444
|
+
reflectEventToProperties(name: string, parameters: Array<unknown>): ExternalProperties | null;
|
445
445
|
/**
|
446
446
|
* Evaluates given property value depending on its type specification and
|
447
447
|
* registers in properties mapping object.
|
package/index.d.ts
CHANGED
@@ -15,5 +15,5 @@ export declare const Web: typeof WebImport;
|
|
15
15
|
*
|
16
16
|
* @returns Generated object to register and retrieve generated web component.
|
17
17
|
*/
|
18
|
-
export declare const wrapAsWebComponent: <Type extends ComponentType = ComponentType,
|
18
|
+
export declare const wrapAsWebComponent: <Type extends ComponentType = ComponentType, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, AdditionalEventToPropertyMapping = unknown>(component: Type, nameHint?: string, configuration?: WebComponentConfiguration<ExternalProperties, InternalProperties, AdditionalEventToPropertyMapping>) => WebComponentAPI;
|
19
19
|
export default wrapAsWebComponent;
|
package/package.json
CHANGED
package/type.d.ts
CHANGED
@@ -11,9 +11,9 @@ export declare type CompiledDomNodeTemplateItem = {
|
|
11
11
|
};
|
12
12
|
export declare type CompiledDomNodeTemplate<NodeType = Node> = Map<NodeType, CompiledDomNodeTemplateItem>;
|
13
13
|
export declare type EventCallbackMapping = Map<string, () => void>;
|
14
|
-
export declare type EventMapping<
|
15
|
-
export declare type EventMapper<E = Mapping<unknown>, I = Mapping<unknown>> = (...
|
16
|
-
export declare type EventToPropertyMapping<E = Mapping<unknown>, I = Mapping<unknown
|
14
|
+
export declare type EventMapping<ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>> = [ExternalProperties, InternalProperties] | ExternalProperties;
|
15
|
+
export declare type EventMapper<E extends Mapping<unknown> = Mapping<unknown>, I extends Mapping<unknown> = Mapping<unknown>> = (..._parameters: Array<unknown>) => EventMapping<E, I>;
|
16
|
+
export declare type EventToPropertyMapping<E extends Mapping<unknown> = Mapping<unknown>, I extends Mapping<unknown> = Mapping<unknown>, A = unknown> = A & Mapping<true | EventMapper<E, I>>;
|
17
17
|
export declare type AttributesReflectionConfiguration = Array<string> | Map<string, string | ValueOf<typeof PropertyTypes>> | string | Mapping<ValueOf<typeof PropertyTypes> | string>;
|
18
18
|
export declare type ScopeDeclaration = Array<string> | Mapping<unknown>;
|
19
19
|
export declare type PreCompiledItem = {
|
@@ -26,11 +26,11 @@ export declare type ReactRenderItemsFactory = Array<ReactRenderItemFactory> | Re
|
|
26
26
|
export declare type ReactRenderBaseItem = ReactElement | string | null;
|
27
27
|
export declare type ReactRenderItem = ((..._parameters: Array<unknown>) => ReactRenderBaseItem) | ReactRenderBaseItem;
|
28
28
|
export declare type ReactRenderItems = Array<ReactRenderItem> | ReactRenderItem;
|
29
|
-
export interface WebComponentConfiguration<
|
29
|
+
export interface WebComponentConfiguration<ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, AdditionalEventToPropertyMapping = unknown> {
|
30
30
|
attachWebComponentAdapterIfNotExists?: boolean;
|
31
31
|
controllableProperties?: Array<string>;
|
32
|
-
eventToPropertyMapping?: EventToPropertyMapping<
|
33
|
-
internalProperties?:
|
32
|
+
eventToPropertyMapping?: EventToPropertyMapping<ExternalProperties, InternalProperties, AdditionalEventToPropertyMapping>;
|
33
|
+
internalProperties?: InternalProperties;
|
34
34
|
propertiesToReflectAsAttributes?: AttributesReflectionConfiguration;
|
35
35
|
propertyAliases?: Mapping;
|
36
36
|
propTypes?: Mapping<ValueOf<typeof PropertyTypes>>;
|