@memberjunction/react-runtime 2.74.0 → 2.75.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 (37) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +96 -4
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +3 -5
  7. package/dist/registry/component-resolver.d.ts +1 -6
  8. package/dist/registry/component-resolver.d.ts.map +1 -1
  9. package/dist/registry/component-resolver.js +19 -19
  10. package/dist/registry/index.d.ts +2 -1
  11. package/dist/registry/index.d.ts.map +1 -1
  12. package/dist/registry/index.js +3 -1
  13. package/dist/runtime/component-hierarchy.d.ts +1 -1
  14. package/dist/runtime/component-hierarchy.d.ts.map +1 -1
  15. package/dist/runtime/component-hierarchy.js +25 -25
  16. package/dist/types/index.d.ts +1 -0
  17. package/dist/types/index.d.ts.map +1 -1
  18. package/dist/types/index.js +15 -0
  19. package/dist/types/library-config.d.ts +32 -0
  20. package/dist/types/library-config.d.ts.map +1 -0
  21. package/dist/types/library-config.js +2 -0
  22. package/dist/utilities/library-loader.d.ts +3 -2
  23. package/dist/utilities/library-loader.d.ts.map +1 -1
  24. package/dist/utilities/library-loader.js +54 -76
  25. package/dist/utilities/standard-libraries.d.ts +13 -24
  26. package/dist/utilities/standard-libraries.d.ts.map +1 -1
  27. package/dist/utilities/standard-libraries.js +58 -47
  28. package/package.json +4 -4
  29. package/src/index.ts +1 -4
  30. package/src/registry/component-resolver.ts +21 -30
  31. package/src/registry/index.ts +2 -1
  32. package/src/runtime/component-hierarchy.ts +26 -26
  33. package/src/types/index.ts +4 -1
  34. package/src/types/library-config.ts +75 -0
  35. package/src/utilities/library-loader.ts +94 -93
  36. package/src/utilities/standard-libraries.ts +104 -71
  37. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @memberjunction/react-runtime@2.74.0 build
2
+ > @memberjunction/react-runtime@2.75.0 build
3
3
  > tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @memberjunction/react-runtime
2
2
 
3
+ ## 2.75.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9ccd145: migration
8
+
9
+ ### Patch Changes
10
+
11
+ - 0da7b51: tweaks to types
12
+ - Updated dependencies [b403003]
13
+ - @memberjunction/interactive-component-types@2.75.0
14
+ - @memberjunction/core@2.75.0
15
+ - @memberjunction/global@2.75.0
16
+
3
17
  ## 2.74.0
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -1,19 +1,21 @@
1
1
  # @memberjunction/react-runtime
2
2
 
3
- Platform-agnostic React component runtime for MemberJunction. This package provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.
3
+ Platform-agnostic React component runtime for MemberJunction. This package provides core compilation, registry, execution capabilities, and dynamic library management for React components in any JavaScript environment.
4
4
 
5
5
  ## Overview
6
6
 
7
- The React Runtime package enables dynamic compilation and execution of React components from source code. It works in both browser and Node.js environments, making it suitable for client-side rendering and server-side testing.
7
+ The React Runtime package enables dynamic compilation and execution of React components from source code, with flexible external library management. It works in both browser and Node.js environments, making it suitable for client-side rendering, server-side testing, and multi-tenant applications with different library requirements.
8
8
 
9
9
  ## Features
10
10
 
11
11
  - **Dynamic Compilation**: Transform JSX and React code at runtime using Babel
12
12
  - **Component Registry**: Manage compiled components with namespace support
13
13
  - **Dependency Resolution**: Handle component hierarchies and dependencies
14
+ - **Dynamic Library Management**: Configure and load external libraries at runtime
14
15
  - **Error Boundaries**: Comprehensive error handling for React components
15
16
  - **Platform Agnostic**: Works in any JavaScript environment
16
17
  - **Type Safe**: Full TypeScript support with strict typing
18
+ - **Organization-Specific Libraries**: Support for different library sets per organization
17
19
 
18
20
  ## Installation
19
21
 
