@memberjunction/react-runtime 2.75.0 → 2.77.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.
Files changed (52) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +23 -0
  3. package/dist/compiler/component-compiler.d.ts +0 -1
  4. package/dist/compiler/component-compiler.d.ts.map +1 -1
  5. package/dist/compiler/component-compiler.js +34 -25
  6. package/dist/index.d.ts +4 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +10 -2
  9. package/dist/registry/component-registry.d.ts +1 -0
  10. package/dist/registry/component-registry.d.ts.map +1 -1
  11. package/dist/registry/component-registry.js +6 -3
  12. package/dist/runtime/index.d.ts +2 -1
  13. package/dist/runtime/index.d.ts.map +1 -1
  14. package/dist/runtime/index.js +4 -2
  15. package/dist/runtime/prop-builder.d.ts +1 -2
  16. package/dist/runtime/prop-builder.d.ts.map +1 -1
  17. package/dist/runtime/prop-builder.js +4 -76
  18. package/dist/runtime/react-root-manager.d.ts +26 -0
  19. package/dist/runtime/react-root-manager.d.ts.map +1 -0
  20. package/dist/runtime/react-root-manager.js +122 -0
  21. package/dist/types/index.d.ts +1 -0
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/utilities/cache-manager.d.ts +38 -0
  24. package/dist/utilities/cache-manager.d.ts.map +1 -0
  25. package/dist/utilities/cache-manager.js +156 -0
  26. package/dist/utilities/core-libraries.d.ts +5 -0
  27. package/dist/utilities/core-libraries.d.ts.map +1 -0
  28. package/dist/utilities/core-libraries.js +52 -0
  29. package/dist/utilities/index.d.ts +2 -0
  30. package/dist/utilities/index.d.ts.map +1 -1
  31. package/dist/utilities/index.js +2 -0
  32. package/dist/utilities/library-loader.d.ts +2 -2
  33. package/dist/utilities/library-loader.d.ts.map +1 -1
  34. package/dist/utilities/library-loader.js +52 -24
  35. package/dist/utilities/resource-manager.d.ts +34 -0
  36. package/dist/utilities/resource-manager.d.ts.map +1 -0
  37. package/dist/utilities/resource-manager.js +174 -0
  38. package/package.json +4 -4
  39. package/samples/entities-1.js +493 -0
  40. package/src/compiler/component-compiler.ts +64 -35
  41. package/src/index.ts +18 -1
  42. package/src/registry/component-registry.ts +14 -4
  43. package/src/runtime/index.ts +7 -2
  44. package/src/runtime/prop-builder.ts +5 -112
  45. package/src/runtime/react-root-manager.ts +218 -0
  46. package/src/types/index.ts +2 -0
  47. package/src/utilities/cache-manager.ts +253 -0
  48. package/src/utilities/core-libraries.ts +61 -0
  49. package/src/utilities/index.ts +3 -1
  50. package/src/utilities/library-loader.ts +111 -47
  51. package/src/utilities/resource-manager.ts +305 -0
  52. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @memberjunction/react-runtime@2.75.0 build
2
+ > @memberjunction/react-runtime@2.77.0 build
3
3
  > tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @memberjunction/react-runtime
2
2
 
3
+ ## 2.77.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d8f14a2]
8
+ - Updated dependencies [c91269e]
9
+ - @memberjunction/core@2.77.0
10
+ - @memberjunction/interactive-component-types@2.77.0
11
+ - @memberjunction/global@2.77.0
12
+
13
+ ## 2.76.0
14
+
15
+ ### Minor Changes
16
+
17
+ - ffda243: migration
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [7dabb22]
22
+ - @memberjunction/core@2.76.0
23
+ - @memberjunction/interactive-component-types@2.76.0
24
+ - @memberjunction/global@2.76.0
25
+
3
26
  ## 2.75.0
4
27
 
5
28
  ### Minor Changes
