@memberjunction/ng-react 6.1.4 → 6.2.0-edge.1

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.
Files changed (27) hide show
  1. package/dist/__tests__/react-bridge.service.test.js +11 -3
  2. package/dist/__tests__/react-bridge.service.test.js.map +1 -1
  3. package/dist/lib/components/mj-react-component.component.d.ts +128 -14
  4. package/dist/lib/components/mj-react-component.component.js +313 -207
  5. package/dist/lib/components/mj-react-component.component.js.map +1 -1
  6. package/dist/lib/config/react-debug.config.d.ts +4 -0
  7. package/dist/lib/config/react-debug.config.js +10 -2
  8. package/dist/lib/config/react-debug.config.js.map +1 -1
  9. package/dist/lib/hooks/antd-dropdown-position-hook.d.ts +2 -0
  10. package/dist/lib/hooks/antd-dropdown-position-hook.js +5 -1
  11. package/dist/lib/hooks/antd-dropdown-position-hook.js.map +1 -1
  12. package/dist/lib/services/angular-adapter.service.d.ts +32 -0
  13. package/dist/lib/services/angular-adapter.service.js +78 -18
  14. package/dist/lib/services/angular-adapter.service.js.map +1 -1
  15. package/dist/lib/services/react-bridge.service.d.ts +26 -2
  16. package/dist/lib/services/react-bridge.service.js +66 -18
  17. package/dist/lib/services/react-bridge.service.js.map +1 -1
  18. package/dist/lib/services/script-loader.service.d.ts +17 -0
  19. package/dist/lib/services/script-loader.service.js +26 -6
  20. package/dist/lib/services/script-loader.service.js.map +1 -1
  21. package/package.json +10 -10
  22. package/dist/__tests__/runtime-utilities-ml.test.d.ts +0 -1
  23. package/dist/__tests__/runtime-utilities-ml.test.js +0 -170
  24. package/dist/__tests__/runtime-utilities-ml.test.js.map +0 -1
  25. package/dist/lib/utilities/runtime-utilities.d.ts +0 -80
  26. package/dist/lib/utilities/runtime-utilities.js +0 -396
  27. package/dist/lib/utilities/runtime-utilities.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"antd-dropdown-position-hook.js","sourceRoot":"","sources":["../../../src/lib/hooks/antd-dropdown-position-hook.ts"],"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H,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,SAAS;YACP,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACtB,QAAQ,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,IAAI,YAAY,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;gBAC5C,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;gBAClD,YAAY,GAAG,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @fileoverview Runtime hook that fixes antd dropdown positioning\n * when running inside Angular's CSS transform context.\n *\n * antd's popup positioning (via rc-trigger / dom-align) calculates wrong\n * coordinates inside Angular because Angular applies CSS transforms that\n * break getBoundingClientRect-based positioning. This hook:\n *\n * 1. Injects a CSS rule using !important with CSS custom properties to\n * override antd's inline left/top values. The fallback (-9999px) hides\n * dropdowns until positioned, preventing flash-of-wrong-position.\n *\n * 2. Creates a MutationObserver that catches dropdown elements when\n * added to the DOM and sets the CSS variables to correct viewport-\n * relative coordinates based on the trigger element's position.\n *\n * This hook is Angular-specific and should only be registered when\n * running inside an Angular host application.\n *\n * @module @memberjunction/ng-react\n */\nimport { RuntimeHook, RootHookContext } from '@memberjunction/react-runtime';\n\nconst DROPDOWN_SELECTOR = '.ant-select-dropdown, .ant-picker-dropdown, .ant-cascader-dropdown';\nconst TRIGGER_SELECTOR = '.ant-select-open, .ant-picker-focused, .ant-dropdown-open';\n\n/**\n * Creates a RuntimeHook that fixes antd dropdown positioning inside Angular.\n * Uses position:absolute (antd's default) rather than position:fixed to\n * preserve antd's virtual scroll behavior inside dropdown panels.\n */\nexport function createAntdDropdownPositionHook(): RuntimeHook {\n let observer: MutationObserver | null = null;\n let styleElement: HTMLStyleElement | null = null;\n\n const fixDropdown = (dd: HTMLElement): void => {\n if (dd.hasAttribute('data-pos-fixed')) return;\n const trigger = document.querySelector(TRIGGER_SELECTOR);\n if (!trigger) return;\n\n const tRect = trigger.getBoundingClientRect();\n const op = dd.offsetParent as HTMLElement | null;\n\n if (op) {\n // Position relative to offset parent (keeps position:absolute working)\n const opRect = op.getBoundingClientRect();\n dd.style.setProperty('--dd-left', `${tRect.left - opRect.left}px`);\n dd.style.setProperty('--dd-top', `${tRect.bottom - opRect.top + 2}px`);\n } else {\n // No offset parent — fall back to viewport coordinates\n dd.style.setProperty('--dd-left', `${tRect.left}px`);\n dd.style.setProperty('--dd-top', `${tRect.bottom + 2}px`);\n }\n dd.setAttribute('data-pos-fixed', '1');\n };\n\n return {\n name: 'antd-dropdown-position-fix',\n\n OnFirstRootCreated(_context: RootHookContext): void {\n if (typeof document === 'undefined') return;\n\n // CSS !important overrides antd's inline left/top permanently.\n // CSS custom properties (--dd-left, --dd-top) are set per-element from JS.\n // Fallback of -9999px hides dropdowns until the observer positions them.\n styleElement = document.createElement('style');\n styleElement.textContent =\n DROPDOWN_SELECTOR +\n ' { left: var(--dd-left, -9999px) !important; top: var(--dd-top, -9999px) !important; z-index: 99999 !important; }';\n document.head.appendChild(styleElement);\n\n // Watch for dropdown elements being added to the DOM.\n // Only watches childList (not attributes) to avoid firing during scroll/hover.\n observer = new MutationObserver((mutations) => {\n for (const m of mutations) {\n const addedNodes = Array.from(m.addedNodes);\n for (const node of addedNodes) {\n if (node.nodeType !== 1) continue;\n const el = node as HTMLElement;\n\n // Check if the added node itself is a dropdown\n if (el.className && typeof el.className === 'string' &&\n /\\bant-(select|picker|cascader)-dropdown\\b/.test(el.className)) {\n fixDropdown(el);\n }\n\n // Check descendants (dropdown may be nested inside a wrapper)\n if (el.querySelectorAll) {\n const nested = el.querySelectorAll(DROPDOWN_SELECTOR);\n nested.forEach((n) => fixDropdown(n as HTMLElement));\n }\n }\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n },\n\n OnCleanup(): void {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n if (styleElement && styleElement.parentNode) {\n styleElement.parentNode.removeChild(styleElement);\n styleElement = null;\n }\n }\n };\n}\n"]}
