@dxos/app-framework 0.3.7-main.cdda206 → 0.3.7-main.ea9e237
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/lib/browser/index.mjs +7 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +7 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/App.tsx +1 -1
- package/src/plugins/PluginHost/PluginHost.tsx +2 -1
|
@@ -119,7 +119,7 @@ import { log } from "@dxos/log";
|
|
|
119
119
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
120
120
|
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
121
121
|
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
122
|
-
var PluginHost = ({ order, plugins: definitions, core =
|
|
122
|
+
var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = null }) => {
|
|
123
123
|
const state = new LocalStorageStore(PLUGIN_HOST, {
|
|
124
124
|
ready: false,
|
|
125
125
|
enabled: [
|
|
@@ -140,7 +140,8 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
140
140
|
state.prop(state.values.$enabled, "enabled", LocalStorageStore.json);
|
|
141
141
|
return {
|
|
142
142
|
meta: {
|
|
143
|
-
id: PLUGIN_HOST
|
|
143
|
+
id: PLUGIN_HOST,
|
|
144
|
+
name: "Plugin host"
|
|
144
145
|
},
|
|
145
146
|
provides: {
|
|
146
147
|
plugins: state.values,
|
|
@@ -153,7 +154,7 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
153
154
|
enabled: state.values.enabled
|
|
154
155
|
}, {
|
|
155
156
|
F: __dxlog_file,
|
|
156
|
-
L:
|
|
157
|
+
L: 66,
|
|
157
158
|
S: void 0,
|
|
158
159
|
C: (f, a) => f(...a)
|
|
159
160
|
});
|
|
@@ -178,7 +179,7 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
178
179
|
plugins
|
|
179
180
|
}, {
|
|
180
181
|
F: __dxlog_file,
|
|
181
|
-
L:
|
|
182
|
+
L: 91,
|
|
182
183
|
S: void 0,
|
|
183
184
|
C: (f, a) => f(...a)
|
|
184
185
|
});
|
|
@@ -189,7 +190,7 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
189
190
|
plugins
|
|
190
191
|
}, {
|
|
191
192
|
F: __dxlog_file,
|
|
192
|
-
L:
|
|
193
|
+
L: 98,
|
|
193
194
|
S: void 0,
|
|
194
195
|
C: (f, a) => f(...a)
|
|
195
196
|
});
|
|
@@ -336,7 +337,7 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
336
337
|
import React4 from "react";
|
|
337
338
|
import { invariant } from "@dxos/invariant";
|
|
338
339
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
339
|
-
var createApp = ({ order, plugins, core =
|
|
340
|
+
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
340
341
|
const host = PluginHost({
|
|
341
342
|
order: [
|
|
342
343
|
meta_default2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphPluginProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphPluginProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = order.map(({ id }) => id),\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { forwardRef, type FC, type ReactNode, Fragment, type ForwardedRef, type PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]) => {\n const result = component({ ...props, data }, forwardedRef);\n return result ? <Fragment key={key}>{result}</Fragment> : undefined;\n })\n .filter((Component): Component is JSX.Element => Boolean(Component));\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = [], ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAMA,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,SAAyCI;AAK5E,IAAMC,0BAA0B,CAACL,WACrCA,OAAOC,SAAiBC,OAAOI,UAAWN,SAA0CI;;;AC5BvF,SAASG,SAAS;AAWX,IAAMC,SAASC,EAAEC,OAAO;EAC7BC,YAAYF,EAAEG,QAAO;EACrBC,aAAaJ,EAAEG,QAAO;EACtBE,0BAA0BL,EAAEG,QAAO;EAEnCG,eAAeN,EAAEO,IAAG,EAAGC,SAAQ,EAAGC,SAAS,0CAAA;EAC3CC,YAAYV,EAAEG,QAAO;EAErBQ,iBAAiBX,EAAEY,OAAM,EAAGJ,SAAQ;EACpCK,gBAAgBb,EAAEO,IAAG,EAAGC,SAAQ,EAAGC,SAAS,2CAAA;EAC5CK,aAAad,EAAEG,QAAO;;EAGtBY,QAAQf,EAAEY,OAAM,EAAGJ,SAAQ,EAAGC,SAAS,kCAAA;;EAEvCO,UAAUhB,EAAEY,OAAM,EAAGJ,SAAQ;AAC/B,CAAA;AAcO,IAAMS,oBAAoB,CAACC,WAAAA;AAChC,QAAM,EAAEC,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GAAEU,MAAMJ,QAAAA,EAAUK,UAAWH,OAAOI,SAAiBC,YAAY;AACrF,SAAOJ,UAAWD,SAA0CM;AAC9D;;;AC2DO,IAAMC,aAAa,CAACC,SAAyBA;AAI7C,IAAUC;;MACFC,OAAAA,QAAAA,OAAO,CAAIC,GAAkBC,UAAAA;AACxC,WAAO,MACLD,EAAAA,EAAIE,KAAK,CAAC,EAAEC,SAASC,WAAU,MAAE;AAC/B,aAAOA,WAAWH,KAAAA;IACpB,CAAA;EACJ;GANeH,WAAAA,SAAAA,CAAAA,EAAAA;;;ACpGjB,SAAsCO,eAAeC,kBAAkB;AAyCvE,IAAMC,gBAAwCC,8BAA6B;EACzEC,OAAO;EACPC,SAAS,CAAA;EACTC,SAAS,CAAA;EACTC,WAAW,CAAA;EACXC,cAAc,MAAA;EAAO;EACrBC,eAAe,MAAA;EAAO;AACxB,CAAA;AAKO,IAAMC,aAAa,MAAqBC,WAAWT,aAAAA;AAKnD,IAAMU,YAAY,CAAKC,OAAAA;AAC5B,QAAM,EAAEP,QAAO,IAAKI,WAAAA;AACpB,SAAOI,WAAcR,SAASO,EAAAA;AAChC;AAKO,IAAME,mBAAmB,CAAKC,cAAAA;AACnC,QAAM,EAAEV,QAAO,IAAKI,WAAAA;AACpB,SAAOO,cAAcX,SAASU,SAAAA;AAChC;AAEO,IAAME,iBAA0ChB,cAAciB;;;ACvErE,SAASC,eAAe;AACxB,OAAOC,SAASC,iBAAkE;AAElF,SAASC,yBAAyB;AAClC,SAASC,WAAW;;AAiBb,IAAMC,kBAAkB,CAACC,WAC7BA,OAAOC,SAAgCC,UAAWF,SAAwCG;AAE7F,IAAMC,cAAc;AAKb,IAAMC,aAAa,CAAC,EACzBC,OACAJ,SAASK,aACTC,
|
|
6
|
-
"names": ["parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "z", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "createContext", "useContext", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "shallow", "React", "useEffect", "LocalStorageStore", "log", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphPluginProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphPluginProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { forwardRef, type FC, type ReactNode, Fragment, type ForwardedRef, type PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]) => {\n const result = component({ ...props, data }, forwardedRef);\n return result ? <Fragment key={key}>{result}</Fragment> : undefined;\n })\n .filter((Component): Component is JSX.Element => Boolean(Component));\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;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C,GAAE,MAAOA,EAAAA,GAAK,GAAGC,OAAAA,MAAgC;AAC/G,QAAMC,OAAOC,WAAW;IACtBP,OAAO;MAACQ;MAAaC;SAAeT;;IACpCC,SAAS;MACP,GAAGA;MACH,CAACO,cAAYJ,EAAE,GAAGM,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAACF,aAAWL,EAAE,GAAGM,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;IACAT,MAAM;MAACM,cAAYJ;MAAIK,aAAWL;SAAOF;;IACzC,GAAGG;EACL,CAAA;AAEAO,YAAUN,KAAKO,UAAUC,SAAAA,QAAAA;;;;;;;;;AACzBF,YAAUN,KAAKO,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUV,KAAKO,SAASC;AAC9B,QAAMG,OAAOX,KAAKO,SAASE;AAE3B,SAAO,MACL,gBAAAG,OAAA,cAACF,SAAAA,MACC,gBAAAE,OAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "z", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "createContext", "useContext", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "shallow", "React", "useEffect", "LocalStorageStore", "log", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "name", "context", "children", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "definition", "Boolean", "initializePlugin", "catch", "err", "console", "error", "then", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "p", "contexts", "reduce", "Acc", "Next", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "React", "this", "fallback", "reset", "children", "setState", "React", "forwardRef", "Fragment", "createContext", "useContext", "Surface", "forwardRef", "role", "name", "fallback", "rest", "forwardedRef", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "ref", "createContext", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "length", "contentFallback", "Object", "entries", "map", "key", "component", "result", "Fragment", "undefined", "filter", "Component", "Boolean", "limit", "slice", "React", "invariant", "createApp", "order", "plugins", "core", "map", "id", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2213,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":7754,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2058,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3465,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":748,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-framework/src/plugins/common/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/sdk/app-framework/src/plugins/common/metadata.ts","kind":"import-statement","original":"./metadata"},{"path":"packages/sdk/app-framework/src/plugins/common/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytes":4017,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":1706,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":1874,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":1616,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts","kind":"import-statement","original":"./intent"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytes":5027,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4312,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytes":18429,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx","kind":"import-statement","original":"./PluginHost"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1954,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4120,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2395,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":10679,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytes":794,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx","kind":"import-statement","original":"./Surface"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/index.ts":{"bytes":854,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/index.ts","kind":"import-statement","original":"./common"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts","kind":"import-statement","original":"./IntentPlugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/index.ts","kind":"import-statement","original":"./PluginHost"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"./SurfacePlugin"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytes":690,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":698,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":4010,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":7167,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6786,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":34371},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentProvider","Layout","LayoutAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","Surface","SurfaceProvider","createApp","filterPlugins","findPlugin","getPlugin","initializePlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parsePluginHost","parseRootSurfacePlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","usePlugin","usePlugins","useResolvePlugin","useSurface"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1724},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytesInOutput":357},"packages/sdk/app-framework/src/plugins/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytesInOutput":241},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":545},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":4475},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":676},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2029},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1128}},"bytes":13284},"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytesInOutput":680}},"bytes":985},"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2799},"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurface"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":235},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":879},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3442},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytesInOutput":1348}},"bytes":1672},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2163},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":184},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":231},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":857},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2110},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["filterPlugins","findPlugin","getPlugin","resolvePlugin"],"inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":525}},"bytes":695}}}
|
|
1
|
+
{"inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2213,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":7754,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2058,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3465,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":748,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-framework/src/plugins/common/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/sdk/app-framework/src/plugins/common/metadata.ts","kind":"import-statement","original":"./metadata"},{"path":"packages/sdk/app-framework/src/plugins/common/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytes":4017,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":1706,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":1874,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":1616,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts","kind":"import-statement","original":"./intent"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytes":5027,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4312,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytes":18413,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx","kind":"import-statement","original":"./PluginHost"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1954,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4120,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2395,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":10679,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytes":794,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx","kind":"import-statement","original":"./Surface"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/index.ts":{"bytes":854,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/index.ts","kind":"import-statement","original":"./common"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts","kind":"import-statement","original":"./IntentPlugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/index.ts","kind":"import-statement","original":"./PluginHost"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"./SurfacePlugin"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytes":690,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":698,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":4010,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":7167,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":34423},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentProvider","Layout","LayoutAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","Surface","SurfaceProvider","createApp","filterPlugins","findPlugin","getPlugin","initializePlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parsePluginHost","parseRootSurfacePlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","usePlugin","usePlugins","useResolvePlugin","useSurface"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1724},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytesInOutput":357},"packages/sdk/app-framework/src/plugins/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytesInOutput":241},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":545},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":4479},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":676},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2029},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1151}},"bytes":13311},"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytesInOutput":680}},"bytes":985},"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2799},"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurface"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":235},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":879},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3442},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytesInOutput":1348}},"bytes":1672},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2163},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":184},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":231},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":857},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2110},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["filterPlugins","findPlugin","getPlugin","resolvePlugin"],"inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":525}},"bytes":695}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -374,7 +374,7 @@ var import_log = require("@dxos/log");
|
|
|
374
374
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
375
375
|
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
376
376
|
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
377
|
-
var PluginHost = ({ order, plugins: definitions, core =
|
|
377
|
+
var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = null }) => {
|
|
378
378
|
const state = new import_local_storage.LocalStorageStore(PLUGIN_HOST, {
|
|
379
379
|
ready: false,
|
|
380
380
|
enabled: [
|
|
@@ -395,7 +395,8 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
395
395
|
state.prop(state.values.$enabled, "enabled", import_local_storage.LocalStorageStore.json);
|
|
396
396
|
return {
|
|
397
397
|
meta: {
|
|
398
|
-
id: PLUGIN_HOST
|
|
398
|
+
id: PLUGIN_HOST,
|
|
399
|
+
name: "Plugin host"
|
|
399
400
|
},
|
|
400
401
|
provides: {
|
|
401
402
|
plugins: state.values,
|
|
@@ -408,7 +409,7 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
408
409
|
enabled: state.values.enabled
|
|
409
410
|
}, {
|
|
410
411
|
F: __dxlog_file,
|
|
411
|
-
L:
|
|
412
|
+
L: 66,
|
|
412
413
|
S: void 0,
|
|
413
414
|
C: (f, a) => f(...a)
|
|
414
415
|
});
|
|
@@ -433,7 +434,7 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
433
434
|
plugins
|
|
434
435
|
}, {
|
|
435
436
|
F: __dxlog_file,
|
|
436
|
-
L:
|
|
437
|
+
L: 91,
|
|
437
438
|
S: void 0,
|
|
438
439
|
C: (f, a) => f(...a)
|
|
439
440
|
});
|
|
@@ -444,7 +445,7 @@ var PluginHost = ({ order, plugins: definitions, core = order.map(({ id }) => id
|
|
|
444
445
|
plugins
|
|
445
446
|
}, {
|
|
446
447
|
F: __dxlog_file,
|
|
447
|
-
L:
|
|
448
|
+
L: 98,
|
|
448
449
|
S: void 0,
|
|
449
450
|
C: (f, a) => f(...a)
|
|
450
451
|
});
|
|
@@ -600,7 +601,7 @@ var import_invariant = require("@dxos/invariant");
|
|
|
600
601
|
init_meta();
|
|
601
602
|
init_meta2();
|
|
602
603
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
603
|
-
var createApp = ({ order, plugins, core =
|
|
604
|
+
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
604
605
|
const host = PluginHost({
|
|
605
606
|
order: [
|
|
606
607
|
meta_default2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/helpers.ts", "../../../src/plugins/IntentPlugin/provides.ts", "../../../src/plugins/IntentPlugin/IntentContext.tsx", "../../../src/plugins/SurfacePlugin/provides.ts", "../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx", "../../../src/plugins/IntentPlugin/meta.ts", "../../../src/plugins/SurfacePlugin/meta.ts", "../../../src/plugins/SurfacePlugin/plugin.tsx", "../../../src/plugins/IntentPlugin/plugin.tsx", "../../../src/index.ts", "../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/index.ts", "../../../src/plugins/IntentPlugin/index.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/index.ts", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { raise } from '@dxos/debug';\n\nimport { type Plugin } from './PluginHost';\n\n/**\n * Find a plugin by ID.\n */\nexport const findPlugin = <T>(plugins: Plugin[], id: string): Plugin<T> | undefined => {\n return plugins.find(\n (plugin) => plugin.meta.id === id || (typeof plugin.meta.shortId === 'string' && plugin.meta.shortId === id),\n ) as Plugin<T>;\n};\n\n/**\n * Find a plugin by ID, or raise an error if not found.\n */\nexport const getPlugin = <T>(plugins: Plugin[], id: string): Plugin<T> => {\n return findPlugin(plugins, id) ?? raise(new Error(`Plugin not found: ${id}`));\n};\n\n/**\n * Filter a list of plugins to only those that match a predicate.\n */\nexport const filterPlugins = <T>(\n plugins: Plugin[],\n predicate: (plugin: Plugin) => Plugin<T> | undefined,\n): Plugin<T>[] => plugins.map((plugin) => predicate(plugin)).filter((plugin): plugin is Plugin<T> => !!plugin);\n\n/**\n * Resolves a plugin by predicate.\n *\n * @example\n * import { parseIntentPlugin, resolvePlugin } from '@dxos/app-framework';\n * const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n */\nexport const resolvePlugin = <T>(\n plugins: Plugin[],\n predicate: (plugin: Plugin) => Plugin<T> | undefined,\n): Plugin<T> | undefined => filterPlugins(plugins, predicate)[0];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type IntentContext } from './IntentContext';\nimport { type Intent } from './intent';\nimport { type Plugin } from '../PluginHost';\n\nexport type IntentResolverProvides = {\n intent: {\n resolver: (intent: Intent, plugins: Plugin[]) => any;\n };\n};\n\nexport type IntentPluginProvides = {\n intent: IntentContext;\n};\n\nexport const parseIntentPlugin = (plugin: Plugin) =>\n (plugin.provides as any).intent?.dispatch ? (plugin as Plugin<IntentPluginProvides>) : undefined;\n\nexport const parseIntentResolverPlugin = (plugin: Plugin) =>\n (plugin.provides as any).intent?.resolver ? (plugin as Plugin<IntentResolverProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, createContext, useContext, type Provider } from 'react';\n\nimport { type DispatchIntent } from './intent';\n\nexport type IntentContext = {\n dispatch: DispatchIntent;\n};\n\nconst IntentContext: Context<IntentContext> = createContext<IntentContext>({ dispatch: async () => {} });\n\nexport const useIntent = () => useContext(IntentContext);\n\nexport const IntentProvider: Provider<IntentContext> = IntentContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../PluginHost';\n\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type Context, type Provider, type ReactNode, type ForwardedRef } from 'react';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Function which resolves a Surface.\n *\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (props: SurfaceComponentProps, forwardedRef: ForwardedRef<HTMLElement>) => ReactNode;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n};\n\nconst SurfaceRootContext: Context<SurfaceRootContext> = createContext<SurfaceRootContext>({ components: {} });\n\nexport const useSurface = () => useContext(SurfaceRootContext);\n\nexport const SurfaceProvider: Provider<SurfaceRootContext> = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst IntentMeta = {\n id: 'dxos.org/plugin/intent',\n};\n\nexport default IntentMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { deepSignal, shallow } from 'deepsignal/react';\nimport React from 'react';\n\nimport { SurfaceProvider, type SurfaceRootContext } from './SurfaceRootContext';\nimport SurfaceMeta from './meta';\nimport { parseSurfacePlugin, type SurfacePluginProvides } from './provides';\nimport type { PluginDefinition } from '../PluginHost';\nimport { filterPlugins } from '../helpers';\n\n/**\n * Provides a registry of surface components.\n */\nconst SurfacePlugin = (): PluginDefinition<SurfacePluginProvides> => {\n const state = deepSignal<SurfaceRootContext>({ components: {} });\n\n return {\n meta: SurfaceMeta,\n ready: async (plugins) => {\n state.components = shallow(\n filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {\n return { ...acc, [plugin.meta.id]: plugin.provides.surface.component };\n }, {}),\n );\n },\n provides: {\n surface: state,\n context: ({ children }) => <SurfaceProvider value={state}>{children}</SurfaceProvider>,\n },\n };\n};\n\nexport default SurfacePlugin;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { deepSignal } from 'deepsignal/react';\nimport React from 'react';\n\nimport { type IntentContext, IntentProvider } from './IntentContext';\nimport type { Intent } from './intent';\nimport IntentMeta from './meta';\nimport { type IntentPluginProvides, type IntentResolverProvides, parseIntentResolverPlugin } from './provides';\nimport type { PluginDefinition } from '../PluginHost';\nimport { filterPlugins, findPlugin } from '../helpers';\n\n/**\n * Allows plugins to register intent handlers and routes sent intents to the appropriate plugin.\n * Inspired by https://developer.android.com/reference/android/content/Intent.\n */\nconst IntentPlugin = (): PluginDefinition<IntentPluginProvides> => {\n const state = deepSignal<IntentContext>({ dispatch: async () => {} });\n\n return {\n meta: IntentMeta,\n ready: async (plugins) => {\n // Dispatch intent to associated plugin.\n const dispatch = async (intent: Intent) => {\n if (intent.plugin) {\n const plugin = findPlugin<IntentResolverProvides>(plugins, intent.plugin);\n return plugin?.provides.intent.resolver(intent, plugins);\n }\n\n // Return resolved value from first plugin that handles the intent.\n for (const plugin of filterPlugins(plugins, parseIntentResolverPlugin)) {\n const result = await plugin.provides.intent.resolver(intent, plugins);\n if (result) {\n return result;\n }\n }\n };\n\n // Sequentially dispatch array of invents.\n state.dispatch = async (intentOrArray) => {\n let result: any = null;\n for (const intent of Array.isArray(intentOrArray) ? intentOrArray : [intentOrArray]) {\n const data = intent.data ? { ...result, ...intent.data } : result;\n result = await dispatch({ ...intent, data });\n }\n return result;\n };\n },\n provides: {\n intent: state,\n context: ({ children }) => <IntentProvider value={state}>{children}</IntentProvider>,\n },\n };\n};\n\nexport default IntentPlugin;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './plugins';\n\nexport * from './App';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphPluginProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphPluginProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './common';\nexport * from './helpers';\n\nexport * from './IntentPlugin';\nexport * from './PluginHost';\nexport * from './SurfacePlugin';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './intent';\nexport * from './provides';\n\nexport * from './IntentContext';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = order.map(({ id }) => id),\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './provides';\n\nexport * from './ErrorBoundary';\nexport * from './Surface';\nexport * from './SurfaceRootContext';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { forwardRef, type FC, type ReactNode, Fragment, type ForwardedRef, type PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]) => {\n const result = component({ ...props, data }, forwardedRef);\n return result ? <Fragment key={key}>{result}</Fragment> : undefined;\n })\n .filter((Component): Component is JSX.Element => Boolean(Component));\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = [], ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAIA,cAOaA,YASAC,WAOAC,eAYAC;AAvCb;;;AAIA,mBAAsB;AAOf,IAAMH,aAAa,CAAII,SAAmBC,OAAAA;AAC/C,aAAOD,QAAQE,KACb,CAACC,WAAWA,OAAOC,KAAKH,OAAOA,MAAO,OAAOE,OAAOC,KAAKC,YAAY,YAAYF,OAAOC,KAAKC,YAAYJ,EAAAA;IAE7G;AAKO,IAAMJ,YAAY,CAAIG,SAAmBC,OAAAA;AAC9C,aAAOL,WAAWI,SAASC,EAAAA,SAAOK,oBAAM,IAAIC,MAAM,qBAAqBN,EAAAA,EAAI,CAAA;IAC7E;AAKO,IAAMH,gBAAgB,CAC3BE,SACAQ,cACgBR,QAAQS,IAAI,CAACN,WAAWK,UAAUL,MAAAA,CAAAA,EAASO,OAAO,CAACP,WAAgC,CAAC,CAACA,MAAAA;AAShG,IAAMJ,gBAAgB,CAC3BC,SACAQ,cAC0BV,cAAcE,SAASQ,SAAAA,EAAW,CAAA;;;;;AC1C9D,IAkBaG,mBAGAC;AArBb;;;AAkBO,IAAMD,oBAAoB,CAACE,WAC/BA,OAAOC,SAAiBC,QAAQC,WAAYH,SAA0CI;AAElF,IAAML,4BAA4B,CAACC,WACvCA,OAAOC,SAAiBC,QAAQG,WAAYL,SAA4CI;;;;;ACtB3F,IAIA,cAQME,eAEOC,WAEAC;AAhBb;;;AA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wCC,QAAQD,UAAAA,CAAAA;AAE3D,SAAO9B,MAAMgC,QAAQlB,MAAMmB,MAAM,GAAGjC,MAAMgC,KAAK,IAAIlB;AACrD;;;AFzHA;;;AGJA,IAAAoB,iBAAkB;AAElB,uBAA0B;AAG1B;AACAC;;AA4BO,IAAMC,YAAY,CAAC,EAAEC,OAAOC,SAASC,OAAO,CAAA,GAAI,GAAGC,OAAAA,MAAgC;AACxF,QAAMC,OAAOC,WAAW;IACtBL,OAAO;MAACM;MAAaC;SAAeP;;IACpCC,SAAS;MACP,GAAGA;MACH,CAACK,cAAYE,EAAE,GAAGC,OAAOC,KAAK,MAAM,6DAAO;MAC3C,CAACH,aAAWC,EAAE,GAAGC,OAAOC,KAAK,MAAM,+DAAO;IAC5C;IACAR,MAAM;MAACI,cAAYE;MAAID,aAAWC;SAAON;;IACzC,GAAGC;EACL,CAAA;AAEAQ,kCAAUP,KAAKQ,UAAUC,SAAAA,QAAAA;;;;;;;;;AACzBF,kCAAUP,KAAKQ,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUX,KAAKQ,SAASC;AAC9B,QAAMG,OAAOZ,KAAKQ,SAASE;AAE3B,SAAO,MACL,+BAAAG,QAAA,cAACF,SAAAA,MACC,+BAAAE,QAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
-
"names": ["findPlugin", "getPlugin", "filterPlugins", "resolvePlugin", "plugins", "id", "find", "plugin", "meta", "shortId", "raise", "Error", "predicate", "map", "filter", "parseIntentPlugin", "parseIntentResolverPlugin", "plugin", "provides", "intent", "dispatch", "undefined", "resolver", "IntentContext", "useIntent", "IntentProvider", "createContext", "dispatch", "useContext", "Provider", "parseRootSurfacePlugin", "parseSurfacePlugin", "init_provides", "plugin", "provides", "surface", "components", "undefined", "component", "import_react", "SurfaceRootContext", "useSurface", "SurfaceProvider", "createContext", "components", "useContext", "Provider", "IntentMeta", "id", "SurfaceMeta", "meta_default", "init_meta", "id", "import_react", "SurfacePlugin", "init_meta", "init_provides", "state", "deepSignal", "components", "meta", "SurfaceMeta", "ready", "plugins", "shallow", "filterPlugins", "parseSurfacePlugin", "reduce", "acc", "plugin", "id", "provides", "surface", "component", "context", "children", "React", "SurfaceProvider", "value", "plugin_exports", "plugin_default", "import_react", "IntentPlugin", "init_plugin", "state", "deepSignal", "dispatch", "meta", "IntentMeta", "ready", "plugins", "intent", "plugin", "findPlugin", "provides", "resolver", "filterPlugins", "parseIntentResolverPlugin", "result", "intentOrArray", "Array", "isArray", "data", "context", "children", "React", "IntentProvider", "value", "parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "import_zod", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "import_react", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "import_react", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { raise } from '@dxos/debug';\n\nimport { type Plugin } from './PluginHost';\n\n/**\n * Find a plugin by ID.\n */\nexport const findPlugin = <T>(plugins: Plugin[], id: string): Plugin<T> | undefined => {\n return plugins.find(\n (plugin) => plugin.meta.id === id || (typeof plugin.meta.shortId === 'string' && plugin.meta.shortId === id),\n ) as Plugin<T>;\n};\n\n/**\n * Find a plugin by ID, or raise an error if not found.\n */\nexport const getPlugin = <T>(plugins: Plugin[], id: string): Plugin<T> => {\n return findPlugin(plugins, id) ?? raise(new Error(`Plugin not found: ${id}`));\n};\n\n/**\n * Filter a list of plugins to only those that match a predicate.\n */\nexport const filterPlugins = <T>(\n plugins: Plugin[],\n predicate: (plugin: Plugin) => Plugin<T> | undefined,\n): Plugin<T>[] => plugins.map((plugin) => predicate(plugin)).filter((plugin): plugin is Plugin<T> => !!plugin);\n\n/**\n * Resolves a plugin by predicate.\n *\n * @example\n * import { parseIntentPlugin, resolvePlugin } from '@dxos/app-framework';\n * const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n */\nexport const resolvePlugin = <T>(\n plugins: Plugin[],\n predicate: (plugin: Plugin) => Plugin<T> | undefined,\n): Plugin<T> | undefined => filterPlugins(plugins, predicate)[0];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type IntentContext } from './IntentContext';\nimport { type Intent } from './intent';\nimport { type Plugin } from '../PluginHost';\n\nexport type IntentResolverProvides = {\n intent: {\n resolver: (intent: Intent, plugins: Plugin[]) => any;\n };\n};\n\nexport type IntentPluginProvides = {\n intent: IntentContext;\n};\n\nexport const parseIntentPlugin = (plugin: Plugin) =>\n (plugin.provides as any).intent?.dispatch ? (plugin as Plugin<IntentPluginProvides>) : undefined;\n\nexport const parseIntentResolverPlugin = (plugin: Plugin) =>\n (plugin.provides as any).intent?.resolver ? (plugin as Plugin<IntentResolverProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, createContext, useContext, type Provider } from 'react';\n\nimport { type DispatchIntent } from './intent';\n\nexport type IntentContext = {\n dispatch: DispatchIntent;\n};\n\nconst IntentContext: Context<IntentContext> = createContext<IntentContext>({ dispatch: async () => {} });\n\nexport const useIntent = () => useContext(IntentContext);\n\nexport const IntentProvider: Provider<IntentContext> = IntentContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../PluginHost';\n\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type Context, type Provider, type ReactNode, type ForwardedRef } from 'react';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Function which resolves a Surface.\n *\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (props: SurfaceComponentProps, forwardedRef: ForwardedRef<HTMLElement>) => ReactNode;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n};\n\nconst SurfaceRootContext: Context<SurfaceRootContext> = createContext<SurfaceRootContext>({ components: {} });\n\nexport const useSurface = () => useContext(SurfaceRootContext);\n\nexport const SurfaceProvider: Provider<SurfaceRootContext> = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst IntentMeta = {\n id: 'dxos.org/plugin/intent',\n};\n\nexport default IntentMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { deepSignal, shallow } from 'deepsignal/react';\nimport React from 'react';\n\nimport { SurfaceProvider, type SurfaceRootContext } from './SurfaceRootContext';\nimport SurfaceMeta from './meta';\nimport { parseSurfacePlugin, type SurfacePluginProvides } from './provides';\nimport type { PluginDefinition } from '../PluginHost';\nimport { filterPlugins } from '../helpers';\n\n/**\n * Provides a registry of surface components.\n */\nconst SurfacePlugin = (): PluginDefinition<SurfacePluginProvides> => {\n const state = deepSignal<SurfaceRootContext>({ components: {} });\n\n return {\n meta: SurfaceMeta,\n ready: async (plugins) => {\n state.components = shallow(\n filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {\n return { ...acc, [plugin.meta.id]: plugin.provides.surface.component };\n }, {}),\n );\n },\n provides: {\n surface: state,\n context: ({ children }) => <SurfaceProvider value={state}>{children}</SurfaceProvider>,\n },\n };\n};\n\nexport default SurfacePlugin;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { deepSignal } from 'deepsignal/react';\nimport React from 'react';\n\nimport { type IntentContext, IntentProvider } from './IntentContext';\nimport type { Intent } from './intent';\nimport IntentMeta from './meta';\nimport { type IntentPluginProvides, type IntentResolverProvides, parseIntentResolverPlugin } from './provides';\nimport type { PluginDefinition } from '../PluginHost';\nimport { filterPlugins, findPlugin } from '../helpers';\n\n/**\n * Allows plugins to register intent handlers and routes sent intents to the appropriate plugin.\n * Inspired by https://developer.android.com/reference/android/content/Intent.\n */\nconst IntentPlugin = (): PluginDefinition<IntentPluginProvides> => {\n const state = deepSignal<IntentContext>({ dispatch: async () => {} });\n\n return {\n meta: IntentMeta,\n ready: async (plugins) => {\n // Dispatch intent to associated plugin.\n const dispatch = async (intent: Intent) => {\n if (intent.plugin) {\n const plugin = findPlugin<IntentResolverProvides>(plugins, intent.plugin);\n return plugin?.provides.intent.resolver(intent, plugins);\n }\n\n // Return resolved value from first plugin that handles the intent.\n for (const plugin of filterPlugins(plugins, parseIntentResolverPlugin)) {\n const result = await plugin.provides.intent.resolver(intent, plugins);\n if (result) {\n return result;\n }\n }\n };\n\n // Sequentially dispatch array of invents.\n state.dispatch = async (intentOrArray) => {\n let result: any = null;\n for (const intent of Array.isArray(intentOrArray) ? intentOrArray : [intentOrArray]) {\n const data = intent.data ? { ...result, ...intent.data } : result;\n result = await dispatch({ ...intent, data });\n }\n return result;\n };\n },\n provides: {\n intent: state,\n context: ({ children }) => <IntentProvider value={state}>{children}</IntentProvider>,\n },\n };\n};\n\nexport default IntentPlugin;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './plugins';\n\nexport * from './App';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphPluginProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphPluginProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './common';\nexport * from './helpers';\n\nexport * from './IntentPlugin';\nexport * from './PluginHost';\nexport * from './SurfacePlugin';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './intent';\nexport * from './provides';\n\nexport * from './IntentContext';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './provides';\n\nexport * from './ErrorBoundary';\nexport * from './Surface';\nexport * from './SurfaceRootContext';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { forwardRef, type FC, type ReactNode, Fragment, type ForwardedRef, type PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]) => {\n const result = component({ ...props, data }, forwardedRef);\n return result ? <Fragment key={key}>{result}</Fragment> : undefined;\n })\n .filter((Component): Component is JSX.Element => Boolean(Component));\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\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C;SAAeT;;IACpCC,SAAS;MACP,GAAGA;MACH,CAACO,cAAYJ,EAAE,GAAGM,OAAOC,KAAK,MAAM,6DAAO;MAC3C,CAACF,aAAWL,EAAE,GAAGM,OAAOC,KAAK,MAAM,+DAAO;IAC5C;IACAT,MAAM;MAACM,cAAYJ;MAAIK,aAAWL;SAAOF;;IACzC,GAAGG;EACL,CAAA;AAEAO,kCAAUN,KAAKO,UAAUC,SAAAA,QAAAA;;;;;;;;;AACzBF,kCAAUN,KAAKO,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUV,KAAKO,SAASC;AAC9B,QAAMG,OAAOX,KAAKO,SAASE;AAE3B,SAAO,MACL,+BAAAG,QAAA,cAACF,SAAAA,MACC,+BAAAE,QAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["findPlugin", "getPlugin", "filterPlugins", "resolvePlugin", "plugins", "id", "find", "plugin", "meta", "shortId", "raise", "Error", "predicate", "map", "filter", "parseIntentPlugin", "parseIntentResolverPlugin", "plugin", "provides", "intent", "dispatch", "undefined", "resolver", "IntentContext", "useIntent", "IntentProvider", "createContext", "dispatch", "useContext", "Provider", "parseRootSurfacePlugin", "parseSurfacePlugin", "init_provides", "plugin", "provides", "surface", "components", "undefined", "component", "import_react", "SurfaceRootContext", "useSurface", "SurfaceProvider", "createContext", "components", "useContext", "Provider", "IntentMeta", "id", "SurfaceMeta", "meta_default", "init_meta", "id", "import_react", "SurfacePlugin", "init_meta", "init_provides", "state", "deepSignal", "components", "meta", "SurfaceMeta", "ready", "plugins", "shallow", "filterPlugins", "parseSurfacePlugin", "reduce", "acc", "plugin", "id", "provides", "surface", "component", "context", "children", "React", "SurfaceProvider", "value", "plugin_exports", "plugin_default", "import_react", "IntentPlugin", "init_plugin", "state", "deepSignal", "dispatch", "meta", "IntentMeta", "ready", "plugins", "intent", "plugin", "findPlugin", "provides", "resolver", "filterPlugins", "parseIntentResolverPlugin", "result", "intentOrArray", "Array", "isArray", "data", "context", "children", "React", "IntentProvider", "value", "parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "import_zod", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "import_react", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "import_react", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "name", "context", "children", "React", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "definition", "Boolean", "initializePlugin", "catch", "err", "console", "error", "then", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "p", "contexts", "reduce", "Acc", "Next", "init_provides", "import_react", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "React", "this", "fallback", "reset", "children", "setState", "import_react", "Surface", "forwardRef", "role", "name", "fallback", "rest", "forwardedRef", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "ref", "createContext", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "length", "contentFallback", "Object", "entries", "map", "key", "component", "result", "Fragment", "undefined", "filter", "Component", "Boolean", "limit", "slice", "import_react", "init_meta", "createApp", "order", "plugins", "core", "map", "id", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2213,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":7754,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2058,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3465,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":748,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-framework/src/plugins/common/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/sdk/app-framework/src/plugins/common/metadata.ts","kind":"import-statement","original":"./metadata"},{"path":"packages/sdk/app-framework/src/plugins/common/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytes":4017,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":1706,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":1874,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":1616,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts","kind":"import-statement","original":"./intent"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytes":5027,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4312,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytes":18429,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx","kind":"import-statement","original":"./PluginHost"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1954,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4120,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2395,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":10679,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytes":794,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx","kind":"import-statement","original":"./Surface"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/index.ts":{"bytes":854,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/index.ts","kind":"import-statement","original":"./common"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts","kind":"import-statement","original":"./IntentPlugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/index.ts","kind":"import-statement","original":"./PluginHost"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"./SurfacePlugin"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytes":690,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":698,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":4010,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":7167,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6786,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":47746},"packages/sdk/app-framework/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/debug","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"deepsignal/react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"deepsignal/react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"zod","kind":"require-call","external":true},{"path":"zod","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"deepsignal/react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dxos/local-storage","kind":"require-call","external":true},{"path":"@dxos/log","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":747},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":360},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":462},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":367},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":484},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":240},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":248},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytesInOutput":1203},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytesInOutput":1952},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":1503},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1853},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytesInOutput":437},"packages/sdk/app-framework/src/plugins/index.ts":{"bytesInOutput":16},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytesInOutput":39},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytesInOutput":241},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":586},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":4733},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":45},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":709},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2229},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1319}},"bytes":23989}}}
|
|
1
|
+
{"inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2213,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":7754,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2058,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3465,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":748,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-framework/src/plugins/common/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/sdk/app-framework/src/plugins/common/metadata.ts","kind":"import-statement","original":"./metadata"},{"path":"packages/sdk/app-framework/src/plugins/common/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytes":4017,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":1706,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":1874,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":1616,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts","kind":"import-statement","original":"./intent"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytes":5027,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4312,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytes":18413,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx","kind":"import-statement","original":"./PluginHost"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1954,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4120,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2395,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":10679,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytes":794,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx","kind":"import-statement","original":"./Surface"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/index.ts":{"bytes":854,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/index.ts","kind":"import-statement","original":"./common"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts","kind":"import-statement","original":"./IntentPlugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/index.ts","kind":"import-statement","original":"./PluginHost"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"./SurfacePlugin"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytes":690,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":698,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":4010,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":7167,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":47799},"packages/sdk/app-framework/dist/lib/node/index.cjs":{"imports":[{"path":"@dxos/debug","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"deepsignal/react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"deepsignal/react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"zod","kind":"require-call","external":true},{"path":"zod","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"deepsignal/react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dxos/local-storage","kind":"require-call","external":true},{"path":"@dxos/log","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":747},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":360},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":462},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":367},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":484},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":240},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":248},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytesInOutput":1203},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytesInOutput":1952},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":1503},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1853},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytesInOutput":437},"packages/sdk/app-framework/src/plugins/index.ts":{"bytesInOutput":16},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytesInOutput":39},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytesInOutput":241},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":586},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":4737},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":45},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":709},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2229},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1342}},"bytes":24016}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/App.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,sBAAsB,EAAsB,MAAM,WAAW,CAAC;AAI5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/App.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,sBAAsB,EAAsB,MAAM,WAAW,CAAC;AAI5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,wCAAqE,sBAAsB,sBAsBhH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginHost.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginHost.tsx"],"names":[],"mappings":"AAKA,OAAc,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK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AC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,MAAM,2CACwD,CAAC;AAIvG;;GAEG;AACH,eAAO,MAAM,UAAU,+DAMpB,sBAAsB,KAAG,iBAAiB,kBAAkB,CAkF9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,4EAS5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/app-framework",
|
|
3
|
-
"version": "0.3.7-main.
|
|
3
|
+
"version": "0.3.7-main.ea9e237",
|
|
4
4
|
"description": "A framework for building applications from composible plugins.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"@preact/signals-react": "^1.3.6",
|
|
17
17
|
"deepsignal": "1.4.0-shallow.0",
|
|
18
18
|
"zod": "^3.19.1",
|
|
19
|
-
"@dxos/
|
|
20
|
-
"@dxos/
|
|
21
|
-
"@dxos/
|
|
22
|
-
"@dxos/
|
|
23
|
-
"@dxos/
|
|
24
|
-
"@dxos/
|
|
19
|
+
"@dxos/app-graph": "0.3.7-main.ea9e237",
|
|
20
|
+
"@dxos/invariant": "0.3.7-main.ea9e237",
|
|
21
|
+
"@dxos/local-storage": "0.3.7-main.ea9e237",
|
|
22
|
+
"@dxos/log": "0.3.7-main.ea9e237",
|
|
23
|
+
"@dxos/debug": "0.3.7-main.ea9e237",
|
|
24
|
+
"@dxos/async": "0.3.7-main.ea9e237"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^18.0.21",
|
package/src/App.tsx
CHANGED
|
@@ -36,7 +36,7 @@ import SurfaceMeta from './plugins/SurfacePlugin/meta';
|
|
|
36
36
|
* @param params.default Default plugins are enabled by default but can be disabled by the user.
|
|
37
37
|
* @param params.fallback Fallback component to render while plugins are initializing.
|
|
38
38
|
*/
|
|
39
|
-
export const createApp = ({ order, plugins, core =
|
|
39
|
+
export const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {
|
|
40
40
|
const host = PluginHost({
|
|
41
41
|
order: [SurfaceMeta, IntentMeta, ...order],
|
|
42
42
|
plugins: {
|
|
@@ -34,7 +34,7 @@ const PLUGIN_HOST = 'dxos.org/plugin/host';
|
|
|
34
34
|
export const PluginHost = ({
|
|
35
35
|
order,
|
|
36
36
|
plugins: definitions,
|
|
37
|
-
core =
|
|
37
|
+
core = [],
|
|
38
38
|
defaults = [],
|
|
39
39
|
fallback = null,
|
|
40
40
|
}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {
|
|
@@ -56,6 +56,7 @@ export const PluginHost = ({
|
|
|
56
56
|
return {
|
|
57
57
|
meta: {
|
|
58
58
|
id: PLUGIN_HOST,
|
|
59
|
+
name: 'Plugin host',
|
|
59
60
|
},
|
|
60
61
|
provides: {
|
|
61
62
|
plugins: state.values,
|