Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 1x 1x 4x 4x 4x 4x 4x 4x 4x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /** * Coherent.js Universal Runtime * Complete standalone runtime that works in any JavaScript environment */ // Re-export everything from core packages export * from '@coherentjs/core'; export * from '@coherentjs/client'; export * from '@coherentjs/web-components'; // Universal runtime components export { BrowserRuntime } from './runtimes/browser.js'; export { EdgeRuntime } from './runtimes/edge.js'; export { StaticRuntime } from './runtimes/static.js'; export { DesktopRuntime } from './runtimes/desktop.js'; // Module loaders export { UniversalLoader } from './loaders/universal-loader.js'; export { ComponentLoader } from './loaders/component-loader.js'; // Main runtime factory export { createRuntime, detectRuntime, RuntimeEnvironment } from './runtime-factory.js'; import { createRuntime, detectRuntime } from './runtime-factory.js'; // Utilities export { RuntimeDetector } from './utils/runtime-detector.js'; export { ModuleResolver } from './utils/module-resolver.js'; export { AssetManager } from './utils/asset-manager.js'; // Main universal entry point export async function createCoherentApp(options = {}) { const runtime = await createRuntime(options); return runtime.createApp(options); } // Simple standalone rendering for quick start export function renderApp(component, props = {}, target = null) { const runtime = detectRuntime(); // If runtime is an object with renderApp method (mocked in tests), use it if (typeof runtime === 'object' && runtime.renderApp) { return runtime.renderApp(component, props, target); } // Otherwise detectRuntime returns a string, so we'd need to create a runtime // This is a simplified version for the actual use case throw new Error('renderApp requires a proper runtime implementation'); } // Global initialization for script tag usage if (typeof window !== 'undefined') { window.Coherent = { // Core functionality renderToString: async (obj) => { const { renderToString } = await import('@coherentjs/core'); return renderToString(obj); }, // Hydration hydrate: async (element, component, props) => { const { hydrate } = await import('@coherentjs/client'); return hydrate(element, component, props); }, // Web Components defineComponent: async (name, component, options) => { const { defineComponent } = await import('@coherentjs/web-components'); return defineComponent(name, component, options); }, // Universal app creation createApp: createCoherentApp, renderApp, // Version info VERSION: '1.1.1' }; // Auto-initialize if data-coherent-auto is present if (document.querySelector('[data-coherent-auto]')) { document.addEventListener('DOMContentLoaded', async () => { const { autoHydrate } = await import('@coherentjs/client'); autoHydrate(window.componentRegistry || {}); }); } } export const VERSION = '1.1.1'; |