open-mcp-app 0.0.2 → 0.0.4
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/dist/core/index.d.ts +27 -96
- package/dist/core/index.js +126 -341
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.d.ts +1 -10
- package/dist/server/index.js +43 -60
- package/dist/server/index.js.map +1 -1
- package/dist/styles/base.css +745 -0
- package/dist/vite/index.d.ts +48 -10
- package/dist/vite/index.js +2 -1
- package/dist/vite/index.js.map +1 -1
- package/package.json +4 -2
package/dist/core/index.d.ts
CHANGED
|
@@ -903,118 +903,49 @@ declare class StandaloneHostClient extends Subscribable implements UnifiedHostCl
|
|
|
903
903
|
}
|
|
904
904
|
|
|
905
905
|
/**
|
|
906
|
-
*
|
|
906
|
+
* SDK Layout Variables
|
|
907
907
|
*
|
|
908
|
-
* This module provides
|
|
909
|
-
*
|
|
908
|
+
* This module provides SDK-only CSS variables for spacing, containers, and component sizing.
|
|
909
|
+
* These are NOT part of the MCP Apps spec - they are convenient defaults for clean layouts.
|
|
910
910
|
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
911
|
+
* Host-provided spec variables (colors, typography, etc.) are applied automatically
|
|
912
|
+
* when the app initializes via hostContext.styles.variables. Apps are not shown until
|
|
913
|
+
* initialization is complete, so there's no need for pre-host defaults.
|
|
914
914
|
*
|
|
915
|
-
*
|
|
916
|
-
* 1.
|
|
917
|
-
* 2.
|
|
918
|
-
* 3. Inject defaults immediately on document.documentElement
|
|
919
|
-
* 4. When host connects, host variables override these defaults
|
|
920
|
-
*
|
|
921
|
-
* IMPORTANT: MCP Apps defaults match Creature's actual values exactly.
|
|
922
|
-
* The observer only runs for ChatGPT (MCP Apps hosts handle theme changes themselves).
|
|
923
|
-
*/
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Theme mode for styling.
|
|
927
|
-
*/
|
|
928
|
-
type Theme = "light" | "dark";
|
|
929
|
-
/**
|
|
930
|
-
* Options for initializing styles.
|
|
931
|
-
*/
|
|
932
|
-
interface InitStylesOptions {
|
|
933
|
-
/** Whether to set up a MutationObserver for dynamic theme changes. Default: true for ChatGPT only */
|
|
934
|
-
observeThemeChanges?: boolean;
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* MCP Apps / Creature default values - DARK mode.
|
|
938
|
-
* These values are extracted directly from Creature's globals.css.
|
|
939
|
-
* They MUST match exactly what Creature sends via hostContext.styles.variables.
|
|
940
|
-
*/
|
|
941
|
-
declare const MCP_APPS_DARK_DEFAULTS: Record<string, string>;
|
|
942
|
-
/**
|
|
943
|
-
* MCP Apps / Creature default values - LIGHT mode.
|
|
944
|
-
* These values are extracted directly from Creature's globals.css.
|
|
945
|
-
*/
|
|
946
|
-
declare const MCP_APPS_LIGHT_DEFAULTS: Record<string, string>;
|
|
947
|
-
/**
|
|
948
|
-
* Shared MCP Apps / Creature typography and layout tokens (same for light/dark).
|
|
949
|
-
* These values are extracted directly from Creature's globals.css.
|
|
950
|
-
*/
|
|
951
|
-
declare const MCP_APPS_SHARED_DEFAULTS: Record<string, string>;
|
|
952
|
-
/**
|
|
953
|
-
* ChatGPT Apps default values - LIGHT mode.
|
|
954
|
-
* Ported from @openai/apps-sdk-ui design tokens.
|
|
955
|
-
*/
|
|
956
|
-
declare const CHATGPT_LIGHT_DEFAULTS: Record<string, string>;
|
|
957
|
-
/**
|
|
958
|
-
* ChatGPT Apps default values - DARK mode.
|
|
959
|
-
*/
|
|
960
|
-
declare const CHATGPT_DARK_DEFAULTS: Record<string, string>;
|
|
961
|
-
/**
|
|
962
|
-
* Shared ChatGPT typography and layout tokens (same for light/dark).
|
|
963
|
-
*/
|
|
964
|
-
declare const CHATGPT_SHARED_DEFAULTS: Record<string, string>;
|
|
965
|
-
/**
|
|
966
|
-
* Get MCP Apps default styles for the specified theme.
|
|
967
|
-
* Returns CSS variable names with their default values.
|
|
968
|
-
* These values match exactly what Creature sends via hostContext.styles.variables.
|
|
969
|
-
*
|
|
970
|
-
* @param theme - The theme to get defaults for
|
|
971
|
-
* @returns Record of CSS variable names to their values
|
|
972
|
-
*/
|
|
973
|
-
declare const getMcpAppDefaultStyles: ({ theme }: {
|
|
974
|
-
theme: Theme;
|
|
975
|
-
}) => Record<string, string>;
|
|
976
|
-
/**
|
|
977
|
-
* Get ChatGPT Apps default styles for the specified theme.
|
|
978
|
-
* Returns CSS variable names with their values matching the @openai/apps-sdk-ui design tokens.
|
|
979
|
-
*
|
|
980
|
-
* @param theme - The theme to get defaults for
|
|
981
|
-
* @returns Record of CSS variable names to their values
|
|
915
|
+
* Usage:
|
|
916
|
+
* 1. Import base.css which uses these variables
|
|
917
|
+
* 2. Or apply them manually via applyLayoutDefaults()
|
|
982
918
|
*/
|
|
983
|
-
declare const getChatGptDefaultStyles: ({ theme }: {
|
|
984
|
-
theme: Theme;
|
|
985
|
-
}) => Record<string, string>;
|
|
986
919
|
/**
|
|
987
|
-
*
|
|
988
|
-
*
|
|
920
|
+
* SDK-only layout variables for spacing, containers, and component sizing.
|
|
921
|
+
* These are NOT part of the MCP Apps spec but provide sensible defaults
|
|
922
|
+
* for clean layouts.
|
|
989
923
|
*
|
|
990
|
-
*
|
|
924
|
+
* Based on a 4px (0.25rem) base unit, similar to Tailwind's spacing scale.
|
|
925
|
+
* Component sizing follows patterns from @openai/apps-sdk-ui for consistency.
|
|
991
926
|
*/
|
|
992
|
-
declare const
|
|
927
|
+
declare const LAYOUT_DEFAULTS: Record<string, string>;
|
|
993
928
|
/**
|
|
994
|
-
* Apply CSS variables to
|
|
929
|
+
* Apply CSS variables to an element (defaults to document root).
|
|
995
930
|
*
|
|
996
931
|
* @param styles - Record of CSS variable names to their values
|
|
932
|
+
* @param root - Element to apply styles to (defaults to document.documentElement)
|
|
997
933
|
*/
|
|
998
|
-
declare const applyStyles: ({ styles }: {
|
|
934
|
+
declare const applyStyles: ({ styles, root, }: {
|
|
999
935
|
styles: Record<string, string>;
|
|
936
|
+
root?: HTMLElement;
|
|
1000
937
|
}) => void;
|
|
1001
938
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
* This
|
|
939
|
+
* Apply SDK layout defaults to the document.
|
|
940
|
+
* This applies spacing, container, and control variables.
|
|
1004
941
|
*
|
|
1005
|
-
*
|
|
1006
|
-
*
|
|
942
|
+
* Note: If you import base.css, these variables are already defined via :root.
|
|
943
|
+
* Only call this manually if you need to apply them programmatically or
|
|
944
|
+
* to a specific element other than document root.
|
|
1007
945
|
*
|
|
1008
|
-
*
|
|
1009
|
-
* since ChatGPT may change theme before sending new hostContext.
|
|
1010
|
-
*
|
|
1011
|
-
* @param environment - The detected environment (from detectEnvironment)
|
|
1012
|
-
* @param options - Configuration options
|
|
946
|
+
* @param root - Element to apply styles to (defaults to document.documentElement)
|
|
1013
947
|
*/
|
|
1014
|
-
declare const
|
|
1015
|
-
environment: Environment;
|
|
1016
|
-
options?: InitStylesOptions;
|
|
1017
|
-
}) => void;
|
|
948
|
+
declare const applyLayoutDefaults: (root?: HTMLElement) => void;
|
|
1018
949
|
|
|
1019
950
|
/**
|
|
1020
951
|
* Create a WebSocket client with automatic reconnection.
|
|
@@ -1092,4 +1023,4 @@ declare const createHost: (config: HostClientConfig) => UnifiedHostClient;
|
|
|
1092
1023
|
*/
|
|
1093
1024
|
declare const createHostAsync: (config: HostClientConfig) => Promise<UnifiedHostClient>;
|
|
1094
1025
|
|
|
1095
|
-
export {
|
|
1026
|
+
export { ChatGptWebHostClient, ClaudeDesktopHostClient, type ContentBlock, CreatureDesktopHostClient, type DisplayMode, type Environment, type ExpHostApi, type HostClientConfig, type HostClientEvents, type HostClientState, type HostContext, type ImageContentBlock, LAYOUT_DEFAULTS, type LogLevel, type OpenContext, StandaloneHostClient, type StateListener, type StructuredWidgetState, type TextContentBlock, type ToolResult, type UnifiedHostClient, type WebSocketClient, type WebSocketClientConfig, type WebSocketStatus, type WidgetState, applyLayoutDefaults, applyStyles, createHost, createHostAsync, createWebSocket, detectEnvironment };
|