ngx-reactify 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -5,7 +5,7 @@ I will try to minimize breaking changes between minor version revisions but some
5
5
 
6
6
  This project aims to make using Angular components in React not suck, and vice-versa. This is a dependency of my other library, ngx-xyflow.
7
7
 
8
- ### Getting started:
8
+ ## Getting started (React in Angular):
9
9
 
10
10
  ##### Install React
11
11
 
@@ -23,9 +23,9 @@ This project aims to make using Angular components in React not suck, and vice-v
23
23
  npm i ngx-reactify
24
24
  ```
25
25
 
26
- ### Embed React component in Angular
26
+ ### Embed a React component in Angular
27
27
 
28
- ##### Create component Interface
28
+ ##### Create the wrapper component
29
29
  Next, you.
30
30
  > This step is necessary as it creates Angular bindings that can be used.
31
31
  > Important: You can't use the normal stylesheet imports from React. Put your styles in the component.scss file.
@@ -83,37 +83,183 @@ export class DemoComponent {
83
83
  }
84
84
  ```
85
85
 
86
- ### Embed Angular component in React
86
+ ## Getting started (Angular in React):
87
+
88
+ ### Install ngx-reactify
89
+
90
+ ```bash
91
+ npm i ngx-reactify
92
+ ```
93
+
94
+ ### Install Angular in your project
95
+ You need at minimum the following dependencies:
96
+
97
+ It has been tested on v19, other versions **should** work if they support standalone components.
98
+
99
+ ```bash
100
+ npm i @analogjs/vite-plugin-angular @angular/common@19 @angular/core@19 @angular/platform-browser@19 @angular/compiler@19
101
+ ```
102
+
103
+ ### Setup
104
+
105
+ ##### Zone.js
106
+
107
+ The init method currently requires zone.js, so you need to import that in the browser.
108
+ I recommend placing the side-effect import in your entrypoint ts/tsx file like so:
87
109
 
