ngx-reactify 0.0.2 → 0.1.0
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/esm2022/util/angular-to-react.mjs +233 -89
- package/esm2022/util/react-to-angular.mjs +42 -17
- package/fesm2022/ngx-reactify.mjs +273 -104
- package/fesm2022/ngx-reactify.mjs.map +1 -1
- package/package.json +1 -1
- package/util/angular-to-react.d.ts +134 -9
- package/util/angular-to-react.d.ts.map +1 -1
- package/util/react-to-angular.d.ts +33 -7
- package/util/react-to-angular.d.ts.map +1 -1
|
@@ -5,99 +5,245 @@ import * as React from 'react';
|
|
|
5
5
|
import { firstValueFrom } from 'rxjs';
|
|
6
6
|
import { createRoot } from 'react-dom/client';
|
|
7
7
|
|
|
8
|
-
// declare const Zone;
|
|
9
|
-
// const zone = Zone ? new Zone(Zone.current, { name: "@dotglitch_menu", properties: {} }) : null;
|
|
10
8
|
/**
|
|
11
|
-
* Wrap an
|
|
9
|
+
* Wrap an Angular component inside of a React memo object.
|
|
12
10
|
* Will attempt to bind @Input and @Output properties if provided,
|
|
13
11
|
* and will bind the react arguments directly as @Input properties.
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
* @param _outputs
|
|
21
|
-
* @returns
|
|
13
|
+
* Usage: An Angular top-level application with a ReactifyNgComponent react implementation
|
|
14
|
+
* that needs to embed Angular components as children of the react-wrapped component.
|
|
15
|
+
*
|
|
16
|
+
* This is replaced by `WrapAngularComponentInReact`.
|
|
17
|
+
* @deprecated
|
|
22
18
|
*/
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// This makes it so that unnecessary setters are not invoked.
|
|
39
|
-
const updated = Object.entries(inputs).filter(([parentKey, childKey]) => {
|
|
40
|
-
return componentInstance.instance[childKey] != staticInputs[parentKey];
|
|
41
|
-
});
|
|
42
|
-
updated.forEach(([parentKey, childKey]) => {
|
|
43
|
-
if (staticInputs.hasOwnProperty(parentKey))
|
|
44
|
-
componentInstance.instance[childKey] = staticInputs[parentKey];
|
|
45
|
-
});
|
|
46
|
-
const outputSubscriptions = {};
|
|
47
|
-
// Get a list of unregistered outputs
|
|
48
|
-
const newOutputs = Object.entries(outputs).filter(([parentKey, childKey]) => {
|
|
49
|
-
return !outputSubscriptions[parentKey];
|
|
50
|
-
});
|
|
51
|
-
// Reverse bind via subscription
|
|
52
|
-
newOutputs.forEach(([parentKey, childKey]) => {
|
|
53
|
-
if (!staticOutputs.hasOwnProperty(parentKey))
|
|
54
|
-
return;
|
|
55
|
-
const target = componentInstance.instance[childKey];
|
|
56
|
-
const outputs = staticOutputs;
|
|
57
|
-
const sub = target.subscribe((...args) => {
|
|
58
|
-
// Run the callback in the provided zone
|
|
59
|
-
ngZone.run(() => {
|
|
60
|
-
outputs[parentKey](...args);
|
|
61
|
-
});
|
|
62
|
-
}); // Subscription
|
|
63
|
-
outputSubscriptions[parentKey] = sub;
|
|
64
|
-
});
|
|
65
|
-
// Wrap the destroy method to safely release the subscriptions
|
|
66
|
-
const originalDestroy = componentInstance.onDestroy?.bind(componentInstance);
|
|
67
|
-
componentInstance.onDestroy = (cb) => {
|
|
19
|
+
const ReactifyAngularComponent = ({ component, appRef, injector, ngZone, staticInputs = {}, staticOutputs = {}, preSiblings = [], postSiblings = [], additionalChildren = [], rootElementName = '', containerElementName = '' }) => React.memo((args) => {
|
|
20
|
+
return ngZone.runOutsideAngular(() => {
|
|
21
|
+
let outputSubscriptions;
|
|
22
|
+
let componentInstance;
|
|
23
|
+
const tripChangeDetection = () => componentInstance?.changeDetectorRef?.detectChanges();
|
|
24
|
+
// These attributes will trigger change detection when they fire from
|
|
25
|
+
// the underlying React element.
|
|
26
|
+
// ... This will break things. FUCK.
|
|
27
|
+
const attributes = ['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'];
|
|
28
|
+
const attrObj = {};
|
|
29
|
+
attributes.forEach(a => attrObj[a] = tripChangeDetection);
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
return () => {
|
|
32
|
+
// Code to run when the component unmounts
|
|
33
|
+
appRef?.detachView(componentInstance.hostView);
|
|
68
34
|
Object.values(outputSubscriptions).forEach(s => s.unsubscribe());
|
|
69
|
-
|
|
35
|
+
componentInstance?.destroy();
|
|
70
36
|
};
|
|
71
|
-
|
|
37
|
+
}, []);
|
|
38
|
+
const elements = [
|
|
39
|
+
...(preSiblings || []),
|
|
40
|
+
React.createElement(containerElementName || "div", {
|
|
41
|
+
...attrObj,
|
|
42
|
+
ref: node => {
|
|
43
|
+
const { inputs, outputs } = component['ɵcmp'];
|
|
44
|
+
if (componentInstance)
|
|
45
|
+
return;
|
|
46
|
+
ngZone.run(() => {
|
|
47
|
+
componentInstance = createComponent(component, {
|
|
48
|
+
environmentInjector: appRef.injector,
|
|
49
|
+
elementInjector: injector,
|
|
50
|
+
hostElement: node
|
|
51
|
+
});
|
|
52
|
+
Object.assign(staticInputs, args);
|
|
53
|
+
appRef.attachView(componentInstance.hostView);
|
|
54
|
+
});
|
|
55
|
+
// Returns a list of entries that need to be set
|
|
56
|
+
// This makes it so that unnecessary setters are not invoked.
|
|
57
|
+
const updated = Object.entries(inputs).filter(([parentKey, childKey]) => {
|
|
58
|
+
return componentInstance.instance[childKey] != staticInputs[parentKey];
|
|
59
|
+
});
|
|
60
|
+
updated.forEach(([parentKey, childKey]) => {
|
|
61
|
+
if (staticInputs.hasOwnProperty(parentKey))
|
|
62
|
+
componentInstance.instance[childKey] = staticInputs[parentKey];
|
|
63
|
+
});
|
|
64
|
+
outputSubscriptions = {};
|
|
65
|
+
// Get a list of unregistered outputs
|
|
66
|
+
const newOutputs = Object.entries(outputs).filter(([parentKey, childKey]) => {
|
|
67
|
+
return !outputSubscriptions[parentKey];
|
|
68
|
+
});
|
|
69
|
+
// Reverse bind via subscription
|
|
70
|
+
newOutputs.forEach(([parentKey, childKey]) => {
|
|
71
|
+
if (!staticOutputs.hasOwnProperty(parentKey))
|
|
72
|
+
return;
|
|
73
|
+
const target = componentInstance.instance[childKey];
|
|
74
|
+
const outputs = staticOutputs;
|
|
75
|
+
const sub = target.subscribe((...args) => {
|
|
76
|
+
// Run the callback in the provided zone
|
|
77
|
+
ngZone.run(() => {
|
|
78
|
+
outputs[parentKey](...args);
|
|
79
|
+
});
|
|
80
|
+
}); // Subscription
|
|
81
|
+
outputSubscriptions[parentKey] = sub;
|
|
82
|
+
});
|
|
83
|
+
// Wrap the destroy method to safely release the subscriptions
|
|
84
|
+
const originalDestroy = componentInstance.onDestroy?.bind(componentInstance);
|
|
85
|
+
componentInstance.onDestroy = (cb) => {
|
|
86
|
+
Object.values(outputSubscriptions).forEach(s => s.unsubscribe());
|
|
87
|
+
originalDestroy?.(cb);
|
|
88
|
+
};
|
|
89
|
+
componentInstance.changeDetectorRef.detectChanges();
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
...(postSiblings || []),
|
|
93
|
+
...(additionalChildren || [])
|
|
94
|
+
].filter(e => e);
|
|
95
|
+
return React.createElement(rootElementName || "div", {}, ...elements);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Do not use this.
|
|
100
|
+
* @hidden
|
|
101
|
+
* @experimental
|
|
102
|
+
*/
|
|
103
|
+
const ng2ReactProps = (obj = {}) => {
|
|
104
|
+
const props = {};
|
|
105
|
+
Object.entries(obj).forEach(([k, v]) => {
|
|
106
|
+
// Omit things prefixed with an underscore
|
|
107
|
+
if (k.startsWith('_'))
|
|
108
|
+
return;
|
|
109
|
+
// Omit output event emitters
|
|
110
|
+
if (v instanceof EventEmitter) {
|
|
111
|
+
props[k] = (...args) => v.emit([args]);
|
|
72
112
|
}
|
|
73
|
-
|
|
74
|
-
|
|
113
|
+
else {
|
|
114
|
+
props[k] = v;
|
|
75
115
|
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
116
|
+
});
|
|
117
|
+
return props;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* This method will create a React component that
|
|
121
|
+
* wraps an Angular component.
|
|
122
|
+
* @returns React.NamedExoticComponent
|
|
123
|
+
*
|
|
124
|
+
* @hidden
|
|
125
|
+
* @experimental
|
|
126
|
+
*/
|
|
127
|
+
function WrapAngularComponentInReact({ component, ngZone, appRef, injector, props, containerTag, reactTemplate, projectableNodes }) {
|
|
128
|
+
props ??= {};
|
|
129
|
+
containerTag ??= 'div';
|
|
87
130
|
const ctx = this;
|
|
88
|
-
|
|
131
|
+
const createWrappedElement = () => {
|
|
89
132
|
// Is there a better way to do this?
|
|
90
133
|
let subscriptions;
|
|
91
|
-
let
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
134
|
+
let componentInstance;
|
|
135
|
+
reactTemplate ??= (el) => el;
|
|
136
|
+
return React.memo((args) => {
|
|
137
|
+
Object.assign(props, args);
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
return () => {
|
|
140
|
+
// Cleanup and dispose leftover Angular objects
|
|
141
|
+
appRef?.detachView(componentInstance.hostView);
|
|
142
|
+
subscriptions?.forEach(s => s?.unsubscribe());
|
|
143
|
+
componentInstance?.destroy();
|
|
144
|
+
};
|
|
145
|
+
}, []);
|
|
146
|
+
const tripChangeDetection = () => componentInstance?.changeDetectorRef?.detectChanges();
|
|
147
|
+
// These attributes will trigger change detection when they fire from
|
|
148
|
+
// the underlying React element.
|
|
149
|
+
// ... This will break things. FUCK.
|
|
150
|
+
const attributes = ['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'];
|
|
151
|
+
const attrObj = {};
|
|
152
|
+
attributes.forEach(a => attrObj[a] = tripChangeDetection);
|
|
153
|
+
return reactTemplate(React.createElement(containerTag, {
|
|
154
|
+
...attrObj,
|
|
155
|
+
ref: async (node) => {
|
|
156
|
+
if (componentInstance)
|
|
157
|
+
return;
|
|
158
|
+
// Not sure if this ever actually happens, added as a preventative measure
|
|
159
|
+
// to memory leaks.
|
|
160
|
+
subscriptions?.forEach(s => s?.unsubscribe());
|
|
161
|
+
const bootstrap = () => {
|
|
162
|
+
// Init the Angular component with the context of the root Angular app.
|
|
163
|
+
componentInstance = createComponent(component, {
|
|
164
|
+
environmentInjector: appRef.injector,
|
|
165
|
+
elementInjector: injector,
|
|
166
|
+
hostElement: node,
|
|
167
|
+
projectableNodes: projectableNodes
|
|
168
|
+
});
|
|
169
|
+
appRef.attachView(componentInstance.hostView);
|
|
170
|
+
};
|
|
171
|
+
ngZone?.runTask
|
|
172
|
+
? ngZone?.runTask(bootstrap)
|
|
173
|
+
: bootstrap();
|
|
174
|
+
// Now that everything has settled, bind inputs and outputs.
|
|
175
|
+
subscriptions = [];
|
|
176
|
+
Object.entries(props).filter(([k, v]) => {
|
|
177
|
+
// @Outputs are always Event Emitters (I think)
|
|
178
|
+
if (v instanceof EventEmitter) {
|
|
179
|
+
subscriptions.push(componentInstance.instance[k]?.subscribe(evt => props[k].call(ctx, evt)));
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
componentInstance.instance[k] = props[k];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
componentInstance.changeDetectorRef.detectChanges();
|
|
186
|
+
}
|
|
187
|
+
}));
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
return ngZone?.runOutsideAngular
|
|
191
|
+
? ngZone?.runOutsideAngular(createWrappedElement)
|
|
192
|
+
: createWrappedElement();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* This method will automatically wrap an Angular
|
|
196
|
+
* Component or Directive into a React object.
|
|
197
|
+
* @Outputs (EventEmitters) will be automatically
|
|
198
|
+
* linked into the input properties along with
|
|
199
|
+
* all of the @Inputs.
|
|
200
|
+
* @returns React.NamedExoticComponent
|
|
201
|
+
* @experimental
|
|
202
|
+
*/
|
|
203
|
+
const AutoWrapAngularObject = ({ component, appRef, ngZone, instance, injector, containerTag, reactTemplate, }) => {
|
|
204
|
+
const props = ng2ReactProps(instance);
|
|
205
|
+
return WrapAngularComponentInReact({
|
|
206
|
+
component,
|
|
207
|
+
ngZone,
|
|
208
|
+
appRef,
|
|
209
|
+
injector,
|
|
210
|
+
containerTag,
|
|
211
|
+
props,
|
|
212
|
+
reactTemplate
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Bootstrap an Angular component with `createApplication` and export it under a
|
|
217
|
+
* react Element.
|
|
218
|
+
* Usage: React top-level application embedding an Angular component.
|
|
219
|
+
*/
|
|
220
|
+
function ReactifyStandaloneAngularComponent(component, props = {}, providers = [], containerTag = 'div') {
|
|
221
|
+
const ctx = this;
|
|
222
|
+
// Is there a better way to do this?
|
|
223
|
+
let subscriptions;
|
|
224
|
+
let app;
|
|
225
|
+
React.useEffect(() => {
|
|
226
|
+
return () => {
|
|
227
|
+
// Code to run when the component unmounts
|
|
228
|
+
subscriptions?.forEach(s => s?.unsubscribe());
|
|
229
|
+
app?.destroy();
|
|
230
|
+
};
|
|
231
|
+
}, []);
|
|
232
|
+
return React.createElement(containerTag, {
|
|
233
|
+
ref: async (node) => {
|
|
234
|
+
// Not sure if this ever actually happens, added as a preventative measure
|
|
235
|
+
// to memory leaks.
|
|
236
|
+
subscriptions?.forEach(s => s?.unsubscribe());
|
|
237
|
+
app?.destroy();
|
|
238
|
+
// Init an Angular application root & bootstrap it to a DOM element.
|
|
239
|
+
app = await createApplication({ providers });
|
|
240
|
+
const base = app.bootstrap(component, node);
|
|
96
241
|
const { instance } = base;
|
|
242
|
+
// Wait for the JS to finish rendering and initing.
|
|
97
243
|
await firstValueFrom(app.isStable);
|
|
98
|
-
//
|
|
244
|
+
// Now that everything has settled, bind inputs and outputs.
|
|
99
245
|
subscriptions = [];
|
|
100
|
-
Object.entries(
|
|
246
|
+
Object.entries(props).filter(([k, v]) => {
|
|
101
247
|
// @Outputs are always Event Emitters (I think)
|
|
102
248
|
if (v instanceof EventEmitter) {
|
|
103
249
|
subscriptions.push(instance[k]?.subscribe(evt => props[k].call(ctx, evt)));
|
|
@@ -106,33 +252,56 @@ const ReactifyAngularComponent2 = (component, props) => {
|
|
|
106
252
|
instance[k] = props[k];
|
|
107
253
|
}
|
|
108
254
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return React.createElement("div");
|
|
118
|
-
};
|
|
255
|
+
base.changeDetectorRef.detectChanges();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
// These exports exist to attempt to make the API have minimal breaking changes.
|
|
260
|
+
const ReactifyReactComponent = ReactifyAngularComponent;
|
|
261
|
+
const ReactifyAngularComponent3 = WrapAngularComponentInReact;
|
|
262
|
+
;
|
|
119
263
|
|
|
120
264
|
/**
|
|
121
|
-
*
|
|
122
|
-
* bindings
|
|
265
|
+
* This component can be used to automatically wrap a React
|
|
266
|
+
* component into Angular bindings with functional change detection.
|
|
267
|
+
* All you need to provide is the @Input and @Output interface
|
|
268
|
+
* for the component in order to tell Angular which keys correspond to what.
|
|
269
|
+
*
|
|
270
|
+
* ### You _must_ override the property `ngReactComponent`.
|
|
123
271
|
*
|
|
124
|
-
* ! You _must_ override the property `ngReactComponent`
|
|
125
272
|
* Failure to do so will result in errors
|
|
126
|
-
*
|
|
273
|
+
*
|
|
274
|
+
* `override readonly ngReactComponent = SomeReactFunction;`
|
|
275
|
+
*
|
|
276
|
+
* Example:
|
|
277
|
+
*
|
|
278
|
+
* ```ts
|
|
279
|
+
* @Component({
|
|
280
|
+
* selector: "app-react-wrapped",
|
|
281
|
+
* standalone: true
|
|
282
|
+
* })
|
|
283
|
+
* export class MyReactWrappedComponent extends ReactifyNgComponent {
|
|
284
|
+
*
|
|
285
|
+
* @Input() data: any;
|
|
286
|
+
* @Input() options: any;
|
|
287
|
+
* @Input() version: any;
|
|
288
|
+
*
|
|
289
|
+
* // Notice how we wrap the result in an array, this is important because
|
|
290
|
+
* // React can pass multiple properties to a callback and Angular can't.
|
|
291
|
+
* @Output() onClick = new EventEmitter<[any]>();
|
|
292
|
+
*
|
|
293
|
+
* }
|
|
294
|
+
* ```
|
|
127
295
|
*/
|
|
128
296
|
class ReactifyNgComponent {
|
|
129
297
|
constructor(ngContainer, ngZone) {
|
|
130
298
|
this.ngContainer = ngContainer;
|
|
131
299
|
this.ngZone = ngZone;
|
|
300
|
+
this._props = {};
|
|
132
301
|
}
|
|
133
302
|
ngOnInit() {
|
|
134
303
|
if (!this.ngReactComponent) {
|
|
135
|
-
throw new Error("
|
|
304
|
+
throw new Error("ReactifyNgComponent cannot be inherited without a provided ngReactComponent!");
|
|
136
305
|
}
|
|
137
306
|
}
|
|
138
307
|
ngOnChanges(changes) {
|
|
@@ -156,33 +325,33 @@ class ReactifyNgComponent {
|
|
|
156
325
|
// List all keys that do not start with `_` nor `ng`
|
|
157
326
|
const keys = Object.keys(this).filter(k => !/^(?:_|ng)/.test(k));
|
|
158
327
|
// Get all property keys from the class
|
|
159
|
-
const propKeys = keys.filter(k => !k
|
|
328
|
+
const propKeys = keys.filter(k => !(this[k] instanceof EventEmitter));
|
|
160
329
|
// Get all event handler keys from the class
|
|
161
|
-
const evtKeys = keys.filter(k => k
|
|
162
|
-
const props = {};
|
|
330
|
+
const evtKeys = keys.filter(k => this[k] instanceof EventEmitter);
|
|
163
331
|
// Project all key properties onto `props`
|
|
164
|
-
propKeys.forEach(k =>
|
|
332
|
+
propKeys.forEach(k => this._props[k] = this[k]);
|
|
165
333
|
// Attempt to ensure no zone is lost during the event emitter fires
|
|
166
334
|
this.ngZone.runGuarded(() => {
|
|
167
335
|
// Bind all event handlers.
|
|
168
336
|
// ! important Angular uses EventEmitter, React uses
|
|
169
337
|
// a different method of event binding
|
|
170
|
-
evtKeys.forEach(k =>
|
|
338
|
+
evtKeys.forEach(k => this._props[k] = (...args) => this[k].next(args));
|
|
171
339
|
});
|
|
172
|
-
this.
|
|
340
|
+
this._reactElement = React.createElement(this.ngReactComponent, { props: this._props });
|
|
341
|
+
this._root.render(this._reactElement);
|
|
173
342
|
}
|
|
174
343
|
catch (err) {
|
|
175
344
|
console.error(err);
|
|
176
345
|
}
|
|
177
346
|
});
|
|
178
347
|
}
|
|
179
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
180
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
348
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReactifyNgComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
349
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ReactifyNgComponent, isStandalone: true, selector: "ngx-reactify", usesOnChanges: true, ngImport: i0, template: ``, isInline: true }); }
|
|
181
350
|
}
|
|
182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ReactifyNgComponent, decorators: [{
|
|
183
352
|
type: Component,
|
|
184
353
|
args: [{
|
|
185
|
-
selector: '
|
|
354
|
+
selector: 'ngx-reactify',
|
|
186
355
|
template: ``,
|
|
187
356
|
standalone: true
|
|
188
357
|
}]
|
|
@@ -192,5 +361,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
192
361
|
* Generated bundle index. Do not edit.
|
|
193
362
|
*/
|
|
194
363
|
|
|
195
|
-
export {
|
|
364
|
+
export { AutoWrapAngularObject, ReactifyAngularComponent, ReactifyAngularComponent3, ReactifyNgComponent, ReactifyReactComponent, ReactifyStandaloneAngularComponent, WrapAngularComponentInReact, ng2ReactProps };
|
|
196
365
|
//# 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 } from '@angular/core';\nimport { createApplication } from '@angular/platform-browser';\nimport * as React from 'react';\nimport { firstValueFrom, Subscription } from 'rxjs';\n\n\n// declare const Zone;\n// const zone = Zone ? new Zone(Zone.current, { name: \"@dotglitch_menu\", properties: {} }) : null;\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 * @experimental\n * @param componentClass Angular component\n * @param envInjector An `EnvironmentInjector` instance to be used for the component\n * @param injector An `ElementInjector` instance\n * @param _inputs\n * @param _outputs\n * @returns\n */\nexport const ReactifyReactComponent = ({\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 const id = Math.random().toString();\n React.useEffect(() => {\n try {\n\n const componentInstance = createComponent(component, {\n environmentInjector: appRef.injector,\n elementInjector: injector,\n hostElement: document.getElementById(id)\n });\n\n appRef.attachView(componentInstance.hostView);\n // @ts-ignore\n // component.hostView = hostView;\n\n Object.assign(staticInputs, args);\n\n const { inputs, outputs } = component['ɵcmp'];\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 const outputSubscriptions: { [key: string]: Subscription; } = {};\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 catch (err) {\n console.error(err);\n }\n }, []);\n\n const elements = [\n ...(preSiblings || []),\n React.createElement(containerElementName || \"div\", { id }),\n ...(postSiblings || []),\n ...(additionalChildren || [])\n ].filter(e => e);\n\n return React.createElement(rootElementName || \"div\", {}, ...elements);\n});\n\n\nexport const ReactifyAngularComponent2 = (\n component: Type<any>,\n props: any\n) => {\n const inputRef = React.useRef(null);\n const ctx = this;\n\n React.useEffect(() => {\n // Is there a better way to do this?\n let subscriptions: Subscription[];\n let app: ApplicationRef;\n (async () => {\n // Code to run when the component mounts\n app = await createApplication({ providers: [] });\n const base = app.bootstrap(component, inputRef.current);\n const { instance } = base;\n\n await firstValueFrom(app.isStable);\n\n // App has now bootstrapped fully.\n subscriptions = [];\n Object.entries(instance).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\n return () => {\n // Code to run when the component unmounts\n subscriptions?.forEach(s => s?.unsubscribe());\n app?.destroy();\n };\n }, []); // Empty dependency array ensures this effect runs only once on mount and cleanup on unmount\n\n const obj = {};\n\n return React.createElement(\"div\")\n}\n","import { AfterViewInit, ApplicationRef, Component, ComponentFactoryResolver, EnvironmentInjector, EventEmitter, Injector, NgZone, OnChanges, OnDestroy, SimpleChanges, Type, ViewContainerRef, ViewRef, createComponent } from '@angular/core';\nimport * as React from 'react';\nimport { createRoot, Root } from 'react-dom/client';\n\n\n/**\n * Extend this component to automatically generate\n * bindings to a React component.\n *\n * ! You _must_ override the property `ngReactComponent`\n * Failure to do so will result in errors\n * `override readonly ngReactComponent = ReactFlowWrappableComponent;`\n */\n@Component({\n selector: 'app-react-magic-wrapper',\n template: ``,\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 constructor(\n private readonly ngContainer: ViewContainerRef,\n private readonly ngZone: NgZone\n ) {\n }\n\n ngOnInit() {\n if (!this.ngReactComponent) {\n throw new Error(\"ReactMagicWrapperComponent cannot start 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 => !k.startsWith(\"on\"));\n // Get all event handler keys from the class\n const evtKeys = keys.filter(k => k.startsWith(\"on\"));\n\n const props = {};\n // Project all key properties onto `props`\n propKeys.forEach(k => 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 => props[k] = (...args) => this[k].next(args));\n })\n\n this._root.render(React.createElement(this.ngReactComponent, { props: props as any }));\n }\n catch(err) {\n console.error(err)\n }\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["this"],"mappings":";;;;;;;AAMA;AACA;AAEA;;;;;;;;;;;;AAYG;AACU,MAAA,sBAAsB,GAAG,CAAC,EACnC,SAAS,EACT,MAAM,EACN,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EAavB,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAI;IAEtB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;AACnC,IAAA,KAAK,CAAC,SAAS,CAAC,MAAK;AACjB,QAAA,IAAI;AAEA,YAAA,MAAM,iBAAiB,GAAG,eAAe,CAAC,SAAS,EAAE;gBACjD,mBAAmB,EAAE,MAAM,CAAC,QAAQ;AACpC,gBAAA,eAAe,EAAE,QAAQ;AACzB,gBAAA,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,EAAE;AAC1C,aAAA,CAAC;AAEF,YAAA,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC;;;AAI7C,YAAA,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC;YAEjC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CA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AAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,KAAY,EAAE,CAAC,CAAC;;YAE1F,OAAM,GAAG,EAAE;AACP,gBAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;;AAE1B,SAAC,CAAC;;8GArEG,mBAAmB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,MAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,mBAAmB,wGAHlB,CAAE,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;2FAGH,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAL/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,QAAQ,EAAE,CAAE,CAAA;AACZ,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACjBD;;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 // Is there a better way to do this?\n let subscriptions: Subscription[];\n let componentInstance: ComponentRef<any>;\n\n reactTemplate ??= (el) => el;\n return React.memo((args) => {\n Object.assign(props, args);\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, Component, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChanges, ViewContainerRef } from '@angular/core';\nimport * as React from 'react';\nimport { createRoot, Root } from 'react-dom/client';\n\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@Component({\n selector: 'ngx-reactify',\n template: ``,\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 ) {\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 => this._props[k] = (...args) => this[k].next(args));\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 * 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,GAA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