1
+ {"version":3,"file":"antd-dropdown-position-hook.js","sourceRoot":"","sources":["../../../src/lib/hooks/antd-dropdown-position-hook.ts"],"names":[],"mappings":"AAuBA,MAAM,iBAAiB,GAAG,oEAAoE,CAAC;AAC/F,MAAM,gBAAgB,GAAG,2DAA2D,CAAC;AAErF;;;;GAIG;AACH,MAAM,UAAU,8BAA8B;IAC5C,IAAI,QAAQ,GAA4B,IAAI,CAAC;IAC7C,IAAI,YAAY,GAA4B,IAAI,CAAC;IAEjD,MAAM,WAAW,GAAG,CAAC,EAAe,EAAQ,EAAE;QAC5C,IAAI,EAAE,CAAC,YAAY,CAAC,gBAAgB,CAAC;YAAE,OAAO;QAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,KAAK,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,YAAkC,CAAC;QAEjD,IAAI,EAAE,EAAE,CAAC;YACP,uEAAuE;YACvE,MAAM,MAAM,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC;YAC1C,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;YACnE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACzE,CAAC;aAAM,CAAC;YACN,uDAAuD;YACvD,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,KAAK,C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,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;4BACtD,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAgB,CAAC,CAAC,CAAC;wBACvD,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,SAAS;YACP,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACtB,QAAQ,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,IAAI,YAAY,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;gBAC5C,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;gBAClD,YAAY,GAAG,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,8BAA8B;IAC5C,OAAO,8BAA8B,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * @fileoverview Runtime hook that fixes antd dropdown positioning\n * when running inside Angular's CSS transform context.\n *\n * antd's popup positioning (via rc-trigger / dom-align) calculates wrong\n * coordinates inside Angular because Angular applies CSS transforms that\n * break getBoundingClientRect-based positioning. This hook:\n *\n * 1. Injects a CSS rule using !important with CSS custom properties to\n * override antd's inline left/top values. The fallback (-9999px) hides\n * dropdowns until positioned, preventing flash-of-wrong-position.\n *\n * 2. Creates a MutationObserver that catches dropdown elements when\n * added to the DOM and sets the CSS variables to correct viewport-\n * relative coordinates based on the trigger element's position.\n *\n * This hook is Angular-specific and should only be registered when\n * running inside an Angular host application.\n *\n * @module @memberjunction/ng-react\n */\nimport { RuntimeHook, RootHookContext } from '@memberjunction/react-runtime';\n\nconst DROPDOWN_SELECTOR = '.ant-select-dropdown, .ant-picker-dropdown, .ant-cascader-dropdown';\nconst TRIGGER_SELECTOR = '.ant-select-open, .ant-picker-focused, .ant-dropdown-open';\n\n/**\n * Creates a RuntimeHook that fixes antd dropdown positioning inside Angular.\n * Uses position:absolute (antd's default) rather than position:fixed to\n * preserve antd's virtual scroll behavior inside dropdown panels.\n */\nexport function CreateAntdDropdownPositionHook(): RuntimeHook {\n let observer: MutationObserver | null = null;\n let styleElement: HTMLStyleElement | null = null;\n\n const fixDropdown = (dd: HTMLElement): void => {\n if (dd.hasAttribute('data-pos-fixed')) return;\n const trigger = document.querySelector(TRIGGER_SELECTOR);\n if (!trigger) return;\n\n const tRect = trigger.getBoundingClientRect();\n const op = dd.offsetParent as HTMLElement | null;\n\n if (op) {\n // Position relative to offset parent (keeps position:absolute working)\n const opRect = op.getBoundingClientRect();\n dd.style.setProperty('--dd-left', `${tRect.left - opRect.left}px`);\n dd.style.setProperty('--dd-top', `${tRect.bottom - opRect.top + 2}px`);\n } else {\n // No offset parent — fall back to viewport coordinates\n dd.style.setProperty('--dd-left', `${tRect.left}px`);\n dd.style.setProperty('--dd-top', `${tRect.bottom + 2}px`);\n }\n dd.setAttribute('data-pos-fixed', '1');\n };\n\n return {\n name: 'antd-dropdown-position-fix',\n\n OnFirstRootCreated(_context: RootHookContext): void {\n if (typeof document === 'undefined') return;\n\n // CSS !important overrides antd's inline left/top permanently.\n // CSS custom properties (--dd-left, --dd-top) are set per-element from JS.\n // Fallback of -9999px hides dropdowns until the observer positions them.\n styleElement = document.createElement('style');\n styleElement.textContent =\n DROPDOWN_SELECTOR +\n ' { left: var(--dd-left, -9999px) !important; top: var(--dd-top, -9999px) !important; z-index: 99999 !important; }';\n document.head.appendChild(styleElement);\n\n // Watch for dropdown elements being added to the DOM.\n // Only watches childList (not attributes) to avoid firing during scroll/hover.\n observer = new MutationObserver((mutations) => {\n for (const m of mutations) {\n const addedNodes = Array.from(m.addedNodes);\n for (const node of addedNodes) {\n if (node.nodeType !== 1) continue;\n const el = node as HTMLElement;\n\n // Check if the added node itself is a dropdown\n if (el.className && typeof el.className === 'string' &&\n /\\bant-(select|picker|cascader)-dropdown\\b/.test(el.className)) {\n fixDropdown(el);\n }\n\n // Check descendants (dropdown may be nested inside a wrapper)\n if (el.querySelectorAll) {\n const nested = el.querySelectorAll(DROPDOWN_SELECTOR);\n nested.forEach((n) => fixDropdown(n as HTMLElement));\n }\n }\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n },\n\n OnCleanup(): void {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n if (styleElement && styleElement.parentNode) {\n styleElement.parentNode.removeChild(styleElement);\n styleElement = null;\n }\n }\n };\n}\n\n/** @deprecated Use {@link CreateAntdDropdownPositionHook}. */\nexport function createAntdDropdownPositionHook(): RuntimeHook {\n return CreateAntdDropdownPositionHook();\n}\n"]}
@@ -27,6 +27,8 @@ export declare class AngularAdapterService {
27
27
  * Safe to call multiple times — the underlying initialize() deduplicates.
28
28
  * Does not block: returns immediately, initialization continues in background.
29
29
  */
30
+ Preload(): void;
31
+ /** @deprecated Use {@link Preload}. */
30
32
  preload(): void;
31
33
  /**
32
34
  * Initialize the React runtime with Angular-specific configuration
@@ -35,6 +37,10 @@ export declare class AngularAdapterService {
35
37
  * @param options Optional options including debug flag
36
38
  * @returns Promise resolving when runtime is ready
37
39
  */
40
+ Initialize(config?: LibraryConfiguration, additionalLibraries?: ExternalLibraryConfig[], options?: {
41
+ debug?: boolean;
42
+ }): Promise<void>;
43
+ /** @deprecated Use {@link Initialize}. */
38
44
  initialize(config?: LibraryConfiguration, additionalLibraries?: ExternalLibraryConfig[], options?: {
39
45
  debug?: boolean;
40
46
  }): Promise<void>;
@@ -43,32 +49,44 @@ export declare class AngularAdapterService {
43
49
  * Get the component compiler
44
50
  * @returns Component compiler instance
45
51
  */
52
+ GetCompiler(): ComponentCompiler;
53
+ /** @deprecated Use {@link GetCompiler}. */
46
54
  getCompiler(): ComponentCompiler;
47
55
  /**
48
56
  * Get the component registry
49
57
  * @returns Component registry instance
50
58
  */
59
+ GetRegistry(): ComponentRegistry;
60
+ /** @deprecated Use {@link GetRegistry}. */
51
61
  getRegistry(): ComponentRegistry;
52
62
  /**
53
63
  * Get the component resolver
54
64
  * @returns Component resolver instance
55
65
  */
66
+ GetResolver(): ComponentResolver;
67
+ /** @deprecated Use {@link GetResolver}. */
56
68
  getResolver(): ComponentResolver;
57
69
  /**
58
70
  * Get the runtime context
59
71
  * @returns Runtime context with React and libraries
60
72
  */
73
+ GetRuntimeContext(): RuntimeContext;
74
+ /** @deprecated Use {@link GetRuntimeContext}. */
61
75
  getRuntimeContext(): RuntimeContext;
62
76
  /**
63
77
  * Get the unified component manager
64
78
  * @returns Component manager instance
65
79
  */
80
+ GetComponentManager(): ComponentManager;
81
+ /** @deprecated Use {@link GetComponentManager}. */
66
82
  getComponentManager(): ComponentManager;
67
83
  /**
68
84
  * Compile a component with Angular-specific defaults
69
85
  * @param options - Compilation options
70
86
  * @returns Promise resolving to compilation result
71
87
  */
88
+ CompileComponent(options: CompileOptions): Promise<import("@memberjunction/react-runtime").CompilationResult>;
89
+ /** @deprecated Use {@link CompileComponent}. */
72
90
  compileComponent(options: CompileOptions): Promise<import("@memberjunction/react-runtime").CompilationResult>;
73
91
  /**
74
92
  * Register a component in the registry
@@ -78,6 +96,8 @@ export declare class AngularAdapterService {
78
96
  * @param version - Component version
79
97
  * @returns Component metadata
80
98
  */
99
+ RegisterComponent(name: string, component: any, namespace?: string, version?: string): import("@memberjunction/react-runtime").ComponentMetadata;
100
+ /** @deprecated Use {@link RegisterComponent}. */
81
101
  registerComponent(name: string, component: any, namespace?: string, version?: string): import("@memberjunction/react-runtime").ComponentMetadata;
82
102
  /**
83
103
  * Get a component from the registry
@@ -86,25 +106,35 @@ export declare class AngularAdapterService {
86
106
  * @param version - Component version
87
107
  * @returns Component if found
88
108
  */
109
+ GetComponent(name: string, namespace?: string, version?: string): import("@memberjunction/interactive-component-types").ComponentObject | undefined;
110
+ /** @deprecated Use {@link GetComponent}. */
89
111
  getComponent(name: string, namespace?: string, version?: string): import("@memberjunction/interactive-component-types").ComponentObject | undefined;
90
112
  /**
91
113
  * Check if runtime is initialized
92
114
  * @returns true if initialized
93
115
  */
116
+ IsInitialized(): boolean;
117
+ /** @deprecated Use {@link IsInitialized}. */
94
118
  isInitialized(): boolean;
95
119
  /**
96
120
  * Get runtime version
97
121
  * @returns Runtime version string
98
122
  */
123
+ GetVersion(): string;
124
+ /** @deprecated Use {@link GetVersion}. */
99
125
  getVersion(): string;
100
126
  /**
101
127
  * Clean up resources
102
128
  */
129
+ Destroy(): void;
130
+ /** @deprecated Use {@link Destroy}. */
103
131
  destroy(): void;
104
132
  /**
105
133
  * Get Babel instance for direct use
106
134
  * @returns Babel instance
107
135
  */
136
+ GetBabel(): any;
137
+ /** @deprecated Use {@link GetBabel}. */
108
138
  getBabel(): any;
109
139
  /**
110
140
  * Transpile JSX code directly
@@ -112,6 +142,8 @@ export declare class AngularAdapterService {
112
142
  * @param filename - Optional filename for better error messages
113
143
  * @returns Transpiled JavaScript code
114
144
  */
145
+ TranspileJSX(code: string, filename?: string): string;
146
+ /** @deprecated Use {@link TranspileJSX}. */
115
147
  transpileJSX(code: string, filename?: string): string;
116
148
  static ɵfac: i0.ɵɵFactoryDeclaration<AngularAdapterService, never>;
117
149
  static ɵprov: i0.ɵɵInjectableDeclaration<AngularAdapterService>;
@@ -32,14 +32,18 @@ export class AngularAdapterService {
32
32
  * Safe to call multiple times — the underlying initialize() deduplicates.
33
33
  * Does not block: returns immediately, initialization continues in background.
34
34
  */
35
- preload() {
35
+ Preload() {
36
36
  // Phase 1: Inject browser preload hints for CDN scripts
37
37
  LibraryLoader.preloadCoreScripts();
38
38
  // Phase 2: Fire-and-forget full initialization (script execution + runtime setup)
39
- this.initialize().catch(err => {
39
+ this.Initialize().catch(err => {
40
40
  console.warn('React runtime preload failed (will retry on demand):', err);
41
41
  });
42
42
  }
43
+ /** @deprecated Use {@link Preload}. */
44
+ preload() {
45
+ return this.Preload();
46
+ }
43
47
  /**
44
48
  * Initialize the React runtime with Angular-specific configuration
45
49
  * @param config Optional library configuration
@@ -47,7 +51,7 @@ export class AngularAdapterService {
47
51
  * @param options Optional options including debug flag
48
52
  * @returns Promise resolving when runtime is ready
49
53
  */
50
- async initialize(config, additionalLibraries, options) {
54
+ async Initialize(config, additionalLibraries, options) {
51
55
  if (this.runtime) {
52
56
  return; // Already initialized
53
57
  }
@@ -66,6 +70,10 @@ export class AngularAdapterService {
66
70
  }
67
71
  return;
68
72
  }
73
+ /** @deprecated Use {@link Initialize}. */
74
+ async initialize(config, additionalLibraries, options) {
75
+ return this.Initialize(config, additionalLibraries, options);
76
+ }
69
77
  async doInitialize(config, additionalLibraries, options) {
70
78
  // Load React ecosystem with optional additional libraries
71
79
  const ecosystem = await this.scriptLoader.loadReactEcosystem(config, additionalLibraries, options);
@@ -98,58 +106,78 @@ export class AngularAdapterService {
98
106
  * Get the component compiler
99
107
  * @returns Component compiler instance
100
108
  */
101
- getCompiler() {
109
+ GetCompiler() {
102
110
  if (!this.runtime) {
103
111
  throw new Error('React runtime not initialized. Call initialize() first.');
104
112
  }
105
113
  return this.runtime.compiler;
106
114
  }
115
+ /** @deprecated Use {@link GetCompiler}. */
116
+ getCompiler() {
117
+ return this.GetCompiler();
118
+ }
107
119
  /**
108
120
  * Get the component registry
109
121
  * @returns Component registry instance
110
122
  */
111
- getRegistry() {
123
+ GetRegistry() {
112
124
  if (!this.runtime) {
113
125
  throw new Error('React runtime not initialized. Call initialize() first.');
114
126
  }
115
127
  return this.runtime.registry;
116
128
  }
129
+ /** @deprecated Use {@link GetRegistry}. */
130
+ getRegistry() {
131
+ return this.GetRegistry();
132
+ }
117
133
  /**
118
134
  * Get the component resolver
119
135
  * @returns Component resolver instance
120
136
  */
121
- getResolver() {
137
+ GetResolver() {
122
138
  if (!this.runtime) {
123
139
  throw new Error('React runtime not initialized. Call initialize() first.');
124
140
  }
125
141
  return this.runtime.resolver;
126
142
  }
143
+ /** @deprecated Use {@link GetResolver}. */
144
+ getResolver() {
145
+ return this.GetResolver();
146
+ }
127
147
  /**
128
148
  * Get the runtime context
129
149
  * @returns Runtime context with React and libraries
130
150
  */
131
- getRuntimeContext() {
151
+ GetRuntimeContext() {
132
152
  if (!this.runtimeContext) {
133
153
  throw new Error('React runtime not initialized. Call initialize() first.');
134
154
  }
135
155
  return this.runtimeContext;
136
156
  }
157
+ /** @deprecated Use {@link GetRuntimeContext}. */
158
+ getRuntimeContext() {
159
+ return this.GetRuntimeContext();
160
+ }
137
161
  /**
138
162
  * Get the unified component manager
139
163
  * @returns Component manager instance
140
164
  */
141
- getComponentManager() {
165
+ GetComponentManager() {
142
166
  if (!this.runtime) {
143
167
  throw new Error('React runtime not initialized. Call initialize() first.');
144
168
  }
145
169
  return this.runtime.manager;
146
170
  }
171
+ /** @deprecated Use {@link GetComponentManager}. */
172
+ getComponentManager() {
173
+ return this.GetComponentManager();
174
+ }
147
175
  /**
148
176
  * Compile a component with Angular-specific defaults
149
177
  * @param options - Compilation options
150
178
  * @returns Promise resolving to compilation result
151
179
  */
152
- async compileComponent(options) {
180
+ async CompileComponent(options) {
153
181
  // Validate options before initialization
154
182
  if (!options) {
155
183
  throw new Error('Angular adapter error: No compilation options provided.\n' +
@@ -168,7 +196,7 @@ export class AngularAdapterService {
168
196
  throw new Error(`Angular adapter error: Component code is missing or empty for component "${options.componentName}".\n` +
169
197
  'Make sure your component spec includes a "code" property with the React component source.');
170
198
  }
171
- await this.initialize();
199
+ await this.Initialize();
172
200
  // Apply default styles if not provided — bridge the host's live MJ theme
173
201
  // (--mj-* tokens) so compiled components match the active theme, including
174
202
  // dark mode. Falls back to SetupStyles() defaults when no themed DOM exists.
@@ -178,6 +206,10 @@ export class AngularAdapterService {
178
206
  };
179
207
  return this.runtime.compiler.compile(optionsWithDefaults);
180
208
  }
209
+ /** @deprecated Use {@link CompileComponent}. */
210
+ async compileComponent(options) {
211
+ return this.CompileComponent(options);
212
+ }
181
213
  /**
182
214
  * Register a component in the registry
183
215
  * @param name - Component name
@@ -186,12 +218,16 @@ export class AngularAdapterService {
186
218
  * @param version - Component version
187
219
  * @returns Component metadata
188
220
  */
189
- registerComponent(name, component, namespace = 'Global', version = 'v1') {
221
+ RegisterComponent(name, component, namespace = 'Global', version = 'v1') {
190
222
  if (!this.runtime) {
191
223
  throw new Error('React runtime not initialized. Call initialize() first.');
192
224
  }
193
225
  return this.runtime.registry.register(name, component, namespace, version);
194
226
  }
227
+ /** @deprecated Use {@link RegisterComponent}. */
228
+ registerComponent(name, component, namespace = 'Global', version = 'v1') {
229
+ return this.RegisterComponent(name, component, namespace, version);
230
+ }
195
231
  /**
196
232
  * Get a component from the registry
197
233
  * @param name - Component name
@@ -199,30 +235,42 @@ export class AngularAdapterService {
199
235
  * @param version - Component version
200
236
  * @returns Component if found
201
237
  */
202
- getComponent(name, namespace = 'Global', version) {
238
+ GetComponent(name, namespace = 'Global', version) {
203
239
  if (!this.runtime) {
204
240
  throw new Error('React runtime not initialized. Call initialize() first.');
205
241
  }
206
242
  return this.runtime.registry.get(name, namespace, version);
207
243
  }
244
+ /** @deprecated Use {@link GetComponent}. */
245
+ getComponent(name, namespace = 'Global', version) {
246
+ return this.GetComponent(name, namespace, version);
247
+ }
208
248
  /**
209
249
  * Check if runtime is initialized
210
250
  * @returns true if initialized
211
251
  */
212
- isInitialized() {
252
+ IsInitialized() {
213
253
  return !!this.runtime && !!this.runtimeContext;
214
254
  }
255
+ /** @deprecated Use {@link IsInitialized}. */
256
+ isInitialized() {
257
+ return this.IsInitialized();
258
+ }
215
259
  /**
216
260
  * Get runtime version
217
261
  * @returns Runtime version string
218
262
  */
219
- getVersion() {
263
+ GetVersion() {
220
264
  return this.runtime?.version || 'unknown';
221
265
  }
266
+ /** @deprecated Use {@link GetVersion}. */
267
+ getVersion() {
268
+ return this.GetVersion();
269
+ }
222
270
  /**
223
271
  * Clean up resources
224
272
  */
225
- destroy() {
273
+ Destroy() {
226
274
  if (this.runtime) {
227
275
  this.runtime.registry.destroy();
228
276
  this.runtime = undefined;
@@ -232,21 +280,29 @@ export class AngularAdapterService {
232
280
  // actually runs doInitialize() instead of returning the stale resolved promise.
233
281
  this.initializationPromise = undefined;
234
282
  }
283
+ /** @deprecated Use {@link Destroy}. */
284
+ destroy() {
285
+ return this.Destroy();
286
+ }
235
287
  /**
236
288
  * Get Babel instance for direct use
237
289
  * @returns Babel instance
238
290
  */
239
- getBabel() {
291
+ GetBabel() {
240
292
  return this.runtimeContext?.libraries?.Babel || window.Babel;
241
293
  }
294
+ /** @deprecated Use {@link GetBabel}. */
295
+ getBabel() {
296
+ return this.GetBabel();
297
+ }
242
298
  /**
243
299
  * Transpile JSX code directly
244
300
  * @param code - JSX code to transpile
245
301
  * @param filename - Optional filename for better error messages
246
302
  * @returns Transpiled JavaScript code
247
303
  */
248
- transpileJSX(code, filename) {
249
- const babel = this.getBabel();
304
+ TranspileJSX(code, filename) {
305
+ const babel = this.GetBabel();
250
306
  if (!babel) {
251
307
  throw new Error('Babel not loaded. Initialize the runtime first.');
252
308
  }
@@ -261,6 +317,10 @@ export class AngularAdapterService {
261
317
  throw new Error(`Failed to transpile JSX: ${error.message}`);
262
318
  }
263
319
  }
320
+ /** @deprecated Use {@link TranspileJSX}. */
321
+ transpileJSX(code, filename) {
322
+ return this.TranspileJSX(code, filename);
323
+ }
264
324
  static { this.ɵfac = function AngularAdapterService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AngularAdapterService)(i0.ɵɵinject(i1.ScriptLoaderService)); }; }
265
325
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AngularAdapterService, factory: AngularAdapterService.ɵfac, providedIn: 'root' }); }
266
326
  }
@@ -1 +1 @@
1
- {"version":3,"file":"angular-adapter.service.js","sourceRoot":"","sources":["../../../src/lib/services/angular-adapter.service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA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,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAClC,CAAC;QACD,uEAAuE;QACvE,gFAAgF;QAChF,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,cAAc,EAAE,SAAS,EAAE,KAAK,IAAK,MAAc,CAAC,KAAK,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAY,EAAE,QAAiB;QAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;gBACnC,OAAO,EAAE,CAAC,OAAO,CAAC;gBAClB,QAAQ,EAAE,QAAQ,IAAI,eAAe;aACtC,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;sHA9SU,qBAAqB;uEAArB,qBAAqB,WAArB,qBAAqB,mBADR,MAAM;;iFACnB,qBAAqB;cADjC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["/**\n * @fileoverview Angular adapter service that bridges the React runtime with Angular.\n * Provides Angular-specific functionality for the platform-agnostic React runtime.\n * @module @memberjunction/ng-react\n */\n\nimport { Injectable } from '@angular/core';\nimport {\n ComponentCompiler,\n ComponentRegistry,\n ComponentResolver,\n ComponentManager,\n createReactRuntime,\n CompileOptions,\n RuntimeContext,\n ExternalLibraryConfig,\n LibraryConfiguration,\n LibraryLoader,\n BuildStylesFromTheme\n} from '@memberjunction/react-runtime';\nimport { ScriptLoaderService } from './script-loader.service';\nimport { ComponentStyles } from '@memberjunction/interactive-component-types';\n\n/**\n * Angular-specific adapter for the React runtime.\n * Manages the integration between Angular services and the platform-agnostic React runtime.\n */\n@Injectable({ providedIn: 'root' })\nexport class AngularAdapterService {\n private runtime?: {\n compiler: ComponentCompiler;\n registry: ComponentRegistry;\n resolver: ComponentResolver;\n manager: ComponentManager;\n version: string;\n };\n private runtimeContext?: RuntimeContext;\n private initializationPromise: Promise<void> | undefined;\n\n constructor(private scriptLoader: ScriptLoaderService) {}\n\n /**\n * Eagerly start loading the React runtime in the background.\n * Call this at app startup (e.g., in APP_INITIALIZER or after auth) so that\n * React, ReactDOM, and Babel are already downloaded from CDN by the time the\n * user opens an interactive component artifact.\n *\n * Two-phase approach:\n * 1. Immediately inject `<link rel=\"preload\">` hints so the browser starts\n * downloading the CDN scripts in parallel with other page work.\n * 2. Fire-and-forget `initialize()` which creates `<script>` tags and\n * executes them. If the preload hints already fetched the bytes, the\n * script load is nearly instant (served from HTTP cache).\n *\n * Safe to call multiple times — the underlying initialize() deduplicates.\n * Does not block: returns immediately, initialization continues in background.\n */\n preload(): void {\n // Phase 1: Inject browser preload hints for CDN scripts\n LibraryLoader.preloadCoreScripts();\n\n // Phase 2: Fire-and-forget full initialization (script execution + runtime setup)\n this.initialize().catch(err => {\n console.warn('React runtime preload failed (will retry on demand):', err);\n });\n }\n\n /**\n * Initialize the React runtime with Angular-specific configuration\n * @param config Optional library configuration\n * @param additionalLibraries Optional additional libraries to merge\n * @param options Optional options including debug flag\n * @returns Promise resolving when runtime is ready\n */\n async initialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[],\n options?: { debug?: boolean }\n ): Promise<void> {\n if (this.runtime) {\n return; // Already initialized\n }\n if (this.initializationPromise) {\n return this.initializationPromise; // in progress\n }\n\n // Start initialization and store the promise immediately\n this.initializationPromise = this.doInitialize(config, additionalLibraries, options);\n\n try {\n await this.initializationPromise;\n } catch (error) {\n // Clear the promise on error so it can be retried\n this.initializationPromise = undefined;\n throw error;\n }\n\n return;\n }\n\n private async doInitialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[],\n options?: { debug?: boolean }\n ): Promise<void> {\n // Load React ecosystem with optional additional libraries\n const ecosystem = await this.scriptLoader.loadReactEcosystem(config, additionalLibraries, options);\n \n // Create runtime context\n this.runtimeContext = {\n React: ecosystem.React,\n ReactDOM: ecosystem.ReactDOM,\n libraries: ecosystem.libraries,\n utilities: {\n // Add any Angular-specific utilities here\n }\n };\n\n // Create the React runtime with runtime context for registry support\n this.runtime = createReactRuntime(ecosystem.Babel, {\n compiler: {\n cache: true,\n maxCacheSize: 100,\n debug: options?.debug\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true,\n debug: options?.debug\n }\n }, this.runtimeContext, options?.debug);\n }\n\n /**\n * Get the component compiler\n * @returns Component compiler instance\n */\n getCompiler(): ComponentCompiler {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.compiler;\n }\n\n /**\n * Get the component registry\n * @returns Component registry instance\n */\n getRegistry(): ComponentRegistry {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry;\n }\n\n /**\n * Get the component resolver\n * @returns Component resolver instance\n */\n getResolver(): ComponentResolver {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.resolver;\n }\n\n /**\n * Get the runtime context\n * @returns Runtime context with React and libraries\n */\n getRuntimeContext(): RuntimeContext {\n if (!this.runtimeContext) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtimeContext;\n }\n\n /**\n * Get the unified component manager\n * @returns Component manager instance\n */\n getComponentManager(): ComponentManager {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.manager;\n }\n\n\n /**\n * Compile a component with Angular-specific defaults\n * @param options - Compilation options\n * @returns Promise resolving to compilation result\n */\n async compileComponent(options: CompileOptions) {\n // Validate options before initialization\n if (!options) {\n throw new Error(\n 'Angular adapter error: No compilation options provided.\\n' +\n 'This usually means the component spec is null or undefined.\\n' +\n 'Please check that:\\n' +\n '1. Your component data is loaded properly\\n' +\n '2. The component spec has \"name\" and \"code\" properties\\n' +\n '3. The component input is not undefined'\n );\n }\n\n if (!options.componentName || options.componentName.trim() === '') {\n throw new Error(\n 'Angular adapter error: Component name is missing or empty.\\n' +\n `Received options: ${JSON.stringify(options, null, 2)}\\n` +\n 'Make sure your component spec includes a \"name\" property.'\n );\n }\n\n if (!options.componentCode || options.componentCode.trim() === '') {\n throw new Error(\n `Angular adapter error: Component code is missing or empty for component \"${options.componentName}\".\\n` +\n 'Make sure your component spec includes a \"code\" property with the React component source.'\n );\n }\n\n await this.initialize();\n \n // Apply default styles if not provided — bridge the host's live MJ theme\n // (--mj-* tokens) so compiled components match the active theme, including\n // dark mode. Falls back to SetupStyles() defaults when no themed DOM exists.\n const optionsWithDefaults = {\n ...options,\n styles: options.styles || BuildStylesFromTheme()\n };\n\n return this.runtime!.compiler.compile(optionsWithDefaults);\n }\n\n /**\n * Register a component in the registry\n * @param name - Component name\n * @param component - Compiled component\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component metadata\n */\n registerComponent(\n name: string,\n component: any,\n namespace: string = 'Global',\n version: string = 'v1'\n ) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.register(name, component, namespace, version);\n }\n\n /**\n * Get a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component if found\n */\n getComponent(name: string, namespace: string = 'Global', version?: string) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.get(name, namespace, version);\n }\n\n /**\n * Check if runtime is initialized\n * @returns true if initialized\n */\n isInitialized(): boolean {\n return !!this.runtime && !!this.runtimeContext;\n }\n\n /**\n * Get runtime version\n * @returns Runtime version string\n */\n getVersion(): string {\n return this.runtime?.version || 'unknown';\n }\n\n /**\n * Clean up resources\n */\n destroy(): void {\n if (this.runtime) {\n this.runtime.registry.destroy();\n this.runtime = undefined;\n this.runtimeContext = undefined;\n }\n // Clear the cached initialization promise so a subsequent initialize()\n // actually runs doInitialize() instead of returning the stale resolved promise.\n this.initializationPromise = undefined;\n }\n\n /**\n * Get Babel instance for direct use\n * @returns Babel instance\n */\n getBabel(): any {\n return this.runtimeContext?.libraries?.Babel || (window as any).Babel;\n }\n\n /**\n * Transpile JSX code directly\n * @param code - JSX code to transpile\n * @param filename - Optional filename for better error messages\n * @returns Transpiled JavaScript code\n */\n transpileJSX(code: string, filename?: string): string {\n const babel = this.getBabel();\n if (!babel) {\n throw new Error('Babel not loaded. Initialize the runtime first.');\n }\n\n try {\n const result = babel.transform(code, {\n presets: ['react'],\n filename: filename || 'component.jsx'\n });\n return result.code;\n } catch (error: any) {\n throw new Error(`Failed to transpile JSX: ${error.message}`);\n }\n }\n}"]}
1
+ {"version":3,"file":"angular-adapter.service.js","sourceRoot":"","sources":["../../../src/lib/services/angular-adapter.service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAKL,kBAAkB,EAKlB,aAAa,EACb,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;;;AAG9D;;;GAGG;AAEH,MAAM,OAAO,qBAAqB;IAWhC,YAAoB,YAAiC;QAAjC,iBAAY,GAAZ,YAAY,CAAqB;IAAG,CAAC;IAEzD;;;;;;;;;;;;;;;OAeG;IACH,OAAO;QACL,wDAAwD;QACxD,aAAa,CAAC,kBAAkB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AED;;;OAGG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,cAAc,EAAE,SAAS,EAAE,KAAK,IAAK,MAAc,CAAC,KAAK,CAAC;IACxE,CAAC;IAED,wCAAwC;IACxC,QAAQ;QACN,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAY,EAAE,QAAiB;QAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;gBACnC,OAAO,EAAE,CAAC,OAAO,CAAC;gBAClB,QAAQ,EAAE,QAAQ,IAAI,eAAe;aACtC,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,YAAY,CAAC,IAAY,EAAE,QAAiB;QAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;sHAlYU,qBAAqB;uEAArB,qBAAqB,WAArB,qBAAqB,mBADR,MAAM;;iFACnB,qBAAqB;cADjC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["/**\n * @fileoverview Angular adapter service that bridges the React runtime with Angular.\n * Provides Angular-specific functionality for the platform-agnostic React runtime.\n * @module @memberjunction/ng-react\n */\n\nimport { Injectable } from '@angular/core';\nimport {\n ComponentCompiler,\n ComponentRegistry,\n ComponentResolver,\n ComponentManager,\n createReactRuntime,\n CompileOptions,\n RuntimeContext,\n ExternalLibraryConfig,\n LibraryConfiguration,\n LibraryLoader,\n BuildStylesFromTheme\n} from '@memberjunction/react-runtime';\nimport { ScriptLoaderService } from './script-loader.service';\nimport { ComponentStyles } from '@memberjunction/interactive-component-types';\n\n/**\n * Angular-specific adapter for the React runtime.\n * Manages the integration between Angular services and the platform-agnostic React runtime.\n */\n@Injectable({ providedIn: 'root' })\nexport class AngularAdapterService {\n private runtime?: {\n compiler: ComponentCompiler;\n registry: ComponentRegistry;\n resolver: ComponentResolver;\n manager: ComponentManager;\n version: string;\n };\n private runtimeContext?: RuntimeContext;\n private initializationPromise: Promise<void> | undefined;\n\n constructor(private scriptLoader: ScriptLoaderService) {}\n\n /**\n * Eagerly start loading the React runtime in the background.\n * Call this at app startup (e.g., in APP_INITIALIZER or after auth) so that\n * React, ReactDOM, and Babel are already downloaded from CDN by the time the\n * user opens an interactive component artifact.\n *\n * Two-phase approach:\n * 1. Immediately inject `<link rel=\"preload\">` hints so the browser starts\n * downloading the CDN scripts in parallel with other page work.\n * 2. Fire-and-forget `initialize()` which creates `<script>` tags and\n * executes them. If the preload hints already fetched the bytes, the\n * script load is nearly instant (served from HTTP cache).\n *\n * Safe to call multiple times — the underlying initialize() deduplicates.\n * Does not block: returns immediately, initialization continues in background.\n */\n Preload(): void {\n // Phase 1: Inject browser preload hints for CDN scripts\n LibraryLoader.preloadCoreScripts();\n\n // Phase 2: Fire-and-forget full initialization (script execution + runtime setup)\n this.Initialize().catch(err => {\n console.warn('React runtime preload failed (will retry on demand):', err);\n });\n }\n\n /** @deprecated Use {@link Preload}. */\n preload(): void {\n return this.Preload();\n }\n\n /**\n * Initialize the React runtime with Angular-specific configuration\n * @param config Optional library configuration\n * @param additionalLibraries Optional additional libraries to merge\n * @param options Optional options including debug flag\n * @returns Promise resolving when runtime is ready\n */\n async Initialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[],\n options?: { debug?: boolean }\n ): Promise<void> {\n if (this.runtime) {\n return; // Already initialized\n }\n if (this.initializationPromise) {\n return this.initializationPromise; // in progress\n }\n\n // Start initialization and store the promise immediately\n this.initializationPromise = this.doInitialize(config, additionalLibraries, options);\n\n try {\n await this.initializationPromise;\n } catch (error) {\n // Clear the promise on error so it can be retried\n this.initializationPromise = undefined;\n throw error;\n }\n\n return;\n }\n\n /** @deprecated Use {@link Initialize}. */\n async initialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[],\n options?: { debug?: boolean }\n ): Promise<void> {\n return this.Initialize(config, additionalLibraries, options);\n }\n\n private async doInitialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[],\n options?: { debug?: boolean }\n ): Promise<void> {\n // Load React ecosystem with optional additional libraries\n const ecosystem = await this.scriptLoader.loadReactEcosystem(config, additionalLibraries, options);\n \n // Create runtime context\n this.runtimeContext = {\n React: ecosystem.React,\n ReactDOM: ecosystem.ReactDOM,\n libraries: ecosystem.libraries,\n utilities: {\n // Add any Angular-specific utilities here\n }\n };\n\n // Create the React runtime with runtime context for registry support\n this.runtime = createReactRuntime(ecosystem.Babel, {\n compiler: {\n cache: true,\n maxCacheSize: 100,\n debug: options?.debug\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true,\n debug: options?.debug\n }\n }, this.runtimeContext, options?.debug);\n }\n\n /**\n * Get the component compiler\n * @returns Component compiler instance\n */\n GetCompiler(): ComponentCompiler {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.compiler;\n }\n\n /** @deprecated Use {@link GetCompiler}. */\n getCompiler(): ComponentCompiler {\n return this.GetCompiler();\n }\n\n /**\n * Get the component registry\n * @returns Component registry instance\n */\n GetRegistry(): ComponentRegistry {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry;\n }\n\n /** @deprecated Use {@link GetRegistry}. */\n getRegistry(): ComponentRegistry {\n return this.GetRegistry();\n }\n\n /**\n * Get the component resolver\n * @returns Component resolver instance\n */\n GetResolver(): ComponentResolver {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.resolver;\n }\n\n /** @deprecated Use {@link GetResolver}. */\n getResolver(): ComponentResolver {\n return this.GetResolver();\n }\n\n /**\n * Get the runtime context\n * @returns Runtime context with React and libraries\n */\n GetRuntimeContext(): RuntimeContext {\n if (!this.runtimeContext) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtimeContext;\n }\n\n /** @deprecated Use {@link GetRuntimeContext}. */\n getRuntimeContext(): RuntimeContext {\n return this.GetRuntimeContext();\n }\n\n /**\n * Get the unified component manager\n * @returns Component manager instance\n */\n GetComponentManager(): ComponentManager {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.manager;\n }\n\n /** @deprecated Use {@link GetComponentManager}. */\n getComponentManager(): ComponentManager {\n return this.GetComponentManager();\n }\n\n\n /**\n * Compile a component with Angular-specific defaults\n * @param options - Compilation options\n * @returns Promise resolving to compilation result\n */\n async CompileComponent(options: CompileOptions) {\n // Validate options before initialization\n if (!options) {\n throw new Error(\n 'Angular adapter error: No compilation options provided.\\n' +\n 'This usually means the component spec is null or undefined.\\n' +\n 'Please check that:\\n' +\n '1. Your component data is loaded properly\\n' +\n '2. The component spec has \"name\" and \"code\" properties\\n' +\n '3. The component input is not undefined'\n );\n }\n\n if (!options.componentName || options.componentName.trim() === '') {\n throw new Error(\n 'Angular adapter error: Component name is missing or empty.\\n' +\n `Received options: ${JSON.stringify(options, null, 2)}\\n` +\n 'Make sure your component spec includes a \"name\" property.'\n );\n }\n\n if (!options.componentCode || options.componentCode.trim() === '') {\n throw new Error(\n `Angular adapter error: Component code is missing or empty for component \"${options.componentName}\".\\n` +\n 'Make sure your component spec includes a \"code\" property with the React component source.'\n );\n }\n\n await this.Initialize();\n \n // Apply default styles if not provided — bridge the host's live MJ theme\n // (--mj-* tokens) so compiled components match the active theme, including\n // dark mode. Falls back to SetupStyles() defaults when no themed DOM exists.\n const optionsWithDefaults = {\n ...options,\n styles: options.styles || BuildStylesFromTheme()\n };\n\n return this.runtime!.compiler.compile(optionsWithDefaults);\n }\n\n /** @deprecated Use {@link CompileComponent}. */\n async compileComponent(options: CompileOptions) {\n return this.CompileComponent(options);\n }\n\n /**\n * Register a component in the registry\n * @param name - Component name\n * @param component - Compiled component\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component metadata\n */\n RegisterComponent(\n name: string,\n component: any,\n namespace: string = 'Global',\n version: string = 'v1'\n ) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.register(name, component, namespace, version);\n }\n\n /** @deprecated Use {@link RegisterComponent}. */\n registerComponent(\n name: string,\n component: any,\n namespace: string = 'Global',\n version: string = 'v1'\n ) {\n return this.RegisterComponent(name, component, namespace, version);\n }\n\n /**\n * Get a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component if found\n */\n GetComponent(name: string, namespace: string = 'Global', version?: string) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.get(name, namespace, version);\n }\n\n /** @deprecated Use {@link GetComponent}. */\n getComponent(name: string, namespace: string = 'Global', version?: string) {\n return this.GetComponent(name, namespace, version);\n }\n\n /**\n * Check if runtime is initialized\n * @returns true if initialized\n */\n IsInitialized(): boolean {\n return !!this.runtime && !!this.runtimeContext;\n }\n\n /** @deprecated Use {@link IsInitialized}. */\n isInitialized(): boolean {\n return this.IsInitialized();\n }\n\n /**\n * Get runtime version\n * @returns Runtime version string\n */\n GetVersion(): string {\n return this.runtime?.version || 'unknown';\n }\n\n /** @deprecated Use {@link GetVersion}. */\n getVersion(): string {\n return this.GetVersion();\n }\n\n /**\n * Clean up resources\n */\n Destroy(): void {\n if (this.runtime) {\n this.runtime.registry.destroy();\n this.runtime = undefined;\n this.runtimeContext = undefined;\n }\n // Clear the cached initialization promise so a subsequent initialize()\n // actually runs doInitialize() instead of returning the stale resolved promise.\n this.initializationPromise = undefined;\n }\n\n /** @deprecated Use {@link Destroy}. */\n destroy(): void {\n return this.Destroy();\n }\n\n /**\n * Get Babel instance for direct use\n * @returns Babel instance\n */\n GetBabel(): any {\n return this.runtimeContext?.libraries?.Babel || (window as any).Babel;\n }\n\n /** @deprecated Use {@link GetBabel}. */\n getBabel(): any {\n return this.GetBabel();\n }\n\n /**\n * Transpile JSX code directly\n * @param code - JSX code to transpile\n * @param filename - Optional filename for better error messages\n * @returns Transpiled JavaScript code\n */\n TranspileJSX(code: string, filename?: string): string {\n const babel = this.GetBabel();\n if (!babel) {\n throw new Error('Babel not loaded. Initialize the runtime first.');\n }\n\n try {\n const result = babel.transform(code, {\n presets: ['react'],\n filename: filename || 'component.jsx'\n });\n return result.code;\n } catch (error: any) {\n throw new Error(`Failed to transpile JSX: ${error.message}`);\n }\n }\n\n /** @deprecated Use {@link TranspileJSX}. */\n transpileJSX(code: string, filename?: string): string {\n return this.TranspileJSX(code, filename);\n }\n}"]}
@@ -15,13 +15,21 @@ export declare class ReactBridgeService implements OnDestroy {
15
15
  private adapter;
16
16
  private reactRoots;
17
17
  private reactReadySubject;
18
- reactReady$: import("rxjs").Observable<boolean>;
18
+ ReactReady$: import("rxjs").Observable<boolean>;
19
+ /** @deprecated Use {@link ReactReady$}. */
20
+ get reactReady$(): import("rxjs").Observable<boolean>;
21
+ /** @deprecated Use {@link ReactReady$}. */
22
+ set reactReady$(value: import("rxjs").Observable<boolean>);
19
23
  private firstComponentAttempted;
20
24
  private maxWaitTime;
21
25
  private checkInterval;
22
26
  private maxBootstrapRetries;
23
27
  private retryBaseDelay;
24
- debug: boolean;
28
+ Debug: boolean;
29
+ /** @deprecated Use {@link Debug}. */
30
+ get debug(): boolean;
31
+ /** @deprecated Use {@link Debug}. */
32
+ set debug(value: boolean);
25
33
  private bootstrapPromise;
26
34
  constructor(adapter: AngularAdapterService);
27
35
  ngOnDestroy(): void;
@@ -41,6 +49,8 @@ export declare class ReactBridgeService implements OnDestroy {
41
49
  * If bootstrap succeeded but createRoot isn't usable (stale browser cache),
42
50
  * forces a re-bootstrap and retries.
43
51
  */
52
+ WaitForReactReady(): Promise<void>;
53
+ /** @deprecated Use {@link WaitForReactReady}. */
44
54
  waitForReactReady(): Promise<void>;
45
55
  /**
46
56
  * Poll for ReactDOM.createRoot availability. If the poll window expires
@@ -58,22 +68,30 @@ export declare class ReactBridgeService implements OnDestroy {
58
68
  * Awaits the bootstrap (with retries) rather than calling adapter.initialize() independently.
59
69
  * @returns React context with React, ReactDOM, Babel, and libraries
60
70
  */
71
+ GetReactContext(): Promise<RuntimeContext>;
72
+ /** @deprecated Use {@link GetReactContext}. */
61
73
  getReactContext(): Promise<RuntimeContext>;
62
74
  /**
63
75
  * Get the current React context synchronously
64
76
  * @returns React context or null if not loaded
65
77
  */
78
+ GetCurrentContext(): RuntimeContext | null;
79
+ /** @deprecated Use {@link GetCurrentContext}. */
66
80
  getCurrentContext(): RuntimeContext | null;
67
81
  /**
68
82
  * Create a React root for rendering
69
83
  * @param container - DOM element to render into
70
84
  * @returns React root instance
71
85
  */
86
+ CreateRoot(container: HTMLElement): any;
87
+ /** @deprecated Use {@link CreateRoot}. */
72
88
  createRoot(container: HTMLElement): any;
73
89
  /**
74
90
  * Unmount and clean up a React root
75
91
  * @param root - React root to unmount
76
92
  */
93
+ UnmountRoot(root: any): void;
94
+ /** @deprecated Use {@link UnmountRoot}. */
77
95
  unmountRoot(root: any): void;
78
96
  /**
79
97
  * Transpile JSX code to JavaScript
@@ -81,6 +99,8 @@ export declare class ReactBridgeService implements OnDestroy {
81
99
  * @param filename - Optional filename for error messages
82
100
  * @returns Transpiled JavaScript code
83
101
  */
102
+ TranspileJSX(code: string, filename: string): string;
103
+ /** @deprecated Use {@link TranspileJSX}. */
84
104
  transpileJSX(code: string, filename: string): string;
85
105
  /**
86
106
  * Clean up all React roots and reset context
@@ -90,11 +110,15 @@ export declare class ReactBridgeService implements OnDestroy {
90
110
  * Check if React is currently ready
91
111
  * @returns true if React is ready
92
112
  */
113
+ IsReady(): boolean;
114
+ /** @deprecated Use {@link IsReady}. */
93
115
  isReady(): boolean;
94
116
  /**
95
117
  * Get the number of active React roots
96
118
  * @returns Number of active roots
97
119
  */
120
+ GetActiveRootsCount(): number;
121
+ /** @deprecated Use {@link GetActiveRootsCount}. */
98
122
  getActiveRootsCount(): number;
99
123
  static ɵfac: i0.ɵɵFactoryDeclaration<ReactBridgeService, never>;
100
124
  static ɵprov: i0.ɵɵInjectableDeclaration<ReactBridgeService>;