@@ -66,6 +68,85 @@ if (result.success) {
66
68
  }
67
69
  ```
68
70
 
71
+ ## Dynamic Library Management (New)
72
+
73
+ ### Loading Libraries with Configuration
74
+
75
+ ```typescript
76
+ import { LibraryLoader, StandardLibraryManager } from '@memberjunction/react-runtime';
77
+
78
+ // Define custom library configuration
79
+ const libraryConfig = {
80
+ libraries: [
81
+ {
82
+ id: 'lodash',
83
+ name: 'lodash',
84
+ displayName: 'Lodash',
85
+ category: 'utility',
86
+ globalVariable: '_',
87
+ version: '4.17.21',
88
+ cdnUrl: 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js',
89
+ description: 'Utility library',
90
+ isEnabled: true,
91
+ isCore: false
92
+ },
93
+ {
94
+ id: 'chart-js',
95
+ name: 'Chart',
96
+ displayName: 'Chart.js',
97
+ category: 'charting',
98
+ globalVariable: 'Chart',
99
+ version: '4.4.0',
100
+ cdnUrl: 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.0/chart.umd.js',
101
+ isEnabled: true,
102
+ isCore: false
103
+ }
104
+ // ... more libraries
105
+ ],
106
+ metadata: {
107
+ version: '1.0.0',
108
+ lastUpdated: '2024-01-01'
109
+ }
110
+ };
111
+
112
+ // Load libraries with custom configuration
113
+ const result = await LibraryLoader.loadAllLibraries(libraryConfig);
114
+ ```
115
+
116
+ ### Managing Library Configurations
117
+
118
+ ```typescript
119
+ import { StandardLibraryManager } from '@memberjunction/react-runtime';
120
+
121
+ // Set a custom configuration
122
+ StandardLibraryManager.setConfiguration(libraryConfig);
123
+
124
+ // Get enabled libraries
125
+ const enabledLibs = StandardLibraryManager.getEnabledLibraries();
126
+
127
+ // Get libraries by category
128
+ const chartingLibs = StandardLibraryManager.getLibrariesByCategory('charting');
129
+ const uiLibs = StandardLibraryManager.getLibrariesByCategory('ui');
130
+
131
+ // Get component libraries (excludes runtime-only libraries)
132
+ const componentLibs = StandardLibraryManager.getComponentLibraries();
133
+
134
+ // Reset to default configuration
135
+ StandardLibraryManager.resetToDefault();
136
+ ```
137
+
138
+ ### Library Categories
139
+
140
+ Libraries are organized into categories:
141
+ - **`runtime`**: Core runtime libraries (React, ReactDOM, Babel) - not exposed to components
142
+ - **`ui`**: UI component libraries (Ant Design, React Bootstrap)
143
+ - **`charting`**: Data visualization libraries (Chart.js, D3.js)
144
+ - **`utility`**: Utility libraries (Lodash, Day.js)
145
+
146
+ ### Runtime-Only Libraries
147
+
148
+ Libraries marked with `isRuntimeOnly: true` are used by the runtime infrastructure but not exposed to generated components. This includes React, ReactDOM, and Babel.
149
+
69
150
  ### Using the Component
70
151
 
71
152
  ```typescript
