ngx-reactify 0.1.5 → 0.1.6
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.
|
@@ -137,14 +137,6 @@ function WrapAngularComponentInReact({ component, ngZone, appRef, injector, prop
|
|
|
137
137
|
// Is there a better way to do this?
|
|
138
138
|
let subscriptions;
|
|
139
139
|
let componentInstance;
|
|
140
|
-
React.useEffect(() => {
|
|
141
|
-
return () => {
|
|
142
|
-
// Cleanup and dispose leftover Angular objects
|
|
143
|
-
appRef?.detachView(componentInstance.hostView);
|
|
144
|
-
subscriptions?.forEach(s => s?.unsubscribe());
|
|
145
|
-
componentInstance?.destroy();
|
|
146
|
-
};
|
|
147
|
-
}, []);
|
|
148
140
|
const tripChangeDetection = () => componentInstance?.changeDetectorRef?.detectChanges();
|
|
149
141
|
// These attributes will trigger change detection when they fire from
|
|
150
142
|
// the underlying React element.
|
|
@@ -155,11 +147,16 @@ function WrapAngularComponentInReact({ component, ngZone, appRef, injector, prop
|
|
|
155
147
|
return reactTemplate(React.createElement(containerTag, {
|
|
156
148
|
...attrObj,
|
|
157
149
|
ref: async (node) => {
|
|
150
|
+
// When the node is empty, we can safely clean up the angular instance
|
|
151
|
+
// and detach views.
|
|
152
|
+
if (!node) {
|
|
153
|
+
// Cleanup and dispose leftover Angular objects
|
|
154
|
+
appRef?.detachView(componentInstance.hostView);
|
|
155
|
+
subscriptions?.forEach(s => s?.unsubscribe());
|
|
156
|
+
componentInstance?.destroy();
|
|
157
|
+
}
|
|
158
158
|
if (componentInstance)
|
|
159
159
|
return;
|
|
160
|
-
// Not sure if this ever actually happens, added as a preventative measure
|
|
161
|
-
// to memory leaks.
|
|
162
|
-
subscriptions?.forEach(s => s?.unsubscribe());
|
|
163
160
|
const bootstrap = () => {
|
|
164
161
|
// Init the Angular component with the context of the root Angular app.
|
|
165
162
|
componentInstance = createComponent(component, {
|
|
@@ -170,6 +167,7 @@ function WrapAngularComponentInReact({ component, ngZone, appRef, injector, prop
|
|
|
170
167
|
});
|
|
171
168
|
appRef.attachView(componentInstance.hostView);
|
|
172
169
|
};
|
|
170
|
+
// Bootstrap in the Angular zone if it's provided
|
|
173
171
|
ngZone?.runTask
|
|
174
172
|
? ngZone?.runTask(bootstrap)
|
|
175
173
|
: bootstrap();
|
|
@@ -214,47 +212,82 @@ const AutoWrapAngularObject = ({ component, appRef, ngZone, instance, injector,
|
|
|
214
212
|
reactTemplate
|
|
215
213
|
});
|
|
216
214
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
function
|
|
215
|
+
function ReactifyStandaloneAngularComponent(component, providers = [], containerTag = 'div', debug = false) {
|
|
216
|
+
return React.memo((props) => {
|
|
217
|
+
return ReactifyStandaloneAngularElement(component, props, providers, containerTag, debug);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function ReactifyStandaloneAngularElement(component, props = {}, providers = [], containerTag = 'div', debug = false) {
|
|
221
|
+
if (debug) {
|
|
222
|
+
console.info(`[ngx-reactify/${containerTag}]: Begin render`, { args: { component, props, providers, containerTag } });
|
|
223
|
+
}
|
|
224
|
+
// Preserve React execution context
|
|
223
225
|
const ctx = this;
|
|
224
|
-
// Is there a better way to do this?
|
|
225
226
|
let subscriptions;
|
|
226
227
|
let app;
|
|
228
|
+
// The Angular component instance
|
|
229
|
+
let instance;
|
|
230
|
+
let containerNode = document.createElement("ngx-container");
|
|
231
|
+
const attachProperties = () => {
|
|
232
|
+
subscriptions?.forEach(s => s.unsubscribe());
|
|
233
|
+
subscriptions = [];
|
|
234
|
+
Object.keys(props).filter((k) => {
|
|
235
|
+
// If the property is being passed in as a bound dispatchState, we'll
|
|
236
|
+
// handle it as a eventEmitter on Angular's side.
|
|
237
|
+
if (props[k].name == 'bound dispatchSetState') {
|
|
238
|
+
subscriptions.push(instance[k]?.subscribe(evt => props[k].call(ctx, evt)));
|
|
239
|
+
}
|
|
240
|
+
// else if (v instanceof EventEmitter) {
|
|
241
|
+
// subscriptions.push(
|
|
242
|
+
// instance[k]?.subscribe(evt => props[k].call(ctx, evt))
|
|
243
|
+
// );
|
|
244
|
+
// }
|
|
245
|
+
else {
|
|
246
|
+
instance[k] = props[k];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
};
|
|
227
250
|
React.useEffect(() => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
};
|
|
233
|
-
}, []);
|
|
251
|
+
if (!instance)
|
|
252
|
+
return;
|
|
253
|
+
attachProperties();
|
|
254
|
+
});
|
|
234
255
|
return React.createElement(containerTag, {
|
|
235
256
|
ref: async (node) => {
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
257
|
+
// If the node is removed, we need to cleanup
|
|
258
|
+
if (!node) {
|
|
259
|
+
if (debug) {
|
|
260
|
+
console.info(`[ngx-reactify/${containerTag}]: Dispose`, { args: { component, props, providers, containerTag } });
|
|
261
|
+
}
|
|
262
|
+
subscriptions?.forEach(s => s?.unsubscribe());
|
|
263
|
+
app?.destroy();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (debug) {
|
|
267
|
+
console.info(`[ngx-reactify/${containerTag}]: NG Bootstrap`, { args: { component, props, providers, containerTag } });
|
|
268
|
+
}
|
|
269
|
+
node.append(containerNode);
|
|
240
270
|
// Init an Angular application root & bootstrap it to a DOM element.
|
|
241
271
|
app = await createApplication({ providers });
|
|
242
|
-
|
|
243
|
-
|
|
272
|
+
if (debug) {
|
|
273
|
+
console.info(`[ngx-reactify/${containerTag}]: NG App Created`, { args: { component, props, providers, containerTag } });
|
|
274
|
+
}
|
|
275
|
+
const base = app.bootstrap(component, containerNode);
|
|
276
|
+
instance = base.instance;
|
|
277
|
+
if (debug) {
|
|
278
|
+
console.info(`[ngx-reactify/${containerTag}]: NG Bootstrapped`, { args: { component, props, providers, containerTag } });
|
|
279
|
+
}
|
|
244
280
|
// Wait for the JS to finish rendering and initing.
|
|
245
281
|
await firstValueFrom(app.isStable);
|
|
282
|
+
if (debug) {
|
|
283
|
+
console.info(`[ngx-reactify/${containerTag}]: NG Stable`, { args: { component, props, providers, containerTag } });
|
|
284
|
+
}
|
|
246
285
|
// Now that everything has settled, bind inputs and outputs.
|
|
247
|
-
|
|
248
|
-
Object.entries(props).filter(([k, v]) => {
|
|
249
|
-
// @Outputs are always Event Emitters (I think)
|
|
250
|
-
if (v instanceof EventEmitter) {
|
|
251
|
-
subscriptions.push(instance[k]?.subscribe(evt => props[k].call(ctx, evt)));
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
instance[k] = props[k];
|
|
255
|
-
}
|
|
256
|
-
});
|
|
286
|
+
attachProperties();
|
|
257
287
|
base.changeDetectorRef.detectChanges();
|
|
288
|
+
if (debug) {
|
|
289
|
+
console.info(`[ngx-reactify/${containerTag}]: Render Complete`, { args: { component, props, providers, containerTag } });
|
|
290
|
+
}
|
|
258
291
|
}
|
|
259
292
|
});
|
|
260
293
|
}
|
|
@@ -379,5 +412,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
379
412
|
* Generated bundle index. Do not edit.
|
|
380
413
|
*/
|
|
381
414
|
|
|
382
|
-
export { AutoWrapAngularObject, ReactifyAngularComponent, ReactifyAngularComponent3, ReactifyNgComponent, ReactifyReactComponent, ReactifyStandaloneAngularComponent, WrapAngularComponentInReact, ng2ReactProps };
|
|
415
|
+
export { AutoWrapAngularObject, ReactifyAngularComponent, ReactifyAngularComponent3, ReactifyNgComponent, ReactifyReactComponent, ReactifyStandaloneAngularComponent, ReactifyStandaloneAngularElement, WrapAngularComponentInReact, ng2ReactProps };
|
|
383
416
|
//# sourceMappingURL=ngx-reactify.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-reactify.mjs","sources":["../../../src/util/angular-to-react.ts","../../../src/util/react-to-angular.ts","../../../src/ngx-reactify.ts"],"sourcesContent":["import { Type, ApplicationRef, Injector, NgZone, createComponent, EventEmitter, Provider, EnvironmentProviders, ComponentRef } from '@angular/core';\nimport { createApplication } from '@angular/platform-browser';\nimport * as React from 'react';\nimport { firstValueFrom, Subscription } from 'rxjs';\n\n\n/**\n * Wrap an Angular component inside of a React memo object.\n * Will attempt to bind @Input and @Output properties if provided,\n * and will bind the react arguments directly as @Input properties.\n *\n * Usage: An Angular top-level application with a ReactifyNgComponent react implementation\n * that needs to embed Angular components as children of the react-wrapped component.\n *\n * This is replaced by `WrapAngularComponentInReact`.\n * @deprecated\n */\nexport const ReactifyAngularComponent = ({\n component,\n appRef,\n injector,\n ngZone,\n staticInputs = {},\n staticOutputs = {},\n preSiblings = [],\n postSiblings = [],\n additionalChildren = [],\n rootElementName = '',\n containerElementName = ''\n}: {\n component: Type<any>,\n appRef: Omit<ApplicationRef, '_runningTick'>,\n injector: Injector,\n ngZone: NgZone,\n staticInputs?: { [key: string]: any; },\n staticOutputs?: { [key: string]: Function; },\n preSiblings?: React.ReactNode[],\n postSiblings?: React.ReactNode[],\n additionalChildren?: React.ReactNode[],\n rootElementName?: Parameters<typeof React.createElement>[0],\n containerElementName?: string;\n}) => React.memo((args) => {\n\n return ngZone.runOutsideAngular(() => {\n let outputSubscriptions: { [key: string]: Subscription; };\n let componentInstance: ComponentRef<any>;\n\n const tripChangeDetection = () =>\n componentInstance?.changeDetectorRef?.detectChanges();\n\n // These attributes will trigger change detection when they fire from\n // the underlying React element.\n // ... This will break things. FUCK.\n const attributes: Array<keyof React.DOMAttributes<any>> = ['onCopy', 'onCut', 'onPaste', 'onAbort', 'onBlur', 'onFocus', 'onCanPlay', 'onCanPlayThrough', 'onChange', 'onClick', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onDurationChange', 'onEmptied', 'onEnded', 'onInput', 'onInvalid', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onReset', 'onScroll', 'onSeeked', 'onSeeking', 'onSelect', 'onStalled', 'onSubmit', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onError'];\n\n const attrObj = {};\n attributes.forEach(a => attrObj[a] = tripChangeDetection);\n\n React.useEffect(() => {\n return () => {\n // Code to run when the component unmounts\n appRef?.detachView(componentInstance.hostView);\n Object.values(outputSubscriptions).forEach(s => s.unsubscribe());\n componentInstance?.destroy();\n };\n }, []);\n\n\n const elements = [\n ...(preSiblings || []),\n React.createElement(containerElementName || \"div\", {\n ...attrObj,\n ref: node => {\n const { inputs, outputs } = component['ɵcmp'];\n\n if (componentInstance) return;\n\n ngZone.run(() => {\n componentInstance = createComponent(component, {\n environmentInjector: appRef.injector,\n elementInjector: injector,\n hostElement: node\n });\n\n Object.assign(staticInputs, args);\n appRef.attachView(componentInstance.hostView);\n });\n\n // Returns a list of entries that need to be set\n // This makes it so that unnecessary setters are not invoked.\n const updated = Object.entries(inputs).filter(([parentKey, childKey]: [string, string]) => {\n return componentInstance.instance[childKey] != staticInputs[parentKey];\n });\n\n updated.forEach(([parentKey, childKey]: [string, string]) => {\n if (staticInputs.hasOwnProperty(parentKey))\n componentInstance.instance[childKey] = staticInputs[parentKey];\n });\n\n outputSubscriptions = {};\n // Get a list of unregistered outputs\n const newOutputs = Object.entries(outputs).filter(([parentKey, childKey]: [string, string]) => {\n return !outputSubscriptions[parentKey];\n });\n\n // Reverse bind via subscription\n newOutputs.forEach(([parentKey, childKey]: [string, string]) => {\n if (!staticOutputs.hasOwnProperty(parentKey)) return;\n\n const target: EventEmitter<unknown> = componentInstance.instance[childKey];\n const outputs = staticOutputs;\n\n const sub = target.subscribe((...args) => {\n // Run the callback in the provided zone\n ngZone.run(() => {\n outputs[parentKey](...args);\n });\n }); // Subscription\n\n outputSubscriptions[parentKey] = sub;\n });\n\n // Wrap the destroy method to safely release the subscriptions\n const originalDestroy = componentInstance.onDestroy?.bind(componentInstance);\n componentInstance.onDestroy = (cb) => {\n Object.values(outputSubscriptions).forEach(s => s.unsubscribe());\n originalDestroy?.(cb);\n };\n\n componentInstance.changeDetectorRef.detectChanges();\n }\n }),\n ...(postSiblings || []),\n ...(additionalChildren || [])\n ].filter(e => e);\n\n return React.createElement(rootElementName || \"div\", {}, ...elements);\n });\n});\n\n\n/**\n * Do not use this.\n * @hidden\n * @experimental\n */\nexport const ng2ReactProps = (obj = {}) => {\n const props = {};\n Object.entries(obj).forEach(([k, v]) => {\n // Omit things prefixed with an underscore\n if (k.startsWith('_')) return;\n\n // Omit output event emitters\n if (v instanceof EventEmitter) {\n props[k] = (...args) => v.emit([args]);\n }\n else {\n props[k] = v;\n }\n });\n return props;\n};\n\n/**\n * This method will create a React component that\n * wraps an Angular component.\n * @returns React.NamedExoticComponent\n *\n * @hidden\n * @experimental\n */\nexport function WrapAngularComponentInReact({\n component,\n ngZone,\n appRef,\n injector,\n props,\n containerTag,\n reactTemplate,\n projectableNodes\n}: {\n /**\n * Angular Component to be rendered within React\n */\n component: Type<any>,\n /**\n * Angular Application Reference. Used for bootstrapping\n * and change detection hierarchy.\n */\n appRef: Omit<ApplicationRef, '_runningTick'>,\n /**\n * Instance of NgZone class.\n * Very important to prevent Zone.js event performance issues.\n * Do not set if running Zoneless CD.\n */\n ngZone?: NgZone,\n /**\n * Static properties to be passed into the Angular instance.\n * Automatically generates event proxies for Angular EventEmitters.\n */\n props?: Record<string, any>,\n /**\n * Local Element Injector provided to the Angular object\n */\n injector?: Injector,\n /**\n * HTML Tag for the created DOM wrapper. Defaults to `div`.\n */\n containerTag?: string,\n /**\n * React Function template\n */\n reactTemplate?: (el: React.ReactElement) => React.ReactElement;\n /**\n * Nodes to be passed to the `ng-content` of the child Angular component.\n */\n projectableNodes?: Node[][];\n}) {\n props ??= {};\n containerTag ??= 'div';\n const ctx = this;\n\n const createWrappedElement = () => {\n reactTemplate ??= (el) => el;\n return React.memo((args) => {\n const _props = {};\n Object.assign(_props, props);\n Object.assign(_props, args);\n\n // Is there a better way to do this?\n let subscriptions: Subscription[];\n let componentInstance: ComponentRef<any>;\n\n React.useEffect(() => {\n return () => {\n // Cleanup and dispose leftover Angular objects\n appRef?.detachView(componentInstance.hostView);\n subscriptions?.forEach(s => s?.unsubscribe());\n componentInstance?.destroy();\n };\n }, []);\n\n const tripChangeDetection = () =>\n componentInstance?.changeDetectorRef?.detectChanges();\n\n // These attributes will trigger change detection when they fire from\n // the underlying React element.\n // ... This will break things. FUCK.\n const attributes: Array<keyof React.DOMAttributes<any>> = ['onCopy', 'onCut', 'onPaste', 'onAbort', 'onBlur', 'onFocus', 'onCanPlay', 'onCanPlayThrough', 'onChange', 'onClick', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onDurationChange', 'onEmptied', 'onEnded', 'onInput', 'onInvalid', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onReset', 'onScroll', 'onSeeked', 'onSeeking', 'onSelect', 'onStalled', 'onSubmit', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onError'];\n\n const attrObj = {};\n attributes.forEach(a => attrObj[a] = tripChangeDetection);\n\n return reactTemplate(React.createElement(containerTag, {\n ...attrObj,\n ref: async (node) => {\n if (componentInstance) return;\n\n // Not sure if this ever actually happens, added as a preventative measure\n // to memory leaks.\n subscriptions?.forEach(s => s?.unsubscribe());\n\n const bootstrap = () => {\n // Init the Angular component with the context of the root Angular app.\n componentInstance = createComponent(component, {\n environmentInjector: appRef.injector,\n elementInjector: injector,\n hostElement: node,\n projectableNodes: projectableNodes\n });\n appRef.attachView(componentInstance.hostView);\n };\n\n ngZone?.runTask\n ? ngZone?.runTask(bootstrap)\n : bootstrap();\n\n // Now that everything has settled, bind inputs and outputs.\n subscriptions = [];\n Object.entries(_props).filter(([k, v]) => {\n // @Outputs are always Event Emitters (I think)\n if (v instanceof EventEmitter) {\n subscriptions.push(\n componentInstance.instance[k]?.subscribe(evt => _props[k].call(ctx, evt))\n );\n }\n else {\n componentInstance.instance[k] = _props[k];\n }\n });\n\n componentInstance.changeDetectorRef.detectChanges();\n }\n }));\n });\n }\n\n return ngZone?.runOutsideAngular\n ? ngZone?.runOutsideAngular(createWrappedElement)\n : createWrappedElement();\n}\n\n/**\n * This method will automatically wrap an Angular\n * Component or Directive into a React object.\n * @Outputs (EventEmitters) will be automatically\n * linked into the input properties along with\n * all of the @Inputs.\n * @returns React.NamedExoticComponent\n * @experimental\n */\nexport const AutoWrapAngularObject = ({\n component,\n appRef,\n ngZone,\n instance,\n injector,\n containerTag,\n reactTemplate,\n}: (Parameters<typeof WrapAngularComponentInReact>[0] & {\n /**\n * Angular Component/Directive instance that will have properties bound to the created\n */\n instance?: InstanceType<Type<any>> | Record<string, any>,\n\n})) => {\n const props = ng2ReactProps(instance);\n\n return WrapAngularComponentInReact({\n component,\n ngZone,\n appRef,\n injector,\n containerTag,\n props,\n reactTemplate\n });\n};\n\n/**\n * Bootstrap an Angular component with `createApplication` and export it under a\n * react Element.\n * Usage: React top-level application embedding an Angular component.\n */\nexport function ReactifyStandaloneAngularComponent(\n component: Type<any>,\n props: any = {},\n providers: (Provider | EnvironmentProviders)[] = [],\n containerTag: string = 'div'\n) {\n const ctx = this;\n\n // Is there a better way to do this?\n let subscriptions: Subscription[];\n let app: ApplicationRef;\n\n React.useEffect(() => {\n return () => {\n // Code to run when the component unmounts\n subscriptions?.forEach(s => s?.unsubscribe());\n app?.destroy();\n };\n }, []);\n\n return React.createElement(containerTag, {\n ref: async (node) => {\n // Not sure if this ever actually happens, added as a preventative measure\n // to memory leaks.\n subscriptions?.forEach(s => s?.unsubscribe());\n app?.destroy();\n\n // Init an Angular application root & bootstrap it to a DOM element.\n app = await createApplication({ providers });\n const base = app.bootstrap(component, node);\n const { instance } = base;\n\n\n // Wait for the JS to finish rendering and initing.\n await firstValueFrom(app.isStable);\n\n // Now that everything has settled, bind inputs and outputs.\n subscriptions = [];\n Object.entries(props).filter(([k, v]) => {\n // @Outputs are always Event Emitters (I think)\n if (v instanceof EventEmitter) {\n subscriptions.push(\n instance[k]?.subscribe(evt => props[k].call(ctx, evt))\n );\n }\n else {\n instance[k] = props[k];\n }\n });\n\n base.changeDetectorRef.detectChanges();\n }\n });\n}\n\n\n\n// These exports exist to attempt to make the API have minimal breaking changes.\nexport const ReactifyReactComponent = ReactifyAngularComponent;\nexport const ReactifyAngularComponent3 = WrapAngularComponentInReact;;\n","import { AfterViewInit, ChangeDetectorRef, Directive, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChanges, ViewContainerRef } from '@angular/core';\nimport * as React from 'react';\nimport { createRoot, Root } from 'react-dom/client';\n\n/**\n * This component can be used to automatically wrap a React\n * component into Angular bindings with functional change detection.\n * All you need to provide is the @Input and @Output interface\n * for the component in order to tell Angular which keys correspond to what.\n *\n * ### You _must_ override the property `ngReactComponent`.\n *\n * Failure to do so will result in errors\n *\n * `override readonly ngReactComponent = SomeReactFunction;`\n *\n * Example:\n *\n * ```ts\n * @Component({\n * selector: \"app-react-wrapped\",\n * standalone: true\n * })\n * export class MyReactWrappedComponent extends ReactifyNgComponent {\n *\n * @Input() data: any;\n * @Input() options: any;\n * @Input() version: any;\n *\n * // Notice how we wrap the result in an array, this is important because\n * // React can pass multiple properties to a callback and Angular can't.\n * @Output() onClick = new EventEmitter<[any]>();\n *\n * }\n * ```\n */\n@Directive({\n standalone: true\n})\nexport class ReactifyNgComponent implements OnChanges, OnDestroy, AfterViewInit {\n\n /**\n * The react component to be wrapped.\n * ! Must be overridden for this wrapper to work\n */\n ngReactComponent: React.FunctionComponent<any> | React.ComponentClass<any>;\n\n private _root: Root;\n\n private _reactElement: React.ReactElement;\n\n private _props: Object = {};\n\n constructor(\n protected readonly ngContainer: ViewContainerRef,\n protected readonly ngZone: NgZone,\n protected readonly ngChangeDetector: ChangeDetectorRef\n ) {\n }\n\n ngOnInit() {\n if (!this.ngReactComponent) {\n throw new Error(\"ReactifyNgComponent cannot be inherited without a provided ngReactComponent!\");\n }\n }\n\n ngOnChanges(changes?: SimpleChanges): void {\n this._render();\n }\n\n ngAfterViewInit() {\n this._render();\n }\n\n ngOnDestroy() {\n this._root?.unmount();\n }\n\n private _render() {\n if (!this.ngReactComponent) {\n console.log(\"Render no component. May be context issue\")\n return\n };\n\n this.ngZone.runOutsideAngular(() => {\n try {\n this._root ??= createRoot(this.ngContainer.element.nativeElement);\n\n // List all keys that do not start with `_` nor `ng`\n const keys = Object.keys(this).filter(k => !/^(?:_|ng)/.test(k));\n\n // Get all property keys from the class\n const propKeys = keys.filter(k => !(this[k] instanceof EventEmitter));\n // Get all event handler keys from the class\n const evtKeys = keys.filter(k => this[k] instanceof EventEmitter);\n\n // Project all key properties onto `props`\n propKeys.forEach(k => this._props[k] = this[k]);\n\n // Attempt to ensure no zone is lost during the event emitter fires\n this.ngZone.runGuarded(() => {\n // Bind all event handlers.\n // ! important Angular uses EventEmitter, React uses\n // a different method of event binding\n evtKeys.forEach(k => {\n if (k.endsWith(\"Change\") && Object.hasOwn(this, k.replace(/Change$/, ''))) {\n // Detect if this should be treated as a 2-way binding. If so we'll assume\n // there's only ever one item in the arguments list.\n this._props[k] = (arg) => {\n (this[k] as EventEmitter<any>).emit(arg);\n this.ngChangeDetector.markForCheck();\n }\n }\n else {\n // We're assuming this is NOT a 2-way binding, just an event so we'll pass\n // everything back to the parent component in an array.\n this._props[k] = (...args) => {\n (this[k] as EventEmitter<any>).emit(args);\n this.ngChangeDetector.markForCheck();\n }\n }\n });\n })\n\n this._reactElement = React.createElement(this.ngReactComponent, { props: this._props as any });\n this._root.render(this._reactElement);\n }\n catch(err) {\n console.error(err)\n }\n })\n }\n}\n\n// We replace all React functions with Angular EventEmitters\n// thus, anything typed as a function will automatically be transformed.\nexport type ReactifyPropsTypeToAngular<T> = {\n [K in keyof T]: T[K] extends (...args) => any ? EventEmitter<\n Parameters<T[K]> extends [any] ? Parameters<T[K]>[0] : Parameters<T[K]>\n > : T[K];\n};\n\n// export function ReactifyNgComponent2<T = any>(): new() => ReactifyNgComponent & ReactifyPropsTypeToAngular<T> {\n// return ReactifyNgComponent as never;\n// };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAMA;;;;;;;;;;AAUG;AACU,MAAA,wBAAwB,GAAG,CAAC,EACrC,SAAS,EACT,MAAM,EACN,QAAQ,EACR,MAAM,EACN,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,EAAE,EAClB,WAAW,GAAG,EAAE,EAChB,YAAY,GAAG,EAAE,EACjB,kBAAkB,GAAG,EAAE,EACvB,eAAe,GAAG,EAAE,EACpB,oBAAoB,GAAG,EAAE,EAa5B,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAI;AAEtB,IAAA,OAAO,MAAM,CAAC,iBAAiB,CAAC,MAAK;AACjC,QAAA,IAAI,mBAAqD;AACzD,QAAA,IAAI,iBAAoC;QAExC,MAAM,mBAAmB,GAAG,MACxB,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE;;;;QAKzD,MAAM,UAAU,GAA0C,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa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AE,IAAI,CAAC,MAAa,EAAE,CAAC;gBAC9F,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;YAEzC,OAAM,GAAG,EAAE;AACP,gBAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;;AAE1B,SAAC,CAAC;;+GA3FG,mBAAmB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,MAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,iBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAnB,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACtCD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-reactify.mjs","sources":["../../../src/util/angular-to-react.ts","../../../src/util/react-to-angular.ts","../../../src/ngx-reactify.ts"],"sourcesContent":["import { Type, ApplicationRef, Injector, NgZone, createComponent, EventEmitter, Provider, EnvironmentProviders, ComponentRef } from '@angular/core';\nimport { createApplication } from '@angular/platform-browser';\nimport * as React from 'react';\nimport { firstValueFrom, Subscription } from 'rxjs';\n\n\n/**\n * Wrap an Angular component inside of a React memo object.\n * Will attempt to bind @Input and @Output properties if provided,\n * and will bind the react arguments directly as @Input properties.\n *\n * Usage: An Angular top-level application with a ReactifyNgComponent react implementation\n * that needs to embed Angular components as children of the react-wrapped component.\n *\n * This is replaced by `WrapAngularComponentInReact`.\n * @deprecated\n */\nexport const ReactifyAngularComponent = ({\n component,\n appRef,\n injector,\n ngZone,\n staticInputs = {},\n staticOutputs = {},\n preSiblings = [],\n postSiblings = [],\n additionalChildren = [],\n rootElementName = '',\n containerElementName = ''\n}: {\n component: Type<any>,\n appRef: Omit<ApplicationRef, '_runningTick'>,\n injector: Injector,\n ngZone: NgZone,\n staticInputs?: { [key: string]: any; },\n staticOutputs?: { [key: string]: Function; },\n preSiblings?: React.ReactNode[],\n postSiblings?: React.ReactNode[],\n additionalChildren?: React.ReactNode[],\n rootElementName?: Parameters<typeof React.createElement>[0],\n containerElementName?: string;\n}) => React.memo((args) => {\n\n return ngZone.runOutsideAngular(() => {\n let outputSubscriptions: { [key: string]: Subscription; };\n let componentInstance: ComponentRef<any>;\n\n const tripChangeDetection = () =>\n componentInstance?.changeDetectorRef?.detectChanges();\n\n // These attributes will trigger change detection when they fire from\n // the underlying React element.\n // ... This will break things. FUCK.\n const attributes: Array<keyof React.DOMAttributes<any>> = ['onCopy', 'onCut', 'onPaste', 'onAbort', 'onBlur', 'onFocus', 'onCanPlay', 'onCanPlayThrough', 'onChange', 'onClick', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onDurationChange', 'onEmptied', 'onEnded', 'onInput', 'onInvalid', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onReset', 'onScroll', 'onSeeked', 'onSeeking', 'onSelect', 'onStalled', 'onSubmit', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onError'];\n\n const attrObj = {};\n attributes.forEach(a => attrObj[a] = tripChangeDetection);\n\n React.useEffect(() => {\n return () => {\n // Code to run when the component unmounts\n appRef?.detachView(componentInstance.hostView);\n Object.values(outputSubscriptions).forEach(s => s.unsubscribe());\n componentInstance?.destroy();\n };\n }, []);\n\n\n const elements = [\n ...(preSiblings || []),\n React.createElement(containerElementName || \"div\", {\n ...attrObj,\n ref: node => {\n const { inputs, outputs } = component['ɵcmp'];\n\n if (componentInstance) return;\n\n ngZone.run(() => {\n componentInstance = createComponent(component, {\n environmentInjector: appRef.injector,\n elementInjector: injector,\n hostElement: node\n });\n\n Object.assign(staticInputs, args);\n appRef.attachView(componentInstance.hostView);\n });\n\n // Returns a list of entries that need to be set\n // This makes it so that unnecessary setters are not invoked.\n const updated = Object.entries(inputs).filter(([parentKey, childKey]: [string, string]) => {\n return componentInstance.instance[childKey] != staticInputs[parentKey];\n });\n\n updated.forEach(([parentKey, childKey]: [string, string]) => {\n if (staticInputs.hasOwnProperty(parentKey))\n componentInstance.instance[childKey] = staticInputs[parentKey];\n });\n\n outputSubscriptions = {};\n // Get a list of unregistered outputs\n const newOutputs = Object.entries(outputs).filter(([parentKey, childKey]: [string, string]) => {\n return !outputSubscriptions[parentKey];\n });\n\n // Reverse bind via subscription\n newOutputs.forEach(([parentKey, childKey]: [string, string]) => {\n if (!staticOutputs.hasOwnProperty(parentKey)) return;\n\n const target: EventEmitter<unknown> = componentInstance.instance[childKey];\n const outputs = staticOutputs;\n\n const sub = target.subscribe((...args) => {\n // Run the callback in the provided zone\n ngZone.run(() => {\n outputs[parentKey](...args);\n });\n }); // Subscription\n\n outputSubscriptions[parentKey] = sub;\n });\n\n // Wrap the destroy method to safely release the subscriptions\n const originalDestroy = componentInstance.onDestroy?.bind(componentInstance);\n componentInstance.onDestroy = (cb) => {\n Object.values(outputSubscriptions).forEach(s => s.unsubscribe());\n originalDestroy?.(cb);\n };\n\n componentInstance.changeDetectorRef.detectChanges();\n }\n }),\n ...(postSiblings || []),\n ...(additionalChildren || [])\n ].filter(e => e);\n\n return React.createElement(rootElementName || \"div\", {}, ...elements);\n });\n});\n\n\n/**\n * Do not use this.\n * @hidden\n * @experimental\n */\nexport const ng2ReactProps = (obj = {}) => {\n const props = {};\n Object.entries(obj).forEach(([k, v]) => {\n // Omit things prefixed with an underscore\n if (k.startsWith('_')) return;\n\n // Omit output event emitters\n if (v instanceof EventEmitter) {\n props[k] = (...args) => v.emit([args]);\n }\n else {\n props[k] = v;\n }\n });\n return props;\n};\n\n/**\n * This method will create a React component that\n * wraps an Angular component.\n * @returns React.NamedExoticComponent\n *\n * @hidden\n * @experimental\n */\nexport function WrapAngularComponentInReact({\n component,\n ngZone,\n appRef,\n injector,\n props,\n containerTag,\n reactTemplate,\n projectableNodes\n}: {\n /**\n * Angular Component to be rendered within React\n */\n component: Type<any>,\n /**\n * Angular Application Reference. Used for bootstrapping\n * and change detection hierarchy.\n */\n appRef: Omit<ApplicationRef, '_runningTick'>,\n /**\n * Instance of NgZone class.\n * Very important to prevent Zone.js event performance issues.\n * Do not set if running Zoneless CD.\n */\n ngZone?: NgZone,\n /**\n * Static properties to be passed into the Angular instance.\n * Automatically generates event proxies for Angular EventEmitters.\n */\n props?: Record<string, any>,\n /**\n * Local Element Injector provided to the Angular object\n */\n injector?: Injector,\n /**\n * HTML Tag for the created DOM wrapper. Defaults to `div`.\n */\n containerTag?: string,\n /**\n * React Function template\n */\n reactTemplate?: (el: React.ReactElement) => React.ReactElement;\n /**\n * Nodes to be passed to the `ng-content` of the child Angular component.\n */\n projectableNodes?: Node[][];\n}) {\n props ??= {};\n containerTag ??= 'div';\n const ctx = this;\n\n const createWrappedElement = () => {\n reactTemplate ??= (el) => el;\n return React.memo((args) => {\n const _props = {};\n Object.assign(_props, props);\n Object.assign(_props, args);\n\n // Is there a better way to do this?\n let subscriptions: Subscription[];\n let componentInstance: ComponentRef<any>;\n\n const tripChangeDetection = () =>\n componentInstance?.changeDetectorRef?.detectChanges();\n\n // These attributes will trigger change detection when they fire from\n // the underlying React element.\n // ... This will break things. FUCK.\n const attributes: Array<keyof React.DOMAttributes<any>> = ['onCopy', 'onCut', 'onPaste', 'onAbort', 'onBlur', 'onFocus', 'onCanPlay', 'onCanPlayThrough', 'onChange', 'onClick', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onDurationChange', 'onEmptied', 'onEnded', 'onInput', 'onInvalid', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onReset', 'onScroll', 'onSeeked', 'onSeeking', 'onSelect', 'onStalled', 'onSubmit', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onError'];\n\n const attrObj = {};\n attributes.forEach(a => attrObj[a] = tripChangeDetection);\n\n return reactTemplate(React.createElement(containerTag, {\n ...attrObj,\n ref: async (node) => {\n // When the node is empty, we can safely clean up the angular instance\n // and detach views.\n if (!node) {\n // Cleanup and dispose leftover Angular objects\n appRef?.detachView(componentInstance.hostView);\n subscriptions?.forEach(s => s?.unsubscribe());\n componentInstance?.destroy();\n }\n\n if (componentInstance) return;\n\n const bootstrap = () => {\n // Init the Angular component with the context of the root Angular app.\n componentInstance = createComponent(component, {\n environmentInjector: appRef.injector,\n elementInjector: injector,\n hostElement: node,\n projectableNodes: projectableNodes\n });\n appRef.attachView(componentInstance.hostView);\n };\n\n // Bootstrap in the Angular zone if it's provided\n ngZone?.runTask\n ? ngZone?.runTask(bootstrap)\n : bootstrap();\n\n // Now that everything has settled, bind inputs and outputs.\n subscriptions = [];\n Object.entries(_props).filter(([k, v]) => {\n // @Outputs are always Event Emitters (I think)\n if (v instanceof EventEmitter) {\n subscriptions.push(\n componentInstance.instance[k]?.subscribe(evt => _props[k].call(ctx, evt))\n );\n }\n else {\n componentInstance.instance[k] = _props[k];\n }\n });\n\n componentInstance.changeDetectorRef.detectChanges();\n }\n }));\n });\n }\n\n return ngZone?.runOutsideAngular\n ? ngZone?.runOutsideAngular(createWrappedElement)\n : createWrappedElement();\n}\n\n/**\n * This method will automatically wrap an Angular\n * Component or Directive into a React object.\n * @Outputs (EventEmitters) will be automatically\n * linked into the input properties along with\n * all of the @Inputs.\n * @returns React.NamedExoticComponent\n * @experimental\n */\nexport const AutoWrapAngularObject = ({\n component,\n appRef,\n ngZone,\n instance,\n injector,\n containerTag,\n reactTemplate,\n}: (Parameters<typeof WrapAngularComponentInReact>[0] & {\n /**\n * Angular Component/Directive instance that will have properties bound to the created\n */\n instance?: InstanceType<Type<any>> | Record<string, any>,\n\n})) => {\n const props = ng2ReactProps(instance);\n\n return WrapAngularComponentInReact({\n component,\n ngZone,\n appRef,\n injector,\n containerTag,\n props,\n reactTemplate\n });\n};\n\ntype TransformProperties<T> = {\n [K in keyof T]: T[K] extends EventEmitter<infer U> ? React.Dispatch<React.SetStateAction<U>> : T[K];\n};\n\nexport function ReactifyStandaloneAngularComponent<T extends Type<any>>(\n component: T,\n providers: (Provider | EnvironmentProviders)[] = [],\n containerTag: string = 'div',\n debug = false\n) {\n return React.memo((props: Partial<TransformProperties<InstanceType<T>>>) => {\n return ReactifyStandaloneAngularElement(\n component as any,\n props,\n providers,\n containerTag,\n debug\n );\n });\n}\n\nexport function ReactifyStandaloneAngularElement(\n component: Type<any>,\n props: any = {},\n providers: (Provider | EnvironmentProviders)[] = [],\n containerTag: string = 'div',\n debug = false\n) {\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: Begin render`, { args: { component, props, providers, containerTag } });\n }\n\n // Preserve React execution context\n const ctx = this;\n\n let subscriptions: Subscription[];\n let app: ApplicationRef;\n\n // The Angular component instance\n let instance;\n\n let containerNode = document.createElement(\"ngx-container\");\n\n const attachProperties = () => {\n subscriptions?.forEach(s => s.unsubscribe());\n subscriptions = [];\n\n Object.keys(props).filter((k) => {\n // If the property is being passed in as a bound dispatchState, we'll\n // handle it as a eventEmitter on Angular's side.\n if (props[k].name == 'bound dispatchSetState') {\n subscriptions.push(\n instance[k]?.subscribe(evt => props[k].call(ctx, evt))\n );\n }\n // else if (v instanceof EventEmitter) {\n // subscriptions.push(\n // instance[k]?.subscribe(evt => props[k].call(ctx, evt))\n // );\n // }\n else {\n instance[k] = props[k];\n }\n });\n };\n\n React.useEffect(() => {\n if (!instance) return;\n\n attachProperties();\n });\n\n return React.createElement(containerTag, {\n ref: async (node: HTMLElement) => {\n\n // If the node is removed, we need to cleanup\n if (!node) {\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: Dispose`, { args: { component, props, providers, containerTag } });\n }\n\n subscriptions?.forEach(s => s?.unsubscribe());\n app?.destroy();\n\n return;\n }\n\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: NG Bootstrap`, { args: { component, props, providers, containerTag } });\n }\n node.append(containerNode);\n\n // Init an Angular application root & bootstrap it to a DOM element.\n app = await createApplication({ providers });\n\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: NG App Created`, { args: { component, props, providers, containerTag } });\n }\n\n const base = app.bootstrap(component, containerNode);\n instance = base.instance;\n\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: NG Bootstrapped`, { args: { component, props, providers, containerTag } });\n }\n\n // Wait for the JS to finish rendering and initing.\n await firstValueFrom(app.isStable);\n\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: NG Stable`, { args: { component, props, providers, containerTag } });\n }\n\n // Now that everything has settled, bind inputs and outputs.\n attachProperties();\n\n base.changeDetectorRef.detectChanges();\n\n if (debug) {\n console.info(`[ngx-reactify/${containerTag}]: Render Complete`, { args: { component, props, providers, containerTag } });\n }\n }\n });\n}\n\n\n// These exports exist to attempt to make the API have minimal breaking changes.\nexport const ReactifyReactComponent = ReactifyAngularComponent;\nexport const ReactifyAngularComponent3 = WrapAngularComponentInReact;;\n","import { AfterViewInit, ChangeDetectorRef, Directive, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChanges, ViewContainerRef } from '@angular/core';\nimport * as React from 'react';\nimport { createRoot, Root } from 'react-dom/client';\n\n/**\n * This component can be used to automatically wrap a React\n * component into Angular bindings with functional change detection.\n * All you need to provide is the @Input and @Output interface\n * for the component in order to tell Angular which keys correspond to what.\n *\n * ### You _must_ override the property `ngReactComponent`.\n *\n * Failure to do so will result in errors\n *\n * `override readonly ngReactComponent = SomeReactFunction;`\n *\n * Example:\n *\n * ```ts\n * @Component({\n * selector: \"app-react-wrapped\",\n * standalone: true\n * })\n * export class MyReactWrappedComponent extends ReactifyNgComponent {\n *\n * @Input() data: any;\n * @Input() options: any;\n * @Input() version: any;\n *\n * // Notice how we wrap the result in an array, this is important because\n * // React can pass multiple properties to a callback and Angular can't.\n * @Output() onClick = new EventEmitter<[any]>();\n *\n * }\n * ```\n */\n@Directive({\n standalone: true\n})\nexport class ReactifyNgComponent\n implements OnChanges, OnDestroy, AfterViewInit\n {\n\n /**\n * The react component to be wrapped.\n * ! Must be overridden for this wrapper to work\n */\n ngReactComponent: React.FC;\n\n private _root: Root;\n\n private _reactElement: React.ReactElement;\n\n public _props = {} as any as React.ComponentProps<this['ngReactComponent']>;\n\n constructor(\n protected readonly ngContainer: ViewContainerRef,\n protected readonly ngZone: NgZone,\n protected readonly ngChangeDetector: ChangeDetectorRef\n ) {\n }\n\n ngOnInit() {\n if (!this.ngReactComponent) {\n throw new Error(\"ReactifyNgComponent cannot be inherited without a provided ngReactComponent!\");\n }\n }\n\n ngOnChanges(changes?: SimpleChanges): void {\n this._render();\n }\n\n ngAfterViewInit() {\n this._render();\n }\n\n ngOnDestroy() {\n this._root?.unmount();\n }\n\n private _render() {\n if (!this.ngReactComponent) {\n console.log(\"Render no component. May be context issue\")\n return\n };\n\n this.ngZone.runOutsideAngular(() => {\n try {\n this._root ??= createRoot(this.ngContainer.element.nativeElement);\n\n // List all keys that do not start with `_` nor `ng`\n const keys = Object.keys(this).filter(k => !/^(?:_|ng)/.test(k));\n\n // Get all property keys from the class\n const propKeys = keys.filter(k => !(this[k] instanceof EventEmitter));\n // Get all event handler keys from the class\n const evtKeys = keys.filter(k => this[k] instanceof EventEmitter);\n\n // Project all key properties onto `props`\n propKeys.forEach(k => this._props[k] = this[k]);\n\n // Attempt to ensure no zone is lost during the event emitter fires\n this.ngZone.runGuarded(() => {\n // Bind all event handlers.\n // ! important Angular uses EventEmitter, React uses\n // a different method of event binding\n evtKeys.forEach(k => {\n if (k.endsWith(\"Change\") && Object.hasOwn(this, k.replace(/Change$/, ''))) {\n // Detect if this should be treated as a 2-way binding. If so we'll assume\n // there's only ever one item in the arguments list.\n this._props[k] = (arg) => {\n (this[k] as EventEmitter<any>).emit(arg);\n this.ngChangeDetector.markForCheck();\n }\n }\n else {\n // We're assuming this is NOT a 2-way binding, just an event so we'll pass\n // everything back to the parent component in an array.\n this._props[k] = (...args) => {\n (this[k] as EventEmitter<any>).emit(args);\n this.ngChangeDetector.markForCheck();\n }\n }\n });\n })\n\n this._reactElement = React.createElement(this.ngReactComponent, { props: this._props as any } as any);\n this._root.render(this._reactElement);\n }\n catch(err) {\n console.error(err)\n }\n })\n }\n}\n\n// We replace all React functions with Angular EventEmitters\n// thus, anything typed as a function will automatically be transformed.\nexport type ReactifyPropsTypeToAngular<T> = {\n [K in keyof T]: T[K] extends (...args) => any ? EventEmitter<\n Parameters<T[K]> extends [any] ? Parameters<T[K]>[0] : Parameters<T[K]>\n > : T[K];\n};\n\n// export function ReactifyNgComponent2<T = any>(): new() => ReactifyNgComponent & ReactifyPropsTypeToAngular<T> {\n// return ReactifyNgComponent as never;\n// };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAMA;;;;;;;;;;AAUG;AACU,MAAA,wBAAwB,GAAG,CAAC,EACrC,SAAS,EACT,MAAM,EACN,QAAQ,EACR,MAAM,EACN,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,EAAE,EAClB,WAAW,GAAG,EAAE,EAChB,YAAY,GAAG,EAAE,EACjB,kBAAkB,GAAG,EAAE,EAC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EAAA,EAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,MAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,iBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAnB,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACtCD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Type, ApplicationRef, Injector, NgZone, Provider, EnvironmentProviders } from '@angular/core';
|
|
1
|
+
import { Type, ApplicationRef, Injector, NgZone, EventEmitter, Provider, EnvironmentProviders } from '@angular/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Wrap an Angular component inside of a React memo object.
|
|
@@ -95,12 +95,11 @@ export declare const AutoWrapAngularObject: ({ component, appRef, ngZone, instan
|
|
|
95
95
|
*/
|
|
96
96
|
instance?: InstanceType<Type<any>> | Record<string, any>;
|
|
97
97
|
})) => React.NamedExoticComponent<object>;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export declare function ReactifyStandaloneAngularComponent(component: Type<any>, props?: any, providers?: (Provider | EnvironmentProviders)[], containerTag?: string): React.DOMElement<React.DOMAttributes<Element>, Element>;
|
|
98
|
+
type TransformProperties<T> = {
|
|
99
|
+
[K in keyof T]: T[K] extends EventEmitter<infer U> ? React.Dispatch<React.SetStateAction<U>> : T[K];
|
|
100
|
+
};
|
|
101
|
+
export declare function ReactifyStandaloneAngularComponent<T extends Type<any>>(component: T, providers?: (Provider | EnvironmentProviders)[], containerTag?: string, debug?: boolean): React.MemoExoticComponent<(props: Partial<TransformProperties<InstanceType<T>>>) => React.DOMElement<React.DOMAttributes<HTMLElement>, HTMLElement>>;
|
|
102
|
+
export declare function ReactifyStandaloneAngularElement(component: Type<any>, props?: any, providers?: (Provider | EnvironmentProviders)[], containerTag?: string, debug?: boolean): React.DOMElement<React.DOMAttributes<HTMLElement>, HTMLElement>;
|
|
104
103
|
export declare const ReactifyReactComponent: ({ component, appRef, injector, ngZone, staticInputs, staticOutputs, preSiblings, postSiblings, additionalChildren, rootElementName, containerElementName }: {
|
|
105
104
|
component: Type<any>;
|
|
106
105
|
appRef: Omit<ApplicationRef, "_runningTick">;
|
|
@@ -119,4 +118,5 @@ export declare const ReactifyReactComponent: ({ component, appRef, injector, ngZ
|
|
|
119
118
|
containerElementName?: string;
|
|
120
119
|
}) => React.NamedExoticComponent<object>;
|
|
121
120
|
export declare const ReactifyAngularComponent3: typeof WrapAngularComponentInReact;
|
|
121
|
+
export {};
|
|
122
122
|
//# sourceMappingURL=angular-to-react.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-to-react.d.ts","sourceRoot":"","sources":["../../../src/util/angular-to-react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"angular-to-react.d.ts","sourceRoot":"","sources":["../../../src/util/angular-to-react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAmB,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAgB,MAAM,eAAe,CAAC;AAEpJ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,+JAYlC;IACC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,MAAM,EAAE,I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,CAAC;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KAAE,CAAC;IACvC,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;KAAE,CAAC;IAC7C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACvC,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC,uCAsa6D,CAAC;AAC/D,eAAO,MAAM,yBAAyB,oCAA8B,CAAC"}
|
|
@@ -41,10 +41,10 @@ export declare class ReactifyNgComponent implements OnChanges, OnDestroy, AfterV
|
|
|
41
41
|
* The react component to be wrapped.
|
|
42
42
|
* ! Must be overridden for this wrapper to work
|
|
43
43
|
*/
|
|
44
|
-
ngReactComponent: React.
|
|
44
|
+
ngReactComponent: React.FC;
|
|
45
45
|
private _root;
|
|
46
46
|
private _reactElement;
|
|
47
|
-
|
|
47
|
+
_props: React.ComponentProps<this["ngReactComponent"]>;
|
|
48
48
|
constructor(ngContainer: ViewContainerRef, ngZone: NgZone, ngChangeDetector: ChangeDetectorRef);
|
|
49
49
|
ngOnInit(): void;
|
|
50
50
|
ngOnChanges(changes?: SimpleChanges): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-to-angular.d.ts","sourceRoot":"","sources":["../../../src/util/react-to-angular.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAa,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAA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