@dxos/app-framework 0.4.7-main.ea67fec → 0.4.7-main.f4b92be

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.
Files changed (28) hide show
  1. package/dist/lib/browser/{chunk-CFZ5JAJF.mjs → chunk-S5CI6EUQ.mjs} +3 -1
  2. package/dist/lib/browser/chunk-S5CI6EUQ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -3
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/{plugin-OEWT2YOH.mjs → plugin-6XDXQ3BN.mjs} +2 -2
  7. package/dist/lib/browser/{plugin-ABX2AJYN.mjs → plugin-FYTGDFFS.mjs} +2 -2
  8. package/dist/lib/node/{chunk-VDKZ7AAF.cjs → chunk-62W6CMGM.cjs} +7 -4
  9. package/dist/lib/node/chunk-62W6CMGM.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +11 -9
  11. package/dist/lib/node/index.cjs.map +2 -2
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/{plugin-J7A2JHKR.cjs → plugin-VEIZZVQP.cjs} +7 -7
  14. package/dist/lib/node/{plugin-D3VWRWFN.cjs → plugin-ZJ26B7E5.cjs} +6 -6
  15. package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts +3 -0
  16. package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +1 -1
  17. package/dist/types/src/plugins/helpers.d.ts +4 -0
  18. package/dist/types/src/plugins/helpers.d.ts.map +1 -1
  19. package/package.json +8 -8
  20. package/src/plugins/SurfacePlugin/Surface.tsx +3 -0
  21. package/src/plugins/helpers.ts +5 -0
  22. package/typedoc.json +7 -0
  23. package/dist/lib/browser/chunk-CFZ5JAJF.mjs.map +0 -7
  24. package/dist/lib/node/chunk-VDKZ7AAF.cjs.map +0 -7
  25. /package/dist/lib/browser/{plugin-OEWT2YOH.mjs.map → plugin-6XDXQ3BN.mjs.map} +0 -0
  26. /package/dist/lib/browser/{plugin-ABX2AJYN.mjs.map → plugin-FYTGDFFS.mjs.map} +0 -0
  27. /package/dist/lib/node/{plugin-J7A2JHKR.cjs.map → plugin-VEIZZVQP.cjs.map} +0 -0
  28. /package/dist/lib/node/{plugin-D3VWRWFN.cjs.map → plugin-ZJ26B7E5.cjs.map} +0 -0
@@ -1,5 +1,6 @@
1
1
  // packages/sdk/app-framework/src/plugins/helpers.ts
2
2
  import { raise } from "@dxos/debug";
3
+ var definePlugin = (plugin) => plugin;
3
4
  var findPlugin = (plugins, id) => {
4
5
  return plugins.find((plugin) => plugin.meta.id === id || typeof plugin.meta.shortId === "string" && plugin.meta.shortId === id);
5
6
  };
@@ -10,9 +11,10 @@ var filterPlugins = (plugins, predicate) => plugins.map((plugin) => predicate(pl
10
11
  var resolvePlugin = (plugins, predicate) => filterPlugins(plugins, predicate)[0];
11
12
 
12
13
  export {
14
+ definePlugin,
13
15
  findPlugin,
14
16
  getPlugin,
15
17
  filterPlugins,
16
18
  resolvePlugin
17
19
  };
18
- //# sourceMappingURL=chunk-CFZ5JAJF.mjs.map
20
+ //# sourceMappingURL=chunk-S5CI6EUQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/helpers.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { raise } from '@dxos/debug';\n\nimport { type Plugin } from './PluginHost';\n\n/**\n * Define a plugin\n */\nexport const definePlugin = <TProvides>(plugin: Plugin<TProvides>): Plugin<TProvides> => plugin;\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"],
5
+ "mappings": ";AAIA,SAASA,aAAa;AAOf,IAAMC,eAAe,CAAYC,WAAiDA;AAKlF,IAAMC,aAAa,CAAIC,SAAmBC,OAAAA;AAC/C,SAAOD,QAAQE,KACb,CAACJ,WAAWA,OAAOK,KAAKF,OAAOA,MAAO,OAAOH,OAAOK,KAAKC,YAAY,YAAYN,OAAOK,KAAKC,YAAYH,EAAAA;AAE7G;AAKO,IAAMI,YAAY,CAAIL,SAAmBC,OAAAA;AAC9C,SAAOF,WAAWC,SAASC,EAAAA,KAAOK,MAAM,IAAIC,MAAM,qBAAqBN,EAAAA,EAAI,CAAA;AAC7E;AAKO,IAAMO,gBAAgB,CAC3BR,SACAS,cACgBT,QAAQU,IAAI,CAACZ,WAAWW,UAAUX,MAAAA,CAAAA,EAASa,OAAO,CAACb,WAAgC,CAAC,CAACA,MAAAA;AAShG,IAAMc,gBAAgB,CAC3BZ,SACAS,cAC0BD,cAAcR,SAASS,SAAAA,EAAW,CAAA;",
6
+ "names": ["raise", "definePlugin", "plugin", "findPlugin", "plugins", "id", "find", "meta", "shortId", "getPlugin", "raise", "Error", "filterPlugins", "predicate", "map", "filter", "resolvePlugin"]
7
+ }
@@ -16,11 +16,12 @@ import {
16
16
  useIntentResolver
17
17
  } from "./chunk-J45KR4DI.mjs";
18
18
  import {
19
+ definePlugin,
19
20
  filterPlugins,
20
21
  findPlugin,
21
22
  getPlugin,
22
23
  resolvePlugin
23
- } from "./chunk-CFZ5JAJF.mjs";
24
+ } from "./chunk-S5CI6EUQ.mjs";
24
25
 
25
26
  // packages/sdk/app-framework/src/plugins/common/file.ts
26
27
  var defaultFileTypes = {
@@ -462,8 +463,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
462
463
  ],
463
464
  plugins: {
464
465
  ...plugins,
465
- [meta_default2.id]: Plugin.lazy(() => import("./plugin-OEWT2YOH.mjs")),
466
- [meta_default.id]: Plugin.lazy(() => import("./plugin-ABX2AJYN.mjs"))
466
+ [meta_default2.id]: Plugin.lazy(() => import("./plugin-6XDXQ3BN.mjs")),
467
+ [meta_default.id]: Plugin.lazy(() => import("./plugin-FYTGDFFS.mjs"))
467
468
  },