@@ -73,8 +154,12 @@ if (result.success) {
73
154
  const React = window.React; // or require('react')
74
155
  const ReactDOM = window.ReactDOM; // or require('react-dom')
75
156
 
76
- // Create runtime context
77
- const context = { React, ReactDOM };
157
+ // Create runtime context with loaded libraries
158
+ const context = {
159
+ React,
160
+ ReactDOM,
161
+ libraries: result.libraries // From LibraryLoader
162
+ };
78
163
 
79
164
  // Get the compiled component
80
165
  const MyComponent = runtime.registry.get('MyComponent', 'MyNamespace');
@@ -198,18 +283,23 @@ const runtime = createReactRuntime(Babel, {
198
283
  - `ComponentProps` - Standard props passed to components
199
284
  - `ComponentCallbacks` - Callback functions available to components
200
285
  - `RegistryEntry` - Registry entry with metadata
286
+ - `LibraryConfiguration` - Configuration for external libraries
287
+ - `ExternalLibraryConfig` - Individual library configuration
201
288
 
202
289
  ### Classes
203
290
 
204
291
  - `ComponentCompiler` - Compiles React components from source
205
292
  - `ComponentRegistry` - Manages compiled components
206
293
  - `ComponentResolver` - Resolves component dependencies
294
+ - `StandardLibraryManager` - Manages library configurations
295
+ - `LibraryLoader` - Loads external libraries dynamically
207
296
 
208
297
  ### Utilities
209
298
 
210
299
  - `createErrorBoundary()` - Creates error boundary components
211
300
  - `buildComponentProps()` - Builds standardized component props
212
301
  - `wrapComponent()` - Wraps components with additional functionality
302
+ - `createStandardLibraries()` - Creates standard library object from globals
213
303
 
214
304
  ## Best Practices
215
305
 
@@ -218,6 +308,8 @@ const runtime = createReactRuntime(Babel, {
218
308
  3. **Handle Errors**: Always check compilation results for errors
219
309
  4. **Clean Up**: Use registry cleanup for long-running applications
220
310
  5. **Type Safety**: Leverage TypeScript types for better development experience
311
+ 6. **Library Management**: Configure only necessary libraries for security and performance
312
+ 7. **Runtime Separation**: Keep runtime libraries separate from component libraries
221
313
 
222
314
  ## License
223
315
 
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { buildComponentProps, cleanupPropBuilder, normalizeCallbacks, normalizeS
12
12
  export { ComponentHierarchyRegistrar, registerComponentHierarchy, validateComponentSpec, flattenComponentHierarchy, countComponentsInHierarchy, HierarchyRegistrationResult, ComponentRegistrationError, HierarchyRegistrationOptions } from './runtime';
13
13
  export { RuntimeUtilities, createRuntimeUtilities } from './utilities/runtime-utilities';
14
14
  export { SetupStyles, createDefaultComponentStyles } from './utilities/component-styles';
15
- export { STANDARD_LIBRARY_URLS, StandardLibraries, getCoreLibraryUrls, getUILibraryUrls, getCSSUrls, createStandardLibraries } from './utilities/standard-libraries';
15
+ export { StandardLibraries, StandardLibraryManager, createStandardLibraries } from './utilities/standard-libraries';
16
16
  export { LibraryLoader, LibraryLoadOptions, LibraryLoadResult } from './utilities/library-loader';
17
17
  export { ComponentErrorAnalyzer, FailedComponentInfo } from './utilities/component-error-analyzer';
18
18
  export declare const VERSION = "2.69.1";
@@ -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,O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,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,WAAW,EACX,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAG9C,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,7 @@ 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.getCSSUrls = exports.getUILibraryUrls = exports.getCoreLibraryUrls = exports.STANDARD_LIBRARY_URLS = 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.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.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;
18
18
  const compiler_1 = require("./compiler");
19
19
  const registry_1 = require("./registry");
20
20
  const registry_2 = require("./registry");
@@ -33,6 +33,7 @@ var registry_3 = require("./registry");
33
33
  Object.defineProperty(exports, "ComponentRegistry", { enumerable: true, get: function () { return registry_3.ComponentRegistry; } });
34
34
  var registry_4 = require("./registry");
35
35
  Object.defineProperty(exports, "ComponentResolver", { enumerable: true, get: function () { return registry_4.ComponentResolver; } });
36
+ Object.defineProperty(exports, "ComponentSpec", { enumerable: true, get: function () { return registry_4.ComponentSpec; } });
36
37
  var runtime_1 = require("./runtime");
37
38
  Object.defineProperty(exports, "createErrorBoundary", { enumerable: true, get: function () { return runtime_1.createErrorBoundary; } });
38
39
  Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return runtime_1.withErrorBoundary; } });
@@ -69,10 +70,7 @@ var component_styles_1 = require("./utilities/component-styles");
69
70
  Object.defineProperty(exports, "SetupStyles", { enumerable: true, get: function () { return component_styles_1.SetupStyles; } });
70
71
  Object.defineProperty(exports, "createDefaultComponentStyles", { enumerable: true, get: function () { return component_styles_1.createDefaultComponentStyles; } });
71
72
  var standard_libraries_1 = require("./utilities/standard-libraries");
72
- Object.defineProperty(exports, "STANDARD_LIBRARY_URLS", { enumerable: true, get: function () { return standard_libraries_1.STANDARD_LIBRARY_URLS; } });
73
- Object.defineProperty(exports, "getCoreLibraryUrls", { enumerable: true, get: function () { return standard_libraries_1.getCoreLibraryUrls; } });
74
- Object.defineProperty(exports, "getUILibraryUrls", { enumerable: true, get: function () { return standard_libraries_1.getUILibraryUrls; } });
75
- Object.defineProperty(exports, "getCSSUrls", { enumerable: true, get: function () { return standard_libraries_1.getCSSUrls; } });
73
+ Object.defineProperty(exports, "StandardLibraryManager", { enumerable: true, get: function () { return standard_libraries_1.StandardLibraryManager; } });
76
74
  Object.defineProperty(exports, "createStandardLibraries", { enumerable: true, get: function () { return standard_libraries_1.createStandardLibraries; } });
77
75
  var library_loader_1 = require("./utilities/library-loader");
78
76
  Object.defineProperty(exports, "LibraryLoader", { enumerable: true, get: function () { return library_loader_1.LibraryLoader; } });
@@ -1,10 +1,5 @@
1
1
  import { ComponentRegistry } from './component-registry';
2
- export interface ComponentSpec {
3
- componentName: string;
4
- componentCode?: string;
5
- childComponents?: ComponentSpec[];
6
- components?: ComponentSpec[];
7
- }
2
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
8
3
  export interface ResolvedComponents {
9
4
  [componentName: string]: any;
10
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"component-resolver.d.ts","sourceRoot":"","sources":["../../src/registry/component-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAKzD,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B;AAKD,MAAM,WAAW,kBAAkB;IACjC,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC;CAC9B;AAMD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAoB;gBAMxB,QAAQ,EAAE,iBAAiB;IAUvC,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,kBAAkB;IAgBxF,OAAO,CAAC,yBAAyB;IAgCjC,oBAAoB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,MAAM,EAAE;IAgBjF,OAAO,CAAC,iBAAiB;IA0BzB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAe9D,OAAO,CAAC,oBAAoB;IAwB5B,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;IAuB3C,OAAO,CAAC,kBAAkB;IAwB1B,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,KAAK,CAAC;QACvE,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,GAAG,CAAC;KAChB,CAAC;IAmBF,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE;IAe3D,OAAO,CAAC,qBAAqB;CAe9B"}
1
+ {"version":3,"file":"component-resolver.d.ts","sourceRoot":"","sources":["../../src/registry/component-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAK5E,MAAM,WAAW,kBAAkB;IACjC,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC;CAC9B;AAMD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAoB;gBAMxB,QAAQ,EAAE,iBAAiB;IAUvC,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,kBAAkB;IAgBxF,OAAO,CAAC,yBAAyB;IAgCjC,oBAAoB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,MAAM,EAAE;IAgBjF,OAAO,CAAC,iBAAiB;IA0BzB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAe9D,OAAO,CAAC,oBAAoB;IAwB5B,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE;IAuB3C,OAAO,CAAC,kBAAkB;IAwB1B,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAE,MAAiB,GAAG,KAAK,CAAC;QACvE,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,GAAG,CAAC;KAChB,CAAC;IAmBF,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE;IAe3D,OAAO,CAAC,qBAAqB;CAe9B"}
@@ -11,16 +11,16 @@ class ComponentResolver {
11
11
  return resolved;
12
12
  }
13
13
  resolveComponentHierarchy(spec, resolved, namespace, visited = new Set()) {
14
- if (visited.has(spec.componentName)) {
15
- console.warn(`Circular dependency detected for component: ${spec.componentName}`);
14
+ if (visited.has(spec.name)) {
15
+ console.warn(`Circular dependency detected for component: ${spec.name}`);
16
16
  return;
17
17
  }
18
- visited.add(spec.componentName);
19
- const component = this.registry.get(spec.componentName, namespace);
18
+ visited.add(spec.name);
19
+ const component = this.registry.get(spec.name, namespace);
20
20
  if (component) {
21
- resolved[spec.componentName] = component;
21
+ resolved[spec.name] = component;
22
22
  }
23
- const children = spec.childComponents || spec.components || [];
23
+ const children = spec.dependencies || [];
24
24
  for (const child of children) {
25
25
  this.resolveComponentHierarchy(child, resolved, namespace, visited);
26
26
  }
@@ -32,13 +32,13 @@ class ComponentResolver {
32
32
  return missing;
33
33
  }
34
34
  checkDependencies(spec, namespace, missing, checked) {
35
- if (checked.has(spec.componentName))
35
+ if (checked.has(spec.name))
36
36
  return;
37
- checked.add(spec.componentName);
38
- if (!this.registry.has(spec.componentName, namespace)) {
39
- missing.push(spec.componentName);
37
+ checked.add(spec.name);
38
+ if (!this.registry.has(spec.name, namespace)) {
39
+ missing.push(spec.name);
40
40
  }
41
- const children = spec.childComponents || spec.components || [];
41
+ const children = spec.dependencies || [];
42
42
  for (const child of children) {
43
43
  this.checkDependencies(child, namespace, missing, checked);
44
44
  }
@@ -50,12 +50,12 @@ class ComponentResolver {
50
50
  return graph;
51
51
  }
52
52
  buildDependencyGraph(spec, graph, visited) {
53
- if (visited.has(spec.componentName))
53
+ if (visited.has(spec.name))
54
54
  return;
55
- visited.add(spec.componentName);
56
- const children = spec.childComponents || spec.components || [];
57
- const dependencies = children.map(child => child.componentName);
58
- graph.set(spec.componentName, dependencies);
55
+ visited.add(spec.name);
56
+ const children = spec.dependencies || [];
57
+ const dependencies = children.map(child => child.name);
58
+ graph.set(spec.name, dependencies);
59
59
  for (const child of children) {
60
60
  this.buildDependencyGraph(child, graph, visited);
61
61
  }
@@ -99,11 +99,11 @@ class ComponentResolver {
99
99
  return flattened;
100
100
  }
101
101
  collectComponentSpecs(spec, collected, visited) {
102
- if (visited.has(spec.componentName))
102
+ if (visited.has(spec.name))
103
103
  return;
104
- visited.add(spec.componentName);
104
+ visited.add(spec.name);
105
105
  collected.push(spec);
106
- const children = spec.childComponents || spec.components || [];
106
+ const children = spec.dependencies || [];
107
107
  for (const child of children) {
108
108
  this.collectComponentSpecs(child, collected, visited);
109
109
  }
@@ -1,3 +1,4 @@
1
1
  export { ComponentRegistry } from './component-registry';
2
- export { ComponentResolver, ComponentSpec, ResolvedComponents } from './component-resolver';
2
+ export { ComponentResolver, ResolvedComponents } from './component-resolver';
3
+ export { ComponentSpec } from '@memberjunction/interactive-component-types';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC"}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentResolver = exports.ComponentRegistry = void 0;
3
+ exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = void 0;
4
4
  var component_registry_1 = require("./component-registry");
5
5
  Object.defineProperty(exports, "ComponentRegistry", { enumerable: true, get: function () { return component_registry_1.ComponentRegistry; } });
6
6
  var component_resolver_1 = require("./component-resolver");
7
7
  Object.defineProperty(exports, "ComponentResolver", { enumerable: true, get: function () { return component_resolver_1.ComponentResolver; } });
8
+ var interactive_component_types_1 = require("@memberjunction/interactive-component-types");
9
+ Object.defineProperty(exports, "ComponentSpec", { enumerable: true, get: function () { return interactive_component_types_1.ComponentSpec; } });
@@ -1,7 +1,7 @@
1
1
  import { ComponentStyles, RuntimeContext } from '../types';
2
2
  import { ComponentCompiler } from '../compiler';
3
3
  import { ComponentRegistry } from '../registry';
4
- import { ComponentSpec } from '../registry/component-resolver';
4
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
5
5
  export interface HierarchyRegistrationResult {
6
6
  success: boolean;
7
7
  registeredComponents: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"component-hierarchy.d.ts","sourceRoot":"","sources":["../../src/runtime/component-hierarchy.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,eAAe,EACf,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAK/D,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAKD,MAAM,WAAW,0BAA0B;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;CACtD;AAKD,MAAM,WAAW,4BAA4B;IAE3C,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,eAAe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QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,0BAA0B,CAAA;KAAE,CAAC;YA8EtD,uBAAuB;CAwCtC;AAWD,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,2BAA2B,CAAC,CAGtC;AAOD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE,CA2BnE;AAOD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,EAAE,CASlF;AAQD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,aAAa,EACvB,YAAY,GAAE,OAAe,GAC5B,MAAM,CAaR"}
@@ -14,7 +14,7 @@ class ComponentHierarchyRegistrar {
14
14
  const warnings = [];
15
15
  const rootResult = await this.registerSingleComponent(rootSpec, { styles, namespace, version, allowOverride });
16
16
  if (rootResult.success) {
17
- registeredComponents.push(rootSpec.componentName);
17
+ registeredComponents.push(rootSpec.name);
18
18
  }
19
19
  else {
20
20
  errors.push(rootResult.error);
@@ -22,7 +22,7 @@ class ComponentHierarchyRegistrar {
22
22
  return { success: false, registeredComponents, errors, warnings };
23
23
  }
24
24
  }
25
- const childComponents = rootSpec.childComponents || rootSpec.components || [];
25
+ const childComponents = rootSpec.dependencies || [];
26
26
  if (childComponents.length > 0) {
27
27
  const childResult = await this.registerChildComponents(childComponents, { styles, namespace, version, continueOnError, allowOverride }, registeredComponents, errors, warnings);
28
28
  }
@@ -36,26 +36,26 @@ class ComponentHierarchyRegistrar {
36
36
  async registerSingleComponent(spec, options) {
37
37
  const { styles, namespace = 'Global', version = 'v1', allowOverride = true } = options;
38
38
  try {
39
- if (!spec.componentCode) {
39
+ if (!spec.code) {
40
40
  return {
41
41
  success: true,
42
42
  error: undefined
43
43
  };
44
44
  }
45
- const existingComponent = this.registry.get(spec.componentName, namespace, version);
45
+ const existingComponent = this.registry.get(spec.name, namespace, version);
46
46
  if (existingComponent && !allowOverride) {
47
47
  return {
48
48
  success: false,
49
49
  error: {
50
- componentName: spec.componentName,
50
+ componentName: spec.name,
51
51
  error: `Component already registered in ${namespace}/${version}`,
52
52
  phase: 'registration'
53
53
  }
54
54
  };
55
55
  }
56
56
  const compileOptions = {
57
- componentName: spec.componentName,
58
- componentCode: spec.componentCode,
57
+ componentName: spec.name,
58
+ componentCode: spec.code,
59
59
  styles
60
60
  };
61
61
  const compilationResult = await this.compiler.compile(compileOptions);
@@ -63,21 +63,21 @@ class ComponentHierarchyRegistrar {
63
63
  return {
64
64
  success: false,
65
65
  error: {
66
- componentName: spec.componentName,
66
+ componentName: spec.name,
67
67
  error: compilationResult.error?.message || 'Unknown compilation error',
68
68
  phase: 'compilation'
69
69
  }
70
70
  };
71
71
  }
72
72
  const componentFactory = compilationResult.component.component(this.runtimeContext, styles);
73
- this.registry.register(spec.componentName, componentFactory.component, namespace, version);
73
+ this.registry.register(spec.name, componentFactory.component, namespace, version);
74
74
  return { success: true };
75
75
  }
76
76
  catch (error) {
77
77
  return {
78
78
  success: false,
79
79
  error: {
80
- componentName: spec.componentName,
80
+ componentName: spec.name,
81
81
  error: error instanceof Error ? error.message : String(error),
82
82
  phase: 'registration'
83
83
  }
@@ -93,8 +93,8 @@ class ComponentHierarchyRegistrar {
93
93
  allowOverride: options.allowOverride
94
94
  });
95
95
  if (childResult.success) {
96
- if (child.componentCode) {
97
- registeredComponents.push(child.componentName);
96
+ if (child.code) {
97
+ registeredComponents.push(child.name);
98
98
  }
99
99
  }
100
100
  else {
@@ -103,7 +103,7 @@ class ComponentHierarchyRegistrar {
103
103
  return;
104
104
  }
105
105
  }
106
- const nestedChildren = child.childComponents || child.components || [];
106
+ const nestedChildren = child.dependencies || [];
107
107
  if (nestedChildren.length > 0) {
108
108
  await this.registerChildComponents(nestedChildren, options, registeredComponents, errors, warnings);
109
109
  }
@@ -118,22 +118,22 @@ async function registerComponentHierarchy(rootSpec, compiler, registry, runtimeC
118
118
  exports.registerComponentHierarchy = registerComponentHierarchy;
119
119
  function validateComponentSpec(spec) {
120
120
  const errors = [];
121
- if (!spec.componentName) {
122
- errors.push('Component specification must have a componentName');
121
+ if (!spec.name) {
122
+ errors.push('Component specification must have a name');
123
123
  }
124
- if (spec.componentCode) {
125
- if (typeof spec.componentCode !== 'string') {
126
- errors.push(`Component code for ${spec.componentName} must be a string`);
124
+ if (spec.code) {
125
+ if (typeof spec.code !== 'string') {
126
+ errors.push(`Component code for ${spec.name} must be a string`);
127
127
  }
128
- if (spec.componentCode.trim().length === 0) {
129
- errors.push(`Component code for ${spec.componentName} cannot be empty`);
128
+ if (spec.code.trim().length === 0) {
129
+ errors.push(`Component code for ${spec.name} cannot be empty`);
130
130
  }
131
131
  }
132
- const children = spec.childComponents || spec.components || [];
132
+ const children = spec.dependencies || [];
133
133
  children.forEach((child, index) => {
134
134
  const childErrors = validateComponentSpec(child);
135
135
  childErrors.forEach(error => {
136
- errors.push(`Child ${index} (${child.componentName || 'unnamed'}): ${error}`);
136
+ errors.push(`Child ${index} (${child.name || 'unnamed'}): ${error}`);
137
137
  });
138
138
  });
139
139
  return errors;
@@ -141,7 +141,7 @@ function validateComponentSpec(spec) {
141
141
  exports.validateComponentSpec = validateComponentSpec;
142
142
  function flattenComponentHierarchy(rootSpec) {
143
143
  const components = [rootSpec];
144
- const children = rootSpec.childComponents || rootSpec.components || [];
144
+ const children = rootSpec.dependencies || [];
145
145
  children.forEach(child => {
146
146
  components.push(...flattenComponentHierarchy(child));
147
147
  });
@@ -150,10 +150,10 @@ function flattenComponentHierarchy(rootSpec) {
150
150
  exports.flattenComponentHierarchy = flattenComponentHierarchy;
151
151
  function countComponentsInHierarchy(rootSpec, includeEmpty = false) {
152
152
  let count = 0;
153
- if (includeEmpty || rootSpec.componentCode) {
153
+ if (includeEmpty || rootSpec.code) {
154
154
  count = 1;
155
155
  }
156
- const children = rootSpec.childComponents || rootSpec.components || [];
156
+ const children = rootSpec.dependencies || [];
157
157
  children.forEach(child => {
158
158
  count += countComponentsInHierarchy(child, includeEmpty);
159
159
  });
@@ -95,4 +95,5 @@ export interface ErrorBoundaryOptions {
95
95
  logErrors?: boolean;
96
96
  recovery?: 'retry' | 'reset' | 'none';
97
97
  }
98
+ export * from './library-config';
98
99
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,GAAG,CAAC;IAEf,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,EAAE,IAAI,CAAC;IAEjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAKD,MAAM,WAAW,cAAc;IAE7B,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IAEtB,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD,MAAM,WAAW,eAAe;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD,MAAM,WAAW,aAAa;IAE5B,SAAS,EAAE,GAAG,CAAC;IAEf,QAAQ,EAAE,iBAAiB,CAAC;IAE5B,YAAY,EAAE,IAAI,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD,MAAM,WAAW,iBAAiB;IAEhC,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;I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,MAAM,CAAC;CACf;AAKD,MAAM,WAAW,cAAc;IAE7B,KAAK,EAAE,GAAG,CAAC;IAEX,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEhC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAKD,MAAM,WAAW,kBAAkB;IAEjC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAEzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAExB,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IAExD,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,KAAK,IAAI,CAAC;IAE1D,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAKD,MAAM,WAAW,oBAAoB;IAEnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IAEjD,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;CACvC;AAGD,cAAc,kBAAkB,CAAC"}
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./library-config"), exports);
@@ -0,0 +1,32 @@
1
+ export interface ExternalLibraryConfig {
2
+ id: string;
3
+ name: string;
4
+ displayName: string;
5
+ category: 'core' | 'runtime' | 'ui' | 'charting' | 'utility';
6
+ globalVariable: string;
7
+ version: string;
8
+ cdnUrl: string;
9
+ cdnCssUrl?: string;
10
+ description: string;
11
+ aiInstructions?: string;
12
+ exampleUsage?: string;
13
+ isEnabled: boolean;
14
+ isCore: boolean;
15
+ isRuntimeOnly?: boolean;
16
+ }
17
+ export interface LibraryConfigurationMetadata {
18
+ version: string;
19
+ lastUpdated: string;
20
+ description?: string;
21
+ }
22
+ export interface LibraryConfiguration {
23
+ libraries: ExternalLibraryConfig[];
24
+ metadata: LibraryConfigurationMetadata;
25
+ }
26
+ export interface LibraryLoadOptions {
27
+ skipIfLoaded?: boolean;
28
+ timeout?: number;
29
+ categories?: Array<ExternalLibraryConfig['category']>;
30
+ excludeRuntimeOnly?: boolean;
31
+ }
32
+ //# sourceMappingURL=library-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library-config.d.ts","sourceRoot":"","sources":["../../src/types/library-config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IAEpC,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,WAAW,EAAE,MAAM,CAAC;IAGpB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,CAAC;IAG7D,cAAc,EAAE,MAAM,CAAC;IAGvB,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,WAAW,EAAE,MAAM,CAAC;IAGpB,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,OAAO,CAAC;IAGnB,MAAM,EAAE,OAAO,CAAC;IAGhB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAKD,MAAM,WAAW,kBAAkB;IAEjC,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,UAAU,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IAGtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  import { StandardLibraries } from './standard-libraries';
2
+ import { LibraryConfiguration, LibraryLoadOptions as ConfigLoadOptions } from '../types/library-config';
2
3
  interface LoadedResource {
3
4
  element: HTMLScriptElement | HTMLLinkElement;
4
5
  promise: Promise<any>;
@@ -20,12 +21,12 @@ export interface LibraryLoadResult {
20
21
  }
21
22
  export declare class LibraryLoader {
22
23
  private static loadedResources;
23
- static loadAllLibraries(): Promise<LibraryLoadResult>;
24
+ static loadAllLibraries(config?: LibraryConfiguration): Promise<LibraryLoadResult>;
25
+ static loadLibrariesFromConfig(options?: ConfigLoadOptions): Promise<LibraryLoadResult>;
24
26
  static loadLibraries(options: LibraryLoadOptions): Promise<LibraryLoadResult>;
25
27
  private static loadScript;
26
28
  private static loadCSS;
27
29
  private static waitForScriptLoad;
28
- private static getLibraryNameFromUrl;
29
30
  static getLoadedResources(): Map<string, LoadedResource>;
30
31
  static clearCache(): void;
31
32
  }