@@ -9,7 +9,6 @@ export declare class ComponentCompiler {
9
9
  private transpileComponent;
10
10
  private wrapComponentCode;
11
11
  private createComponentFactory;
12
- private createStateUpdaterUtility;
13
12
  private validateCompileOptions;
14
13
  private generateComponentId;
15
14
  private getCachedComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"component-compiler.d.ts","sourceRoot":"","sources":["../../src/compiler/component-compiler.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EAEd,iBAAiB,EACjB,cAAc,EAGf,MAAM,UAAU,CAAC;AAoBlB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,aAAa,CAAM;gBAMf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAS5C,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAS5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqElE,OAAO,CAAC,kBAAkB;IAgC1B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,sBAAsB;IAmD9B,OAAO,CAAC,yBAAyB;IAwBjC,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,sBAAsB;IAa9B,UAAU,IAAI,IAAI;IAQlB,YAAY,IAAI,MAAM;IAQtB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;CAGpD"}
1
+ {"version":3,"file":"component-compiler.d.ts","sourceRoot":"","sources":["../../src/compiler/component-compiler.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EAEd,iBAAiB,EACjB,cAAc,EAGf,MAAM,UAAU,CAAC;AAoBlB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,aAAa,CAAM;gBAMf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAS5C,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAS5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqElE,OAAO,CAAC,kBAAkB;IAgC1B,OAAO,CAAC,iBAAiB;IAoCzB,OAAO,CAAC,sBAAsB;IA2D9B,OAAO,CAAC,sBAAsB;IAiE9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,sBAAsB;IAa9B,UAAU,IAAI,IAAI;IAQlB,YAAY,IAAI,MAAM;IAQtB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;CAGpD"}
@@ -81,7 +81,11 @@ class ComponentCompiler {
81
81
  }
82
82
  wrapComponentCode(componentCode, componentName) {
83
83
  return `
84
- function createComponent(React, ReactDOM, useState, useEffect, useCallback, createStateUpdater, libraries, styles, console) {
84
+ function createComponent(
85
+ React, ReactDOM,
86
+ useState, useEffect, useCallback, useMemo, useRef, useContext, useReducer, useLayoutEffect,
87
+ libraries, styles, console
88
+ ) {
85
89
  ${componentCode}
86
90
 
87
91
  // Ensure the component exists
@@ -106,46 +110,51 @@ class ComponentCompiler {
106
110
  }
107
111
  createComponentFactory(transpiledCode, componentName) {
108
112
  try {
109
- const factoryCreator = new Function('React', 'ReactDOM', 'useState', 'useEffect', 'useCallback', 'createStateUpdater', 'libraries', 'styles', 'console', `${transpiledCode}; return createComponent;`);
113
+ const factoryCreator = new Function('React', 'ReactDOM', 'useState', 'useEffect', 'useCallback', 'useMemo', 'useRef', 'useContext', 'useReducer', 'useLayoutEffect', 'libraries', 'styles', 'console', `${transpiledCode}; return createComponent;`);
110
114
  return (context, styles = {}) => {
111
115
  const { React, ReactDOM, libraries = {} } = context;
112
- const createStateUpdater = this.createStateUpdaterUtility();
113
- const createComponentFn = factoryCreator(React, ReactDOM, React.useState, React.useEffect, React.useCallback, createStateUpdater, libraries, styles, console);
114
- return createComponentFn(React, ReactDOM, React.useState, React.useEffect, React.useCallback, createStateUpdater, libraries, styles, console);
116
+ const createComponentFn = factoryCreator(React, ReactDOM, React.useState, React.useEffect, React.useCallback, React.useMemo, React.useRef, React.useContext, React.useReducer, React.useLayoutEffect, libraries, styles, console);
117
+ return createComponentFn(React, ReactDOM, React.useState, React.useEffect, React.useCallback, React.useMemo, React.useRef, React.useContext, React.useReducer, React.useLayoutEffect, libraries, styles, console);
115
118
  };
116
119
  }
117
120
  catch (error) {
118
121
  throw new Error(`Failed to create component factory: ${error.message}`);
119
122
  }
120
123
  }
121
- createStateUpdaterUtility() {
122
- return (statePath, parentStateUpdater) => {
123
- return (componentStateUpdate) => {
124
- if (!statePath) {
125
- parentStateUpdater(componentStateUpdate);
126
- }
127
- else {
128
- const pathParts = statePath.split('.');
129
- const componentKey = pathParts[pathParts.length - 1];
130
- parentStateUpdater({
131
- [componentKey]: componentStateUpdate
132
- });
133
- }
134
- };
135
- };
136
- }
137
124
  validateCompileOptions(options) {
125
+ if (!options) {
126
+ throw new Error('Component compilation failed: No options provided.\n' +
127
+ 'Expected an object with componentName and componentCode properties.\n' +
128
+ 'Example: { componentName: "MyComponent", componentCode: "function MyComponent() { ... }" }');
129
+ }
138
130
  if (!options.componentName) {
139
- throw new Error('Component name is required');
131
+ const providedKeys = Object.keys(options).join(', ');
132
+ throw new Error('Component compilation failed: Component name is required.\n' +
133
+ `Received options with keys: [${providedKeys}]\n` +
134
+ 'Please ensure your component spec includes a "name" property.\n' +
135
+ 'Example: { name: "MyComponent", code: "..." }');
140
136
  }
141
137
  if (!options.componentCode) {
142
- throw new Error('Component code is required');
138
+ throw new Error(`Component compilation failed: Component code is required for "${options.componentName}".\n` +
139
+ 'Please ensure your component spec includes a "code" property with the component source code.\n' +
140
+ 'Example: { name: "MyComponent", code: "function MyComponent() { return <div>Hello</div>; }" }');
143
141
  }
144
142
  if (typeof options.componentCode !== 'string') {
145
- throw new Error('Component code must be a string');
143
+ const actualType = typeof options.componentCode;
144
+ throw new Error(`Component compilation failed: Component code must be a string for "${options.componentName}".\n` +
145
+ `Received type: ${actualType}\n` +
146
+ `Received value: ${JSON.stringify(options.componentCode).substring(0, 100)}...\n` +
147
+ 'Please ensure the code property contains a string of JavaScript/JSX code.');
148
+ }
149
+ if (options.componentCode.trim().length === 0) {
150
+ throw new Error(`Component compilation failed: Component code is empty for "${options.componentName}".\n` +
151
+ 'The code property must contain valid JavaScript/JSX code defining a React component.');
146
152
  }
147
153
  if (!options.componentCode.includes(options.componentName)) {
148
- throw new Error(`Component code must define a component named "${options.componentName}"`);
154
+ throw new Error(`Component compilation failed: Component code must define a component named "${options.componentName}".\n` +
155
+ 'The function/component name in the code must match the componentName property.\n' +
156
+ `Expected to find: function ${options.componentName}(...) or const ${options.componentName} = ...\n` +
157
+ 'Code preview: ' + options.componentCode.substring(0, 200) + '...');
149
158
  }
150
159
  }
151
160
  generateComponentId(componentName) {
package/dist/index.d.ts CHANGED
@@ -8,13 +8,16 @@ export { ComponentRegistry } from './registry';
8
8
  export { ComponentResolver, ComponentSpec, ResolvedComponents } from './registry';
9
9
  export { createErrorBoundary, withErrorBoundary, formatComponentError, createErrorLogger } from './runtime';
10
10
  export { wrapComponent, memoizeComponent, lazyComponent, injectProps, conditionalComponent, withErrorHandler, portalComponent, WrapperOptions } from './runtime';
11
- export { buildComponentProps, cleanupPropBuilder, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './runtime';
11
+ export { buildComponentProps, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './runtime';
12
12
  export { ComponentHierarchyRegistrar, registerComponentHierarchy, validateComponentSpec, flattenComponentHierarchy, countComponentsInHierarchy, HierarchyRegistrationResult, ComponentRegistrationError, HierarchyRegistrationOptions } from './runtime';
13
+ export { ReactRootManager, reactRootManager, ManagedReactRoot } from './runtime';
13
14
  export { RuntimeUtilities, createRuntimeUtilities } from './utilities/runtime-utilities';
14
15
  export { SetupStyles, createDefaultComponentStyles } from './utilities/component-styles';
15
16
  export { StandardLibraries, StandardLibraryManager, createStandardLibraries } from './utilities/standard-libraries';
16
17
  export { LibraryLoader, LibraryLoadOptions, LibraryLoadResult } from './utilities/library-loader';
17
18
  export { ComponentErrorAnalyzer, FailedComponentInfo } from './utilities/component-error-analyzer';
19
+ export { ResourceManager, resourceManager, ManagedResource } from './utilities/resource-manager';
20
+ export { CacheManager, CacheEntry, CacheOptions } from './utilities/cache-manager';
18
21
  export declare const VERSION = "2.69.1";
19
22
  export declare const DEFAULT_CONFIGS: {
20
23
  compiler: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,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,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EAChB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EACb,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,OAAO,WAAW,CAAC;AAGhC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAQF,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,GAAG,EAClB,MAAM,CAAC,EAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,SAAS,EAAE,cAAc,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,SAAS,EAAE,cAAc,CAAC,CAAC;CACtD;;;;;EAcF"}
package/dist/index.js CHANGED
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createReactRuntime = exports.DEFAULT_CONFIGS = exports.VERSION = exports.ComponentErrorAnalyzer = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.createRuntimeUtilities = exports.RuntimeUtilities = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.cleanupPropBuilder = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
17
+ exports.DEFAULT_CONFIGS = exports.VERSION = exports.CacheManager = exports.resourceManager = exports.ResourceManager = exports.ComponentErrorAnalyzer = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.createRuntimeUtilities = exports.RuntimeUtilities = exports.reactRootManager = exports.ReactRootManager = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
18
+ exports.createReactRuntime = void 0;
18
19
  const compiler_1 = require("./compiler");
19
20
  const registry_1 = require("./registry");
20
21
  const registry_2 = require("./registry");
@@ -49,7 +50,6 @@ Object.defineProperty(exports, "withErrorHandler", { enumerable: true, get: func
49
50
  Object.defineProperty(exports, "portalComponent", { enumerable: true, get: function () { return runtime_2.portalComponent; } });
50
51
  var runtime_3 = require("./runtime");
51
52
  Object.defineProperty(exports, "buildComponentProps", { enumerable: true, get: function () { return runtime_3.buildComponentProps; } });
52
- Object.defineProperty(exports, "cleanupPropBuilder", { enumerable: true, get: function () { return runtime_3.cleanupPropBuilder; } });
53
53
  Object.defineProperty(exports, "normalizeCallbacks", { enumerable: true, get: function () { return runtime_3.normalizeCallbacks; } });
54
54
  Object.defineProperty(exports, "normalizeStyles", { enumerable: true, get: function () { return runtime_3.normalizeStyles; } });
55
55
  Object.defineProperty(exports, "validateComponentProps", { enumerable: true, get: function () { return runtime_3.validateComponentProps; } });
@@ -63,6 +63,9 @@ Object.defineProperty(exports, "registerComponentHierarchy", { enumerable: true,
63
63
  Object.defineProperty(exports, "validateComponentSpec", { enumerable: true, get: function () { return runtime_4.validateComponentSpec; } });
64
64
  Object.defineProperty(exports, "flattenComponentHierarchy", { enumerable: true, get: function () { return runtime_4.flattenComponentHierarchy; } });
65
65
  Object.defineProperty(exports, "countComponentsInHierarchy", { enumerable: true, get: function () { return runtime_4.countComponentsInHierarchy; } });
66
+ var runtime_5 = require("./runtime");
67
+ Object.defineProperty(exports, "ReactRootManager", { enumerable: true, get: function () { return runtime_5.ReactRootManager; } });
68
+ Object.defineProperty(exports, "reactRootManager", { enumerable: true, get: function () { return runtime_5.reactRootManager; } });
66
69
  var runtime_utilities_1 = require("./utilities/runtime-utilities");
67
70
  Object.defineProperty(exports, "RuntimeUtilities", { enumerable: true, get: function () { return runtime_utilities_1.RuntimeUtilities; } });
68
71
  Object.defineProperty(exports, "createRuntimeUtilities", { enumerable: true, get: function () { return runtime_utilities_1.createRuntimeUtilities; } });
@@ -76,6 +79,11 @@ var library_loader_1 = require("./utilities/library-loader");
76
79
  Object.defineProperty(exports, "LibraryLoader", { enumerable: true, get: function () { return library_loader_1.LibraryLoader; } });
77
80
  var component_error_analyzer_1 = require("./utilities/component-error-analyzer");
78
81
  Object.defineProperty(exports, "ComponentErrorAnalyzer", { enumerable: true, get: function () { return component_error_analyzer_1.ComponentErrorAnalyzer; } });
82
+ var resource_manager_1 = require("./utilities/resource-manager");
83
+ Object.defineProperty(exports, "ResourceManager", { enumerable: true, get: function () { return resource_manager_1.ResourceManager; } });
84
+ Object.defineProperty(exports, "resourceManager", { enumerable: true, get: function () { return resource_manager_1.resourceManager; } });
85
+ var cache_manager_1 = require("./utilities/cache-manager");
86
+ Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return cache_manager_1.CacheManager; } });
79
87
  exports.VERSION = '2.69.1';
80
88
  exports.DEFAULT_CONFIGS = {
81
89
  compiler: {
@@ -3,6 +3,7 @@ export declare class ComponentRegistry {
3
3
  private registry;
4
4
  private config;
5
5
  private cleanupTimer?;
6
+ private registryId;
6
7
  constructor(config?: Partial<RegistryConfig>);
7
8
  register(name: string, component: any, namespace?: string, version?: string, tags?: string[]): ComponentMetadata;
8
9
  get(name: string, namespace?: string, version?: string): any;
@@ -1 +1 @@
1
- {"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/registry/component-registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAC;AAgBlB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,YAAY,CAAC,CAA0B;gBAMnC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAmB5C,QAAQ,CACN,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,GAAG,EACd,SAAS,GAAE,MAAiB,EAC5B,OAAO,GAAE,MAAa,EACtB,IAAI,CAAC,EAAE,MAAM,EAAE,GACd,iBAAiB;IAuCpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG;IAyBtE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAe1E,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,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AE,MAAM,EAAE,GACd,iBAAiB;IAuCpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG;IAyBtE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAe1E,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAejF,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAgBpD,aAAa,IAAI,MAAM,EAAE;IAezB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE;IAkB9C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAgB3E,KAAK,IAAI,IAAI;IAQb,IAAI,IAAI,MAAM;IASd,OAAO,CAAC,KAAK,GAAE,OAAe,GAAG,MAAM;IAyBvC,QAAQ,IAAI;QACV,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,IAAI,CAAC;QACvB,eAAe,CAAC,EAAE,IAAI,CAAC;KACxB;IA6BD,OAAO,IAAI,IAAI;IAcf,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,QAAQ;IAsBhB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,gBAAgB;CAMzB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ComponentRegistry = void 0;
4
+ const resource_manager_1 = require("../utilities/resource-manager");
4
5
  const DEFAULT_REGISTRY_CONFIG = {
5
6
  maxComponents: 1000,
6
7
  cleanupInterval: 60000,
@@ -11,6 +12,7 @@ class ComponentRegistry {
11
12
  constructor(config) {
12
13
  this.config = { ...DEFAULT_REGISTRY_CONFIG, ...config };
13
14
  this.registry = new Map();
15
+ this.registryId = `component-registry-${Date.now()}`;
14
16
  if (this.config.cleanupInterval > 0) {
15
17
  this.startCleanupTimer();
16
18
  }
@@ -146,6 +148,7 @@ class ComponentRegistry {
146
148
  destroy() {
147
149
  this.stopCleanupTimer();
148
150
  this.clear();
151
+ resource_manager_1.resourceManager.cleanupComponent(this.registryId);
149
152
  }
150
153
  generateRegistryKey(name, namespace, version) {
151
154
  if (this.config.enableNamespaces) {
@@ -183,13 +186,13 @@ class ComponentRegistry {
183
186
  }
184
187
  }
185
188
  startCleanupTimer() {
186
- this.cleanupTimer = setInterval(() => {
189
+ this.cleanupTimer = resource_manager_1.resourceManager.setInterval(this.registryId, () => {
187
190
  this.cleanup();
188
- }, this.config.cleanupInterval);
191
+ }, this.config.cleanupInterval, { purpose: 'component-registry-cleanup' });
189
192
  }
190
193
  stopCleanupTimer() {
191
194
  if (this.cleanupTimer) {
192
- clearInterval(this.cleanupTimer);
195
+ resource_manager_1.resourceManager.clearInterval(this.registryId, this.cleanupTimer);
193
196
  this.cleanupTimer = undefined;
194
197
  }
195
198
  }
@@ -1,5 +1,6 @@
1
1
  export { createErrorBoundary, withErrorBoundary, formatComponentError, createErrorLogger } from './error-boundary';
2
2
  export { wrapComponent, memoizeComponent, lazyComponent, injectProps, conditionalComponent, withErrorHandler, portalComponent, WrapperOptions } from './component-wrapper';
3
- export { buildComponentProps, cleanupPropBuilder, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './prop-builder';
3
+ export { buildComponentProps, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './prop-builder';
4
4
  export { ComponentHierarchyRegistrar, registerComponentHierarchy, validateComponentSpec, flattenComponentHierarchy, countComponentsInHierarchy, HierarchyRegistrationResult, ComponentRegistrationError, HierarchyRegistrationOptions } from './component-hierarchy';
5
+ export { ReactRootManager, reactRootManager, ManagedReactRoot } from './react-root-manager';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.cleanupPropBuilder = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = void 0;
3
+ exports.reactRootManager = exports.ReactRootManager = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = void 0;
4
4
  var error_boundary_1 = require("./error-boundary");
5
5
  Object.defineProperty(exports, "createErrorBoundary", { enumerable: true, get: function () { return error_boundary_1.createErrorBoundary; } });
6
6
  Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return error_boundary_1.withErrorBoundary; } });
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "withErrorHandler", { enumerable: true, get: func
16
16
  Object.defineProperty(exports, "portalComponent", { enumerable: true, get: function () { return component_wrapper_1.portalComponent; } });
17
17
  var prop_builder_1 = require("./prop-builder");
18
18
  Object.defineProperty(exports, "buildComponentProps", { enumerable: true, get: function () { return prop_builder_1.buildComponentProps; } });
19
- Object.defineProperty(exports, "cleanupPropBuilder", { enumerable: true, get: function () { return prop_builder_1.cleanupPropBuilder; } });
20
19
  Object.defineProperty(exports, "normalizeCallbacks", { enumerable: true, get: function () { return prop_builder_1.normalizeCallbacks; } });
21
20
  Object.defineProperty(exports, "normalizeStyles", { enumerable: true, get: function () { return prop_builder_1.normalizeStyles; } });
22
21
  Object.defineProperty(exports, "validateComponentProps", { enumerable: true, get: function () { return prop_builder_1.validateComponentProps; } });
@@ -30,3 +29,6 @@ Object.defineProperty(exports, "registerComponentHierarchy", { enumerable: true,
30
29
  Object.defineProperty(exports, "validateComponentSpec", { enumerable: true, get: function () { return component_hierarchy_1.validateComponentSpec; } });
31
30
  Object.defineProperty(exports, "flattenComponentHierarchy", { enumerable: true, get: function () { return component_hierarchy_1.flattenComponentHierarchy; } });
32
31
  Object.defineProperty(exports, "countComponentsInHierarchy", { enumerable: true, get: function () { return component_hierarchy_1.countComponentsInHierarchy; } });
32
+ var react_root_manager_1 = require("./react-root-manager");
33
+ Object.defineProperty(exports, "ReactRootManager", { enumerable: true, get: function () { return react_root_manager_1.ReactRootManager; } });
34
+ Object.defineProperty(exports, "reactRootManager", { enumerable: true, get: function () { return react_root_manager_1.reactRootManager; } });
@@ -6,12 +6,11 @@ export interface PropBuilderOptions {
6
6
  transformState?: (state: any) => any;
7
7
  debounceUpdateUserState?: number;
8
8
  }
9
- export declare function buildComponentProps(data?: any, userState?: any, utilities?: any, callbacks?: ComponentCallbacks, components?: Record<string, any>, styles?: ComponentStyles, options?: PropBuilderOptions): ComponentProps;
9
+ export declare function buildComponentProps(data?: any, userState?: any, utilities?: any, callbacks?: ComponentCallbacks, components?: Record<string, any>, styles?: ComponentStyles, options?: PropBuilderOptions, onStateChanged?: (stateUpdate: Record<string, any>) => void): ComponentProps;
10
10
  export declare function normalizeCallbacks(callbacks: any, debounceMs?: number): ComponentCallbacks;
11
11
  export declare function normalizeStyles(styles?: any): any;
12
12
  export declare function validateComponentProps(props: ComponentProps): void;
13
13
  export declare function mergeProps(...propsList: Partial<ComponentProps>[]): ComponentProps;
14
- export declare function cleanupPropBuilder(callbacks: ComponentCallbacks): void;
15
14
  export declare function createPropsTransformer(transformations: Record<string, (value: any) => any>): (props: ComponentProps) => ComponentProps;
16
15
  export declare function wrapCallbacksWithLogging(callbacks: ComponentCallbacks, componentName: string): ComponentCallbacks;
17
16
  export declare function extractPropPaths(componentCode: string): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"prop-builder.d.ts","sourceRoot":"","sources":["../../src/runtime/prop-builder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM/E,MAAM,WAAW,kBAAkB;IAEjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAEnC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAErC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAaD,wBAAgB,mBAAmB,CACjC,IAAI,GAAE,GAAQ,EACd,SAAS,GAAE,GAAQ,EACnB,SAAS,GAAE,GAAQ,EACnB,SAAS,GAAE,kBAAuB,EAClC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,MAAM,CAAC,EA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AgB,mBAAmB,CACjC,IAAI,GAAE,GAAQ,EACd,SAAS,GAAE,GAAQ,EACnB,SAAS,GAAE,GAAQ,EACnB,SAAS,GAAE,kBAAuB,EAClC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,MAAM,CAAC,EAAE,eAAe,EACxB,OAAO,GAAE,kBAAuB,EAChC,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,GAC1D,cAAc,CA6BhB;AA0CD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,GAAE,MAAa,GAAG,kBAAkB,CAahG;AAOD,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,CAKjD;AAOD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CA2BlE;AAOD,wBAAgB,UAAU,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,GAAG,cAAc,CAqClF;AAOD,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GACnD,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,CAyB3C;AAQD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,kBAAkB,EAC7B,aAAa,EAAE,MAAM,GACpB,kBAAkB,CAkBpB;AAOD,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBhE"}
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.cleanupPropBuilder = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = void 0;
4
- const rxjs_1 = require("rxjs");
5
- function buildComponentProps(data = {}, userState = {}, utilities = {}, callbacks = {}, components = {}, styles, options = {}) {
3
+ exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = void 0;
4
+ function buildComponentProps(data = {}, userState = {}, utilities = {}, callbacks = {}, components = {}, styles, options = {}, onStateChanged) {
6
5
  const { validate = true, transformData, transformState, debounceUpdateUserState = 3000 } = options;
7
6
  const transformedData = transformData ? transformData(data) : data;
8
7
  const transformedState = transformState ? transformState(userState) : userState;
@@ -12,7 +11,8 @@ function buildComponentProps(data = {}, userState = {}, utilities = {}, callback
12
11
  utilities,
13
12
  callbacks: normalizeCallbacks(callbacks, debounceUpdateUserState),
14
13
  components,
15
- styles: normalizeStyles(styles)
14
+ styles: normalizeStyles(styles),
15
+ onStateChanged
16
16
  };
17
17
  if (validate) {
18
18
  validateComponentProps(props);
@@ -50,49 +50,6 @@ function normalizeCallbacks(callbacks, debounceMs = 3000) {
50
50
  if (callbacks.OpenEntityRecord && typeof callbacks.OpenEntityRecord === 'function') {
51
51
  normalized.OpenEntityRecord = callbacks.OpenEntityRecord;
52
52
  }
53
- if (callbacks.UpdateUserState && typeof callbacks.UpdateUserState === 'function') {
54
- const originalCallback = callbacks.UpdateUserState;
55
- let subject = updateUserStateSubjects.get(originalCallback);
56
- if (!subject) {
57
- subject = new rxjs_1.Subject();
58
- updateUserStateSubjects.set(originalCallback, subject);
59
- const subscription = subject.pipe((0, rxjs_1.debounceTime)(debounceMs)).subscribe(state => {
60
- console.log(`[Skip Component] UpdateUserState called after ${debounceMs}ms debounce`);
61
- originalCallback(state);
62
- });
63
- updateUserStateSubscriptions.set(originalCallback, subscription);
64
- }
65
- let loopState = loopDetectionStates.get(originalCallback);
66
- if (!loopState) {
67
- loopState = { count: 0, lastUpdate: 0, lastState: null };
68
- loopDetectionStates.set(originalCallback, loopState);
69
- }
70
- normalized.UpdateUserState = (state) => {
71
- if (loopState.lastState && deepEqual(state, loopState.lastState)) {
72
- console.log('[Skip Component] Skipping redundant state update');
73
- return;
74
- }
75
- const now = Date.now();
76
- const timeSinceLastUpdate = now - loopState.lastUpdate;
77
- if (timeSinceLastUpdate < 100) {
78
- loopState.count++;
79
- if (loopState.count > 5) {
80
- console.error('[Skip Component] Rapid state updates detected - possible infinite loop');
81
- console.error('Updates in last 100ms:', loopState.count);
82
- }
83
- }
84
- else {
85
- loopState.count = 0;
86
- }
87
- loopState.lastUpdate = now;
88
- loopState.lastState = JSON.parse(JSON.stringify(state));
89
- console.log('[Skip Component] Processing state update');
90
- subject.next(state);
91
- };
92
- }
93
- if (callbacks.NotifyEvent && typeof callbacks.NotifyEvent === 'function') {
94
- normalized.NotifyEvent = callbacks.NotifyEvent;
95
- }
96
53
  return normalized;
97
54
  }
98
55
  exports.normalizeCallbacks = normalizeCallbacks;
@@ -152,23 +109,6 @@ function mergeProps(...propsList) {
152
109
  return merged;
153
110
  }
154
111
  exports.mergeProps = mergeProps;
155
- function cleanupPropBuilder(callbacks) {
156
- if (callbacks.UpdateUserState && typeof callbacks.UpdateUserState === 'function') {
157
- const originalCallback = callbacks.UpdateUserState;
158
- const subscription = updateUserStateSubscriptions.get(originalCallback);
159
- if (subscription) {
160
- subscription.unsubscribe();
161
- updateUserStateSubscriptions.delete(originalCallback);
162
- }
163
- const subject = updateUserStateSubjects.get(originalCallback);
164
- if (subject) {
165
- subject.complete();
166
- updateUserStateSubjects.delete(originalCallback);
167
- }
168
- loopDetectionStates.delete(originalCallback);
169
- }
170
- }
171
- exports.cleanupPropBuilder = cleanupPropBuilder;
172
112
  function createPropsTransformer(transformations) {
173
113
  return (props) => {
174
114
  const transformed = { ...props };
@@ -204,18 +144,6 @@ function wrapCallbacksWithLogging(callbacks, componentName) {
204
144
  callbacks.OpenEntityRecord(entityName, key);
205
145
  };
206
146
  }
207
- if (callbacks.UpdateUserState) {
208
- wrapped.UpdateUserState = (state) => {
209
- console.log(`[${componentName}] UpdateUserState called:`, state);
210
- callbacks.UpdateUserState(state);
211
- };
212
- }
213
- if (callbacks.NotifyEvent) {
214
- wrapped.NotifyEvent = (event, data) => {
215
- console.log(`[${componentName}] NotifyEvent called:`, { event, data });
216
- callbacks.NotifyEvent(event, data);
217
- };
218
- }
219
147
  return wrapped;
220
148
  }
221
149
  exports.wrapCallbacksWithLogging = wrapCallbacksWithLogging;
@@ -0,0 +1,26 @@
1
+ export interface ManagedReactRoot {
2
+ id: string;
3
+ root: any;
4
+ container: HTMLElement;
5
+ isRendering: boolean;
6
+ lastRenderTime?: Date;
7
+ componentId?: string;
8
+ }
9
+ export declare class ReactRootManager {
10
+ private roots;
11
+ private renderingRoots;
12
+ private unmountQueue;
13
+ createRoot(container: HTMLElement, createRootFn: (container: HTMLElement) => any, componentId?: string): string;
14
+ render(rootId: string, element: any, onComplete?: () => void): void;
15
+ unmountRoot(rootId: string, force?: boolean): Promise<void>;
16
+ unmountComponentRoots(componentId: string): Promise<void>;
17
+ isRendering(rootId: string): boolean;
18
+ getStats(): {
19
+ totalRoots: number;
20
+ renderingRoots: number;
21
+ pendingUnmounts: number;
22
+ };
23
+ cleanup(): Promise<void>;
24
+ }
25
+ export declare const reactRootManager: ReactRootManager;
26
+ //# sourceMappingURL=react-root-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-root-manager.d.ts","sourceRoot":"","sources":["../../src/runtime/react-root-manager.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,WAAW,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAuC;IACpD,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,YAAY,CAAiC;IASrD,UAAU,CACR,SAAS,EAAE,WAAW,EACtB,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,GAAG,EAC7C,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM;IAgCT,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EACZ,UAAU,CAAC,EAAE,MAAM,IAAI,GACtB,IAAI;IAkDP,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAiD5D,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB/D,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAOpC,QAAQ,IAAI;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACzB;IAWK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAI/B;AAGD,eAAO,MAAM,gBAAgB,kBAAyB,CAAC"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reactRootManager = exports.ReactRootManager = void 0;
4
+ const resource_manager_1 = require("../utilities/resource-manager");
5
+ class ReactRootManager {
6
+ constructor() {
7
+ this.roots = new Map();
8
+ this.renderingRoots = new Set();
9
+ this.unmountQueue = new Map();
10
+ }
11
+ createRoot(container, createRootFn, componentId) {
12
+ const rootId = `react-root-${Date.now()}-${Math.random()}`;
13
+ const root = createRootFn(container);
14
+ const managedRoot = {
15
+ id: rootId,
16
+ root,
17
+ container,
18
+ isRendering: false,
19
+ componentId
20
+ };
21
+ this.roots.set(rootId, managedRoot);
22
+ if (componentId) {
23
+ resource_manager_1.resourceManager.registerReactRoot(componentId, root, () => this.unmountRoot(rootId));
24
+ }
25
+ return rootId;
26
+ }
27
+ render(rootId, element, onComplete) {
28
+ const managedRoot = this.roots.get(rootId);
29
+ if (!managedRoot) {
30
+ console.warn(`React root ${rootId} not found`);
31
+ return;
32
+ }
33
+ if (this.unmountQueue.has(rootId)) {
34
+ console.warn(`React root ${rootId} is being unmounted, skipping render`);
35
+ return;
36
+ }
37
+ managedRoot.isRendering = true;
38
+ this.renderingRoots.add(rootId);
39
+ try {
40
+ managedRoot.root.render(element);
41
+ managedRoot.lastRenderTime = new Date();
42
+ Promise.resolve().then(() => {
43
+ managedRoot.isRendering = false;
44
+ this.renderingRoots.delete(rootId);
45
+ const pendingUnmount = this.unmountQueue.get(rootId);
46
+ if (pendingUnmount) {
47
+ this.unmountQueue.delete(rootId);
48
+ pendingUnmount();
49
+ }
50
+ if (onComplete) {
51
+ onComplete();
52
+ }
53
+ });
54
+ }
55
+ catch (error) {
56
+ managedRoot.isRendering = false;
57
+ this.renderingRoots.delete(rootId);
58
+ throw error;
59
+ }
60
+ }
61
+ unmountRoot(rootId, force = false) {
62
+ return new Promise((resolve) => {
63
+ const managedRoot = this.roots.get(rootId);
64
+ if (!managedRoot) {
65
+ resolve();
66
+ return;
67
+ }
68
+ const performUnmount = () => {
69
+ try {
70
+ managedRoot.root.unmount();
71
+ this.roots.delete(rootId);
72
+ this.renderingRoots.delete(rootId);
73
+ if (managedRoot.container) {
74
+ delete managedRoot.container._reactRootContainer;
75
+ const newContainer = managedRoot.container.cloneNode(false);
76
+ managedRoot.container.parentNode?.replaceChild(newContainer, managedRoot.container);
77
+ }
78
+ resolve();
79
+ }
80
+ catch (error) {
81
+ console.error(`Error unmounting React root ${rootId}:`, error);
82
+ this.roots.delete(rootId);
83
+ this.renderingRoots.delete(rootId);
84
+ resolve();
85
+ }
86
+ };
87
+ if (!managedRoot.isRendering || force) {
88
+ performUnmount();
89
+ }
90
+ else {
91
+ this.unmountQueue.set(rootId, () => {
92
+ performUnmount();
93
+ });
94
+ }
95
+ });
96
+ }
97
+ async unmountComponentRoots(componentId) {
98
+ const rootIds = [];
99
+ for (const [rootId, managedRoot] of this.roots) {
100
+ if (managedRoot.componentId === componentId) {
101
+ rootIds.push(rootId);
102
+ }
103
+ }
104
+ await Promise.all(rootIds.map(id => this.unmountRoot(id)));
105
+ }
106
+ isRendering(rootId) {
107
+ return this.renderingRoots.has(rootId);
108
+ }
109
+ getStats() {
110
+ return {
111
+ totalRoots: this.roots.size,
112
+ renderingRoots: this.renderingRoots.size,
113
+ pendingUnmounts: this.unmountQueue.size
114
+ };
115
+ }
116
+ async cleanup() {
117
+ const allRootIds = Array.from(this.roots.keys());
118
+ await Promise.all(allRootIds.map(id => this.unmountRoot(id, true)));
119
+ }
120
+ }
121
+ exports.ReactRootManager = ReactRootManager;
122
+ exports.reactRootManager = new ReactRootManager();
@@ -46,6 +46,7 @@ export interface ComponentProps {
46
46
  callbacks: ComponentCallbacks;
47
47
  components?: Record<string, any>;
48
48
  styles?: ComponentStyles;
49
+ onStateChanged?: (stateUpdate: Record<string, any>) => void;
49
50
  }
50
51
  export interface ComponentCallbacks {
51
52
  RefreshData?: () => void;