@dxos/app-framework 0.6.12 → 0.6.13-main.548ca8d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +169 -163
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +183 -182
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/chunk-ERPIGFBI.mjs +28 -0
- package/dist/lib/node-esm/chunk-ERPIGFBI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-IY7HCP4K.mjs +22 -0
- package/dist/lib/node-esm/chunk-IY7HCP4K.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-P2TQLXZR.mjs +54 -0
- package/dist/lib/node-esm/chunk-P2TQLXZR.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +683 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/plugin-24ZP3LDU.mjs +40 -0
- package/dist/lib/node-esm/plugin-24ZP3LDU.mjs.map +7 -0
- package/dist/lib/node-esm/plugin-5AAUGDB3.mjs +168 -0
- package/dist/lib/node-esm/plugin-5AAUGDB3.mjs.map +7 -0
- package/dist/types/src/App.d.ts +4 -4
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts +14 -0
- package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts.map +1 -0
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts +4 -4
- package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +4 -8
- package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/plugin.d.ts +37 -83
- package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -1
- package/dist/types/src/plugins/PluginHost/plugin.test.d.ts.map +1 -1
- package/dist/types/src/plugins/common/navigation.d.ts +1 -12
- package/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
- package/package.json +14 -11
- package/project.json +3 -8
- package/src/App.tsx +10 -9
- package/src/plugins/PluginHost/PluginContainer.tsx +120 -0
- package/src/plugins/PluginHost/PluginContext.tsx +8 -14
- package/src/plugins/PluginHost/PluginHost.tsx +18 -121
- package/src/plugins/PluginHost/plugin.test.ts +1 -2
- package/src/plugins/PluginHost/plugin.ts +45 -52
- package/src/plugins/common/navigation.ts +4 -12
- package/tsconfig.json +1 -29
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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/PluginHost/PluginContainer.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 Space } from '@dxos/client-protocol';\n\nimport { type Plugin } from '../PluginHost';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport type FileInfo = {\n url?: string;\n cid?: string; // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n};\n\nexport type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;\n\n/**\n * Generic interface provided by file plugins (e.g., IPFS, WNFS).\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, GraphBuilder, Node } from '@dxos/app-graph';\nimport { type MaybePromise } from '@dxos/util';\n\nimport type { Plugin } from '../PluginHost';\n\n// TODO(wittjosiah): Factor out.\nexport type SerializedNode = {\n name: string;\n data: string;\n type?: string;\n};\n\n// TODO(wittjosiah): Factor out.\nexport type NodeSerializer<T = any> = {\n inputType: string;\n outputType: string;\n disposition?: 'hoist' | 'fallback';\n\n /**\n * Takes a node and serializes it into a format that can be stored.\n */\n serialize: (node: Node<T>) => MaybePromise<SerializedNode>;\n\n /**\n * Takes a serialized node and deserializes it into the application.\n */\n deserialize: (data: SerializedNode, ancestors: unknown[]) => MaybePromise<T>;\n};\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphProvides = {\n graph: Graph;\n explore: GraphBuilder['explore'];\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (plugins: Plugin[]) => Parameters<GraphBuilder['addExtension']>[0];\n };\n};\n\nexport type GraphSerializerProvides = {\n graph: {\n serializer: (plugins: Plugin[]) => NodeSerializer[];\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/**\n * Type guard for graph serializer plugins.\n */\nexport const parseGraphSerializerPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.serializer ? (plugin as Plugin<GraphSerializerProvides>) : 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\nconst LayoutMode = z.union([z.literal('deck'), z.literal('solo'), z.literal('fullscreen')]);\nexport const isLayoutMode = (value: any): value is LayoutMode => LayoutMode.safeParse(value).success;\nexport type LayoutMode = z.infer<typeof LayoutMode>;\n\n// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.\nexport const Layout = z.object({\n layoutMode: z.union([z.literal('deck'), z.literal('solo'), z.literal('fullscreen')]),\n\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n /**\n * @deprecated\n */\n complementarySidebarContent: z\n .any()\n .optional()\n .describe('DEPRECATED. 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 // TODO(wittjosiah): Custom properties?\n dialogBlockAlign: z.union([z.literal('start'), z.literal('center')]).optional(),\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 scrollIntoView: z\n .string()\n .optional()\n .describe('The identifier of a component to scroll into view when it is mounted.'),\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 SET_LAYOUT_MODE = `${LAYOUT_ACTION}/set-layout-mode`,\n SCROLL_INTO_VIEW = `${LAYOUT_ACTION}/scroll-into-view`,\n UPDATE_PLANK_SIZE = `${LAYOUT_ACTION}/update-plank-size`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type SetLayoutMode = IntentData<{\n layoutMode?: LayoutMode;\n revert?: boolean;\n }>;\n\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 // TODO(wittjosiah): Custom properties?\n\n /**\n * Block alignment for the dialog.\n */\n dialogBlockAlign?: 'start' | 'center';\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 { Schema as S } from '@effect/schema';\nimport { z } from 'zod';\n\nimport type { IntentData } from '../IntentPlugin';\nimport type { Plugin } from '../PluginHost';\n\n// NOTE(thure): These are chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const SLUG_LIST_SEPARATOR = '+';\nexport const SLUG_ENTRY_SEPARATOR = '_';\nexport const SLUG_KEY_VALUE_SEPARATOR = '-';\nexport const SLUG_PATH_SEPARATOR = '~';\nexport const SLUG_COLLECTION_INDICATOR = '';\n\nconst LayoutEntrySchema = S.mutable(S.Struct({ id: S.String, path: S.optional(S.String) }));\nexport type LayoutEntry = S.Schema.Type<typeof LayoutEntrySchema>;\n\n// TODO(Zan): Consider renaming the 'main' part to 'deck' part now that we are throwing out the old layout plugin.\n// TODO(Zan): Extend to all strings?\nconst LayoutPartSchema = S.Union(\n S.Literal('sidebar'),\n S.Literal('main'),\n S.Literal('solo'),\n S.Literal('complementary'),\n S.Literal('fullScreen'),\n);\nexport type LayoutPart = S.Schema.Type<typeof LayoutPartSchema>;\n\nconst LayoutPartsSchema = S.partial(\n S.mutable(S.Record({ key: LayoutPartSchema, value: S.mutable(S.Array(LayoutEntrySchema)) })),\n);\nexport type LayoutParts = S.Schema.Type<typeof LayoutPartsSchema>;\n\nconst LayoutCoordinateSchema = S.mutable(S.Struct({ part: LayoutPartSchema, entryId: S.String }));\nexport type LayoutCoordinate = S.Schema.Type<typeof LayoutCoordinateSchema>;\n\nconst PartAdjustmentSchema = S.Union(S.Literal('increment-start'), S.Literal('increment-end'), S.Literal('solo'));\nexport type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;\n\nconst LayoutAdjustmentSchema = S.mutable(\n S.Struct({ layoutCoordinate: LayoutCoordinateSchema, type: PartAdjustmentSchema }),\n);\nexport type LayoutAdjustment = S.Schema.Type<typeof LayoutAdjustmentSchema>;\n\n/** @deprecated */\nexport const ActiveParts = z.record(z.string(), z.union([z.string(), z.array(z.string())]));\nexport type ActiveParts = z.infer<typeof ActiveParts>;\n\n// TODO(burdon): Where should this go?\nexport type LayoutContainerProps<T> = T & { role?: string; coordinate?: LayoutCoordinate };\n\n/**\n * Provides for a plugin that can manage the app navigation.\n */\nconst LocationProvidesSchema = S.mutable(\n S.Struct({\n location: S.Struct({\n active: LayoutPartsSchema,\n closed: S.Array(S.String),\n }),\n }),\n);\nexport type LocationProvides = S.Schema.Type<typeof LocationProvidesSchema>;\n\n/**\n * Type guard for layout plugins.\n */\nexport const isLayoutParts = (value: unknown): value is LayoutParts => {\n return S.is(LayoutPartsSchema)(value);\n};\n\n// Type guard for PartAdjustment.\nexport const isLayoutAdjustment = (value: unknown): value is LayoutAdjustment => {\n return S.is(LayoutAdjustmentSchema)(value);\n};\n\nexport const parseNavigationPlugin = (plugin: Plugin): Plugin<LocationProvides> | undefined => {\n const location = (plugin.provides as any)?.location;\n if (!location) {\n return undefined;\n }\n\n if (S.is(LocationProvidesSchema)({ location })) {\n return plugin as Plugin<LocationProvides>;\n }\n\n return undefined;\n};\n\n/**\n * Utilities.\n */\n\n/** Extracts all unique IDs from the layout parts. */\nexport const openIds = (layout: LayoutParts): string[] => {\n return Object.values(layout)\n .flatMap((part) => part?.map((entry) => entry.id) ?? [])\n .filter((id): id is string => id !== undefined);\n};\n\nexport const firstIdInPart = (layout: LayoutParts | undefined, part: LayoutPart): string | undefined => {\n if (!layout) {\n return undefined;\n }\n\n return layout[part]?.at(0)?.id;\n};\n\nexport const indexInPart = (\n layout: LayoutParts | undefined,\n layoutCoordinate: LayoutCoordinate | undefined,\n): number | undefined => {\n if (!layout || !layoutCoordinate) {\n return undefined;\n }\n\n const { part, entryId } = layoutCoordinate;\n return layout[part]?.findIndex((entry) => entry.id === entryId);\n};\n\nexport const partLength = (layout: LayoutParts | undefined, part: LayoutPart | undefined): number => {\n if (!layout || !part) {\n return 0;\n }\n\n return layout[part]?.length ?? 0;\n};\n\n//\n// Intents\n//\n\nconst NAVIGATION_ACTION = 'dxos.org/plugin/navigation';\nexport enum NavigationAction {\n OPEN = `${NAVIGATION_ACTION}/open`,\n ADD_TO_ACTIVE = `${NAVIGATION_ACTION}/add-to-active`,\n SET = `${NAVIGATION_ACTION}/set`,\n ADJUST = `${NAVIGATION_ACTION}/adjust`,\n CLOSE = `${NAVIGATION_ACTION}/close`,\n EXPOSE = `${NAVIGATION_ACTION}/expose`,\n}\n\n/**\n * Expected payload for navigation actions.\n */\nexport namespace NavigationAction {\n /**\n * An additive overlay to apply to `location.active` (i.e. the result is a union of previous active and the argument)\n */\n export type Open = IntentData<{ activeParts: ActiveParts }>;\n\n /**\n * Payload for adding an item to the active items.\n */\n export type AddToActive = IntentData<{\n part: LayoutPart;\n id: string;\n scrollIntoView?: boolean;\n pivotId?: string;\n positioning?: 'start' | 'end';\n }>;\n\n /**\n * A subtractive overlay to apply to `location.active` (i.e. the result is a subtraction from the previous active of the argument)\n */\n export type Close = IntentData<{ activeParts: ActiveParts; noToggle?: boolean }>;\n\n /**\n * The active parts to directly set, to be used when working with URLs or restoring a specific state.\n */\n export type Set = IntentData<{ activeParts: ActiveParts }>;\n\n /**\n * An atomic transaction to apply to `location.active`, describing which element to (attempt to) move to which location.\n */\n export type Adjust = IntentData<LayoutAdjustment>;\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 { 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\nexport type PluginMeta = {\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 * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\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: PluginMeta;\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\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 2024 DXOS.org\n//\n\nimport { createContext, useContext, useMemo } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { nonNullable } from '@dxos/util';\n\nimport { type Plugin, type PluginMeta } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Core plugins.\n */\n core: string[];\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 * NOTE: This is metadata rather than just ids because it includes plugins which have not been fully loaded yet.\n */\n available: PluginMeta[];\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 = createContext<PluginContext | undefined>(undefined);\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext) ?? raise(new Error('Missing 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\n/**\n * Resolve a collection of plugins by predicate.\n */\nexport const useResolvePlugins = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T>[] => {\n const { plugins } = usePlugins();\n return useMemo(() => plugins.map(predicate).filter(nonNullable), [plugins, predicate]);\n};\n\nexport const PluginProvider = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\n\nimport { PluginContainer } from './PluginContainer';\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginMeta } from './plugin';\nimport { ErrorBoundary } from '../SurfacePlugin';\n\nexport type BootstrapPluginsParams = {\n plugins: Record<string, () => Promise<PluginDefinition>>;\n // Ordered list of plugins.\n meta: PluginMeta[];\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 plugins,\n meta,\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 core,\n enabled: [...defaults],\n plugins: [],\n available: meta.filter(({ id }) => !core.includes(id)),\n setPlugin: (id: string, enabled: boolean) => {\n if (enabled) {\n state.values.enabled.push(id);\n } else {\n const index = state.values.enabled.findIndex((enabled) => enabled === id);\n index !== -1 && state.values.enabled.splice(index, 1);\n }\n },\n });\n\n // Register and load values.\n state.prop({ key: 'enabled', type: LocalStorageStore.json<string[]>() });\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => {\n return <PluginProvider value={state.values}>{children}</PluginProvider>;\n },\n root: () => {\n return (\n <ErrorBoundary fallback={fallback}>\n <PluginContainer plugins={plugins} core={core} state={state.values} placeholder={placeholder} />\n </ErrorBoundary>\n );\n },\n },\n };\n};\n\n/**\n * Fallback does not use tailwind or theme.\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type JSX, type FC, type PropsWithChildren, type ReactNode, useEffect, useState } from 'react';\n\nimport { log } from '@dxos/log';\n\nimport { type PluginContext } from './PluginContext';\nimport { type BootstrapPluginsParams } from './PluginHost';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type PluginContainerProps = Pick<BootstrapPluginsParams, 'core'> & {\n plugins: Record<string, () => Promise<PluginDefinition>>;\n state: PluginContext;\n placeholder: ReactNode;\n};\n\n/**\n * Root component initializes plugins.\n */\nexport const PluginContainer = ({ plugins: definitions, core, state, placeholder }: PluginContainerProps) => {\n const [error, setError] = useState<unknown>();\n\n useEffect(() => {\n log('initializing plugins', { enabled: state.enabled });\n const t = setTimeout(async () => {\n try {\n const enabledIds = [...core, ...state.enabled];\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 log.error('Failed to initialize plugin:', { id: definition.meta.id, err });\n });\n\n log('initialized', { plugin: definition.meta.id });\n return plugin;\n }),\n );\n\n const initialized = plugins.filter((plugin): plugin is Plugin => Boolean(plugin));\n log('plugins initialized', { plugins: initialized });\n\n await Promise.all(enabled.map((plugin) => plugin.ready?.(initialized)));\n log('plugins ready', { plugins: initialized });\n\n state.plugins = initialized;\n state.ready = true;\n } catch (err) {\n setError(err);\n }\n });\n\n return () => {\n clearTimeout(t);\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 */\nconst 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<{ data?: any; 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 data={this.props.data} 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, Plugin, PluginHost } 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 meta = [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.plugins All plugins available to the application.\n * @param params.meta All plugin metadata.\n * @param params.core Core plugins which will always be enabled.\n * @param params.defaults 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 = ({ meta, plugins, core, ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n // TODO(burdon): Why not include in core?\n meta: [SurfaceMeta, IntentMeta, ...meta],\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides);\n const { context: Context, root: Root } = host.provides;\n invariant(Context);\n invariant(Root);\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,IAAMA,mBAAmB;EAC9BC,QAAQ;IAAC;IAAO;IAAO;IAAQ;;EAC/BC,OAAO;IAAC;IAAO;IAAO;IAAO;;EAC7BC,MAAM;IAAC;IAAO;IAAO;;AACvB;AAmBO,IAAMC,yBAAyB,CAACC,WAAAA;AACrC,SAAQA,OAAOC,SAAiBC,OAAQF,SAAyCG;AACnF;;;ACqBO,IAAMC,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,SAAmCI;AAKtE,IAAMC,0BAA0B,CAACL,WACrCA,OAAOC,SAAiBC,OAAOI,UAAWN,SAA0CI;AAKhF,IAAMG,6BAA6B,CAACP,WACxCA,OAAOC,SAAiBC,OAAOM,aAAcR,SAA6CI;;;ACjE7F,SAASK,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;AAYA,IAAMW,aAAahB,EAAEiB,MAAM;EAACjB,EAAEkB,QAAQ,MAAA;EAASlB,EAAEkB,QAAQ,MAAA;EAASlB,EAAEkB,QAAQ,YAAA;CAAc;AACnF,IA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MQ,OAAO,GACtF,gBAAAd,OAAA,cAACe,OAAAA,MAAKT,MAAMU,KAAK,CAAA;AAGvB;;;AK1FA,OAAOC,YAAW;AAElB,SAASC,iBAAiB;;AAgCnB,IAAMC,YAAY,CAAC,EAAEC,MAAMC,SAASC,MAAM,GAAGC,OAAAA,MAAgC;AAClF,QAAMC,OAAOC,WAAW;IACtBJ,SAAS;MACP,GAAGA;MACH,CAACK,cAAYC,EAAE,GAAGC,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAACC,aAAWH,EAAE,GAAGC,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;;IAEAT,MAAM;MAACM;MAAaI;SAAeV;;IACnCE,MAAM;MAACI,cAAYC;MAAIG,aAAWH;SAAOL;;IACzC,GAAGC;EACL,CAAA;AAEAQ,YAAUP,KAAKQ,UAAQ,QAAA;;;;;;;;;AACvB,QAAM,EAAEC,SAASC,SAASC,MAAMC,KAAI,IAAKZ,KAAKQ;AAC9CD,YAAUG,SAAAA,QAAAA;;;;;;;;;AACVH,YAAUK,MAAAA,QAAAA;;;;;;;;;AAEV,SAAO,MACL,gBAAAC,OAAA,cAACH,SAAAA,MACC,gBAAAG,OAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["defaultFileTypes", "images", "media", "text", "parseFileManagerPlugin", "plugin", "provides", "file", "undefined", "parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "parseGraphSerializerPlugin", "serializer", "z", "Toast", "z", "object", "id", "string", "title", "optional", "description", "icon", "any", "duration", "number", "closeLabel", "actionLabel", "actionAlt", "onAction", "function", "LayoutMode", "union", "literal", "isLayoutMode", "value", "safeParse", "success", "Layout", "layoutMode", "sidebarOpen", "boolean", "complementarySidebarOpen", "complementarySidebarContent", "describe", "dialogOpen", "dialogContent", "dialogBlockAlign", "popoverOpen", "popoverContent", "popoverAnchorId", "toasts", "array", "scrollIntoView", "parseLayoutPlugin", "plugin", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "Schema", "S", "z", "SLUG_LIST_SEPARATOR", "SLUG_ENTRY_SEPARATOR", "SLUG_KEY_VALUE_SEPARATOR", "SLUG_PATH_SEPARATOR", "SLUG_COLLECTION_INDICATOR", "LayoutEntrySchema", "S", "mutable", "Struct", "id", "String", "path", "optional", "LayoutPartSchema", "Union", "Literal", "LayoutPartsSchema", "partial", "Record", "key", "value", "Array", "LayoutCoordinateSchema", "part", "entryId", "PartAdjustmentSchema", "LayoutAdjustmentSchema", "layoutCoordinate", "type", "ActiveParts", "z", "record", "string", "union", "array", "LocationProvidesSchema", "location", "active", "closed", "isLayoutParts", "is", "isLayoutAdjustment", "parseNavigationPlugin", "plugin", "provides", "undefined", "openIds", "layout", "Object", "values", "flatMap", "map", "entry", "filter", "firstIdInPart", "at", "indexInPart", "findIndex", "partLength", "length", "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", "Plugin", "lazy", "p", "props", "then", "default", "definition", "createContext", "useContext", "useMemo", "raise", "nonNullable", "PluginContext", "createContext", "undefined", "usePlugins", "useContext", "raise", "Error", "usePlugin", "id", "plugins", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "useResolvePlugins", "useMemo", "map", "filter", "nonNullable", "PluginProvider", "Provider", "React", "LocalStorageStore", "React", "useEffect", "useState", "log", "PluginContainer", "plugins", "definitions", "core", "state", "placeholder", "error", "setError", "enabled", "t", "setTimeout", "enabledIds", "Promise", "all", "map", "id", "filter", "definition", "Boolean", "plugin", "initializePlugin", "catch", "err", "meta", "initialized", "ready", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "pluginDefinition", "provides", "initialize", "Component", "root", "key", "node", "compose", "p", "context", "contexts", "reduce", "Acc", "Next", "children", "isObject", "data", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "React", "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", "meta", "core", "defaults", "fallback", "DefaultFallback", "placeholder", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "setPlugin", "values", "push", "index", "findIndex", "splice", "prop", "key", "type", "json", "name", "context", "children", "React", "PluginProvider", "value", "root", "ErrorBoundary", "PluginContainer", "error", "div", "style", "padding", "h1", "fontSize", "fontWeight", "margin", "message", "pre", "stack", "React", "invariant", "createApp", "meta", "plugins", "core", "params", "host", "PluginHost", "SurfaceMeta", "id", "Plugin", "lazy", "IntentMeta", "invariant", "provides", "context", "Context", "root", "Root", "React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytes":2950,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":3905,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":11904,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2094,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/navigation.ts":{"bytes":16418,"imports":[{"path":"@effect/schema","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/settings.ts":{"bytes":2093,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3521,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":1046,"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":4410,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":3845,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":2719,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":4090,"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":710,"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":4952,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":5326,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContainer.tsx":{"bytes":13337,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts":{"bytes":1817,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1970,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4343,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2815,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":13897,"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":917,"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":9280,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContainer.tsx","kind":"import-statement","original":"./PluginContainer"},{"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":710,"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":890,"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":726,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":734,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":3949,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":1170,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":19387,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":7052,"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":576,"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-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":54089},"packages/sdk/app-framework/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-ERPIGFBI.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-P2TQLXZR.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-IY7HCP4K.mjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"path":"@effect/schema","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":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"react","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-esm/plugin-24ZP3LDU.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/node-esm/plugin-5AAUGDB3.mjs","kind":"dynamic-import"}],"exports":["ActiveParts","ErrorBoundary","IntentAction","IntentProvider","Layout","LayoutAction","NavigationAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","SLUG_COLLECTION_INDICATOR","SLUG_ENTRY_SEPARATOR","SLUG_KEY_VALUE_SEPARATOR","SLUG_LIST_SEPARATOR","SLUG_PATH_SEPARATOR","SettingsAction","Surface","SurfaceProvider","Toast","createApp","defaultFileTypes","definePlugin","filterPlugins","findPlugin","firstIdInPart","getPlugin","indexInPart","isLayoutAdjustment","isLayoutMode","isLayoutParts","isObject","openIds","parseFileManagerPlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseGraphSerializerPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parseNavigationPlugin","parsePluginHost","parseRootSurfacePlugin","parseSettingsPlugin","parseSurfacePlugin","parseTranslationsPlugin","partLength","resolvePlugin","useIntent","useIntentDispatcher","useIntentResolver","usePlugin","usePlugins","useResolvePlugin","useResolvePlugins","useSurface","useSurfaceRoot"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/file.ts":{"bytesInOutput":288},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":272},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":2222},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/navigation.ts":{"bytesInOutput":2923},"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":197},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":742},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":1821},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContainer.tsx":{"bytesInOutput":3388},"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":707},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2746},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1226}},"bytes":20311},"packages/sdk/app-framework/dist/lib/node-esm/plugin-24ZP3LDU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1946},"packages/sdk/app-framework/dist/lib/node-esm/plugin-24ZP3LDU.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-ERPIGFBI.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-IY7HCP4K.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":655}},"bytes":1052},"packages/sdk/app-framework/dist/lib/node-esm/chunk-ERPIGFBI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3086},"packages/sdk/app-framework/dist/lib/node-esm/chunk-ERPIGFBI.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":980},"packages/sdk/app-framework/dist/lib/node-esm/plugin-5AAUGDB3.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9485},"packages/sdk/app-framework/dist/lib/node-esm/plugin-5AAUGDB3.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-P2TQLXZR.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/node-esm/chunk-IY7HCP4K.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","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":4605},"packages/sdk/app-framework/src/plugins/IntentPlugin/helpers.ts":{"bytesInOutput":94}},"bytes":5265},"packages/sdk/app-framework/dist/lib/node-esm/chunk-P2TQLXZR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3906},"packages/sdk/app-framework/dist/lib/node-esm/chunk-P2TQLXZR.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":1638},"packages/sdk/app-framework/dist/lib/node-esm/chunk-IY7HCP4K.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2288},"packages/sdk/app-framework/dist/lib/node-esm/chunk-IY7HCP4K.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":843}}}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
SurfaceProvider,
|
|
4
|
+
meta_default,
|
|
5
|
+
parseSurfacePlugin
|
|
6
|
+
} from "./chunk-ERPIGFBI.mjs";
|
|
7
|
+
import {
|
|
8
|
+
filterPlugins
|
|
9
|
+
} from "./chunk-IY7HCP4K.mjs";
|
|
10
|
+
|
|
11
|
+
// packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { create } from "@dxos/echo-schema";
|
|
14
|
+
var SurfacePlugin = () => {
|
|
15
|
+
const state = create({
|
|
16
|
+
components: {}
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
meta: meta_default,
|
|
20
|
+
ready: async (plugins) => {
|
|
21
|
+
state.components = filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {
|
|
22
|
+
return {
|
|
23
|
+
...acc,
|
|
24
|
+
[plugin.meta.id]: plugin.provides.surface.component
|
|
25
|
+
};
|
|
26
|
+
}, {});
|
|
27
|
+
},
|
|
28
|
+
provides: {
|
|
29
|
+
surface: state,
|
|
30
|
+
context: ({ children }) => /* @__PURE__ */ React.createElement(SurfaceProvider, {
|
|
31
|
+
value: state
|
|
32
|
+
}, children)
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
var plugin_default = SurfacePlugin;
|
|
37
|
+
export {
|
|
38
|
+
plugin_default as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=plugin-24ZP3LDU.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/SurfacePlugin/plugin.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { create } from '@dxos/echo-schema';\n\nimport { SurfaceProvider, type SurfaceRootContext } from './SurfaceRootContext';\nimport SurfaceMeta from './meta';\nimport { parseSurfacePlugin, type SurfacePluginProvides } from './provides';\nimport type { PluginDefinition } from '../PluginHost';\nimport { filterPlugins } from '../helpers';\n\n/**\n * Provides a registry of surface components.\n */\nconst SurfacePlugin = (): PluginDefinition<SurfacePluginProvides> => {\n const state = create<SurfaceRootContext>({ components: {} });\n\n return {\n meta: SurfaceMeta,\n ready: async (plugins) => {\n state.components = filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {\n return { ...acc, [plugin.meta.id]: plugin.provides.surface.component };\n }, {});\n },\n provides: {\n surface: state,\n context: ({ children }) => <SurfaceProvider value={state}>{children}</SurfaceProvider>,\n },\n };\n};\n\nexport default SurfacePlugin;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAc;AAWvB,IAAMC,gBAAgB,MAAA;AACpB,QAAMC,QAAQC,OAA2B;IAAEC,YAAY,CAAC;EAAE,CAAA;AAE1D,SAAO;IACLC,MAAMC;IACNC,OAAO,OAAOC,YAAAA;AACZN,YAAME,aAAaK,cAAcD,SAASE,kBAAAA,EAAoBC,OAAO,CAACC,KAAKC,WAAAA;AACzE,eAAO;UAAE,GAAGD;UAAK,CAACC,OAAOR,KAAKS,EAAE,GAAGD,OAAOE,SAASC,QAAQC;QAAU;MACvE,GAAG,CAAC,CAAA;IACN;IACAF,UAAU;MACRC,SAASd;MACTgB,SAAS,CAAC,EAAEC,SAAQ,MAAO,sBAAA,cAACC,iBAAAA;QAAgBC,OAAOnB;SAAQiB,QAAAA;IAC7D;EACF;AACF;AAEA,IAAA,iBAAelB;",
|
|
6
|
+
"names": ["React", "create", "SurfacePlugin", "state", "create", "components", "meta", "SurfaceMeta", "ready", "plugins", "filterPlugins", "parseSurfacePlugin", "reduce", "acc", "plugin", "id", "provides", "surface", "component", "context", "children", "SurfaceProvider", "value"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
IntentAction,
|
|
4
|
+
IntentProvider,
|
|
5
|
+
meta_default,
|
|
6
|
+
parseIntentResolverPlugin
|
|
7
|
+
} from "./chunk-P2TQLXZR.mjs";
|
|
8
|
+
import {
|
|
9
|
+
filterPlugins,
|
|
10
|
+
findPlugin
|
|
11
|
+
} from "./chunk-IY7HCP4K.mjs";
|
|
12
|
+
|
|
13
|
+
// packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx
|
|
14
|
+
import React from "react";
|
|
15
|
+
import { create } from "@dxos/echo-schema";
|
|
16
|
+
import { log } from "@dxos/log";
|
|
17
|
+
|
|
18
|
+
// packages/sdk/app-framework/src/plugins/IntentPlugin/helpers.ts
|
|
19
|
+
var isUndoable = (chain) => chain.length > 0 && chain.every(({ result }) => result.undoable);
|
|
20
|
+
|
|
21
|
+
// packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx
|
|
22
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx";
|
|
23
|
+
var EXECUTION_LIMIT = 1e3;
|
|
24
|
+
var HISTORY_LIMIT = 100;
|
|
25
|
+
var IntentPlugin = () => {
|
|
26
|
+
const state = create({
|
|
27
|
+
dispatch: async () => ({}),
|
|
28
|
+
undo: async () => ({}),
|
|
29
|
+
history: [],
|
|
30
|
+
registerResolver: () => () => {
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const dynamicResolvers = /* @__PURE__ */ new Set();
|
|
34
|
+
return {
|
|
35
|
+
meta: meta_default,
|
|
36
|
+
ready: async (plugins) => {
|
|
37
|
+
const dispatch = async (intent) => {
|
|
38
|
+
log("dispatch", {
|
|
39
|
+
action: intent.action,
|
|
40
|
+
intent
|
|
41
|
+
}, {
|
|
42
|
+
F: __dxlog_file,
|
|
43
|
+
L: 45,
|
|
44
|
+
S: void 0,
|
|
45
|
+
C: (f, a) => f(...a)
|
|
46
|
+
});
|
|
47
|
+
if (intent.plugin) {
|
|
48
|
+
for (const entry of dynamicResolvers) {
|
|
49
|
+
if (entry.plugin === intent.plugin) {
|
|
50
|
+
const result2 = await entry.resolver(intent, plugins);
|
|
51
|
+
if (result2) {
|
|
52
|
+
return result2;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const plugin = findPlugin(plugins, intent.plugin);
|
|
57
|
+
const result = plugin?.provides.intent.resolver(intent, plugins);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
for (const entry of dynamicResolvers) {
|
|
61
|
+
const result = await entry.resolver(intent, plugins);
|
|
62
|
+
if (result) {
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
for (const plugin of filterPlugins(plugins, parseIntentResolverPlugin)) {
|
|
67
|
+
const result = await plugin.provides.intent.resolver(intent, plugins);
|
|
68
|
+
if (result) {
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (import.meta?.env?.DEV) {
|
|
73
|
+
log.warn("No plugin found to handle intent", intent, {
|
|
74
|
+
F: __dxlog_file,
|
|
75
|
+
L: 79,
|
|
76
|
+
S: void 0,
|
|
77
|
+
C: (f, a) => f(...a)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const dispatchChain = async (intentOrArray, depth = 0) => {
|
|
82
|
+
if (depth > EXECUTION_LIMIT) {
|
|
83
|
+
return {
|
|
84
|
+
error: new Error(`Intent execution limit exceeded (${EXECUTION_LIMIT} iterations). This is likely due to an infinite loop within intent resolvers.`)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const executionResults = [];
|
|
88
|
+
const chain = Array.isArray(intentOrArray) ? intentOrArray : [
|
|
89
|
+
intentOrArray
|
|
90
|
+
];
|
|
91
|
+
for (const intent of chain) {
|
|
92
|
+
const { result: prevResult } = executionResults.at(-1) ?? {};
|
|
93
|
+
const data = intent.data ? {
|
|
94
|
+
result: prevResult?.data,
|
|
95
|
+
...intent.data
|
|
96
|
+
} : prevResult?.data;
|
|
97
|
+
const result = await dispatch({
|
|
98
|
+
...intent,
|
|
99
|
+
data
|
|
100
|
+
});
|
|
101
|
+
if (!result || result?.error) {
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
executionResults.push({
|
|
105
|
+
intent,
|
|
106
|
+
result
|
|
107
|
+
});
|
|
108
|
+
result?.intents?.forEach((intents) => {
|
|
109
|
+
void dispatchChain(intents, depth + 1);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
state.history.push(executionResults);
|
|
113
|
+
if (state.history.length > HISTORY_LIMIT) {
|
|
114
|
+
state.history.splice(0, state.history.length - HISTORY_LIMIT);
|
|
115
|
+
}
|
|
116
|
+
if (isUndoable(executionResults)) {
|
|
117
|
+
void dispatch({
|
|
118
|
+
action: IntentAction.SHOW_UNDO,
|
|
119
|
+
data: {
|
|
120
|
+
results: executionResults
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return executionResults.at(-1)?.result;
|
|
125
|
+
};
|
|
126
|
+
const undo = async () => {
|
|
127
|
+
const last = state.history.findLastIndex(isUndoable);
|
|
128
|
+
const chain = last !== -1 && state.history[last]?.map(({ intent, result }) => {
|
|
129
|
+
const data = result.undoable?.data ? {
|
|
130
|
+
...intent.data,
|
|
131
|
+
...result.undoable.data
|
|
132
|
+
} : intent.data;
|
|
133
|
+
return {
|
|
134
|
+
...intent,
|
|
135
|
+
data,
|
|
136
|
+
undo: true
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
if (chain) {
|
|
140
|
+
const result = await dispatchChain(chain);
|
|
141
|
+
state.history = state.history.filter((_, index) => index !== last);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
state.dispatch = dispatchChain;
|
|
146
|
+
state.undo = undo;
|
|
147
|
+
state.registerResolver = (plugin, resolver) => {
|
|
148
|
+
const entry = {
|
|
149
|
+
plugin,
|
|
150
|
+
resolver
|
|
151
|
+
};
|
|
152
|
+
dynamicResolvers.add(entry);
|
|
153
|
+
return () => dynamicResolvers.delete(entry);
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
provides: {
|
|
157
|
+
intent: state,
|
|
158
|
+
context: ({ children }) => /* @__PURE__ */ React.createElement(IntentProvider, {
|
|
159
|
+
value: state
|
|
160
|
+
}, children)
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
var plugin_default = IntentPlugin;
|
|
165
|
+
export {
|
|
166
|
+
plugin_default as default
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=plugin-5AAUGDB3.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/IntentPlugin/plugin.tsx", "../../../src/plugins/IntentPlugin/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { create } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\n\nimport { type IntentContext, IntentProvider, type IntentExecution } from './IntentContext';\nimport { isUndoable } from './helpers';\nimport type { Intent, IntentResolver } from './intent';\nimport IntentMeta from './meta';\nimport {\n type IntentPluginProvides,\n type IntentResolverProvides,\n parseIntentResolverPlugin,\n IntentAction,\n} from './provides';\nimport type { PluginDefinition } from '../PluginHost';\nimport { filterPlugins, findPlugin } from '../helpers';\n\nconst EXECUTION_LIMIT = 1000;\nconst HISTORY_LIMIT = 100;\n\n/**\n * Allows plugins to register intent handlers and routes sent intents to the appropriate plugin.\n * Inspired by https://developer.android.com/reference/android/content/Intent.\n */\nconst IntentPlugin = (): PluginDefinition<IntentPluginProvides> => {\n const state = create<IntentContext>({\n dispatch: async () => ({}),\n undo: async () => ({}),\n history: [],\n registerResolver: () => () => {},\n });\n\n const dynamicResolvers = new Set<{ plugin: string; resolver: IntentResolver }>();\n\n return {\n meta: IntentMeta,\n ready: async (plugins) => {\n // Dispatch intent to associated plugin.\n const dispatch = async (intent: Intent) => {\n log('dispatch', { action: intent.action, intent });\n if (intent.plugin) {\n for (const entry of dynamicResolvers) {\n if (entry.plugin === intent.plugin) {\n const result = await entry.resolver(intent, plugins);\n if (result) {\n return result;\n }\n }\n }\n\n const plugin = findPlugin<IntentResolverProvides>(plugins, intent.plugin);\n const result = plugin?.provides.intent.resolver(intent, plugins);\n return result;\n }\n\n for (const entry of dynamicResolvers) {\n const result = await entry.resolver(intent, plugins);\n if (result) {\n return result;\n }\n }\n\n // Return resolved value from first plugin that handles the intent.\n for (const plugin of filterPlugins(plugins, parseIntentResolverPlugin)) {\n const result = await plugin.provides.intent.resolver(intent, plugins);\n if (result) {\n return result;\n }\n }\n\n // https://vitejs.dev/guide/env-and-mode#env-variables\n // TODO(wittjosiah): How to handle this more generically?\n if (import.meta?.env?.DEV) {\n log.warn('No plugin found to handle intent', intent);\n }\n };\n\n // Sequentially dispatch array of invents.\n const dispatchChain = async (intentOrArray: Intent | Intent[], depth = 0) => {\n if (depth > EXECUTION_LIMIT) {\n return {\n error: new Error(\n `Intent execution limit exceeded (${EXECUTION_LIMIT} iterations). This is likely due to an infinite loop within intent resolvers.`,\n ),\n };\n }\n\n const executionResults: IntentExecution[] = [];\n const chain = Array.isArray(intentOrArray) ? intentOrArray : [intentOrArray];\n for (const intent of chain) {\n const { result: prevResult } = executionResults.at(-1) ?? {};\n const data = intent.data ? { result: prevResult?.data, ...intent.data } : prevResult?.data;\n const result = await dispatch({ ...intent, data });\n\n if (!result || result?.error) {\n break;\n }\n\n executionResults.push({ intent, result });\n\n // TODO(wittjosiah): How does undo work with returned intents?\n result?.intents?.forEach((intents) => {\n void dispatchChain(intents, depth + 1);\n });\n }\n\n state.history.push(executionResults);\n if (state.history.length > HISTORY_LIMIT) {\n state.history.splice(0, state.history.length - HISTORY_LIMIT);\n }\n\n if (isUndoable(executionResults)) {\n void dispatch({ action: IntentAction.SHOW_UNDO, data: { results: executionResults } });\n }\n\n return executionResults.at(-1)?.result;\n };\n\n const undo = async () => {\n const last = state.history.findLastIndex(isUndoable);\n const chain =\n last !== -1 &&\n state.history[last]?.map(({ intent, result }): Intent => {\n const data = result.undoable?.data ? { ...intent.data, ...result.undoable.data } : intent.data;\n return { ...intent, data, undo: true };\n });\n if (chain) {\n const result = await dispatchChain(chain);\n state.history = state.history.filter((_, index) => index !== last);\n return result;\n }\n };\n\n state.dispatch = dispatchChain;\n state.undo = undo;\n state.registerResolver = (plugin, resolver) => {\n const entry = { plugin, resolver };\n dynamicResolvers.add(entry);\n return () => dynamicResolvers.delete(entry);\n };\n },\n provides: {\n intent: state,\n context: ({ children }) => <IntentProvider value={state}>{children}</IntentProvider>,\n },\n };\n};\n\nexport default IntentPlugin;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type IntentExecution } from './IntentContext';\n\n/**\n * Check if the chain of intents is undoable.\n */\nexport const isUndoable = (chain: IntentExecution[]): boolean =>\n chain.length > 0 && chain.every(({ result }) => result.undoable);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAc;AACvB,SAASC,WAAW;;;ACEb,IAAMC,aAAa,CAACC,UACzBA,MAAMC,SAAS,KAAKD,MAAME,MAAM,CAAC,EAAEC,OAAM,MAAOA,OAAOC,QAAQ;;;;ADYjE,IAAMC,kBAAkB;AACxB,IAAMC,gBAAgB;AAMtB,IAAMC,eAAe,MAAA;AACnB,QAAMC,QAAQC,OAAsB;IAClCC,UAAU,aAAa,CAAC;IACxBC,MAAM,aAAa,CAAC;IACpBC,SAAS,CAAA;IACTC,kBAAkB,MAAM,MAAA;IAAO;EACjC,CAAA;AAEA,QAAMC,mBAAmB,oBAAIC,IAAAA;AAE7B,SAAO;IACLC,MAAMC;IACNC,OAAO,OAAOC,YAAAA;AAEZ,YAAMT,WAAW,OAAOU,WAAAA;AACtBC,YAAI,YAAY;UAAEC,QAAQF,OAAOE;UAAQF;QAAO,GAAA;;;;;;AAChD,YAAIA,OAAOG,QAAQ;AACjB,qBAAWC,SAASV,kBAAkB;AACpC,gBAAIU,MAAMD,WAAWH,OAAOG,QAAQ;AAClC,oBAAME,UAAS,MAAMD,MAAME,SAASN,QAAQD,OAAAA;AAC5C,kBAAIM,SAAQ;AACV,uBAAOA;cACT;YACF;UACF;AAEA,gBAAMF,SAASI,WAAmCR,SAASC,OAAOG,MAAM;AACxE,gBAAME,SAASF,QAAQK,SAASR,OAAOM,SAASN,QAAQD,OAAAA;AACxD,iBAAOM;QACT;AAEA,mBAAWD,SAASV,kBAAkB;AACpC,gBAAMW,S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ACjD;AAEA,YAAI6C,WAAWZ,gBAAAA,GAAmB;AAChC,eAAK7B,SAAS;YAAEY,QAAQ8B,aAAaC;YAAWR,MAAM;cAAES,SAASf;YAAiB;UAAE,CAAA;QACtF;AAEA,eAAOA,iBAAiBK,GAAG,EAAC,GAAInB;MAClC;AAEA,YAAMd,OAAO,YAAA;AACX,cAAM4C,OAAO/C,MAAMI,QAAQ4C,cAAcL,UAAAA;AACzC,cAAMX,QACJe,SAAS,MACT/C,MAAMI,QAAQ2C,IAAAA,GAAOE,IAAI,CAAC,EAAErC,QAAQK,OAAM,MAAE;AAC1C,gBAAMoB,OAAOpB,OAAOiC,UAAUb,OAAO;YAAE,GAAGzB,OAAOyB;YAAM,GAAGpB,OAAOiC,SAASb;UAAK,IAAIzB,OAAOyB;AAC1F,iBAAO;YAAE,GAAGzB;YAAQyB;YAAMlC,MAAM;UAAK;QACvC,CAAA;AACF,YAAI6B,OAAO;AACT,gBAAMf,SAAS,MAAMS,cAAcM,KAAAA;AACnChC,gBAAMI,UAAUJ,MAAMI,QAAQ+C,OAAO,CAACC,GAAGC,UAAUA,UAAUN,IAAAA;AAC7D,iBAAO9B;QACT;MACF;AAEAjB,YAAME,WAAWwB;AACjB1B,YAAMG,OAAOA;AACbH,YAAMK,mBAAmB,CAACU,QAAQG,aAAAA;AAChC,cAAMF,QAAQ;UAAED;UAAQG;QAAS;AACjCZ,yBAAiBgD,IAAItC,KAAAA;AACrB,eAAO,MAAMV,iBAAiBiD,OAAOvC,KAAAA;MACvC;IACF;IACAI,UAAU;MACRR,QAAQZ;MACRwD,SAAS,CAAC,EAAEC,SAAQ,MAAO,sBAAA,cAACC,gBAAAA;QAAeC,OAAO3D;SAAQyD,QAAAA;IAC5D;EACF;AACF;AAEA,IAAA,iBAAe1D;",
|
|
6
|
+
"names": ["React", "create", "log", "isUndoable", "chain", "length", "every", "result", "undoable", "EXECUTION_LIMIT", "HISTORY_LIMIT", "IntentPlugin", "state", "create", "dispatch", "undo", "history", "registerResolver", "dynamicResolvers", "Set", "meta", "IntentMeta", "ready", "plugins", "intent", "log", "action", "plugin", "entry", "result", "resolver", "findPlugin", "provides", "filterPlugins", "parseIntentResolverPlugin", "env", "DEV", "warn", "dispatchChain", "intentOrArray", "depth", "error", "Error", "executionResults", "chain", "Array", "isArray", "prevResult", "at", "data", "push", "intents", "forEach", "length", "splice", "isUndoable", "IntentAction", "SHOW_UNDO", "results", "last", "findLastIndex", "map", "undoable", "filter", "_", "index", "add", "delete", "context", "children", "IntentProvider", "value"]
|
|
7
|
+
}
|
package/dist/types/src/App.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type BootstrapPluginsParams } from './plugins';
|
|
|
5
5
|
* Initializes plugins and renders the root components.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* const
|
|
8
|
+
* const meta = [LayoutMeta, MyPluginMeta];
|
|
9
9
|
* const plugins = {
|
|
10
10
|
* [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),
|
|
11
11
|
* [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),
|
|
@@ -20,11 +20,11 @@ import { type BootstrapPluginsParams } from './plugins';
|
|
|
20
20
|
* </StrictMode>,
|
|
21
21
|
* );
|
|
22
22
|
*
|
|
23
|
-
* @param params.order Total ordering of plugins.
|
|
24
23
|
* @param params.plugins All plugins available to the application.
|
|
24
|
+
* @param params.meta All plugin metadata.
|
|
25
25
|
* @param params.core Core plugins which will always be enabled.
|
|
26
|
-
* @param params.
|
|
26
|
+
* @param params.defaults Default plugins are enabled by default but can be disabled by the user.
|
|
27
27
|
* @param params.fallback Fallback component to render while plugins are initializing.
|
|
28
28
|
*/
|
|
29
|
-
export declare const createApp: ({
|
|
29
|
+
export declare const createApp: ({ meta, plugins, core, ...params }: BootstrapPluginsParams) => () => React.JSX.Element;
|
|
30
30
|
//# sourceMappingURL=App.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/App.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,sBAAsB,EAAsB,MAAM,WAAW,CAAC;AAI5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/App.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,sBAAsB,EAAsB,MAAM,WAAW,CAAC;AAI5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,uCAAwC,sBAAsB,4BAuBnF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type JSX, type ReactNode } from 'react';
|
|
2
|
+
import { type PluginContext } from './PluginContext';
|
|
3
|
+
import { type BootstrapPluginsParams } from './PluginHost';
|
|
4
|
+
import { type PluginDefinition } from './plugin';
|
|
5
|
+
export type PluginContainerProps = Pick<BootstrapPluginsParams, 'core'> & {
|
|
6
|
+
plugins: Record<string, () => Promise<PluginDefinition>>;
|
|
7
|
+
state: PluginContext;
|
|
8
|
+
placeholder: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Root component initializes plugins.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PluginContainer: ({ plugins: definitions, core, state, placeholder }: PluginContainerProps) => JSX.Element;
|
|
14
|
+
//# sourceMappingURL=PluginContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginContainer.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginContainer.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,GAAG,EAAmC,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAI9G,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAe,KAAK,gBAAgB,EAAuB,MAAM,UAAU,CAAC;AAEnF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,GAAG;IACxE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACzD,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,uDAAwD,oBAAoB,gBA2DvG,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type Plugin } from './plugin';
|
|
1
|
+
import { type Plugin, type PluginMeta } from './plugin';
|
|
3
2
|
export type PluginContext = {
|
|
4
3
|
/**
|
|
5
4
|
* All plugins are ready.
|
|
@@ -19,8 +18,9 @@ export type PluginContext = {
|
|
|
19
18
|
plugins: Plugin[];
|
|
20
19
|
/**
|
|
21
20
|
* All available plugins.
|
|
21
|
+
* NOTE: This is metadata rather than just ids because it includes plugins which have not been fully loaded yet.
|
|
22
22
|
*/
|
|
23
|
-
available:
|
|
23
|
+
available: PluginMeta[];
|
|
24
24
|
/**
|
|
25
25
|
* Mark plugin as enabled.
|
|
26
26
|
* Requires reload to take effect.
|
|
@@ -43,5 +43,5 @@ export declare const useResolvePlugin: <T>(predicate: (plugin: Plugin) => Plugin
|
|
|
43
43
|
* Resolve a collection of plugins by predicate.
|
|
44
44
|
*/
|
|
45
45
|
export declare const useResolvePlugins: <T>(predicate: (plugin: Plugin) => Plugin<T> | undefined) => Plugin<T>[];
|
|
46
|
-
export declare const PluginProvider: Provider<PluginContext>;
|
|
46
|
+
export declare const PluginProvider: import("react").Provider<PluginContext | undefined>;
|
|
47
47
|
//# sourceMappingURL=PluginContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginContext.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAGxD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB;;;OAGG;IACH,SAAS,EAAE,UAAU,EAAE,CAAC;IAExB;;;OAGG;IACH,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,UAAU,QAAO,aAAuF,CAAC;AAEtH;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,MAAO,MAAM,KAAG,MAAM,CAAC,CAAC,CAAC,GAAG,SAGtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,aAAc,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,KAAG,MAAM,CAAC,CAAC,CAAC,GAAG,SAGvG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,aAAc,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,KAAG,MAAM,CAAC,CAAC,CAAC,EAGrG,CAAC;AAEF,eAAO,MAAM,cAAc,qDAAyB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type PluginContext } from './PluginContext';
|
|
3
|
-
import { type Plugin, type PluginDefinition } from './plugin';
|
|
3
|
+
import { type Plugin, type PluginDefinition, type PluginMeta } from './plugin';
|
|
4
4
|
import { ErrorBoundary } from '../SurfacePlugin';
|
|
5
5
|
export type BootstrapPluginsParams = {
|
|
6
|
-
order: PluginDefinition['meta'][];
|
|
7
6
|
plugins: Record<string, () => Promise<PluginDefinition>>;
|
|
8
|
-
|
|
7
|
+
meta: PluginMeta[];
|
|
8
|
+
core: string[];
|
|
9
9
|
defaults?: string[];
|
|
10
10
|
fallback?: ErrorBoundary['props']['fallback'];
|
|
11
11
|
placeholder?: ReactNode;
|
|
@@ -17,9 +17,5 @@ export declare const parsePluginHost: (plugin: Plugin) => Plugin<PluginHostProvi
|
|
|
17
17
|
/**
|
|
18
18
|
* Bootstraps an application by initializing plugins and rendering root components.
|
|
19
19
|
*/
|
|
20
|
-
export declare const PluginHost: ({
|
|
21
|
-
/**
|
|
22
|
-
* Resolve a `PluginDefinition` into a fully initialized `Plugin`.
|
|
23
|
-
*/
|
|
24
|
-
export declare const initializePlugin: <T, U>(pluginDefinition: PluginDefinition<T, U>) => Promise<Plugin<T & U>>;
|
|
20
|
+
export declare const PluginHost: ({ plugins, meta, core, defaults, fallback, placeholder, }: BootstrapPluginsParams) => PluginDefinition<PluginHostProvides>;
|
|
25
21
|
//# sourceMappingURL=PluginHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginHost.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginHost.tsx"],"names":[],"mappings":"AAIA,OAAc,
|
|
1
|
+
{"version":3,"file":"PluginHost.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginHost.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9C,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEzD,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,MAAM,2CACwD,CAAC;AAIvG;;GAEG;AACH,eAAO,MAAM,UAAU,8DAOpB,sBAAsB,KAAG,gBAAgB,CAAC,kBAAkB,CAuC9D,CAAC"}
|