@frontmcp/ui 0.12.2 → 1.0.0-beta.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/README.md +279 -72
- package/bridge/adapters/claude.adapter.d.ts.map +1 -1
- package/bridge/adapters/gemini.adapter.d.ts.map +1 -1
- package/bridge/index.js +2 -36
- package/components/Alert/Alert.d.ts +11 -0
- package/components/Alert/Alert.d.ts.map +1 -0
- package/components/Alert/index.d.ts +4 -0
- package/components/Alert/index.d.ts.map +1 -0
- package/components/Alert/index.js +61 -0
- package/components/Avatar/Avatar.d.ts +10 -0
- package/components/Avatar/Avatar.d.ts.map +1 -0
- package/components/Avatar/index.d.ts +4 -0
- package/components/Avatar/index.d.ts.map +1 -0
- package/components/Avatar/index.js +43 -0
- package/components/Badge/Badge.d.ts +13 -0
- package/components/Badge/Badge.d.ts.map +1 -0
- package/components/Badge/index.d.ts +4 -0
- package/components/Badge/index.d.ts.map +1 -0
- package/{render → components/Badge}/index.js +54 -42
- package/components/Button/Button.d.ts +16 -0
- package/components/Button/Button.d.ts.map +1 -0
- package/components/Button/index.d.ts +4 -0
- package/components/Button/index.d.ts.map +1 -0
- package/components/Button/index.js +91 -0
- package/components/Card/Card.d.ts +25 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +110 -0
- package/components/List/List.d.ts +15 -0
- package/components/List/List.d.ts.map +1 -0
- package/components/List/index.d.ts +4 -0
- package/components/List/index.d.ts.map +1 -0
- package/components/List/index.js +58 -0
- package/components/Loader/Loader.d.ts +28 -0
- package/components/Loader/Loader.d.ts.map +1 -0
- package/components/Loader/LoaderContext.d.ts +20 -0
- package/components/Loader/LoaderContext.d.ts.map +1 -0
- package/components/Loader/index.d.ts +6 -0
- package/components/Loader/index.d.ts.map +1 -0
- package/components/Loader/index.js +174 -0
- package/components/Modal/Modal.d.ts +22 -0
- package/components/Modal/Modal.d.ts.map +1 -0
- package/components/Modal/index.d.ts +4 -0
- package/components/Modal/index.d.ts.map +1 -0
- package/components/Modal/index.js +80 -0
- package/components/Select/Select.d.ts +21 -0
- package/components/Select/Select.d.ts.map +1 -0
- package/components/Select/index.d.ts +4 -0
- package/components/Select/index.d.ts.map +1 -0
- package/components/Select/index.js +78 -0
- package/components/Table/Table.d.ts +15 -0
- package/components/Table/Table.d.ts.map +1 -0
- package/components/Table/index.d.ts +4 -0
- package/components/Table/index.d.ts.map +1 -0
- package/components/Table/index.js +70 -0
- package/components/TextField/TextField.d.ts +19 -0
- package/components/TextField/TextField.d.ts.map +1 -0
- package/components/TextField/index.d.ts +4 -0
- package/components/TextField/index.d.ts.map +1 -0
- package/components/TextField/index.js +77 -0
- package/components/index.d.ts +22 -28
- package/components/index.d.ts.map +1 -1
- package/components/index.js +523 -2521
- package/esm/bridge/index.mjs +2 -6
- package/esm/components/Alert/index.mjs +28 -0
- package/esm/components/Avatar/index.mjs +10 -0
- package/esm/components/Badge/index.mjs +56 -0
- package/esm/components/Button/index.mjs +58 -0
- package/esm/components/Card/index.mjs +77 -0
- package/esm/components/List/index.mjs +25 -0
- package/esm/components/Loader/index.mjs +141 -0
- package/esm/components/Modal/index.mjs +47 -0
- package/esm/components/Select/index.mjs +45 -0
- package/esm/components/Table/index.mjs +37 -0
- package/esm/components/TextField/index.mjs +44 -0
- package/esm/components/index.mjs +513 -2415
- package/esm/index.mjs +62 -4652
- package/esm/package.json +372 -16
- package/esm/react/index.mjs +2 -285
- package/esm/renderer/charts/index.mjs +336 -0
- package/esm/renderer/common/index.mjs +135 -0
- package/esm/renderer/csv/index.mjs +193 -0
- package/esm/renderer/flow/index.mjs +259 -0
- package/esm/renderer/html/index.mjs +99 -0
- package/esm/renderer/image/index.mjs +125 -0
- package/esm/renderer/index.mjs +2173 -0
- package/esm/renderer/maps/index.mjs +217 -0
- package/esm/renderer/math/index.mjs +229 -0
- package/esm/renderer/mdx/index.mjs +261 -0
- package/esm/renderer/media/index.mjs +235 -0
- package/esm/renderer/mermaid/index.mjs +220 -0
- package/esm/renderer/pdf/index.mjs +229 -0
- package/esm/renderer/react/index.mjs +230 -0
- package/esm/runtime/index.mjs +194 -0
- package/esm/theme/index.mjs +93 -0
- package/index.d.ts +10 -18
- package/index.d.ts.map +1 -1
- package/index.js +63 -4806
- package/package.json +372 -16
- package/react/index.d.ts +8 -54
- package/react/index.d.ts.map +1 -1
- package/react/index.js +2 -295
- package/renderer/auto-detect.d.ts +39 -0
- package/renderer/auto-detect.d.ts.map +1 -0
- package/renderer/charts/index.d.ts +22 -0
- package/renderer/charts/index.d.ts.map +1 -0
- package/renderer/charts/index.js +367 -0
- package/renderer/common/index.d.ts +5 -0
- package/renderer/common/index.d.ts.map +1 -0
- package/renderer/common/index.js +158 -0
- package/renderer/common/inject-stylesheet.d.ts +9 -0
- package/renderer/common/inject-stylesheet.d.ts.map +1 -0
- package/renderer/common/lazy-import.d.ts +85 -0
- package/renderer/common/lazy-import.d.ts.map +1 -0
- package/renderer/common/use-lazy-module.d.ts +13 -0
- package/renderer/common/use-lazy-module.d.ts.map +1 -0
- package/renderer/common/use-renderer-theme.d.ts +35 -0
- package/renderer/common/use-renderer-theme.d.ts.map +1 -0
- package/renderer/csv/index.d.ts +12 -0
- package/renderer/csv/index.d.ts.map +1 -0
- package/renderer/csv/index.js +224 -0
- package/renderer/flow/index.d.ts +40 -0
- package/renderer/flow/index.d.ts.map +1 -0
- package/renderer/flow/index.js +290 -0
- package/renderer/html/index.d.ts +12 -0
- package/renderer/html/index.d.ts.map +1 -0
- package/renderer/html/index.js +130 -0
- package/renderer/image/index.d.ts +11 -0
- package/renderer/image/index.d.ts.map +1 -0
- package/renderer/image/index.js +156 -0
- package/renderer/index.d.ts +32 -0
- package/renderer/index.d.ts.map +1 -0
- package/renderer/index.js +2206 -0
- package/renderer/maps/index.d.ts +27 -0
- package/renderer/maps/index.d.ts.map +1 -0
- package/renderer/maps/index.js +248 -0
- package/renderer/math/index.d.ts +11 -0
- package/renderer/math/index.d.ts.map +1 -0
- package/renderer/math/index.js +260 -0
- package/renderer/mdx/index.d.ts +10 -0
- package/renderer/mdx/index.d.ts.map +1 -0
- package/renderer/mdx/index.js +292 -0
- package/renderer/media/index.d.ts +20 -0
- package/renderer/media/index.d.ts.map +1 -0
- package/renderer/media/index.js +266 -0
- package/renderer/mermaid/index.d.ts +11 -0
- package/renderer/mermaid/index.d.ts.map +1 -0
- package/renderer/mermaid/index.js +251 -0
- package/renderer/pdf/index.d.ts +10 -0
- package/renderer/pdf/index.d.ts.map +1 -0
- package/renderer/pdf/index.js +260 -0
- package/renderer/react/index.d.ts +45 -0
- package/renderer/react/index.d.ts.map +1 -0
- package/renderer/react/index.js +261 -0
- package/renderer/types.d.ts +24 -0
- package/renderer/types.d.ts.map +1 -0
- package/runtime/babel-runtime.d.ts +70 -0
- package/runtime/babel-runtime.d.ts.map +1 -0
- package/runtime/content-detector.d.ts +43 -0
- package/runtime/content-detector.d.ts.map +1 -0
- package/runtime/index.d.ts +10 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +217 -0
- package/theme/FrontMcpThemeProvider.d.ts +4 -0
- package/theme/FrontMcpThemeProvider.d.ts.map +1 -0
- package/theme/create-theme.d.ts +9 -0
- package/theme/create-theme.d.ts.map +1 -0
- package/theme/index.d.ts +5 -0
- package/theme/index.d.ts.map +1 -0
- package/theme/index.js +126 -0
- package/theme/types.d.ts +28 -0
- package/theme/types.d.ts.map +1 -0
- package/theme/use-theme.d.ts +3 -0
- package/theme/use-theme.d.ts.map +1 -0
- package/bundler/browser-components.d.ts +0 -42
- package/bundler/browser-components.d.ts.map +0 -1
- package/bundler/bundler.d.ts +0 -282
- package/bundler/bundler.d.ts.map +0 -1
- package/bundler/index.d.ts +0 -43
- package/bundler/index.d.ts.map +0 -1
- package/bundler/index.js +0 -3168
- package/bundler/types.d.ts +0 -883
- package/bundler/types.d.ts.map +0 -1
- package/components/alert.d.ts +0 -83
- package/components/alert.d.ts.map +0 -1
- package/components/alert.schema.d.ts +0 -98
- package/components/alert.schema.d.ts.map +0 -1
- package/components/avatar.d.ts +0 -77
- package/components/avatar.d.ts.map +0 -1
- package/components/avatar.schema.d.ts +0 -170
- package/components/avatar.schema.d.ts.map +0 -1
- package/components/badge.d.ts +0 -78
- package/components/badge.d.ts.map +0 -1
- package/components/badge.schema.d.ts +0 -91
- package/components/badge.schema.d.ts.map +0 -1
- package/components/button.d.ts +0 -100
- package/components/button.d.ts.map +0 -1
- package/components/button.schema.d.ts +0 -120
- package/components/button.schema.d.ts.map +0 -1
- package/components/card.d.ts +0 -76
- package/components/card.d.ts.map +0 -1
- package/components/card.schema.d.ts +0 -93
- package/components/card.schema.d.ts.map +0 -1
- package/components/form.d.ts +0 -227
- package/components/form.d.ts.map +0 -1
- package/components/form.schema.d.ts +0 -365
- package/components/form.schema.d.ts.map +0 -1
- package/components/list.d.ts +0 -121
- package/components/list.d.ts.map +0 -1
- package/components/list.schema.d.ts +0 -129
- package/components/list.schema.d.ts.map +0 -1
- package/components/modal.d.ts +0 -100
- package/components/modal.d.ts.map +0 -1
- package/components/modal.schema.d.ts +0 -151
- package/components/modal.schema.d.ts.map +0 -1
- package/components/table.d.ts +0 -91
- package/components/table.d.ts.map +0 -1
- package/components/table.schema.d.ts +0 -123
- package/components/table.schema.d.ts.map +0 -1
- package/esm/bundler/index.mjs +0 -3136
- package/esm/layouts/index.mjs +0 -409
- package/esm/render/index.mjs +0 -45
- package/esm/renderers/index.mjs +0 -621
- package/esm/universal/index.mjs +0 -1946
- package/esm/web-components/index.mjs +0 -2023
- package/layouts/base.d.ts +0 -86
- package/layouts/base.d.ts.map +0 -1
- package/layouts/index.d.ts +0 -8
- package/layouts/index.d.ts.map +0 -1
- package/layouts/index.js +0 -437
- package/layouts/presets.d.ts +0 -134
- package/layouts/presets.d.ts.map +0 -1
- package/react/Alert.d.ts +0 -101
- package/react/Alert.d.ts.map +0 -1
- package/react/Badge.d.ts +0 -100
- package/react/Badge.d.ts.map +0 -1
- package/react/Button.d.ts +0 -108
- package/react/Button.d.ts.map +0 -1
- package/react/Card.d.ts +0 -103
- package/react/Card.d.ts.map +0 -1
- package/react/types.d.ts +0 -105
- package/react/types.d.ts.map +0 -1
- package/render/index.d.ts +0 -8
- package/render/index.d.ts.map +0 -1
- package/render/prerender.d.ts +0 -57
- package/render/prerender.d.ts.map +0 -1
- package/renderers/index.d.ts +0 -26
- package/renderers/index.d.ts.map +0 -1
- package/renderers/index.js +0 -666
- package/renderers/mdx.renderer.d.ts +0 -99
- package/renderers/mdx.renderer.d.ts.map +0 -1
- package/renderers/react.adapter.d.ts +0 -70
- package/renderers/react.adapter.d.ts.map +0 -1
- package/renderers/react.renderer.d.ts +0 -105
- package/renderers/react.renderer.d.ts.map +0 -1
- package/renderers/transpiler.d.ts +0 -49
- package/renderers/transpiler.d.ts.map +0 -1
- package/universal/UniversalApp.d.ts +0 -108
- package/universal/UniversalApp.d.ts.map +0 -1
- package/universal/cached-runtime.d.ts +0 -139
- package/universal/cached-runtime.d.ts.map +0 -1
- package/universal/context.d.ts +0 -122
- package/universal/context.d.ts.map +0 -1
- package/universal/index.d.ts +0 -57
- package/universal/index.d.ts.map +0 -1
- package/universal/index.js +0 -2032
- package/universal/renderers/html.renderer.d.ts +0 -36
- package/universal/renderers/html.renderer.d.ts.map +0 -1
- package/universal/renderers/index.d.ts +0 -112
- package/universal/renderers/index.d.ts.map +0 -1
- package/universal/renderers/markdown.renderer.d.ts +0 -33
- package/universal/renderers/markdown.renderer.d.ts.map +0 -1
- package/universal/renderers/mdx.renderer.d.ts +0 -38
- package/universal/renderers/mdx.renderer.d.ts.map +0 -1
- package/universal/renderers/react.renderer.d.ts +0 -46
- package/universal/renderers/react.renderer.d.ts.map +0 -1
- package/universal/runtime-builder.d.ts +0 -33
- package/universal/runtime-builder.d.ts.map +0 -1
- package/universal/store.d.ts +0 -135
- package/universal/store.d.ts.map +0 -1
- package/universal/types.d.ts +0 -199
- package/universal/types.d.ts.map +0 -1
- package/web-components/core/attribute-parser.d.ts +0 -82
- package/web-components/core/attribute-parser.d.ts.map +0 -1
- package/web-components/core/base-element.d.ts +0 -197
- package/web-components/core/base-element.d.ts.map +0 -1
- package/web-components/core/index.d.ts +0 -9
- package/web-components/core/index.d.ts.map +0 -1
- package/web-components/elements/fmcp-alert.d.ts +0 -46
- package/web-components/elements/fmcp-alert.d.ts.map +0 -1
- package/web-components/elements/fmcp-badge.d.ts +0 -47
- package/web-components/elements/fmcp-badge.d.ts.map +0 -1
- package/web-components/elements/fmcp-button.d.ts +0 -117
- package/web-components/elements/fmcp-button.d.ts.map +0 -1
- package/web-components/elements/fmcp-card.d.ts +0 -53
- package/web-components/elements/fmcp-card.d.ts.map +0 -1
- package/web-components/elements/fmcp-input.d.ts +0 -96
- package/web-components/elements/fmcp-input.d.ts.map +0 -1
- package/web-components/elements/fmcp-select.d.ts +0 -100
- package/web-components/elements/fmcp-select.d.ts.map +0 -1
- package/web-components/elements/index.d.ts +0 -13
- package/web-components/elements/index.d.ts.map +0 -1
- package/web-components/index.d.ts +0 -49
- package/web-components/index.d.ts.map +0 -1
- package/web-components/index.js +0 -2058
- package/web-components/register.d.ts +0 -57
- package/web-components/register.d.ts.map +0 -1
- package/web-components/types.d.ts +0 -122
- package/web-components/types.d.ts.map +0 -1
package/bundler/types.d.ts
DELETED
|
@@ -1,883 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundler Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for the in-memory bundler system.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
import type { ThemeConfig } from '@frontmcp/uipack/theme';
|
|
9
|
-
/**
|
|
10
|
-
* Build mode for static HTML generation.
|
|
11
|
-
* Controls how tool data is injected into the generated HTML.
|
|
12
|
-
*
|
|
13
|
-
* - 'static': Data is baked into HTML at build time (current default behavior)
|
|
14
|
-
* - 'dynamic': HTML subscribes to platform events for data updates (OpenAI onToolResult)
|
|
15
|
-
* - 'hybrid': Pre-built shell with placeholder for runtime data injection
|
|
16
|
-
*/
|
|
17
|
-
export type BuildMode = 'static' | 'dynamic' | 'hybrid';
|
|
18
|
-
/**
|
|
19
|
-
* Placeholder marker for hybrid mode output.
|
|
20
|
-
* Used as a string that callers can replace with actual JSON data.
|
|
21
|
-
*/
|
|
22
|
-
export declare const HYBRID_DATA_PLACEHOLDER = "__FRONTMCP_OUTPUT_PLACEHOLDER__";
|
|
23
|
-
/**
|
|
24
|
-
* Placeholder marker for hybrid mode input.
|
|
25
|
-
* Used as a string that callers can replace with actual JSON data.
|
|
26
|
-
*/
|
|
27
|
-
export declare const HYBRID_INPUT_PLACEHOLDER = "__FRONTMCP_INPUT_PLACEHOLDER__";
|
|
28
|
-
/**
|
|
29
|
-
* Dynamic mode configuration options.
|
|
30
|
-
*/
|
|
31
|
-
export interface DynamicModeOptions {
|
|
32
|
-
/**
|
|
33
|
-
* Whether to include initial data in the HTML.
|
|
34
|
-
* If true, component shows data immediately; if false, shows loading state.
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
includeInitialData?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Subscribe to platform tool result events.
|
|
40
|
-
* For OpenAI: window.openai.canvas.onToolResult
|
|
41
|
-
* @default true
|
|
42
|
-
*/
|
|
43
|
-
subscribeToUpdates?: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Hybrid mode configuration options.
|
|
47
|
-
*/
|
|
48
|
-
export interface HybridModeOptions {
|
|
49
|
-
/**
|
|
50
|
-
* Custom placeholder string for output data injection.
|
|
51
|
-
* @default HYBRID_DATA_PLACEHOLDER
|
|
52
|
-
*/
|
|
53
|
-
placeholder?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Custom placeholder string for input data injection.
|
|
56
|
-
* @default HYBRID_INPUT_PLACEHOLDER
|
|
57
|
-
*/
|
|
58
|
-
inputPlaceholder?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Source type for bundler input.
|
|
62
|
-
*/
|
|
63
|
-
export type SourceType = 'jsx' | 'tsx' | 'mdx' | 'html' | 'auto';
|
|
64
|
-
/**
|
|
65
|
-
* Output format for bundles.
|
|
66
|
-
*/
|
|
67
|
-
export type OutputFormat = 'iife' | 'esm' | 'cjs';
|
|
68
|
-
/**
|
|
69
|
-
* Options for bundling source code.
|
|
70
|
-
*/
|
|
71
|
-
export interface BundleOptions {
|
|
72
|
-
/**
|
|
73
|
-
* Source code to bundle.
|
|
74
|
-
*/
|
|
75
|
-
source: string;
|
|
76
|
-
/**
|
|
77
|
-
* Source type (jsx, tsx, mdx, html, or auto).
|
|
78
|
-
* @default 'auto'
|
|
79
|
-
*/
|
|
80
|
-
sourceType?: SourceType;
|
|
81
|
-
/**
|
|
82
|
-
* Output format.
|
|
83
|
-
* @default 'iife'
|
|
84
|
-
*/
|
|
85
|
-
format?: OutputFormat;
|
|
86
|
-
/**
|
|
87
|
-
* Minify output code.
|
|
88
|
-
* @default false
|
|
89
|
-
*/
|
|
90
|
-
minify?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Generate source maps.
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
sourceMaps?: boolean | 'inline';
|
|
96
|
-
/**
|
|
97
|
-
* External modules (not bundled).
|
|
98
|
-
* @default ['react', 'react-dom']
|
|
99
|
-
*/
|
|
100
|
-
externals?: string[];
|
|
101
|
-
/**
|
|
102
|
-
* JSX configuration.
|
|
103
|
-
*/
|
|
104
|
-
jsx?: {
|
|
105
|
-
/**
|
|
106
|
-
* JSX runtime mode.
|
|
107
|
-
* @default 'automatic'
|
|
108
|
-
*/
|
|
109
|
-
runtime?: 'automatic' | 'classic';
|
|
110
|
-
/**
|
|
111
|
-
* Import source for automatic runtime.
|
|
112
|
-
* @default 'react'
|
|
113
|
-
*/
|
|
114
|
-
importSource?: string;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Security policy for bundling.
|
|
118
|
-
*/
|
|
119
|
-
security?: SecurityPolicy;
|
|
120
|
-
/**
|
|
121
|
-
* Target environment.
|
|
122
|
-
* @default 'es2020'
|
|
123
|
-
*/
|
|
124
|
-
target?: string;
|
|
125
|
-
/**
|
|
126
|
-
* Global variable name for IIFE format.
|
|
127
|
-
* @default 'Widget'
|
|
128
|
-
*/
|
|
129
|
-
globalName?: string;
|
|
130
|
-
/**
|
|
131
|
-
* Cache key override. If not provided, computed from source hash.
|
|
132
|
-
*/
|
|
133
|
-
cacheKey?: string;
|
|
134
|
-
/**
|
|
135
|
-
* Skip cache lookup.
|
|
136
|
-
* @default false
|
|
137
|
-
*/
|
|
138
|
-
skipCache?: boolean;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Options specifically for SSR bundling.
|
|
142
|
-
*/
|
|
143
|
-
export interface SSRBundleOptions extends BundleOptions {
|
|
144
|
-
/**
|
|
145
|
-
* Context data to inject during SSR.
|
|
146
|
-
*/
|
|
147
|
-
context?: Record<string, unknown>;
|
|
148
|
-
/**
|
|
149
|
-
* Component export name to render.
|
|
150
|
-
* @default 'default'
|
|
151
|
-
*/
|
|
152
|
-
componentExport?: string;
|
|
153
|
-
/**
|
|
154
|
-
* Whether to include hydration script.
|
|
155
|
-
* @default false
|
|
156
|
-
*/
|
|
157
|
-
includeHydration?: boolean;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Result of a bundle operation.
|
|
161
|
-
*/
|
|
162
|
-
export interface BundleResult {
|
|
163
|
-
/**
|
|
164
|
-
* Bundled/transformed code.
|
|
165
|
-
*/
|
|
166
|
-
code: string;
|
|
167
|
-
/**
|
|
168
|
-
* Content hash of the bundle.
|
|
169
|
-
*/
|
|
170
|
-
hash: string;
|
|
171
|
-
/**
|
|
172
|
-
* Whether result was served from cache.
|
|
173
|
-
*/
|
|
174
|
-
cached: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Bundle size in bytes.
|
|
177
|
-
*/
|
|
178
|
-
size: number;
|
|
179
|
-
/**
|
|
180
|
-
* Source map (if generated).
|
|
181
|
-
*/
|
|
182
|
-
map?: string;
|
|
183
|
-
/**
|
|
184
|
-
* Performance metrics.
|
|
185
|
-
*/
|
|
186
|
-
metrics: BundleMetrics;
|
|
187
|
-
/**
|
|
188
|
-
* Detected or specified source type.
|
|
189
|
-
*/
|
|
190
|
-
sourceType: SourceType;
|
|
191
|
-
/**
|
|
192
|
-
* Output format used.
|
|
193
|
-
*/
|
|
194
|
-
format: OutputFormat;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Performance metrics for bundling.
|
|
198
|
-
*/
|
|
199
|
-
export interface BundleMetrics {
|
|
200
|
-
/**
|
|
201
|
-
* Time to transform source (ms).
|
|
202
|
-
*/
|
|
203
|
-
transformTime: number;
|
|
204
|
-
/**
|
|
205
|
-
* Time to bundle (ms).
|
|
206
|
-
*/
|
|
207
|
-
bundleTime: number;
|
|
208
|
-
/**
|
|
209
|
-
* Total processing time (ms).
|
|
210
|
-
*/
|
|
211
|
-
totalTime: number;
|
|
212
|
-
/**
|
|
213
|
-
* Cache lookup time (ms).
|
|
214
|
-
*/
|
|
215
|
-
cacheTime?: number;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Result of SSR rendering.
|
|
219
|
-
*/
|
|
220
|
-
export interface SSRResult extends BundleResult {
|
|
221
|
-
/**
|
|
222
|
-
* Rendered HTML output.
|
|
223
|
-
*/
|
|
224
|
-
html: string;
|
|
225
|
-
/**
|
|
226
|
-
* Hydration script (if included).
|
|
227
|
-
*/
|
|
228
|
-
hydrationScript?: string;
|
|
229
|
-
/**
|
|
230
|
-
* SSR-specific metrics.
|
|
231
|
-
*/
|
|
232
|
-
ssrMetrics: {
|
|
233
|
-
/**
|
|
234
|
-
* Time to render component (ms).
|
|
235
|
-
*/
|
|
236
|
-
renderTime: number;
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Security policy for bundler execution.
|
|
241
|
-
*/
|
|
242
|
-
export interface SecurityPolicy {
|
|
243
|
-
/**
|
|
244
|
-
* Allowed import patterns (regex).
|
|
245
|
-
* @default [/^react/, /^@frontmcp\/ui/]
|
|
246
|
-
*/
|
|
247
|
-
allowedImports?: RegExp[];
|
|
248
|
-
/**
|
|
249
|
-
* Blocked import patterns (regex).
|
|
250
|
-
* @default [/^fs/, /^net/, /^child_process/, /^os/, /^path/]
|
|
251
|
-
*/
|
|
252
|
-
blockedImports?: RegExp[];
|
|
253
|
-
/**
|
|
254
|
-
* Maximum bundle size in bytes.
|
|
255
|
-
* @default 512000 (500KB)
|
|
256
|
-
*/
|
|
257
|
-
maxBundleSize?: number;
|
|
258
|
-
/**
|
|
259
|
-
* Maximum transform time in ms.
|
|
260
|
-
* @default 5000 (5s)
|
|
261
|
-
*/
|
|
262
|
-
maxTransformTime?: number;
|
|
263
|
-
/**
|
|
264
|
-
* Block eval() and Function() usage.
|
|
265
|
-
* @default true
|
|
266
|
-
*/
|
|
267
|
-
noEval?: boolean;
|
|
268
|
-
/**
|
|
269
|
-
* Block dynamic imports.
|
|
270
|
-
* @default true
|
|
271
|
-
*/
|
|
272
|
-
noDynamicImports?: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Block require() usage.
|
|
275
|
-
* @default true
|
|
276
|
-
*/
|
|
277
|
-
noRequire?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Allowed global variables.
|
|
280
|
-
* @default ['console', 'Math', 'JSON', 'Date', 'Array', 'Object', 'String', 'Number', 'Boolean', 'Promise', 'Map', 'Set', 'WeakMap', 'WeakSet', 'Symbol', 'Reflect', 'Proxy', 'Error', 'TypeError', 'RangeError', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'encodeURI', 'encodeURIComponent', 'decodeURI', 'decodeURIComponent', 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval']
|
|
281
|
-
*/
|
|
282
|
-
allowedGlobals?: string[];
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Security violation details.
|
|
286
|
-
*/
|
|
287
|
-
export interface SecurityViolation {
|
|
288
|
-
/**
|
|
289
|
-
* Type of violation.
|
|
290
|
-
*/
|
|
291
|
-
type: 'blocked-import' | 'disallowed-import' | 'eval-usage' | 'dynamic-import' | 'require-usage' | 'size-exceeded' | 'timeout' | 'blocked-global';
|
|
292
|
-
/**
|
|
293
|
-
* Human-readable message.
|
|
294
|
-
*/
|
|
295
|
-
message: string;
|
|
296
|
-
/**
|
|
297
|
-
* Location in source (if available).
|
|
298
|
-
*/
|
|
299
|
-
location?: {
|
|
300
|
-
line: number;
|
|
301
|
-
column: number;
|
|
302
|
-
};
|
|
303
|
-
/**
|
|
304
|
-
* Offending pattern/value.
|
|
305
|
-
*/
|
|
306
|
-
value?: string;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Options passed to esbuild transform API.
|
|
310
|
-
* @see https://esbuild.github.io/api/#transform
|
|
311
|
-
*/
|
|
312
|
-
export interface EsbuildTransformOptions {
|
|
313
|
-
/**
|
|
314
|
-
* File type for the input.
|
|
315
|
-
*/
|
|
316
|
-
loader?: 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'css';
|
|
317
|
-
/**
|
|
318
|
-
* Minify the output.
|
|
319
|
-
*/
|
|
320
|
-
minify?: boolean;
|
|
321
|
-
/**
|
|
322
|
-
* Generate source maps.
|
|
323
|
-
*/
|
|
324
|
-
sourcemap?: boolean | 'inline' | 'external' | 'both';
|
|
325
|
-
/**
|
|
326
|
-
* Target environment (e.g., 'es2020', 'esnext').
|
|
327
|
-
*/
|
|
328
|
-
target?: string | string[];
|
|
329
|
-
/**
|
|
330
|
-
* Output format.
|
|
331
|
-
*/
|
|
332
|
-
format?: 'iife' | 'cjs' | 'esm';
|
|
333
|
-
/**
|
|
334
|
-
* JSX factory function (classic mode).
|
|
335
|
-
*/
|
|
336
|
-
jsxFactory?: string;
|
|
337
|
-
/**
|
|
338
|
-
* JSX fragment factory function (classic mode).
|
|
339
|
-
*/
|
|
340
|
-
jsxFragment?: string;
|
|
341
|
-
/**
|
|
342
|
-
* JSX mode: 'transform' (classic) or 'automatic' (React 17+).
|
|
343
|
-
*/
|
|
344
|
-
jsx?: 'transform' | 'preserve' | 'automatic';
|
|
345
|
-
/**
|
|
346
|
-
* Import source for automatic JSX runtime.
|
|
347
|
-
*/
|
|
348
|
-
jsxImportSource?: string;
|
|
349
|
-
/**
|
|
350
|
-
* Global name for IIFE output.
|
|
351
|
-
*/
|
|
352
|
-
globalName?: string;
|
|
353
|
-
/**
|
|
354
|
-
* Keep names (function/class names) for debugging.
|
|
355
|
-
*/
|
|
356
|
-
keepNames?: boolean;
|
|
357
|
-
/**
|
|
358
|
-
* Drop console/debugger statements.
|
|
359
|
-
*/
|
|
360
|
-
drop?: ('console' | 'debugger')[];
|
|
361
|
-
/**
|
|
362
|
-
* Define global constants.
|
|
363
|
-
*/
|
|
364
|
-
define?: Record<string, string>;
|
|
365
|
-
/**
|
|
366
|
-
* Pure function calls that can be removed if unused.
|
|
367
|
-
*/
|
|
368
|
-
pure?: string[];
|
|
369
|
-
/**
|
|
370
|
-
* Charset for output files.
|
|
371
|
-
*/
|
|
372
|
-
charset?: 'ascii' | 'utf8';
|
|
373
|
-
/**
|
|
374
|
-
* Legal comments handling.
|
|
375
|
-
*/
|
|
376
|
-
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
|
|
377
|
-
/**
|
|
378
|
-
* Supported features override.
|
|
379
|
-
*/
|
|
380
|
-
supported?: Record<string, boolean>;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Configuration options for creating a bundler instance.
|
|
384
|
-
*/
|
|
385
|
-
export interface BundlerOptions {
|
|
386
|
-
/**
|
|
387
|
-
* Default security policy.
|
|
388
|
-
*/
|
|
389
|
-
defaultSecurity?: SecurityPolicy;
|
|
390
|
-
/**
|
|
391
|
-
* Cache configuration.
|
|
392
|
-
*/
|
|
393
|
-
cache?: {
|
|
394
|
-
/**
|
|
395
|
-
* Maximum number of cached entries.
|
|
396
|
-
* @default 100
|
|
397
|
-
*/
|
|
398
|
-
maxSize?: number;
|
|
399
|
-
/**
|
|
400
|
-
* TTL for cache entries in ms.
|
|
401
|
-
* @default 300000 (5 minutes)
|
|
402
|
-
*/
|
|
403
|
-
ttl?: number;
|
|
404
|
-
/**
|
|
405
|
-
* Disable caching entirely.
|
|
406
|
-
* @default false
|
|
407
|
-
*/
|
|
408
|
-
disabled?: boolean;
|
|
409
|
-
};
|
|
410
|
-
/**
|
|
411
|
-
* Enable verbose logging.
|
|
412
|
-
* @default false
|
|
413
|
-
*/
|
|
414
|
-
verbose?: boolean;
|
|
415
|
-
/**
|
|
416
|
-
* Custom esbuild transform options.
|
|
417
|
-
* @see EsbuildTransformOptions
|
|
418
|
-
*/
|
|
419
|
-
esbuildOptions?: EsbuildTransformOptions;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Cache entry for bundled results.
|
|
423
|
-
*/
|
|
424
|
-
export interface CacheEntry {
|
|
425
|
-
/**
|
|
426
|
-
* Bundle result.
|
|
427
|
-
*/
|
|
428
|
-
result: BundleResult;
|
|
429
|
-
/**
|
|
430
|
-
* Creation timestamp.
|
|
431
|
-
*/
|
|
432
|
-
createdAt: number;
|
|
433
|
-
/**
|
|
434
|
-
* Last access timestamp.
|
|
435
|
-
*/
|
|
436
|
-
lastAccessedAt: number;
|
|
437
|
-
/**
|
|
438
|
-
* Access count.
|
|
439
|
-
*/
|
|
440
|
-
accessCount: number;
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Context for transform operations.
|
|
444
|
-
*/
|
|
445
|
-
export interface TransformContext {
|
|
446
|
-
/**
|
|
447
|
-
* Source type being transformed.
|
|
448
|
-
*/
|
|
449
|
-
sourceType: SourceType;
|
|
450
|
-
/**
|
|
451
|
-
* File path (for source maps).
|
|
452
|
-
*/
|
|
453
|
-
filename?: string;
|
|
454
|
-
/**
|
|
455
|
-
* Source code.
|
|
456
|
-
*/
|
|
457
|
-
source: string;
|
|
458
|
-
/**
|
|
459
|
-
* Active security policy.
|
|
460
|
-
*/
|
|
461
|
-
security: SecurityPolicy;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Default security policy.
|
|
465
|
-
*/
|
|
466
|
-
export declare const DEFAULT_SECURITY_POLICY: SecurityPolicy;
|
|
467
|
-
/**
|
|
468
|
-
* Default bundle options.
|
|
469
|
-
*/
|
|
470
|
-
export declare const DEFAULT_BUNDLE_OPTIONS: Required<Pick<BundleOptions, 'sourceType' | 'format' | 'minify' | 'sourceMaps' | 'externals' | 'jsx' | 'target' | 'globalName' | 'skipCache'>>;
|
|
471
|
-
/**
|
|
472
|
-
* Default bundler options.
|
|
473
|
-
*/
|
|
474
|
-
export declare const DEFAULT_BUNDLER_OPTIONS: Required<BundlerOptions>;
|
|
475
|
-
/**
|
|
476
|
-
* Target platform for CDN selection.
|
|
477
|
-
* Affects which CDN URLs are used for externals.
|
|
478
|
-
*
|
|
479
|
-
* - 'auto': Auto-detect from environment (default)
|
|
480
|
-
* - 'openai': OpenAI ChatGPT/Plugins - uses esm.sh
|
|
481
|
-
* - 'claude': Claude Artifacts - uses cdnjs.cloudflare.com (only trusted CDN)
|
|
482
|
-
* - 'cursor': Cursor IDE - uses esm.sh
|
|
483
|
-
* - 'ext-apps': MCP Apps (SEP-1865) - uses esm.sh
|
|
484
|
-
* - 'generic': Generic platform - uses esm.sh with frontmcp/* namespace
|
|
485
|
-
*/
|
|
486
|
-
export type TargetPlatform = 'auto' | 'openai' | 'claude' | 'cursor' | 'ext-apps' | 'generic';
|
|
487
|
-
/**
|
|
488
|
-
* Concrete platform type (excludes 'auto').
|
|
489
|
-
* Used for multi-platform builds where a specific platform must be targeted.
|
|
490
|
-
*/
|
|
491
|
-
export type ConcretePlatform = Exclude<TargetPlatform, 'auto'>;
|
|
492
|
-
/**
|
|
493
|
-
* All platforms that can be targeted for multi-platform builds.
|
|
494
|
-
* Order: OpenAI, Claude, Cursor, ext-apps, Generic
|
|
495
|
-
*/
|
|
496
|
-
export declare const ALL_PLATFORMS: readonly ConcretePlatform[];
|
|
497
|
-
/**
|
|
498
|
-
* Configuration for external dependencies in static HTML bundling.
|
|
499
|
-
* Each dependency can be:
|
|
500
|
-
* - 'cdn': Load from platform-appropriate CDN (default)
|
|
501
|
-
* - 'inline': Embed script content directly in HTML
|
|
502
|
-
* - string: Custom CDN URL
|
|
503
|
-
*/
|
|
504
|
-
export interface StaticHTMLExternalConfig {
|
|
505
|
-
/**
|
|
506
|
-
* React runtime configuration.
|
|
507
|
-
* @default 'cdn' - Uses esm.sh for most platforms, cdnjs for Claude
|
|
508
|
-
*/
|
|
509
|
-
react?: 'cdn' | 'inline' | string;
|
|
510
|
-
/**
|
|
511
|
-
* react-dom/client runtime configuration.
|
|
512
|
-
* @default 'cdn' - Uses esm.sh for most platforms, cdnjs for Claude
|
|
513
|
-
*/
|
|
514
|
-
reactDom?: 'cdn' | 'inline' | string;
|
|
515
|
-
/**
|
|
516
|
-
* Tailwind CSS configuration.
|
|
517
|
-
* @default 'cdn' - Uses jsdelivr for most platforms, cdnjs for Claude
|
|
518
|
-
*/
|
|
519
|
-
tailwind?: 'cdn' | 'inline' | string;
|
|
520
|
-
/**
|
|
521
|
-
* FrontMCP UI components (Card, Badge, Button, etc.) and hooks.
|
|
522
|
-
* @default 'inline' - Always inlined for reliability
|
|
523
|
-
*/
|
|
524
|
-
frontmcpUi?: 'cdn' | 'inline' | string;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Options for bundling a component to static HTML.
|
|
528
|
-
*/
|
|
529
|
-
export interface StaticHTMLOptions {
|
|
530
|
-
/**
|
|
531
|
-
* Source code of the component (JSX/TSX).
|
|
532
|
-
*/
|
|
533
|
-
source: string;
|
|
534
|
-
/**
|
|
535
|
-
* Source type for the component.
|
|
536
|
-
* @default 'auto' - Auto-detect from content
|
|
537
|
-
*/
|
|
538
|
-
sourceType?: SourceType;
|
|
539
|
-
/**
|
|
540
|
-
* Tool name (used for page title and data injection).
|
|
541
|
-
*/
|
|
542
|
-
toolName: string;
|
|
543
|
-
/**
|
|
544
|
-
* Tool input arguments to embed in HTML.
|
|
545
|
-
*/
|
|
546
|
-
input?: Record<string, unknown>;
|
|
547
|
-
/**
|
|
548
|
-
* Tool output to embed in HTML.
|
|
549
|
-
*/
|
|
550
|
-
output?: unknown;
|
|
551
|
-
/**
|
|
552
|
-
* Structured content to embed in HTML.
|
|
553
|
-
*/
|
|
554
|
-
structuredContent?: unknown;
|
|
555
|
-
/**
|
|
556
|
-
* External dependency configuration.
|
|
557
|
-
* Controls whether dependencies are loaded from CDN or inlined.
|
|
558
|
-
*/
|
|
559
|
-
externals?: StaticHTMLExternalConfig;
|
|
560
|
-
/**
|
|
561
|
-
* Target platform for CDN selection.
|
|
562
|
-
* @default 'auto'
|
|
563
|
-
*/
|
|
564
|
-
targetPlatform?: TargetPlatform;
|
|
565
|
-
/**
|
|
566
|
-
* Page title.
|
|
567
|
-
* @default `${toolName} - Widget`
|
|
568
|
-
*/
|
|
569
|
-
title?: string;
|
|
570
|
-
/**
|
|
571
|
-
* Whether the widget can call tools via the bridge.
|
|
572
|
-
* @default false
|
|
573
|
-
*/
|
|
574
|
-
widgetAccessible?: boolean;
|
|
575
|
-
/**
|
|
576
|
-
* Minify the transpiled component code.
|
|
577
|
-
* @default true
|
|
578
|
-
*/
|
|
579
|
-
minify?: boolean;
|
|
580
|
-
/**
|
|
581
|
-
* Security policy for transpilation.
|
|
582
|
-
*/
|
|
583
|
-
security?: SecurityPolicy;
|
|
584
|
-
/**
|
|
585
|
-
* Skip bundle cache lookup.
|
|
586
|
-
* @default false
|
|
587
|
-
*/
|
|
588
|
-
skipCache?: boolean;
|
|
589
|
-
/**
|
|
590
|
-
* Root element ID for React rendering.
|
|
591
|
-
* @default 'frontmcp-widget-root'
|
|
592
|
-
*/
|
|
593
|
-
rootId?: string;
|
|
594
|
-
/**
|
|
595
|
-
* Custom CSS to inject after Tailwind CSS.
|
|
596
|
-
* Can be used to add component-specific styles or override Tailwind defaults.
|
|
597
|
-
*
|
|
598
|
-
* @example
|
|
599
|
-
* ```typescript
|
|
600
|
-
* customCss: `
|
|
601
|
-
* .custom-card { border-radius: 12px; }
|
|
602
|
-
* h2 { font-size: 1.5rem; font-weight: 600; }
|
|
603
|
-
* `
|
|
604
|
-
* ```
|
|
605
|
-
*/
|
|
606
|
-
customCss?: string;
|
|
607
|
-
/**
|
|
608
|
-
* Theme configuration for CSS variables.
|
|
609
|
-
* When provided, theme CSS variables (--color-primary, --color-border, etc.)
|
|
610
|
-
* will be injected into the HTML as :root CSS variables.
|
|
611
|
-
*
|
|
612
|
-
* If not provided, uses DEFAULT_THEME from @frontmcp/uipack.
|
|
613
|
-
*
|
|
614
|
-
* @example
|
|
615
|
-
* ```typescript
|
|
616
|
-
* import { createTheme, DEFAULT_THEME } from '@frontmcp/uipack/theme';
|
|
617
|
-
*
|
|
618
|
-
* // Use default theme
|
|
619
|
-
* theme: DEFAULT_THEME
|
|
620
|
-
*
|
|
621
|
-
* // Or create custom theme
|
|
622
|
-
* theme: createTheme({
|
|
623
|
-
* colors: { semantic: { primary: '#0969da' } }
|
|
624
|
-
* })
|
|
625
|
-
* ```
|
|
626
|
-
*/
|
|
627
|
-
theme?: ThemeConfig;
|
|
628
|
-
/**
|
|
629
|
-
* Enable universal rendering mode.
|
|
630
|
-
* When true, the bundler generates a universal React app that can
|
|
631
|
-
* render multiple content types (HTML, Markdown, React, MDX) with
|
|
632
|
-
* auto-detection.
|
|
633
|
-
*
|
|
634
|
-
* @default false
|
|
635
|
-
*/
|
|
636
|
-
universal?: boolean;
|
|
637
|
-
/**
|
|
638
|
-
* Content type for universal mode.
|
|
639
|
-
* Only used when `universal: true`.
|
|
640
|
-
*
|
|
641
|
-
* - 'html': Raw HTML (rendered with dangerouslySetInnerHTML)
|
|
642
|
-
* - 'markdown': Markdown content (rendered with react-markdown)
|
|
643
|
-
* - 'react': React component (rendered directly)
|
|
644
|
-
* - 'mdx': MDX content (Markdown + JSX)
|
|
645
|
-
*
|
|
646
|
-
* @default 'auto' - Auto-detect from content
|
|
647
|
-
*/
|
|
648
|
-
contentType?: 'html' | 'markdown' | 'react' | 'mdx' | 'auto';
|
|
649
|
-
/**
|
|
650
|
-
* Include markdown renderer in universal mode.
|
|
651
|
-
* Adds react-markdown from esm.sh (~15KB gzipped).
|
|
652
|
-
* For Claude (UMD mode), uses inline minimal parser instead.
|
|
653
|
-
*
|
|
654
|
-
* @default false
|
|
655
|
-
*/
|
|
656
|
-
includeMarkdown?: boolean;
|
|
657
|
-
/**
|
|
658
|
-
* Include MDX renderer in universal mode.
|
|
659
|
-
* Adds @mdx-js/react from esm.sh (~40KB gzipped).
|
|
660
|
-
* Note: MDX is not available on Claude (no cdnjs package).
|
|
661
|
-
*
|
|
662
|
-
* @default false
|
|
663
|
-
*/
|
|
664
|
-
includeMdx?: boolean;
|
|
665
|
-
/**
|
|
666
|
-
* Custom components available for Markdown/MDX rendering.
|
|
667
|
-
* Provided as inline JavaScript code that defines the components.
|
|
668
|
-
*
|
|
669
|
-
* @example
|
|
670
|
-
* ```typescript
|
|
671
|
-
* customComponents: `
|
|
672
|
-
* const WeatherCard = ({ temp }) => (
|
|
673
|
-
* React.createElement('div', { className: 'text-4xl' }, temp + '°F')
|
|
674
|
-
* );
|
|
675
|
-
* window.__frontmcp.components = { WeatherCard };
|
|
676
|
-
* `
|
|
677
|
-
* ```
|
|
678
|
-
*/
|
|
679
|
-
customComponents?: string;
|
|
680
|
-
/**
|
|
681
|
-
* Build mode for data injection.
|
|
682
|
-
* - 'static': Data baked in at build time (default)
|
|
683
|
-
* - 'dynamic': Subscribes to platform events for updates (OpenAI)
|
|
684
|
-
* - 'hybrid': Shell with placeholder for runtime data injection
|
|
685
|
-
* @default 'static'
|
|
686
|
-
*/
|
|
687
|
-
buildMode?: BuildMode;
|
|
688
|
-
/**
|
|
689
|
-
* Options for dynamic build mode.
|
|
690
|
-
* Only used when buildMode is 'dynamic'.
|
|
691
|
-
*/
|
|
692
|
-
dynamicOptions?: DynamicModeOptions;
|
|
693
|
-
/**
|
|
694
|
-
* Options for hybrid build mode.
|
|
695
|
-
* Only used when buildMode is 'hybrid'.
|
|
696
|
-
*/
|
|
697
|
-
hybridOptions?: HybridModeOptions;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Result of bundling a component to static HTML.
|
|
701
|
-
*/
|
|
702
|
-
export interface StaticHTMLResult {
|
|
703
|
-
/**
|
|
704
|
-
* Complete HTML document ready for rendering.
|
|
705
|
-
*/
|
|
706
|
-
html: string;
|
|
707
|
-
/**
|
|
708
|
-
* Transpiled component code (for debugging/inspection).
|
|
709
|
-
*/
|
|
710
|
-
componentCode: string;
|
|
711
|
-
/**
|
|
712
|
-
* Bundle metrics from transpilation.
|
|
713
|
-
*/
|
|
714
|
-
metrics: BundleMetrics;
|
|
715
|
-
/**
|
|
716
|
-
* Content hash of the HTML document.
|
|
717
|
-
*/
|
|
718
|
-
hash: string;
|
|
719
|
-
/**
|
|
720
|
-
* HTML document size in bytes.
|
|
721
|
-
*/
|
|
722
|
-
size: number;
|
|
723
|
-
/**
|
|
724
|
-
* Whether the component was served from cache.
|
|
725
|
-
*/
|
|
726
|
-
cached: boolean;
|
|
727
|
-
/**
|
|
728
|
-
* Detected source type.
|
|
729
|
-
*/
|
|
730
|
-
sourceType: SourceType;
|
|
731
|
-
/**
|
|
732
|
-
* Target platform used for CDN selection.
|
|
733
|
-
*/
|
|
734
|
-
targetPlatform: TargetPlatform;
|
|
735
|
-
/**
|
|
736
|
-
* Whether universal rendering mode was used.
|
|
737
|
-
*/
|
|
738
|
-
universal?: boolean;
|
|
739
|
-
/**
|
|
740
|
-
* Content type detected/used (when universal mode is enabled).
|
|
741
|
-
*/
|
|
742
|
-
contentType?: 'html' | 'markdown' | 'react' | 'mdx';
|
|
743
|
-
/**
|
|
744
|
-
* Build mode used for data injection.
|
|
745
|
-
*/
|
|
746
|
-
buildMode?: BuildMode;
|
|
747
|
-
/**
|
|
748
|
-
* For hybrid mode: the output placeholder string that can be replaced with data.
|
|
749
|
-
* Use injectHybridData() from @frontmcp/uipack to replace this placeholder.
|
|
750
|
-
*/
|
|
751
|
-
dataPlaceholder?: string;
|
|
752
|
-
/**
|
|
753
|
-
* For hybrid mode: the input placeholder string that can be replaced with data.
|
|
754
|
-
* Use injectHybridDataFull() from @frontmcp/uipack to replace both placeholders.
|
|
755
|
-
*/
|
|
756
|
-
inputPlaceholder?: string;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* CDN URLs for different platforms.
|
|
760
|
-
* - esm: ES modules (OpenAI, Cursor, generic)
|
|
761
|
-
* - umd: UMD globals (Claude - only trusts cdnjs.cloudflare.com)
|
|
762
|
-
*/
|
|
763
|
-
export declare const STATIC_HTML_CDN: {
|
|
764
|
-
/**
|
|
765
|
-
* ES modules from esm.sh (React 19, modern platforms)
|
|
766
|
-
*/
|
|
767
|
-
readonly esm: {
|
|
768
|
-
readonly react: "https://esm.sh/react@19";
|
|
769
|
-
readonly reactDom: "https://esm.sh/react-dom@19/client";
|
|
770
|
-
};
|
|
771
|
-
/**
|
|
772
|
-
* UMD builds from cdnjs (React 18.2, Claude only trusts cloudflare)
|
|
773
|
-
*/
|
|
774
|
-
readonly umd: {
|
|
775
|
-
readonly react: "https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js";
|
|
776
|
-
readonly reactDom: "https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js";
|
|
777
|
-
};
|
|
778
|
-
/**
|
|
779
|
-
* Font CDN URLs
|
|
780
|
-
*/
|
|
781
|
-
readonly fonts: {
|
|
782
|
-
readonly preconnect: readonly ["https://fonts.googleapis.com", "https://fonts.gstatic.com"];
|
|
783
|
-
readonly inter: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";
|
|
784
|
-
};
|
|
785
|
-
};
|
|
786
|
-
/**
|
|
787
|
-
* Get the CDN type for a target platform.
|
|
788
|
-
* @param platform - Target platform
|
|
789
|
-
* @returns 'esm' for ES modules, 'umd' for UMD globals
|
|
790
|
-
*/
|
|
791
|
-
export declare function getCdnTypeForPlatform(platform: TargetPlatform): 'esm' | 'umd';
|
|
792
|
-
/**
|
|
793
|
-
* Default static HTML options.
|
|
794
|
-
*/
|
|
795
|
-
export declare const DEFAULT_STATIC_HTML_OPTIONS: {
|
|
796
|
-
readonly sourceType: SourceType;
|
|
797
|
-
readonly targetPlatform: TargetPlatform;
|
|
798
|
-
readonly minify: true;
|
|
799
|
-
readonly skipCache: false;
|
|
800
|
-
readonly rootId: "frontmcp-widget-root";
|
|
801
|
-
readonly widgetAccessible: false;
|
|
802
|
-
readonly externals: {
|
|
803
|
-
readonly react: "cdn";
|
|
804
|
-
readonly reactDom: "cdn";
|
|
805
|
-
readonly tailwind: "cdn";
|
|
806
|
-
readonly frontmcpUi: "inline";
|
|
807
|
-
};
|
|
808
|
-
readonly universal: false;
|
|
809
|
-
readonly contentType: "auto";
|
|
810
|
-
readonly includeMarkdown: false;
|
|
811
|
-
readonly includeMdx: false;
|
|
812
|
-
readonly buildMode: BuildMode;
|
|
813
|
-
};
|
|
814
|
-
/**
|
|
815
|
-
* Internal type for merged static HTML options.
|
|
816
|
-
* Used by bundler methods after merging user options with defaults.
|
|
817
|
-
*/
|
|
818
|
-
export type MergedStaticHTMLOptions = Required<Pick<StaticHTMLOptions, 'sourceType' | 'targetPlatform' | 'minify' | 'skipCache' | 'rootId' | 'widgetAccessible' | 'externals' | 'universal' | 'contentType' | 'includeMarkdown' | 'includeMdx' | 'buildMode'>> & Pick<StaticHTMLOptions, 'toolName' | 'input' | 'output' | 'structuredContent' | 'title' | 'security' | 'customCss' | 'customComponents' | 'theme' | 'dynamicOptions' | 'hybridOptions'>;
|
|
819
|
-
/**
|
|
820
|
-
* Options for building for multiple platforms at once.
|
|
821
|
-
* Extends StaticHTMLOptions but replaces targetPlatform with platforms array.
|
|
822
|
-
*/
|
|
823
|
-
export interface MultiPlatformBuildOptions extends Omit<StaticHTMLOptions, 'targetPlatform'> {
|
|
824
|
-
/**
|
|
825
|
-
* Platforms to build for.
|
|
826
|
-
* @default ALL_PLATFORMS (all 5 platforms)
|
|
827
|
-
*/
|
|
828
|
-
platforms?: ConcretePlatform[];
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Result for a single platform in multi-platform build.
|
|
832
|
-
* Extends StaticHTMLResult with platform-specific metadata.
|
|
833
|
-
*/
|
|
834
|
-
export interface PlatformBuildResult extends StaticHTMLResult {
|
|
835
|
-
/**
|
|
836
|
-
* Platform-specific metadata for tool response _meta field.
|
|
837
|
-
* Ready to merge into MCP response.
|
|
838
|
-
*
|
|
839
|
-
* Contains namespace-prefixed fields like:
|
|
840
|
-
* - OpenAI: openai/html, openai/mimeType, etc.
|
|
841
|
-
* - Claude: frontmcp/html, claude/widgetDescription, etc.
|
|
842
|
-
* - Generic: frontmcp/html, frontmcp/widgetAccessible, etc.
|
|
843
|
-
* - ext-apps: ui/html, ui/mimeType, ui/csp, etc.
|
|
844
|
-
*/
|
|
845
|
-
meta: Record<string, unknown>;
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Result of building for multiple platforms.
|
|
849
|
-
* Contains all platform-specific builds with shared metrics.
|
|
850
|
-
*/
|
|
851
|
-
export interface MultiPlatformBuildResult {
|
|
852
|
-
/**
|
|
853
|
-
* Results keyed by platform name.
|
|
854
|
-
* Each platform has its own HTML and metadata.
|
|
855
|
-
*
|
|
856
|
-
* @remarks
|
|
857
|
-
* Only platforms specified in `options.platforms` are included.
|
|
858
|
-
* If no platforms are specified, all platforms are built.
|
|
859
|
-
* Use `Object.keys(result.platforms)` to see which platforms were built.
|
|
860
|
-
*/
|
|
861
|
-
platforms: Partial<Record<ConcretePlatform, PlatformBuildResult>>;
|
|
862
|
-
/**
|
|
863
|
-
* Shared component code (transpiled once, reused).
|
|
864
|
-
* All platforms share this code to avoid redundant transpilation.
|
|
865
|
-
*/
|
|
866
|
-
sharedComponentCode: string;
|
|
867
|
-
/**
|
|
868
|
-
* Multi-platform build metrics.
|
|
869
|
-
*/
|
|
870
|
-
metrics: {
|
|
871
|
-
/** Time to transpile component (once) in ms */
|
|
872
|
-
transpileTime: number;
|
|
873
|
-
/** Time to generate all platform variants in ms */
|
|
874
|
-
generationTime: number;
|
|
875
|
-
/** Total time in ms */
|
|
876
|
-
totalTime: number;
|
|
877
|
-
};
|
|
878
|
-
/**
|
|
879
|
-
* Whether component was served from cache.
|
|
880
|
-
*/
|
|
881
|
-
cached: boolean;
|
|
882
|
-
}
|
|
883
|
-
//# sourceMappingURL=types.d.ts.map
|