88
- > :warn: Under construction.
89
- <!--
90
110
  ```ts
91
- import React from 'react';
92
- import { ReactifyReactComponent } from 'ngx-reactify';
93
- import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
94
- import { ReactDemoComponent } from './react-demo.component';
111
+ import "zone.js";
112
+ ```
113
+
114
+ ##### tsconfig
115
+
116
+ You **must** add a tsconfig.app.json file. The sample below has been tested and works.
117
+ `tsconfig.app.json`
118
+ ```json
119
+ {
120
+ "extends": "./tsconfig.json",
121
+ "compileOnSave": false,
122
+ "compilerOptions": {
123
+ "baseUrl": "./",
124
+ "outDir": "./dist/out-tsc",
125
+ "forceConsistentCasingInFileNames": true,
126
+ "strict": true,
127
+ "noImplicitOverride": true,
128
+ "noPropertyAccessFromIndexSignature": true,
129
+ "noImplicitReturns": true,
130
+ "noFallthroughCasesInSwitch": true,
131
+ "sourceMap": true,
132
+ "declaration": false,
133
+ "downlevelIteration": true,
134
+ "experimentalDecorators": true,
135
+ "moduleResolution": "node",
136
+ "importHelpers": true,
137
+ "noEmit": false,
138
+ "target": "es2020",
139
+ "module": "es2020",
140
+ "lib": [
141
+ "es2020",
142
+ "dom"
143
+ ],
144
+ "skipLibCheck": true
145
+ },
146
+ "angularCompilerOptions": {
147
+ "enableI18nLegacyMessageIdFormat": false,
148
+ "strictInjectionParameters": true,
149
+ "strictInputAccessModifiers": true,
150
+ "strictTemplates": true
151
+ },
152
+ "files": [],
153
+ "include": [
154
+ "src/**/*.ts"
155
+ ]
156
+ }
157
+
158
+ ```
159
+
160
+ ##### vite.config.js
161
+
162
+ You need to import the angular plugin from @analogjs/vite-plugin-angular.
163
+
164
+ ```js
165
+ import { defineConfig } from 'vite';
166
+ import react from '@vitejs/plugin-react';
167
+ import angular from '@analogjs/vite-plugin-angular';
168
+
169
+ export default defineConfig({
170
+ plugins: [
171
+ // Angular plugin **MUST** be imported before the react plugin.
172
+ angular(),
173
+ react()
174
+ ]
175
+ });
176
+ ```
177
+
178
+ ### Using an Angular component in your React app
179
+
180
+ There are two ways in which you can transform an Angular component into a React entity.
181
+
182
+ Option one is to perform a one-time wrapping of the Angular component. This allows you to
183
+ use it like a normal react component, and you can even import the transformed component
184
+ throughout your project like normal react components.
185
+ Option two is to perform an ad-hoc transformation. This is more useful where you need to
186
+ pass providers into the Angular ecosystem.
187
+
188
+
189
+ #### One time auto-wrap of an Angular component to a React component
190
+
191
+ Angular Component:
192
+
193
+ ```ts
194
+ import { Component, EventEmitter, Input, Output } from '@angular/core';
95
195
 
96
196
  @Component({
97
- selector: 'app-demo',
98
- template: `<div (click)="onNodeClick($event)"></div>`,
99
- standalone: true
197
+ selector: 'ngx-child',
198
+ standalone: true,
199
+ template: `
200
+ <div class="angular">
201
+ <h1>Hello from Angular, {{name}}!</h1>
202
+ <p>Clicks: {{ clicks }}</p>
203
+ <button (click)="increment()">Click me!</button>
204
+ </div>
205
+ `,
206
+ styles: [``]
100
207
  })
101
- export class DemoComponent {
102
- onNodeClick(evt) {
103
- console.log(evt)
208
+ export class AngularComponent {
209
+
210
+ @Input() clicks = 0;
211
+ @Output() clickChange = new EventEmitter<number>();
212
+
213
+ @Input() name;
214
+
215
+ increment() {
216
+ this.clicks++;
217
+ this.clickChange.emit(this.clicks);
104
218
  }
105
219
  }
220
+ ```
221
+
222
+ React component
223
+ ```tsx
224
+ import React, { useState } from 'react';
225
+ import { createRoot } from 'react-dom/client';
226
+
227
+ import './main.css';
228
+ import { ReactifyStandaloneAngularComponent } from 'ngx-reactify';
229
+ import { AngularComponent } from './angular.component';
106
230
 
107
- const AngularReactComponent = ReactifyReactComponent(DemoComponent)
231
+ import "zone.js";
108
232
 
109
- export default function App() {
233
+ const AngularReactComponent = ReactifyStandaloneAngularComponent(AngularComponent, [], 'ngx-react-wrapped', true)
110
234
 
111
- return (
112
- <img src="https://picsum.photos/200" className={'picture'}></img>
235
+ // Main App component
236
+ const App = () => {
237
+ const [angularClicks, setAngularClicks] = useState(10);
113
238
 
114
- <div>
115
-
116
- </div>
117
- )
239
+ return <div>
240
+ <AngularReactComponent
241
+ // This causes React to re-render the Angular
242
+ // component every time angularClicks changes
243
+ // it also enables pre-seeding 2-way bindings
244
+ // This is sub-optimal for Angular flows but
245
+ // follows the intended React practice
246
+ clicks={angularClicks}
247
+ clickChange={setAngularClicks}
248
+
249
+ name="Alex"
250
+ />
251
+ </div>;
118
252
  }
119
- ``` -->
253
+
254
+ const container = document.getElementById('root');
255
+ const root = createRoot(container);
256
+ root.render(
257
+ <React.StrictMode>
258
+ <App />
259
+ </React.StrictMode>
260
+ );
261
+ ```
262
+
263
+
264
+
265
+ #### ad-hoc transformation (WIP)
@@ -377,7 +377,7 @@ class ReactifyNgComponent {
377
377
  // there's only ever one item in the arguments list.
378
378
  this._props[k] = (arg) => {
379
379
  this[k].emit(arg);
380
- this.ngChangeDetector.markForCheck();
380
+ this.ngChangeDetector?.markForCheck();
381
381
  };
382
382
  }
383
383
  else {
@@ -385,7 +385,7 @@ class ReactifyNgComponent {
385
385
  // everything back to the parent component in an array.
386
386
  this._props[k] = (...args) => {
387
387
  this[k].emit(args);
388
- this.ngChangeDetector.markForCheck();
388
+ this.ngChangeDetector?.markForCheck();
389
389
  };
390
390
  }
391
391
  });
@@ -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 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,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;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AA,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 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,U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ACf,iBAAA;;;ACtCD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-reactify",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "repository": {
5
5
  "url": "https://github.com/knackstedt/ngx-reactify"
6
6
  },
@@ -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.FC;
44
+ ngReactComponent: React.FunctionComponent<any> | React.ComponentClass<any>;
45
45
  private _root;
46
46
  private _reactElement;
47
- _props: React.ComponentProps<this["ngReactComponent"]>;
47
+ private _props;
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,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzJ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAGa,mBACT,YAAW,SAAS,EAAE,SAAS,EAAE,aAAa;IAgB1C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB;IAChD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACjC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,iBAAiB;IAf1D;;;OAGG;IACH,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAE3B,OAAO,CAAC,KAAK,CAAO;IAEpB,OAAO,CAAC,aAAa,CAAqB;IAEn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