468
469
  core: [
469
470
  meta_default2.id,
@@ -514,6 +515,7 @@ export {
514
515
  Toast,
515
516
  createApp,
516
517
  defaultFileTypes,
518
+ definePlugin,
517
519
  filterPlugins,
518
520
  findPlugin,
519
521
  getPlugin,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/common/file.ts", "../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/navigation.ts", "../../../src/plugins/common/settings.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/helpers.ts", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport type FileInfo = {\n cid?: string; // TODO(burdon): Meta key? Or other common properties with other file management system?\n};\n\nexport type FileUploader = (file: File) => Promise<FileInfo | undefined>;\n\nexport type FileManagerProvides = {\n file: {\n upload?: FileUploader;\n };\n};\n\n// TODO(burdon): Better match against interface? and Return provided service type. What if multiple?\nexport const parseFileManagerPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).file ? (plugin as Plugin<FileManagerProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph } 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 GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (plugins: Plugin[], graph: Graph) => 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<GraphProvides>) : 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 IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\nexport const Toast = z.object({\n id: z.string(),\n title: z.string().optional(),\n description: z.string().optional(),\n // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.\n icon: z.any().optional(),\n duration: z.number().optional(),\n closeLabel: z.string().optional(),\n actionLabel: z.string().optional(),\n actionAlt: z.string().optional(),\n onAction: z.function().optional(),\n});\n\nexport type Toast = z.infer<typeof Toast>;\n\n/**\n * Basic state provided by a layout plugin.\n *\n * Layout provides the state of global UI landmarks, such as the sidebar, dialog, and popover.\n * Generally only one dialog or popover should be open at a time, a layout plugin should manage this.\n * For other landmarks, such as toasts, rendering them in the layout prevents them from unmounting when navigating.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n\n complementarySidebarOpen: z.boolean(),\n complementarySidebarContent: z.any().optional().describe('Data to be passed to the complementary sidebar Surface.'),\n\n dialogOpen: z.boolean(),\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n\n popoverOpen: z.boolean(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverAnchorId: z.string().optional(),\n\n toasts: z.array(Toast),\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/layout';\nexport enum LayoutAction {\n SET_LAYOUT = `${LAYOUT_ACTION}/set-layout`,\n\n /** @deprecated */\n // TODO(wittjosiah): At minimum this should be renamed, \"focus\" means something very specific on a web page.\n // Consider removing this action entirely, it's maybe not generic enough to live here.\n FOCUS = `${LAYOUT_ACTION}/focus`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type SetLayout = IntentData<{\n /**\n * Element to set the state of.\n */\n element: 'fullscreen' | 'sidebar' | 'complementary' | 'dialog' | 'popover' | 'toast';\n\n /**\n * Whether the element is on or off.\n *\n * If omitted, the element's state will be toggled or set based on other provided data.\n * For example, if `component` is provided, the state will be set to `true`.\n */\n state?: boolean;\n\n /**\n * Component to render in the dialog or popover.\n */\n component?: string;\n\n /**\n * Data to be passed to the dialog or popover Surface.\n */\n subject?: any;\n\n /**\n * Anchor ID for the popover.\n */\n anchorId?: 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 2024 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a navigation plugin.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\n// TODO(wittjosiah): We should align this more with `window.location` along the lines of what React Router does.\nexport const Location = z.object({\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 Location = z.infer<typeof Location>;\n\n/**\n * Provides for a plugin that can manage the app navigation.\n */\nexport type LocationProvides = {\n location: Readonly<Location>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseNavigationPlugin = (plugin: Plugin) => {\n const { success } = Location.safeParse((plugin.provides as any).location);\n return success ? (plugin as Plugin<LocationProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst NAVIGATION_ACTION = 'dxos.org/plugin/navigation';\nexport enum NavigationAction {\n ACTIVATE = `${NAVIGATION_ACTION}/activate`,\n}\n\n/**\n * Expected payload for navigation actions.\n */\nexport namespace NavigationAction {\n export type Activate = IntentData<{\n /**\n * Id to set as active.\n */\n id: string;\n\n /**\n * Location of the active item.\n * Defaults to 'main'.\n */\n key?: string;\n }>;\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\n// TODO(burdon): Plugins should export ts-effect object (see local-storage).\n// TODO(burdon): Auto generate form.\n// TODO(burdon): Set surface's data.type to plugin id (allow custom settings surface).\n\nexport type SettingsProvides<T extends Record<string, any> = Record<string, any>> = {\n settings: T; // TODO(burdon): Read-only.\n};\n\nexport const parseSettingsPlugin = (plugin: Plugin) => {\n return typeof (plugin.provides as any).settings === 'object' ? (plugin as Plugin<SettingsProvides>) : undefined;\n};\n\nconst SETTINGS_ACTION = 'dxos.org/plugin/settings';\nexport enum SettingsAction {\n OPEN = `${SETTINGS_ACTION}/open`,\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 * URL of home page.\n */\n homePage?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: 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> | void>;\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 // TODO(wittjosiah): Rename `ready` to a verb?\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 * Requires reload to take effect.\n */\n setPlugin: (id: string, enabled: boolean) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n setPlugin: () => {},\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, useState } 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';\nimport { ErrorBoundary } from '../SurfacePlugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ErrorBoundary['props']['fallback'];\n placeholder?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = DefaultFallback,\n placeholder = 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 setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled = [...state.values.enabled, id];\n } else {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n }\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n return (\n <ErrorBoundary fallback={fallback}>\n <Root order={order} core={core} definitions={definitions} state={state.values} placeholder={placeholder} />\n </ErrorBoundary>\n );\n },\n },\n };\n};\n\nconst DefaultFallback = ({ error }: { error: Error }) => {\n return (\n <div style={{ padding: '1rem' }}>\n {/* TODO(wittjosiah): Link to docs for replacing default. */}\n <h1 style={{ fontSize: '1.2rem', fontWeight: 700, margin: '0.5rem 0' }}>{error.message}</h1>\n <pre>{error.stack}</pre>\n </div>\n );\n};\n\ntype RootProps = {\n order: PluginDefinition['meta'][];\n state: PluginContext;\n definitions: Record<string, () => Promise<PluginDefinition>>;\n core: string[];\n placeholder: ReactNode;\n};\n\nconst Root = ({ order, core: corePluginIds, definitions, state, placeholder }: RootProps) => {\n const [error, setError] = useState<unknown>();\n\n useEffect(() => {\n log('initializing plugins', { enabled: state.enabled });\n const timeout = setTimeout(async () => {\n try {\n const enabledIds = [...corePluginIds, ...state.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(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));\n log('plugins ready', { plugins });\n\n state.plugins = shallow(plugins);\n state.ready = true;\n } catch (err) {\n setError(err);\n }\n });\n\n return () => {\n clearTimeout(timeout);\n state.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 (error) {\n throw error;\n }\n\n if (!state.ready) {\n return <>{placeholder}</>;\n }\n\n const ComposedContext = composeContext(state.plugins);\n\n return <ComposedContext>{rootComponents(state.plugins)}</ComposedContext>;\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\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\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, {\n forwardRef,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n Suspense,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } 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, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\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, placeholder, ...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 const resolver = <SurfaceResolver {...props} ref={forwardedRef} />;\n const suspense = placeholder ? <Suspense fallback={placeholder}>{resolver}</Suspense> : resolver;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nexport const useSurface = (): SurfaceProps =>\n useContext(SurfaceContext) ?? raise(new Error('Surface context not found'));\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurfaceRoot();\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 <SurfaceContext.Provider value={currentContext}>{nodes}</SurfaceContext.Provider>;\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]): [string, SurfaceResult] | undefined => {\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n return 'node' in result ? [key, result] : isValidElement(result) ? [key, { node: result }] : undefined;\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, a], [, b]) => {\n const aDisposition = a.disposition ?? 'default';\n const bDisposition = b.disposition ?? 'default';\n\n if (aDisposition === bDisposition) {\n return 0;\n } else if (aDisposition === 'hoist' || bDisposition === 'fallback') {\n return -1;\n } else if (bDisposition === 'hoist' || aDisposition === 'fallback') {\n return 1;\n }\n\n return 0;\n })\n .map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAMO,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AKO,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUV,KAAKO,SAASC;AAC9B,QAAMG,QAAOX,KAAKO,SAASE;AAE3B,SAAO,MACL,gBAAAG,OAAA,cAACF,SAAAA,MACC,gBAAAE,OAAA,cAACD,OAAAA,IAAAA,CAAAA;AAGP;",
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport type FileInfo = {\n cid?: string; // TODO(burdon): Meta key? Or other common properties with other file management system?\n};\n\nexport type FileUploader = (file: File) => Promise<FileInfo | undefined>;\n\nexport type FileManagerProvides = {\n file: {\n upload?: FileUploader;\n };\n};\n\n// TODO(burdon): Better match against interface? and Return provided service type. What if multiple?\nexport const parseFileManagerPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).file ? (plugin as Plugin<FileManagerProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph } 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 GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (plugins: Plugin[], graph: Graph) => 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<GraphProvides>) : 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 IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\nexport const Toast = z.object({\n id: z.string(),\n title: z.string().optional(),\n description: z.string().optional(),\n // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.\n icon: z.any().optional(),\n duration: z.number().optional(),\n closeLabel: z.string().optional(),\n actionLabel: z.string().optional(),\n actionAlt: z.string().optional(),\n onAction: z.function().optional(),\n});\n\nexport type Toast = z.infer<typeof Toast>;\n\n/**\n * Basic state provided by a layout plugin.\n *\n * Layout provides the state of global UI landmarks, such as the sidebar, dialog, and popover.\n * Generally only one dialog or popover should be open at a time, a layout plugin should manage this.\n * For other landmarks, such as toasts, rendering them in the layout prevents them from unmounting when navigating.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n\n complementarySidebarOpen: z.boolean(),\n complementarySidebarContent: z.any().optional().describe('Data to be passed to the complementary sidebar Surface.'),\n\n dialogOpen: z.boolean(),\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n\n popoverOpen: z.boolean(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverAnchorId: z.string().optional(),\n\n toasts: z.array(Toast),\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/layout';\nexport enum LayoutAction {\n SET_LAYOUT = `${LAYOUT_ACTION}/set-layout`,\n\n /** @deprecated */\n // TODO(wittjosiah): At minimum this should be renamed, \"focus\" means something very specific on a web page.\n // Consider removing this action entirely, it's maybe not generic enough to live here.\n FOCUS = `${LAYOUT_ACTION}/focus`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type SetLayout = IntentData<{\n /**\n * Element to set the state of.\n */\n element: 'fullscreen' | 'sidebar' | 'complementary' | 'dialog' | 'popover' | 'toast';\n\n /**\n * Whether the element is on or off.\n *\n * If omitted, the element's state will be toggled or set based on other provided data.\n * For example, if `component` is provided, the state will be set to `true`.\n */\n state?: boolean;\n\n /**\n * Component to render in the dialog or popover.\n */\n component?: string;\n\n /**\n * Data to be passed to the dialog or popover Surface.\n */\n subject?: any;\n\n /**\n * Anchor ID for the popover.\n */\n anchorId?: 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 2024 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a navigation plugin.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\n// TODO(wittjosiah): We should align this more with `window.location` along the lines of what React Router does.\nexport const Location = z.object({\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 Location = z.infer<typeof Location>;\n\n/**\n * Provides for a plugin that can manage the app navigation.\n */\nexport type LocationProvides = {\n location: Readonly<Location>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseNavigationPlugin = (plugin: Plugin) => {\n const { success } = Location.safeParse((plugin.provides as any).location);\n return success ? (plugin as Plugin<LocationProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst NAVIGATION_ACTION = 'dxos.org/plugin/navigation';\nexport enum NavigationAction {\n ACTIVATE = `${NAVIGATION_ACTION}/activate`,\n}\n\n/**\n * Expected payload for navigation actions.\n */\nexport namespace NavigationAction {\n export type Activate = IntentData<{\n /**\n * Id to set as active.\n */\n id: string;\n\n /**\n * Location of the active item.\n * Defaults to 'main'.\n */\n key?: string;\n }>;\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\n// TODO(burdon): Plugins should export ts-effect object (see local-storage).\n// TODO(burdon): Auto generate form.\n// TODO(burdon): Set surface's data.type to plugin id (allow custom settings surface).\n\nexport type SettingsProvides<T extends Record<string, any> = Record<string, any>> = {\n settings: T; // TODO(burdon): Read-only.\n};\n\nexport const parseSettingsPlugin = (plugin: Plugin) => {\n return typeof (plugin.provides as any).settings === 'object' ? (plugin as Plugin<SettingsProvides>) : undefined;\n};\n\nconst SETTINGS_ACTION = 'dxos.org/plugin/settings';\nexport enum SettingsAction {\n OPEN = `${SETTINGS_ACTION}/open`,\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 * URL of home page.\n */\n homePage?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: 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> | void>;\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 // TODO(wittjosiah): Rename `ready` to a verb?\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 * Requires reload to take effect.\n */\n setPlugin: (id: string, enabled: boolean) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n setPlugin: () => {},\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, useState } 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';\nimport { ErrorBoundary } from '../SurfacePlugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ErrorBoundary['props']['fallback'];\n placeholder?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = DefaultFallback,\n placeholder = 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 setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled = [...state.values.enabled, id];\n } else {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n }\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n return (\n <ErrorBoundary fallback={fallback}>\n <Root order={order} core={core} definitions={definitions} state={state.values} placeholder={placeholder} />\n </ErrorBoundary>\n );\n },\n },\n };\n};\n\nconst DefaultFallback = ({ error }: { error: Error }) => {\n return (\n <div style={{ padding: '1rem' }}>\n {/* TODO(wittjosiah): Link to docs for replacing default. */}\n <h1 style={{ fontSize: '1.2rem', fontWeight: 700, margin: '0.5rem 0' }}>{error.message}</h1>\n <pre>{error.stack}</pre>\n </div>\n );\n};\n\ntype RootProps = {\n order: PluginDefinition['meta'][];\n state: PluginContext;\n definitions: Record<string, () => Promise<PluginDefinition>>;\n core: string[];\n placeholder: ReactNode;\n};\n\nconst Root = ({ order, core: corePluginIds, definitions, state, placeholder }: RootProps) => {\n const [error, setError] = useState<unknown>();\n\n useEffect(() => {\n log('initializing plugins', { enabled: state.enabled });\n const timeout = setTimeout(async () => {\n try {\n const enabledIds = [...corePluginIds, ...state.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(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));\n log('plugins ready', { plugins });\n\n state.plugins = shallow(plugins);\n state.ready = true;\n } catch (err) {\n setError(err);\n }\n });\n\n return () => {\n clearTimeout(timeout);\n state.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 (error) {\n throw error;\n }\n\n if (!state.ready) {\n return <>{placeholder}</>;\n }\n\n const ComposedContext = composeContext(state.plugins);\n\n return <ComposedContext>{rootComponents(state.plugins)}</ComposedContext>;\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\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\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, {\n forwardRef,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n Suspense,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\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, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\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, placeholder, ...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 const resolver = <SurfaceResolver {...props} ref={forwardedRef} />;\n const suspense = placeholder ? <Suspense fallback={placeholder}>{resolver}</Suspense> : resolver;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nexport const useSurface = (): SurfaceProps =>\n useContext(SurfaceContext) ?? raise(new Error('Surface context not found'));\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurfaceRoot();\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 <SurfaceContext.Provider value={currentContext}>{nodes}</SurfaceContext.Provider>;\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]): [string, SurfaceResult] | undefined => {\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n return 'node' in result ? [key, result] : isValidElement(result) ? [key, { node: result }] : undefined;\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, a], [, b]) => {\n const aDisposition = a.disposition ?? 'default';\n const bDisposition = b.disposition ?? 'default';\n\n if (aDisposition === bDisposition) {\n return 0;\n } else if (aDisposition === 'hoist' || bDisposition === 'fallback') {\n return -1;\n } else if (bDisposition === 'hoist' || aDisposition === 'fallback') {\n return 1;\n }\n\n return 0;\n })\n .map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,mBAAmB;EAC9BC,QAAQ;IAAC;IAAO;IAAO;;EACvBC,OAAO;IAAC;IAAO;IAAO;IAAO;;EAC7BC,MAAM;IAAC;IAAO;IAAO;;AACvB;AAeO,IAAMC,yBAAyB,CAACC,WAAAA;AACrC,SAAQA,OAAOC,SAAiBC,OAAQF,SAAyCG;AACnF;;;ACFO,IAAMC,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,SAAmCI;AAKtE,IAAMC,0BAA0B,CAACL,WACrCA,OAAOC,SAAiBC,OAAOI,UAAWN,SAA0CI;;;AC5BvF,SAASG,SAAS;AASX,IAAMC,QAAQC,EAAEC,OAAO;EAC5BC,IAAIF,EAAEG,OAAM;EACZC,OAAOJ,EAAEG,OAAM,EAAGE,SAAQ;EAC1BC,aAAaN,EAAEG,OAAM,EAAGE,SAAQ;;EAEhCE,MAAMP,EAAEQ,IAAG,EAAGH,SAAQ;EACtBI,UAAUT,EAAEU,OAAM,EAAGL,SAAQ;EAC7BM,YAAYX,EAAEG,OAAM,EAAGE,SAAQ;EAC/BO,aAAaZ,EAAEG,OAAM,EAAGE,SAAQ;EAChCQ,WAAWb,EAAEG,OAAM,EAAGE,SAAQ;EAC9BS,UAAUd,EAAEe,SAAQ,EAAGV,SAAQ;AACjC,CAAA;AAYO,IAAMW,SAAShB,EAAEC,OAAO;EAC7BgB,YAAYjB,EAAEkB,QAAO;EACrBC,aAAanB,EAAEkB,QA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C;SAAeT;;IACpCC,SAAS;MACP,GAAGA;MACH,CAACO,cAAYJ,EAAE,GAAGM,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAACF,aAAWL,EAAE,GAAGM,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;IACAT,MAAM;MAACM,cAAYJ;MAAIK,aAAWL;SAAOF;;IACzC,GAAGG;EACL,CAAA;AAEAO,YAAUN,KAAKO,UAAUC,SAAAA,QAAAA;;;;;;;;;AACzBF,YAAUN,KAAKO,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUV,KAAKO,SAASC;AAC9B,QAAMG,QAAOX,KAAKO,SAASE;AAE3B,SAAO,MACL,gBAAAG,OAAA,cAACF,SAAAA,MACC,gBAAAE,OAAA,cAACD,OAAAA,IAAAA,CAAAA;AAGP;",
6
6
  "names": ["defaultFileTypes", "images", "media", "text", "parseFileManagerPlugin", "plugin", "provides", "file", "undefined", "parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Toast", "z", "object", "id", "string", "title", "optional", "description", "icon", "any", "duration", "number", "closeLabel", "actionLabel", "actionAlt", "onAction", "function", "Layout", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "complementarySidebarContent", "describe", "dialogOpen", "dialogContent", "popoverOpen", "popoverContent", "popoverAnchorId", "toasts", "array", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "z", "Location", "z", "object", "active", "string", "optional", "describe", "previous", "parseNavigationPlugin", "plugin", "success", "safeParse", "provides", "location", "undefined", "NAVIGATION_ACTION", "NavigationAction", "parseSettingsPlugin", "plugin", "provides", "settings", "undefined", "SETTINGS_ACTION", "SettingsAction", "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", "setPlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "shallow", "React", "useEffect", "useState", "LocalStorageStore", "log", "isObject", "data", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "this", "fallback", "reset", "children", "setState", "React", "forwardRef", "Fragment", "isValidElement", "Suspense", "createContext", "useContext", "raise", "Surface", "forwardRef", "role", "name", "fallback", "placeholder", "rest", "forwardedRef", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "resolver", "React", "SurfaceResolver", "ref", "suspense", "Suspense", "ErrorBoundary", "createContext", "useSurface", "raise", "Error", "components", "useSurfaceRoot", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "Object", "entries", "map", "key", "component", "result", "undefined", "isValidElement", "node", "filter", "Boolean", "sort", "a", "b", "aDisposition", "disposition", "bDisposition", "Fragment", "limit", "slice", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "DefaultFallback", "placeholder", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "setPlugin", "values", "prop", "$enabled", "json", "meta", "name", "context", "children", "React", "PluginProvider", "value", "root", "ErrorBoundary", "Root", "error", "div", "style", "padding", "h1", "fontSize", "fontWeight", "margin", "message", "pre", "stack", "corePluginIds", "setError", "useState", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "definition", "Boolean", "initializePlugin", "catch", "err", "console", "then", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "p", "contexts", "reduce", "Acc", "Next", "React", "invariant", "createApp", "order", "plugins", "core", "map", "id", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytes":2319,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2173,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":9327,"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/navigation.ts":{"bytes":4314,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytes":2053,"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":1006,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/file.ts","kind":"import-statement","original":"./file"},{"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/navigation.ts","kind":"import-statement","original":"./navigation"},{"path":"packages/sdk/app-framework/src/plugins/common/settings.ts","kind":"import-statement","original":"./settings"},{"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":3705,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":2675,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":4026,"imports":[{"path":"react","kind":"import-statement","external":true},{"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":5280,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4030,"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/SurfacePlugin/helpers.ts":{"bytes":1765,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1938,"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":2763,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":13645,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","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":881,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts","kind":"import-statement","original":"./helpers"},{"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/PluginHost/PluginHost.tsx":{"bytes":20987,"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"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"../SurfacePlugin"}],"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/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/helpers.ts":{"bytes":1138,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":18871,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43598},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-7TTLFUDC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.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":"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":"@dxos/debug","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-OEWT2YOH.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-ABX2AJYN.mjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentAction","IntentProvider","Layout","LayoutAction","Location","NavigationAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","SettingsAction","Surface","SurfaceProvider","Toast","createApp","defaultFileTypes","filterPlugins","findPlugin","getPlugin","initializePlugin","isObject","parseFileManagerPlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parseNavigationPlugin","parsePluginHost","parseRootSurfacePlugin","parseSettingsPlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","useIntentDispatcher","useIntentResolver","usePlugin","usePlugins","useResolvePlugin","useSurface","useSurfaceRoot"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytesInOutput":277},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1425},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/navigation.ts":{"bytesInOutput":612},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytesInOutput":341},"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":230},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":512},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":5063},"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts":{"bytesInOutput":61},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":674},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2735},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1153}},"bytes":16177},"packages/sdk/app-framework/dist/lib/browser/plugin-OEWT2YOH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-OEWT2YOH.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-7TTLFUDC.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-7TTLFUDC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3074},"packages/sdk/app-framework/dist/lib/browser/chunk-7TTLFUDC.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurfaceRoot"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":239},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":887},"packages/sdk/app-framework/dist/lib/browser/plugin-ABX2AJYN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9329},"packages/sdk/app-framework/dist/lib/browser/plugin-ABX2AJYN.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.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},{"path":"@dxos/log","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":4551},"packages/sdk/app-framework/src/plugins/IntentPlugin/helpers.ts":{"bytesInOutput":94}},"bytes":5119},"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3904},"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["IntentAction","IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent","useIntentDispatcher","useIntentResolver"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":406},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":637},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":1545},"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/file.ts":{"bytes":2319,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2173,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":9327,"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/navigation.ts":{"bytes":4314,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytes":2053,"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":1006,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/file.ts","kind":"import-statement","original":"./file"},{"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/navigation.ts","kind":"import-statement","original":"./navigation"},{"path":"packages/sdk/app-framework/src/plugins/common/settings.ts","kind":"import-statement","original":"./settings"},{"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":4350,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":3705,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":2675,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":4026,"imports":[{"path":"react","kind":"import-statement","external":true},{"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":5280,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4030,"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/SurfacePlugin/helpers.ts":{"bytes":1765,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1938,"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":2763,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":13757,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","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":881,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts","kind":"import-statement","original":"./helpers"},{"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/PluginHost/PluginHost.tsx":{"bytes":20987,"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"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"../SurfacePlugin"}],"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/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/helpers.ts":{"bytes":1138,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":18871,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43682},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-7TTLFUDC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-S5CI6EUQ.mjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"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":"@dxos/debug","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-6XDXQ3BN.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-FYTGDFFS.mjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentAction","IntentProvider","Layout","LayoutAction","Location","NavigationAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","SettingsAction","Surface","SurfaceProvider","Toast","createApp","defaultFileTypes","definePlugin","filterPlugins","findPlugin","getPlugin","initializePlugin","isObject","parseFileManagerPlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parseNavigationPlugin","parsePluginHost","parseRootSurfacePlugin","parseSettingsPlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","useIntentDispatcher","useIntentResolver","usePlugin","usePlugins","useResolvePlugin","useSurface","useSurfaceRoot"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytesInOutput":277},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1425},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/navigation.ts":{"bytesInOutput":612},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytesInOutput":341},"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":230},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":512},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":5063},"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts":{"bytesInOutput":61},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":674},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2735},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1153}},"bytes":16209},"packages/sdk/app-framework/dist/lib/browser/plugin-6XDXQ3BN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-6XDXQ3BN.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-7TTLFUDC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-S5CI6EUQ.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-7TTLFUDC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3074},"packages/sdk/app-framework/dist/lib/browser/chunk-7TTLFUDC.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurfaceRoot"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":239},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":887},"packages/sdk/app-framework/dist/lib/browser/plugin-FYTGDFFS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9329},"packages/sdk/app-framework/dist/lib/browser/plugin-FYTGDFFS.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-S5CI6EUQ.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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":4551},"packages/sdk/app-framework/src/plugins/IntentPlugin/helpers.ts":{"bytesInOutput":94}},"bytes":5119},"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3904},"packages/sdk/app-framework/dist/lib/browser/chunk-J45KR4DI.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["IntentAction","IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent","useIntentDispatcher","useIntentResolver"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":406},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":637},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":1545},"packages/sdk/app-framework/dist/lib/browser/chunk-S5CI6EUQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2286},"packages/sdk/app-framework/dist/lib/browser/chunk-S5CI6EUQ.mjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["definePlugin","filterPlugins","findPlugin","getPlugin","resolvePlugin"],"inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":564}},"bytes":750}}}
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-7TTLFUDC.mjs";
6
6
  import {
7
7
  filterPlugins
8
- } from "./chunk-CFZ5JAJF.mjs";
8
+ } from "./chunk-S5CI6EUQ.mjs";
9
9
 
