@dxos/app-framework 0.3.7-main.77874ab → 0.3.7-main.f0cd532
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/{chunk-T6Z4W7BV.mjs → chunk-WDA7VA54.mjs} +1 -1
- package/dist/lib/browser/{chunk-T6Z4W7BV.mjs.map → chunk-WDA7VA54.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +20 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{plugin-T5H34MVA.mjs → plugin-XEJ5RYCP.mjs} +2 -2
- package/dist/lib/node/index.cjs +17 -8
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts +9 -4
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +1 -1
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts +8 -2
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/plugins/SurfacePlugin/Surface.tsx +33 -24
- package/src/plugins/SurfacePlugin/SurfaceRootContext.tsx +11 -2
- /package/dist/lib/browser/{plugin-T5H34MVA.mjs.map → plugin-XEJ5RYCP.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/SurfacePlugin/provides.ts", "../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx", "../../../src/plugins/SurfacePlugin/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\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 } from 'react';\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 = (
|
|
5
|
-
"mappings": ";AAoBO,IAAMA,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CI;AAExF,IAAMC,qBAAqB,CAACL,WAChCA,QAAQC,UAAkBC,SAASI,YAAaN,SAAqCI;;;ACpBxF,SAASG,eAAeC,
|
|
4
|
+
"sourcesContent": ["//\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 SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n"],
|
|
5
|
+
"mappings": ";AAoBO,IAAMA,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CI;AAExF,IAAMC,qBAAqB,CAACL,WAChCA,QAAQC,UAAkBC,SAASI,YAAaN,SAAqCI;;;ACpBxF,SAASG,eAAeC,kBAAkF;AAsB1G,IAAMC,qBAAkDC,8BAAkC;EAAEC,YAAY,CAAC;AAAE,CAAA;AAEpG,IAAMC,aAAa,MAAMC,WAAWJ,kBAAAA;AAEpC,IAAMK,kBAAgDL,mBAAmBM;;;AC1BhF,IAAMC,cAAc;EAClBC,IAAI;AACN;AAEA,IAAA,eAAeD;",
|
|
6
6
|
"names": ["parseRootSurfacePlugin", "plugin", "provides", "surface", "components", "undefined", "parseSurfacePlugin", "component", "createContext", "useContext", "SurfaceRootContext", "createContext", "components", "useSurface", "useContext", "SurfaceProvider", "Provider", "SurfaceMeta", "id"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
parseRootSurfacePlugin,
|
|
5
5
|
parseSurfacePlugin,
|
|
6
6
|
useSurface
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WDA7VA54.mjs";
|
|
8
8
|
import {
|
|
9
9
|
IntentProvider,
|
|
10
10
|
meta_default,
|
|
@@ -277,9 +277,9 @@ var ErrorBoundary = class extends Component {
|
|
|
277
277
|
};
|
|
278
278
|
|
|
279
279
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
|
|
280
|
-
import React3, { Fragment } from "react";
|
|
280
|
+
import React3, { forwardRef, Fragment } from "react";
|
|
281
281
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
282
|
-
var Surface = ({ role, name = role, fallback, ...rest }) => {
|
|
282
|
+
var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
283
283
|
const props = {
|
|
284
284
|
role,
|
|
285
285
|
name,
|
|
@@ -291,13 +291,19 @@ var Surface = ({ role, name = role, fallback, ...rest }) => {
|
|
|
291
291
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, fallback ? /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
292
292
|
data,
|
|
293
293
|
fallback
|
|
294
|
-
}, /* @__PURE__ */ React3.createElement(SurfaceResolver,
|
|
295
|
-
|
|
294
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceResolver, {
|
|
295
|
+
...props,
|
|
296
|
+
ref: forwardedRef
|
|
297
|
+
})) : /* @__PURE__ */ React3.createElement(SurfaceResolver, {
|
|
298
|
+
...props,
|
|
299
|
+
ref: forwardedRef
|
|
300
|
+
}));
|
|
301
|
+
});
|
|
296
302
|
var SurfaceContext = /* @__PURE__ */ createContext2(null);
|
|
297
|
-
var SurfaceResolver = (props) => {
|
|
303
|
+
var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
298
304
|
const { components } = useSurface();
|
|
299
305
|
const parent = useContext2(SurfaceContext);
|
|
300
|
-
const nodes = resolveNodes(components, props, parent);
|
|
306
|
+
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
301
307
|
const currentContext = {
|
|
302
308
|
...props,
|
|
303
309
|
surfaces: {
|
|
@@ -308,14 +314,17 @@ var SurfaceResolver = (props) => {
|
|
|
308
314
|
return /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
309
315
|
value: currentContext
|
|
310
316
|
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ React3.createElement(props.contentFallback, null) : null);
|
|
311
|
-
};
|
|
312
|
-
var resolveNodes = (components, props, context) => {
|
|
317
|
+
});
|
|
318
|
+
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
313
319
|
const data = {
|
|
314
320
|
...props.name && context?.surfaces?.[props.name]?.data || {},
|
|
315
321
|
...props.data
|
|
316
322
|
};
|
|
317
323
|
const nodes = Object.entries(components).map(([key, component]) => {
|
|
318
|
-
const result = component(
|
|
324
|
+
const result = component({
|
|
325
|
+
...props,
|
|
326
|
+
data
|
|
327
|
+
}, forwardedRef);
|
|
319
328
|
return result ? /* @__PURE__ */ React3.createElement(Fragment, {
|
|
320
329
|
key
|
|
321
330
|
}, result) : void 0;
|
|
@@ -336,7 +345,7 @@ var createApp = ({ order, plugins, core = [], ...params }) => {
|
|
|
336
345
|
],
|
|
337
346
|
plugins: {
|
|
338
347
|
...plugins,
|
|
339
|
-
[meta_default2.id]: Plugin.lazy(() => import("./plugin-
|
|
348
|
+
[meta_default2.id]: Plugin.lazy(() => import("./plugin-XEJ5RYCP.mjs")),
|
|
340
349
|
[meta_default.id]: Plugin.lazy(() => import("./plugin-CBPJO5NB.mjs"))
|
|
341
350
|
},
|
|
342
351
|
core: [
|
|
@@ -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, { Fragment, type FC, type ReactNode } 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 = {\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/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = ({ role, name = role, fallback, ...rest }: SurfaceProps) => {\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} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} />\n )}\n </>\n );\n};\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = (props: SurfaceProps) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent);\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): 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(data, props.role);\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,QAAO,IAAKpB,OAAOqB,UAAWF,OAAOG,SAAiBC,MAAM;AACpE,SAAOH,UAAWD,SAAoCK;AACxD;AAMA,IAAMC,gBAAgB;IAEf;UAAKC,eAAY;AAAZA,EAAAA,cAAAA,cACVC,mBAAAA,IAAoB,GAAGF,aAAAA,oBAAiC,IAAxDE;AADUD,EAAAA,cAAAA,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,QAAQgB,IAAAA,CAAAA;AACnD;AAEA,IAAML,iBAAiB,CAACvD,YAAAA;AACtB,SAAO6D,QAAQ7D,QAAQO,IAAI,CAACuD,MAAMA,EAAE/D,SAAS0B,OAAO,EAAGT,OAAO4B,OAAAA,CAAAA;AAChE;AAEA,IAAMiB,UAAU,CAACE,aAAAA;AACf,SAAO;OAAIA;IAAUC,OAAO,CAACC,KAAKC,SAAS,CAAC,EAAExC,SAAQ,MACpD,sBAAA,cAACuC,KAAAA,MACC,sBAAA,cAACC,MAAAA,MAAMxC,QAAAA,CAAAA,CAAAA;AAGb;;;AC3JA,OAAOyC,UAASC,iBAAkD;AAa3D,IAAMC,gBAAN,cAA4BC,UAAAA;EACjCC,YAAYC,OAAc;AACxB,UAAMA,KAAAA;AACN,SAAKC,QAAQ;MAAEC,OAAOC;IAAU;EAClC;EAEA,OAAOC,yBAAyBF,OAAc;AAC5C,WAAO;MAAEA;IAAM;EACjB;EAESG,mBAAmBC,WAAwB;AAClD,QAAIA,UAAUC,SAAS,KAAKP,MAAMO,MAAM;AACtC,WAAKC,WAAU;IACjB;EACF;EAESC,SAAS;AAChB,QAAI,KAAKR,MAAMC,OAAO;AACpB,aAAO,gBAAAQ,OAAA,cAACC,KAAKX,MAAMY,UAAQ;QAACV,OAAO,KAAKD,MAAMC;QAAOW,OAAO,KAAKL;;IACnE;AAEA,WAAO,KAAKR,MAAMc;EACpB;EAEQN,aAAa;AACnB,SAAKO,SAAS;MAAEb,OAAOC;IAAU,CAAA;EACnC;AACF;;;ACxCA,OAAOa,UAASC,
|
|
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", "map", "id", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "context", "children", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "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", "Fragment", "createContext", "useContext", "Surface", "role", "name", "fallback", "rest", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "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", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "id", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
|
|
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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AASE;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", "map", "id", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "context", "children", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "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", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "id", "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":1967,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":9559,"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":33719},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-T6Z4W7BV.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-T5H34MVA.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":1801},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1128}},"bytes":13056},"packages/sdk/app-framework/dist/lib/browser/plugin-T5H34MVA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-T5H34MVA.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-T6Z4W7BV.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-T6Z4W7BV.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2480},"packages/sdk/app-framework/dist/lib/browser/chunk-T6Z4W7BV.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":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}}}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SurfaceProvider,
|
|
3
3
|
meta_default,
|
|
4
4
|
parseSurfacePlugin
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WDA7VA54.mjs";
|
|
6
6
|
import {
|
|
7
7
|
filterPlugins
|
|
8
8
|
} from "./chunk-CFZ5JAJF.mjs";
|
|
@@ -36,4 +36,4 @@ var plugin_default = SurfacePlugin;
|
|
|
36
36
|
export {
|
|
37
37
|
plugin_default as default
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=plugin-
|
|
39
|
+
//# sourceMappingURL=plugin-XEJ5RYCP.mjs.map
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -538,7 +538,7 @@ var ErrorBoundary = class extends import_react5.Component {
|
|
|
538
538
|
var import_react7 = __toESM(require("react"));
|
|
539
539
|
var import_react8 = require("react");
|
|
540
540
|
init_SurfaceRootContext();
|
|
541
|
-
var Surface = ({ role, name = role, fallback, ...rest }) => {
|
|
541
|
+
var Surface = /* @__PURE__ */ (0, import_react7.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
542
542
|
const props = {
|
|
543
543
|
role,
|
|
544
544
|
name,
|
|
@@ -550,13 +550,19 @@ var Surface = ({ role, name = role, fallback, ...rest }) => {
|
|
|
550
550
|
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, fallback ? /* @__PURE__ */ import_react7.default.createElement(ErrorBoundary, {
|
|
551
551
|
data,
|
|
552
552
|
fallback
|
|
553
|
-
}, /* @__PURE__ */ import_react7.default.createElement(SurfaceResolver,
|
|
554
|
-
|
|
553
|
+
}, /* @__PURE__ */ import_react7.default.createElement(SurfaceResolver, {
|
|
554
|
+
...props,
|
|
555
|
+
ref: forwardedRef
|
|
556
|
+
})) : /* @__PURE__ */ import_react7.default.createElement(SurfaceResolver, {
|
|
557
|
+
...props,
|
|
558
|
+
ref: forwardedRef
|
|
559
|
+
}));
|
|
560
|
+
});
|
|
555
561
|
var SurfaceContext = /* @__PURE__ */ (0, import_react8.createContext)(null);
|
|
556
|
-
var SurfaceResolver = (props) => {
|
|
562
|
+
var SurfaceResolver = /* @__PURE__ */ (0, import_react7.forwardRef)((props, forwardedRef) => {
|
|
557
563
|
const { components } = useSurface();
|
|
558
564
|
const parent = (0, import_react8.useContext)(SurfaceContext);
|
|
559
|
-
const nodes = resolveNodes(components, props, parent);
|
|
565
|
+
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
560
566
|
const currentContext = {
|
|
561
567
|
...props,
|
|
562
568
|
surfaces: {
|
|
@@ -567,14 +573,17 @@ var SurfaceResolver = (props) => {
|
|
|
567
573
|
return /* @__PURE__ */ import_react7.default.createElement(SurfaceContext.Provider, {
|
|
568
574
|
value: currentContext
|
|
569
575
|
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react7.default.createElement(props.contentFallback, null) : null);
|
|
570
|
-
};
|
|
571
|
-
var resolveNodes = (components, props, context) => {
|
|
576
|
+
});
|
|
577
|
+
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
572
578
|
const data = {
|
|
573
579
|
...props.name && context?.surfaces?.[props.name]?.data || {},
|
|
574
580
|
...props.data
|
|
575
581
|
};
|
|
576
582
|
const nodes = Object.entries(components).map(([key, component]) => {
|
|
577
|
-
const result = component(
|
|
583
|
+
const result = component({
|
|
584
|
+
...props,
|
|
585
|
+
data
|
|
586
|
+
}, forwardedRef);
|
|
578
587
|
return result ? /* @__PURE__ */ import_react7.default.createElement(import_react7.Fragment, {
|
|
579
588
|
key
|
|
580
589
|
}, result) : void 0;
|
|
@@ -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 } from 'react';\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 = (data: Record<string, unknown>, role?: string) => 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, { Fragment, type FC, type ReactNode } 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 = {\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/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = ({ role, name = role, fallback, ...rest }: SurfaceProps) => {\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} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} />\n )}\n </>\n );\n};\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = (props: SurfaceProps) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent);\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): 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(data, props.role);\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,CAA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;;;;;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", "map", "id", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "context", "children", "React", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "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", "role", "name", "fallback", "rest", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "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", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "id", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
|
|
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;;;AAIA,mBAAuE;AAQvE,IAAMF,gBAAwCG,gDAA6B;MAAEC,UAAU,YAAA;MAAa;IAAE,CAAA;AAE/F,IAAMH,YA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AIlB;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", "map", "id", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "context", "children", "React", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "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", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "id", "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":1967,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":9559,"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":46795},"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":1975},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1319}},"bytes":23735}}}
|
|
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,10 +1,10 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
1
|
+
import React, { type FC, type PropsWithChildren } from 'react';
|
|
2
2
|
import { ErrorBoundary } from './ErrorBoundary';
|
|
3
3
|
/**
|
|
4
4
|
* Direction determines how multiple components are laid out.
|
|
5
5
|
*/
|
|
6
6
|
export type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';
|
|
7
|
-
export type SurfaceProps = {
|
|
7
|
+
export type SurfaceProps = PropsWithChildren<{
|
|
8
8
|
/**
|
|
9
9
|
* Role defines how the data should be rendered.
|
|
10
10
|
*/
|
|
@@ -40,9 +40,14 @@ export type SurfaceProps = {
|
|
|
40
40
|
* NOTE: This is not yet implemented.
|
|
41
41
|
*/
|
|
42
42
|
direction?: Direction;
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Additional props to pass to the component.
|
|
45
|
+
* These props are not used by Surface itself but may be used by components which resolve the surface.
|
|
46
|
+
*/
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}>;
|
|
44
49
|
/**
|
|
45
50
|
* A surface is a named region of the screen that can be populated by plugins.
|
|
46
51
|
*/
|
|
47
|
-
export declare const Surface:
|
|
52
|
+
export declare const Surface: React.ForwardRefExoticComponent<Pick<SurfaceProps, string | number> & React.RefAttributes<HTMLElement>>;
|
|
48
53
|
//# sourceMappingURL=Surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/Surface.tsx"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/Surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAc,KAAK,EAAE,EAA+C,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGxH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,gBAAgB,GAAG,OAAO,GAAG,eAAe,CAAC;AAEhF,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;IAC3C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;IAEnE;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC;IAE9C;;OAEG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,OAAO,yGAkBnB,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { type Provider, type ReactNode } from 'react';
|
|
1
|
+
import { type Provider, type ReactNode, type ForwardedRef } from 'react';
|
|
2
|
+
import { type SurfaceProps } from './Surface';
|
|
3
|
+
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
4
|
+
[Property in Key]-?: Type[Property];
|
|
5
|
+
};
|
|
6
|
+
type SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;
|
|
2
7
|
/**
|
|
3
8
|
* Function which resolves a Surface.
|
|
4
9
|
*
|
|
5
10
|
* If a null value is returned, the rendering is deferred to other plugins.
|
|
6
11
|
*/
|
|
7
|
-
export type SurfaceComponent = (
|
|
12
|
+
export type SurfaceComponent = (props: SurfaceComponentProps, forwardedRef: ForwardedRef<HTMLElement>) => ReactNode;
|
|
8
13
|
export type SurfaceRootContext = {
|
|
9
14
|
components: Record<string, SurfaceComponent>;
|
|
10
15
|
};
|
|
11
16
|
export declare const useSurface: () => SurfaceRootContext;
|
|
12
17
|
export declare const SurfaceProvider: Provider<SurfaceRootContext>;
|
|
18
|
+
export {};
|
|
13
19
|
//# sourceMappingURL=SurfaceRootContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceRootContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA2C,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SurfaceRootContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA2C,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAElH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,KAAK,oBAAoB,CAAC,IAAI,EAAE,GAAG,SAAS,MAAM,IAAI,IAAI,IAAI,GAAG;KAC9D,QAAQ,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CACpC,CAAC;AAEF,KAAK,qBAAqB,GAAG,oBAAoB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,KAAK,SAAS,CAAC;AAEpH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC9C,CAAC;AAIF,eAAO,MAAM,UAAU,0BAAuC,CAAC;AAE/D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,kBAAkB,CAA+B,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.f0cd532",
|
|
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/debug": "0.3.7-main.
|
|
22
|
-
"@dxos/
|
|
23
|
-
"@dxos/
|
|
24
|
-
"@dxos/log": "0.3.7-main.
|
|
19
|
+
"@dxos/async": "0.3.7-main.f0cd532",
|
|
20
|
+
"@dxos/app-graph": "0.3.7-main.f0cd532",
|
|
21
|
+
"@dxos/debug": "0.3.7-main.f0cd532",
|
|
22
|
+
"@dxos/local-storage": "0.3.7-main.f0cd532",
|
|
23
|
+
"@dxos/invariant": "0.3.7-main.f0cd532",
|
|
24
|
+
"@dxos/log": "0.3.7-main.f0cd532"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^18.0.21",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { forwardRef, type FC, type ReactNode, Fragment, type ForwardedRef, type PropsWithChildren } from 'react';
|
|
6
6
|
import { createContext, useContext } from 'react';
|
|
7
7
|
|
|
8
8
|
import { ErrorBoundary } from './ErrorBoundary';
|
|
@@ -13,7 +13,7 @@ import { type SurfaceComponent, useSurface } from './SurfaceRootContext';
|
|
|
13
13
|
*/
|
|
14
14
|
export type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';
|
|
15
15
|
|
|
16
|
-
export type SurfaceProps = {
|
|
16
|
+
export type SurfaceProps = PropsWithChildren<{
|
|
17
17
|
/**
|
|
18
18
|
* Role defines how the data should be rendered.
|
|
19
19
|
*/
|
|
@@ -56,35 +56,43 @@ export type SurfaceProps = {
|
|
|
56
56
|
* NOTE: This is not yet implemented.
|
|
57
57
|
*/
|
|
58
58
|
direction?: Direction;
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Additional props to pass to the component.
|
|
62
|
+
* These props are not used by Surface itself but may be used by components which resolve the surface.
|
|
63
|
+
*/
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}>;
|
|
60
66
|
|
|
61
67
|
/**
|
|
62
68
|
* A surface is a named region of the screen that can be populated by plugins.
|
|
63
69
|
*/
|
|
64
|
-
export const Surface =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
export const Surface = forwardRef<HTMLElement, SurfaceProps>(
|
|
71
|
+
({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
72
|
+
const props = { role, name, fallback, ...rest };
|
|
73
|
+
const context = useContext(SurfaceContext);
|
|
74
|
+
const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
{fallback ? (
|
|
79
|
+
<ErrorBoundary data={data} fallback={fallback}>
|
|
80
|
+
<SurfaceResolver {...props} ref={forwardedRef} />
|
|
81
|
+
</ErrorBoundary>
|
|
82
|
+
) : (
|
|
83
|
+
<SurfaceResolver {...props} ref={forwardedRef} />
|
|
84
|
+
)}
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
);
|
|
81
89
|
|
|
82
90
|
const SurfaceContext = createContext<SurfaceProps | null>(null);
|
|
83
91
|
|
|
84
|
-
const SurfaceResolver = (props
|
|
92
|
+
const SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {
|
|
85
93
|
const { components } = useSurface();
|
|
86
94
|
const parent = useContext(SurfaceContext);
|
|
87
|
-
const nodes = resolveNodes(components, props, parent);
|
|
95
|
+
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
88
96
|
const currentContext: SurfaceProps = {
|
|
89
97
|
...props,
|
|
90
98
|
surfaces: {
|
|
@@ -98,12 +106,13 @@ const SurfaceResolver = (props: SurfaceProps) => {
|
|
|
98
106
|
{nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}
|
|
99
107
|
</SurfaceContext.Provider>
|
|
100
108
|
);
|
|
101
|
-
};
|
|
109
|
+
});
|
|
102
110
|
|
|
103
111
|
const resolveNodes = (
|
|
104
112
|
components: Record<string, SurfaceComponent>,
|
|
105
113
|
props: SurfaceProps,
|
|
106
114
|
context: SurfaceProps | null,
|
|
115
|
+
forwardedRef: ForwardedRef<HTMLElement>,
|
|
107
116
|
): ReactNode[] => {
|
|
108
117
|
const data = {
|
|
109
118
|
...((props.name && context?.surfaces?.[props.name]?.data) || {}),
|
|
@@ -112,7 +121,7 @@ const resolveNodes = (
|
|
|
112
121
|
|
|
113
122
|
const nodes = Object.entries(components)
|
|
114
123
|
.map(([key, component]) => {
|
|
115
|
-
const result = component(data,
|
|
124
|
+
const result = component({ ...props, data }, forwardedRef);
|
|
116
125
|
return result ? <Fragment key={key}>{result}</Fragment> : undefined;
|
|
117
126
|
})
|
|
118
127
|
.filter((Component): Component is JSX.Element => Boolean(Component));
|
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { createContext, useContext, type Context, type Provider, type ReactNode } from 'react';
|
|
5
|
+
import { createContext, useContext, type Context, type Provider, type ReactNode, type ForwardedRef } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceProps } from './Surface';
|
|
8
|
+
|
|
9
|
+
// TODO(wittjosiah): Factor out.
|
|
10
|
+
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
11
|
+
[Property in Key]-?: Type[Property];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;
|
|
6
15
|
|
|
7
16
|
/**
|
|
8
17
|
* Function which resolves a Surface.
|
|
9
18
|
*
|
|
10
19
|
* If a null value is returned, the rendering is deferred to other plugins.
|
|
11
20
|
*/
|
|
12
|
-
export type SurfaceComponent = (
|
|
21
|
+
export type SurfaceComponent = (props: SurfaceComponentProps, forwardedRef: ForwardedRef<HTMLElement>) => ReactNode;
|
|
13
22
|
|
|
14
23
|
export type SurfaceRootContext = {
|
|
15
24
|
components: Record<string, SurfaceComponent>;
|
|
File without changes
|