@frontmcp/ui 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bridge/core/bridge-factory.d.ts +1 -0
- package/bridge/core/bridge-factory.d.ts.map +1 -1
- package/bridge/index.d.ts +1 -1
- package/bridge/index.d.ts.map +1 -1
- package/bridge/index.js +39 -881
- package/bundler/browser-components.d.ts +42 -0
- package/bundler/browser-components.d.ts.map +1 -0
- package/bundler/bundler.d.ts +78 -4
- package/bundler/bundler.d.ts.map +1 -1
- package/bundler/index.d.ts +8 -8
- package/bundler/index.d.ts.map +1 -1
- package/bundler/index.js +1315 -1854
- package/bundler/types.d.ts +188 -7
- package/bundler/types.d.ts.map +1 -1
- package/esm/bridge/{index.js → index.mjs} +40 -877
- package/esm/bundler/{index.js → index.mjs} +1391 -1895
- package/esm/{index.js → index.mjs} +215 -3091
- package/esm/layouts/{index.js → index.mjs} +3 -3
- package/esm/package.json +9 -8
- package/esm/react/index.mjs +1183 -0
- package/esm/renderers/index.mjs +611 -0
- package/esm/universal/{index.js → index.mjs} +266 -70
- package/index.d.ts +1 -4
- package/index.d.ts.map +1 -1
- package/index.js +208 -3113
- package/layouts/base.d.ts.map +1 -1
- package/layouts/index.js +3 -3
- package/layouts/presets.d.ts.map +1 -1
- package/package.json +9 -8
- package/react/Badge.d.ts.map +1 -1
- package/react/hooks/context.d.ts.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +57 -2001
- package/react/types.d.ts.map +1 -1
- package/renderers/index.d.ts +9 -4
- package/renderers/index.d.ts.map +1 -1
- package/renderers/index.js +328 -88
- package/renderers/mdx.renderer.d.ts +99 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/react.renderer.d.ts +22 -13
- package/renderers/react.renderer.d.ts.map +1 -1
- package/renderers/transpiler.d.ts +49 -0
- package/renderers/transpiler.d.ts.map +1 -0
- package/universal/cached-runtime.d.ts +25 -1
- package/universal/cached-runtime.d.ts.map +1 -1
- package/universal/index.js +266 -70
- package/universal/runtime-builder.d.ts.map +1 -1
- package/universal/types.d.ts.map +1 -1
- package/web-components/elements/fmcp-input.d.ts.map +1 -1
- package/web-components/elements/fmcp-select.d.ts.map +1 -1
- package/web-components/index.d.ts +0 -1
- package/web-components/index.d.ts.map +1 -1
- package/bundler/cache.d.ts +0 -173
- package/bundler/cache.d.ts.map +0 -1
- package/bundler/file-cache/component-builder.d.ts +0 -167
- package/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/bundler/file-cache/index.d.ts +0 -12
- package/bundler/file-cache/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/bundler/file-cache/storage/index.d.ts +0 -11
- package/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/interface.d.ts +0 -152
- package/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/bundler/file-cache/storage/redis.d.ts +0 -139
- package/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/bundler/sandbox/executor.d.ts +0 -14
- package/bundler/sandbox/executor.d.ts.map +0 -1
- package/bundler/sandbox/policy.d.ts +0 -62
- package/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bridge/adapters/base-adapter.d.ts +0 -104
- package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
- package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
- package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
- package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
- package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/index.d.ts +0 -26
- package/esm/bridge/adapters/index.d.ts.map +0 -1
- package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
- package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
- package/esm/bridge/core/adapter-registry.d.ts +0 -122
- package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
- package/esm/bridge/core/bridge-factory.d.ts +0 -199
- package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
- package/esm/bridge/core/index.d.ts +0 -10
- package/esm/bridge/core/index.d.ts.map +0 -1
- package/esm/bridge/index.d.ts +0 -62
- package/esm/bridge/index.d.ts.map +0 -1
- package/esm/bridge/runtime/iife-generator.d.ts +0 -62
- package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
- package/esm/bridge/runtime/index.d.ts +0 -10
- package/esm/bridge/runtime/index.d.ts.map +0 -1
- package/esm/bridge/types.d.ts +0 -386
- package/esm/bridge/types.d.ts.map +0 -1
- package/esm/bundler/bundler.d.ts +0 -208
- package/esm/bundler/bundler.d.ts.map +0 -1
- package/esm/bundler/cache.d.ts +0 -173
- package/esm/bundler/cache.d.ts.map +0 -1
- package/esm/bundler/file-cache/component-builder.d.ts +0 -167
- package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/esm/bundler/file-cache/index.d.ts +0 -12
- package/esm/bundler/file-cache/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/index.d.ts +0 -11
- package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
- package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
- package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/esm/bundler/index.d.ts +0 -43
- package/esm/bundler/index.d.ts.map +0 -1
- package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/esm/bundler/sandbox/executor.d.ts +0 -14
- package/esm/bundler/sandbox/executor.d.ts.map +0 -1
- package/esm/bundler/sandbox/policy.d.ts +0 -62
- package/esm/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bundler/types.d.ts +0 -702
- package/esm/bundler/types.d.ts.map +0 -1
- package/esm/components/alert.d.ts +0 -66
- package/esm/components/alert.d.ts.map +0 -1
- package/esm/components/alert.schema.d.ts +0 -98
- package/esm/components/alert.schema.d.ts.map +0 -1
- package/esm/components/avatar.d.ts +0 -77
- package/esm/components/avatar.d.ts.map +0 -1
- package/esm/components/avatar.schema.d.ts +0 -170
- package/esm/components/avatar.schema.d.ts.map +0 -1
- package/esm/components/badge.d.ts +0 -64
- package/esm/components/badge.d.ts.map +0 -1
- package/esm/components/badge.schema.d.ts +0 -91
- package/esm/components/badge.schema.d.ts.map +0 -1
- package/esm/components/button.d.ts +0 -100
- package/esm/components/button.d.ts.map +0 -1
- package/esm/components/button.schema.d.ts +0 -120
- package/esm/components/button.schema.d.ts.map +0 -1
- package/esm/components/card.d.ts +0 -53
- package/esm/components/card.d.ts.map +0 -1
- package/esm/components/card.schema.d.ts +0 -93
- package/esm/components/card.schema.d.ts.map +0 -1
- package/esm/components/form.d.ts +0 -212
- package/esm/components/form.d.ts.map +0 -1
- package/esm/components/form.schema.d.ts +0 -365
- package/esm/components/form.schema.d.ts.map +0 -1
- package/esm/components/index.d.ts +0 -29
- package/esm/components/index.d.ts.map +0 -1
- package/esm/components/list.d.ts +0 -121
- package/esm/components/list.d.ts.map +0 -1
- package/esm/components/list.schema.d.ts +0 -129
- package/esm/components/list.schema.d.ts.map +0 -1
- package/esm/components/modal.d.ts +0 -100
- package/esm/components/modal.d.ts.map +0 -1
- package/esm/components/modal.schema.d.ts +0 -151
- package/esm/components/modal.schema.d.ts.map +0 -1
- package/esm/components/table.d.ts +0 -91
- package/esm/components/table.d.ts.map +0 -1
- package/esm/components/table.schema.d.ts +0 -123
- package/esm/components/table.schema.d.ts.map +0 -1
- package/esm/index.d.ts +0 -40
- package/esm/index.d.ts.map +0 -1
- package/esm/layouts/base.d.ts +0 -86
- package/esm/layouts/base.d.ts.map +0 -1
- package/esm/layouts/index.d.ts +0 -8
- package/esm/layouts/index.d.ts.map +0 -1
- package/esm/layouts/presets.d.ts +0 -134
- package/esm/layouts/presets.d.ts.map +0 -1
- package/esm/pages/consent.d.ts +0 -117
- package/esm/pages/consent.d.ts.map +0 -1
- package/esm/pages/error.d.ts +0 -101
- package/esm/pages/error.d.ts.map +0 -1
- package/esm/pages/index.d.ts +0 -9
- package/esm/pages/index.d.ts.map +0 -1
- package/esm/pages/index.js +0 -1036
- package/esm/react/Alert.d.ts +0 -101
- package/esm/react/Alert.d.ts.map +0 -1
- package/esm/react/Badge.d.ts +0 -100
- package/esm/react/Badge.d.ts.map +0 -1
- package/esm/react/Button.d.ts +0 -108
- package/esm/react/Button.d.ts.map +0 -1
- package/esm/react/Card.d.ts +0 -103
- package/esm/react/Card.d.ts.map +0 -1
- package/esm/react/hooks/context.d.ts +0 -179
- package/esm/react/hooks/context.d.ts.map +0 -1
- package/esm/react/hooks/index.d.ts +0 -42
- package/esm/react/hooks/index.d.ts.map +0 -1
- package/esm/react/hooks/tools.d.ts +0 -284
- package/esm/react/hooks/tools.d.ts.map +0 -1
- package/esm/react/index.d.ts +0 -80
- package/esm/react/index.d.ts.map +0 -1
- package/esm/react/index.js +0 -3124
- package/esm/react/types.d.ts +0 -105
- package/esm/react/types.d.ts.map +0 -1
- package/esm/react/utils.d.ts +0 -43
- package/esm/react/utils.d.ts.map +0 -1
- package/esm/render/index.d.ts +0 -8
- package/esm/render/index.d.ts.map +0 -1
- package/esm/render/prerender.d.ts +0 -57
- package/esm/render/prerender.d.ts.map +0 -1
- package/esm/renderers/index.d.ts +0 -21
- package/esm/renderers/index.d.ts.map +0 -1
- package/esm/renderers/index.js +0 -381
- package/esm/renderers/react.adapter.d.ts +0 -70
- package/esm/renderers/react.adapter.d.ts.map +0 -1
- package/esm/renderers/react.renderer.d.ts +0 -96
- package/esm/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/UniversalApp.d.ts +0 -108
- package/esm/universal/UniversalApp.d.ts.map +0 -1
- package/esm/universal/cached-runtime.d.ts +0 -115
- package/esm/universal/cached-runtime.d.ts.map +0 -1
- package/esm/universal/context.d.ts +0 -122
- package/esm/universal/context.d.ts.map +0 -1
- package/esm/universal/index.d.ts +0 -57
- package/esm/universal/index.d.ts.map +0 -1
- package/esm/universal/renderers/html.renderer.d.ts +0 -37
- package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/index.d.ts +0 -112
- package/esm/universal/renderers/index.d.ts.map +0 -1
- package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
- package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
- package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/react.renderer.d.ts +0 -46
- package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/runtime-builder.d.ts +0 -33
- package/esm/universal/runtime-builder.d.ts.map +0 -1
- package/esm/universal/store.d.ts +0 -135
- package/esm/universal/store.d.ts.map +0 -1
- package/esm/universal/types.d.ts +0 -199
- package/esm/universal/types.d.ts.map +0 -1
- package/esm/web-components/core/attribute-parser.d.ts +0 -82
- package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
- package/esm/web-components/core/base-element.d.ts +0 -197
- package/esm/web-components/core/base-element.d.ts.map +0 -1
- package/esm/web-components/core/index.d.ts +0 -9
- package/esm/web-components/core/index.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
- package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
- package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-button.d.ts +0 -117
- package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-card.d.ts +0 -53
- package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-input.d.ts +0 -96
- package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-select.d.ts +0 -100
- package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
- package/esm/web-components/elements/index.d.ts +0 -13
- package/esm/web-components/elements/index.d.ts.map +0 -1
- package/esm/web-components/index.d.ts +0 -50
- package/esm/web-components/index.d.ts.map +0 -1
- package/esm/web-components/register.d.ts +0 -57
- package/esm/web-components/register.d.ts.map +0 -1
- package/esm/web-components/types.d.ts +0 -122
- package/esm/web-components/types.d.ts.map +0 -1
- package/esm/widgets/index.d.ts +0 -8
- package/esm/widgets/index.d.ts.map +0 -1
- package/esm/widgets/index.js +0 -883
- package/esm/widgets/progress.d.ts +0 -133
- package/esm/widgets/progress.d.ts.map +0 -1
- package/esm/widgets/resource.d.ts +0 -163
- package/esm/widgets/resource.d.ts.map +0 -1
- package/pages/consent.d.ts +0 -117
- package/pages/consent.d.ts.map +0 -1
- package/pages/error.d.ts +0 -101
- package/pages/error.d.ts.map +0 -1
- package/pages/index.d.ts +0 -9
- package/pages/index.d.ts.map +0 -1
- package/pages/index.js +0 -1065
- package/react/utils.d.ts +0 -43
- package/react/utils.d.ts.map +0 -1
- package/widgets/index.d.ts +0 -8
- package/widgets/index.d.ts.map +0 -1
- package/widgets/index.js +0 -910
- package/widgets/progress.d.ts +0 -133
- package/widgets/progress.d.ts.map +0 -1
- package/widgets/resource.d.ts +0 -163
- package/widgets/resource.d.ts.map +0 -1
- /package/esm/components/{index.js → index.mjs} +0 -0
- /package/esm/render/{index.js → index.mjs} +0 -0
- /package/esm/web-components/{index.js → index.mjs} +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Renderer Registry
|
|
3
|
-
*
|
|
4
|
-
* Central registry for client-side renderers with auto-detection.
|
|
5
|
-
* Manages registration and selection of renderers based on content type.
|
|
6
|
-
*/
|
|
7
|
-
import type { ClientRenderer, UniversalContent, RenderContext, ContentType } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* Client-side renderer registry.
|
|
10
|
-
*
|
|
11
|
-
* Manages renderers and provides auto-detection based on content type.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const registry = new RendererRegistry();
|
|
16
|
-
*
|
|
17
|
-
* // Auto-detect and get renderer
|
|
18
|
-
* const renderer = registry.detect({ type: 'markdown', source: '# Hello' });
|
|
19
|
-
*
|
|
20
|
-
* // Register custom renderer
|
|
21
|
-
* registry.register(myCustomRenderer);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare class RendererRegistry {
|
|
25
|
-
private renderers;
|
|
26
|
-
private sortedRenderers;
|
|
27
|
-
constructor();
|
|
28
|
-
/**
|
|
29
|
-
* Register a renderer.
|
|
30
|
-
* Renderers are sorted by priority (highest first) for auto-detection.
|
|
31
|
-
*/
|
|
32
|
-
register(renderer: ClientRenderer): void;
|
|
33
|
-
/**
|
|
34
|
-
* Unregister a renderer by type.
|
|
35
|
-
*/
|
|
36
|
-
unregister(type: ContentType): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Get a renderer by type.
|
|
39
|
-
*/
|
|
40
|
-
get(type: ContentType): ClientRenderer | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Check if a renderer type is registered.
|
|
43
|
-
*/
|
|
44
|
-
has(type: ContentType): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Get all registered renderer types.
|
|
47
|
-
*/
|
|
48
|
-
getTypes(): ContentType[];
|
|
49
|
-
/**
|
|
50
|
-
* Auto-detect the best renderer for content.
|
|
51
|
-
*
|
|
52
|
-
* Checks renderers in priority order (highest first).
|
|
53
|
-
* Falls back to HTML renderer if no match.
|
|
54
|
-
*/
|
|
55
|
-
detect(content: UniversalContent): ClientRenderer;
|
|
56
|
-
/**
|
|
57
|
-
* Render content using auto-detection.
|
|
58
|
-
*/
|
|
59
|
-
render(content: UniversalContent, context: RenderContext): React.ReactNode;
|
|
60
|
-
/**
|
|
61
|
-
* Render with a specific renderer type.
|
|
62
|
-
*/
|
|
63
|
-
renderWith(type: ContentType, content: UniversalContent, context: RenderContext): React.ReactNode;
|
|
64
|
-
/**
|
|
65
|
-
* Get registry statistics.
|
|
66
|
-
*/
|
|
67
|
-
getStats(): {
|
|
68
|
-
registeredTypes: ContentType[];
|
|
69
|
-
priorityOrder: Array<{
|
|
70
|
-
type: ContentType;
|
|
71
|
-
priority: number;
|
|
72
|
-
}>;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Update the sorted renderer list by priority.
|
|
76
|
-
*/
|
|
77
|
-
private updateSortedList;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Global renderer registry instance.
|
|
81
|
-
*
|
|
82
|
-
* Pre-configured with HTML, Markdown, React, and MDX renderers.
|
|
83
|
-
*/
|
|
84
|
-
export declare const rendererRegistry: RendererRegistry;
|
|
85
|
-
/**
|
|
86
|
-
* Detect the best renderer for content.
|
|
87
|
-
*
|
|
88
|
-
* @param content - Content to analyze
|
|
89
|
-
* @returns Best matching renderer
|
|
90
|
-
*/
|
|
91
|
-
export declare function detectRenderer(content: UniversalContent): ClientRenderer;
|
|
92
|
-
/**
|
|
93
|
-
* Render content with auto-detection.
|
|
94
|
-
*
|
|
95
|
-
* @param content - Content to render
|
|
96
|
-
* @param context - Render context
|
|
97
|
-
* @returns Rendered React node
|
|
98
|
-
*/
|
|
99
|
-
export declare function renderContent(content: UniversalContent, context: RenderContext): React.ReactNode;
|
|
100
|
-
/**
|
|
101
|
-
* Create content object from source with auto-detected type.
|
|
102
|
-
*
|
|
103
|
-
* @param source - Content source (string or component)
|
|
104
|
-
* @param options - Additional options
|
|
105
|
-
* @returns Content object
|
|
106
|
-
*/
|
|
107
|
-
export declare function createContent(source: UniversalContent['source'], options?: Partial<Omit<UniversalContent, 'source'>>): UniversalContent;
|
|
108
|
-
export { htmlRenderer, safeHtmlRenderer } from './html.renderer';
|
|
109
|
-
export { markdownRenderer, createMarkdownRenderer } from './markdown.renderer';
|
|
110
|
-
export { reactRenderer, isReactComponent } from './react.renderer';
|
|
111
|
-
export { mdxRenderer, isMdxSupported, createMdxRenderer } from './mdx.renderer';
|
|
112
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/universal/renderers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAW7F;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,eAAe,CAAwB;;IAU/C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKxC;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO;IAQtC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS;IAIlD;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO;IAI/B;;OAEG;IACH,QAAQ,IAAI,WAAW,EAAE;IAIzB;;;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
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Markdown Renderer
|
|
3
|
-
*
|
|
4
|
-
* Renders Markdown content using react-markdown.
|
|
5
|
-
* Supports custom components for enhanced rendering.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import type { ClientRenderer } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* Markdown renderer implementation.
|
|
11
|
-
*
|
|
12
|
-
* Uses react-markdown when available, falls back to minimal inline parser.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const content: UniversalContent = {
|
|
17
|
-
* type: 'markdown',
|
|
18
|
-
* source: '# Hello\n\nThis is **bold** text.',
|
|
19
|
-
* components: { a: CustomLink },
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* // Renders: <h1>Hello</h1><p>This is <strong>bold</strong> text.</p>
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const markdownRenderer: ClientRenderer;
|
|
26
|
-
/**
|
|
27
|
-
* Create a markdown renderer with custom default components.
|
|
28
|
-
*
|
|
29
|
-
* @param defaultComponents - Default components to use
|
|
30
|
-
* @returns Configured markdown renderer
|
|
31
|
-
*/
|
|
32
|
-
export declare function createMarkdownRenderer(defaultComponents: Record<string, React.ComponentType<any>>): ClientRenderer;
|
|
33
|
-
//# sourceMappingURL=markdown.renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.renderer.d.ts","sourceRoot":"","sources":["../../../../src/universal/renderers/markdown.renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,UAAU,CAAC;AAqGhF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,EAAE,cA2D9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAEpC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAC1D,cAAc,CAgBhB"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MDX Renderer
|
|
3
|
-
*
|
|
4
|
-
* Renders MDX content (Markdown + JSX) using @mdx-js/react.
|
|
5
|
-
* Supports custom components for enhanced rendering.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import type { ClientRenderer } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* MDX renderer implementation.
|
|
11
|
-
*
|
|
12
|
-
* Uses @mdx-js/react when available. Falls back to warning when MDX
|
|
13
|
-
* cannot be rendered (e.g., on Claude which only supports cdnjs).
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* const content: UniversalContent = {
|
|
18
|
-
* type: 'mdx',
|
|
19
|
-
* source: '# Hello\n\n<WeatherCard temp={72} />',
|
|
20
|
-
* components: { WeatherCard },
|
|
21
|
-
* };
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare const mdxRenderer: ClientRenderer;
|
|
25
|
-
/**
|
|
26
|
-
* Check if MDX rendering is supported on the current platform.
|
|
27
|
-
*
|
|
28
|
-
* @returns True if MDX can be rendered
|
|
29
|
-
*/
|
|
30
|
-
export declare function isMdxSupported(): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Create an MDX renderer with pre-configured components.
|
|
33
|
-
*
|
|
34
|
-
* @param defaultComponents - Default components for MDX
|
|
35
|
-
* @returns Configured MDX renderer
|
|
36
|
-
*/
|
|
37
|
-
export declare function createMdxRenderer(defaultComponents: Record<string, React.ComponentType<any>>): ClientRenderer;
|
|
38
|
-
//# sourceMappingURL=mdx.renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.renderer.d.ts","sourceRoot":"","sources":["../../../../src/universal/renderers/mdx.renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,UAAU,CAAC;AA4ChF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,EAAE,cA+FzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAE/B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAC1D,cAAc,CAehB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Renderer
|
|
3
|
-
*
|
|
4
|
-
* Renders React components directly.
|
|
5
|
-
* Used for pre-compiled or imported React components.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import type { ClientRenderer } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* React renderer implementation.
|
|
11
|
-
*
|
|
12
|
-
* Renders React components by creating elements with the provided props.
|
|
13
|
-
* This is the highest priority renderer when a function is provided.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* const WeatherCard = ({ output }) => (
|
|
18
|
-
* <div className="card">{output.temperature}°F</div>
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* const content: UniversalContent = {
|
|
22
|
-
* type: 'react',
|
|
23
|
-
* source: WeatherCard,
|
|
24
|
-
* props: { output: { temperature: 72 } },
|
|
25
|
-
* };
|
|
26
|
-
*
|
|
27
|
-
* // Renders: <div class="card">72°F</div>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare const reactRenderer: ClientRenderer;
|
|
31
|
-
/**
|
|
32
|
-
* Check if a value is a React component.
|
|
33
|
-
*
|
|
34
|
-
* @param value - Value to check
|
|
35
|
-
* @returns True if the value is a React component
|
|
36
|
-
*/
|
|
37
|
-
export declare function isReactComponent(value: unknown): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Wrap a component with error boundary behavior.
|
|
40
|
-
*
|
|
41
|
-
* @param Component - Component to wrap
|
|
42
|
-
* @param fallback - Fallback to render on error
|
|
43
|
-
* @returns Wrapped component
|
|
44
|
-
*/
|
|
45
|
-
export declare function withErrorBoundary(Component: React.ComponentType<any>, fallback?: React.ReactNode): React.ComponentType<any>;
|
|
46
|
-
//# sourceMappingURL=react.renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.renderer.d.ts","sourceRoot":"","sources":["../../../../src/universal/renderers/react.renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,UAAU,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,EAAE,cAgC3B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA8BxD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAE/B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAEzB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAkB1B"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Universal Runtime Builder
|
|
3
|
-
*
|
|
4
|
-
* Generates inline JavaScript for the universal renderer.
|
|
5
|
-
* Used by bundleToStaticHTML to create self-contained HTML documents.
|
|
6
|
-
*/
|
|
7
|
-
import type { UniversalRuntimeOptions, UniversalRuntimeResult } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* Build the complete universal runtime script.
|
|
10
|
-
*
|
|
11
|
-
* @param options - Build options
|
|
12
|
-
* @returns Runtime result with script and CDN imports
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const result = buildUniversalRuntime({
|
|
17
|
-
* cdnType: 'esm',
|
|
18
|
-
* includeMarkdown: true,
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* // result.script = complete inline runtime
|
|
22
|
-
* // result.cdnImports = CDN script tags to include in head
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function buildUniversalRuntime(options: UniversalRuntimeOptions): UniversalRuntimeResult;
|
|
26
|
-
/**
|
|
27
|
-
* Build a minimal runtime (store + basic rendering only).
|
|
28
|
-
*
|
|
29
|
-
* @param options - Build options
|
|
30
|
-
* @returns Minimal runtime script
|
|
31
|
-
*/
|
|
32
|
-
export declare function buildMinimalRuntime(options: Pick<UniversalRuntimeOptions, 'minify'>): string;
|
|
33
|
-
//# sourceMappingURL=runtime-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-builder.d.ts","sourceRoot":"","sources":["../../../src/universal/runtime-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAW,MAAM,SAAS,CAAC;AAmZxF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CA6C9F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,GAAG,MAAM,CAa5F"}
|
package/esm/universal/store.d.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FrontMCP Store
|
|
3
|
-
*
|
|
4
|
-
* Simple observable store for managing tool context and state.
|
|
5
|
-
* Uses React 18's useSyncExternalStore for subscription.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* // Create store
|
|
10
|
-
* const store = createFrontMCPStore();
|
|
11
|
-
*
|
|
12
|
-
* // Update state
|
|
13
|
-
* store.setState({ toolName: 'get_weather', output: { temp: 72 } });
|
|
14
|
-
*
|
|
15
|
-
* // In React component
|
|
16
|
-
* const state = useFrontMCPStore();
|
|
17
|
-
* console.log(state.output);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
import type { FrontMCPState, FrontMCPStore, UniversalContent } from './types';
|
|
21
|
-
/**
|
|
22
|
-
* Create a new FrontMCP store instance.
|
|
23
|
-
*
|
|
24
|
-
* @param initialState - Initial state values
|
|
25
|
-
* @returns Store instance with subscription support
|
|
26
|
-
*/
|
|
27
|
-
export declare function createFrontMCPStore(initialState?: Partial<FrontMCPState>): FrontMCPStore;
|
|
28
|
-
/**
|
|
29
|
-
* Get or create the global store instance.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getGlobalStore(): FrontMCPStore;
|
|
32
|
-
/**
|
|
33
|
-
* Set the global store instance.
|
|
34
|
-
* Used for testing or custom store injection.
|
|
35
|
-
*/
|
|
36
|
-
export declare function setGlobalStore(store: FrontMCPStore): void;
|
|
37
|
-
/**
|
|
38
|
-
* Reset the global store to a new instance.
|
|
39
|
-
*/
|
|
40
|
-
export declare function resetGlobalStore(initialState?: Partial<FrontMCPState>): void;
|
|
41
|
-
/**
|
|
42
|
-
* Hook to access the FrontMCP store state.
|
|
43
|
-
*
|
|
44
|
-
* @param store - Optional store instance (uses global if not provided)
|
|
45
|
-
* @returns Current store state
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* function MyWidget() {
|
|
50
|
-
* const { output, loading, error } = useFrontMCPStore();
|
|
51
|
-
*
|
|
52
|
-
* if (loading) return <Spinner />;
|
|
53
|
-
* if (error) return <Error message={error} />;
|
|
54
|
-
*
|
|
55
|
-
* return <div>{output?.message}</div>;
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export declare function useFrontMCPStore(store?: FrontMCPStore): FrontMCPState;
|
|
60
|
-
/**
|
|
61
|
-
* Hook to access the tool output data.
|
|
62
|
-
*
|
|
63
|
-
* @param store - Optional store instance
|
|
64
|
-
* @returns Tool output (typed as T) or null
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```tsx
|
|
68
|
-
* interface WeatherData {
|
|
69
|
-
* temperature: number;
|
|
70
|
-
* conditions: string;
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* function Weather() {
|
|
74
|
-
* const output = useToolOutput<WeatherData>();
|
|
75
|
-
* return <div>{output?.temperature}°F</div>;
|
|
76
|
-
* }
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export declare function useToolOutput<T = unknown>(store?: FrontMCPStore): T | null;
|
|
80
|
-
/**
|
|
81
|
-
* Hook to access the tool input arguments.
|
|
82
|
-
*
|
|
83
|
-
* @param store - Optional store instance
|
|
84
|
-
* @returns Tool input or null
|
|
85
|
-
*/
|
|
86
|
-
export declare function useToolInput<T extends Record<string, unknown> = Record<string, unknown>>(store?: FrontMCPStore): T | null;
|
|
87
|
-
/**
|
|
88
|
-
* Hook to access the content configuration.
|
|
89
|
-
*
|
|
90
|
-
* @param store - Optional store instance
|
|
91
|
-
* @returns Content configuration or null
|
|
92
|
-
*/
|
|
93
|
-
export declare function useContent(store?: FrontMCPStore): UniversalContent | null;
|
|
94
|
-
/**
|
|
95
|
-
* Hook to access the tool name.
|
|
96
|
-
*
|
|
97
|
-
* @param store - Optional store instance
|
|
98
|
-
* @returns Tool name or null
|
|
99
|
-
*/
|
|
100
|
-
export declare function useToolName(store?: FrontMCPStore): string | null;
|
|
101
|
-
/**
|
|
102
|
-
* Hook to access loading and error states.
|
|
103
|
-
*
|
|
104
|
-
* @param store - Optional store instance
|
|
105
|
-
* @returns Loading and error state
|
|
106
|
-
*/
|
|
107
|
-
export declare function useLoadingState(store?: FrontMCPStore): {
|
|
108
|
-
loading: boolean;
|
|
109
|
-
error: string | null;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Initialize store from window.__frontmcp data.
|
|
113
|
-
* Used by the inline runtime to hydrate the store.
|
|
114
|
-
*
|
|
115
|
-
* @param store - Store instance to initialize
|
|
116
|
-
*/
|
|
117
|
-
export declare function initializeStoreFromWindow(store?: FrontMCPStore): void;
|
|
118
|
-
/**
|
|
119
|
-
* Create a store selector for derived state.
|
|
120
|
-
*
|
|
121
|
-
* @param selector - Function to select derived state
|
|
122
|
-
* @returns Hook that returns the selected state
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```tsx
|
|
126
|
-
* const useTemperature = createStoreSelector((state) => state.output?.temperature);
|
|
127
|
-
*
|
|
128
|
-
* function Temperature() {
|
|
129
|
-
* const temp = useTemperature();
|
|
130
|
-
* return <div>{temp}°F</div>;
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
export declare function createStoreSelector<T>(selector: (state: FrontMCPState) => T): (store?: FrontMCPStore) => T;
|
|
135
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/universal/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAO9E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CA6CxF;AAYD;;GAEG;AACH,wBAAgB,cAAc,IAAI,aAAa,CAK9C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAEzD;AAED;;GAEG;AACH,w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
*
|
|
4
|
-
* Core types for the multi-format client-side rendering system.
|
|
5
|
-
* Supports HTML, Markdown, React, and MDX content types with
|
|
6
|
-
* auto-detection and custom component injection.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Supported content types for the universal renderer.
|
|
10
|
-
*
|
|
11
|
-
* - 'html': Raw HTML string (rendered with dangerouslySetInnerHTML)
|
|
12
|
-
* - 'markdown': Markdown content (rendered with react-markdown)
|
|
13
|
-
* - 'react': React component (rendered directly)
|
|
14
|
-
* - 'mdx': MDX content (rendered with @mdx-js/react)
|
|
15
|
-
*/
|
|
16
|
-
export type ContentType = 'html' | 'markdown' | 'react' | 'mdx';
|
|
17
|
-
/**
|
|
18
|
-
* Content configuration for the universal renderer.
|
|
19
|
-
*/
|
|
20
|
-
export interface UniversalContent {
|
|
21
|
-
/** Content type for auto-detection override */
|
|
22
|
-
type: ContentType;
|
|
23
|
-
/** Source content - string for HTML/Markdown/MDX, component for React */
|
|
24
|
-
source: string | React.ComponentType<any>;
|
|
25
|
-
/** Props to pass to React/MDX components */
|
|
26
|
-
props?: Record<string, unknown>;
|
|
27
|
-
/** Custom components available in Markdown/MDX content */
|
|
28
|
-
components?: Record<string, React.ComponentType<any>>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* FrontMCP store state shape.
|
|
32
|
-
* Provides tool context and loading/error states.
|
|
33
|
-
*/
|
|
34
|
-
export interface FrontMCPState {
|
|
35
|
-
/** Tool name from MCP context */
|
|
36
|
-
toolName: string | null;
|
|
37
|
-
/** Tool input arguments */
|
|
38
|
-
input: Record<string, unknown> | null;
|
|
39
|
-
/** Tool output data */
|
|
40
|
-
output: unknown | null;
|
|
41
|
-
/** Content configuration for rendering */
|
|
42
|
-
content: UniversalContent | null;
|
|
43
|
-
/** Structured content parsed from output */
|
|
44
|
-
structuredContent: unknown | null;
|
|
45
|
-
/** Whether data is currently loading */
|
|
46
|
-
loading: boolean;
|
|
47
|
-
/** Error message if loading failed */
|
|
48
|
-
error: string | null;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Default initial state for the FrontMCP store.
|
|
52
|
-
*/
|
|
53
|
-
export declare const DEFAULT_FRONTMCP_STATE: FrontMCPState;
|
|
54
|
-
/**
|
|
55
|
-
* Store interface with subscription support.
|
|
56
|
-
*/
|
|
57
|
-
export interface FrontMCPStore {
|
|
58
|
-
/** Get current state snapshot */
|
|
59
|
-
getState(): FrontMCPState;
|
|
60
|
-
/** Get server-side state (for SSR) */
|
|
61
|
-
getServerState(): FrontMCPState;
|
|
62
|
-
/** Update state with partial values */
|
|
63
|
-
setState(partial: Partial<FrontMCPState>): void;
|
|
64
|
-
/** Subscribe to state changes */
|
|
65
|
-
subscribe(listener: () => void): () => void;
|
|
66
|
-
/** Reset state to initial values */
|
|
67
|
-
reset(): void;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Render context passed to client-side renderers.
|
|
71
|
-
*/
|
|
72
|
-
export interface RenderContext {
|
|
73
|
-
/** Tool output data */
|
|
74
|
-
output: unknown;
|
|
75
|
-
/** Tool input data */
|
|
76
|
-
input: Record<string, unknown> | null;
|
|
77
|
-
/** Custom components available for rendering */
|
|
78
|
-
components: Record<string, React.ComponentType<any>>;
|
|
79
|
-
/** Full store state */
|
|
80
|
-
state: FrontMCPState;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Client-side renderer interface.
|
|
84
|
-
* Each renderer handles a specific content type.
|
|
85
|
-
*/
|
|
86
|
-
export interface ClientRenderer {
|
|
87
|
-
/** Content type this renderer handles */
|
|
88
|
-
readonly type: ContentType;
|
|
89
|
-
/** Priority for auto-detection (higher = checked first) */
|
|
90
|
-
readonly priority: number;
|
|
91
|
-
/**
|
|
92
|
-
* Check if this renderer can handle the given content.
|
|
93
|
-
*/
|
|
94
|
-
canHandle(content: UniversalContent): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Render the content to React elements.
|
|
97
|
-
*/
|
|
98
|
-
render(content: UniversalContent, context: RenderContext): React.ReactNode;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Props for the UniversalApp component.
|
|
102
|
-
*/
|
|
103
|
-
export interface UniversalAppProps {
|
|
104
|
-
/** Content to render (overrides store content) */
|
|
105
|
-
content?: UniversalContent;
|
|
106
|
-
/** Custom components available for rendering */
|
|
107
|
-
components?: Record<string, React.ComponentType<any>>;
|
|
108
|
-
/** Loading fallback component */
|
|
109
|
-
fallback?: React.ReactNode;
|
|
110
|
-
/** Error fallback component */
|
|
111
|
-
errorFallback?: React.ComponentType<{
|
|
112
|
-
error: string;
|
|
113
|
-
}>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Props for the FrontMCPProvider component.
|
|
117
|
-
*/
|
|
118
|
-
export interface FrontMCPProviderProps {
|
|
119
|
-
/** Store instance to provide */
|
|
120
|
-
store?: FrontMCPStore;
|
|
121
|
-
/** Initial state override */
|
|
122
|
-
initialState?: Partial<FrontMCPState>;
|
|
123
|
-
/** Children to render (optional when using React.createElement) */
|
|
124
|
-
children?: React.ReactNode;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* CDN type for runtime script loading.
|
|
128
|
-
*/
|
|
129
|
-
export type CDNType = 'esm' | 'umd';
|
|
130
|
-
/**
|
|
131
|
-
* Content security options for XSS protection.
|
|
132
|
-
*/
|
|
133
|
-
export interface ContentSecurityOptions {
|
|
134
|
-
/**
|
|
135
|
-
* Allow unsafe URL schemes (javascript:, data:, vbscript:) in links.
|
|
136
|
-
* @default false
|
|
137
|
-
*/
|
|
138
|
-
allowUnsafeLinks?: boolean;
|
|
139
|
-
/**
|
|
140
|
-
* Allow inline <script> tags and event handlers.
|
|
141
|
-
* @default false
|
|
142
|
-
*/
|
|
143
|
-
allowInlineScripts?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Bypass all sanitization (dangerous!).
|
|
146
|
-
* @default false
|
|
147
|
-
*/
|
|
148
|
-
bypassSanitization?: boolean;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Options for building the universal runtime script.
|
|
152
|
-
*/
|
|
153
|
-
export interface UniversalRuntimeOptions {
|
|
154
|
-
/** CDN type to use for external dependencies */
|
|
155
|
-
cdnType: CDNType;
|
|
156
|
-
/** Include markdown renderer (react-markdown) */
|
|
157
|
-
includeMarkdown?: boolean;
|
|
158
|
-
/** Include MDX renderer (@mdx-js/react) */
|
|
159
|
-
includeMdx?: boolean;
|
|
160
|
-
/** Custom components to include (as inline JavaScript) */
|
|
161
|
-
customComponents?: string;
|
|
162
|
-
/** Minify the output */
|
|
163
|
-
minify?: boolean;
|
|
164
|
-
/** Content security / XSS protection options */
|
|
165
|
-
contentSecurity?: ContentSecurityOptions;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Result from building the universal runtime.
|
|
169
|
-
*/
|
|
170
|
-
export interface UniversalRuntimeResult {
|
|
171
|
-
/** Complete runtime script (including store, renderers, app) */
|
|
172
|
-
script: string;
|
|
173
|
-
/** CDN imports to include in head */
|
|
174
|
-
cdnImports: string;
|
|
175
|
-
/** Size of the runtime in bytes */
|
|
176
|
-
size: number;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* CDN URLs for universal renderer dependencies.
|
|
180
|
-
*/
|
|
181
|
-
export declare const UNIVERSAL_CDN: {
|
|
182
|
-
readonly esm: {
|
|
183
|
-
readonly reactMarkdown: "https://esm.sh/react-markdown@9";
|
|
184
|
-
readonly mdxReact: "https://esm.sh/@mdx-js/react@3";
|
|
185
|
-
readonly remarkGfm: "https://esm.sh/remark-gfm@4";
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Detect content type from source content.
|
|
190
|
-
*
|
|
191
|
-
* Detection priority:
|
|
192
|
-
* 1. React component function -> 'react'
|
|
193
|
-
* 2. Module code (import/export) with JSX -> 'react' (needs transpilation)
|
|
194
|
-
* 3. Markdown with JSX components -> 'mdx' (render with MDX renderer)
|
|
195
|
-
* 4. Pure markdown -> 'markdown'
|
|
196
|
-
* 5. Default -> 'html'
|
|
197
|
-
*/
|
|
198
|
-
export declare function detectContentType(source: unknown): ContentType;
|
|
199
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/universal/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,IAAI,EAAE,WAAW,CAAC;IAElB,yEAAyE;IAEzE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAE1C,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhC,0DAA0D;IAE1D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;CACvD;AAMD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEtC,uBAAuB;IACvB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvB,0CAA0C;IAC1C,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAEjC,4CAA4C;IAC5C,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAC;IAElC,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IAEjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED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