10
10
  // packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx
11
11
  import { deepSignal, shallow } from "deepsignal/react";
@@ -36,4 +36,4 @@ var plugin_default = SurfacePlugin;
36
36
  export {
37
37
  plugin_default as default
38
38
  };
39
- //# sourceMappingURL=plugin-OEWT2YOH.mjs.map
39
+ //# sourceMappingURL=plugin-6XDXQ3BN.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  filterPlugins,
9
9
  findPlugin
10
- } from "./chunk-CFZ5JAJF.mjs";
10
+ } from "./chunk-S5CI6EUQ.mjs";
11
11
 
12
12
  // packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx
13
13
  import { deepSignal } from "deepsignal/react";
@@ -164,4 +164,4 @@ var plugin_default = IntentPlugin;
164
164
  export {
165
165
  plugin_default as default
166
166
  };
167
- //# sourceMappingURL=plugin-ABX2AJYN.mjs.map
167
+ //# sourceMappingURL=plugin-FYTGDFFS.mjs.map
@@ -16,15 +16,17 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_VDKZ7AAF_exports = {};
20
- __export(chunk_VDKZ7AAF_exports, {
19
+ var chunk_62W6CMGM_exports = {};
20
+ __export(chunk_62W6CMGM_exports, {
21
+ definePlugin: () => definePlugin,
21
22
  filterPlugins: () => filterPlugins,
22
23
  findPlugin: () => findPlugin,
23
24
  getPlugin: () => getPlugin,
24
25
  resolvePlugin: () => resolvePlugin
25
26
  });
26
- module.exports = __toCommonJS(chunk_VDKZ7AAF_exports);
27
+ module.exports = __toCommonJS(chunk_62W6CMGM_exports);
27
28
  var import_debug = require("@dxos/debug");
29
+ var definePlugin = (plugin) => plugin;
28
30
  var findPlugin = (plugins, id) => {
29
31
  return plugins.find((plugin) => plugin.meta.id === id || typeof plugin.meta.shortId === "string" && plugin.meta.shortId === id);
30
32
  };
@@ -35,9 +37,10 @@ var filterPlugins = (plugins, predicate) => plugins.map((plugin) => predicate(pl
35
37
  var resolvePlugin = (plugins, predicate) => filterPlugins(plugins, predicate)[0];
36
38
  // Annotate the CommonJS export names for ESM import in node:
37
39
  0 && (module.exports = {
40
+ definePlugin,
38
41
  filterPlugins,
39
42
  findPlugin,
40
43
  getPlugin,
41
44
  resolvePlugin
42
45
  });
43
- //# sourceMappingURL=chunk-VDKZ7AAF.cjs.map
46
+ //# sourceMappingURL=chunk-62W6CMGM.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/helpers.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { raise } from '@dxos/debug';\n\nimport { type Plugin } from './PluginHost';\n\n/**\n * Define a plugin\n */\nexport const definePlugin = <TProvides>(plugin: Plugin<TProvides>): Plugin<TProvides> => plugin;\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAsB;AAOf,IAAMA,eAAe,CAAYC,WAAiDA;AAKlF,IAAMC,aAAa,CAAIC,SAAmBC,OAAAA;AAC/C,SAAOD,QAAQE,KACb,CAACJ,WAAWA,OAAOK,KAAKF,OAAOA,MAAO,OAAOH,OAAOK,KAAKC,YAAY,YAAYN,OAAOK,KAAKC,YAAYH,EAAAA;AAE7G;AAKO,IAAMI,YAAY,CAAIL,SAAmBC,OAAAA;AAC9C,SAAOF,WAAWC,SAASC,EAAAA,SAAOK,oBAAM,IAAIC,MAAM,qBAAqBN,EAAAA,EAAI,CAAA;AAC7E;AAKO,IAAMO,gBAAgB,CAC3BR,SACAS,cACgBT,QAAQU,IAAI,CAACZ,WAAWW,UAAUX,MAAAA,CAAAA,EAASa,OAAO,CAACb,WAAgC,CAAC,CAACA,MAAAA;AAShG,IAAMc,gBAAgB,CAC3BZ,SACAS,cAC0BD,cAAcR,SAASS,SAAAA,EAAW,CAAA;",
6
+ "names": ["definePlugin", "plugin", "findPlugin", "plugins", "id", "find", "meta", "shortId", "getPlugin", "raise", "Error", "filterPlugins", "predicate", "map", "filter", "resolvePlugin"]
7
+ }
@@ -47,9 +47,10 @@ __export(node_exports, {
47
47
  Toast: () => Toast,
48
48
  createApp: () => createApp,
49
49
  defaultFileTypes: () => defaultFileTypes,
50
- filterPlugins: () => import_chunk_VDKZ7AAF.filterPlugins,
51
- findPlugin: () => import_chunk_VDKZ7AAF.findPlugin,
52
- getPlugin: () => import_chunk_VDKZ7AAF.getPlugin,
50
+ definePlugin: () => import_chunk_62W6CMGM.definePlugin,
51
+ filterPlugins: () => import_chunk_62W6CMGM.filterPlugins,
52
+ findPlugin: () => import_chunk_62W6CMGM.findPlugin,
53
+ getPlugin: () => import_chunk_62W6CMGM.getPlugin,
53
54
  initializePlugin: () => initializePlugin,
54
55
  isObject: () => isObject,
55
56
  parseFileManagerPlugin: () => parseFileManagerPlugin,
@@ -67,7 +68,7 @@ __export(node_exports, {
67
68
  parseSurfacePlugin: () => import_chunk_BTZLKXA2.parseSurfacePlugin,
68
69
  parseTranslationsPlugin: () => parseTranslationsPlugin,
69
70
  pluginMeta: () => pluginMeta,
70
- resolvePlugin: () => import_chunk_VDKZ7AAF.resolvePlugin,
71
+ resolvePlugin: () => import_chunk_62W6CMGM.resolvePlugin,
71
72
  useIntent: () => import_chunk_DFST5IG5.useIntent,
72
73
  useIntentDispatcher: () => import_chunk_DFST5IG5.useIntentDispatcher,
73
74
  useIntentResolver: () => import_chunk_DFST5IG5.useIntentResolver,
@@ -80,7 +81,7 @@ __export(node_exports, {
80
81
  module.exports = __toCommonJS(node_exports);
81
82
  var import_chunk_BTZLKXA2 = require("./chunk-BTZLKXA2.cjs");
82
83
  var import_chunk_DFST5IG5 = require("./chunk-DFST5IG5.cjs");
83
- var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
84
+ var import_chunk_62W6CMGM = require("./chunk-62W6CMGM.cjs");
84
85
  var import_zod = require("zod");
85
86
  var import_zod2 = require("zod");
86
87
  var import_zod3 = require("zod");
@@ -210,11 +211,11 @@ var PluginContext = /* @__PURE__ */ (0, import_react.createContext)({
210
211
  var usePlugins = () => (0, import_react.useContext)(PluginContext);
211
212
  var usePlugin = (id) => {
212
213
  const { plugins } = usePlugins();
213
- return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
214
+ return (0, import_chunk_62W6CMGM.findPlugin)(plugins, id);
214
215
  };
215
216
  var useResolvePlugin = (predicate) => {
216
217
  const { plugins } = usePlugins();
217
- return (0, import_chunk_VDKZ7AAF.resolvePlugin)(plugins, predicate);
218
+ return (0, import_chunk_62W6CMGM.resolvePlugin)(plugins, predicate);
218
219
  };
219
220
  var PluginProvider = PluginContext.Provider;
220
221
  var isObject = (data) => !!data && typeof data === "object";
@@ -492,8 +493,8 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
492
493
  ],
493
494
  plugins: {
494
495
  ...plugins,
495
- [import_chunk_BTZLKXA2.meta_default.id]: Plugin.lazy(() => import("./plugin-D3VWRWFN.cjs")),
496
- [import_chunk_DFST5IG5.meta_default.id]: Plugin.lazy(() => import("./plugin-J7A2JHKR.cjs"))
496
+ [import_chunk_BTZLKXA2.meta_default.id]: Plugin.lazy(() => import("./plugin-ZJ26B7E5.cjs")),
497
+ [import_chunk_DFST5IG5.meta_default.id]: Plugin.lazy(() => import("./plugin-VEIZZVQP.cjs"))
497
498
  },
498
499
  core: [
499
500
  import_chunk_BTZLKXA2.meta_default.id,
@@ -545,6 +546,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
545
546
  Toast,
546
547
  createApp,
547
548
  defaultFileTypes,
549
+ definePlugin,
548
550
  filterPlugins,
549
551
  findPlugin,
550
552
  getPlugin,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/common/file.ts", "../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/navigation.ts", "../../../src/plugins/common/settings.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/helpers.ts", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport type FileInfo = {\n cid?: string; // TODO(burdon): Meta key? Or other common properties with other file management system?\n};\n\nexport type FileUploader = (file: File) => Promise<FileInfo | undefined>;\n\nexport type FileManagerProvides = {\n file: {\n upload?: FileUploader;\n };\n};\n\n// TODO(burdon): Better match against interface? and Return provided service type. What if multiple?\nexport const parseFileManagerPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).file ? (plugin as Plugin<FileManagerProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph } 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 GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (plugins: Plugin[], graph: Graph) => 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<GraphProvides>) : 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 IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\nexport const Toast = z.object({\n id: z.string(),\n title: z.string().optional(),\n description: z.string().optional(),\n // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.\n icon: z.any().optional(),\n duration: z.number().optional(),\n closeLabel: z.string().optional(),\n actionLabel: z.string().optional(),\n actionAlt: z.string().optional(),\n onAction: z.function().optional(),\n});\n\nexport type Toast = z.infer<typeof Toast>;\n\n/**\n * Basic state provided by a layout plugin.\n *\n * Layout provides the state of global UI landmarks, such as the sidebar, dialog, and popover.\n * Generally only one dialog or popover should be open at a time, a layout plugin should manage this.\n * For other landmarks, such as toasts, rendering them in the layout prevents them from unmounting when navigating.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n\n complementarySidebarOpen: z.boolean(),\n complementarySidebarContent: z.any().optional().describe('Data to be passed to the complementary sidebar Surface.'),\n\n dialogOpen: z.boolean(),\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n\n popoverOpen: z.boolean(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverAnchorId: z.string().optional(),\n\n toasts: z.array(Toast),\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/layout';\nexport enum LayoutAction {\n SET_LAYOUT = `${LAYOUT_ACTION}/set-layout`,\n\n /** @deprecated */\n // TODO(wittjosiah): At minimum this should be renamed, \"focus\" means something very specific on a web page.\n // Consider removing this action entirely, it's maybe not generic enough to live here.\n FOCUS = `${LAYOUT_ACTION}/focus`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type SetLayout = IntentData<{\n /**\n * Element to set the state of.\n */\n element: 'fullscreen' | 'sidebar' | 'complementary' | 'dialog' | 'popover' | 'toast';\n\n /**\n * Whether the element is on or off.\n *\n * If omitted, the element's state will be toggled or set based on other provided data.\n * For example, if `component` is provided, the state will be set to `true`.\n */\n state?: boolean;\n\n /**\n * Component to render in the dialog or popover.\n */\n component?: string;\n\n /**\n * Data to be passed to the dialog or popover Surface.\n */\n subject?: any;\n\n /**\n * Anchor ID for the popover.\n */\n anchorId?: 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 2024 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a navigation plugin.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\n// TODO(wittjosiah): We should align this more with `window.location` along the lines of what React Router does.\nexport const Location = z.object({\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 Location = z.infer<typeof Location>;\n\n/**\n * Provides for a plugin that can manage the app navigation.\n */\nexport type LocationProvides = {\n location: Readonly<Location>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseNavigationPlugin = (plugin: Plugin) => {\n const { success } = Location.safeParse((plugin.provides as any).location);\n return success ? (plugin as Plugin<LocationProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst NAVIGATION_ACTION = 'dxos.org/plugin/navigation';\nexport enum NavigationAction {\n ACTIVATE = `${NAVIGATION_ACTION}/activate`,\n}\n\n/**\n * Expected payload for navigation actions.\n */\nexport namespace NavigationAction {\n export type Activate = IntentData<{\n /**\n * Id to set as active.\n */\n id: string;\n\n /**\n * Location of the active item.\n * Defaults to 'main'.\n */\n key?: string;\n }>;\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\n// TODO(burdon): Plugins should export ts-effect object (see local-storage).\n// TODO(burdon): Auto generate form.\n// TODO(burdon): Set surface's data.type to plugin id (allow custom settings surface).\n\nexport type SettingsProvides<T extends Record<string, any> = Record<string, any>> = {\n settings: T; // TODO(burdon): Read-only.\n};\n\nexport const parseSettingsPlugin = (plugin: Plugin) => {\n return typeof (plugin.provides as any).settings === 'object' ? (plugin as Plugin<SettingsProvides>) : undefined;\n};\n\nconst SETTINGS_ACTION = 'dxos.org/plugin/settings';\nexport enum SettingsAction {\n OPEN = `${SETTINGS_ACTION}/open`,\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 * URL of home page.\n */\n homePage?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: 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> | void>;\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 // TODO(wittjosiah): Rename `ready` to a verb?\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 * Requires reload to take effect.\n */\n setPlugin: (id: string, enabled: boolean) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n setPlugin: () => {},\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, useState } 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';\nimport { ErrorBoundary } from '../SurfacePlugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ErrorBoundary['props']['fallback'];\n placeholder?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = DefaultFallback,\n placeholder = 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 setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled = [...state.values.enabled, id];\n } else {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n }\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n return (\n <ErrorBoundary fallback={fallback}>\n <Root order={order} core={core} definitions={definitions} state={state.values} placeholder={placeholder} />\n </ErrorBoundary>\n );\n },\n },\n };\n};\n\nconst DefaultFallback = ({ error }: { error: Error }) => {\n return (\n <div style={{ padding: '1rem' }}>\n {/* TODO(wittjosiah): Link to docs for replacing default. */}\n <h1 style={{ fontSize: '1.2rem', fontWeight: 700, margin: '0.5rem 0' }}>{error.message}</h1>\n <pre>{error.stack}</pre>\n </div>\n );\n};\n\ntype RootProps = {\n order: PluginDefinition['meta'][];\n state: PluginContext;\n definitions: Record<string, () => Promise<PluginDefinition>>;\n core: string[];\n placeholder: ReactNode;\n};\n\nconst Root = ({ order, core: corePluginIds, definitions, state, placeholder }: RootProps) => {\n const [error, setError] = useState<unknown>();\n\n useEffect(() => {\n log('initializing plugins', { enabled: state.enabled });\n const timeout = setTimeout(async () => {\n try {\n const enabledIds = [...corePluginIds, ...state.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(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));\n log('plugins ready', { plugins });\n\n state.plugins = shallow(plugins);\n state.ready = true;\n } catch (err) {\n setError(err);\n }\n });\n\n return () => {\n clearTimeout(timeout);\n state.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 (error) {\n throw error;\n }\n\n if (!state.ready) {\n return <>{placeholder}</>;\n }\n\n const ComposedContext = composeContext(state.plugins);\n\n return <ComposedContext>{rootComponents(state.plugins)}</ComposedContext>;\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\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\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, {\n forwardRef,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n Suspense,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } 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, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\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, placeholder, ...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 const resolver = <SurfaceResolver {...props} ref={forwardedRef} />;\n const suspense = placeholder ? <Suspense fallback={placeholder}>{resolver}</Suspense> : resolver;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nexport const useSurface = (): SurfaceProps =>\n useContext(SurfaceContext) ?? raise(new Error('Surface context not found'));\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurfaceRoot();\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 <SurfaceContext.Provider value={currentContext}>{nodes}</SurfaceContext.Provider>;\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]): [string, SurfaceResult] | undefined => {\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n return 'node' in result ? [key, result] : isValidElement(result) ? [key, { node: result }] : undefined;\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, a], [, b]) => {\n const aDisposition = a.disposition ?? 'default';\n const bDisposition = b.disposition ?? 'default';\n\n if (aDisposition === bDisposition) {\n return 0;\n } else if (aDisposition === 'hoist' || bDisposition === 'fallback') {\n return -1;\n } else if (bDisposition === 'hoist' || aDisposition === 'fallback') {\n return 1;\n }\n\n return 0;\n })\n .map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,iBAAkB;AEAlB,IAAAA,cAAkB;AEAlB,IAAAA,cAAkB;AEAlB,mBAAuE;ACAvE,IAAAC,gBAAwB;AACxB,IAAAA,gBAA4F;AAE5F,2BAAkC;AAClC,iBAAoB;AEJpB,IAAAA,gBAAkE;ACAlE,IAAAA,gBAQO;AACP,IAAAA,gBAA0C;AAE1C,mBAAsB;ACXtB,IAAAA,gBAAkB;AAElB,uBAA0B;AbAnB,IAAMC,mBAAmB;EAC9BC,QAAQ;IAAC;IAAO;IAAO;;EACvBC,OAAO;IAAC;IAAO;IAAO;IAAO;;EAC7BC,MAAM;IAAC;IAAO;IAAO;;AACvB;AAeO,IAAMC,yBAAyB,CAACC,WAAAA;AACrC,SAAQA,OAAOC,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,8BAAAA,QAAA,cAAC6G,SAAAA,MACC7G,8BAAAA,QAAA,cAAC+D,OAAAA,IAAAA,CAAAA;AAGP;",
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport type FileInfo = {\n cid?: string; // TODO(burdon): Meta key? Or other common properties with other file management system?\n};\n\nexport type FileUploader = (file: File) => Promise<FileInfo | undefined>;\n\nexport type FileManagerProvides = {\n file: {\n upload?: FileUploader;\n };\n};\n\n// TODO(burdon): Better match against interface? and Return provided service type. What if multiple?\nexport const parseFileManagerPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).file ? (plugin as Plugin<FileManagerProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph } 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 GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (plugins: Plugin[], graph: Graph) => 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<GraphProvides>) : 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 IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\nexport const Toast = z.object({\n id: z.string(),\n title: z.string().optional(),\n description: z.string().optional(),\n // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.\n icon: z.any().optional(),\n duration: z.number().optional(),\n closeLabel: z.string().optional(),\n actionLabel: z.string().optional(),\n actionAlt: z.string().optional(),\n onAction: z.function().optional(),\n});\n\nexport type Toast = z.infer<typeof Toast>;\n\n/**\n * Basic state provided by a layout plugin.\n *\n * Layout provides the state of global UI landmarks, such as the sidebar, dialog, and popover.\n * Generally only one dialog or popover should be open at a time, a layout plugin should manage this.\n * For other landmarks, such as toasts, rendering them in the layout prevents them from unmounting when navigating.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n\n complementarySidebarOpen: z.boolean(),\n complementarySidebarContent: z.any().optional().describe('Data to be passed to the complementary sidebar Surface.'),\n\n dialogOpen: z.boolean(),\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n\n popoverOpen: z.boolean(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverAnchorId: z.string().optional(),\n\n toasts: z.array(Toast),\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/layout';\nexport enum LayoutAction {\n SET_LAYOUT = `${LAYOUT_ACTION}/set-layout`,\n\n /** @deprecated */\n // TODO(wittjosiah): At minimum this should be renamed, \"focus\" means something very specific on a web page.\n // Consider removing this action entirely, it's maybe not generic enough to live here.\n FOCUS = `${LAYOUT_ACTION}/focus`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type SetLayout = IntentData<{\n /**\n * Element to set the state of.\n */\n element: 'fullscreen' | 'sidebar' | 'complementary' | 'dialog' | 'popover' | 'toast';\n\n /**\n * Whether the element is on or off.\n *\n * If omitted, the element's state will be toggled or set based on other provided data.\n * For example, if `component` is provided, the state will be set to `true`.\n */\n state?: boolean;\n\n /**\n * Component to render in the dialog or popover.\n */\n component?: string;\n\n /**\n * Data to be passed to the dialog or popover Surface.\n */\n subject?: any;\n\n /**\n * Anchor ID for the popover.\n */\n anchorId?: 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 2024 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a navigation plugin.\n */\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\n// TODO(wittjosiah): We should align this more with `window.location` along the lines of what React Router does.\nexport const Location = z.object({\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 Location = z.infer<typeof Location>;\n\n/**\n * Provides for a plugin that can manage the app navigation.\n */\nexport type LocationProvides = {\n location: Readonly<Location>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseNavigationPlugin = (plugin: Plugin) => {\n const { success } = Location.safeParse((plugin.provides as any).location);\n return success ? (plugin as Plugin<LocationProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst NAVIGATION_ACTION = 'dxos.org/plugin/navigation';\nexport enum NavigationAction {\n ACTIVATE = `${NAVIGATION_ACTION}/activate`,\n}\n\n/**\n * Expected payload for navigation actions.\n */\nexport namespace NavigationAction {\n export type Activate = IntentData<{\n /**\n * Id to set as active.\n */\n id: string;\n\n /**\n * Location of the active item.\n * Defaults to 'main'.\n */\n key?: string;\n }>;\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '../PluginHost';\n\n// TODO(burdon): Plugins should export ts-effect object (see local-storage).\n// TODO(burdon): Auto generate form.\n// TODO(burdon): Set surface's data.type to plugin id (allow custom settings surface).\n\nexport type SettingsProvides<T extends Record<string, any> = Record<string, any>> = {\n settings: T; // TODO(burdon): Read-only.\n};\n\nexport const parseSettingsPlugin = (plugin: Plugin) => {\n return typeof (plugin.provides as any).settings === 'object' ? (plugin as Plugin<SettingsProvides>) : undefined;\n};\n\nconst SETTINGS_ACTION = 'dxos.org/plugin/settings';\nexport enum SettingsAction {\n OPEN = `${SETTINGS_ACTION}/open`,\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 * URL of home page.\n */\n homePage?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: 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> | void>;\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 // TODO(wittjosiah): Rename `ready` to a verb?\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 * Requires reload to take effect.\n */\n setPlugin: (id: string, enabled: boolean) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n setPlugin: () => {},\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, useState } 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';\nimport { ErrorBoundary } from '../SurfacePlugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ErrorBoundary['props']['fallback'];\n placeholder?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = DefaultFallback,\n placeholder = 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 setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled = [...state.values.enabled, id];\n } else {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n }\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n return (\n <ErrorBoundary fallback={fallback}>\n <Root order={order} core={core} definitions={definitions} state={state.values} placeholder={placeholder} />\n </ErrorBoundary>\n );\n },\n },\n };\n};\n\nconst DefaultFallback = ({ error }: { error: Error }) => {\n return (\n <div style={{ padding: '1rem' }}>\n {/* TODO(wittjosiah): Link to docs for replacing default. */}\n <h1 style={{ fontSize: '1.2rem', fontWeight: 700, margin: '0.5rem 0' }}>{error.message}</h1>\n <pre>{error.stack}</pre>\n </div>\n );\n};\n\ntype RootProps = {\n order: PluginDefinition['meta'][];\n state: PluginContext;\n definitions: Record<string, () => Promise<PluginDefinition>>;\n core: string[];\n placeholder: ReactNode;\n};\n\nconst Root = ({ order, core: corePluginIds, definitions, state, placeholder }: RootProps) => {\n const [error, setError] = useState<unknown>();\n\n useEffect(() => {\n log('initializing plugins', { enabled: state.enabled });\n const timeout = setTimeout(async () => {\n try {\n const enabledIds = [...corePluginIds, ...state.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(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));\n log('plugins ready', { plugins });\n\n state.plugins = shallow(plugins);\n state.ready = true;\n } catch (err) {\n setError(err);\n }\n });\n\n return () => {\n clearTimeout(timeout);\n state.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 (error) {\n throw error;\n }\n\n if (!state.ready) {\n return <>{placeholder}</>;\n }\n\n const ComposedContext = composeContext(state.plugins);\n\n return <ComposedContext>{rootComponents(state.plugins)}</ComposedContext>;\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\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\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, {\n forwardRef,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n Suspense,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\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, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\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, placeholder, ...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 const resolver = <SurfaceResolver {...props} ref={forwardedRef} />;\n const suspense = placeholder ? <Suspense fallback={placeholder}>{resolver}</Suspense> : resolver;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nexport const useSurface = (): SurfaceProps =>\n useContext(SurfaceContext) ?? raise(new Error('Surface context not found'));\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurfaceRoot();\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 <SurfaceContext.Provider value={currentContext}>{nodes}</SurfaceContext.Provider>;\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]): [string, SurfaceResult] | undefined => {\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n return 'node' in result ? [key, result] : isValidElement(result) ? [key, { node: result }] : undefined;\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, a], [, b]) => {\n const aDisposition = a.disposition ?? 'default';\n const bDisposition = b.disposition ?? 'default';\n\n if (aDisposition === bDisposition) {\n return 0;\n } else if (aDisposition === 'hoist' || bDisposition === 'fallback') {\n return -1;\n } else if (bDisposition === 'hoist' || aDisposition === 'fallback') {\n return 1;\n }\n\n return 0;\n })\n .map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,iBAAkB;AEAlB,IAAAA,cAAkB;AEAlB,IAAAA,cAAkB;AEAlB,mBAAuE;ACAvE,IAAAC,gBAAwB;AACxB,IAAAA,gBAA4F;AAE5F,2BAAkC;AAClC,iBAAoB;AEJpB,IAAAA,gBAAkE;ACAlE,IAAAA,gBAQO;AACP,IAAAA,gBAA0C;AAE1C,mBAAsB;ACXtB,IAAAA,gBAAkB;AAElB,uBAA0B;AbAnB,IAAMC,mBAAmB;EAC9BC,QAAQ;IAAC;IAAO;IAAO;;EACvBC,OAAO;IAAC;IAAO;IAAO;IAAO;;EAC7BC,MAAM;IAAC;IAAO;IAAO;;AACvB;AAeO,IAAMC,yBAAyB,CAACC,WAAAA;AACrC,SAAQA,OAAOC,SAAiBC,OAAQF,SAAyCG;AACnF;ACFO,IAAMC,mBAAmB,CAACJ,WAC9BA,OAAOC,SAAiBI,OAAOC,OAAQN,SAAmCG;AAKtE,IAAMI,0BAA0B,CAACP,WACrCA,OAAOC,SAAiBI,OAAOG,UAAWR,SAA0CG;ACnBhF,IAAMM,QAAQC,aAAEC,OAAO;EAC5BC,IAAIF,aAAEG,OAAM;EACZC,OAAOJ,aAAEG,OAAM,EAAGE,SAAQ;EAC1BC,aAAaN,aAAEG,OAAM,EAAGE,SAAQ;;EAEhCE,MAAMP,aAAEQ,IAAG,EAAGH,SAAQ;EACtBI,UAAUT,aAAEU,OAAM,EAAGL,SAAQ;EAC7BM,YAAYX,aAAEG,OAAM,EAAGE,SAAQ;EAC/BO,aAAaZ,aAAEG,OAAM,EAA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,QAAAA,CAAAA,CAAAA;AAGb;;AI9JO,IAAMmG,YAAY,CAAC,EAAEnD,OAAO5E,SAAS8E,OAAOF,MAAMpB,IAAI,CAAC,EAAE9H,GAAE,MAAOA,EAAAA,GAAK,GAAGsM,OAAAA,MAAgC;AAC/G,QAAMC,OAAOtD,WAAW;IACtBC,OAAO;MAACsD,sBAAAA;MAAaC;SAAevD;;IACpC5E,SAAS;MACP,GAAGA;MACH,CAACkI,sBAAAA,aAAYxM,EAAE,GAAG2D,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAAC6I,mCAAWzM,EAAE,GAAG2D,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;IACAwF,MAAM;MAACoD,sBAAAA,aAAYxM;MAAIyM,mCAAWzM;SAAOoJ;;IACzC,GAAGkD;EACL,CAAA;AAEAI,kCAAUH,KAAKlN,UAAUsH,SAAAA,QAAAA;;;;;;;;;AACzB+F,kCAAUH,KAAKlN,UAAUK,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMiN,UAAUJ,KAAKlN,SAASsH;AAC9B,QAAMkD,QAAO0C,KAAKlN,SAASK;AAE3B,SAAO,MACLoG,8BAAAA,QAAA,cAAC6G,SAAAA,MACC7G,8BAAAA,QAAA,cAAC+D,OAAAA,IAAAA,CAAAA;AAGP;",
6
6
  "names": ["import_zod", "import_react", "defaultFileTypes", "images", "media", "text", "parseFileManagerPlugin", "plugin", "provides", "file", "undefined", "parseGraphPlugin", "graph", "root", "parseGraphBuilderPlugin", "builder", "Toast", "z", "object", "id", "string", "title", "optional", "description", "icon", "any", "duration", "number", "closeLabel", "actionLabel", "actionAlt", "onAction", "function", "Layout", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "complementarySidebarContent", "describe", "dialogOpen", "dialogContent", "popoverOpen", "popoverContent", "popoverAnchorId", "toasts", "array", "parseLayoutPlugin", "success", "safeParse", "layout", "LAYOUT_ACTION", "LayoutAction", "parseMetadataRecordsPlugin", "metadata", "records", "parseMetadataResolverPlugin", "resolver", "Location", "active", "previous", "parseNavigationPlugin", "location", "NAVIGATION_ACTION", "NavigationAction", "parseSettingsPlugin", "settings", "SETTINGS_ACTION", "SettingsAction", "ResourceKey", "union", "record", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "translations", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "setPlugin", "usePlugins", "useContext", "usePlugin", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "isObject", "data", "ErrorBoundary", "Component", "constructor", "state", "error", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "resetError", "render", "React", "this", "fallback", "reset", "children", "setState", "Surface", "forwardRef", "role", "name", "placeholder", "rest", "forwardedRef", "context", "SurfaceContext", "surfaces", "SurfaceResolver", "ref", "suspense", "Suspense", "useSurface", "raise", "Error", "components", "useSurfaceRoot", "parent", "nodes", "resolveNodes", "currentContext", "value", "Object", "entries", "map", "key", "component", "result", "isValidElement", "node", "filter", "Boolean", "sort", "a", "b", "aDisposition", "disposition", "bDisposition", "Fragment", "limit", "slice", "parsePluginHost", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "DefaultFallback", "LocalStorageStore", "includes", "values", "prop", "$enabled", "json", "Root", "div", "style", "padding", "h1", "fontSize", "fontWeight", "margin", "message", "pre", "stack", "corePluginIds", "setError", "useState", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "indexA", "findIndex", "indexB", "Promise", "all", "initializePlugin", "catch", "err", "console", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "compose", "contexts", "reduce", "Acc", "Next", "createApp", "params", "host", "SurfaceMeta", "IntentMeta", "invariant", "Context"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytes":2319,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2173,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":9327,"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/navigation.ts":{"bytes":4314,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytes":2053,"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":1006,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/file.ts","kind":"import-statement","original":"./file"},{"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/navigation.ts","kind":"import-statement","original":"./navigation"},{"path":"packages/sdk/app-framework/src/plugins/common/settings.ts","kind":"import-statement","original":"./settings"},{"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":3705,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":2675,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":4026,"imports":[{"path":"react","kind":"import-statement","external":true},{"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":5280,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4030,"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/SurfacePlugin/helpers.ts":{"bytes":1765,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1938,"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":2763,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":13645,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","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":881,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts","kind":"import-statement","original":"./helpers"},{"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/PluginHost/PluginHost.tsx":{"bytes":20987,"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"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"../SurfacePlugin"}],"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/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/helpers.ts":{"bytes":1138,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":18871,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43598},"packages/sdk/app-framework/dist/lib/node/index.cjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node/chunk-BTZLKXA2.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-VDKZ7AAF.cjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"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":"@dxos/debug","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/node/plugin-D3VWRWFN.cjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/node/plugin-J7A2JHKR.cjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentAction","IntentProvider","Layout","LayoutAction","Location","NavigationAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","SettingsAction","Surface","SurfaceProvider","Toast","createApp","defaultFileTypes","filterPlugins","findPlugin","getPlugin","initializePlugin","isObject","parseFileManagerPlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parseNavigationPlugin","parsePluginHost","parseRootSurfacePlugin","parseSettingsPlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","useIntentDispatcher","useIntentResolver","usePlugin","usePlugins","useResolvePlugin","useSurface","useSurfaceRoot"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytesInOutput":277},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1425},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/navigation.ts":{"bytesInOutput":612},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytesInOutput":341},"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":230},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":512},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":5063},"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts":{"bytesInOutput":61},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":674},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2735},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1153}},"bytes":16177},"packages/sdk/app-framework/dist/lib/node/plugin-D3VWRWFN.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/node/plugin-D3VWRWFN.cjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node/chunk-BTZLKXA2.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-VDKZ7AAF.cjs","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/node/chunk-BTZLKXA2.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3074},"packages/sdk/app-framework/dist/lib/node/chunk-BTZLKXA2.cjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurfaceRoot"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":239},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":887},"packages/sdk/app-framework/dist/lib/node/plugin-J7A2JHKR.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9329},"packages/sdk/app-framework/dist/lib/node/plugin-J7A2JHKR.cjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-VDKZ7AAF.cjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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":4551},"packages/sdk/app-framework/src/plugins/IntentPlugin/helpers.ts":{"bytesInOutput":94}},"bytes":5119},"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3904},"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["IntentAction","IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent","useIntentDispatcher","useIntentResolver"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":406},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":637},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":1545},"packages/sdk/app-framework/dist/lib/node/chunk-VDKZ7AAF.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2110},"packages/sdk/app-framework/dist/lib/node/chunk-VDKZ7AAF.cjs":{"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/file.ts":{"bytes":2319,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2173,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":9327,"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/navigation.ts":{"bytes":4314,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytes":2053,"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":1006,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/file.ts","kind":"import-statement","original":"./file"},{"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/navigation.ts","kind":"import-statement","original":"./navigation"},{"path":"packages/sdk/app-framework/src/plugins/common/settings.ts","kind":"import-statement","original":"./settings"},{"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":4350,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":3705,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":2675,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":4026,"imports":[{"path":"react","kind":"import-statement","external":true},{"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":5280,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4030,"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/SurfacePlugin/helpers.ts":{"bytes":1765,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1938,"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":2763,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":13757,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","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":881,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts","kind":"import-statement","original":"./helpers"},{"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/PluginHost/PluginHost.tsx":{"bytes":20987,"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"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"../SurfacePlugin"}],"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/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/helpers.ts":{"bytes":1138,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":18871,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":43682},"packages/sdk/app-framework/dist/lib/node/index.cjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node/chunk-BTZLKXA2.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-62W6CMGM.cjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"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":"@dxos/debug","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/node/plugin-ZJ26B7E5.cjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/node/plugin-VEIZZVQP.cjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentAction","IntentProvider","Layout","LayoutAction","Location","NavigationAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","SettingsAction","Surface","SurfaceProvider","Toast","createApp","defaultFileTypes","definePlugin","filterPlugins","findPlugin","getPlugin","initializePlugin","isObject","parseFileManagerPlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parseNavigationPlugin","parsePluginHost","parseRootSurfacePlugin","parseSettingsPlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","useIntentDispatcher","useIntentResolver","usePlugin","usePlugins","useResolvePlugin","useSurface","useSurfaceRoot"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytesInOutput":277},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1425},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/navigation.ts":{"bytesInOutput":612},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytesInOutput":341},"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":230},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":512},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":5063},"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts":{"bytesInOutput":61},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":674},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2735},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1153}},"bytes":16209},"packages/sdk/app-framework/dist/lib/node/plugin-ZJ26B7E5.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/node/plugin-ZJ26B7E5.cjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node/chunk-BTZLKXA2.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-62W6CMGM.cjs","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/node/chunk-BTZLKXA2.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3074},"packages/sdk/app-framework/dist/lib/node/chunk-BTZLKXA2.cjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurfaceRoot"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":239},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":887},"packages/sdk/app-framework/dist/lib/node/plugin-VEIZZVQP.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9329},"packages/sdk/app-framework/dist/lib/node/plugin-VEIZZVQP.cjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node/chunk-62W6CMGM.cjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","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":4551},"packages/sdk/app-framework/src/plugins/IntentPlugin/helpers.ts":{"bytesInOutput":94}},"bytes":5119},"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3904},"packages/sdk/app-framework/dist/lib/node/chunk-DFST5IG5.cjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["IntentAction","IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent","useIntentDispatcher","useIntentResolver"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":406},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":637},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":1545},"packages/sdk/app-framework/dist/lib/node/chunk-62W6CMGM.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2286},"packages/sdk/app-framework/dist/lib/node/chunk-62W6CMGM.cjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["definePlugin","filterPlugins","findPlugin","getPlugin","resolvePlugin"],"inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":564}},"bytes":750}}}
