import { default as sdkComponents } from './modules/Element'; import { elementChildren, withElement, useElement, useElementVisible, usePluginTrigger, useRscData, JsxManager, PluginManager, PluginRemote, ReplicaProvider, RootElement, useChannel, useJob, ElementContextValue, ElementChild, PluginTriggerPayload, ChannelHandle } from '@plitzi/sdk-elements'; import { createShaderProgram, ShaderError, useAnimationFrame, useCanvas2d, useReducedMotion, useWebGL, useWebGL2, CanvasHandle, CanvasOptions, CanvasSize, Frame } from '@plitzi/sdk-elements/canvas'; import { ComponentProvider } from '@plitzi/sdk-elements/Component'; import { useFlag } from '@plitzi/sdk-elements/dataSource'; import { ComponentContext } from '@plitzi/sdk-shared/elements'; import { usePlitzi, PlitziProvider, PlitziContextValue } from '@plitzi/sdk-shared/hooks'; import { PluginsContext } from '@plitzi/sdk-shared/plugins/react'; import { useRscRefresh, usePluginRoute } from '@plitzi/sdk-shared/server'; import { useSdkStore } from '@plitzi/sdk-shared/store'; import { useDisplayMode, useElementSize } from '@plitzi/sdk-shared/style/react'; import { default as useServerAction, ServerActionOptions, ServerActionResult } from './modules/Actions/useServerAction'; import { track } from './modules/Analytics'; import { default as useNotify, Notify } from './modules/Space/useNotify'; import { DeferredPlugin, PluginComponent } from './modules/Sdk/deferredPlugins'; import { EventBridgeContextValue } from '@plitzi/sdk-event-bridge'; import { ActionRunSummary, AnalyticsConfig, Element, Schema, Style, ComponentPluginFC, ComponentPlugin, InteractionCallback, InteractionCallbackParamValues, Environment, HostActions, OfflineDataRaw, RenderMode, Server, RuntimeStateInstance, Theme, RealtimeMessage } from '@plitzi/sdk-shared'; import { PluginDeclaration, NotificationOptions } from '@plitzi/sdk-shared/authoring'; import { RealtimeMember } from '@plitzi/sdk-shared/realtime'; import { ThemeScope } from '@plitzi/sdk-shared/theme'; import { ReactNode } from 'react'; /** * A registered plugin is a COMPONENT, not a decorated one. * * `ComponentPluginFC` and not `ComponentPlugin`, because the metadata the latter carries — `type`, `assets`, * `origin`, `content` — is stamped on by `App` when it reads these, from the very keys given here. Asking a * caller for it made the parameter impossible to satisfy without a cast: everybody registering a component of * their own has a React component and nothing else, which is also exactly what `` declares. */ type RenderPluginBase = { props?: Record; clientOnly?: boolean; }; export type RenderPlugins = Record; export type RenderOptions = { /** * Development: the page's plugins can be swapped while it runs (`replacePlugin` on what `render` returns) — what a * server rebuilding a plugin hands an open page, so an edit shows without loading the page again. */ hotPlugins?: boolean; }; export declare function render(widgetContainer: string, params?: PlitziSdkProps, renderPlugins?: RenderPlugins, debugMode?: boolean, ssrMode?: boolean, { hotPlugins }?: RenderOptions): { unmount: () => void; /** * Swaps a plugin where it is drawn, with `hotPlugins` on: `false` when it cannot be swapped in place — not * registered by this page, or its declaration changed — and the page should load again. */ replacePlugin: (key: string, component: PluginComponent) => boolean; /** * Swaps the space the page draws for `documents` where it stands — its state, scroll and focus kept: what a server * whose space changed hands an open page (`updatePages`). `false` when it cannot be swapped in place — a page that * reads its space from the network, one not mounted, or one whose space has elements the server draws, which only a * new request draws again — and the page should load again. */ replaceSpace: (documents: OfflineDataRaw) => boolean; } | undefined; declare global { interface Window { plitziCache?: PlitziSdkProps; } } export type PlitziSdkProps = { className?: string; children?: ReactNode; revision?: number; webKey?: string; environment?: Environment; currentPageId?: string; server?: Partial; offlineMode?: boolean; offlineData?: OfflineDataRaw; offlineDataType?: 'json' | 'yaml'; renderMode?: RenderMode; /** * Whether this space owns the browser's address bar. `browser` (the default) is right when the space IS the page. * * `memory` is for a space EMBEDDED in an application that has a router of its own — the desktop app, a component * mounted in a host: without it the space's own navigation rewrites the host's location, and a reload then opens * the host's index with the space gone. */ routing?: 'browser' | 'memory'; debugMode?: boolean; /** What the server ran to build this page, for the dev-tools. Only ever sent to a page allowed to debug them. */ actionRuns?: ActionRunSummary[]; /** * The feature flags this embedding decides, by name: `{ newCheckout: true }`. Above whatever the space and the server * rendering it say, below a tester with the dev tools. Only for flags the space declares — anything else is ignored, * with a warning in the console. */ flags?: Record; /** Set by the server that rendered this page: the flags its deployment decides (`createServer({ flags })`). */ serverFlags?: Record; /** * Set by the server that rendered this page for somebody allowed to debug it: the flags a tester forced, read from * the cookie the dev tools write — so the page hydrates drawn the way the server drew it. */ forcedFlags?: Record; /** * Set by the server that rendered this page: `offlineData.style.cache` was left out of the payload because the * page's own stylesheet holds it, and `render()` reads it back from there before hydrating. */ styleCacheInDocument?: boolean; isHydrating?: boolean; previewMode?: boolean; /** Set by the server that metered this render: the account behind this space is over its quota, so the page says * so. Never authored — a space cannot turn it off from its own settings. */ overQuota?: boolean; externalStyle?: string; sdkDevToolsStylePath?: string; /** Where Font Awesome's sheet is served, for the panels the SDK draws in a root of their own (the dev tools, the * `iframe` and `shadow` render modes). Defaults to `/plitzi-sdk-icons.css`, beside the SDK's own stylesheet. */ sdkIconsStylePath?: string; /** Where this render reports SPA navigations and interactions, and with what key. Injected by a server that * renders the page; derived from `server` + `webKey` for a client-side render; absent means report nothing. */ analytics?: AnalyticsConfig; state?: Record; /** * What the application EMBEDDING this space hands it, published as the `host` data source. * * The half that makes an application SHELL authorable: a sidebar cannot list the host's screens unless the host * can give it the list. Kept current while the space is on screen — unlike `state`, which the space owns from * the moment it mounts. */ hostData?: Record; /** * What that application is willing to be asked to do, reached from a flow with the `hostAction` step. * * The only way out of a space and into its host: opening one of the host's screens, signing out of its keyring, * quitting. A name the host does not register does nothing. */ hostActions?: HostActions; /** * Whose theme this space follows and repaints. `document` (the default for a space on its own) is a space that IS * the page. * * `container` is a space EMBEDDED in an application with a theme of its own: it wears the class on its own root * and keeps a theme store of its own, so toggling it never reaches the application around it, and two spaces in * one document do not answer for each other. A space drawn inside another one — the `plitziSdk` element, a plugin * rendering a space — is `container` unless it says otherwise. */ themeScope?: ThemeScope; /** The theme the host already settled — from the cookie a server read before it rendered the document. */ theme?: Theme; }; declare const PlitziSdk: { ({ debugMode, isHydrating, children, webKey, environment, renderMode, ...otherProps }: PlitziSdkProps): import('react').JSX.Element; Plugin: (_props: import('./modules/Sdk/SdkPlugin').SdkPluginProps) => undefined; }; export { track, useSdkStore as useStore, ComponentProvider, ComponentContext, PluginsContext, usePlitzi, PlitziProvider, RootElement, withElement, JsxManager, PluginManager, sdkComponents, PluginRemote, ReplicaProvider, useElement, useRscData, useElementVisible, usePluginTrigger, useNotify, useServerAction, elementChildren, useDisplayMode, useElementSize, useRscRefresh, usePluginRoute, useChannel, useJob, useFlag, useAnimationFrame, useReducedMotion, useCanvas2d, useWebGL, useWebGL2, createShaderProgram, ShaderError }; export type { AnalyticsConfig, ElementContextValue, Element, Schema, Style, ComponentPlugin, ComponentPluginFC, PlitziContextValue, OfflineDataRaw, InteractionCallback, InteractionCallbackParamValues, PluginDeclaration, PluginTriggerPayload, Notify, NotificationOptions, ServerActionOptions, ServerActionResult, ChannelHandle, ElementChild, RealtimeMember, RealtimeMessage, CanvasHandle, CanvasOptions, CanvasSize, Frame }; export declare const version: string; export declare const getStateManager: () => RuntimeStateInstance; export declare const getEventBridge: () => EventBridgeContextValue; export default PlitziSdk;