web-component-wrapper 0.0.599 → 0.0.600

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/dist/type.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import { Mapping, TemplateFunction, UTILITY_SCOPE, ValueOf } from 'clientnode';
2
+ import PropertyTypes, { ValidationMap } from 'clientnode/property-types';
3
+ import React, { ComponentType as ReactComponentType, HTMLAttributes, ReactElement } from 'react';
4
+ import Web from './Web';
5
+ export interface RenderState {
6
+ promise: Promise<string>;
7
+ pending: boolean;
8
+ resolve: (reason: string) => void;
9
+ }
10
+ export interface CompilerOptions {
11
+ filter?: (domNode: Node) => boolean;
12
+ ignoreComponents?: boolean;
13
+ ignoreNestedComponents?: boolean;
14
+ unsafe?: boolean;
15
+ }
16
+ export interface CompiledDomNodeTemplateItem {
17
+ domNode: Node;
18
+ children: Array<CompiledDomNodeTemplateItem>;
19
+ error?: null | string;
20
+ scopeNames?: Array<string>;
21
+ template?: string;
22
+ templateFunction?: TemplateFunction;
23
+ }
24
+ export type DomNodeToCompiledTemplateMap<NodeType = Node> = Map<NodeType, CompiledDomNodeTemplateItem>;
25
+ export type EventCallbackMapping = Map<string, () => void>;
26
+ export type EventMapping<ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>> = (null | [
27
+ Partial<ExternalProperties>,
28
+ Partial<InternalProperties>
29
+ ] | Partial<ExternalProperties>);
30
+ export type EventMapper<E extends Mapping<unknown> = Mapping<unknown>, I extends Mapping<unknown> = Mapping<unknown>, P extends Array<unknown> = Array<unknown>> = (...parameters: P) => EventMapping<E, I> | Promise<EventMapping<E, I>>;
31
+ export type EventToPropertyMapping<E extends Mapping<unknown> = Mapping<unknown>, I extends Mapping<unknown> = Mapping<unknown>, P extends Array<unknown> = Array<unknown>> = Mapping<true | EventMapper<E, I, P>>;
32
+ export type PropertyType = string | ValueOf<typeof PropertyTypes>;
33
+ export type PropertyConfiguration = PropertyType;
34
+ export type ValidationMapping = ValidationMap<ValueOf<typeof PropertyTypes>>;
35
+ export type PropertiesValidationMap = Mapping<ValueOf<typeof PropertyTypes>>;
36
+ export type PropertiesConfiguration = Mapping | PropertiesValidationMap;
37
+ export type NormalizedAttributesReflectionConfiguration = Map<string, PropertyConfiguration>;
38
+ export type AttributesReflectionConfiguration = (string | Array<string> | PropertiesConfiguration | NormalizedAttributesReflectionConfiguration);
39
+ export type ReadonlyScope = typeof UTILITY_SCOPE;
40
+ export type Scope = {
41
+ -readonly [key in keyof ReadonlyScope]: ReadonlyScope[key];
42
+ };
43
+ export type CallbackScope<Type = unknown> = Scope & {
44
+ data: Type;
45
+ event: Type;
46
+ firstArgument: Type;
47
+ firstParameter: Type;
48
+ options: Type;
49
+ parameters: Type;
50
+ scope: CallbackScope<Type>;
51
+ };
52
+ export type ScopeDeclaration = Array<string> | Mapping<unknown>;
53
+ export interface PreCompiledItem {
54
+ originalScopeNames: Array<string>;
55
+ templateFunction: TemplateFunction;
56
+ }
57
+ export type ReactComponentBaseProperties<TElement = HTMLElement> = Mapping<unknown> & {
58
+ children?: Array<React.ReactNode> | React.ReactNode;
59
+ dangerouslySetInnerHTML?: HTMLAttributes<TElement>['dangerouslySetInnerHTML'];
60
+ key?: string;
61
+ ref?: (null | {
62
+ current?: ComponentAdapter;
63
+ } | ((reference: ComponentAdapter) => void));
64
+ };
65
+ export type ReactRenderBaseItemFactory = (scope: Mapping<unknown>) => ReactRenderBaseItem;
66
+ export type ReactRenderItemFactory = (scope: Mapping<unknown>) => ReactRenderItem;
67
+ export type ReactRenderItemsFactory = Array<ReactRenderItemFactory> | ReactRenderItemFactory;
68
+ export type ReactRenderBaseItem = ReactElement | string | null;
69
+ export type ReactRenderItem = ((...parameters: Array<unknown>) => ReactRenderBaseItem) | ReactRenderBaseItem;
70
+ export type ReactRenderItems = Array<ReactRenderItem> | ReactRenderItem;
71
+ export interface WebComponentConfiguration<ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, EventParameters extends Array<unknown> = Array<unknown>> {
72
+ attachWebComponentAdapterIfNotExists?: boolean;
73
+ controllableProperties?: Array<string>;
74
+ eventToPropertyMapping?: (EventToPropertyMapping<ExternalProperties, InternalProperties, EventParameters> | null);
75
+ internalProperties?: InternalProperties;
76
+ propertiesToReflectAsAttributes?: AttributesReflectionConfiguration;
77
+ propertyAliases?: Mapping;
78
+ propTypes?: PropertiesConfiguration;
79
+ renderProperties?: Array<string>;
80
+ unmountOnDisconnect?: boolean;
81
+ }
82
+ export interface StaticWebComponent<ComponentType = unknown, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, EventParameters extends Array<unknown> = Array<unknown>> extends WebComponentConfiguration<ExternalProperties, InternalProperties, EventParameters> {
83
+ webComponentAdapterWrapped?: string;
84
+ wrapped?: ComponentType;
85
+ _name?: string;
86
+ ___types?: {
87
+ name?: {
88
+ name?: string;
89
+ };
90
+ };
91
+ }
92
+ export type ComponentType<PropertyTypes = Mapping<unknown>> = Omit<ReactComponentType<PropertyTypes>, 'propTypes'> & StaticWebComponent;
93
+ export interface ComponentAdapter<Properties = Mapping<unknown>, State = Mapping<unknown>> {
94
+ properties?: Properties;
95
+ state?: State;
96
+ }
97
+ export interface WebComponentAPI<TElement = HTMLElement, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, Type extends typeof Web<TElement, ExternalProperties, InternalProperties> = typeof Web<TElement, ExternalProperties, InternalProperties>> {
98
+ component: Type;
99
+ register: (tagName?: string) => void;
100
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-wrapper",
3
- "version": "0.0.599",
3
+ "version": "0.0.600",
4
4
  "description": "Generic web-component base class and framework specific wrapper.",
5
5
  "keywords": [
6
6
  "component",
@@ -24,6 +24,20 @@
24
24
  "url": "https://torben.website"
25
25
  },
26
26
  "main": "dist/index.js",
27
+ "exports": {
28
+ ".": "./dist/index.js",
29
+ "./decorator": "./dist/decorator.js",
30
+ "./ReactWeb": "./dist/ReactWeb.js",
31
+ "./Web": "./dist/Web.js",
32
+ "./type": "./dist/type.js"
33
+ },
34
+ "typesVersions": {
35
+ "*": {
36
+ "type": [
37
+ "./dist/type.d.ts"
38
+ ]
39
+ }
40
+ },
27
41
  "files": [
28
42
  "dist"
29
43
  ],
@@ -68,7 +82,7 @@
68
82
  "@typescript-eslint/eslint-plugin": "^8.61.0",
69
83
  "@typescript-eslint/parser": "^8.61.0",
70
84
  "@webcomponents/webcomponentsjs": "^2.8.0",
71
- "clientnode": "^4.0.1422",
85
+ "clientnode": "^4.0.1423",
72
86
  "eslint": "^10.5.0",
73
87
  "eslint-config-google": "^0.14.0",
74
88
  "eslint-plugin-jsdoc": "^63.0.2",
@@ -78,7 +92,7 @@
78
92
  "react": "^19.2.7",
79
93
  "react-dom": "^19.2.7",
80
94
  "typescript-eslint": "^8.61.0",
81
- "web-documentation": "^1.0.37",
95
+ "web-documentation": "^1.0.38",
82
96
  "weboptimizer": "^3.0.24",
83
97
  "webpack-dev-server": "^5.2.5"
84
98
  },