@@ -26,13 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var plugin_J7A2JHKR_exports = {};
30
- __export(plugin_J7A2JHKR_exports, {
29
+ var plugin_VEIZZVQP_exports = {};
30
+ __export(plugin_VEIZZVQP_exports, {
31
31
  default: () => plugin_default
32
32
  });
33
- module.exports = __toCommonJS(plugin_J7A2JHKR_exports);
33
+ module.exports = __toCommonJS(plugin_VEIZZVQP_exports);
34
34
  var import_chunk_DFST5IG5 = require("./chunk-DFST5IG5.cjs");
35
- var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
35
+ var import_chunk_62W6CMGM = require("./chunk-62W6CMGM.cjs");
36
36
  var import_react = require("deepsignal/react");
37
37
  var import_react2 = __toESM(require("react"));
38
38
  var import_log = require("@dxos/log");
@@ -72,7 +72,7 @@ var IntentPlugin = () => {
72
72
  }
73
73
  }
74
74
  }
75
- const plugin = (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, intent.plugin);
75
+ const plugin = (0, import_chunk_62W6CMGM.findPlugin)(plugins, intent.plugin);
76
76
  const result = plugin?.provides.intent.resolver(intent, plugins);
77
77
  return result;
78
78
  }
@@ -82,7 +82,7 @@ var IntentPlugin = () => {
82
82
  return result;
83
83
  }
