@pancake-apps/web 0.0.0-snapshot-20260125200133
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 +333 -0
- package/dist/adaptor-interface-BYbH9PpT.d.ts +370 -0
- package/dist/apps-sdk/index.d.ts +1 -0
- package/dist/apps-sdk/index.js +4 -0
- package/dist/apps-sdk/index.js.map +1 -0
- package/dist/chunk-5NYJ2IVD.js +406 -0
- package/dist/chunk-5NYJ2IVD.js.map +1 -0
- package/dist/chunk-7HJ5PKKT.js +146 -0
- package/dist/chunk-7HJ5PKKT.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-TLBYYZHP.js +715 -0
- package/dist/chunk-TLBYYZHP.js.map +1 -0
- package/dist/chunk-YGGRUIUG.js +977 -0
- package/dist/chunk-YGGRUIUG.js.map +1 -0
- package/dist/chunk-ZYBPDIEG.js +674 -0
- package/dist/chunk-ZYBPDIEG.js.map +1 -0
- package/dist/core/index.d.ts +169 -0
- package/dist/core/index.js +195 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index-BBfZZJWn.d.ts +671 -0
- package/dist/index-CpXDfXKD.d.ts +395 -0
- package/dist/index-DtukOUjY.d.ts +738 -0
- package/dist/index.d.ts +741 -0
- package/dist/index.js +685 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-apps/index.d.ts +2 -0
- package/dist/mcp-apps/index.js +4 -0
- package/dist/mcp-apps/index.js.map +1 -0
- package/dist/notify-size-changed-Ck2BGfUk.d.ts +270 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +7 -0
- package/dist/react/index.js.map +1 -0
- package/dist/types-B_O3kZYh.d.ts +253 -0
- package/package.json +90 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
import { m as UseViewDataResult, n as UseActionResult, o as UseDataOptions, p as UseDataResult, T as Theme, a as DeviceType, P as Platform, S as SafeAreaInsets, D as DisplayMode, C as ContainerSize, I as InputCapabilities, q as UseCallToolResult, r as UseCallToolCallbacks, s as UseViewParamsResult, t as ActionStatus, A as ActionTool, u as AdaptorStoreKey, v as AdaptorStoreState, c as CallToolResult, w as CallToolStatus, d as ContentBlock, x as DataStatus, k as DataTool, E as ExternalStore, F as Feature, L as LogLevel, R as ResourceContent, f as ResourceReadResult, h as ResourceTeardownParams, j as TeardownHandler, e as ToolResponseMetadata, l as UnifiedAdaptor, U as UpdateModelContextParams, y as UseActionCallbacks, V as ViewDataStatus, z as ViewParamsStatus, g as getPlatform, i as isAppsSdkAvailable, b as isMcpAppsAvailable } from './adaptor-interface-BYbH9PpT.js';
|
|
2
|
+
import { b as action, c as callTool, d as data, t as getAdaptor, i as isSupported, l as log, f as logDebug, j as logError, g as logInfo, h as logWarning, n as navigateToView, m as notifySizeChanged, k as onTeardown, o as openExternal, p as ping, e as readResource, r as requestDisplayMode, v as resetAdaptor, a as say, s as sendFollowUpMessage, q as setupAutoSizeReporting, u as updateModelContext } from './notify-size-changed-Ck2BGfUk.js';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
import { T as ToolResultParams, U as UseHostStylesOptions, a as UseViewOptions, b as UseViewResult, V as View, c as ViewAppInfo, d as ViewOptions, e as createView, u as useDocumentTheme, f as useDocumentThemeState, g as useHostFontsHook, h as useHostStyles, i as useHostTheme, j as useHostVariables, k as useSystemColorScheme, l as useView } from './index-CpXDfXKD.js';
|
|
5
|
+
import { S as StyleVariables, H as HostContext } from './types-B_O3kZYh.js';
|
|
6
|
+
import { a as appsSdk } from './index-BBfZZJWn.js';
|
|
7
|
+
import { m as mcpApps } from './index-DtukOUjY.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Primary semantic hook for accessing view data (Tier 0)
|
|
11
|
+
*
|
|
12
|
+
* Combines tool input, output, and metadata into a single unified interface
|
|
13
|
+
* with status tracking for easy conditional rendering.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* function MyView() {
|
|
18
|
+
* const { status, input, output, isReady, isError, error } = useViewData<InputType, OutputType>();
|
|
19
|
+
*
|
|
20
|
+
* if (status === 'idle') return <Loading />;
|
|
21
|
+
* if (status === 'streaming') return <StreamingPreview partial={inputPartial} />;
|
|
22
|
+
* if (status === 'pending') return <Processing />;
|
|
23
|
+
* if (isError) return <Error message={error?.message} />;
|
|
24
|
+
* if (isReady) return <Result data={output} />;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function useViewData<TInput = Record<string, unknown>, TOutput = unknown, TMeta = Record<string, unknown>>(): UseViewDataResult<TInput, TOutput, TMeta>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Hook for executing action tools (Tier 0 Semantic API)
|
|
32
|
+
*
|
|
33
|
+
* Actions are side-effect tools that mutate state. This hook provides
|
|
34
|
+
* status tracking and convenient execution methods.
|
|
35
|
+
*
|
|
36
|
+
* Use for: save, delete, update, navigate, send, submit
|
|
37
|
+
*
|
|
38
|
+
* @param toolName - Name of the action tool
|
|
39
|
+
* @returns Object with status, execute functions, and reset
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* function DeleteButton({ id }: { id: string }) {
|
|
44
|
+
* const { isPending, isError, error, execute } = useAction<{ id: string }>('delete-item');
|
|
45
|
+
*
|
|
46
|
+
* return (
|
|
47
|
+
* <>
|
|
48
|
+
* <button
|
|
49
|
+
* onClick={() => execute(
|
|
50
|
+
* { id },
|
|
51
|
+
* { onSuccess: () => console.log('Deleted!') }
|
|
52
|
+
* )}
|
|
53
|
+
* disabled={isPending}
|
|
54
|
+
* >
|
|
55
|
+
* {isPending ? 'Deleting...' : 'Delete'}
|
|
56
|
+
* </button>
|
|
57
|
+
* {isError && <p>Error: {error?.message}</p>}
|
|
58
|
+
* </>
|
|
59
|
+
* );
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function useAction<TInput = void>(toolName: string): UseActionResult<TInput>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Hook for fetching data from tools (Tier 0 Semantic API)
|
|
67
|
+
*
|
|
68
|
+
* Data tools are read-only queries that return structured data. This hook
|
|
69
|
+
* provides status tracking, caching, and convenient fetch methods.
|
|
70
|
+
*
|
|
71
|
+
* Use for: search, get, list, fetch
|
|
72
|
+
*
|
|
73
|
+
* @param toolName - Name of the data tool
|
|
74
|
+
* @param defaultInput - Default input to use for fetches
|
|
75
|
+
* @param options - Configuration options
|
|
76
|
+
* @returns Object with status, data, fetch functions, and cache controls
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* function SearchResults({ query }: { query: string }) {
|
|
81
|
+
* const { data, isPending, isStale, refetch } = useData<{ q: string }, Result[]>(
|
|
82
|
+
* 'search',
|
|
83
|
+
* { q: query },
|
|
84
|
+
* { staleTime: 30000, refetchOnWindowFocus: true }
|
|
85
|
+
* );
|
|
86
|
+
*
|
|
87
|
+
* return (
|
|
88
|
+
* <div>
|
|
89
|
+
* {isPending && <Loading />}
|
|
90
|
+
* {isStale && <span>Refreshing...</span>}
|
|
91
|
+
* {data?.map(item => <Item key={item.id} {...item} />)}
|
|
92
|
+
* <button onClick={refetch}>Refresh</button>
|
|
93
|
+
* </div>
|
|
94
|
+
* );
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
declare function useData<TInput = void, TOutput = unknown>(toolName: string, defaultInput?: TInput, options?: UseDataOptions<TOutput>): UseDataResult<TInput, TOutput>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get the current theme (light or dark)
|
|
102
|
+
*
|
|
103
|
+
* @returns Current theme
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* function MyView() {
|
|
108
|
+
* const theme = useTheme();
|
|
109
|
+
* return <div className={theme === 'dark' ? 'dark' : 'light'}>...</div>;
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function useTheme(): Theme;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get the user's locale setting
|
|
117
|
+
*
|
|
118
|
+
* @returns BCP 47 language tag (e.g., 'en-US')
|
|
119
|
+
*/
|
|
120
|
+
declare function useLocale(): string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get the device type (mobile, tablet, desktop)
|
|
124
|
+
*
|
|
125
|
+
* @returns Device type
|
|
126
|
+
*/
|
|
127
|
+
declare function useDeviceType(): DeviceType;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get the current platform
|
|
131
|
+
*
|
|
132
|
+
* @returns Platform identifier
|
|
133
|
+
*/
|
|
134
|
+
declare function usePlatform(): Platform;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get safe area insets for devices with notches/rounded corners
|
|
138
|
+
*
|
|
139
|
+
* @returns Safe area insets object
|
|
140
|
+
*/
|
|
141
|
+
declare function useSafeArea(): SafeAreaInsets;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Get the maximum height constraint
|
|
145
|
+
*
|
|
146
|
+
* @returns Maximum height in pixels
|
|
147
|
+
*/
|
|
148
|
+
declare function useMaxHeight(): number;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get the current display mode
|
|
152
|
+
*
|
|
153
|
+
* @returns Current display mode
|
|
154
|
+
*/
|
|
155
|
+
declare function useDisplayMode(): DisplayMode;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Get the container size dimensions
|
|
159
|
+
*
|
|
160
|
+
* @returns Container size object with width and height
|
|
161
|
+
*/
|
|
162
|
+
declare function useContainerSize(): ContainerSize;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get input capabilities (keyboard, touch, etc.)
|
|
166
|
+
*
|
|
167
|
+
* @returns Input capabilities object
|
|
168
|
+
*/
|
|
169
|
+
declare function useInputCapabilities(): InputCapabilities;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get the tool input parameters
|
|
173
|
+
*
|
|
174
|
+
* @returns Tool input object or undefined
|
|
175
|
+
*/
|
|
176
|
+
declare function useToolInput<T = unknown>(): T | undefined;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get the tool output
|
|
180
|
+
*
|
|
181
|
+
* @returns Tool output object or undefined
|
|
182
|
+
*/
|
|
183
|
+
declare function useToolOutput<T = unknown>(): T | undefined;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Get metadata about the tool response
|
|
187
|
+
*
|
|
188
|
+
* @returns Tool response metadata or undefined
|
|
189
|
+
*/
|
|
190
|
+
declare function useToolResponseMetadata<T = Record<string, unknown>>(): T | undefined;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Options for the useCallTool hook (alias for UseCallToolCallbacks)
|
|
194
|
+
*/
|
|
195
|
+
type UseCallToolOptions<TOutput> = UseCallToolCallbacks<TOutput>;
|
|
196
|
+
/**
|
|
197
|
+
* Rich hook for calling tools with full state machine
|
|
198
|
+
*
|
|
199
|
+
* @param toolName - Name of the tool to call
|
|
200
|
+
* @returns Object with status, data, error, and call functions
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```tsx
|
|
204
|
+
* function SearchButton() {
|
|
205
|
+
* const { isPending, isError, error, callTool } = useCallTool<
|
|
206
|
+
* { query: string },
|
|
207
|
+
* SearchResult
|
|
208
|
+
* >('search');
|
|
209
|
+
*
|
|
210
|
+
* return (
|
|
211
|
+
* <>
|
|
212
|
+
* <button
|
|
213
|
+
* onClick={() => callTool(
|
|
214
|
+
* { query: 'pancakes' },
|
|
215
|
+
* { onSuccess: (data) => console.log('Found:', data) }
|
|
216
|
+
* )}
|
|
217
|
+
* disabled={isPending}
|
|
218
|
+
* >
|
|
219
|
+
* {isPending ? 'Searching...' : 'Search'}
|
|
220
|
+
* </button>
|
|
221
|
+
* {isError && <p>Error: {error?.message}</p>}
|
|
222
|
+
* </>
|
|
223
|
+
* );
|
|
224
|
+
* }
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
declare function useCallTool<TInput = Record<string, unknown>, TOutput = unknown>(toolName: string): UseCallToolResult<TInput, TOutput>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Combined access to tool input/output with status derivation
|
|
231
|
+
*
|
|
232
|
+
* Status is derived as follows:
|
|
233
|
+
* - 'idle': No tool input received yet
|
|
234
|
+
* - 'pending': Tool input received, waiting for output
|
|
235
|
+
* - 'success': Both input and output available
|
|
236
|
+
*
|
|
237
|
+
* @returns Object with status flags and data
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```tsx
|
|
241
|
+
* function SearchResults() {
|
|
242
|
+
* const { status, isSuccess, input, output } = useViewParams<
|
|
243
|
+
* { query: string },
|
|
244
|
+
* SearchOutput,
|
|
245
|
+
* { timing: number }
|
|
246
|
+
* >();
|
|
247
|
+
*
|
|
248
|
+
* if (!isSuccess) {
|
|
249
|
+
* return <Loading query={input?.query} />;
|
|
250
|
+
* }
|
|
251
|
+
*
|
|
252
|
+
* return <ResultList results={output.items} />;
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function useViewParams<TInput = Record<string, unknown>, TOutput = unknown, TMeta = Record<string, unknown>>(): UseViewParamsResult<TInput, TOutput, TMeta>;
|
|
257
|
+
|
|
258
|
+
interface UseViewStateReturn<T> extends Array<T | ((newState: T | ((prev: T) => T)) => void)> {
|
|
259
|
+
/** Current state value */
|
|
260
|
+
0: T;
|
|
261
|
+
/** Function to update state */
|
|
262
|
+
1: (newState: T | ((prev: T) => T)) => void;
|
|
263
|
+
/** Current state value (named access) */
|
|
264
|
+
state: T;
|
|
265
|
+
/** Function to update state (named access) */
|
|
266
|
+
setState: (newState: T | ((prev: T) => T)) => void;
|
|
267
|
+
/** Reset state to initial value */
|
|
268
|
+
resetState: () => void;
|
|
269
|
+
/** Whether state differs from initial */
|
|
270
|
+
isDirty: boolean;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Manage view state with reset capability and dirty tracking.
|
|
274
|
+
* State is synced with the platform (persisted across conversation turns).
|
|
275
|
+
*
|
|
276
|
+
* Supports both tuple and object destructuring:
|
|
277
|
+
* @example
|
|
278
|
+
* ```tsx
|
|
279
|
+
* // Tuple style (like useState)
|
|
280
|
+
* const [count, setCount] = useViewState(0);
|
|
281
|
+
*
|
|
282
|
+
* // Object style (with extra features)
|
|
283
|
+
* const { state, setState, resetState, isDirty } = useViewState(0);
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @param initialState - Initial state value (used when no persisted state exists)
|
|
287
|
+
* @returns Tuple/object with state, setState, resetState, and isDirty flag
|
|
288
|
+
*/
|
|
289
|
+
declare function useViewState<T>(initialState: T): UseViewStateReturn<T>;
|
|
290
|
+
|
|
291
|
+
interface HostEnvironment {
|
|
292
|
+
theme: Theme;
|
|
293
|
+
locale: string;
|
|
294
|
+
deviceType: DeviceType;
|
|
295
|
+
platform: Platform;
|
|
296
|
+
safeArea: SafeAreaInsets;
|
|
297
|
+
displayMode: DisplayMode;
|
|
298
|
+
containerSize: ContainerSize;
|
|
299
|
+
inputCapabilities: InputCapabilities;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Get all host environment information in a single hook
|
|
303
|
+
*
|
|
304
|
+
* @returns Complete host environment object
|
|
305
|
+
*/
|
|
306
|
+
declare function useHostEnvironment(): HostEnvironment;
|
|
307
|
+
|
|
308
|
+
interface DisplayModeControl {
|
|
309
|
+
displayMode: DisplayMode;
|
|
310
|
+
requestFullscreen: () => Promise<void>;
|
|
311
|
+
requestInline: () => Promise<void>;
|
|
312
|
+
requestPip: () => Promise<void>;
|
|
313
|
+
requestDisplayMode: (mode: DisplayMode) => Promise<void>;
|
|
314
|
+
isFullscreen: boolean;
|
|
315
|
+
isInline: boolean;
|
|
316
|
+
isPip: boolean;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Control display mode with convenient methods
|
|
320
|
+
*
|
|
321
|
+
* @returns Display mode state and control methods
|
|
322
|
+
*/
|
|
323
|
+
declare function useDisplayModeControl(): DisplayModeControl;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Check if the current device is mobile or tablet
|
|
327
|
+
*
|
|
328
|
+
* @returns true if deviceType is 'mobile' or 'tablet'
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```tsx
|
|
332
|
+
* function MyComponent() {
|
|
333
|
+
* const isMobile = useIsMobile();
|
|
334
|
+
* return isMobile ? <MobileView /> : <DesktopView />;
|
|
335
|
+
* }
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
declare function useIsMobile(): boolean;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Check if the current display mode is fullscreen
|
|
342
|
+
*
|
|
343
|
+
* @returns true if displayMode is 'fullscreen'
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```tsx
|
|
347
|
+
* function MyComponent() {
|
|
348
|
+
* const isFullscreen = useIsFullscreen();
|
|
349
|
+
* return isFullscreen ? <FullscreenLayout /> : <InlineLayout />;
|
|
350
|
+
* }
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare function useIsFullscreen(): boolean;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Check if the current theme is dark mode
|
|
357
|
+
*
|
|
358
|
+
* @returns true if theme is 'dark'
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```tsx
|
|
362
|
+
* function MyComponent() {
|
|
363
|
+
* const isDarkMode = useIsDarkMode();
|
|
364
|
+
* return (
|
|
365
|
+
* <div style={{ background: isDarkMode ? '#1a1a1a' : '#ffffff' }}>
|
|
366
|
+
* Content
|
|
367
|
+
* </div>
|
|
368
|
+
* );
|
|
369
|
+
* }
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
declare function useIsDarkMode(): boolean;
|
|
373
|
+
|
|
374
|
+
interface PancakeContextValue {
|
|
375
|
+
isReady: boolean;
|
|
376
|
+
error: Error | undefined;
|
|
377
|
+
platform: 'apps-sdk' | 'mcp-apps';
|
|
378
|
+
}
|
|
379
|
+
interface PancakeProviderProps {
|
|
380
|
+
/**
|
|
381
|
+
* Children to render once the provider is ready
|
|
382
|
+
*/
|
|
383
|
+
children: ReactNode;
|
|
384
|
+
/**
|
|
385
|
+
* Callback when initialization fails
|
|
386
|
+
*/
|
|
387
|
+
onError?: (error: Error) => void;
|
|
388
|
+
/**
|
|
389
|
+
* Enable debug logging
|
|
390
|
+
*/
|
|
391
|
+
debug?: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* Custom loading component to show while initializing (MCP only)
|
|
394
|
+
* If not provided, children are rendered immediately on Apps SDK,
|
|
395
|
+
* and nothing is rendered until ready on MCP
|
|
396
|
+
*/
|
|
397
|
+
fallback?: ReactNode;
|
|
398
|
+
/**
|
|
399
|
+
* If true, renders children even before initialization completes
|
|
400
|
+
* Use this for progressive enhancement patterns
|
|
401
|
+
*/
|
|
402
|
+
immediate?: boolean;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Provider component that handles platform initialization
|
|
406
|
+
*
|
|
407
|
+
* On MCP Apps: Waits for handshake to complete before rendering children
|
|
408
|
+
* On Apps SDK: Renders immediately (no async initialization needed)
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```tsx
|
|
412
|
+
* function App() {
|
|
413
|
+
* return (
|
|
414
|
+
* <PancakeProvider
|
|
415
|
+
* onError={(e) => console.error('Init failed:', e)}
|
|
416
|
+
* fallback={<LoadingSpinner />}
|
|
417
|
+
* >
|
|
418
|
+
* <MyPancakeApp />
|
|
419
|
+
* </PancakeProvider>
|
|
420
|
+
* );
|
|
421
|
+
* }
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
declare function PancakeProvider({ children, onError, debug, fallback, immediate, }: PancakeProviderProps): React.ReactElement | null;
|
|
425
|
+
/**
|
|
426
|
+
* Hook to access Pancake provider context
|
|
427
|
+
*
|
|
428
|
+
* @returns Context value with isReady, error, and platform
|
|
429
|
+
* @throws If used outside of PancakeProvider
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```tsx
|
|
433
|
+
* function MyComponent() {
|
|
434
|
+
* const { isReady, platform, error } = usePancakeContext();
|
|
435
|
+
* if (error) return <Error error={error} />;
|
|
436
|
+
* if (!isReady) return <Loading />;
|
|
437
|
+
* return <Content />;
|
|
438
|
+
* }
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
declare function usePancakeContext(): PancakeContextValue;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Development Mode Helpers
|
|
445
|
+
*
|
|
446
|
+
* Utilities for debugging and development environments.
|
|
447
|
+
*/
|
|
448
|
+
/**
|
|
449
|
+
* Check if running in development mode
|
|
450
|
+
*/
|
|
451
|
+
declare const DEBUG: boolean;
|
|
452
|
+
/**
|
|
453
|
+
* Check if running in a test environment
|
|
454
|
+
*/
|
|
455
|
+
declare const IS_TEST: boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Check if running in Storybook
|
|
458
|
+
*/
|
|
459
|
+
declare const IS_STORYBOOK: boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Log a debug message (only in development mode)
|
|
462
|
+
*
|
|
463
|
+
* @param message - Message to log
|
|
464
|
+
* @param data - Optional data to log
|
|
465
|
+
*/
|
|
466
|
+
declare function debugLog(message: string, data?: unknown): void;
|
|
467
|
+
/**
|
|
468
|
+
* Log a debug warning (only in development mode)
|
|
469
|
+
*
|
|
470
|
+
* @param message - Warning message
|
|
471
|
+
* @param data - Optional data to log
|
|
472
|
+
*/
|
|
473
|
+
declare function debugWarn(message: string, data?: unknown): void;
|
|
474
|
+
/**
|
|
475
|
+
* Assert a condition and log an error if it fails (development only)
|
|
476
|
+
*
|
|
477
|
+
* @param condition - Condition to check
|
|
478
|
+
* @param message - Error message if condition is false
|
|
479
|
+
*/
|
|
480
|
+
declare function debugAssert(condition: boolean, message: string): void;
|
|
481
|
+
/**
|
|
482
|
+
* Measure execution time of a function (development only)
|
|
483
|
+
*
|
|
484
|
+
* @param label - Label for the measurement
|
|
485
|
+
* @param fn - Function to measure
|
|
486
|
+
* @returns Result of the function
|
|
487
|
+
*/
|
|
488
|
+
declare function debugTime<T>(label: string, fn: () => T): T;
|
|
489
|
+
/**
|
|
490
|
+
* Async version of debugTime
|
|
491
|
+
*
|
|
492
|
+
* @param label - Label for the measurement
|
|
493
|
+
* @param fn - Async function to measure
|
|
494
|
+
* @returns Promise with result of the function
|
|
495
|
+
*/
|
|
496
|
+
declare function debugTimeAsync<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Style Utilities
|
|
500
|
+
*
|
|
501
|
+
* Standalone utility functions for theming and styling.
|
|
502
|
+
* These work anywhere without requiring React or adaptors.
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* import { getDocumentTheme, applyDocumentTheme, applyHostStyleVariables } from '@pancake-apps/web';
|
|
507
|
+
*
|
|
508
|
+
* // Detect current theme
|
|
509
|
+
* const theme = getDocumentTheme();
|
|
510
|
+
*
|
|
511
|
+
* // Apply theme to document
|
|
512
|
+
* applyDocumentTheme('dark');
|
|
513
|
+
*
|
|
514
|
+
* // Apply host-provided CSS variables
|
|
515
|
+
* applyHostStyleVariables({
|
|
516
|
+
* '--color-background-primary': '#ffffff',
|
|
517
|
+
* '--color-text-primary': '#000000',
|
|
518
|
+
* });
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Detect the current document theme based on:
|
|
524
|
+
* 1. Document color scheme meta tag
|
|
525
|
+
* 2. Media query preference
|
|
526
|
+
* 3. Document class (dark/light)
|
|
527
|
+
*/
|
|
528
|
+
declare function getDocumentTheme(): Theme;
|
|
529
|
+
/**
|
|
530
|
+
* Create a reactive theme detection observer
|
|
531
|
+
* Returns current theme and calls callback on changes
|
|
532
|
+
*/
|
|
533
|
+
declare function observeDocumentTheme(callback: (theme: Theme) => void): {
|
|
534
|
+
getTheme: () => Theme;
|
|
535
|
+
disconnect: () => void;
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* Apply a theme to the document
|
|
539
|
+
* Sets both the class and data-theme attribute
|
|
540
|
+
*/
|
|
541
|
+
declare function applyDocumentTheme(theme: Theme): void;
|
|
542
|
+
/**
|
|
543
|
+
* Apply host-provided CSS variables to the document
|
|
544
|
+
*/
|
|
545
|
+
declare function applyHostStyleVariables(variables: StyleVariables | Record<string, string>): void;
|
|
546
|
+
/**
|
|
547
|
+
* Apply host-provided font CSS
|
|
548
|
+
*/
|
|
549
|
+
declare function applyHostFonts(css: string): void;
|
|
550
|
+
/**
|
|
551
|
+
* Remove all host-applied styles
|
|
552
|
+
*/
|
|
553
|
+
declare function clearHostStyles(): void;
|
|
554
|
+
/**
|
|
555
|
+
* Apply all styles from a HostContext
|
|
556
|
+
* Includes theme, CSS variables, and fonts
|
|
557
|
+
*/
|
|
558
|
+
declare function applyHostContext(context: HostContext): void;
|
|
559
|
+
/**
|
|
560
|
+
* Extract CSS variables currently applied to an element
|
|
561
|
+
*/
|
|
562
|
+
declare function getComputedStyleVariables(element?: HTMLElement, variableNames?: string[]): Record<string, string>;
|
|
563
|
+
/**
|
|
564
|
+
* Apply safe area insets as CSS variables
|
|
565
|
+
*/
|
|
566
|
+
declare function applySafeAreaInsets(insets: {
|
|
567
|
+
top: number;
|
|
568
|
+
right: number;
|
|
569
|
+
bottom: number;
|
|
570
|
+
left: number;
|
|
571
|
+
}): void;
|
|
572
|
+
/**
|
|
573
|
+
* Get the current safe area insets from CSS environment variables
|
|
574
|
+
*/
|
|
575
|
+
declare function getSafeAreaInsets(): {
|
|
576
|
+
top: number;
|
|
577
|
+
right: number;
|
|
578
|
+
bottom: number;
|
|
579
|
+
left: number;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
declare const unified_ActionStatus: typeof ActionStatus;
|
|
583
|
+
declare const unified_ActionTool: typeof ActionTool;
|
|
584
|
+
declare const unified_AdaptorStoreKey: typeof AdaptorStoreKey;
|
|
585
|
+
declare const unified_AdaptorStoreState: typeof AdaptorStoreState;
|
|
586
|
+
declare const unified_CallToolResult: typeof CallToolResult;
|
|
587
|
+
declare const unified_CallToolStatus: typeof CallToolStatus;
|
|
588
|
+
declare const unified_ContainerSize: typeof ContainerSize;
|
|
589
|
+
declare const unified_ContentBlock: typeof ContentBlock;
|
|
590
|
+
declare const unified_DEBUG: typeof DEBUG;
|
|
591
|
+
declare const unified_DataStatus: typeof DataStatus;
|
|
592
|
+
declare const unified_DataTool: typeof DataTool;
|
|
593
|
+
declare const unified_DeviceType: typeof DeviceType;
|
|
594
|
+
declare const unified_DisplayMode: typeof DisplayMode;
|
|
595
|
+
type unified_DisplayModeControl = DisplayModeControl;
|
|
596
|
+
declare const unified_ExternalStore: typeof ExternalStore;
|
|
597
|
+
declare const unified_Feature: typeof Feature;
|
|
598
|
+
type unified_HostEnvironment = HostEnvironment;
|
|
599
|
+
declare const unified_IS_STORYBOOK: typeof IS_STORYBOOK;
|
|
600
|
+
declare const unified_IS_TEST: typeof IS_TEST;
|
|
601
|
+
declare const unified_InputCapabilities: typeof InputCapabilities;
|
|
602
|
+
declare const unified_LogLevel: typeof LogLevel;
|
|
603
|
+
declare const unified_PancakeProvider: typeof PancakeProvider;
|
|
604
|
+
type unified_PancakeProviderProps = PancakeProviderProps;
|
|
605
|
+
declare const unified_Platform: typeof Platform;
|
|
606
|
+
declare const unified_ResourceContent: typeof ResourceContent;
|
|
607
|
+
declare const unified_ResourceReadResult: typeof ResourceReadResult;
|
|
608
|
+
declare const unified_ResourceTeardownParams: typeof ResourceTeardownParams;
|
|
609
|
+
declare const unified_SafeAreaInsets: typeof SafeAreaInsets;
|
|
610
|
+
declare const unified_TeardownHandler: typeof TeardownHandler;
|
|
611
|
+
declare const unified_Theme: typeof Theme;
|
|
612
|
+
declare const unified_ToolResponseMetadata: typeof ToolResponseMetadata;
|
|
613
|
+
declare const unified_ToolResultParams: typeof ToolResultParams;
|
|
614
|
+
declare const unified_UnifiedAdaptor: typeof UnifiedAdaptor;
|
|
615
|
+
declare const unified_UpdateModelContextParams: typeof UpdateModelContextParams;
|
|
616
|
+
declare const unified_UseActionCallbacks: typeof UseActionCallbacks;
|
|
617
|
+
declare const unified_UseActionResult: typeof UseActionResult;
|
|
618
|
+
declare const unified_UseCallToolCallbacks: typeof UseCallToolCallbacks;
|
|
619
|
+
type unified_UseCallToolOptions<TOutput> = UseCallToolOptions<TOutput>;
|
|
620
|
+
declare const unified_UseCallToolResult: typeof UseCallToolResult;
|
|
621
|
+
declare const unified_UseDataOptions: typeof UseDataOptions;
|
|
622
|
+
declare const unified_UseDataResult: typeof UseDataResult;
|
|
623
|
+
declare const unified_UseHostStylesOptions: typeof UseHostStylesOptions;
|
|
624
|
+
declare const unified_UseViewDataResult: typeof UseViewDataResult;
|
|
625
|
+
declare const unified_UseViewOptions: typeof UseViewOptions;
|
|
626
|
+
declare const unified_UseViewParamsResult: typeof UseViewParamsResult;
|
|
627
|
+
declare const unified_UseViewResult: typeof UseViewResult;
|
|
628
|
+
type unified_UseViewStateReturn<T> = UseViewStateReturn<T>;
|
|
629
|
+
declare const unified_View: typeof View;
|
|
630
|
+
declare const unified_ViewAppInfo: typeof ViewAppInfo;
|
|
631
|
+
declare const unified_ViewDataStatus: typeof ViewDataStatus;
|
|
632
|
+
declare const unified_ViewOptions: typeof ViewOptions;
|
|
633
|
+
declare const unified_ViewParamsStatus: typeof ViewParamsStatus;
|
|
634
|
+
declare const unified_action: typeof action;
|
|
635
|
+
declare const unified_applyDocumentTheme: typeof applyDocumentTheme;
|
|
636
|
+
declare const unified_applyHostContext: typeof applyHostContext;
|
|
637
|
+
declare const unified_applyHostFonts: typeof applyHostFonts;
|
|
638
|
+
declare const unified_applyHostStyleVariables: typeof applyHostStyleVariables;
|
|
639
|
+
declare const unified_applySafeAreaInsets: typeof applySafeAreaInsets;
|
|
640
|
+
declare const unified_callTool: typeof callTool;
|
|
641
|
+
declare const unified_clearHostStyles: typeof clearHostStyles;
|
|
642
|
+
declare const unified_createView: typeof createView;
|
|
643
|
+
declare const unified_data: typeof data;
|
|
644
|
+
declare const unified_debugAssert: typeof debugAssert;
|
|
645
|
+
declare const unified_debugLog: typeof debugLog;
|
|
646
|
+
declare const unified_debugTime: typeof debugTime;
|
|
647
|
+
declare const unified_debugTimeAsync: typeof debugTimeAsync;
|
|
648
|
+
declare const unified_debugWarn: typeof debugWarn;
|
|
649
|
+
declare const unified_getAdaptor: typeof getAdaptor;
|
|
650
|
+
declare const unified_getComputedStyleVariables: typeof getComputedStyleVariables;
|
|
651
|
+
declare const unified_getDocumentTheme: typeof getDocumentTheme;
|
|
652
|
+
declare const unified_getPlatform: typeof getPlatform;
|
|
653
|
+
declare const unified_getSafeAreaInsets: typeof getSafeAreaInsets;
|
|
654
|
+
declare const unified_isAppsSdkAvailable: typeof isAppsSdkAvailable;
|
|
655
|
+
declare const unified_isMcpAppsAvailable: typeof isMcpAppsAvailable;
|
|
656
|
+
declare const unified_isSupported: typeof isSupported;
|
|
657
|
+
declare const unified_log: typeof log;
|
|
658
|
+
declare const unified_logDebug: typeof logDebug;
|
|
659
|
+
declare const unified_logError: typeof logError;
|
|
660
|
+
declare const unified_logInfo: typeof logInfo;
|
|
661
|
+
declare const unified_logWarning: typeof logWarning;
|
|
662
|
+
declare const unified_navigateToView: typeof navigateToView;
|
|
663
|
+
declare const unified_notifySizeChanged: typeof notifySizeChanged;
|
|
664
|
+
declare const unified_observeDocumentTheme: typeof observeDocumentTheme;
|
|
665
|
+
declare const unified_onTeardown: typeof onTeardown;
|
|
666
|
+
declare const unified_openExternal: typeof openExternal;
|
|
667
|
+
declare const unified_ping: typeof ping;
|
|
668
|
+
declare const unified_readResource: typeof readResource;
|
|
669
|
+
declare const unified_requestDisplayMode: typeof requestDisplayMode;
|
|
670
|
+
declare const unified_resetAdaptor: typeof resetAdaptor;
|
|
671
|
+
declare const unified_say: typeof say;
|
|
672
|
+
declare const unified_sendFollowUpMessage: typeof sendFollowUpMessage;
|
|
673
|
+
declare const unified_setupAutoSizeReporting: typeof setupAutoSizeReporting;
|
|
674
|
+
declare const unified_updateModelContext: typeof updateModelContext;
|
|
675
|
+
declare const unified_useAction: typeof useAction;
|
|
676
|
+
declare const unified_useCallTool: typeof useCallTool;
|
|
677
|
+
declare const unified_useContainerSize: typeof useContainerSize;
|
|
678
|
+
declare const unified_useData: typeof useData;
|
|
679
|
+
declare const unified_useDeviceType: typeof useDeviceType;
|
|
680
|
+
declare const unified_useDisplayMode: typeof useDisplayMode;
|
|
681
|
+
declare const unified_useDisplayModeControl: typeof useDisplayModeControl;
|
|
682
|
+
declare const unified_useDocumentTheme: typeof useDocumentTheme;
|
|
683
|
+
declare const unified_useDocumentThemeState: typeof useDocumentThemeState;
|
|
684
|
+
declare const unified_useHostEnvironment: typeof useHostEnvironment;
|
|
685
|
+
declare const unified_useHostFontsHook: typeof useHostFontsHook;
|
|
686
|
+
declare const unified_useHostStyles: typeof useHostStyles;
|
|
687
|
+
declare const unified_useHostTheme: typeof useHostTheme;
|
|
688
|
+
declare const unified_useHostVariables: typeof useHostVariables;
|
|
689
|
+
declare const unified_useInputCapabilities: typeof useInputCapabilities;
|
|
690
|
+
declare const unified_useIsDarkMode: typeof useIsDarkMode;
|
|
691
|
+
declare const unified_useIsFullscreen: typeof useIsFullscreen;
|
|
692
|
+
declare const unified_useIsMobile: typeof useIsMobile;
|
|
693
|
+
declare const unified_useLocale: typeof useLocale;
|
|
694
|
+
declare const unified_useMaxHeight: typeof useMaxHeight;
|
|
695
|
+
declare const unified_usePancakeContext: typeof usePancakeContext;
|
|
696
|
+
declare const unified_usePlatform: typeof usePlatform;
|
|
697
|
+
declare const unified_useSafeArea: typeof useSafeArea;
|
|
698
|
+
declare const unified_useSystemColorScheme: typeof useSystemColorScheme;
|
|
699
|
+
declare const unified_useTheme: typeof useTheme;
|
|
700
|
+
declare const unified_useToolInput: typeof useToolInput;
|
|
701
|
+
declare const unified_useToolOutput: typeof useToolOutput;
|
|
702
|
+
declare const unified_useToolResponseMetadata: typeof useToolResponseMetadata;
|
|
703
|
+
declare const unified_useView: typeof useView;
|
|
704
|
+
declare const unified_useViewData: typeof useViewData;
|
|
705
|
+
declare const unified_useViewParams: typeof useViewParams;
|
|
706
|
+
declare const unified_useViewState: typeof useViewState;
|
|
707
|
+
declare namespace unified {
|
|
708
|
+
export { unified_ActionStatus as ActionStatus, unified_ActionTool as ActionTool, unified_AdaptorStoreKey as AdaptorStoreKey, unified_AdaptorStoreState as AdaptorStoreState, unified_CallToolResult as CallToolResult, unified_CallToolStatus as CallToolStatus, unified_ContainerSize as ContainerSize, unified_ContentBlock as ContentBlock, unified_DEBUG as DEBUG, unified_DataStatus as DataStatus, unified_DataTool as DataTool, unified_DeviceType as DeviceType, unified_DisplayMode as DisplayMode, type unified_DisplayModeControl as DisplayModeControl, unified_ExternalStore as ExternalStore, unified_Feature as Feature, type unified_HostEnvironment as HostEnvironment, unified_IS_STORYBOOK as IS_STORYBOOK, unified_IS_TEST as IS_TEST, unified_InputCapabilities as InputCapabilities, unified_LogLevel as LogLevel, unified_PancakeProvider as PancakeProvider, type unified_PancakeProviderProps as PancakeProviderProps, unified_Platform as Platform, unified_ResourceContent as ResourceContent, unified_ResourceReadResult as ResourceReadResult, unified_ResourceTeardownParams as ResourceTeardownParams, unified_SafeAreaInsets as SafeAreaInsets, unified_TeardownHandler as TeardownHandler, unified_Theme as Theme, unified_ToolResponseMetadata as ToolResponseMetadata, unified_ToolResultParams as ToolResultParams, unified_UnifiedAdaptor as UnifiedAdaptor, unified_UpdateModelContextParams as UpdateModelContextParams, unified_UseActionCallbacks as UseActionCallbacks, unified_UseActionResult as UseActionResult, unified_UseCallToolCallbacks as UseCallToolCallbacks, type unified_UseCallToolOptions as UseCallToolOptions, unified_UseCallToolResult as UseCallToolResult, unified_UseDataOptions as UseDataOptions, unified_UseDataResult as UseDataResult, unified_UseHostStylesOptions as UseHostStylesOptions, unified_UseViewDataResult as UseViewDataResult, unified_UseViewOptions as UseViewOptions, unified_UseViewParamsResult as UseViewParamsResult, unified_UseViewResult as UseViewResult, type unified_UseViewStateReturn as UseViewStateReturn, unified_View as View, unified_ViewAppInfo as ViewAppInfo, unified_ViewDataStatus as ViewDataStatus, unified_ViewOptions as ViewOptions, unified_ViewParamsStatus as ViewParamsStatus, unified_action as action, unified_applyDocumentTheme as applyDocumentTheme, unified_applyHostContext as applyHostContext, unified_applyHostFonts as applyHostFonts, unified_applyHostStyleVariables as applyHostStyleVariables, unified_applySafeAreaInsets as applySafeAreaInsets, unified_callTool as callTool, unified_clearHostStyles as clearHostStyles, unified_createView as createView, unified_data as data, unified_debugAssert as debugAssert, unified_debugLog as debugLog, unified_debugTime as debugTime, unified_debugTimeAsync as debugTimeAsync, unified_debugWarn as debugWarn, unified_getAdaptor as getAdaptor, unified_getComputedStyleVariables as getComputedStyleVariables, unified_getDocumentTheme as getDocumentTheme, unified_getPlatform as getPlatform, unified_getSafeAreaInsets as getSafeAreaInsets, unified_isAppsSdkAvailable as isAppsSdkAvailable, unified_isMcpAppsAvailable as isMcpAppsAvailable, unified_isSupported as isSupported, unified_log as log, unified_logDebug as logDebug, unified_logError as logError, unified_logInfo as logInfo, unified_logWarning as logWarning, unified_navigateToView as navigateToView, unified_notifySizeChanged as notifySizeChanged, unified_observeDocumentTheme as observeDocumentTheme, unified_onTeardown as onTeardown, unified_openExternal as openExternal, unified_ping as ping, unified_readResource as readResource, unified_requestDisplayMode as requestDisplayMode, unified_resetAdaptor as resetAdaptor, unified_say as say, unified_sendFollowUpMessage as sendFollowUpMessage, unified_setupAutoSizeReporting as setupAutoSizeReporting, unified_updateModelContext as updateModelContext, unified_useAction as useAction, unified_useCallTool as useCallTool, unified_useContainerSize as useContainerSize, unified_useData as useData, unified_useDeviceType as useDeviceType, unified_useDisplayMode as useDisplayMode, unified_useDisplayModeControl as useDisplayModeControl, unified_useDocumentTheme as useDocumentTheme, unified_useDocumentThemeState as useDocumentThemeState, unified_useHostEnvironment as useHostEnvironment, unified_useHostFontsHook as useHostFontsHook, unified_useHostStyles as useHostStyles, unified_useHostTheme as useHostTheme, unified_useHostVariables as useHostVariables, unified_useInputCapabilities as useInputCapabilities, unified_useIsDarkMode as useIsDarkMode, unified_useIsFullscreen as useIsFullscreen, unified_useIsMobile as useIsMobile, unified_useLocale as useLocale, unified_useMaxHeight as useMaxHeight, unified_usePancakeContext as usePancakeContext, unified_usePlatform as usePlatform, unified_useSafeArea as useSafeArea, unified_useSystemColorScheme as useSystemColorScheme, unified_useTheme as useTheme, unified_useToolInput as useToolInput, unified_useToolOutput as useToolOutput, unified_useToolResponseMetadata as useToolResponseMetadata, unified_useView as useView, unified_useViewData as useViewData, unified_useViewParams as useViewParams, unified_useViewState as useViewState };
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* @pancake-apps/web - Unified SDK for building Pancake apps
|
|
713
|
+
*
|
|
714
|
+
* This is the main entry point that auto-detects the platform
|
|
715
|
+
* and provides a unified API.
|
|
716
|
+
*
|
|
717
|
+
* Subpath exports:
|
|
718
|
+
* - @pancake-apps/web - Unified SDK (this file)
|
|
719
|
+
* - @pancake-apps/web/apps-sdk - ChatGPT Apps SDK
|
|
720
|
+
* - @pancake-apps/web/mcp-apps - MCP Apps SDK
|
|
721
|
+
*/
|
|
722
|
+
|
|
723
|
+
declare global {
|
|
724
|
+
interface Window {
|
|
725
|
+
pancake?: PancakeGlobal;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
interface PancakeGlobal {
|
|
729
|
+
platform: ReturnType<typeof getPlatform>;
|
|
730
|
+
adaptor: ReturnType<typeof getAdaptor>;
|
|
731
|
+
appsSdk: typeof appsSdk;
|
|
732
|
+
mcpApps: typeof mcpApps;
|
|
733
|
+
unified: typeof unified;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Initialize and attach the pancake global object to window
|
|
737
|
+
* This allows imperative access to the SDK from non-React code
|
|
738
|
+
*/
|
|
739
|
+
declare function initPancake(): PancakeGlobal;
|
|
740
|
+
|
|
741
|
+
export { ActionStatus, ActionTool, AdaptorStoreKey, AdaptorStoreState, CallToolResult, CallToolStatus, ContainerSize, ContentBlock, DEBUG, DataStatus, DataTool, DeviceType, DisplayMode, type DisplayModeControl, ExternalStore, Feature, type HostEnvironment, IS_STORYBOOK, IS_TEST, InputCapabilities, LogLevel, type PancakeGlobal, PancakeProvider, type PancakeProviderProps, Platform, ResourceContent, ResourceReadResult, ResourceTeardownParams, SafeAreaInsets, TeardownHandler, Theme, ToolResponseMetadata, ToolResultParams, UnifiedAdaptor, UpdateModelContextParams, UseActionCallbacks, UseActionResult, UseCallToolCallbacks, type UseCallToolOptions, UseCallToolResult, UseDataOptions, UseDataResult, UseHostStylesOptions, UseViewDataResult, UseViewOptions, UseViewParamsResult, UseViewResult, type UseViewStateReturn, View, ViewAppInfo, ViewDataStatus, ViewOptions, ViewParamsStatus, action, applyDocumentTheme, applyHostContext, applyHostFonts, applyHostStyleVariables, applySafeAreaInsets, appsSdk, callTool, clearHostStyles, createView, data, debugAssert, debugLog, debugTime, debugTimeAsync, debugWarn, getAdaptor, getComputedStyleVariables, getDocumentTheme, getPlatform, getSafeAreaInsets, initPancake, isAppsSdkAvailable, isMcpAppsAvailable, isSupported, log, logDebug, logError, logInfo, logWarning, mcpApps, navigateToView, notifySizeChanged, observeDocumentTheme, onTeardown, openExternal, ping, readResource, requestDisplayMode, resetAdaptor, say, sendFollowUpMessage, setupAutoSizeReporting, updateModelContext, useAction, useCallTool, useContainerSize, useData, useDeviceType, useDisplayMode, useDisplayModeControl, useDocumentTheme, useDocumentThemeState, useHostEnvironment, useHostFontsHook, useHostStyles, useHostTheme, useHostVariables, useInputCapabilities, useIsDarkMode, useIsFullscreen, useIsMobile, useLocale, useMaxHeight, usePancakeContext, usePlatform, useSafeArea, useSystemColorScheme, useTheme, useToolInput, useToolOutput, useToolResponseMetadata, useView, useViewData, useViewParams, useViewState };
|