84
84
  }
85
- for (const plugin of (0, import_chunk_VDKZ7AAF.filterPlugins)(plugins, import_chunk_DFST5IG5.parseIntentResolverPlugin)) {
85
+ for (const plugin of (0, import_chunk_62W6CMGM.filterPlugins)(plugins, import_chunk_DFST5IG5.parseIntentResolverPlugin)) {
86
86
  const result = await plugin.provides.intent.resolver(intent, plugins);
87
87
  if (result) {
88
88
  return result;
@@ -181,4 +181,4 @@ var IntentPlugin = () => {
181
181
  };
182
182
  };
183
183
  var plugin_default = IntentPlugin;
184
- //# sourceMappingURL=plugin-J7A2JHKR.cjs.map
184
+ //# sourceMappingURL=plugin-VEIZZVQP.cjs.map
@@ -26,13 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var plugin_D3VWRWFN_exports = {};
30
- __export(plugin_D3VWRWFN_exports, {
29
+ var plugin_ZJ26B7E5_exports = {};
30
+ __export(plugin_ZJ26B7E5_exports, {
31
31
  default: () => plugin_default
32
32
  });
33
- module.exports = __toCommonJS(plugin_D3VWRWFN_exports);
33
+ module.exports = __toCommonJS(plugin_ZJ26B7E5_exports);
34
34
  var import_chunk_BTZLKXA2 = require("./chunk-BTZLKXA2.cjs");
35
- var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
35
+ var import_chunk_62W6CMGM = require("./chunk-62W6CMGM.cjs");
36
36
  var import_react = require("deepsignal/react");
37
37
  var import_react2 = __toESM(require("react"));
38
38
  var SurfacePlugin = () => {
@@ -42,7 +42,7 @@ var SurfacePlugin = () => {
42
42
  return {
43
43
  meta: import_chunk_BTZLKXA2.meta_default,
44
44
  ready: async (plugins) => {
45
- state.components = (0, import_react.shallow)((0, import_chunk_VDKZ7AAF.filterPlugins)(plugins, import_chunk_BTZLKXA2.parseSurfacePlugin).reduce((acc, plugin) => {
45
+ state.components = (0, import_react.shallow)((0, import_chunk_62W6CMGM.filterPlugins)(plugins, import_chunk_BTZLKXA2.parseSurfacePlugin).reduce((acc, plugin) => {
46
46
  return {
47
47
  ...acc,
48
48
  [plugin.meta.id]: plugin.provides.surface.component
@@ -58,4 +58,4 @@ var SurfacePlugin = () => {
58
58
  };
59
59
  };
60
60
  var plugin_default = SurfacePlugin;
61
- //# sourceMappingURL=plugin-D3VWRWFN.cjs.map
61
+ //# sourceMappingURL=plugin-ZJ26B7E5.cjs.map
@@ -4,6 +4,9 @@ import { ErrorBoundary } from './ErrorBoundary';
4
4
  * Direction determines how multiple components are laid out.
5
5
  */
6
6
  export type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';
7
+ /**
8
+ * SurfaceProps are the props that are passed to the Surface component.
9
+ */
7
10
  export type SurfaceProps = PropsWithChildren<{
8
11
  /**
9
12
  * Role defines how the data should be rendered.
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/Surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAEZ,KAAK,SAAS,EAGd,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AAKf,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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WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;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,yGAiBnB,CAAC;AAIF,eAAO,MAAM,UAAU,QAAO,YAC+C,CAAC"}
@@ -1,4 +1,8 @@
1
1
  import { type Plugin } from './PluginHost';
2
+ /**
3
+ * Define a plugin
4
+ */
5
+ export declare const definePlugin: <TProvides>(plugin: Plugin<TProvides>) => Plugin<TProvides>;
2
6
  /**
3
7
  * Find a plugin by ID.
4
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/plugins/helpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,UAAU,eAAgB,MAAM,EAAE,MAAM,MAAM,0BAI1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,eAAgB,MAAM,EAAE,MAAM,MAAM,cAEzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,eACf,MAAM,EAAE,sBACG,MAAM,0CACkF,CAAC;AAE/G;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,eACf,MAAM,EAAE,sBACG,MAAM,oDACoC,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/plugins/helpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,YAAY,6DAAsE,CAAC;AAEhG;;GAEG;AACH,eAAO,MAAM,UAAU,eAAgB,MAAM,EAAE,MAAM,MAAM,0BAI1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,eAAgB,MAAM,EAAE,MAAM,MAAM,cAEzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,eACf,MAAM,EAAE,sBACG,MAAM,0CACkF,CAAC;AAE/G;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,eACf,MAAM,EAAE,sBACG,MAAM,oDACoC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/app-framework",
3
- "version": "0.4.7-main.ea67fec",
3
+ "version": "0.4.7-main.f4b92be",
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,13 +16,13 @@
16
16
  "@preact/signals-core": "^1.5.1",
17
17
  "deepsignal": "^1.5.0",
18
18
  "zod": "^3.22.4",
19
- "@dxos/debug": "0.4.7-main.ea67fec",
20
- "@dxos/async": "0.4.7-main.ea67fec",
21
- "@dxos/app-graph": "0.4.7-main.ea67fec",
22
- "@dxos/invariant": "0.4.7-main.ea67fec",
23
- "@dxos/local-storage": "0.4.7-main.ea67fec",
24
- "@dxos/util": "0.4.7-main.ea67fec",
25
- "@dxos/log": "0.4.7-main.ea67fec"
19
+ "@dxos/async": "0.4.7-main.f4b92be",
20
+ "@dxos/debug": "0.4.7-main.f4b92be",
21
+ "@dxos/app-graph": "0.4.7-main.f4b92be",
22
+ "@dxos/invariant": "0.4.7-main.f4b92be",
23
+ "@dxos/log": "0.4.7-main.f4b92be",
24
+ "@dxos/local-storage": "0.4.7-main.f4b92be",
25
+ "@dxos/util": "0.4.7-main.f4b92be"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react": "^18.0.21",
@@ -23,6 +23,9 @@ import { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } from './Sur
23
23
  */
24
24
  export type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';
25
25
 
26
+ /**
27
+ * SurfaceProps are the props that are passed to the Surface component.
28
+ */
26
29
  export type SurfaceProps = PropsWithChildren<{
27
30
  /**
28
31
  * Role defines how the data should be rendered.
@@ -6,6 +6,11 @@ import { raise } from '@dxos/debug';
6
6
 
7
7
  import { type Plugin } from './PluginHost';
8
8
 
9
+ /**
10
+ * Define a plugin
11
+ */
12
+ export const definePlugin = <TProvides>(plugin: Plugin<TProvides>): Plugin<TProvides> => plugin;
13
+
9
14
  /**
10
15
  * Find a plugin by ID.
11
16
  */
package/typedoc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "includeVersion": true,
4
+ "entryPoints": [
5
+ "src/index.ts"
6
+ ]
7
+ }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugins/helpers.ts"],
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"],
5
- "mappings": ";AAIA,SAASA,aAAa;AAOf,IAAMC,aAAa,CAAIC,SAAmBC,OAAAA;AAC/C,SAAOD,QAAQE,KACb,CAACC,WAAWA,OAAOC,KAAKH,OAAOA,MAAO,OAAOE,OAAOC,KAAKC,YAAY,YAAYF,OAAOC,KAAKC,YAAYJ,EAAAA;AAE7G;AAKO,IAAMK,YAAY,CAAIN,SAAmBC,OAAAA;AAC9C,SAAOF,WAAWC,SAASC,EAAAA,KAAOM,MAAM,IAAIC,MAAM,qBAAqBP,EAAAA,EAAI,CAAA;AAC7E;AAKO,IAAMQ,gBAAgB,CAC3BT,SACAU,cACgBV,QAAQW,IAAI,CAACR,WAAWO,UAAUP,MAAAA,CAAAA,EAASS,OAAO,CAACT,WAAgC,CAAC,CAACA,MAAAA;AAShG,IAAMU,gBAAgB,CAC3Bb,SACAU,cAC0BD,cAAcT,SAASU,SAAAA,EAAW,CAAA;",
6
- "names": ["raise", "findPlugin", "plugins", "id", "find", "plugin", "meta", "shortId", "getPlugin", "raise", "Error", "filterPlugins", "predicate", "map", "filter", "resolvePlugin"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugins/helpers.ts"],
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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAsB;AAOf,IAAMA,aAAa,CAAIC,SAAmBC,OAAAA;AAC/C,SAAOD,QAAQE,KACb,CAACC,WAAWA,OAAOC,KAAKH,OAAOA,MAAO,OAAOE,OAAOC,KAAKC,YAAY,YAAYF,OAAOC,KAAKC,YAAYJ,EAAAA;AAE7G;AAKO,IAAMK,YAAY,CAAIN,SAAmBC,OAAAA;AAC9C,SAAOF,WAAWC,SAASC,EAAAA,SAAOM,oBAAM,IAAIC,MAAM,qBAAqBP,EAAAA,EAAI,CAAA;AAC7E;AAKO,IAAMQ,gBAAgB,CAC3BT,SACAU,cACgBV,QAAQW,IAAI,CAACR,WAAWO,UAAUP,MAAAA,CAAAA,EAASS,OAAO,CAACT,WAAgC,CAAC,CAACA,MAAAA;AAShG,IAAMU,gBAAgB,CAC3Bb,SACAU,cAC0BD,cAAcT,SAASU,SAAAA,EAAW,CAAA;",
6
- "names": ["findPlugin", "plugins", "id", "find", "plugin", "meta", "shortId", "getPlugin", "raise", "Error", "filterPlugins", "predicate", "map", "filter", "resolvePlugin"]
7
- }